var Og = Object.defineProperty;
var Ig = (t, e, l) => e in t ? Og(t, e, { enumerable: !0, configurable: !0, writable: !0, value: l }) : t[e] = l;
var nr = (t, e, l) => (Ig(t, typeof e != "symbol" ? e + "" : e, l), l);
function ae() {
}
const Dg = (t) => t;
function ts(t, e) {
  for (const l in e)
    t[l] = e[l];
  return (
    /** @type {T & S} */
    t
  );
}
function wm(t) {
  return t();
}
function ls() {
  return /* @__PURE__ */ Object.create(null);
}
function vt(t) {
  t.forEach(wm);
}
function $m(t) {
  return typeof t == "function";
}
function Le(t, e) {
  return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
}
function Rg(t) {
  return Object.keys(t).length === 0;
}
function rt(t, ...e) {
  if (t == null) {
    for (const i of e)
      i(void 0);
    return ae;
  }
  const l = t.subscribe(...e);
  return l.unsubscribe ? () => l.unsubscribe() : l;
}
function at(t, e, l) {
  t.$$.on_destroy.push(rt(e, l));
}
function Gt(t) {
  return t ?? "";
}
function Ba(t, e, l) {
  return t.set(l), e;
}
const qm = typeof window < "u";
let Hg = qm ? () => window.performance.now() : () => Date.now(), jm = qm ? (t) => requestAnimationFrame(t) : ae;
const Hi = /* @__PURE__ */ new Set();
function Tm(t) {
  Hi.forEach((e) => {
    e.c(t) || (Hi.delete(e), e.f());
  }), Hi.size !== 0 && jm(Tm);
}
function Fg(t) {
  let e;
  return Hi.size === 0 && jm(Tm), {
    promise: new Promise((l) => {
      Hi.add(e = { c: t, f: l });
    }),
    abort() {
      Hi.delete(e);
    }
  };
}
function _(t, e) {
  t.appendChild(e);
}
function C(t, e, l) {
  t.insertBefore(e, l || null);
}
function T(t) {
  t.parentNode && t.parentNode.removeChild(t);
}
function Ge(t, e) {
  for (let l = 0; l < t.length; l += 1)
    t[l] && t[l].d(e);
}
function m(t) {
  return document.createElement(t);
}
function Xe(t) {
  return document.createElementNS("http://www.w3.org/2000/svg", t);
}
function E(t) {
  return document.createTextNode(t);
}
function A() {
  return E(" ");
}
function Be() {
  return E("");
}
function le(t, e, l, i) {
  return t.addEventListener(e, l, i), () => t.removeEventListener(e, l, i);
}
function f(t, e, l) {
  l == null ? t.removeAttribute(e) : t.getAttribute(e) !== l && t.setAttribute(e, l);
}
function xt(t, e, l) {
  const i = e.toLowerCase();
  i in t ? t[i] = typeof t[i] == "boolean" && l === "" ? !0 : l : e in t ? t[e] = typeof t[e] == "boolean" && l === "" ? !0 : l : f(t, e, l);
}
function Cm(t) {
  return t === "" ? null : +t;
}
function Lg(t) {
  return Array.from(t.childNodes);
}
function Y(t, e) {
  e = "" + e, t.data !== e && (t.data = /** @type {string} */
  e);
}
function dt(t, e) {
  t.value = e ?? "";
}
function Mt(t, e, l, i) {
  l == null ? t.style.removeProperty(e) : t.style.setProperty(e, l, i ? "important" : "");
}
function _l(t, e, l) {
  for (let i = 0; i < t.options.length; i += 1) {
    const n = t.options[i];
    if (n.__value === e) {
      n.selected = !0;
      return;
    }
  }
  (!l || e !== void 0) && (t.selectedIndex = -1);
}
let qn;
function wn(t) {
  qn = t;
}
function Sm() {
  if (!qn)
    throw new Error("Function called outside component initialization");
  return qn;
}
function yt(t) {
  Sm().$$.on_mount.push(t);
}
function fi(t) {
  Sm().$$.on_destroy.push(t);
}
const Di = [], is = [];
let Fi = [];
const ns = [], Qg = /* @__PURE__ */ Promise.resolve();
let jr = !1;
function Vg() {
  jr || (jr = !0, Qg.then(Mm));
}
function Tr(t) {
  Fi.push(t);
}
const ar = /* @__PURE__ */ new Set();
let _i = 0;
function Mm() {
  if (_i !== 0)
    return;
  const t = qn;
  do {
    try {
      for (; _i < Di.length; ) {
        const e = Di[_i];
        _i++, wn(e), Xg(e.$$);
      }
    } catch (e) {
      throw Di.length = 0, _i = 0, e;
    }
    for (wn(null), Di.length = 0, _i = 0; is.length; )
      is.pop()();
    for (let e = 0; e < Fi.length; e += 1) {
      const l = Fi[e];
      ar.has(l) || (ar.add(l), l());
    }
    Fi.length = 0;
  } while (Di.length);
  for (; ns.length; )
    ns.pop()();
  jr = !1, ar.clear(), wn(t);
}
function Xg(t) {
  if (t.fragment !== null) {
    t.update(), vt(t.before_update);
    const e = t.dirty;
    t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(Tr);
  }
}
function Gg(t) {
  const e = [], l = [];
  Fi.forEach((i) => t.indexOf(i) === -1 ? e.push(i) : l.push(i)), l.forEach((i) => i()), Fi = e;
}
const Ca = /* @__PURE__ */ new Set();
let li;
function ge() {
  li = {
    r: 0,
    c: [],
    p: li
    // parent group
  };
}
function be() {
  li.r || vt(li.c), li = li.p;
}
function S(t, e) {
  t && t.i && (Ca.delete(t), t.i(e));
}
function D(t, e, l, i) {
  if (t && t.o) {
    if (Ca.has(t))
      return;
    Ca.add(t), li.c.push(() => {
      Ca.delete(t), i && (l && t.d(1), i());
    }), t.o(e);
  } else
    i && i();
}
function we(t) {
  return (t == null ? void 0 : t.length) !== void 0 ? t : Array.from(t);
}
function he(t) {
  t && t.c();
}
function ce(t, e, l) {
  const { fragment: i, after_update: n } = t.$$;
  i && i.m(e, l), Tr(() => {
    const a = t.$$.on_mount.map(wm).filter($m);
    t.$$.on_destroy ? t.$$.on_destroy.push(...a) : vt(a), t.$$.on_mount = [];
  }), n.forEach(Tr);
}
function de(t, e) {
  const l = t.$$;
  l.fragment !== null && (Gg(l.after_update), vt(l.on_destroy), l.fragment && l.fragment.d(e), l.on_destroy = l.fragment = null, l.ctx = []);
}
function Yg(t, e) {
  t.$$.dirty[0] === -1 && (Di.push(t), Vg(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31;
}
function Qe(t, e, l, i, n, a, r = null, s = [-1]) {
  const o = qn;
  wn(t);
  const u = t.$$ = {
    fragment: null,
    ctx: [],
    // state
    props: a,
    update: ae,
    not_equal: n,
    bound: ls(),
    // lifecycle
    on_mount: [],
    on_destroy: [],
    on_disconnect: [],
    before_update: [],
    after_update: [],
    context: new Map(e.context || (o ? o.$$.context : [])),
    // everything else
    callbacks: ls(),
    dirty: s,
    skip_bound: !1,
    root: e.target || o.$$.root
  };
  r && r(u.root);
  let c = !1;
  if (u.ctx = l ? l(t, e.props || {}, (d, h, ...p) => {
    const b = p.length ? p[0] : h;
    return u.ctx && n(u.ctx[d], u.ctx[d] = b) && (!u.skip_bound && u.bound[d] && u.bound[d](b), c && Yg(t, d)), h;
  }) : [], u.update(), c = !0, vt(u.before_update), u.fragment = i ? i(u.ctx) : !1, e.target) {
    if (e.hydrate) {
      const d = Lg(e.target);
      u.fragment && u.fragment.l(d), d.forEach(T);
    } else
      u.fragment && u.fragment.c();
    e.intro && S(t.$$.fragment), ce(t, e.target, e.anchor), Mm();
  }
  wn(o);
}
class Ve {
  constructor() {
    /**
     * ### PRIVATE API
     *
     * Do not use, may change at any time
     *
     * @type {any}
     */
    nr(this, "$$");
    /**
     * ### PRIVATE API
     *
     * Do not use, may change at any time
     *
     * @type {any}
     */
    nr(this, "$$set");
  }
  /** @returns {void} */
  $destroy() {
    de(this, 1), this.$destroy = ae;
  }
  /**
   * @template {Extract<keyof Events, string>} K
   * @param {K} type
   * @param {((e: Events[K]) => void) | null | undefined} callback
   * @returns {() => void}
   */
  $on(e, l) {
    if (!$m(l))
      return ae;
    const i = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
    return i.push(l), () => {
      const n = i.indexOf(l);
      n !== -1 && i.splice(n, 1);
    };
  }
  /**
   * @param {Partial<Props>} props
   * @returns {void}
   */
  $set(e) {
    this.$$set && !Rg(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
  }
}
const Kg = "4";
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(Kg);
const ci = [];
function Pe(t, e = ae) {
  let l;
  const i = /* @__PURE__ */ new Set();
  function n(s) {
    if (Le(t, s) && (t = s, l)) {
      const o = !ci.length;
      for (const u of i)
        u[1](), ci.push(u, t);
      if (o) {
        for (let u = 0; u < ci.length; u += 2)
          ci[u][0](ci[u + 1]);
        ci.length = 0;
      }
    }
  }
  function a(s) {
    n(s(t));
  }
  function r(s, o = ae) {
    const u = [s, o];
    return i.add(u), i.size === 1 && (l = e(n, a) || ae), s(t), () => {
      i.delete(u), i.size === 0 && l && (l(), l = null);
    };
  }
  return { set: n, update: a, subscribe: r };
}
const $e = 24, At = 6, Ze = 6, as = 48, tt = 24, Ie = 10, di = 12, tn = 14, bl = 48, Cl = 24, Bt = 70, Ug = 25, Ol = 16, ze = "#000000", it = "#ffffff", rs = 70, ln = 10, Ut = [
  "#4285f4",
  "#db4437",
  "#f4b400",
  "#0f9d58",
  "#ab47bc",
  "#00acc1",
  "#ff7043",
  "#9e9d24",
  "#5c6bc0",
  "#f06292",
  "#00796b",
  "#c2185b",
  "#7e57c2",
  "#03a9f4",
  "#8bc34a",
  "#fdd835",
  "#fb8c00",
  "#8d6e63",
  "#9e9e9e",
  "#607d8b"
], Wg = [
  // no-target
  "cp"
], Jg = [
  // single-target
  "mcx",
  "cccx",
  "c3x",
  "ccccx",
  "c4x",
  "ccx",
  "c2x",
  "ch",
  "cs",
  "csdg",
  "csx",
  "cx",
  "cy",
  "cz",
  "ccz",
  "crx",
  "cry",
  "crz",
  "cu",
  "cu1",
  "cu3",
  "rccx",
  "rcccx"
], Zg = [
  // double-target
  "cswap"
], xg = [
  "cswap",
  "iswap",
  "swap"
];
function nt(t, e) {
  let l = t.qubits.map((o) => o.index);
  e && (l = l.map((o) => e[o]));
  let i = Math.min(...l), n = Math.max(...l), a = t.num_clbits > 0, r = 0, s = 0;
  if (t.num_qubits == 1 && !a)
    r = (At + $e) * i, s = $e;
  else if (a) {
    r = (At + $e) * i;
    let u = (e ? Object.keys(e).length : t.qubits[0].register.size) - i + 1;
    s = At * u + $e * (u + 1);
  } else {
    r = (At + $e) * i;
    let o = n - i;
    s = At * o + $e * (o + 1);
  }
  return {
    y: r,
    height: s
  };
}
function kt(t, e, l) {
  let i = 0, n = t.qubits.map((s) => s.index);
  l && (n = n.map((s) => l[s]));
  let a = Math.min(...n), r = l[e.index] - a;
  return i = (At + $e) * r, i;
}
let Hl = tt, hi = "cx", ss = {
  name: hi,
  width: Hl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${hi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Hl,
      height: 0,
      elem: []
    }, n = t.qubits[0], a = t.qubits[1], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = kt(t, n, l), o = kt(t, a, l), u = {
      id: `layer-${e}--${hi}--connect`,
      type: "line",
      x1: Hl / 2 - 0.5,
      x2: Hl / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + (o > s ? 0 : $e),
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = {
      id: `layer-${e}--${hi}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: ze,
      width: 6,
      height: 6,
      x: Hl / 2 - 3,
      y: s + $e / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${hi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: Hl,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${hi}--target-marker`,
      type: "text",
      x: Hl / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "X"
    };
    return i.elem.push(h), i;
  }
}, Nn = tt * 1.65, pi = "iswap", os = {
  name: pi,
  width: Nn,
  plan: function(t, e, l) {
    var u, c;
    let i = {
      id: `layer-${e}--${pi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Nn,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${pi}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: Nn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${pi}--qubit-1`,
      type: "text",
      x: Ze / 2,
      y: $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (u = t.qubits[0]) == null ? void 0 : u.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${pi}--qubit-2`,
      type: "text",
      x: Ze / 2,
      y: n.height - $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (c = t.qubits[1]) == null ? void 0 : c.index
    };
    i.elem.push(s);
    let o = {
      id: `layer-${e}--${pi}--marker`,
      type: "text",
      x: Nn - Ze / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: "ISWAP"
    };
    return i.elem.push(o), i;
  }
}, Fl = tt, mi = "measure", us = {
  name: mi,
  width: Fl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${mi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Fl,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height - $e - Ie;
    let a = {
      id: `layer-${e}--${mi}--qubit`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: Fl,
      x: 0,
      y: 0,
      height: $e
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${mi}--marker`,
      type: "text",
      x: Fl / 2,
      y: $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "M"
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${mi}--connect`,
      type: "line",
      x1: Fl / 2 - 0.5,
      x2: Fl / 2 - 0.5,
      y1: $e,
      y2: n.height - $e * 2 + At,
      "stroke-width": 1
    };
    i.elem.push(s);
    let o = {
      id: `layer-${e}--${mi}--clbit`,
      type: "text",
      x: Fl / 2,
      y: n.height + At - $e * 1.5,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: t.clbits[0].index,
      "font-size": 12,
      role: "clbit",
      data: t.clbits[0]
    };
    return i.elem.push(o), i;
  }
}, e0 = [2, 3, 4, 6, 8, 16, 32];
function Gi(t, e) {
  let l = t / Math.PI;
  if (l == 0)
    return "0";
  if (l == 1)
    return "π";
  if (l == -1)
    return "-π";
  {
    let i = l < 0 ? "-" : "", n = Math.abs(l).toPrecision(8), a = [];
    for (let r of e0)
      for (let s = 1; s < r; s++) {
        let o = (s / r).toPrecision(8);
        if (!a.includes(o)) {
          if (n == o)
            return i + (s == 1 ? "" : s) + "π/" + r;
          a.push(o);
        }
      }
    return e ? t : Math.round(t * 100) / 100;
  }
}
function t0(t) {
  let e = t.length;
  if (e <= 1)
    return null;
  let l = 100 / (e - 1);
  return t.map((n, a) => ({
    offset: l * a + "%",
    "stop-color": n
  }));
}
const rr = "http://www.w3.org/2000/svg";
function l0(t, e) {
  let l = document.querySelector(`#${t} defs`), i = document.querySelector(`#${t}`);
  l || (l = document.createElementNS(rr, "defs"));
  let n = document.createElementNS(rr, "linearGradient");
  n.setAttribute("id", e.id), n.setAttribute("x1", 0), n.setAttribute("x2", 0), n.setAttribute("y1", 0), n.setAttribute("y2", 1), e.grad_data.forEach((a) => {
    let r = document.createElementNS(rr, "stop");
    r.setAttribute("offset", a.offset), r.setAttribute("stop-color", a["stop-color"]), n.appendChild(r);
  }), l.appendChild(n), i.appendChild(l);
}
function Li(t, e) {
  let l = document.getElementById(t), i = l.clientWidth, n = l.clientHeight, r = new XMLSerializer().serializeToString(l);
  r.match(/^<svg[^>]+xmlns="http\:\/\/www\.w3\.org\/2000\/svg"/) || (r = r.replace(
    /^<svg/,
    '<svg xmlns="http://www.w3.org/2000/svg"'
  )), r.match(/^<svg[^>]+"http\:\/\/www\.w3\.org\/1999\/xlink"/) || (r = r.replace(
    /^<svg/,
    '<svg xmlns:xlink="http://www.w3.org/1999/xlink"'
  )), r = `<?xml version="1.0" standalone="no"?>\r
` + r;
  let s = new Blob([r], { type: "image/svg+xml;charset=utf-8" }), o = URL.createObjectURL(s), u = document.createElement("canvas");
  u.setAttribute("width", i), u.setAttribute("height", n), document.body.appendChild(u);
  let c = u.getContext("2d"), d = new Image();
  d.onload = () => {
    c.drawImage(d, 0, 0);
    let h = u.toDataURL("image/png");
    URL.revokeObjectURL(h), e && e.set && e.set({ png: h, id: t, svg: o }), u.remove();
  }, d.src = o;
}
function fs(t, e) {
  let l = Math.pow(10, e);
  return Math.round(t * l) / l;
}
function Nt(t) {
  if (typeof t == "number")
    return Gi(t);
  if (typeof t == "string")
    return t;
  if (t instanceof Object) {
    if (t.expr !== void 0)
      return t.expr.match(/^\-?[0-9]+(\.[0-9]+)?$/gi) ? Gi(parseFloat(t.expr)) : t.expr;
    if (t.vector !== void 0 && t.index !== void 0)
      return `${t.vector}[${t.index}]`;
  }
}
let nn = tt * 2.3, An = "rz", _s = {
  name: An,
  width: nn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${An}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: nn,
      height: nn,
      elem: []
    }, n = `Rz(${Nt(t.params[0])})`, a = nt(t, l);
    i.y = a.y, i.height = a.height;
    let r = {
      id: `layer-${e}--${An}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: nn,
      x: 0,
      y: 0,
      height: a.height
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${An}--marker`,
      type: "text",
      x: nn / 2,
      y: a.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: n.length > 9 ? n.substring(0, 6) + "…" : n
    };
    return i.elem.push(s), i;
  }
}, Bn = tt, Pn = "sx", cs = {
  name: Pn,
  width: Bn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Pn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Bn,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Pn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: Bn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Pn}--marker`,
      type: "text",
      x: Bn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "√X"
    };
    return i.elem.push(r), i;
  }
}, sr = tt * 1.65, i0 = "custom", n0 = {
  name: i0,
  is_custom: !0,
  width: sr,
  plan: function(t, e, l, i) {
    let n = {
      id: `layer-${l}--${e}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: sr,
      height: 0,
      elem: []
    }, a = nt(t, i);
    n.y = a.y, n.height = a.height;
    let r = e.toUpperCase().length;
    n.width = Math.max(
      sr,
      r * 0.75 * 9 + 10
    );
    let s = {
      id: `layer-${l}--${e}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: n.width,
      x: 0,
      y: 0,
      height: a.height
    };
    n.elem.push(s);
    let o = 0;
    for (const c of t.qubits) {
      let d = nt({
        qubits: [c],
        num_clbits: 0,
        num_qubits: 1
      }), h = {
        id: `layer-${l}--${e}--qubit-${o}`,
        type: "text",
        x: Ze / 2,
        y: d.y + $e / 2 - a.y,
        "text-anchor": "start",
        "alignment-baseline": "middle",
        text: c == null ? void 0 : c.index
      };
      n.elem.push(h), o++;
    }
    let u = {
      id: `layer-${l}--${e}--marker`,
      type: "text",
      x: n.width - Ze / 2,
      y: a.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: e.toUpperCase()
    };
    return n.elem.push(u), n;
  }
}, or = 10, ur = "barrier", ds = {
  name: ur,
  is_custom: !0,
  width: or,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${ur}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: or,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${ur}--wrap`,
      type: "rect",
      "stroke-width": 1,
      stroke: "#cccccc",
      fill: "#cccccc",
      width: or,
      x: 0,
      y: 0,
      height: n.height
    };
    return i.elem.push(a), i;
  }
}, En = tt, On = "h", hs = {
  name: On,
  width: En,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${On}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: En,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${On}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: En,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${On}--marker`,
      type: "text",
      x: En / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "H"
    };
    return i.elem.push(r), i;
  }
}, In = tt, Dn = "x", ps = {
  name: Dn,
  width: In,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Dn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: In,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Dn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: In,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Dn}--marker`,
      type: "text",
      x: In / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "X"
    };
    return i.elem.push(r), i;
  }
}, Rn = tt, an = "y", ms = {
  name: an,
  width: Rn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${an}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Rn,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${an}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: Rn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${an}--marker`,
      type: "text",
      x: Rn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: an.toUpperCase()
    };
    return i.elem.push(r), i;
  }
}, fr = tt, _r = "z", gs = {
  name: _r,
  width: fr,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${_r}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: fr,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${_r}--marker`,
      type: "rect",
      "stroke-width": 0,
      fill: ze,
      width: 6,
      height: 6,
      x: fr / 2 - 3,
      y: $e / 2 - 3
    };
    return i.elem.push(a), i;
  }
}, Hn = tt, Fn = "id", bs = {
  name: Fn,
  width: Hn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Fn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Hn,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Fn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: Hn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Fn}--marker`,
      type: "text",
      x: Hn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "I"
    };
    return i.elem.push(r), i;
  }
}, Ln = tt, rn = "s", vs = {
  name: rn,
  width: Ln,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${rn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Ln,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${rn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: Ln,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${rn}--marker`,
      type: "text",
      x: Ln / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: rn.toUpperCase()
    };
    return i.elem.push(r), i;
  }
}, Qn = tt, Vn = "sdg", ks = {
  name: Vn,
  width: Qn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Vn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Qn,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Vn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: Qn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Vn}--marker`,
      type: "text",
      x: Qn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "S†"
    };
    return i.elem.push(r), i;
  }
}, Xn = tt, Gn = "sxdg", ys = {
  name: Gn,
  width: Xn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Gn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Xn,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Gn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: Xn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Gn}--marker`,
      type: "text",
      x: Xn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "√X†"
    };
    return i.elem.push(r), i;
  }
}, Yn = tt, sn = "t", ws = {
  name: sn,
  width: Yn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${sn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Yn,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${sn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: Yn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${sn}--marker`,
      type: "text",
      x: Yn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: sn.toUpperCase()
    };
    return i.elem.push(r), i;
  }
}, Kn = tt, Un = "tdg", $s = {
  name: Un,
  width: Kn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Un}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Kn,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Un}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: Kn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Un}--marker`,
      type: "text",
      x: Kn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "T†"
    };
    return i.elem.push(r), i;
  }
}, Wn = tt * 2.8, Jn = "r", qs = {
  name: Jn,
  width: Wn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Jn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Wn,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Jn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: Wn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Jn}--marker`,
      type: "text",
      x: Wn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `R(${Nt(t.params[0])},${Nt(t.params[1])})`
    };
    return i.elem.push(r), i;
  }
}, Zn = tt * 2.3, xn = "rx", js = {
  name: xn,
  width: Zn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${xn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Zn,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${xn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: Zn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${xn}--marker`,
      type: "text",
      x: Zn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `Rx(${Nt(t.params[0])})`
    };
    return i.elem.push(r), i;
  }
}, ea = tt * 2.3, ta = "ry", Ts = {
  name: ta,
  width: ea,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${ta}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ea,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${ta}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: ea,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${ta}--marker`,
      type: "text",
      x: ea / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `Ry(${Nt(t.params[0])})`
    };
    return i.elem.push(r), i;
  }
}, la = tt * 2.25, ia = "p", Cs = {
  name: ia,
  width: la,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${ia}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: la,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${ia}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: la,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${ia}--marker`,
      type: "text",
      x: la / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `P(${Nt(t.params[0])})`
    };
    return i.elem.push(r), i;
  }
}, na = tt * 4, aa = "u", Ss = {
  name: aa,
  width: na,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${aa}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: na,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${aa}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: na,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${aa}--marker`,
      type: "text",
      x: na / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `U(${Nt(t.params[0])},${Nt(t.params[1])},${Nt(t.params[2])})`
    };
    return i.elem.push(r), i;
  }
}, ra = tt * 2.3, sa = "u1", Ms = {
  name: sa,
  width: ra,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${sa}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ra,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${sa}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: ra,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${sa}--marker`,
      type: "text",
      x: ra / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `U1(${Nt(t.params[0])})`
    };
    return i.elem.push(r), i;
  }
}, oa = tt * 2.6, ua = "u2", zs = {
  name: ua,
  width: oa,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${ua}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: oa,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${ua}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: oa,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${ua}--marker`,
      type: "text",
      x: oa / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `U2(${Nt(t.params[0])},${Nt(t.params[1])})`
    };
    return i.elem.push(r), i;
  }
}, fa = tt * 3, _a = "u3", Ns = {
  name: _a,
  width: fa,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${_a}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: fa,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${_a}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: fa,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${_a}--marker`,
      type: "text",
      x: fa / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `U3(${Nt(t.params[0])},${Nt(t.params[1])},${Nt(t.params[2])})`
    };
    return i.elem.push(r), i;
  }
}, ca = tt * 1.4, gi = "ecr", As = {
  name: gi,
  width: ca,
  plan: function(t, e, l) {
    var u, c;
    let i = {
      id: `layer-${e}--${gi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ca,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${gi}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: ca,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${gi}--qubit-1`,
      type: "text",
      x: Ze / 2,
      y: $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (u = t.qubits[0]) == null ? void 0 : u.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${gi}--qubit-2`,
      type: "text",
      x: Ze / 2,
      y: n.height - $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (c = t.qubits[1]) == null ? void 0 : c.index
    };
    i.elem.push(s);
    let o = {
      id: `layer-${e}--${gi}--marker`,
      type: "text",
      x: ca - Ze / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: "ECR"
    };
    return i.elem.push(o), i;
  }
}, Ll = tt, bi = "mcx", a0 = {
  name: bi,
  width: Ll,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${bi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Ll,
      height: 0,
      elem: []
    }, n = t.qubits.slice(0, -1), a = t.qubits.slice(-1)[0], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = n.map((g) => kt(t, g, l)), o = kt(t, a, l), u = Math.min(...s, o), c = Math.max(...s, o), d = {
      id: `layer-${e}--${bi}--connect`,
      type: "line",
      x1: Ll / 2 - 0.5,
      x2: Ll / 2 - 0.5,
      y1: u + $e / 2,
      y2: c + $e / 2,
      "stroke-width": 1
    };
    i.elem.push(d);
    let h = 0;
    for (let g in n) {
      let v = {
        id: `layer-${e}--${bi}--control` + h,
        type: "rect",
        "stroke-width": 0,
        fill: ze,
        width: 6,
        height: 6,
        x: Ll / 2 - 3,
        y: s[h] + $e / 2 - 3
      };
      i.elem.push(v), h++;
    }
    let p = {
      id: `layer-${e}--${bi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: Ll,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(p);
    let b = {
      id: `layer-${e}--${bi}--target-marker`,
      type: "text",
      x: Ll / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "X"
    };
    return i.elem.push(b), i;
  }
}, Ql = tt, vi = "ch", Bs = {
  name: vi,
  width: Ql,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${vi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Ql,
      height: 0,
      elem: []
    }, n = t.qubits[0], a = t.qubits[1], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = kt(t, n, l), o = kt(t, a, l), u = {
      id: `layer-${e}--${vi}--connect`,
      type: "line",
      x1: Ql / 2 - 0.5,
      x2: Ql / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + (o > s ? 0 : $e),
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = {
      id: `layer-${e}--${vi}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: ze,
      width: 6,
      height: 6,
      x: Ql / 2 - 3,
      y: s + $e / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${vi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: Ql,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${vi}--target-marker`,
      type: "text",
      x: Ql / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "H"
    };
    return i.elem.push(h), i;
  }
}, Vl = tt, ki = "cs", Ps = {
  name: ki,
  width: Vl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${ki}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Vl,
      height: 0,
      elem: []
    }, n = t.qubits[0], a = t.qubits[1], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = kt(t, n, l), o = kt(t, a, l), u = {
      id: `layer-${e}--${ki}--connect`,
      type: "line",
      x1: Vl / 2 - 0.5,
      x2: Vl / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + (o > s ? 0 : $e),
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = {
      id: `layer-${e}--${ki}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: ze,
      width: 6,
      height: 6,
      x: Vl / 2 - 3,
      y: s + $e / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${ki}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: Vl,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${ki}--target-marker`,
      type: "text",
      x: Vl / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "S"
    };
    return i.elem.push(h), i;
  }
}, Xl = tt, yi = "csdg", Es = {
  name: yi,
  width: Xl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${yi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Xl,
      height: 0,
      elem: []
    }, n = t.qubits[0], a = t.qubits[1], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = kt(t, n, l), o = kt(t, a, l), u = {
      id: `layer-${e}--${yi}--connect`,
      type: "line",
      x1: Xl / 2 - 0.5,
      x2: Xl / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + (o > s ? 0 : $e),
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = {
      id: `layer-${e}--${yi}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: ze,
      width: 6,
      height: 6,
      x: Xl / 2 - 3,
      y: s + $e / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${yi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: Xl,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${yi}--target-marker`,
      type: "text",
      x: Xl / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "S†"
    };
    return i.elem.push(h), i;
  }
}, Gl = tt, wi = "csx", Os = {
  name: wi,
  width: Gl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${wi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Gl,
      height: 0,
      elem: []
    }, n = t.qubits[0], a = t.qubits[1], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = kt(t, n, l), o = kt(t, a, l), u = {
      id: `layer-${e}--${wi}--connect`,
      type: "line",
      x1: Gl / 2 - 0.5,
      x2: Gl / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + (o > s ? 0 : $e),
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = {
      id: `layer-${e}--${wi}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: ze,
      width: 6,
      height: 6,
      x: Gl / 2 - 3,
      y: s + $e / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${wi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: Gl,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${wi}--target-marker`,
      type: "text",
      x: Gl / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "√X"
    };
    return i.elem.push(h), i;
  }
}, Yl = tt, $i = "cy", Is = {
  name: $i,
  width: Yl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${$i}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Yl,
      height: 0,
      elem: []
    }, n = t.qubits[0], a = t.qubits[1], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = kt(t, n, l), o = kt(t, a, l), u = {
      id: `layer-${e}--${$i}--connect`,
      type: "line",
      x1: Yl / 2 - 0.5,
      x2: Yl / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + (o > s ? 0 : $e),
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = {
      id: `layer-${e}--${$i}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: ze,
      width: 6,
      height: 6,
      x: Yl / 2 - 3,
      y: s + $e / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${$i}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: Yl,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${$i}--target-marker`,
      type: "text",
      x: Yl / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "Y"
    };
    return i.elem.push(h), i;
  }
}, on = tt, da = "cz", Ds = {
  name: da,
  width: on,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${da}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: on,
      height: 0,
      elem: []
    }, n = t.qubits, a = nt(t, l);
    i.y = a.y, i.height = a.height;
    let r = n.map((d) => kt(t, d, l)), s = Math.min(...r), o = Math.max(...r), u = {
      id: `layer-${e}--${da}--connect`,
      type: "line",
      x1: on / 2 - 0.5,
      x2: on / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + $e / 2,
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = 0;
    for (let d in n) {
      let h = {
        id: `layer-${e}--${da}--control` + c,
        type: "rect",
        "stroke-width": 0,
        fill: ze,
        width: 6,
        height: 6,
        x: on / 2 - 3,
        y: r[c] + $e / 2 - 3
      };
      i.elem.push(h), c++;
    }
    return i;
  }
}, un = tt, ha = "ccz", Rs = {
  name: ha,
  width: un,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${ha}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: un,
      height: 0,
      elem: []
    }, n = t.qubits, a = nt(t, l);
    i.y = a.y, i.height = a.height;
    let r = n.map((d) => kt(t, d, l)), s = Math.min(...r), o = Math.max(...r), u = {
      id: `layer-${e}--${ha}--connect`,
      type: "line",
      x1: un / 2 - 0.5,
      x2: un / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + $e / 2,
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = 0;
    for (let d in n) {
      let h = {
        id: `layer-${e}--${ha}--control` + c,
        type: "rect",
        "stroke-width": 0,
        fill: ze,
        width: 6,
        height: 6,
        x: un / 2 - 3,
        y: r[c] + $e / 2 - 3
      };
      i.elem.push(h), c++;
    }
    return i;
  }
}, fn = tt, pa = "swap", Hs = {
  name: pa,
  width: fn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${pa}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: fn,
      height: 0,
      elem: []
    }, n = t.qubits, a = nt(t, l);
    i.y = a.y, i.height = a.height;
    let r = n.map((d) => kt(t, d, l)), s = Math.min(...r), o = Math.max(...r), u = {
      id: `layer-${e}--${pa}--connect`,
      type: "line",
      x1: fn / 2 - 0.5,
      x2: fn / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + $e / 2,
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = 0;
    for (let d in n) {
      let h = {
        id: `layer-${e}--${pa}--swap-${c}-marker`,
        type: "x",
        cx: fn / 2,
        cy: r[c] + $e / 2,
        width: tt / 2,
        height: tt / 2,
        "stroke-width": 1,
        stroke: ze
      };
      i.elem.push(h), c++;
    }
    return i;
  }
}, cr = tt * 2 + At, vl = "dcx", Fs = {
  name: vl,
  width: cr,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${vl}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: cr,
      height: 0,
      elem: []
    }, n = (cr - At) / 2;
    {
      let r = t.qubits[0], s = t.qubits[1], o = nt(t, l);
      i.y = o.y, i.height = o.height;
      let u = kt(t, r, l), c = kt(t, s, l), d = {
        id: `layer-${e}--${vl}--1--connect`,
        type: "line",
        x1: n / 2 - 0.5,
        x2: n / 2 - 0.5,
        y1: u + $e / 2,
        y2: c + (c > u ? 0 : $e),
        "stroke-width": 1
      };
      i.elem.push(d);
      let h = {
        id: `layer-${e}--${vl}--1--control`,
        type: "rect",
        "stroke-width": 0,
        fill: ze,
        width: 6,
        height: 6,
        x: n / 2 - 3,
        y: u + $e / 2 - 3
      };
      i.elem.push(h);
      let p = {
        id: `layer-${e}--${vl}--1--target-box`,
        type: "rect",
        "stroke-width": 1,
        stroke: ze,
        fill: it,
        width: n,
        x: 0,
        y: c,
        height: $e
      };
      i.elem.push(p);
      let b = {
        id: `layer-${e}--${vl}--1--target-marker`,
        type: "text",
        x: n / 2,
        y: c + $e / 2,
        "text-anchor": "middle",
        "alignment-baseline": "middle",
        text: "X"
      };
      i.elem.push(b);
    }
    let a = n + At;
    {
      let r = t.qubits[1], s = t.qubits[0], o = nt(t, l);
      i.y = o.y, i.height = o.height;
      let u = kt(t, r, l), c = kt(t, s, l), d = {
        id: `layer-${e}--${vl}--2--connect`,
        type: "line",
        x1: a + n / 2 - 0.5,
        x2: a + n / 2 - 0.5,
        y1: u + $e / 2,
        y2: c + (c > u ? 0 : $e),
        "stroke-width": 1
      };
      i.elem.push(d);
      let h = {
        id: `layer-${e}--${vl}--2--control`,
        type: "rect",
        "stroke-width": 0,
        fill: ze,
        width: 6,
        height: 6,
        x: a + n / 2 - 3,
        y: u + $e / 2 - 3
      };
      i.elem.push(h);
      let p = {
        id: `layer-${e}--${vl}--2--target-box`,
        type: "rect",
        "stroke-width": 1,
        stroke: ze,
        fill: it,
        width: n,
        x: a,
        y: c,
        height: $e
      };
      i.elem.push(p);
      let b = {
        id: `layer-${e}--${vl}--2--target-marker`,
        type: "text",
        x: a + n / 2,
        y: c + $e / 2,
        "text-anchor": "middle",
        "alignment-baseline": "middle",
        text: "X"
      };
      i.elem.push(b);
    }
    return i;
  }
}, Kl = tt, qi = "mrcx", r0 = {
  name: qi,
  width: Kl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${qi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Kl,
      height: 0,
      elem: []
    }, n = t.qubits.slice(0, -1), a = t.qubits.slice(-1)[0], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = n.map((g) => kt(t, g, l)), o = kt(t, a, l), u = Math.min(...s, o), c = Math.max(...s, o), d = {
      id: `layer-${e}--${qi}--connect`,
      type: "line",
      x1: Kl / 2 - 0.5,
      x2: Kl / 2 - 0.5,
      y1: u + $e / 2,
      y2: c + $e / 2,
      "stroke-width": 1
    };
    i.elem.push(d);
    let h = 0;
    for (let g in n) {
      let v = {
        id: `layer-${e}--${qi}--control` + h,
        type: "rect",
        "stroke-width": 0,
        fill: ze,
        width: 6,
        height: 6,
        x: Kl / 2 - 3,
        y: s[h] + $e / 2 - 3
      };
      i.elem.push(v), h++;
    }
    let p = {
      id: `layer-${e}--${qi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: Kl,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(p);
    let b = {
      id: `layer-${e}--${qi}--target-marker`,
      type: "text",
      x: Kl / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "X"
    };
    return i.elem.push(b), i;
  }
}, ji = tt, _n = "cswap", Ls = {
  name: _n,
  width: ji,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${_n}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ji,
      height: 0,
      elem: []
    }, n = t.qubits, a = nt(t, l);
    i.y = a.y, i.height = a.height;
    let r = n.map((d) => kt(t, d, l)), s = Math.min(...r), o = Math.max(...r), u = {
      id: `layer-${e}--${_n}--connect`,
      type: "line",
      x1: ji / 2 - 0.5,
      x2: ji / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + $e / 2,
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = 0;
    for (let d in n) {
      if (console.log(c, c < 1), c < 1) {
        let h = {
          id: `layer-${e}--${_n}--swap-${c}-control-marker`,
          type: "rect",
          "stroke-width": 0,
          fill: ze,
          width: 6,
          height: 6,
          x: ji / 2 - 3,
          y: r[c] + $e / 2 - 3
        };
        i.elem.push(h);
      } else {
        let h = {
          id: `layer-${e}--${_n}--swap-${c}-marker`,
          type: "x",
          cx: ji / 2,
          cy: r[c] + $e / 2,
          width: tt / 2,
          height: tt / 2,
          "stroke-width": 1,
          stroke: ze
        };
        i.elem.push(h);
      }
      c++;
    }
    return i;
  }
}, Ul = tt * 2.3, Ti = "crx", Qs = {
  name: Ti,
  width: Ul,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Ti}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Ul,
      height: 0,
      elem: []
    }, n = t.qubits[0], a = t.qubits[1], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = kt(t, n, l), o = kt(t, a, l), u = {
      id: `layer-${e}--${Ti}--connect`,
      type: "line",
      x1: Ul / 2 - 0.5,
      x2: Ul / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + (o > s ? 0 : $e),
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = {
      id: `layer-${e}--${Ti}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: ze,
      width: 6,
      height: 6,
      x: Ul / 2 - 3,
      y: s + $e / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${Ti}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: Ul,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${Ti}--target-marker`,
      type: "text",
      x: Ul / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `Rx(${Nt(t.params[0])})`
    };
    return i.elem.push(h), i;
  }
}, Wl = tt * 2.3, Ci = "cry", Vs = {
  name: Ci,
  width: Wl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Ci}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Wl,
      height: 0,
      elem: []
    }, n = t.qubits[0], a = t.qubits[1], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = kt(t, n, l), o = kt(t, a, l), u = {
      id: `layer-${e}--${Ci}--connect`,
      type: "line",
      x1: Wl / 2 - 0.5,
      x2: Wl / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + (o > s ? 0 : $e),
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = {
      id: `layer-${e}--${Ci}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: ze,
      width: 6,
      height: 6,
      x: Wl / 2 - 3,
      y: s + $e / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${Ci}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: Wl,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${Ci}--target-marker`,
      type: "text",
      x: Wl / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `Ry(${Nt(t.params[0])})`
    };
    return i.elem.push(h), i;
  }
}, Jl = tt * 2.3, Si = "crz", Xs = {
  name: Si,
  width: Jl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Si}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Jl,
      height: 0,
      elem: []
    }, n = t.qubits[0], a = t.qubits[1], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = kt(t, n, l), o = kt(t, a, l), u = {
      id: `layer-${e}--${Si}--connect`,
      type: "line",
      x1: Jl / 2 - 0.5,
      x2: Jl / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + (o > s ? 0 : $e),
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = {
      id: `layer-${e}--${Si}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: ze,
      width: 6,
      height: 6,
      x: Jl / 2 - 3,
      y: s + $e / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${Si}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: Jl,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${Si}--target-marker`,
      type: "text",
      x: Jl / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `Rz(${Nt(t.params[0])})`
    };
    return i.elem.push(h), i;
  }
}, Zl = tt * 5, Mi = "cu", Gs = {
  name: Mi,
  width: Zl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Mi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Zl,
      height: 0,
      elem: []
    }, n = t.qubits[0], a = t.qubits[1], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = kt(t, n, l), o = kt(t, a, l), u = {
      id: `layer-${e}--${Mi}--connect`,
      type: "line",
      x1: Zl / 2 - 0.5,
      x2: Zl / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + (o > s ? 0 : $e),
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = {
      id: `layer-${e}--${Mi}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: ze,
      width: 6,
      height: 6,
      x: Zl / 2 - 3,
      y: s + $e / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${Mi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: Zl,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${Mi}--target-marker`,
      type: "text",
      x: Zl / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `U(${Nt(t.params[0])},${Nt(t.params[1])},${Nt(t.params[2])},${Nt(t.params[3])})`
    };
    return i.elem.push(h), i;
  }
}, xl = tt * 2.3, zi = "cu1", Ys = {
  name: zi,
  width: xl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${zi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: xl,
      height: 0,
      elem: []
    }, n = t.qubits[0], a = t.qubits[1], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = kt(t, n, l), o = kt(t, a, l), u = {
      id: `layer-${e}--${zi}--connect`,
      type: "line",
      x1: xl / 2 - 0.5,
      x2: xl / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + (o > s ? 0 : $e),
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = {
      id: `layer-${e}--${zi}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: ze,
      width: 6,
      height: 6,
      x: xl / 2 - 3,
      y: s + $e / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${zi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: xl,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${zi}--target-marker`,
      type: "text",
      x: xl / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `Ru1(${Nt(t.params[0])})`
    };
    return i.elem.push(h), i;
  }
}, ei = tt * 3, Ni = "cu3", Ks = {
  name: Ni,
  width: ei,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Ni}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ei,
      height: 0,
      elem: []
    }, n = t.qubits[0], a = t.qubits[1], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = kt(t, n, l), o = kt(t, a, l), u = {
      id: `layer-${e}--${Ni}--connect`,
      type: "line",
      x1: ei / 2 - 0.5,
      x2: ei / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + (o > s ? 0 : $e),
      "stroke-width": 1
    };
    i.elem.push(u);
    let c = {
      id: `layer-${e}--${Ni}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: ze,
      width: 6,
      height: 6,
      x: ei / 2 - 3,
      y: s + $e / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${Ni}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: ze,
      fill: it,
      width: ei,
      x: 0,
      y: o,
      height: $e
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${Ni}--target-marker`,
      type: "text",
      x: ei / 2,
      y: o + $e / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `U3(${Nt(t.params[0])},${Nt(t.params[1])},${Nt(t.params[2])})`
    };
    return i.elem.push(h), i;
  }
}, dr = tt * 2.7, cn = "cp", Us = {
  name: cn,
  width: dr,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${cn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: dr,
      height: 0,
      elem: []
    }, n = t.qubits, a = nt(t, l);
    i.y = a.y, i.height = a.height;
    let r = n.map((p) => kt(t, p, l)), s = Math.min(...r), o = Math.max(...r), u = (s + o) / 2 + $e / 2, c = {
      id: `layer-${e}--${cn}--connect`,
      type: "line",
      x1: tt / 2 - 0.5,
      x2: tt / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + $e / 2,
      "stroke-width": 1
    };
    i.elem.push(c);
    let d = 0;
    for (let p in n) {
      let b = {
        id: `layer-${e}--${cn}--control` + d,
        type: "rect",
        "stroke-width": 0,
        fill: ze,
        width: 6,
        height: 6,
        x: tt / 2 - 3,
        y: r[d] + $e / 2 - 3
      };
      i.elem.push(b), d++;
    }
    let h = {
      id: `layer-${e}--${cn}--param-text` + d,
      type: "text",
      "stroke-width": 0,
      fill: ze,
      width: dr - tt,
      height: $e,
      x: tt - 3,
      y: u,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: `${Nt(t.params[0])}`
    };
    return i.elem.push(h), i;
  }
}, hr = tt * 2.7, dn = "rzz", Ws = {
  name: dn,
  width: hr,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${dn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: hr,
      height: 0,
      elem: []
    }, n = t.qubits, a = nt(t, l);
    i.y = a.y, i.height = a.height;
    let r = n.map((p) => kt(t, p, l)), s = Math.min(...r), o = Math.max(...r), u = (s + o) / 2 + $e / 2, c = {
      id: `layer-${e}--${dn}--connect`,
      type: "line",
      x1: tt / 2 - 0.5,
      x2: tt / 2 - 0.5,
      y1: s + $e / 2,
      y2: o + $e / 2,
      "stroke-width": 1
    };
    i.elem.push(c);
    let d = 0;
    for (let p in n) {
      let b = {
        id: `layer-${e}--${dn}--control` + d,
        type: "rect",
        "stroke-width": 0,
        fill: ze,
        width: 6,
        height: 6,
        x: tt / 2 - 3,
        y: r[d] + $e / 2 - 3
      };
      i.elem.push(b), d++;
    }
    let h = {
      id: `layer-${e}--${dn}--param-text` + d,
      type: "text",
      "stroke-width": 0,
      fill: ze,
      width: hr - tt,
      height: $e,
      x: tt - 3,
      y: u,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: `ZZ(${Nt(t.params[0])})`
    };
    return i.elem.push(h), i;
  }
}, ma = tt * 2.6, Ai = "rxx", Js = {
  name: Ai,
  width: ma,
  plan: function(t, e, l) {
    var u, c;
    let i = {
      id: `layer-${e}--${Ai}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ma,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Ai}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: ma,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Ai}--qubit-1`,
      type: "text",
      x: Ze / 2,
      y: $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (u = t.qubits[0]) == null ? void 0 : u.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${Ai}--qubit-2`,
      type: "text",
      x: Ze / 2,
      y: n.height - $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (c = t.qubits[1]) == null ? void 0 : c.index
    };
    i.elem.push(s);
    let o = {
      id: `layer-${e}--${Ai}--marker`,
      type: "text",
      x: ma - Ze / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: `Rxx(${Nt(t.params[0])})`
    };
    return i.elem.push(o), i;
  }
}, ga = tt * 2.6, Bi = "ryy", Zs = {
  name: Bi,
  width: ga,
  plan: function(t, e, l) {
    var u, c;
    let i = {
      id: `layer-${e}--${Bi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ga,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Bi}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: ga,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Bi}--qubit-1`,
      type: "text",
      x: Ze / 2,
      y: $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (u = t.qubits[0]) == null ? void 0 : u.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${Bi}--qubit-2`,
      type: "text",
      x: Ze / 2,
      y: n.height - $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (c = t.qubits[1]) == null ? void 0 : c.index
    };
    i.elem.push(s);
    let o = {
      id: `layer-${e}--${Bi}--marker`,
      type: "text",
      x: ga - Ze / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: `Ryy(${Nt(t.params[0])})`
    };
    return i.elem.push(o), i;
  }
}, ba = tt * 2.6, Pi = "rzx", xs = {
  name: Pi,
  width: ba,
  plan: function(t, e, l) {
    var u, c;
    let i = {
      id: `layer-${e}--${Pi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ba,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Pi}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: ba,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Pi}--qubit-1`,
      type: "text",
      x: Ze / 2,
      y: $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (u = t.qubits[0]) == null ? void 0 : u.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${Pi}--qubit-2`,
      type: "text",
      x: Ze / 2,
      y: n.height - $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (c = t.qubits[1]) == null ? void 0 : c.index
    };
    i.elem.push(s);
    let o = {
      id: `layer-${e}--${Pi}--marker`,
      type: "text",
      x: ba - Ze / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: `Rzx(${Nt(t.params[0])})`
    };
    return i.elem.push(o), i;
  }
}, va = tt * 4, Ei = "xx_minus_yy", eo = {
  name: Ei,
  width: va,
  plan: function(t, e, l) {
    var u, c;
    let i = {
      id: `layer-${e}--${Ei}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: va,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Ei}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: va,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Ei}--qubit-1`,
      type: "text",
      x: Ze / 2,
      y: $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (u = t.qubits[0]) == null ? void 0 : u.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${Ei}--qubit-2`,
      type: "text",
      x: Ze / 2,
      y: n.height - $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (c = t.qubits[1]) == null ? void 0 : c.index
    };
    i.elem.push(s);
    let o = {
      id: `layer-${e}--${Ei}--marker`,
      type: "text",
      x: va - Ze / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: `(XX-YY)(${format_parameter(t.params[0])},${format_parameter(t.params[1])})`
    };
    return i.elem.push(o), i;
  }
}, ka = tt * 4, Oi = "xx_plus_yy", to = {
  name: Oi,
  width: ka,
  plan: function(t, e, l) {
    var u, c;
    let i = {
      id: `layer-${e}--${Oi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ka,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Oi}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: ze,
      fill: it,
      width: ka,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Oi}--qubit-1`,
      type: "text",
      x: Ze / 2,
      y: $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (u = t.qubits[0]) == null ? void 0 : u.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${Oi}--qubit-2`,
      type: "text",
      x: Ze / 2,
      y: n.height - $e / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (c = t.qubits[1]) == null ? void 0 : c.index
    };
    i.elem.push(s);
    let o = {
      id: `layer-${e}--${Oi}--marker`,
      type: "text",
      x: ka - Ze / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: `(XX+YY)(${format_parameter(t.params[0])},${format_parameter(t.params[1])})`
    };
    return i.elem.push(o), i;
  }
};
function s0(t, e, l) {
  let i;
  return ["mcx", "cccx", "c3x", "ccccx", "c4x", "ccx"].includes(t.gate) ? i = a0.plan(t, e, l) : t.gate === Bs.name ? i = Bs.plan(t, e, l) : t.gate === Ps.name ? i = Ps.plan(t, e, l) : t.gate === Es.name ? i = Es.plan(t, e, l) : t.gate === Os.name ? i = Os.plan(t, e, l) : t.gate === ss.name ? i = ss.plan(t, e, l) : t.gate === Is.name ? i = Is.plan(t, e, l) : t.gate === Cs.name ? i = Cs.plan(t, e, l) : t.gate === qs.name ? i = qs.plan(t, e, l) : t.gate === js.name ? i = js.plan(t, e, l) : t.gate === Ts.name ? i = Ts.plan(t, e, l) : t.gate === _s.name ? i = _s.plan(t, e, l) : t.gate === Ss.name ? i = Ss.plan(t, e, l) : t.gate === Ms.name ? i = Ms.plan(t, e, l) : t.gate === zs.name ? i = zs.plan(t, e, l) : t.gate === Ns.name ? i = Ns.plan(t, e, l) : t.gate === hs.name ? i = hs.plan(t, e, l) : t.gate === ps.name ? i = ps.plan(t, e, l) : t.gate === ms.name ? i = ms.plan(t, e, l) : t.gate === gs.name ? i = gs.plan(t, e, l) : t.gate === vs.name ? i = vs.plan(t, e, l) : t.gate === ks.name ? i = ks.plan(t, e, l) : t.gate === bs.name ? i = bs.plan(t, e, l) : t.gate === cs.name ? i = cs.plan(t, e, l) : t.gate === ys.name ? i = ys.plan(t, e, l) : t.gate === ws.name ? i = ws.plan(t, e, l) : t.gate === $s.name ? i = $s.plan(t, e, l) : t.gate === Rs.name ? i = Rs.plan(t, e, l) : t.gate === Hs.name ? i = Hs.plan(t, e, l) : t.gate === Ds.name ? i = Ds.plan(t, e, l) : t.gate === Ls.name ? i = Ls.plan(t, e, l) : t.gate === os.name ? i = os.plan(t, e, l) : t.gate === As.name ? i = As.plan(t, e, l) : t.gate === Fs.name ? i = Fs.plan(t, e, l) : t.gate === Qs.name ? i = Qs.plan(t, e, l) : t.gate === Vs.name ? i = Vs.plan(t, e, l) : t.gate === Xs.name ? i = Xs.plan(t, e, l) : t.gate === Gs.name ? i = Gs.plan(t, e, l) : t.gate === Ys.name ? i = Ys.plan(t, e, l) : t.gate === Ks.name ? i = Ks.plan(t, e, l) : t.gate === Us.name ? i = Us.plan(t, e, l) : t.gate === Ws.name ? i = Ws.plan(t, e, l) : t.gate === Js.name ? i = Js.plan(t, e, l) : t.gate === Zs.name ? i = Zs.plan(t, e, l) : t.gate === xs.name ? i = xs.plan(t, e, l) : t.gate === eo.name ? i = eo.plan(t, e, l) : t.gate === to.name ? i = to.plan(t, e, l) : ["rccx", "rcccx"].includes(t.gate) ? i = r0.plan(t, e, l) : t.gate === ds.name ? i = ds.plan(t, e, l) : t.gate === us.name ? i = us.plan(t, e, l) : i = n0.plan(t, t.gate, e, l), i && (i.role = "gate-group", i.data = {
    operation: t,
    layer_index: e,
    tooltip_content: {
      Layer: e,
      Gate: t.gate,
      "Qubit(s)": t.qubits.map((n) => n.index).join(", ")
    }
  }), i;
}
function o0(t, e, l) {
  let i = {
    id: "esp--group",
    type: "g",
    x: t.x,
    y: t.y,
    width: t.width,
    height: t.height,
    elem: [],
    role: "esp-group"
  }, n = {
    id: "esp-axis--group",
    type: "g",
    x: 0,
    y: t.y,
    width: t.x,
    height: t.height,
    elem: [],
    role: "esp-axis-group"
  };
  n.elem.push({
    type: "text",
    id: "esp--title",
    role: "esp--title",
    text: "Estimated",
    x: 0,
    y: 6,
    "font-weight": 700,
    "text-anchor": "start",
    "alignment-baseline": "top"
  }, {
    type: "text",
    id: "esp--title",
    role: "esp--title",
    text: "Success",
    x: 0,
    y: 6 + 14,
    "font-weight": 700,
    "text-anchor": "start",
    "alignment-baseline": "top"
  }, {
    type: "text",
    id: "esp--title",
    role: "esp--title",
    text: "Prob.",
    x: 0,
    y: 6 + 14 + 14,
    "font-weight": 700,
    "text-anchor": "start",
    "alignment-baseline": "top"
  });
  let a = {
    id: "esp-y-axis--wrap",
    type: "g",
    role: "esp-y-axis",
    x: 0,
    y: 0,
    width: t.x,
    height: t.height,
    elem: []
  };
  for (let u = 0; u < 5; u++)
    a.elem.push({
      type: "text",
      id: "esp-y-axis--label",
      role: "esp-y-axis--label",
      text: u / 4,
      x: t.x - Ze * 2,
      y: t.height - t.height * (u / 4),
      "font-size": 12,
      "text-anchor": "end",
      "alignment-baseline": "middle"
    });
  a.elem.push({
    type: "line",
    id: "esp-y-axis--domain",
    role: "esp-y-axis--domain",
    x1: t.x - Ze - 1,
    x2: t.x - Ze - 1,
    y1: -0.5,
    y2: t.height + 0.5,
    stroke: ze,
    "stroke-width": 1
  }), n.elem.push(a);
  let s = {
    id: "esp-h-grid--wrap",
    type: "g",
    role: "esp-h-grid",
    x: 0,
    y: 0,
    width: t.width,
    height: t.height,
    elem: []
  };
  for (let u = 0; u < 5; u++)
    s.elem.push({
      type: "line",
      id: "esp-h-grid--line",
      role: "esp-h-grid--line",
      x1: -Ze - 1,
      x2: t.width,
      y1: t.height * (u / 4),
      y2: t.height * (u / 4),
      stroke: ze,
      "stroke-width": 1,
      "stroke-opacity": 0.2
    });
  i.elem.push(s);
  let o = {
    id: "esp-bars--group",
    type: "g",
    role: "esp-bars--group",
    x: 0,
    y: 0,
    width: t.width,
    height: t.height,
    elem: []
  };
  for (let u = 0; u < e.layers.length; u++) {
    let c = e.layers[u], d = l[u].width, h = {
      id: `esp-bar-${u}--group`,
      type: "g",
      role: "esp-bar--group",
      x: l[u].x,
      y: 0,
      width: d,
      height: t.height,
      elem: [],
      data: {
        layer_index: u,
        operations: c.operations,
        detail: c.esp_detail,
        esp_this: c.esp_this,
        esp_total: c.esp_total,
        tooltip_content: {
          "ESP (this layer)": c.esp_this,
          "ESP (cummulative)": c.esp_total
        }
      }
    }, p = c.esp_this * t.height;
    h.elem.push({
      type: "rect",
      id: `esp-bar-${u}--bar-this`,
      role: "esp-bar--bar-this",
      x: d / 2 - ln,
      y: t.height - p,
      width: ln,
      height: p,
      "stroke-width": 0,
      fill: "orange"
    });
    let b = c.esp_total * t.height;
    h.elem.push({
      type: "rect",
      id: `esp-bar-${u}--bar-total`,
      role: "esp-bar--bar-total",
      x: d / 2,
      y: t.height - b,
      width: ln,
      height: b,
      "stroke-width": 0,
      fill: "red"
    }), h.elem.push({
      type: "click-wrap",
      id: `esp-bar-${u}--click-wrap`,
      role: "esp-bar-click-wrap",
      x: d / 2 - ln,
      y: 0,
      width: ln * 2,
      height: t.height,
      data: {
        layer_index: u,
        operations: c.operations,
        detail: c.esp_detail,
        esp_this: c.esp_this,
        esp_total: c.esp_total
      }
    }), o.elem.push(h);
  }
  return i.elem.push(o), [n, i];
}
function Cr(t, e) {
  var M, H, B, R, P, I, L, F, X, V;
  if (!t)
    return null;
  let l = 0, i = 0, n = 0, a = [], r = [], s = e == null ? void 0 : e.pagination, o = (e == null ? void 0 : e.first_layer_index) || 0, u = !(e != null && e.is_original) && ((M = e == null ? void 0 : e.match) == null ? void 0 : M.bit_match), c = (H = e == null ? void 0 : e.match) == null ? void 0 : H.bit_match, d = (e == null ? void 0 : e.filter_unused_qubits) === void 0 ? !1 : e.filter_unused_qubits, h = as + (!(e != null && e.is_original) && ((B = e == null ? void 0 : e.match) != null && B.bit_match) ? as * 1.25 : 0), p = t.qubits.map((Q) => Q.index), b = p.length;
  d && ((R = t.match) != null && R.bit_match) ? (p = t.match.bit_match.filter((Q) => !Q.is_ancilla).map((Q) => Q.to), b = p.length) : d && (d = !1);
  let g;
  t.global_phase && (g = {
    type: "g",
    x: Ie,
    y: Ie,
    role: "global-phase",
    id: "global-phase",
    elem: []
  }, g.elem.push({
    type: "text",
    x: h,
    y: di,
    role: "global-phase--marker",
    id: "global-phase--marker",
    "text-anchor": "end",
    "font-size": 10,
    text: `Global phase: ${Gi(t.global_phase)}`
  }));
  let v = 0, y = {};
  if (b > 0) {
    l += h, n = $e * b + At * (b - 1), i += n;
    for (let Q of t.qubits)
      if (!(d && !p.includes(Q.index))) {
        y[Q.index] = v;
        let J = "", te;
        !(e != null && e.no_match) && (e != null && e.is_original) ? te = c.filter((G) => G.from == Q.index)[0] : e != null && e.no_match || (te = c.filter((G) => G.to == Q.index)[0]);
        let ie = Ut[(te == null ? void 0 : te.from) || t.qubits.length];
        u && (te && !te.is_ancilla ? J = Q.register.name + te.from + " > " : te && te.is_ancilla && (J = "ancilla/" + te.to + " > "));
        let U = {
          type: "g",
          x: 0,
          y: ($e + At) * v,
          width: h,
          height: $e,
          role: "qubit-group",
          id: `qubit-${Q.index}--group`,
          _class: `qubit-group qubit-${Q.index}` + (e != null && e.is_original ? " original" : " transpiled"),
          data: {
            qubit: Q,
            bit_match: te,
            matched_circuit_id: e == null ? void 0 : e.matched_circuit_id,
            unit_id: e == null ? void 0 : e.unit_id,
            this_circuit_id: e == null ? void 0 : e.this_circuit_id,
            matched_machine_id: e == null ? void 0 : e.matched_machine_id,
            match_color: ie
          },
          elem: []
        };
        U.elem.push({
          type: "rect",
          x: 0,
          y: 0,
          width: h,
          height: $e,
          role: "qubit-background",
          "fill-opacity": 0.2,
          stroke: "transparent",
          _class: `qubit-background qubit-${Q.index}` + (e != null && e.is_original ? " original" : " transpiled")
        }), U.elem.push({
          type: "text",
          text: J + Q.register.name + Q.index,
          "text-anchor": "end",
          "alignment-baseline": "middle",
          x: h,
          y: $e / 2,
          width: h,
          height: $e,
          role: "qubit",
          _class: `qubit qubit-${Q.index}` + (e != null && e.is_original ? " original" : " transpiled")
        }), U.elem.push({
          type: "click-wrap",
          x: 0,
          y: 0,
          width: h,
          height: $e,
          role: "qubit-group-click-wrap",
          data: {
            qubit: Q,
            bit_match: te,
            matched_circuit_id: e == null ? void 0 : e.matched_circuit_id,
            unit_id: e == null ? void 0 : e.unit_id,
            this_circuit_id: e == null ? void 0 : e.this_circuit_id,
            matched_machine_id: e == null ? void 0 : e.matched_machine_id,
            match_color: ie
          }
        }), a.push(U), r.push({
          type: "line",
          x1: 0,
          y1: v * ($e + At) + $e / 2 - 0.5,
          "stroke-width": 1
        }), v += 1;
      }
  }
  t.num_clbits > 0 && (i += $e + At, a.push({
    type: "text",
    text: "C/" + t.num_clbits,
    "text-anchor": "end",
    "alignment-baseline": "middle",
    x: h,
    y: n + At + $e / 2,
    width: h,
    height: $e,
    role: "clbit",
    data: t.clbits
  }), a.push({
    type: "click-wrap",
    x: 0,
    y: n + At,
    width: h,
    height: $e,
    role: "qubit-group-click-wrap",
    data: t.clbits
  }), r.push({
    type: "double-line",
    x1: 0,
    y1: n + At + $e / 2 - 2,
    "stroke-width": 4
  }));
  let k = 0, w = [], $ = Ze, q = (P = s == null ? void 0 : s.range) != null && P[0] ? Math.max((I = s == null ? void 0 : s.range) == null ? void 0 : I[0], 0) : 0, j = (L = s == null ? void 0 : s.range) != null && L[1] ? Math.min((F = s == null ? void 0 : s.range) == null ? void 0 : F[1], t.layers.length) : t.layers.length;
  for (let Q = 0; Q < t.layers.length; Q++) {
    if (Q < q || Q >= j)
      continue;
    let J = t.layers[Q], te = {
      id: `layer-${o + Q}--group`,
      type: "g",
      role: "layer-group",
      _class: `layer-wrap layer-${o + Q}` + (e != null && e.is_original ? " original" : " transpiled"),
      x: $,
      y: 0,
      width: 0,
      height: i,
      elem: [],
      data: {
        layer: J,
        layer_index: o + Q,
        tooltip_content: {
          priority: 2,
          Layer: Q,
          "# Operations": J.operations.length,
          Qubits: ""
        }
      }
    }, ie = 0, U = [], G = J.operations.length;
    for (let W = 0; W < J.operations.length; W++) {
      let Z = J.operations[W], ee = s0(Z, o + Q, y), ye, qe;
      !(e != null && e.no_match) && (e != null && e.is_original) ? (ye = Sr((X = e == null ? void 0 : e.match) == null ? void 0 : X.layer_match, "o-t", o + Q, W), qe = Ut[(o + Q + W * G) % Ut.length]) : e != null && e.no_match || (ye = Sr((V = e == null ? void 0 : e.match) == null ? void 0 : V.layer_match, "t-o", o + Q, W), ye && (qe = Ut[(ye.layer + ye.operation * G) % Ut.length])), ee && (ee._class = `gate-wrap layer-${o + Q} gate-${W}` + (e != null && e.is_original ? " original" : " transpiled"), ee.data.operation_index = W, ee.data.layer_match = ye, ee.data.match_color = qe, ee.data.matched_circuit_id = e == null ? void 0 : e.matched_circuit_id, ee.data.unit_id = e == null ? void 0 : e.unit_id, ee.data.this_circuit_id = e == null ? void 0 : e.this_circuit_id, ee.data.matched_machine_id = e == null ? void 0 : e.matched_machine_id, ee.elem.push({
        id: `layer-${o + Q}--${Z.gate}--click-wrap`,
        _class: "gate-group-click-wrap",
        role: "gate-group-click-wrap",
        type: "click-wrap",
        x: 0,
        y: 0,
        width: ee.width,
        height: ee.height,
        data: ee.data
      })), te.elem.push(ee), ie = Math.max(ie, (ee == null ? void 0 : ee.width) || 32), Z.qubits.forEach((je) => {
        U.includes(je.index) || U.push(je.index);
      });
    }
    te.width = ie, te.data.tooltip_content.Qubits = "[" + U.join(", ") + "]", te.elem.forEach((W) => {
      W && W.width < ie && (W.x += (ie - W.width) / 2);
    }), te.elem.unshift({
      id: `layer-${o + Q}--interaction-wrap`,
      _class: "interation-wrap",
      type: "rect",
      x: -(Ze / 2),
      y: e != null && e.show_moments ? -di - At - Ie : 0,
      width: ie + Ze,
      height: e != null && e.show_moments ? i + di + At + Ie * 2 : i,
      fill: "rgba(0, 0, 0, 0)",
      stroke: "transparent"
    }), $ = $ + ie + Ze, k = k + ie + Ze, w.push(te);
  }
  k = k + Ze, l += k + Ze, r.forEach((Q) => {
    Q.x2 = k, Q.y2 = Q.y1;
  });
  let O, z;
  t.esp !== void 0 && ([O, z] = o0(
    {
      x: Ie + h + Ze,
      y: i + At * 4,
      width: k,
      height: rs
    },
    t,
    w
  ), i += rs + At * 4);
  let N = {
    type: "svg",
    width: l + Ie * 2,
    height: i + Ie * 2,
    viewBox: [0, 0, l + Ie * 2, i + Ie * 2],
    groups: {
      qubit_group: {
        id: "qubits--group",
        type: "g",
        x: Ie,
        y: Ie,
        width: h,
        height: i,
        elem: a,
        role: "qubits",
        data: {
          qubits: t.qubits,
          clbits: t.clbits,
          num_qubits: t.num_qubits,
          num_clbits: t.num_clbits
        }
      },
      circuit_line_group: {
        id: "circuit-line--group",
        type: "g",
        x: Ie + h + Ze,
        y: Ie,
        width: k,
        height: i,
        elem: r,
        role: "circuit_lines"
      },
      circuit_group: {
        id: "circuit-body--group",
        type: "g",
        x: Ie + h + Ze,
        y: Ie,
        width: k,
        height: i,
        elem: w,
        role: "circuit_body",
        data: t.layers
      },
      phase_marker: g,
      esp_group: z,
      esp_axis_group: O
    }
  };
  if (e != null && e.show_moments) {
    let Q = {
      id: "moment--group",
      type: "g",
      x: Ie + h + Ze,
      y: Ie,
      width: k,
      height: di,
      elem: []
    };
    Q.elem = w.map((te, ie) => ({
      id: `moment-${te.data.layer_index}--marker`,
      type: "text",
      text: te.data.layer_index,
      x: te.x + te.width / 2,
      y: di / 2,
      "font-size": 10,
      data: te.data,
      "text-anchor": "middle",
      "alignment-baseline": "middle"
    }));
    let J = di + At;
    N.height += J, N.viewBox[3] += J, N.groups.qubit_group.y += J, N.groups.circuit_line_group.y += J, N.groups.circuit_group.y += J, N.groups.esp_group && (N.groups.esp_group.y += J), N.groups.esp_axis_group && (N.groups.esp_axis_group.y += J), N.groups.moment_group = Q;
  }
  return N;
}
function Sr(t, e, l, i) {
  var n, a;
  if (e === "o-t") {
    let r = (n = t.filter((s) => {
      var o, u;
      return ((o = s == null ? void 0 : s.from) == null ? void 0 : o[0]) == l && ((u = s == null ? void 0 : s.from) == null ? void 0 : u[1]) == i;
    })) == null ? void 0 : n[0];
    return r ? {
      layer: r.from[0],
      operation: r.from[1],
      matches: r.to.matches,
      complete: r.to.complete
    } : null;
  } else if (e === "t-o") {
    let r = (a = t.filter((s) => s.to.matches.some((o) => (o == null ? void 0 : o[0]) == l && (o == null ? void 0 : o[1]) == i))) == null ? void 0 : a[0];
    return r ? { layer: r.from[0], operation: r.from[1], colleagues: r.to.matches, complete: r.to.complete } : null;
  }
  return null;
}
function lo(t) {
  let e, l, i, n, a, r, s, o, u, c, d;
  return {
    c() {
      e = Xe("polygon"), f(e, "id", l = /*data*/
      t[0].id), f(e, "class", i = /*data*/
      t[0]._class), f(e, "data-role", n = /*data*/
      t[0].role), f(e, "points", a = `${/*data*/
      t[0].x},${/*data*/
      t[0].y - 6} ${/*data*/
      t[0].x + 4},${/*data*/
      t[0].y + 4} ${/*data*/
      t[0].x - 4},${/*data*/
      t[0].y + 4}`), f(e, "stroke", r = /*data*/
      t[0].stroke || ze), f(e, "stroke-width", s = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), f(e, "fill", o = /*data*/
      t[0].fill || it), f(e, "fill-opacity", u = /*data*/
      t[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        t[0]["fill-opacity"]
      ) : 1), f(e, "transform", c = `rotate(${/*data*/
      (t[0].rotate || 0) + 90})`), f(e, "transform-origin", d = `${/*data*/
      t[0].x} ${/*data*/
      t[0].y}`);
    },
    m(h, p) {
      C(h, e, p);
    },
    p(h, p) {
      p & /*data*/
      1 && l !== (l = /*data*/
      h[0].id) && f(e, "id", l), p & /*data*/
      1 && i !== (i = /*data*/
      h[0]._class) && f(e, "class", i), p & /*data*/
      1 && n !== (n = /*data*/
      h[0].role) && f(e, "data-role", n), p & /*data*/
      1 && a !== (a = `${/*data*/
      h[0].x},${/*data*/
      h[0].y - 6} ${/*data*/
      h[0].x + 4},${/*data*/
      h[0].y + 4} ${/*data*/
      h[0].x - 4},${/*data*/
      h[0].y + 4}`) && f(e, "points", a), p & /*data*/
      1 && r !== (r = /*data*/
      h[0].stroke || ze) && f(e, "stroke", r), p & /*data*/
      1 && s !== (s = /*data*/
      h[0]["stroke-width"] !== void 0 ? (
        /*data*/
        h[0]["stroke-width"]
      ) : 1) && f(e, "stroke-width", s), p & /*data*/
      1 && o !== (o = /*data*/
      h[0].fill || it) && f(e, "fill", o), p & /*data*/
      1 && u !== (u = /*data*/
      h[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        h[0]["fill-opacity"]
      ) : 1) && f(e, "fill-opacity", u), p & /*data*/
      1 && c !== (c = `rotate(${/*data*/
      (h[0].rotate || 0) + 90})`) && f(e, "transform", c), p & /*data*/
      1 && d !== (d = `${/*data*/
      h[0].x} ${/*data*/
      h[0].y}`) && f(e, "transform-origin", d);
    },
    d(h) {
      h && T(e);
    }
  };
}
function u0(t) {
  let e, l = (
    /*data*/
    t[0] && lo(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = lo(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function f0(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
class _0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, f0, u0, Le, { data: 0 });
  }
}
function io(t) {
  let e, l, i, n, a, r, s, o, u, c, d;
  return {
    c() {
      e = Xe("circle"), f(e, "id", l = /*data*/
      t[0].id), f(e, "class", i = /*data*/
      t[0]._class), f(e, "data-role", n = /*data*/
      t[0].role), f(e, "cx", a = /*data*/
      t[0].cx), f(e, "cy", r = /*data*/
      t[0].cy), f(e, "r", s = /*data*/
      t[0].r), f(e, "stroke", o = /*data*/
      t[0].stroke || ze), f(e, "stroke-width", u = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), f(e, "fill", c = /*data*/
      t[0].fill || it), f(e, "fill-opacity", d = /*data*/
      t[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        t[0]["fill-opacity"]
      ) : 1);
    },
    m(h, p) {
      C(h, e, p);
    },
    p(h, p) {
      p & /*data*/
      1 && l !== (l = /*data*/
      h[0].id) && f(e, "id", l), p & /*data*/
      1 && i !== (i = /*data*/
      h[0]._class) && f(e, "class", i), p & /*data*/
      1 && n !== (n = /*data*/
      h[0].role) && f(e, "data-role", n), p & /*data*/
      1 && a !== (a = /*data*/
      h[0].cx) && f(e, "cx", a), p & /*data*/
      1 && r !== (r = /*data*/
      h[0].cy) && f(e, "cy", r), p & /*data*/
      1 && s !== (s = /*data*/
      h[0].r) && f(e, "r", s), p & /*data*/
      1 && o !== (o = /*data*/
      h[0].stroke || ze) && f(e, "stroke", o), p & /*data*/
      1 && u !== (u = /*data*/
      h[0]["stroke-width"] !== void 0 ? (
        /*data*/
        h[0]["stroke-width"]
      ) : 1) && f(e, "stroke-width", u), p & /*data*/
      1 && c !== (c = /*data*/
      h[0].fill || it) && f(e, "fill", c), p & /*data*/
      1 && d !== (d = /*data*/
      h[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        h[0]["fill-opacity"]
      ) : 1) && f(e, "fill-opacity", d);
    },
    d(h) {
      h && T(e);
    }
  };
}
function c0(t) {
  let e, l = (
    /*data*/
    t[0] && io(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = io(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function d0(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
class h0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, d0, c0, Le, { data: 0 });
  }
}
function no(t) {
  let e, l, i, n, a, r, s, o, u, c;
  return {
    c() {
      e = Xe("rect"), f(e, "id", l = /*data*/
      t[0].id), f(e, "class", i = /*data*/
      t[0]._class + " click-wrap"), f(e, "data-role", n = /*data*/
      t[0].role), f(e, "x", a = /*data*/
      t[0].x), f(e, "y", r = /*data*/
      t[0].y), f(e, "width", s = /*data*/
      t[0].width), f(e, "height", o = /*data*/
      t[0].height), f(e, "stroke", "transparent"), f(e, "stroke-width", "0"), f(e, "fill", "transparent");
    },
    m(d, h) {
      C(d, e, h), u || (c = le(
        e,
        "dblclick",
        /*dblclick_handler*/
        t[2]
      ), u = !0);
    },
    p(d, h) {
      h & /*data*/
      1 && l !== (l = /*data*/
      d[0].id) && f(e, "id", l), h & /*data*/
      1 && i !== (i = /*data*/
      d[0]._class + " click-wrap") && f(e, "class", i), h & /*data*/
      1 && n !== (n = /*data*/
      d[0].role) && f(e, "data-role", n), h & /*data*/
      1 && a !== (a = /*data*/
      d[0].x) && f(e, "x", a), h & /*data*/
      1 && r !== (r = /*data*/
      d[0].y) && f(e, "y", r), h & /*data*/
      1 && s !== (s = /*data*/
      d[0].width) && f(e, "width", s), h & /*data*/
      1 && o !== (o = /*data*/
      d[0].height) && f(e, "height", o);
    },
    d(d) {
      d && T(e), u = !1, c();
    }
  };
}
function p0(t) {
  let e, l = (
    /*data*/
    t[0] && no(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = no(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function m0(t, e, l) {
  let { data: i = {}, open_tool: n = () => {
  } } = e;
  const a = (r) => {
    [
      "qubit-group-click-wrap",
      "gate-group-click-wrap",
      "qubit-node-click-wrap",
      "op-gate-error-group-click-wrap",
      "esp-bar-click-wrap",
      "machine-gate-click-wrap"
    ].includes(i.role) && n(i);
  };
  return t.$$set = (r) => {
    "data" in r && l(0, i = r.data), "open_tool" in r && l(1, n = r.open_tool);
  }, [i, n, a];
}
let g0 = class extends Ve {
  constructor(e) {
    super(), Qe(this, e, m0, p0, Le, { data: 0, open_tool: 1 });
  }
};
function ao(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w;
  return {
    c() {
      e = Xe("line"), c = A(), d = Xe("line"), f(e, "id", l = /*data*/
      t[0].id + "--top"), f(e, "class", i = /*data*/
      t[0]._class), f(e, "data-role", n = /*data*/
      t[0].role), f(e, "x1", a = /*data*/
      t[0].x1), f(e, "y1", r = /*data*/
      t[0].y1 - /*gap*/
      t[1] / 2), f(e, "x2", s = /*data*/
      t[0].x2 !== void 0 ? (
        /*data*/
        t[0].x2
      ) : (
        /*data*/
        t[0].x1
      )), f(e, "y2", o = /*data*/
      (t[0].y2 !== void 0 ? (
        /*data*/
        t[0].y2
      ) : (
        /*data*/
        t[0].y1
      )) - /*gap*/
      t[1] / 2), f(e, "stroke", u = /*data*/
      t[0].stroke || ze), f(e, "stroke-width", 1), f(d, "id", h = /*data*/
      t[0].id + "--bottom"), f(d, "class", p = /*data*/
      t[0]._class), f(d, "data-role", b = /*data*/
      t[0].role), f(d, "x1", g = /*data*/
      t[0].x1), f(d, "y1", v = /*data*/
      t[0].y1 + /*gap*/
      t[1] / 2), f(d, "x2", y = /*data*/
      t[0].x2 !== void 0 ? (
        /*data*/
        t[0].x2
      ) : (
        /*data*/
        t[0].x1
      )), f(d, "y2", k = /*data*/
      (t[0].y2 !== void 0 ? (
        /*data*/
        t[0].y2
      ) : (
        /*data*/
        t[0].y1
      )) + /*gap*/
      t[1] / 2), f(d, "stroke", w = /*data*/
      t[0].stroke || ze), f(d, "stroke-width", 1);
    },
    m($, q) {
      C($, e, q), C($, c, q), C($, d, q);
    },
    p($, q) {
      q & /*data*/
      1 && l !== (l = /*data*/
      $[0].id + "--top") && f(e, "id", l), q & /*data*/
      1 && i !== (i = /*data*/
      $[0]._class) && f(e, "class", i), q & /*data*/
      1 && n !== (n = /*data*/
      $[0].role) && f(e, "data-role", n), q & /*data*/
      1 && a !== (a = /*data*/
      $[0].x1) && f(e, "x1", a), q & /*data, gap*/
      3 && r !== (r = /*data*/
      $[0].y1 - /*gap*/
      $[1] / 2) && f(e, "y1", r), q & /*data*/
      1 && s !== (s = /*data*/
      $[0].x2 !== void 0 ? (
        /*data*/
        $[0].x2
      ) : (
        /*data*/
        $[0].x1
      )) && f(e, "x2", s), q & /*data, gap*/
      3 && o !== (o = /*data*/
      ($[0].y2 !== void 0 ? (
        /*data*/
        $[0].y2
      ) : (
        /*data*/
        $[0].y1
      )) - /*gap*/
      $[1] / 2) && f(e, "y2", o), q & /*data*/
      1 && u !== (u = /*data*/
      $[0].stroke || ze) && f(e, "stroke", u), q & /*data*/
      1 && h !== (h = /*data*/
      $[0].id + "--bottom") && f(d, "id", h), q & /*data*/
      1 && p !== (p = /*data*/
      $[0]._class) && f(d, "class", p), q & /*data*/
      1 && b !== (b = /*data*/
      $[0].role) && f(d, "data-role", b), q & /*data*/
      1 && g !== (g = /*data*/
      $[0].x1) && f(d, "x1", g), q & /*data, gap*/
      3 && v !== (v = /*data*/
      $[0].y1 + /*gap*/
      $[1] / 2) && f(d, "y1", v), q & /*data*/
      1 && y !== (y = /*data*/
      $[0].x2 !== void 0 ? (
        /*data*/
        $[0].x2
      ) : (
        /*data*/
        $[0].x1
      )) && f(d, "x2", y), q & /*data, gap*/
      3 && k !== (k = /*data*/
      ($[0].y2 !== void 0 ? (
        /*data*/
        $[0].y2
      ) : (
        /*data*/
        $[0].y1
      )) + /*gap*/
      $[1] / 2) && f(d, "y2", k), q & /*data*/
      1 && w !== (w = /*data*/
      $[0].stroke || ze) && f(d, "stroke", w);
    },
    d($) {
      $ && (T(e), T(c), T(d));
    }
  };
}
function b0(t) {
  let e, l = (
    /*data*/
    t[0] && ao(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = ao(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function v0(t, e, l) {
  let { data: i = {} } = e, n = 0;
  return yt(() => {
    l(1, n = i["stroke-width"] !== void 0 ? i["stroke-width"] : 1);
  }), t.$$set = (a) => {
    "data" in a && l(0, i = a.data);
  }, [i, n];
}
class k0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, v0, b0, Le, { data: 0 });
  }
}
function ro(t, e, l) {
  const i = t.slice();
  return i[11] = e[l], i;
}
function so(t) {
  let e, l, i, n, a, r, s, o, u, c, d = we(
    /*data*/
    t[0].elem
  ), h = [];
  for (let b = 0; b < d.length; b += 1)
    h[b] = oo(ro(t, d, b));
  const p = (b) => D(h[b], 1, 1, () => {
    h[b] = null;
  });
  return {
    c() {
      e = Xe("g");
      for (let b = 0; b < h.length; b += 1)
        h[b].c();
      f(e, "id", l = /*data*/
      t[0].id), f(e, "class", i = /*data*/
      t[0]._class), f(e, "data-role", n = /*data*/
      t[0].role), f(e, "height", a = /*data*/
      t[0].height), f(e, "width", r = /*data*/
      t[0].width), f(e, "transform", s = `translate(${/*data*/
      t[0].x} ${/*data*/
      t[0].y})`);
    },
    m(b, g) {
      C(b, e, g);
      for (let v = 0; v < h.length; v += 1)
        h[v] && h[v].m(e, null);
      o = !0, u || (c = [
        le(
          e,
          "mouseover",
          /*mouseover_handler*/
          t[5]
        ),
        le(
          e,
          "mousemove",
          /*mousemove_handler*/
          t[6]
        ),
        le(
          e,
          "mouseout",
          /*mouseout_handler*/
          t[7]
        ),
        le(
          e,
          "click",
          /*click_handler*/
          t[8]
        ),
        le(
          e,
          "blur",
          /*blur_handler*/
          t[9]
        ),
        le(
          e,
          "focus",
          /*focus_handler*/
          t[10]
        )
      ], u = !0);
    },
    p(b, g) {
      if (g & /*data, open_tool, openTooltip, closeTooltip, moveTooltip*/
      31) {
        d = we(
          /*data*/
          b[0].elem
        );
        let v;
        for (v = 0; v < d.length; v += 1) {
          const y = ro(b, d, v);
          h[v] ? (h[v].p(y, g), S(h[v], 1)) : (h[v] = oo(y), h[v].c(), S(h[v], 1), h[v].m(e, null));
        }
        for (ge(), v = d.length; v < h.length; v += 1)
          p(v);
        be();
      }
      (!o || g & /*data*/
      1 && l !== (l = /*data*/
      b[0].id)) && f(e, "id", l), (!o || g & /*data*/
      1 && i !== (i = /*data*/
      b[0]._class)) && f(e, "class", i), (!o || g & /*data*/
      1 && n !== (n = /*data*/
      b[0].role)) && f(e, "data-role", n), (!o || g & /*data*/
      1 && a !== (a = /*data*/
      b[0].height)) && f(e, "height", a), (!o || g & /*data*/
      1 && r !== (r = /*data*/
      b[0].width)) && f(e, "width", r), (!o || g & /*data*/
      1 && s !== (s = `translate(${/*data*/
      b[0].x} ${/*data*/
      b[0].y})`)) && f(e, "transform", s);
    },
    i(b) {
      if (!o) {
        for (let g = 0; g < d.length; g += 1)
          S(h[g]);
        o = !0;
      }
    },
    o(b) {
      h = h.filter(Boolean);
      for (let g = 0; g < h.length; g += 1)
        D(h[g]);
      o = !1;
    },
    d(b) {
      b && T(e), Ge(h, b), u = !1, vt(c);
    }
  };
}
function oo(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*el*/
        t[11]
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      ),
      openTooltip: (
        /*openTooltip*/
        t[2]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[3]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[4]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*el*/
      i[11]), n & /*open_tool*/
      2 && (a.open_tool = /*open_tool*/
      i[1]), n & /*openTooltip*/
      4 && (a.openTooltip = /*openTooltip*/
      i[2]), n & /*closeTooltip*/
      8 && (a.closeTooltip = /*closeTooltip*/
      i[3]), n & /*moveTooltip*/
      16 && (a.moveTooltip = /*moveTooltip*/
      i[4]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function y0(t) {
  let e, l, i = (
    /*data*/
    t[0] && so(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, e, a), l = !0;
    },
    p(n, [a]) {
      /*data*/
      n[0] ? i ? (i.p(n, a), a & /*data*/
      1 && S(i, 1)) : (i = so(n), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d(n);
    }
  };
}
function uo(t) {
  var n, a, r, s;
  let e, l, i;
  return t._class.includes(" original") ? (e = [
    document.querySelector(`#circuit-viewer-${t.data.unit_id} #${t.data.this_circuit_id}-sticky .qubit-background.qubit-${(n = t.data.bit_match) == null ? void 0 : n.from}`)
  ], l = t.data.matched_circuit_id.map((o) => {
    var u;
    return document.querySelector(`#circuit-viewer-${t.data.unit_id} #${o}-sticky .qubit-background.qubit-${(u = t.data.bit_match) == null ? void 0 : u.to}`);
  }), i = t.data.matched_machine_id.map((o) => {
    var u;
    return document.querySelector(`#circuit-viewer-${t.data.unit_id} #${o} #qubit-node-${(u = t.data.bit_match) == null ? void 0 : u.to}--group`);
  })) : t._class.includes(" transpiled") ? (e = t.data.matched_circuit_id.map((o) => {
    var u;
    return document.querySelector(`#circuit-viewer-${t.data.unit_id} #${o}-sticky .qubit-background.qubit-${(u = t.data.bit_match) == null ? void 0 : u.from}`);
  }), l = [
    document.querySelector(`#circuit-viewer-${t.data.unit_id} #${t.data.this_circuit_id}-sticky .qubit-background.qubit-${(a = t.data.bit_match) == null ? void 0 : a.to}`)
  ], i = t.data.matched_machine_id.map((o) => {
    var u;
    return document.querySelector(`#circuit-viewer-${t.data.unit_id} #${o} #qubit-node-${(u = t.data.bit_match) == null ? void 0 : u.to}--group`);
  })) : t._class.includes("qubit-node--group") && (e = [
    document.querySelector(`#circuit-viewer-${t.data.unit_id} #${t.data.original_circuit_id}-sticky .qubit-background.qubit-${(r = t.data) == null ? void 0 : r.original_qubit_id}`)
  ], l = [
    document.querySelector(`#circuit-viewer-${t.data.unit_id} #${t.data.transpiled_circuit_id}-sticky .qubit-background.qubit-${(s = t.data) == null ? void 0 : s.qubit_id}`)
  ], i = [
    document.querySelector(`#circuit-viewer-${t.data.unit_id} #${t.data.id} #qubit-node-${t.data.qubit_id}--group`)
  ]), [...e, ...l, ...i];
}
function ya(t) {
  var i, n, a, r, s, o, u, c, d, h;
  let e = [], l = [];
  return t._class.includes(" original") ? (e = t.data.layer_match.matches.map((p) => t.data.matched_circuit_id.map((b) => document.querySelector(`#circuit-viewer-${t.data.unit_id} #${b} #layer-${p[0]}--interaction-wrap`))).flat(), e.push(document.querySelector(`#circuit-viewer-${t.data.unit_id} #${t.data.this_circuit_id} #layer-${t.data.layer_match.layer}--interaction-wrap`)), l = t.data.layer_match.matches.map((p) => t.data.matched_circuit_id.map((b) => document.querySelector(`#circuit-viewer-${t.data.unit_id} #${b} .gate-wrap.layer-${p[0]}.gate-${p[1]}`))).flat(), l.push(document.querySelector(`#circuit-viewer-${t.data.unit_id} #${t.data.this_circuit_id} .gate-wrap.layer-${t.data.layer_index}.gate-${t.data.operation_index}`))) : t._class.includes(" transpiled") ? (e = ((a = (n = (i = t == null ? void 0 : t.data) == null ? void 0 : i.layer_match) == null ? void 0 : n.colleagues) == null ? void 0 : a.map((p) => document.querySelector(`#circuit-viewer-${t.data.unit_id} #${t.data.this_circuit_id} #layer-${p[0]}--interaction-wrap`))) || [], ((s = (r = t == null ? void 0 : t.data) == null ? void 0 : r.layer_match) == null ? void 0 : s.layer) !== void 0 && e.push(...t.data.matched_circuit_id.map((p) => {
    var b;
    return document.querySelector(`#circuit-viewer-${t.data.unit_id} #${p} #layer-${(b = t.data.layer_match) == null ? void 0 : b.layer}--interaction-wrap`);
  })), l = ((c = (u = (o = t == null ? void 0 : t.data) == null ? void 0 : o.layer_match) == null ? void 0 : u.colleagues) == null ? void 0 : c.map((p) => document.querySelector(`#circuit-viewer-${t.data.unit_id} #${t.data.this_circuit_id} .gate-wrap.layer-${p[0]}.gate-${p[1]}`))) || [], ((h = (d = t == null ? void 0 : t.data) == null ? void 0 : d.layer_match) == null ? void 0 : h.layer) !== void 0 && l.push(...t.data.matched_circuit_id.map((p) => {
    var b, g;
    return document.querySelector(`#circuit-viewer-${t.data.unit_id} #${p} .gate-wrap.layer-${(b = t.data.layer_match) == null ? void 0 : b.layer}.gate-${(g = t.data.layer_match) == null ? void 0 : g.operation}`);
  }))) : t._class.includes(" on-machine") && (e = [], e.push(document.querySelector(`#circuit-viewer-${t.data.unit_id} #${t.data.original_circuit_id} .gate-wrap.layer-${t.data.original_layer_index}.gate-${t.data.original_operation_index}`)), l = [], l.push(document.querySelector(`#circuit-viewer-${t.data.unit_id} #${t.data.transpiled_circuit_id} .gate-wrap.layer-${t.data.layer_index}.gate-${t.data.operation_index}`))), [e, l];
}
function fo(t) {
  let e = [];
  return t._class.includes(" on-machine") && (e = [], e.push(document.querySelector(`#circuit-viewer-${t.data.unit_id} #${t.data.pulse_view_id} .pulse-path--layer-${t.data.layer_index}--op-${t.data.operation_index}`))), [e];
}
function pr(t) {
  return "<table>" + Object.keys(t).map((e) => e === "priority" ? "" : `<tr><th>${e}:</th><td>${t[e]}</td></tr>`).join(" ") + "</table>";
}
function w0(t, e, l) {
  let { data: i = {}, open_tool: n = () => {
  }, openTooltip: a = () => {
  }, closeTooltip: r = () => {
  }, moveTooltip: s = () => {
  } } = e;
  const o = (b) => {
    var g;
    if (i.role === "qubit-group" || i.role === "qubit-node--group") {
      let [v, y, k] = uo(i);
      v && (v.style.fill = i.data.match_color), y && (y.style.fill = i.data.match_color), k && (k.style.outline = `2px solid  ${i.data.match_color}`);
    } else if (i.role === "gate-group") {
      let [v, y] = ya(i);
      v && v.forEach((k) => {
        k && (k.style.fill = i.data.match_color, k.style.fillOpacity = 0.2);
      }), y && y.forEach((k) => {
        k && (k.style.outline = `2px solid  ${i.data.match_color}`);
      });
    } else if (i.role === "op-layer-operation-group") {
      let [v, y] = ya(i);
      v && v.forEach((w) => {
        w && (w.style.outline = `2px solid  ${i.data.match_color}`);
      }), y && y.forEach((w) => {
        w && (w.style.outline = `2px solid  ${i.data.match_color}`);
      });
      let [k] = fo(i);
      k && k.forEach((w) => {
        w && (w.style.outline = `2px solid  ${i.data.match_color}`);
      });
    }
    if ((g = i == null ? void 0 : i.data) != null && g.tooltip_content) {
      let v = pr(i.data.tooltip_content);
      a(b, v, !1, i.data.tooltip_content.priority);
    }
  }, u = (b) => {
    s(b);
  }, c = (b) => {
    var g;
    if (i.role === "qubit-group" || i.role === "qubit-node--group") {
      let [v, y, k] = uo(i);
      v && (v.style.fill = "transparent"), y && (y.style.fill = "transparent"), k && (k.style.outline = null);
    } else if (i.role === "gate-group") {
      let [v, y] = ya(i);
      v && v.forEach((k) => {
        k && (k.style.fill = "transparent");
      }), y && y.forEach((k) => {
        k && (k.style.outline = null);
      });
    } else if (i.role === "op-layer-operation-group") {
      let [v, y] = ya(i);
      v && v.forEach((w) => {
        w && (w.style.outline = null);
      }), y && y.forEach((w) => {
        w && (w.style.outline = null);
      });
      let [k] = fo(i);
      k && k.forEach((w) => {
        w && (w.style.outline = null);
      });
    }
    (g = i == null ? void 0 : i.data) != null && g.tooltip_content && r();
  }, d = (b) => {
    var g;
    if (b.preventDefault(), (g = i == null ? void 0 : i.data) != null && g.tooltip_content) {
      let v = pr(i.data.tooltip_content);
      a(b, v, !0, i.data.tooltip_content.priority);
    }
  }, h = (b) => {
    b.preventDefault(), r(!0);
  }, p = (b) => {
    var g;
    if (b.preventDefault(), (g = i == null ? void 0 : i.data) != null && g.tooltip_content) {
      let v = pr(i.data.tooltip_content);
      a(b, v, !0, i.data.tooltip_content.priority);
    }
  };
  return t.$$set = (b) => {
    "data" in b && l(0, i = b.data), "open_tool" in b && l(1, n = b.open_tool), "openTooltip" in b && l(2, a = b.openTooltip), "closeTooltip" in b && l(3, r = b.closeTooltip), "moveTooltip" in b && l(4, s = b.moveTooltip);
  }, [
    i,
    n,
    a,
    r,
    s,
    o,
    u,
    c,
    d,
    h,
    p
  ];
}
class $0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, w0, y0, Le, {
      data: 0,
      open_tool: 1,
      openTooltip: 2,
      closeTooltip: 3,
      moveTooltip: 4
    });
  }
}
function _o(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h;
  return {
    c() {
      e = Xe("line"), f(e, "id", l = /*data*/
      t[0].id), f(e, "class", i = /*data*/
      t[0]._class), f(e, "data-role", n = /*data*/
      t[0].role), f(e, "x1", a = /*data*/
      t[0].x1), f(e, "y1", r = /*data*/
      t[0].y1), f(e, "x2", s = /*data*/
      t[0].x2 !== void 0 ? (
        /*data*/
        t[0].x2
      ) : (
        /*data*/
        t[0].x1
      )), f(e, "y2", o = /*data*/
      t[0].y2 !== void 0 ? (
        /*data*/
        t[0].y2
      ) : (
        /*data*/
        t[0].y1
      )), f(e, "stroke", u = /*data*/
      t[0].stroke || ze), f(e, "stroke-width", c = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), f(e, "stroke-opacity", d = /*data*/
      t[0]["stroke-opacity"] !== void 0 ? (
        /*data*/
        t[0]["stroke-opacity"]
      ) : 1), f(e, "stroke-dasharray", h = /*data*/
      t[0]["stroke-dasharray"] ?? "");
    },
    m(p, b) {
      C(p, e, b);
    },
    p(p, b) {
      b & /*data*/
      1 && l !== (l = /*data*/
      p[0].id) && f(e, "id", l), b & /*data*/
      1 && i !== (i = /*data*/
      p[0]._class) && f(e, "class", i), b & /*data*/
      1 && n !== (n = /*data*/
      p[0].role) && f(e, "data-role", n), b & /*data*/
      1 && a !== (a = /*data*/
      p[0].x1) && f(e, "x1", a), b & /*data*/
      1 && r !== (r = /*data*/
      p[0].y1) && f(e, "y1", r), b & /*data*/
      1 && s !== (s = /*data*/
      p[0].x2 !== void 0 ? (
        /*data*/
        p[0].x2
      ) : (
        /*data*/
        p[0].x1
      )) && f(e, "x2", s), b & /*data*/
      1 && o !== (o = /*data*/
      p[0].y2 !== void 0 ? (
        /*data*/
        p[0].y2
      ) : (
        /*data*/
        p[0].y1
      )) && f(e, "y2", o), b & /*data*/
      1 && u !== (u = /*data*/
      p[0].stroke || ze) && f(e, "stroke", u), b & /*data*/
      1 && c !== (c = /*data*/
      p[0]["stroke-width"] !== void 0 ? (
        /*data*/
        p[0]["stroke-width"]
      ) : 1) && f(e, "stroke-width", c), b & /*data*/
      1 && d !== (d = /*data*/
      p[0]["stroke-opacity"] !== void 0 ? (
        /*data*/
        p[0]["stroke-opacity"]
      ) : 1) && f(e, "stroke-opacity", d), b & /*data*/
      1 && h !== (h = /*data*/
      p[0]["stroke-dasharray"] ?? "") && f(e, "stroke-dasharray", h);
    },
    d(p) {
      p && T(e);
    }
  };
}
function q0(t) {
  let e, l = (
    /*data*/
    t[0] && _o(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = _o(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function j0(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
class zm extends Ve {
  constructor(e) {
    super(), Qe(this, e, j0, q0, Le, { data: 0 });
  }
}
function co(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p;
  return {
    c() {
      e = Xe("rect"), f(e, "id", l = /*data*/
      t[0].id), f(e, "class", i = /*data*/
      t[0]._class), f(e, "data-role", n = /*data*/
      t[0].role), f(e, "x", a = /*data*/
      t[0].x), f(e, "y", r = /*data*/
      t[0].y), f(e, "width", s = /*data*/
      t[0].width), f(e, "height", o = /*data*/
      t[0].height), f(e, "stroke", u = /*data*/
      t[0].stroke || ze), f(e, "stroke-width", c = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), f(e, "fill", d = /*data*/
      t[0].fill || it), f(e, "fill-opacity", h = /*data*/
      t[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        t[0]["fill-opacity"]
      ) : 1), f(e, "transform", p = /*data*/
      t[0].transform);
    },
    m(b, g) {
      C(b, e, g);
    },
    p(b, g) {
      g & /*data*/
      1 && l !== (l = /*data*/
      b[0].id) && f(e, "id", l), g & /*data*/
      1 && i !== (i = /*data*/
      b[0]._class) && f(e, "class", i), g & /*data*/
      1 && n !== (n = /*data*/
      b[0].role) && f(e, "data-role", n), g & /*data*/
      1 && a !== (a = /*data*/
      b[0].x) && f(e, "x", a), g & /*data*/
      1 && r !== (r = /*data*/
      b[0].y) && f(e, "y", r), g & /*data*/
      1 && s !== (s = /*data*/
      b[0].width) && f(e, "width", s), g & /*data*/
      1 && o !== (o = /*data*/
      b[0].height) && f(e, "height", o), g & /*data*/
      1 && u !== (u = /*data*/
      b[0].stroke || ze) && f(e, "stroke", u), g & /*data*/
      1 && c !== (c = /*data*/
      b[0]["stroke-width"] !== void 0 ? (
        /*data*/
        b[0]["stroke-width"]
      ) : 1) && f(e, "stroke-width", c), g & /*data*/
      1 && d !== (d = /*data*/
      b[0].fill || it) && f(e, "fill", d), g & /*data*/
      1 && h !== (h = /*data*/
      b[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        b[0]["fill-opacity"]
      ) : 1) && f(e, "fill-opacity", h), g & /*data*/
      1 && p !== (p = /*data*/
      b[0].transform) && f(e, "transform", p);
    },
    d(b) {
      b && T(e);
    }
  };
}
function T0(t) {
  let e, l = (
    /*data*/
    t[0] && co(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = co(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function C0(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
class S0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, C0, T0, Le, { data: 0 });
  }
}
function ho(t) {
  let e, l = (
    /*data*/
    t[0].text + ""
  ), i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w;
  return {
    c() {
      e = Xe("text"), i = E(l), f(e, "id", n = /*data*/
      t[0].id), f(e, "class", a = Gt(
        /*data*/
        t[0]._class
      ) + " svelte-128zimx"), f(e, "data-role", r = /*data*/
      t[0].role), f(e, "x", s = /*data*/
      t[0].x), f(e, "y", o = /*data*/
      t[0].y), f(e, "width", u = /*data*/
      t[0].width), f(e, "height", c = /*data*/
      t[0].height), f(e, "text-anchor", d = /*data*/
      t[0]["text-anchor"]), f(e, "alignment-baseline", h = /*data*/
      t[0]["alignment-baseline"]), f(e, "font-size", p = /*data*/
      t[0]["font-size"] || 12), f(e, "font-weight", b = /*data*/
      t[0]["font-weight"]), f(e, "font-style", g = /*data*/
      t[0]["font-style"]), f(e, "fill", v = /*data*/
      t[0].fill), f(e, "transform", y = /*data*/
      t[0].transform), f(e, "stroke", k = /*data*/
      t[0].stroke || "#000000"), f(e, "stroke-width", w = /*data*/
      t[0]["stroke-width"] || 0);
    },
    m($, q) {
      C($, e, q), _(e, i);
    },
    p($, q) {
      q & /*data*/
      1 && l !== (l = /*data*/
      $[0].text + "") && Y(i, l), q & /*data*/
      1 && n !== (n = /*data*/
      $[0].id) && f(e, "id", n), q & /*data*/
      1 && a !== (a = Gt(
        /*data*/
        $[0]._class
      ) + " svelte-128zimx") && f(e, "class", a), q & /*data*/
      1 && r !== (r = /*data*/
      $[0].role) && f(e, "data-role", r), q & /*data*/
      1 && s !== (s = /*data*/
      $[0].x) && f(e, "x", s), q & /*data*/
      1 && o !== (o = /*data*/
      $[0].y) && f(e, "y", o), q & /*data*/
      1 && u !== (u = /*data*/
      $[0].width) && f(e, "width", u), q & /*data*/
      1 && c !== (c = /*data*/
      $[0].height) && f(e, "height", c), q & /*data*/
      1 && d !== (d = /*data*/
      $[0]["text-anchor"]) && f(e, "text-anchor", d), q & /*data*/
      1 && h !== (h = /*data*/
      $[0]["alignment-baseline"]) && f(e, "alignment-baseline", h), q & /*data*/
      1 && p !== (p = /*data*/
      $[0]["font-size"] || 12) && f(e, "font-size", p), q & /*data*/
      1 && b !== (b = /*data*/
      $[0]["font-weight"]) && f(e, "font-weight", b), q & /*data*/
      1 && g !== (g = /*data*/
      $[0]["font-style"]) && f(e, "font-style", g), q & /*data*/
      1 && v !== (v = /*data*/
      $[0].fill) && f(e, "fill", v), q & /*data*/
      1 && y !== (y = /*data*/
      $[0].transform) && f(e, "transform", y), q & /*data*/
      1 && k !== (k = /*data*/
      $[0].stroke || "#000000") && f(e, "stroke", k), q & /*data*/
      1 && w !== (w = /*data*/
      $[0]["stroke-width"] || 0) && f(e, "stroke-width", w);
    },
    d($) {
      $ && T(e);
    }
  };
}
function M0(t) {
  let e, l = (
    /*data*/
    t[0] && ho(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = ho(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function z0(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
class Nm extends Ve {
  constructor(e) {
    super(), Qe(this, e, z0, M0, Le, { data: 0 });
  }
}
function po(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R;
  return {
    c() {
      e = Xe("g"), l = Xe("line"), g = A(), v = Xe("g"), y = Xe("line"), f(l, "id", i = /*data*/
      t[0].id + "-0"), f(l, "x1", n = /*data*/
      t[0].cx), f(l, "y1", a = /*data*/
      t[0].cy), f(l, "x2", r = /*data*/
      t[0].cx + /*data*/
      t[0].width), f(l, "y2", s = /*data*/
      t[0].cy + /*data*/
      t[0].height), f(l, "stroke", o = /*data*/
      t[0].stroke || ze), f(l, "stroke-width", u = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), f(l, "stroke-opacity", c = /*data*/
      t[0]["stroke-opacity"] !== void 0 ? (
        /*data*/
        t[0]["stroke-opacity"]
      ) : 1), f(l, "transform", d = `translate(-${/*data*/
      t[0].width / 2}, -${/*data*/
      t[0].height / 2})`), f(e, "id", h = /*data*/
      t[0].id), f(e, "class", p = /*data*/
      t[0]._class), f(e, "data-role", b = /*data*/
      t[0].role), f(y, "id", k = /*data*/
      t[0].id + "-0"), f(y, "x1", w = /*data*/
      t[0].cx + /*data*/
      t[0].width), f(y, "y1", $ = /*data*/
      t[0].cy), f(y, "x2", q = /*data*/
      t[0].cx), f(y, "y2", j = /*data*/
      t[0].cy + /*data*/
      t[0].height), f(y, "stroke", O = /*data*/
      t[0].stroke || ze), f(y, "stroke-width", z = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), f(y, "stroke-opacity", N = /*data*/
      t[0]["stroke-opacity"] !== void 0 ? (
        /*data*/
        t[0]["stroke-opacity"]
      ) : 1), f(y, "transform", M = `translate(-${/*data*/
      t[0].width / 2}, -${/*data*/
      t[0].height / 2})`), f(v, "id", H = /*data*/
      t[0].id), f(v, "class", B = /*data*/
      t[0]._class), f(v, "data-role", R = /*data*/
      t[0].role);
    },
    m(P, I) {
      C(P, e, I), _(e, l), C(P, g, I), C(P, v, I), _(v, y);
    },
    p(P, I) {
      I & /*data*/
      1 && i !== (i = /*data*/
      P[0].id + "-0") && f(l, "id", i), I & /*data*/
      1 && n !== (n = /*data*/
      P[0].cx) && f(l, "x1", n), I & /*data*/
      1 && a !== (a = /*data*/
      P[0].cy) && f(l, "y1", a), I & /*data*/
      1 && r !== (r = /*data*/
      P[0].cx + /*data*/
      P[0].width) && f(l, "x2", r), I & /*data*/
      1 && s !== (s = /*data*/
      P[0].cy + /*data*/
      P[0].height) && f(l, "y2", s), I & /*data*/
      1 && o !== (o = /*data*/
      P[0].stroke || ze) && f(l, "stroke", o), I & /*data*/
      1 && u !== (u = /*data*/
      P[0]["stroke-width"] !== void 0 ? (
        /*data*/
        P[0]["stroke-width"]
      ) : 1) && f(l, "stroke-width", u), I & /*data*/
      1 && c !== (c = /*data*/
      P[0]["stroke-opacity"] !== void 0 ? (
        /*data*/
        P[0]["stroke-opacity"]
      ) : 1) && f(l, "stroke-opacity", c), I & /*data*/
      1 && d !== (d = `translate(-${/*data*/
      P[0].width / 2}, -${/*data*/
      P[0].height / 2})`) && f(l, "transform", d), I & /*data*/
      1 && h !== (h = /*data*/
      P[0].id) && f(e, "id", h), I & /*data*/
      1 && p !== (p = /*data*/
      P[0]._class) && f(e, "class", p), I & /*data*/
      1 && b !== (b = /*data*/
      P[0].role) && f(e, "data-role", b), I & /*data*/
      1 && k !== (k = /*data*/
      P[0].id + "-0") && f(y, "id", k), I & /*data*/
      1 && w !== (w = /*data*/
      P[0].cx + /*data*/
      P[0].width) && f(y, "x1", w), I & /*data*/
      1 && $ !== ($ = /*data*/
      P[0].cy) && f(y, "y1", $), I & /*data*/
      1 && q !== (q = /*data*/
      P[0].cx) && f(y, "x2", q), I & /*data*/
      1 && j !== (j = /*data*/
      P[0].cy + /*data*/
      P[0].height) && f(y, "y2", j), I & /*data*/
      1 && O !== (O = /*data*/
      P[0].stroke || ze) && f(y, "stroke", O), I & /*data*/
      1 && z !== (z = /*data*/
      P[0]["stroke-width"] !== void 0 ? (
        /*data*/
        P[0]["stroke-width"]
      ) : 1) && f(y, "stroke-width", z), I & /*data*/
      1 && N !== (N = /*data*/
      P[0]["stroke-opacity"] !== void 0 ? (
        /*data*/
        P[0]["stroke-opacity"]
      ) : 1) && f(y, "stroke-opacity", N), I & /*data*/
      1 && M !== (M = `translate(-${/*data*/
      P[0].width / 2}, -${/*data*/
      P[0].height / 2})`) && f(y, "transform", M), I & /*data*/
      1 && H !== (H = /*data*/
      P[0].id) && f(v, "id", H), I & /*data*/
      1 && B !== (B = /*data*/
      P[0]._class) && f(v, "class", B), I & /*data*/
      1 && R !== (R = /*data*/
      P[0].role) && f(v, "data-role", R);
    },
    d(P) {
      P && (T(e), T(g), T(v));
    }
  };
}
function N0(t) {
  let e, l = (
    /*data*/
    t[0] && po(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = po(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function A0(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
class B0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, A0, N0, Le, { data: 0 });
  }
}
function mo(t) {
  let e, l, i, n, a, r, s, o, u, c;
  return {
    c() {
      e = Xe("path"), f(e, "id", l = /*data*/
      t[0].id), f(e, "class", i = /*data*/
      t[0]._class), f(e, "data-role", n = /*data*/
      t[0].role), f(e, "d", a = /*data*/
      t[0].path), f(e, "stroke", r = /*data*/
      t[0].stroke || ze), f(e, "stroke-width", s = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), f(e, "fill", o = /*data*/
      t[0].fill || it), f(e, "fill-opacity", u = /*data*/
      t[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        t[0]["fill-opacity"]
      ) : 1), f(e, "transform", c = /*data*/
      t[0].transform);
    },
    m(d, h) {
      C(d, e, h);
    },
    p(d, h) {
      h & /*data*/
      1 && l !== (l = /*data*/
      d[0].id) && f(e, "id", l), h & /*data*/
      1 && i !== (i = /*data*/
      d[0]._class) && f(e, "class", i), h & /*data*/
      1 && n !== (n = /*data*/
      d[0].role) && f(e, "data-role", n), h & /*data*/
      1 && a !== (a = /*data*/
      d[0].path) && f(e, "d", a), h & /*data*/
      1 && r !== (r = /*data*/
      d[0].stroke || ze) && f(e, "stroke", r), h & /*data*/
      1 && s !== (s = /*data*/
      d[0]["stroke-width"] !== void 0 ? (
        /*data*/
        d[0]["stroke-width"]
      ) : 1) && f(e, "stroke-width", s), h & /*data*/
      1 && o !== (o = /*data*/
      d[0].fill || it) && f(e, "fill", o), h & /*data*/
      1 && u !== (u = /*data*/
      d[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        d[0]["fill-opacity"]
      ) : 1) && f(e, "fill-opacity", u), h & /*data*/
      1 && c !== (c = /*data*/
      d[0].transform) && f(e, "transform", c);
    },
    d(d) {
      d && T(e);
    }
  };
}
function P0(t) {
  let e, l = (
    /*data*/
    t[0] && mo(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = mo(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function E0(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
let O0 = class extends Ve {
  constructor(e) {
    super(), Qe(this, e, E0, P0, Le, { data: 0 });
  }
};
function I0(t) {
  let e, l;
  return e = new O0({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function D0(t) {
  let e, l;
  return e = new B0({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function R0(t) {
  let e, l;
  return e = new Nm({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function H0(t) {
  let e, l;
  return e = new _0({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function F0(t) {
  let e, l;
  return e = new h0({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function L0(t) {
  let e, l;
  return e = new S0({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Q0(t) {
  let e, l;
  return e = new k0({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function V0(t) {
  let e, l;
  return e = new zm({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function X0(t) {
  let e, l;
  return e = new g0({
    props: {
      data: (
        /*data*/
        t[0]
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), n & /*open_tool*/
      2 && (a.open_tool = /*open_tool*/
      i[1]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function G0(t) {
  let e, l;
  return e = new $0({
    props: {
      data: (
        /*data*/
        t[0]
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      ),
      openTooltip: (
        /*openTooltip*/
        t[2]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[3]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[4]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), n & /*open_tool*/
      2 && (a.open_tool = /*open_tool*/
      i[1]), n & /*openTooltip*/
      4 && (a.openTooltip = /*openTooltip*/
      i[2]), n & /*closeTooltip*/
      8 && (a.closeTooltip = /*closeTooltip*/
      i[3]), n & /*moveTooltip*/
      16 && (a.moveTooltip = /*moveTooltip*/
      i[4]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Y0(t) {
  let e, l, i, n;
  const a = [
    G0,
    X0,
    V0,
    Q0,
    L0,
    F0,
    H0,
    R0,
    D0,
    I0
  ], r = [];
  function s(o, u) {
    var c, d, h, p, b, g, v, y, k, w;
    return (
      /*data*/
      ((c = o[0]) == null ? void 0 : c.type) === "g" ? 0 : (
        /*data*/
        ((d = o[0]) == null ? void 0 : d.type) === "click-wrap" ? 1 : (
          /*data*/
          ((h = o[0]) == null ? void 0 : h.type) === "line" ? 2 : (
            /*data*/
            ((p = o[0]) == null ? void 0 : p.type) === "double-line" ? 3 : (
              /*data*/
              ((b = o[0]) == null ? void 0 : b.type) === "rect" ? 4 : (
                /*data*/
                ((g = o[0]) == null ? void 0 : g.type) === "circle" ? 5 : (
                  /*data*/
                  ((v = o[0]) == null ? void 0 : v.type) === "arrow-end" ? 6 : (
                    /*data*/
                    ((y = o[0]) == null ? void 0 : y.type) === "text" ? 7 : (
                      /*data*/
                      ((k = o[0]) == null ? void 0 : k.type) === "x" ? 8 : (
                        /*data*/
                        ((w = o[0]) == null ? void 0 : w.type) === "path" ? 9 : -1
                      )
                    )
                  )
                )
              )
            )
          )
        )
      )
    );
  }
  return ~(e = s(t)) && (l = r[e] = a[e](t)), {
    c() {
      l && l.c(), i = Be();
    },
    m(o, u) {
      ~e && r[e].m(o, u), C(o, i, u), n = !0;
    },
    p(o, [u]) {
      let c = e;
      e = s(o), e === c ? ~e && r[e].p(o, u) : (l && (ge(), D(r[c], 1, 1, () => {
        r[c] = null;
      }), be()), ~e ? (l = r[e], l ? l.p(o, u) : (l = r[e] = a[e](o), l.c()), S(l, 1), l.m(i.parentNode, i)) : l = null);
    },
    i(o) {
      n || (S(l), n = !0);
    },
    o(o) {
      D(l), n = !1;
    },
    d(o) {
      o && T(i), ~e && r[e].d(o);
    }
  };
}
function K0(t, e, l) {
  let { data: i = {}, open_tool: n = () => {
  }, openTooltip: a = () => {
  }, closeTooltip: r = () => {
  }, moveTooltip: s = () => {
  } } = e;
  return t.$$set = (o) => {
    "data" in o && l(0, i = o.data), "open_tool" in o && l(1, n = o.open_tool), "openTooltip" in o && l(2, a = o.openTooltip), "closeTooltip" in o && l(3, r = o.closeTooltip), "moveTooltip" in o && l(4, s = o.moveTooltip);
  }, [i, n, a, r, s];
}
class ut extends Ve {
  constructor(e) {
    super(), Qe(this, e, K0, Y0, Le, {
      data: 0,
      open_tool: 1,
      openTooltip: 2,
      closeTooltip: 3,
      moveTooltip: 4
    });
  }
}
function go(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R = (
    /*drawPlan*/
    t[4].groups.phase_marker && bo(t)
  ), P = (
    /*drawPlan*/
    t[4].groups.qubit_group && vo(t)
  ), I = (
    /*drawPlan*/
    t[4].groups.esp_axis_group && ko(t)
  ), L = (
    /*drawPlan*/
    t[4].groups.phase_marker && yo(t)
  ), F = (
    /*drawPlan*/
    t[4].groups.moment_group && wo(t)
  ), X = (
    /*drawPlan*/
    t[4].groups.qubit_group && $o(t)
  ), V = (
    /*drawPlan*/
    t[4].groups.circuit_line_group && qo(t)
  ), Q = (
    /*drawPlan*/
    t[4].groups.circuit_group && jo(t)
  ), J = (
    /*drawPlan*/
    t[4].groups.esp_axis_group && To(t)
  ), te = (
    /*drawPlan*/
    t[4].groups.esp_group && Co(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = Xe("svg"), n = Xe("style"), a = E(`g {
            font-family: Iosevka;
            font-size: 14px;
          }
        `), R && R.c(), r = Be(), P && P.c(), s = Be(), I && I.c(), p = A(), b = m("div"), g = Xe("svg"), v = Xe("style"), y = E(`g {
            font-family: Iosevka;
            font-size: 14px;
          }
        `), L && L.c(), k = Be(), F && F.c(), w = Be(), X && X.c(), $ = Be(), V && V.c(), q = Be(), Q && Q.c(), j = Be(), J && J.c(), O = Be(), te && te.c(), f(i, "id", o = /*id*/
      t[0] + "-sticky"), f(i, "width", u = /*drawPlan*/
      t[4].groups.qubit_group.x + /*drawPlan*/
      t[4].groups.qubit_group.width), f(i, "height", c = /*drawPlan*/
      t[4].height), f(i, "viewBox", d = /*drawPlan*/
      t[4].viewBox.map(
        /*func*/
        t[16]
      ).join(" ")), f(l, "class", "circuit-sticky svelte-1011ir3"), f(l, "style", h = `width: ${/*drawPlan*/
      t[4].groups.qubit_group.x + /*drawPlan*/
      t[4].groups.qubit_group.width}px; height:${/*drawPlan*/
      t[4].height}px;`), f(
        g,
        "id",
        /*id*/
        t[0]
      ), f(g, "width", z = /*drawPlan*/
      t[4].width), f(g, "height", N = /*drawPlan*/
      t[4].height), f(g, "viewBox", M = /*drawPlan*/
      t[4].viewBox.join(" ")), f(b, "class", "circuit-main svelte-1011ir3"), f(e, "id", H = /*id*/
      t[0] + "-wrapper"), f(e, "class", "ciruit-view-wrapper svelte-1011ir3"), Mt(e, "position", "relative"), Mt(e, "width", "100%"), Mt(e, "overflow-x", "scroll"), Mt(e, "overflow-y", "hidden");
    },
    m(ie, U) {
      C(ie, e, U), _(e, l), _(l, i), _(i, n), _(n, a), R && R.m(i, null), _(i, r), P && P.m(i, null), _(i, s), I && I.m(i, null), _(e, p), _(e, b), _(b, g), _(g, v), _(v, y), L && L.m(g, null), _(g, k), F && F.m(g, null), _(g, w), X && X.m(g, null), _(g, $), V && V.m(g, null), _(g, q), Q && Q.m(g, null), _(g, j), J && J.m(g, null), _(g, O), te && te.m(g, null), B = !0;
    },
    p(ie, U) {
      /*drawPlan*/
      ie[4].groups.phase_marker ? R ? (R.p(ie, U), U & /*drawPlan*/
      16 && S(R, 1)) : (R = bo(ie), R.c(), S(R, 1), R.m(i, r)) : R && (ge(), D(R, 1, 1, () => {
        R = null;
      }), be()), /*drawPlan*/
      ie[4].groups.qubit_group ? P ? (P.p(ie, U), U & /*drawPlan*/
      16 && S(P, 1)) : (P = vo(ie), P.c(), S(P, 1), P.m(i, s)) : P && (ge(), D(P, 1, 1, () => {
        P = null;
      }), be()), /*drawPlan*/
      ie[4].groups.esp_axis_group ? I ? (I.p(ie, U), U & /*drawPlan*/
      16 && S(I, 1)) : (I = ko(ie), I.c(), S(I, 1), I.m(i, null)) : I && (ge(), D(I, 1, 1, () => {
        I = null;
      }), be()), (!B || U & /*id*/
      1 && o !== (o = /*id*/
      ie[0] + "-sticky")) && f(i, "id", o), (!B || U & /*drawPlan*/
      16 && u !== (u = /*drawPlan*/
      ie[4].groups.qubit_group.x + /*drawPlan*/
      ie[4].groups.qubit_group.width)) && f(i, "width", u), (!B || U & /*drawPlan*/
      16 && c !== (c = /*drawPlan*/
      ie[4].height)) && f(i, "height", c), (!B || U & /*drawPlan*/
      16 && d !== (d = /*drawPlan*/
      ie[4].viewBox.map(
        /*func*/
        ie[16]
      ).join(" "))) && f(i, "viewBox", d), (!B || U & /*drawPlan*/
      16 && h !== (h = `width: ${/*drawPlan*/
      ie[4].groups.qubit_group.x + /*drawPlan*/
      ie[4].groups.qubit_group.width}px; height:${/*drawPlan*/
      ie[4].height}px;`)) && f(l, "style", h), /*drawPlan*/
      ie[4].groups.phase_marker ? L ? (L.p(ie, U), U & /*drawPlan*/
      16 && S(L, 1)) : (L = yo(ie), L.c(), S(L, 1), L.m(g, k)) : L && (ge(), D(L, 1, 1, () => {
        L = null;
      }), be()), /*drawPlan*/
      ie[4].groups.moment_group ? F ? (F.p(ie, U), U & /*drawPlan*/
      16 && S(F, 1)) : (F = wo(ie), F.c(), S(F, 1), F.m(g, w)) : F && (ge(), D(F, 1, 1, () => {
        F = null;
      }), be()), /*drawPlan*/
      ie[4].groups.qubit_group ? X ? (X.p(ie, U), U & /*drawPlan*/
      16 && S(X, 1)) : (X = $o(ie), X.c(), S(X, 1), X.m(g, $)) : X && (ge(), D(X, 1, 1, () => {
        X = null;
      }), be()), /*drawPlan*/
      ie[4].groups.circuit_line_group ? V ? (V.p(ie, U), U & /*drawPlan*/
      16 && S(V, 1)) : (V = qo(ie), V.c(), S(V, 1), V.m(g, q)) : V && (ge(), D(V, 1, 1, () => {
        V = null;
      }), be()), /*drawPlan*/
      ie[4].groups.circuit_group ? Q ? (Q.p(ie, U), U & /*drawPlan*/
      16 && S(Q, 1)) : (Q = jo(ie), Q.c(), S(Q, 1), Q.m(g, j)) : Q && (ge(), D(Q, 1, 1, () => {
        Q = null;
      }), be()), /*drawPlan*/
      ie[4].groups.esp_axis_group ? J ? (J.p(ie, U), U & /*drawPlan*/
      16 && S(J, 1)) : (J = To(ie), J.c(), S(J, 1), J.m(g, O)) : J && (ge(), D(J, 1, 1, () => {
        J = null;
      }), be()), /*drawPlan*/
      ie[4].groups.esp_group ? te ? (te.p(ie, U), U & /*drawPlan*/
      16 && S(te, 1)) : (te = Co(ie), te.c(), S(te, 1), te.m(g, null)) : te && (ge(), D(te, 1, 1, () => {
        te = null;
      }), be()), (!B || U & /*id*/
      1) && f(
        g,
        "id",
        /*id*/
        ie[0]
      ), (!B || U & /*drawPlan*/
      16 && z !== (z = /*drawPlan*/
      ie[4].width)) && f(g, "width", z), (!B || U & /*drawPlan*/
      16 && N !== (N = /*drawPlan*/
      ie[4].height)) && f(g, "height", N), (!B || U & /*drawPlan*/
      16 && M !== (M = /*drawPlan*/
      ie[4].viewBox.join(" "))) && f(g, "viewBox", M), (!B || U & /*id*/
      1 && H !== (H = /*id*/
      ie[0] + "-wrapper")) && f(e, "id", H);
    },
    i(ie) {
      B || (S(R), S(P), S(I), S(L), S(F), S(X), S(V), S(Q), S(J), S(te), B = !0);
    },
    o(ie) {
      D(R), D(P), D(I), D(L), D(F), D(X), D(V), D(Q), D(J), D(te), B = !1;
    },
    d(ie) {
      ie && T(e), R && R.d(), P && P.d(), I && I.d(), L && L.d(), F && F.d(), X && X.d(), V && V.d(), Q && Q.d(), J && J.d(), te && te.d();
    }
  };
}
function bo(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[4].groups.phase_marker
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      16 && (a.data = /*drawPlan*/
      i[4].groups.phase_marker), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function vo(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[4].groups.qubit_group
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      16 && (a.data = /*drawPlan*/
      i[4].groups.qubit_group), n & /*open_tool*/
      2 && (a.open_tool = /*open_tool*/
      i[1]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function ko(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[4].groups.esp_axis_group
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      16 && (a.data = /*drawPlan*/
      i[4].groups.esp_axis_group), n & /*open_tool*/
      2 && (a.open_tool = /*open_tool*/
      i[1]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function yo(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[4].groups.phase_marker
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      16 && (a.data = /*drawPlan*/
      i[4].groups.phase_marker), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function wo(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[4].groups.moment_group
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      16 && (a.data = /*drawPlan*/
      i[4].groups.moment_group), n & /*open_tool*/
      2 && (a.open_tool = /*open_tool*/
      i[1]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function $o(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[4].groups.qubit_group
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      16 && (a.data = /*drawPlan*/
      i[4].groups.qubit_group), n & /*open_tool*/
      2 && (a.open_tool = /*open_tool*/
      i[1]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function qo(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[4].groups.circuit_line_group
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      16 && (a.data = /*drawPlan*/
      i[4].groups.circuit_line_group), n & /*open_tool*/
      2 && (a.open_tool = /*open_tool*/
      i[1]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function jo(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[4].groups.circuit_group
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      16 && (a.data = /*drawPlan*/
      i[4].groups.circuit_group), n & /*open_tool*/
      2 && (a.open_tool = /*open_tool*/
      i[1]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function To(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[4].groups.esp_axis_group
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      16 && (a.data = /*drawPlan*/
      i[4].groups.esp_axis_group), n & /*open_tool*/
      2 && (a.open_tool = /*open_tool*/
      i[1]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Co(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[4].groups.esp_group
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      16 && (a.data = /*drawPlan*/
      i[4].groups.esp_group), n & /*open_tool*/
      2 && (a.open_tool = /*open_tool*/
      i[1]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function U0(t) {
  let e;
  return {
    c() {
      e = m("div"), e.textContent = "Click or hover to see details. Double-click for further details.", f(e, "class", "g-tooltip deactive svelte-1011ir3");
    },
    m(l, i) {
      C(l, e, i);
    },
    p: ae,
    d(l) {
      l && T(e);
    }
  };
}
function W0(t) {
  let e;
  return {
    c() {
      e = m("div"), f(e, "class", "g-tooltip svelte-1011ir3");
    },
    m(l, i) {
      C(l, e, i), e.innerHTML = /*tootlip_content*/
      t[3];
    },
    p(l, i) {
      i & /*tootlip_content*/
      8 && (e.innerHTML = /*tootlip_content*/
      l[3]);
    },
    d(l) {
      l && T(e);
    }
  };
}
function J0(t) {
  let e, l, i, n = (
    /*drawPlan*/
    t[4] && go(t)
  );
  function a(o, u) {
    return (
      /*showTooltip*/
      o[2] ? W0 : U0
    );
  }
  let r = a(t), s = r(t);
  return {
    c() {
      n && n.c(), e = A(), s.c(), l = Be();
    },
    m(o, u) {
      n && n.m(o, u), C(o, e, u), s.m(o, u), C(o, l, u), i = !0;
    },
    p(o, [u]) {
      /*drawPlan*/
      o[4] ? n ? (n.p(o, u), u & /*drawPlan*/
      16 && S(n, 1)) : (n = go(o), n.c(), S(n, 1), n.m(e.parentNode, e)) : n && (ge(), D(n, 1, 1, () => {
        n = null;
      }), be()), r === (r = a(o)) && s ? s.p(o, u) : (s.d(1), s = r(o), s && (s.c(), s.m(l.parentNode, l)));
    },
    i(o) {
      i || (S(n), i = !0);
    },
    o(o) {
      D(n), i = !1;
    },
    d(o) {
      o && (T(e), T(l)), n && n.d(o), s.d(o);
    }
  };
}
function Z0(t, e, l) {
  let { circuit_data: i, is_original: n = !0, match: a, id: r, matched_circuit_id: s, matched_machine_id: o, machine_moment_at: u = Pe(), open_tool: c = () => {
  }, filter_unused_qubits: d = !0, unit_id: h } = e, p = !1, b, g = !1, v = 999;
  function y(j, O, z, N) {
    g && !z || v < N || (l(2, p = !0), j.clientX + 5, j.clientY + 5, l(3, b = O), g = z, v = N || 0);
  }
  function k(j) {
    p && (j.clientX + 5, j.clientY + 5);
  }
  function w(j) {
    g || l(2, p = !1), j && (l(2, p = !1), v = 999);
  }
  let $;
  yt(() => {
    l(4, $ = Cr(i, {
      show_moments: !0,
      is_original: n,
      match: a,
      matched_circuit_id: s,
      this_circuit_id: r,
      matched_machine_id: o,
      filter_unused_qubits: d,
      unit_id: h
    })), u.subscribe((j) => {
      var z, N, M, H, B;
      let O = document.querySelector(`#${r} #layer-${j}--group`);
      if (O) {
        let R = document.querySelector("#" + r + "-wrapper"), P = document.querySelector("#" + r + "-sticky"), I = (z = R.getClientRects()[0]) == null ? void 0 : z.left, L = (N = R.getClientRects()[0]) == null ? void 0 : N.width, F = (M = P.getClientRects()[0]) == null ? void 0 : M.width, X = ((H = O.getClientRects()[0]) == null ? void 0 : H.left) - I - F, V = (B = O.getClientRects()[0]) == null ? void 0 : B.width;
        X < 0 ? R.scrollBy({
          top: 0,
          left: -L / 3,
          behavior: "smooth"
        }) : X + V > L - F && R.scrollBy({
          top: 0,
          left: L / 3,
          behavior: "smooth"
        });
      }
    });
  });
  const q = (j, O) => O == 2 ? $.groups.qubit_group.x + $.groups.qubit_group.width : j;
  return t.$$set = (j) => {
    "circuit_data" in j && l(8, i = j.circuit_data), "is_original" in j && l(9, n = j.is_original), "match" in j && l(10, a = j.match), "id" in j && l(0, r = j.id), "matched_circuit_id" in j && l(11, s = j.matched_circuit_id), "matched_machine_id" in j && l(12, o = j.matched_machine_id), "machine_moment_at" in j && l(13, u = j.machine_moment_at), "open_tool" in j && l(1, c = j.open_tool), "filter_unused_qubits" in j && l(14, d = j.filter_unused_qubits), "unit_id" in j && l(15, h = j.unit_id);
  }, t.$$.update = () => {
    t.$$.dirty & /*circuit_data, is_original, match, matched_circuit_id, id, matched_machine_id, filter_unused_qubits, unit_id*/
    57089 && l(4, $ = Cr(i, {
      show_moments: !0,
      is_original: n,
      match: a,
      matched_circuit_id: s,
      this_circuit_id: r,
      matched_machine_id: o,
      filter_unused_qubits: d,
      unit_id: h
    }));
  }, [
    r,
    c,
    p,
    b,
    $,
    y,
    k,
    w,
    i,
    n,
    a,
    s,
    o,
    u,
    d,
    h,
    q
  ];
}
class Am extends Ve {
  constructor(e) {
    super(), Qe(this, e, Z0, J0, Le, {
      circuit_data: 8,
      is_original: 9,
      match: 10,
      id: 0,
      matched_circuit_id: 11,
      matched_machine_id: 12,
      machine_moment_at: 13,
      open_tool: 1,
      filter_unused_qubits: 14,
      unit_id: 15
    });
  }
}
function So(t, e, l) {
  const i = t.slice();
  return i[1] = e[l], i[3] = l, i;
}
function Mo(t) {
  let e, l, i, n = (
    /*info*/
    t[0].layer_index + ""
  ), a, r, s, o, u, c, d, h = (
    /*info*/
    t[0].layer_index + ""
  ), p, b, g, v, y, k = (
    /*info*/
    t[0].esp_this + ""
  ), w, $, q, j, O, z = (
    /*info*/
    t[0].esp_total + ""
  ), N, M, H = we(
    /*info*/
    t[0].operations
  ), B = [];
  for (let R = 0; R < H.length; R += 1)
    B[R] = zo(So(t, H, R));
  return {
    c() {
      e = m("div"), l = m("h2"), i = E("ESP for Layer "), a = E(n), r = A(), s = m("div"), o = m("table"), u = m("tr"), c = m("th"), c.textContent = "Layer (moment)", d = m("td"), p = E(h), b = A(), g = m("tr"), v = m("th"), v.textContent = "Current ESP", y = m("td"), w = E(k), $ = A(), q = m("tr"), j = m("th"), j.textContent = "Cumulative ESP", O = m("td"), N = E(z), M = A();
      for (let R = 0; R < B.length; R += 1)
        B[R].c();
      f(l, "class", "svelte-1fh3lcn"), f(c, "class", "svelte-1fh3lcn"), f(d, "class", "svelte-1fh3lcn"), f(u, "class", "svelte-1fh3lcn"), f(v, "class", "svelte-1fh3lcn"), f(y, "class", "svelte-1fh3lcn"), f(g, "class", "svelte-1fh3lcn"), f(j, "class", "svelte-1fh3lcn"), f(O, "class", "svelte-1fh3lcn"), f(q, "class", "svelte-1fh3lcn"), f(o, "class", "svelte-1fh3lcn"), f(s, "class", "info-section svelte-1fh3lcn"), f(e, "class", "svelte-1fh3lcn");
    },
    m(R, P) {
      C(R, e, P), _(e, l), _(l, i), _(l, a), _(e, r), _(e, s), _(s, o), _(o, u), _(u, c), _(u, d), _(d, p), _(o, b), _(o, g), _(g, v), _(g, y), _(y, w), _(o, $), _(o, q), _(q, j), _(q, O), _(O, N), _(o, M);
      for (let I = 0; I < B.length; I += 1)
        B[I] && B[I].m(o, null);
    },
    p(R, P) {
      if (P & /*info*/
      1 && n !== (n = /*info*/
      R[0].layer_index + "") && Y(a, n), P & /*info*/
      1 && h !== (h = /*info*/
      R[0].layer_index + "") && Y(p, h), P & /*info*/
      1 && k !== (k = /*info*/
      R[0].esp_this + "") && Y(w, k), P & /*info*/
      1 && z !== (z = /*info*/
      R[0].esp_total + "") && Y(N, z), P & /*info*/
      1) {
        H = we(
          /*info*/
          R[0].operations
        );
        let I;
        for (I = 0; I < H.length; I += 1) {
          const L = So(R, H, I);
          B[I] ? B[I].p(L, P) : (B[I] = zo(L), B[I].c(), B[I].m(o, null));
        }
        for (; I < B.length; I += 1)
          B[I].d(1);
        B.length = H.length;
      }
    },
    d(R) {
      R && T(e), Ge(B, R);
    }
  };
}
function zo(t) {
  var w;
  let e, l, i, n = (
    /*op*/
    t[1].gate + ""
  ), a, r, s, o, u, c = (
    /*op*/
    t[1].qubits.map(No).join(", ") + ""
  ), d, h, p, b, g, v = (
    /*info*/
    ((w = t[0].detail[
      /*oi*/
      t[3]
    ]) == null ? void 0 : w.gate_error) + ""
  ), y, k;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = `Operation ${/*oi*/
      t[3]}`, i = m("td"), a = E(n), r = A(), s = m("tr"), o = m("th"), o.textContent = "Qubits", u = m("td"), d = E(c), h = A(), p = m("tr"), b = m("th"), b.textContent = "Gate_error", g = m("td"), y = E(v), k = A(), f(l, "class", "svelte-1fh3lcn"), f(i, "class", "svelte-1fh3lcn"), f(e, "class", "first svelte-1fh3lcn"), f(o, "class", "svelte-1fh3lcn"), f(u, "class", "svelte-1fh3lcn"), f(s, "class", "svelte-1fh3lcn"), f(b, "class", "svelte-1fh3lcn"), f(g, "class", "svelte-1fh3lcn"), f(p, "class", "svelte-1fh3lcn");
    },
    m($, q) {
      C($, e, q), _(e, l), _(e, i), _(i, a), C($, r, q), C($, s, q), _(s, o), _(s, u), _(u, d), C($, h, q), C($, p, q), _(p, b), _(p, g), _(g, y), _(p, k);
    },
    p($, q) {
      var j;
      q & /*info*/
      1 && n !== (n = /*op*/
      $[1].gate + "") && Y(a, n), q & /*info*/
      1 && c !== (c = /*op*/
      $[1].qubits.map(No).join(", ") + "") && Y(d, c), q & /*info*/
      1 && v !== (v = /*info*/
      ((j = $[0].detail[
        /*oi*/
        $[3]
      ]) == null ? void 0 : j.gate_error) + "") && Y(y, v);
    },
    d($) {
      $ && (T(e), T(r), T(s), T(h), T(p));
    }
  };
}
function x0(t) {
  let e, l = (
    /*info*/
    t[0] && Mo(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*info*/
      i[0] ? l ? l.p(i, n) : (l = Mo(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
const No = (t) => t.index;
function eb(t, e, l) {
  let { info: i } = e;
  return t.$$set = (n) => {
    "info" in n && l(0, i = n.info);
  }, [i];
}
class tb extends Ve {
  constructor(e) {
    super(), Qe(this, e, eb, x0, Le, { info: 0 });
  }
}
function Ao(t) {
  let e, l, i, n, a, r, s, o, u, c = (
    /*info*/
    t[0].gate_error_info.layer + ""
  ), d, h, p, b, g, v = (
    /*info*/
    t[0].gate_error_info.operation + ""
  ), y, k, w, $, q, j = (
    /*info*/
    t[0].gate_error_info.gate + ""
  ), O, z, N, M, H, B = (
    /*info*/
    t[0].gate_error_info.qubits.join(",") + ""
  ), R, P, I, L, F, X = (
    /*info*/
    t[0].gate_error_info.gate_error + ""
  ), V, Q, J, te, ie, U = (
    /*info*/
    t[0].gate_error_info.gate_duration + ""
  ), G, W, Z = (
    /*info*/
    t[0].gate_error_info.duration_unit && Bo(t)
  );
  return {
    c() {
      e = m("div"), l = m("h2"), l.textContent = "Gate Error Information", i = A(), n = m("div"), a = m("table"), r = m("tbody"), s = m("tr"), o = m("th"), o.textContent = "Layer", u = m("td"), d = E(c), h = A(), p = m("tr"), b = m("th"), b.textContent = "Operation", g = m("td"), y = E(v), k = A(), w = m("tr"), $ = m("th"), $.textContent = "Gate", q = m("td"), O = E(j), z = A(), N = m("tr"), M = m("th"), M.textContent = "Qubits", H = m("td"), R = E(B), P = A(), I = m("tr"), L = m("th"), L.textContent = "Gate error", F = m("td"), V = E(X), Q = A(), J = m("tr"), te = m("th"), te.textContent = "Gate duration", ie = m("td"), G = E(U), W = A(), Z && Z.c(), f(l, "class", "svelte-1h3inn9"), f(o, "class", "svelte-1h3inn9"), f(u, "class", "svelte-1h3inn9"), f(s, "class", "svelte-1h3inn9"), f(b, "class", "svelte-1h3inn9"), f(g, "class", "svelte-1h3inn9"), f(p, "class", "svelte-1h3inn9"), f($, "class", "svelte-1h3inn9"), f(q, "class", "svelte-1h3inn9"), f(w, "class", "svelte-1h3inn9"), f(M, "class", "svelte-1h3inn9"), f(H, "class", "svelte-1h3inn9"), f(N, "class", "svelte-1h3inn9"), f(L, "class", "svelte-1h3inn9"), f(F, "class", "svelte-1h3inn9"), f(I, "class", "svelte-1h3inn9"), f(te, "class", "svelte-1h3inn9"), f(ie, "class", "svelte-1h3inn9"), f(J, "class", "svelte-1h3inn9"), f(r, "class", "svelte-1h3inn9"), f(a, "class", "svelte-1h3inn9"), f(n, "class", "info-section svelte-1h3inn9"), f(e, "class", "svelte-1h3inn9");
    },
    m(ee, ye) {
      C(ee, e, ye), _(e, l), _(e, i), _(e, n), _(n, a), _(a, r), _(r, s), _(s, o), _(s, u), _(u, d), _(r, h), _(r, p), _(p, b), _(p, g), _(g, y), _(r, k), _(r, w), _(w, $), _(w, q), _(q, O), _(r, z), _(r, N), _(N, M), _(N, H), _(H, R), _(r, P), _(r, I), _(I, L), _(I, F), _(F, V), _(r, Q), _(r, J), _(J, te), _(J, ie), _(ie, G), _(ie, W), Z && Z.m(ie, null);
    },
    p(ee, ye) {
      ye & /*info*/
      1 && c !== (c = /*info*/
      ee[0].gate_error_info.layer + "") && Y(d, c), ye & /*info*/
      1 && v !== (v = /*info*/
      ee[0].gate_error_info.operation + "") && Y(y, v), ye & /*info*/
      1 && j !== (j = /*info*/
      ee[0].gate_error_info.gate + "") && Y(O, j), ye & /*info*/
      1 && B !== (B = /*info*/
      ee[0].gate_error_info.qubits.join(",") + "") && Y(R, B), ye & /*info*/
      1 && X !== (X = /*info*/
      ee[0].gate_error_info.gate_error + "") && Y(V, X), ye & /*info*/
      1 && U !== (U = /*info*/
      ee[0].gate_error_info.gate_duration + "") && Y(G, U), /*info*/
      ee[0].gate_error_info.duration_unit ? Z ? Z.p(ee, ye) : (Z = Bo(ee), Z.c(), Z.m(ie, null)) : Z && (Z.d(1), Z = null);
    },
    d(ee) {
      ee && T(e), Z && Z.d();
    }
  };
}
function Bo(t) {
  let e, l = (
    /*info*/
    t[0].gate_error_info.duration_unit + ""
  ), i, n;
  return {
    c() {
      e = E("("), i = E(l), n = E(")");
    },
    m(a, r) {
      C(a, e, r), C(a, i, r), C(a, n, r);
    },
    p(a, r) {
      r & /*info*/
      1 && l !== (l = /*info*/
      a[0].gate_error_info.duration_unit + "") && Y(i, l);
    },
    d(a) {
      a && (T(e), T(i), T(n));
    }
  };
}
function lb(t) {
  let e, l = (
    /*info*/
    t[0] && Ao(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*info*/
      i[0] ? l ? l.p(i, n) : (l = Ao(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function ib(t, e, l) {
  let { info: i } = e;
  return t.$$set = (n) => {
    "info" in n && l(0, i = n.info);
  }, [i];
}
class nb extends Ve {
  constructor(e) {
    super(), Qe(this, e, ib, lb, Le, { info: 0 });
  }
}
function Po(t, e, l) {
  const i = t.slice();
  return i[1] = e[l], i[3] = l, i;
}
function Eo(t) {
  var oe, x;
  let e, l, i, n = (
    /*info*/
    t[0].operation.gate + ""
  ), a, r, s = (
    /*info*/
    t[0].this_circuit_id === "original-circuit" ? "(original)" : ""
  ), o, u, c = (
    /*info*/
    t[0].this_circuit_id === "transpiled-circuit" ? "(transpiled)" : ""
  ), d, h, p, b, g, v, y, k = (
    /*info*/
    t[0].operation.gate + ""
  ), w, $, q, j, O, z = (
    /*info*/
    t[0].layer_index + ""
  ), N, M, H, B, R, P = (
    /*info*/
    t[0].operation_index + ""
  ), I, L, F, X, V, Q = (
    /*info*/
    t[0].operation.num_qubits + ""
  ), J, te, ie, U, G, W, Z = (
    /*info*/
    t[0].operation.num_clbits + ""
  ), ee, ye, qe, je, fe, _e = (
    /*info*/
    t[0].operation.num_qubits > 0 && Oo(t)
  ), K = (
    /*info*/
    t[0].operation.num_clbits > 0 && Io(t)
  ), ke = (
    /*info*/
    t[0].operation.params && Do(t)
  ), ue = (
    /*info*/
    ((oe = t[0].layer_match) == null ? void 0 : oe.matches) && /*info*/
    t[0].this_circuit_id === "original-circuit" && Ho(t)
  ), ne = (
    /*info*/
    ((x = t[0].layer_match) == null ? void 0 : x.colleagues) && /*info*/
    t[0].this_circuit_id === "transpiled-circuit" && Fo(t)
  );
  return {
    c() {
      e = m("div"), l = m("h2"), i = E("Operation "), a = E(n), r = A(), o = E(s), u = A(), d = E(c), h = A(), p = m("div"), b = m("table"), g = m("tr"), v = m("th"), v.textContent = "Gate name", y = m("td"), w = E(k), $ = A(), q = m("tr"), j = m("th"), j.textContent = "Layer (moment)", O = m("td"), N = E(z), M = A(), H = m("tr"), B = m("th"), B.textContent = "Operation index", R = m("td"), I = E(P), L = A(), F = m("tr"), X = m("th"), X.textContent = "# Qubits", V = m("td"), J = E(Q), te = A(), _e && _e.c(), ie = A(), U = m("tr"), G = m("th"), G.textContent = "# bits", W = m("td"), ee = E(Z), ye = A(), K && K.c(), qe = A(), ke && ke.c(), je = A(), ue && ue.c(), fe = A(), ne && ne.c(), f(l, "class", "svelte-w2ec5n"), f(v, "class", "svelte-w2ec5n"), f(y, "class", "svelte-w2ec5n"), f(j, "class", "svelte-w2ec5n"), f(O, "class", "svelte-w2ec5n"), f(B, "class", "svelte-w2ec5n"), f(R, "class", "svelte-w2ec5n"), f(X, "class", "svelte-w2ec5n"), f(V, "class", "svelte-w2ec5n"), f(G, "class", "svelte-w2ec5n"), f(W, "class", "svelte-w2ec5n"), f(b, "class", "svelte-w2ec5n"), f(p, "class", "info-section svelte-w2ec5n");
    },
    m(ve, se) {
      C(ve, e, se), _(e, l), _(l, i), _(l, a), _(l, r), _(l, o), _(l, u), _(l, d), _(e, h), _(e, p), _(p, b), _(b, g), _(g, v), _(g, y), _(y, w), _(b, $), _(b, q), _(q, j), _(q, O), _(O, N), _(b, M), _(b, H), _(H, B), _(H, R), _(R, I), _(b, L), _(b, F), _(F, X), _(F, V), _(V, J), _(b, te), _e && _e.m(b, null), _(b, ie), _(b, U), _(U, G), _(U, W), _(W, ee), _(b, ye), K && K.m(b, null), _(b, qe), ke && ke.m(b, null), _(b, je), ue && ue.m(b, null), _(b, fe), ne && ne.m(b, null);
    },
    p(ve, se) {
      var Re, Ce;
      se & /*info*/
      1 && n !== (n = /*info*/
      ve[0].operation.gate + "") && Y(a, n), se & /*info*/
      1 && s !== (s = /*info*/
      ve[0].this_circuit_id === "original-circuit" ? "(original)" : "") && Y(o, s), se & /*info*/
      1 && c !== (c = /*info*/
      ve[0].this_circuit_id === "transpiled-circuit" ? "(transpiled)" : "") && Y(d, c), se & /*info*/
      1 && k !== (k = /*info*/
      ve[0].operation.gate + "") && Y(w, k), se & /*info*/
      1 && z !== (z = /*info*/
      ve[0].layer_index + "") && Y(N, z), se & /*info*/
      1 && P !== (P = /*info*/
      ve[0].operation_index + "") && Y(I, P), se & /*info*/
      1 && Q !== (Q = /*info*/
      ve[0].operation.num_qubits + "") && Y(J, Q), /*info*/
      ve[0].operation.num_qubits > 0 ? _e ? _e.p(ve, se) : (_e = Oo(ve), _e.c(), _e.m(b, ie)) : _e && (_e.d(1), _e = null), se & /*info*/
      1 && Z !== (Z = /*info*/
      ve[0].operation.num_clbits + "") && Y(ee, Z), /*info*/
      ve[0].operation.num_clbits > 0 ? K ? K.p(ve, se) : (K = Io(ve), K.c(), K.m(b, qe)) : K && (K.d(1), K = null), /*info*/
      ve[0].operation.params ? ke ? ke.p(ve, se) : (ke = Do(ve), ke.c(), ke.m(b, je)) : ke && (ke.d(1), ke = null), /*info*/
      (Re = ve[0].layer_match) != null && Re.matches && /*info*/
      ve[0].this_circuit_id === "original-circuit" ? ue ? ue.p(ve, se) : (ue = Ho(ve), ue.c(), ue.m(b, fe)) : ue && (ue.d(1), ue = null), /*info*/
      (Ce = ve[0].layer_match) != null && Ce.colleagues && /*info*/
      ve[0].this_circuit_id === "transpiled-circuit" ? ne ? ne.p(ve, se) : (ne = Fo(ve), ne.c(), ne.m(b, null)) : ne && (ne.d(1), ne = null);
    },
    d(ve) {
      ve && T(e), _e && _e.d(), K && K.d(), ke && ke.d(), ue && ue.d(), ne && ne.d();
    }
  };
}
function Oo(t) {
  let e, l, i, n = (
    /*info*/
    t[0].operation.qubits.map(Lo).join(", ") + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Qubits", i = m("td"), a = E(n), f(l, "class", "svelte-w2ec5n"), f(i, "class", "svelte-w2ec5n");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*info*/
      1 && n !== (n = /*info*/
      r[0].operation.qubits.map(Lo).join(", ") + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function Io(t) {
  let e, l, i, n = (
    /*info*/
    t[0].operation.clbits.map(Qo).join(", ") + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Bits", i = m("td"), a = E(n), f(l, "class", "svelte-w2ec5n"), f(i, "class", "svelte-w2ec5n");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*info*/
      1 && n !== (n = /*info*/
      r[0].operation.clbits.map(Qo).join(", ") + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function Do(t) {
  let e, l = we(
    /*info*/
    t[0].operation.params
  ), i = [];
  for (let n = 0; n < l.length; n += 1)
    i[n] = Ro(Po(t, l, n));
  return {
    c() {
      for (let n = 0; n < i.length; n += 1)
        i[n].c();
      e = Be();
    },
    m(n, a) {
      for (let r = 0; r < i.length; r += 1)
        i[r] && i[r].m(n, a);
      C(n, e, a);
    },
    p(n, a) {
      if (a & /*info, undefined, Object*/
      1) {
        l = we(
          /*info*/
          n[0].operation.params
        );
        let r;
        for (r = 0; r < l.length; r += 1) {
          const s = Po(n, l, r);
          i[r] ? i[r].p(s, a) : (i[r] = Ro(s), i[r].c(), i[r].m(e.parentNode, e));
        }
        for (; r < i.length; r += 1)
          i[r].d(1);
        i.length = l.length;
      }
    },
    d(n) {
      n && T(e), Ge(i, n);
    }
  };
}
function ab(t) {
  let e;
  function l(a, r) {
    if (
      /*param*/
      a[1].expr !== void 0
    )
      return ub;
    if (
      /*param*/
      a[1].vector !== void 0 && /*param*/
      a[1].index !== void 0
    )
      return ob;
  }
  let i = l(t), n = i && i(t);
  return {
    c() {
      e = m("td"), n && n.c(), f(e, "class", "svelte-w2ec5n");
    },
    m(a, r) {
      C(a, e, r), n && n.m(e, null);
    },
    p(a, r) {
      i === (i = l(a)) && n ? n.p(a, r) : (n && n.d(1), n = i && i(a), n && (n.c(), n.m(e, null)));
    },
    d(a) {
      a && T(e), n && n.d();
    }
  };
}
function rb(t) {
  let e, l = (
    /*param*/
    t[1] + ""
  ), i;
  return {
    c() {
      e = m("td"), i = E(l), f(e, "class", "svelte-w2ec5n");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*info*/
      1 && l !== (l = /*param*/
      n[1] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function sb(t) {
  let e, l = Gi(
    /*param*/
    t[1],
    !0
  ) + "", i;
  return {
    c() {
      e = m("td"), i = E(l), f(e, "class", "svelte-w2ec5n");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*info*/
      1 && l !== (l = Gi(
        /*param*/
        n[1],
        !0
      ) + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function ob(t) {
  let e = (
    /*param*/
    t[1].vector + ""
  ), l, i, n = (
    /*param*/
    t[1].index + ""
  ), a, r;
  return {
    c() {
      l = E(e), i = E("["), a = E(n), r = E("]");
    },
    m(s, o) {
      C(s, l, o), C(s, i, o), C(s, a, o), C(s, r, o);
    },
    p(s, o) {
      o & /*info*/
      1 && e !== (e = /*param*/
      s[1].vector + "") && Y(l, e), o & /*info*/
      1 && n !== (n = /*param*/
      s[1].index + "") && Y(a, n);
    },
    d(s) {
      s && (T(l), T(i), T(a), T(r));
    }
  };
}
function ub(t) {
  let e = (
    /*param*/
    t[1].expr + ""
  ), l;
  return {
    c() {
      l = E(e);
    },
    m(i, n) {
      C(i, l, n);
    },
    p(i, n) {
      n & /*info*/
      1 && e !== (e = /*param*/
      i[1].expr + "") && Y(l, e);
    },
    d(i) {
      i && T(l);
    }
  };
}
function Ro(t) {
  let e, l, i, n;
  function a(o, u) {
    if (typeof /*param*/
    o[1] == "number")
      return sb;
    if (typeof /*param*/
    o[1] == "string")
      return rb;
    if (
      /*param*/
      o[1] instanceof Object
    )
      return ab;
  }
  let r = a(t), s = r && r(t);
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = `Parameter ${/*pi*/
      t[3] + 1}`, i = A(), s && s.c(), n = A(), f(l, "class", "svelte-w2ec5n");
    },
    m(o, u) {
      C(o, e, u), _(e, l), _(e, i), s && s.m(e, null), _(e, n);
    },
    p(o, u) {
      r === (r = a(o)) && s ? s.p(o, u) : (s && s.d(1), s = r && r(o), s && (s.c(), s.m(e, n)));
    },
    d(o) {
      o && T(e), s && s.d();
    }
  };
}
function Ho(t) {
  let e, l, i, n = (
    /*info*/
    t[0].layer_match.matches.map(Vo).join(", ") + ""
  ), a, r, s, o, u, c = (
    /*info*/
    t[0].layer_match.complete + ""
  ), d;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Matches (layer-op)", i = m("td"), a = E(n), r = A(), s = m("tr"), o = m("th"), o.textContent = "Complete match?", u = m("td"), d = E(c), f(l, "class", "svelte-w2ec5n"), f(i, "class", "svelte-w2ec5n"), f(o, "class", "svelte-w2ec5n"), f(u, "class", "svelte-w2ec5n");
    },
    m(h, p) {
      C(h, e, p), _(e, l), _(e, i), _(i, a), C(h, r, p), C(h, s, p), _(s, o), _(s, u), _(u, d);
    },
    p(h, p) {
      p & /*info*/
      1 && n !== (n = /*info*/
      h[0].layer_match.matches.map(Vo).join(", ") + "") && Y(a, n), p & /*info*/
      1 && c !== (c = /*info*/
      h[0].layer_match.complete + "") && Y(d, c);
    },
    d(h) {
      h && (T(e), T(r), T(s));
    }
  };
}
function Fo(t) {
  let e, l, i, n = (
    /*info*/
    t[0].layer_match.layer + ""
  ), a, r, s = (
    /*info*/
    t[0].layer_match.operation + ""
  ), o, u, c, d, h, p = (
    /*info*/
    t[0].layer_match.colleagues.map(Xo).join(", ") + ""
  ), b, g, v, y, k, w = (
    /*info*/
    t[0].layer_match.complete + ""
  ), $;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Transpiled from", i = m("td"), a = E(n), r = E("-"), o = E(s), u = A(), c = m("tr"), d = m("th"), d.textContent = "Other in-group ops", h = m("td"), b = E(p), g = A(), v = m("tr"), y = m("th"), y.textContent = "Complete match?", k = m("td"), $ = E(w), f(l, "class", "svelte-w2ec5n"), f(i, "class", "svelte-w2ec5n"), f(d, "class", "svelte-w2ec5n"), f(h, "class", "svelte-w2ec5n"), f(y, "class", "svelte-w2ec5n"), f(k, "class", "svelte-w2ec5n");
    },
    m(q, j) {
      C(q, e, j), _(e, l), _(e, i), _(i, a), _(i, r), _(i, o), C(q, u, j), C(q, c, j), _(c, d), _(c, h), _(h, b), C(q, g, j), C(q, v, j), _(v, y), _(v, k), _(k, $);
    },
    p(q, j) {
      j & /*info*/
      1 && n !== (n = /*info*/
      q[0].layer_match.layer + "") && Y(a, n), j & /*info*/
      1 && s !== (s = /*info*/
      q[0].layer_match.operation + "") && Y(o, s), j & /*info*/
      1 && p !== (p = /*info*/
      q[0].layer_match.colleagues.map(Xo).join(", ") + "") && Y(b, p), j & /*info*/
      1 && w !== (w = /*info*/
      q[0].layer_match.complete + "") && Y($, w);
    },
    d(q) {
      q && (T(e), T(u), T(c), T(g), T(v));
    }
  };
}
function fb(t) {
  let e, l = (
    /*info*/
    t[0] && Eo(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*info*/
      i[0] ? l ? l.p(i, n) : (l = Eo(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
const Lo = (t) => t.index, Qo = (t) => t.index, Vo = (t) => `${t[0]}-${t[1]}`, Xo = (t) => `${t[0]}-${t[1]}`;
function _b(t, e, l) {
  let { info: i } = e;
  return t.$$set = (n) => {
    "info" in n && l(0, i = n.info);
  }, [i];
}
class cb extends Ve {
  constructor(e) {
    super(), Qe(this, e, _b, fb, Le, { info: 0 });
  }
}
function Go(t, e, l) {
  const i = t.slice();
  return i[1] = e[l], i;
}
function Yo(t) {
  let e, l, i, n = we(
    /*info*/
    t[0].gate_info
  ), a = [];
  for (let r = 0; r < n.length; r += 1)
    a[r] = Wo(Go(t, n, r));
  return {
    c() {
      e = m("div"), l = m("h2"), l.textContent = "Gate Operation Information", i = A();
      for (let r = 0; r < a.length; r += 1)
        a[r].c();
      f(l, "class", "svelte-dn9fba"), f(e, "class", "svelte-dn9fba");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i);
      for (let o = 0; o < a.length; o += 1)
        a[o] && a[o].m(e, null);
    },
    p(r, s) {
      if (s & /*info*/
      1) {
        n = we(
          /*info*/
          r[0].gate_info
        );
        let o;
        for (o = 0; o < n.length; o += 1) {
          const u = Go(r, n, o);
          a[o] ? a[o].p(u, s) : (a[o] = Wo(u), a[o].c(), a[o].m(e, null));
        }
        for (; o < a.length; o += 1)
          a[o].d(1);
        a.length = n.length;
      }
    },
    d(r) {
      r && T(e), Ge(a, r);
    }
  };
}
function Ko(t) {
  let e, l, i, n = (
    /*item*/
    t[1].gate_error.value + ""
  ), a, r, s, o, u, c = (
    /*item*/
    t[1].gate_error.asof + ""
  ), d;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Gate error", i = m("td"), a = E(n), r = A(), s = m("tr"), o = m("th"), o.textContent = "As of", u = m("td"), d = E(c), f(l, "class", "svelte-dn9fba"), f(i, "class", "svelte-dn9fba"), f(e, "class", "svelte-dn9fba"), f(o, "class", "svelte-dn9fba"), f(u, "class", "svelte-dn9fba"), f(s, "class", "svelte-dn9fba");
    },
    m(h, p) {
      C(h, e, p), _(e, l), _(e, i), _(i, a), C(h, r, p), C(h, s, p), _(s, o), _(s, u), _(u, d);
    },
    p(h, p) {
      p & /*info*/
      1 && n !== (n = /*item*/
      h[1].gate_error.value + "") && Y(a, n), p & /*info*/
      1 && c !== (c = /*item*/
      h[1].gate_error.asof + "") && Y(d, c);
    },
    d(h) {
      h && (T(e), T(r), T(s));
    }
  };
}
function Uo(t) {
  let e, l, i, n = (
    /*item*/
    t[1].gate_length.value + ""
  ), a, r, s = (
    /*item*/
    t[1].gate_length.unit + ""
  ), o, u, c, d, h, p, b = (
    /*item*/
    t[1].gate_length.asof + ""
  ), g;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Gate length", i = m("td"), a = E(n), r = E(" ("), o = E(s), u = E(")"), c = A(), d = m("tr"), h = m("th"), h.textContent = "As of", p = m("td"), g = E(b), f(l, "class", "svelte-dn9fba"), f(i, "class", "svelte-dn9fba"), f(e, "class", "svelte-dn9fba"), f(h, "class", "svelte-dn9fba"), f(p, "class", "svelte-dn9fba"), f(d, "class", "svelte-dn9fba");
    },
    m(v, y) {
      C(v, e, y), _(e, l), _(e, i), _(i, a), _(i, r), _(i, o), _(i, u), C(v, c, y), C(v, d, y), _(d, h), _(d, p), _(p, g);
    },
    p(v, y) {
      y & /*info*/
      1 && n !== (n = /*item*/
      v[1].gate_length.value + "") && Y(a, n), y & /*info*/
      1 && s !== (s = /*item*/
      v[1].gate_length.unit + "") && Y(o, s), y & /*info*/
      1 && b !== (b = /*item*/
      v[1].gate_length.asof + "") && Y(g, b);
    },
    d(v) {
      v && (T(e), T(c), T(d));
    }
  };
}
function Wo(t) {
  let e, l, i, n, a, r, s = (
    /*item*/
    t[1].gate + ""
  ), o, u, c, d, h, p, b = (
    /*item*/
    t[1].qubits.join(", ") + ""
  ), g, v, y, k, w = (
    /*item*/
    t[1].gate_error && Ko(t)
  ), $ = (
    /*item*/
    t[1].gate_length && Uo(t)
  );
  return {
    c() {
      e = m("div"), l = m("table"), i = m("thead"), n = m("tr"), a = m("th"), a.textContent = "Gate", r = m("th"), o = E(s), u = A(), c = m("tbody"), d = m("tr"), h = m("th"), h.textContent = "Qubits", p = m("td"), g = E(b), v = A(), w && w.c(), y = A(), $ && $.c(), k = A(), f(a, "class", "svelte-dn9fba"), f(r, "class", "svelte-dn9fba"), f(n, "class", "svelte-dn9fba"), f(i, "class", "svelte-dn9fba"), f(h, "class", "svelte-dn9fba"), f(p, "class", "svelte-dn9fba"), f(d, "class", "svelte-dn9fba"), f(c, "class", "svelte-dn9fba"), f(l, "class", "svelte-dn9fba"), f(e, "class", "info-section svelte-dn9fba");
    },
    m(q, j) {
      C(q, e, j), _(e, l), _(l, i), _(i, n), _(n, a), _(n, r), _(r, o), _(l, u), _(l, c), _(c, d), _(d, h), _(d, p), _(p, g), _(c, v), w && w.m(c, null), _(c, y), $ && $.m(c, null), _(e, k);
    },
    p(q, j) {
      j & /*info*/
      1 && s !== (s = /*item*/
      q[1].gate + "") && Y(o, s), j & /*info*/
      1 && b !== (b = /*item*/
      q[1].qubits.join(", ") + "") && Y(g, b), /*item*/
      q[1].gate_error ? w ? w.p(q, j) : (w = Ko(q), w.c(), w.m(c, y)) : w && (w.d(1), w = null), /*item*/
      q[1].gate_length ? $ ? $.p(q, j) : ($ = Uo(q), $.c(), $.m(c, null)) : $ && ($.d(1), $ = null);
    },
    d(q) {
      q && T(e), w && w.d(), $ && $.d();
    }
  };
}
function db(t) {
  let e, l = (
    /*info*/
    t[0] && Yo(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*info*/
      i[0] ? l ? l.p(i, n) : (l = Yo(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function hb(t, e, l) {
  let { info: i } = e;
  return t.$$set = (n) => {
    "info" in n && l(0, i = n.info);
  }, [i];
}
class pb extends Ve {
  constructor(e) {
    super(), Qe(this, e, hb, db, Le, { info: 0 });
  }
}
function Jo(t) {
  let e, l, i, n = (
    /*info*/
    t[0].qubit.index + ""
  ), a, r, s = (
    /*info*/
    t[0].this_circuit_id === "original-circuit" ? "(original)" : ""
  ), o, u, c = (
    /*info*/
    t[0].this_circuit_id === "transpiled-circuit" ? "(transpiled)" : ""
  ), d, h, p, b, g, v, y, k = (
    /*info*/
    t[0].qubit.index + ""
  ), w, $, q, j = (
    /*info*/
    t[0].qubit.register && Zo(t)
  ), O = (
    /*info*/
    t[0].bit_match !== void 0 && xo(t)
  );
  return {
    c() {
      e = m("div"), l = m("h2"), i = E("Qubit "), a = E(n), r = A(), o = E(s), u = A(), d = E(c), h = A(), p = m("div"), b = m("table"), g = m("tr"), v = m("th"), v.textContent = "Qubit index", y = m("td"), w = E(k), $ = A(), j && j.c(), q = A(), O && O.c(), f(l, "class", "svelte-rb4g2h"), f(v, "class", "svelte-rb4g2h"), f(y, "class", "svelte-rb4g2h"), f(g, "class", "svelte-rb4g2h"), f(b, "class", "svelte-rb4g2h"), f(p, "class", "info-section svelte-rb4g2h"), f(e, "class", "svelte-rb4g2h");
    },
    m(z, N) {
      C(z, e, N), _(e, l), _(l, i), _(l, a), _(l, r), _(l, o), _(l, u), _(l, d), _(e, h), _(e, p), _(p, b), _(b, g), _(g, v), _(g, y), _(y, w), _(b, $), j && j.m(b, null), _(b, q), O && O.m(b, null);
    },
    p(z, N) {
      N & /*info*/
      1 && n !== (n = /*info*/
      z[0].qubit.index + "") && Y(a, n), N & /*info*/
      1 && s !== (s = /*info*/
      z[0].this_circuit_id === "original-circuit" ? "(original)" : "") && Y(o, s), N & /*info*/
      1 && c !== (c = /*info*/
      z[0].this_circuit_id === "transpiled-circuit" ? "(transpiled)" : "") && Y(d, c), N & /*info*/
      1 && k !== (k = /*info*/
      z[0].qubit.index + "") && Y(w, k), /*info*/
      z[0].qubit.register ? j ? j.p(z, N) : (j = Zo(z), j.c(), j.m(b, q)) : j && (j.d(1), j = null), /*info*/
      z[0].bit_match !== void 0 ? O ? O.p(z, N) : (O = xo(z), O.c(), O.m(b, null)) : O && (O.d(1), O = null);
    },
    d(z) {
      z && T(e), j && j.d(), O && O.d();
    }
  };
}
function Zo(t) {
  let e, l, i, n = (
    /*info*/
    t[0].qubit.register.name + ""
  ), a, r, s = (
    /*info*/
    t[0].qubit.register.size + ""
  ), o, u;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Register", i = m("td"), a = E(n), r = E(" ("), o = E(s), u = E(")"), f(l, "class", "svelte-rb4g2h"), f(i, "class", "svelte-rb4g2h"), f(e, "class", "svelte-rb4g2h");
    },
    m(c, d) {
      C(c, e, d), _(e, l), _(e, i), _(i, a), _(i, r), _(i, o), _(i, u);
    },
    p(c, d) {
      d & /*info*/
      1 && n !== (n = /*info*/
      c[0].qubit.register.name + "") && Y(a, n), d & /*info*/
      1 && s !== (s = /*info*/
      c[0].qubit.register.size + "") && Y(o, s);
    },
    d(c) {
      c && T(e);
    }
  };
}
function xo(t) {
  let e, l, i, n = (
    /*info*/
    t[0].bit_match.to + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Transpiled to", i = m("td"), a = E(n), f(l, "class", "svelte-rb4g2h"), f(i, "class", "svelte-rb4g2h"), f(e, "class", "svelte-rb4g2h");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*info*/
      1 && n !== (n = /*info*/
      r[0].bit_match.to + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function mb(t) {
  let e, l = (
    /*info*/
    t[0] && Jo(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*info*/
      i[0] ? l ? l.p(i, n) : (l = Jo(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function gb(t, e, l) {
  let { info: i } = e;
  return t.$$set = (n) => {
    "info" in n && l(0, i = n.info);
  }, [i];
}
class bb extends Ve {
  constructor(e) {
    super(), Qe(this, e, gb, mb, Le, { info: 0 });
  }
}
function eu(t) {
  let e, l, i, n, a, r, s, o, u, c = (
    /*info*/
    t[0].original_qubit_id + ""
  ), d, h, p, b, g, v = (
    /*info*/
    t[0].qubit_id + ""
  ), y, k, w, $, q = (
    /*info*/
    t[0].readout_error && tu(t)
  ), j = (
    /*info*/
    t[0].esp_value && /*$machine_moment_at*/
    t[2] !== void 0 && lu(t)
  ), O = (
    /*info*/
    t[0].cummul_duration !== void 0 && /*$machine_moment_at*/
    t[2] !== void 0 && iu(t)
  );
  return {
    c() {
      e = m("div"), l = m("h2"), l.textContent = "Machine Qubit Information", i = A(), n = m("div"), a = m("table"), r = m("tbody"), s = m("tr"), o = m("th"), o.textContent = "From", u = m("td"), d = E(c), h = A(), p = m("tr"), b = m("th"), b.textContent = "To", g = m("td"), y = E(v), k = A(), q && q.c(), w = A(), j && j.c(), $ = A(), O && O.c(), f(l, "class", "svelte-1u88l4o"), f(o, "class", "svelte-1u88l4o"), f(u, "class", "svelte-1u88l4o"), f(s, "class", "svelte-1u88l4o"), f(b, "class", "svelte-1u88l4o"), f(g, "class", "svelte-1u88l4o"), f(p, "class", "svelte-1u88l4o"), f(r, "class", "svelte-1u88l4o"), f(a, "class", "svelte-1u88l4o"), f(n, "class", "info-section svelte-1u88l4o"), f(e, "class", "svelte-1u88l4o");
    },
    m(z, N) {
      C(z, e, N), _(e, l), _(e, i), _(e, n), _(n, a), _(a, r), _(r, s), _(s, o), _(s, u), _(u, d), _(r, h), _(r, p), _(p, b), _(p, g), _(g, y), _(r, k), q && q.m(r, null), _(r, w), j && j.m(r, null), _(r, $), O && O.m(r, null);
    },
    p(z, N) {
      N & /*info*/
      1 && c !== (c = /*info*/
      z[0].original_qubit_id + "") && Y(d, c), N & /*info*/
      1 && v !== (v = /*info*/
      z[0].qubit_id + "") && Y(y, v), /*info*/
      z[0].readout_error ? q ? q.p(z, N) : (q = tu(z), q.c(), q.m(r, w)) : q && (q.d(1), q = null), /*info*/
      z[0].esp_value && /*$machine_moment_at*/
      z[2] !== void 0 ? j ? j.p(z, N) : (j = lu(z), j.c(), j.m(r, $)) : j && (j.d(1), j = null), /*info*/
      z[0].cummul_duration !== void 0 && /*$machine_moment_at*/
      z[2] !== void 0 ? O ? O.p(z, N) : (O = iu(z), O.c(), O.m(r, null)) : O && (O.d(1), O = null);
    },
    d(z) {
      z && T(e), q && q.d(), j && j.d(), O && O.d();
    }
  };
}
function tu(t) {
  let e, l, i, n = (
    /*info*/
    t[0].readout_error.value + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Readout error", i = m("td"), a = E(n), f(l, "class", "svelte-1u88l4o"), f(i, "class", "svelte-1u88l4o"), f(e, "class", "svelte-1u88l4o");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*info*/
      1 && n !== (n = /*info*/
      r[0].readout_error.value + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function lu(t) {
  let e, l, i, n, a, r = (
    /*info*/
    t[0].esp_value[
      /*$machine_moment_at*/
      t[2]
    ] + ""
  ), s;
  return {
    c() {
      e = m("tr"), l = m("th"), i = E("ESP at "), n = E(
        /*$machine_moment_at*/
        t[2]
      ), a = m("td"), s = E(r), f(l, "class", "svelte-1u88l4o"), f(a, "class", "svelte-1u88l4o"), f(e, "class", "svelte-1u88l4o");
    },
    m(o, u) {
      C(o, e, u), _(e, l), _(l, i), _(l, n), _(e, a), _(a, s);
    },
    p(o, u) {
      u & /*$machine_moment_at*/
      4 && Y(
        n,
        /*$machine_moment_at*/
        o[2]
      ), u & /*info, $machine_moment_at*/
      5 && r !== (r = /*info*/
      o[0].esp_value[
        /*$machine_moment_at*/
        o[2]
      ] + "") && Y(s, r);
    },
    d(o) {
      o && T(e);
    }
  };
}
function iu(t) {
  let e, l, i, n, a, r = (
    /*info*/
    t[0].cummul_duration + ""
  ), s;
  return {
    c() {
      e = m("tr"), l = m("th"), i = E("Cummulative duration at "), n = E(
        /*$machine_moment_at*/
        t[2]
      ), a = m("td"), s = E(r), f(l, "class", "svelte-1u88l4o"), f(a, "class", "svelte-1u88l4o"), f(e, "class", "svelte-1u88l4o");
    },
    m(o, u) {
      C(o, e, u), _(e, l), _(l, i), _(l, n), _(e, a), _(a, s);
    },
    p(o, u) {
      u & /*$machine_moment_at*/
      4 && Y(
        n,
        /*$machine_moment_at*/
        o[2]
      ), u & /*info*/
      1 && r !== (r = /*info*/
      o[0].cummul_duration + "") && Y(s, r);
    },
    d(o) {
      o && T(e);
    }
  };
}
function vb(t) {
  let e, l = (
    /*info*/
    t[0] && eu(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*info*/
      i[0] ? l ? l.p(i, n) : (l = eu(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function kb(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(s, (o) => l(2, i = o)), s);
  t.$$.on_destroy.push(() => n());
  let { info: r, machine_moment_at: s = Pe() } = e;
  return a(), t.$$set = (o) => {
    "info" in o && l(0, r = o.info), "machine_moment_at" in o && a(l(1, s = o.machine_moment_at));
  }, [r, s, i];
}
class yb extends Ve {
  constructor(e) {
    super(), Qe(this, e, kb, vb, Le, { info: 0, machine_moment_at: 1 });
  }
}
function ii(t) {
  try {
    navigator.clipboard.writeText(t), alert("Copied!");
  } catch {
    alert("Copy failed.. :(");
  }
}
function nu(t) {
  let e, l, i, n = (
    /*info*/
    t[0].qasm_version + ""
  ), a, r, s = (
    /*info*/
    t[0].title + ""
  ), o, u, c, d, h, p, b = (
    /*info*/
    t[0].qasm + ""
  ), g, v, y;
  return {
    c() {
      e = m("div"), l = m("h2"), i = E("QASM"), a = E(n), r = E(" for "), o = E(s), u = A(), c = m("button"), c.textContent = "Copy", d = A(), h = m("div"), p = m("pre"), g = E(b), f(c, "class", "svelte-1c6sep5"), f(l, "class", "svelte-1c6sep5"), f(p, "class", "svelte-1c6sep5"), f(h, "class", "info-section svelte-1c6sep5"), f(e, "class", "svelte-1c6sep5");
    },
    m(k, w) {
      C(k, e, w), _(e, l), _(l, i), _(l, a), _(l, r), _(l, o), _(l, u), _(l, c), _(e, d), _(e, h), _(h, p), _(p, g), v || (y = le(
        c,
        "click",
        /*click_handler*/
        t[1]
      ), v = !0);
    },
    p(k, w) {
      w & /*info*/
      1 && n !== (n = /*info*/
      k[0].qasm_version + "") && Y(a, n), w & /*info*/
      1 && s !== (s = /*info*/
      k[0].title + "") && Y(o, s), w & /*info*/
      1 && b !== (b = /*info*/
      k[0].qasm + "") && Y(g, b);
    },
    d(k) {
      k && T(e), v = !1, y();
    }
  };
}
function wb(t) {
  let e, l = (
    /*info*/
    t[0] && nu(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*info*/
      i[0] ? l ? l.p(i, n) : (l = nu(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function $b(t, e, l) {
  let { info: i } = e;
  const n = (a) => {
    ii(i.qasm);
  };
  return t.$$set = (a) => {
    "info" in a && l(0, i = a.info);
  }, [i, n];
}
class qb extends Ve {
  constructor(e) {
    super(), Qe(this, e, $b, wb, Le, { info: 0 });
  }
}
function ai(t, e) {
  return t == null || e == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function jb(t, e) {
  return t == null || e == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function Bm(t) {
  let e, l, i;
  t.length !== 2 ? (e = ai, l = (s, o) => ai(t(s), o), i = (s, o) => t(s) - o) : (e = t === ai || t === jb ? t : Tb, l = t, i = t);
  function n(s, o, u = 0, c = s.length) {
    if (u < c) {
      if (e(o, o) !== 0)
        return c;
      do {
        const d = u + c >>> 1;
        l(s[d], o) < 0 ? u = d + 1 : c = d;
      } while (u < c);
    }
    return u;
  }
  function a(s, o, u = 0, c = s.length) {
    if (u < c) {
      if (e(o, o) !== 0)
        return c;
      do {
        const d = u + c >>> 1;
        l(s[d], o) <= 0 ? u = d + 1 : c = d;
      } while (u < c);
    }
    return u;
  }
  function r(s, o, u = 0, c = s.length) {
    const d = n(s, o, u, c - 1);
    return d > u && i(s[d - 1], o) > -i(s[d], o) ? d - 1 : d;
  }
  return { left: n, center: r, right: a };
}
function Tb() {
  return 0;
}
function Cb(t) {
  return t === null ? NaN : +t;
}
function* Sb(t, e) {
  if (e === void 0)
    for (let l of t)
      l != null && (l = +l) >= l && (yield l);
  else {
    let l = -1;
    for (let i of t)
      (i = e(i, ++l, t)) != null && (i = +i) >= i && (yield i);
  }
}
const Mb = Bm(ai), zb = Mb.right;
Bm(Cb).center;
const Pm = zb;
function Nb(t, e) {
  let l = 0;
  if (e === void 0)
    for (let i of t)
      i != null && (i = +i) >= i && ++l;
  else {
    let i = -1;
    for (let n of t)
      (n = e(n, ++i, t)) != null && (n = +n) >= n && ++l;
  }
  return l;
}
function mr(t, e) {
  let l, i;
  if (e === void 0)
    for (const n of t)
      n != null && (l === void 0 ? n >= n && (l = i = n) : (l > n && (l = n), i < n && (i = n)));
  else {
    let n = -1;
    for (let a of t)
      (a = e(a, ++n, t)) != null && (l === void 0 ? a >= a && (l = i = a) : (l > a && (l = a), i < a && (i = a)));
  }
  return [l, i];
}
class au extends Map {
  constructor(e, l = Pb) {
    if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: l } }), e != null)
      for (const [i, n] of e)
        this.set(i, n);
  }
  get(e) {
    return super.get(ru(this, e));
  }
  has(e) {
    return super.has(ru(this, e));
  }
  set(e, l) {
    return super.set(Ab(this, e), l);
  }
  delete(e) {
    return super.delete(Bb(this, e));
  }
}
function ru({ _intern: t, _key: e }, l) {
  const i = e(l);
  return t.has(i) ? t.get(i) : l;
}
function Ab({ _intern: t, _key: e }, l) {
  const i = e(l);
  return t.has(i) ? t.get(i) : (t.set(i, l), l);
}
function Bb({ _intern: t, _key: e }, l) {
  const i = e(l);
  return t.has(i) && (l = t.get(i), t.delete(i)), l;
}
function Pb(t) {
  return t !== null && typeof t == "object" ? t.valueOf() : t;
}
function Eb(t) {
  return t;
}
function Ob(t = ai) {
  if (t === ai)
    return Em;
  if (typeof t != "function")
    throw new TypeError("compare is not a function");
  return (e, l) => {
    const i = t(e, l);
    return i || i === 0 ? i : (t(l, l) === 0) - (t(e, e) === 0);
  };
}
function Em(t, e) {
  return (t == null || !(t >= t)) - (e == null || !(e >= e)) || (t < e ? -1 : t > e ? 1 : 0);
}
var Ib = Array.prototype, Db = Ib.slice;
function gr(t) {
  return () => t;
}
const Rb = Math.sqrt(50), Hb = Math.sqrt(10), Fb = Math.sqrt(2);
function Pa(t, e, l) {
  const i = (e - t) / Math.max(0, l), n = Math.floor(Math.log10(i)), a = i / Math.pow(10, n), r = a >= Rb ? 10 : a >= Hb ? 5 : a >= Fb ? 2 : 1;
  let s, o, u;
  return n < 0 ? (u = Math.pow(10, -n) / r, s = Math.round(t * u), o = Math.round(e * u), s / u < t && ++s, o / u > e && --o, u = -u) : (u = Math.pow(10, n) * r, s = Math.round(t / u), o = Math.round(e / u), s * u < t && ++s, o * u > e && --o), o < s && 0.5 <= l && l < 2 ? Pa(t, e, l * 2) : [s, o, u];
}
function Om(t, e, l) {
  if (e = +e, t = +t, l = +l, !(l > 0))
    return [];
  if (t === e)
    return [t];
  const i = e < t, [n, a, r] = i ? Pa(e, t, l) : Pa(t, e, l);
  if (!(a >= n))
    return [];
  const s = a - n + 1, o = new Array(s);
  if (i)
    if (r < 0)
      for (let u = 0; u < s; ++u)
        o[u] = (a - u) / -r;
    else
      for (let u = 0; u < s; ++u)
        o[u] = (a - u) * r;
  else if (r < 0)
    for (let u = 0; u < s; ++u)
      o[u] = (n + u) / -r;
  else
    for (let u = 0; u < s; ++u)
      o[u] = (n + u) * r;
  return o;
}
function Yi(t, e, l) {
  return e = +e, t = +t, l = +l, Pa(t, e, l)[2];
}
function Lb(t, e, l) {
  e = +e, t = +t, l = +l;
  const i = e < t, n = i ? Yi(e, t, l) : Yi(t, e, l);
  return (i ? -1 : 1) * (n < 0 ? 1 / -n : n);
}
function Qb(t, e, l) {
  let i;
  for (; ; ) {
    const n = Yi(t, e, l);
    if (n === i || n === 0 || !isFinite(n))
      return [t, e];
    n > 0 ? (t = Math.floor(t / n) * n, e = Math.ceil(e / n) * n) : n < 0 && (t = Math.ceil(t * n) / n, e = Math.floor(e * n) / n), i = n;
  }
}
function Vb(t) {
  return Math.max(1, Math.ceil(Math.log(Nb(t)) / Math.LN2) + 1);
}
function Xb() {
  var t = Eb, e = mr, l = Vb;
  function i(n) {
    Array.isArray(n) || (n = Array.from(n));
    var a, r = n.length, s, o, u = new Array(r);
    for (a = 0; a < r; ++a)
      u[a] = t(n[a], a, n);
    var c = e(u), d = c[0], h = c[1], p = l(u, d, h);
    if (!Array.isArray(p)) {
      const w = h, $ = +p;
      if (e === mr && ([d, h] = Qb(d, h, $)), p = Om(d, h, $), p[0] <= d && (o = Yi(d, h, $)), p[p.length - 1] >= h)
        if (w >= h && e === mr) {
          const q = Yi(d, h, $);
          isFinite(q) && (q > 0 ? h = (Math.floor(h / q) + 1) * q : q < 0 && (h = (Math.ceil(h * -q) + 1) / -q));
        } else
          p.pop();
    }
    for (var b = p.length, g = 0, v = b; p[g] <= d; )
      ++g;
    for (; p[v - 1] > h; )
      --v;
    (g || v < b) && (p = p.slice(g, v), b = v - g);
    var y = new Array(b + 1), k;
    for (a = 0; a <= b; ++a)
      k = y[a] = [], k.x0 = a > 0 ? p[a - 1] : d, k.x1 = a < b ? p[a] : h;
    if (isFinite(o)) {
      if (o > 0)
        for (a = 0; a < r; ++a)
          (s = u[a]) != null && d <= s && s <= h && y[Math.min(b, Math.floor((s - d) / o))].push(n[a]);
      else if (o < 0) {
        for (a = 0; a < r; ++a)
          if ((s = u[a]) != null && d <= s && s <= h) {
            const w = Math.floor((d - s) * o);
            y[Math.min(b, w + (p[w] <= s))].push(n[a]);
          }
      }
    } else
      for (a = 0; a < r; ++a)
        (s = u[a]) != null && d <= s && s <= h && y[Pm(p, s, 0, b)].push(n[a]);
    return y;
  }
  return i.value = function(n) {
    return arguments.length ? (t = typeof n == "function" ? n : gr(n), i) : t;
  }, i.domain = function(n) {
    return arguments.length ? (e = typeof n == "function" ? n : gr([n[0], n[1]]), i) : e;
  }, i.thresholds = function(n) {
    return arguments.length ? (l = typeof n == "function" ? n : gr(Array.isArray(n) ? Db.call(n) : n), i) : l;
  }, i;
}
function Mr(t, e) {
  let l;
  if (e === void 0)
    for (const i of t)
      i != null && (l < i || l === void 0 && i >= i) && (l = i);
  else {
    let i = -1;
    for (let n of t)
      (n = e(n, ++i, t)) != null && (l < n || l === void 0 && n >= n) && (l = n);
  }
  return l;
}
function su(t, e) {
  let l;
  if (e === void 0)
    for (const i of t)
      i != null && (l > i || l === void 0 && i >= i) && (l = i);
  else {
    let i = -1;
    for (let n of t)
      (n = e(n, ++i, t)) != null && (l > n || l === void 0 && n >= n) && (l = n);
  }
  return l;
}
function Im(t, e, l = 0, i = 1 / 0, n) {
  if (e = Math.floor(e), l = Math.floor(Math.max(0, l)), i = Math.floor(Math.min(t.length - 1, i)), !(l <= e && e <= i))
    return t;
  for (n = n === void 0 ? Em : Ob(n); i > l; ) {
    if (i - l > 600) {
      const o = i - l + 1, u = e - l + 1, c = Math.log(o), d = 0.5 * Math.exp(2 * c / 3), h = 0.5 * Math.sqrt(c * d * (o - d) / o) * (u - o / 2 < 0 ? -1 : 1), p = Math.max(l, Math.floor(e - u * d / o + h)), b = Math.min(i, Math.floor(e + (o - u) * d / o + h));
      Im(t, e, p, b, n);
    }
    const a = t[e];
    let r = l, s = i;
    for (hn(t, l, e), n(t[i], a) > 0 && hn(t, l, i); r < s; ) {
      for (hn(t, r, s), ++r, --s; n(t[r], a) < 0; )
        ++r;
      for (; n(t[s], a) > 0; )
        --s;
    }
    n(t[l], a) === 0 ? hn(t, l, s) : (++s, hn(t, s, i)), s <= e && (l = s + 1), e <= s && (i = s - 1);
  }
  return t;
}
function hn(t, e, l) {
  const i = t[e];
  t[e] = t[l], t[l] = i;
}
function Gb(t, e, l) {
  if (t = Float64Array.from(Sb(t, l)), !(!(i = t.length) || isNaN(e = +e))) {
    if (e <= 0 || i < 2)
      return su(t);
    if (e >= 1)
      return Mr(t);
    var i, n = (i - 1) * e, a = Math.floor(n), r = Mr(Im(t, a).subarray(0, a + 1)), s = su(t.subarray(a + 1));
    return r + (s - r) * (n - a);
  }
}
function Qi(t, e) {
  let l = 0, i = 0;
  if (e === void 0)
    for (let n of t)
      n != null && (n = +n) >= n && (++l, i += n);
  else {
    let n = -1;
    for (let a of t)
      (a = e(a, ++n, t)) != null && (a = +a) >= a && (++l, i += a);
  }
  if (l)
    return i / l;
}
function Vi(t, e) {
  return Gb(t, 0.5, e);
}
function Yb(t) {
  return t;
}
var Sa = 1, Ma = 2, zr = 3, bn = 4, ou = 1e-6;
function Kb(t) {
  return "translate(" + t + ",0)";
}
function Ub(t) {
  return "translate(0," + t + ")";
}
function Wb(t) {
  return (e) => +t(e);
}
function Jb(t, e) {
  return e = Math.max(0, t.bandwidth() - e * 2) / 2, t.round() && (e = Math.round(e)), (l) => +t(l) + e;
}
function Zb() {
  return !this.__axis;
}
function Ka(t, e) {
  var l = [], i = null, n = null, a = 6, r = 6, s = 3, o = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, u = t === Sa || t === bn ? -1 : 1, c = t === bn || t === Ma ? "x" : "y", d = t === Sa || t === zr ? Kb : Ub;
  function h(p) {
    var b = i ?? (e.ticks ? e.ticks.apply(e, l) : e.domain()), g = n ?? (e.tickFormat ? e.tickFormat.apply(e, l) : Yb), v = Math.max(a, 0) + s, y = e.range(), k = +y[0] + o, w = +y[y.length - 1] + o, $ = (e.bandwidth ? Jb : Wb)(e.copy(), o), q = p.selection ? p.selection() : p, j = q.selectAll(".domain").data([null]), O = q.selectAll(".tick").data(b, e).order(), z = O.exit(), N = O.enter().append("g").attr("class", "tick"), M = O.select("line"), H = O.select("text");
    j = j.merge(j.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), O = O.merge(N), M = M.merge(N.append("line").attr("stroke", "currentColor").attr(c + "2", u * a)), H = H.merge(N.append("text").attr("fill", "currentColor").attr(c, u * v).attr("dy", t === Sa ? "0em" : t === zr ? "0.71em" : "0.32em")), p !== q && (j = j.transition(p), O = O.transition(p), M = M.transition(p), H = H.transition(p), z = z.transition(p).attr("opacity", ou).attr("transform", function(B) {
      return isFinite(B = $(B)) ? d(B + o) : this.getAttribute("transform");
    }), N.attr("opacity", ou).attr("transform", function(B) {
      var R = this.parentNode.__axis;
      return d((R && isFinite(R = R(B)) ? R : $(B)) + o);
    })), z.remove(), j.attr("d", t === bn || t === Ma ? r ? "M" + u * r + "," + k + "H" + o + "V" + w + "H" + u * r : "M" + o + "," + k + "V" + w : r ? "M" + k + "," + u * r + "V" + o + "H" + w + "V" + u * r : "M" + k + "," + o + "H" + w), O.attr("opacity", 1).attr("transform", function(B) {
      return d($(B) + o);
    }), M.attr(c + "2", u * a), H.attr(c, u * v).text(g), q.filter(Zb).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", t === Ma ? "start" : t === bn ? "end" : "middle"), q.each(function() {
      this.__axis = $;
    });
  }
  return h.scale = function(p) {
    return arguments.length ? (e = p, h) : e;
  }, h.ticks = function() {
    return l = Array.from(arguments), h;
  }, h.tickArguments = function(p) {
    return arguments.length ? (l = p == null ? [] : Array.from(p), h) : l.slice();
  }, h.tickValues = function(p) {
    return arguments.length ? (i = p == null ? null : Array.from(p), h) : i && i.slice();
  }, h.tickFormat = function(p) {
    return arguments.length ? (n = p, h) : n;
  }, h.tickSize = function(p) {
    return arguments.length ? (a = r = +p, h) : a;
  }, h.tickSizeInner = function(p) {
    return arguments.length ? (a = +p, h) : a;
  }, h.tickSizeOuter = function(p) {
    return arguments.length ? (r = +p, h) : r;
  }, h.tickPadding = function(p) {
    return arguments.length ? (s = +p, h) : s;
  }, h.offset = function(p) {
    return arguments.length ? (o = +p, h) : o;
  }, h;
}
function xb(t) {
  return Ka(Sa, t);
}
function e2(t) {
  return Ka(Ma, t);
}
function t2(t) {
  return Ka(zr, t);
}
function l2(t) {
  return Ka(bn, t);
}
var i2 = { value: () => {
} };
function Vr() {
  for (var t = 0, e = arguments.length, l = {}, i; t < e; ++t) {
    if (!(i = arguments[t] + "") || i in l || /[\s.]/.test(i))
      throw new Error("illegal type: " + i);
    l[i] = [];
  }
  return new za(l);
}
function za(t) {
  this._ = t;
}
function n2(t, e) {
  return t.trim().split(/^|\s+/).map(function(l) {
    var i = "", n = l.indexOf(".");
    if (n >= 0 && (i = l.slice(n + 1), l = l.slice(0, n)), l && !e.hasOwnProperty(l))
      throw new Error("unknown type: " + l);
    return { type: l, name: i };
  });
}
za.prototype = Vr.prototype = {
  constructor: za,
  on: function(t, e) {
    var l = this._, i = n2(t + "", l), n, a = -1, r = i.length;
    if (arguments.length < 2) {
      for (; ++a < r; )
        if ((n = (t = i[a]).type) && (n = a2(l[n], t.name)))
          return n;
      return;
    }
    if (e != null && typeof e != "function")
      throw new Error("invalid callback: " + e);
    for (; ++a < r; )
      if (n = (t = i[a]).type)
        l[n] = uu(l[n], t.name, e);
      else if (e == null)
        for (n in l)
          l[n] = uu(l[n], t.name, null);
    return this;
  },
  copy: function() {
    var t = {}, e = this._;
    for (var l in e)
      t[l] = e[l].slice();
    return new za(t);
  },
  call: function(t, e) {
    if ((n = arguments.length - 2) > 0)
      for (var l = new Array(n), i = 0, n, a; i < n; ++i)
        l[i] = arguments[i + 2];
    if (!this._.hasOwnProperty(t))
      throw new Error("unknown type: " + t);
    for (a = this._[t], i = 0, n = a.length; i < n; ++i)
      a[i].value.apply(e, l);
  },
  apply: function(t, e, l) {
    if (!this._.hasOwnProperty(t))
      throw new Error("unknown type: " + t);
    for (var i = this._[t], n = 0, a = i.length; n < a; ++n)
      i[n].value.apply(e, l);
  }
};
function a2(t, e) {
  for (var l = 0, i = t.length, n; l < i; ++l)
    if ((n = t[l]).name === e)
      return n.value;
}
function uu(t, e, l) {
  for (var i = 0, n = t.length; i < n; ++i)
    if (t[i].name === e) {
      t[i] = i2, t = t.slice(0, i).concat(t.slice(i + 1));
      break;
    }
  return l != null && t.push({ name: e, value: l }), t;
}
var Nr = "http://www.w3.org/1999/xhtml";
const fu = {
  svg: "http://www.w3.org/2000/svg",
  xhtml: Nr,
  xlink: "http://www.w3.org/1999/xlink",
  xml: "http://www.w3.org/XML/1998/namespace",
  xmlns: "http://www.w3.org/2000/xmlns/"
};
function Ua(t) {
  var e = t += "", l = e.indexOf(":");
  return l >= 0 && (e = t.slice(0, l)) !== "xmlns" && (t = t.slice(l + 1)), fu.hasOwnProperty(e) ? { space: fu[e], local: t } : t;
}
function r2(t) {
  return function() {
    var e = this.ownerDocument, l = this.namespaceURI;
    return l === Nr && e.documentElement.namespaceURI === Nr ? e.createElement(t) : e.createElementNS(l, t);
  };
}
function s2(t) {
  return function() {
    return this.ownerDocument.createElementNS(t.space, t.local);
  };
}
function Dm(t) {
  var e = Ua(t);
  return (e.local ? s2 : r2)(e);
}
function o2() {
}
function Xr(t) {
  return t == null ? o2 : function() {
    return this.querySelector(t);
  };
}
function u2(t) {
  typeof t != "function" && (t = Xr(t));
  for (var e = this._groups, l = e.length, i = new Array(l), n = 0; n < l; ++n)
    for (var a = e[n], r = a.length, s = i[n] = new Array(r), o, u, c = 0; c < r; ++c)
      (o = a[c]) && (u = t.call(o, o.__data__, c, a)) && ("__data__" in o && (u.__data__ = o.__data__), s[c] = u);
  return new tl(i, this._parents);
}
function Rm(t) {
  return t == null ? [] : Array.isArray(t) ? t : Array.from(t);
}
function f2() {
  return [];
}
function Hm(t) {
  return t == null ? f2 : function() {
    return this.querySelectorAll(t);
  };
}
function _2(t) {
  return function() {
    return Rm(t.apply(this, arguments));
  };
}
function c2(t) {
  typeof t == "function" ? t = _2(t) : t = Hm(t);
  for (var e = this._groups, l = e.length, i = [], n = [], a = 0; a < l; ++a)
    for (var r = e[a], s = r.length, o, u = 0; u < s; ++u)
      (o = r[u]) && (i.push(t.call(o, o.__data__, u, r)), n.push(o));
  return new tl(i, n);
}
function Fm(t) {
  return function() {
    return this.matches(t);
  };
}
function Lm(t) {
  return function(e) {
    return e.matches(t);
  };
}
var d2 = Array.prototype.find;
function h2(t) {
  return function() {
    return d2.call(this.children, t);
  };
}
function p2() {
  return this.firstElementChild;
}
function m2(t) {
  return this.select(t == null ? p2 : h2(typeof t == "function" ? t : Lm(t)));
}
var g2 = Array.prototype.filter;
function b2() {
  return Array.from(this.children);
}
function v2(t) {
  return function() {
    return g2.call(this.children, t);
  };
}
function k2(t) {
  return this.selectAll(t == null ? b2 : v2(typeof t == "function" ? t : Lm(t)));
}
function y2(t) {
  typeof t != "function" && (t = Fm(t));
  for (var e = this._groups, l = e.length, i = new Array(l), n = 0; n < l; ++n)
    for (var a = e[n], r = a.length, s = i[n] = [], o, u = 0; u < r; ++u)
      (o = a[u]) && t.call(o, o.__data__, u, a) && s.push(o);
  return new tl(i, this._parents);
}
function Qm(t) {
  return new Array(t.length);
}
function w2() {
  return new tl(this._enter || this._groups.map(Qm), this._parents);
}
function Ea(t, e) {
  this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = e;
}
Ea.prototype = {
  constructor: Ea,
  appendChild: function(t) {
    return this._parent.insertBefore(t, this._next);
  },
  insertBefore: function(t, e) {
    return this._parent.insertBefore(t, e);
  },
  querySelector: function(t) {
    return this._parent.querySelector(t);
  },
  querySelectorAll: function(t) {
    return this._parent.querySelectorAll(t);
  }
};
function $2(t) {
  return function() {
    return t;
  };
}
function q2(t, e, l, i, n, a) {
  for (var r = 0, s, o = e.length, u = a.length; r < u; ++r)
    (s = e[r]) ? (s.__data__ = a[r], i[r] = s) : l[r] = new Ea(t, a[r]);
  for (; r < o; ++r)
    (s = e[r]) && (n[r] = s);
}
function j2(t, e, l, i, n, a, r) {
  var s, o, u = /* @__PURE__ */ new Map(), c = e.length, d = a.length, h = new Array(c), p;
  for (s = 0; s < c; ++s)
    (o = e[s]) && (h[s] = p = r.call(o, o.__data__, s, e) + "", u.has(p) ? n[s] = o : u.set(p, o));
  for (s = 0; s < d; ++s)
    p = r.call(t, a[s], s, a) + "", (o = u.get(p)) ? (i[s] = o, o.__data__ = a[s], u.delete(p)) : l[s] = new Ea(t, a[s]);
  for (s = 0; s < c; ++s)
    (o = e[s]) && u.get(h[s]) === o && (n[s] = o);
}
function T2(t) {
  return t.__data__;
}
function C2(t, e) {
  if (!arguments.length)
    return Array.from(this, T2);
  var l = e ? j2 : q2, i = this._parents, n = this._groups;
  typeof t != "function" && (t = $2(t));
  for (var a = n.length, r = new Array(a), s = new Array(a), o = new Array(a), u = 0; u < a; ++u) {
    var c = i[u], d = n[u], h = d.length, p = S2(t.call(c, c && c.__data__, u, i)), b = p.length, g = s[u] = new Array(b), v = r[u] = new Array(b), y = o[u] = new Array(h);
    l(c, d, g, v, y, p, e);
    for (var k = 0, w = 0, $, q; k < b; ++k)
      if ($ = g[k]) {
        for (k >= w && (w = k + 1); !(q = v[w]) && ++w < b; )
          ;
        $._next = q || null;
      }
  }
  return r = new tl(r, i), r._enter = s, r._exit = o, r;
}
function S2(t) {
  return typeof t == "object" && "length" in t ? t : Array.from(t);
}
function M2() {
  return new tl(this._exit || this._groups.map(Qm), this._parents);
}
function z2(t, e, l) {
  var i = this.enter(), n = this, a = this.exit();
  return typeof t == "function" ? (i = t(i), i && (i = i.selection())) : i = i.append(t + ""), e != null && (n = e(n), n && (n = n.selection())), l == null ? a.remove() : l(a), i && n ? i.merge(n).order() : n;
}
function N2(t) {
  for (var e = t.selection ? t.selection() : t, l = this._groups, i = e._groups, n = l.length, a = i.length, r = Math.min(n, a), s = new Array(n), o = 0; o < r; ++o)
    for (var u = l[o], c = i[o], d = u.length, h = s[o] = new Array(d), p, b = 0; b < d; ++b)
      (p = u[b] || c[b]) && (h[b] = p);
  for (; o < n; ++o)
    s[o] = l[o];
  return new tl(s, this._parents);
}
function A2() {
  for (var t = this._groups, e = -1, l = t.length; ++e < l; )
    for (var i = t[e], n = i.length - 1, a = i[n], r; --n >= 0; )
      (r = i[n]) && (a && r.compareDocumentPosition(a) ^ 4 && a.parentNode.insertBefore(r, a), a = r);
  return this;
}
function B2(t) {
  t || (t = P2);
  function e(d, h) {
    return d && h ? t(d.__data__, h.__data__) : !d - !h;
  }
  for (var l = this._groups, i = l.length, n = new Array(i), a = 0; a < i; ++a) {
    for (var r = l[a], s = r.length, o = n[a] = new Array(s), u, c = 0; c < s; ++c)
      (u = r[c]) && (o[c] = u);
    o.sort(e);
  }
  return new tl(n, this._parents).order();
}
function P2(t, e) {
  return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function E2() {
  var t = arguments[0];
  return arguments[0] = this, t.apply(null, arguments), this;
}
function O2() {
  return Array.from(this);
}
function I2() {
  for (var t = this._groups, e = 0, l = t.length; e < l; ++e)
    for (var i = t[e], n = 0, a = i.length; n < a; ++n) {
      var r = i[n];
      if (r)
        return r;
    }
  return null;
}
function D2() {
  let t = 0;
  for (const e of this)
    ++t;
  return t;
}
function R2() {
  return !this.node();
}
function H2(t) {
  for (var e = this._groups, l = 0, i = e.length; l < i; ++l)
    for (var n = e[l], a = 0, r = n.length, s; a < r; ++a)
      (s = n[a]) && t.call(s, s.__data__, a, n);
  return this;
}
function F2(t) {
  return function() {
    this.removeAttribute(t);
  };
}
function L2(t) {
  return function() {
    this.removeAttributeNS(t.space, t.local);
  };
}
function Q2(t, e) {
  return function() {
    this.setAttribute(t, e);
  };
}
function V2(t, e) {
  return function() {
    this.setAttributeNS(t.space, t.local, e);
  };
}
function X2(t, e) {
  return function() {
    var l = e.apply(this, arguments);
    l == null ? this.removeAttribute(t) : this.setAttribute(t, l);
  };
}
function G2(t, e) {
  return function() {
    var l = e.apply(this, arguments);
    l == null ? this.removeAttributeNS(t.space, t.local) : this.setAttributeNS(t.space, t.local, l);
  };
}
function Y2(t, e) {
  var l = Ua(t);
  if (arguments.length < 2) {
    var i = this.node();
    return l.local ? i.getAttributeNS(l.space, l.local) : i.getAttribute(l);
  }
  return this.each((e == null ? l.local ? L2 : F2 : typeof e == "function" ? l.local ? G2 : X2 : l.local ? V2 : Q2)(l, e));
}
function Vm(t) {
  return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView;
}
function K2(t) {
  return function() {
    this.style.removeProperty(t);
  };
}
function U2(t, e, l) {
  return function() {
    this.style.setProperty(t, e, l);
  };
}
function W2(t, e, l) {
  return function() {
    var i = e.apply(this, arguments);
    i == null ? this.style.removeProperty(t) : this.style.setProperty(t, i, l);
  };
}
function J2(t, e, l) {
  return arguments.length > 1 ? this.each((e == null ? K2 : typeof e == "function" ? W2 : U2)(t, e, l ?? "")) : Ki(this.node(), t);
}
function Ki(t, e) {
  return t.style.getPropertyValue(e) || Vm(t).getComputedStyle(t, null).getPropertyValue(e);
}
function Z2(t) {
  return function() {
    delete this[t];
  };
}
function x2(t, e) {
  return function() {
    this[t] = e;
  };
}
function ev(t, e) {
  return function() {
    var l = e.apply(this, arguments);
    l == null ? delete this[t] : this[t] = l;
  };
}
function tv(t, e) {
  return arguments.length > 1 ? this.each((e == null ? Z2 : typeof e == "function" ? ev : x2)(t, e)) : this.node()[t];
}
function Xm(t) {
  return t.trim().split(/^|\s+/);
}
function Gr(t) {
  return t.classList || new Gm(t);
}
function Gm(t) {
  this._node = t, this._names = Xm(t.getAttribute("class") || "");
}
Gm.prototype = {
  add: function(t) {
    var e = this._names.indexOf(t);
    e < 0 && (this._names.push(t), this._node.setAttribute("class", this._names.join(" ")));
  },
  remove: function(t) {
    var e = this._names.indexOf(t);
    e >= 0 && (this._names.splice(e, 1), this._node.setAttribute("class", this._names.join(" ")));
  },
  contains: function(t) {
    return this._names.indexOf(t) >= 0;
  }
};
function Ym(t, e) {
  for (var l = Gr(t), i = -1, n = e.length; ++i < n; )
    l.add(e[i]);
}
function Km(t, e) {
  for (var l = Gr(t), i = -1, n = e.length; ++i < n; )
    l.remove(e[i]);
}
function lv(t) {
  return function() {
    Ym(this, t);
  };
}
function iv(t) {
  return function() {
    Km(this, t);
  };
}
function nv(t, e) {
  return function() {
    (e.apply(this, arguments) ? Ym : Km)(this, t);
  };
}
function av(t, e) {
  var l = Xm(t + "");
  if (arguments.length < 2) {
    for (var i = Gr(this.node()), n = -1, a = l.length; ++n < a; )
      if (!i.contains(l[n]))
        return !1;
    return !0;
  }
  return this.each((typeof e == "function" ? nv : e ? lv : iv)(l, e));
}
function rv() {
  this.textContent = "";
}
function sv(t) {
  return function() {
    this.textContent = t;
  };
}
function ov(t) {
  return function() {
    var e = t.apply(this, arguments);
    this.textContent = e ?? "";
  };
}
function uv(t) {
  return arguments.length ? this.each(t == null ? rv : (typeof t == "function" ? ov : sv)(t)) : this.node().textContent;
}
function fv() {
  this.innerHTML = "";
}
function _v(t) {
  return function() {
    this.innerHTML = t;
  };
}
function cv(t) {
  return function() {
    var e = t.apply(this, arguments);
    this.innerHTML = e ?? "";
  };
}
function dv(t) {
  return arguments.length ? this.each(t == null ? fv : (typeof t == "function" ? cv : _v)(t)) : this.node().innerHTML;
}
function hv() {
  this.nextSibling && this.parentNode.appendChild(this);
}
function pv() {
  return this.each(hv);
}
function mv() {
  this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
}
function gv() {
  return this.each(mv);
}
function bv(t) {
  var e = typeof t == "function" ? t : Dm(t);
  return this.select(function() {
    return this.appendChild(e.apply(this, arguments));
  });
}
function vv() {
  return null;
}
function kv(t, e) {
  var l = typeof t == "function" ? t : Dm(t), i = e == null ? vv : typeof e == "function" ? e : Xr(e);
  return this.select(function() {
    return this.insertBefore(l.apply(this, arguments), i.apply(this, arguments) || null);
  });
}
function yv() {
  var t = this.parentNode;
  t && t.removeChild(this);
}
function wv() {
  return this.each(yv);
}
function $v() {
  var t = this.cloneNode(!1), e = this.parentNode;
  return e ? e.insertBefore(t, this.nextSibling) : t;
}
function qv() {
  var t = this.cloneNode(!0), e = this.parentNode;
  return e ? e.insertBefore(t, this.nextSibling) : t;
}
function jv(t) {
  return this.select(t ? qv : $v);
}
function Tv(t) {
  return arguments.length ? this.property("__data__", t) : this.node().__data__;
}
function Cv(t) {
  return function(e) {
    t.call(this, e, this.__data__);
  };
}
function Sv(t) {
  return t.trim().split(/^|\s+/).map(function(e) {
    var l = "", i = e.indexOf(".");
    return i >= 0 && (l = e.slice(i + 1), e = e.slice(0, i)), { type: e, name: l };
  });
}
function Mv(t) {
  return function() {
    var e = this.__on;
    if (e) {
      for (var l = 0, i = -1, n = e.length, a; l < n; ++l)
        a = e[l], (!t.type || a.type === t.type) && a.name === t.name ? this.removeEventListener(a.type, a.listener, a.options) : e[++i] = a;
      ++i ? e.length = i : delete this.__on;
    }
  };
}
function zv(t, e, l) {
  return function() {
    var i = this.__on, n, a = Cv(e);
    if (i) {
      for (var r = 0, s = i.length; r < s; ++r)
        if ((n = i[r]).type === t.type && n.name === t.name) {
          this.removeEventListener(n.type, n.listener, n.options), this.addEventListener(n.type, n.listener = a, n.options = l), n.value = e;
          return;
        }
    }
    this.addEventListener(t.type, a, l), n = { type: t.type, name: t.name, value: e, listener: a, options: l }, i ? i.push(n) : this.__on = [n];
  };
}
function Nv(t, e, l) {
  var i = Sv(t + ""), n, a = i.length, r;
  if (arguments.length < 2) {
    var s = this.node().__on;
    if (s) {
      for (var o = 0, u = s.length, c; o < u; ++o)
        for (n = 0, c = s[o]; n < a; ++n)
          if ((r = i[n]).type === c.type && r.name === c.name)
            return c.value;
    }
    return;
  }
  for (s = e ? zv : Mv, n = 0; n < a; ++n)
    this.each(s(i[n], e, l));
  return this;
}
function Um(t, e, l) {
  var i = Vm(t), n = i.CustomEvent;
  typeof n == "function" ? n = new n(e, l) : (n = i.document.createEvent("Event"), l ? (n.initEvent(e, l.bubbles, l.cancelable), n.detail = l.detail) : n.initEvent(e, !1, !1)), t.dispatchEvent(n);
}
function Av(t, e) {
  return function() {
    return Um(this, t, e);
  };
}
function Bv(t, e) {
  return function() {
    return Um(this, t, e.apply(this, arguments));
  };
}
function Pv(t, e) {
  return this.each((typeof e == "function" ? Bv : Av)(t, e));
}
function* Ev() {
  for (var t = this._groups, e = 0, l = t.length; e < l; ++e)
    for (var i = t[e], n = 0, a = i.length, r; n < a; ++n)
      (r = i[n]) && (yield r);
}
var Yr = [null];
function tl(t, e) {
  this._groups = t, this._parents = e;
}
function Sn() {
  return new tl([[document.documentElement]], Yr);
}
function Ov() {
  return this;
}
tl.prototype = Sn.prototype = {
  constructor: tl,
  select: u2,
  selectAll: c2,
  selectChild: m2,
  selectChildren: k2,
  filter: y2,
  data: C2,
  enter: w2,
  exit: M2,
  join: z2,
  merge: N2,
  selection: Ov,
  order: A2,
  sort: B2,
  call: E2,
  nodes: O2,
  node: I2,
  size: D2,
  empty: R2,
  each: H2,
  attr: Y2,
  style: J2,
  property: tv,
  classed: av,
  text: uv,
  html: dv,
  raise: pv,
  lower: gv,
  append: bv,
  insert: kv,
  remove: wv,
  clone: jv,
  datum: Tv,
  on: Nv,
  dispatch: Pv,
  [Symbol.iterator]: Ev
};
function _u(t) {
  return typeof t == "string" ? new tl([[document.querySelector(t)]], [document.documentElement]) : new tl([[t]], Yr);
}
function cu(t) {
  return typeof t == "string" ? new tl([document.querySelectorAll(t)], [document.documentElement]) : new tl([Rm(t)], Yr);
}
function Kr(t, e, l) {
  t.prototype = e.prototype = l, l.constructor = t;
}
function Wm(t, e) {
  var l = Object.create(t.prototype);
  for (var i in e)
    l[i] = e[i];
  return l;
}
function Mn() {
}
var jn = 0.7, Oa = 1 / jn, Xi = "\\s*([+-]?\\d+)\\s*", Tn = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", wl = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", Iv = /^#([0-9a-f]{3,8})$/, Dv = new RegExp(`^rgb\\(${Xi},${Xi},${Xi}\\)$`), Rv = new RegExp(`^rgb\\(${wl},${wl},${wl}\\)$`), Hv = new RegExp(`^rgba\\(${Xi},${Xi},${Xi},${Tn}\\)$`), Fv = new RegExp(`^rgba\\(${wl},${wl},${wl},${Tn}\\)$`), Lv = new RegExp(`^hsl\\(${Tn},${wl},${wl}\\)$`), Qv = new RegExp(`^hsla\\(${Tn},${wl},${wl},${Tn}\\)$`), du = {
  aliceblue: 15792383,
  antiquewhite: 16444375,
  aqua: 65535,
  aquamarine: 8388564,
  azure: 15794175,
  beige: 16119260,
  bisque: 16770244,
  black: 0,
  blanchedalmond: 16772045,
  blue: 255,
  blueviolet: 9055202,
  brown: 10824234,
  burlywood: 14596231,
  cadetblue: 6266528,
  chartreuse: 8388352,
  chocolate: 13789470,
  coral: 16744272,
  cornflowerblue: 6591981,
  cornsilk: 16775388,
  crimson: 14423100,
  cyan: 65535,
  darkblue: 139,
  darkcyan: 35723,
  darkgoldenrod: 12092939,
  darkgray: 11119017,
  darkgreen: 25600,
  darkgrey: 11119017,
  darkkhaki: 12433259,
  darkmagenta: 9109643,
  darkolivegreen: 5597999,
  darkorange: 16747520,
  darkorchid: 10040012,
  darkred: 9109504,
  darksalmon: 15308410,
  darkseagreen: 9419919,
  darkslateblue: 4734347,
  darkslategray: 3100495,
  darkslategrey: 3100495,
  darkturquoise: 52945,
  darkviolet: 9699539,
  deeppink: 16716947,
  deepskyblue: 49151,
  dimgray: 6908265,
  dimgrey: 6908265,
  dodgerblue: 2003199,
  firebrick: 11674146,
  floralwhite: 16775920,
  forestgreen: 2263842,
  fuchsia: 16711935,
  gainsboro: 14474460,
  ghostwhite: 16316671,
  gold: 16766720,
  goldenrod: 14329120,
  gray: 8421504,
  green: 32768,
  greenyellow: 11403055,
  grey: 8421504,
  honeydew: 15794160,
  hotpink: 16738740,
  indianred: 13458524,
  indigo: 4915330,
  ivory: 16777200,
  khaki: 15787660,
  lavender: 15132410,
  lavenderblush: 16773365,
  lawngreen: 8190976,
  lemonchiffon: 16775885,
  lightblue: 11393254,
  lightcoral: 15761536,
  lightcyan: 14745599,
  lightgoldenrodyellow: 16448210,
  lightgray: 13882323,
  lightgreen: 9498256,
  lightgrey: 13882323,
  lightpink: 16758465,
  lightsalmon: 16752762,
  lightseagreen: 2142890,
  lightskyblue: 8900346,
  lightslategray: 7833753,
  lightslategrey: 7833753,
  lightsteelblue: 11584734,
  lightyellow: 16777184,
  lime: 65280,
  limegreen: 3329330,
  linen: 16445670,
  magenta: 16711935,
  maroon: 8388608,
  mediumaquamarine: 6737322,
  mediumblue: 205,
  mediumorchid: 12211667,
  mediumpurple: 9662683,
  mediumseagreen: 3978097,
  mediumslateblue: 8087790,
  mediumspringgreen: 64154,
  mediumturquoise: 4772300,
  mediumvioletred: 13047173,
  midnightblue: 1644912,
  mintcream: 16121850,
  mistyrose: 16770273,
  moccasin: 16770229,
  navajowhite: 16768685,
  navy: 128,
  oldlace: 16643558,
  olive: 8421376,
  olivedrab: 7048739,
  orange: 16753920,
  orangered: 16729344,
  orchid: 14315734,
  palegoldenrod: 15657130,
  palegreen: 10025880,
  paleturquoise: 11529966,
  palevioletred: 14381203,
  papayawhip: 16773077,
  peachpuff: 16767673,
  peru: 13468991,
  pink: 16761035,
  plum: 14524637,
  powderblue: 11591910,
  purple: 8388736,
  rebeccapurple: 6697881,
  red: 16711680,
  rosybrown: 12357519,
  royalblue: 4286945,
  saddlebrown: 9127187,
  salmon: 16416882,
  sandybrown: 16032864,
  seagreen: 3050327,
  seashell: 16774638,
  sienna: 10506797,
  silver: 12632256,
  skyblue: 8900331,
  slateblue: 6970061,
  slategray: 7372944,
  slategrey: 7372944,
  snow: 16775930,
  springgreen: 65407,
  steelblue: 4620980,
  tan: 13808780,
  teal: 32896,
  thistle: 14204888,
  tomato: 16737095,
  turquoise: 4251856,
  violet: 15631086,
  wheat: 16113331,
  white: 16777215,
  whitesmoke: 16119285,
  yellow: 16776960,
  yellowgreen: 10145074
};
Kr(Mn, si, {
  copy(t) {
    return Object.assign(new this.constructor(), this, t);
  },
  displayable() {
    return this.rgb().displayable();
  },
  hex: hu,
  // Deprecated! Use color.formatHex.
  formatHex: hu,
  formatHex8: Vv,
  formatHsl: Xv,
  formatRgb: pu,
  toString: pu
});
function hu() {
  return this.rgb().formatHex();
}
function Vv() {
  return this.rgb().formatHex8();
}
function Xv() {
  return Jm(this).formatHsl();
}
function pu() {
  return this.rgb().formatRgb();
}
function si(t) {
  var e, l;
  return t = (t + "").trim().toLowerCase(), (e = Iv.exec(t)) ? (l = e[1].length, e = parseInt(e[1], 16), l === 6 ? mu(e) : l === 3 ? new il(e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, (e & 15) << 4 | e & 15, 1) : l === 8 ? wa(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, (e & 255) / 255) : l === 4 ? wa(e >> 12 & 15 | e >> 8 & 240, e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, ((e & 15) << 4 | e & 15) / 255) : null) : (e = Dv.exec(t)) ? new il(e[1], e[2], e[3], 1) : (e = Rv.exec(t)) ? new il(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, 1) : (e = Hv.exec(t)) ? wa(e[1], e[2], e[3], e[4]) : (e = Fv.exec(t)) ? wa(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, e[4]) : (e = Lv.exec(t)) ? vu(e[1], e[2] / 100, e[3] / 100, 1) : (e = Qv.exec(t)) ? vu(e[1], e[2] / 100, e[3] / 100, e[4]) : du.hasOwnProperty(t) ? mu(du[t]) : t === "transparent" ? new il(NaN, NaN, NaN, 0) : null;
}
function mu(t) {
  return new il(t >> 16 & 255, t >> 8 & 255, t & 255, 1);
}
function wa(t, e, l, i) {
  return i <= 0 && (t = e = l = NaN), new il(t, e, l, i);
}
function Gv(t) {
  return t instanceof Mn || (t = si(t)), t ? (t = t.rgb(), new il(t.r, t.g, t.b, t.opacity)) : new il();
}
function Ia(t, e, l, i) {
  return arguments.length === 1 ? Gv(t) : new il(t, e, l, i ?? 1);
}
function il(t, e, l, i) {
  this.r = +t, this.g = +e, this.b = +l, this.opacity = +i;
}
Kr(il, Ia, Wm(Mn, {
  brighter(t) {
    return t = t == null ? Oa : Math.pow(Oa, t), new il(this.r * t, this.g * t, this.b * t, this.opacity);
  },
  darker(t) {
    return t = t == null ? jn : Math.pow(jn, t), new il(this.r * t, this.g * t, this.b * t, this.opacity);
  },
  rgb() {
    return this;
  },
  clamp() {
    return new il(ri(this.r), ri(this.g), ri(this.b), Da(this.opacity));
  },
  displayable() {
    return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
  },
  hex: gu,
  // Deprecated! Use color.formatHex.
  formatHex: gu,
  formatHex8: Yv,
  formatRgb: bu,
  toString: bu
}));
function gu() {
  return `#${ni(this.r)}${ni(this.g)}${ni(this.b)}`;
}
function Yv() {
  return `#${ni(this.r)}${ni(this.g)}${ni(this.b)}${ni((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}
function bu() {
  const t = Da(this.opacity);
  return `${t === 1 ? "rgb(" : "rgba("}${ri(this.r)}, ${ri(this.g)}, ${ri(this.b)}${t === 1 ? ")" : `, ${t})`}`;
}
function Da(t) {
  return isNaN(t) ? 1 : Math.max(0, Math.min(1, t));
}
function ri(t) {
  return Math.max(0, Math.min(255, Math.round(t) || 0));
}
function ni(t) {
  return t = ri(t), (t < 16 ? "0" : "") + t.toString(16);
}
function vu(t, e, l, i) {
  return i <= 0 ? t = e = l = NaN : l <= 0 || l >= 1 ? t = e = NaN : e <= 0 && (t = NaN), new ml(t, e, l, i);
}
function Jm(t) {
  if (t instanceof ml)
    return new ml(t.h, t.s, t.l, t.opacity);
  if (t instanceof Mn || (t = si(t)), !t)
    return new ml();
  if (t instanceof ml)
    return t;
  t = t.rgb();
  var e = t.r / 255, l = t.g / 255, i = t.b / 255, n = Math.min(e, l, i), a = Math.max(e, l, i), r = NaN, s = a - n, o = (a + n) / 2;
  return s ? (e === a ? r = (l - i) / s + (l < i) * 6 : l === a ? r = (i - e) / s + 2 : r = (e - l) / s + 4, s /= o < 0.5 ? a + n : 2 - a - n, r *= 60) : s = o > 0 && o < 1 ? 0 : r, new ml(r, s, o, t.opacity);
}
function Kv(t, e, l, i) {
  return arguments.length === 1 ? Jm(t) : new ml(t, e, l, i ?? 1);
}
function ml(t, e, l, i) {
  this.h = +t, this.s = +e, this.l = +l, this.opacity = +i;
}
Kr(ml, Kv, Wm(Mn, {
  brighter(t) {
    return t = t == null ? Oa : Math.pow(Oa, t), new ml(this.h, this.s, this.l * t, this.opacity);
  },
  darker(t) {
    return t = t == null ? jn : Math.pow(jn, t), new ml(this.h, this.s, this.l * t, this.opacity);
  },
  rgb() {
    var t = this.h % 360 + (this.h < 0) * 360, e = isNaN(t) || isNaN(this.s) ? 0 : this.s, l = this.l, i = l + (l < 0.5 ? l : 1 - l) * e, n = 2 * l - i;
    return new il(
      br(t >= 240 ? t - 240 : t + 120, n, i),
      br(t, n, i),
      br(t < 120 ? t + 240 : t - 120, n, i),
      this.opacity
    );
  },
  clamp() {
    return new ml(ku(this.h), $a(this.s), $a(this.l), Da(this.opacity));
  },
  displayable() {
    return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
  },
  formatHsl() {
    const t = Da(this.opacity);
    return `${t === 1 ? "hsl(" : "hsla("}${ku(this.h)}, ${$a(this.s) * 100}%, ${$a(this.l) * 100}%${t === 1 ? ")" : `, ${t})`}`;
  }
}));
function ku(t) {
  return t = (t || 0) % 360, t < 0 ? t + 360 : t;
}
function $a(t) {
  return Math.max(0, Math.min(1, t || 0));
}
function br(t, e, l) {
  return (t < 60 ? e + (l - e) * t / 60 : t < 180 ? l : t < 240 ? e + (l - e) * (240 - t) / 60 : e) * 255;
}
function Uv(t, e, l, i, n) {
  var a = t * t, r = a * t;
  return ((1 - 3 * t + 3 * a - r) * e + (4 - 6 * a + 3 * r) * l + (1 + 3 * t + 3 * a - 3 * r) * i + r * n) / 6;
}
function Wv(t) {
  var e = t.length - 1;
  return function(l) {
    var i = l <= 0 ? l = 0 : l >= 1 ? (l = 1, e - 1) : Math.floor(l * e), n = t[i], a = t[i + 1], r = i > 0 ? t[i - 1] : 2 * n - a, s = i < e - 1 ? t[i + 2] : 2 * a - n;
    return Uv((l - i / e) * e, r, n, a, s);
  };
}
const Ur = (t) => () => t;
function Jv(t, e) {
  return function(l) {
    return t + l * e;
  };
}
function Zv(t, e, l) {
  return t = Math.pow(t, l), e = Math.pow(e, l) - t, l = 1 / l, function(i) {
    return Math.pow(t + i * e, l);
  };
}
function xv(t) {
  return (t = +t) == 1 ? Zm : function(e, l) {
    return l - e ? Zv(e, l, t) : Ur(isNaN(e) ? l : e);
  };
}
function Zm(t, e) {
  var l = e - t;
  return l ? Jv(t, l) : Ur(isNaN(t) ? e : t);
}
const Ra = function t(e) {
  var l = xv(e);
  function i(n, a) {
    var r = l((n = Ia(n)).r, (a = Ia(a)).r), s = l(n.g, a.g), o = l(n.b, a.b), u = Zm(n.opacity, a.opacity);
    return function(c) {
      return n.r = r(c), n.g = s(c), n.b = o(c), n.opacity = u(c), n + "";
    };
  }
  return i.gamma = t, i;
}(1);
function ek(t) {
  return function(e) {
    var l = e.length, i = new Array(l), n = new Array(l), a = new Array(l), r, s;
    for (r = 0; r < l; ++r)
      s = Ia(e[r]), i[r] = s.r || 0, n[r] = s.g || 0, a[r] = s.b || 0;
    return i = t(i), n = t(n), a = t(a), s.opacity = 1, function(o) {
      return s.r = i(o), s.g = n(o), s.b = a(o), s + "";
    };
  };
}
var tk = ek(Wv);
function lk(t, e) {
  e || (e = []);
  var l = t ? Math.min(e.length, t.length) : 0, i = e.slice(), n;
  return function(a) {
    for (n = 0; n < l; ++n)
      i[n] = t[n] * (1 - a) + e[n] * a;
    return i;
  };
}
function ik(t) {
  return ArrayBuffer.isView(t) && !(t instanceof DataView);
}
function nk(t, e) {
  var l = e ? e.length : 0, i = t ? Math.min(l, t.length) : 0, n = new Array(i), a = new Array(l), r;
  for (r = 0; r < i; ++r)
    n[r] = Wa(t[r], e[r]);
  for (; r < l; ++r)
    a[r] = e[r];
  return function(s) {
    for (r = 0; r < i; ++r)
      a[r] = n[r](s);
    return a;
  };
}
function ak(t, e) {
  var l = /* @__PURE__ */ new Date();
  return t = +t, e = +e, function(i) {
    return l.setTime(t * (1 - i) + e * i), l;
  };
}
function pl(t, e) {
  return t = +t, e = +e, function(l) {
    return t * (1 - l) + e * l;
  };
}
function rk(t, e) {
  var l = {}, i = {}, n;
  (t === null || typeof t != "object") && (t = {}), (e === null || typeof e != "object") && (e = {});
  for (n in e)
    n in t ? l[n] = Wa(t[n], e[n]) : i[n] = e[n];
  return function(a) {
    for (n in l)
      i[n] = l[n](a);
    return i;
  };
}
var Ar = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, vr = new RegExp(Ar.source, "g");
function sk(t) {
  return function() {
    return t;
  };
}
function ok(t) {
  return function(e) {
    return t(e) + "";
  };
}
function xm(t, e) {
  var l = Ar.lastIndex = vr.lastIndex = 0, i, n, a, r = -1, s = [], o = [];
  for (t = t + "", e = e + ""; (i = Ar.exec(t)) && (n = vr.exec(e)); )
    (a = n.index) > l && (a = e.slice(l, a), s[r] ? s[r] += a : s[++r] = a), (i = i[0]) === (n = n[0]) ? s[r] ? s[r] += n : s[++r] = n : (s[++r] = null, o.push({ i: r, x: pl(i, n) })), l = vr.lastIndex;
  return l < e.length && (a = e.slice(l), s[r] ? s[r] += a : s[++r] = a), s.length < 2 ? o[0] ? ok(o[0].x) : sk(e) : (e = o.length, function(u) {
    for (var c = 0, d; c < e; ++c)
      s[(d = o[c]).i] = d.x(u);
    return s.join("");
  });
}
function Wa(t, e) {
  var l = typeof e, i;
  return e == null || l === "boolean" ? Ur(e) : (l === "number" ? pl : l === "string" ? (i = si(e)) ? (e = i, Ra) : xm : e instanceof si ? Ra : e instanceof Date ? ak : ik(e) ? lk : Array.isArray(e) ? nk : typeof e.valueOf != "function" && typeof e.toString != "function" || isNaN(e) ? rk : pl)(t, e);
}
function eg(t, e) {
  return t = +t, e = +e, function(l) {
    return Math.round(t * (1 - l) + e * l);
  };
}
var yu = 180 / Math.PI, Br = {
  translateX: 0,
  translateY: 0,
  rotate: 0,
  skewX: 0,
  scaleX: 1,
  scaleY: 1
};
function tg(t, e, l, i, n, a) {
  var r, s, o;
  return (r = Math.sqrt(t * t + e * e)) && (t /= r, e /= r), (o = t * l + e * i) && (l -= t * o, i -= e * o), (s = Math.sqrt(l * l + i * i)) && (l /= s, i /= s, o /= s), t * i < e * l && (t = -t, e = -e, o = -o, r = -r), {
    translateX: n,
    translateY: a,
    rotate: Math.atan2(e, t) * yu,
    skewX: Math.atan(o) * yu,
    scaleX: r,
    scaleY: s
  };
}
var qa;
function uk(t) {
  const e = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(t + "");
  return e.isIdentity ? Br : tg(e.a, e.b, e.c, e.d, e.e, e.f);
}
function fk(t) {
  return t == null || (qa || (qa = document.createElementNS("http://www.w3.org/2000/svg", "g")), qa.setAttribute("transform", t), !(t = qa.transform.baseVal.consolidate())) ? Br : (t = t.matrix, tg(t.a, t.b, t.c, t.d, t.e, t.f));
}
function lg(t, e, l, i) {
  function n(u) {
    return u.length ? u.pop() + " " : "";
  }
  function a(u, c, d, h, p, b) {
    if (u !== d || c !== h) {
      var g = p.push("translate(", null, e, null, l);
      b.push({ i: g - 4, x: pl(u, d) }, { i: g - 2, x: pl(c, h) });
    } else
      (d || h) && p.push("translate(" + d + e + h + l);
  }
  function r(u, c, d, h) {
    u !== c ? (u - c > 180 ? c += 360 : c - u > 180 && (u += 360), h.push({ i: d.push(n(d) + "rotate(", null, i) - 2, x: pl(u, c) })) : c && d.push(n(d) + "rotate(" + c + i);
  }
  function s(u, c, d, h) {
    u !== c ? h.push({ i: d.push(n(d) + "skewX(", null, i) - 2, x: pl(u, c) }) : c && d.push(n(d) + "skewX(" + c + i);
  }
  function o(u, c, d, h, p, b) {
    if (u !== d || c !== h) {
      var g = p.push(n(p) + "scale(", null, ",", null, ")");
      b.push({ i: g - 4, x: pl(u, d) }, { i: g - 2, x: pl(c, h) });
    } else
      (d !== 1 || h !== 1) && p.push(n(p) + "scale(" + d + "," + h + ")");
  }
  return function(u, c) {
    var d = [], h = [];
    return u = t(u), c = t(c), a(u.translateX, u.translateY, c.translateX, c.translateY, d, h), r(u.rotate, c.rotate, d, h), s(u.skewX, c.skewX, d, h), o(u.scaleX, u.scaleY, c.scaleX, c.scaleY, d, h), u = c = null, function(p) {
      for (var b = -1, g = h.length, v; ++b < g; )
        d[(v = h[b]).i] = v.x(p);
      return d.join("");
    };
  };
}
var _k = lg(uk, "px, ", "px)", "deg)"), ck = lg(fk, ", ", ")", ")"), Ui = 0, vn = 0, pn = 0, ig = 1e3, Ha, kn, Fa = 0, oi = 0, Ja = 0, Cn = typeof performance == "object" && performance.now ? performance : Date, ng = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(t) {
  setTimeout(t, 17);
};
function Wr() {
  return oi || (ng(dk), oi = Cn.now() + Ja);
}
function dk() {
  oi = 0;
}
function La() {
  this._call = this._time = this._next = null;
}
La.prototype = Za.prototype = {
  constructor: La,
  restart: function(t, e, l) {
    if (typeof t != "function")
      throw new TypeError("callback is not a function");
    l = (l == null ? Wr() : +l) + (e == null ? 0 : +e), !this._next && kn !== this && (kn ? kn._next = this : Ha = this, kn = this), this._call = t, this._time = l, Pr();
  },
  stop: function() {
    this._call && (this._call = null, this._time = 1 / 0, Pr());
  }
};
function Za(t, e, l) {
  var i = new La();
  return i.restart(t, e, l), i;
}
function hk() {
  Wr(), ++Ui;
  for (var t = Ha, e; t; )
    (e = oi - t._time) >= 0 && t._call.call(void 0, e), t = t._next;
  --Ui;
}
function wu() {
  oi = (Fa = Cn.now()) + Ja, Ui = vn = 0;
  try {
    hk();
  } finally {
    Ui = 0, mk(), oi = 0;
  }
}
function pk() {
  var t = Cn.now(), e = t - Fa;
  e > ig && (Ja -= e, Fa = t);
}
function mk() {
  for (var t, e = Ha, l, i = 1 / 0; e; )
    e._call ? (i > e._time && (i = e._time), t = e, e = e._next) : (l = e._next, e._next = null, e = t ? t._next = l : Ha = l);
  kn = t, Pr(i);
}
function Pr(t) {
  if (!Ui) {
    vn && (vn = clearTimeout(vn));
    var e = t - oi;
    e > 24 ? (t < 1 / 0 && (vn = setTimeout(wu, t - Cn.now() - Ja)), pn && (pn = clearInterval(pn))) : (pn || (Fa = Cn.now(), pn = setInterval(pk, ig)), Ui = 1, ng(wu));
  }
}
function $u(t, e, l) {
  var i = new La();
  return e = e == null ? 0 : +e, i.restart((n) => {
    i.stop(), t(n + e);
  }, e, l), i;
}
var gk = Vr("start", "end", "cancel", "interrupt"), bk = [], ag = 0, qu = 1, Er = 2, Na = 3, ju = 4, Or = 5, Aa = 6;
function xa(t, e, l, i, n, a) {
  var r = t.__transition;
  if (!r)
    t.__transition = {};
  else if (l in r)
    return;
  vk(t, l, {
    name: e,
    index: i,
    // For context during callback.
    group: n,
    // For context during callback.
    on: gk,
    tween: bk,
    time: a.time,
    delay: a.delay,
    duration: a.duration,
    ease: a.ease,
    timer: null,
    state: ag
  });
}
function Jr(t, e) {
  var l = gl(t, e);
  if (l.state > ag)
    throw new Error("too late; already scheduled");
  return l;
}
function jl(t, e) {
  var l = gl(t, e);
  if (l.state > Na)
    throw new Error("too late; already running");
  return l;
}
function gl(t, e) {
  var l = t.__transition;
  if (!l || !(l = l[e]))
    throw new Error("transition not found");
  return l;
}
function vk(t, e, l) {
  var i = t.__transition, n;
  i[e] = l, l.timer = Za(a, 0, l.time);
  function a(u) {
    l.state = qu, l.timer.restart(r, l.delay, l.time), l.delay <= u && r(u - l.delay);
  }
  function r(u) {
    var c, d, h, p;
    if (l.state !== qu)
      return o();
    for (c in i)
      if (p = i[c], p.name === l.name) {
        if (p.state === Na)
          return $u(r);
        p.state === ju ? (p.state = Aa, p.timer.stop(), p.on.call("interrupt", t, t.__data__, p.index, p.group), delete i[c]) : +c < e && (p.state = Aa, p.timer.stop(), p.on.call("cancel", t, t.__data__, p.index, p.group), delete i[c]);
      }
    if ($u(function() {
      l.state === Na && (l.state = ju, l.timer.restart(s, l.delay, l.time), s(u));
    }), l.state = Er, l.on.call("start", t, t.__data__, l.index, l.group), l.state === Er) {
      for (l.state = Na, n = new Array(h = l.tween.length), c = 0, d = -1; c < h; ++c)
        (p = l.tween[c].value.call(t, t.__data__, l.index, l.group)) && (n[++d] = p);
      n.length = d + 1;
    }
  }
  function s(u) {
    for (var c = u < l.duration ? l.ease.call(null, u / l.duration) : (l.timer.restart(o), l.state = Or, 1), d = -1, h = n.length; ++d < h; )
      n[d].call(t, c);
    l.state === Or && (l.on.call("end", t, t.__data__, l.index, l.group), o());
  }
  function o() {
    l.state = Aa, l.timer.stop(), delete i[e];
    for (var u in i)
      return;
    delete t.__transition;
  }
}
function kk(t, e) {
  var l = t.__transition, i, n, a = !0, r;
  if (l) {
    e = e == null ? null : e + "";
    for (r in l) {
      if ((i = l[r]).name !== e) {
        a = !1;
        continue;
      }
      n = i.state > Er && i.state < Or, i.state = Aa, i.timer.stop(), i.on.call(n ? "interrupt" : "cancel", t, t.__data__, i.index, i.group), delete l[r];
    }
    a && delete t.__transition;
  }
}
function yk(t) {
  return this.each(function() {
    kk(this, t);
  });
}
function wk(t, e) {
  var l, i;
  return function() {
    var n = jl(this, t), a = n.tween;
    if (a !== l) {
      i = l = a;
      for (var r = 0, s = i.length; r < s; ++r)
        if (i[r].name === e) {
          i = i.slice(), i.splice(r, 1);
          break;
        }
    }
    n.tween = i;
  };
}
function $k(t, e, l) {
  var i, n;
  if (typeof l != "function")
    throw new Error();
  return function() {
    var a = jl(this, t), r = a.tween;
    if (r !== i) {
      n = (i = r).slice();
      for (var s = { name: e, value: l }, o = 0, u = n.length; o < u; ++o)
        if (n[o].name === e) {
          n[o] = s;
          break;
        }
      o === u && n.push(s);
    }
    a.tween = n;
  };
}
function qk(t, e) {
  var l = this._id;
  if (t += "", arguments.length < 2) {
    for (var i = gl(this.node(), l).tween, n = 0, a = i.length, r; n < a; ++n)
      if ((r = i[n]).name === t)
        return r.value;
    return null;
  }
  return this.each((e == null ? wk : $k)(l, t, e));
}
function Zr(t, e, l) {
  var i = t._id;
  return t.each(function() {
    var n = jl(this, i);
    (n.value || (n.value = {}))[e] = l.apply(this, arguments);
  }), function(n) {
    return gl(n, i).value[e];
  };
}
function rg(t, e) {
  var l;
  return (typeof e == "number" ? pl : e instanceof si ? Ra : (l = si(e)) ? (e = l, Ra) : xm)(t, e);
}
function jk(t) {
  return function() {
    this.removeAttribute(t);
  };
}
function Tk(t) {
  return function() {
    this.removeAttributeNS(t.space, t.local);
  };
}
function Ck(t, e, l) {
  var i, n = l + "", a;
  return function() {
    var r = this.getAttribute(t);
    return r === n ? null : r === i ? a : a = e(i = r, l);
  };
}
function Sk(t, e, l) {
  var i, n = l + "", a;
  return function() {
    var r = this.getAttributeNS(t.space, t.local);
    return r === n ? null : r === i ? a : a = e(i = r, l);
  };
}
function Mk(t, e, l) {
  var i, n, a;
  return function() {
    var r, s = l(this), o;
    return s == null ? void this.removeAttribute(t) : (r = this.getAttribute(t), o = s + "", r === o ? null : r === i && o === n ? a : (n = o, a = e(i = r, s)));
  };
}
function zk(t, e, l) {
  var i, n, a;
  return function() {
    var r, s = l(this), o;
    return s == null ? void this.removeAttributeNS(t.space, t.local) : (r = this.getAttributeNS(t.space, t.local), o = s + "", r === o ? null : r === i && o === n ? a : (n = o, a = e(i = r, s)));
  };
}
function Nk(t, e) {
  var l = Ua(t), i = l === "transform" ? ck : rg;
  return this.attrTween(t, typeof e == "function" ? (l.local ? zk : Mk)(l, i, Zr(this, "attr." + t, e)) : e == null ? (l.local ? Tk : jk)(l) : (l.local ? Sk : Ck)(l, i, e));
}
function Ak(t, e) {
  return function(l) {
    this.setAttribute(t, e.call(this, l));
  };
}
function Bk(t, e) {
  return function(l) {
    this.setAttributeNS(t.space, t.local, e.call(this, l));
  };
}
function Pk(t, e) {
  var l, i;
  function n() {
    var a = e.apply(this, arguments);
    return a !== i && (l = (i = a) && Bk(t, a)), l;
  }
  return n._value = e, n;
}
function Ek(t, e) {
  var l, i;
  function n() {
    var a = e.apply(this, arguments);
    return a !== i && (l = (i = a) && Ak(t, a)), l;
  }
  return n._value = e, n;
}
function Ok(t, e) {
  var l = "attr." + t;
  if (arguments.length < 2)
    return (l = this.tween(l)) && l._value;
  if (e == null)
    return this.tween(l, null);
  if (typeof e != "function")
    throw new Error();
  var i = Ua(t);
  return this.tween(l, (i.local ? Pk : Ek)(i, e));
}
function Ik(t, e) {
  return function() {
    Jr(this, t).delay = +e.apply(this, arguments);
  };
}
function Dk(t, e) {
  return e = +e, function() {
    Jr(this, t).delay = e;
  };
}
function Rk(t) {
  var e = this._id;
  return arguments.length ? this.each((typeof t == "function" ? Ik : Dk)(e, t)) : gl(this.node(), e).delay;
}
function Hk(t, e) {
  return function() {
    jl(this, t).duration = +e.apply(this, arguments);
  };
}
function Fk(t, e) {
  return e = +e, function() {
    jl(this, t).duration = e;
  };
}
function Lk(t) {
  var e = this._id;
  return arguments.length ? this.each((typeof t == "function" ? Hk : Fk)(e, t)) : gl(this.node(), e).duration;
}
function Qk(t, e) {
  if (typeof e != "function")
    throw new Error();
  return function() {
    jl(this, t).ease = e;
  };
}
function Vk(t) {
  var e = this._id;
  return arguments.length ? this.each(Qk(e, t)) : gl(this.node(), e).ease;
}
function Xk(t, e) {
  return function() {
    var l = e.apply(this, arguments);
    if (typeof l != "function")
      throw new Error();
    jl(this, t).ease = l;
  };
}
function Gk(t) {
  if (typeof t != "function")
    throw new Error();
  return this.each(Xk(this._id, t));
}
function Yk(t) {
  typeof t != "function" && (t = Fm(t));
  for (var e = this._groups, l = e.length, i = new Array(l), n = 0; n < l; ++n)
    for (var a = e[n], r = a.length, s = i[n] = [], o, u = 0; u < r; ++u)
      (o = a[u]) && t.call(o, o.__data__, u, a) && s.push(o);
  return new Al(i, this._parents, this._name, this._id);
}
function Kk(t) {
  if (t._id !== this._id)
    throw new Error();
  for (var e = this._groups, l = t._groups, i = e.length, n = l.length, a = Math.min(i, n), r = new Array(i), s = 0; s < a; ++s)
    for (var o = e[s], u = l[s], c = o.length, d = r[s] = new Array(c), h, p = 0; p < c; ++p)
      (h = o[p] || u[p]) && (d[p] = h);
  for (; s < i; ++s)
    r[s] = e[s];
  return new Al(r, this._parents, this._name, this._id);
}
function Uk(t) {
  return (t + "").trim().split(/^|\s+/).every(function(e) {
    var l = e.indexOf(".");
    return l >= 0 && (e = e.slice(0, l)), !e || e === "start";
  });
}
function Wk(t, e, l) {
  var i, n, a = Uk(e) ? Jr : jl;
  return function() {
    var r = a(this, t), s = r.on;
    s !== i && (n = (i = s).copy()).on(e, l), r.on = n;
  };
}
function Jk(t, e) {
  var l = this._id;
  return arguments.length < 2 ? gl(this.node(), l).on.on(t) : this.each(Wk(l, t, e));
}
function Zk(t) {
  return function() {
    var e = this.parentNode;
    for (var l in this.__transition)
      if (+l !== t)
        return;
    e && e.removeChild(this);
  };
}
function xk() {
  return this.on("end.remove", Zk(this._id));
}
function ey(t) {
  var e = this._name, l = this._id;
  typeof t != "function" && (t = Xr(t));
  for (var i = this._groups, n = i.length, a = new Array(n), r = 0; r < n; ++r)
    for (var s = i[r], o = s.length, u = a[r] = new Array(o), c, d, h = 0; h < o; ++h)
      (c = s[h]) && (d = t.call(c, c.__data__, h, s)) && ("__data__" in c && (d.__data__ = c.__data__), u[h] = d, xa(u[h], e, l, h, u, gl(c, l)));
  return new Al(a, this._parents, e, l);
}
function ty(t) {
  var e = this._name, l = this._id;
  typeof t != "function" && (t = Hm(t));
  for (var i = this._groups, n = i.length, a = [], r = [], s = 0; s < n; ++s)
    for (var o = i[s], u = o.length, c, d = 0; d < u; ++d)
      if (c = o[d]) {
        for (var h = t.call(c, c.__data__, d, o), p, b = gl(c, l), g = 0, v = h.length; g < v; ++g)
          (p = h[g]) && xa(p, e, l, g, h, b);
        a.push(h), r.push(c);
      }
  return new Al(a, r, e, l);
}
var ly = Sn.prototype.constructor;
function iy() {
  return new ly(this._groups, this._parents);
}
function ny(t, e) {
  var l, i, n;
  return function() {
    var a = Ki(this, t), r = (this.style.removeProperty(t), Ki(this, t));
    return a === r ? null : a === l && r === i ? n : n = e(l = a, i = r);
  };
}
function sg(t) {
  return function() {
    this.style.removeProperty(t);
  };
}
function ay(t, e, l) {
  var i, n = l + "", a;
  return function() {
    var r = Ki(this, t);
    return r === n ? null : r === i ? a : a = e(i = r, l);
  };
}
function ry(t, e, l) {
  var i, n, a;
  return function() {
    var r = Ki(this, t), s = l(this), o = s + "";
    return s == null && (o = s = (this.style.removeProperty(t), Ki(this, t))), r === o ? null : r === i && o === n ? a : (n = o, a = e(i = r, s));
  };
}
function sy(t, e) {
  var l, i, n, a = "style." + e, r = "end." + a, s;
  return function() {
    var o = jl(this, t), u = o.on, c = o.value[a] == null ? s || (s = sg(e)) : void 0;
    (u !== l || n !== c) && (i = (l = u).copy()).on(r, n = c), o.on = i;
  };
}
function oy(t, e, l) {
  var i = (t += "") == "transform" ? _k : rg;
  return e == null ? this.styleTween(t, ny(t, i)).on("end.style." + t, sg(t)) : typeof e == "function" ? this.styleTween(t, ry(t, i, Zr(this, "style." + t, e))).each(sy(this._id, t)) : this.styleTween(t, ay(t, i, e), l).on("end.style." + t, null);
}
function uy(t, e, l) {
  return function(i) {
    this.style.setProperty(t, e.call(this, i), l);
  };
}
function fy(t, e, l) {
  var i, n;
  function a() {
    var r = e.apply(this, arguments);
    return r !== n && (i = (n = r) && uy(t, r, l)), i;
  }
  return a._value = e, a;
}
function _y(t, e, l) {
  var i = "style." + (t += "");
  if (arguments.length < 2)
    return (i = this.tween(i)) && i._value;
  if (e == null)
    return this.tween(i, null);
  if (typeof e != "function")
    throw new Error();
  return this.tween(i, fy(t, e, l ?? ""));
}
function cy(t) {
  return function() {
    this.textContent = t;
  };
}
function dy(t) {
  return function() {
    var e = t(this);
    this.textContent = e ?? "";
  };
}
function hy(t) {
  return this.tween("text", typeof t == "function" ? dy(Zr(this, "text", t)) : cy(t == null ? "" : t + ""));
}
function py(t) {
  return function(e) {
    this.textContent = t.call(this, e);
  };
}
function my(t) {
  var e, l;
  function i() {
    var n = t.apply(this, arguments);
    return n !== l && (e = (l = n) && py(n)), e;
  }
  return i._value = t, i;
}
function gy(t) {
  var e = "text";
  if (arguments.length < 1)
    return (e = this.tween(e)) && e._value;
  if (t == null)
    return this.tween(e, null);
  if (typeof t != "function")
    throw new Error();
  return this.tween(e, my(t));
}
function by() {
  for (var t = this._name, e = this._id, l = og(), i = this._groups, n = i.length, a = 0; a < n; ++a)
    for (var r = i[a], s = r.length, o, u = 0; u < s; ++u)
      if (o = r[u]) {
        var c = gl(o, e);
        xa(o, t, l, u, r, {
          time: c.time + c.delay + c.duration,
          delay: 0,
          duration: c.duration,
          ease: c.ease
        });
      }
  return new Al(i, this._parents, t, l);
}
function vy() {
  var t, e, l = this, i = l._id, n = l.size();
  return new Promise(function(a, r) {
    var s = { value: r }, o = { value: function() {
      --n === 0 && a();
    } };
    l.each(function() {
      var u = jl(this, i), c = u.on;
      c !== t && (e = (t = c).copy(), e._.cancel.push(s), e._.interrupt.push(s), e._.end.push(o)), u.on = e;
    }), n === 0 && a();
  });
}
var ky = 0;
function Al(t, e, l, i) {
  this._groups = t, this._parents = e, this._name = l, this._id = i;
}
function og() {
  return ++ky;
}
var Sl = Sn.prototype;
Al.prototype = {
  constructor: Al,
  select: ey,
  selectAll: ty,
  selectChild: Sl.selectChild,
  selectChildren: Sl.selectChildren,
  filter: Yk,
  merge: Kk,
  selection: iy,
  transition: by,
  call: Sl.call,
  nodes: Sl.nodes,
  node: Sl.node,
  size: Sl.size,
  empty: Sl.empty,
  each: Sl.each,
  on: Jk,
  attr: Nk,
  attrTween: Ok,
  style: oy,
  styleTween: _y,
  text: hy,
  textTween: gy,
  remove: xk,
  tween: qk,
  delay: Rk,
  duration: Lk,
  ease: Vk,
  easeVarying: Gk,
  end: vy,
  [Symbol.iterator]: Sl[Symbol.iterator]
};
function yy(t) {
  return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
}
var wy = {
  time: null,
  // Set on use.
  delay: 0,
  duration: 250,
  ease: yy
};
function $y(t, e) {
  for (var l; !(l = t.__transition) || !(l = l[e]); )
    if (!(t = t.parentNode))
      throw new Error(`transition ${e} not found`);
  return l;
}
function qy(t) {
  var e, l;
  t instanceof Al ? (e = t._id, t = t._name) : (e = og(), (l = wy).time = Wr(), t = t == null ? null : t + "");
  for (var i = this._groups, n = i.length, a = 0; a < n; ++a)
    for (var r = i[a], s = r.length, o, u = 0; u < s; ++u)
      (o = r[u]) && xa(o, t, e, u, r, l || $y(o, e));
  return new Al(i, this._parents, t, e);
}
Sn.prototype.interrupt = yk;
Sn.prototype.transition = qy;
const Ir = Math.PI, Dr = 2 * Ir, ti = 1e-6, jy = Dr - ti;
function ug(t) {
  this._ += t[0];
  for (let e = 1, l = t.length; e < l; ++e)
    this._ += arguments[e] + t[e];
}
function Ty(t) {
  let e = Math.floor(t);
  if (!(e >= 0))
    throw new Error(`invalid digits: ${t}`);
  if (e > 15)
    return ug;
  const l = 10 ** e;
  return function(i) {
    this._ += i[0];
    for (let n = 1, a = i.length; n < a; ++n)
      this._ += Math.round(arguments[n] * l) / l + i[n];
  };
}
class Cy {
  constructor(e) {
    this._x0 = this._y0 = // start of current subpath
    this._x1 = this._y1 = null, this._ = "", this._append = e == null ? ug : Ty(e);
  }
  moveTo(e, l) {
    this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +l}`;
  }
  closePath() {
    this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
  }
  lineTo(e, l) {
    this._append`L${this._x1 = +e},${this._y1 = +l}`;
  }
  quadraticCurveTo(e, l, i, n) {
    this._append`Q${+e},${+l},${this._x1 = +i},${this._y1 = +n}`;
  }
  bezierCurveTo(e, l, i, n, a, r) {
    this._append`C${+e},${+l},${+i},${+n},${this._x1 = +a},${this._y1 = +r}`;
  }
  arcTo(e, l, i, n, a) {
    if (e = +e, l = +l, i = +i, n = +n, a = +a, a < 0)
      throw new Error(`negative radius: ${a}`);
    let r = this._x1, s = this._y1, o = i - e, u = n - l, c = r - e, d = s - l, h = c * c + d * d;
    if (this._x1 === null)
      this._append`M${this._x1 = e},${this._y1 = l}`;
    else if (h > ti)
      if (!(Math.abs(d * o - u * c) > ti) || !a)
        this._append`L${this._x1 = e},${this._y1 = l}`;
      else {
        let p = i - r, b = n - s, g = o * o + u * u, v = p * p + b * b, y = Math.sqrt(g), k = Math.sqrt(h), w = a * Math.tan((Ir - Math.acos((g + h - v) / (2 * y * k))) / 2), $ = w / k, q = w / y;
        Math.abs($ - 1) > ti && this._append`L${e + $ * c},${l + $ * d}`, this._append`A${a},${a},0,0,${+(d * p > c * b)},${this._x1 = e + q * o},${this._y1 = l + q * u}`;
      }
  }
  arc(e, l, i, n, a, r) {
    if (e = +e, l = +l, i = +i, r = !!r, i < 0)
      throw new Error(`negative radius: ${i}`);
    let s = i * Math.cos(n), o = i * Math.sin(n), u = e + s, c = l + o, d = 1 ^ r, h = r ? n - a : a - n;
    this._x1 === null ? this._append`M${u},${c}` : (Math.abs(this._x1 - u) > ti || Math.abs(this._y1 - c) > ti) && this._append`L${u},${c}`, i && (h < 0 && (h = h % Dr + Dr), h > jy ? this._append`A${i},${i},0,1,${d},${e - s},${l - o}A${i},${i},0,1,${d},${this._x1 = u},${this._y1 = c}` : h > ti && this._append`A${i},${i},0,${+(h >= Ir)},${d},${this._x1 = e + i * Math.cos(a)},${this._y1 = l + i * Math.sin(a)}`);
  }
  rect(e, l, i, n) {
    this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +l}h${i = +i}v${+n}h${-i}Z`;
  }
  toString() {
    return this._;
  }
}
function Sy(t) {
  const e = +this._x.call(null, t), l = +this._y.call(null, t);
  return fg(this.cover(e, l), e, l, t);
}
function fg(t, e, l, i) {
  if (isNaN(e) || isNaN(l))
    return t;
  var n, a = t._root, r = { data: i }, s = t._x0, o = t._y0, u = t._x1, c = t._y1, d, h, p, b, g, v, y, k;
  if (!a)
    return t._root = r, t;
  for (; a.length; )
    if ((g = e >= (d = (s + u) / 2)) ? s = d : u = d, (v = l >= (h = (o + c) / 2)) ? o = h : c = h, n = a, !(a = a[y = v << 1 | g]))
      return n[y] = r, t;
  if (p = +t._x.call(null, a.data), b = +t._y.call(null, a.data), e === p && l === b)
    return r.next = a, n ? n[y] = r : t._root = r, t;
  do
    n = n ? n[y] = new Array(4) : t._root = new Array(4), (g = e >= (d = (s + u) / 2)) ? s = d : u = d, (v = l >= (h = (o + c) / 2)) ? o = h : c = h;
  while ((y = v << 1 | g) === (k = (b >= h) << 1 | p >= d));
  return n[k] = a, n[y] = r, t;
}
function My(t) {
  var e, l, i = t.length, n, a, r = new Array(i), s = new Array(i), o = 1 / 0, u = 1 / 0, c = -1 / 0, d = -1 / 0;
  for (l = 0; l < i; ++l)
    isNaN(n = +this._x.call(null, e = t[l])) || isNaN(a = +this._y.call(null, e)) || (r[l] = n, s[l] = a, n < o && (o = n), n > c && (c = n), a < u && (u = a), a > d && (d = a));
  if (o > c || u > d)
    return this;
  for (this.cover(o, u).cover(c, d), l = 0; l < i; ++l)
    fg(this, r[l], s[l], t[l]);
  return this;
}
function zy(t, e) {
  if (isNaN(t = +t) || isNaN(e = +e))
    return this;
  var l = this._x0, i = this._y0, n = this._x1, a = this._y1;
  if (isNaN(l))
    n = (l = Math.floor(t)) + 1, a = (i = Math.floor(e)) + 1;
  else {
    for (var r = n - l || 1, s = this._root, o, u; l > t || t >= n || i > e || e >= a; )
      switch (u = (e < i) << 1 | t < l, o = new Array(4), o[u] = s, s = o, r *= 2, u) {
        case 0:
          n = l + r, a = i + r;
          break;
        case 1:
          l = n - r, a = i + r;
          break;
        case 2:
          n = l + r, i = a - r;
          break;
        case 3:
          l = n - r, i = a - r;
          break;
      }
    this._root && this._root.length && (this._root = s);
  }
  return this._x0 = l, this._y0 = i, this._x1 = n, this._y1 = a, this;
}
function Ny() {
  var t = [];
  return this.visit(function(e) {
    if (!e.length)
      do
        t.push(e.data);
      while (e = e.next);
  }), t;
}
function Ay(t) {
  return arguments.length ? this.cover(+t[0][0], +t[0][1]).cover(+t[1][0], +t[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]];
}
function el(t, e, l, i, n) {
  this.node = t, this.x0 = e, this.y0 = l, this.x1 = i, this.y1 = n;
}
function By(t, e, l) {
  var i, n = this._x0, a = this._y0, r, s, o, u, c = this._x1, d = this._y1, h = [], p = this._root, b, g;
  for (p && h.push(new el(p, n, a, c, d)), l == null ? l = 1 / 0 : (n = t - l, a = e - l, c = t + l, d = e + l, l *= l); b = h.pop(); )
    if (!(!(p = b.node) || (r = b.x0) > c || (s = b.y0) > d || (o = b.x1) < n || (u = b.y1) < a))
      if (p.length) {
        var v = (r + o) / 2, y = (s + u) / 2;
        h.push(
          new el(p[3], v, y, o, u),
          new el(p[2], r, y, v, u),
          new el(p[1], v, s, o, y),
          new el(p[0], r, s, v, y)
        ), (g = (e >= y) << 1 | t >= v) && (b = h[h.length - 1], h[h.length - 1] = h[h.length - 1 - g], h[h.length - 1 - g] = b);
      } else {
        var k = t - +this._x.call(null, p.data), w = e - +this._y.call(null, p.data), $ = k * k + w * w;
        if ($ < l) {
          var q = Math.sqrt(l = $);
          n = t - q, a = e - q, c = t + q, d = e + q, i = p.data;
        }
      }
  return i;
}
function Py(t) {
  if (isNaN(c = +this._x.call(null, t)) || isNaN(d = +this._y.call(null, t)))
    return this;
  var e, l = this._root, i, n, a, r = this._x0, s = this._y0, o = this._x1, u = this._y1, c, d, h, p, b, g, v, y;
  if (!l)
    return this;
  if (l.length)
    for (; ; ) {
      if ((b = c >= (h = (r + o) / 2)) ? r = h : o = h, (g = d >= (p = (s + u) / 2)) ? s = p : u = p, e = l, !(l = l[v = g << 1 | b]))
        return this;
      if (!l.length)
        break;
      (e[v + 1 & 3] || e[v + 2 & 3] || e[v + 3 & 3]) && (i = e, y = v);
    }
  for (; l.data !== t; )
    if (n = l, !(l = l.next))
      return this;
  return (a = l.next) && delete l.next, n ? (a ? n.next = a : delete n.next, this) : e ? (a ? e[v] = a : delete e[v], (l = e[0] || e[1] || e[2] || e[3]) && l === (e[3] || e[2] || e[1] || e[0]) && !l.length && (i ? i[y] = l : this._root = l), this) : (this._root = a, this);
}
function Ey(t) {
  for (var e = 0, l = t.length; e < l; ++e)
    this.remove(t[e]);
  return this;
}
function Oy() {
  return this._root;
}
function Iy() {
  var t = 0;
  return this.visit(function(e) {
    if (!e.length)
      do
        ++t;
      while (e = e.next);
  }), t;
}
function Dy(t) {
  var e = [], l, i = this._root, n, a, r, s, o;
  for (i && e.push(new el(i, this._x0, this._y0, this._x1, this._y1)); l = e.pop(); )
    if (!t(i = l.node, a = l.x0, r = l.y0, s = l.x1, o = l.y1) && i.length) {
      var u = (a + s) / 2, c = (r + o) / 2;
      (n = i[3]) && e.push(new el(n, u, c, s, o)), (n = i[2]) && e.push(new el(n, a, c, u, o)), (n = i[1]) && e.push(new el(n, u, r, s, c)), (n = i[0]) && e.push(new el(n, a, r, u, c));
    }
  return this;
}
function Ry(t) {
  var e = [], l = [], i;
  for (this._root && e.push(new el(this._root, this._x0, this._y0, this._x1, this._y1)); i = e.pop(); ) {
    var n = i.node;
    if (n.length) {
      var a, r = i.x0, s = i.y0, o = i.x1, u = i.y1, c = (r + o) / 2, d = (s + u) / 2;
      (a = n[0]) && e.push(new el(a, r, s, c, d)), (a = n[1]) && e.push(new el(a, c, s, o, d)), (a = n[2]) && e.push(new el(a, r, d, c, u)), (a = n[3]) && e.push(new el(a, c, d, o, u));
    }
    l.push(i);
  }
  for (; i = l.pop(); )
    t(i.node, i.x0, i.y0, i.x1, i.y1);
  return this;
}
function Hy(t) {
  return t[0];
}
function Fy(t) {
  return arguments.length ? (this._x = t, this) : this._x;
}
function Ly(t) {
  return t[1];
}
function Qy(t) {
  return arguments.length ? (this._y = t, this) : this._y;
}
function _g(t, e, l) {
  var i = new xr(e ?? Hy, l ?? Ly, NaN, NaN, NaN, NaN);
  return t == null ? i : i.addAll(t);
}
function xr(t, e, l, i, n, a) {
  this._x = t, this._y = e, this._x0 = l, this._y0 = i, this._x1 = n, this._y1 = a, this._root = void 0;
}
function Tu(t) {
  for (var e = { data: t.data }, l = e; t = t.next; )
    l = l.next = { data: t.data };
  return e;
}
var ll = _g.prototype = xr.prototype;
ll.copy = function() {
  var t = new xr(this._x, this._y, this._x0, this._y0, this._x1, this._y1), e = this._root, l, i;
  if (!e)
    return t;
  if (!e.length)
    return t._root = Tu(e), t;
  for (l = [{ source: e, target: t._root = new Array(4) }]; e = l.pop(); )
    for (var n = 0; n < 4; ++n)
      (i = e.source[n]) && (i.length ? l.push({ source: i, target: e.target[n] = new Array(4) }) : e.target[n] = Tu(i));
  return t;
};
ll.add = Sy;
ll.addAll = My;
ll.cover = zy;
ll.data = Ny;
ll.extent = Ay;
ll.find = By;
ll.remove = Py;
ll.removeAll = Ey;
ll.root = Oy;
ll.size = Iy;
ll.visit = Dy;
ll.visitAfter = Ry;
ll.x = Fy;
ll.y = Qy;
function $n(t) {
  return function() {
    return t;
  };
}
function Ri(t) {
  return (t() - 0.5) * 1e-6;
}
function Vy(t) {
  return t.index;
}
function Cu(t, e) {
  var l = t.get(e);
  if (!l)
    throw new Error("node not found: " + e);
  return l;
}
function Xy(t) {
  var e = Vy, l = d, i, n = $n(30), a, r, s, o, u, c = 1;
  t == null && (t = []);
  function d(v) {
    return 1 / Math.min(s[v.source.index], s[v.target.index]);
  }
  function h(v) {
    for (var y = 0, k = t.length; y < c; ++y)
      for (var w = 0, $, q, j, O, z, N, M; w < k; ++w)
        $ = t[w], q = $.source, j = $.target, O = j.x + j.vx - q.x - q.vx || Ri(u), z = j.y + j.vy - q.y - q.vy || Ri(u), N = Math.sqrt(O * O + z * z), N = (N - a[w]) / N * v * i[w], O *= N, z *= N, j.vx -= O * (M = o[w]), j.vy -= z * M, q.vx += O * (M = 1 - M), q.vy += z * M;
  }
  function p() {
    if (r) {
      var v, y = r.length, k = t.length, w = new Map(r.map((q, j) => [e(q, j, r), q])), $;
      for (v = 0, s = new Array(y); v < k; ++v)
        $ = t[v], $.index = v, typeof $.source != "object" && ($.source = Cu(w, $.source)), typeof $.target != "object" && ($.target = Cu(w, $.target)), s[$.source.index] = (s[$.source.index] || 0) + 1, s[$.target.index] = (s[$.target.index] || 0) + 1;
      for (v = 0, o = new Array(k); v < k; ++v)
        $ = t[v], o[v] = s[$.source.index] / (s[$.source.index] + s[$.target.index]);
      i = new Array(k), b(), a = new Array(k), g();
    }
  }
  function b() {
    if (r)
      for (var v = 0, y = t.length; v < y; ++v)
        i[v] = +l(t[v], v, t);
  }
  function g() {
    if (r)
      for (var v = 0, y = t.length; v < y; ++v)
        a[v] = +n(t[v], v, t);
  }
  return h.initialize = function(v, y) {
    r = v, u = y, p();
  }, h.links = function(v) {
    return arguments.length ? (t = v, p(), h) : t;
  }, h.id = function(v) {
    return arguments.length ? (e = v, h) : e;
  }, h.iterations = function(v) {
    return arguments.length ? (c = +v, h) : c;
  }, h.strength = function(v) {
    return arguments.length ? (l = typeof v == "function" ? v : $n(+v), b(), h) : l;
  }, h.distance = function(v) {
    return arguments.length ? (n = typeof v == "function" ? v : $n(+v), g(), h) : n;
  }, h;
}
const Gy = 1664525, Yy = 1013904223, Su = 4294967296;
function Ky() {
  let t = 1;
  return () => (t = (Gy * t + Yy) % Su) / Su;
}
function Uy(t) {
  return t.x;
}
function Wy(t) {
  return t.y;
}
var Jy = 10, Zy = Math.PI * (3 - Math.sqrt(5));
function xy(t) {
  var e, l = 1, i = 1e-3, n = 1 - Math.pow(i, 1 / 300), a = 0, r = 0.6, s = /* @__PURE__ */ new Map(), o = Za(d), u = Vr("tick", "end"), c = Ky();
  t == null && (t = []);
  function d() {
    h(), u.call("tick", e), l < i && (o.stop(), u.call("end", e));
  }
  function h(g) {
    var v, y = t.length, k;
    g === void 0 && (g = 1);
    for (var w = 0; w < g; ++w)
      for (l += (a - l) * n, s.forEach(function($) {
        $(l);
      }), v = 0; v < y; ++v)
        k = t[v], k.fx == null ? k.x += k.vx *= r : (k.x = k.fx, k.vx = 0), k.fy == null ? k.y += k.vy *= r : (k.y = k.fy, k.vy = 0);
    return e;
  }
  function p() {
    for (var g = 0, v = t.length, y; g < v; ++g) {
      if (y = t[g], y.index = g, y.fx != null && (y.x = y.fx), y.fy != null && (y.y = y.fy), isNaN(y.x) || isNaN(y.y)) {
        var k = Jy * Math.sqrt(0.5 + g), w = g * Zy;
        y.x = k * Math.cos(w), y.y = k * Math.sin(w);
      }
      (isNaN(y.vx) || isNaN(y.vy)) && (y.vx = y.vy = 0);
    }
  }
  function b(g) {
    return g.initialize && g.initialize(t, c), g;
  }
  return p(), e = {
    tick: h,
    restart: function() {
      return o.restart(d), e;
    },
    stop: function() {
      return o.stop(), e;
    },
    nodes: function(g) {
      return arguments.length ? (t = g, p(), s.forEach(b), e) : t;
    },
    alpha: function(g) {
      return arguments.length ? (l = +g, e) : l;
    },
    alphaMin: function(g) {
      return arguments.length ? (i = +g, e) : i;
    },
    alphaDecay: function(g) {
      return arguments.length ? (n = +g, e) : +n;
    },
    alphaTarget: function(g) {
      return arguments.length ? (a = +g, e) : a;
    },
    velocityDecay: function(g) {
      return arguments.length ? (r = 1 - g, e) : 1 - r;
    },
    randomSource: function(g) {
      return arguments.length ? (c = g, s.forEach(b), e) : c;
    },
    force: function(g, v) {
      return arguments.length > 1 ? (v == null ? s.delete(g) : s.set(g, b(v)), e) : s.get(g);
    },
    find: function(g, v, y) {
      var k = 0, w = t.length, $, q, j, O, z;
      for (y == null ? y = 1 / 0 : y *= y, k = 0; k < w; ++k)
        O = t[k], $ = g - O.x, q = v - O.y, j = $ * $ + q * q, j < y && (z = O, y = j);
      return z;
    },
    on: function(g, v) {
      return arguments.length > 1 ? (u.on(g, v), e) : u.on(g);
    }
  };
}
function ew() {
  var t, e, l, i, n = $n(-30), a, r = 1, s = 1 / 0, o = 0.81;
  function u(p) {
    var b, g = t.length, v = _g(t, Uy, Wy).visitAfter(d);
    for (i = p, b = 0; b < g; ++b)
      e = t[b], v.visit(h);
  }
  function c() {
    if (t) {
      var p, b = t.length, g;
      for (a = new Array(b), p = 0; p < b; ++p)
        g = t[p], a[g.index] = +n(g, p, t);
    }
  }
  function d(p) {
    var b = 0, g, v, y = 0, k, w, $;
    if (p.length) {
      for (k = w = $ = 0; $ < 4; ++$)
        (g = p[$]) && (v = Math.abs(g.value)) && (b += g.value, y += v, k += v * g.x, w += v * g.y);
      p.x = k / y, p.y = w / y;
    } else {
      g = p, g.x = g.data.x, g.y = g.data.y;
      do
        b += a[g.data.index];
      while (g = g.next);
    }
    p.value = b;
  }
  function h(p, b, g, v) {
    if (!p.value)
      return !0;
    var y = p.x - e.x, k = p.y - e.y, w = v - b, $ = y * y + k * k;
    if (w * w / o < $)
      return $ < s && (y === 0 && (y = Ri(l), $ += y * y), k === 0 && (k = Ri(l), $ += k * k), $ < r && ($ = Math.sqrt(r * $)), e.vx += y * p.value * i / $, e.vy += k * p.value * i / $), !0;
    if (p.length || $ >= s)
      return;
    (p.data !== e || p.next) && (y === 0 && (y = Ri(l), $ += y * y), k === 0 && (k = Ri(l), $ += k * k), $ < r && ($ = Math.sqrt(r * $)));
    do
      p.data !== e && (w = a[p.data.index] * i / $, e.vx += y * w, e.vy += k * w);
    while (p = p.next);
  }
  return u.initialize = function(p, b) {
    t = p, l = b, c();
  }, u.strength = function(p) {
    return arguments.length ? (n = typeof p == "function" ? p : $n(+p), c(), u) : n;
  }, u.distanceMin = function(p) {
    return arguments.length ? (r = p * p, u) : Math.sqrt(r);
  }, u.distanceMax = function(p) {
    return arguments.length ? (s = p * p, u) : Math.sqrt(s);
  }, u.theta = function(p) {
    return arguments.length ? (o = p * p, u) : Math.sqrt(o);
  }, u;
}
function tw(t) {
  return Math.abs(t = Math.round(t)) >= 1e21 ? t.toLocaleString("en").replace(/,/g, "") : t.toString(10);
}
function Qa(t, e) {
  if ((l = (t = e ? t.toExponential(e - 1) : t.toExponential()).indexOf("e")) < 0)
    return null;
  var l, i = t.slice(0, l);
  return [
    i.length > 1 ? i[0] + i.slice(2) : i,
    +t.slice(l + 1)
  ];
}
function Wi(t) {
  return t = Qa(Math.abs(t)), t ? t[1] : NaN;
}
function lw(t, e) {
  return function(l, i) {
    for (var n = l.length, a = [], r = 0, s = t[0], o = 0; n > 0 && s > 0 && (o + s + 1 > i && (s = Math.max(1, i - o)), a.push(l.substring(n -= s, n + s)), !((o += s + 1) > i)); )
      s = t[r = (r + 1) % t.length];
    return a.reverse().join(e);
  };
}
function iw(t) {
  return function(e) {
    return e.replace(/[0-9]/g, function(l) {
      return t[+l];
    });
  };
}
var nw = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function Va(t) {
  if (!(e = nw.exec(t)))
    throw new Error("invalid format: " + t);
  var e;
  return new es({
    fill: e[1],
    align: e[2],
    sign: e[3],
    symbol: e[4],
    zero: e[5],
    width: e[6],
    comma: e[7],
    precision: e[8] && e[8].slice(1),
    trim: e[9],
    type: e[10]
  });
}
Va.prototype = es.prototype;
function es(t) {
  this.fill = t.fill === void 0 ? " " : t.fill + "", this.align = t.align === void 0 ? ">" : t.align + "", this.sign = t.sign === void 0 ? "-" : t.sign + "", this.symbol = t.symbol === void 0 ? "" : t.symbol + "", this.zero = !!t.zero, this.width = t.width === void 0 ? void 0 : +t.width, this.comma = !!t.comma, this.precision = t.precision === void 0 ? void 0 : +t.precision, this.trim = !!t.trim, this.type = t.type === void 0 ? "" : t.type + "";
}
es.prototype.toString = function() {
  return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
};
function aw(t) {
  e:
    for (var e = t.length, l = 1, i = -1, n; l < e; ++l)
      switch (t[l]) {
        case ".":
          i = n = l;
          break;
        case "0":
          i === 0 && (i = l), n = l;
          break;
        default:
          if (!+t[l])
            break e;
          i > 0 && (i = 0);
          break;
      }
  return i > 0 ? t.slice(0, i) + t.slice(n + 1) : t;
}
var cg;
function rw(t, e) {
  var l = Qa(t, e);
  if (!l)
    return t + "";
  var i = l[0], n = l[1], a = n - (cg = Math.max(-8, Math.min(8, Math.floor(n / 3))) * 3) + 1, r = i.length;
  return a === r ? i : a > r ? i + new Array(a - r + 1).join("0") : a > 0 ? i.slice(0, a) + "." + i.slice(a) : "0." + new Array(1 - a).join("0") + Qa(t, Math.max(0, e + a - 1))[0];
}
function Mu(t, e) {
  var l = Qa(t, e);
  if (!l)
    return t + "";
  var i = l[0], n = l[1];
  return n < 0 ? "0." + new Array(-n).join("0") + i : i.length > n + 1 ? i.slice(0, n + 1) + "." + i.slice(n + 1) : i + new Array(n - i.length + 2).join("0");
}
const zu = {
  "%": (t, e) => (t * 100).toFixed(e),
  b: (t) => Math.round(t).toString(2),
  c: (t) => t + "",
  d: tw,
  e: (t, e) => t.toExponential(e),
  f: (t, e) => t.toFixed(e),
  g: (t, e) => t.toPrecision(e),
  o: (t) => Math.round(t).toString(8),
  p: (t, e) => Mu(t * 100, e),
  r: Mu,
  s: rw,
  X: (t) => Math.round(t).toString(16).toUpperCase(),
  x: (t) => Math.round(t).toString(16)
};
function Nu(t) {
  return t;
}
var Au = Array.prototype.map, Bu = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
function sw(t) {
  var e = t.grouping === void 0 || t.thousands === void 0 ? Nu : lw(Au.call(t.grouping, Number), t.thousands + ""), l = t.currency === void 0 ? "" : t.currency[0] + "", i = t.currency === void 0 ? "" : t.currency[1] + "", n = t.decimal === void 0 ? "." : t.decimal + "", a = t.numerals === void 0 ? Nu : iw(Au.call(t.numerals, String)), r = t.percent === void 0 ? "%" : t.percent + "", s = t.minus === void 0 ? "−" : t.minus + "", o = t.nan === void 0 ? "NaN" : t.nan + "";
  function u(d) {
    d = Va(d);
    var h = d.fill, p = d.align, b = d.sign, g = d.symbol, v = d.zero, y = d.width, k = d.comma, w = d.precision, $ = d.trim, q = d.type;
    q === "n" ? (k = !0, q = "g") : zu[q] || (w === void 0 && (w = 12), $ = !0, q = "g"), (v || h === "0" && p === "=") && (v = !0, h = "0", p = "=");
    var j = g === "$" ? l : g === "#" && /[boxX]/.test(q) ? "0" + q.toLowerCase() : "", O = g === "$" ? i : /[%p]/.test(q) ? r : "", z = zu[q], N = /[defgprs%]/.test(q);
    w = w === void 0 ? 6 : /[gprs]/.test(q) ? Math.max(1, Math.min(21, w)) : Math.max(0, Math.min(20, w));
    function M(H) {
      var B = j, R = O, P, I, L;
      if (q === "c")
        R = z(H) + R, H = "";
      else {
        H = +H;
        var F = H < 0 || 1 / H < 0;
        if (H = isNaN(H) ? o : z(Math.abs(H), w), $ && (H = aw(H)), F && +H == 0 && b !== "+" && (F = !1), B = (F ? b === "(" ? b : s : b === "-" || b === "(" ? "" : b) + B, R = (q === "s" ? Bu[8 + cg / 3] : "") + R + (F && b === "(" ? ")" : ""), N) {
          for (P = -1, I = H.length; ++P < I; )
            if (L = H.charCodeAt(P), 48 > L || L > 57) {
              R = (L === 46 ? n + H.slice(P + 1) : H.slice(P)) + R, H = H.slice(0, P);
              break;
            }
        }
      }
      k && !v && (H = e(H, 1 / 0));
      var X = B.length + H.length + R.length, V = X < y ? new Array(y - X + 1).join(h) : "";
      switch (k && v && (H = e(V + H, V.length ? y - R.length : 1 / 0), V = ""), p) {
        case "<":
          H = B + H + R + V;
          break;
        case "=":
          H = B + V + H + R;
          break;
        case "^":
          H = V.slice(0, X = V.length >> 1) + B + H + R + V.slice(X);
          break;
        default:
          H = V + B + H + R;
          break;
      }
      return a(H);
    }
    return M.toString = function() {
      return d + "";
    }, M;
  }
  function c(d, h) {
    var p = u((d = Va(d), d.type = "f", d)), b = Math.max(-8, Math.min(8, Math.floor(Wi(h) / 3))) * 3, g = Math.pow(10, -b), v = Bu[8 + b / 3];
    return function(y) {
      return p(g * y) + v;
    };
  }
  return {
    format: u,
    formatPrefix: c
  };
}
var ja, Wt, dg;
ow({
  thousands: ",",
  grouping: [3],
  currency: ["$", ""]
});
function ow(t) {
  return ja = sw(t), Wt = ja.format, dg = ja.formatPrefix, ja;
}
function uw(t) {
  return Math.max(0, -Wi(Math.abs(t)));
}
function fw(t, e) {
  return Math.max(0, Math.max(-8, Math.min(8, Math.floor(Wi(e) / 3))) * 3 - Wi(Math.abs(t)));
}
function _w(t, e) {
  return t = Math.abs(t), e = Math.abs(e) - t, Math.max(0, Wi(e) - Wi(t)) + 1;
}
function hg(t, e) {
  switch (arguments.length) {
    case 0:
      break;
    case 1:
      this.range(t);
      break;
    default:
      this.range(e).domain(t);
      break;
  }
  return this;
}
function cw(t, e) {
  switch (arguments.length) {
    case 0:
      break;
    case 1: {
      typeof t == "function" ? this.interpolator(t) : this.range(t);
      break;
    }
    default: {
      this.domain(t), typeof e == "function" ? this.interpolator(e) : this.range(e);
      break;
    }
  }
  return this;
}
const Pu = Symbol("implicit");
function Rr() {
  var t = new au(), e = [], l = [], i = Pu;
  function n(a) {
    let r = t.get(a);
    if (r === void 0) {
      if (i !== Pu)
        return i;
      t.set(a, r = e.push(a) - 1);
    }
    return l[r % l.length];
  }
  return n.domain = function(a) {
    if (!arguments.length)
      return e.slice();
    e = [], t = new au();
    for (const r of a)
      t.has(r) || t.set(r, e.push(r) - 1);
    return n;
  }, n.range = function(a) {
    return arguments.length ? (l = Array.from(a), n) : l.slice();
  }, n.unknown = function(a) {
    return arguments.length ? (i = a, n) : i;
  }, n.copy = function() {
    return Rr(e, l).unknown(i);
  }, hg.apply(n, arguments), n;
}
function dw(t) {
  return function() {
    return t;
  };
}
function hw(t) {
  return +t;
}
var Eu = [0, 1];
function Il(t) {
  return t;
}
function Hr(t, e) {
  return (e -= t = +t) ? function(l) {
    return (l - t) / e;
  } : dw(isNaN(e) ? NaN : 0.5);
}
function pw(t, e) {
  var l;
  return t > e && (l = t, t = e, e = l), function(i) {
    return Math.max(t, Math.min(e, i));
  };
}
function mw(t, e, l) {
  var i = t[0], n = t[1], a = e[0], r = e[1];
  return n < i ? (i = Hr(n, i), a = l(r, a)) : (i = Hr(i, n), a = l(a, r)), function(s) {
    return a(i(s));
  };
}
function gw(t, e, l) {
  var i = Math.min(t.length, e.length) - 1, n = new Array(i), a = new Array(i), r = -1;
  for (t[i] < t[0] && (t = t.slice().reverse(), e = e.slice().reverse()); ++r < i; )
    n[r] = Hr(t[r], t[r + 1]), a[r] = l(e[r], e[r + 1]);
  return function(s) {
    var o = Pm(t, s, 1, i) - 1;
    return a[o](n[o](s));
  };
}
function bw(t, e) {
  return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());
}
function vw() {
  var t = Eu, e = Eu, l = Wa, i, n, a, r = Il, s, o, u;
  function c() {
    var h = Math.min(t.length, e.length);
    return r !== Il && (r = pw(t[0], t[h - 1])), s = h > 2 ? gw : mw, o = u = null, d;
  }
  function d(h) {
    return h == null || isNaN(h = +h) ? a : (o || (o = s(t.map(i), e, l)))(i(r(h)));
  }
  return d.invert = function(h) {
    return r(n((u || (u = s(e, t.map(i), pl)))(h)));
  }, d.domain = function(h) {
    return arguments.length ? (t = Array.from(h, hw), c()) : t.slice();
  }, d.range = function(h) {
    return arguments.length ? (e = Array.from(h), c()) : e.slice();
  }, d.rangeRound = function(h) {
    return e = Array.from(h), l = eg, c();
  }, d.clamp = function(h) {
    return arguments.length ? (r = h ? !0 : Il, c()) : r !== Il;
  }, d.interpolate = function(h) {
    return arguments.length ? (l = h, c()) : l;
  }, d.unknown = function(h) {
    return arguments.length ? (a = h, d) : a;
  }, function(h, p) {
    return i = h, n = p, c();
  };
}
function kw() {
  return vw()(Il, Il);
}
function yw(t, e, l, i) {
  var n = Lb(t, e, l), a;
  switch (i = Va(i ?? ",f"), i.type) {
    case "s": {
      var r = Math.max(Math.abs(t), Math.abs(e));
      return i.precision == null && !isNaN(a = fw(n, r)) && (i.precision = a), dg(i, r);
    }
    case "":
    case "e":
    case "g":
    case "p":
    case "r": {
      i.precision == null && !isNaN(a = _w(n, Math.max(Math.abs(t), Math.abs(e)))) && (i.precision = a - (i.type === "e"));
      break;
    }
    case "f":
    case "%": {
      i.precision == null && !isNaN(a = uw(n)) && (i.precision = a - (i.type === "%") * 2);
      break;
    }
  }
  return Wt(i);
}
function pg(t) {
  var e = t.domain;
  return t.ticks = function(l) {
    var i = e();
    return Om(i[0], i[i.length - 1], l ?? 10);
  }, t.tickFormat = function(l, i) {
    var n = e();
    return yw(n[0], n[n.length - 1], l ?? 10, i);
  }, t.nice = function(l) {
    l == null && (l = 10);
    var i = e(), n = 0, a = i.length - 1, r = i[n], s = i[a], o, u, c = 10;
    for (s < r && (u = r, r = s, s = u, u = n, n = a, a = u); c-- > 0; ) {
      if (u = Yi(r, s, l), u === o)
        return i[n] = r, i[a] = s, e(i);
      if (u > 0)
        r = Math.floor(r / u) * u, s = Math.ceil(s / u) * u;
      else if (u < 0)
        r = Math.ceil(r * u) / u, s = Math.floor(s * u) / u;
      else
        break;
      o = u;
    }
    return t;
  }, t;
}
function Rl() {
  var t = kw();
  return t.copy = function() {
    return bw(t, Rl());
  }, hg.apply(t, arguments), pg(t);
}
function ww() {
  var t = 0, e = 1, l, i, n, a, r = Il, s = !1, o;
  function u(d) {
    return d == null || isNaN(d = +d) ? o : r(n === 0 ? 0.5 : (d = (a(d) - l) * n, s ? Math.max(0, Math.min(1, d)) : d));
  }
  u.domain = function(d) {
    return arguments.length ? ([t, e] = d, l = a(t = +t), i = a(e = +e), n = l === i ? 0 : 1 / (i - l), u) : [t, e];
  }, u.clamp = function(d) {
    return arguments.length ? (s = !!d, u) : s;
  }, u.interpolator = function(d) {
    return arguments.length ? (r = d, u) : r;
  };
  function c(d) {
    return function(h) {
      var p, b;
      return arguments.length ? ([p, b] = h, r = d(p, b), u) : [r(0), r(1)];
    };
  }
  return u.range = c(Wa), u.rangeRound = c(eg), u.unknown = function(d) {
    return arguments.length ? (o = d, u) : o;
  }, function(d) {
    return a = d, l = d(t), i = d(e), n = l === i ? 0 : 1 / (i - l), u;
  };
}
function $w(t, e) {
  return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown());
}
function yl() {
  var t = pg(ww()(Il));
  return t.copy = function() {
    return $w(t, yl());
  }, cw.apply(t, arguments);
}
function zn(t) {
  for (var e = t.length / 6 | 0, l = new Array(e), i = 0; i < e; )
    l[i] = "#" + t.slice(i * 6, ++i * 6);
  return l;
}
const qw = (t) => tk(t[t.length - 1]);
var jw = new Array(3).concat(
  "fc8d59ffffbf91cf60",
  "d7191cfdae61a6d96a1a9641",
  "d7191cfdae61ffffbfa6d96a1a9641",
  "d73027fc8d59fee08bd9ef8b91cf601a9850",
  "d73027fc8d59fee08bffffbfd9ef8b91cf601a9850",
  "d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850",
  "d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850",
  "a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837",
  "a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837"
).map(zn);
const Tw = qw(jw);
function er(t) {
  var e = t.length;
  return function(l) {
    return t[Math.max(0, Math.min(e - 1, Math.floor(l * e)))];
  };
}
er(zn("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));
var Dl = er(zn("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));
er(zn("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));
er(zn("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
function Xt(t) {
  return function() {
    return t;
  };
}
function mg(t) {
  let e = 3;
  return t.digits = function(l) {
    if (!arguments.length)
      return e;
    if (l == null)
      e = null;
    else {
      const i = Math.floor(l);
      if (!(i >= 0))
        throw new RangeError(`invalid digits: ${l}`);
      e = i;
    }
    return t;
  }, () => new Cy(e);
}
function gg(t) {
  return typeof t == "object" && "length" in t ? t : Array.from(t);
}
function bg(t) {
  this._context = t;
}
bg.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(t, e) {
    switch (t = +t, e = +e, this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(t, e) : this._context.moveTo(t, e);
        break;
      case 1:
        this._point = 2;
      default:
        this._context.lineTo(t, e);
        break;
    }
  }
};
function vg(t) {
  return new bg(t);
}
function kg(t) {
  return t[0];
}
function yg(t) {
  return t[1];
}
function Cw(t, e) {
  var l = Xt(!0), i = null, n = vg, a = null, r = mg(s);
  t = typeof t == "function" ? t : t === void 0 ? kg : Xt(t), e = typeof e == "function" ? e : e === void 0 ? yg : Xt(e);
  function s(o) {
    var u, c = (o = gg(o)).length, d, h = !1, p;
    for (i == null && (a = n(p = r())), u = 0; u <= c; ++u)
      !(u < c && l(d = o[u], u, o)) === h && ((h = !h) ? a.lineStart() : a.lineEnd()), h && a.point(+t(d, u, o), +e(d, u, o));
    if (p)
      return a = null, p + "" || null;
  }
  return s.x = function(o) {
    return arguments.length ? (t = typeof o == "function" ? o : Xt(+o), s) : t;
  }, s.y = function(o) {
    return arguments.length ? (e = typeof o == "function" ? o : Xt(+o), s) : e;
  }, s.defined = function(o) {
    return arguments.length ? (l = typeof o == "function" ? o : Xt(!!o), s) : l;
  }, s.curve = function(o) {
    return arguments.length ? (n = o, i != null && (a = n(i)), s) : n;
  }, s.context = function(o) {
    return arguments.length ? (o == null ? i = a = null : a = n(i = o), s) : i;
  }, s;
}
function Sw(t, e, l) {
  var i = null, n = Xt(!0), a = null, r = vg, s = null, o = mg(u);
  t = typeof t == "function" ? t : t === void 0 ? kg : Xt(+t), e = typeof e == "function" ? e : Xt(e === void 0 ? 0 : +e), l = typeof l == "function" ? l : l === void 0 ? yg : Xt(+l);
  function u(d) {
    var h, p, b, g = (d = gg(d)).length, v, y = !1, k, w = new Array(g), $ = new Array(g);
    for (a == null && (s = r(k = o())), h = 0; h <= g; ++h) {
      if (!(h < g && n(v = d[h], h, d)) === y)
        if (y = !y)
          p = h, s.areaStart(), s.lineStart();
        else {
          for (s.lineEnd(), s.lineStart(), b = h - 1; b >= p; --b)
            s.point(w[b], $[b]);
          s.lineEnd(), s.areaEnd();
        }
      y && (w[h] = +t(v, h, d), $[h] = +e(v, h, d), s.point(i ? +i(v, h, d) : w[h], l ? +l(v, h, d) : $[h]));
    }
    if (k)
      return s = null, k + "" || null;
  }
  function c() {
    return Cw().defined(n).curve(r).context(a);
  }
  return u.x = function(d) {
    return arguments.length ? (t = typeof d == "function" ? d : Xt(+d), i = null, u) : t;
  }, u.x0 = function(d) {
    return arguments.length ? (t = typeof d == "function" ? d : Xt(+d), u) : t;
  }, u.x1 = function(d) {
    return arguments.length ? (i = d == null ? null : typeof d == "function" ? d : Xt(+d), u) : i;
  }, u.y = function(d) {
    return arguments.length ? (e = typeof d == "function" ? d : Xt(+d), l = null, u) : e;
  }, u.y0 = function(d) {
    return arguments.length ? (e = typeof d == "function" ? d : Xt(+d), u) : e;
  }, u.y1 = function(d) {
    return arguments.length ? (l = d == null ? null : typeof d == "function" ? d : Xt(+d), u) : l;
  }, u.lineX0 = u.lineY0 = function() {
    return c().x(t).y(e);
  }, u.lineY1 = function() {
    return c().x(t).y(l);
  }, u.lineX1 = function() {
    return c().x(i).y(e);
  }, u.defined = function(d) {
    return arguments.length ? (n = typeof d == "function" ? d : Xt(!!d), u) : n;
  }, u.curve = function(d) {
    return arguments.length ? (r = d, a != null && (s = r(a)), u) : r;
  }, u.context = function(d) {
    return arguments.length ? (d == null ? a = s = null : s = r(a = d), u) : a;
  }, u;
}
class Mw {
  constructor(e, l) {
    this._context = e, this._x = l;
  }
  areaStart() {
    this._line = 0;
  }
  areaEnd() {
    this._line = NaN;
  }
  lineStart() {
    this._point = 0;
  }
  lineEnd() {
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  }
  point(e, l) {
    switch (e = +e, l = +l, this._point) {
      case 0: {
        this._point = 1, this._line ? this._context.lineTo(e, l) : this._context.moveTo(e, l);
        break;
      }
      case 1:
        this._point = 2;
      default: {
        this._x ? this._context.bezierCurveTo(this._x0 = (this._x0 + e) / 2, this._y0, this._x0, l, e, l) : this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + l) / 2, e, this._y0, e, l);
        break;
      }
    }
    this._x0 = e, this._y0 = l;
  }
}
function zw(t) {
  return new Mw(t, !0);
}
function yn(t, e, l) {
  this.k = t, this.x = e, this.y = l;
}
yn.prototype = {
  constructor: yn,
  scale: function(t) {
    return t === 1 ? this : new yn(this.k * t, this.x, this.y);
  },
  translate: function(t, e) {
    return t === 0 & e === 0 ? this : new yn(this.k, this.x + this.k * t, this.y + this.k * e);
  },
  apply: function(t) {
    return [t[0] * this.k + this.x, t[1] * this.k + this.y];
  },
  applyX: function(t) {
    return t * this.k + this.x;
  },
  applyY: function(t) {
    return t * this.k + this.y;
  },
  invert: function(t) {
    return [(t[0] - this.x) / this.k, (t[1] - this.y) / this.k];
  },
  invertX: function(t) {
    return (t - this.x) / this.k;
  },
  invertY: function(t) {
    return (t - this.y) / this.k;
  },
  rescaleX: function(t) {
    return t.copy().domain(t.range().map(this.invertX, this).map(t.invert, t));
  },
  rescaleY: function(t) {
    return t.copy().domain(t.range().map(this.invertY, this).map(t.invert, t));
  },
  toString: function() {
    return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
  }
};
yn.prototype;
let Nw = Wt(",d");
const kr = 20, wg = 5;
function yr(t, e, l = {}) {
  let i = (l == null ? void 0 : l.unit_dt) || wg, n = (l == null ? void 0 : l.pulse_row_height) || Ug;
  if (!t || t.length == 0 || !e || Object.keys(e).length == 0)
    return;
  let a = 0, r = 0, s, o, u = {}, c = 0, d = [];
  for (const v in e)
    u[e[v].channel_type] || (u[e[v].channel_type] = { color: Ut[c] }, c += 1), d.push(v);
  d = d.map((v) => {
    var y, k;
    return [(y = v.match(/[a-z]+/)) == null ? void 0 : y[0], parseInt((k = v.match(/[0-9]+/)) == null ? void 0 : k[0])];
  }).toSorted((v, y) => v[1] - y[1]).map((v) => v.join(""));
  let h = {}, p = d.map((v, y) => {
    let k = e[v];
    return h[v] = y, k;
  }), b = Rl().domain([0, 0.5]).range([0, n]), g = (v) => v / i;
  if (t.length > 0 && Object.keys(e).length > 0) {
    o = {
      type: "g",
      role: "pulse-data-group",
      id: "pulse-data-group",
      _class: "pulse-data-group",
      x: Ie,
      y: Ie,
      width: 0,
      height: 0,
      elem: []
    }, s = {
      type: "g",
      role: "pulse-axis-group",
      id: "pulse-axis-group",
      _class: "pulse-axis-group",
      x: Ie,
      y: Ie,
      width: 0,
      height: 0,
      elem: []
    };
    let v = n * p.length;
    o.height = v, s.height = v, r = o.height > r ? o.height : r;
    let y = t.map((O) => O.time_at + O.duration), k = Math.max(...y), w = g(k);
    o.width = w + Bt + Ze, a += o.width, s.width = Bt;
    let $ = 0;
    for (const O of p) {
      let z = {
        type: "g",
        role: "pulse-area-row-group",
        id: "pulse-area-row-group-" + O.name,
        _class: "pulse-area-row-group",
        x: 0,
        y: n * $,
        width: 0,
        height: n,
        elem: []
      }, N = {
        type: "g",
        role: "pulse-area-row-name-group",
        id: "pulse-area-row-name-group-" + O.name,
        _class: "pulse-area-row-name-group",
        x: 0,
        y: 0,
        width: 0,
        height: 0,
        elem: []
      };
      N.elem.push({
        type: "text",
        x: Bt,
        y: n / 2 - 6 + 4.5,
        "font-size": 12,
        "text-anchor": "end",
        "alignment-baseline": "center",
        text: O.channel_type.replace(/Channel$/, ""),
        "font-weight": 700,
        "line-height": 1
      }), N.elem.push({
        type: "text",
        x: Bt,
        y: n / 2 + 6 + 4.5,
        "font-size": 12,
        "text-anchor": "end",
        "alignment-baseline": "center",
        text: "(" + O.name + ")",
        "font-weight": 400,
        "line-height": 1
      }), z.elem.push(N);
      let M = JSON.parse(JSON.stringify(N));
      M.y = n * $, M.elem.splice(0, 0, {
        type: "rect",
        x: 0,
        y: 0,
        width: Bt,
        height: n,
        "stroke-width": 0,
        fill: it
      }), s.elem.push(M), z.elem.push({
        type: "rect",
        x: Bt + Ze,
        y: 0,
        width: w,
        height: n,
        fill: ze,
        "fill-opacity": 0.05,
        "stroke-width": 0
      }), z.elem.push({
        type: "line",
        x1: Bt + Ze,
        y1: n,
        x2: Bt + Ze + w,
        y2: n,
        "stroke-width": 1
      });
      let H = {
        type: "g",
        role: "pulse-area-vis-group",
        id: "pulse-area-vis-group-" + O.name,
        _class: "pulse-area-vis-group",
        x: Bt + Ze,
        y: 0,
        width: w,
        height: n,
        elem: []
      };
      z.elem.push(H), o.elem.push(z), $++;
    }
    for (const O of t) {
      let z = g(O.time_at), N = g(O.time_at + O.duration);
      if (O.component_type === "Play") {
        let M = b(O.amplitude), H = o.elem[h[O.name]].elem.length - 1, B = $g(z, N, M, n);
        o.elem[h[O.name]].elem[H].elem.push({
          _class: `pulse-path--layer-${O.layer_index}--op-${O.op_index}`,
          type: "path",
          path: B,
          fill: u[O.channel_type].color,
          "fill-opacity": 0.5,
          "stroke-width": 0
        });
      } else if (O.component_type === "ShiftPhase") {
        let M = o.elem[h[O.name]].elem.length - 1;
        o.elem[h[O.name]].elem[M].elem.push({
          _class: `pulse-path--layer-${O.layer_index}--op-${O.op_index}`,
          type: "rect",
          x: z - 1,
          y: n * 0.2,
          width: 2,
          height: n * 0.8,
          fill: u[O.channel_type].color,
          "fill-opacity": 0.7,
          "stroke-width": 0
        });
      }
    }
    let q = {
      type: "g",
      role: "pulse-data-x-axis-group",
      id: "pulse-data-x-axis-group",
      _class: "pulse-data-x-axis-group",
      x: Bt + Ze,
      y: v,
      width: w,
      height: Ol,
      elem: []
    }, j = 0;
    for (; j < k; ) {
      let O = {
        type: "g",
        role: "pulse-data-x-axis-group",
        id: "pulse-data-x-axis-group-" + j,
        _class: "pulse-data-x-axis-group",
        x: g(j),
        y: 0,
        elem: [{
          type: "line",
          x1: -0.5,
          y1: 0,
          x2: -0.5,
          y2: 6,
          "stroke-width": 1,
          stroke: ze
        }, {
          type: "text",
          x: -1,
          y: Ol,
          "font-size": 10,
          "text-anchor": "middle",
          "alignment-baseline": "bottom",
          text: Nw(j),
          "font-weight": 400
        }]
      };
      q.elem.push(O), j += 500;
    }
    o.elem.push(q), o.height += Ol, r += Ol;
  }
  return {
    type: "svg",
    width: a + Ie * 2,
    height: r + Ie * 2,
    viewBox: [0, 0, a + Ie * 2, r + Ie * 2],
    groups: {
      axis_group: s,
      area_group: o
    },
    scales: {
      dt_scale: g,
      amp_scale: b
    }
  };
}
function $g(t, e, l, i) {
  let n = [];
  return e - t < kr * 2 ? n.push({
    x: t,
    y: i
  }, {
    x: (e + t) / 2,
    y: l
  }, {
    x: e,
    y: i
  }) : n.push({
    x: t,
    y: i
  }, {
    x: t + kr,
    y: l
  }, {
    x: e - kr,
    y: l
  }, {
    x: e,
    y: i
  }), Sw().x((r) => r.x).y0((r) => i).y1((r) => r.y).curve(zw)(n);
}
let Aw = Wt(",d");
const Bw = 5, Pw = 50;
function Ou(t, e = {}) {
  if (!t)
    return;
  let l = {};
  for (const g of t)
    l[g.name] || (l[g.name] = {
      channel_type: g.channel_type,
      channel_index: g.channel_index,
      name: g.name
    });
  let i = (e == null ? void 0 : e.unit_dt) || Bw, n = (e == null ? void 0 : e.pulse_row_height) || Pw;
  if (!t || t.length == 0 || !l || Object.keys(l).length == 0)
    return;
  let a = 0, r = 0, s, o = {}, u = 0, c = [];
  for (const g in l)
    o[l[g].channel_type] || (o[l[g].channel_type] = { color: Ut[u] }, u += 1), c.push(g);
  c = c.map((g) => {
    var v, y;
    return [(v = g.match(/[a-z]+/)) == null ? void 0 : v[0], parseInt((y = g.match(/[0-9]+/)) == null ? void 0 : y[0])];
  }).toSorted((g, v) => g[1] - v[1]).map((g) => g.join(""));
  let d = {}, h = c.map((g, v) => {
    let y = l[g];
    return d[g] = v, y;
  }), p = Rl().domain([0, 0.5]).range([0, n]), b = (g) => g / i;
  if (t.length > 0 && Object.keys(l).length > 0) {
    s = {
      type: "g",
      role: "mini-pulse-data-group",
      id: "mini-pulse-data-group",
      _class: "mini-pulse-data-group",
      x: Ie,
      y: Ie,
      width: 0,
      height: 0,
      elem: []
    };
    let g = n * h.length;
    s.height = g, r = s.height > r ? s.height : r;
    let v = t.map((j) => j.time_at + j.duration), y = Math.max(...v), k = b(y);
    s.width = k + Bt + Ze, a += s.width;
    let w = 0;
    for (const j of h) {
      let O = {
        type: "g",
        role: "mini-pulse-area-row-group",
        id: "mini-pulse-area-row-group-" + j.name,
        _class: "mini-pulse-area-row-group",
        x: 0,
        y: n * w,
        width: 0,
        height: n,
        elem: []
      }, z = {
        type: "g",
        role: "mini-pulse-area-row-name-group",
        id: "mini-pulse-area-row-name-group-" + j.name,
        _class: "mini-pulse-area-row-name-group",
        x: 0,
        y: 0,
        width: 0,
        height: 0,
        elem: []
      };
      z.elem.push({
        type: "text",
        x: Bt,
        y: n / 2 - 6 + 4.5,
        "font-size": 12,
        "text-anchor": "end",
        "alignment-baseline": "center",
        text: j.channel_type.replace(/Channel$/, ""),
        "font-weight": 700,
        "line-height": 1
      }), z.elem.push({
        type: "text",
        x: Bt,
        y: n / 2 + 6 + 4.5,
        "font-size": 12,
        "text-anchor": "end",
        "alignment-baseline": "center",
        text: "(" + j.name + ")",
        "font-weight": 400,
        "line-height": 1
      }), O.elem.push(z), O.elem.push({
        type: "rect",
        x: Bt + Ze,
        y: 0,
        width: k,
        height: n,
        fill: ze,
        "fill-opacity": 0.05,
        "stroke-width": 0
      }), O.elem.push({
        type: "line",
        x1: Bt + Ze,
        y1: n,
        x2: Bt + Ze + k,
        y2: n,
        "stroke-width": 1
      });
      let N = {
        type: "g",
        role: "mini-pulse-area-vis-group",
        id: "mini-pulse-area-vis-group-" + j.name,
        _class: "mini-pulse-area-vis-group",
        x: Bt + Ze,
        y: 0,
        width: k,
        height: n,
        elem: []
      };
      O.elem.push(N), s.elem.push(O), w++;
    }
    for (const j of t) {
      let O = b(j.time_at), z = b(j.time_at + j.duration);
      if (j.component_type === "Play") {
        let N = p(j.amplitude), M = s.elem[d[j.name]].elem.length - 1, H = $g(O, z, N, n);
        s.elem[d[j.name]].elem[M].elem.push({
          _class: `mini-pulse-path--layer-${j.layer_index}--op-${j.op_index}`,
          type: "path",
          path: H,
          fill: o[j.channel_type].color,
          "fill-opacity": 0.5,
          "stroke-width": 0
        });
      } else if (j.component_type === "ShiftPhase") {
        let N = s.elem[d[j.name]].elem.length - 1;
        s.elem[d[j.name]].elem[N].elem.push({
          _class: `mini-pulse-path--layer-${j.layer_index}--op-${j.op_index}`,
          type: "rect",
          x: O - 1,
          y: n * 0.2,
          width: 2,
          height: n * 0.8,
          fill: o[j.channel_type].color,
          "fill-opacity": 0.7,
          "stroke-width": 0
        });
      }
    }
    let $ = {
      type: "g",
      role: "mini-pulse-data-x-axis-group",
      id: "mini-pulse-data-x-axis-group",
      _class: "mini-pulse-data-x-axis-group",
      x: Bt + Ze,
      y: g,
      width: k,
      height: Ol,
      elem: []
    }, q = 0;
    for (; q < y; ) {
      let j = {
        type: "g",
        role: "mini-pulse-data-x-axis-group",
        id: "mini-pulse-data-x-axis-group-" + q,
        _class: "mini-pulse-data-x-axis-group",
        x: b(q),
        y: 0,
        elem: [{
          type: "line",
          x1: -0.5,
          y1: 0,
          x2: -0.5,
          y2: 6,
          "stroke-width": 1,
          stroke: ze
        }, {
          type: "text",
          x: -1,
          y: Ol,
          "font-size": 10,
          "text-anchor": "middle",
          "alignment-baseline": "bottom",
          text: Aw(q),
          "font-weight": 400
        }]
      };
      $.elem.push(j), q += 500;
    }
    s.elem.push($), s.height += Ol, r += Ol;
  }
  return {
    type: "svg",
    width: a + Ie * 2,
    height: r + Ie * 2,
    viewBox: [0, 0, a + Ie * 2, r + Ie * 2],
    groups: {
      area_group: s
    },
    scales: {
      dt_scale: b,
      amp_scale: p
    }
  };
}
function Iu(t, e, l) {
  const i = t.slice();
  return i[6] = e[l], i;
}
function Du(t) {
  var L;
  let e, l, i, n = (
    /*info*/
    t[0].operation.gate + ""
  ), a, r, s = (
    /*info*/
    ((L = t[0].operation.qubit_index) == null ? void 0 : L.join(", ")) + ""
  ), o, u, c, d, h, p, b, g, v, y = (
    /*info*/
    t[0].pulse_data.duration + ""
  ), k, w, $, q, j, O, z, N, M, H, B, R = (
    /*$pulse_vis*/
    t[2] && Ru(t)
  ), P = we(
    /*info*/
    t[0].pulse_data.pulse_schedule
  ), I = [];
  for (let F = 0; F < P.length; F += 1)
    I[F] = Yu(Iu(t, P, F));
  return {
    c() {
      e = m("div"), l = m("h2"), i = E("Pulse for '"), a = E(n), r = E("' gate on qubits ("), o = E(s), u = E(")"), c = A(), d = m("div"), h = m("table"), p = m("tbody"), b = m("tr"), g = m("th"), g.textContent = "Duration", v = m("td"), k = E(y), w = A(), R && R.c(), $ = A(), q = m("h3"), q.textContent = "Schedules", j = A(), O = m("div"), z = m("table"), N = m("thead"), N.innerHTML = '<tr><th class="svelte-1mijona">At</th> <th class="svelte-1mijona">Duration</th> <th class="svelte-1mijona">Comp</th> <th class="svelte-1mijona">Channel</th> <th class="svelte-1mijona">Amp.</th> <th class="svelte-1mijona">Params</th></tr>', M = A(), H = m("tbody");
      for (let F = 0; F < I.length; F += 1)
        I[F].c();
      f(l, "class", "svelte-1mijona"), f(g, "class", "svelte-1mijona"), f(v, "class", "svelte-1mijona"), f(h, "class", "svelte-1mijona"), f(q, "class", "svelte-1mijona"), f(z, "class", "svelte-1mijona"), f(O, "class", "schedule-table-wrap svelte-1mijona"), f(d, "class", "info-section svelte-1mijona");
    },
    m(F, X) {
      C(F, e, X), _(e, l), _(l, i), _(l, a), _(l, r), _(l, o), _(l, u), _(e, c), _(e, d), _(d, h), _(h, p), _(p, b), _(b, g), _(b, v), _(v, k), _(d, w), R && R.m(d, null), _(d, $), _(d, q), _(d, j), _(d, O), _(O, z), _(z, N), _(z, M), _(z, H);
      for (let V = 0; V < I.length; V += 1)
        I[V] && I[V].m(H, null);
      B = !0;
    },
    p(F, X) {
      var V;
      if ((!B || X & /*info*/
      1) && n !== (n = /*info*/
      F[0].operation.gate + "") && Y(a, n), (!B || X & /*info*/
      1) && s !== (s = /*info*/
      ((V = F[0].operation.qubit_index) == null ? void 0 : V.join(", ")) + "") && Y(o, s), (!B || X & /*info*/
      1) && y !== (y = /*info*/
      F[0].pulse_data.duration + "") && Y(k, y), /*$pulse_vis*/
      F[2] ? R ? (R.p(F, X), X & /*$pulse_vis*/
      4 && S(R, 1)) : (R = Ru(F), R.c(), S(R, 1), R.m(d, $)) : R && (ge(), D(R, 1, 1, () => {
        R = null;
      }), be()), X & /*info, undefined*/
      1) {
        P = we(
          /*info*/
          F[0].pulse_data.pulse_schedule
        );
        let Q;
        for (Q = 0; Q < P.length; Q += 1) {
          const J = Iu(F, P, Q);
          I[Q] ? I[Q].p(J, X) : (I[Q] = Yu(J), I[Q].c(), I[Q].m(H, null));
        }
        for (; Q < I.length; Q += 1)
          I[Q].d(1);
        I.length = P.length;
      }
    },
    i(F) {
      B || (S(R), B = !0);
    },
    o(F) {
      D(R), B = !1;
    },
    d(F) {
      F && T(e), R && R.d(), Ge(I, F);
    }
  };
}
function Ru(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v = (
    /*images*/
    t[1]["mini-pulse-view"] && Hu(t)
  ), y = (
    /*$pulse_vis*/
    t[2].groups.area_group && Fu(t)
  );
  return {
    c() {
      e = m("h3"), l = E("Pulse amplitude "), i = m("button"), i.textContent = "Image", n = A(), v && v.c(), a = A(), r = m("div"), s = Xe("svg"), o = Xe("style"), u = E(`g {
                font-family: Iosevka;
                font-size: 14px;
              }
            `), y && y.c(), f(i, "class", "save-make svelte-1mijona"), f(e, "class", "svelte-1mijona"), f(s, "id", "mini-pulse-view"), f(s, "width", c = /*$pulse_vis*/
      t[2].width), f(s, "height", d = /*$pulse_vis*/
      t[2].height), f(s, "viewBox", h = /*$pulse_vis*/
      t[2].viewBox.join(" ")), f(r, "class", "mini-pulse-view");
    },
    m(k, w) {
      C(k, e, w), _(e, l), _(e, i), _(e, n), v && v.m(e, null), C(k, a, w), C(k, r, w), _(r, s), _(s, o), _(o, u), y && y.m(s, null), p = !0, b || (g = le(
        i,
        "click",
        /*click_handler*/
        t[5]
      ), b = !0);
    },
    p(k, w) {
      /*images*/
      k[1]["mini-pulse-view"] ? v ? v.p(k, w) : (v = Hu(k), v.c(), v.m(e, null)) : v && (v.d(1), v = null), /*$pulse_vis*/
      k[2].groups.area_group ? y ? (y.p(k, w), w & /*$pulse_vis*/
      4 && S(y, 1)) : (y = Fu(k), y.c(), S(y, 1), y.m(s, null)) : y && (ge(), D(y, 1, 1, () => {
        y = null;
      }), be()), (!p || w & /*$pulse_vis*/
      4 && c !== (c = /*$pulse_vis*/
      k[2].width)) && f(s, "width", c), (!p || w & /*$pulse_vis*/
      4 && d !== (d = /*$pulse_vis*/
      k[2].height)) && f(s, "height", d), (!p || w & /*$pulse_vis*/
      4 && h !== (h = /*$pulse_vis*/
      k[2].viewBox.join(" "))) && f(s, "viewBox", h);
    },
    i(k) {
      p || (S(y), p = !0);
    },
    o(k) {
      D(y), p = !1;
    },
    d(k) {
      k && (T(e), T(a), T(r)), v && v.d(), y && y.d(), b = !1, g();
    }
  };
}
function Hu(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("a"), l = E("PNG"), n = A(), a = m("a"), r = E("SVG"), f(e, "class", "save-download svelte-1mijona"), f(e, "href", i = /*images*/
      t[1]["mini-pulse-view"].png), f(e, "download", ""), f(a, "class", "save-download svelte-1mijona"), f(a, "href", s = /*images*/
      t[1]["mini-pulse-view"].svg), f(a, "download", "");
    },
    m(o, u) {
      C(o, e, u), _(e, l), C(o, n, u), C(o, a, u), _(a, r);
    },
    p(o, u) {
      u & /*images*/
      2 && i !== (i = /*images*/
      o[1]["mini-pulse-view"].png) && f(e, "href", i), u & /*images*/
      2 && s !== (s = /*images*/
      o[1]["mini-pulse-view"].svg) && f(a, "href", s);
    },
    d(o) {
      o && (T(e), T(n), T(a));
    }
  };
}
function Fu(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$pulse_vis*/
        t[2].groups.area_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$pulse_vis*/
      4 && (a.data = /*$pulse_vis*/
      i[2].groups.area_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Lu(t) {
  let e, l = (
    /*sched*/
    t[6].phase + ""
  ), i, n;
  return {
    c() {
      e = E("Phase ("), i = E(l), n = E(")");
    },
    m(a, r) {
      C(a, e, r), C(a, i, r), C(a, n, r);
    },
    p(a, r) {
      r & /*info*/
      1 && l !== (l = /*sched*/
      a[6].phase + "") && Y(i, l);
    },
    d(a) {
      a && (T(e), T(i), T(n));
    }
  };
}
function Qu(t) {
  let e, l = (
    /*sched*/
    t[6].angle + ""
  ), i, n;
  return {
    c() {
      e = E("Angle ("), i = E(l), n = E(")");
    },
    m(a, r) {
      C(a, e, r), C(a, i, r), C(a, n, r);
    },
    p(a, r) {
      r & /*info*/
      1 && l !== (l = /*sched*/
      a[6].angle + "") && Y(i, l);
    },
    d(a) {
      a && (T(e), T(i), T(n));
    }
  };
}
function Vu(t) {
  let e, l = (
    /*sched*/
    t[6].sigma + ""
  ), i, n;
  return {
    c() {
      e = E("Sigma ("), i = E(l), n = E(")");
    },
    m(a, r) {
      C(a, e, r), C(a, i, r), C(a, n, r);
    },
    p(a, r) {
      r & /*info*/
      1 && l !== (l = /*sched*/
      a[6].sigma + "") && Y(i, l);
    },
    d(a) {
      a && (T(e), T(i), T(n));
    }
  };
}
function Xu(t) {
  let e, l = (
    /*sched*/
    t[6].beta + ""
  ), i, n;
  return {
    c() {
      e = E("Beta ("), i = E(l), n = E(")");
    },
    m(a, r) {
      C(a, e, r), C(a, i, r), C(a, n, r);
    },
    p(a, r) {
      r & /*info*/
      1 && l !== (l = /*sched*/
      a[6].beta + "") && Y(i, l);
    },
    d(a) {
      a && (T(e), T(i), T(n));
    }
  };
}
function Gu(t) {
  let e, l = (
    /*sched*/
    t[6].freq + ""
  ), i, n;
  return {
    c() {
      e = E("Freq ("), i = E(l), n = E(")");
    },
    m(a, r) {
      C(a, e, r), C(a, i, r), C(a, n, r);
    },
    p(a, r) {
      r & /*info*/
      1 && l !== (l = /*sched*/
      a[6].freq + "") && Y(i, l);
    },
    d(a) {
      a && (T(e), T(i), T(n));
    }
  };
}
function Yu(t) {
  let e, l, i = (
    /*sched*/
    t[6].time_at + ""
  ), n, a, r, s = (
    /*sched*/
    t[6].duration + ""
  ), o, u, c, d = (
    /*sched*/
    t[6].component_type + ""
  ), h, p, b, g = (
    /*sched*/
    t[6].channel_type + ""
  ), v, y, k, w = (
    /*sched*/
    (t[6].amplitude !== void 0 ? (
      /*sched*/
      t[6].amplitude
    ) : "") + ""
  ), $, q, j, O, z, N, M, H, B = (
    /*sched*/
    t[6].phase && Lu(t)
  ), R = (
    /*sched*/
    t[6].angle && Qu(t)
  ), P = (
    /*sched*/
    t[6].sigma && Vu(t)
  ), I = (
    /*sched*/
    t[6].beta && Xu(t)
  ), L = (
    /*sched*/
    t[6].freq && Gu(t)
  );
  return {
    c() {
      e = m("tr"), l = m("td"), n = E(i), a = A(), r = m("td"), o = E(s), u = A(), c = m("td"), h = E(d), p = A(), b = m("td"), v = E(g), y = A(), k = m("td"), $ = E(w), q = A(), j = m("td"), B && B.c(), O = A(), R && R.c(), z = A(), P && P.c(), N = A(), I && I.c(), M = A(), L && L.c(), H = A(), f(l, "class", "svelte-1mijona"), f(r, "class", "svelte-1mijona"), f(c, "class", "svelte-1mijona"), f(b, "class", "svelte-1mijona"), f(k, "class", "svelte-1mijona"), f(j, "class", "svelte-1mijona");
    },
    m(F, X) {
      C(F, e, X), _(e, l), _(l, n), _(e, a), _(e, r), _(r, o), _(e, u), _(e, c), _(c, h), _(e, p), _(e, b), _(b, v), _(e, y), _(e, k), _(k, $), _(e, q), _(e, j), B && B.m(j, null), _(j, O), R && R.m(j, null), _(j, z), P && P.m(j, null), _(j, N), I && I.m(j, null), _(j, M), L && L.m(j, null), _(e, H);
    },
    p(F, X) {
      X & /*info*/
      1 && i !== (i = /*sched*/
      F[6].time_at + "") && Y(n, i), X & /*info*/
      1 && s !== (s = /*sched*/
      F[6].duration + "") && Y(o, s), X & /*info*/
      1 && d !== (d = /*sched*/
      F[6].component_type + "") && Y(h, d), X & /*info*/
      1 && g !== (g = /*sched*/
      F[6].channel_type + "") && Y(v, g), X & /*info*/
      1 && w !== (w = /*sched*/
      (F[6].amplitude !== void 0 ? (
        /*sched*/
        F[6].amplitude
      ) : "") + "") && Y($, w), /*sched*/
      F[6].phase ? B ? B.p(F, X) : (B = Lu(F), B.c(), B.m(j, O)) : B && (B.d(1), B = null), /*sched*/
      F[6].angle ? R ? R.p(F, X) : (R = Qu(F), R.c(), R.m(j, z)) : R && (R.d(1), R = null), /*sched*/
      F[6].sigma ? P ? P.p(F, X) : (P = Vu(F), P.c(), P.m(j, N)) : P && (P.d(1), P = null), /*sched*/
      F[6].beta ? I ? I.p(F, X) : (I = Xu(F), I.c(), I.m(j, M)) : I && (I.d(1), I = null), /*sched*/
      F[6].freq ? L ? L.p(F, X) : (L = Gu(F), L.c(), L.m(j, null)) : L && (L.d(1), L = null);
    },
    d(F) {
      F && T(e), B && B.d(), R && R.d(), P && P.d(), I && I.d(), L && L.d();
    }
  };
}
function Ew(t) {
  let e, l, i = (
    /*info*/
    t[0] && Du(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, e, a), l = !0;
    },
    p(n, [a]) {
      /*info*/
      n[0] ? i ? (i.p(n, a), a & /*info*/
      1 && S(i, 1)) : (i = Du(n), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d(n);
    }
  };
}
function Ow(t, e, l) {
  let i, { info: n } = e, a = Pe();
  at(t, a, (u) => l(2, i = u));
  let r = {}, s = Pe();
  s.subscribe((u) => {
    u && l(1, r[u.id] = u, r);
  }), yt(() => {
    var u;
    (u = n == null ? void 0 : n.pulse_data) != null && u.pulse_schedule && a.set(Ou(n.pulse_data.pulse_schedule));
  });
  const o = (u) => {
    Li("mini-pulse-view", s);
  };
  return t.$$set = (u) => {
    "info" in u && l(0, n = u.info);
  }, t.$$.update = () => {
    var u;
    t.$$.dirty & /*info*/
    1 && (u = n == null ? void 0 : n.pulse_data) != null && u.pulse_schedule && a.set(Ou(n.pulse_data.pulse_schedule));
  }, [n, r, i, a, s, o];
}
class Iw extends Ve {
  constructor(e) {
    super(), Qe(this, e, Ow, Ew, Le, { info: 0 });
  }
}
function Ku(t) {
  let e, l, i, n, a, r, s, o, u, c = (
    /*info*/
    t[0].qubit && Uu(t)
  ), d = (
    /*info*/
    t[0].operation && Wu(t)
  ), h = (
    /*info*/
    t[0].readout_error && Ju(t)
  ), p = (
    /*info*/
    t[0].gate_info && Zu(t)
  ), b = (
    /*info*/
    t[0].gate_error_info && xu(t)
  ), g = (
    /*info*/
    t[0].esp_this && ef(t)
  ), v = (
    /*info*/
    t[0].qasm && tf(t)
  ), y = (
    /*info*/
    t[0].pulse_data && lf(t)
  );
  return {
    c() {
      c && c.c(), e = A(), d && d.c(), l = A(), h && h.c(), i = A(), p && p.c(), n = A(), b && b.c(), a = A(), g && g.c(), r = A(), v && v.c(), s = A(), y && y.c(), o = Be();
    },
    m(k, w) {
      c && c.m(k, w), C(k, e, w), d && d.m(k, w), C(k, l, w), h && h.m(k, w), C(k, i, w), p && p.m(k, w), C(k, n, w), b && b.m(k, w), C(k, a, w), g && g.m(k, w), C(k, r, w), v && v.m(k, w), C(k, s, w), y && y.m(k, w), C(k, o, w), u = !0;
    },
    p(k, w) {
      /*info*/
      k[0].qubit ? c ? (c.p(k, w), w & /*info*/
      1 && S(c, 1)) : (c = Uu(k), c.c(), S(c, 1), c.m(e.parentNode, e)) : c && (ge(), D(c, 1, 1, () => {
        c = null;
      }), be()), /*info*/
      k[0].operation ? d ? (d.p(k, w), w & /*info*/
      1 && S(d, 1)) : (d = Wu(k), d.c(), S(d, 1), d.m(l.parentNode, l)) : d && (ge(), D(d, 1, 1, () => {
        d = null;
      }), be()), /*info*/
      k[0].readout_error ? h ? (h.p(k, w), w & /*info*/
      1 && S(h, 1)) : (h = Ju(k), h.c(), S(h, 1), h.m(i.parentNode, i)) : h && (ge(), D(h, 1, 1, () => {
        h = null;
      }), be()), /*info*/
      k[0].gate_info ? p ? (p.p(k, w), w & /*info*/
      1 && S(p, 1)) : (p = Zu(k), p.c(), S(p, 1), p.m(n.parentNode, n)) : p && (ge(), D(p, 1, 1, () => {
        p = null;
      }), be()), /*info*/
      k[0].gate_error_info ? b ? (b.p(k, w), w & /*info*/
      1 && S(b, 1)) : (b = xu(k), b.c(), S(b, 1), b.m(a.parentNode, a)) : b && (ge(), D(b, 1, 1, () => {
        b = null;
      }), be()), /*info*/
      k[0].esp_this ? g ? (g.p(k, w), w & /*info*/
      1 && S(g, 1)) : (g = ef(k), g.c(), S(g, 1), g.m(r.parentNode, r)) : g && (ge(), D(g, 1, 1, () => {
        g = null;
      }), be()), /*info*/
      k[0].qasm ? v ? (v.p(k, w), w & /*info*/
      1 && S(v, 1)) : (v = tf(k), v.c(), S(v, 1), v.m(s.parentNode, s)) : v && (ge(), D(v, 1, 1, () => {
        v = null;
      }), be()), /*info*/
      k[0].pulse_data ? y ? (y.p(k, w), w & /*info*/
      1 && S(y, 1)) : (y = lf(k), y.c(), S(y, 1), y.m(o.parentNode, o)) : y && (ge(), D(y, 1, 1, () => {
        y = null;
      }), be());
    },
    i(k) {
      u || (S(c), S(d), S(h), S(p), S(b), S(g), S(v), S(y), u = !0);
    },
    o(k) {
      D(c), D(d), D(h), D(p), D(b), D(g), D(v), D(y), u = !1;
    },
    d(k) {
      k && (T(e), T(l), T(i), T(n), T(a), T(r), T(s), T(o)), c && c.d(k), d && d.d(k), h && h.d(k), p && p.d(k), b && b.d(k), g && g.d(k), v && v.d(k), y && y.d(k);
    }
  };
}
function Uu(t) {
  let e, l, i;
  return l = new bb({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), he(l.$$.fragment), f(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      C(n, e, a), ce(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (S(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && T(e), de(l);
    }
  };
}
function Wu(t) {
  let e, l, i;
  return l = new cb({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), he(l.$$.fragment), f(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      C(n, e, a), ce(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (S(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && T(e), de(l);
    }
  };
}
function Ju(t) {
  let e, l, i;
  return l = new yb({
    props: {
      info: (
        /*info*/
        t[0]
      ),
      machine_moment_at: (
        /*machine_moment_at*/
        t[1]
      )
    }
  }), {
    c() {
      e = m("article"), he(l.$$.fragment), f(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      C(n, e, a), ce(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), a & /*machine_moment_at*/
      2 && (r.machine_moment_at = /*machine_moment_at*/
      n[1]), l.$set(r);
    },
    i(n) {
      i || (S(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && T(e), de(l);
    }
  };
}
function Zu(t) {
  let e, l, i;
  return l = new pb({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), he(l.$$.fragment), f(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      C(n, e, a), ce(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (S(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && T(e), de(l);
    }
  };
}
function xu(t) {
  let e, l, i;
  return l = new nb({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), he(l.$$.fragment), f(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      C(n, e, a), ce(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (S(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && T(e), de(l);
    }
  };
}
function ef(t) {
  let e, l, i;
  return l = new tb({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), he(l.$$.fragment), f(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      C(n, e, a), ce(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (S(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && T(e), de(l);
    }
  };
}
function tf(t) {
  let e, l, i;
  return l = new qb({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), he(l.$$.fragment), f(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      C(n, e, a), ce(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (S(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && T(e), de(l);
    }
  };
}
function lf(t) {
  let e, l, i;
  return l = new Iw({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), he(l.$$.fragment), f(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      C(n, e, a), ce(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (S(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && T(e), de(l);
    }
  };
}
function Dw(t) {
  let e, l, i = (
    /*info*/
    t[0] && Ku(t)
  );
  return {
    c() {
      e = m("div"), i && i.c(), f(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      C(n, e, a), i && i.m(e, null), l = !0;
    },
    p(n, [a]) {
      /*info*/
      n[0] ? i ? (i.p(n, a), a & /*info*/
      1 && S(i, 1)) : (i = Ku(n), i.c(), S(i, 1), i.m(e, null)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d();
    }
  };
}
function Rw(t, e, l) {
  let { info: i, machine_moment_at: n = Pe() } = e;
  return t.$$set = (a) => {
    "info" in a && l(0, i = a.info), "machine_moment_at" in a && l(1, n = a.machine_moment_at);
  }, [i, n];
}
class Hw extends Ve {
  constructor(e) {
    super(), Qe(this, e, Rw, Dw, Le, { info: 0, machine_moment_at: 1 });
  }
}
const Fw = 1.6;
function Lw(t, e) {
  return t / 1e9 * Fw * e;
}
let mn = 160, nf = 100, gn = 30;
function af(t, e, l) {
  var B, R, P, I, L, F, X, V, Q, J, te, ie, U, G, W, Z, ee, ye, qe, je, fe, _e, K, ke, ue, ne, oe;
  l != null && l.nodeColorScale && (l != null && l.nodeColorScale.domain) && (l == null || l.nodeColorScale.domain([e.esp, (1 + e.esp) / 2, 1]));
  let i = (l == null ? void 0 : l.filter_unused_qubits) === void 0 ? !1 : l.filter_unused_qubits, n = e.qubits.map((x) => x.index), a = n.length;
  i && ((B = l == null ? void 0 : l.match) != null && B.bit_match) ? (n = l.match.bit_match.filter((x) => !x.is_ancilla).map((x) => x.to), a = n.length) : i && (i = !1);
  let r = (R = t == null ? void 0 : t.design) == null ? void 0 : R.nodes.map((x) => ({ index: x.index, x: x.x, y: x.y })), s = {}, o = {};
  a < ((P = t == null ? void 0 : t.design) == null ? void 0 : P.nodes.length) && (r = r.filter((x) => n.includes(x.index))), r.forEach((x, ve) => {
    s[ve] = x.index, o[x.index] = ve;
  });
  let u, c, d = r.map((x) => x.x), h = r.map((x) => x.y);
  u = Math.min(...d), c = Math.min(...h), r = r.map((x) => (x.x = x.x - u, x.y = x.y - c, x));
  let p = 0, b = 0, g = {
    type: "g",
    role: "machine-circuit",
    id: "machine-circuit",
    _class: "machine-circuit",
    x: 0,
    y: 0,
    width: 0,
    height: 0,
    elem: []
  };
  g.elem.push({
    type: "text",
    id: "title",
    role: "title",
    _class: "title",
    text: "Machine: " + t.name + (t.machine_data.simulator ? " (simulator)" : ""),
    "font-size": 14,
    x: 0,
    y: 16,
    "font-weight": 700,
    "text-anchor": "start",
    "alignment-baseline": "bottom"
  });
  let v = {
    type: "g",
    role: "qubit-nodes",
    id: "qubit-nodes",
    _class: "qubit-nodes",
    x: Ie,
    y: Ie + gn + At,
    width: 0,
    height: 0,
    elem: []
  }, y = {};
  for (const x of r) {
    let ve = t.readout_errors[x.index], se = t.gate_info.filter((Ue) => {
      var Ke;
      return (Ke = Ue == null ? void 0 : Ue.qubits) == null ? void 0 : Ke.includes(x.index);
    }), Re;
    (I = l == null ? void 0 : l.match) != null && I.bit_match && (Re = (L = l == null ? void 0 : l.match) == null ? void 0 : L.bit_match.filter((Ue) => Ue.to === x.index)[0]);
    let Ce = {
      readout_error: ve,
      gate_info: se,
      qubit_id: x.index,
      original_qubit_id: Re.from,
      match_color: Ut[Re.from || r.length],
      id: l == null ? void 0 : l.id,
      original_circuit_id: l == null ? void 0 : l.original_circuit_id,
      transpiled_circuit_id: l == null ? void 0 : l.transpiled_circuit_id,
      unit_id: l == null ? void 0 : l.unit_id,
      pulse_view_id: l == null ? void 0 : l.pulse_view_id
    }, pe = {
      type: "g",
      role: "qubit-node--group",
      id: `qubit-node-${x.index}--group`,
      _class: "qubit-node--group",
      x: 0,
      y: 0,
      width: bl,
      height: bl,
      elem: [],
      data: Ce
    }, De = x.x * (Cl + bl), re = x.y * (Cl + bl), Se = bl / 2;
    pe.x = De, pe.y = re, pe.elem.push({
      type: "circle",
      role: "qubit-node--node",
      id: `qubit-node-${x.index}--node`,
      _class: "qubit-node--node",
      cx: Se,
      cy: Se,
      r: Se,
      stroke: ze,
      "stroke-width": 2,
      fill: l == null ? void 0 : l.nodeColorScale(1)
      // "fill-opacity": (1 - readout_error.value)
    }), pe.elem.push({
      type: "text",
      role: "qubit-node--marker",
      id: `qubit-node-${x.index}--marker`,
      _class: "qubit-node--marker",
      text: x.index,
      x: Se,
      y: Se + 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      stroke: ze,
      "stroke-width": 0,
      fill: ze
    }), pe.elem.push({
      type: "click-wrap",
      role: "qubit-node-click-wrap",
      id: `qubit-node-${x.index}--click-wrap`,
      _class: "qubit-node-click-wrap",
      x: 0,
      y: 0,
      width: bl,
      height: bl,
      data: Ce
    }), y[x.index] = [
      [De + Se, re],
      [De, re + Se],
      [De + 2 * Se, re + Se],
      [De + Se, re + 2 * Se]
    ], y[x.index].x = De, y[x.index].y = re, y[x.index].cx = De + Se, y[x.index].cy = re + Se, p = Math.max(p, pe.x + pe.width), b = Math.max(b, pe.y + pe.height), v.elem.push(pe);
  }
  v.width = p, v.height = b;
  let k = {
    type: "g",
    role: "qubit-edges",
    id: "qubit-edges",
    _class: "qubit-edges",
    x: Ie,
    y: Ie,
    width: 0,
    height: 0,
    elem: []
  }, w = {};
  for (const x of (F = t == null ? void 0 : t.design) == null ? void 0 : F.edges)
    if (n.includes(x[0]) && n.includes(x[1])) {
      let ve = x.toSorted().join(">"), se = x.join(">");
      w[ve] ? ve !== se && (w[ve].bi_dir = !0) : w[ve] = {
        nodes: x,
        from_to: Vw(y[x[0]], y[x[1]]),
        bi_dir: !1
      };
    }
  let $ = 0, q = {};
  for (const x in w) {
    let ve = w[x], se = (V = (X = ve.from_to) == null ? void 0 : X[0]) == null ? void 0 : V[0], Re = (J = (Q = ve.from_to) == null ? void 0 : Q[1]) == null ? void 0 : J[0], Ce = (ie = (te = ve.from_to) == null ? void 0 : te[0]) == null ? void 0 : ie[1], pe = (G = (U = ve.from_to) == null ? void 0 : U[1]) == null ? void 0 : G[1], De = Math.min(se, Re), re = Math.min(Ce, pe), Se = Math.max(se, Re) - Math.min(se, Re), Ue = Math.max(Ce, pe) - Math.min(Ce, pe), Ke = Gw([Se, -Ue], [Se, 0]), xe = Ke + 180, wt = {
      type: "g",
      role: "qubit-edge--group",
      id: `qubit-edge-${$}--group`,
      _class: "qubit-edge--group",
      x: De,
      y: re + gn + At,
      width: Se,
      height: Ue,
      elem: []
    };
    wt.elem.push({
      type: "line",
      role: "qubit-edge--edge",
      id: `qubit-edge-${$}--edge`,
      _class: "qubit-edge--edge",
      x1: 0,
      x2: Se,
      y1: 0,
      y2: Ue,
      stroke: ze,
      "stroke-width": 1
    }), (ve.bi_dir || (!ve.bi_dir && sf(ve.from_to[0], ve.from_to[1])) > 0) && wt.elem.push({
      type: "arrow-end",
      role: "qubit-edge--edge-arrow-1",
      id: `qubit-edge-${$}--edge-arrow-1`,
      _class: "qubit-edge--edge-arrow",
      x: Se,
      y: Ue,
      fill: ze,
      "stroke-width": 0,
      rotate: Ke
    }), (ve.bi_dir || (!ve.bi_dir && sf(ve.from_to[0], ve.from_to[1])) < 1) && wt.elem.push({
      type: "arrow-end",
      role: "qubit-edge--edge-arrow-2",
      id: `qubit-edge-${$}--edge-arrow-2`,
      _class: "qubit-edge--edge-arrow",
      x: 0,
      y: 0,
      fill: ze,
      "stroke-width": 0,
      rotate: xe
    });
    let $t = Se + Ie / 2, st = Ue + Ie * 2;
    wt.elem.push({
      type: "rect",
      role: "qubit-edge--highlight-wrap",
      id: `qubit-edge-${$}--highlight-wrap`,
      _class: "qubit-edge--highlight-wrap highlight-wrap",
      x: Se / 2 - $t / 2,
      y: Ue / 2 - st / 2,
      width: $t,
      height: st,
      "stroke-width": 0,
      "fill-opacity": 0
    }), q[x] = `qubit-edge-${$}`, $++, k.elem.push(wt);
  }
  g.width = p, g.height = b, g.elem.push(v), g.elem.push(k);
  let j = e.esp, O = [], z = [], N = [], M = 0, H = 0;
  for (const x of e.layers) {
    let ve = {
      type: "g",
      role: "op-layer-group",
      id: `layer-${M}--op-layer-group`,
      _class: "op-layer-group",
      x: Ie,
      y: Ie + gn + At,
      width: p,
      height: b,
      elem: [],
      data: {}
    }, se = 0, Re = 0, Ce = {
      type: "g",
      x: p + Ze * 2,
      y: Ie + 8,
      elem: []
    };
    Ce.elem.push({
      type: "text",
      x: 0,
      y: 0,
      "text-anchor": "start",
      "alignment-baseline": "bottom",
      "font-weight": 700,
      text: "Layer info"
    }), Ce.elem.push({
      type: "text",
      x: 0,
      y: 14,
      "font-size": 12,
      "text-anchor": "start",
      "alignment-baseline": "bottom",
      text: `Layer: ${M}` + (M === e.layers.length - 1 ? " (last)" : "")
    }), z[M] = z[M - 1] || 1;
    let pe = x.operations.length;
    for (const De of x.operations) {
      let re = (W = t.gate_info.filter(
        (He) => Kw(De.qubits.map((et) => et.index), He == null ? void 0 : He.qubits) && He.gate == De.gate
      )) == null ? void 0 : W[0], Se = ((Z = re == null ? void 0 : re.gate_length) == null ? void 0 : Z.value) || 0;
      Re = Math.max(Se, Re);
      let Ue = De.gate, Ke = ((ee = re == null ? void 0 : re.gate_error) == null ? void 0 : ee.value) || 0, xe = (re == null ? void 0 : re.qubits) || De.qubits.map((He) => He.index);
      De.gate === "measure" && (Ke = (ye = t.readout_errors[De.qubits[0].index]) == null ? void 0 : ye.value), z[M] = z[M] * (1 - Ke), O[M] || (O[M] = r.map(() => 0));
      for (let He in O[M]) {
        let et = parseInt(He), gt = s[et];
        v.elem[et] && (O[M][et] = ((qe = O[M - 1]) == null ? void 0 : qe[et]) || 1, v.elem[et].data.esp_value || (v.elem[et].data.esp_value = []), ((je = re == null ? void 0 : re.qubits) != null && je.includes(gt) || De.gate === "measure" && De.qubits[0].index === gt) && (O[M][et] = O[M][et] * (1 - Ke)), v.elem[et].data.esp_value[M] = O[M][et]);
      }
      let { edges: wt, edge_ids: $t } = Qw(re, q), st, qt = Sr((fe = l == null ? void 0 : l.match) == null ? void 0 : fe.layer_match, "t-o", M, se);
      qt ? st = Ut[(qt.layer + qt.operation * pe) % Ut.length] : st = "#454545";
      let Dt = Ue + "__" + xe.join("_"), ot = [], ht = [], Me = [], me = [];
      Wg.includes(De.gate) ? ot = xe : Jg.includes(De.gate) ? (ot = xe.slice(0, -1), ht = xe.slice(-1)) : Zg.includes(De.gate) ? (ot = xe.slice(0, -2), ht = xe.slice(-2)) : xg.includes(De.gate) ? me = xe : ht = xe, Me = De.params.map((He) => Gi(He));
      let Oe = (_e = e == null ? void 0 : e.pulse_data) == null ? void 0 : _e[Dt], Fe = {
        original_circuit_id: l == null ? void 0 : l.original_circuit_id,
        transpiled_circuit_id: l == null ? void 0 : l.transpiled_circuit_id,
        unit_id: l == null ? void 0 : l.unit_id,
        pulse_view_id: l == null ? void 0 : l.pulse_view_id,
        layer_index: M,
        operation_index: se,
        operation: {
          gate: Ue,
          qubits: De.qubits,
          qubit_index: xe,
          num_qubits: xe.length,
          num_clbits: De.clbits.length,
          clbits: De.clbits
        },
        original_layer_index: qt == null ? void 0 : qt.layer,
        original_operation_index: qt == null ? void 0 : qt.operation,
        duration: Se,
        unit: (K = re == null ? void 0 : re.gate_length) == null ? void 0 : K.unit,
        edges: wt,
        edge_ids: $t,
        match_color: st,
        gate_error: Ke,
        esp_qubit_wise: O[M],
        esp_cumulative: z[M],
        pulse_data: Oe
      }, Ee = {
        type: "g",
        role: "op-layer-operation-group",
        id: `layer-${M}--operation-${se}--op-group`,
        _class: "op-layer-group on-machine",
        x: 0,
        y: 0,
        is_timed: !0,
        duration: Se,
        elem: [],
        data: Fe
      };
      ve.data.unit = (ke = re == null ? void 0 : re.gate_length) == null ? void 0 : ke.unit;
      for (const He of De.qubits) {
        let et = [(ue = y[He.index]) == null ? void 0 : ue.cx, (ne = y[He.index]) == null ? void 0 : ne.cy];
        if (ot.includes(He.index))
          Ee.elem.push({
            type: "rect",
            id: `layer-${M}--operation-${se}--gate-${De.gate}--qubit-${He.index}`,
            role: "layer-op-gate-control",
            _class: "layer-op-gate-control",
            width: 8,
            height: 8,
            x: et[0] - 4,
            y: et[1] + Cl / 2 - 2,
            fill: st,
            "stroke-width": 1
          }), Ee.elem.push({
            type: "click-wrap",
            id: `layer-${M}--operation-${se}--gate-${De.gate}--qubit-${He.index}--click-wrap`,
            role: "machine-gate-click-wrap",
            width: 8,
            height: 8,
            x: et[0] - 4,
            y: et[1] + Cl / 2 - 2,
            data: Fe
          });
        else if (ht.includes(He.index)) {
          let gt = De.gate;
          Me.length > 0 && (gt += `(${Me.join(",")})`);
          let Ct = (gt.length + 2) * 6;
          Ee.elem.push({
            type: "rect",
            id: `layer-${M}--operation-${se}--gate-${De.gate}--qubit-${He.index}`,
            role: "layer-op-gate-target",
            _class: "layer-op-gate-target",
            width: Ct,
            height: Cl * 0.8,
            x: et[0] - Ct / 2,
            y: et[1] + Cl / 2 - 3,
            "stroke-width": 1,
            fill: st
          }), Ee.elem.push({
            type: "text",
            id: `layer-${M}--operation-${se}--gate-${De.gate}--qubit-${He.index}--marker`,
            role: "layer-op-gate-target-marker",
            _class: "layer-op-gate-target-marker",
            x: et[0],
            y: et[1] + Cl - 4,
            "font-size": 12,
            "text-anchor": "middle",
            "alignment-baseline": "middle",
            fill: "white",
            text: gt
          }), Ee.elem.push({
            type: "click-wrap",
            id: `layer-${M}--operation-${se}--gate-${De.gate}--qubit-${He.index}--click-wrap`,
            role: "machine-gate-click-wrap",
            width: Ct,
            height: Cl * 0.8,
            x: et[0] - Ct / 2,
            y: et[1] + Cl / 2 - 3,
            data: Fe
          });
        } else
          me.includes(He.index) && (Ee.elem.push({
            type: "rect",
            id: `layer-${M}--operation-${se}--gate-${De.gate}--qubit-${He.index}`,
            role: "layer-op-gate-swap",
            _class: "layer-op-gate-swap",
            width: 12,
            height: 12,
            x: et[0] - 6,
            y: et[1] + bl / 3 - 6,
            fill: st,
            "stroke-width": 0
          }), Ee.elem.push({
            type: "text",
            id: `layer-${M}--operation-${se}--gate-${De.gate}--qubit-${He.index}`,
            role: "layer-op-gate-swap-marker",
            _class: "layer-op-gate-swap-marker",
            "font-size": 12,
            x: et[0] - 5,
            y: et[1] + bl / 3 - 5,
            "text-anchor": "middle",
            "alignment-baseline": "middle",
            fill: "white",
            text: "×"
          }), Ee.elem.push({
            type: "click-wrap",
            id: `layer-${M}--operation-${se}--gate-${De.gate}--qubit-${He.index}--click-wrap`,
            role: "machine-gate-click-wrap",
            width: 12,
            height: 12,
            x: et[0] - 6,
            y: et[1] + bl / 3 - 6,
            data: Fe
          }));
      }
      if (De.qubits.length > 0)
        for (let He = 0; He < De.length; He++) {
          let et = De.qubits[He];
          for (let gt = He + 1; gt < De.length; gt++) {
            let Ct = De.qubits[gt], cl = [et.index, Ct.index].toSorted().join(">");
            q[cl] && Ee.data.edges.push(q[cl]);
          }
        }
      H += Re;
      let We = p + Ze * 2, Ye = se * 20 + Ie + 16 + 64;
      if (Ke !== void 0) {
        let He = O[M][o[xe[0]]], et = {
          type: "g",
          role: "op-gate-error-group",
          id: `layer-${M}--operation-${se}--gate-error`,
          _class: "op-gate-error",
          x: We,
          y: Ye,
          elem: []
        };
        se == 0 && ve.elem.push({
          x: We,
          y: Ye - 4,
          "text-anchor": "start",
          "alignment-baseline": "bottom",
          "font-weight": 700,
          type: "text",
          text: "ESP info"
        }), et.elem.push({
          type: "rect",
          role: "op-gate-error-group-bar-wrap",
          id: `layer-${M}--operation-${se}--gate-error--bar-wrap`,
          _class: "op-gate-error-bar-wrap",
          x: 0,
          y: 0,
          width: mn - Ie,
          height: tn
        }), et.elem.push({
          type: "rect",
          role: "op-gate-error-group-bar",
          id: `layer-${M}--operation-${se}--gate-error--bar`,
          _class: "op-gate-error-bar",
          x: 0,
          y: 0,
          width: (mn - Ie) * (He - j) / (1 - j),
          height: tn,
          fill: l == null ? void 0 : l.nodeColorScale((He - j) / (1 - j))
        }), et.elem.push({
          type: "text",
          role: "op-gate-error-group-label",
          id: `layer-${M}--operation-${se}--gate-error--label`,
          _class: "op-gate-error-label",
          x: 2,
          y: 11,
          "font-size": 10,
          "text-anchor": "start",
          "alignment-baseline": "bottom",
          fill: "white",
          text: De.gate + `(${xe.join(",")}): ` + He.toString().slice(0, 7)
        }), et.elem.push({
          type: "click-wrap",
          role: "op-gate-error-group-click-wrap",
          id: `layer-${M}--operation-${se}--gate-error--click-wrap`,
          _class: "op-gate-error-click-wrap",
          x: mn - nf,
          y: 2,
          width: nf - Ie,
          height: tn,
          data: {
            gate_error_info: {
              gate_error: Ke,
              layer: M,
              operation: se,
              qubits: xe,
              gate: De.gate,
              gate_duration: Se,
              duration_unit: (oe = re == null ? void 0 : re.gate_length) == null ? void 0 : oe.unit,
              esp: He
            }
          }
        }), Ee.elem.push(et), Ye + tn > b && (b = Ye + tn);
      }
      ve.elem.push(Ee), se++;
    }
    Ce.elem.push({
      type: "text",
      x: 0,
      y: 28,
      "font-size": 12,
      "text-anchor": "start",
      "alignment-baseline": "bottom",
      text: `Duration: ${Re.toString().slice(0, 7)} (${ve.data.unit || "ns"})`
    }), Ce.elem.push({
      type: "text",
      x: 0,
      y: 42,
      "font-size": 12,
      "text-anchor": "start",
      "alignment-baseline": "bottom",
      text: `Cummulative: ${H.toString().slice(0, 7)} (${ve.data.unit || "ns"})`
    }), ve.data.cummul_duration = H, ve.elem.push(Ce), M++, ve.is_timed = !0, ve.duration = Re, N.push(ve);
  }
  return {
    type: "svg",
    width: p + Ie * 2 + mn + Ze * 2,
    height: b + Ie * 2 + gn + At,
    viewBox: [0, 0, p + Ie * 4 + mn, b + Ie * 2 + gn + At],
    groups: {
      machine: g
    },
    operations: N,
    bit_map: {
      qubit_rel_map: o,
      qubit_pos_map: s
    },
    meta_info: {
      cummul_duration: H
    }
  };
}
function Qw(t, e) {
  let l = [], i = [];
  if (t) {
    let n = t.qubits;
    if (n.length > 0) {
      n = n.toSorted();
      for (let a = 0; a < n.length; a++)
        for (let r = 0; r < n.length; r++) {
          let s = n[a] + ">" + n[r];
          e[s] && (l.push([n[a], n[r]]), i.push(e[s]));
        }
    }
  }
  return { edges: l, edge_ids: i };
}
function Vw(t, e) {
  let l = 9e9, i;
  if (t && t.length > 0) {
    for (const n of t)
      if (e && e.length > 0)
        for (const a of e) {
          let r = Xw(n, a);
          r < l && (l = r, i = [n, a]);
        }
  }
  return i;
}
function Xw(t, e) {
  return Math.sqrt(
    Math.pow(t[0] - e[0], 2) + Math.pow(t[1] - e[1], 2)
  );
}
function Gw(t, e) {
  let l = Math.acos(
    Yw(t, e) / (rf(t) * rf(e))
  );
  return isNaN(l) && (l = Math.PI / 2), l / Math.PI * 180;
}
function Yw(t, e) {
  return t[0] * e[0] + t[1] * e[1];
}
function rf(t) {
  return Math.sqrt(
    Math.pow(t[0], 2) + Math.pow(t[1], 2)
  );
}
function sf(t, e) {
  return t[0] <= e[0] && t[1] <= e[1] ? 1 : -1;
}
function Kw(t, e) {
  return t.join(",") === e.join(",");
}
function of(t, e, l) {
  const i = t.slice();
  return i[5] = e[l], i[7] = l, i;
}
function uf(t) {
  let e, l, i;
  return {
    c() {
      e = m("div"), f(e, "style", l = `width: ${/*unit_width*/
      t[4]}px;`), f(e, "class", i = Gt(`p ${/*cumulative*/
      t[3] ? (
        /*i*/
        t[7] <= /*curr*/
        t[1] ? "o" : "x"
      ) : (
        /*curr*/
        t[1] == /*i*/
        t[7] ? "o" : "x"
      )}`) + " svelte-k5l8cv");
    },
    m(n, a) {
      C(n, e, a);
    },
    p(n, a) {
      a & /*unit_width*/
      16 && l !== (l = `width: ${/*unit_width*/
      n[4]}px;`) && f(e, "style", l), a & /*cumulative, curr*/
      10 && i !== (i = Gt(`p ${/*cumulative*/
      n[3] ? (
        /*i*/
        n[7] <= /*curr*/
        n[1] ? "o" : "x"
      ) : (
        /*curr*/
        n[1] == /*i*/
        n[7] ? "o" : "x"
      )}`) + " svelte-k5l8cv") && f(e, "class", i);
    },
    d(n) {
      n && T(e);
    }
  };
}
function Uw(t) {
  let e, l, i, n, a, r, s = (
    /*curr*/
    t[1] + 1 + ""
  ), o, u, c, d, h = we({ length: (
    /*total*/
    t[0]
  ) }), p = [];
  for (let b = 0; b < h.length; b += 1)
    p[b] = uf(of(t, h, b));
  return {
    c() {
      e = m("div"), l = m("div");
      for (let b = 0; b < p.length; b += 1)
        p[b].c();
      n = A(), a = m("div"), r = E("("), o = E(s), u = E(" / "), c = E(
        /*total*/
        t[0]
      ), d = E(")"), f(l, "style", i = `width: ${/*width*/
      t[2]}px;`), f(l, "class", "w svelte-k5l8cv"), f(a, "class", "notion svelte-k5l8cv"), f(e, "class", "f svelte-k5l8cv");
    },
    m(b, g) {
      C(b, e, g), _(e, l);
      for (let v = 0; v < p.length; v += 1)
        p[v] && p[v].m(l, null);
      _(e, n), _(e, a), _(a, r), _(a, o), _(a, u), _(a, c), _(a, d);
    },
    p(b, [g]) {
      if (g & /*unit_width, cumulative, curr, total*/
      27) {
        h = we({ length: (
          /*total*/
          b[0]
        ) });
        let v;
        for (v = 0; v < h.length; v += 1) {
          const y = of(b, h, v);
          p[v] ? p[v].p(y, g) : (p[v] = uf(y), p[v].c(), p[v].m(l, null));
        }
        for (; v < p.length; v += 1)
          p[v].d(1);
        p.length = h.length;
      }
      g & /*width*/
      4 && i !== (i = `width: ${/*width*/
      b[2]}px;`) && f(l, "style", i), g & /*curr*/
      2 && s !== (s = /*curr*/
      b[1] + 1 + "") && Y(o, s), g & /*total*/
      1 && Y(
        c,
        /*total*/
        b[0]
      );
    },
    i: ae,
    o: ae,
    d(b) {
      b && T(e), Ge(p, b);
    }
  };
}
function Ww(t, e, l) {
  let { total: i = 0, curr: n = 0, width: a = 200, cumulative: r = !1 } = e, s = 0;
  return yt(() => {
    i > 0 && l(4, s = a / i);
  }), t.$$set = (o) => {
    "total" in o && l(0, i = o.total), "curr" in o && l(1, n = o.curr), "width" in o && l(2, a = o.width), "cumulative" in o && l(3, r = o.cumulative);
  }, [i, n, a, r, s];
}
class Jw extends Ve {
  constructor(e) {
    super(), Qe(this, e, Ww, Uw, Le, {
      total: 0,
      curr: 1,
      width: 2,
      cumulative: 3
    });
  }
}
function ff(t) {
  return Object.prototype.toString.call(t) === "[object Date]";
}
function Fr(t, e) {
  if (t === e || t !== t)
    return () => t;
  const l = typeof t;
  if (l !== typeof e || Array.isArray(t) !== Array.isArray(e))
    throw new Error("Cannot interpolate values of different type");
  if (Array.isArray(t)) {
    const i = e.map((n, a) => Fr(t[a], n));
    return (n) => i.map((a) => a(n));
  }
  if (l === "object") {
    if (!t || !e)
      throw new Error("Object cannot be null");
    if (ff(t) && ff(e)) {
      t = t.getTime(), e = e.getTime();
      const a = e - t;
      return (r) => new Date(t + r * a);
    }
    const i = Object.keys(e), n = {};
    return i.forEach((a) => {
      n[a] = Fr(t[a], e[a]);
    }), (a) => {
      const r = {};
      return i.forEach((s) => {
        r[s] = n[s](a);
      }), r;
    };
  }
  if (l === "number") {
    const i = e - t;
    return (n) => t + n * i;
  }
  throw new Error(`Cannot interpolate ${l} values`);
}
function _f(t, e = {}) {
  const l = Pe(t);
  let i, n = t;
  function a(r, s) {
    if (t == null)
      return l.set(t = r), Promise.resolve();
    n = r;
    let o = i, u = !1, {
      delay: c = 0,
      duration: d = 400,
      easing: h = Dg,
      interpolate: p = Fr
    } = ts(ts({}, e), s);
    if (d === 0)
      return o && (o.abort(), o = null), l.set(t = n), Promise.resolve();
    const b = Hg() + c;
    let g;
    return i = Fg((v) => {
      if (v < b)
        return !0;
      u || (g = p(t, r), typeof d == "function" && (d = d(t, r)), u = !0), o && (o.abort(), o = null);
      const y = v - b;
      return y > /** @type {number} */
      d ? (l.set(t = r), !1) : (l.set(t = g(h(y / d))), !0);
    }), i.promise;
  }
  return {
    set: a,
    update: (r, s) => a(r(n, t), s),
    subscribe: l.subscribe
  };
}
function Zw(t) {
  let e, l, i, n, a, r, s, o, u, c = (
    /*duration*/
    (t[0] == 0 ? "100" : Math.round(
      /*$progress*/
      t[3] / /*duration*/
      t[0] * 1e4
    ) / 100) + ""
  ), d, h, p = (
    /*duration*/
    t[0].toString().slice(0, 7) + ""
  ), b, g;
  return {
    c() {
      e = m("div"), l = m("div"), i = m("div"), n = A(), a = m("div"), o = A(), u = m("div"), d = E(c), h = E(`%
    (`), b = E(p), g = E("ns)"), f(i, "class", "b svelte-1c1h349"), f(a, "class", "p svelte-1c1h349"), f(a, "style", r = `width: ${/*duration*/
      t[0] == 0 ? (
        /*width*/
        t[1]
      ) : (
        /*$progress*/
        t[3] / /*duration*/
        t[0] * /*width*/
        t[1]
      )}px`), f(l, "style", s = `width: ${/*width*/
      t[1]}px;`), f(l, "class", "w svelte-1c1h349"), f(u, "class", "notion svelte-1c1h349"), f(e, "class", "f svelte-1c1h349");
    },
    m(v, y) {
      C(v, e, y), _(e, l), _(l, i), _(l, n), _(l, a), _(e, o), _(e, u), _(u, d), _(u, h), _(u, b), _(u, g);
    },
    p(v, [y]) {
      y & /*duration, width, $progress*/
      11 && r !== (r = `width: ${/*duration*/
      v[0] == 0 ? (
        /*width*/
        v[1]
      ) : (
        /*$progress*/
        v[3] / /*duration*/
        v[0] * /*width*/
        v[1]
      )}px`) && f(a, "style", r), y & /*width*/
      2 && s !== (s = `width: ${/*width*/
      v[1]}px;`) && f(l, "style", s), y & /*duration, $progress*/
      9 && c !== (c = /*duration*/
      (v[0] == 0 ? "100" : Math.round(
        /*$progress*/
        v[3] / /*duration*/
        v[0] * 1e4
      ) / 100) + "") && Y(d, c), y & /*duration*/
      1 && p !== (p = /*duration*/
      v[0].toString().slice(0, 7) + "") && Y(b, p);
    },
    i: ae,
    o: ae,
    d(v) {
      v && T(e);
    }
  };
}
function xw(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(o, (u) => l(3, i = u)), o);
  t.$$.on_destroy.push(() => n());
  let { duration: r = 100, width: s = 200 } = e, o;
  return yt(() => {
    a(l(2, o = _f(0, { duration: r }))), Ba(o, i = r, i);
  }), t.$$set = (u) => {
    "duration" in u && l(0, r = u.duration), "width" in u && l(1, s = u.width);
  }, t.$$.update = () => {
    t.$$.dirty & /*duration*/
    1 && (a(l(2, o = _f(0, { duration: r }))), Ba(o, i = r, i));
  }, [r, s, o, i];
}
class e3 extends Ve {
  constructor(e) {
    super(), Qe(this, e, xw, Zw, Le, { duration: 0, width: 1 });
  }
}
function cf(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R, P, I, L, F, X, V, Q, J, te, ie, U, G, W, Z, ee = (
    /*$drawPlan*/
    t[6].groups.machine && df(t)
  );
  const ye = [l3, t3], qe = [];
  function je(_e, K) {
    return (
      /*$drawPlan*/
      _e[6].operations && !/*$autoplay*/
      _e[12] ? 0 : (
        /*$drawPlan*/
        _e[6].operations && /*$autoplay*/
        _e[12] ? 1 : -1
      )
    );
  }
  ~(X = je(t)) && (V = qe[X] = ye[X](t));
  let fe = (
    /*$drawPlan*/
    t[6].operations && hf(t)
  );
  return {
    c() {
      e = m("h5"), e.textContent = "Cost estimate", l = A(), i = m("div"), n = m("div"), a = m("label"), r = E("Shots"), o = A(), u = m("input"), d = A(), h = m("div"), p = m("label"), b = E("Time (ns)"), v = A(), y = m("input"), w = A(), $ = m("div"), q = m("label"), j = E("Estimated costs $"), z = A(), N = m("input"), H = A(), B = m("p"), B.textContent = `The estimated cost is only for the operations. The actual cost includes
    qubit initialization, etc.`, R = A(), P = Xe("svg"), I = Xe("style"), L = E(`g {
        font-family: Iosevka;
        font-size: 14px;
      }
    `), ee && ee.c(), F = Be(), V && V.c(), ie = A(), fe && fe.c(), U = Be(), f(e, "class", "svelte-18z7n1k"), f(a, "for", s = "cost-exp-shots-" + /*id*/
      t[1]), f(a, "class", "svelte-18z7n1k"), f(u, "id", c = "cost-exp-shots-" + /*id*/
      t[1]), f(u, "type", "number"), f(u, "class", "svelte-18z7n1k"), f(n, "class", "input-wrap svelte-18z7n1k"), f(p, "for", g = "cost-exp-shots-" + /*id*/
      t[1]), f(p, "class", "svelte-18z7n1k"), f(y, "id", k = "cost-exp-shots-" + /*id*/
      t[1]), f(y, "type", "number"), y.disabled = !0, y.value = /*cost_time*/
      t[8], f(y, "class", "svelte-18z7n1k"), f(h, "class", "input-wrap svelte-18z7n1k"), f(q, "for", O = "cost-exp-shots-" + /*id*/
      t[1]), f(q, "class", "svelte-18z7n1k"), f(N, "id", M = "cost-exp-shots-" + /*id*/
      t[1]), f(N, "type", "number"), N.disabled = !0, N.value = /*cost_charge*/
      t[7], f(N, "class", "svelte-18z7n1k"), f($, "class", "input-wrap svelte-18z7n1k"), f(i, "class", "cost-explorer svelte-18z7n1k"), f(B, "class", "note svelte-18z7n1k"), f(
        P,
        "id",
        /*id*/
        t[1]
      ), f(P, "width", Q = /*$drawPlan*/
      t[6].width), f(P, "height", J = /*$drawPlan*/
      t[6].height), f(P, "viewBox", te = /*$drawPlan*/
      t[6].viewBox.join(" "));
    },
    m(_e, K) {
      C(_e, e, K), C(_e, l, K), C(_e, i, K), _(i, n), _(n, a), _(a, r), _(n, o), _(n, u), dt(
        u,
        /*cost_shots*/
        t[5]
      ), _(i, d), _(i, h), _(h, p), _(p, b), _(h, v), _(h, y), _(i, w), _(i, $), _($, q), _(q, j), _($, z), _($, N), C(_e, H, K), C(_e, B, K), C(_e, R, K), C(_e, P, K), _(P, I), _(I, L), ee && ee.m(P, null), _(P, F), ~X && qe[X].m(P, null), C(_e, ie, K), fe && fe.m(_e, K), C(_e, U, K), G = !0, W || (Z = le(
        u,
        "input",
        /*input0_input_handler*/
        t[30]
      ), W = !0);
    },
    p(_e, K) {
      (!G || K[0] & /*id*/
      2 && s !== (s = "cost-exp-shots-" + /*id*/
      _e[1])) && f(a, "for", s), (!G || K[0] & /*id*/
      2 && c !== (c = "cost-exp-shots-" + /*id*/
      _e[1])) && f(u, "id", c), K[0] & /*cost_shots*/
      32 && Cm(u.value) !== /*cost_shots*/
      _e[5] && dt(
        u,
        /*cost_shots*/
        _e[5]
      ), (!G || K[0] & /*id*/
      2 && g !== (g = "cost-exp-shots-" + /*id*/
      _e[1])) && f(p, "for", g), (!G || K[0] & /*id*/
      2 && k !== (k = "cost-exp-shots-" + /*id*/
      _e[1])) && f(y, "id", k), (!G || K[0] & /*cost_time*/
      256 && y.value !== /*cost_time*/
      _e[8]) && (y.value = /*cost_time*/
      _e[8]), (!G || K[0] & /*id*/
      2 && O !== (O = "cost-exp-shots-" + /*id*/
      _e[1])) && f(q, "for", O), (!G || K[0] & /*id*/
      2 && M !== (M = "cost-exp-shots-" + /*id*/
      _e[1])) && f(N, "id", M), (!G || K[0] & /*cost_charge*/
      128 && N.value !== /*cost_charge*/
      _e[7]) && (N.value = /*cost_charge*/
      _e[7]), /*$drawPlan*/
      _e[6].groups.machine ? ee ? (ee.p(_e, K), K[0] & /*$drawPlan*/
      64 && S(ee, 1)) : (ee = df(_e), ee.c(), S(ee, 1), ee.m(P, F)) : ee && (ge(), D(ee, 1, 1, () => {
        ee = null;
      }), be());
      let ke = X;
      X = je(_e), X === ke ? ~X && qe[X].p(_e, K) : (V && (ge(), D(qe[ke], 1, 1, () => {
        qe[ke] = null;
      }), be()), ~X ? (V = qe[X], V ? V.p(_e, K) : (V = qe[X] = ye[X](_e), V.c()), S(V, 1), V.m(P, null)) : V = null), (!G || K[0] & /*id*/
      2) && f(
        P,
        "id",
        /*id*/
        _e[1]
      ), (!G || K[0] & /*$drawPlan*/
      64 && Q !== (Q = /*$drawPlan*/
      _e[6].width)) && f(P, "width", Q), (!G || K[0] & /*$drawPlan*/
      64 && J !== (J = /*$drawPlan*/
      _e[6].height)) && f(P, "height", J), (!G || K[0] & /*$drawPlan*/
      64 && te !== (te = /*$drawPlan*/
      _e[6].viewBox.join(" "))) && f(P, "viewBox", te), /*$drawPlan*/
      _e[6].operations ? fe ? (fe.p(_e, K), K[0] & /*$drawPlan*/
      64 && S(fe, 1)) : (fe = hf(_e), fe.c(), S(fe, 1), fe.m(U.parentNode, U)) : fe && (ge(), D(fe, 1, 1, () => {
        fe = null;
      }), be());
    },
    i(_e) {
      G || (S(ee), S(V), S(fe), G = !0);
    },
    o(_e) {
      D(ee), D(V), D(fe), G = !1;
    },
    d(_e) {
      _e && (T(e), T(l), T(i), T(H), T(B), T(R), T(P), T(ie), T(U)), ee && ee.d(), ~X && qe[X].d(), fe && fe.d(_e), W = !1, Z();
    }
  };
}
function df(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[6].groups.machine
      ),
      open_tool: (
        /*open_tool*/
        t[3]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*$drawPlan*/
      64 && (a.data = /*$drawPlan*/
      i[6].groups.machine), n[0] & /*open_tool*/
      8 && (a.open_tool = /*open_tool*/
      i[3]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function t3(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[6].operations[
          /*$anim_curr_layer*/
          t[9]
        ]
      ),
      open_tool: (
        /*open_tool*/
        t[3]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*$drawPlan, $anim_curr_layer*/
      576 && (a.data = /*$drawPlan*/
      i[6].operations[
        /*$anim_curr_layer*/
        i[9]
      ]), n[0] & /*open_tool*/
      8 && (a.open_tool = /*open_tool*/
      i[3]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function l3(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[6].operations[
          /*$curr_layer*/
          t[13]
        ]
      ),
      open_tool: (
        /*open_tool*/
        t[3]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*$drawPlan, $curr_layer*/
      8256 && (a.data = /*$drawPlan*/
      i[6].operations[
        /*$curr_layer*/
        i[13]
      ]), n[0] & /*open_tool*/
      8 && (a.open_tool = /*open_tool*/
      i[3]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function hf(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R, P, I, L, F, X, V, Q, J, te, ie, U, G, W, Z, ee, ye, qe, je = 5 / /*time_factors*/
  t[18][
    /*$time_factor*/
    t[11]
  ] + "", fe, _e, K, ke, ue, ne = (
    /*$keep_timescale*/
    t[10] && /*$autoplay*/
    t[12] && pf(t)
  );
  return i = new Jw({
    props: {
      total: (
        /*$drawPlan*/
        t[6].operations.length
      ),
      curr: (
        /*$autoplay*/
        t[12] ? (
          /*$anim_curr_layer*/
          t[9]
        ) : (
          /*$curr_layer*/
          t[13]
        )
      )
    }
  }), {
    c() {
      ne && ne.c(), e = A(), l = m("div"), he(i.$$.fragment), n = A(), a = m("div"), r = m("button"), s = E("To first"), u = A(), c = m("button"), d = E("← Prev"), p = A(), b = m("button"), g = E("Next →"), y = A(), k = m("button"), w = E("To last"), q = A(), j = m("div"), O = m("button"), z = E("Autoplay"), N = A(), M = m("button"), H = E("Stop"), R = A(), P = m("button"), I = E("Slower"), F = A(), X = m("button"), V = E("Faster"), J = A(), te = m("br"), ie = A(), U = m("div"), G = m("input"), W = A(), Z = m("label"), Z.textContent = "Keep times", ee = A(), ye = m("span"), qe = E("Speed: "), fe = E(je), _e = E("x"), f(l, "class", "button-wrap svelte-18z7n1k"), r.disabled = o = /*$curr_layer*/
      t[13] == 0 || /*$autoplay*/
      t[12], f(r, "class", "svelte-18z7n1k"), c.disabled = h = /*$curr_layer*/
      t[13] == 0 || /*$autoplay*/
      t[12], f(c, "class", "svelte-18z7n1k"), b.disabled = v = /*$curr_layer*/
      t[13] == /*$drawPlan*/
      t[6].operations.length - 1 || /*$autoplay*/
      t[12], f(b, "class", "svelte-18z7n1k"), k.disabled = $ = /*$curr_layer*/
      t[13] == /*$drawPlan*/
      t[6].operations.length - 1 || /*$autoplay*/
      t[12], f(k, "class", "svelte-18z7n1k"), f(a, "class", "button-wrap svelte-18z7n1k"), O.disabled = /*$autoplay*/
      t[12], f(O, "class", "svelte-18z7n1k"), M.disabled = B = !/*$autoplay*/
      t[12], f(M, "class", "svelte-18z7n1k"), P.disabled = L = /*$time_factor*/
      t[11] == 0, f(P, "class", "svelte-18z7n1k"), X.disabled = Q = /*$time_factor*/
      t[11] == /*time_factors*/
      t[18].length - 1, f(X, "class", "svelte-18z7n1k"), f(G, "type", "checkbox"), f(G, "name", "match-time-scale"), f(G, "class", "svelte-18z7n1k"), f(Z, "for", "match-time-scale"), f(Z, "class", "svelte-18z7n1k"), f(ye, "class", "speed svelte-18z7n1k"), Mt(U, "margin-top", "0.25rem"), f(j, "class", "button-wrap svelte-18z7n1k");
    },
    m(oe, x) {
      ne && ne.m(oe, x), C(oe, e, x), C(oe, l, x), ce(i, l, null), C(oe, n, x), C(oe, a, x), _(a, r), _(r, s), _(a, u), _(a, c), _(c, d), _(a, p), _(a, b), _(b, g), _(a, y), _(a, k), _(k, w), C(oe, q, x), C(oe, j, x), _(j, O), _(O, z), _(j, N), _(j, M), _(M, H), _(j, R), _(j, P), _(P, I), _(j, F), _(j, X), _(X, V), _(j, J), _(j, te), _(j, ie), _(j, U), _(U, G), _(U, W), _(U, Z), _(U, ee), _(U, ye), _(ye, qe), _(ye, fe), _(ye, _e), K = !0, ke || (ue = [
        le(
          r,
          "click",
          /*click_handler*/
          t[31]
        ),
        le(
          c,
          "click",
          /*click_handler_1*/
          t[32]
        ),
        le(
          b,
          "click",
          /*click_handler_2*/
          t[33]
        ),
        le(
          k,
          "click",
          /*click_handler_3*/
          t[34]
        ),
        le(
          O,
          "click",
          /*click_handler_4*/
          t[35]
        ),
        le(
          M,
          "click",
          /*click_handler_5*/
          t[36]
        ),
        le(
          P,
          "click",
          /*click_handler_6*/
          t[37]
        ),
        le(
          X,
          "click",
          /*click_handler_7*/
          t[38]
        ),
        le(
          G,
          "change",
          /*change_handler*/
          t[39]
        )
      ], ke = !0);
    },
    p(oe, x) {
      /*$keep_timescale*/
      oe[10] && /*$autoplay*/
      oe[12] ? ne ? (ne.p(oe, x), x[0] & /*$keep_timescale, $autoplay*/
      5120 && S(ne, 1)) : (ne = pf(oe), ne.c(), S(ne, 1), ne.m(e.parentNode, e)) : ne && (ge(), D(ne, 1, 1, () => {
        ne = null;
      }), be());
      const ve = {};
      x[0] & /*$drawPlan*/
      64 && (ve.total = /*$drawPlan*/
      oe[6].operations.length), x[0] & /*$autoplay, $anim_curr_layer, $curr_layer*/
      12800 && (ve.curr = /*$autoplay*/
      oe[12] ? (
        /*$anim_curr_layer*/
        oe[9]
      ) : (
        /*$curr_layer*/
        oe[13]
      )), i.$set(ve), (!K || x[0] & /*$curr_layer, $autoplay*/
      12288 && o !== (o = /*$curr_layer*/
      oe[13] == 0 || /*$autoplay*/
      oe[12])) && (r.disabled = o), (!K || x[0] & /*$curr_layer, $autoplay*/
      12288 && h !== (h = /*$curr_layer*/
      oe[13] == 0 || /*$autoplay*/
      oe[12])) && (c.disabled = h), (!K || x[0] & /*$curr_layer, $drawPlan, $autoplay*/
      12352 && v !== (v = /*$curr_layer*/
      oe[13] == /*$drawPlan*/
      oe[6].operations.length - 1 || /*$autoplay*/
      oe[12])) && (b.disabled = v), (!K || x[0] & /*$curr_layer, $drawPlan, $autoplay*/
      12352 && $ !== ($ = /*$curr_layer*/
      oe[13] == /*$drawPlan*/
      oe[6].operations.length - 1 || /*$autoplay*/
      oe[12])) && (k.disabled = $), (!K || x[0] & /*$autoplay*/
      4096) && (O.disabled = /*$autoplay*/
      oe[12]), (!K || x[0] & /*$autoplay*/
      4096 && B !== (B = !/*$autoplay*/
      oe[12])) && (M.disabled = B), (!K || x[0] & /*$time_factor*/
      2048 && L !== (L = /*$time_factor*/
      oe[11] == 0)) && (P.disabled = L), (!K || x[0] & /*$time_factor*/
      2048 && Q !== (Q = /*$time_factor*/
      oe[11] == /*time_factors*/
      oe[18].length - 1)) && (X.disabled = Q), (!K || x[0] & /*$time_factor*/
      2048) && je !== (je = 5 / /*time_factors*/
      oe[18][
        /*$time_factor*/
        oe[11]
      ] + "") && Y(fe, je);
    },
    i(oe) {
      K || (S(ne), S(i.$$.fragment, oe), K = !0);
    },
    o(oe) {
      D(ne), D(i.$$.fragment, oe), K = !1;
    },
    d(oe) {
      oe && (T(e), T(l), T(n), T(a), T(q), T(j)), ne && ne.d(oe), de(i), ke = !1, vt(ue);
    }
  };
}
function pf(t) {
  var n, a;
  let e, l, i;
  return l = new e3({
    props: {
      duration: (
        /*$drawPlan*/
        (a = (n = t[6].operations) == null ? void 0 : n[
          /*$autoplay*/
          t[12] ? (
            /*$anim_curr_layer*/
            t[9]
          ) : (
            /*$curr_layer*/
            t[13]
          )
        ]) == null ? void 0 : a.duration
      )
    }
  }), {
    c() {
      e = m("div"), he(l.$$.fragment), f(e, "class", "button-wrap svelte-18z7n1k");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0;
    },
    p(r, s) {
      var u, c;
      const o = {};
      s[0] & /*$drawPlan, $autoplay, $anim_curr_layer, $curr_layer*/
      12864 && (o.duration = /*$drawPlan*/
      (c = (u = r[6].operations) == null ? void 0 : u[
        /*$autoplay*/
        r[12] ? (
          /*$anim_curr_layer*/
          r[9]
        ) : (
          /*$curr_layer*/
          r[13]
        )
      ]) == null ? void 0 : c.duration), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l);
    }
  };
}
function i3(t) {
  let e, l, i = (
    /*data*/
    t[0] && /*$drawPlan*/
    t[6] && cf(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, e, a), l = !0;
    },
    p(n, a) {
      /*data*/
      n[0] && /*$drawPlan*/
      n[6] ? i ? (i.p(n, a), a[0] & /*data, $drawPlan*/
      65 && S(i, 1)) : (i = cf(n), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d(n);
    }
  };
}
function n3(t) {
  return new Promise((e) => {
    setTimeout(e, t);
  });
}
function a3(t, e, l) {
  let i, n, a = ae, r = () => (a(), a = rt(O, (se) => l(43, n = se)), O), s, o, u, c, d = ae, h = () => (d(), d = rt(M, (se) => l(12, c = se)), M), p;
  t.$$.on_destroy.push(() => a()), t.$$.on_destroy.push(() => d());
  let { data: b, id: g, original_circuit_id: v, transpiled_circuit_id: y, pulse_view_id: k, match: w, operation_data: $, machine_moment_at: q = Pe(0), machine_dt_at: j = Pe(0), op_schedule: O = Pe([]), open_tool: z = () => {
  }, filter_unused_qubits: N = !1, autoplay: M = Pe(!1) } = e;
  r(), h();
  let H = window, B = Pe();
  at(t, B, (se) => l(6, i = se));
  let R = Pe(null), P = Pe(0);
  at(t, R, (se) => l(13, p = se)), at(t, P, (se) => l(9, s = se));
  let I = Pe(!1), L = !1;
  at(t, I, (se) => l(10, o = se));
  let F = yl(Tw);
  R.subscribe((se) => {
    var Re;
    G(), se >= 0 && se <= ((Re = i == null ? void 0 : i.operations) == null ? void 0 : Re.length) - 1 && U(se), W(se);
  }), P.subscribe((se) => {
    var Re;
    G(), se >= 0 && se <= ((Re = i == null ? void 0 : i.operations) == null ? void 0 : Re.length) - 1 && U(se), W(se);
  }), B.subscribe((se) => {
    se != null && se.operations && (R.set(0), W(0));
  });
  let X = [];
  yt(() => {
    var se;
    b && (B.set(af(b, $, {
      id: g,
      original_circuit_id: v,
      transpiled_circuit_id: y,
      pulse_view_id: k,
      match: w,
      nodeColorScale: F,
      filter_unused_qubits: N
    })), (se = i.operations) == null || se.map((Re) => Re.duration).reduce((Re, Ce) => Re + Ce, 0), W(0));
  });
  let V = [
    1e3 / 50,
    1e3 / 100,
    1e3 / 150,
    1e3 / 200,
    1e3 / 250,
    1e3 / 300,
    1e3 / 350,
    1e3 / 400
  ], Q = Pe(3);
  at(t, Q, (se) => l(11, u = se));
  function J() {
    Q.update((se) => Math.max(se - 1, 0));
  }
  function te() {
    Q.update((se) => Math.min(se + 1, V.length - 1));
  }
  async function ie() {
    if (L = !0, P.set(0), !!(i != null && i.operations)) {
      for (const se of i == null ? void 0 : i.operations) {
        if (!L) {
          M.set(!1), R.set(s);
          return;
        }
        let Re = V[u] * (o ? n[s] : 100);
        if (Re > 0) {
          let Ce = (n[s + 1] === void 0 ? n[s] : n[s + 1]) - n[s], pe = Za((De) => {
            j.set(n[s] + Ce * De / Re), De > Re && pe.stop();
          });
          await n3(Re);
        }
        if (!L) {
          M.set(!1), R.set(s);
          return;
        }
        P.update((Ce) => Math.min(Ce + 1, i.operations.length - 1));
      }
      M.set(!1), R.set(0);
    }
  }
  function U(se) {
    var De;
    X = [];
    let Re = (De = i == null ? void 0 : i.operations) == null ? void 0 : De[se], Ce = [], pe = [];
    if (Re != null && Re.elem) {
      let re = Re.elem.filter((Ue) => Ue.role === "op-layer-operation-group");
      re && re.forEach((Ue) => {
        Ue.data.edge_ids.forEach((Dt) => {
          let ot = document.querySelector(`#${g} #${Dt}--group .highlight-wrap`);
          ot && (ot.classList.add("edge-highlighted"), ot.style.fill = Ue.data.match_color, ot.style.fillOpacity = "0.4");
        });
        let xe = Ue.data.operation_index, wt = document.querySelector(`#${y} .gate-wrap.layer-${se}.gate-${xe}.transpiled`);
        wt && (wt.classList.add("op-highlighted"), wt.style.outline = `2px solid ${Ue.data.match_color}`);
        let $t = Ue.data.original_layer_index;
        pe.push($t);
        let st = Ue.data.original_operation_index, qt = document.querySelector(`#${v} .gate-wrap.layer-${$t}.gate-${st}.original`);
        qt && (qt.classList.add("op-highlighted"), qt.style.outline = `2px solid ${Ue.data.match_color}`), Ce.push(Ue.data.match_color);
      });
      let Se = document.querySelector(`#${y} #layer-${se}--interaction-wrap`);
      if (Se) {
        let Ue = t0(Ce), Ke = Ue ? `tg-l-${se}` : null;
        Ke && (l0(y, { id: Ke, grad_data: Ue }), X.push(Ke)), Se.classList.add("layer-highlighted"), Se.style.fill = Ke ? `url(#${Ke})` : Ce[0] || "#000000", Se.style.fillOpacity = "0.2";
      }
      pe.forEach((Ue, Ke) => {
        let xe = document.querySelector(`#${v} #layer-${Ue}--interaction-wrap`);
        xe && (xe.classList.add("layer-highlighted"), xe.style.fill = Ce[Ke], xe.style.fillOpacity = "0.2");
      });
    }
  }
  function G() {
    let se = Array.from(H ? document.querySelectorAll(`#${y} .edge-highlighted`) : []);
    se == null || se.forEach((re) => {
      re.classList.remove("edge-highlighted"), re.style.fill = "#ffffff", re.style.fillOpacity = 0;
    });
    let Re = Array.from(H ? document.querySelectorAll(`#${y} .layer-highlighted`) : []);
    Re == null || Re.forEach((re) => {
      re.classList.remove("layer-highlighted"), re.style.fillOpacity = 0;
    });
    let Ce = Array.from(H ? document.querySelectorAll(`#${y} .op-highlighted`) : []);
    Ce == null || Ce.forEach((re) => {
      re.classList.remove("op-highlighted"), re.style.outline = null;
    });
    let pe = Array.from(H ? document.querySelectorAll(`#${v} .layer-highlighted`) : []);
    pe == null || pe.forEach((re) => {
      re.classList.remove("layer-highlighted"), re.style.fillOpacity = 0;
    });
    let De = Array.from(H ? document.querySelectorAll(`#${v} .op-highlighted`) : []);
    De == null || De.forEach((re) => {
      re.classList.remove("op-highlighted"), re.style.outline = null;
    });
  }
  function W(se) {
    var pe, De, re, Se, Ue;
    let Re = (De = (pe = i == null ? void 0 : i.operations[se].elem) == null ? void 0 : pe.filter((Ke) => Ke.role === "op-layer-operation-group")) == null ? void 0 : De[0], Ce = ((re = i == null ? void 0 : i.bit_map) == null ? void 0 : re.qubit_rel_map) || {};
    Re && ((Ue = (Se = b == null ? void 0 : b.design) == null ? void 0 : Se.nodes) == null || Ue.forEach((Ke, xe) => {
      var wt, $t;
      if (Ce[Ke.index] !== void 0) {
        q.set(se), j.set(n[se]);
        let st = ((($t = (wt = Re.data) == null ? void 0 : wt.esp_qubit_wise) == null ? void 0 : $t[Ce[Ke.index]]) - $.esp) / (1 - $.esp), qt = document.querySelector(`#${g} #qubit-node-${Ke.index}--node`);
        qt && qt.setAttribute("fill", F(st));
      }
    }));
  }
  function Z() {
    L = !1;
  }
  M.subscribe((se) => {
    se ? ie() : Z();
  });
  let ee = 1e3, ye = 0, qe;
  function je() {
    ee = Cm(this.value), l(5, ee);
  }
  const fe = () => {
    R.update((se) => 0);
  }, _e = () => {
    R.update((se) => se - 1);
  }, K = () => {
    R.update((se) => se + 1);
  }, ke = () => {
    R.update((se) => i.operations.length - 1);
  }, ue = () => {
    M.set(!0);
  }, ne = () => {
    M.set(!1);
  }, oe = () => {
    J();
  }, x = () => {
    te();
  }, ve = (se) => {
    I.set(se.target.checked);
  };
  return t.$$set = (se) => {
    "data" in se && l(0, b = se.data), "id" in se && l(1, g = se.id), "original_circuit_id" in se && l(22, v = se.original_circuit_id), "transpiled_circuit_id" in se && l(23, y = se.transpiled_circuit_id), "pulse_view_id" in se && l(24, k = se.pulse_view_id), "match" in se && l(25, w = se.match), "operation_data" in se && l(26, $ = se.operation_data), "machine_moment_at" in se && l(27, q = se.machine_moment_at), "machine_dt_at" in se && l(28, j = se.machine_dt_at), "op_schedule" in se && r(l(2, O = se.op_schedule)), "open_tool" in se && l(3, z = se.open_tool), "filter_unused_qubits" in se && l(29, N = se.filter_unused_qubits), "autoplay" in se && h(l(4, M = se.autoplay));
  }, t.$$.update = () => {
    var se;
    t.$$.dirty[0] & /*data, operation_data, id, original_circuit_id, transpiled_circuit_id, pulse_view_id, match, filter_unused_qubits, $drawPlan*/
    666894403 && b && (B.set(af(b, $, {
      id: g,
      original_circuit_id: v,
      transpiled_circuit_id: y,
      pulse_view_id: k,
      match: w,
      nodeColorScale: F,
      filter_unused_qubits: N
    })), (se = i == null ? void 0 : i.operations) == null || se.map((Re) => Re.duration).reduce((Re, Ce) => Re + Ce, 0), W(0)), t.$$.dirty[0] & /*$drawPlan, cost_shots*/
    96 && (l(7, ye = Lw(i.meta_info.cummul_duration, ee)), l(8, qe = ee * i.meta_info.cummul_duration));
  }, [
    b,
    g,
    O,
    z,
    M,
    ee,
    i,
    ye,
    qe,
    s,
    o,
    u,
    c,
    p,
    B,
    R,
    P,
    I,
    V,
    Q,
    J,
    te,
    v,
    y,
    k,
    w,
    $,
    q,
    j,
    N,
    je,
    fe,
    _e,
    K,
    ke,
    ue,
    ne,
    oe,
    x,
    ve
  ];
}
class r3 extends Ve {
  constructor(e) {
    super(), Qe(
      this,
      e,
      a3,
      i3,
      Le,
      {
        data: 0,
        id: 1,
        original_circuit_id: 22,
        transpiled_circuit_id: 23,
        pulse_view_id: 24,
        match: 25,
        operation_data: 26,
        machine_moment_at: 27,
        machine_dt_at: 28,
        op_schedule: 2,
        open_tool: 3,
        filter_unused_qubits: 29,
        autoplay: 4
      },
      null,
      [-1, -1]
    );
  }
}
function mf(t, e, l) {
  const i = t.slice();
  return i[4] = e[l], i;
}
function gf(t) {
  var a;
  let e, l, i = (
    /*backend*/
    ((a = t[0]) == null ? void 0 : a.machine_data) && bf(t)
  ), n = (
    /*params*/
    t[1] && vf(t)
  );
  return {
    c() {
      e = m("table"), i && i.c(), l = A(), n && n.c(), f(e, "class", "svelte-1yxnwb0");
    },
    m(r, s) {
      C(r, e, s), i && i.m(e, null), _(e, l), n && n.m(e, null);
    },
    p(r, s) {
      var o;
      /*backend*/
      (o = r[0]) != null && o.machine_data ? i ? i.p(r, s) : (i = bf(r), i.c(), i.m(e, l)) : i && (i.d(1), i = null), /*params*/
      r[1] ? n ? n.p(r, s) : (n = vf(r), n.c(), n.m(e, null)) : n && (n.d(1), n = null);
    },
    d(r) {
      r && T(e), i && i.d(), n && n.d();
    }
  };
}
function bf(t) {
  var k, w, $, q, j, O;
  let e, l, i, n, a = (
    /*backend*/
    ((w = (k = t[0]) == null ? void 0 : k.machine_data) == null ? void 0 : w.backend_name) + ""
  ), r, s, o = (
    /*backend*/
    ((q = ($ = t[0]) == null ? void 0 : $.machine_data) == null ? void 0 : q.backend_version) + ""
  ), u, c, d, h, p, b, g, v = (
    /*backend*/
    ((O = (j = t[0]) == null ? void 0 : j.machine_data) == null ? void 0 : O.gates.map(wf).join(", ")) + ""
  ), y;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Backend", i = A(), n = m("td"), r = E(a), s = E(" ("), u = E(o), c = E(")"), d = A(), h = m("tr"), p = m("th"), p.textContent = "Supported Gates", b = A(), g = m("td"), y = E(v), f(l, "class", "svelte-1yxnwb0"), f(n, "class", "svelte-1yxnwb0"), f(p, "class", "svelte-1yxnwb0"), f(g, "class", "svelte-1yxnwb0");
    },
    m(z, N) {
      C(z, e, N), _(e, l), _(e, i), _(e, n), _(n, r), _(n, s), _(n, u), _(n, c), C(z, d, N), C(z, h, N), _(h, p), _(h, b), _(h, g), _(g, y);
    },
    p(z, N) {
      var M, H, B, R, P, I;
      N & /*backend*/
      1 && a !== (a = /*backend*/
      ((H = (M = z[0]) == null ? void 0 : M.machine_data) == null ? void 0 : H.backend_name) + "") && Y(r, a), N & /*backend*/
      1 && o !== (o = /*backend*/
      ((R = (B = z[0]) == null ? void 0 : B.machine_data) == null ? void 0 : R.backend_version) + "") && Y(u, o), N & /*backend*/
      1 && v !== (v = /*backend*/
      ((I = (P = z[0]) == null ? void 0 : P.machine_data) == null ? void 0 : I.gates.map(wf).join(", ")) + "") && Y(y, v);
    },
    d(z) {
      z && (T(e), T(d), T(h));
    }
  };
}
function vf(t) {
  let e, l = we(Object.keys(
    /*params*/
    t[1]
  )), i = [];
  for (let n = 0; n < l.length; n += 1)
    i[n] = yf(mf(t, l, n));
  return {
    c() {
      for (let n = 0; n < i.length; n += 1)
        i[n].c();
      e = Be();
    },
    m(n, a) {
      for (let r = 0; r < i.length; r += 1)
        i[r] && i[r].m(n, a);
      C(n, e, a);
    },
    p(n, a) {
      if (a & /*params, Object, undefined*/
      2) {
        l = we(Object.keys(
          /*params*/
          n[1]
        ));
        let r;
        for (r = 0; r < l.length; r += 1) {
          const s = mf(n, l, r);
          i[r] ? i[r].p(s, a) : (i[r] = yf(s), i[r].c(), i[r].m(e.parentNode, e));
        }
        for (; r < i.length; r += 1)
          i[r].d(1);
        i.length = l.length;
      }
    },
    d(n) {
      n && T(e), Ge(i, n);
    }
  };
}
function kf(t) {
  let e, l, i = (
    /*key*/
    t[4] + ""
  ), n, a, r, s = (
    /*params*/
    t[1][
      /*key*/
      t[4]
    ] + ""
  ), o, u;
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = A(), r = m("td"), o = E(s), u = A(), f(l, "class", "svelte-1yxnwb0"), f(r, "class", "svelte-1yxnwb0");
    },
    m(c, d) {
      C(c, e, d), _(e, l), _(l, n), _(e, a), _(e, r), _(r, o), _(e, u);
    },
    p(c, d) {
      d & /*params*/
      2 && i !== (i = /*key*/
      c[4] + "") && Y(n, i), d & /*params*/
      2 && s !== (s = /*params*/
      c[1][
        /*key*/
        c[4]
      ] + "") && Y(o, s);
    },
    d(c) {
      c && T(e);
    }
  };
}
function yf(t) {
  let e, l = (
    /*params*/
    t[1][
      /*key*/
      t[4]
    ] != null && /*params*/
    t[1][
      /*key*/
      t[4]
    ] !== !1 && /*params*/
    t[1][
      /*key*/
      t[4]
    ] !== "default" && kf(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, n) {
      /*params*/
      i[1][
        /*key*/
        i[4]
      ] != null && /*params*/
      i[1][
        /*key*/
        i[4]
      ] !== !1 && /*params*/
      i[1][
        /*key*/
        i[4]
      ] !== "default" ? l ? l.p(i, n) : (l = kf(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function s3(t) {
  let e, l, i, n, a = (
    /*show*/
    t[2] ? "Close" : "Open"
  ), r, s, o, u, c = (
    /*show*/
    t[2] && gf(t)
  );
  return {
    c() {
      e = m("div"), l = m("h3"), i = E("Machine & transpilation information "), n = m("button"), r = E(a), s = A(), c && c.c(), f(n, "class", "svelte-1yxnwb0"), f(l, "class", "svelte-1yxnwb0"), f(e, "class", "machine-info-wrap svelte-1yxnwb0");
    },
    m(d, h) {
      C(d, e, h), _(e, l), _(l, i), _(l, n), _(n, r), _(e, s), c && c.m(e, null), o || (u = le(
        n,
        "click",
        /*click_handler*/
        t[3]
      ), o = !0);
    },
    p(d, [h]) {
      h & /*show*/
      4 && a !== (a = /*show*/
      d[2] ? "Close" : "Open") && Y(r, a), /*show*/
      d[2] ? c ? c.p(d, h) : (c = gf(d), c.c(), c.m(e, null)) : c && (c.d(1), c = null);
    },
    i: ae,
    o: ae,
    d(d) {
      d && T(e), c && c.d(), o = !1, u();
    }
  };
}
const wf = (t) => t.name;
function o3(t, e, l) {
  let { backend: i, params: n } = e, a = !0;
  const r = () => {
    l(2, a = !a);
  };
  return t.$$set = (s) => {
    "backend" in s && l(0, i = s.backend), "params" in s && l(1, n = s.params);
  }, [i, n, a, r];
}
class u3 extends Ve {
  constructor(e) {
    super(), Qe(this, e, o3, s3, Le, { backend: 0, params: 1 });
  }
}
function $f(t, e, l) {
  const i = t.slice();
  return i[2] = e[l], i[4] = l, i;
}
function qf(t, e, l) {
  const i = t.slice();
  return i[2] = e[l], i[4] = l, i;
}
function jf(t, e, l) {
  const i = t.slice();
  return i[2] = e[l], i[4] = l, i;
}
function Tf(t, e, l) {
  const i = t.slice();
  return i[7] = e[l], i;
}
function Cf(t, e, l) {
  const i = t.slice();
  return i[2] = e[l], i[4] = l, i;
}
function Sf(t, e, l) {
  const i = t.slice();
  return i[2] = e[l], i[4] = l, i;
}
function Mf(t, e, l) {
  const i = t.slice();
  return i[2] = e[l], i[4] = l, i;
}
function zf(t, e, l) {
  const i = t.slice();
  return i[2] = e[l], i[4] = l, i;
}
function Nf(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R, P, I, L, F, X, V, Q, J, te, ie, U, G, W, Z, ee, ye, qe = we(
    /*transpile_data*/
    t[0]
  ), je = [];
  for (let pe = 0; pe < qe.length; pe += 1)
    je[pe] = Af(zf(t, qe, pe));
  let fe = we(
    /*transpile_data*/
    t[0]
  ), _e = [];
  for (let pe = 0; pe < fe.length; pe += 1)
    _e[pe] = Bf(Mf(t, fe, pe));
  let K = we(
    /*transpile_data*/
    t[0]
  ), ke = [];
  for (let pe = 0; pe < K.length; pe += 1)
    ke[pe] = Pf(Sf(t, K, pe));
  let ue = we(
    /*specified_parameters*/
    t[1]
  ), ne = [];
  for (let pe = 0; pe < ue.length; pe += 1)
    ne[pe] = Of(Tf(t, ue, pe));
  let oe = we(
    /*transpile_data*/
    t[0]
  ), x = [];
  for (let pe = 0; pe < oe.length; pe += 1)
    x[pe] = If(jf(t, oe, pe));
  let ve = we(
    /*transpile_data*/
    t[0]
  ), se = [];
  for (let pe = 0; pe < ve.length; pe += 1)
    se[pe] = Df(qf(t, ve, pe));
  let Re = we(
    /*transpile_data*/
    t[0]
  ), Ce = [];
  for (let pe = 0; pe < Re.length; pe += 1)
    Ce[pe] = Rf($f(t, Re, pe));
  return {
    c() {
      e = m("table"), l = m("thead"), i = m("tr"), n = m("th"), a = A();
      for (let pe = 0; pe < je.length; pe += 1)
        je[pe].c();
      r = A(), s = m("tbody"), o = m("tr"), u = m("th"), u.textContent = "Backend", c = A(), d = m("td"), p = A(), b = m("tr"), g = m("th"), g.textContent = "Name", v = A();
      for (let pe = 0; pe < _e.length; pe += 1)
        _e[pe].c();
      y = A(), k = m("tr"), w = m("th"), w.textContent = "#Qubits", $ = A();
      for (let pe = 0; pe < ke.length; pe += 1)
        ke[pe].c();
      q = A(), j = m("tr"), O = m("th"), O.textContent = "Params", z = A(), N = m("td"), H = A();
      for (let pe = 0; pe < ne.length; pe += 1)
        ne[pe].c();
      B = A(), R = m("tr"), P = m("th"), P.textContent = "Post", I = A(), L = m("td"), X = A(), V = m("tr"), Q = m("th"), Q.textContent = "#Layers", J = A();
      for (let pe = 0; pe < x.length; pe += 1)
        x[pe].c();
      te = A(), ie = m("tr"), U = m("th"), U.textContent = "#Operations", G = A();
      for (let pe = 0; pe < se.length; pe += 1)
        se[pe].c();
      W = A(), Z = m("tr"), ee = m("th"), ee.textContent = "ESP", ye = A();
      for (let pe = 0; pe < Ce.length; pe += 1)
        Ce[pe].c();
      f(n, "class", "svelte-652jkj"), f(u, "class", "gap svelte-652jkj"), f(d, "colspan", h = /*transpile_data*/
      t[0].length || 0), f(d, "class", "gap svelte-652jkj"), f(g, "class", "svelte-652jkj"), f(w, "class", "svelte-652jkj"), f(O, "class", "gap svelte-652jkj"), f(N, "colspan", M = /*transpile_data*/
      t[0].length || 0), f(N, "class", "gap svelte-652jkj"), f(P, "class", "gap svelte-652jkj"), f(L, "colspan", F = /*transpile_data*/
      t[0].length || 0), f(L, "class", "gap svelte-652jkj"), f(Q, "class", "svelte-652jkj"), f(U, "class", "svelte-652jkj"), f(ee, "class", "svelte-652jkj"), f(e, "class", "svelte-652jkj");
    },
    m(pe, De) {
      C(pe, e, De), _(e, l), _(l, i), _(i, n), _(i, a);
      for (let re = 0; re < je.length; re += 1)
        je[re] && je[re].m(i, null);
      _(e, r), _(e, s), _(s, o), _(o, u), _(o, c), _(o, d), _(s, p), _(s, b), _(b, g), _(b, v);
      for (let re = 0; re < _e.length; re += 1)
        _e[re] && _e[re].m(b, null);
      _(s, y), _(s, k), _(k, w), _(k, $);
      for (let re = 0; re < ke.length; re += 1)
        ke[re] && ke[re].m(k, null);
      _(s, q), _(s, j), _(j, O), _(j, z), _(j, N), _(s, H);
      for (let re = 0; re < ne.length; re += 1)
        ne[re] && ne[re].m(s, null);
      _(s, B), _(s, R), _(R, P), _(R, I), _(R, L), _(s, X), _(s, V), _(V, Q), _(V, J);
      for (let re = 0; re < x.length; re += 1)
        x[re] && x[re].m(V, null);
      _(s, te), _(s, ie), _(ie, U), _(ie, G);
      for (let re = 0; re < se.length; re += 1)
        se[re] && se[re].m(ie, null);
      _(s, W), _(s, Z), _(Z, ee), _(Z, ye);
      for (let re = 0; re < Ce.length; re += 1)
        Ce[re] && Ce[re].m(Z, null);
    },
    p(pe, De) {
      if (De & /*transpile_data*/
      1) {
        qe = we(
          /*transpile_data*/
          pe[0]
        );
        let re;
        for (re = 0; re < qe.length; re += 1) {
          const Se = zf(pe, qe, re);
          je[re] ? je[re].p(Se, De) : (je[re] = Af(Se), je[re].c(), je[re].m(i, null));
        }
        for (; re < je.length; re += 1)
          je[re].d(1);
        je.length = qe.length;
      }
      if (De & /*transpile_data*/
      1 && h !== (h = /*transpile_data*/
      pe[0].length || 0) && f(d, "colspan", h), De & /*shorten_backend_name, transpile_data*/
      1) {
        fe = we(
          /*transpile_data*/
          pe[0]
        );
        let re;
        for (re = 0; re < fe.length; re += 1) {
          const Se = Mf(pe, fe, re);
          _e[re] ? _e[re].p(Se, De) : (_e[re] = Bf(Se), _e[re].c(), _e[re].m(b, null));
        }
        for (; re < _e.length; re += 1)
          _e[re].d(1);
        _e.length = fe.length;
      }
      if (De & /*transpile_data*/
      1) {
        K = we(
          /*transpile_data*/
          pe[0]
        );
        let re;
        for (re = 0; re < K.length; re += 1) {
          const Se = Sf(pe, K, re);
          ke[re] ? ke[re].p(Se, De) : (ke[re] = Pf(Se), ke[re].c(), ke[re].m(k, null));
        }
        for (; re < ke.length; re += 1)
          ke[re].d(1);
        ke.length = K.length;
      }
      if (De & /*transpile_data*/
      1 && M !== (M = /*transpile_data*/
      pe[0].length || 0) && f(N, "colspan", M), De & /*transpile_data, specified_parameters*/
      3) {
        ue = we(
          /*specified_parameters*/
          pe[1]
        );
        let re;
        for (re = 0; re < ue.length; re += 1) {
          const Se = Tf(pe, ue, re);
          ne[re] ? ne[re].p(Se, De) : (ne[re] = Of(Se), ne[re].c(), ne[re].m(s, B));
        }
        for (; re < ne.length; re += 1)
          ne[re].d(1);
        ne.length = ue.length;
      }
      if (De & /*transpile_data*/
      1 && F !== (F = /*transpile_data*/
      pe[0].length || 0) && f(L, "colspan", F), De & /*transpile_data*/
      1) {
        oe = we(
          /*transpile_data*/
          pe[0]
        );
        let re;
        for (re = 0; re < oe.length; re += 1) {
          const Se = jf(pe, oe, re);
          x[re] ? x[re].p(Se, De) : (x[re] = If(Se), x[re].c(), x[re].m(V, null));
        }
        for (; re < x.length; re += 1)
          x[re].d(1);
        x.length = oe.length;
      }
      if (De & /*transpile_data*/
      1) {
        ve = we(
          /*transpile_data*/
          pe[0]
        );
        let re;
        for (re = 0; re < ve.length; re += 1) {
          const Se = qf(pe, ve, re);
          se[re] ? se[re].p(Se, De) : (se[re] = Df(Se), se[re].c(), se[re].m(ie, null));
        }
        for (; re < se.length; re += 1)
          se[re].d(1);
        se.length = ve.length;
      }
      if (De & /*transpile_data*/
      1) {
        Re = we(
          /*transpile_data*/
          pe[0]
        );
        let re;
        for (re = 0; re < Re.length; re += 1) {
          const Se = $f(pe, Re, re);
          Ce[re] ? Ce[re].p(Se, De) : (Ce[re] = Rf(Se), Ce[re].c(), Ce[re].m(Z, null));
        }
        for (; re < Ce.length; re += 1)
          Ce[re].d(1);
        Ce.length = Re.length;
      }
    },
    d(pe) {
      pe && T(e), Ge(je, pe), Ge(_e, pe), Ge(ke, pe), Ge(ne, pe), Ge(x, pe), Ge(se, pe), Ge(Ce, pe);
    }
  };
}
function Af(t) {
  let e;
  return {
    c() {
      e = m("td"), e.textContent = `#${/*ti*/
      t[4]} `, f(e, "class", "svelte-652jkj");
    },
    m(l, i) {
      C(l, e, i);
    },
    p: ae,
    d(l) {
      l && T(e);
    }
  };
}
function Bf(t) {
  var a, r, s;
  let e, l = Ff(
    /*trans*/
    (s = (r = (a = t[2]) == null ? void 0 : a.backend) == null ? void 0 : r.machine_data) == null ? void 0 : s.backend_name
  ) + "", i, n;
  return {
    c() {
      e = m("td"), i = E(l), n = A(), f(e, "class", "svelte-652jkj");
    },
    m(o, u) {
      C(o, e, u), _(e, i), _(e, n);
    },
    p(o, u) {
      var c, d, h;
      u & /*transpile_data*/
      1 && l !== (l = Ff(
        /*trans*/
        (h = (d = (c = o[2]) == null ? void 0 : c.backend) == null ? void 0 : d.machine_data) == null ? void 0 : h.backend_name
      ) + "") && Y(i, l);
    },
    d(o) {
      o && T(e);
    }
  };
}
function Pf(t) {
  var a, r, s;
  let e, l = (
    /*trans*/
    ((s = (r = (a = t[2]) == null ? void 0 : a.backend) == null ? void 0 : r.design) == null ? void 0 : s.nodes.length) + ""
  ), i, n;
  return {
    c() {
      e = m("td"), i = E(l), n = A(), f(e, "class", "svelte-652jkj");
    },
    m(o, u) {
      C(o, e, u), _(e, i), _(e, n);
    },
    p(o, u) {
      var c, d, h;
      u & /*transpile_data*/
      1 && l !== (l = /*trans*/
      ((h = (d = (c = o[2]) == null ? void 0 : c.backend) == null ? void 0 : d.design) == null ? void 0 : h.nodes.length) + "") && Y(i, l);
    },
    d(o) {
      o && T(e);
    }
  };
}
function Ef(t) {
  var n, a;
  let e, l = (
    /*trans*/
    ((a = (n = t[2]) == null ? void 0 : n.transpile_param) == null ? void 0 : a[
      /*key*/
      t[7]
    ]) + ""
  ), i;
  return {
    c() {
      e = m("td"), i = E(l), f(e, "class", "svelte-652jkj");
    },
    m(r, s) {
      C(r, e, s), _(e, i);
    },
    p(r, s) {
      var o, u;
      s & /*transpile_data, specified_parameters*/
      3 && l !== (l = /*trans*/
      ((u = (o = r[2]) == null ? void 0 : o.transpile_param) == null ? void 0 : u[
        /*key*/
        r[7]
      ]) + "") && Y(i, l);
    },
    d(r) {
      r && T(e);
    }
  };
}
function Of(t) {
  let e, l, i = (
    /*key*/
    t[7] + ""
  ), n, a, r = we(
    /*transpile_data*/
    t[0]
  ), s = [];
  for (let o = 0; o < r.length; o += 1)
    s[o] = Ef(Cf(t, r, o));
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = A();
      for (let o = 0; o < s.length; o += 1)
        s[o].c();
      f(l, "class", "svelte-652jkj");
    },
    m(o, u) {
      C(o, e, u), _(e, l), _(l, n), _(e, a);
      for (let c = 0; c < s.length; c += 1)
        s[c] && s[c].m(e, null);
    },
    p(o, u) {
      if (u & /*specified_parameters*/
      2 && i !== (i = /*key*/
      o[7] + "") && Y(n, i), u & /*transpile_data, specified_parameters*/
      3) {
        r = we(
          /*transpile_data*/
          o[0]
        );
        let c;
        for (c = 0; c < r.length; c += 1) {
          const d = Cf(o, r, c);
          s[c] ? s[c].p(d, u) : (s[c] = Ef(d), s[c].c(), s[c].m(e, null));
        }
        for (; c < s.length; c += 1)
          s[c].d(1);
        s.length = r.length;
      }
    },
    d(o) {
      o && T(e), Ge(s, o);
    }
  };
}
function If(t) {
  var a, r;
  let e, l = (
    /*trans*/
    ((r = (a = t[2]) == null ? void 0 : a.layers) == null ? void 0 : r.length) + ""
  ), i, n;
  return {
    c() {
      e = m("td"), i = E(l), n = A(), f(e, "class", "svelte-652jkj");
    },
    m(s, o) {
      C(s, e, o), _(e, i), _(e, n);
    },
    p(s, o) {
      var u, c;
      o & /*transpile_data*/
      1 && l !== (l = /*trans*/
      ((c = (u = s[2]) == null ? void 0 : u.layers) == null ? void 0 : c.length) + "") && Y(i, l);
    },
    d(s) {
      s && T(e);
    }
  };
}
function Df(t) {
  var a, r;
  let e, l = (
    /*trans*/
    ((r = (a = t[2]) == null ? void 0 : a.layers) == null ? void 0 : r.map(Lf).reduce(Qf, 0)) + ""
  ), i, n;
  return {
    c() {
      e = m("td"), i = E(l), n = A(), f(e, "class", "svelte-652jkj");
    },
    m(s, o) {
      C(s, e, o), _(e, i), _(e, n);
    },
    p(s, o) {
      var u, c;
      o & /*transpile_data*/
      1 && l !== (l = /*trans*/
      ((c = (u = s[2]) == null ? void 0 : u.layers) == null ? void 0 : c.map(Lf).reduce(Qf, 0)) + "") && Y(i, l);
    },
    d(s) {
      s && T(e);
    }
  };
}
function Rf(t) {
  var a;
  let e, l = fs(
    /*trans*/
    (a = t[2]) == null ? void 0 : a.esp,
    8
  ) + "", i, n;
  return {
    c() {
      e = m("td"), i = E(l), n = A(), f(e, "class", "svelte-652jkj");
    },
    m(r, s) {
      C(r, e, s), _(e, i), _(e, n);
    },
    p(r, s) {
      var o;
      s & /*transpile_data*/
      1 && l !== (l = fs(
        /*trans*/
        (o = r[2]) == null ? void 0 : o.esp,
        8
      ) + "") && Y(i, l);
    },
    d(r) {
      r && T(e);
    }
  };
}
function f3(t) {
  let e, l = (
    /*transpile_data*/
    t[0] && Nf(t)
  );
  return {
    c() {
      e = m("div"), l && l.c(), f(e, "class", "svelte-652jkj");
    },
    m(i, n) {
      C(i, e, n), l && l.m(e, null);
    },
    p(i, [n]) {
      /*transpile_data*/
      i[0] ? l ? l.p(i, n) : (l = Nf(i), l.c(), l.m(e, null)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d();
    }
  };
}
function Hf(t) {
  var l;
  let e = [];
  for (let i of Object.keys(((l = t == null ? void 0 : t[0]) == null ? void 0 : l.transpile_param) || {}))
    t.some((n) => n.transpile_param[i] != null && n.transpile_param[i] !== !1 && n.transpile_param[i] !== "default") && e.push(i);
  return e;
}
function Ff(t) {
  let e = t;
  return e = e.replace("ibmq_", ""), e = e.replace("ibm_", ""), e = e.replace("fake_", ""), e = e.replace("aer_simulator_from(", ""), e = e.replace(/\)$/gi, ""), e;
}
const Lf = (t) => t.operations.length, Qf = (t, e) => t + e;
function _3(t, e, l) {
  let { transpile_data: i = [] } = e, n = [];
  return yt(() => {
    l(1, n = Hf(i));
  }), t.$$set = (a) => {
    "transpile_data" in a && l(0, i = a.transpile_data);
  }, t.$$.update = () => {
    t.$$.dirty & /*transpile_data*/
    1 && l(1, n = Hf(i));
  }, [i, n];
}
class c3 extends Ve {
  constructor(e) {
    super(), Qe(this, e, _3, f3, Le, { transpile_data: 0 });
  }
}
function Vf(t, e) {
  let l = 0, i = [], n = [], a = {}, r = 0;
  for (const s of t) {
    let o = 0, u = 0;
    for (const c of s.operations) {
      let d = c.gate, h = c.qubits.map((g) => g.index), p = d + "__" + h.join("_"), b = e == null ? void 0 : e[p];
      if (b) {
        o = b.duration > o ? b.duration : o;
        for (const g of b.pulse_schedule) {
          let v = JSON.parse(JSON.stringify(g));
          v.time_at = v.time_at + l, v.layer_index = r, v.op_index = u, i.push(v), a[v.name] || (a[v.name] = {
            name: v.name,
            channel_type: v.channel_type,
            channel_index: v.channel_index,
            component_type: v.component_type,
            pulse_type: v.pulse_type
          });
        }
      }
      u++;
    }
    l += o, n.push(l), r++;
  }
  return n.unshift(0), { schedule: i, channels: a, operation_schedule: n };
}
function Xf(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z;
  return {
    c() {
      e = m("div"), l = m("div"), i = m("button"), n = E("Width: 1/"), a = E(
        /*$unit_dt*/
        t[9]
      ), r = A(), s = m("button"), s.textContent = "←", o = A(), u = m("button"), u.textContent = "→", c = A(), d = m("button"), d.textContent = "↺", h = A(), p = m("div"), b = m("button"), g = E("Height: "), v = E(
        /*$pulse_row_height*/
        t[10]
      ), y = A(), k = m("button"), k.textContent = "↑", w = A(), $ = m("button"), $.textContent = "↓", q = A(), j = m("button"), j.textContent = "↺", i.disabled = !0, f(i, "class", "svelte-wurcqz"), f(s, "alt", "narrower"), f(s, "class", "svelte-wurcqz"), f(u, "alt", "wider"), f(u, "class", "svelte-wurcqz"), f(d, "class", "svelte-wurcqz"), f(l, "class", "sizing-button-wrap svelte-wurcqz"), b.disabled = !0, f(b, "class", "svelte-wurcqz"), f(k, "alt", "shallower"), f(k, "class", "svelte-wurcqz"), f($, "alt", "deeper"), f($, "class", "svelte-wurcqz"), f(j, "alt", "reset"), f(j, "class", "svelte-wurcqz"), f(p, "class", "sizing-button-wrap svelte-wurcqz"), f(e, "class", "sizing-options svelte-wurcqz");
    },
    m(N, M) {
      C(N, e, M), _(e, l), _(l, i), _(i, n), _(i, a), _(l, r), _(l, s), _(l, o), _(l, u), _(l, c), _(l, d), _(e, h), _(e, p), _(p, b), _(b, g), _(b, v), _(p, y), _(p, k), _(p, w), _(p, $), _(p, q), _(p, j), O || (z = [
        le(
          s,
          "click",
          /*click_handler_2*/
          t[23]
        ),
        le(
          u,
          "click",
          /*click_handler_3*/
          t[24]
        ),
        le(
          d,
          "click",
          /*click_handler_4*/
          t[25]
        ),
        le(
          k,
          "click",
          /*click_handler_5*/
          t[26]
        ),
        le(
          $,
          "click",
          /*click_handler_6*/
          t[27]
        ),
        le(
          j,
          "click",
          /*click_handler_7*/
          t[28]
        )
      ], O = !0);
    },
    p(N, M) {
      M[0] & /*$unit_dt*/
      512 && Y(
        a,
        /*$unit_dt*/
        N[9]
      ), M[0] & /*$pulse_row_height*/
      1024 && Y(
        v,
        /*$pulse_row_height*/
        N[10]
      );
    },
    d(N) {
      N && T(e), O = !1, vt(z);
    }
  };
}
function Gf(t) {
  var O, z, N, M, H;
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q = (
    /*$drawPlan*/
    t[11].groups.axis_group && Yf(t)
  ), j = (
    /*$drawPlan*/
    t[11].groups.area_group && Kf(t)
  );
  return g = new Nm({
    props: {
      data: {
        id: (
          /*id*/
          t[0] + "-dt-marker-text"
        ),
        x: Ie + Bt + Ze - 1 + /*$drawPlan*/
        ((O = t[11].scales) == null ? void 0 : O.dt_scale(
          /*$machine_dt_at*/
          t[12]
        )) + /*$drawPlan*/
        (((z = t[11].scales) == null ? void 0 : z.dt_scale(
          /*$machine_dt_at*/
          t[12]
        )) > /*$drawPlan*/
        t[11].groups.area_group.width * 0.8 ? -5 : 5),
        y: 10,
        "font-size": 10,
        "alignment-baseline": "bottom",
        "text-anchor": (
          /*$drawPlan*/
          ((N = t[11].scales) == null ? void 0 : N.dt_scale(
            /*$machine_dt_at*/
            t[12]
          )) > /*$drawPlan*/
          t[11].groups.area_group.width * 0.8 ? "end" : "start"
        ),
        text: "Layer " + /*$machine_moment_at*/
        t[13] + "/" + /*$machine_dt_at*/
        t[12] + " (dt)"
      }
    }
  }), v = new zm({
    props: {
      data: {
        id: (
          /*id*/
          t[0] + "-dt-marker"
        ),
        x1: Ie + Bt + Ze - 1 + /*$drawPlan*/
        ((M = t[11].scales) == null ? void 0 : M.dt_scale(
          /*$machine_dt_at*/
          t[12]
        )),
        x2: Ie + Bt + Ze - 1 + /*$drawPlan*/
        ((H = t[11].scales) == null ? void 0 : H.dt_scale(
          /*$machine_dt_at*/
          t[12]
        )),
        y1: 0,
        y2: (
          /*$drawPlan*/
          t[11].height
        ),
        "stroke-width": 2,
        stroke: "red",
        "stroke-opacity": 0.5,
        animate: { duration: 20, delay: 0 }
      }
    }
  }), {
    c() {
      e = m("div"), l = Xe("svg"), i = Xe("style"), n = E(`g {
            font-family: Iosevka;
            font-size: 14px;
          }
        `), q && q.c(), u = A(), c = m("div"), d = Xe("svg"), h = Xe("style"), p = E(`g {
            font-family: Iosevka;
            font-size: 14px;
          }
        `), j && j.c(), b = Xe("g"), he(g.$$.fragment), he(v.$$.fragment), f(l, "id", a = /*id*/
      t[0] + "-sticky"), f(l, "class", "sticky-axis"), f(l, "width", Ie + Bt), f(l, "height", r = /*$drawPlan*/
      t[11].height), f(l, "viewBox", s = [
        0,
        0,
        Ie + Bt,
        /*$drawPlan*/
        t[11].height
      ].join(" ")), f(e, "class", "pulse-sticky svelte-wurcqz"), f(e, "style", o = `width: ${Ie + Bt}px; height:${Ie + /*$drawPlan*/
      t[11].height}px;`), f(
        d,
        "id",
        /*id*/
        t[0]
      ), f(d, "width", y = /*$drawPlan*/
      t[11].width), f(d, "height", k = /*$drawPlan*/
      t[11].height), f(d, "viewBox", w = /*$drawPlan*/
      t[11].viewBox.join(" ")), f(c, "class", "pulse-main svelte-wurcqz");
    },
    m(B, R) {
      C(B, e, R), _(e, l), _(l, i), _(i, n), q && q.m(l, null), C(B, u, R), C(B, c, R), _(c, d), _(d, h), _(h, p), j && j.m(d, null), _(d, b), ce(g, b, null), ce(v, b, null), $ = !0;
    },
    p(B, R) {
      var L, F, X, V, Q;
      /*$drawPlan*/
      B[11].groups.axis_group ? q ? (q.p(B, R), R[0] & /*$drawPlan*/
      2048 && S(q, 1)) : (q = Yf(B), q.c(), S(q, 1), q.m(l, null)) : q && (ge(), D(q, 1, 1, () => {
        q = null;
      }), be()), (!$ || R[0] & /*id*/
      1 && a !== (a = /*id*/
      B[0] + "-sticky")) && f(l, "id", a), (!$ || R[0] & /*$drawPlan*/
      2048 && r !== (r = /*$drawPlan*/
      B[11].height)) && f(l, "height", r), (!$ || R[0] & /*$drawPlan*/
      2048 && s !== (s = [
        0,
        0,
        Ie + Bt,
        /*$drawPlan*/
        B[11].height
      ].join(" "))) && f(l, "viewBox", s), (!$ || R[0] & /*$drawPlan*/
      2048 && o !== (o = `width: ${Ie + Bt}px; height:${Ie + /*$drawPlan*/
      B[11].height}px;`)) && f(e, "style", o), /*$drawPlan*/
      B[11].groups.area_group ? j ? (j.p(B, R), R[0] & /*$drawPlan*/
      2048 && S(j, 1)) : (j = Kf(B), j.c(), S(j, 1), j.m(d, b)) : j && (ge(), D(j, 1, 1, () => {
        j = null;
      }), be());
      const P = {};
      R[0] & /*id, $drawPlan, $machine_dt_at, $machine_moment_at*/
      14337 && (P.data = {
        id: (
          /*id*/
          B[0] + "-dt-marker-text"
        ),
        x: Ie + Bt + Ze - 1 + /*$drawPlan*/
        ((L = B[11].scales) == null ? void 0 : L.dt_scale(
          /*$machine_dt_at*/
          B[12]
        )) + /*$drawPlan*/
        (((F = B[11].scales) == null ? void 0 : F.dt_scale(
          /*$machine_dt_at*/
          B[12]
        )) > /*$drawPlan*/
        B[11].groups.area_group.width * 0.8 ? -5 : 5),
        y: 10,
        "font-size": 10,
        "alignment-baseline": "bottom",
        "text-anchor": (
          /*$drawPlan*/
          ((X = B[11].scales) == null ? void 0 : X.dt_scale(
            /*$machine_dt_at*/
            B[12]
          )) > /*$drawPlan*/
          B[11].groups.area_group.width * 0.8 ? "end" : "start"
        ),
        text: "Layer " + /*$machine_moment_at*/
        B[13] + "/" + /*$machine_dt_at*/
        B[12] + " (dt)"
      }), g.$set(P);
      const I = {};
      R[0] & /*id, $drawPlan, $machine_dt_at*/
      6145 && (I.data = {
        id: (
          /*id*/
          B[0] + "-dt-marker"
        ),
        x1: Ie + Bt + Ze - 1 + /*$drawPlan*/
        ((V = B[11].scales) == null ? void 0 : V.dt_scale(
          /*$machine_dt_at*/
          B[12]
        )),
        x2: Ie + Bt + Ze - 1 + /*$drawPlan*/
        ((Q = B[11].scales) == null ? void 0 : Q.dt_scale(
          /*$machine_dt_at*/
          B[12]
        )),
        y1: 0,
        y2: (
          /*$drawPlan*/
          B[11].height
        ),
        "stroke-width": 2,
        stroke: "red",
        "stroke-opacity": 0.5,
        animate: { duration: 20, delay: 0 }
      }), v.$set(I), (!$ || R[0] & /*id*/
      1) && f(
        d,
        "id",
        /*id*/
        B[0]
      ), (!$ || R[0] & /*$drawPlan*/
      2048 && y !== (y = /*$drawPlan*/
      B[11].width)) && f(d, "width", y), (!$ || R[0] & /*$drawPlan*/
      2048 && k !== (k = /*$drawPlan*/
      B[11].height)) && f(d, "height", k), (!$ || R[0] & /*$drawPlan*/
      2048 && w !== (w = /*$drawPlan*/
      B[11].viewBox.join(" "))) && f(d, "viewBox", w);
    },
    i(B) {
      $ || (S(q), S(j), S(g.$$.fragment, B), S(v.$$.fragment, B), $ = !0);
    },
    o(B) {
      D(q), D(j), D(g.$$.fragment, B), D(v.$$.fragment, B), $ = !1;
    },
    d(B) {
      B && (T(e), T(u), T(c)), q && q.d(), j && j.d(), de(g), de(v);
    }
  };
}
function Yf(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[11].groups.axis_group
      ),
      open_tool: (
        /*open_tool*/
        t[5]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*$drawPlan*/
      2048 && (a.data = /*$drawPlan*/
      i[11].groups.axis_group), n[0] & /*open_tool*/
      32 && (a.open_tool = /*open_tool*/
      i[5]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Kf(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[11].groups.area_group
      ),
      open_tool: (
        /*open_tool*/
        t[5]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*$drawPlan*/
      2048 && (a.data = /*$drawPlan*/
      i[11].groups.area_group), n[0] & /*open_tool*/
      32 && (a.open_tool = /*open_tool*/
      i[5]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function d3(t) {
  let e, l, i, n, a = (
    /*showPulseView*/
    t[8] ? "Hide" : "Show"
  ), r, s, o, u, c = (
    /*showViewControl*/
    t[7] ? "Hide" : "Show"
  ), d, h, p, b, g, v, y, k, w, $ = (
    /*showViewControl*/
    t[7] && Xf(t)
  ), q = (
    /*circuit_layers*/
    t[1] && /*pulse_data*/
    t[2] && /*$drawPlan*/
    t[11] && /*showPulseView*/
    t[8] && Gf(t)
  );
  return {
    c() {
      e = m("div"), l = m("h5"), i = E(`Pulse data view
    `), n = m("button"), r = E(a), s = E(" pulse data"), o = A(), u = m("button"), d = E(c), h = E(" view control"), p = A(), $ && $.c(), b = A(), g = m("div"), q && q.c(), f(n, "class", "svelte-wurcqz"), f(u, "class", "svelte-wurcqz"), f(l, "class", "svelte-wurcqz"), f(g, "class", "pulse-vis-wrap svelte-wurcqz"), f(g, "id", v = /*id*/
      t[0] + "-wrapper");
    },
    m(j, O) {
      C(j, e, O), _(e, l), _(l, i), _(l, n), _(n, r), _(n, s), _(l, o), _(l, u), _(u, d), _(u, h), _(e, p), $ && $.m(e, null), C(j, b, O), C(j, g, O), q && q.m(g, null), y = !0, k || (w = [
        le(
          n,
          "click",
          /*click_handler*/
          t[21]
        ),
        le(
          u,
          "click",
          /*click_handler_1*/
          t[22]
        )
      ], k = !0);
    },
    p(j, O) {
      (!y || O[0] & /*showPulseView*/
      256) && a !== (a = /*showPulseView*/
      j[8] ? "Hide" : "Show") && Y(r, a), (!y || O[0] & /*showViewControl*/
      128) && c !== (c = /*showViewControl*/
      j[7] ? "Hide" : "Show") && Y(d, c), /*showViewControl*/
      j[7] ? $ ? $.p(j, O) : ($ = Xf(j), $.c(), $.m(e, null)) : $ && ($.d(1), $ = null), /*circuit_layers*/
      j[1] && /*pulse_data*/
      j[2] && /*$drawPlan*/
      j[11] && /*showPulseView*/
      j[8] ? q ? (q.p(j, O), O[0] & /*circuit_layers, pulse_data, $drawPlan, showPulseView*/
      2310 && S(q, 1)) : (q = Gf(j), q.c(), S(q, 1), q.m(g, null)) : q && (ge(), D(q, 1, 1, () => {
        q = null;
      }), be()), (!y || O[0] & /*id*/
      1 && v !== (v = /*id*/
      j[0] + "-wrapper")) && f(g, "id", v);
    },
    i(j) {
      y || (S(q), y = !0);
    },
    o(j) {
      D(q), y = !1;
    },
    d(j) {
      j && (T(e), T(b), T(g)), $ && $.d(), q && q.d(), k = !1, vt(w);
    }
  };
}
function h3(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(N, (G) => l(30, i = G)), N), r, s, o, u, c, d = ae, h = () => (d(), d = rt(j, (G) => l(12, c = G)), j), p, b = ae, g = () => (b(), b = rt(q, (G) => l(13, p = G)), q);
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => d()), t.$$.on_destroy.push(() => b());
  let { id: v, transpiled_circuit_id: y, original_circuit_id: k, circuit_layers: w, pulse_data: $, machine_moment_at: q = Pe(0), machine_dt_at: j = Pe(0), op_schedule: O = Pe([]), open_tool: z = () => {
  }, autoplay: N = Pe(!1) } = e;
  g(), h(), a();
  let M = Pe(10), H = Pe(25);
  at(t, M, (G) => l(9, r = G)), at(t, H, (G) => l(10, o = G));
  let B = Pe([]), R = {}, P = Pe();
  at(t, B, (G) => l(31, s = G)), at(t, P, (G) => l(11, u = G)), yt(() => {
    B.subscribe((ee) => {
      P.set(yr(ee, R, {
        unit_dt: r,
        pulse_row_height: o
      }));
    }), M.subscribe((ee) => {
      P.set(yr(s, R, {
        unit_dt: ee,
        pulse_row_height: o
      }));
    }), H.subscribe((ee) => {
      P.set(yr(s, R, { unit_dt: r, pulse_row_height: ee }));
    });
    let { schedule: G, channels: W, operation_schedule: Z } = Vf(w, $);
    R = W, B.set(G), O.set(Z), j.subscribe((ee) => {
      setTimeout(
        () => {
          var qe, je, fe, _e;
          let ye = document.querySelector("#" + v + "-dt-marker");
          if (ye) {
            let K = document.querySelector("#" + v + "-wrapper"), ke = document.querySelector("#" + v + "-sticky"), ue = (qe = K.getClientRects()[0]) == null ? void 0 : qe.left, ne = (je = K.getClientRects()[0]) == null ? void 0 : je.width, oe = (fe = ke.getClientRects()[0]) == null ? void 0 : fe.width, x = ((_e = ye.getClientRects()[0]) == null ? void 0 : _e.left) - ue - oe, ve = 2;
            x < 0 ? K.scrollBy({
              top: 0,
              left: -ne / 3,
              behavior: i ? "instant" : "smooth"
            }) : x + ve > ne - oe && K.scrollBy({
              top: 0,
              left: ne / 3,
              behavior: i ? "instant" : "smooth"
            });
          }
        },
        50
      );
    });
  });
  let I = !1, L = !0;
  const F = () => {
    l(8, L = !L);
  }, X = () => {
    l(7, I = !I);
  }, V = () => {
    M.update((G) => Math.min(G + 2, 20));
  }, Q = () => {
    M.update((G) => Math.max(G - 2, 1));
  }, J = () => {
    M.set(wg);
  }, te = () => {
    H.update((G) => Math.max(G - 2, 10));
  }, ie = () => {
    H.update((G) => Math.min(G + 2, 100));
  }, U = () => {
    H.set(Bt);
  };
  return t.$$set = (G) => {
    "id" in G && l(0, v = G.id), "transpiled_circuit_id" in G && l(18, y = G.transpiled_circuit_id), "original_circuit_id" in G && l(19, k = G.original_circuit_id), "circuit_layers" in G && l(1, w = G.circuit_layers), "pulse_data" in G && l(2, $ = G.pulse_data), "machine_moment_at" in G && g(l(3, q = G.machine_moment_at)), "machine_dt_at" in G && h(l(4, j = G.machine_dt_at)), "op_schedule" in G && l(20, O = G.op_schedule), "open_tool" in G && l(5, z = G.open_tool), "autoplay" in G && a(l(6, N = G.autoplay));
  }, t.$$.update = () => {
    if (t.$$.dirty[0] & /*circuit_layers, pulse_data*/
    6) {
      let { schedule: G, channels: W } = Vf(w, $);
      R = W, B.set(G);
    }
  }, [
    v,
    w,
    $,
    q,
    j,
    z,
    N,
    I,
    L,
    r,
    o,
    u,
    c,
    p,
    M,
    H,
    B,
    P,
    y,
    k,
    O,
    F,
    X,
    V,
    Q,
    J,
    te,
    ie,
    U
  ];
}
class p3 extends Ve {
  constructor(e) {
    super(), Qe(
      this,
      e,
      h3,
      d3,
      Le,
      {
        id: 0,
        transpiled_circuit_id: 18,
        original_circuit_id: 19,
        circuit_layers: 1,
        pulse_data: 2,
        machine_moment_at: 3,
        machine_dt_at: 4,
        op_schedule: 20,
        open_tool: 5,
        autoplay: 6
      },
      null,
      [-1, -1]
    );
  }
}
function Uf(t, e, l) {
  const i = t.slice();
  return i[37] = e[l], i[39] = l, i;
}
function Wf(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("a"), l = E("PNG"), n = A(), a = m("a"), r = E("SVG"), f(e, "class", "save-download svelte-ttpui0"), f(e, "href", i = /*images*/
      t[6]["original-circuit"].png), f(e, "download", ""), f(a, "class", "save-download svelte-ttpui0"), f(a, "href", s = /*images*/
      t[6]["original-circuit"].svg), f(a, "download", "");
    },
    m(o, u) {
      C(o, e, u), _(e, l), C(o, n, u), C(o, a, u), _(a, r);
    },
    p(o, u) {
      u[0] & /*images*/
      64 && i !== (i = /*images*/
      o[6]["original-circuit"].png) && f(e, "href", i), u[0] & /*images*/
      64 && s !== (s = /*images*/
      o[6]["original-circuit"].svg) && f(a, "href", s);
    },
    d(o) {
      o && (T(e), T(n), T(a));
    }
  };
}
function Jf(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("span"), e.textContent = "QASM2:", l = A(), i = m("button"), i.textContent = "Copy", n = A(), a = m("button"), a.textContent = "Show", f(e, "class", "save-make-label svelte-ttpui0"), f(i, "class", "save-make svelte-ttpui0"), f(a, "class", "save-make svelte-ttpui0");
    },
    m(o, u) {
      C(o, e, u), C(o, l, u), C(o, i, u), C(o, n, u), C(o, a, u), r || (s = [
        le(
          i,
          "click",
          /*click_handler_1*/
          t[19]
        ),
        le(
          a,
          "click",
          /*click_handler_2*/
          t[20]
        )
      ], r = !0);
    },
    p: ae,
    d(o) {
      o && (T(e), T(l), T(i), T(n), T(a)), r = !1, vt(s);
    }
  };
}
function Zf(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("span"), e.textContent = "QASM3:", l = A(), i = m("button"), i.textContent = "Copy", n = A(), a = m("button"), a.textContent = "Show", f(e, "class", "save-make-label svelte-ttpui0"), f(i, "class", "save-make svelte-ttpui0"), f(a, "class", "save-make svelte-ttpui0");
    },
    m(o, u) {
      C(o, e, u), C(o, l, u), C(o, i, u), C(o, n, u), C(o, a, u), r || (s = [
        le(
          i,
          "click",
          /*click_handler_3*/
          t[21]
        ),
        le(
          a,
          "click",
          /*click_handler_4*/
          t[22]
        )
      ], r = !0);
    },
    p: ae,
    d(o) {
      o && (T(e), T(l), T(i), T(n), T(a)), r = !1, vt(s);
    }
  };
}
function xf(t) {
  var n;
  let e, l, i;
  return l = new c3({
    props: {
      transpile_data: (
        /*$data*/
        (n = t[8]) == null ? void 0 : n.transpiled
      )
    }
  }), {
    c() {
      e = m("div"), he(l.$$.fragment), f(e, "class", "info-section-wrap svelte-ttpui0");
    },
    m(a, r) {
      C(a, e, r), ce(l, e, null), i = !0;
    },
    p(a, r) {
      var o;
      const s = {};
      r[0] & /*$data*/
      256 && (s.transpile_data = /*$data*/
      (o = a[8]) == null ? void 0 : o.transpiled), l.$set(s);
    },
    i(a) {
      i || (S(l.$$.fragment, a), i = !0);
    },
    o(a) {
      D(l.$$.fragment, a), i = !1;
    },
    d(a) {
      a && T(e), de(l);
    }
  };
}
function e_(t) {
  let e, l;
  return e = new Hw({
    props: {
      info: (
        /*$selected_info*/
        t[10].data
      ),
      machine_moment_at: (
        /*machine_moment_at*/
        t[0][
          /*$transpile_at*/
          t[9]
        ]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*$selected_info*/
      1024 && (a.info = /*$selected_info*/
      i[10].data), n[0] & /*machine_moment_at, $transpile_at*/
      513 && (a.machine_moment_at = /*machine_moment_at*/
      i[0][
        /*$transpile_at*/
        i[9]
      ]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function t_(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("a"), l = E("PNG"), n = A(), a = m("a"), r = E("SVG"), f(e, "class", "save-download svelte-ttpui0"), f(e, "href", i = /*images*/
      t[6]["transpiled-circuit-" + /*ti*/
      t[39]].png), f(e, "download", ""), f(a, "class", "save-download svelte-ttpui0"), f(a, "href", s = /*images*/
      t[6]["transpiled-circuit-" + /*ti*/
      t[39]].svg), f(a, "download", "");
    },
    m(o, u) {
      C(o, e, u), _(e, l), C(o, n, u), C(o, a, u), _(a, r);
    },
    p(o, u) {
      u[0] & /*images*/
      64 && i !== (i = /*images*/
      o[6]["transpiled-circuit-" + /*ti*/
      o[39]].png) && f(e, "href", i), u[0] & /*images*/
      64 && s !== (s = /*images*/
      o[6]["transpiled-circuit-" + /*ti*/
      o[39]].svg) && f(a, "href", s);
    },
    d(o) {
      o && (T(e), T(n), T(a));
    }
  };
}
function l_(t) {
  let e, l, i, n, a, r, s;
  function o(...c) {
    return (
      /*click_handler_8*/
      t[26](
        /*trans_circuit*/
        t[37],
        ...c
      )
    );
  }
  function u(...c) {
    return (
      /*click_handler_9*/
      t[27](
        /*ti*/
        t[39],
        /*trans_circuit*/
        t[37],
        ...c
      )
    );
  }
  return {
    c() {
      e = m("span"), e.textContent = "QASM2:", l = A(), i = m("button"), i.textContent = "Copy", n = A(), a = m("button"), a.textContent = "Show", f(e, "class", "save-make-label svelte-ttpui0"), f(i, "class", "save-make svelte-ttpui0"), f(a, "class", "save-make svelte-ttpui0");
    },
    m(c, d) {
      C(c, e, d), C(c, l, d), C(c, i, d), C(c, n, d), C(c, a, d), r || (s = [
        le(i, "click", o),
        le(a, "click", u)
      ], r = !0);
    },
    p(c, d) {
      t = c;
    },
    d(c) {
      c && (T(e), T(l), T(i), T(n), T(a)), r = !1, vt(s);
    }
  };
}
function i_(t) {
  let e, l, i, n, a, r, s;
  function o(...c) {
    return (
      /*click_handler_10*/
      t[28](
        /*trans_circuit*/
        t[37],
        ...c
      )
    );
  }
  function u(...c) {
    return (
      /*click_handler_11*/
      t[29](
        /*ti*/
        t[39],
        /*trans_circuit*/
        t[37],
        ...c
      )
    );
  }
  return {
    c() {
      e = m("span"), e.textContent = "QASM3:", l = A(), i = m("button"), i.textContent = "Copy", n = A(), a = m("button"), a.textContent = "Show", f(e, "class", "save-make-label svelte-ttpui0"), f(i, "class", "save-make svelte-ttpui0"), f(a, "class", "save-make svelte-ttpui0");
    },
    m(c, d) {
      C(c, e, d), C(c, l, d), C(c, i, d), C(c, n, d), C(c, a, d), r || (s = [
        le(i, "click", o),
        le(a, "click", u)
      ], r = !0);
    },
    p(c, d) {
      t = c;
    },
    d(c) {
      c && (T(e), T(l), T(i), T(n), T(a)), r = !1, vt(s);
    }
  };
}
function n_(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("a"), l = E("PNG"), n = A(), a = m("a"), r = E("SVG"), f(e, "class", "save-download svelte-ttpui0"), f(e, "href", i = /*images*/
      t[6]["on-machine-" + /*ti*/
      t[39]].png), f(e, "download", ""), f(a, "class", "save-download svelte-ttpui0"), f(a, "href", s = /*images*/
      t[6]["on-machine-" + /*ti*/
      t[39]].svg), f(a, "download", "");
    },
    m(o, u) {
      C(o, e, u), _(e, l), C(o, n, u), C(o, a, u), _(a, r);
    },
    p(o, u) {
      u[0] & /*images*/
      64 && i !== (i = /*images*/
      o[6]["on-machine-" + /*ti*/
      o[39]].png) && f(e, "href", i), u[0] & /*images*/
      64 && s !== (s = /*images*/
      o[6]["on-machine-" + /*ti*/
      o[39]].svg) && f(a, "href", s);
    },
    d(o) {
      o && (T(e), T(n), T(a));
    }
  };
}
function a_(t) {
  var qe, je, fe, _e, K, ke, ue;
  let e, l, i, n, a = (
    /*ti*/
    t[39] + 1 + ""
  ), r, s, o, u = (
    /*filter_unused_qubits*/
    t[5][
      /*ti*/
      t[39]
    ] ? "Show" : "Filter"
  ), c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R, P, I, L, F, X, V, Q;
  function J(...ne) {
    return (
      /*click_handler_6*/
      t[24](
        /*ti*/
        t[39],
        ...ne
      )
    );
  }
  function te(...ne) {
    return (
      /*click_handler_7*/
      t[25](
        /*ti*/
        t[39],
        ...ne
      )
    );
  }
  let ie = (
    /*images*/
    t[6]["transpiled-circuit-" + /*ti*/
    t[39]] && t_(t)
  ), U = (
    /*trans_circuit*/
    ((qe = t[37]) == null ? void 0 : qe.qasm2) && l_(t)
  ), G = (
    /*trans_circuit*/
    ((je = t[37]) == null ? void 0 : je.qasm3) && i_(t)
  );
  k = new u3({
    props: {
      backend: (
        /*trans_circuit*/
        (fe = t[37]) == null ? void 0 : fe.backend
      ),
      params: (
        /*trans_circuit*/
        (_e = t[37]) == null ? void 0 : _e.transpile_param
      )
    }
  }), q = new Am({
    props: {
      id: "transpiled-circuit-" + /*ti*/
      t[39],
      circuit_data: (
        /*trans_circuit*/
        t[37]
      ),
      is_original: !1,
      match: (
        /*trans_circuit*/
        (K = t[37]) == null ? void 0 : K.match
      ),
      matched_circuit_id: ["original-circuit"],
      matched_machine_id: ["on-machine-" + /*ti*/
      t[39]],
      open_tool: (
        /*open_tool*/
        t[15]
      ),
      machine_moment_at: (
        /*machine_moment_at*/
        t[0][
          /*ti*/
          t[39]
        ]
      ),
      filter_unused_qubits: (
        /*filter_unused_qubits*/
        t[5][
          /*ti*/
          t[39]
        ]
      ),
      unit_id: (
        /*unit_id*/
        t[7]
      )
    }
  });
  function W(...ne) {
    return (
      /*click_handler_12*/
      t[30](
        /*ti*/
        t[39],
        ...ne
      )
    );
  }
  let Z = (
    /*images*/
    t[6]["on-machine-" + /*ti*/
    t[39]] && n_(t)
  );
  P = new r3({
    props: {
      data: (
        /*trans_circuit*/
        (ke = t[37]) == null ? void 0 : ke.backend
      ),
      match: (
        /*trans_circuit*/
        (ue = t[37]) == null ? void 0 : ue.match
      ),
      id: "on-machine-" + /*ti*/
      t[39],
      transpiled_circuit_id: "transpiled-circuit-" + /*ti*/
      t[39],
      original_circuit_id: "original-circuit",
      pulse_view_id: "pulse-view-" + /*ti*/
      t[39],
      operation_data: (
        /*trans_circuit*/
        t[37]
      ),
      open_tool: (
        /*open_tool*/
        t[15]
      ),
      machine_moment_at: (
        /*machine_moment_at*/
        t[0][
          /*ti*/
          t[39]
        ]
      ),
      filter_unused_qubits: (
        /*filter_unused_qubits*/
        t[5][
          /*ti*/
          t[39]
        ]
      ),
      machine_dt_at: (
        /*machine_dt_at*/
        t[2][
          /*ti*/
          t[39]
        ]
      ),
      op_schedule: (
        /*operation_schedules*/
        t[1][
          /*ti*/
          t[39]
        ]
      ),
      autoplay: (
        /*autoplays*/
        t[3][
          /*ti*/
          t[39]
        ]
      ),
      unit_id: (
        /*unit_id*/
        t[7]
      )
    }
  }), F = new p3({
    props: {
      id: "pulse-view-" + /*ti*/
      t[39],
      transpiled_circuit_id: "transpiled-circuit-" + /*ti*/
      t[39],
      original_circuit_id: "original-circuit",
      circuit_layers: (
        /*trans_circuit*/
        t[37].layers
      ),
      pulse_data: (
        /*trans_circuit*/
        t[37].pulse_data
      ),
      gate_data: (
        /*trans_circuit*/
        t[37].backend.gate_info
      ),
      open_tool: (
        /*open_tool*/
        t[15]
      ),
      machine_moment_at: (
        /*machine_moment_at*/
        t[0][
          /*ti*/
          t[39]
        ]
      ),
      machine_dt_at: (
        /*machine_dt_at*/
        t[2][
          /*ti*/
          t[39]
        ]
      ),
      op_schedule: (
        /*operation_schedules*/
        t[1][
          /*ti*/
          t[39]
        ]
      ),
      autoplay: (
        /*autoplays*/
        t[3][
          /*ti*/
          t[39]
        ]
      )
    }
  });
  function ee(...ne) {
    return (
      /*focus_handler*/
      t[31](
        /*ti*/
        t[39],
        ...ne
      )
    );
  }
  function ye(...ne) {
    return (
      /*click_handler_13*/
      t[32](
        /*ti*/
        t[39],
        ...ne
      )
    );
  }
  return {
    c() {
      e = m("div"), l = m("section"), i = m("h1"), n = E("Transpiled Circuit "), r = E(a), s = A(), o = m("button"), c = E(u), d = E(" unused qubits"), h = A(), p = m("button"), p.textContent = "Image", b = A(), ie && ie.c(), g = A(), U && U.c(), v = A(), G && G.c(), y = A(), he(k.$$.fragment), w = A(), $ = m("div"), he(q.$$.fragment), j = A(), O = m("section"), z = m("h1"), N = E("On-machine view "), M = m("button"), M.textContent = "Image", H = A(), Z && Z.c(), B = A(), R = m("div"), he(P.$$.fragment), I = A(), L = m("div"), he(F.$$.fragment), f(o, "class", "save-make svelte-ttpui0"), f(p, "class", "save-make svelte-ttpui0"), f(i, "class", "svelte-ttpui0"), f($, "class", "circuit svelte-ttpui0"), f(l, "class", "circuit-view-wrap circuit-section svelte-ttpui0"), f(M, "class", "save-make svelte-ttpui0"), f(z, "class", "svelte-ttpui0"), f(R, "class", "circuit svelte-ttpui0"), f(L, "class", "circuit svelte-ttpui0"), f(O, "class", "circuit-view-wrap machine-section svelte-ttpui0"), f(e, "class", "transpiled-wrap svelte-ttpui0");
    },
    m(ne, oe) {
      C(ne, e, oe), _(e, l), _(l, i), _(i, n), _(i, r), _(i, s), _(i, o), _(o, c), _(o, d), _(i, h), _(i, p), _(i, b), ie && ie.m(i, null), _(i, g), U && U.m(i, null), _(i, v), G && G.m(i, null), _(l, y), ce(k, l, null), _(l, w), _(l, $), ce(q, $, null), _(e, j), _(e, O), _(O, z), _(z, N), _(z, M), _(z, H), Z && Z.m(z, null), _(O, B), _(O, R), ce(P, R, null), _(O, I), _(O, L), ce(F, L, null), X = !0, V || (Q = [
        le(o, "click", J),
        le(p, "click", te),
        le(M, "click", W),
        le(e, "focus", ee),
        le(e, "click", ye)
      ], V = !0);
    },
    p(ne, oe) {
      var Ce, pe, De, re, Se, Ue, Ke;
      t = ne, (!X || oe[0] & /*filter_unused_qubits*/
      32) && u !== (u = /*filter_unused_qubits*/
      t[5][
        /*ti*/
        t[39]
      ] ? "Show" : "Filter") && Y(c, u), /*images*/
      t[6]["transpiled-circuit-" + /*ti*/
      t[39]] ? ie ? ie.p(t, oe) : (ie = t_(t), ie.c(), ie.m(i, g)) : ie && (ie.d(1), ie = null), /*trans_circuit*/
      (Ce = t[37]) != null && Ce.qasm2 ? U ? U.p(t, oe) : (U = l_(t), U.c(), U.m(i, v)) : U && (U.d(1), U = null), /*trans_circuit*/
      (pe = t[37]) != null && pe.qasm3 ? G ? G.p(t, oe) : (G = i_(t), G.c(), G.m(i, null)) : G && (G.d(1), G = null);
      const x = {};
      oe[0] & /*$data*/
      256 && (x.backend = /*trans_circuit*/
      (De = t[37]) == null ? void 0 : De.backend), oe[0] & /*$data*/
      256 && (x.params = /*trans_circuit*/
      (re = t[37]) == null ? void 0 : re.transpile_param), k.$set(x);
      const ve = {};
      oe[0] & /*$data*/
      256 && (ve.circuit_data = /*trans_circuit*/
      t[37]), oe[0] & /*$data*/
      256 && (ve.match = /*trans_circuit*/
      (Se = t[37]) == null ? void 0 : Se.match), oe[0] & /*machine_moment_at*/
      1 && (ve.machine_moment_at = /*machine_moment_at*/
      t[0][
        /*ti*/
        t[39]
      ]), oe[0] & /*filter_unused_qubits*/
      32 && (ve.filter_unused_qubits = /*filter_unused_qubits*/
      t[5][
        /*ti*/
        t[39]
      ]), oe[0] & /*unit_id*/
      128 && (ve.unit_id = /*unit_id*/
      t[7]), q.$set(ve), /*images*/
      t[6]["on-machine-" + /*ti*/
      t[39]] ? Z ? Z.p(t, oe) : (Z = n_(t), Z.c(), Z.m(z, null)) : Z && (Z.d(1), Z = null);
      const se = {};
      oe[0] & /*$data*/
      256 && (se.data = /*trans_circuit*/
      (Ue = t[37]) == null ? void 0 : Ue.backend), oe[0] & /*$data*/
      256 && (se.match = /*trans_circuit*/
      (Ke = t[37]) == null ? void 0 : Ke.match), oe[0] & /*$data*/
      256 && (se.operation_data = /*trans_circuit*/
      t[37]), oe[0] & /*machine_moment_at*/
      1 && (se.machine_moment_at = /*machine_moment_at*/
      t[0][
        /*ti*/
        t[39]
      ]), oe[0] & /*filter_unused_qubits*/
      32 && (se.filter_unused_qubits = /*filter_unused_qubits*/
      t[5][
        /*ti*/
        t[39]
      ]), oe[0] & /*machine_dt_at*/
      4 && (se.machine_dt_at = /*machine_dt_at*/
      t[2][
        /*ti*/
        t[39]
      ]), oe[0] & /*operation_schedules*/
      2 && (se.op_schedule = /*operation_schedules*/
      t[1][
        /*ti*/
        t[39]
      ]), oe[0] & /*autoplays*/
      8 && (se.autoplay = /*autoplays*/
      t[3][
        /*ti*/
        t[39]
      ]), oe[0] & /*unit_id*/
      128 && (se.unit_id = /*unit_id*/
      t[7]), P.$set(se);
      const Re = {};
      oe[0] & /*$data*/
      256 && (Re.circuit_layers = /*trans_circuit*/
      t[37].layers), oe[0] & /*$data*/
      256 && (Re.pulse_data = /*trans_circuit*/
      t[37].pulse_data), oe[0] & /*$data*/
      256 && (Re.gate_data = /*trans_circuit*/
      t[37].backend.gate_info), oe[0] & /*machine_moment_at*/
      1 && (Re.machine_moment_at = /*machine_moment_at*/
      t[0][
        /*ti*/
        t[39]
      ]), oe[0] & /*machine_dt_at*/
      4 && (Re.machine_dt_at = /*machine_dt_at*/
      t[2][
        /*ti*/
        t[39]
      ]), oe[0] & /*operation_schedules*/
      2 && (Re.op_schedule = /*operation_schedules*/
      t[1][
        /*ti*/
        t[39]
      ]), oe[0] & /*autoplays*/
      8 && (Re.autoplay = /*autoplays*/
      t[3][
        /*ti*/
        t[39]
      ]), F.$set(Re);
    },
    i(ne) {
      X || (S(k.$$.fragment, ne), S(q.$$.fragment, ne), S(P.$$.fragment, ne), S(F.$$.fragment, ne), X = !0);
    },
    o(ne) {
      D(k.$$.fragment, ne), D(q.$$.fragment, ne), D(P.$$.fragment, ne), D(F.$$.fragment, ne), X = !1;
    },
    d(ne) {
      ne && T(e), ie && ie.d(), U && U.d(), G && G.d(), de(k), de(q), Z && Z.d(), de(P), de(F), V = !1, vt(Q);
    }
  };
}
function m3(t) {
  var W, Z, ee, ye, qe, je, fe, _e, K, ke;
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k = (
    /*show_transpile_summary*/
    t[4] ? "Hide" : "Show"
  ), w, $, q, j, O, z, N, M, H, B, R, P, I, L, F, X = (
    /*images*/
    t[6]["original-circuit"] && Wf(t)
  ), V = (
    /*$data*/
    ((Z = (W = t[8]) == null ? void 0 : W.original) == null ? void 0 : Z.qasm2) && Jf(t)
  ), Q = (
    /*$data*/
    ((ye = (ee = t[8]) == null ? void 0 : ee.original) == null ? void 0 : ye.qasm3) && Zf(t)
  );
  h = new Am({
    props: {
      id: "original-circuit",
      circuit_data: (
        /*$data*/
        (qe = t[8]) == null ? void 0 : qe.original
      ),
      is_original: !0,
      match: (
        /*$data*/
        (fe = (je = t[8]) == null ? void 0 : je.transpiled[
          /*$transpile_at*/
          t[9]
        ]) == null ? void 0 : fe.match
      ),
      matched_circuit_id: (
        /*$data*/
        (_e = t[8]) == null ? void 0 : _e.transpiled.map(r_)
      ),
      matched_machine_id: (
        /*$data*/
        (K = t[8]) == null ? void 0 : K.transpiled.map(s_)
      ),
      open_tool: (
        /*open_tool*/
        t[15]
      ),
      filter_unused_qubits: !1,
      unit_id: (
        /*unit_id*/
        t[7]
      )
    }
  });
  let J = (
    /*show_transpile_summary*/
    t[4] && xf(t)
  ), te = (
    /*$selected_info*/
    t[10] && e_(t)
  ), ie = we(
    /*$data*/
    ((ke = t[8]) == null ? void 0 : ke.transpiled) || []
  ), U = [];
  for (let ue = 0; ue < ie.length; ue += 1)
    U[ue] = a_(Uf(t, ie, ue));
  const G = (ue) => D(U[ue], 1, 1, () => {
    U[ue] = null;
  });
  return {
    c() {
      e = m("div"), l = m("div"), i = m("section"), n = m("h1"), a = E("Original Circuit "), r = m("button"), r.textContent = "Image", s = A(), X && X.c(), o = A(), V && V.c(), u = A(), Q && Q.c(), c = A(), d = m("div"), he(h.$$.fragment), p = A(), b = m("section"), g = m("h1"), v = E("Transpilation Summary "), y = m("button"), w = E(k), $ = A(), J && J.c(), q = A(), j = m("section"), O = m("h1"), O.textContent = "Information & Interaction", z = A(), N = m("div"), te && te.c(), M = A(), H = m("div");
      for (let ue = 0; ue < U.length; ue += 1)
        U[ue].c();
      B = A(), R = m("span"), R.textContent = `To support how each qubit contributes to the overall success, each qubit
      node shows its own ESP (estimated success probability) as the product of
      ESP values of the operations that have been applied to the qubit so far
      (i.e., up to the current moment). Thus, the term may be different then the
      overall ESP value which is the product of the ESP values of all the
      operations in the circut. The overall ESP value change is shown in the
      transpiled circuit view.`, f(r, "class", "save-make svelte-ttpui0"), f(n, "class", "svelte-ttpui0"), f(d, "class", "circuit svelte-ttpui0"), f(i, "class", "circuit-view-wrap original svelte-ttpui0"), f(y, "class", "save-make svelte-ttpui0"), f(g, "class", "svelte-ttpui0"), f(b, "class", "circuit-view-wrap transpile-summary svelte-ttpui0"), f(O, "class", "svelte-ttpui0"), f(N, "class", "info-section-wrap svelte-ttpui0"), f(j, "class", "circuit-view-wrap info-section-group svelte-ttpui0"), f(l, "class", "original-circuit-column svelte-ttpui0"), f(R, "class", "note svelte-ttpui0"), f(H, "class", "transpiled-circuit-column svelte-ttpui0"), f(e, "class", "frame svelte-ttpui0"), f(e, "id", P = "circuit-viewer-" + /*unit_id*/
      t[7]);
    },
    m(ue, ne) {
      C(ue, e, ne), _(e, l), _(l, i), _(i, n), _(n, a), _(n, r), _(n, s), X && X.m(n, null), _(n, o), V && V.m(n, null), _(n, u), Q && Q.m(n, null), _(i, c), _(i, d), ce(h, d, null), _(l, p), _(l, b), _(b, g), _(g, v), _(g, y), _(y, w), _(b, $), J && J.m(b, null), _(l, q), _(l, j), _(j, O), _(j, z), _(j, N), te && te.m(N, null), _(e, M), _(e, H);
      for (let oe = 0; oe < U.length; oe += 1)
        U[oe] && U[oe].m(H, null);
      _(H, B), _(H, R), I = !0, L || (F = [
        le(
          r,
          "click",
          /*click_handler*/
          t[18]
        ),
        le(
          y,
          "click",
          /*click_handler_5*/
          t[23]
        )
      ], L = !0);
    },
    p(ue, ne) {
      var x, ve, se, Re, Ce, pe, De, re, Se, Ue;
      /*images*/
      ue[6]["original-circuit"] ? X ? X.p(ue, ne) : (X = Wf(ue), X.c(), X.m(n, o)) : X && (X.d(1), X = null), /*$data*/
      (ve = (x = ue[8]) == null ? void 0 : x.original) != null && ve.qasm2 ? V ? V.p(ue, ne) : (V = Jf(ue), V.c(), V.m(n, u)) : V && (V.d(1), V = null), /*$data*/
      (Re = (se = ue[8]) == null ? void 0 : se.original) != null && Re.qasm3 ? Q ? Q.p(ue, ne) : (Q = Zf(ue), Q.c(), Q.m(n, null)) : Q && (Q.d(1), Q = null);
      const oe = {};
      if (ne[0] & /*$data*/
      256 && (oe.circuit_data = /*$data*/
      (Ce = ue[8]) == null ? void 0 : Ce.original), ne[0] & /*$data, $transpile_at*/
      768 && (oe.match = /*$data*/
      (De = (pe = ue[8]) == null ? void 0 : pe.transpiled[
        /*$transpile_at*/
        ue[9]
      ]) == null ? void 0 : De.match), ne[0] & /*$data*/
      256 && (oe.matched_circuit_id = /*$data*/
      (re = ue[8]) == null ? void 0 : re.transpiled.map(r_)), ne[0] & /*$data*/
      256 && (oe.matched_machine_id = /*$data*/
      (Se = ue[8]) == null ? void 0 : Se.transpiled.map(s_)), ne[0] & /*unit_id*/
      128 && (oe.unit_id = /*unit_id*/
      ue[7]), h.$set(oe), (!I || ne[0] & /*show_transpile_summary*/
      16) && k !== (k = /*show_transpile_summary*/
      ue[4] ? "Hide" : "Show") && Y(w, k), /*show_transpile_summary*/
      ue[4] ? J ? (J.p(ue, ne), ne[0] & /*show_transpile_summary*/
      16 && S(J, 1)) : (J = xf(ue), J.c(), S(J, 1), J.m(b, null)) : J && (ge(), D(J, 1, 1, () => {
        J = null;
      }), be()), /*$selected_info*/
      ue[10] ? te ? (te.p(ue, ne), ne[0] & /*$selected_info*/
      1024 && S(te, 1)) : (te = e_(ue), te.c(), S(te, 1), te.m(N, null)) : te && (ge(), D(te, 1, 1, () => {
        te = null;
      }), be()), ne[0] & /*transpile_at, $data, open_tool, machine_moment_at, machine_dt_at, operation_schedules, autoplays, filter_unused_qubits, unit_id, images, images_loader*/
      53743) {
        ie = we(
          /*$data*/
          ((Ue = ue[8]) == null ? void 0 : Ue.transpiled) || []
        );
        let Ke;
        for (Ke = 0; Ke < ie.length; Ke += 1) {
          const xe = Uf(ue, ie, Ke);
          U[Ke] ? (U[Ke].p(xe, ne), S(U[Ke], 1)) : (U[Ke] = a_(xe), U[Ke].c(), S(U[Ke], 1), U[Ke].m(H, B));
        }
        for (ge(), Ke = ie.length; Ke < U.length; Ke += 1)
          G(Ke);
        be();
      }
      (!I || ne[0] & /*unit_id*/
      128 && P !== (P = "circuit-viewer-" + /*unit_id*/
      ue[7])) && f(e, "id", P);
    },
    i(ue) {
      if (!I) {
        S(h.$$.fragment, ue), S(J), S(te);
        for (let ne = 0; ne < ie.length; ne += 1)
          S(U[ne]);
        I = !0;
      }
    },
    o(ue) {
      D(h.$$.fragment, ue), D(J), D(te), U = U.filter(Boolean);
      for (let ne = 0; ne < U.length; ne += 1)
        D(U[ne]);
      I = !1;
    },
    d(ue) {
      ue && T(e), X && X.d(), V && V.d(), Q && Q.d(), de(h), J && J.d(), te && te.d(), Ge(U, ue), L = !1, vt(F);
    }
  };
}
const r_ = (t, e) => "transpiled-circuit-" + e, s_ = (t, e) => "on-machine-" + e;
function g3(t, e, l) {
  let i, n, a, { model: r } = e, { key_circ: s = "circ" } = e, o = r.get(s), u = JSON.parse(o), c = `change:${s}`, d = () => o = r.get(s), h = Pe();
  at(t, h, (U) => l(8, i = U));
  let p = [Pe(0)], b = [Pe([])], g = [Pe(0)], v = Pe(0);
  at(t, v, (U) => l(9, n = U));
  let y = [Pe(!1)], k = !0, w = [], $ = Pe();
  at(t, $, (U) => l(10, a = U));
  let q = {}, j = Pe();
  j.subscribe((U) => {
    U && l(6, q[U.id] = U, q);
  });
  function O(U) {
    $.set(U);
  }
  let z = "";
  yt(() => {
    var U, G, W, Z, ee;
    l(7, z = crypto.randomUUID()), h.set(u), r.on(c, d), l(0, p = (U = i == null ? void 0 : i.transpiled) == null ? void 0 : U.map(() => Pe(0))), l(2, g = (G = i == null ? void 0 : i.transpiled) == null ? void 0 : G.map(() => Pe(0))), l(1, b = (W = i == null ? void 0 : i.transpiled) == null ? void 0 : W.map(() => Pe([]))), l(5, w = (Z = i == null ? void 0 : i.transpiled) == null ? void 0 : Z.map(() => !0)), l(3, y = (ee = i == null ? void 0 : i.transpiled) == null ? void 0 : ee.map(() => Pe(!1))), console.log(i);
  }), fi(() => {
    r.off(c, d);
  });
  const N = (U) => {
    Li("original-circuit", j);
  }, M = (U) => {
    var G;
    ii((G = i == null ? void 0 : i.original) == null ? void 0 : G.qasm2);
  }, H = (U) => {
    var G;
    O({
      data: {
        qasm_version: 2,
        title: "Original Circuit",
        qasm: (G = i == null ? void 0 : i.original) == null ? void 0 : G.qasm2
      }
    });
  }, B = (U) => {
    var G;
    ii((G = i == null ? void 0 : i.original) == null ? void 0 : G.qasm3);
  }, R = (U) => {
    var G;
    O({
      data: {
        qasm_version: 3,
        title: "Original Circuit",
        qasm: (G = i == null ? void 0 : i.original) == null ? void 0 : G.qasm3
      }
    });
  }, P = () => {
    l(4, k = !k);
  }, I = (U, G) => {
    l(5, w[U] = !w[U], w);
  }, L = (U, G) => {
    Li("transpiled-circuit-" + U, j);
  }, F = (U, G) => {
    ii(U == null ? void 0 : U.qasm2);
  }, X = (U, G, W) => {
    O({
      data: {
        qasm_version: 2,
        title: "Transpiled Circuit " + (U + 1),
        qasm: G == null ? void 0 : G.qasm2
      }
    });
  }, V = (U, G) => {
    ii(U == null ? void 0 : U.qasm3);
  }, Q = (U, G, W) => {
    O({
      data: {
        qasm_version: 3,
        title: "Transpiled Circuit " + (U + 1),
        qasm: G == null ? void 0 : G.qasm3
      }
    });
  }, J = (U, G) => {
    Li("on-machine-" + U, j);
  }, te = (U, G) => {
    v.set(U);
  }, ie = (U, G) => {
    v.set(U);
  };
  return t.$$set = (U) => {
    "model" in U && l(16, r = U.model), "key_circ" in U && l(17, s = U.key_circ);
  }, [
    p,
    b,
    g,
    y,
    k,
    w,
    q,
    z,
    i,
    n,
    a,
    h,
    v,
    $,
    j,
    O,
    r,
    s,
    N,
    M,
    H,
    B,
    R,
    P,
    I,
    L,
    F,
    X,
    V,
    Q,
    J,
    te,
    ie
  ];
}
class b3 extends Ve {
  constructor(e) {
    super(), Qe(this, e, g3, m3, Le, { model: 16, key_circ: 17 }, null, [-1, -1]);
  }
}
const $l = {
  Aer: {
    name: "Aer",
    sim: "AerSimulator",
    n_qubits: 1 / 0
  },
  Qiskit: {
    name: "Qiskit",
    n_qubits: 133,
    description: "This option chooses what Qiskit recommends using. While you may choose upto 133 qubits, typically Qiskit cloud machines offer upto 127 qubits."
  },
  Vigo: {
    name: "Vigo",
    sim: "FakeVigo",
    n_qubits: 5
  },
  Casablanca: {
    name: "Casablanca",
    sim: "FakeCasablanca",
    n_qubits: 7
  },
  Melbourne: {
    name: "Melbourne",
    sim: "FakeMelbourneV2",
    n_qubits: 16
  },
  Guadalupe: {
    name: "Guadalupe",
    sim: "FakeGuadalupe",
    n_qubits: 16
  },
  Hanoi: {
    name: "Hanoi",
    sim: "FakeHanoi",
    n_qubits: 27
  },
  Brisbane: {
    name: "Brisbane",
    machine: "ibm_brisbane",
    sim: "FakeBrisbane",
    n_qubits: 127
  },
  Sherbrooke: {
    name: "Sherbrooke",
    machine: "ibm_sherbrooke",
    sim: "FakeSherbrooke",
    n_qubits: 127
  },
  Kyiv: {
    name: "Kyiv",
    machine: "imb_kyiv",
    sim: "FakeKyiv",
    n_qubits: 127
  },
  Quebec: {
    name: "Quebec",
    machine: "ibm_quebec",
    sim: "FakeQuebec",
    n_qubits: 127
  },
  Rensselaer: {
    name: "Rensselaer",
    machine: "ibm_rensselaer",
    n_qubits: 127
  },
  Brussels: {
    name: "Brussels",
    machine: "ibm_brussels",
    n_qubits: 127
  },
  Osaka: {
    name: "Osaka",
    machine: "ibm_osaka",
    sim: "FakeOsaka",
    n_qubits: 127
  },
  Nazca: {
    name: "Nazca",
    machine: "ibm_nazca",
    n_qubits: 127
  },
  Strasbourg: {
    name: "Strasbourg",
    machine: "ibm_strasbourg",
    n_qubits: 127
  },
  Kawasaki: {
    name: "Kawasaki",
    machine: "ibm_kawasaki",
    sim: "FakeKawasaki",
    n_qubits: 127
  },
  Kyoto: {
    name: "Kyoto",
    machine: "ibm_kyoto",
    sim: "FakeKyoto",
    n_qubits: 127
  },
  Cusco: {
    name: "Cusco",
    machine: "ibm_cusco",
    sim: "FakeCusco",
    n_qubits: 127
  },
  Cleveland: {
    name: "Cleveland",
    machine: "ibm_cleveland",
    n_qubits: 127
  },
  Torino: {
    name: "Torino",
    machine: "ibm_torino",
    sim: "FakeTorino",
    n_qubits: 133
  },
  Fez: {
    name: "Fez",
    machine: "ibm_fez",
    n_qubits: 156
  }
}, o_ = Object.keys($l).map((t) => $l[t]), Pt = {
  superposition: {
    name: "Superposition",
    key: "superposition",
    max_qubits: 1 / 0,
    params: void 0,
    n_params: 0
  },
  superposition_probbed: {
    name: "Superposition with probability",
    key: "superposition_probbed",
    max_qubits: 1 / 0,
    params: void 0,
    n_params: 0,
    globals: [
      {
        key: "prob",
        name: "P(state = 0)",
        type: "number"
      }
    ],
    variables: {
      prob_value: (t) => {
        var e;
        return (e = t.globals) == null ? void 0 : e.prob;
      },
      zero: (t) => 0,
      one: (t) => 1
    },
    constraints: [
      {
        key: "eligible_prob",
        range: ["prob_value", "zero", "one"],
        warning: "The probability should be between 0 and 1.",
        success: "The probability value is appropriate."
      }
    ]
  },
  entanglement: {
    name: "Entanglement (pair)",
    key: "entanglement",
    max_qubits: 2,
    params: void 0,
    n_params: 0
  },
  group_entanglement: {
    name: "Entanglement (grouped)",
    key: "group_entanglement",
    max_qubits: 1 / 0,
    params: void 0,
    n_params: 0,
    needs_size: !0,
    globals: [
      {
        key: "type",
        name: "Entagle type",
        type: "select",
        option: [
          { key: "full", name: "Full" },
          { key: "linear", name: "Linear" },
          { key: "circular", name: "Circular" }
        ]
      }
    ]
  },
  interference: {
    name: "Interference",
    key: "interference",
    max_qubits: 1 / 0,
    needs_size: !0,
    n_params: 1,
    params: [{ key: "theta", name: "Theta", type: "radian" }]
  },
  QFT: {
    name: "Quantum Fourier Transform Circuit",
    key: "QFT",
    max_qubits: 1 / 0,
    needs_size: !0,
    n_params: 0,
    params: void 0
  },
  BTT: {
    name: "Boolean Function Oracle",
    key: "BTT",
    max_qubits: 1 / 0,
    n_params: 0,
    params: void 0,
    needs_size: !0,
    globals: [
      { key: "random_all", name: "Randomize all", type: "boolean" },
      { key: "boolean_expression", name: "Boolean expression", type: "bool_exp" }
    ],
    variables: {
      n_symbols: (t) => {
        var e, l;
        return f_(((l = (e = t.globals) == null ? void 0 : e.boolean_expression) == null ? void 0 : l.match(/[a-zA-Z]/gi)) || []).length;
      },
      n_req_qubits: (t) => {
        var e, l;
        return f_(((l = (e = t.globals) == null ? void 0 : e.boolean_expression) == null ? void 0 : l.match(/[a-zA-Z]/gi)) || []).length + 1;
      },
      n_qubits: (t) => {
        var e;
        return ((e = t.apply_to) == null ? void 0 : e.length) || 0;
      }
    },
    constraints: [
      {
        key: "match_symbol_req_qubit",
        match: ["n_req_qubits", "n_qubits"],
        warning: "Should have enough number of qubits (i.e., #symbols + 1).",
        success: "The right number of qubits are selected."
      }
    ]
  },
  SHOR_period: {
    name: "Shor's Alogrithm for Finding a Period (a^r mod N)",
    key: "SHOR_period",
    max_qubits: 1 / 0,
    qubit_registers: [
      "counter",
      "oracle"
    ],
    n_params: 2,
    params: [
      { key: "factor", name: "Base factor (a)", type: "number" },
      { key: "divider", name: "Divider (N)", type: "number" }
    ],
    variables: {
      factor: (t) => {
        var e;
        return (e = t.params) == null ? void 0 : e.factor;
      },
      divider: (t) => {
        var e;
        return (e = t.params) == null ? void 0 : e.divider;
      },
      oracle_size: (t) => {
        var e, l;
        return (l = ((e = t.params) == null ? void 0 : e.divider) || 0) == null ? void 0 : l.toString(2).length;
      },
      n_oracle_qubits: (t) => {
        var e, l, i;
        return ((i = (l = (e = t.qubit_registers) == null ? void 0 : e.oracle) == null ? void 0 : l.apply_to) == null ? void 0 : i.length) || 0;
      },
      oracle_qubits: (t) => {
        var e, l;
        return ((l = (e = t.qubit_registers) == null ? void 0 : e.oracle) == null ? void 0 : l.apply_to) || [];
      },
      counter_qubits: (t) => {
        var e, l;
        return ((l = (e = t.qubit_registers) == null ? void 0 : e.counter) == null ? void 0 : l.apply_to) || [];
      }
    },
    constraints: [
      {
        key: "factor_exist",
        exist: ["factor"],
        warning: "A factor must be provided.",
        success: "A factor is provided."
      },
      {
        key: "divider_exist",
        exist: ["divider"],
        warning: "A divider must be provided.",
        success: "A divider is provided."
      },
      {
        key: "oracle_size_match",
        geq: ["n_oracle_qubits", "oracle_size"],
        warning: "The number of qubits for oracle (divider) is not sufficient for the oracle.",
        success: "The right number of oracle qubits are selected.",
        auto_qubit_exempt: !0
      },
      {
        key: "oracle_counter_separation",
        array_distinct: ["oracle_qubits", "counter_qubits"],
        warning: "The oracle (divider) and counter (base) should have different qubits.",
        success: "The oracle (divider) and counter (base) qubits are well-separated."
      }
    ]
  },
  BV: {
    name: "Bernstein-Vazirani algorithm (secret string search)",
    key: "BV",
    max_qubits: 1 / 0,
    qubit_registers: [
      "string",
      "store"
    ],
    n_params: 1,
    params: [
      { key: "string", name: "Bitstring to find", type: "string" }
    ],
    variables: {
      string: (t) => {
        var e;
        return (e = t.params) == null ? void 0 : e.string;
      },
      string_size: (t) => {
        var e, l;
        return ((l = (e = t.params) == null ? void 0 : e.string) == null ? void 0 : l.length) || 0;
      },
      string_qubits: (t) => {
        var e, l;
        return ((l = (e = t.qubit_registers) == null ? void 0 : e.string) == null ? void 0 : l.apply_to) || [];
      },
      string_qubit_size: (t) => {
        var e, l, i;
        return (i = ((l = (e = t.qubit_registers) == null ? void 0 : e.string) == null ? void 0 : l.apply_to) || []) == null ? void 0 : i.length;
      },
      store_qubits: (t) => {
        var e, l;
        return ((l = (e = t.qubit_registers) == null ? void 0 : e.store) == null ? void 0 : l.apply_to) || [];
      },
      store_qubit_size: (t) => {
        var e, l, i;
        return (i = ((l = (e = t.qubit_registers) == null ? void 0 : e.store) == null ? void 0 : l.apply_to) || []) == null ? void 0 : i.length;
      }
    },
    constraints: [
      {
        key: "string_exist",
        string_exist: ["string"],
        warning: "A secret bitstring to find must be provided.",
        success: "A secret bitstring is provided."
      },
      {
        key: "string_pattern",
        pattern: ["string", "^[01]+$"],
        warning: "A bitstring must consist of '0' and '1'.",
        success: "A proper bitstring is provided."
      },
      {
        key: "oracle_size_match",
        eq: ["string_size", "string_qubit_size"],
        warning: "The number of qubits for bitstring is not sufficient for the bitstring.",
        success: "The right number of bitstring qubits are selected.",
        auto_qubit_exempt: !0
      },
      {
        key: "oracle_counter_separation",
        array_distinct: ["string_qubits", "store_qubits"],
        warning: "The bitstring and store should have different qubits.",
        success: "The bitstring and store qubits are well-separated."
      }
      //  SHORS_ORACLE_SIZE = len(np.binary_repr(SHORS_MOD))
    ]
  },
  qnn_input_angle: {
    name: "QNN Data Entry (angle encoding)",
    key: "qnn_input_angle",
    max_qubits: 1 / 0,
    n_params: "auto",
    needs_size: !0,
    params_per_bit: [
      {
        key: "angle_dir",
        name: "Direction",
        type: "select",
        option: [
          { key: "rx", name: "X (0/1)" },
          { key: "ry", name: "Y (i)" },
          { key: "rz", name: "Z (+/-)" }
        ]
      },
      { key: "angle", name: "Angle", type: "number" }
    ]
  },
  qnn_weight_angle: {
    name: "QNN Weight Entry (angle encoding)",
    key: "qnn_weight_angle",
    max_qubits: 1 / 0,
    n_params: "auto",
    needs_size: !0,
    params_per_bit: [
      {
        key: "angle_dir",
        name: "Direction",
        type: "select",
        option: [
          { key: "rx", name: "X (0/1)" },
          { key: "ry", name: "Y (i)" },
          { key: "rz", name: "Z (+/-)" }
        ]
      },
      { key: "angle", name: "Angle", type: "number" }
    ]
  },
  image_convolution_filters: {
    name: "Image Convolution Filters",
    key: "image_convolution_filters",
    max_qubits: 1 / 0,
    qubit_registers: [
      "ancilla",
      "image"
    ],
    n_params: 2,
    globals: [
      { key: "image_file", name: "Image file path", type: "string" },
      {
        key: "color_mode",
        name: "Color Mode",
        type: "select",
        option: [
          { key: "RGB", name: "RGB" },
          { key: "L", name: "Black/White" }
        ]
      },
      {
        key: "filter",
        name: "Filter",
        type: "select",
        option: [
          { key: "avg", name: "Average convolution" },
          { key: "sobel", name: "Sobel" },
          { key: "blur", name: "Gaussian Blur" }
        ]
      },
      {
        key: "sigma",
        name: "Gaussian Variance",
        type: "number"
      }
    ],
    variables: {
      image_file: (t) => {
        var e;
        return (e = t.globals) == null ? void 0 : e.image_file;
      },
      filter: (t) => {
        var e;
        return (e = t.globals) == null ? void 0 : e.filter;
      }
    },
    constraints: [
      {
        key: "image_exist",
        exist: ["image_file"],
        warning: "An image file path must be provided.",
        success: "An image file path is provided."
      },
      {
        key: "filter_exist",
        exist: ["filter"],
        warning: "A filter must be selected.",
        success: "A filter is selected."
      }
    ],
    notes: "This operation relies on the imeage size, so the qubits are automatically chosen."
  }
}, u_ = Object.keys(Pt).map((t) => Pt[t]);
function f_(t) {
  return Array(...new Set(t));
}
function v3(t, e, l, i) {
  if (i && t.auto_qubit_exempt)
    return !0;
  if (t.match) {
    let n = t.match.map((a) => l[a].constructor.name === "Function" ? l[a](e) : l[a]);
    return n.every((a) => a === n[0]);
  } else if (t.eq) {
    let n = t.eq.map((a) => l[a].constructor.name === "Function" ? l[a](e) : l[a]);
    return n[0] == n[1];
  } else if (t.geq) {
    let n = t.geq.map((a) => l[a].constructor.name === "Function" ? l[a](e) : l[a]);
    return n[0] >= n[1];
  } else if (t.leq) {
    let n = t.leq.map((a) => l[a].constructor.name === "Function" ? l[a](e) : l[a]);
    return n[0] <= n[1];
  } else if (t.gt) {
    let n = t.qt.map((a) => l[a].constructor.name === "Function" ? l[a](e) : l[a]);
    return n[0] > n[1];
  } else if (t.lt) {
    let n = t.lt.map((a) => l[a].constructor.name === "Function" ? l[a](e) : l[a]);
    return n[0] < n[1];
  } else if (t.range) {
    let n = t.range.map((a) => l[a].constructor.name === "Function" ? l[a](e) : l[a]);
    return n[0] >= n[1] && n[0] <= n[2];
  } else if (t.rangex) {
    let n = t.rangex.map((a) => l[a].constructor.name === "Function" ? l[a](e) : l[a]);
    return n[0] > n[1] && n[0] < n[2];
  } else if (t.array_distinct) {
    let n = t.array_distinct.map((a) => l[a].constructor.name === "Function" ? l[a](e) : l[a]);
    return n[0].every((a) => !n[1].includes(a));
  } else {
    if (t.exist)
      return t.exist.map((a) => l[a].constructor.name === "Function" ? l[a](e) : l[a]).every((a) => a != null);
    if (t.string_exist)
      return t.string_exist.map((a) => l[a].constructor.name === "Function" ? l[a](e) : l[a]).every((a) => a != null && a.length > 0);
    if (t.pattern) {
      let n = l[t.pattern[0]](e), a = t.pattern[1], r = new RegExp(a);
      return (n == null ? void 0 : n.match(r)) != null;
    }
  }
}
function k3(t, e, l, i) {
  let n = [];
  if (e) {
    n.push("# Get the filter");
    let a = !1;
    e === "sobel" ? (a = !0, n.push("convolution_filter = sobel_filter(3, axis=0)")) : e === "avg" ? (a = !0, n.push("convolution_filter = avg_filter(3, axis=0)")) : e === "blur" && (a = !0, n.push(`convolution_filter = laplacian_of_gaussian(3, sigma=${i || 0.6})`)), a && n.push('psi_filter = pad_array(convolution_filter).flatten(order="F")');
  }
  return n.push(`
# Get the image data
QCNN_image_file = Path("${t}")
image_data, dims = flatten_image(QCNN_image_file)
n_dims = len(dims)
dims_data = np.asarray(dims).astype(int)
image_mode = "${l || "RGB"}"
if (n_dims == 2):
    image_mode = "L"`), n.push(`
# Compute the input dimensions
n_qubits = 0
dims_qubits = dims_data
for i_dim in range(0, n_dims):
    n_qubits_i = int(np.ceil(np.log2(dims_data[i_dim]))) # Calculate the number of qubits required for each dimension
    dims_qubits[i_dim] = n_qubits_i
    n_qubits += n_qubits_i`), n.push(`
# Compute the output dimensions
output = dims_qubits.cumsum()
dim_qubit_end = output - 1
dim_qubit_start = np.asarray(dims).astype(int)
dim_qubit_start[0] = 0
for i_dim in range(1, n_dims):
    dim_qubit_start[i_dim] = output[i_dim-1]`), n.push("num_qubits = n_qubits"), n.push("num_states = 2**num_qubits"), n.push("psi = image_data"), n.push("fltr_shape_q = [int(np.ceil(np.log2(filter_size))) for filter_size in convolution_filter.shape]"), n.push(`num_ancilla = sum(fltr_shape_q)
QCNN_total_qubits = num_qubits + num_ancilla
QCNN_total_states = 2**QCNN_total_qubits`), n.push(`
# Get the magnitude
magnitude = np.linalg.norm(psi)
psi /= magnitude

magnitude_filter = np.linalg.norm(psi_filter)
psi_filter /= magnitude_filter
magnitude *= magnitude_filter

magnitude *= np.sqrt(2**num_ancilla)

# Re-writing the circuit
circuit = QuantumCircuit(QCNN_total_qubits, QCNN_total_qubits)
circuit.initialize(psi, circuit.qubits[:num_qubits])

# Shift operation
for i, (dim, fq) in enumerate(zip(dims_qubits[:convolution_filter.ndim], fltr_shape_q)):
    filter_qubits = num_qubits + sum(fltr_shape_q[:i]) + np.arange(fq)
    circuit.h(filter_qubits)

    qubits = list(sum(dims_data[:i]) + np.arange(dim))
    for i, control_qubit in enumerate(filter_qubits):
        shift(circuit, -1, qubits=qubits[i:], control=control_qubit)

# data rearrangement
roots = np.concatenate([np.zeros(1, dtype=int), np.cumsum(dims_qubits[:convolution_filter.ndim-1])]) # base
filter_qubits = np.array([root + np.arange(fq) for root, fq in zip(roots, fltr_shape_q)]).flatten()

swap_targets = np.array([num_qubits + sum(fltr_shape_q[:i]) + np.arange(fq) for i, fq in enumerate(fltr_shape_q)]).flatten()
for a,b in zip(filter_qubits, swap_targets):
    circuit.swap(a, b)

# Multiply and accummulate

mac = StatePreparation(np.conj(psi_filter), inverse=True)
circuit.compose(mac, qubits=list(swap_targets), inplace=True)

circuit.measure(list(range(QCNN_total_qubits)), list(range(QCNN_total_qubits)))
`), n.join(`
`);
}
function y3() {
  return `
counts = job.result().get_counts(circuit)
display_function(QCNN_total_states, counts, shots, num_states, magnitude, dims, image_mode)
  `;
}
const __ = "from patoka.shors_utils import c_amodN, qft_dagger";
function w3(t, e, l, i) {
  return `
SHORS_COUNT_QUBITS = [${t.join(", ")}]
SHORS_ORACLE_QUBITS = [${e.join(", ")}]
SHORS_MOD = ${l}
SHORS_FACTOR = ${i}
`;
}
const $3 = `
# SHORS_ORACLE_SIZE: the size of QPE gate
# SHORS_MOD: the divider
# SHORS_FACTOR: the base number
# SHORS_COUNT: # of the counting qubits
SHORS_COUNT = len(SHORS_COUNT_QUBITS)
SHORS_ORACLE_SIZE = len(SHORS_ORACLE_QUBITS)

# Initialize counting qubits
# in state |+>
for q in SHORS_COUNT_QUBITS:
    circuit.h(q)

# And auxiliary register in state |1>
circuit.x(SHORS_ORACLE_QUBITS[0])

# Do controlled-U operations
for q in SHORS_COUNT_QUBITS:
    circuit.append(c_amodN(SHORS_FACTOR, SHORS_MOD, 2**q),
            [q] + SHORS_ORACLE_QUBITS)

# Do inverse-QFT
circuit.append(qft_dagger(SHORS_COUNT), range(SHORS_COUNT))

# Don't forget to measure circuit if you didnt! (uncomment this)
# circuit.measure(SHORS_COUNT_QUBITS, range(SHORS_COUNT))
`;
function c_(t, e) {
  var q, j, O, z, N, M, H, B, R, P, I, L, F, X, V, Q, J, te, ie, U, G, W, Z, ee, ye, qe, je, fe, _e, K, ke, ue, ne, oe, x, ve, se, Re, Ce, pe, De, re, Se, Ue, Ke, xe, wt, $t, st, qt, Dt, ot;
  let l = [], i = [], n = [], a = [], r = [], s = 0;
  e != null && e.no_includes || (i.push("from qiskit import QuantumCircuit"), t.reporting === "measure" && i.push("from qiskit.visualization import plot_histogram"));
  let o = t.num_qubits === "auto", u = t.num_clbits === "auto", c = [], d = $l[t.machine], h = t.is_simulator;
  d && (i.push("from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager"), d.name === "Aer" ? (i.push("from qiskit_aer import AerSimulator"), i.push("from qiskit import transpile")) : h ? (i.push("import qiskit_aer"), i.push(`from qiskit_ibm_runtime.fake_provider import ${d.sim}`)) : (i.push("import os"), i.push("from qiskit_ibm_runtime import QiskitRuntimeService")));
  let p = !1, b = !1, g, v = !1, y = [];
  if (t != null && t.operations) {
    let ht = 0;
    for (const Me of t.operations)
      if (!Me.deactive) {
        let me = Pt[Me.operation_def];
        if ((me == null ? void 0 : me.key) === "QFT") {
          i.includes("from qiskit.circuit.library import QFT") || i.push("from qiskit.circuit.library import QFT"), l.push(""), l.push("# Quantum Fourier Transform");
          let Oe = Me.apply_to;
          if (o) {
            let Fe = Me.qubit_size || 5, Ee = c.length - 1;
            Oe = [];
            for (let We = 0; We < Fe; We++)
              c.push(Ee + We + 1), Oe.push(Ee + We + 1);
          }
          l.push(`qft_${ht} = QFT(${Oe.length}).to_gate()`), l.push(`circuit.append(qft_${ht}, [${Oe.join(", ")}])`), u && y.push(...Oe);
        } else if ((me == null ? void 0 : me.key) === "superposition") {
          l.push(""), l.push("# Superposition");
          let Oe = Me.apply_to;
          if (o) {
            let Fe = c.length - 1;
            c.push(Fe + 1), Oe = [Fe + 1];
          }
          Oe.forEach((Fe) => {
            l.push(`circuit.h(${Fe})`);
          }), u && y.push(...Oe);
        } else if ((me == null ? void 0 : me.key) === "superposition_probbed") {
          l.push(""), l.push("# Superposition with probabilities"), i.includes("import numpy as np") || i.push("import numpy as np");
          let Oe = Me.apply_to;
          if (o) {
            let Fe = c.length - 1;
            c.push(Fe + 1), Oe = [Fe + 1];
          }
          Oe.forEach((Fe) => {
            var Ee;
            l.push(`circuit.rx(2 * np.arccos(np.sqrt(${(Ee = Me.globals) == null ? void 0 : Ee.prob})), ${Fe})`);
          }), u && y.push(...Oe);
        } else if ((me == null ? void 0 : me.key) === "entanglement") {
          l.push(""), l.push("# Entanglement");
          let Oe = Me.apply_to;
          if (o && !Me.qubits_manual && !((q = Me.qubits_manual) != null && q.length)) {
            let Fe = 2;
            if (c.length < Fe) {
              let Ee = c.length - 1;
              Oe = c.map((We) => We);
              for (let We = Ee + 1; We < Fe; We++)
                c.push(We), Oe.push(We);
            } else
              Oe = [c[0], c[1]];
          }
          l.push(`circuit.h(${Oe[0]})`), l.push(`circuit.cx(${Oe.join(", ")})`), u && y.push(...Oe);
        } else if ((me == null ? void 0 : me.key) === "group_entanglement") {
          l.push(""), l.push("# Grouped Entanglement");
          let Oe = Me.apply_to;
          if (o && !Me.qubits_manual && !((j = Me.qubits_manual) != null && j.length)) {
            let Fe = Me.qubit_size || 2;
            if (c.length < Fe) {
              let Ee = c.length - 1;
              Oe = c.map((We) => We);
              for (let We = Ee + 1; We < Fe; We++)
                c.push(1), Oe.push(We);
            } else
              Oe = c;
          }
          if (((O = Me == null ? void 0 : Me.globals) == null ? void 0 : O.type) === "linear")
            Oe.forEach((Fe, Ee) => {
              Ee < Oe.length - 1 && l.push(`circuit.cx(${Fe}, ${Oe[Ee + 1]})`);
            });
          else if (((z = Me == null ? void 0 : Me.globals) == null ? void 0 : z.type) === "full")
            for (let Fe = 0; Fe < Oe.length - 1; Fe++) {
              let Ee = Oe[Fe];
              for (let We = Fe + 1; We < Oe.length; We++) {
                let Ye = Oe[We];
                l.push(`circuit.cx(${Ee}, ${Ye})`);
              }
            }
          else
            (((N = Me == null ? void 0 : Me.globals) == null ? void 0 : N.type) === "circular" || !((M = Me == null ? void 0 : Me.globals) != null && M.type)) && Oe.forEach((Fe, Ee) => {
              Ee < Oe.length - 1 ? l.push(`circuit.cx(${Fe}, ${Oe[Ee + 1]})`) : l.push(`circuit.cx(${Fe}, ${Oe[0]})`);
            });
          u && y.push(...Oe);
        } else if ((me == null ? void 0 : me.key) === "interference") {
          l.push(""), l.push("# Interference");
          let Oe = Me.apply_to;
          if (o) {
            let Fe = Me.qubit_size || 1, Ee = c.length - 1;
            Oe = [];
            for (let We = 0; We < Fe; We++)
              c.push(Ee + We + 1), Oe.push(Ee + We + 1);
          }
          Oe.forEach((Fe, Ee) => {
            var We;
            l.push(`circuit.rz(${Fe},${((We = Me.params) == null ? void 0 : We.theta) || 0})`);
          }), u && y.push(...Oe);
        } else if ((me == null ? void 0 : me.key) === "BTT") {
          l.push(""), i.push("from revkit import netlist, oracle_synth, truth_table"), i.push("import revkit.export.qiskit");
          let Oe = Me.apply_to;
          if (o && !Me.qubits_manual && !((H = Me.qubits_manual) != null && H.length)) {
            let Ee = me.variables.n_symbols(Me) + 1;
            if (c.length < Ee) {
              let We = c.length - 1;
              Oe = [];
              for (let Ye = We + 1; Ye < Ee; Ye++)
                c.push(Ye), Oe.push(Ye);
            } else
              Oe = c.slice(0, Ee).map((We) => We);
          }
          (B = Me == null ? void 0 : Me.globals) != null && B.random_all && (l.push("# Superpose every qubit"), Me.apply_to.forEach((Fe, Ee) => {
            Ee < Me.apply_to.length - 1 && l.push(`circuit.h(${Fe})`);
          })), (R = Me == null ? void 0 : Me.globals) != null && R.boolean_expression && (l.push("# Boolean Truth Table Function Oracle"), l.push(`tt_bool_${ht} = revkit.truth_table.from_expression("${Me.globals.boolean_expression}")`), l.push(`oracle_${ht} = revkit.oracle_synth(tt_bool_${ht})`), l.push(`oracle_gate_${ht} = oracle_${ht}.to_qiskit().to_gate()`), l.push(`circuit.append(oracle_gate_${ht}, [${Me.apply_to.join(", ")}])`)), u && y.push(...Oe);
        } else if ((me == null ? void 0 : me.key) === "SHOR_period") {
          i.includes("import numpy as np") || i.push("import numpy as np"), i.includes(__) || i.push(__);
          let Oe = (I = (P = Me.qubit_registers) == null ? void 0 : P.oracle) == null ? void 0 : I.apply_to, Fe = (F = (L = Me.qubit_registers) == null ? void 0 : L.counter) == null ? void 0 : F.apply_to;
          if (o) {
            let Ee = me.variables.oracle_size(Me), We = 6;
            if (!((V = (X = Me.qubit_registers) == null ? void 0 : X.oracle) != null && V.qubits_manual) && !((te = (J = (Q = Me.qubit_registers) == null ? void 0 : Q.oracle) == null ? void 0 : J.qubits_manual) != null && te.length))
              if (c.length < Ee) {
                let Ye = c.length - 1;
                Oe = [];
                for (let He = Ye + 1; He < Ee; He++)
                  c.push(He), Oe.push(He);
              } else
                Oe = c.slice(0, Ee).map((Ye) => Ye);
            if (!((U = (ie = Me.qubit_registers) == null ? void 0 : ie.counter) != null && U.qubits_manual) && !((Z = (W = (G = Me.qubit_registers) == null ? void 0 : G.counter) == null ? void 0 : W.qubits_manual) != null && Z.length))
              if (c.length < Ee + We) {
                let Ye = c.length - 1;
                Fe = [];
                for (let He = Ye + 1; He < Ee + We; He++)
                  c.push(He), Fe.push(He);
              } else
                Oe = c.slice(Ee, Ee + We).map((Ye) => Ye);
          }
          if (l.push("# Shor's algorithm for finding a modular period"), ((ee = Me.params) == null ? void 0 : ee.divider) !== void 0 && ((ye = Me.params) == null ? void 0 : ye.factor) !== void 0) {
            let Ee = w3(
              Fe || [],
              Oe || [],
              (qe = Me.params) == null ? void 0 : qe.divider,
              (je = Me.params) == null ? void 0 : je.factor
            );
            l.push(Ee), l.push($3);
          }
          u && y.push(...Fe);
        } else if ((me == null ? void 0 : me.key) === "BV") {
          let Oe = (((_e = (fe = Me.qubit_registers) == null ? void 0 : fe.string) == null ? void 0 : _e.apply_to) || []).toSorted((Ye, He) => Ye - He), Fe = ((ke = (K = Me.qubit_registers) == null ? void 0 : K.store) == null ? void 0 : ke.apply_to) || [], Ee = (ue = Me.params) == null ? void 0 : ue.string;
          if (o) {
            let Ye = me.variables.string_size(Me), He = 1;
            if (!((oe = (ne = Me.qubit_registers) == null ? void 0 : ne.string) != null && oe.qubits_manual) && !((se = (ve = (x = Me.qubit_registers) == null ? void 0 : x.string) == null ? void 0 : ve.qubits_manual) != null && se.length))
              if (c.length < Ye) {
                let et = c.length - 1;
                Oe = [];
                for (let gt = et + 1; gt < Ye; gt++)
                  c.push(gt), Oe.push(gt);
              } else
                Oe = c.slice(0, Ye).map((et) => et);
            if (!((Ce = (Re = Me.qubit_registers) == null ? void 0 : Re.store) != null && Ce.qubits_manual) && !((re = (De = (pe = Me.qubit_registers) == null ? void 0 : pe.store) == null ? void 0 : De.qubits_manual) != null && re.length))
              if (c.length < Ye + He) {
                let et = c.length - 1;
                Fe = [];
                for (let gt = et + 1; gt < Ye + He; gt++)
                  c.push(gt), Fe.push(gt);
              } else
                oracle_qubits = c.slice(Ye, Ye + He).map((et) => et);
          }
          l.push(`# Bernstein-Vazirani algorithm for finding hidden bits (bitstring: ${Ee})`), l.push(`for i in [${Oe.join(", ")}]:`), l.push("    circuit.h(i)"), l.push(`circuit.x(${Fe[0]})`), l.push(`circuit.h(${Fe[0]})`);
          let We = 0;
          if (Ee)
            for (const Ye in Oe)
              Ee[We] == "1" && l.push(`circuit.cx(${Ye}, ${Fe[0]})`), We++;
          l.push("circuit.barrier()"), l.push(`for i in [${Oe.join(", ")}]:`), l.push("    circuit.h(i)"), l.push(`circuit.h(${Fe[0]})`), u && y.push(...Oe);
        } else if ((me == null ? void 0 : me.key) === "qnn_input_angle") {
          l.push(""), l.push("# QNN Input Entry"), i.includes("import numpy as np") || i.push("import numpy as np");
          let Oe = Me.apply_to;
          if (o && !Me.qubits_manual && !((Se = Me.qubits_manual) != null && Se.length)) {
            let Ee = Me.qubit_size || 1;
            if (c.length < Ee) {
              let We = c.length - 1;
              Oe = c.map((Ye) => Ye);
              for (let Ye = We + 1; Ye < Ee; Ye++)
                c.push(1), Oe.push(Ye);
            } else
              Oe = c;
          }
          let Fe = [];
          Oe.forEach((Ee, We) => {
            var Ye, He, et, gt;
            l.push(`circuit.h(${Ee})`), (Ye = Me.params) != null && Ye["angle/" + Ee] && ((He = Me.params) != null && He["angle_dir/" + Ee]) && (Fe.push((et = Me.params) == null ? void 0 : et["angle/" + Ee]), l.push(`circuit.${(gt = Me.params) == null ? void 0 : gt["angle_dir/" + Ee]}(qnn_inputs[${We}], ${Ee})`));
          }), r.push(`qnn_inputs = np.array([${Fe.join(", ")}])`), u && y.push(...Oe);
        } else if ((me == null ? void 0 : me.key) === "qnn_weight_angle") {
          l.push(""), l.push("# QNN Weight Entry"), r.includes("# QNN Weight Entry") || (r.push("# QNN Weight Entry"), r.push("qnn_weights = np.array([]);")), i.includes("import numpy as np") || i.push("import numpy as np");
          let Oe = [];
          Me.apply_to.forEach((Ee, We) => {
            var Ye, He, et;
            (Ye = Me.params) != null && Ye["angle/" + Ee] && ((He = Me.params) != null && He["angle_dir/" + Ee]) && Oe.push((et = Me.params) == null ? void 0 : et["angle/" + Ee]);
          }), l.push(`qnn_weights = np.concatenate((qnn_weights, np.array([${Oe.join(", ")}])))`), Me.apply_to.forEach((Ee, We) => {
            var Ye, He, et, gt;
            (Ye = Me.params) != null && Ye["angle/" + Ee] && ((He = Me.params) != null && He["angle_dir/" + Ee]) && (l.push(`circuit.${(et = Me.params) == null ? void 0 : et["angle_dir/" + Ee]}(qnn_weights[${s}], ${Ee})`), Oe.push((gt = Me.params) == null ? void 0 : gt["angle/" + Ee]), s += 1);
          });
          let Fe = Me.apply_to;
          u && y.push(...Fe);
        } else if ((me == null ? void 0 : me.key) === "image_convolution_filters") {
          let Oe = {
            avg: "avg_filter",
            sobel: "sobel_filter",
            blur: "laplacian_of_gaussian"
          }, Fe = [
            "from pathlib import Path",
            "from PIL import Image",
            "import numpy as np",
            "from patoka.image_convolution_utils import pad_array, flatten_image, construct_image, rotate_right, rotate_left, convolution, shift, display_function",
            (Ue = Me == null ? void 0 : Me.globals) != null && Ue.filter ? `from patoka.image_convolution_utils import ${Oe[(Ke = Me == null ? void 0 : Me.globals) == null ? void 0 : Ke.filter]} ` : "",
            "from qiskit.circuit.library import StatePreparation"
          ];
          for (const We of Fe)
            i.includes(We) || i.push(We);
          let Ee = k3(
            (xe = Me == null ? void 0 : Me.globals) == null ? void 0 : xe.image_file,
            (wt = Me == null ? void 0 : Me.globals) == null ? void 0 : wt.filter,
            ($t = Me == null ? void 0 : Me.globals) == null ? void 0 : $t.color_mode,
            (st = Me == null ? void 0 : Me.globals) == null ? void 0 : st.sigma
          );
          l.push(Ee), p = !0, b = !0, g = y3(), v = !0;
        }
        ht++;
      }
  }
  let k = 0;
  o ? k = Math.max(...c) + 1 : (t == null || t.qubits, k = t == null ? void 0 : t.num_qubits), y = Array.from(new Set(y)), y.sort();
  let w = 0, $ = [];
  if (u ? ($ = y.map((ht, Me) => Me), w = Math.max(...$) + 1) : ($ = t == null ? void 0 : t.clbits, w = t == null ? void 0 : t.num_qubits), p || l.splice(0, 0, `circuit = QuantumCircuit(${k || 1}, ${w || 0})`), d && (d.name === "Aer" ? n.push("aer_sim = AerSimulator()") : d.name === "Qiskit" ? (i.includes("from qiskit_ibm_runtime import QiskitRuntimeService") || i.push("from qiskit_ibm_runtime import QiskitRuntimeService"), n.push('QiskitRuntimeService.save_account(channel="ibm_quantum", token=token, overwrite=True)'), n.push('service = QiskitRuntimeService(channel="ibm_quantum")'), n.push("avail_backends = service.backends()"), n.push("backend = avail_backends[0]"), n.push("pass_manager = generate_preset_pass_manager(backend=backend, optimization_level=optimization_level)")) : (n.push("# backend and optimizer"), n.push(`optimization_level = ${t.optimization_level || 1}`), h ? n.push(`backend = qiskit_aer.AerSimulator.from_backend(${d.sim}())`) : (i.includes("from qiskit_ibm_runtime import QiskitRuntimeService") || i.push("from qiskit_ibm_runtime import QiskitRuntimeService"), n.push("# the below code retrieves your IBM token that is stored as an environment variable."), n.push("# Visit https://docs.quantum.ibm.com/api/runtime/ for details and search 'store an environment variable' for how-to."), n.push('token = os.environ["ibm_token"]'), n.push("# Alternatively, you can directly provide your token as a string, which is less recommended."), n.push("# token = YOUR_TOKEN"), n.push('QiskitRuntimeService.save_account(channel="ibm_quantum", token=token, overwrite=True)'), n.push('service = QiskitRuntimeService(channel="ibm_quantum")'), n.push(`backend = service.backend(name="${d.machine}")`)), n.push("pass_manager = generate_preset_pass_manager(backend=backend, optimization_level=optimization_level)")), n.push("")), t.reporting === "observe")
    ((qt = t == null ? void 0 : t.pauli_obs) == null ? void 0 : qt.length) > 0 && (e != null && e.no_includes || (i.push("from qiskit.quantum_info import SparsePauliOp"), i.push("from qiskit_ibm_runtime import EstimatorV2 as Estimator")), l.push(""), l.push("# Pauli Observables"), l.push(`observables_labels = [${t.pauli_obs.map((ht) => '"' + ht.observable + '"').join(", ")}]`), l.push("observables = [SparsePauliOp(label) for label in observables_labels]"), l.push("mapped_observables = [observable.apply_layout(circuit.layout) for observable in observables]")), d ? (n.push("# pass manager and run"), n.push("estimator = Estimator(backend)"), n.push("transpiled = pass_manager.run(transpiled)"), n.push("job = estimator.run([(transpiled, mapped_observables)])")) : (n.push("# # Uncomment & run this code with a pass manager"), n.push("# estimator = Estimator(backend)"), n.push("# transpiled = pass_manager.run(circuit)"), n.push("# # Uncomment & Run this code with a backend"), n.push("# job = estimator.run([(transpiled, mapped_observables)])"));
  else if (t.reporting === "measure") {
    if (!b && (t != null && t.measure_all))
      l.push(""), l.push("# Measure"), l.push(`circuit.measure([${t.qubits.join(", ")}], [${t.clbits.join(", ")}])`);
    else if (!b && (t != null && t.measure) && (t == null ? void 0 : t.measure[0]) === "auto")
      l.push(""), l.push("# Measure"), l.push(`circuit.measure([${y.join(", ")}], [${y.map((ht, Me) => Me).join(", ")}])`);
    else if (!b && (t != null && t.measure) && (t == null ? void 0 : t.measure.length) > 0) {
      l.push(""), l.push("# Measure");
      let ht = t.clbits.slice(0, t.measure.length);
      l.push(`circuit.measure([${t.measure.join(", ")}], [${ht.join(", ")}])`);
    } else
      !b && $.length > 0 && l.push(`circuit.measure([${y.join(", ")}], [${$.join(", ")}])`);
    d ? d.name === "Aer" ? (n.push("transpiled = transpile(circuit, aer_sim)"), v ? (n.push("shots = aer_sim.configuration().max_shots"), n.push("job = aer_sim.run(transpiled, shots=shots)")) : n.push("job = aer_sim.run(transpiled)")) : (n.push("# pass manager and run"), n.push("transpiled = pass_manager.run(circuit)"), v ? (n.push("shots = backend.configuration().max_shots"), n.push("job = backend.run(transpiled, shots=shots)")) : n.push("job = backend.run(transpiled)")) : (n.push("# # Uncomment & run this code with a pass manager"), n.push("# transpiled = pass_manager.run(circuit)"), n.push("# # Run this code with a backend"), n.push("# job = backend.run(transpiled)")), n.push(""), g ? n.push(g) : (n.push("counts = job.result().get_counts()"), n.push("plot_histogram(counts)"));
  }
  if ((Dt = t.sharing) != null && Dt.qasm2) {
    i.push("from qiskit import qasm2"), l.push(""), l.push("# save the circuit as a QASM2 file"), l.push("circuit_qasm2 = qasm2.dumps(circuit)");
    let ht = `circuit_qasm2_${(/* @__PURE__ */ new Date()).getTime()}.qasm`;
    l.push(`with open("${ht}", "w") as f:`), l.push("    f.write(circuit_qasm2)"), l.push(`# to load: run qasm3.load([path]/${ht}) after setting the appropriate path`);
  }
  if ((ot = t.sharing) != null && ot.qasm3) {
    i.push("from qiskit import qasm3"), l.push(""), l.push("# save the circuit as a QASM3 file"), l.push("circuit_qasm3 = qasm3.dumps(circuit)");
    let ht = `circuit_qasm3_${(/* @__PURE__ */ new Date()).getTime()}.qasm`;
    l.push(`with open("${ht}", "w") as f:`), l.push("    f.write(circuit_qasm3)"), l.push(`# to load: run qasm3.load([path]/${ht}) after setting the appropriate path`);
  }
  return i.join(`
`) + `

` + r.join(`
`) + `

` + l.join(`
`) + `

` + n.join(`
`) + `

` + a.join(`
`);
}
function d_(t, e, l) {
  const i = t.slice();
  return i[6] = e[l], i[8] = l, i;
}
function h_(t) {
  let e, l = (
    /*m*/
    t[6].name + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), n = A(), e.__value = /*m*/
      t[6].name, dt(e, e.__value), e.selected = a = /*m*/
      t[6].name === /*$data*/
      t[1].machine;
    },
    m(r, s) {
      C(r, e, s), _(e, i), _(e, n);
    },
    p(r, s) {
      s & /*$data*/
      2 && a !== (a = /*m*/
      r[6].name === /*$data*/
      r[1].machine) && (e.selected = a);
    },
    d(r) {
      r && T(e);
    }
  };
}
function q3(t) {
  let e;
  return {
    c() {
      e = E(`This
        machine cannot be used as a simulator.`);
    },
    m(l, i) {
      C(l, e, i);
    },
    d(l) {
      l && T(e);
    }
  };
}
function j3(t) {
  let e;
  return {
    c() {
      e = E("This machine is only available as a simulator.");
    },
    m(l, i) {
      C(l, e, i);
    },
    d(l) {
      l && T(e);
    }
  };
}
function p_(t) {
  let e, l, i = $l[
    /*$data*/
    t[1].machine
  ].description + "", n;
  return {
    c() {
      e = m("span"), l = m("strong"), n = E(i), f(e, "class", "note svelte-r85cdz");
    },
    m(a, r) {
      C(a, e, r), _(e, l), _(l, n);
    },
    p(a, r) {
      r & /*$data*/
      2 && i !== (i = $l[
        /*$data*/
        a[1].machine
      ].description + "") && Y(n, i);
    },
    d(a) {
      a && T(e);
    }
  };
}
function m_(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].machine_qubits + ""
  ), a, r, s, o = (
    /*$data*/
    t[1].num_qubits + ""
  ), u, c;
  return {
    c() {
      e = m("div"), l = m("strong"), i = E("You can use up to "), a = E(n), r = E(" qubits."), s = E(`
      Currently, `), u = E(o), c = E(" qubits are used."), f(e, "class", "warning svelte-r85cdz");
    },
    m(d, h) {
      C(d, e, h), _(e, l), _(l, i), _(l, a), _(l, r), _(e, s), _(e, u), _(e, c);
    },
    p(d, h) {
      h & /*$data*/
      2 && n !== (n = /*$data*/
      d[1].machine_qubits + "") && Y(a, n), h & /*$data*/
      2 && o !== (o = /*$data*/
      d[1].num_qubits + "") && Y(u, o);
    },
    d(d) {
      d && T(e);
    }
  };
}
function T3(t) {
  var oe;
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R, P, I, L, F = (
    /*$data*/
    t[1].machine + ""
  ), X, V, Q, J = (
    /*$data*/
    t[1].machine_qubits + ""
  ), te, ie, U, G, W, Z, ee, ye, qe, je = we(o_), fe = [];
  for (let x = 0; x < je.length; x += 1)
    fe[x] = h_(d_(t, je, x));
  function _e(x, ve) {
    if (
      /*$data*/
      x[1].no_machine
    )
      return j3;
    if (
      /*$data*/
      x[1].no_sim
    )
      return q3;
  }
  let K = _e(t), ke = K && K(t), ue = ((oe = $l[
    /*$data*/
    t[1].machine
  ]) == null ? void 0 : oe.description) && p_(t), ne = (
    /*$data*/
    t[1].num_qubits > /*$data*/
    t[1].machine_qubits && m_(t)
  );
  return {
    c() {
      e = m("article"), l = m("h4"), l.textContent = "1. What machine do you want? How many bits do you need?", i = A(), n = m("div"), a = m("div"), r = m("label"), r.textContent = "Machine", s = A(), o = m("select"), u = m("option"), u.textContent = "-";
      for (let x = 0; x < fe.length; x += 1)
        fe[x].c();
      d = A(), h = m("div"), p = m("label"), p.textContent = "Simulator?", b = A(), g = m("div"), v = m("input"), w = A(), $ = m("div"), q = m("label"), q.textContent = "# Qubits", j = m("input"), z = A(), N = m("div"), M = m("label"), M.textContent = "# Classical bits", H = m("input"), R = A(), P = m("div"), I = m("span"), L = E("The chosen machine ("), X = E(F), V = E(`) supports upto
      `), Q = m("strong"), te = E(J), ie = E(`
      qubits.
      `), ke && ke.c(), U = E(`
      You can define as many qubits as needed, but exceeding the number of supported
      qubits can cause an error when you run a code. This information is also relevant
      if you want to set up Pauli observables. The machine part is for those who
      are less familiar with writing execution codes. If you are familiar with setting
      up a backend machine, then feel free to ignore the machien setting.`), G = A(), W = m("span"), W.innerHTML = "If you are not sure about the nubmer of qubits, type <strong>&quot;auto&quot;</strong> for qubits and classical bits.", Z = A(), ue && ue.c(), ee = A(), ne && ne.c(), f(l, "class", "svelte-r85cdz"), f(r, "for", "machine"), f(r, "class", "svelte-r85cdz"), u.__value = "-", dt(u, u.__value), f(o, "id", "machine"), f(o, "name", "machine"), f(o, "class", "svelte-r85cdz"), f(a, "class", "input-form svelte-r85cdz"), f(p, "for", "machine-simulator"), f(p, "class", "svelte-r85cdz"), f(v, "type", "checkbox"), f(v, "id", "machine-simulator"), f(v, "name", "machine-simulator"), v.checked = y = /*$data*/
      t[1].is_simulator, v.disabled = k = /*$data*/
      t[1].sim_not_choosable, f(v, "class", "svelte-r85cdz"), f(g, "class", "checkbox-group solo svelte-r85cdz"), f(h, "class", "input-form svelte-r85cdz"), f(q, "for", "num_qubits"), f(q, "class", "svelte-r85cdz"), f(j, "type", "text"), f(j, "id", "num_qubits"), f(j, "name", "num_qubits"), j.value = O = /*$data*/
      t[1].num_qubits || "", f(j, "class", "svelte-r85cdz"), f($, "class", "input-form svelte-r85cdz"), f(M, "for", "num_clbits"), f(M, "class", "svelte-r85cdz"), f(H, "type", "text"), f(H, "id", "num_clbits"), f(H, "name", "num_clbits"), H.value = B = /*$data*/
      t[1].num_clbits || "", f(H, "class", "svelte-r85cdz"), f(N, "class", "input-form svelte-r85cdz"), f(n, "class", "input-row svelte-r85cdz"), f(I, "class", "note svelte-r85cdz"), f(W, "class", "note svelte-r85cdz"), f(e, "class", "svelte-r85cdz");
    },
    m(x, ve) {
      C(x, e, ve), _(e, l), _(e, i), _(e, n), _(n, a), _(a, r), _(a, s), _(a, o), _(o, u);
      for (let se = 0; se < fe.length; se += 1)
        fe[se] && fe[se].m(o, null);
      _l(
        o,
        /*$data*/
        t[1].machine
      ), _(n, d), _(n, h), _(h, p), _(h, b), _(h, g), _(g, v), _(n, w), _(n, $), _($, q), _($, j), _(n, z), _(n, N), _(N, M), _(N, H), _(e, R), _(e, P), _(P, I), _(I, L), _(I, X), _(I, V), _(I, Q), _(Q, te), _(I, ie), ke && ke.m(I, null), _(I, U), _(P, G), _(P, W), _(P, Z), ue && ue.m(P, null), _(e, ee), ne && ne.m(e, null), ye || (qe = [
        le(
          o,
          "change",
          /*change_handler*/
          t[2]
        ),
        le(
          v,
          "change",
          /*change_handler_1*/
          t[3]
        ),
        le(
          j,
          "change",
          /*change_handler_2*/
          t[4]
        ),
        le(
          H,
          "change",
          /*change_handler_3*/
          t[5]
        )
      ], ye = !0);
    },
    p(x, [ve]) {
      var se;
      if (ve & /*$data*/
      2) {
        je = we(o_);
        let Re;
        for (Re = 0; Re < je.length; Re += 1) {
          const Ce = d_(x, je, Re);
          fe[Re] ? fe[Re].p(Ce, ve) : (fe[Re] = h_(Ce), fe[Re].c(), fe[Re].m(o, null));
        }
        for (; Re < fe.length; Re += 1)
          fe[Re].d(1);
        fe.length = je.length;
      }
      ve & /*$data*/
      2 && c !== (c = /*$data*/
      x[1].machine) && _l(
        o,
        /*$data*/
        x[1].machine
      ), ve & /*$data*/
      2 && y !== (y = /*$data*/
      x[1].is_simulator) && (v.checked = y), ve & /*$data*/
      2 && k !== (k = /*$data*/
      x[1].sim_not_choosable) && (v.disabled = k), ve & /*$data*/
      2 && O !== (O = /*$data*/
      x[1].num_qubits || "") && j.value !== O && (j.value = O), ve & /*$data*/
      2 && B !== (B = /*$data*/
      x[1].num_clbits || "") && H.value !== B && (H.value = B), ve & /*$data*/
      2 && F !== (F = /*$data*/
      x[1].machine + "") && Y(X, F), ve & /*$data*/
      2 && J !== (J = /*$data*/
      x[1].machine_qubits + "") && Y(te, J), K !== (K = _e(x)) && (ke && ke.d(1), ke = K && K(x), ke && (ke.c(), ke.m(I, U))), (se = $l[
        /*$data*/
        x[1].machine
      ]) != null && se.description ? ue ? ue.p(x, ve) : (ue = p_(x), ue.c(), ue.m(P, null)) : ue && (ue.d(1), ue = null), /*$data*/
      x[1].num_qubits > /*$data*/
      x[1].machine_qubits ? ne ? ne.p(x, ve) : (ne = m_(x), ne.c(), ne.m(e, null)) : ne && (ne.d(1), ne = null);
    },
    i: ae,
    o: ae,
    d(x) {
      x && T(e), Ge(fe, x), ke && ke.d(), ue && ue.d(), ne && ne.d(), ye = !1, vt(qe);
    }
  };
}
function C3(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(r, (d) => l(1, i = d)), r);
  t.$$.on_destroy.push(() => n());
  let { data: r = Pe({}) } = e;
  a();
  const s = (d) => {
    r.update((h) => (h.machine = d.target.value, h));
  }, o = (d) => {
    r.update((h) => (h.is_simulator = d.target.checked, h));
  }, u = (d) => {
    r.update((h) => (d.target.value === "auto" ? (h.num_qubits = "auto", h.qubits = ["auto"]) : (h.num_qubits = parseInt(d.target.value), h.qubits = [...Array(parseInt(d.target.value))].map((p, b) => b)), h));
  }, c = (d) => {
    r.update((h) => (d.target.value === "auto" ? (h.num_clbits = "auto", h.clbits = ["auto"]) : (h.num_clbits = parseInt(d.target.value), h.clbits = [...Array(parseInt(d.target.value))].map((p, b) => b)), h));
  };
  return t.$$set = (d) => {
    "data" in d && a(l(0, r = d.data));
  }, [
    r,
    i,
    s,
    o,
    u,
    c
  ];
}
class S3 extends Ve {
  constructor(e) {
    super(), Qe(this, e, C3, T3, Le, { data: 0 });
  }
}
function M3(t) {
  let e, l, i, n, a, r;
  return {
    c() {
      e = m("div"), l = m("button"), i = E(
        /*label*/
        t[1]
      ), f(l, "class", n = Gt(
        /*checked*/
        t[2] ? "checked" : "unchecked"
      ) + " svelte-1eeukdp"), l.disabled = /*deactive*/
      t[3], f(
        l,
        "id",
        /*id*/
        t[0]
      ), f(e, "class", "checkbox-item svelte-1eeukdp");
    },
    m(s, o) {
      C(s, e, o), _(e, l), _(l, i), a || (r = le(
        l,
        "click",
        /*click_handler*/
        t[5]
      ), a = !0);
    },
    p(s, [o]) {
      o & /*label*/
      2 && Y(
        i,
        /*label*/
        s[1]
      ), o & /*checked*/
      4 && n !== (n = Gt(
        /*checked*/
        s[2] ? "checked" : "unchecked"
      ) + " svelte-1eeukdp") && f(l, "class", n), o & /*deactive*/
      8 && (l.disabled = /*deactive*/
      s[3]), o & /*id*/
      1 && f(
        l,
        "id",
        /*id*/
        s[0]
      );
    },
    i: ae,
    o: ae,
    d(s) {
      s && T(e), a = !1, r();
    }
  };
}
function z3(t, e, l) {
  let { id: i = "", label: n = "", checked: a = !1, deactive: r = !1, oncheck: s = () => {
  } } = e;
  const o = (u) => s(!a);
  return t.$$set = (u) => {
    "id" in u && l(0, i = u.id), "label" in u && l(1, n = u.label), "checked" in u && l(2, a = u.checked), "deactive" in u && l(3, r = u.deactive), "oncheck" in u && l(4, s = u.oncheck);
  }, [i, n, a, r, s, o];
}
class Bl extends Ve {
  constructor(e) {
    super(), Qe(this, e, z3, M3, Le, {
      id: 0,
      label: 1,
      checked: 2,
      deactive: 3,
      oncheck: 4
    });
  }
}
function g_(t, e, l) {
  const i = t.slice();
  return i[9] = e[l], i[11] = l, i;
}
function N3(t) {
  let e, l, i = (
    /*param*/
    t[0].name + ""
  ), n, a, r = (
    /*param*/
    t[0].type + ""
  ), s, o, u, c, d, h, p, b, g, v, y, k, w, $ = we(
    /*param*/
    t[0].option
  ), q = [];
  for (let j = 0; j < $.length; j += 1)
    q[j] = b_(g_(t, $, j));
  return {
    c() {
      var j, O;
      e = m("div"), l = m("label"), n = E(i), a = E(" ("), s = E(r), o = E(")"), c = A(), d = m("select"), h = m("option"), p = E("-");
      for (let z = 0; z < q.length; z += 1)
        q[z].c();
      f(l, "for", u = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), f(l, "class", "svelte-7uzics"), h.__value = "null", dt(h, h.__value), h.selected = b = !/*$data*/
      ((O = (j = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : j.params) != null && O[
        /*param*/
        t[0].key
      ]), f(d, "name", g = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), f(d, "id", v = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), f(d, "class", "svelte-7uzics"), f(e, "class", "input-form svelte-7uzics");
    },
    m(j, O) {
      var z, N;
      C(j, e, O), _(e, l), _(l, n), _(l, a), _(l, s), _(l, o), _(e, c), _(e, d), _(d, h), _(h, p);
      for (let M = 0; M < q.length; M += 1)
        q[M] && q[M].m(d, null);
      _l(
        d,
        /*$data*/
        ((N = (z = t[4].operations[
          /*oi*/
          t[2]
        ]) == null ? void 0 : z.params) == null ? void 0 : N[
          /*param*/
          t[0].key
        ]) || ""
      ), k || (w = le(
        d,
        "change",
        /*change_handler_3*/
        t[8]
      ), k = !0);
    },
    p(j, O) {
      var z, N, M, H, B, R;
      if (O & /*param*/
      1 && i !== (i = /*param*/
      j[0].name + "") && Y(n, i), O & /*param*/
      1 && r !== (r = /*param*/
      j[0].type + "") && Y(s, r), O & /*param, oi, pi*/
      13 && u !== (u = `param-${/*param*/
      j[0].key}-${/*oi*/
      j[2]}-${/*pi*/
      j[3]}`) && f(l, "for", u), O & /*$data, oi, param*/
      21 && b !== (b = !/*$data*/
      ((N = (z = j[4].operations[
        /*oi*/
        j[2]
      ]) == null ? void 0 : z.params) != null && N[
        /*param*/
        j[0].key
      ])) && (h.selected = b), O & /*param, $data, oi*/
      21) {
        $ = we(
          /*param*/
          j[0].option
        );
        let P;
        for (P = 0; P < $.length; P += 1) {
          const I = g_(j, $, P);
          q[P] ? q[P].p(I, O) : (q[P] = b_(I), q[P].c(), q[P].m(d, null));
        }
        for (; P < q.length; P += 1)
          q[P].d(1);
        q.length = $.length;
      }
      O & /*param, oi, pi*/
      13 && g !== (g = `param-${/*param*/
      j[0].key}-${/*oi*/
      j[2]}-${/*pi*/
      j[3]}`) && f(d, "name", g), O & /*param, oi, pi*/
      13 && v !== (v = `param-${/*param*/
      j[0].key}-${/*oi*/
      j[2]}-${/*pi*/
      j[3]}`) && f(d, "id", v), O & /*$data, oi, param*/
      21 && y !== (y = /*$data*/
      ((H = (M = j[4].operations[
        /*oi*/
        j[2]
      ]) == null ? void 0 : M.params) == null ? void 0 : H[
        /*param*/
        j[0].key
      ]) || "") && _l(
        d,
        /*$data*/
        ((R = (B = j[4].operations[
          /*oi*/
          j[2]
        ]) == null ? void 0 : B.params) == null ? void 0 : R[
          /*param*/
          j[0].key
        ]) || ""
      );
    },
    d(j) {
      j && T(e), Ge(q, j), k = !1, w();
    }
  };
}
function A3(t) {
  let e, l, i = (
    /*param*/
    t[0].name + ""
  ), n, a, r = (
    /*param*/
    t[0].type + ""
  ), s, o, u, c, d, h, p, b, g, v;
  return {
    c() {
      var y, k;
      e = m("div"), l = m("label"), n = E(i), a = E(" ("), s = E(r), o = E(")"), c = A(), d = m("input"), f(l, "for", u = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), f(l, "class", "svelte-7uzics"), f(d, "type", "text"), f(d, "name", h = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), f(d, "id", p = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), d.value = b = /*$data*/
      ((k = (y = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : y.params) == null ? void 0 : k[
        /*param*/
        t[0].key
      ]) || "", f(d, "class", "svelte-7uzics"), f(e, "class", "input-form svelte-7uzics");
    },
    m(y, k) {
      C(y, e, k), _(e, l), _(l, n), _(l, a), _(l, s), _(l, o), _(e, c), _(e, d), g || (v = le(
        d,
        "change",
        /*change_handler_2*/
        t[7]
      ), g = !0);
    },
    p(y, k) {
      var w, $;
      k & /*param*/
      1 && i !== (i = /*param*/
      y[0].name + "") && Y(n, i), k & /*param*/
      1 && r !== (r = /*param*/
      y[0].type + "") && Y(s, r), k & /*param, oi, pi*/
      13 && u !== (u = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && f(l, "for", u), k & /*param, oi, pi*/
      13 && h !== (h = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && f(d, "name", h), k & /*param, oi, pi*/
      13 && p !== (p = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && f(d, "id", p), k & /*$data, oi, param*/
      21 && b !== (b = /*$data*/
      (($ = (w = y[4].operations[
        /*oi*/
        y[2]
      ]) == null ? void 0 : w.params) == null ? void 0 : $[
        /*param*/
        y[0].key
      ]) || "") && d.value !== b && (d.value = b);
    },
    d(y) {
      y && T(e), g = !1, v();
    }
  };
}
function B3(t) {
  let e, l, i = (
    /*param*/
    t[0].name + ""
  ), n, a, r = (
    /*param*/
    t[0].type + ""
  ), s, o, u, c, d, h, p, b, g, v;
  return {
    c() {
      var y, k;
      e = m("div"), l = m("label"), n = E(i), a = E(" ("), s = E(r), o = E(")"), c = A(), d = m("input"), f(l, "for", u = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), f(l, "class", "svelte-7uzics"), f(d, "type", "number"), f(d, "name", h = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), f(d, "id", p = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), d.value = b = /*$data*/
      ((k = (y = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : y.params) == null ? void 0 : k[
        /*param*/
        t[0].key
      ]) || "", f(d, "class", "svelte-7uzics"), f(e, "class", "input-form svelte-7uzics");
    },
    m(y, k) {
      C(y, e, k), _(e, l), _(l, n), _(l, a), _(l, s), _(l, o), _(e, c), _(e, d), g || (v = le(
        d,
        "change",
        /*change_handler_1*/
        t[6]
      ), g = !0);
    },
    p(y, k) {
      var w, $;
      k & /*param*/
      1 && i !== (i = /*param*/
      y[0].name + "") && Y(n, i), k & /*param*/
      1 && r !== (r = /*param*/
      y[0].type + "") && Y(s, r), k & /*param, oi, pi*/
      13 && u !== (u = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && f(l, "for", u), k & /*param, oi, pi*/
      13 && h !== (h = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && f(d, "name", h), k & /*param, oi, pi*/
      13 && p !== (p = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && f(d, "id", p), k & /*$data, oi, param*/
      21 && b !== (b = /*$data*/
      (($ = (w = y[4].operations[
        /*oi*/
        y[2]
      ]) == null ? void 0 : w.params) == null ? void 0 : $[
        /*param*/
        y[0].key
      ]) || "") && d.value !== b && (d.value = b);
    },
    d(y) {
      y && T(e), g = !1, v();
    }
  };
}
function P3(t) {
  let e, l, i = (
    /*param*/
    t[0].name + ""
  ), n, a, r = (
    /*param*/
    t[0].type + ""
  ), s, o, u, c, d, h, p, b, g, v;
  return {
    c() {
      var y, k;
      e = m("div"), l = m("label"), n = E(i), a = E(" ("), s = E(r), o = E(")"), c = A(), d = m("input"), f(l, "for", u = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), f(l, "class", "svelte-7uzics"), f(d, "type", "text"), f(d, "name", h = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), f(d, "id", p = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), f(d, "match", "^[0-9]+[\\.\\/][0-9]+$"), d.value = b = /*$data*/
      ((k = (y = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : y.params) == null ? void 0 : k[
        /*param*/
        t[0].key
      ]) || "", f(d, "class", "svelte-7uzics"), f(e, "class", "input-form svelte-7uzics");
    },
    m(y, k) {
      C(y, e, k), _(e, l), _(l, n), _(l, a), _(l, s), _(l, o), _(e, c), _(e, d), g || (v = le(
        d,
        "change",
        /*change_handler*/
        t[5]
      ), g = !0);
    },
    p(y, k) {
      var w, $;
      k & /*param*/
      1 && i !== (i = /*param*/
      y[0].name + "") && Y(n, i), k & /*param*/
      1 && r !== (r = /*param*/
      y[0].type + "") && Y(s, r), k & /*param, oi, pi*/
      13 && u !== (u = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && f(l, "for", u), k & /*param, oi, pi*/
      13 && h !== (h = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && f(d, "name", h), k & /*param, oi, pi*/
      13 && p !== (p = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && f(d, "id", p), k & /*$data, oi, param*/
      21 && b !== (b = /*$data*/
      (($ = (w = y[4].operations[
        /*oi*/
        y[2]
      ]) == null ? void 0 : w.params) == null ? void 0 : $[
        /*param*/
        y[0].key
      ]) || "") && d.value !== b && (d.value = b);
    },
    d(y) {
      y && T(e), g = !1, v();
    }
  };
}
function b_(t) {
  let e, l = (
    /*opt*/
    t[9].name + ""
  ), i, n, a;
  return {
    c() {
      var r, s;
      e = m("option"), i = E(l), e.__value = n = /*opt*/
      t[9].key, dt(e, e.__value), e.selected = a = /*$data*/
      (((s = (r = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : r.params) == null ? void 0 : s[
        /*param*/
        t[0].key
      ]) || "") === /*opt*/
      t[9].key;
    },
    m(r, s) {
      C(r, e, s), _(e, i);
    },
    p(r, s) {
      var o, u;
      s & /*param*/
      1 && l !== (l = /*opt*/
      r[9].name + "") && Y(i, l), s & /*param*/
      1 && n !== (n = /*opt*/
      r[9].key) && (e.__value = n, dt(e, e.__value)), s & /*$data, oi, param*/
      21 && a !== (a = /*$data*/
      (((u = (o = r[4].operations[
        /*oi*/
        r[2]
      ]) == null ? void 0 : o.params) == null ? void 0 : u[
        /*param*/
        r[0].key
      ]) || "") === /*opt*/
      r[9].key) && (e.selected = a);
    },
    d(r) {
      r && T(e);
    }
  };
}
function E3(t) {
  let e;
  function l(a, r) {
    if (
      /*param*/
      a[0].type === "radian"
    )
      return P3;
    if (
      /*param*/
      a[0].type === "number"
    )
      return B3;
    if (
      /*param*/
      a[0].type === "string"
    )
      return A3;
    if (
      /*param*/
      a[0].type === "select"
    )
      return N3;
  }
  let i = l(t), n = i && i(t);
  return {
    c() {
      n && n.c(), e = Be();
    },
    m(a, r) {
      n && n.m(a, r), C(a, e, r);
    },
    p(a, [r]) {
      i === (i = l(a)) && n ? n.p(a, r) : (n && n.d(1), n = i && i(a), n && (n.c(), n.m(e.parentNode, e)));
    },
    i: ae,
    o: ae,
    d(a) {
      a && T(e), n && n.d(a);
    }
  };
}
function O3(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(s, (b) => l(4, i = b)), s);
  t.$$.on_destroy.push(() => n());
  let { param: r = {}, data: s = Pe(), oi: o, pi: u } = e;
  a();
  const c = (b) => {
    s.update((g) => (g.operations[o].params || (g.operations[o].params = {}), g.operations[o].params[r.key] = b.target.value, g));
  }, d = (b) => {
    s.update((g) => (g.operations[o].params || (g.operations[o].params = {}), g.operations[o].params[r.key] = parseFloat(b.target.value), g));
  }, h = (b) => {
    s.update((g) => (g.operations[o].params || (g.operations[o].params = {}), g.operations[o].params[r.key] = b.target.value, g));
  }, p = (b) => {
    s.update((g) => (g.operations[o].params || (g.operations[o].params = {}), b.target.value === "null" ? delete g.operations[o].params[r.key] : g.operations[o].params[r.key] = b.target.value, g));
  };
  return t.$$set = (b) => {
    "param" in b && l(0, r = b.param), "data" in b && a(l(1, s = b.data)), "oi" in b && l(2, o = b.oi), "pi" in b && l(3, u = b.pi);
  }, [
    r,
    s,
    o,
    u,
    i,
    c,
    d,
    h,
    p
  ];
}
class qg extends Ve {
  constructor(e) {
    super(), Qe(this, e, O3, E3, Le, { param: 0, data: 1, oi: 2, pi: 3 });
  }
}
function v_(t, e, l) {
  const i = t.slice();
  return i[10] = e[l], i[12] = l, i;
}
function I3(t) {
  let e, l, i, n, a, r, s, o, u, c = we(
    /*glb*/
    t[0].option
  ), d = [];
  for (let h = 0; h < c.length; h += 1)
    d[h] = k_(v_(t, c, h));
  return {
    c() {
      var h, p;
      e = m("select"), l = m("option"), i = E("-");
      for (let b = 0; b < d.length; b += 1)
        d[b].c();
      l.__value = "null", dt(l, l.__value), l.selected = n = !/*$data*/
      ((p = (h = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : h.globals) != null && p[
        /*glb*/
        t[0].key
      ]), f(e, "name", a = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), f(e, "id", r = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), f(e, "class", "svelte-7uzics");
    },
    m(h, p) {
      var b, g;
      C(h, e, p), _(e, l), _(l, i);
      for (let v = 0; v < d.length; v += 1)
        d[v] && d[v].m(e, null);
      _l(
        e,
        /*$data*/
        ((g = (b = t[4].operations[
          /*oi*/
          t[2]
        ]) == null ? void 0 : b.globals) == null ? void 0 : g[
          /*glb*/
          t[0].key
        ]) || ""
      ), o || (u = le(
        e,
        "change",
        /*change_handler_4*/
        t[9]
      ), o = !0);
    },
    p(h, p) {
      var b, g, v, y, k, w;
      if (p & /*$data, oi, glb*/
      21 && n !== (n = !/*$data*/
      ((g = (b = h[4].operations[
        /*oi*/
        h[2]
      ]) == null ? void 0 : b.globals) != null && g[
        /*glb*/
        h[0].key
      ])) && (l.selected = n), p & /*glb, $data, oi*/
      21) {
        c = we(
          /*glb*/
          h[0].option
        );
        let $;
        for ($ = 0; $ < c.length; $ += 1) {
          const q = v_(h, c, $);
          d[$] ? d[$].p(q, p) : (d[$] = k_(q), d[$].c(), d[$].m(e, null));
        }
        for (; $ < d.length; $ += 1)
          d[$].d(1);
        d.length = c.length;
      }
      p & /*oi, gi, glb*/
      13 && a !== (a = `global-${/*oi*/
      h[2]}-${/*gi*/
      h[3]}`) && f(e, "name", a), p & /*oi, gi, glb*/
      13 && r !== (r = `global-${/*oi*/
      h[2]}-${/*gi*/
      h[3]}`) && f(e, "id", r), p & /*$data, oi, glb*/
      21 && s !== (s = /*$data*/
      ((y = (v = h[4].operations[
        /*oi*/
        h[2]
      ]) == null ? void 0 : v.globals) == null ? void 0 : y[
        /*glb*/
        h[0].key
      ]) || "") && _l(
        e,
        /*$data*/
        ((w = (k = h[4].operations[
          /*oi*/
          h[2]
        ]) == null ? void 0 : k.globals) == null ? void 0 : w[
          /*glb*/
          h[0].key
        ]) || ""
      );
    },
    d(h) {
      h && T(e), Ge(d, h), o = !1, u();
    }
  };
}
function D3(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      var o, u;
      e = m("div"), l = m("input"), f(l, "type", "checkbox"), f(l, "name", i = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), f(l, "id", n = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), l.checked = a = /*$data*/
      (u = (o = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : o.globals) == null ? void 0 : u[
        /*glb*/
        t[0].key
      ], f(l, "class", "svelte-7uzics"), f(e, "class", "checkbox-group solo svelte-7uzics");
    },
    m(o, u) {
      C(o, e, u), _(e, l), r || (s = le(
        l,
        "change",
        /*change_handler_3*/
        t[8]
      ), r = !0);
    },
    p(o, u) {
      var c, d;
      u & /*oi, gi, glb*/
      13 && i !== (i = `global-${/*oi*/
      o[2]}-${/*gi*/
      o[3]}`) && f(l, "name", i), u & /*oi, gi, glb*/
      13 && n !== (n = `global-${/*oi*/
      o[2]}-${/*gi*/
      o[3]}`) && f(l, "id", n), u & /*$data, oi, glb*/
      21 && a !== (a = /*$data*/
      (d = (c = o[4].operations[
        /*oi*/
        o[2]
      ]) == null ? void 0 : c.globals) == null ? void 0 : d[
        /*glb*/
        o[0].key
      ]) && (l.checked = a);
    },
    d(o) {
      o && T(e), r = !1, s();
    }
  };
}
function R3(t) {
  let e, l, i, n, a, r;
  return {
    c() {
      var s, o;
      e = m("input"), Mt(e, "width", "300px"), f(e, "type", "text"), f(e, "name", l = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), f(e, "id", i = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), e.value = n = /*$data*/
      ((o = (s = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : s.globals) == null ? void 0 : o[
        /*glb*/
        t[0].key
      ]) || "", f(e, "class", "svelte-7uzics");
    },
    m(s, o) {
      C(s, e, o), a || (r = le(
        e,
        "change",
        /*change_handler_2*/
        t[7]
      ), a = !0);
    },
    p(s, o) {
      var u, c;
      o & /*oi, gi, glb*/
      13 && l !== (l = `global-${/*oi*/
      s[2]}-${/*gi*/
      s[3]}`) && f(e, "name", l), o & /*oi, gi, glb*/
      13 && i !== (i = `global-${/*oi*/
      s[2]}-${/*gi*/
      s[3]}`) && f(e, "id", i), o & /*$data, oi, glb*/
      21 && n !== (n = /*$data*/
      ((c = (u = s[4].operations[
        /*oi*/
        s[2]
      ]) == null ? void 0 : u.globals) == null ? void 0 : c[
        /*glb*/
        s[0].key
      ]) || "") && e.value !== n && (e.value = n);
    },
    d(s) {
      s && T(e), a = !1, r();
    }
  };
}
function H3(t) {
  let e, l, i, n, a, r;
  return {
    c() {
      var s, o;
      e = m("input"), Mt(e, "width", "300px"), f(e, "type", "number"), f(e, "name", l = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), f(e, "id", i = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), e.value = n = /*$data*/
      ((o = (s = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : s.globals) == null ? void 0 : o[
        /*glb*/
        t[0].key
      ]) || "", f(e, "class", "svelte-7uzics");
    },
    m(s, o) {
      C(s, e, o), a || (r = le(
        e,
        "change",
        /*change_handler_1*/
        t[6]
      ), a = !0);
    },
    p(s, o) {
      var u, c;
      o & /*oi, gi, glb*/
      13 && l !== (l = `global-${/*oi*/
      s[2]}-${/*gi*/
      s[3]}`) && f(e, "name", l), o & /*oi, gi, glb*/
      13 && i !== (i = `global-${/*oi*/
      s[2]}-${/*gi*/
      s[3]}`) && f(e, "id", i), o & /*$data, oi, glb*/
      21 && n !== (n = /*$data*/
      ((c = (u = s[4].operations[
        /*oi*/
        s[2]
      ]) == null ? void 0 : u.globals) == null ? void 0 : c[
        /*glb*/
        s[0].key
      ]) || "") && e.value !== n && (e.value = n);
    },
    d(s) {
      s && T(e), a = !1, r();
    }
  };
}
function F3(t) {
  let e, l, i, n, a, r;
  return {
    c() {
      var s, o;
      e = m("input"), Mt(e, "width", "300px"), f(e, "type", "text"), f(e, "name", l = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), f(e, "id", i = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), e.value = n = /*$data*/
      ((o = (s = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : s.globals) == null ? void 0 : o[
        /*glb*/
        t[0].key
      ]) || "", f(e, "class", "svelte-7uzics");
    },
    m(s, o) {
      C(s, e, o), a || (r = le(
        e,
        "change",
        /*change_handler*/
        t[5]
      ), a = !0);
    },
    p(s, o) {
      var u, c;
      o & /*oi, gi, glb*/
      13 && l !== (l = `global-${/*oi*/
      s[2]}-${/*gi*/
      s[3]}`) && f(e, "name", l), o & /*oi, gi, glb*/
      13 && i !== (i = `global-${/*oi*/
      s[2]}-${/*gi*/
      s[3]}`) && f(e, "id", i), o & /*$data, oi, glb*/
      21 && n !== (n = /*$data*/
      ((c = (u = s[4].operations[
        /*oi*/
        s[2]
      ]) == null ? void 0 : u.globals) == null ? void 0 : c[
        /*glb*/
        s[0].key
      ]) || "") && e.value !== n && (e.value = n);
    },
    d(s) {
      s && T(e), a = !1, r();
    }
  };
}
function k_(t) {
  let e, l = (
    /*opt*/
    t[10].name + ""
  ), i, n, a;
  return {
    c() {
      var r, s;
      e = m("option"), i = E(l), e.__value = n = /*opt*/
      t[10].key, dt(e, e.__value), e.selected = a = /*$data*/
      (((s = (r = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : r.globals) == null ? void 0 : s[
        /*glb*/
        t[0].key
      ]) || "") === /*opt*/
      t[10].key;
    },
    m(r, s) {
      C(r, e, s), _(e, i);
    },
    p(r, s) {
      var o, u;
      s & /*glb*/
      1 && l !== (l = /*opt*/
      r[10].name + "") && Y(i, l), s & /*glb*/
      1 && n !== (n = /*opt*/
      r[10].key) && (e.__value = n, dt(e, e.__value)), s & /*$data, oi, glb*/
      21 && a !== (a = /*$data*/
      (((u = (o = r[4].operations[
        /*oi*/
        r[2]
      ]) == null ? void 0 : o.globals) == null ? void 0 : u[
        /*glb*/
        r[0].key
      ]) || "") === /*opt*/
      r[10].key) && (e.selected = a);
    },
    d(r) {
      r && T(e);
    }
  };
}
function L3(t) {
  let e, l, i = (
    /*glb*/
    t[0].name + ""
  ), n, a, r;
  function s(c, d) {
    if (
      /*glb*/
      c[0].type === "bool_exp"
    )
      return F3;
    if (
      /*glb*/
      c[0].type === "number"
    )
      return H3;
    if (
      /*glb*/
      c[0].type === "string"
    )
      return R3;
    if (
      /*glb*/
      c[0].type === "boolean"
    )
      return D3;
    if (
      /*glb*/
      c[0].type === "select"
    )
      return I3;
  }
  let o = s(t), u = o && o(t);
  return {
    c() {
      e = m("div"), l = m("label"), n = E(i), r = A(), u && u.c(), f(l, "for", a = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), f(l, "class", "svelte-7uzics"), f(e, "class", "input-form svelte-7uzics");
    },
    m(c, d) {
      C(c, e, d), _(e, l), _(l, n), _(e, r), u && u.m(e, null);
    },
    p(c, [d]) {
      d & /*glb*/
      1 && i !== (i = /*glb*/
      c[0].name + "") && Y(n, i), d & /*oi, gi, glb*/
      13 && a !== (a = `global-${/*oi*/
      c[2]}-${/*gi*/
      c[3]}`) && f(l, "for", a), o === (o = s(c)) && u ? u.p(c, d) : (u && u.d(1), u = o && o(c), u && (u.c(), u.m(e, null)));
    },
    i: ae,
    o: ae,
    d(c) {
      c && T(e), u && u.d();
    }
  };
}
function Q3(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(s, (g) => l(4, i = g)), s);
  t.$$.on_destroy.push(() => n());
  let { glb: r = {}, data: s = Pe(), oi: o, gi: u } = e;
  a();
  const c = (g) => {
    s.update((v) => (v.operations[o].globals || (v.operations[o].globals = {}), v.operations[o].globals[r.key] = g.target.value, v));
  }, d = (g) => {
    s.update((v) => (v.operations[o].globals || (v.operations[o].globals = {}), v.operations[o].globals[r.key] = g.target.value, v));
  }, h = (g) => {
    s.update((v) => (v.operations[o].globals || (v.operations[o].globals = {}), v.operations[o].globals[r.key] = g.target.value, v));
  }, p = (g) => {
    s.update((v) => (v.operations[o].globals || (v.operations[o].globals = {}), v.operations[o].globals[r.key] = g.target.checked, v));
  }, b = (g) => {
    s.update((v) => (v.operations[o].globals || (v.operations[o].globals = {}), g.target.value === "null" ? delete v.operations[o].globals[r.key] : v.operations[o].globals[r.key] = g.target.value, v));
  };
  return t.$$set = (g) => {
    "glb" in g && l(0, r = g.glb), "data" in g && a(l(1, s = g.data)), "oi" in g && l(2, o = g.oi), "gi" in g && l(3, u = g.gi);
  }, [
    r,
    s,
    o,
    u,
    i,
    c,
    d,
    h,
    p,
    b
  ];
}
class V3 extends Ve {
  constructor(e) {
    super(), Qe(this, e, Q3, L3, Le, { glb: 0, data: 1, oi: 2, gi: 3 });
  }
}
function y_(t, e, l) {
  const i = t.slice();
  return i[19] = e[l], i[21] = l, i;
}
function w_(t, e, l) {
  const i = t.slice();
  return i[22] = e[l], i[24] = l, i;
}
function $_(t, e, l) {
  const i = t.slice();
  return i[25] = e[l], i[27] = l, i;
}
function q_(t, e, l) {
  const i = t.slice();
  return i[28] = e[l], i[30] = l, i;
}
function j_(t, e, l) {
  const i = t.slice();
  return i[31] = e[l], i[33] = l, i;
}
function T_(t, e, l) {
  const i = t.slice();
  return i[31] = e[l], i[33] = l, i;
}
function C_(t, e, l) {
  const i = t.slice();
  return i[38] = e[l], i;
}
function S_(t, e, l) {
  const i = t.slice();
  return i[35] = e[l], i[37] = l, i;
}
function M_(t, e, l) {
  const i = t.slice();
  return i[38] = e[l], i;
}
function z_(t, e, l) {
  const i = t.slice();
  return i[38] = e[l], i;
}
function N_(t) {
  let e, l, i;
  function n(...a) {
    return (
      /*click_handler*/
      t[2](
        /*oi*/
        t[21],
        ...a
      )
    );
  }
  return {
    c() {
      e = m("button"), e.textContent = "⊗ Deactivate", f(e, "class", "svelte-1tjl940");
    },
    m(a, r) {
      C(a, e, r), l || (i = le(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && T(e), l = !1, i();
    }
  };
}
function A_(t) {
  let e, l, i;
  function n(...a) {
    return (
      /*click_handler_1*/
      t[3](
        /*oi*/
        t[21],
        ...a
      )
    );
  }
  return {
    c() {
      e = m("button"), e.textContent = "⊚ Activate", f(e, "class", "svelte-1tjl940");
    },
    m(a, r) {
      C(a, e, r), l || (i = le(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && T(e), l = !1, i();
    }
  };
}
function X3(t) {
  let e, l, i;
  function n(...a) {
    return (
      /*click_handler_3*/
      t[5](
        /*oi*/
        t[21],
        ...a
      )
    );
  }
  return {
    c() {
      e = m("button"), e.textContent = "↑ Move up", f(e, "class", "svelte-1tjl940");
    },
    m(a, r) {
      C(a, e, r), l || (i = le(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && T(e), l = !1, i();
    }
  };
}
function B_(t) {
  let e, l, i;
  function n(...a) {
    return (
      /*click_handler_4*/
      t[6](
        /*oi*/
        t[21],
        ...a
      )
    );
  }
  return {
    c() {
      e = m("button"), e.textContent = "↓ Move down", f(e, "class", "svelte-1tjl940");
    },
    m(a, r) {
      C(a, e, r), l || (i = le(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && T(e), l = !1, i();
    }
  };
}
function P_(t) {
  let e, l = (
    /*item*/
    t[38].name + ""
  ), i, n;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = /*item*/
      t[38].key, dt(e, e.__value), e.selected = n = /*item*/
      t[38].key === /*op*/
      t[19].operation_def, f(e, "class", "svelte-1tjl940");
    },
    m(a, r) {
      C(a, e, r), _(e, i);
    },
    p(a, r) {
      r[0] & /*$data*/
      2 && n !== (n = /*item*/
      a[38].key === /*op*/
      a[19].operation_def) && (e.selected = n);
    },
    d(a) {
      a && T(e);
    }
  };
}
function G3(t) {
  let e, l, i, n, a, r, s, o;
  function u(...b) {
    return (
      /*func_3*/
      t[15](
        /*oi*/
        t[21],
        ...b
      )
    );
  }
  a = new Bl({
    props: {
      id: `op-${/*oi*/
      t[21]}-qubit-reset`,
      checked: !1,
      oncheck: u,
      label: "Reset"
    }
  });
  let c = (
    /*$data*/
    t[1].num_qubits && E_(t)
  ), d = we(
    /*$data*/
    t[1].qubits || []
  ), h = [];
  for (let b = 0; b < d.length; b += 1)
    h[b] = O_(C_(t, d, b));
  const p = (b) => D(h[b], 1, 1, () => {
    h[b] = null;
  });
  return {
    c() {
      e = m("div"), l = m("label"), l.textContent = "Qubits to apply", i = A(), n = m("div"), he(a.$$.fragment), r = A(), c && c.c(), s = A();
      for (let b = 0; b < h.length; b += 1)
        h[b].c();
      f(l, "class", "svelte-1tjl940"), f(n, "class", "checkbox-group svelte-1tjl940"), f(e, "class", "input-form svelte-1tjl940");
    },
    m(b, g) {
      C(b, e, g), _(e, l), _(e, i), _(e, n), ce(a, n, null), _(n, r), c && c.m(n, null), _(n, s);
      for (let v = 0; v < h.length; v += 1)
        h[v] && h[v].m(n, null);
      o = !0;
    },
    p(b, g) {
      t = b;
      const v = {};
      if (g[0] & /*data*/
      1 && (v.oncheck = u), a.$set(v), /*$data*/
      t[1].num_qubits ? c ? (c.p(t, g), g[0] & /*$data*/
      2 && S(c, 1)) : (c = E_(t), c.c(), S(c, 1), c.m(n, s)) : c && (ge(), D(c, 1, 1, () => {
        c = null;
      }), be()), g[0] & /*$data, data*/
      3) {
        d = we(
          /*$data*/
          t[1].qubits || []
        );
        let y;
        for (y = 0; y < d.length; y += 1) {
          const k = C_(t, d, y);
          h[y] ? (h[y].p(k, g), S(h[y], 1)) : (h[y] = O_(k), h[y].c(), S(h[y], 1), h[y].m(n, null));
        }
        for (ge(), y = d.length; y < h.length; y += 1)
          p(y);
        be();
      }
    },
    i(b) {
      if (!o) {
        S(a.$$.fragment, b), S(c);
        for (let g = 0; g < d.length; g += 1)
          S(h[g]);
        o = !0;
      }
    },
    o(b) {
      D(a.$$.fragment, b), D(c), h = h.filter(Boolean);
      for (let g = 0; g < h.length; g += 1)
        D(h[g]);
      o = !1;
    },
    d(b) {
      b && T(e), de(a), c && c.d(), Ge(h, b);
    }
  };
}
function Y3(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p;
  function b(...v) {
    return (
      /*change_handler_3*/
      t[13](
        /*oi*/
        t[21],
        ...v
      )
    );
  }
  function g(...v) {
    return (
      /*change_handler_4*/
      t[14](
        /*oi*/
        t[21],
        ...v
      )
    );
  }
  return {
    c() {
      e = m("div"), l = m("label"), l.textContent = "Qubits to apply", i = A(), n = m("input"), r = A(), s = m("div"), o = m("label"), o.textContent = "Qubits", u = A(), c = m("input"), f(l, "for", `op-${/*oi*/
      t[21]}-qubit-num_qubits`), f(l, "class", "svelte-1tjl940"), f(n, "type", "number"), f(n, "name", "num_qubits"), f(n, "id", `op-${/*oi*/
      t[21]}-qubit-num_qubits`), n.value = a = /*op*/
      t[19].qubit_size, f(n, "class", "svelte-1tjl940"), f(e, "class", "input-form svelte-1tjl940"), f(o, "for", `op-${/*oi*/
      t[21]}-qubit-qubits_manual`), f(o, "class", "svelte-1tjl940"), f(c, "type", "text"), f(c, "name", "qubits_manual"), f(c, "id", `op-${/*oi*/
      t[21]}-qubit-qubits_manual`), c.value = d = /*$data*/
      t[1].operations[
        /*oi*/
        t[21]
      ].qubits_manual || "", f(c, "class", "svelte-1tjl940"), f(s, "class", "input-form svelte-1tjl940");
    },
    m(v, y) {
      C(v, e, y), _(e, l), _(e, i), _(e, n), C(v, r, y), C(v, s, y), _(s, o), _(s, u), _(s, c), h || (p = [
        le(n, "change", b),
        le(c, "change", g)
      ], h = !0);
    },
    p(v, y) {
      t = v, y[0] & /*$data*/
      2 && a !== (a = /*op*/
      t[19].qubit_size) && n.value !== a && (n.value = a), y[0] & /*$data*/
      2 && d !== (d = /*$data*/
      t[1].operations[
        /*oi*/
        t[21]
      ].qubits_manual || "") && c.value !== d && (c.value = d);
    },
    i: ae,
    o: ae,
    d(v) {
      v && (T(e), T(r), T(s)), h = !1, vt(p);
    }
  };
}
function K3(t) {
  var r, s;
  let e, l, i = we((s = Pt[
    /*op*/
    (r = t[19]) == null ? void 0 : r.operation_def
  ]) == null ? void 0 : s.qubit_registers), n = [];
  for (let o = 0; o < i.length; o += 1)
    n[o] = R_(S_(t, i, o));
  const a = (o) => D(n[o], 1, 1, () => {
    n[o] = null;
  });
  return {
    c() {
      for (let o = 0; o < n.length; o += 1)
        n[o].c();
      e = Be();
    },
    m(o, u) {
      for (let c = 0; c < n.length; c += 1)
        n[c] && n[c].m(o, u);
      C(o, e, u), l = !0;
    },
    p(o, u) {
      var c, d;
      if (u[0] & /*$data, data*/
      3) {
        i = we((d = Pt[
          /*op*/
          (c = o[19]) == null ? void 0 : c.operation_def
        ]) == null ? void 0 : d.qubit_registers);
        let h;
        for (h = 0; h < i.length; h += 1) {
          const p = S_(o, i, h);
          n[h] ? (n[h].p(p, u), S(n[h], 1)) : (n[h] = R_(p), n[h].c(), S(n[h], 1), n[h].m(e.parentNode, e));
        }
        for (ge(), h = i.length; h < n.length; h += 1)
          a(h);
        be();
      }
    },
    i(o) {
      if (!l) {
        for (let u = 0; u < i.length; u += 1)
          S(n[u]);
        l = !0;
      }
    },
    o(o) {
      n = n.filter(Boolean);
      for (let u = 0; u < n.length; u += 1)
        D(n[u]);
      l = !1;
    },
    d(o) {
      o && T(e), Ge(n, o);
    }
  };
}
function E_(t) {
  let e, l;
  function i(...n) {
    return (
      /*func_4*/
      t[16](
        /*oi*/
        t[21],
        ...n
      )
    );
  }
  return e = new Bl({
    props: {
      id: `op-${/*oi*/
      t[21]}-qubit-all`,
      checked: (
        /*op*/
        t[19].apply_all
      ),
      oncheck: i,
      label: "All"
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(n, a) {
      ce(e, n, a), l = !0;
    },
    p(n, a) {
      t = n;
      const r = {};
      a[0] & /*$data*/
      2 && (r.checked = /*op*/
      t[19].apply_all), a[0] & /*data*/
      1 && (r.oncheck = i), e.$set(r);
    },
    i(n) {
      l || (S(e.$$.fragment, n), l = !0);
    },
    o(n) {
      D(e.$$.fragment, n), l = !1;
    },
    d(n) {
      de(e, n);
    }
  };
}
function O_(t) {
  let e, l;
  function i(...n) {
    return (
      /*func_5*/
      t[17](
        /*oi*/
        t[21],
        /*item*/
        t[38],
        ...n
      )
    );
  }
  return e = new Bl({
    props: {
      id: `op-${/*oi*/
      t[21]}-qubit-${/*item*/
      t[38]}`,
      checked: (
        /*op*/
        t[19].apply_to.includes(
          /*item*/
          t[38]
        )
      ),
      oncheck: i,
      label: (
        /*item*/
        t[38]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(n, a) {
      ce(e, n, a), l = !0;
    },
    p(n, a) {
      t = n;
      const r = {};
      a[0] & /*$data*/
      2 && (r.id = `op-${/*oi*/
      t[21]}-qubit-${/*item*/
      t[38]}`), a[0] & /*$data*/
      2 && (r.checked = /*op*/
      t[19].apply_to.includes(
        /*item*/
        t[38]
      )), a[0] & /*data, $data*/
      3 && (r.oncheck = i), a[0] & /*$data*/
      2 && (r.label = /*item*/
      t[38]), e.$set(r);
    },
    i(n) {
      l || (S(e.$$.fragment, n), l = !0);
    },
    o(n) {
      D(e.$$.fragment, n), l = !1;
    },
    d(n) {
      de(e, n);
    }
  };
}
function U3(t) {
  let e, l, i, n = (
    /*reg*/
    t[35] + ""
  ), a, r, s, o, u, c, d, h;
  function p(...k) {
    return (
      /*func*/
      t[10](
        /*oi*/
        t[21],
        /*reg*/
        t[35],
        ...k
      )
    );
  }
  o = new Bl({
    props: {
      id: `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-reset`,
      checked: !1,
      oncheck: p,
      label: "Reset"
    }
  });
  let b = (
    /*$data*/
    t[1].num_qubits && /*$data*/
    t[1].num_qubits !== "auto" && I_(t)
  ), g = we(
    /*$data*/
    t[1].qubits || []
  ), v = [];
  for (let k = 0; k < g.length; k += 1)
    v[k] = D_(M_(t, g, k));
  const y = (k) => D(v[k], 1, 1, () => {
    v[k] = null;
  });
  return {
    c() {
      e = m("div"), l = m("label"), i = E("Qubits to apply for "), a = E(n), r = A(), s = m("div"), he(o.$$.fragment), u = A(), b && b.c(), c = A();
      for (let k = 0; k < v.length; k += 1)
        v[k].c();
      d = A(), f(l, "class", "svelte-1tjl940"), f(s, "class", "checkbox-group svelte-1tjl940"), f(e, "class", "input-form svelte-1tjl940");
    },
    m(k, w) {
      C(k, e, w), _(e, l), _(l, i), _(l, a), _(e, r), _(e, s), ce(o, s, null), _(s, u), b && b.m(s, null), _(s, c);
      for (let $ = 0; $ < v.length; $ += 1)
        v[$] && v[$].m(s, null);
      _(e, d), h = !0;
    },
    p(k, w) {
      t = k, (!h || w[0] & /*$data*/
      2) && n !== (n = /*reg*/
      t[35] + "") && Y(a, n);
      const $ = {};
      if (w[0] & /*$data*/
      2 && ($.id = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-reset`), w[0] & /*data, $data*/
      3 && ($.oncheck = p), o.$set($), /*$data*/
      t[1].num_qubits && /*$data*/
      t[1].num_qubits !== "auto" ? b ? (b.p(t, w), w[0] & /*$data*/
      2 && S(b, 1)) : (b = I_(t), b.c(), S(b, 1), b.m(s, c)) : b && (ge(), D(b, 1, 1, () => {
        b = null;
      }), be()), w[0] & /*$data, data*/
      3) {
        g = we(
          /*$data*/
          t[1].qubits || []
        );
        let q;
        for (q = 0; q < g.length; q += 1) {
          const j = M_(t, g, q);
          v[q] ? (v[q].p(j, w), S(v[q], 1)) : (v[q] = D_(j), v[q].c(), S(v[q], 1), v[q].m(s, null));
        }
        for (ge(), q = g.length; q < v.length; q += 1)
          y(q);
        be();
      }
    },
    i(k) {
      if (!h) {
        S(o.$$.fragment, k), S(b);
        for (let w = 0; w < g.length; w += 1)
          S(v[w]);
        h = !0;
      }
    },
    o(k) {
      D(o.$$.fragment, k), D(b), v = v.filter(Boolean);
      for (let w = 0; w < v.length; w += 1)
        D(v[w]);
      h = !1;
    },
    d(k) {
      k && T(e), de(o), b && b.d(), Ge(v, k);
    }
  };
}
function W3(t) {
  let e, l, i, n = (
    /*reg*/
    t[35] + ""
  ), a, r, s, o, u, c, d, h, p, b, g = (
    /*reg*/
    t[35] + ""
  ), v, y, k, w, $, q, j, O, z;
  function N(...H) {
    return (
      /*change_handler_1*/
      t[8](
        /*oi*/
        t[21],
        /*reg*/
        t[35],
        /*reg_i*/
        t[37],
        ...H
      )
    );
  }
  function M(...H) {
    return (
      /*change_handler_2*/
      t[9](
        /*oi*/
        t[21],
        /*reg*/
        t[35],
        ...H
      )
    );
  }
  return {
    c() {
      var H, B, R, P;
      e = m("div"), l = m("label"), i = E("# Qubits "), a = E(n), s = A(), o = m("input"), d = A(), h = m("div"), p = m("label"), b = E("Qubits "), v = E(g), k = A(), w = m("input"), j = A(), f(l, "for", r = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-num_qubits`), f(l, "class", "svelte-1tjl940"), f(o, "type", "number"), f(o, "name", "num_qubits"), f(o, "id", u = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-num_qubits`), o.value = c = /*op*/
      (B = (H = t[19].qubit_registers) == null ? void 0 : H[
        /*reg*/
        t[35]
      ]) == null ? void 0 : B.size, f(o, "class", "svelte-1tjl940"), f(e, "class", "input-form svelte-1tjl940"), f(p, "for", y = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-qubits_manual`), f(p, "class", "svelte-1tjl940"), f(w, "type", "text"), f(w, "name", "qubits_manual"), f(w, "id", $ = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-qubits_manual`), w.value = q = /*op*/
      ((P = (R = t[19].qubit_registers) == null ? void 0 : R[
        /*reg*/
        t[35]
      ]) == null ? void 0 : P.qubits_manual) || "", f(w, "class", "svelte-1tjl940"), f(h, "class", "input-form svelte-1tjl940");
    },
    m(H, B) {
      C(H, e, B), _(e, l), _(l, i), _(l, a), _(e, s), _(e, o), C(H, d, B), C(H, h, B), _(h, p), _(p, b), _(p, v), _(h, k), _(h, w), _(h, j), O || (z = [
        le(o, "change", N),
        le(w, "change", M)
      ], O = !0);
    },
    p(H, B) {
      var R, P, I, L;
      t = H, B[0] & /*$data*/
      2 && n !== (n = /*reg*/
      t[35] + "") && Y(a, n), B[0] & /*$data*/
      2 && r !== (r = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-num_qubits`) && f(l, "for", r), B[0] & /*$data*/
      2 && u !== (u = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-num_qubits`) && f(o, "id", u), B[0] & /*$data*/
      2 && c !== (c = /*op*/
      (P = (R = t[19].qubit_registers) == null ? void 0 : R[
        /*reg*/
        t[35]
      ]) == null ? void 0 : P.size) && o.value !== c && (o.value = c), B[0] & /*$data*/
      2 && g !== (g = /*reg*/
      t[35] + "") && Y(v, g), B[0] & /*$data*/
      2 && y !== (y = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-qubits_manual`) && f(p, "for", y), B[0] & /*$data*/
      2 && $ !== ($ = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-qubits_manual`) && f(w, "id", $), B[0] & /*$data*/
      2 && q !== (q = /*op*/
      ((L = (I = t[19].qubit_registers) == null ? void 0 : I[
        /*reg*/
        t[35]
      ]) == null ? void 0 : L.qubits_manual) || "") && w.value !== q && (w.value = q);
    },
    i: ae,
    o: ae,
    d(H) {
      H && (T(e), T(d), T(h)), O = !1, vt(z);
    }
  };
}
function I_(t) {
  var n, a;
  let e, l;
  function i(...r) {
    return (
      /*func_1*/
      t[11](
        /*oi*/
        t[21],
        /*reg*/
        t[35],
        ...r
      )
    );
  }
  return e = new Bl({
    props: {
      id: `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-all`,
      checked: (
        /*op*/
        (a = (n = t[19].qubit_registers) == null ? void 0 : n[
          /*reg*/
          t[35]
        ]) == null ? void 0 : a.apply_all
      ),
      oncheck: i,
      label: "All"
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(r, s) {
      ce(e, r, s), l = !0;
    },
    p(r, s) {
      var u, c;
      t = r;
      const o = {};
      s[0] & /*$data*/
      2 && (o.id = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-all`), s[0] & /*$data*/
      2 && (o.checked = /*op*/
      (c = (u = t[19].qubit_registers) == null ? void 0 : u[
        /*reg*/
        t[35]
      ]) == null ? void 0 : c.apply_all), s[0] & /*data, $data*/
      3 && (o.oncheck = i), e.$set(o);
    },
    i(r) {
      l || (S(e.$$.fragment, r), l = !0);
    },
    o(r) {
      D(e.$$.fragment, r), l = !1;
    },
    d(r) {
      de(e, r);
    }
  };
}
function D_(t) {
  var n, a;
  let e, l;
  function i(...r) {
    return (
      /*func_2*/
      t[12](
        /*oi*/
        t[21],
        /*reg*/
        t[35],
        /*item*/
        t[38],
        ...r
      )
    );
  }
  return e = new Bl({
    props: {
      id: `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-${/*item*/
      t[38]}`,
      checked: (
        /*op*/
        (a = (n = t[19].qubit_registers) == null ? void 0 : n[
          /*reg*/
          t[35]
        ]) == null ? void 0 : a.apply_to.includes(
          /*item*/
          t[38]
        )
      ),
      oncheck: i,
      label: (
        /*item*/
        t[38]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(r, s) {
      ce(e, r, s), l = !0;
    },
    p(r, s) {
      var u, c;
      t = r;
      const o = {};
      s[0] & /*$data*/
      2 && (o.id = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-${/*item*/
      t[38]}`), s[0] & /*$data*/
      2 && (o.checked = /*op*/
      (c = (u = t[19].qubit_registers) == null ? void 0 : u[
        /*reg*/
        t[35]
      ]) == null ? void 0 : c.apply_to.includes(
        /*item*/
        t[38]
      )), s[0] & /*data, $data*/
      3 && (o.oncheck = i), s[0] & /*$data*/
      2 && (o.label = /*item*/
      t[38]), e.$set(o);
    },
    i(r) {
      l || (S(e.$$.fragment, r), l = !0);
    },
    o(r) {
      D(e.$$.fragment, r), l = !1;
    },
    d(r) {
      de(e, r);
    }
  };
}
function R_(t) {
  let e, l, i, n;
  const a = [W3, U3], r = [];
  function s(o, u) {
    var c, d;
    return (
      /*$data*/
      o[1].num_qubits === "auto" && ((d = Pt[
        /*op*/
        (c = o[19]) == null ? void 0 : c.operation_def
      ]) != null && d.needs_size) ? 0 : (
        /*$data*/
        o[1].num_qubits !== "auto" ? 1 : -1
      )
    );
  }
  return ~(e = s(t)) && (l = r[e] = a[e](t)), {
    c() {
      l && l.c(), i = Be();
    },
    m(o, u) {
      ~e && r[e].m(o, u), C(o, i, u), n = !0;
    },
    p(o, u) {
      let c = e;
      e = s(o), e === c ? ~e && r[e].p(o, u) : (l && (ge(), D(r[c], 1, 1, () => {
        r[c] = null;
      }), be()), ~e ? (l = r[e], l ? l.p(o, u) : (l = r[e] = a[e](o), l.c()), S(l, 1), l.m(i.parentNode, i)) : l = null);
    },
    i(o) {
      n || (S(l), n = !0);
    },
    o(o) {
      D(l), n = !1;
    },
    d(o) {
      o && T(i), ~e && r[e].d(o);
    }
  };
}
function H_(t) {
  var r, s;
  let e, l, i = we((s = Pt[
    /*op*/
    (r = t[19]) == null ? void 0 : r.operation_def
  ]) == null ? void 0 : s.params), n = [];
  for (let o = 0; o < i.length; o += 1)
    n[o] = F_(T_(t, i, o));
  const a = (o) => D(n[o], 1, 1, () => {
    n[o] = null;
  });
  return {
    c() {
      e = m("div");
      for (let o = 0; o < n.length; o += 1)
        n[o].c();
      f(e, "class", "input-row svelte-1tjl940");
    },
    m(o, u) {
      C(o, e, u);
      for (let c = 0; c < n.length; c += 1)
        n[c] && n[c].m(e, null);
      l = !0;
    },
    p(o, u) {
      var c, d;
      if (u[0] & /*data, $data*/
      3) {
        i = we((d = Pt[
          /*op*/
          (c = o[19]) == null ? void 0 : c.operation_def
        ]) == null ? void 0 : d.params);
        let h;
        for (h = 0; h < i.length; h += 1) {
          const p = T_(o, i, h);
          n[h] ? (n[h].p(p, u), S(n[h], 1)) : (n[h] = F_(p), n[h].c(), S(n[h], 1), n[h].m(e, null));
        }
        for (ge(), h = i.length; h < n.length; h += 1)
          a(h);
        be();
      }
    },
    i(o) {
      if (!l) {
        for (let u = 0; u < i.length; u += 1)
          S(n[u]);
        l = !0;
      }
    },
    o(o) {
      n = n.filter(Boolean);
      for (let u = 0; u < n.length; u += 1)
        D(n[u]);
      l = !1;
    },
    d(o) {
      o && T(e), Ge(n, o);
    }
  };
}
function F_(t) {
  let e, l;
  return e = new qg({
    props: {
      data: (
        /*data*/
        t[0]
      ),
      param: (
        /*param*/
        t[31]
      ),
      oi: (
        /*oi*/
        t[21]
      ),
      pi: (
        /*pi*/
        t[33]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*data*/
      1 && (a.data = /*data*/
      i[0]), n[0] & /*$data*/
      2 && (a.param = /*param*/
      i[31]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function L_(t) {
  var n, a;
  let e, l, i = (
    /*$data*/
    ((a = (n = t[1].operations[
      /*oi*/
      t[21]
    ]) == null ? void 0 : n.apply_to) == null ? void 0 : a.length) > 0 && Q_(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(r, s) {
      i && i.m(r, s), C(r, e, s), l = !0;
    },
    p(r, s) {
      var o, u;
      /*$data*/
      ((u = (o = r[1].operations[
        /*oi*/
        r[21]
      ]) == null ? void 0 : o.apply_to) == null ? void 0 : u.length) > 0 ? i ? (i.p(r, s), s[0] & /*$data*/
      2 && S(i, 1)) : (i = Q_(r), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(r) {
      l || (S(i), l = !0);
    },
    o(r) {
      D(i), l = !1;
    },
    d(r) {
      r && T(e), i && i.d(r);
    }
  };
}
function Q_(t) {
  var r;
  let e, l, i = we(
    /*$data*/
    (r = t[1].operations[
      /*oi*/
      t[21]
    ]) == null ? void 0 : r.apply_to
  ), n = [];
  for (let s = 0; s < i.length; s += 1)
    n[s] = X_(q_(t, i, s));
  const a = (s) => D(n[s], 1, 1, () => {
    n[s] = null;
  });
  return {
    c() {
      for (let s = 0; s < n.length; s += 1)
        n[s].c();
      e = Be();
    },
    m(s, o) {
      for (let u = 0; u < n.length; u += 1)
        n[u] && n[u].m(s, o);
      C(s, e, o), l = !0;
    },
    p(s, o) {
      var u;
      if (o[0] & /*$data, data*/
      3) {
        i = we(
          /*$data*/
          (u = s[1].operations[
            /*oi*/
            s[21]
          ]) == null ? void 0 : u.apply_to
        );
        let c;
        for (c = 0; c < i.length; c += 1) {
          const d = q_(s, i, c);
          n[c] ? (n[c].p(d, o), S(n[c], 1)) : (n[c] = X_(d), n[c].c(), S(n[c], 1), n[c].m(e.parentNode, e));
        }
        for (ge(), c = i.length; c < n.length; c += 1)
          a(c);
        be();
      }
    },
    i(s) {
      if (!l) {
        for (let o = 0; o < i.length; o += 1)
          S(n[o]);
        l = !0;
      }
    },
    o(s) {
      n = n.filter(Boolean);
      for (let o = 0; o < n.length; o += 1)
        D(n[o]);
      l = !1;
    },
    d(s) {
      s && T(e), Ge(n, s);
    }
  };
}
function V_(t) {
  let e, l;
  return e = new qg({
    props: {
      data: (
        /*data*/
        t[0]
      ),
      param: {
        type: (
          /*param*/
          t[31].type
        ),
        key: (
          /*param*/
          t[31].key + "/" + /*q*/
          t[28]
        ),
        name: (
          /*param*/
          t[31].name + " for " + /*q*/
          t[28]
        ),
        option: (
          /*param*/
          t[31].option
        )
      },
      oi: (
        /*oi*/
        t[21]
      ),
      pi: (
        /*pi*/
        t[33] + "-" + /*q*/
        t[28]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*data*/
      1 && (a.data = /*data*/
      i[0]), n[0] & /*$data*/
      2 && (a.param = {
        type: (
          /*param*/
          i[31].type
        ),
        key: (
          /*param*/
          i[31].key + "/" + /*q*/
          i[28]
        ),
        name: (
          /*param*/
          i[31].name + " for " + /*q*/
          i[28]
        ),
        option: (
          /*param*/
          i[31].option
        )
      }), n[0] & /*$data*/
      2 && (a.pi = /*pi*/
      i[33] + "-" + /*q*/
      i[28]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function X_(t) {
  var s, o;
  let e, l, i, n = we((o = Pt[
    /*op*/
    (s = t[19]) == null ? void 0 : s.operation_def
  ]) == null ? void 0 : o.params_per_bit), a = [];
  for (let u = 0; u < n.length; u += 1)
    a[u] = V_(j_(t, n, u));
  const r = (u) => D(a[u], 1, 1, () => {
    a[u] = null;
  });
  return {
    c() {
      e = m("div");
      for (let u = 0; u < a.length; u += 1)
        a[u].c();
      l = A(), f(e, "class", "input-row svelte-1tjl940");
    },
    m(u, c) {
      C(u, e, c);
      for (let d = 0; d < a.length; d += 1)
        a[d] && a[d].m(e, null);
      _(e, l), i = !0;
    },
    p(u, c) {
      var d, h;
      if (c[0] & /*data, $data*/
      3) {
        n = we((h = Pt[
          /*op*/
          (d = u[19]) == null ? void 0 : d.operation_def
        ]) == null ? void 0 : h.params_per_bit);
        let p;
        for (p = 0; p < n.length; p += 1) {
          const b = j_(u, n, p);
          a[p] ? (a[p].p(b, c), S(a[p], 1)) : (a[p] = V_(b), a[p].c(), S(a[p], 1), a[p].m(e, l));
        }
        for (ge(), p = n.length; p < a.length; p += 1)
          r(p);
        be();
      }
    },
    i(u) {
      if (!i) {
        for (let c = 0; c < n.length; c += 1)
          S(a[c]);
        i = !0;
      }
    },
    o(u) {
      a = a.filter(Boolean);
      for (let c = 0; c < a.length; c += 1)
        D(a[c]);
      i = !1;
    },
    d(u) {
      u && T(e), Ge(a, u);
    }
  };
}
function G_(t) {
  var r, s;
  let e, l, i = we((s = Pt[
    /*op*/
    (r = t[19]) == null ? void 0 : r.operation_def
  ]) == null ? void 0 : s.globals), n = [];
  for (let o = 0; o < i.length; o += 1)
    n[o] = Y_($_(t, i, o));
  const a = (o) => D(n[o], 1, 1, () => {
    n[o] = null;
  });
  return {
    c() {
      e = m("div");
      for (let o = 0; o < n.length; o += 1)
        n[o].c();
      f(e, "class", "input-row svelte-1tjl940");
    },
    m(o, u) {
      C(o, e, u);
      for (let c = 0; c < n.length; c += 1)
        n[c] && n[c].m(e, null);
      l = !0;
    },
    p(o, u) {
      var c, d;
      if (u[0] & /*$data, data*/
      3) {
        i = we((d = Pt[
          /*op*/
          (c = o[19]) == null ? void 0 : c.operation_def
        ]) == null ? void 0 : d.globals);
        let h;
        for (h = 0; h < i.length; h += 1) {
          const p = $_(o, i, h);
          n[h] ? (n[h].p(p, u), S(n[h], 1)) : (n[h] = Y_(p), n[h].c(), S(n[h], 1), n[h].m(e, null));
        }
        for (ge(), h = i.length; h < n.length; h += 1)
          a(h);
        be();
      }
    },
    i(o) {
      if (!l) {
        for (let u = 0; u < i.length; u += 1)
          S(n[u]);
        l = !0;
      }
    },
    o(o) {
      n = n.filter(Boolean);
      for (let u = 0; u < n.length; u += 1)
        D(n[u]);
      l = !1;
    },
    d(o) {
      o && T(e), Ge(n, o);
    }
  };
}
function Y_(t) {
  let e, l;
  return e = new V3({
    props: {
      glb: (
        /*glb*/
        t[25]
      ),
      gi: (
        /*gi*/
        t[27]
      ),
      data: (
        /*data*/
        t[0]
      ),
      oi: (
        /*oi*/
        t[21]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*$data*/
      2 && (a.glb = /*glb*/
      i[25]), n[0] & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function K_(t) {
  var n, a;
  let e, l = we((a = Pt[
    /*op*/
    (n = t[19]) == null ? void 0 : n.operation_def
  ]) == null ? void 0 : a.constraints), i = [];
  for (let r = 0; r < l.length; r += 1)
    i[r] = U_(w_(t, l, r));
  return {
    c() {
      e = m("div");
      for (let r = 0; r < i.length; r += 1)
        i[r].c();
      f(e, "class", "input-row svelte-1tjl940");
    },
    m(r, s) {
      C(r, e, s);
      for (let o = 0; o < i.length; o += 1)
        i[o] && i[o].m(e, null);
    },
    p(r, s) {
      var o, u;
      if (s[0] & /*$data*/
      2) {
        l = we((u = Pt[
          /*op*/
          (o = r[19]) == null ? void 0 : o.operation_def
        ]) == null ? void 0 : u.constraints);
        let c;
        for (c = 0; c < l.length; c += 1) {
          const d = w_(r, l, c);
          i[c] ? i[c].p(d, s) : (i[c] = U_(d), i[c].c(), i[c].m(e, null));
        }
        for (; c < i.length; c += 1)
          i[c].d(1);
        i.length = l.length;
      }
    },
    d(r) {
      r && T(e), Ge(i, r);
    }
  };
}
function J3(t) {
  let e, l, i = (
    /*co*/
    t[22].success + ""
  ), n, a;
  return {
    c() {
      e = m("div"), l = E("Constraint satisfied: "), n = E(i), a = A(), f(e, "class", "success svelte-1tjl940");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, n), _(e, a);
    },
    p(r, s) {
      s[0] & /*$data*/
      2 && i !== (i = /*co*/
      r[22].success + "") && Y(n, i);
    },
    d(r) {
      r && T(e);
    }
  };
}
function Z3(t) {
  let e, l, i, n = (
    /*co*/
    t[22].warning + ""
  ), a, r;
  return {
    c() {
      e = m("div"), l = m("strong"), l.textContent = "Constraint unsatisfied:", i = A(), a = E(n), r = A(), f(l, "class", "svelte-1tjl940"), f(e, "class", "warning svelte-1tjl940");
    },
    m(s, o) {
      C(s, e, o), _(e, l), _(e, i), _(e, a), _(e, r);
    },
    p(s, o) {
      o[0] & /*$data*/
      2 && n !== (n = /*co*/
      s[22].warning + "") && Y(a, n);
    },
    d(s) {
      s && T(e);
    }
  };
}
function U_(t) {
  let e, l;
  function i(r, s) {
    var o, u;
    return s[0] & /*$data*/
    2 && (e = null), e == null && (e = !v3(
      /*co*/
      r[22],
      /*op*/
      r[19],
      (u = Pt[
        /*op*/
        (o = r[19]) == null ? void 0 : o.operation_def
      ]) == null ? void 0 : u.variables,
      /*$data*/
      r[1].num_qubits === "auto"
    )), e ? Z3 : J3;
  }
  let n = i(t, [-1, -1]), a = n(t);
  return {
    c() {
      a.c(), l = Be();
    },
    m(r, s) {
      a.m(r, s), C(r, l, s);
    },
    p(r, s) {
      n === (n = i(r, s)) && a ? a.p(r, s) : (a.d(1), a = n(r), a && (a.c(), a.m(l.parentNode, l)));
    },
    d(r) {
      r && T(l), a.d(r);
    }
  };
}
function W_(t) {
  var r, s;
  let e, l, i = ((s = Pt[
    /*op*/
    (r = t[19]) == null ? void 0 : r.operation_def
  ]) == null ? void 0 : s.notes) + "", n, a;
  return {
    c() {
      e = m("div"), l = m("span"), n = E(i), a = A(), f(l, "class", "note svelte-1tjl940"), f(e, "class", "svelte-1tjl940");
    },
    m(o, u) {
      C(o, e, u), _(e, l), _(l, n), _(e, a);
    },
    p(o, u) {
      var c, d;
      u[0] & /*$data*/
      2 && i !== (i = ((d = Pt[
        /*op*/
        (c = o[19]) == null ? void 0 : c.operation_def
      ]) == null ? void 0 : d.notes) + "") && Y(n, i);
    },
    d(o) {
      o && T(e);
    }
  };
}
function J_(t) {
  var ue, ne, oe, x, ve, se, Re, Ce, pe, De;
  let e, l, i = (
    /*op*/
    t[19].deactive ? "[Deactive]" : ""
  ), n, a, r = (
    /*oi*/
    t[21] + 1 + ""
  ), s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R, P, I, L, F, X, V, Q = !/*op*/
  t[19].deactive && N_(t), J = (
    /*op*/
    t[19].deactive && A_(t)
  );
  function te(...re) {
    return (
      /*click_handler_2*/
      t[4](
        /*oi*/
        t[21],
        ...re
      )
    );
  }
  let ie = (
    /*oi*/
    t[21] > 0 && X3(t)
  ), U = (
    /*oi*/
    t[21] < /*$data*/
    t[1].operations.length - 1 && B_(t)
  ), G = we(u_), W = [];
  for (let re = 0; re < G.length; re += 1)
    W[re] = P_(z_(t, G, re));
  function Z(...re) {
    return (
      /*change_handler*/
      t[7](
        /*oi*/
        t[21],
        ...re
      )
    );
  }
  const ee = [K3, Y3, G3], ye = [];
  function qe(re, Se) {
    var Ue, Ke, xe, wt;
    return (Ke = Pt[
      /*op*/
      (Ue = re[19]) == null ? void 0 : Ue.operation_def
    ]) != null && Ke.qubit_registers ? 0 : (
      /*$data*/
      re[1].num_qubits === "auto" && ((wt = Pt[
        /*op*/
        (xe = re[19]) == null ? void 0 : xe.operation_def
      ]) != null && wt.needs_size) ? 1 : 2
    );
  }
  N = qe(t), M = ye[N] = ee[N](t);
  let je = ((ne = Pt[
    /*op*/
    (ue = t[19]) == null ? void 0 : ue.operation_def
  ]) == null ? void 0 : ne.params) && H_(t), fe = ((x = Pt[
    /*op*/
    (oe = t[19]) == null ? void 0 : oe.operation_def
  ]) == null ? void 0 : x.params_per_bit) && L_(t), _e = ((se = Pt[
    /*op*/
    (ve = t[19]) == null ? void 0 : ve.operation_def
  ]) == null ? void 0 : se.globals) && G_(t), K = ((Ce = Pt[
    /*op*/
    (Re = t[19]) == null ? void 0 : Re.operation_def
  ]) == null ? void 0 : Ce.constraints) && K_(t), ke = ((De = Pt[
    /*op*/
    (pe = t[19]) == null ? void 0 : pe.operation_def
  ]) == null ? void 0 : De.notes) && W_(t);
  return {
    c() {
      e = m("div"), l = m("h5"), n = E(i), a = E(" Operation "), s = E(r), o = A(), u = m("span"), Q && Q.c(), c = A(), J && J.c(), d = A(), h = m("button"), h.textContent = "× Remove", p = A(), ie && ie.c(), b = A(), U && U.c(), g = A(), v = m("div"), y = m("div"), k = m("label"), k.textContent = "Operation type", w = A(), $ = m("select"), q = m("option"), q.textContent = "-";
      for (let re = 0; re < W.length; re += 1)
        W[re].c();
      z = A(), M.c(), H = A(), je && je.c(), B = A(), fe && fe.c(), R = A(), _e && _e.c(), P = A(), K && K.c(), I = A(), ke && ke.c(), L = Be(), f(h, "class", "svelte-1tjl940"), f(u, "class", "header-button-group svelte-1tjl940"), f(l, "class", "svelte-1tjl940"), f(k, "for", "op_type-" + /*oi*/
      t[21]), f(k, "class", "svelte-1tjl940"), q.__value = "-", dt(q, q.__value), f(q, "class", "svelte-1tjl940"), f($, "id", "op_type-" + /*oi*/
      t[21]), f($, "name", "op_type-" + /*oi*/
      t[21]), $.disabled = O = !/*$data*/
      t[1].num_qubits, f($, "class", "svelte-1tjl940"), f(y, "class", "input-form svelte-1tjl940"), f(v, "class", "input-row svelte-1tjl940"), f(e, "class", "op-wrap svelte-1tjl940");
    },
    m(re, Se) {
      C(re, e, Se), _(e, l), _(l, n), _(l, a), _(l, s), _(l, o), _(l, u), Q && Q.m(u, null), _(u, c), J && J.m(u, null), _(u, d), _(u, h), _(u, p), ie && ie.m(u, null), _(u, b), U && U.m(u, null), _(e, g), _(e, v), _(v, y), _(y, k), _(y, w), _(y, $), _($, q);
      for (let Ue = 0; Ue < W.length; Ue += 1)
        W[Ue] && W[Ue].m($, null);
      _l(
        $,
        /*op*/
        t[19].operation_def
      ), _(v, z), ye[N].m(v, null), _(e, H), je && je.m(e, null), _(e, B), fe && fe.m(e, null), _(e, R), _e && _e.m(e, null), _(e, P), K && K.m(e, null), C(re, I, Se), ke && ke.m(re, Se), C(re, L, Se), F = !0, X || (V = [
        le(h, "click", te),
        le($, "change", Z)
      ], X = !0);
    },
    p(re, Se) {
      var Ke, xe, wt, $t, st, qt, Dt, ot, ht, Me;
      if (t = re, (!F || Se[0] & /*$data*/
      2) && i !== (i = /*op*/
      t[19].deactive ? "[Deactive]" : "") && Y(n, i), /*op*/
      t[19].deactive ? Q && (Q.d(1), Q = null) : Q ? Q.p(t, Se) : (Q = N_(t), Q.c(), Q.m(u, c)), /*op*/
      t[19].deactive ? J ? J.p(t, Se) : (J = A_(t), J.c(), J.m(u, d)) : J && (J.d(1), J = null), /*oi*/
      t[21] > 0 && ie.p(t, Se), /*oi*/
      t[21] < /*$data*/
      t[1].operations.length - 1 ? U ? U.p(t, Se) : (U = B_(t), U.c(), U.m(u, null)) : U && (U.d(1), U = null), Se[0] & /*$data*/
      2) {
        G = we(u_);
        let me;
        for (me = 0; me < G.length; me += 1) {
          const Oe = z_(t, G, me);
          W[me] ? W[me].p(Oe, Se) : (W[me] = P_(Oe), W[me].c(), W[me].m($, null));
        }
        for (; me < W.length; me += 1)
          W[me].d(1);
        W.length = G.length;
      }
      (!F || Se[0] & /*$data*/
      2 && j !== (j = /*op*/
      t[19].operation_def)) && _l(
        $,
        /*op*/
        t[19].operation_def
      ), (!F || Se[0] & /*$data*/
      2 && O !== (O = !/*$data*/
      t[1].num_qubits)) && ($.disabled = O);
      let Ue = N;
      N = qe(t), N === Ue ? ye[N].p(t, Se) : (ge(), D(ye[Ue], 1, 1, () => {
        ye[Ue] = null;
      }), be(), M = ye[N], M ? M.p(t, Se) : (M = ye[N] = ee[N](t), M.c()), S(M, 1), M.m(v, null)), (xe = Pt[
        /*op*/
        (Ke = t[19]) == null ? void 0 : Ke.operation_def
      ]) != null && xe.params ? je ? (je.p(t, Se), Se[0] & /*$data*/
      2 && S(je, 1)) : (je = H_(t), je.c(), S(je, 1), je.m(e, B)) : je && (ge(), D(je, 1, 1, () => {
        je = null;
      }), be()), ($t = Pt[
        /*op*/
        (wt = t[19]) == null ? void 0 : wt.operation_def
      ]) != null && $t.params_per_bit ? fe ? (fe.p(t, Se), Se[0] & /*$data*/
      2 && S(fe, 1)) : (fe = L_(t), fe.c(), S(fe, 1), fe.m(e, R)) : fe && (ge(), D(fe, 1, 1, () => {
        fe = null;
      }), be()), (qt = Pt[
        /*op*/
        (st = t[19]) == null ? void 0 : st.operation_def
      ]) != null && qt.globals ? _e ? (_e.p(t, Se), Se[0] & /*$data*/
      2 && S(_e, 1)) : (_e = G_(t), _e.c(), S(_e, 1), _e.m(e, P)) : _e && (ge(), D(_e, 1, 1, () => {
        _e = null;
      }), be()), (ot = Pt[
        /*op*/
        (Dt = t[19]) == null ? void 0 : Dt.operation_def
      ]) != null && ot.constraints ? K ? K.p(t, Se) : (K = K_(t), K.c(), K.m(e, null)) : K && (K.d(1), K = null), (Me = Pt[
        /*op*/
        (ht = t[19]) == null ? void 0 : ht.operation_def
      ]) != null && Me.notes ? ke ? ke.p(t, Se) : (ke = W_(t), ke.c(), ke.m(L.parentNode, L)) : ke && (ke.d(1), ke = null);
    },
    i(re) {
      F || (S(M), S(je), S(fe), S(_e), F = !0);
    },
    o(re) {
      D(M), D(je), D(fe), D(_e), F = !1;
    },
    d(re) {
      re && (T(e), T(I), T(L)), Q && Q.d(), J && J.d(), ie && ie.d(), U && U.d(), Ge(W, re), ye[N].d(), je && je.d(), fe && fe.d(), _e && _e.d(), K && K.d(), ke && ke.d(re), X = !1, vt(V);
    }
  };
}
function Z_(t) {
  let e;
  return {
    c() {
      e = m("hr"), f(e, "class", "svelte-1tjl940");
    },
    m(l, i) {
      C(l, e, i);
    },
    d(l) {
      l && T(e);
    }
  };
}
function x3(t) {
  var H, B, R;
  let e, l, i, n, a = (
    /*$data*/
    ((H = t[1]) == null ? void 0 : H.num_operations) + ""
  ), r, s, o = (
    /*$data*/
    ((B = t[1]) == null ? void 0 : B.num_operations) == 1 ? "" : "s"
  ), u, c, d, h, p, b, g, v, y, k, w, $, q, j, O = we(
    /*$data*/
    t[1].operations || []
  ), z = [];
  for (let P = 0; P < O.length; P += 1)
    z[P] = J_(y_(t, O, P));
  const N = (P) => D(z[P], 1, 1, () => {
    z[P] = null;
  });
  let M = (
    /*$data*/
    ((R = t[1].operations) == null ? void 0 : R.length) > 0 && Z_()
  );
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`2. Define operations
    `), n = m("span"), r = E(a), s = E(" active opeartion"), u = E(o), c = E("."), d = A(), h = m("div");
      for (let P = 0; P < z.length; P += 1)
        z[P].c();
      p = A(), M && M.c(), b = A(), g = m("div"), v = m("button"), v.textContent = "Add an operation", y = A(), k = m("span"), k.textContent = "Deactive operations are excluded from the final circuit code.", f(n, "class", "note svelte-1tjl940"), f(l, "class", "svelte-1tjl940"), f(h, "class", "content-wrap svelte-1tjl940"), f(v, "class", "svelte-1tjl940"), f(g, "class", "input-row svelte-1tjl940"), f(k, "class", "note svelte-1tjl940"), f(e, "class", w = Gt(
        /*$data*/
        t[1].num_qubits ? "" : "deactive"
      ) + " svelte-1tjl940");
    },
    m(P, I) {
      C(P, e, I), _(e, l), _(l, i), _(l, n), _(n, r), _(n, s), _(n, u), _(n, c), _(e, d), _(e, h);
      for (let L = 0; L < z.length; L += 1)
        z[L] && z[L].m(h, null);
      _(e, p), M && M.m(e, null), _(e, b), _(e, g), _(g, v), _(e, y), _(e, k), $ = !0, q || (j = le(
        v,
        "click",
        /*click_handler_5*/
        t[18]
      ), q = !0);
    },
    p(P, I) {
      var L, F, X;
      if ((!$ || I[0] & /*$data*/
      2) && a !== (a = /*$data*/
      ((L = P[1]) == null ? void 0 : L.num_operations) + "") && Y(r, a), (!$ || I[0] & /*$data*/
      2) && o !== (o = /*$data*/
      ((F = P[1]) == null ? void 0 : F.num_operations) == 1 ? "" : "s") && Y(u, o), I[0] & /*$data, data*/
      3) {
        O = we(
          /*$data*/
          P[1].operations || []
        );
        let V;
        for (V = 0; V < O.length; V += 1) {
          const Q = y_(P, O, V);
          z[V] ? (z[V].p(Q, I), S(z[V], 1)) : (z[V] = J_(Q), z[V].c(), S(z[V], 1), z[V].m(h, null));
        }
        for (ge(), V = O.length; V < z.length; V += 1)
          N(V);
        be();
      }
      /*$data*/
      ((X = P[1].operations) == null ? void 0 : X.length) > 0 ? M || (M = Z_(), M.c(), M.m(e, b)) : M && (M.d(1), M = null), (!$ || I[0] & /*$data*/
      2 && w !== (w = Gt(
        /*$data*/
        P[1].num_qubits ? "" : "deactive"
      ) + " svelte-1tjl940")) && f(e, "class", w);
    },
    i(P) {
      if (!$) {
        for (let I = 0; I < O.length; I += 1)
          S(z[I]);
        $ = !0;
      }
    },
    o(P) {
      z = z.filter(Boolean);
      for (let I = 0; I < z.length; I += 1)
        D(z[I]);
      $ = !1;
    },
    d(P) {
      P && T(e), Ge(z, P), M && M.d(), q = !1, j();
    }
  };
}
function e4(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(r, (z) => l(1, i = z)), r);
  t.$$.on_destroy.push(() => n());
  let { data: r = Pe({}) } = e;
  a();
  const s = (z, N) => {
    r.update((M) => (M.operations[z].deactive = !0, M));
  }, o = (z, N) => {
    r.update((M) => (M.operations[z].deactive = !1, M));
  }, u = (z, N) => {
    r.update((M) => (M.operations.splice(z, 1), M));
  }, c = (z, N) => {
    r.update((M) => ([M.operations[z], M.operations[z - 1]] = [M.operations[z - 1], M.operations[z]], M));
  }, d = (z, N) => {
    r.update((M) => ([M.operations[z], M.operations[z + 1]] = [M.operations[z + 1], M.operations[z]], M));
  }, h = (z, N) => {
    r.update((M) => (M.operations[z].operation_def = N.target.value, M));
  }, p = (z, N, M, H) => {
    r.update((B) => (B.operations[z].qubit_registers || (B.operations[z].qubit_registers = {}), B.operations[z].qubit_registers[N] || (B.operations[z].qubit_registers[N] = { apply_all: !1, apply_to: [] }), B.operations[z].qubit_registers[N].size = parseInt(H.target.value), B.operations[z].qubit_registers[N].size > 0 && (B.operations[z].qubit_registers[N].apply_to = Array.from(Array(B.operations[z].qubit_registers[N].size).keys()).map((R) => M * 1e3 + R)), B));
  }, b = (z, N, M) => {
    r.update((H) => (H.operations[z].qubit_registers || (H.operations[z].qubit_registers = {}), H.operations[z].qubit_registers[N] || (H.operations[z].qubit_registers[N] = { apply_all: !1, apply_to: [] }), M.target.value.length > 0 ? (H.operations[z].qubit_registers[N].qubits_manual = M.target.value, H.operations[z].qubit_registers[N].apply_to = M.target.value.split(",").map((B) => parseInt(B.trim()))) : (delete H.operations[z].qubit_registers[N].qubits_manual, H.operations[z].qubit_registers[N].apply_to = []), H));
  }, g = (z, N, M) => {
    r.update((H) => {
      var B, R, P;
      return (P = (R = (B = H.operations) == null ? void 0 : B[z]) == null ? void 0 : R.qubit_registers) != null && P[N] && (H.operations[z].qubit_registers[N] = { apply_all: !1, apply_to: [] }), H;
    });
  }, v = (z, N, M) => {
    r.update((H) => (H.operations[z].qubit_registers || (H.operations[z].qubit_registers = {}), H.operations[z].qubit_registers[N] || (H.operations[z].qubit_registers[N] = { apply_all: !1, apply_to: [] }), H.operations[z].qubit_registers[N].apply_all = M, M ? H.operations[z].qubit_registers[N].apply_to = H.qubits.map((B) => B) : H.operations[z].qubit_registers[N].apply_to = [], H));
  }, y = (z, N, M, H) => {
    r.update((B) => {
      var R, P;
      return B.operations[z].qubit_registers || (B.operations[z].qubit_registers = {}), B.operations[z].qubit_registers[N] || (B.operations[z].qubit_registers[N] = { apply_all: !1, apply_to: [] }), H && !((R = B.operations[z].qubit_registers[N]) != null && R.apply_to.includes(M)) ? B.operations[z].qubit_registers[N].apply_to.push(M) : !H && ((P = B.operations[z].qubit_registers[N]) != null && P.apply_to.includes(M)) && B.operations[z].qubit_registers[N].apply_to.splice(B.operations[z].qubit_registers[N].apply_to.indexOf(M), 1), B;
    });
  }, k = (z, N) => {
    r.update((M) => (M.operations[z].qubit_size = parseInt(N.target.value), M.operations[z].qubit_size > 0 && (M.operations[z].apply_to = Array.from(Array(M.operations[z].qubit_size).keys())), M));
  }, w = (z, N) => {
    r.update((M) => (N.target.value.length > 0 ? (M.operations[z].qubits_manual = N.target.value, M.operations[z].apply_to = N.target.value.split(",").map((H) => parseInt(H.trim()))) : (delete M.operations[z].qubits_manual, M.operations[z].apply_to = []), M));
  }, $ = (z, N) => {
    r.update((M) => {
      var H;
      return (H = M.operations) != null && H[z] && (M.operations[z].apply_to = [], M.operations[z].apply_all = !1), M;
    });
  }, q = (z, N) => {
    r.update((M) => (M.operations[z].apply_all = N, N ? M.operations[z].apply_to = M.qubits.map((H) => H) : M.operations[z].apply_to = [], M));
  }, j = (z, N, M) => {
    r.update((H) => (M && !H.operations[z].apply_to.includes(N) ? H.operations[z].apply_to.push(N) : !M && H.operations[z].apply_to.includes(N) && H.operations[z].apply_to.splice(H.operations[z].apply_to.indexOf(N), 1), H));
  }, O = (z) => {
    r.update((N) => (N.operations || (N.operations = []), N.num_operations || (N.num_operations = 0), N.operations.push({
      operation_def: void 0,
      apply_to: [],
      apply_all: !1
    }), N));
  };
  return t.$$set = (z) => {
    "data" in z && a(l(0, r = z.data));
  }, [
    r,
    i,
    s,
    o,
    u,
    c,
    d,
    h,
    p,
    b,
    g,
    v,
    y,
    k,
    w,
    $,
    q,
    j,
    O
  ];
}
class t4 extends Ve {
  constructor(e) {
    super(), Qe(this, e, e4, x3, Le, { data: 0 }, null, [-1, -1]);
  }
}
function l4(t, e) {
  let l = t - e;
  if (l < 0)
    return null;
  {
    let i = "I".repeat(l);
    return jg(e).map((n) => n + i);
  }
}
const x_ = ["X", "Y", "Z"];
function jg(t) {
  if (t == 1)
    return x_;
  let e = [];
  for (const l of x_) {
    let i = jg(t - 1).map((n) => l + n);
    e.push(...i);
  }
  return e;
}
function ec(t, e, l) {
  const i = t.slice();
  return i[12] = e[l], i[14] = l, i;
}
function tc(t, e, l) {
  const i = t.slice();
  return i[15] = e[l], i[17] = l, i;
}
function lc(t) {
  let e, l, i;
  function n(...a) {
    return (
      /*click_handler*/
      t[4](
        /*pi*/
        t[14],
        ...a
      )
    );
  }
  return {
    c() {
      e = m("button"), e.textContent = "⊗ Deactivate", f(e, "class", "svelte-1fuex22");
    },
    m(a, r) {
      C(a, e, r), l || (i = le(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && T(e), l = !1, i();
    }
  };
}
function ic(t) {
  let e, l, i;
  function n(...a) {
    return (
      /*click_handler_1*/
      t[5](
        /*pi*/
        t[14],
        ...a
      )
    );
  }
  return {
    c() {
      e = m("button"), e.textContent = "⊚ Activate", f(e, "class", "svelte-1fuex22");
    },
    m(a, r) {
      C(a, e, r), l || (i = le(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && T(e), l = !1, i();
    }
  };
}
function i4(t) {
  let e, l, i;
  function n(...a) {
    return (
      /*click_handler_3*/
      t[7](
        /*pi*/
        t[14],
        ...a
      )
    );
  }
  return {
    c() {
      e = m("button"), e.textContent = "↑ Move up", f(e, "class", "svelte-1fuex22");
    },
    m(a, r) {
      C(a, e, r), l || (i = le(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && T(e), l = !1, i();
    }
  };
}
function nc(t) {
  let e, l, i;
  function n(...a) {
    return (
      /*click_handler_4*/
      t[8](
        /*pi*/
        t[14],
        ...a
      )
    );
  }
  return {
    c() {
      e = m("button"), e.textContent = "↓ Move down", f(e, "class", "svelte-1fuex22");
    },
    m(a, r) {
      C(a, e, r), l || (i = le(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && T(e), l = !1, i();
    }
  };
}
function ac(t) {
  let e = (
    /*xi*/
    t[17] > 0 ? " | " : ""
  ), l, i;
  return {
    c() {
      l = E(e), i = E(
        /*xi*/
        t[17]
      );
    },
    m(n, a) {
      C(n, l, a), C(n, i, a);
    },
    p: ae,
    d(n) {
      n && (T(l), T(i));
    }
  };
}
function rc(t) {
  let e, l, i = (
    /*pauli*/
    t[12].deactive ? "[Deactive]" : ""
  ), n, a, r = (
    /*pi*/
    t[14] + 1 + ""
  ), s, o, u = (
    /*pauli*/
    t[12].observable + ""
  ), c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R, P, I, L = !/*pauli*/
  t[12].deactive && lc(t), F = (
    /*pauli*/
    t[12].deactive && ic(t)
  );
  function X(...U) {
    return (
      /*click_handler_2*/
      t[6](
        /*pi*/
        t[14],
        ...U
      )
    );
  }
  let V = (
    /*pi*/
    t[14] > 0 && i4(t)
  ), Q = (
    /*pi*/
    t[14] < /*$data*/
    t[1].pauli_obs.length - 1 && nc(t)
  ), J = we({
    length: (
      /*$data*/
      t[1].machine_qubits ? (
        /*$data*/
        t[1].machine_qubits
      ) : (
        /*$data*/
        t[1].num_qubits
      )
    )
  }), te = [];
  for (let U = 0; U < J.length; U += 1)
    te[U] = ac(tc(t, J, U));
  function ie(...U) {
    return (
      /*change_handler*/
      t[9](
        /*pi*/
        t[14],
        ...U
      )
    );
  }
  return {
    c() {
      e = m("div"), l = m("h5"), n = E(i), a = E(" Observable "), s = E(r), o = E(". ("), c = E(u), d = E(`)
          `), h = m("span"), L && L.c(), p = A(), F && F.c(), b = A(), g = m("button"), g.textContent = "× Remove", v = A(), V && V.c(), y = A(), Q && Q.c(), k = A(), w = m("div"), $ = m("div"), q = m("label");
      for (let U = 0; U < te.length; U += 1)
        te[U].c();
      j = A(), O = m("input"), H = A(), B = m("span"), R = A(), f(g, "class", "svelte-1fuex22"), f(h, "class", "header-button-group svelte-1fuex22"), f(l, "class", "svelte-1fuex22"), f(q, "for", `pauli-obs-${/*pi*/
      t[14]}`), f(q, "class", "pauli-label svelte-1fuex22"), f(O, "type", "text"), f(O, "class", "pauli-input-form svelte-1fuex22"), f(O, "id", `pauli-obs-${/*pi*/
      t[14]}`), f(O, "name", `pauli-obs-${/*pi*/
      t[14]}`), O.value = z = /*$data*/
      t[1].pauli_obs[
        /*pi*/
        t[14]
      ].observable, f(O, "pattern", N = `[iIxXyYzZ]${/*$data*/
      t[1].machine_qubits ? `{${/*$data*/
      t[1].machine_qubits}}` : "+"}`), f(O, "style", M = `width: ${/*$data*/
      t[1].pauli_obs[
        /*pi*/
        t[14]
      ].observable.length * 2}rem; letter-spacing: 1rem;`), f(B, "class", "validity svelte-1fuex22"), f($, "class", "pauli-input svelte-1fuex22"), f(w, "class", "pauli-input-row svelte-1fuex22"), f(e, "class", "op-wrap svelte-1fuex22");
    },
    m(U, G) {
      C(U, e, G), _(e, l), _(l, n), _(l, a), _(l, s), _(l, o), _(l, c), _(l, d), _(l, h), L && L.m(h, null), _(h, p), F && F.m(h, null), _(h, b), _(h, g), _(h, v), V && V.m(h, null), _(h, y), Q && Q.m(h, null), _(e, k), _(e, w), _(w, $), _($, q);
      for (let W = 0; W < te.length; W += 1)
        te[W] && te[W].m(q, null);
      _($, j), _($, O), _($, H), _($, B), _(e, R), P || (I = [
        le(g, "click", X),
        le(O, "change", ie)
      ], P = !0);
    },
    p(U, G) {
      if (t = U, G & /*$data*/
      2 && i !== (i = /*pauli*/
      t[12].deactive ? "[Deactive]" : "") && Y(n, i), G & /*$data*/
      2 && u !== (u = /*pauli*/
      t[12].observable + "") && Y(c, u), /*pauli*/
      t[12].deactive ? L && (L.d(1), L = null) : L ? L.p(t, G) : (L = lc(t), L.c(), L.m(h, p)), /*pauli*/
      t[12].deactive ? F ? F.p(t, G) : (F = ic(t), F.c(), F.m(h, b)) : F && (F.d(1), F = null), /*pi*/
      t[14] > 0 && V.p(t, G), /*pi*/
      t[14] < /*$data*/
      t[1].pauli_obs.length - 1 ? Q ? Q.p(t, G) : (Q = nc(t), Q.c(), Q.m(h, null)) : Q && (Q.d(1), Q = null), G & /*$data*/
      2) {
        J = we({
          length: (
            /*$data*/
            t[1].machine_qubits ? (
              /*$data*/
              t[1].machine_qubits
            ) : (
              /*$data*/
              t[1].num_qubits
            )
          )
        });
        let W;
        for (W = 0; W < J.length; W += 1) {
          const Z = tc(t, J, W);
          te[W] ? te[W].p(Z, G) : (te[W] = ac(Z), te[W].c(), te[W].m(q, null));
        }
        for (; W < te.length; W += 1)
          te[W].d(1);
        te.length = J.length;
      }
      G & /*$data*/
      2 && z !== (z = /*$data*/
      t[1].pauli_obs[
        /*pi*/
        t[14]
      ].observable) && O.value !== z && (O.value = z), G & /*$data*/
      2 && N !== (N = `[iIxXyYzZ]${/*$data*/
      t[1].machine_qubits ? `{${/*$data*/
      t[1].machine_qubits}}` : "+"}`) && f(O, "pattern", N), G & /*$data*/
      2 && M !== (M = `width: ${/*$data*/
      t[1].pauli_obs[
        /*pi*/
        t[14]
      ].observable.length * 2}rem; letter-spacing: 1rem;`) && f(O, "style", M);
    },
    d(U) {
      U && T(e), L && L.d(), F && F.d(), V && V.d(), Q && Q.d(), Ge(te, U), P = !1, vt(I);
    }
  };
}
function sc(t) {
  let e, l, i, n;
  return {
    c() {
      e = m("div"), l = m("strong"), l.textContent = "Warning:", i = A(), n = E(
        /*$pauli_warning*/
        t[2]
      ), f(l, "class", "svelte-1fuex22"), f(e, "class", "warning svelte-1fuex22");
    },
    m(a, r) {
      C(a, e, r), _(e, l), _(e, i), _(e, n);
    },
    p(a, r) {
      r & /*$pauli_warning*/
      4 && Y(
        n,
        /*$pauli_warning*/
        a[2]
      );
    },
    d(a) {
      a && T(e);
    }
  };
}
function n4(t) {
  var R, P;
  let e, l, i, n, a = (
    /*$data*/
    ((R = t[1]) == null ? void 0 : R.num_pauli_obs) + ""
  ), r, s, o = (
    /*$data*/
    ((P = t[1]) == null ? void 0 : P.num_pauli_obs) == 1 ? "" : "s"
  ), u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M = we(
    /*$data*/
    t[1].pauli_obs || []
  ), H = [];
  for (let I = 0; I < M.length; I += 1)
    H[I] = rc(ec(t, M, I));
  let B = (
    /*$pauli_warning*/
    t[2] && sc(t)
  );
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`3b. Pauli Observables
    `), n = m("span"), r = E(a), s = E(" active pauli observables"), u = E(o), c = E("."), d = A(), h = m("span"), h.textContent = `Strongly recommend to set up the machine first because Pauli operators
      should be defined for all the qubits in the machine.`, p = A(), b = m("div");
      for (let I = 0; I < H.length; I += 1)
        H[I].c();
      g = A(), v = m("div"), y = m("button"), y.textContent = "Add a Pauli observable", k = A(), w = m("button"), w.textContent = "Generate Pauli obersvable permutations", $ = A(), q = m("span"), q.textContent = `Allowed opeartors: I/X/Y/Z (case-insensitive). If you have more than a few
    qubits, avoid generating permutations because it can delay the process.`, j = A(), B && B.c(), f(n, "class", "note svelte-1fuex22"), f(h, "class", "note svelte-1fuex22"), f(l, "class", "svelte-1fuex22"), f(b, "class", "content-wrap svelte-1fuex22"), f(y, "class", "svelte-1fuex22"), f(w, "class", "svelte-1fuex22"), f(v, "class", "input-row svelte-1fuex22"), f(q, "class", "note svelte-1fuex22"), f(e, "class", O = Gt(
        /*$data*/
        t[1].num_qubits ? "" : "deactive"
      ) + " svelte-1fuex22");
    },
    m(I, L) {
      C(I, e, L), _(e, l), _(l, i), _(l, n), _(n, r), _(n, s), _(n, u), _(n, c), _(l, d), _(l, h), _(e, p), _(e, b);
      for (let F = 0; F < H.length; F += 1)
        H[F] && H[F].m(b, null);
      _(e, g), _(e, v), _(v, y), _(v, k), _(v, w), _(e, $), _(e, q), _(e, j), B && B.m(e, null), z || (N = [
        le(
          y,
          "click",
          /*click_handler_5*/
          t[10]
        ),
        le(
          w,
          "click",
          /*click_handler_6*/
          t[11]
        )
      ], z = !0);
    },
    p(I, [L]) {
      var F, X;
      if (L & /*$data*/
      2 && a !== (a = /*$data*/
      ((F = I[1]) == null ? void 0 : F.num_pauli_obs) + "") && Y(r, a), L & /*$data*/
      2 && o !== (o = /*$data*/
      ((X = I[1]) == null ? void 0 : X.num_pauli_obs) == 1 ? "" : "s") && Y(u, o), L & /*$data, data, RegExp, pauli_warning*/
      11) {
        M = we(
          /*$data*/
          I[1].pauli_obs || []
        );
        let V;
        for (V = 0; V < M.length; V += 1) {
          const Q = ec(I, M, V);
          H[V] ? H[V].p(Q, L) : (H[V] = rc(Q), H[V].c(), H[V].m(b, null));
        }
        for (; V < H.length; V += 1)
          H[V].d(1);
        H.length = M.length;
      }
      /*$pauli_warning*/
      I[2] ? B ? B.p(I, L) : (B = sc(I), B.c(), B.m(e, null)) : B && (B.d(1), B = null), L & /*$data*/
      2 && O !== (O = Gt(
        /*$data*/
        I[1].num_qubits ? "" : "deactive"
      ) + " svelte-1fuex22") && f(e, "class", O);
    },
    i: ae,
    o: ae,
    d(I) {
      I && T(e), Ge(H, I), B && B.d(), z = !1, vt(N);
    }
  };
}
function a4(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(o, (y) => l(1, i = y)), o), r;
  t.$$.on_destroy.push(() => n());
  let s = Pe();
  at(t, s, (y) => l(2, r = y));
  let { data: o = Pe({}) } = e;
  a();
  const u = (y, k) => {
    o.update((w) => (w.pauli_obs[y].deactive = !0, w));
  }, c = (y, k) => {
    o.update((w) => (w.pauli_obs[y].deactive = !1, w));
  }, d = (y, k) => {
    o.update((w) => (w.pauli_obs.splice(y, 1), w));
  }, h = (y, k) => {
    o.update((w) => ([w.pauli_obs[y], w.pauli_obs[y - 1]] = [w.pauli_obs[y - 1], w.pauli_obs[y]], w));
  }, p = (y, k) => {
    o.update((w) => ([w.pauli_obs[y], w.pauli_obs[y + 1]] = [w.pauli_obs[y + 1], w.pauli_obs[y]], w));
  }, b = (y, k) => {
    o.update((w) => {
      let $ = k.target.value.toUpperCase(), q = `[iIxXyYzZ]${i.machine_qubits ? `{${i.machine_qubits}}` : "+"}`;
      return w.pauli_obs[y] || (w.pauli_obs[y] = {}), $.match(new RegExp(q, "g")) ? (w.pauli_obs[y].observable = $, s.set()) : (w.pauli_obs[y].observable = w.pauli_obs[y].observable, s.set(k.target.value + " is not an allowed Pauli operator.")), w;
    });
  }, g = (y) => {
    o.update((k) => {
      k.pauli_obs || (k.pauli_obs = []);
      let w = i.machine_qubits ? i.machine_qubits : i.num_qubits;
      return k.pauli_obs.push("I".repeat(w)), k;
    });
  }, v = (y) => {
    o.update((k) => {
      k.pauli_obs || (k.pauli_obs = []);
      let w = i.machine_qubits ? i.machine_qubits : i.num_qubits, $ = i.num_qubits, q = l4(w, $);
      return k.pauli_obs = q.map((j) => ({ observable: j })), k;
    });
  };
  return t.$$set = (y) => {
    "data" in y && a(l(0, o = y.data));
  }, [
    o,
    i,
    r,
    s,
    u,
    c,
    d,
    h,
    p,
    b,
    g,
    v
  ];
}
class r4 extends Ve {
  constructor(e) {
    super(), Qe(this, e, a4, n4, Le, { data: 0 });
  }
}
function oc(t, e, l) {
  const i = t.slice();
  return i[7] = e[l], i;
}
function s4(t) {
  let e;
  return {
    c() {
      e = m("span"), e.textContent = "Auto-selected", f(e, "class", "auto-selected svelte-1q1n3c9");
    },
    m(l, i) {
      C(l, e, i);
    },
    p: ae,
    i: ae,
    o: ae,
    d(l) {
      l && T(e);
    }
  };
}
function o4(t) {
  let e, l, i, n, a, r;
  e = new Bl({
    props: {
      id: "measure-reset",
      checked: !1,
      oncheck: (
        /*func*/
        t[4]
      ),
      label: "Reset"
    }
  }), i = new Bl({
    props: {
      id: "measure-all",
      checked: (
        /*$data*/
        t[1].measure_all
      ),
      deactive: /*$data*/ t[1].num_qubits && /*$data*/
      t[1].num_clbits && /*$data*/
      t[1].num_clbits >= /*$data*/
      t[1].num_qubits ? "" : "deactive",
      oncheck: (
        /*func_1*/
        t[5]
      ),
      label: "All"
    }
  });
  let s = we(
    /*$data*/
    t[1].qubits || []
  ), o = [];
  for (let c = 0; c < s.length; c += 1)
    o[c] = uc(oc(t, s, c));
  const u = (c) => D(o[c], 1, 1, () => {
    o[c] = null;
  });
  return {
    c() {
      he(e.$$.fragment), l = A(), he(i.$$.fragment), n = A();
      for (let c = 0; c < o.length; c += 1)
        o[c].c();
      a = Be();
    },
    m(c, d) {
      ce(e, c, d), C(c, l, d), ce(i, c, d), C(c, n, d);
      for (let h = 0; h < o.length; h += 1)
        o[h] && o[h].m(c, d);
      C(c, a, d), r = !0;
    },
    p(c, d) {
      const h = {};
      d & /*data*/
      1 && (h.oncheck = /*func*/
      c[4]), e.$set(h);
      const p = {};
      if (d & /*$data*/
      2 && (p.checked = /*$data*/
      c[1].measure_all), d & /*$data*/
      2 && (p.deactive = /*$data*/
      c[1].num_qubits && /*$data*/
      c[1].num_clbits && /*$data*/
      c[1].num_clbits >= /*$data*/
      c[1].num_qubits ? "" : "deactive"), d & /*data*/
      1 && (p.oncheck = /*func_1*/
      c[5]), i.$set(p), d & /*$data, data, measure_warning*/
      11) {
        s = we(
          /*$data*/
          c[1].qubits || []
        );
        let b;
        for (b = 0; b < s.length; b += 1) {
          const g = oc(c, s, b);
          o[b] ? (o[b].p(g, d), S(o[b], 1)) : (o[b] = uc(g), o[b].c(), S(o[b], 1), o[b].m(a.parentNode, a));
        }
        for (ge(), b = s.length; b < o.length; b += 1)
          u(b);
        be();
      }
    },
    i(c) {
      if (!r) {
        S(e.$$.fragment, c), S(i.$$.fragment, c);
        for (let d = 0; d < s.length; d += 1)
          S(o[d]);
        r = !0;
      }
    },
    o(c) {
      D(e.$$.fragment, c), D(i.$$.fragment, c), o = o.filter(Boolean);
      for (let d = 0; d < o.length; d += 1)
        D(o[d]);
      r = !1;
    },
    d(c) {
      c && (T(l), T(n), T(a)), de(e, c), de(i, c), Ge(o, c);
    }
  };
}
function uc(t) {
  var n;
  let e, l;
  function i(...a) {
    return (
      /*func_2*/
      t[6](
        /*item*/
        t[7],
        ...a
      )
    );
  }
  return e = new Bl({
    props: {
      id: "measure-" + /*item*/
      t[7],
      checked: (
        /*$data*/
        (n = t[1].measure) == null ? void 0 : n.includes(
          /*item*/
          t[7]
        )
      ),
      oncheck: i,
      label: (
        /*item*/
        t[7]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(a, r) {
      ce(e, a, r), l = !0;
    },
    p(a, r) {
      var o;
      t = a;
      const s = {};
      r & /*$data*/
      2 && (s.id = "measure-" + /*item*/
      t[7]), r & /*$data*/
      2 && (s.checked = /*$data*/
      (o = t[1].measure) == null ? void 0 : o.includes(
        /*item*/
        t[7]
      )), r & /*data, $data*/
      3 && (s.oncheck = i), r & /*$data*/
      2 && (s.label = /*item*/
      t[7]), e.$set(s);
    },
    i(a) {
      l || (S(e.$$.fragment, a), l = !0);
    },
    o(a) {
      D(e.$$.fragment, a), l = !1;
    },
    d(a) {
      de(e, a);
    }
  };
}
function fc(t) {
  let e, l;
  return {
    c() {
      e = m("div"), l = E(
        /*$measure_warning*/
        t[2]
      ), f(e, "class", "warning svelte-1q1n3c9");
    },
    m(i, n) {
      C(i, e, n), _(e, l);
    },
    p(i, n) {
      n & /*$measure_warning*/
      4 && Y(
        l,
        /*$measure_warning*/
        i[2]
      );
    },
    d(i) {
      i && T(e);
    }
  };
}
function u4(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b;
  const g = [o4, s4], v = [];
  function y(w, $) {
    return (
      /*$data*/
      w[1].clbits === "auto" ? 0 : 1
    );
  }
  c = y(t), d = v[c] = g[c](t);
  let k = (
    /*$measure_warning*/
    t[2] && fc(t)
  );
  return {
    c() {
      e = m("article"), l = m("h4"), l.textContent = "3a. Measure", i = A(), n = m("div"), a = m("div"), r = m("div"), s = m("label"), s.textContent = "Qubits to measure", o = A(), u = m("div"), d.c(), h = A(), k && k.c(), f(l, "class", "svelte-1q1n3c9"), f(s, "class", "svelte-1q1n3c9"), f(u, "class", "checkbox-group svelte-1q1n3c9"), f(r, "class", "input-form svelte-1q1n3c9"), f(a, "class", "input-row svelte-1q1n3c9"), f(n, "class", "content-wrap svelte-1q1n3c9"), f(e, "class", p = Gt(
        /*$data*/
        t[1].num_clbits && /*$data*/
        t[1].num_qubits ? "" : "deactive"
      ) + " svelte-1q1n3c9");
    },
    m(w, $) {
      C(w, e, $), _(e, l), _(e, i), _(e, n), _(n, a), _(a, r), _(r, s), _(r, o), _(r, u), v[c].m(u, null), _(e, h), k && k.m(e, null), b = !0;
    },
    p(w, [$]) {
      let q = c;
      c = y(w), c === q ? v[c].p(w, $) : (ge(), D(v[q], 1, 1, () => {
        v[q] = null;
      }), be(), d = v[c], d ? d.p(w, $) : (d = v[c] = g[c](w), d.c()), S(d, 1), d.m(u, null)), /*$measure_warning*/
      w[2] ? k ? k.p(w, $) : (k = fc(w), k.c(), k.m(e, null)) : k && (k.d(1), k = null), (!b || $ & /*$data*/
      2 && p !== (p = Gt(
        /*$data*/
        w[1].num_clbits && /*$data*/
        w[1].num_qubits ? "" : "deactive"
      ) + " svelte-1q1n3c9")) && f(e, "class", p);
    },
    i(w) {
      b || (S(d), b = !0);
    },
    o(w) {
      D(d), b = !1;
    },
    d(w) {
      w && T(e), v[c].d(), k && k.d();
    }
  };
}
function f4(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(o, (h) => l(1, i = h)), o), r;
  t.$$.on_destroy.push(() => n());
  let s = Pe();
  at(t, s, (h) => l(2, r = h));
  let { data: o = Pe({}) } = e;
  a();
  const u = (h) => {
    o.update((p) => (p.measure_all = !1, p.measure = [], p));
  }, c = (h) => {
    o.update((p) => (p.measure_all = h, p));
  }, d = (h, p) => {
    o.update((b) => {
      var g, v;
      if (b.measure || (b.measure = []), s.set(), p && !b.measure.includes(h)) {
        if (b.num_clbits <= ((g = b.measure) == null ? void 0 : g.length))
          return s.set(`More classical bits are needed to measure the qubit ${h}.`), b;
        b.measure.push(h);
      } else
        !p && b.measure.includes(h) && b.measure.splice(b.measure.indexOf(h), 1);
      return b.num_clbits >= ((v = b.measure) == null ? void 0 : v.length) && s.set(), b;
    });
  };
  return t.$$set = (h) => {
    "data" in h && a(l(0, o = h.data));
  }, [o, i, r, s, u, c, d];
}
class _4 extends Ve {
  constructor(e) {
    super(), Qe(this, e, f4, u4, Le, { data: 0 });
  }
}
function c4(t) {
  let e, l;
  return e = new _4({ props: { data: (
    /*data*/
    t[2]
  ) } }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p: ae,
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function d4(t) {
  let e, l;
  return e = new r4({ props: { data: (
    /*data*/
    t[2]
  ) } }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p: ae,
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function _c(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j;
  return {
    c() {
      e = m("article"), l = m("h4"), l.textContent = "4. Sharing options", i = A(), n = m("div"), a = m("div"), r = m("label"), r.textContent = "Add sharing options", s = A(), o = m("div"), u = m("div"), c = m("input"), h = A(), p = m("label"), p.textContent = "QASM 2", b = A(), g = m("div"), v = m("input"), k = A(), w = m("label"), w.textContent = "QASM 3", f(l, "class", "svelte-2993p9"), f(r, "class", "svelte-2993p9"), f(c, "type", "checkbox"), f(c, "id", "reporting-measure"), c.checked = d = /*$data*/
      t[1].sharing.qasm2, f(c, "class", "svelte-2993p9"), f(p, "for", "reporting-measure"), f(p, "class", "svelte-2993p9"), f(u, "class", "checkbox-item svelte-2993p9"), f(v, "type", "checkbox"), f(v, "id", "reporting-measure"), v.checked = y = /*$data*/
      t[1].sharing.qasm3, f(v, "class", "svelte-2993p9"), f(w, "for", "reporting-measure"), f(w, "class", "svelte-2993p9"), f(g, "class", "checkbox-item svelte-2993p9"), f(o, "class", "checkbox-group svelte-2993p9"), f(a, "class", "input-form svelte-2993p9"), f(n, "class", "input-row svelte-2993p9"), f(e, "class", $ = Gt(
        /*$data*/
        t[1].num_qubits ? "" : "deactive"
      ) + " svelte-2993p9");
    },
    m(O, z) {
      C(O, e, z), _(e, l), _(e, i), _(e, n), _(n, a), _(a, r), _(a, s), _(a, o), _(o, u), _(u, c), _(u, h), _(u, p), _(o, b), _(o, g), _(g, v), _(g, k), _(g, w), q || (j = [
        le(
          c,
          "change",
          /*change_handler_2*/
          t[9]
        ),
        le(
          v,
          "change",
          /*change_handler_3*/
          t[10]
        )
      ], q = !0);
    },
    p(O, z) {
      z & /*$data*/
      2 && d !== (d = /*$data*/
      O[1].sharing.qasm2) && (c.checked = d), z & /*$data*/
      2 && y !== (y = /*$data*/
      O[1].sharing.qasm3) && (v.checked = y), z & /*$data*/
      2 && $ !== ($ = Gt(
        /*$data*/
        O[1].num_qubits ? "" : "deactive"
      ) + " svelte-2993p9") && f(e, "class", $);
    },
    d(O) {
      O && T(e), q = !1, vt(j);
    }
  };
}
function h4(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R, P, I, L, F, X, V, Q, J, te, ie, U, G, W, Z, ee;
  s = new S3({ props: { data: (
    /*data*/
    t[2]
  ) } }), u = new t4({ props: { data: (
    /*data*/
    t[2]
  ) } });
  const ye = [d4, c4], qe = [];
  function je(_e, K) {
    return (
      /*$data*/
      _e[1].reporting === "observe" ? 0 : (
        /*$data*/
        _e[1].reporting === "measure" ? 1 : -1
      )
    );
  }
  ~(L = je(t)) && (F = qe[L] = ye[L](t));
  let fe = (
    /*$data*/
    t[1].sharing && _c(t)
  );
  return {
    c() {
      e = m("section"), l = m("h3"), i = E(`Writing a quantum circuit
    `), n = m("button"), n.textContent = "Reset", a = A(), r = m("div"), he(s.$$.fragment), o = A(), he(u.$$.fragment), c = A(), d = m("article"), h = m("h4"), h.textContent = "3. Measure? or Observe?", p = A(), b = m("div"), g = m("div"), v = m("label"), v.textContent = "Choose reporting method", y = A(), k = m("div"), w = m("div"), $ = m("input"), j = A(), O = m("label"), O.textContent = "Measure", z = A(), N = m("div"), M = m("input"), B = A(), R = m("label"), R.textContent = "Pauli-Observables", I = A(), F && F.c(), X = A(), fe && fe.c(), V = A(), Q = m("article"), J = m("h4"), J.textContent = "Get your circuit code (in Qiskit)", te = A(), ie = m("div"), U = m("button"), U.textContent = "Copy", f(n, "class", "svelte-2993p9"), f(l, "class", "svelte-2993p9"), f(h, "class", "svelte-2993p9"), f(v, "class", "svelte-2993p9"), f($, "type", "radio"), f($, "id", "reporting-measure"), f($, "name", "reporting"), $.checked = q = /*$data*/
      t[1].reporting === "measure", f($, "class", "svelte-2993p9"), f(O, "for", "reporting-measure"), f(O, "class", "svelte-2993p9"), f(w, "class", "checkbox-item svelte-2993p9"), f(M, "type", "radio"), f(M, "id", "reporting-observe"), f(M, "name", "reporting"), M.checked = H = /*$data*/
      t[1].reporting === "observe", f(M, "class", "svelte-2993p9"), f(R, "for", "reporting-observe"), f(R, "class", "svelte-2993p9"), f(N, "class", "checkbox-item svelte-2993p9"), f(k, "class", "checkbox-group svelte-2993p9"), f(g, "class", "input-form svelte-2993p9"), f(b, "class", "input-row svelte-2993p9"), f(d, "class", P = Gt(
        /*$data*/
        t[1].num_qubits ? "" : "deactive"
      ) + " svelte-2993p9"), f(J, "class", "svelte-2993p9"), f(U, "class", "copy-qiskit svelte-2993p9"), f(ie, "class", "input-row svelte-2993p9"), f(Q, "class", G = Gt(
        /*$data*/
        t[1].num_qubits ? "" : "deactive"
      ) + " svelte-2993p9"), f(r, "class", "content svelte-2993p9"), f(e, "class", "circuit-write-wrap svelte-2993p9");
    },
    m(_e, K) {
      C(_e, e, K), _(e, l), _(l, i), _(l, n), _(e, a), _(e, r), ce(s, r, null), _(r, o), ce(u, r, null), _(r, c), _(r, d), _(d, h), _(d, p), _(d, b), _(b, g), _(g, v), _(g, y), _(g, k), _(k, w), _(w, $), _(w, j), _(w, O), _(k, z), _(k, N), _(N, M), _(N, B), _(N, R), _(r, I), ~L && qe[L].m(r, null), _(r, X), fe && fe.m(r, null), _(r, V), _(r, Q), _(Q, J), _(Q, te), _(Q, ie), _(ie, U), W = !0, Z || (ee = [
        le(
          n,
          "click",
          /*click_handler*/
          t[6]
        ),
        le(
          $,
          "change",
          /*change_handler*/
          t[7]
        ),
        le(
          M,
          "change",
          /*change_handler_1*/
          t[8]
        ),
        le(
          U,
          "click",
          /*click_handler_1*/
          t[11]
        )
      ], Z = !0);
    },
    p(_e, [K]) {
      (!W || K & /*$data*/
      2 && q !== (q = /*$data*/
      _e[1].reporting === "measure")) && ($.checked = q), (!W || K & /*$data*/
      2 && H !== (H = /*$data*/
      _e[1].reporting === "observe")) && (M.checked = H), (!W || K & /*$data*/
      2 && P !== (P = Gt(
        /*$data*/
        _e[1].num_qubits ? "" : "deactive"
      ) + " svelte-2993p9")) && f(d, "class", P);
      let ke = L;
      L = je(_e), L === ke ? ~L && qe[L].p(_e, K) : (F && (ge(), D(qe[ke], 1, 1, () => {
        qe[ke] = null;
      }), be()), ~L ? (F = qe[L], F ? F.p(_e, K) : (F = qe[L] = ye[L](_e), F.c()), S(F, 1), F.m(r, X)) : F = null), /*$data*/
      _e[1].sharing ? fe ? fe.p(_e, K) : (fe = _c(_e), fe.c(), fe.m(r, V)) : fe && (fe.d(1), fe = null), (!W || K & /*$data*/
      2 && G !== (G = Gt(
        /*$data*/
        _e[1].num_qubits ? "" : "deactive"
      ) + " svelte-2993p9")) && f(Q, "class", G);
    },
    i(_e) {
      W || (S(s.$$.fragment, _e), S(u.$$.fragment, _e), S(F), W = !0);
    },
    o(_e) {
      D(s.$$.fragment, _e), D(u.$$.fragment, _e), D(F), W = !1;
    },
    d(_e) {
      _e && T(e), de(s), de(u), ~L && qe[L].d(), fe && fe.d(), Z = !1, vt(ee);
    }
  };
}
function p4(t, e, l) {
  let i, { model: n } = e, { key_circ: a = "circ_code", key_machine: r = "machine" } = e;
  n.get(a);
  let s, o = `change:${r}`, u = () => count = n.get(r), c = Pe({});
  at(t, c, (k) => l(1, i = k));
  let d = Pe({});
  yt(() => {
    n.get(r) && l(0, s = JSON.parse(n.get(r))), n.get(a), c.subscribe((k) => {
      var w, $, q, j, O;
      k.operations && (k.num_operations = (($ = (w = k.operations) == null ? void 0 : w.filter((z) => !z.deactive)) == null ? void 0 : $.length) || 0), k.pauli_obs && (k.num_pauli_obs = ((j = (q = k.pauli_obs) == null ? void 0 : q.filter((z) => !z.deactive)) == null ? void 0 : j.length) || 0, k.pauli_obs.forEach((z) => {
        z.observable.length < k.machine_qubits ? z.observable = z.observable + "I".repeat(k.machine_qubits - z.observable.length) : z.observable.length > k.machine_qubits && (z.observable = z.observable.substring(0, k.machine_qubits));
      })), k.machine && (k.machine_qubits = (O = $l[k.machine]) == null ? void 0 : O.n_qubits, $l[k.machine].sim ? $l[k.machine].machine ? (k.no_sim = !1, k.no_machine = !1) : (k.no_machine = !0, k.no_sim = !1, k.is_simulator = !0) : (k.no_sim = !0, k.no_machine = !1, k.is_simulator = !1), k.no_sim || k.no_machine ? k.sim_not_choosable = !0 : k.sim_not_choosable = !1), k.measure && k.measure.length > 0 && k.measure.sort(), d.set(c_(k));
    }), d.subscribe((k) => {
      n.set(a, k), n.save_changes();
    }), c.set({
      machine: "Aer",
      is_simulator: s == null ? void 0 : s.is_simulator,
      sharing: { qasm2: !1, qasm3: !1 }
    }), n.on(o, u);
  }), fi(() => {
    n.off(o, u);
  });
  const h = () => {
    c.set({
      machine: s == null ? void 0 : s.name,
      is_simulator: s == null ? void 0 : s.is_simulator,
      sharing: { qasm2: !1, qasm3: !1 }
    });
  }, p = (k) => {
    c.update((w) => (k.target.checked && (w.reporting = "measure"), w));
  }, b = (k) => {
    c.update((w) => (k.target.checked && (w.reporting = "observe"), w));
  }, g = (k) => {
    c.update((w) => (Ba(c, i.sharing.qasm2 = k.target.checked, i), w));
  }, v = (k) => {
    c.update((w) => (Ba(c, i.sharing.qasm3 = k.target.checked, i), w));
  }, y = (k) => {
    ii(c_(i));
  };
  return t.$$set = (k) => {
    "model" in k && l(3, n = k.model), "key_circ" in k && l(4, a = k.key_circ), "key_machine" in k && l(5, r = k.key_machine);
  }, [
    s,
    i,
    c,
    n,
    a,
    r,
    h,
    p,
    b,
    g,
    v,
    y
  ];
}
class m4 extends Ve {
  constructor(e) {
    super(), Qe(this, e, p4, h4, Le, { model: 3, key_circ: 4, key_machine: 5 });
  }
}
const Ml = [
  {
    title: "Meta data",
    subsections: ["asof", "name", "description", "backend_version", "provider", "is_simulator"]
  },
  {
    title: "Availability",
    subsections: [
      {
        key: "status",
        order: [
          "operational",
          "pending_jobs",
          "status_msg"
        ]
      },
      "online_date",
      "max_circuits"
    ]
  },
  {
    title: "Options",
    subsections: [
      {
        key: "options",
        title: "Shots",
        order: [
          "init_qubits",
          "shots",
          "rep_time",
          "rep_delay",
          "noise_model",
          "seed_simulator"
        ]
      },
      {
        key: "options",
        title: "Memory",
        order: ["memory", "memory_slots", "memory_slot_size"]
      },
      {
        key: "options",
        title: "Measure",
        order: ["meas_level", "meas_return", "use_measure_esp"]
      }
    ]
  },
  {
    title: "Properties",
    subsections: [
      {
        key: "properties",
        title: "Overall",
        order: ["last_update_date", "general_qlists", "general"]
      },
      {
        key: "properties",
        title: "Circuit",
        order: ["gates", "qubits"]
      },
      {
        key: "properties",
        title: "Faulty",
        order: ["faulty_gates", "faulty_qubits"]
      }
    ]
  },
  {
    title: "Qubits",
    subsections: [
      "num_qubits",
      {
        key: "coupling_map",
        order: [
          // "size",
          // "nodes",
          // "edges",
          "circuit_view",
          "distance_matrix",
          "is_symmetric"
        ]
      }
    ]
  },
  {
    title: "Operations",
    subsections: ["operation_names", "operations"]
  },
  {
    title: "Instructions",
    subsections: ["instructions"]
  },
  {
    title: "Pulse-related",
    subsections: [
      {
        key: "pulse_defaults",
        order: [
          "qubit_freq_est",
          "meas_freq_est"
        ]
      },
      "meas_map",
      "input_time_resolution",
      "output_time_resolution"
    ]
  },
  {
    title: "Compiler-related",
    subsections: ["translation_stage_plugin"]
    // "target",
  }
], ft = {
  // Meta data
  asof: "Data collected",
  name: "Name",
  description: "Description",
  backend_version: "Version",
  provider: "Provider",
  is_simulator: "Is simulator?",
  // Availability
  status: "Status",
  operational: "Is operational?",
  pending_jobs: "Pending jobs",
  status_msg: "Status",
  online_date: "Online date",
  max_circuits: "Maximum circuits",
  // Setups
  options: "Options",
  shots: "Default shots per run",
  memory: "Memory support",
  memory_slots: "Memory slots",
  memory_slot_size: "Memory slot size",
  meas_level: "Supported measurement levels",
  meas_return: "Level of measurement data for the backend to return",
  rep_time: "Supported repetition times (program execution time, unit: μs)",
  rep_delay: "Delay between primitives (unit: sec)",
  init_qubits: "Reset the qubits to the ground state for each shot",
  use_measure_esp: "Use excited state promoted (ESP) readout for measurements",
  noise_model: "Noise model",
  seed_simulator: "Random seed to control sampling (Simulators only)",
  properties: "Properties",
  last_update_date: "Last update date",
  general: "General system parameters",
  gates: "Supported gates",
  qubits: "Qubit data",
  general_qlists: "General qubit list",
  faulty_qubits: "Faulty qubits",
  faulty_gates: "Faulty gates",
  // Qubits
  coupling_map: "Coupling map",
  size: "Size",
  distance_matrix: "Distance matrix",
  nodes: "Nodes",
  edges: "Edges",
  is_symmetric: "Is symmetric?",
  num_qubits: "Number of qubits",
  circuit_view: "Circuit",
  // Operations
  operation_names: "Operation names",
  operations: "Operations",
  // Instructions
  instructions: "Instructions",
  instruction_durations: "Instruciton durationas",
  instruction_schedule_map: "Instruction schedule map",
  // Pulse-related inforamation
  pulse_defaults: "Pulse defaults",
  qubit_freq_est: "Qubit frequencies in Hertz",
  meas_freq_est: "Measurement frequencies in Hertz",
  meas_map: "Measurement groupings",
  input_time_resolution: "Input time resolution",
  output_time_resolution: "Output time resolutin",
  // Compiler-related information
  target: "Target",
  translation_stage_plugin: "Translation stage plugin(s)"
}, mt = {
  // Meta data
  asof: "The time when the attributes were collected.",
  name: "The name of the backend machine.",
  description: "The overview information about the backend machine.",
  backend_version: "The version of the backend machine.",
  provider: "The provider of the backend.",
  // Availability
  status: "The status of the backend machine",
  online_date: "This machine has been online since ... (after being offline).",
  max_circuits: "The maximum number of circuits can be run in a single job.",
  // Setups
  options: "Options for the backend machine",
  rep_delay: "This parameter is applicable only if `dynamic=False` is specified or defaulted to.",
  use_measure_esp: "ESP readout can offer higher fidelity than standard measurement sequences. Backend support for ESP readout is determined by the `flag measure_esp_enabled` in `backend.configuration()`. This parameter is applicable only if `dynamic=False` is specified or defaulted to.",
  properties: "The properties of the backend machine",
  qubits: "Anh(armonicity), Freq(uency), M0P1 (= prob_meas0_prep1), M1P0 (= prob_meas1_prep0), RE (=readout error), RL (= readout lenght)",
  // Qubits
  coupling_map: "The qubit couplings.",
  num_qubits: "The number of qubits supported",
  // Operations
  operation_names: "Operation names supported by the machine",
  operations: "Operations supported by the machine",
  // Instructions
  instructions: "Instructions supported for each qubit.",
  // Pulse-related inforamation
  pulse_defaults: "the pulse defaults for the backend. If `None`, the machine is not available for Pulse scheduling.",
  meas_map: "The grouping of measurements which are multiplexed. If `None`, the machine is not available for Pulse scheduling.",
  input_time_resolution: "The system time resolution of input signals. If `None`, the machine is not available for Pulse scheduling.",
  output_time_resolution: "The system time resolution of output signals. If `None`, the machine is not available for Pulse scheduling.",
  // Compiler-related information
  target: "A description of instructions on a backend and their properties as well as some timing information.",
  translation_stage_plugin: "The default translation stage plugin name for IBM backends. If `None`, it is not provided."
}, g4 = {
  // Meta data
  name: "_backend_.name",
  description: "_backend_.description",
  backend_version: "_backend_.backend_version",
  provider: "_backend_.provider",
  is_simulator: "_backend_.properties().simulator",
  // Availability
  status: "_backend_.status",
  operational: "_backend_.status.operational",
  pending_jobs: "_backend_.status.pending_jobs",
  status_msg: "_backend_.status.status_msg",
  online_date: "_backend_.online_date",
  max_circuits: "_backend_.max_circuits",
  // Setups
  options: "_backend_.options",
  shots: "_backend_.options.shots",
  memory: "_backend_.options.memory",
  memory_slots: "_backend_.options.memory_slots",
  memory_slot_size: "_backend_.options.memory_slot_size",
  meas_level: "_backend_.options.meas_level",
  meas_return: "_backend_.options.meas_return",
  rep_time: "_backend_.options.rep_time",
  rep_delay: "_backend_.options.rep_delay",
  init_qubits: "_backend_.options.init_qubits",
  use_measure_esp: "_backend_.options.use_measure_esp",
  noise_model: "_backend_.options.noise_model",
  seed_simulator: "_backend_.options.seed_simulator",
  properties: "_backend_.properties()",
  last_update_date: "_backend_.properties().last_update_date",
  general: "_backend_.properties().general",
  gates: "_backend_.properties().gates",
  qubits: "_backend_.properties().qubits",
  general_qlists: "_backend_.properties().general_qlists",
  faulty_qubits: "_backend_.properties().faulty_qubits()",
  faulty_gates: "_backend_.properties().faulty_gates()",
  // Qubits
  coupling_map: "_backend_.coupling_map",
  size: "_backend_.coupling_map.coupling_map.size()",
  distance_matrix: "_backend_.coupling_map.distance_matrix",
  is_symmetric: "_backend_.coupling_map.is_symmetric",
  num_qubits: "_backend_.num_qubits",
  // Operations
  operation_names: "_backend_.operation_names",
  operations: "_backend_.operations",
  // Instructions
  instructions: "_backend_.instructions",
  instruction_durations: "Instruciton durationas",
  instruction_schedule_map: "Instruction schedule map",
  // Pulse-related inforamation
  pulse_defaults: "_backend_.defaults()",
  qubit_freq_est: "_backend_.defaults().qubit_freq_est",
  meas_freq_est: "_backend_.defaults().meas_freq_est",
  meas_map: "_backend_.meas_map",
  input_time_resolution: "_backend_.dt",
  output_time_resolution: "_backend_.dtm",
  // Compiler-related information
  translation_stage_plugin: "translation_stage_plugin = _backend_.get_translation_stage_plugin() if hasattr(backend, 'get_translation_stage_plugin') else None"
};
function cc(t, e) {
  let l = e.as_function === void 0 ? !0 : e.as_function, i = l ? "    " : "", n = e.backend_var_name, a = l ? "def get_data(_backend_):" : "";
  a += `
`;
  let r = [];
  for (const s of t)
    s.includes(" = ") ? (a += `${i}${s}`, r.push(s.split(" = ")[0])) : (a += `${i}${s} = ${g4[s]}`, r.push(s)), a += `
`;
  if (l) {
    a += `
${i}output = {
`;
    for (const s of r)
      a += `${i}    "${s}": ${s},`, a += `
`;
    a += `${i}}
`, a += i + "return output";
  }
  return a = a.replace(/_backend_/gi, n), a;
}
function dc(t) {
  let e = t.replace("#", ""), l = [e.slice(0, 2), e.slice(2, 4), e.slice(4, 6)].map((i) => parseInt(i, 16));
  return l[0] * 0.299 + l[1] * 0.587 + l[2] * 0.114 > 186 ? "#000000" : "#ffffff";
}
function Tg(t) {
  let e = new Date(t);
  return "datetime(" + [
    e.getFullYear(),
    e.getMonth(),
    e.getDate(),
    e.getHours(),
    e.getMinutes(),
    e.getSeconds(),
    e.getMilliseconds()
  ].join(", ") + ")";
}
function b4(t) {
  let e, l, i, n, a, r = (
    /*hide*/
    t[2] ? "Open" : "Close"
  ), s, o, u, c = (
    /*note*/
    t[1] && hc(t)
  );
  return {
    c() {
      e = m("h2"), l = E(
        /*title*/
        t[0]
      ), i = A(), c && c.c(), n = A(), a = m("button"), s = E(r), f(a, "class", "svelte-agu7v9"), f(e, "class", "svelte-agu7v9");
    },
    m(d, h) {
      C(d, e, h), _(e, l), _(e, i), c && c.m(e, null), _(e, n), _(e, a), _(a, s), o || (u = le(
        a,
        "click",
        /*click_handler_1*/
        t[6]
      ), o = !0);
    },
    p(d, h) {
      h & /*title*/
      1 && Y(
        l,
        /*title*/
        d[0]
      ), /*note*/
      d[1] ? c ? c.p(d, h) : (c = hc(d), c.c(), c.m(e, n)) : c && (c.d(1), c = null), h & /*hide*/
      4 && r !== (r = /*hide*/
      d[2] ? "Open" : "Close") && Y(s, r);
    },
    d(d) {
      d && T(e), c && c.d(), o = !1, u();
    }
  };
}
function v4(t) {
  let e, l, i, n, a, r = (
    /*hide*/
    t[2] ? "Open" : "Close"
  ), s, o, u, c = (
    /*note*/
    t[1] && pc(t)
  );
  return {
    c() {
      e = m("h1"), l = E(
        /*title*/
        t[0]
      ), i = A(), c && c.c(), n = A(), a = m("button"), s = E(r), f(a, "class", "svelte-agu7v9"), f(e, "class", "svelte-agu7v9");
    },
    m(d, h) {
      C(d, e, h), _(e, l), _(e, i), c && c.m(e, null), _(e, n), _(e, a), _(a, s), o || (u = le(
        a,
        "click",
        /*click_handler*/
        t[5]
      ), o = !0);
    },
    p(d, h) {
      h & /*title*/
      1 && Y(
        l,
        /*title*/
        d[0]
      ), /*note*/
      d[1] ? c ? c.p(d, h) : (c = pc(d), c.c(), c.m(e, n)) : c && (c.d(1), c = null), h & /*hide*/
      4 && r !== (r = /*hide*/
      d[2] ? "Open" : "Close") && Y(s, r);
    },
    d(d) {
      d && T(e), c && c.d(), o = !1, u();
    }
  };
}
function hc(t) {
  let e, l;
  return {
    c() {
      e = m("small"), l = E(
        /*note*/
        t[1]
      ), f(e, "class", "svelte-agu7v9");
    },
    m(i, n) {
      C(i, e, n), _(e, l);
    },
    p(i, n) {
      n & /*note*/
      2 && Y(
        l,
        /*note*/
        i[1]
      );
    },
    d(i) {
      i && T(e);
    }
  };
}
function pc(t) {
  let e, l;
  return {
    c() {
      e = m("small"), l = E(
        /*note*/
        t[1]
      ), f(e, "class", "svelte-agu7v9");
    },
    m(i, n) {
      C(i, e, n), _(e, l);
    },
    p(i, n) {
      n & /*note*/
      2 && Y(
        l,
        /*note*/
        i[1]
      );
    },
    d(i) {
      i && T(e);
    }
  };
}
function k4(t) {
  let e;
  function l(a, r) {
    if (
      /*level*/
      a[3] == 1
    )
      return v4;
    if (
      /*level*/
      a[3] == 2
    )
      return b4;
  }
  let i = l(t), n = i && i(t);
  return {
    c() {
      n && n.c(), e = Be();
    },
    m(a, r) {
      n && n.m(a, r), C(a, e, r);
    },
    p(a, [r]) {
      i === (i = l(a)) && n ? n.p(a, r) : (n && n.d(1), n = i && i(a), n && (n.c(), n.m(e.parentNode, e)));
    },
    i: ae,
    o: ae,
    d(a) {
      a && T(e), n && n.d(a);
    }
  };
}
function y4(t, e, l) {
  let { title: i = "", note: n, hide: a, level: r = 1 } = e, { toggleSection: s = () => {
  } } = e;
  const o = () => {
    s();
  }, u = () => {
    s();
  };
  return t.$$set = (c) => {
    "title" in c && l(0, i = c.title), "note" in c && l(1, n = c.note), "hide" in c && l(2, a = c.hide), "level" in c && l(3, r = c.level), "toggleSection" in c && l(4, s = c.toggleSection);
  }, [i, n, a, r, s, o, u];
}
class Cg extends Ve {
  constructor(e) {
    super(), Qe(this, e, y4, k4, Le, {
      title: 0,
      note: 1,
      hide: 2,
      level: 3,
      toggleSection: 4
    });
  }
}
function w4(t) {
  let e, l;
  return {
    c() {
      e = Xe("svg"), l = Xe("path"), f(l, "d", "M0 1.5A.5.5 0 0 1 .5 1H2a.5.5 0 0 1 .485.379L2.89 3H14.5a.5.5 0 0 1 .491.592l-1.5 8A.5.5 0 0 1 13 12H4a.5.5 0 0 1-.491-.408L2.01 3.607 1.61 2H.5a.5.5 0 0 1-.5-.5M3.102 4l1.313 7h8.17l1.313-7zM5 12a2 2 0 1 0 0 4 2 2 0 0 0 0-4m7 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4m-7 1a1 1 0 1 1 0 2 1 1 0 0 1 0-2m7 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2"), f(e, "xmlns", "http://www.w3.org/2000/svg"), f(e, "width", "16"), f(e, "height", "16"), f(e, "fill", "currentColor"), f(e, "class", "bi bi-cart"), f(e, "viewBox", "0 0 16 16");
    },
    m(i, n) {
      C(i, e, n), _(e, l);
    },
    d(i) {
      i && T(e);
    }
  };
}
function $4(t) {
  let e, l;
  return {
    c() {
      e = Xe("svg"), l = Xe("path"), f(l, "d", "M.5 1a.5.5 0 0 0 0 1h1.11l.401 1.607 1.498 7.985A.5.5 0 0 0 4 12h1a2 2 0 1 0 0 4 2 2 0 0 0 0-4h7a2 2 0 1 0 0 4 2 2 0 0 0 0-4h1a.5.5 0 0 0 .491-.408l1.5-8A.5.5 0 0 0 14.5 3H2.89l-.405-1.621A.5.5 0 0 0 2 1zM6 14a1 1 0 1 1-2 0 1 1 0 0 1 2 0m7 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m-1.646-7.646-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708"), f(e, "xmlns", "http://www.w3.org/2000/svg"), f(e, "width", "16"), f(e, "height", "16"), f(e, "fill", "currentColor"), f(e, "class", "bi bi-cart-check-fill"), f(e, "viewBox", "0 0 16 16");
    },
    m(i, n) {
      C(i, e, n), _(e, l);
    },
    d(i) {
      i && T(e);
    }
  };
}
function q4(t) {
  let e;
  function l(a, r) {
    return (
      /*on*/
      a[0] ? $4 : w4
    );
  }
  let i = l(t), n = i(t);
  return {
    c() {
      n.c(), e = Be();
    },
    m(a, r) {
      n.m(a, r), C(a, e, r);
    },
    p(a, [r]) {
      i !== (i = l(a)) && (n.d(1), n = i(a), n && (n.c(), n.m(e.parentNode, e)));
    },
    i: ae,
    o: ae,
    d(a) {
      a && T(e), n.d(a);
    }
  };
}
function j4(t, e, l) {
  let { on: i = !1 } = e;
  return t.$$set = (n) => {
    "on" in n && l(0, i = n.on);
  }, [i];
}
class Tt extends Ve {
  constructor(e) {
    super(), Qe(this, e, j4, q4, Le, { on: 0 });
  }
}
function mc(t, e, l) {
  const i = t.slice();
  return i[8] = e[l], i[10] = l, i;
}
function gc(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[5].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1wl619s");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler*/
        t[6]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s & /*$basket, key*/
      33 && (o.on = /*$basket*/
      r[5].includes(
        /*key*/
        r[0]
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function T4(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), f(e, "class", "svelte-1wl619s");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function C4(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), f(e, "class", "svelte-1wl619s");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function S4(t) {
  let e;
  return {
    c() {
      e = E(
        /*value*/
        t[1]
      );
    },
    m(l, i) {
      C(l, e, i);
    },
    p(l, i) {
      i & /*value*/
      2 && Y(
        e,
        /*value*/
        l[1]
      );
    },
    i: ae,
    o: ae,
    d(l) {
      l && T(e);
    }
  };
}
function M4(t) {
  let e = (
    /*value*/
    t[1].join(", ") + ""
  ), l;
  return {
    c() {
      l = E(e);
    },
    m(i, n) {
      C(i, l, n);
    },
    p(i, n) {
      n & /*value*/
      2 && e !== (e = /*value*/
      i[1].join(", ") + "") && Y(l, e);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(l);
    }
  };
}
function z4(t) {
  let e, l, i = we(
    /*value*/
    t[1]
  ), n = [];
  for (let r = 0; r < i.length; r += 1)
    n[r] = vc(mc(t, i, r));
  const a = (r) => D(n[r], 1, 1, () => {
    n[r] = null;
  });
  return {
    c() {
      for (let r = 0; r < n.length; r += 1)
        n[r].c();
      e = Be();
    },
    m(r, s) {
      for (let o = 0; o < n.length; o += 1)
        n[o] && n[o].m(r, s);
      C(r, e, s), l = !0;
    },
    p(r, s) {
      if (s & /*value, addToBasket, $basket*/
      38) {
        i = we(
          /*value*/
          r[1]
        );
        let o;
        for (o = 0; o < i.length; o += 1) {
          const u = mc(r, i, o);
          n[o] ? (n[o].p(u, s), S(n[o], 1)) : (n[o] = vc(u), n[o].c(), S(n[o], 1), n[o].m(e.parentNode, e));
        }
        for (ge(), o = i.length; o < n.length; o += 1)
          a(o);
        be();
      }
    },
    i(r) {
      if (!l) {
        for (let s = 0; s < i.length; s += 1)
          S(n[s]);
        l = !0;
      }
    },
    o(r) {
      n = n.filter(Boolean);
      for (let s = 0; s < n.length; s += 1)
        D(n[s]);
      l = !1;
    },
    d(r) {
      r && T(e), Ge(n, r);
    }
  };
}
function bc(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[5].includes(`meas_map_${/*i*/
        t[10]} = backend.meas_map[${/*i*/
        t[10]}]`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_1*/
      t[7](
        /*i*/
        t[10]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1wl619s");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o & /*$basket*/
      32 && (u.on = /*$basket*/
      t[5].includes(`meas_map_${/*i*/
      t[10]} = backend.meas_map[${/*i*/
      t[10]}]`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function vc(t) {
  let e, l, i, n = (
    /*i*/
    t[10] + 1 + ""
  ), a, r, s, o = (
    /*v*/
    t[8].join(", ") + ""
  ), u, c, d, h = (
    /*addToBasket*/
    t[2] && bc(t)
  );
  return {
    c() {
      e = m("div"), l = m("strong"), i = E("Group "), a = E(n), r = A(), h && h.c(), s = A(), u = E(o), c = A(), f(l, "class", "svelte-1wl619s"), f(e, "class", "meas_grouping svelte-1wl619s");
    },
    m(p, b) {
      C(p, e, b), _(e, l), _(l, i), _(l, a), _(l, r), h && h.m(l, null), _(e, s), _(e, u), _(e, c), d = !0;
    },
    p(p, b) {
      /*addToBasket*/
      p[2] ? h ? (h.p(p, b), b & /*addToBasket*/
      4 && S(h, 1)) : (h = bc(p), h.c(), S(h, 1), h.m(l, null)) : h && (ge(), D(h, 1, 1, () => {
        h = null;
      }), be()), (!d || b & /*value*/
      2) && o !== (o = /*v*/
      p[8].join(", ") + "") && Y(u, o);
    },
    i(p) {
      d || (S(h), d = !0);
    },
    o(p) {
      D(h), d = !1;
    },
    d(p) {
      p && T(e), h && h.d();
    }
  };
}
function kc(t) {
  let e, l = mt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), f(e, "class", "desc svelte-1wl619s");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = mt[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function N4(t) {
  let e, l, i, n, a, r, s, o, u = (
    /*addToBasket*/
    t[2] && gc(t)
  );
  function c(y, k) {
    if (
      /*level*/
      y[4] == 1
    )
      return C4;
    if (
      /*level*/
      y[4] == 2
    )
      return T4;
  }
  let d = c(t), h = d && d(t);
  const p = [z4, M4, S4], b = [];
  function g(y, k) {
    var w;
    return (
      /*value*/
      y[1] !== void 0 && /*key*/
      y[0] === "meas_map" ? 0 : (
        /*value*/
        y[1] !== void 0 && /*value*/
        ((w = y[1]) == null ? void 0 : w.constructor.name) === "Array" ? 1 : (
          /*value*/
          y[1] !== void 0 ? 2 : -1
        )
      )
    );
  }
  ~(a = g(t)) && (r = b[a] = p[a](t));
  let v = mt[
    /*key*/
    t[0]
  ] && kc(t);
  return {
    c() {
      e = m("article"), u && u.c(), l = A(), h && h.c(), i = A(), n = m("div"), r && r.c(), s = A(), v && v.c(), f(n, "class", "value svelte-1wl619s"), f(e, "class", "svelte-1wl619s");
    },
    m(y, k) {
      C(y, e, k), u && u.m(e, null), _(e, l), h && h.m(e, null), _(e, i), _(e, n), ~a && b[a].m(n, null), _(e, s), v && v.m(e, null), o = !0;
    },
    p(y, [k]) {
      /*addToBasket*/
      y[2] ? u ? (u.p(y, k), k & /*addToBasket*/
      4 && S(u, 1)) : (u = gc(y), u.c(), S(u, 1), u.m(e, l)) : u && (ge(), D(u, 1, 1, () => {
        u = null;
      }), be()), d === (d = c(y)) && h ? h.p(y, k) : (h && h.d(1), h = d && d(y), h && (h.c(), h.m(e, i)));
      let w = a;
      a = g(y), a === w ? ~a && b[a].p(y, k) : (r && (ge(), D(b[w], 1, 1, () => {
        b[w] = null;
      }), be()), ~a ? (r = b[a], r ? r.p(y, k) : (r = b[a] = p[a](y), r.c()), S(r, 1), r.m(n, null)) : r = null), mt[
        /*key*/
        y[0]
      ] ? v ? v.p(y, k) : (v = kc(y), v.c(), v.m(e, null)) : v && (v.d(1), v = null);
    },
    i(y) {
      o || (S(u), S(r), o = !0);
    },
    o(y) {
      D(u), D(r), o = !1;
    },
    d(y) {
      y && T(e), u && u.d(), h && h.d(), ~a && b[a].d(), v && v.d();
    }
  };
}
function A4(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, (p) => l(5, i = p)), u);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: u, level: c = 1 } = e;
  a();
  const d = () => {
    o(r);
  }, h = (p) => {
    o(`meas_map_${p} = backend.meas_map[${p}]`);
  };
  return t.$$set = (p) => {
    "key" in p && l(0, r = p.key), "value" in p && l(1, s = p.value), "addToBasket" in p && l(2, o = p.addToBasket), "basket" in p && a(l(3, u = p.basket)), "level" in p && l(4, c = p.level);
  }, [
    r,
    s,
    o,
    u,
    c,
    i,
    d,
    h
  ];
}
class tr extends Ve {
  constructor(e) {
    super(), Qe(this, e, A4, N4, Le, {
      key: 0,
      value: 1,
      addToBasket: 2,
      basket: 3,
      level: 4
    });
  }
}
function B4(t) {
  let e, l, i, n;
  return {
    c() {
      e = Xe("svg"), l = Xe("path"), i = Xe("path"), n = Xe("path"), f(l, "d", "M8.515 1.019A7 7 0 0 0 8 1V0a8 8 0 0 1 .589.022zm2.004.45a7 7 0 0 0-.985-.299l.219-.976q.576.129 1.126.342zm1.37.71a7 7 0 0 0-.439-.27l.493-.87a8 8 0 0 1 .979.654l-.615.789a7 7 0 0 0-.418-.302zm1.834 1.79a7 7 0 0 0-.653-.796l.724-.69q.406.429.747.91zm.744 1.352a7 7 0 0 0-.214-.468l.893-.45a8 8 0 0 1 .45 1.088l-.95.313a7 7 0 0 0-.179-.483m.53 2.507a7 7 0 0 0-.1-1.025l.985-.17q.1.58.116 1.17zm-.131 1.538q.05-.254.081-.51l.993.123a8 8 0 0 1-.23 1.155l-.964-.267q.069-.247.12-.501m-.952 2.379q.276-.436.486-.908l.914.405q-.24.54-.555 1.038zm-.964 1.205q.183-.183.35-.378l.758.653a8 8 0 0 1-.401.432z"), f(i, "d", "M8 1a7 7 0 1 0 4.95 11.95l.707.707A8.001 8.001 0 1 1 8 0z"), f(n, "d", "M7.5 3a.5.5 0 0 1 .5.5v5.21l3.248 1.856a.5.5 0 0 1-.496.868l-3.5-2A.5.5 0 0 1 7 9V3.5a.5.5 0 0 1 .5-.5"), f(e, "xmlns", "http://www.w3.org/2000/svg"), f(e, "width", "16"), f(e, "height", "16"), f(e, "fill", "currentColor"), f(e, "class", "bi bi-clock-history"), f(e, "viewBox", "0 0 16 16");
    },
    m(a, r) {
      C(a, e, r), _(e, l), _(e, i), _(e, n);
    },
    p: ae,
    i: ae,
    o: ae,
    d(a) {
      a && T(e);
    }
  };
}
class Tl extends Ve {
  constructor(e) {
    super(), Qe(this, e, null, B4, Le, {});
  }
}
function yc(t, e, l) {
  const i = t.slice();
  return i[9] = e[l], i[16] = l, i;
}
function wc(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(
          /*key*/
          t[9]
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-jt5wrr");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler*/
        t[12]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s & /*$basket, key*/
      1536 && (o.on = /*$basket*/
      r[10].includes(
        /*key*/
        r[9]
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function P4(t) {
  let e, l = ft[
    /*key*/
    t[9]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), f(e, "class", "svelte-jt5wrr");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      512 && l !== (l = ft[
        /*key*/
        n[9]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function E4(t) {
  let e, l = ft[
    /*key*/
    t[9]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), f(e, "class", "svelte-jt5wrr");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      512 && l !== (l = ft[
        /*key*/
        n[9]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function $c(t) {
  let e;
  return {
    c() {
      e = m("th"), e.textContent = "T", f(e, "class", "svelte-jt5wrr");
    },
    m(l, i) {
      C(l, e, i);
    },
    d(l) {
      l && T(e);
    }
  };
}
function qc(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(`${/*key*/
        t[9]}_${/*ki*/
        t[16]} = ${/*code_header*/
        t[4]}${/*key*/
        t[9]}${/*code_footer*/
        t[5]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_1*/
      t[13](
        /*key*/
        t[9],
        /*ki*/
        t[16]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-jt5wrr");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o & /*$basket, value, code_header, code_footer*/
      1073 && (u.on = /*$basket*/
      t[10].includes(`${/*key*/
      t[9]}_${/*ki*/
      t[16]} = ${/*code_header*/
      t[4]}${/*key*/
      t[9]}${/*code_footer*/
      t[5]}`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function jc(t) {
  let e, l, i, n, a, r;
  i = new Tl({});
  function s() {
    return (
      /*click_handler_2*/
      t[14](
        /*key*/
        t[9]
      )
    );
  }
  return {
    c() {
      e = m("td"), l = m("button"), he(i.$$.fragment), f(l, "class", "basket svelte-jt5wrr"), f(e, "class", "svelte-jt5wrr");
    },
    m(o, u) {
      C(o, e, u), _(e, l), ce(i, l, null), n = !0, a || (r = le(l, "click", s), a = !0);
    },
    p(o, u) {
      t = o;
    },
    i(o) {
      n || (S(i.$$.fragment, o), n = !0);
    },
    o(o) {
      D(i.$$.fragment, o), n = !1;
    },
    d(o) {
      o && T(e), de(i), a = !1, r();
    }
  };
}
function Tc(t) {
  let e, l, i = (
    /*key*/
    t[9] + ""
  ), n, a, r = (
    /*value*/
    t[0][
      /*key*/
      t[9]
    ].value + ""
  ), s, o, u = (
    /*value*/
    t[0][
      /*key*/
      t[9]
    ].unit + ""
  ), c, d, h = (
    /*value*/
    t[0][
      /*key*/
      t[9]
    ].asof + ""
  ), p, b, g, v, y, k, w = (
    /*addToBasket*/
    t[1] && qc(t)
  ), $ = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && jc(t)
  );
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = m("td"), s = E(r), o = m("td"), c = E(u), d = m("td"), p = E(h), b = A(), g = m("td"), w && w.c(), v = A(), $ && $.c(), y = A(), f(l, "class", "svelte-jt5wrr"), f(a, "class", "svelte-jt5wrr"), f(o, "class", "svelte-jt5wrr"), f(d, "class", "svelte-jt5wrr"), f(g, "class", "svelte-jt5wrr");
    },
    m(q, j) {
      C(q, e, j), _(e, l), _(l, n), _(e, a), _(a, s), _(e, o), _(o, c), _(e, d), _(d, p), _(e, b), _(e, g), w && w.m(g, null), _(e, v), $ && $.m(e, null), _(e, y), k = !0;
    },
    p(q, j) {
      (!k || j & /*value*/
      1) && i !== (i = /*key*/
      q[9] + "") && Y(n, i), (!k || j & /*value*/
      1) && r !== (r = /*value*/
      q[0][
        /*key*/
        q[9]
      ].value + "") && Y(s, r), (!k || j & /*value*/
      1) && u !== (u = /*value*/
      q[0][
        /*key*/
        q[9]
      ].unit + "") && Y(c, u), (!k || j & /*value*/
      1) && h !== (h = /*value*/
      q[0][
        /*key*/
        q[9]
      ].asof + "") && Y(p, h), /*addToBasket*/
      q[1] ? w ? (w.p(q, j), j & /*addToBasket*/
      2 && S(w, 1)) : (w = qc(q), w.c(), S(w, 1), w.m(g, null)) : w && (ge(), D(w, 1, 1, () => {
        w = null;
      }), be()), /*topLevelKey*/
      q[7] === "properties" && /*openTimeMachine*/
      q[8] ? $ ? ($.p(q, j), j & /*topLevelKey, openTimeMachine*/
      384 && S($, 1)) : ($ = jc(q), $.c(), S($, 1), $.m(e, y)) : $ && (ge(), D($, 1, 1, () => {
        $ = null;
      }), be());
    },
    i(q) {
      k || (S(w), S($), k = !0);
    },
    o(q) {
      D(w), D($), k = !1;
    },
    d(q) {
      q && T(e), w && w.d(), $ && $.d();
    }
  };
}
function Cc(t) {
  let e, l = mt[
    /*key*/
    t[9]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), f(e, "class", "desc svelte-jt5wrr");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      512 && l !== (l = mt[
        /*key*/
        n[9]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function O4(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j = (
    /*addToBasket*/
    t[1] && wc(t)
  );
  function O(I, L) {
    if (
      /*level*/
      I[3] == 1
    )
      return E4;
    if (
      /*level*/
      I[3] == 2
    )
      return P4;
  }
  let z = O(t), N = z && z(t), M = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && $c()
  ), H = we(Object.keys(
    /*value*/
    t[0]
  )), B = [];
  for (let I = 0; I < H.length; I += 1)
    B[I] = Tc(yc(t, H, I));
  const R = (I) => D(B[I], 1, 1, () => {
    B[I] = null;
  });
  let P = mt[
    /*key*/
    t[9]
  ] && Cc(t);
  return {
    c() {
      e = m("article"), j && j.c(), l = A(), N && N.c(), i = A(), n = m("div"), a = m("table"), r = m("thead"), s = m("tr"), o = m("th"), o.textContent = "Name", u = A(), c = m("th"), c.textContent = "Value", d = A(), h = m("th"), h.textContent = "Unit", p = A(), b = m("th"), b.textContent = "As of", g = A(), v = m("th"), v.textContent = "-", y = A(), M && M.c(), k = A(), w = m("tbody");
      for (let I = 0; I < B.length; I += 1)
        B[I].c();
      $ = A(), P && P.c(), f(o, "class", "svelte-jt5wrr"), f(c, "class", "svelte-jt5wrr"), f(h, "class", "svelte-jt5wrr"), f(b, "class", "svelte-jt5wrr"), f(v, "class", "svelte-jt5wrr"), f(r, "class", "svelte-jt5wrr"), f(a, "class", "svelte-jt5wrr"), f(n, "class", "value svelte-jt5wrr"), f(e, "class", "svelte-jt5wrr");
    },
    m(I, L) {
      C(I, e, L), j && j.m(e, null), _(e, l), N && N.m(e, null), _(e, i), _(e, n), _(n, a), _(a, r), _(r, s), _(s, o), _(s, u), _(s, c), _(s, d), _(s, h), _(s, p), _(s, b), _(s, g), _(s, v), _(s, y), M && M.m(s, null), _(a, k), _(a, w);
      for (let F = 0; F < B.length; F += 1)
        B[F] && B[F].m(w, null);
      _(e, $), P && P.m(e, null), q = !0;
    },
    p(I, [L]) {
      if (/*addToBasket*/
      I[1] ? j ? (j.p(I, L), L & /*addToBasket*/
      2 && S(j, 1)) : (j = wc(I), j.c(), S(j, 1), j.m(e, l)) : j && (ge(), D(j, 1, 1, () => {
        j = null;
      }), be()), z === (z = O(I)) && N ? N.p(I, L) : (N && N.d(1), N = z && z(I), N && (N.c(), N.m(e, i))), /*topLevelKey*/
      I[7] === "properties" && /*openTimeMachine*/
      I[8] ? M || (M = $c(), M.c(), M.m(s, null)) : M && (M.d(1), M = null), L & /*openTimeMachine, Object, value, parentKey, topLevelKey, code_header, code_footer, addToBasket, $basket*/
      1523) {
        H = we(Object.keys(
          /*value*/
          I[0]
        ));
        let F;
        for (F = 0; F < H.length; F += 1) {
          const X = yc(I, H, F);
          B[F] ? (B[F].p(X, L), S(B[F], 1)) : (B[F] = Tc(X), B[F].c(), S(B[F], 1), B[F].m(w, null));
        }
        for (ge(), F = H.length; F < B.length; F += 1)
          R(F);
        be();
      }
      mt[
        /*key*/
        I[9]
      ] ? P ? P.p(I, L) : (P = Cc(I), P.c(), P.m(e, null)) : P && (P.d(1), P = null);
    },
    i(I) {
      if (!q) {
        S(j);
        for (let L = 0; L < H.length; L += 1)
          S(B[L]);
        q = !0;
      }
    },
    o(I) {
      D(j), B = B.filter(Boolean);
      for (let L = 0; L < B.length; L += 1)
        D(B[L]);
      q = !1;
    },
    d(I) {
      I && T(e), j && j.d(), N && N.d(), M && M.d(), Ge(B, I), P && P.d();
    }
  };
}
function I4(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, ($) => l(10, i = $)), u);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: u, level: c = 1, code_header: d = "", code_type: h = "", code_footer: p = "", parentKey: b = "", topLevelKey: g = "", openTimeMachine: v } = e;
  a();
  const y = () => {
    o(r);
  }, k = ($, q) => {
    o(`${$}_${q} = ${d}${$}${p}`);
  }, w = ($) => {
    v({
      datatype: "nudv-map",
      key: $,
      title_key: $,
      parentKey: b,
      topLevelKey: g,
      data: s[$],
      code_header: d,
      code_key: $,
      code_footer: p
    });
  };
  return t.$$set = ($) => {
    "key" in $ && l(9, r = $.key), "value" in $ && l(0, s = $.value), "addToBasket" in $ && l(1, o = $.addToBasket), "basket" in $ && a(l(2, u = $.basket)), "level" in $ && l(3, c = $.level), "code_header" in $ && l(4, d = $.code_header), "code_type" in $ && l(11, h = $.code_type), "code_footer" in $ && l(5, p = $.code_footer), "parentKey" in $ && l(6, b = $.parentKey), "topLevelKey" in $ && l(7, g = $.topLevelKey), "openTimeMachine" in $ && l(8, v = $.openTimeMachine);
  }, [
    s,
    o,
    u,
    c,
    d,
    p,
    b,
    g,
    v,
    r,
    i,
    h,
    y,
    k,
    w
  ];
}
class D4 extends Ve {
  constructor(e) {
    super(), Qe(this, e, I4, O4, Le, {
      key: 9,
      value: 0,
      addToBasket: 1,
      basket: 2,
      level: 3,
      code_header: 4,
      code_type: 11,
      code_footer: 5,
      parentKey: 6,
      topLevelKey: 7,
      openTimeMachine: 8
    });
  }
}
function Sc(t, e, l) {
  const i = t.slice();
  return i[23] = e[l], i[25] = l, i;
}
function Mc(t, e, l) {
  const i = t.slice();
  return i[26] = e[l], i;
}
function zc(t, e, l) {
  const i = t.slice();
  return i[26] = e[l], i;
}
function Nc(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[13].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1xxiico");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler*/
        t[16]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s & /*$basket, key*/
      8193 && (o.on = /*$basket*/
      r[13].includes(
        /*key*/
        r[0]
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function R4(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), f(e, "class", "svelte-1xxiico");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function H4(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), f(e, "class", "svelte-1xxiico");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function Ac(t) {
  let e, l = (
    /*g*/
    t[26] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*g*/
      t[26], dt(e, e.__value), e.selected = a = /*filter*/
      t[10].gates.includes(
        /*g*/
        t[26]
      );
    },
    m(r, s) {
      C(r, e, s), _(e, i);
    },
    p(r, s) {
      s & /*gates*/
      2048 && l !== (l = /*g*/
      r[26] + "") && Y(i, l), s & /*gates*/
      2048 && n !== (n = /*g*/
      r[26]) && (e.__value = n, dt(e, e.__value)), s & /*filter, gates*/
      3072 && a !== (a = /*filter*/
      r[10].gates.includes(
        /*g*/
        r[26]
      )) && (e.selected = a);
    },
    d(r) {
      r && T(e);
    }
  };
}
function Bc(t) {
  let e, l = (
    /*g*/
    t[26] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*g*/
      t[26], dt(e, e.__value), e.selected = a = /*filter*/
      t[10].qubits.includes(
        /*g*/
        t[26]
      );
    },
    m(r, s) {
      C(r, e, s), _(e, i);
    },
    p(r, s) {
      s & /*qubits*/
      4096 && l !== (l = /*g*/
      r[26] + "") && Y(i, l), s & /*qubits*/
      4096 && n !== (n = /*g*/
      r[26]) && (e.__value = n, dt(e, e.__value)), s & /*filter, qubits*/
      5120 && a !== (a = /*filter*/
      r[10].qubits.includes(
        /*g*/
        r[26]
      )) && (e.selected = a);
    },
    d(r) {
      r && T(e);
    }
  };
}
function Pc(t) {
  let e;
  return {
    c() {
      e = m("th"), e.textContent = "T", f(e, "class", "svelte-1xxiico");
    },
    m(l, i) {
      C(l, e, i);
    },
    d(l) {
      l && T(e);
    }
  };
}
function Ec(t) {
  var te, ie, U, G;
  let e, l, i = (
    /*gate*/
    t[23].gate + ""
  ), n, a, r, s = (
    /*gate*/
    t[23].qubits.join(",") + ""
  ), o, u, c, d = (
    /*gate*/
    ((te = t[23].parameters.gate_error) == null ? void 0 : te.value) + ""
  ), h, p, b, g, v = (
    /*gate*/
    ((ie = t[23].parameters.gate_error) == null ? void 0 : ie.asof) + ""
  ), y, k, w, $ = (
    /*gate*/
    ((U = t[23].parameters.gate_length) == null ? void 0 : U.value) + ""
  ), q, j, O = (
    /*gate*/
    t[23].parameters.gate_length.unit + ""
  ), z, N, M, H, B, R = (
    /*gate*/
    ((G = t[23].parameters.gate_length) == null ? void 0 : G.asof) + ""
  ), P, I, L, F, X, V, Q = (
    /*addToBasket*/
    t[2] && Oc(t)
  ), J = (
    /*topLevelKey*/
    t[8] === "properties" && /*openTimeMachine*/
    t[9] && Ic(t)
  );
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = A(), r = m("td"), o = E(s), u = A(), c = m("td"), h = E(d), p = m("br"), b = A(), g = m("span"), y = E(v), k = A(), w = m("td"), q = E($), j = E(" ("), z = E(O), N = E(")"), M = m("br"), H = A(), B = m("span"), P = E(R), I = A(), L = m("td"), Q && Q.c(), F = A(), J && J.c(), X = A(), f(l, "class", "svelte-1xxiico"), f(r, "class", "svelte-1xxiico"), f(g, "class", "asof svelte-1xxiico"), f(c, "class", "svelte-1xxiico"), f(B, "class", "asof svelte-1xxiico"), f(w, "class", "svelte-1xxiico"), f(L, "class", "svelte-1xxiico");
    },
    m(W, Z) {
      C(W, e, Z), _(e, l), _(l, n), _(e, a), _(e, r), _(r, o), _(e, u), _(e, c), _(c, h), _(c, p), _(c, b), _(c, g), _(g, y), _(e, k), _(e, w), _(w, q), _(w, j), _(w, z), _(w, N), _(w, M), _(w, H), _(w, B), _(B, P), _(e, I), _(e, L), Q && Q.m(L, null), _(e, F), J && J.m(e, null), _(e, X), V = !0;
    },
    p(W, Z) {
      var ee, ye, qe, je;
      (!V || Z & /*value*/
      2) && i !== (i = /*gate*/
      W[23].gate + "") && Y(n, i), (!V || Z & /*value*/
      2) && s !== (s = /*gate*/
      W[23].qubits.join(",") + "") && Y(o, s), (!V || Z & /*value*/
      2) && d !== (d = /*gate*/
      ((ee = W[23].parameters.gate_error) == null ? void 0 : ee.value) + "") && Y(h, d), (!V || Z & /*value*/
      2) && v !== (v = /*gate*/
      ((ye = W[23].parameters.gate_error) == null ? void 0 : ye.asof) + "") && Y(y, v), (!V || Z & /*value*/
      2) && $ !== ($ = /*gate*/
      ((qe = W[23].parameters.gate_length) == null ? void 0 : qe.value) + "") && Y(q, $), (!V || Z & /*value*/
      2) && O !== (O = /*gate*/
      W[23].parameters.gate_length.unit + "") && Y(z, O), (!V || Z & /*value*/
      2) && R !== (R = /*gate*/
      ((je = W[23].parameters.gate_length) == null ? void 0 : je.asof) + "") && Y(P, R), /*addToBasket*/
      W[2] ? Q ? (Q.p(W, Z), Z & /*addToBasket*/
      4 && S(Q, 1)) : (Q = Oc(W), Q.c(), S(Q, 1), Q.m(L, null)) : Q && (ge(), D(Q, 1, 1, () => {
        Q = null;
      }), be()), /*topLevelKey*/
      W[8] === "properties" && /*openTimeMachine*/
      W[9] ? J ? (J.p(W, Z), Z & /*topLevelKey, openTimeMachine*/
      768 && S(J, 1)) : (J = Ic(W), J.c(), S(J, 1), J.m(e, X)) : J && (ge(), D(J, 1, 1, () => {
        J = null;
      }), be());
    },
    i(W) {
      V || (S(Q), S(J), V = !0);
    },
    o(W) {
      D(Q), D(J), V = !1;
    },
    d(W) {
      W && T(e), Q && Q.d(), J && J.d();
    }
  };
}
function Oc(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[13].includes(`gate_${/*gate*/
        t[23].gate}_${/*gate*/
        t[23].qubits.join("_")} = ${/*code_header*/
        t[5]}gate="${/*gate*/
        t[23].gate}", qubits=[${/*gate*/
        t[23].qubits.join(", ")}]${/*code_footer*/
        t[6]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_3*/
      t[21](
        /*gate*/
        t[23]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1xxiico");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o & /*$basket, value, code_header, code_footer*/
      8290 && (u.on = /*$basket*/
      t[13].includes(`gate_${/*gate*/
      t[23].gate}_${/*gate*/
      t[23].qubits.join("_")} = ${/*code_header*/
      t[5]}gate="${/*gate*/
      t[23].gate}", qubits=[${/*gate*/
      t[23].qubits.join(", ")}]${/*code_footer*/
      t[6]}`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function Ic(t) {
  let e, l, i, n, a, r;
  i = new Tl({});
  function s() {
    return (
      /*click_handler_4*/
      t[22](
        /*gate*/
        t[23],
        /*gi*/
        t[25]
      )
    );
  }
  return {
    c() {
      e = m("td"), l = m("button"), he(i.$$.fragment), f(l, "class", "basket svelte-1xxiico"), f(e, "class", "svelte-1xxiico");
    },
    m(o, u) {
      C(o, e, u), _(e, l), ce(i, l, null), n = !0, a || (r = le(l, "click", s), a = !0);
    },
    p(o, u) {
      t = o;
    },
    i(o) {
      n || (S(i.$$.fragment, o), n = !0);
    },
    o(o) {
      D(i.$$.fragment, o), n = !1;
    },
    d(o) {
      o && T(e), de(i), a = !1, r();
    }
  };
}
function Dc(t) {
  let e = (!/*filter*/
  t[10].gates || /*filter*/
  t[10].gates.length == 0 || /*filter*/
  t[10].gates && /*filter*/
  t[10].gates.includes(
    /*gate*/
    t[23].gate
  )) && (!/*filter*/
  t[10].qubits || /*filter*/
  t[10].qubits.length == 0 || /*filter*/
  t[10].qubits && /*gate*/
  t[23].qubits.some(
    /*func*/
    t[15]
  )), l, i, n = e && Ec(t);
  return {
    c() {
      n && n.c(), l = Be();
    },
    m(a, r) {
      n && n.m(a, r), C(a, l, r), i = !0;
    },
    p(a, r) {
      r & /*filter, value*/
      1026 && (e = (!/*filter*/
      a[10].gates || /*filter*/
      a[10].gates.length == 0 || /*filter*/
      a[10].gates && /*filter*/
      a[10].gates.includes(
        /*gate*/
        a[23].gate
      )) && (!/*filter*/
      a[10].qubits || /*filter*/
      a[10].qubits.length == 0 || /*filter*/
      a[10].qubits && /*gate*/
      a[23].qubits.some(
        /*func*/
        a[15]
      ))), e ? n ? (n.p(a, r), r & /*filter, value*/
      1026 && S(n, 1)) : (n = Ec(a), n.c(), S(n, 1), n.m(l.parentNode, l)) : n && (ge(), D(n, 1, 1, () => {
        n = null;
      }), be());
    },
    i(a) {
      i || (S(n), i = !0);
    },
    o(a) {
      D(n), i = !1;
    },
    d(a) {
      a && T(l), n && n.d(a);
    }
  };
}
function Rc(t) {
  let e, l = mt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), f(e, "class", "desc svelte-1xxiico");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = mt[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function F4(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R, P, I, L, F, X, V, Q, J, te, ie, U = (
    /*addToBasket*/
    t[2] && Nc(t)
  );
  function G(ne, oe) {
    if (
      /*level*/
      ne[4] == 1
    )
      return H4;
    if (
      /*level*/
      ne[4] == 2
    )
      return R4;
  }
  let W = G(t), Z = W && W(t), ee = we(
    /*gates*/
    t[11]
  ), ye = [];
  for (let ne = 0; ne < ee.length; ne += 1)
    ye[ne] = Ac(zc(t, ee, ne));
  let qe = we(
    /*qubits*/
    t[12]
  ), je = [];
  for (let ne = 0; ne < qe.length; ne += 1)
    je[ne] = Bc(Mc(t, qe, ne));
  let fe = (
    /*topLevelKey*/
    t[8] === "properties" && /*openTimeMachine*/
    t[9] && Pc()
  ), _e = we(
    /*value*/
    t[1]
  ), K = [];
  for (let ne = 0; ne < _e.length; ne += 1)
    K[ne] = Dc(Sc(t, _e, ne));
  const ke = (ne) => D(K[ne], 1, 1, () => {
    K[ne] = null;
  });
  let ue = mt[
    /*key*/
    t[0]
  ] && Rc(t);
  return {
    c() {
      e = m("article"), U && U.c(), l = A(), Z && Z.c(), i = A(), n = m("div"), a = m("div"), r = m("div"), s = m("label"), s.textContent = "Gates", o = A(), u = m("button"), u.textContent = "×", c = A(), d = m("select");
      for (let ne = 0; ne < ye.length; ne += 1)
        ye[ne].c();
      h = A(), p = m("div"), b = m("label"), b.textContent = "Qubits", g = A(), v = m("button"), v.textContent = "×", y = A(), k = m("select");
      for (let ne = 0; ne < je.length; ne += 1)
        je[ne].c();
      w = A(), $ = m("div"), q = m("table"), j = m("thead"), O = m("tr"), z = m("th"), z.textContent = "Gate", N = A(), M = m("th"), M.textContent = "Qubits", H = A(), B = m("th"), B.textContent = "Error", R = A(), P = m("th"), P.textContent = "Length", I = A(), L = m("th"), L.textContent = "-", F = A(), fe && fe.c(), X = A(), V = m("tbody");
      for (let ne = 0; ne < K.length; ne += 1)
        K[ne].c();
      Q = A(), ue && ue.c(), f(s, "for", "gates"), f(s, "class", "svelte-1xxiico"), f(u, "class", "svelte-1xxiico"), f(d, "class", "filter svelte-1xxiico"), f(d, "name", "gates"), f(d, "id", "gates"), d.multiple = !0, f(r, "class", "svelte-1xxiico"), f(b, "for", "qubits"), f(b, "class", "svelte-1xxiico"), f(v, "class", "svelte-1xxiico"), f(k, "class", "filter svelte-1xxiico"), f(k, "name", "qubits"), f(k, "id", "qubits"), k.multiple = !0, f(p, "class", "svelte-1xxiico"), f(a, "class", "filter-wrap svelte-1xxiico"), f(z, "class", "svelte-1xxiico"), f(M, "class", "svelte-1xxiico"), f(B, "class", "svelte-1xxiico"), f(P, "class", "svelte-1xxiico"), f(L, "class", "svelte-1xxiico"), f(j, "class", "svelte-1xxiico"), f(q, "class", "svelte-1xxiico"), f($, "class", "value svelte-1xxiico"), f(n, "class", "content-wrap svelte-1xxiico"), f(e, "class", "svelte-1xxiico");
    },
    m(ne, oe) {
      C(ne, e, oe), U && U.m(e, null), _(e, l), Z && Z.m(e, null), _(e, i), _(e, n), _(n, a), _(a, r), _(r, s), _(r, o), _(r, u), _(r, c), _(r, d);
      for (let x = 0; x < ye.length; x += 1)
        ye[x] && ye[x].m(d, null);
      _(a, h), _(a, p), _(p, b), _(p, g), _(p, v), _(p, y), _(p, k);
      for (let x = 0; x < je.length; x += 1)
        je[x] && je[x].m(k, null);
      _(n, w), _(n, $), _($, q), _(q, j), _(j, O), _(O, z), _(O, N), _(O, M), _(O, H), _(O, B), _(O, R), _(O, P), _(O, I), _(O, L), _(O, F), fe && fe.m(O, null), _(q, X), _(q, V);
      for (let x = 0; x < K.length; x += 1)
        K[x] && K[x].m(V, null);
      _(e, Q), ue && ue.m(e, null), J = !0, te || (ie = [
        le(
          u,
          "click",
          /*click_handler_1*/
          t[17]
        ),
        le(
          d,
          "change",
          /*change_handler*/
          t[18]
        ),
        le(
          v,
          "click",
          /*click_handler_2*/
          t[19]
        ),
        le(
          k,
          "change",
          /*change_handler_1*/
          t[20]
        )
      ], te = !0);
    },
    p(ne, [oe]) {
      if (/*addToBasket*/
      ne[2] ? U ? (U.p(ne, oe), oe & /*addToBasket*/
      4 && S(U, 1)) : (U = Nc(ne), U.c(), S(U, 1), U.m(e, l)) : U && (ge(), D(U, 1, 1, () => {
        U = null;
      }), be()), W === (W = G(ne)) && Z ? Z.p(ne, oe) : (Z && Z.d(1), Z = W && W(ne), Z && (Z.c(), Z.m(e, i))), oe & /*gates, filter*/
      3072) {
        ee = we(
          /*gates*/
          ne[11]
        );
        let x;
        for (x = 0; x < ee.length; x += 1) {
          const ve = zc(ne, ee, x);
          ye[x] ? ye[x].p(ve, oe) : (ye[x] = Ac(ve), ye[x].c(), ye[x].m(d, null));
        }
        for (; x < ye.length; x += 1)
          ye[x].d(1);
        ye.length = ee.length;
      }
      if (oe & /*qubits, filter*/
      5120) {
        qe = we(
          /*qubits*/
          ne[12]
        );
        let x;
        for (x = 0; x < qe.length; x += 1) {
          const ve = Mc(ne, qe, x);
          je[x] ? je[x].p(ve, oe) : (je[x] = Bc(ve), je[x].c(), je[x].m(k, null));
        }
        for (; x < je.length; x += 1)
          je[x].d(1);
        je.length = qe.length;
      }
      if (/*topLevelKey*/
      ne[8] === "properties" && /*openTimeMachine*/
      ne[9] ? fe || (fe = Pc(), fe.c(), fe.m(O, null)) : fe && (fe.d(1), fe = null), oe & /*openTimeMachine, value, parentKey, topLevelKey, code_header, code_footer, addToBasket, $basket, filter*/
      10214) {
        _e = we(
          /*value*/
          ne[1]
        );
        let x;
        for (x = 0; x < _e.length; x += 1) {
          const ve = Sc(ne, _e, x);
          K[x] ? (K[x].p(ve, oe), S(K[x], 1)) : (K[x] = Dc(ve), K[x].c(), S(K[x], 1), K[x].m(V, null));
        }
        for (ge(), x = _e.length; x < K.length; x += 1)
          ke(x);
        be();
      }
      mt[
        /*key*/
        ne[0]
      ] ? ue ? ue.p(ne, oe) : (ue = Rc(ne), ue.c(), ue.m(e, null)) : ue && (ue.d(1), ue = null);
    },
    i(ne) {
      if (!J) {
        S(U);
        for (let oe = 0; oe < _e.length; oe += 1)
          S(K[oe]);
        J = !0;
      }
    },
    o(ne) {
      D(U), K = K.filter(Boolean);
      for (let oe = 0; oe < K.length; oe += 1)
        D(K[oe]);
      J = !1;
    },
    d(ne) {
      ne && T(e), U && U.d(), Z && Z.d(), Ge(ye, ne), Ge(je, ne), fe && fe.d(), Ge(K, ne), ue && ue.d(), te = !1, vt(ie);
    }
  };
}
function L4(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, (B) => l(13, i = B)), u);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: u, level: c = 1, code_header: d = "", code_type: h = "", code_footer: p = "", parentKey: b = "", topLevelKey: g = "", openTimeMachine: v } = e;
  a();
  let y = { gates: [], qubits: [] }, k = [], w = [];
  yt(() => {
    s && (l(11, k = Array.from(new Set(s.map((B) => B.gate)))), l(12, w = Array.from(new Set(s.map((B) => B.qubits).flat()))));
  });
  const $ = (B) => y.qubits.includes(B), q = () => {
    o(r);
  }, j = (B) => {
    l(10, y.gates = [], y);
  }, O = (B) => {
    l(10, y.gates = Array.from(B.target.selectedOptions).map((R) => R.value), y);
  }, z = (B) => {
    l(10, y.qubits = [], y);
  }, N = (B) => {
    l(10, y.qubits = Array.from(B.target.selectedOptions).map((R) => parseInt(R.value)), y);
  }, M = (B) => {
    o(`gate_${B.gate}_${B.qubits.join("_")} = ${d}gate="${B.gate}", qubits=[${B.qubits.join(", ")}]${p}`);
  }, H = (B, R) => {
    v({
      datatype: "gates",
      key: B.gate + "_" + B.qubits.join("_"),
      title_key: `gate[${B.qubits.join(",")}].${B.gate}`,
      index: R,
      parentKey: b,
      topLevelKey: g,
      data: B,
      code_header: d,
      code_footer: p
    });
  };
  return t.$$set = (B) => {
    "key" in B && l(0, r = B.key), "value" in B && l(1, s = B.value), "addToBasket" in B && l(2, o = B.addToBasket), "basket" in B && a(l(3, u = B.basket)), "level" in B && l(4, c = B.level), "code_header" in B && l(5, d = B.code_header), "code_type" in B && l(14, h = B.code_type), "code_footer" in B && l(6, p = B.code_footer), "parentKey" in B && l(7, b = B.parentKey), "topLevelKey" in B && l(8, g = B.topLevelKey), "openTimeMachine" in B && l(9, v = B.openTimeMachine);
  }, [
    r,
    s,
    o,
    u,
    c,
    d,
    p,
    b,
    g,
    v,
    y,
    k,
    w,
    i,
    h,
    $,
    q,
    j,
    O,
    z,
    N,
    M,
    H
  ];
}
class Sg extends Ve {
  constructor(e) {
    super(), Qe(this, e, L4, F4, Le, {
      key: 0,
      value: 1,
      addToBasket: 2,
      basket: 3,
      level: 4,
      code_header: 5,
      code_type: 14,
      code_footer: 6,
      parentKey: 7,
      topLevelKey: 8,
      openTimeMachine: 9
    });
  }
}
function Hc(t, e, l) {
  const i = t.slice();
  return i[10] = e[l], i[12] = l, i;
}
function Fc(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-131ulv6");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler*/
        t[8]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s & /*$basket, key*/
      129 && (o.on = /*$basket*/
      r[7].includes(
        /*key*/
        r[0]
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function Q4(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), f(e, "class", "svelte-131ulv6");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function V4(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), f(e, "class", "svelte-131ulv6");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function Lc(t) {
  let e, l, i = we(
    /*value*/
    t[1]
  ), n = [];
  for (let r = 0; r < i.length; r += 1)
    n[r] = Vc(Hc(t, i, r));
  const a = (r) => D(n[r], 1, 1, () => {
    n[r] = null;
  });
  return {
    c() {
      for (let r = 0; r < n.length; r += 1)
        n[r].c();
      e = Be();
    },
    m(r, s) {
      for (let o = 0; o < n.length; o += 1)
        n[o] && n[o].m(r, s);
      C(r, e, s), l = !0;
    },
    p(r, s) {
      if (s & /*value, addToBasket, key, code_header, code_footer, $basket*/
      231) {
        i = we(
          /*value*/
          r[1]
        );
        let o;
        for (o = 0; o < i.length; o += 1) {
          const u = Hc(r, i, o);
          n[o] ? (n[o].p(u, s), S(n[o], 1)) : (n[o] = Vc(u), n[o].c(), S(n[o], 1), n[o].m(e.parentNode, e));
        }
        for (ge(), o = i.length; o < n.length; o += 1)
          a(o);
        be();
      }
    },
    i(r) {
      if (!l) {
        for (let s = 0; s < i.length; s += 1)
          S(n[s]);
        l = !0;
      }
    },
    o(r) {
      n = n.filter(Boolean);
      for (let s = 0; s < n.length; s += 1)
        D(n[s]);
      l = !1;
    },
    d(r) {
      r && T(e), Ge(n, r);
    }
  };
}
function Qc(t) {
  let e, l, i, n, a, r;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(`${/*key*/
        t[0]}_${/*ai*/
        t[12]} = ${/*code_header*/
        t[5]}${/*ai*/
        t[12]}${/*code_footer*/
        t[6]}`)
      )
    }
  });
  function s() {
    return (
      /*click_handler_1*/
      t[9](
        /*ai*/
        t[12]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), i = A(), f(e, "class", "basket x2 svelte-131ulv6");
    },
    m(o, u) {
      C(o, e, u), ce(l, e, null), C(o, i, u), n = !0, a || (r = le(e, "click", s), a = !0);
    },
    p(o, u) {
      t = o;
      const c = {};
      u & /*$basket, key, code_header, code_footer*/
      225 && (c.on = /*$basket*/
      t[7].includes(`${/*key*/
      t[0]}_${/*ai*/
      t[12]} = ${/*code_header*/
      t[5]}${/*ai*/
      t[12]}${/*code_footer*/
      t[6]}`)), l.$set(c);
    },
    i(o) {
      n || (S(l.$$.fragment, o), n = !0);
    },
    o(o) {
      D(l.$$.fragment, o), n = !1;
    },
    d(o) {
      o && (T(e), T(i)), de(l), a = !1, r();
    }
  };
}
function Vc(t) {
  let e, l, i = (
    /*a_set*/
    t[10].name + ""
  ), n, a, r, s, o = (
    /*a_set*/
    t[10].qubits.join(", ") + ""
  ), u, c, d, h = (
    /*addToBasket*/
    t[2] && Qc(t)
  );
  return {
    c() {
      e = m("div"), l = m("strong"), n = E(i), a = A(), h && h.c(), r = m("br"), s = A(), u = E(o), c = A(), f(e, "class", "value-row svelte-131ulv6");
    },
    m(p, b) {
      C(p, e, b), _(e, l), _(l, n), _(e, a), h && h.m(e, null), _(e, r), _(e, s), _(e, u), _(e, c), d = !0;
    },
    p(p, b) {
      (!d || b & /*value*/
      2) && i !== (i = /*a_set*/
      p[10].name + "") && Y(n, i), /*addToBasket*/
      p[2] ? h ? (h.p(p, b), b & /*addToBasket*/
      4 && S(h, 1)) : (h = Qc(p), h.c(), S(h, 1), h.m(e, r)) : h && (ge(), D(h, 1, 1, () => {
        h = null;
      }), be()), (!d || b & /*value*/
      2) && o !== (o = /*a_set*/
      p[10].qubits.join(", ") + "") && Y(u, o);
    },
    i(p) {
      d || (S(h), d = !0);
    },
    o(p) {
      D(h), d = !1;
    },
    d(p) {
      p && T(e), h && h.d();
    }
  };
}
function Xc(t) {
  let e, l = mt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), f(e, "class", "desc svelte-131ulv6");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = mt[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function X4(t) {
  let e, l, i, n, a, r, s = (
    /*addToBasket*/
    t[2] && Fc(t)
  );
  function o(p, b) {
    if (
      /*level*/
      p[4] == 1
    )
      return V4;
    if (
      /*level*/
      p[4] == 2
    )
      return Q4;
  }
  let u = o(t), c = u && u(t), d = (
    /*value*/
    t[1] !== void 0 && Lc(t)
  ), h = mt[
    /*key*/
    t[0]
  ] && Xc(t);
  return {
    c() {
      e = m("article"), s && s.c(), l = A(), c && c.c(), i = A(), n = m("div"), d && d.c(), a = A(), h && h.c(), f(n, "class", "value svelte-131ulv6"), f(e, "class", "svelte-131ulv6");
    },
    m(p, b) {
      C(p, e, b), s && s.m(e, null), _(e, l), c && c.m(e, null), _(e, i), _(e, n), d && d.m(n, null), _(e, a), h && h.m(e, null), r = !0;
    },
    p(p, [b]) {
      /*addToBasket*/
      p[2] ? s ? (s.p(p, b), b & /*addToBasket*/
      4 && S(s, 1)) : (s = Fc(p), s.c(), S(s, 1), s.m(e, l)) : s && (ge(), D(s, 1, 1, () => {
        s = null;
      }), be()), u === (u = o(p)) && c ? c.p(p, b) : (c && c.d(1), c = u && u(p), c && (c.c(), c.m(e, i))), /*value*/
      p[1] !== void 0 ? d ? (d.p(p, b), b & /*value*/
      2 && S(d, 1)) : (d = Lc(p), d.c(), S(d, 1), d.m(n, null)) : d && (ge(), D(d, 1, 1, () => {
        d = null;
      }), be()), mt[
        /*key*/
        p[0]
      ] ? h ? h.p(p, b) : (h = Xc(p), h.c(), h.m(e, null)) : h && (h.d(1), h = null);
    },
    i(p) {
      r || (S(s), S(d), r = !0);
    },
    o(p) {
      D(s), D(d), r = !1;
    },
    d(p) {
      p && T(e), s && s.d(), c && c.d(), d && d.d(), h && h.d();
    }
  };
}
function G4(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, (g) => l(7, i = g)), u);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: u, level: c = 1, code_header: d = "", code_footer: h = "" } = e;
  a();
  const p = () => {
    o(r);
  }, b = (g) => {
    o(`${r}_${g} = ${d}${g}${h}`);
  };
  return t.$$set = (g) => {
    "key" in g && l(0, r = g.key), "value" in g && l(1, s = g.value), "addToBasket" in g && l(2, o = g.addToBasket), "basket" in g && a(l(3, u = g.basket)), "level" in g && l(4, c = g.level), "code_header" in g && l(5, d = g.code_header), "code_footer" in g && l(6, h = g.code_footer);
  }, [
    r,
    s,
    o,
    u,
    c,
    d,
    h,
    i,
    p,
    b
  ];
}
class Y4 extends Ve {
  constructor(e) {
    super(), Qe(this, e, G4, X4, Le, {
      key: 0,
      value: 1,
      addToBasket: 2,
      basket: 3,
      level: 4,
      code_header: 5,
      code_footer: 6
    });
  }
}
function Gc(t, e, l) {
  const i = t.slice();
  return i[70] = e[l], i[72] = l, i;
}
function Yc(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler*/
        t[18]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s[0] & /*$basket, key*/
      1025 && (o.on = /*$basket*/
      r[10].includes(
        /*key*/
        r[0]
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function K4(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a[0] & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function U4(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a[0] & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function W4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_2*/
        t[20]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function J4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_1*/
        t[19]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function Z4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_4*/
        t[22]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function x4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_3*/
        t[21]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function e5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_6*/
        t[24]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function t5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_5*/
        t[23]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function l5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_8*/
        t[26]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function i5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_7*/
        t[25]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function n5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_10*/
        t[28]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function a5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_9*/
        t[27]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function r5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_12*/
        t[30]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function s5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_11*/
        t[29]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function o5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_14*/
        t[32]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function u5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_13*/
        t[31]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function f5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_16*/
        t[34]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function _5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_15*/
        t[33]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function c5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_18*/
        t[36]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function d5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_17*/
        t[35]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function h5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_20*/
        t[38]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function p5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_19*/
        t[37]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function m5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_22*/
        t[40]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function g5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_21*/
        t[39]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function b5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_24*/
        t[42]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function v5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_23*/
        t[41]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function k5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_26*/
        t[44]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function y5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_25*/
        t[43]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function w5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_28*/
        t[46]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function $5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_27*/
        t[45]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function q5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_30*/
        t[48]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function j5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_29*/
        t[47]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function T5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_32*/
        t[50]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function C5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_31*/
        t[49]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function S5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_34*/
        t[52]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function M5(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_33*/
        t[51]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function Kc(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(`qubit_${/*key*/
        t[0]}_${/*qi*/
        t[72]}_T1 = ${/*code_header*/
        t[4]}${/*qi*/
        t[72]}, name="T1"${/*code_footer*/
        t[5]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_35*/
      t[53](
        /*qi*/
        t[72]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (u.on = /*$basket*/
      t[10].includes(`qubit_${/*key*/
      t[0]}_${/*qi*/
      t[72]}_T1 = ${/*code_header*/
      t[4]}${/*qi*/
      t[72]}, name="T1"${/*code_footer*/
      t[5]}`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function Uc(t) {
  let e, l, i, n, a;
  l = new Tl({});
  function r() {
    return (
      /*click_handler_36*/
      t[54](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function Wc(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(`qubit_${/*key*/
        t[0]}_${/*qi*/
        t[72]}_T2 = ${/*code_header*/
        t[4]}${/*qi*/
        t[72]}, name="T2"${/*code_footer*/
        t[5]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_37*/
      t[55](
        /*qi*/
        t[72]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (u.on = /*$basket*/
      t[10].includes(`qubit_${/*key*/
      t[0]}_${/*qi*/
      t[72]}_T2 = ${/*code_header*/
      t[4]}${/*qi*/
      t[72]}, name="T2"${/*code_footer*/
      t[5]}`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function Jc(t) {
  let e, l, i, n, a;
  l = new Tl({});
  function r() {
    return (
      /*click_handler_38*/
      t[56](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function Zc(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(`qubit_${/*key*/
        t[0]}_${/*qi*/
        t[72]}_anharmonicity = ${/*code_header*/
        t[4]}${/*qi*/
        t[72]}, name="anharmonicity"${/*code_footer*/
        t[5]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_39*/
      t[57](
        /*qi*/
        t[72]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (u.on = /*$basket*/
      t[10].includes(`qubit_${/*key*/
      t[0]}_${/*qi*/
      t[72]}_anharmonicity = ${/*code_header*/
      t[4]}${/*qi*/
      t[72]}, name="anharmonicity"${/*code_footer*/
      t[5]}`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function xc(t) {
  let e, l, i, n, a;
  l = new Tl({});
  function r() {
    return (
      /*click_handler_40*/
      t[58](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function ed(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(`qubit_${/*key*/
        t[0]}_${/*qi*/
        t[72]}_frequency = ${/*code_header*/
        t[4]}${/*qi*/
        t[72]}, name="frequency"${/*code_footer*/
        t[5]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_41*/
      t[59](
        /*qi*/
        t[72]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (u.on = /*$basket*/
      t[10].includes(`qubit_${/*key*/
      t[0]}_${/*qi*/
      t[72]}_frequency = ${/*code_header*/
      t[4]}${/*qi*/
      t[72]}, name="frequency"${/*code_footer*/
      t[5]}`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function td(t) {
  let e, l, i, n, a;
  l = new Tl({});
  function r() {
    return (
      /*click_handler_42*/
      t[60](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function z5(t) {
  let e, l, i, n;
  return {
    c() {
      e = E("-"), l = m("br"), i = A(), n = m("span"), n.textContent = "(-)", f(n, "class", "asof svelte-1njjtck");
    },
    m(a, r) {
      C(a, e, r), C(a, l, r), C(a, i, r), C(a, n, r);
    },
    p: ae,
    i: ae,
    o: ae,
    d(a) {
      a && (T(e), T(l), T(i), T(n));
    }
  };
}
function N5(t) {
  var v, y;
  let e = (
    /*qubit*/
    ((v = t[70].prob_meas0_prep1) == null ? void 0 : v.value) + ""
  ), l, i, n, a, r, s = (
    /*qubit*/
    ((y = t[70].prob_meas0_prep1) == null ? void 0 : y.asof) + ""
  ), o, u, c, d, h, p, b = (
    /*addToBasket*/
    t[1] && ld(t)
  ), g = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && id(t)
  );
  return {
    c() {
      l = E(e), i = m("br"), n = A(), a = m("span"), r = E("("), o = E(s), u = E(")"), c = A(), b && b.c(), d = A(), g && g.c(), h = Be(), f(a, "class", "asof svelte-1njjtck");
    },
    m(k, w) {
      C(k, l, w), C(k, i, w), C(k, n, w), C(k, a, w), _(a, r), _(a, o), _(a, u), C(k, c, w), b && b.m(k, w), C(k, d, w), g && g.m(k, w), C(k, h, w), p = !0;
    },
    p(k, w) {
      var $, q;
      (!p || w[0] & /*$value_react*/
      2048) && e !== (e = /*qubit*/
      (($ = k[70].prob_meas0_prep1) == null ? void 0 : $.value) + "") && Y(l, e), (!p || w[0] & /*$value_react*/
      2048) && s !== (s = /*qubit*/
      ((q = k[70].prob_meas0_prep1) == null ? void 0 : q.asof) + "") && Y(o, s), /*addToBasket*/
      k[1] ? b ? (b.p(k, w), w[0] & /*addToBasket*/
      2 && S(b, 1)) : (b = ld(k), b.c(), S(b, 1), b.m(d.parentNode, d)) : b && (ge(), D(b, 1, 1, () => {
        b = null;
      }), be()), /*topLevelKey*/
      k[7] === "properties" && /*openTimeMachine*/
      k[8] ? g ? (g.p(k, w), w[0] & /*topLevelKey, openTimeMachine*/
      384 && S(g, 1)) : (g = id(k), g.c(), S(g, 1), g.m(h.parentNode, h)) : g && (ge(), D(g, 1, 1, () => {
        g = null;
      }), be());
    },
    i(k) {
      p || (S(b), S(g), p = !0);
    },
    o(k) {
      D(b), D(g), p = !1;
    },
    d(k) {
      k && (T(l), T(i), T(n), T(a), T(c), T(d), T(h)), b && b.d(k), g && g.d(k);
    }
  };
}
function ld(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(`qubit_${/*key*/
        t[0]}_${/*qi*/
        t[72]}_prob_meas0_prep1 = ${/*code_header*/
        t[4]}${/*qi*/
        t[72]}, name="prob_meas0_prep1"${/*code_footer*/
        t[5]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_43*/
      t[61](
        /*qi*/
        t[72]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (u.on = /*$basket*/
      t[10].includes(`qubit_${/*key*/
      t[0]}_${/*qi*/
      t[72]}_prob_meas0_prep1 = ${/*code_header*/
      t[4]}${/*qi*/
      t[72]}, name="prob_meas0_prep1"${/*code_footer*/
      t[5]}`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function id(t) {
  let e, l, i, n, a;
  l = new Tl({});
  function r() {
    return (
      /*click_handler_44*/
      t[62](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function A5(t) {
  let e, l, i, n;
  return {
    c() {
      e = E("-"), l = m("br"), i = A(), n = m("span"), n.textContent = "(-)", f(n, "class", "asof svelte-1njjtck");
    },
    m(a, r) {
      C(a, e, r), C(a, l, r), C(a, i, r), C(a, n, r);
    },
    p: ae,
    i: ae,
    o: ae,
    d(a) {
      a && (T(e), T(l), T(i), T(n));
    }
  };
}
function B5(t) {
  var g, v;
  let e = (
    /*qubit*/
    ((g = t[70].prob_meas1_prep0) == null ? void 0 : g.value) + ""
  ), l, i, n, a, r = (
    /*qubit*/
    ((v = t[70].prob_meas1_prep0) == null ? void 0 : v.asof) + ""
  ), s, o, u, c, d, h, p = (
    /*addToBasket*/
    t[1] && nd(t)
  ), b = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && ad(t)
  );
  return {
    c() {
      l = E(e), i = m("br"), n = m("span"), a = E("("), s = E(r), o = E(")"), u = A(), p && p.c(), c = A(), b && b.c(), d = Be(), f(n, "class", "asof svelte-1njjtck");
    },
    m(y, k) {
      C(y, l, k), C(y, i, k), C(y, n, k), _(n, a), _(n, s), _(n, o), C(y, u, k), p && p.m(y, k), C(y, c, k), b && b.m(y, k), C(y, d, k), h = !0;
    },
    p(y, k) {
      var w, $;
      (!h || k[0] & /*$value_react*/
      2048) && e !== (e = /*qubit*/
      ((w = y[70].prob_meas1_prep0) == null ? void 0 : w.value) + "") && Y(l, e), (!h || k[0] & /*$value_react*/
      2048) && r !== (r = /*qubit*/
      (($ = y[70].prob_meas1_prep0) == null ? void 0 : $.asof) + "") && Y(s, r), /*addToBasket*/
      y[1] ? p ? (p.p(y, k), k[0] & /*addToBasket*/
      2 && S(p, 1)) : (p = nd(y), p.c(), S(p, 1), p.m(c.parentNode, c)) : p && (ge(), D(p, 1, 1, () => {
        p = null;
      }), be()), /*topLevelKey*/
      y[7] === "properties" && /*openTimeMachine*/
      y[8] ? b ? (b.p(y, k), k[0] & /*topLevelKey, openTimeMachine*/
      384 && S(b, 1)) : (b = ad(y), b.c(), S(b, 1), b.m(d.parentNode, d)) : b && (ge(), D(b, 1, 1, () => {
        b = null;
      }), be());
    },
    i(y) {
      h || (S(p), S(b), h = !0);
    },
    o(y) {
      D(p), D(b), h = !1;
    },
    d(y) {
      y && (T(l), T(i), T(n), T(u), T(c), T(d)), p && p.d(y), b && b.d(y);
    }
  };
}
function nd(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(`qubit_${/*key*/
        t[0]}_${/*qi*/
        t[72]}_prob_meas1_prep0 = ${/*code_header*/
        t[4]}${/*qi*/
        t[72]}, name="prob_meas1_prep0"${/*code_footer*/
        t[5]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_45*/
      t[63](
        /*qi*/
        t[72]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (u.on = /*$basket*/
      t[10].includes(`qubit_${/*key*/
      t[0]}_${/*qi*/
      t[72]}_prob_meas1_prep0 = ${/*code_header*/
      t[4]}${/*qi*/
      t[72]}, name="prob_meas1_prep0"${/*code_footer*/
      t[5]}`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function ad(t) {
  let e, l, i, n, a;
  l = new Tl({});
  function r() {
    return (
      /*click_handler_46*/
      t[64](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function rd(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(`qubit_${/*key*/
        t[0]}_${/*qi*/
        t[72]}_readout_error = ${/*code_header*/
        t[4]}${/*qi*/
        t[72]}, name="readout_error"${/*code_footer*/
        t[5]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_47*/
      t[65](
        /*qi*/
        t[72]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (u.on = /*$basket*/
      t[10].includes(`qubit_${/*key*/
      t[0]}_${/*qi*/
      t[72]}_readout_error = ${/*code_header*/
      t[4]}${/*qi*/
      t[72]}, name="readout_error"${/*code_footer*/
      t[5]}`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function sd(t) {
  let e, l, i, n, a;
  l = new Tl({});
  function r() {
    return (
      /*click_handler_48*/
      t[66](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function od(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(`qubit_${/*key*/
        t[0]}_${/*qi*/
        t[72]}_readout_length = ${/*code_header*/
        t[4]}${/*qi*/
        t[72]}, name="readout_length"${/*code_footer*/
        t[5]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_49*/
      t[67](
        /*qi*/
        t[72]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (u.on = /*$basket*/
      t[10].includes(`qubit_${/*key*/
      t[0]}_${/*qi*/
      t[72]}_readout_length = ${/*code_header*/
      t[4]}${/*qi*/
      t[72]}, name="readout_length"${/*code_footer*/
      t[5]}`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function ud(t) {
  let e, l, i, n, a;
  l = new Tl({});
  function r() {
    return (
      /*click_handler_50*/
      t[68](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function fd(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(`qubit_${/*key*/
        t[0]}_${/*qi*/
        t[72]} = ${/*code_header*/
        t[4]}${/*qi*/
        t[72]}${/*code_footer*/
        t[5]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_51*/
      t[69](
        /*qi*/
        t[72]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (u.on = /*$basket*/
      t[10].includes(`qubit_${/*key*/
      t[0]}_${/*qi*/
      t[72]} = ${/*code_header*/
      t[4]}${/*qi*/
      t[72]}${/*code_footer*/
      t[5]}`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function _d(t) {
  let e, l, i = (
    /*qubit*/
    t[70].index.value + ""
  ), n, a, r, s = (
    /*qubit*/
    t[70].T1.value + ""
  ), o, u, c, d, h = (
    /*qubit*/
    t[70].T1.asof + ""
  ), p, b, g, v, y, k, w = (
    /*qubit*/
    t[70].T2.value + ""
  ), $, q, j, O, z = (
    /*qubit*/
    t[70].T2.asof + ""
  ), N, M, H, B, R, P, I = (
    /*qubit*/
    t[70].anharmonicity.value + ""
  ), L, F, X, V, Q = (
    /*qubit*/
    t[70].anharmonicity.asof + ""
  ), J, te, ie, U, G, W, Z = (
    /*qubit*/
    t[70].frequency.value + ""
  ), ee, ye, qe, je, fe = (
    /*qubit*/
    t[70].frequency.asof + ""
  ), _e, K, ke, ue, ne, oe, x, ve, se, Re, Ce, pe, De, re, Se = (
    /*qubit*/
    t[70].readout_error.value + ""
  ), Ue, Ke, xe, wt, $t = (
    /*qubit*/
    t[70].readout_error.asof + ""
  ), st, qt, Dt, ot, ht, Me, me = (
    /*qubit*/
    t[70].readout_length.value + ""
  ), Oe, Fe, Ee, We, Ye = (
    /*qubit*/
    t[70].readout_length.asof + ""
  ), He, et, gt, Ct, cl, Jt, Rt, Ht, Et = (
    /*addToBasket*/
    t[1] && Kc(t)
  ), pt = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && Uc(t)
  ), Ot = (
    /*addToBasket*/
    t[1] && Wc(t)
  ), bt = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && Jc(t)
  ), Ne = (
    /*addToBasket*/
    t[1] && Zc(t)
  ), lt = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && xc(t)
  ), _t = (
    /*addToBasket*/
    t[1] && ed(t)
  ), St = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && td(t)
  );
  const xi = [N5, z5], nl = [];
  function al(Ae, Je) {
    var ol;
    return (
      /*qubit*/
      ((ol = Ae[70].prob_meas0_prep1) == null ? void 0 : ol.value) !== void 0 ? 0 : 1
    );
  }
  x = al(t), ve = nl[x] = xi[x](t);
  const en = [B5, A5], rl = [];
  function sl(Ae, Je) {
    var ol;
    return (
      /*qubit*/
      ((ol = Ae[70].prob_meas1_prep0) == null ? void 0 : ol.value) !== void 0 ? 0 : 1
    );
  }
  Ce = sl(t), pe = rl[Ce] = en[Ce](t);
  let It = (
    /*addToBasket*/
    t[1] && rd(t)
  ), ct = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && sd(t)
  ), Lt = (
    /*addToBasket*/
    t[1] && od(t)
  ), jt = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && ud(t)
  ), Te = (
    /*addToBasket*/
    t[1] && fd(t)
  );
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = A(), r = m("td"), o = E(s), u = m("br"), c = m("span"), d = E("("), p = E(h), b = E(")"), g = A(), Et && Et.c(), v = A(), pt && pt.c(), y = A(), k = m("td"), $ = E(w), q = m("br"), j = m("span"), O = E("("), N = E(z), M = E(")"), H = A(), Ot && Ot.c(), B = A(), bt && bt.c(), R = A(), P = m("td"), L = E(I), F = m("br"), X = m("span"), V = E("("), J = E(Q), te = E(")"), ie = A(), Ne && Ne.c(), U = A(), lt && lt.c(), G = A(), W = m("td"), ee = E(Z), ye = m("br"), qe = m("span"), je = E("("), _e = E(fe), K = E(")"), ke = A(), _t && _t.c(), ue = A(), St && St.c(), ne = A(), oe = m("td"), ve.c(), se = A(), Re = m("td"), pe.c(), De = A(), re = m("td"), Ue = E(Se), Ke = m("br"), xe = m("span"), wt = E("("), st = E($t), qt = E(")"), Dt = A(), It && It.c(), ot = A(), ct && ct.c(), ht = A(), Me = m("td"), Oe = E(me), Fe = m("br"), Ee = m("span"), We = E("("), He = E(Ye), et = E(")"), gt = A(), Lt && Lt.c(), Ct = A(), jt && jt.c(), cl = A(), Jt = m("td"), Te && Te.c(), Rt = A(), f(l, "class", "svelte-1njjtck"), f(c, "class", "asof svelte-1njjtck"), f(r, "class", "svelte-1njjtck"), f(j, "class", "asof svelte-1njjtck"), f(k, "class", "svelte-1njjtck"), f(X, "class", "asof svelte-1njjtck"), f(P, "class", "svelte-1njjtck"), f(qe, "class", "asof svelte-1njjtck"), f(W, "class", "svelte-1njjtck"), f(oe, "class", "svelte-1njjtck"), f(Re, "class", "svelte-1njjtck"), f(xe, "class", "asof svelte-1njjtck"), f(re, "class", "svelte-1njjtck"), f(Ee, "class", "asof svelte-1njjtck"), f(Me, "class", "svelte-1njjtck"), f(Jt, "class", "svelte-1njjtck");
    },
    m(Ae, Je) {
      C(Ae, e, Je), _(e, l), _(l, n), _(e, a), _(e, r), _(r, o), _(r, u), _(r, c), _(c, d), _(c, p), _(c, b), _(r, g), Et && Et.m(r, null), _(r, v), pt && pt.m(r, null), _(e, y), _(e, k), _(k, $), _(k, q), _(k, j), _(j, O), _(j, N), _(j, M), _(k, H), Ot && Ot.m(k, null), _(k, B), bt && bt.m(k, null), _(e, R), _(e, P), _(P, L), _(P, F), _(P, X), _(X, V), _(X, J), _(X, te), _(P, ie), Ne && Ne.m(P, null), _(P, U), lt && lt.m(P, null), _(e, G), _(e, W), _(W, ee), _(W, ye), _(W, qe), _(qe, je), _(qe, _e), _(qe, K), _(W, ke), _t && _t.m(W, null), _(W, ue), St && St.m(W, null), _(e, ne), _(e, oe), nl[x].m(oe, null), _(e, se), _(e, Re), rl[Ce].m(Re, null), _(e, De), _(e, re), _(re, Ue), _(re, Ke), _(re, xe), _(xe, wt), _(xe, st), _(xe, qt), _(re, Dt), It && It.m(re, null), _(re, ot), ct && ct.m(re, null), _(e, ht), _(e, Me), _(Me, Oe), _(Me, Fe), _(Me, Ee), _(Ee, We), _(Ee, He), _(Ee, et), _(Me, gt), Lt && Lt.m(Me, null), _(Me, Ct), jt && jt.m(Me, null), _(e, cl), _(e, Jt), Te && Te.m(Jt, null), _(e, Rt), Ht = !0;
    },
    p(Ae, Je) {
      (!Ht || Je[0] & /*$value_react*/
      2048) && i !== (i = /*qubit*/
      Ae[70].index.value + "") && Y(n, i), (!Ht || Je[0] & /*$value_react*/
      2048) && s !== (s = /*qubit*/
      Ae[70].T1.value + "") && Y(o, s), (!Ht || Je[0] & /*$value_react*/
      2048) && h !== (h = /*qubit*/
      Ae[70].T1.asof + "") && Y(p, h), /*addToBasket*/
      Ae[1] ? Et ? (Et.p(Ae, Je), Je[0] & /*addToBasket*/
      2 && S(Et, 1)) : (Et = Kc(Ae), Et.c(), S(Et, 1), Et.m(r, v)) : Et && (ge(), D(Et, 1, 1, () => {
        Et = null;
      }), be()), /*topLevelKey*/
      Ae[7] === "properties" && /*openTimeMachine*/
      Ae[8] ? pt ? (pt.p(Ae, Je), Je[0] & /*topLevelKey, openTimeMachine*/
      384 && S(pt, 1)) : (pt = Uc(Ae), pt.c(), S(pt, 1), pt.m(r, null)) : pt && (ge(), D(pt, 1, 1, () => {
        pt = null;
      }), be()), (!Ht || Je[0] & /*$value_react*/
      2048) && w !== (w = /*qubit*/
      Ae[70].T2.value + "") && Y($, w), (!Ht || Je[0] & /*$value_react*/
      2048) && z !== (z = /*qubit*/
      Ae[70].T2.asof + "") && Y(N, z), /*addToBasket*/
      Ae[1] ? Ot ? (Ot.p(Ae, Je), Je[0] & /*addToBasket*/
      2 && S(Ot, 1)) : (Ot = Wc(Ae), Ot.c(), S(Ot, 1), Ot.m(k, B)) : Ot && (ge(), D(Ot, 1, 1, () => {
        Ot = null;
      }), be()), /*topLevelKey*/
      Ae[7] === "properties" && /*openTimeMachine*/
      Ae[8] ? bt ? (bt.p(Ae, Je), Je[0] & /*topLevelKey, openTimeMachine*/
      384 && S(bt, 1)) : (bt = Jc(Ae), bt.c(), S(bt, 1), bt.m(k, null)) : bt && (ge(), D(bt, 1, 1, () => {
        bt = null;
      }), be()), (!Ht || Je[0] & /*$value_react*/
      2048) && I !== (I = /*qubit*/
      Ae[70].anharmonicity.value + "") && Y(L, I), (!Ht || Je[0] & /*$value_react*/
      2048) && Q !== (Q = /*qubit*/
      Ae[70].anharmonicity.asof + "") && Y(J, Q), /*addToBasket*/
      Ae[1] ? Ne ? (Ne.p(Ae, Je), Je[0] & /*addToBasket*/
      2 && S(Ne, 1)) : (Ne = Zc(Ae), Ne.c(), S(Ne, 1), Ne.m(P, U)) : Ne && (ge(), D(Ne, 1, 1, () => {
        Ne = null;
      }), be()), /*topLevelKey*/
      Ae[7] === "properties" && /*openTimeMachine*/
      Ae[8] ? lt ? (lt.p(Ae, Je), Je[0] & /*topLevelKey, openTimeMachine*/
      384 && S(lt, 1)) : (lt = xc(Ae), lt.c(), S(lt, 1), lt.m(P, null)) : lt && (ge(), D(lt, 1, 1, () => {
        lt = null;
      }), be()), (!Ht || Je[0] & /*$value_react*/
      2048) && Z !== (Z = /*qubit*/
      Ae[70].frequency.value + "") && Y(ee, Z), (!Ht || Je[0] & /*$value_react*/
      2048) && fe !== (fe = /*qubit*/
      Ae[70].frequency.asof + "") && Y(_e, fe), /*addToBasket*/
      Ae[1] ? _t ? (_t.p(Ae, Je), Je[0] & /*addToBasket*/
      2 && S(_t, 1)) : (_t = ed(Ae), _t.c(), S(_t, 1), _t.m(W, ue)) : _t && (ge(), D(_t, 1, 1, () => {
        _t = null;
      }), be()), /*topLevelKey*/
      Ae[7] === "properties" && /*openTimeMachine*/
      Ae[8] ? St ? (St.p(Ae, Je), Je[0] & /*topLevelKey, openTimeMachine*/
      384 && S(St, 1)) : (St = td(Ae), St.c(), S(St, 1), St.m(W, null)) : St && (ge(), D(St, 1, 1, () => {
        St = null;
      }), be());
      let ol = x;
      x = al(Ae), x === ol ? nl[x].p(Ae, Je) : (ge(), D(nl[ol], 1, 1, () => {
        nl[ol] = null;
      }), be(), ve = nl[x], ve ? ve.p(Ae, Je) : (ve = nl[x] = xi[x](Ae), ve.c()), S(ve, 1), ve.m(oe, null));
      let ir = Ce;
      Ce = sl(Ae), Ce === ir ? rl[Ce].p(Ae, Je) : (ge(), D(rl[ir], 1, 1, () => {
        rl[ir] = null;
      }), be(), pe = rl[Ce], pe ? pe.p(Ae, Je) : (pe = rl[Ce] = en[Ce](Ae), pe.c()), S(pe, 1), pe.m(Re, null)), (!Ht || Je[0] & /*$value_react*/
      2048) && Se !== (Se = /*qubit*/
      Ae[70].readout_error.value + "") && Y(Ue, Se), (!Ht || Je[0] & /*$value_react*/
      2048) && $t !== ($t = /*qubit*/
      Ae[70].readout_error.asof + "") && Y(st, $t), /*addToBasket*/
      Ae[1] ? It ? (It.p(Ae, Je), Je[0] & /*addToBasket*/
      2 && S(It, 1)) : (It = rd(Ae), It.c(), S(It, 1), It.m(re, ot)) : It && (ge(), D(It, 1, 1, () => {
        It = null;
      }), be()), /*topLevelKey*/
      Ae[7] === "properties" && /*openTimeMachine*/
      Ae[8] ? ct ? (ct.p(Ae, Je), Je[0] & /*topLevelKey, openTimeMachine*/
      384 && S(ct, 1)) : (ct = sd(Ae), ct.c(), S(ct, 1), ct.m(re, null)) : ct && (ge(), D(ct, 1, 1, () => {
        ct = null;
      }), be()), (!Ht || Je[0] & /*$value_react*/
      2048) && me !== (me = /*qubit*/
      Ae[70].readout_length.value + "") && Y(Oe, me), (!Ht || Je[0] & /*$value_react*/
      2048) && Ye !== (Ye = /*qubit*/
      Ae[70].readout_length.asof + "") && Y(He, Ye), /*addToBasket*/
      Ae[1] ? Lt ? (Lt.p(Ae, Je), Je[0] & /*addToBasket*/
      2 && S(Lt, 1)) : (Lt = od(Ae), Lt.c(), S(Lt, 1), Lt.m(Me, Ct)) : Lt && (ge(), D(Lt, 1, 1, () => {
        Lt = null;
      }), be()), /*topLevelKey*/
      Ae[7] === "properties" && /*openTimeMachine*/
      Ae[8] ? jt ? (jt.p(Ae, Je), Je[0] & /*topLevelKey, openTimeMachine*/
      384 && S(jt, 1)) : (jt = ud(Ae), jt.c(), S(jt, 1), jt.m(Me, null)) : jt && (ge(), D(jt, 1, 1, () => {
        jt = null;
      }), be()), /*addToBasket*/
      Ae[1] ? Te ? (Te.p(Ae, Je), Je[0] & /*addToBasket*/
      2 && S(Te, 1)) : (Te = fd(Ae), Te.c(), S(Te, 1), Te.m(Jt, null)) : Te && (ge(), D(Te, 1, 1, () => {
        Te = null;
      }), be());
    },
    i(Ae) {
      Ht || (S(Et), S(pt), S(Ot), S(bt), S(Ne), S(lt), S(_t), S(St), S(ve), S(pe), S(It), S(ct), S(Lt), S(jt), S(Te), Ht = !0);
    },
    o(Ae) {
      D(Et), D(pt), D(Ot), D(bt), D(Ne), D(lt), D(_t), D(St), D(ve), D(pe), D(It), D(ct), D(Lt), D(jt), D(Te), Ht = !1;
    },
    d(Ae) {
      Ae && T(e), Et && Et.d(), pt && pt.d(), Ot && Ot.d(), bt && bt.d(), Ne && Ne.d(), lt && lt.d(), _t && _t.d(), St && St.d(), nl[x].d(), rl[Ce].d(), It && It.d(), ct && ct.d(), Lt && Lt.d(), jt && jt.d(), Te && Te.d();
    }
  };
}
function cd(t) {
  let e, l = mt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), f(e, "class", "desc svelte-1njjtck");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a[0] & /*key*/
      1 && l !== (l = mt[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function P5(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R, P, I, L, F, X, V, Q, J, te, ie, U, G, W, Z, ee, ye, qe, je, fe = (
    /*addToBasket*/
    t[1] && Yc(t)
  );
  function _e(Te, Ae) {
    if (
      /*level*/
      Te[3] == 1
    )
      return U4;
    if (
      /*level*/
      Te[3] == 2
    )
      return K4;
  }
  let K = _e(t), ke = K && K(t);
  function ue(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].index !== "a" ? J4 : W4
    );
  }
  let ne = ue(t), oe = ne(t);
  function x(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].T1 !== "a" ? x4 : Z4
    );
  }
  let ve = x(t), se = ve(t);
  function Re(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].T1d !== "a" ? t5 : e5
    );
  }
  let Ce = Re(t), pe = Ce(t);
  function De(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].T2 !== "a" ? i5 : l5
    );
  }
  let re = De(t), Se = re(t);
  function Ue(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].T2d !== "a" ? a5 : n5
    );
  }
  let Ke = Ue(t), xe = Ke(t);
  function wt(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].anharmonicity !== "a" ? s5 : r5
    );
  }
  let $t = wt(t), st = $t(t);
  function qt(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].anharmonicityd !== "a" ? u5 : o5
    );
  }
  let Dt = qt(t), ot = Dt(t);
  function ht(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].frequency !== "a" ? _5 : f5
    );
  }
  let Me = ht(t), me = Me(t);
  function Oe(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].frequencyd !== "a" ? d5 : c5
    );
  }
  let Fe = Oe(t), Ee = Fe(t);
  function We(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].prob_meas0_prep1 !== "a" ? p5 : h5
    );
  }
  let Ye = We(t), He = Ye(t);
  function et(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].prob_meas0_prep1d !== "a" ? g5 : m5
    );
  }
  let gt = et(t), Ct = gt(t);
  function cl(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].prob_meas1_prep0 !== "a" ? v5 : b5
    );
  }
  let Jt = cl(t), Rt = Jt(t);
  function Ht(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].prob_meas1_prep0d !== "a" ? y5 : k5
    );
  }
  let Et = Ht(t), pt = Et(t);
  function Ot(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].readout_error !== "a" ? $5 : w5
    );
  }
  let bt = Ot(t), Ne = bt(t);
  function lt(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].readout_errord !== "a" ? j5 : q5
    );
  }
  let _t = lt(t), St = _t(t);
  function xi(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].readout_length !== "a" ? C5 : T5
    );
  }
  let nl = xi(t), al = nl(t);
  function en(Te, Ae) {
    return (
      /*sort_reg*/
      Te[9].readout_lengthd !== "a" ? M5 : S5
    );
  }
  let rl = en(t), sl = rl(t), It = we(
    /*$value_react*/
    t[11]
  ), ct = [];
  for (let Te = 0; Te < It.length; Te += 1)
    ct[Te] = _d(Gc(t, It, Te));
  const Lt = (Te) => D(ct[Te], 1, 1, () => {
    ct[Te] = null;
  });
  let jt = mt[
    /*key*/
    t[0]
  ] && cd(t);
  return {
    c() {
      e = m("article"), fe && fe.c(), l = A(), ke && ke.c(), i = A(), n = m("div"), a = m("table"), r = m("thead"), s = m("tr"), o = m("th"), u = E("I "), oe.c(), c = A(), d = m("th"), h = E("T1 "), se.c(), p = Be(), pe.c(), b = A(), g = m("th"), v = E("T2 "), Se.c(), y = Be(), xe.c(), k = A(), w = m("th"), $ = E("Anharmonic. "), st.c(), q = Be(), ot.c(), j = A(), O = m("th"), z = E("Frequency "), me.c(), N = Be(), Ee.c(), M = A(), H = m("th"), B = E("Meas0Prob1 "), He.c(), R = Be(), Ct.c(), P = A(), I = m("th"), L = E("Meas1Prob0 "), Rt.c(), F = Be(), pt.c(), X = A(), V = m("th"), Q = E("Readout Error "), Ne.c(), J = Be(), St.c(), te = A(), ie = m("th"), U = E("Readout Length "), al.c(), G = Be(), sl.c(), W = A(), Z = m("th"), Z.textContent = "-", ee = A(), ye = m("tbody");
      for (let Te = 0; Te < ct.length; Te += 1)
        ct[Te].c();
      qe = A(), jt && jt.c(), f(o, "class", "svelte-1njjtck"), f(d, "class", "svelte-1njjtck"), f(g, "class", "svelte-1njjtck"), f(w, "class", "svelte-1njjtck"), f(O, "class", "svelte-1njjtck"), f(H, "class", "svelte-1njjtck"), f(I, "class", "svelte-1njjtck"), f(V, "class", "svelte-1njjtck"), f(ie, "class", "svelte-1njjtck"), f(Z, "class", "svelte-1njjtck"), f(r, "class", "svelte-1njjtck"), f(ye, "class", "svelte-1njjtck"), f(a, "class", "svelte-1njjtck"), f(n, "class", "value svelte-1njjtck"), f(e, "class", "svelte-1njjtck");
    },
    m(Te, Ae) {
      C(Te, e, Ae), fe && fe.m(e, null), _(e, l), ke && ke.m(e, null), _(e, i), _(e, n), _(n, a), _(a, r), _(r, s), _(s, o), _(o, u), oe.m(o, null), _(s, c), _(s, d), _(d, h), se.m(d, null), _(d, p), pe.m(d, null), _(s, b), _(s, g), _(g, v), Se.m(g, null), _(g, y), xe.m(g, null), _(s, k), _(s, w), _(w, $), st.m(w, null), _(w, q), ot.m(w, null), _(s, j), _(s, O), _(O, z), me.m(O, null), _(O, N), Ee.m(O, null), _(s, M), _(s, H), _(H, B), He.m(H, null), _(H, R), Ct.m(H, null), _(s, P), _(s, I), _(I, L), Rt.m(I, null), _(I, F), pt.m(I, null), _(s, X), _(s, V), _(V, Q), Ne.m(V, null), _(V, J), St.m(V, null), _(s, te), _(s, ie), _(ie, U), al.m(ie, null), _(ie, G), sl.m(ie, null), _(s, W), _(s, Z), _(a, ee), _(a, ye);
      for (let Je = 0; Je < ct.length; Je += 1)
        ct[Je] && ct[Je].m(ye, null);
      _(e, qe), jt && jt.m(e, null), je = !0;
    },
    p(Te, Ae) {
      if (/*addToBasket*/
      Te[1] ? fe ? (fe.p(Te, Ae), Ae[0] & /*addToBasket*/
      2 && S(fe, 1)) : (fe = Yc(Te), fe.c(), S(fe, 1), fe.m(e, l)) : fe && (ge(), D(fe, 1, 1, () => {
        fe = null;
      }), be()), K === (K = _e(Te)) && ke ? ke.p(Te, Ae) : (ke && ke.d(1), ke = K && K(Te), ke && (ke.c(), ke.m(e, i))), ne === (ne = ue(Te)) && oe ? oe.p(Te, Ae) : (oe.d(1), oe = ne(Te), oe && (oe.c(), oe.m(o, null))), ve === (ve = x(Te)) && se ? se.p(Te, Ae) : (se.d(1), se = ve(Te), se && (se.c(), se.m(d, p))), Ce === (Ce = Re(Te)) && pe ? pe.p(Te, Ae) : (pe.d(1), pe = Ce(Te), pe && (pe.c(), pe.m(d, null))), re === (re = De(Te)) && Se ? Se.p(Te, Ae) : (Se.d(1), Se = re(Te), Se && (Se.c(), Se.m(g, y))), Ke === (Ke = Ue(Te)) && xe ? xe.p(Te, Ae) : (xe.d(1), xe = Ke(Te), xe && (xe.c(), xe.m(g, null))), $t === ($t = wt(Te)) && st ? st.p(Te, Ae) : (st.d(1), st = $t(Te), st && (st.c(), st.m(w, q))), Dt === (Dt = qt(Te)) && ot ? ot.p(Te, Ae) : (ot.d(1), ot = Dt(Te), ot && (ot.c(), ot.m(w, null))), Me === (Me = ht(Te)) && me ? me.p(Te, Ae) : (me.d(1), me = Me(Te), me && (me.c(), me.m(O, N))), Fe === (Fe = Oe(Te)) && Ee ? Ee.p(Te, Ae) : (Ee.d(1), Ee = Fe(Te), Ee && (Ee.c(), Ee.m(O, null))), Ye === (Ye = We(Te)) && He ? He.p(Te, Ae) : (He.d(1), He = Ye(Te), He && (He.c(), He.m(H, R))), gt === (gt = et(Te)) && Ct ? Ct.p(Te, Ae) : (Ct.d(1), Ct = gt(Te), Ct && (Ct.c(), Ct.m(H, null))), Jt === (Jt = cl(Te)) && Rt ? Rt.p(Te, Ae) : (Rt.d(1), Rt = Jt(Te), Rt && (Rt.c(), Rt.m(I, F))), Et === (Et = Ht(Te)) && pt ? pt.p(Te, Ae) : (pt.d(1), pt = Et(Te), pt && (pt.c(), pt.m(I, null))), bt === (bt = Ot(Te)) && Ne ? Ne.p(Te, Ae) : (Ne.d(1), Ne = bt(Te), Ne && (Ne.c(), Ne.m(V, J))), _t === (_t = lt(Te)) && St ? St.p(Te, Ae) : (St.d(1), St = _t(Te), St && (St.c(), St.m(V, null))), nl === (nl = xi(Te)) && al ? al.p(Te, Ae) : (al.d(1), al = nl(Te), al && (al.c(), al.m(ie, G))), rl === (rl = en(Te)) && sl ? sl.p(Te, Ae) : (sl.d(1), sl = rl(Te), sl && (sl.c(), sl.m(ie, null))), Ae[0] & /*addToBasket, key, code_header, code_footer, $basket, openTimeMachine, parentKey, topLevelKey, $value_react*/
      3571) {
        It = we(
          /*$value_react*/
          Te[11]
        );
        let Je;
        for (Je = 0; Je < It.length; Je += 1) {
          const ol = Gc(Te, It, Je);
          ct[Je] ? (ct[Je].p(ol, Ae), S(ct[Je], 1)) : (ct[Je] = _d(ol), ct[Je].c(), S(ct[Je], 1), ct[Je].m(ye, null));
        }
        for (ge(), Je = It.length; Je < ct.length; Je += 1)
          Lt(Je);
        be();
      }
      mt[
        /*key*/
        Te[0]
      ] ? jt ? jt.p(Te, Ae) : (jt = cd(Te), jt.c(), jt.m(e, null)) : jt && (jt.d(1), jt = null);
    },
    i(Te) {
      if (!je) {
        S(fe);
        for (let Ae = 0; Ae < It.length; Ae += 1)
          S(ct[Ae]);
        je = !0;
      }
    },
    o(Te) {
      D(fe), ct = ct.filter(Boolean);
      for (let Ae = 0; Ae < ct.length; Ae += 1)
        D(ct[Ae]);
      je = !1;
    },
    d(Te) {
      Te && T(e), fe && fe.d(), ke && ke.d(), oe.d(), se.d(), pe.d(), Se.d(), xe.d(), st.d(), ot.d(), me.d(), Ee.d(), He.d(), Ct.d(), Rt.d(), pt.d(), Ne.d(), St.d(), al.d(), sl.d(), Ge(ct, Te), jt && jt.d();
    }
  };
}
function E5(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(c, (me) => l(10, i = me)), c), r;
  t.$$.on_destroy.push(() => n());
  let { key: s = "", value: o, addToBasket: u, basket: c, level: d = 1, code_header: h = "", code_type: p = "", code_footer: b = "", parentKey: g = "", topLevelKey: v = "", openTimeMachine: y, property_time: k = Pe() } = e;
  a();
  let w = {}, $ = Pe([]);
  at(t, $, (me) => l(11, r = me));
  function q(me, Oe) {
    Oe == "a" ? ($.update((Fe) => (Fe.sort((Ee, We) => {
      var Ye, He;
      return ((Ye = Ee[me]) == null ? void 0 : Ye.value) - ((He = We[me]) == null ? void 0 : He.value);
    }), Fe)), l(9, w[me] = "a", w)) : ($.update((Fe) => (Fe.sort((Ee, We) => {
      var Ye, He;
      return ((Ye = We[me]) == null ? void 0 : Ye.value) - ((He = Ee[me]) == null ? void 0 : He.value);
    }), Fe)), l(9, w[me] = "d", w));
  }
  function j(me, Oe) {
    Oe == "a" ? ($.update((Fe) => (Fe.sort((Ee, We) => {
      var Ye, He;
      return new Date((Ye = Ee[me]) == null ? void 0 : Ye.asof) - new Date((He = We[me]) == null ? void 0 : He.asof);
    }), Fe)), l(9, w[me + "d"] = "a", w)) : ($.update((Fe) => (Fe.sort((Ee, We) => {
      var Ye, He;
      return new Date((Ye = We[me]) == null ? void 0 : Ye.asof) - new Date((He = Ee[me]) == null ? void 0 : He.asof);
    }), Fe)), l(9, w[me + "d"] = "d", w));
  }
  yt(() => {
    k.subscribe((me) => {
      $.set(o.map((Oe, Fe) => (Oe.index = { value: Fe }, Oe)));
    });
  });
  const O = () => {
    u(s);
  }, z = () => {
    q("index", "a");
  }, N = () => {
    q("index", "d");
  }, M = () => {
    q("T1", "a");
  }, H = () => {
    q("T1", "d");
  }, B = () => {
    j("T1", "a");
  }, R = () => {
    j("T1", "d");
  }, P = () => {
    q("T2", "a");
  }, I = () => {
    q("T2", "d");
  }, L = () => {
    j("T2", "a");
  }, F = () => {
    j("T2", "d");
  }, X = () => {
    q("anharmonicity", "a");
  }, V = () => {
    q("anharmonicity", "d");
  }, Q = () => {
    j("anharmonicity", "a");
  }, J = () => {
    j("anharmonicity", "d");
  }, te = () => {
    q("frequency", "a");
  }, ie = () => {
    q("frequency", "d");
  }, U = () => {
    j("frequency", "a");
  }, G = () => {
    j("frequency", "d");
  }, W = () => {
    q("prob_meas0_prep1", "a");
  }, Z = () => {
    q("prob_meas0_prep1", "d");
  }, ee = () => {
    j("prob_meas0_prep1", "a");
  }, ye = () => {
    j("prob_meas0_prep1", "d");
  }, qe = () => {
    q("prob_meas1_prep0", "a");
  }, je = () => {
    q("prob_meas1_prep0", "d");
  }, fe = () => {
    j("prob_meas1_prep0", "a");
  }, _e = () => {
    j("prob_meas1_prep0", "d");
  }, K = () => {
    q("readout_error", "a");
  }, ke = () => {
    q("readout_error", "d");
  }, ue = () => {
    j("readout_error", "a");
  }, ne = () => {
    j("readout_error", "d");
  }, oe = () => {
    q("readout_length", "a");
  }, x = () => {
    q("readout_length", "d");
  }, ve = () => {
    j("readout_length", "a");
  }, se = () => {
    j("readout_length", "d");
  }, Re = (me) => {
    u(`qubit_${s}_${me}_T1 = ${h}${me}, name="T1"${b}`);
  }, Ce = (me, Oe) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${me}_T1`,
      title_key: `qubit[${me}].T1`,
      qubit_index: me,
      property: "T1",
      parentKey: g,
      topLevelKey: v,
      data: Oe.T1,
      code_header: `${h}${me}, name="T1"`,
      code_footer: b,
      code_key: ""
    });
  }, pe = (me) => {
    u(`qubit_${s}_${me}_T2 = ${h}${me}, name="T2"${b}`);
  }, De = (me, Oe) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${me}_T2`,
      title_key: `qubit[${me}].T2`,
      qubit_index: me,
      property: "T2",
      parentKey: g,
      topLevelKey: v,
      data: Oe.T2,
      code_header: `${h}${me}, name="T2"`,
      code_footer: b,
      code_key: ""
    });
  }, re = (me) => {
    u(`qubit_${s}_${me}_anharmonicity = ${h}${me}, name="anharmonicity"${b}`);
  }, Se = (me, Oe) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${me}_anharmonicity`,
      title_key: `qubit[${me}].anharmonicity`,
      qubit_index: me,
      property: "anharmonicity",
      parentKey: g,
      topLevelKey: v,
      data: Oe.anharmonicity,
      code_header: `${h}${me}, name="anharmonicity"`,
      code_footer: b,
      code_key: ""
    });
  }, Ue = (me) => {
    u(`qubit_${s}_${me}_frequency = ${h}${me}, name="frequency"${b}`);
  }, Ke = (me, Oe) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${me}_frequency`,
      title_key: `qubit[${me}].frequency`,
      qubit_index: me,
      property: "frequency",
      parentKey: g,
      topLevelKey: v,
      data: Oe.frequency,
      code_header: `${h}${me}, name="frequency"`,
      code_footer: b,
      code_key: ""
    });
  }, xe = (me) => {
    u(`qubit_${s}_${me}_prob_meas0_prep1 = ${h}${me}, name="prob_meas0_prep1"${b}`);
  }, wt = (me, Oe) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${me}_prob_meas0_prep1`,
      title_key: `qubit[${me}].prob_meas0_prep1`,
      qubit_index: me,
      property: "prob_meas0_prep1",
      parentKey: g,
      topLevelKey: v,
      data: Oe.prob_meas0_prep1,
      code_header: `${h}${me}, name="prob_meas0_prep1"`,
      code_footer: b,
      code_key: ""
    });
  }, $t = (me) => {
    u(`qubit_${s}_${me}_prob_meas1_prep0 = ${h}${me}, name="prob_meas1_prep0"${b}`);
  }, st = (me, Oe) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${me}_prob_meas1_prep0`,
      title_key: `qubit[${me}].prob_meas1_prep0`,
      qubit_index: me,
      property: "prob_meas1_prep0",
      parentKey: g,
      topLevelKey: v,
      data: Oe.prob_meas1_prep0,
      code_header: `${h}${me}, name="prob_meas1_prep0"`,
      code_footer: b,
      code_key: ""
    });
  }, qt = (me) => {
    u(`qubit_${s}_${me}_readout_error = ${h}${me}, name="readout_error"${b}`);
  }, Dt = (me, Oe) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${me}_readout_error`,
      title_key: `qubit[${me}].readout_error`,
      qubit_index: me,
      property: "readout_error",
      parentKey: g,
      topLevelKey: v,
      data: Oe.readout_error,
      code_header: `${h}${me}, name="readout_error"`,
      code_footer: b,
      code_key: ""
    });
  }, ot = (me) => {
    u(`qubit_${s}_${me}_readout_length = ${h}${me}, name="readout_length"${b}`);
  }, ht = (me, Oe) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${me}_readout_length`,
      title_key: `qubit[${me}].readout_length`,
      qubit_index: me,
      property: "readout_length",
      parentKey: g,
      topLevelKey: v,
      data: Oe.readout_length,
      code_header: `${h}${me}, name="readout_length"`,
      code_footer: b,
      code_key: ""
    });
  }, Me = (me) => {
    u(`qubit_${s}_${me} = ${h}${me}${b}`);
  };
  return t.$$set = (me) => {
    "key" in me && l(0, s = me.key), "value" in me && l(15, o = me.value), "addToBasket" in me && l(1, u = me.addToBasket), "basket" in me && a(l(2, c = me.basket)), "level" in me && l(3, d = me.level), "code_header" in me && l(4, h = me.code_header), "code_type" in me && l(16, p = me.code_type), "code_footer" in me && l(5, b = me.code_footer), "parentKey" in me && l(6, g = me.parentKey), "topLevelKey" in me && l(7, v = me.topLevelKey), "openTimeMachine" in me && l(8, y = me.openTimeMachine), "property_time" in me && l(17, k = me.property_time);
  }, [
    s,
    u,
    c,
    d,
    h,
    b,
    g,
    v,
    y,
    w,
    i,
    r,
    $,
    q,
    j,
    o,
    p,
    k,
    O,
    z,
    N,
    M,
    H,
    B,
    R,
    P,
    I,
    L,
    F,
    X,
    V,
    Q,
    J,
    te,
    ie,
    U,
    G,
    W,
    Z,
    ee,
    ye,
    qe,
    je,
    fe,
    _e,
    K,
    ke,
    ue,
    ne,
    oe,
    x,
    ve,
    se,
    Re,
    Ce,
    pe,
    De,
    re,
    Se,
    Ue,
    Ke,
    xe,
    wt,
    $t,
    st,
    qt,
    Dt,
    ot,
    ht,
    Me
  ];
}
class O5 extends Ve {
  constructor(e) {
    super(), Qe(
      this,
      e,
      E5,
      P5,
      Le,
      {
        key: 0,
        value: 15,
        addToBasket: 1,
        basket: 2,
        level: 3,
        code_header: 4,
        code_type: 16,
        code_footer: 5,
        parentKey: 6,
        topLevelKey: 7,
        openTimeMachine: 8,
        property_time: 17
      },
      null,
      [-1, -1, -1]
    );
  }
}
function dd(t) {
  let e;
  function l(a, r) {
    var s, o;
    return (
      /*edge_nodes*/
      ((s = a[1][0]) == null ? void 0 : s.x) == /*edge_nodes*/
      ((o = a[1][1]) == null ? void 0 : o.x) ? D5 : I5
    );
  }
  let i = l(t), n = i(t);
  return {
    c() {
      n.c(), e = Be();
    },
    m(a, r) {
      n.m(a, r), C(a, e, r);
    },
    p(a, r) {
      i === (i = l(a)) && n ? n.p(a, r) : (n.d(1), n = i(a), n && (n.c(), n.m(e.parentNode, e)));
    },
    d(a) {
      a && T(e), n.d(a);
    }
  };
}
function I5(t) {
  let e, l, i, n, a;
  return {
    c() {
      var r, s, o, u, c;
      e = m("qubit-edge"), xt(e, "id", l = "edge-" + /*edge*/
      t[0].join("-")), xt(e, "class", "circuit-element h svelte-e7mn57"), xt(e, "style", i = `top: ${/*padding*/
      t[4] * 2 + /*edge_nodes*/
      ((r = t[1][0]) == null ? void 0 : r.y) * /*qubit_gap*/
      t[2] - /*edge_width*/
      t[3] / 2}px; 
      height: ${/*edge_width*/
      t[3]}px;
      width: ${Math.abs(
        /*edge_nodes*/
        ((s = t[1][0]) == null ? void 0 : s.x) - /*edge_nodes*/
        ((o = t[1][1]) == null ? void 0 : o.x)
      ) * /*qubit_gap*/
      t[2]}px; 
      left: ${/*padding*/
      t[4] * 2 + /*edge_nodes*/
      ((u = t[1][0]) == null ? void 0 : u.x) * /*qubit_gap*/
      t[2]}px;
      background-color: ${/*colorScale*/
      t[6](
        /*edge_info_value*/
        (c = t[5]) == null ? void 0 : c.value
      )};` + /*is_used*/
      (t[10] ? "box-shadow: 0 0 5px purple;" : ""));
    },
    m(r, s) {
      C(r, e, s), n || (a = [
        le(
          e,
          "mouseover",
          /*mouseover_handler_1*/
          t[18]
        ),
        le(
          e,
          "focus",
          /*focus_handler_1*/
          t[19]
        ),
        le(
          e,
          "click",
          /*click_handler_1*/
          t[20]
        ),
        le(
          e,
          "mouseout",
          /*mouseout_handler_1*/
          t[21]
        ),
        le(
          e,
          "blur",
          /*blur_handler_1*/
          t[22]
        )
      ], n = !0);
    },
    p(r, s) {
      var o, u, c, d, h;
      s & /*edge*/
      1 && l !== (l = "edge-" + /*edge*/
      r[0].join("-")) && xt(e, "id", l), s & /*padding, edge_nodes, qubit_gap, edge_width, colorScale, edge_info_value, is_used*/
      1150 && i !== (i = `top: ${/*padding*/
      r[4] * 2 + /*edge_nodes*/
      ((o = r[1][0]) == null ? void 0 : o.y) * /*qubit_gap*/
      r[2] - /*edge_width*/
      r[3] / 2}px; 
      height: ${/*edge_width*/
      r[3]}px;
      width: ${Math.abs(
        /*edge_nodes*/
        ((u = r[1][0]) == null ? void 0 : u.x) - /*edge_nodes*/
        ((c = r[1][1]) == null ? void 0 : c.x)
      ) * /*qubit_gap*/
      r[2]}px; 
      left: ${/*padding*/
      r[4] * 2 + /*edge_nodes*/
      ((d = r[1][0]) == null ? void 0 : d.x) * /*qubit_gap*/
      r[2]}px;
      background-color: ${/*colorScale*/
      r[6](
        /*edge_info_value*/
        (h = r[5]) == null ? void 0 : h.value
      )};` + /*is_used*/
      (r[10] ? "box-shadow: 0 0 5px purple;" : "")) && xt(e, "style", i);
    },
    d(r) {
      r && T(e), n = !1, vt(a);
    }
  };
}
function D5(t) {
  let e, l, i, n, a;
  return {
    c() {
      var r, s, o, u, c;
      e = m("qubit-edge"), xt(e, "id", l = "edge-" + /*edge*/
      t[0].join("-")), xt(e, "class", "circuit-element v svelte-e7mn57"), xt(e, "style", i = `top: ${/*padding*/
      t[4] * 2 + /*edge_nodes*/
      ((r = t[1][0]) == null ? void 0 : r.y) * /*qubit_gap*/
      t[2]}px;
      width: ${/*edge_width*/
      t[3]}px; 
      height: ${Math.abs(
        /*edge_nodes*/
        ((s = t[1][0]) == null ? void 0 : s.y) - /*edge_nodes*/
        ((o = t[1][1]) == null ? void 0 : o.y)
      ) * /*qubit_gap*/
      t[2]}px;
      left: ${/*padding*/
      t[4] * 2 + /*edge_nodes*/
      ((u = t[1][0]) == null ? void 0 : u.x) * /*qubit_gap*/
      t[2] - /*edge_width*/
      t[3] / 2}px;
      background-color: ${/*colorScale*/
      t[6](
        /*edge_info_value*/
        (c = t[5]) == null ? void 0 : c.value
      )};` + /*is_used*/
      (t[10] ? "box-shadow: 0 0 5px purple;" : ""));
    },
    m(r, s) {
      C(r, e, s), n || (a = [
        le(
          e,
          "mouseover",
          /*mouseover_handler*/
          t[13]
        ),
        le(
          e,
          "focus",
          /*focus_handler*/
          t[14]
        ),
        le(
          e,
          "click",
          /*click_handler*/
          t[15]
        ),
        le(
          e,
          "mouseout",
          /*mouseout_handler*/
          t[16]
        ),
        le(
          e,
          "blur",
          /*blur_handler*/
          t[17]
        )
      ], n = !0);
    },
    p(r, s) {
      var o, u, c, d, h;
      s & /*edge*/
      1 && l !== (l = "edge-" + /*edge*/
      r[0].join("-")) && xt(e, "id", l), s & /*padding, edge_nodes, qubit_gap, edge_width, colorScale, edge_info_value, is_used*/
      1150 && i !== (i = `top: ${/*padding*/
      r[4] * 2 + /*edge_nodes*/
      ((o = r[1][0]) == null ? void 0 : o.y) * /*qubit_gap*/
      r[2]}px;
      width: ${/*edge_width*/
      r[3]}px; 
      height: ${Math.abs(
        /*edge_nodes*/
        ((u = r[1][0]) == null ? void 0 : u.y) - /*edge_nodes*/
        ((c = r[1][1]) == null ? void 0 : c.y)
      ) * /*qubit_gap*/
      r[2]}px;
      left: ${/*padding*/
      r[4] * 2 + /*edge_nodes*/
      ((d = r[1][0]) == null ? void 0 : d.x) * /*qubit_gap*/
      r[2] - /*edge_width*/
      r[3] / 2}px;
      background-color: ${/*colorScale*/
      r[6](
        /*edge_info_value*/
        (h = r[5]) == null ? void 0 : h.value
      )};` + /*is_used*/
      (r[10] ? "box-shadow: 0 0 5px purple;" : "")) && xt(e, "style", i);
    },
    d(r) {
      r && T(e), n = !1, vt(a);
    }
  };
}
function R5(t) {
  let e, l = (
    /*edge*/
    t[0] && /*edge_nodes*/
    t[1] && dd(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*edge*/
      i[0] && /*edge_nodes*/
      i[1] ? l ? l.p(i, n) : (l = dd(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function H5(t, e, l) {
  let { edge: i, edge_nodes: n, qubit_gap: a = 35, edge_width: r = 20, padding: s = 20, edge_info_value: o, info_type: u, colorScale: c = () => {
  }, openTooltip: d = () => {
  }, hideTooltip: h = () => {
  }, moveTooltip: p = () => {
  }, edge_info_selected: b, is_used: g = !1 } = e;
  const v = (M) => {
    d(M, "Edge " + i.join("-"), b, o, "edge-" + i.join("-"), i, !1);
  }, y = (M) => {
    d(M, "Edge " + i.join("-"), b, o, "edge-" + i.join("-"), i, !0);
  }, k = (M) => {
    d(M, "Edge " + i.join("-"), b, o, "edge-" + i.join("-"), i, !0);
  }, w = (M) => {
    h(!1);
  }, $ = (M) => {
    h(!0);
  }, q = (M) => {
    d(M, "Edge " + i.join("-"), b, o, "edge-" + i.join("-"), i, !1);
  }, j = (M) => {
    d(M, "Edge " + i.join("-"), b, o, "edge-" + i.join("-"), i, !0);
  }, O = (M) => {
    d(M, "Edge " + i.join("-"), b, o, "edge-" + i.join("-"), i, !0);
  }, z = (M) => {
    h(!1);
  }, N = (M) => {
    h(!0);
  };
  return t.$$set = (M) => {
    "edge" in M && l(0, i = M.edge), "edge_nodes" in M && l(1, n = M.edge_nodes), "qubit_gap" in M && l(2, a = M.qubit_gap), "edge_width" in M && l(3, r = M.edge_width), "padding" in M && l(4, s = M.padding), "edge_info_value" in M && l(5, o = M.edge_info_value), "info_type" in M && l(11, u = M.info_type), "colorScale" in M && l(6, c = M.colorScale), "openTooltip" in M && l(7, d = M.openTooltip), "hideTooltip" in M && l(8, h = M.hideTooltip), "moveTooltip" in M && l(12, p = M.moveTooltip), "edge_info_selected" in M && l(9, b = M.edge_info_selected), "is_used" in M && l(10, g = M.is_used);
  }, [
    i,
    n,
    a,
    r,
    s,
    o,
    c,
    d,
    h,
    b,
    g,
    u,
    p,
    v,
    y,
    k,
    w,
    $,
    q,
    j,
    O,
    z,
    N
  ];
}
class Mg extends Ve {
  constructor(e) {
    super(), Qe(this, e, H5, R5, Le, {
      edge: 0,
      edge_nodes: 1,
      qubit_gap: 2,
      edge_width: 3,
      padding: 4,
      edge_info_value: 5,
      info_type: 11,
      colorScale: 6,
      openTooltip: 7,
      hideTooltip: 8,
      moveTooltip: 12,
      edge_info_selected: 9,
      is_used: 10
    });
  }
}
function hd(t) {
  let e, l, i, n, a, r;
  return {
    c() {
      e = m("qubit-node"), l = E(
        /*qubit*/
        t[0]
      ), xt(e, "id", i = "qubit-" + /*qubit*/
      t[0]), xt(e, "class", "circuit-element svelte-qmo2vj"), xt(e, "style", n = `top: ${/*padding*/
      t[3] * 2 + /*qubit_node*/
      t[1].y * /*qubit_gap*/
      t[2] - /*qubit_radius*/
      t[4] / 2}px; 
    left: ${/*padding*/
      t[3] * 2 + /*qubit_node*/
      t[1].x * /*qubit_gap*/
      t[2] - /*qubit_radius*/
      t[4] / 2}px;
    width: ${/*qubit_radius*/
      t[4]}px;
    height: ${/*qubit_radius*/
      t[4]}px;
    border-radius: ${/*qubit_radius*/
      t[4] / 2}px;
    font-size: ${/*qubit_radius*/
      t[4] * 0.55}px;
    padding-top: ${/*qubit_radius*/
      t[4] * 0.225}px;
    background-color: ${/*colorScale*/
      t[6](
        /*qubit_info_value*/
        t[5].value
      )};
    color: ${dc(
        /*colorScale*/
        t[6](
          /*qubit_info_value*/
          t[5].value
        )
      )};` + /*is_used*/
      (t[10] ? "box-shadow: 0 0 5px purple;" : ""));
    },
    m(s, o) {
      C(s, e, o), _(e, l), a || (r = [
        le(
          e,
          "mouseover",
          /*mouseover_handler*/
          t[14]
        ),
        le(
          e,
          "focus",
          /*focus_handler*/
          t[15]
        ),
        le(
          e,
          "click",
          /*click_handler*/
          t[16]
        ),
        le(
          e,
          "mouseout",
          /*mouseout_handler*/
          t[17]
        ),
        le(
          e,
          "blur",
          /*blur_handler*/
          t[18]
        )
      ], a = !0);
    },
    p(s, o) {
      o & /*qubit*/
      1 && Y(
        l,
        /*qubit*/
        s[0]
      ), o & /*qubit*/
      1 && i !== (i = "qubit-" + /*qubit*/
      s[0]) && xt(e, "id", i), o & /*padding, qubit_node, qubit_gap, qubit_radius, colorScale, qubit_info_value, is_used*/
      1150 && n !== (n = `top: ${/*padding*/
      s[3] * 2 + /*qubit_node*/
      s[1].y * /*qubit_gap*/
      s[2] - /*qubit_radius*/
      s[4] / 2}px; 
    left: ${/*padding*/
      s[3] * 2 + /*qubit_node*/
      s[1].x * /*qubit_gap*/
      s[2] - /*qubit_radius*/
      s[4] / 2}px;
    width: ${/*qubit_radius*/
      s[4]}px;
    height: ${/*qubit_radius*/
      s[4]}px;
    border-radius: ${/*qubit_radius*/
      s[4] / 2}px;
    font-size: ${/*qubit_radius*/
      s[4] * 0.55}px;
    padding-top: ${/*qubit_radius*/
      s[4] * 0.225}px;
    background-color: ${/*colorScale*/
      s[6](
        /*qubit_info_value*/
        s[5].value
      )};
    color: ${dc(
        /*colorScale*/
        s[6](
          /*qubit_info_value*/
          s[5].value
        )
      )};` + /*is_used*/
      (s[10] ? "box-shadow: 0 0 5px purple;" : "")) && xt(e, "style", n);
    },
    d(s) {
      s && T(e), a = !1, vt(r);
    }
  };
}
function F5(t) {
  let e, l = (
    /*qubit*/
    t[0] !== void 0 && /*qubit_node*/
    t[1] && hd(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*qubit*/
      i[0] !== void 0 && /*qubit_node*/
      i[1] ? l ? l.p(i, n) : (l = hd(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function L5(t, e, l) {
  let { qubit: i, qubit_node: n, qubit_gap: a = 35, edge_width: r = 15, padding: s = 20, qubit_radius: o = 25, qubit_info_value: u, info_type: c, colorScale: d = () => {
  }, openTooltip: h = () => {
  }, hideTooltip: p = () => {
  }, moveTooltip: b = () => {
  }, qubit_info_selected: g, is_used: v = !1 } = e;
  const y = (j) => {
    j.preventDefault(), h(j, "Qubit " + i, g, u, "qubit-" + i, [i], !1);
  }, k = (j) => {
    console.log("/"), j.preventDefault(), h(j, "Qubit " + i, g, u, "qubit-" + i, [i], !0);
  }, w = (j) => {
    j.preventDefault(), h(j, "Qubit " + i, g, u, "qubit-" + i, [i], !0);
  }, $ = (j) => {
    j.preventDefault(), p(!1);
  }, q = (j) => {
    console.log("/"), j.preventDefault(), p(!0);
  };
  return t.$$set = (j) => {
    "qubit" in j && l(0, i = j.qubit), "qubit_node" in j && l(1, n = j.qubit_node), "qubit_gap" in j && l(2, a = j.qubit_gap), "edge_width" in j && l(11, r = j.edge_width), "padding" in j && l(3, s = j.padding), "qubit_radius" in j && l(4, o = j.qubit_radius), "qubit_info_value" in j && l(5, u = j.qubit_info_value), "info_type" in j && l(12, c = j.info_type), "colorScale" in j && l(6, d = j.colorScale), "openTooltip" in j && l(7, h = j.openTooltip), "hideTooltip" in j && l(8, p = j.hideTooltip), "moveTooltip" in j && l(13, b = j.moveTooltip), "qubit_info_selected" in j && l(9, g = j.qubit_info_selected), "is_used" in j && l(10, v = j.is_used);
  }, [
    i,
    n,
    a,
    s,
    o,
    u,
    d,
    h,
    p,
    g,
    v,
    r,
    c,
    b,
    y,
    k,
    w,
    $,
    q
  ];
}
class zg extends Ve {
  constructor(e) {
    super(), Qe(this, e, L5, F5, Le, {
      qubit: 0,
      qubit_node: 1,
      qubit_gap: 2,
      edge_width: 11,
      padding: 3,
      qubit_radius: 4,
      qubit_info_value: 5,
      info_type: 12,
      colorScale: 6,
      openTooltip: 7,
      hideTooltip: 8,
      moveTooltip: 13,
      qubit_info_selected: 9,
      is_used: 10
    });
  }
}
function pd(t, e, l) {
  const i = t.slice();
  return i[12] = e[l], i[14] = l, i;
}
function md(t) {
  let e, l;
  return {
    c() {
      e = m("div"), f(e, "class", "histogram-bin svelte-k599bk"), f(e, "style", l = `width: ${fl / /*counts*/
      t[6].length - 1}px;
        height: ${gd * /*count*/
      t[12] / /*max_count*/
      t[7]}px;
        background-color: ${/*colorScale*/
      t[0](
        /*bins*/
        t[5][
          /*ci*/
          t[14]
        ].x0
      )}`);
    },
    m(i, n) {
      C(i, e, n);
    },
    p(i, n) {
      n & /*counts, max_count, colorScale, bins*/
      225 && l !== (l = `width: ${fl / /*counts*/
      i[6].length - 1}px;
        height: ${gd * /*count*/
      i[12] / /*max_count*/
      i[7]}px;
        background-color: ${/*colorScale*/
      i[0](
        /*bins*/
        i[5][
          /*ci*/
          i[14]
        ].x0
      )}`) && f(e, "style", l);
    },
    d(i) {
      i && T(e);
    }
  };
}
function Q5(t) {
  let e, l, i, n, a = (
    /*roundN*/
    t[8](
      /*mean*/
      t[3]
    ) + ""
  ), r, s, o, u, c, d, h, p, b, g, v, y = (
    /*roundN*/
    t[8](
      /*min*/
      t[1]
    ) + ""
  ), k, w, $, q, j = (
    /*roundN*/
    t[8](
      /*max*/
      t[2]
    ) + ""
  ), O, z = we(
    /*counts*/
    t[6]
  ), N = [];
  for (let M = 0; M < z.length; M += 1)
    N[M] = md(pd(t, z, M));
  return {
    c() {
      e = m("div"), l = m("div"), i = m("span"), n = E("Med: "), r = E(a), o = A(), u = m("div");
      for (let M = 0; M < N.length; M += 1)
        N[M].c();
      c = A(), d = m("div"), p = A(), b = m("div"), g = m("span"), v = E("Min: "), k = E(y), w = A(), $ = m("span"), q = E("Max: "), O = E(j), f(i, "class", "median svelte-k599bk"), f(i, "style", s = `left: ${/*median*/
      (t[4] - /*min*/
      t[1]) / /*max*/
      (t[2] - /*min*/
      t[1]) * fl}px; 
      transform: ${/*median*/
      (t[4] - /*min*/
      t[1]) / /*max*/
      (t[2] - /*min*/
      t[1]) * fl > 60 ? "translateX(-50%)" : ""};`), f(l, "class", "histogram-stats-wrap svelte-k599bk"), f(l, "style", `width: ${fl}px`), f(d, "class", "median-marker svelte-k599bk"), f(d, "style", h = `left:${/*median*/
      (t[4] - /*min*/
      t[1]) / /*max*/
      (t[2] - /*min*/
      t[1]) * fl}px;`), f(u, "class", "histogram-wrap svelte-k599bk"), f(u, "style", `width: ${fl}px`), f(g, "class", "min svelte-k599bk"), f($, "class", "max svelte-k599bk"), f(b, "class", "histogram-stats-wrap svelte-k599bk"), f(b, "style", `width: ${fl}px`), f(e, "style", `width: ${fl}px; padding: `), f(e, "class", "svelte-k599bk");
    },
    m(M, H) {
      C(M, e, H), _(e, l), _(l, i), _(i, n), _(i, r), _(e, o), _(e, u);
      for (let B = 0; B < N.length; B += 1)
        N[B] && N[B].m(u, null);
      _(u, c), _(u, d), _(e, p), _(e, b), _(b, g), _(g, v), _(g, k), _(b, w), _(b, $), _($, q), _($, O);
    },
    p(M, [H]) {
      if (H & /*mean*/
      8 && a !== (a = /*roundN*/
      M[8](
        /*mean*/
        M[3]
      ) + "") && Y(r, a), H & /*median, min, max*/
      22 && s !== (s = `left: ${/*median*/
      (M[4] - /*min*/
      M[1]) / /*max*/
      (M[2] - /*min*/
      M[1]) * fl}px; 
      transform: ${/*median*/
      (M[4] - /*min*/
      M[1]) / /*max*/
      (M[2] - /*min*/
      M[1]) * fl > 60 ? "translateX(-50%)" : ""};`) && f(i, "style", s), H & /*total_width, counts, bar_height, max_count, colorScale, bins*/
      225) {
        z = we(
          /*counts*/
          M[6]
        );
        let B;
        for (B = 0; B < z.length; B += 1) {
          const R = pd(M, z, B);
          N[B] ? N[B].p(R, H) : (N[B] = md(R), N[B].c(), N[B].m(u, c));
        }
        for (; B < N.length; B += 1)
          N[B].d(1);
        N.length = z.length;
      }
      H & /*median, min, max*/
      22 && h !== (h = `left:${/*median*/
      (M[4] - /*min*/
      M[1]) / /*max*/
      (M[2] - /*min*/
      M[1]) * fl}px;`) && f(d, "style", h), H & /*min*/
      2 && y !== (y = /*roundN*/
      M[8](
        /*min*/
        M[1]
      ) + "") && Y(k, y), H & /*max*/
      4 && j !== (j = /*roundN*/
      M[8](
        /*max*/
        M[2]
      ) + "") && Y(O, j);
    },
    i: ae,
    o: ae,
    d(M) {
      M && T(e), Ge(N, M);
    }
  };
}
let fl = 200;
const gd = 40;
function V5(t, e, l) {
  let { data: i = {}, colorScale: n = () => {
  } } = e, a, r, s, o, u, c, d, h;
  function p(g) {
    l(1, a = g.min), l(2, r = g.max), l(3, s = g.mean), l(4, o = g.median), u = g.values, l(5, c = Xb().thresholds(20)(u)), l(6, d = c.map((v) => v.length)), l(7, h = Math.max(...d));
  }
  let b = (g) => Math.round(g * 1e4) / 1e4;
  return yt(() => {
    p(i);
  }), t.$$set = (g) => {
    "data" in g && l(9, i = g.data), "colorScale" in g && l(0, n = g.colorScale);
  }, t.$$.update = () => {
    t.$$.dirty & /*data*/
    512 && p(i);
  }, [n, a, r, s, o, c, d, h, b, i];
}
class lr extends Ve {
  constructor(e) {
    super(), Qe(this, e, V5, Q5, Le, { data: 9, colorScale: 0 });
  }
}
const bd = {
  x: 50,
  y: 120
};
function vd(t, e, l) {
  const i = t.slice();
  return i[48] = e[l], i;
}
function kd(t, e, l) {
  const i = t.slice();
  return i[51] = e[l], i[53] = l, i;
}
function yd(t, e, l) {
  const i = t.slice();
  return i[54] = e[l], i;
}
function wd(t, e, l) {
  const i = t.slice();
  return i[54] = e[l], i;
}
function $d(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[21].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1xkxkc8");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler*/
        t[32]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s[0] & /*$basket, key*/
      2097153 && (o.on = /*$basket*/
      r[21].includes(
        /*key*/
        r[0]
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function X5(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), f(e, "class", "svelte-1xkxkc8");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a[0] & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function G5(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), f(e, "class", "svelte-1xkxkc8");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a[0] & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function qd(t) {
  let e, l = (
    /*item*/
    (t[54].feature || /*item*/
    t[54].gate) + ""
  ), i, n, a = (
    /*item*/
    t[54].gate ? "- " + /*item*/
    t[54].type : ""
  ), r, s;
  return {
    c() {
      e = m("option"), i = E(l), n = A(), r = E(a), e.__value = s = JSON.stringify(
        /*item*/
        t[54]
      ), dt(e, e.__value);
    },
    m(o, u) {
      C(o, e, u), _(e, i), _(e, n), _(e, r);
    },
    p(o, u) {
      u[0] & /*qubit_info_list*/
      2048 && l !== (l = /*item*/
      (o[54].feature || /*item*/
      o[54].gate) + "") && Y(i, l), u[0] & /*qubit_info_list*/
      2048 && a !== (a = /*item*/
      o[54].gate ? "- " + /*item*/
      o[54].type : "") && Y(r, a), u[0] & /*qubit_info_list*/
      2048 && s !== (s = JSON.stringify(
        /*item*/
        o[54]
      )) && (e.__value = s, dt(e, e.__value));
    },
    d(o) {
      o && T(e);
    }
  };
}
function jd(t) {
  let e, l;
  return e = new lr({
    props: {
      data: (
        /*qubit_stats*/
        t[15]
      ),
      colorScale: (
        /*colorScale*/
        t[6]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*qubit_stats*/
      32768 && (a.data = /*qubit_stats*/
      i[15]), n[0] & /*colorScale*/
      64 && (a.colorScale = /*colorScale*/
      i[6]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Td(t) {
  let e, l = (
    /*item*/
    (t[54].gate || /*item*/
    t[54].feature) + ""
  ), i, n, a = (
    /*item*/
    t[54].gate ? "- " + /*item*/
    t[54].type : ""
  ), r, s;
  return {
    c() {
      e = m("option"), i = E(l), n = A(), r = E(a), e.__value = s = JSON.stringify(
        /*item*/
        t[54]
      ), dt(e, e.__value);
    },
    m(o, u) {
      C(o, e, u), _(e, i), _(e, n), _(e, r);
    },
    p(o, u) {
      u[0] & /*edge_info_list*/
      4096 && l !== (l = /*item*/
      (o[54].gate || /*item*/
      o[54].feature) + "") && Y(i, l), u[0] & /*edge_info_list*/
      4096 && a !== (a = /*item*/
      o[54].gate ? "- " + /*item*/
      o[54].type : "") && Y(r, a), u[0] & /*edge_info_list*/
      4096 && s !== (s = JSON.stringify(
        /*item*/
        o[54]
      )) && (e.__value = s, dt(e, e.__value));
    },
    d(o) {
      o && T(e);
    }
  };
}
function Cd(t) {
  let e, l;
  return e = new lr({
    props: {
      data: (
        /*edge_stats*/
        t[16]
      ),
      colorScale: (
        /*edgeColorScale*/
        t[7]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*edge_stats*/
      65536 && (a.data = /*edge_stats*/
      i[16]), n[0] & /*edgeColorScale*/
      128 && (a.colorScale = /*edgeColorScale*/
      i[7]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Sd(t) {
  let e, l, i, n = we(
    /*qubit_edges*/
    t[1]
  ), a = [];
  for (let c = 0; c < n.length; c += 1)
    a[c] = Md(kd(t, n, c));
  const r = (c) => D(a[c], 1, 1, () => {
    a[c] = null;
  });
  let s = we(
    /*qubit_index*/
    t[2]
  ), o = [];
  for (let c = 0; c < s.length; c += 1)
    o[c] = zd(vd(t, s, c));
  const u = (c) => D(o[c], 1, 1, () => {
    o[c] = null;
  });
  return {
    c() {
      for (let c = 0; c < a.length; c += 1)
        a[c].c();
      e = A();
      for (let c = 0; c < o.length; c += 1)
        o[c].c();
      l = Be();
    },
    m(c, d) {
      for (let h = 0; h < a.length; h += 1)
        a[h] && a[h].m(c, d);
      C(c, e, d);
      for (let h = 0; h < o.length; h += 1)
        o[h] && o[h].m(c, d);
      C(c, l, d), i = !0;
    },
    p(c, d) {
      if (d[0] & /*qubit_edges, node_map, edge_info_values, $edge_info_selected, edgeColorScale, openTooltip, hideTooltip, moveTooltip*/
      473973122) {
        n = we(
          /*qubit_edges*/
          c[1]
        );
        let h;
        for (h = 0; h < n.length; h += 1) {
          const p = kd(c, n, h);
          a[h] ? (a[h].p(p, d), S(a[h], 1)) : (a[h] = Md(p), a[h].c(), S(a[h], 1), a[h].m(e.parentNode, e));
        }
        for (ge(), h = n.length; h < a.length; h += 1)
          r(h);
        be();
      }
      if (d[0] & /*qubit_index, node_map, $qubit_info_selected, qubit_info_values, colorScale, openTooltip, hideTooltip, moveTooltip*/
      478159172) {
        s = we(
          /*qubit_index*/
          c[2]
        );
        let h;
        for (h = 0; h < s.length; h += 1) {
          const p = vd(c, s, h);
          o[h] ? (o[h].p(p, d), S(o[h], 1)) : (o[h] = zd(p), o[h].c(), S(o[h], 1), o[h].m(l.parentNode, l));
        }
        for (ge(), h = s.length; h < o.length; h += 1)
          u(h);
        be();
      }
    },
    i(c) {
      if (!i) {
        for (let d = 0; d < n.length; d += 1)
          S(a[d]);
        for (let d = 0; d < s.length; d += 1)
          S(o[d]);
        i = !0;
      }
    },
    o(c) {
      a = a.filter(Boolean);
      for (let d = 0; d < a.length; d += 1)
        D(a[d]);
      o = o.filter(Boolean);
      for (let d = 0; d < o.length; d += 1)
        D(o[d]);
      i = !1;
    },
    d(c) {
      c && (T(e), T(l)), Ge(a, c), Ge(o, c);
    }
  };
}
function Md(t) {
  var i, n;
  let e, l;
  return e = new Mg({
    props: {
      edge: (
        /*edge*/
        t[51]
      ),
      edge_nodes: (
        /*edge*/
        (i = t[51]) == null ? void 0 : i.toSorted(Ed).map(
          /*func_1*/
          t[36]
        )
      ),
      qubit_gap: Xa,
      edge_width: Ng,
      padding: Ga,
      edge_info_value: (
        /*edge_info_values*/
        (n = t[14][
          /*edge*/
          t[51].join("-")
        ] || /*edge_info_values*/
        t[14][
          /*edge*/
          t[51][1] + "-" + /*edge*/
          t[51][0]
        ]) == null ? void 0 : n.parameters["gate_" + /*$edge_info_selected*/
        t[22].type]
      ),
      colorScale: (
        /*edgeColorScale*/
        t[7]
      ),
      edge_info_selected: (
        /*$edge_info_selected*/
        t[22]
      ),
      info_type: (
        /*$edge_info_selected*/
        t[22].type
      ),
      openTooltip: (
        /*openTooltip*/
        t[26]
      ),
      hideTooltip: (
        /*hideTooltip*/
        t[28]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[27]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(a, r) {
      ce(e, a, r), l = !0;
    },
    p(a, r) {
      var o, u;
      const s = {};
      r[0] & /*qubit_edges*/
      2 && (s.edge = /*edge*/
      a[51]), r[0] & /*qubit_edges, node_map*/
      258 && (s.edge_nodes = /*edge*/
      (o = a[51]) == null ? void 0 : o.toSorted(Ed).map(
        /*func_1*/
        a[36]
      )), r[0] & /*edge_info_values, qubit_edges, $edge_info_selected*/
      4210690 && (s.edge_info_value = /*edge_info_values*/
      (u = a[14][
        /*edge*/
        a[51].join("-")
      ] || /*edge_info_values*/
      a[14][
        /*edge*/
        a[51][1] + "-" + /*edge*/
        a[51][0]
      ]) == null ? void 0 : u.parameters["gate_" + /*$edge_info_selected*/
      a[22].type]), r[0] & /*edgeColorScale*/
      128 && (s.colorScale = /*edgeColorScale*/
      a[7]), r[0] & /*$edge_info_selected*/
      4194304 && (s.edge_info_selected = /*$edge_info_selected*/
      a[22]), r[0] & /*$edge_info_selected*/
      4194304 && (s.info_type = /*$edge_info_selected*/
      a[22].type), e.$set(s);
    },
    i(a) {
      l || (S(e.$$.fragment, a), l = !0);
    },
    o(a) {
      D(e.$$.fragment, a), l = !1;
    },
    d(a) {
      de(e, a);
    }
  };
}
function zd(t) {
  let e, l;
  return e = new zg({
    props: {
      qubit: (
        /*qi*/
        t[48]
      ),
      qubit_node: (
        /*node_map*/
        t[8][
          /*qi*/
          t[48]
        ]
      ),
      qubit_gap: Xa,
      edge_width: Ng,
      padding: Ga,
      qubit_info_value: (
        /*$qubit_info_selected*/
        t[23].feature ? (
          /*qubit_info_values*/
          t[13][
            /*qi*/
            t[48]
          ]
        ) : (
          /*qubit_info_values*/
          t[13][
            /*qi*/
            t[48]
          ].parameters["gate_" + /*$qubit_info_selected*/
          t[23].type]
        )
      ),
      info_type: (
        /*$qubit_info_selected*/
        t[23].type
      ),
      colorScale: (
        /*colorScale*/
        t[6]
      ),
      qubit_info_selected: (
        /*$qubit_info_selected*/
        t[23]
      ),
      openTooltip: (
        /*openTooltip*/
        t[26]
      ),
      hideTooltip: (
        /*hideTooltip*/
        t[28]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[27]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*qubit_index*/
      4 && (a.qubit = /*qi*/
      i[48]), n[0] & /*node_map, qubit_index*/
      260 && (a.qubit_node = /*node_map*/
      i[8][
        /*qi*/
        i[48]
      ]), n[0] & /*$qubit_info_selected, qubit_info_values, qubit_index*/
      8396804 && (a.qubit_info_value = /*$qubit_info_selected*/
      i[23].feature ? (
        /*qubit_info_values*/
        i[13][
          /*qi*/
          i[48]
        ]
      ) : (
        /*qubit_info_values*/
        i[13][
          /*qi*/
          i[48]
        ].parameters["gate_" + /*$qubit_info_selected*/
        i[23].type]
      )), n[0] & /*$qubit_info_selected*/
      8388608 && (a.info_type = /*$qubit_info_selected*/
      i[23].type), n[0] & /*colorScale*/
      64 && (a.colorScale = /*colorScale*/
      i[6]), n[0] & /*$qubit_info_selected*/
      8388608 && (a.qubit_info_selected = /*$qubit_info_selected*/
      i[23]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Nd(t) {
  let e, l = mt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), f(e, "class", "desc svelte-1xkxkc8");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a[0] & /*key*/
      1 && l !== (l = mt[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function Ad(t) {
  let e, l, i = (
    /*tooltipInfo*/
    t[20].item + ""
  ), n, a, r = (
    /*tooltipInfo*/
    (t[20].key.gate || /*tooltipInfo*/
    t[20].key.feature) + ""
  ), s, o, u = (
    /*tooltipInfo*/
    (t[20].key.type ? (
      /*tooltipInfo*/
      t[20].key.type
    ) : "") + ""
  ), c, d, h, p, b, g, v = (
    /*tooltipInfo*/
    t[20].value.value + ""
  ), y, k, w, $, q, j = (
    /*tooltipInfo*/
    t[20].value.asof + ""
  ), O, z, N, M, H, B, R, P, I, L, F = (
    /*tooltipInfo*/
    t[20].value.unit && Bd(t)
  ), X = (
    /*addToBasket*/
    t[3] && Pd(t)
  );
  return {
    c() {
      e = m("div"), l = m("h5"), n = E(i), a = E("–"), s = E(r), o = A(), c = E(u), d = A(), h = m("table"), p = m("tr"), b = m("th"), b.textContent = "Value", g = m("td"), y = E(v), k = A(), w = m("tr"), $ = m("th"), $.textContent = "Date", q = m("td"), O = E(j), z = A(), F && F.c(), N = A(), M = m("div"), X && X.c(), H = A(), B = m("button"), B.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16"><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"></path></svg>', f(l, "class", "svelte-1xkxkc8"), f(b, "class", "svelte-1xkxkc8"), f(g, "class", "svelte-1xkxkc8"), f($, "class", "svelte-1xkxkc8"), f(q, "class", "svelte-1xkxkc8"), f(h, "class", "svelte-1xkxkc8"), f(B, "class", "close svelte-1xkxkc8"), Mt(M, "text-align", "right"), f(e, "class", "tooltip svelte-1xkxkc8"), f(e, "style", R = `right: 1rem; top: ${/*tooltipY*/
      t[19]}px;`);
    },
    m(V, Q) {
      C(V, e, Q), _(e, l), _(l, n), _(l, a), _(l, s), _(l, o), _(l, c), _(e, d), _(e, h), _(h, p), _(p, b), _(p, g), _(g, y), _(h, k), _(h, w), _(w, $), _(w, q), _(q, O), _(h, z), F && F.m(h, null), _(e, N), _(e, M), X && X.m(M, null), _(M, H), _(M, B), P = !0, I || (L = le(
        B,
        "click",
        /*click_handler_3*/
        t[38]
      ), I = !0);
    },
    p(V, Q) {
      (!P || Q[0] & /*tooltipInfo*/
      1048576) && i !== (i = /*tooltipInfo*/
      V[20].item + "") && Y(n, i), (!P || Q[0] & /*tooltipInfo*/
      1048576) && r !== (r = /*tooltipInfo*/
      (V[20].key.gate || /*tooltipInfo*/
      V[20].key.feature) + "") && Y(s, r), (!P || Q[0] & /*tooltipInfo*/
      1048576) && u !== (u = /*tooltipInfo*/
      (V[20].key.type ? (
        /*tooltipInfo*/
        V[20].key.type
      ) : "") + "") && Y(c, u), (!P || Q[0] & /*tooltipInfo*/
      1048576) && v !== (v = /*tooltipInfo*/
      V[20].value.value + "") && Y(y, v), (!P || Q[0] & /*tooltipInfo*/
      1048576) && j !== (j = /*tooltipInfo*/
      V[20].value.asof + "") && Y(O, j), /*tooltipInfo*/
      V[20].value.unit ? F ? F.p(V, Q) : (F = Bd(V), F.c(), F.m(h, null)) : F && (F.d(1), F = null), /*addToBasket*/
      V[3] ? X ? (X.p(V, Q), Q[0] & /*addToBasket*/
      8 && S(X, 1)) : (X = Pd(V), X.c(), S(X, 1), X.m(M, H)) : X && (ge(), D(X, 1, 1, () => {
        X = null;
      }), be()), (!P || Q[0] & /*tooltipY*/
      524288 && R !== (R = `right: 1rem; top: ${/*tooltipY*/
      V[19]}px;`)) && f(e, "style", R);
    },
    i(V) {
      P || (S(X), P = !0);
    },
    o(V) {
      D(X), P = !1;
    },
    d(V) {
      V && T(e), F && F.d(), X && X.d(), I = !1, L();
    }
  };
}
function Bd(t) {
  let e, l, i, n = (
    /*tooltipInfo*/
    t[20].value.unit + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Unit", i = m("td"), a = E(n), f(l, "class", "svelte-1xkxkc8"), f(i, "class", "svelte-1xkxkc8");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s[0] & /*tooltipInfo*/
      1048576 && n !== (n = /*tooltipInfo*/
      r[20].value.unit + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function Pd(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[21].includes(
          /*circuitElemCartKey*/
          t[17]
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1xkxkc8");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler_2*/
        t[37]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s[0] & /*$basket, circuitElemCartKey*/
      2228224 && (o.on = /*$basket*/
      r[21].includes(
        /*circuitElemCartKey*/
        r[17]
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function Y5(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B = (
    /*addToBasket*/
    t[3] && $d(t)
  );
  function R(G, W) {
    if (
      /*level*/
      G[5] == 1
    )
      return G5;
    if (
      /*level*/
      G[5] == 2
    )
      return X5;
  }
  let P = R(t), I = P && P(t), L = we(
    /*qubit_info_list*/
    t[11]
  ), F = [];
  for (let G = 0; G < L.length; G += 1)
    F[G] = qd(wd(t, L, G));
  let X = (
    /*qubit_stats*/
    t[15] && /*colorScale*/
    t[6] && jd(t)
  ), V = we(
    /*edge_info_list*/
    t[12]
  ), Q = [];
  for (let G = 0; G < V.length; G += 1)
    Q[G] = Td(yd(t, V, G));
  let J = (
    /*edge_stats*/
    t[16] && /*edgeColorScale*/
    t[7] && Cd(t)
  ), te = (
    /*qubit_edges*/
    t[1] && /*node_map*/
    t[8] && Sd(t)
  ), ie = mt[
    /*key*/
    t[0]
  ] && Nd(t), U = (
    /*showTooltip*/
    t[18] && Ad(t)
  );
  return {
    c() {
      e = m("article"), B && B.c(), l = A(), I && I.c(), i = A(), n = m("div"), a = m("div"), r = m("label"), r.textContent = "For Qubits:", s = A(), o = m("select");
      for (let G = 0; G < F.length; G += 1)
        F[G].c();
      u = A(), c = m("div"), X && X.c(), d = A(), h = m("div"), p = m("label"), p.textContent = "For Edges:", b = A(), g = m("select");
      for (let G = 0; G < Q.length; G += 1)
        Q[G].c();
      v = A(), y = m("div"), J && J.c(), k = A(), w = m("div"), $ = A(), q = m("div"), te && te.c(), O = A(), ie && ie.c(), z = A(), U && U.c(), f(r, "for", "qubit_rep"), f(r, "class", "svelte-1xkxkc8"), f(o, "name", "qubit_rep"), f(o, "id", "qubit_rep"), f(o, "class", "svelte-1xkxkc8"), f(c, "class", "stats"), f(a, "class", "svelte-1xkxkc8"), f(p, "for", "edge_rep"), f(p, "class", "svelte-1xkxkc8"), f(g, "name", "edge_rep"), f(g, "id", "edge_rep"), f(g, "class", "svelte-1xkxkc8"), f(y, "class", "stats"), f(h, "class", "svelte-1xkxkc8"), f(n, "class", "controls svelte-1xkxkc8"), f(w, "class", "circuit-background-map svelte-1xkxkc8"), f(q, "class", "circuit svelte-1xkxkc8"), f(q, "style", j = `width: ${/*width*/
      t[9]}px; height: ${/*height*/
      t[10]}px; padding-bottom: 3rem;`), f(e, "class", "svelte-1xkxkc8");
    },
    m(G, W) {
      C(G, e, W), B && B.m(e, null), _(e, l), I && I.m(e, null), _(e, i), _(e, n), _(n, a), _(a, r), _(a, s), _(a, o);
      for (let Z = 0; Z < F.length; Z += 1)
        F[Z] && F[Z].m(o, null);
      _(a, u), _(a, c), X && X.m(c, null), _(n, d), _(n, h), _(h, p), _(h, b), _(h, g);
      for (let Z = 0; Z < Q.length; Z += 1)
        Q[Z] && Q[Z].m(g, null);
      _(h, v), _(h, y), J && J.m(y, null), _(e, k), _(e, w), _(e, $), _(e, q), te && te.m(q, null), _(e, O), ie && ie.m(e, null), _(e, z), U && U.m(e, null), N = !0, M || (H = [
        le(
          o,
          "change",
          /*change_handler*/
          t[33]
        ),
        le(
          g,
          "change",
          /*change_handler_1*/
          t[34]
        ),
        le(
          w,
          "click",
          /*click_handler_1*/
          t[35]
        )
      ], M = !0);
    },
    p(G, W) {
      if (/*addToBasket*/
      G[3] ? B ? (B.p(G, W), W[0] & /*addToBasket*/
      8 && S(B, 1)) : (B = $d(G), B.c(), S(B, 1), B.m(e, l)) : B && (ge(), D(B, 1, 1, () => {
        B = null;
      }), be()), P === (P = R(G)) && I ? I.p(G, W) : (I && I.d(1), I = P && P(G), I && (I.c(), I.m(e, i))), W[0] & /*qubit_info_list*/
      2048) {
        L = we(
          /*qubit_info_list*/
          G[11]
        );
        let Z;
        for (Z = 0; Z < L.length; Z += 1) {
          const ee = wd(G, L, Z);
          F[Z] ? F[Z].p(ee, W) : (F[Z] = qd(ee), F[Z].c(), F[Z].m(o, null));
        }
        for (; Z < F.length; Z += 1)
          F[Z].d(1);
        F.length = L.length;
      }
      if (/*qubit_stats*/
      G[15] && /*colorScale*/
      G[6] ? X ? (X.p(G, W), W[0] & /*qubit_stats, colorScale*/
      32832 && S(X, 1)) : (X = jd(G), X.c(), S(X, 1), X.m(c, null)) : X && (ge(), D(X, 1, 1, () => {
        X = null;
      }), be()), W[0] & /*edge_info_list*/
      4096) {
        V = we(
          /*edge_info_list*/
          G[12]
        );
        let Z;
        for (Z = 0; Z < V.length; Z += 1) {
          const ee = yd(G, V, Z);
          Q[Z] ? Q[Z].p(ee, W) : (Q[Z] = Td(ee), Q[Z].c(), Q[Z].m(g, null));
        }
        for (; Z < Q.length; Z += 1)
          Q[Z].d(1);
        Q.length = V.length;
      }
      /*edge_stats*/
      G[16] && /*edgeColorScale*/
      G[7] ? J ? (J.p(G, W), W[0] & /*edge_stats, edgeColorScale*/
      65664 && S(J, 1)) : (J = Cd(G), J.c(), S(J, 1), J.m(y, null)) : J && (ge(), D(J, 1, 1, () => {
        J = null;
      }), be()), /*qubit_edges*/
      G[1] && /*node_map*/
      G[8] ? te ? (te.p(G, W), W[0] & /*qubit_edges, node_map*/
      258 && S(te, 1)) : (te = Sd(G), te.c(), S(te, 1), te.m(q, null)) : te && (ge(), D(te, 1, 1, () => {
        te = null;
      }), be()), (!N || W[0] & /*width, height*/
      1536 && j !== (j = `width: ${/*width*/
      G[9]}px; height: ${/*height*/
      G[10]}px; padding-bottom: 3rem;`)) && f(q, "style", j), mt[
        /*key*/
        G[0]
      ] ? ie ? ie.p(G, W) : (ie = Nd(G), ie.c(), ie.m(e, z)) : ie && (ie.d(1), ie = null), /*showTooltip*/
      G[18] ? U ? (U.p(G, W), W[0] & /*showTooltip*/
      262144 && S(U, 1)) : (U = Ad(G), U.c(), S(U, 1), U.m(e, null)) : U && (ge(), D(U, 1, 1, () => {
        U = null;
      }), be());
    },
    i(G) {
      N || (S(B), S(X), S(J), S(te), S(U), N = !0);
    },
    o(G) {
      D(B), D(X), D(J), D(te), D(U), N = !1;
    },
    d(G) {
      G && T(e), B && B.d(), I && I.d(), Ge(F, G), X && X.d(), Ge(Q, G), J && J.d(), te && te.d(), ie && ie.d(), U && U.d(), M = !1, vt(H);
    }
  };
}
let Xa = 45, Ng = 15, Ga = 20;
const Ed = (t, e) => t - e;
function K5(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(p, (ue) => l(21, i = ue)), p), r, s;
  t.$$.on_destroy.push(() => n());
  let { key: o = "", qubit_edges: u, qubit_nodes: c, qubit_index: d, addToBasket: h, basket: p, level: b = 1, qubit_info: g, gate_info: v } = e;
  a();
  const y = ["id", "rz", "sx"], k = ["cx", "ecr"];
  let w, $, q, j = 0, O = 0, z = 0, N = 0, M = [], H = [], B = Pe(), R = Pe();
  at(t, B, (ue) => l(23, s = ue)), at(t, R, (ue) => l(22, r = ue));
  function P(ue) {
    if (j = Math.max(...(ue == null ? void 0 : ue.map((x) => x.y)) ?? [0]) + 1, O = Math.max(...(ue == null ? void 0 : ue.map((x) => x.x)) ?? [0]) + 1, l(9, z = (O - 1) * Xa + Ga * 2), l(10, N = j * Xa + Ga * 2), l(8, q = {}), ue)
      for (const x of ue)
        l(8, q[x.index] = x, q);
    g && l(11, M = Object.keys(g[0]).filter((x) => x !== "index").map((x) => ({ feature: x })));
    let ne = [], oe = [];
    l(12, H = []), v.forEach((x) => {
      k.includes(x.gate) && !oe.includes(x.gate) && (H.push({ gate: x.gate, type: "error" }), H.push({ gate: x.gate, type: "length" }), oe.push(x.gate)), y.includes(x.gate) && !ne.includes(x.gate) && (M.push({ gate: x.gate, type: "error" }), M.push({ gate: x.gate, type: "length" }), ne.push(x.gate));
    }), B.set(M[0]), R.set(H[0]);
  }
  let I = [], L = {}, F, X, V, Q, J;
  B.subscribe((ue) => {
    if (l(13, I = []), ue != null && ue.feature) {
      l(13, I = g.map((ve) => ve[ue.feature]));
      let ne = I.map((ve) => ve.value), [oe, x] = [Math.min(...ne), Math.max(...ne)];
      l(15, F = {
        min: oe,
        max: x,
        mean: Qi(ne),
        median: Vi(ne),
        values: ne
      }), ["frequency", "readout_error"].includes(ue.feature) ? l(6, w = yl(Dl).domain([x, oe])) : l(6, w = yl(Dl).domain([oe, x]));
    } else if (ue != null && ue.gate) {
      l(13, I = v.filter((ve) => ve.gate === ue.gate).map((ve) => (ve.qubit = ve.qubits[0], ve)).toSorted((ve, se) => ve.qubit - se.qubit));
      let ne = I.map((ve) => ve.parameters["gate_" + ue.type].value), [oe, x] = [Math.min(...ne), Math.max(...ne)];
      l(15, F = {
        min: oe,
        max: x,
        mean: Qi(ne),
        median: Vi(ne),
        values: ne
      }), l(6, w = yl(Dl).domain([x, oe]));
    }
  }), R.subscribe((ue) => {
    if (l(14, L = {}), ue != null && ue.gate) {
      v.filter((se) => se.gate === ue.gate).forEach((se) => {
        l(14, L[se.qubits.join("-")] = se, L);
      });
      let oe = Object.keys(L).map((se) => {
        var Re;
        return (Re = L[se].parameters["gate_" + ue.type]) == null ? void 0 : Re.value;
      }), [x, ve] = [Math.min(...oe), Math.max(...oe)];
      l(16, X = {
        min: x,
        max: ve,
        mean: Qi(oe),
        median: Vi(oe),
        values: oe
      }), l(7, $ = yl(Dl).domain([ve, x]));
    }
  });
  let te = !1, ie, U = !1, G = {};
  function W(ue, ne, oe, x, ve, se, Re) {
    U && !Re || (l(18, te = !0), l(20, G = { item: ne, key: oe, value: x }), U = Re, l(19, ie = ue.target.offsetTop + 100), Array.from(document.querySelectorAll(".circuit-element")).forEach((Ce) => {
      Ce.style.outline = null;
    }), document.querySelector("#" + ve) && (document.querySelector("#" + ve).style.outline = "2px solid black"), oe.feature === "T1" ? (Q = "backend.properties().t1(", J = ")") : oe.feature === "T2" ? (Q = "backend.properties().t2(", J = ")") : oe.feature === "frequency" ? (Q = "backend.properties().frequency(", J = ")") : oe.feature === "readout_error" ? (Q = "backend.properties().readout_error(", J = ")") : oe.feature === "readout_length" ? (Q = "backend.properties().readout_length(", J = ")") : oe.feature === "prob_meas0_prep1" ? (Q = "backend.properties().qubit_property(", J = ', "prob_meas0_prep1")') : oe.feature === "prob_meas1_prep0" ? (Q = "backend.properties().qubit_property(", J = ', "prob_meas1_prep0")') : oe.gate && (Q = `backend.properties().gate_${oe.type}(${oe.gate}, [`, J = "])"), l(17, V = `circuit_${oe.gate ? oe.gate + "_" + oe.type : oe.feature}_${se.join("_")} = ${Q}${se.join(",")}${J}`));
  }
  function Z(ue) {
    te && (ue.screenX - bd.x, l(19, ie = ue.screenY - bd.y));
  }
  function ee(ue) {
    U || l(18, te = !1), ue && (l(18, te = !1), l(20, G = void 0), U = !1, Array.from(document.querySelectorAll(".circuit-element")).forEach((ne) => {
      ne.style.outline = null;
    }));
  }
  yt(() => {
    P(c);
  });
  const ye = () => {
    h(o);
  }, qe = (ue) => {
    B.set(JSON.parse(ue.target.value));
  }, je = (ue) => {
    R.set(JSON.parse(ue.target.value));
  }, fe = () => {
    ee(!0);
  }, _e = (ue) => q[ue], K = () => {
    h(V);
  }, ke = () => {
    ee(!0);
  };
  return t.$$set = (ue) => {
    "key" in ue && l(0, o = ue.key), "qubit_edges" in ue && l(1, u = ue.qubit_edges), "qubit_nodes" in ue && l(29, c = ue.qubit_nodes), "qubit_index" in ue && l(2, d = ue.qubit_index), "addToBasket" in ue && l(3, h = ue.addToBasket), "basket" in ue && a(l(4, p = ue.basket)), "level" in ue && l(5, b = ue.level), "qubit_info" in ue && l(30, g = ue.qubit_info), "gate_info" in ue && l(31, v = ue.gate_info);
  }, [
    o,
    u,
    d,
    h,
    p,
    b,
    w,
    $,
    q,
    z,
    N,
    M,
    H,
    I,
    L,
    F,
    X,
    V,
    te,
    ie,
    G,
    i,
    r,
    s,
    B,
    R,
    W,
    Z,
    ee,
    c,
    g,
    v,
    ye,
    qe,
    je,
    fe,
    _e,
    K,
    ke
  ];
}
class U5 extends Ve {
  constructor(e) {
    super(), Qe(
      this,
      e,
      K5,
      Y5,
      Le,
      {
        key: 0,
        qubit_edges: 1,
        qubit_nodes: 29,
        qubit_index: 2,
        addToBasket: 3,
        basket: 4,
        level: 5,
        qubit_info: 30,
        gate_info: 31
      },
      null,
      [-1, -1]
    );
  }
}
function Od(t, e, l) {
  const i = t.slice();
  return i[13] = e[l], i[15] = l, i;
}
function Id(t, e, l) {
  const i = t.slice();
  return i[13] = e[l], i[17] = l, i;
}
function Dd(t, e, l) {
  const i = t.slice();
  return i[13] = e[l], i[17] = l, i;
}
function Rd(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-aa04ir");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler*/
        t[11]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s & /*$basket, key*/
      129 && (o.on = /*$basket*/
      r[7].includes(
        /*key*/
        r[0]
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function W5(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), f(e, "class", "svelte-aa04ir");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function J5(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), f(e, "class", "svelte-aa04ir");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function Hd(t) {
  let e;
  return {
    c() {
      e = m("th"), e.textContent = `${/*j*/
      t[17]}`, f(e, "class", "svelte-aa04ir");
    },
    m(l, i) {
      C(l, e, i);
    },
    p: ae,
    d(l) {
      l && T(e);
    }
  };
}
function Fd(t) {
  var a, r;
  let e, l = (
    /*value*/
    ((r = (a = t[1]) == null ? void 0 : a[
      /*i*/
      t[15]
    ]) == null ? void 0 : r[
      /*j*/
      t[17]
    ]) + ""
  ), i, n;
  return {
    c() {
      var s, o;
      e = m("td"), i = E(l), f(e, "style", n = `background-color: rgba(255, 102, 13, ${/*colorFunc*/
      t[6](
        /*value*/
        (o = (s = t[1]) == null ? void 0 : s[
          /*i*/
          t[15]
        ]) == null ? void 0 : o[
          /*j*/
          t[17]
        ]
      )})`), f(e, "class", "svelte-aa04ir");
    },
    m(s, o) {
      C(s, e, o), _(e, i);
    },
    p(s, o) {
      var u, c, d, h;
      o & /*value*/
      2 && l !== (l = /*value*/
      ((c = (u = s[1]) == null ? void 0 : u[
        /*i*/
        s[15]
      ]) == null ? void 0 : c[
        /*j*/
        s[17]
      ]) + "") && Y(i, l), o & /*colorFunc, value*/
      66 && n !== (n = `background-color: rgba(255, 102, 13, ${/*colorFunc*/
      s[6](
        /*value*/
        (h = (d = s[1]) == null ? void 0 : d[
          /*i*/
          s[15]
        ]) == null ? void 0 : h[
          /*j*/
          s[17]
        ]
      )})`) && f(e, "style", n);
    },
    d(s) {
      s && T(e);
    }
  };
}
function Ld(t) {
  let e, l, i, n, a = we(Array(
    /*size*/
    t[5][1]
  )), r = [];
  for (let s = 0; s < a.length; s += 1)
    r[s] = Fd(Id(t, a, s));
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = `${/*i*/
      t[15]}`, i = A();
      for (let s = 0; s < r.length; s += 1)
        r[s].c();
      n = A(), f(l, "class", "svelte-aa04ir");
    },
    m(s, o) {
      C(s, e, o), _(e, l), _(e, i);
      for (let u = 0; u < r.length; u += 1)
        r[u] && r[u].m(e, null);
      _(e, n);
    },
    p(s, o) {
      if (o & /*colorFunc, value, size*/
      98) {
        a = we(Array(
          /*size*/
          s[5][1]
        ));
        let u;
        for (u = 0; u < a.length; u += 1) {
          const c = Id(s, a, u);
          r[u] ? r[u].p(c, o) : (r[u] = Fd(c), r[u].c(), r[u].m(e, n));
        }
        for (; u < r.length; u += 1)
          r[u].d(1);
        r.length = a.length;
      }
    },
    d(s) {
      s && T(e), Ge(r, s);
    }
  };
}
function Qd(t) {
  let e, l = mt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), f(e, "class", "desc svelte-aa04ir");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = mt[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function Z5(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b = (
    /*addToBasket*/
    t[2] && Rd(t)
  );
  function g(O, z) {
    if (
      /*level*/
      O[4] == 1
    )
      return J5;
    if (
      /*level*/
      O[4] == 2
    )
      return W5;
  }
  let v = g(t), y = v && v(t), k = we(Array(
    /*size*/
    t[5][1]
  )), w = [];
  for (let O = 0; O < k.length; O += 1)
    w[O] = Hd(Dd(t, k, O));
  let $ = we(Array(
    /*size*/
    t[5][0]
  )), q = [];
  for (let O = 0; O < $.length; O += 1)
    q[O] = Ld(Od(t, $, O));
  let j = mt[
    /*key*/
    t[0]
  ] && Qd(t);
  return {
    c() {
      e = m("article"), b && b.c(), l = A(), y && y.c(), i = A(), n = m("div"), a = m("table"), r = m("thead"), s = m("tr"), o = m("th"), u = A();
      for (let O = 0; O < w.length; O += 1)
        w[O].c();
      c = A(), d = m("tbody");
      for (let O = 0; O < q.length; O += 1)
        q[O].c();
      h = A(), j && j.c(), f(o, "class", "svelte-aa04ir"), f(a, "class", "svelte-aa04ir"), f(n, "class", "content-wrap svelte-aa04ir"), f(e, "class", "svelte-aa04ir");
    },
    m(O, z) {
      C(O, e, z), b && b.m(e, null), _(e, l), y && y.m(e, null), _(e, i), _(e, n), _(n, a), _(a, r), _(r, s), _(s, o), _(s, u);
      for (let N = 0; N < w.length; N += 1)
        w[N] && w[N].m(s, null);
      _(a, c), _(a, d);
      for (let N = 0; N < q.length; N += 1)
        q[N] && q[N].m(d, null);
      _(e, h), j && j.m(e, null), p = !0;
    },
    p(O, [z]) {
      if (/*addToBasket*/
      O[2] ? b ? (b.p(O, z), z & /*addToBasket*/
      4 && S(b, 1)) : (b = Rd(O), b.c(), S(b, 1), b.m(e, l)) : b && (ge(), D(b, 1, 1, () => {
        b = null;
      }), be()), v === (v = g(O)) && y ? y.p(O, z) : (y && y.d(1), y = v && v(O), y && (y.c(), y.m(e, i))), z & /*size*/
      32) {
        k = we(Array(
          /*size*/
          O[5][1]
        ));
        let N;
        for (N = 0; N < k.length; N += 1) {
          const M = Dd(O, k, N);
          w[N] ? w[N].p(M, z) : (w[N] = Hd(M), w[N].c(), w[N].m(s, null));
        }
        for (; N < w.length; N += 1)
          w[N].d(1);
        w.length = k.length;
      }
      if (z & /*Array, size, colorFunc, value*/
      98) {
        $ = we(Array(
          /*size*/
          O[5][0]
        ));
        let N;
        for (N = 0; N < $.length; N += 1) {
          const M = Od(O, $, N);
          q[N] ? q[N].p(M, z) : (q[N] = Ld(M), q[N].c(), q[N].m(d, null));
        }
        for (; N < q.length; N += 1)
          q[N].d(1);
        q.length = $.length;
      }
      mt[
        /*key*/
        O[0]
      ] ? j ? j.p(O, z) : (j = Qd(O), j.c(), j.m(e, null)) : j && (j.d(1), j = null);
    },
    i(O) {
      p || (S(b), p = !0);
    },
    o(O) {
      D(b), p = !1;
    },
    d(O) {
      O && T(e), b && b.d(), y && y.d(), Ge(w, O), Ge(q, O), j && j.d();
    }
  };
}
function x5(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, (k) => l(7, i = k)), u);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: u, level: c = 1, code_header: d = "", code_type: h = "", code_footer: p = "" } = e;
  a();
  let b = [0, 0], g = () => {
  }, v = 1;
  yt(() => {
    var k;
    s && (l(5, b[0] = (s == null ? void 0 : s.length) || 0, b), l(5, b[1] = ((k = s == null ? void 0 : s[0]) == null ? void 0 : k.length) || 0, b), v = Math.max(...s == null ? void 0 : s.map((w) => Math.max(...w))), l(6, g = (w) => (1 - w / v) * 0.8));
  });
  const y = () => {
    o(r);
  };
  return t.$$set = (k) => {
    "key" in k && l(0, r = k.key), "value" in k && l(1, s = k.value), "addToBasket" in k && l(2, o = k.addToBasket), "basket" in k && a(l(3, u = k.basket)), "level" in k && l(4, c = k.level), "code_header" in k && l(8, d = k.code_header), "code_type" in k && l(9, h = k.code_type), "code_footer" in k && l(10, p = k.code_footer);
  }, [
    r,
    s,
    o,
    u,
    c,
    b,
    g,
    i,
    d,
    h,
    p,
    y
  ];
}
class e$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, x5, Z5, Le, {
      key: 0,
      value: 1,
      addToBasket: 2,
      basket: 3,
      level: 4,
      code_header: 8,
      code_type: 9,
      code_footer: 10
    });
  }
}
function Vd(t, e, l) {
  const i = t.slice();
  return i[11] = e[l], i[13] = l, i;
}
function Xd(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1dv3ar6");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler*/
        t[9]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s & /*$basket, key*/
      129 && (o.on = /*$basket*/
      r[7].includes(
        /*key*/
        r[0]
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function t$(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), f(e, "class", "svelte-1dv3ar6");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function l$(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), f(e, "class", "svelte-1dv3ar6");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function Gd(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(`${/*key*/
        t[0]}_${/*i*/
        t[13]} = ${/*code_header*/
        t[5]}${/*i*/
        t[13]}${/*code_footer*/
        t[6]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_1*/
      t[10](
        /*i*/
        t[13]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1dv3ar6");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o & /*$basket, key, code_header, code_footer*/
      225 && (u.on = /*$basket*/
      t[7].includes(`${/*key*/
      t[0]}_${/*i*/
      t[13]} = ${/*code_header*/
      t[5]}${/*i*/
      t[13]}${/*code_footer*/
      t[6]}`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function Yd(t) {
  let e, l, i, n, a = (
    /*v*/
    t[11] + ""
  ), r, s, o, u, c, d = (
    /*addToBasket*/
    t[2] && Gd(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), l.textContent = `${/*i*/
      t[13]}`, i = A(), n = m("div"), r = E(a), s = A(), o = m("div"), d && d.c(), u = A(), f(l, "class", "i svelte-1dv3ar6"), f(n, "class", "v svelte-1dv3ar6"), f(o, "class", "b svelte-1dv3ar6"), f(e, "class", "chip svelte-1dv3ar6");
    },
    m(h, p) {
      C(h, e, p), _(e, l), _(e, i), _(e, n), _(n, r), _(e, s), _(e, o), d && d.m(o, null), _(e, u), c = !0;
    },
    p(h, p) {
      (!c || p & /*value*/
      2) && a !== (a = /*v*/
      h[11] + "") && Y(r, a), /*addToBasket*/
      h[2] ? d ? (d.p(h, p), p & /*addToBasket*/
      4 && S(d, 1)) : (d = Gd(h), d.c(), S(d, 1), d.m(o, null)) : d && (ge(), D(d, 1, 1, () => {
        d = null;
      }), be());
    },
    i(h) {
      c || (S(d), c = !0);
    },
    o(h) {
      D(d), c = !1;
    },
    d(h) {
      h && T(e), d && d.d();
    }
  };
}
function Kd(t) {
  let e, l = mt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), f(e, "class", "desc svelte-1dv3ar6");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = mt[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function i$(t) {
  let e, l, i, n, a, r, s = (
    /*addToBasket*/
    t[2] && Xd(t)
  );
  function o(g, v) {
    if (
      /*level*/
      g[4] == 1
    )
      return l$;
    if (
      /*level*/
      g[4] == 2
    )
      return t$;
  }
  let u = o(t), c = u && u(t), d = we(
    /*value*/
    t[1]
  ), h = [];
  for (let g = 0; g < d.length; g += 1)
    h[g] = Yd(Vd(t, d, g));
  const p = (g) => D(h[g], 1, 1, () => {
    h[g] = null;
  });
  let b = mt[
    /*key*/
    t[0]
  ] && Kd(t);
  return {
    c() {
      e = m("article"), s && s.c(), l = A(), c && c.c(), i = A(), n = m("div");
      for (let g = 0; g < h.length; g += 1)
        h[g].c();
      a = A(), b && b.c(), f(n, "class", "value svelte-1dv3ar6"), f(e, "class", "svelte-1dv3ar6");
    },
    m(g, v) {
      C(g, e, v), s && s.m(e, null), _(e, l), c && c.m(e, null), _(e, i), _(e, n);
      for (let y = 0; y < h.length; y += 1)
        h[y] && h[y].m(n, null);
      _(e, a), b && b.m(e, null), r = !0;
    },
    p(g, [v]) {
      if (/*addToBasket*/
      g[2] ? s ? (s.p(g, v), v & /*addToBasket*/
      4 && S(s, 1)) : (s = Xd(g), s.c(), S(s, 1), s.m(e, l)) : s && (ge(), D(s, 1, 1, () => {
        s = null;
      }), be()), u === (u = o(g)) && c ? c.p(g, v) : (c && c.d(1), c = u && u(g), c && (c.c(), c.m(e, i))), v & /*addToBasket, key, code_header, code_footer, $basket, value*/
      231) {
        d = we(
          /*value*/
          g[1]
        );
        let y;
        for (y = 0; y < d.length; y += 1) {
          const k = Vd(g, d, y);
          h[y] ? (h[y].p(k, v), S(h[y], 1)) : (h[y] = Yd(k), h[y].c(), S(h[y], 1), h[y].m(n, null));
        }
        for (ge(), y = d.length; y < h.length; y += 1)
          p(y);
        be();
      }
      mt[
        /*key*/
        g[0]
      ] ? b ? b.p(g, v) : (b = Kd(g), b.c(), b.m(e, null)) : b && (b.d(1), b = null);
    },
    i(g) {
      if (!r) {
        S(s);
        for (let v = 0; v < d.length; v += 1)
          S(h[v]);
        r = !0;
      }
    },
    o(g) {
      D(s), h = h.filter(Boolean);
      for (let v = 0; v < h.length; v += 1)
        D(h[v]);
      r = !1;
    },
    d(g) {
      g && T(e), s && s.d(), c && c.d(), Ge(h, g), b && b.d();
    }
  };
}
function n$(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, (v) => l(7, i = v)), u);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: u, level: c = 1, code_header: d = "", code_type: h = "", code_footer: p = "" } = e;
  a(), yt(() => {
  });
  const b = () => {
    o(r);
  }, g = (v) => {
    o(`${r}_${v} = ${d}${v}${p}`);
  };
  return t.$$set = (v) => {
    "key" in v && l(0, r = v.key), "value" in v && l(1, s = v.value), "addToBasket" in v && l(2, o = v.addToBasket), "basket" in v && a(l(3, u = v.basket)), "level" in v && l(4, c = v.level), "code_header" in v && l(5, d = v.code_header), "code_type" in v && l(8, h = v.code_type), "code_footer" in v && l(6, p = v.code_footer);
  }, [
    r,
    s,
    o,
    u,
    c,
    d,
    p,
    i,
    h,
    b,
    g
  ];
}
class Ag extends Ve {
  constructor(e) {
    super(), Qe(this, e, n$, i$, Le, {
      key: 0,
      value: 1,
      addToBasket: 2,
      basket: 3,
      level: 4,
      code_header: 5,
      code_type: 8,
      code_footer: 6
    });
  }
}
function Ud(t, e, l) {
  const i = t.slice();
  return i[11] = e[l], i;
}
function Wd(t) {
  let e, l, i, n;
  l = new Cg({
    props: {
      title: (
        /*section_meta*/
        t[4].title || ft[
          /*section_meta*/
          t[4].key
        ]
      ),
      note: (
        /*is_prop_timed*/
        t[5] && /*$property_time*/
        t[9] !== "current" ? "Collected at: " + /*$property_time*/
        t[9] : ""
      ),
      toggleSection: (
        /*toggleSection*/
        t[10]
      ),
      hide: (
        /*hide*/
        t[7]
      ),
      level: 2
    }
  });
  let a = !/*hide*/
  t[7] && Jd(t);
  return {
    c() {
      e = m("section"), he(l.$$.fragment), i = A(), a && a.c(), f(e, "class", "svelte-1fzr24z");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), _(e, i), a && a.m(e, null), n = !0;
    },
    p(r, s) {
      const o = {};
      s & /*section_meta*/
      16 && (o.title = /*section_meta*/
      r[4].title || ft[
        /*section_meta*/
        r[4].key
      ]), s & /*is_prop_timed, $property_time*/
      544 && (o.note = /*is_prop_timed*/
      r[5] && /*$property_time*/
      r[9] !== "current" ? "Collected at: " + /*$property_time*/
      r[9] : ""), s & /*hide*/
      128 && (o.hide = /*hide*/
      r[7]), l.$set(o), /*hide*/
      r[7] ? a && (ge(), D(a, 1, 1, () => {
        a = null;
      }), be()) : a ? (a.p(r, s), s & /*hide*/
      128 && S(a, 1)) : (a = Jd(r), a.c(), S(a, 1), a.m(e, null));
    },
    i(r) {
      n || (S(l.$$.fragment, r), S(a), n = !0);
    },
    o(r) {
      D(l.$$.fragment, r), D(a), n = !1;
    },
    d(r) {
      r && T(e), de(l), a && a.d();
    }
  };
}
function Jd(t) {
  var r;
  let e, l, i = we(
    /*section_meta*/
    (r = t[4]) == null ? void 0 : r.order
  ), n = [];
  for (let s = 0; s < i.length; s += 1)
    n[s] = Zd(Ud(t, i, s));
  const a = (s) => D(n[s], 1, 1, () => {
    n[s] = null;
  });
  return {
    c() {
      e = m("div");
      for (let s = 0; s < n.length; s += 1)
        n[s].c();
      f(e, "class", "panel svelte-1fzr24z");
    },
    m(s, o) {
      C(s, e, o);
      for (let u = 0; u < n.length; u += 1)
        n[u] && n[u].m(e, null);
      l = !0;
    },
    p(s, o) {
      var u;
      if (o & /*section_meta, is_prop_timed, $property_time, $data, addToBasket, basket, openTimeMachine, property_time*/
      894) {
        i = we(
          /*section_meta*/
          (u = s[4]) == null ? void 0 : u.order
        );
        let c;
        for (c = 0; c < i.length; c += 1) {
          const d = Ud(s, i, c);
          n[c] ? (n[c].p(d, o), S(n[c], 1)) : (n[c] = Zd(d), n[c].c(), S(n[c], 1), n[c].m(e, null));
        }
        for (ge(), c = i.length; c < n.length; c += 1)
          a(c);
        be();
      }
    },
    i(s) {
      if (!l) {
        for (let o = 0; o < i.length; o += 1)
          S(n[o]);
        l = !0;
      }
    },
    o(s) {
      n = n.filter(Boolean);
      for (let o = 0; o < n.length; o += 1)
        D(n[o]);
      l = !1;
    },
    d(s) {
      s && T(e), Ge(n, s);
    }
  };
}
function a$(t) {
  var i;
  let e, l;
  return e = new tr({
    props: {
      key: (
        /*sub*/
        t[11]
      ),
      value: (
        /*$data*/
        (i = t[8][
          /*section_meta*/
          t[4].key
        ]) == null ? void 0 : i[
          /*sub*/
          t[11]
        ]
      ),
      level: 2,
      addToBasket: (
        /*addToBasket*/
        t[1]
      ),
      basket: (
        /*basket*/
        t[3]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(n, a) {
      ce(e, n, a), l = !0;
    },
    p(n, a) {
      var s;
      const r = {};
      a & /*section_meta*/
      16 && (r.key = /*sub*/
      n[11]), a & /*$data, section_meta*/
      272 && (r.value = /*$data*/
      (s = n[8][
        /*section_meta*/
        n[4].key
      ]) == null ? void 0 : s[
        /*sub*/
        n[11]
      ]), a & /*addToBasket*/
      2 && (r.addToBasket = /*addToBasket*/
      n[1]), a & /*basket*/
      8 && (r.basket = /*basket*/
      n[3]), e.$set(r);
    },
    i(n) {
      l || (S(e.$$.fragment, n), l = !0);
    },
    o(n) {
      D(e.$$.fragment, n), l = !1;
    },
    d(n) {
      de(e, n);
    }
  };
}
function r$(t) {
  let e, l;
  return e = new Ag({
    props: {
      key: (
        /*sub*/
        t[11]
      ),
      value: (
        /*$data*/
        t[8][
          /*section_meta*/
          t[4].key
        ][
          /*sub*/
          t[11]
        ]
      ),
      level: 2,
      code_header: "backend.defaults().meas_freq_est[",
      code_footer: "]",
      addToBasket: (
        /*addToBasket*/
        t[1]
      ),
      basket: (
        /*basket*/
        t[3]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      16 && (a.key = /*sub*/
      i[11]), n & /*$data, section_meta*/
      272 && (a.value = /*$data*/
      i[8][
        /*section_meta*/
        i[4].key
      ][
        /*sub*/
        i[11]
      ]), n & /*addToBasket*/
      2 && (a.addToBasket = /*addToBasket*/
      i[1]), n & /*basket*/
      8 && (a.basket = /*basket*/
      i[3]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function s$(t) {
  let e, l;
  return e = new Ag({
    props: {
      key: (
        /*sub*/
        t[11]
      ),
      value: (
        /*$data*/
        t[8][
          /*section_meta*/
          t[4].key
        ][
          /*sub*/
          t[11]
        ]
      ),
      level: 2,
      code_header: "backend.defaults().qubit_freq_est[",
      code_footer: "]",
      addToBasket: (
        /*addToBasket*/
        t[1]
      ),
      basket: (
        /*basket*/
        t[3]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      16 && (a.key = /*sub*/
      i[11]), n & /*$data, section_meta*/
      272 && (a.value = /*$data*/
      i[8][
        /*section_meta*/
        i[4].key
      ][
        /*sub*/
        i[11]
      ]), n & /*addToBasket*/
      2 && (a.addToBasket = /*addToBasket*/
      i[1]), n & /*basket*/
      8 && (a.basket = /*basket*/
      i[3]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function o$(t) {
  let e, l;
  return e = new e$({
    props: {
      key: (
        /*sub*/
        t[11]
      ),
      value: (
        /*$data*/
        t[8][
          /*section_meta*/
          t[4].key
        ][
          /*sub*/
          t[11]
        ]
      ),
      level: 2,
      addToBasket: (
        /*addToBasket*/
        t[1]
      ),
      basket: (
        /*basket*/
        t[3]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      16 && (a.key = /*sub*/
      i[11]), n & /*$data, section_meta*/
      272 && (a.value = /*$data*/
      i[8][
        /*section_meta*/
        i[4].key
      ][
        /*sub*/
        i[11]
      ]), n & /*addToBasket*/
      2 && (a.addToBasket = /*addToBasket*/
      i[1]), n & /*basket*/
      8 && (a.basket = /*basket*/
      i[3]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function u$(t) {
  let e, l;
  return e = new U5({
    props: {
      key: (
        /*sub*/
        t[11]
      ),
      qubit_edges: (
        /*$data*/
        t[8][
          /*section_meta*/
          t[4].key
        ].edges
      ),
      qubit_nodes: (
        /*$data*/
        t[8].circuit_nodes
      ),
      qubit_index: (
        /*$data*/
        t[8][
          /*section_meta*/
          t[4].key
        ].nodes
      ),
      qubit_info: (
        /*$data*/
        t[8].properties.qubits
      ),
      gate_info: (
        /*$data*/
        t[8].properties.gates
      ),
      level: 2,
      addToBasket: (
        /*addToBasket*/
        t[1]
      ),
      basket: (
        /*basket*/
        t[3]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      16 && (a.key = /*sub*/
      i[11]), n & /*$data, section_meta*/
      272 && (a.qubit_edges = /*$data*/
      i[8][
        /*section_meta*/
        i[4].key
      ].edges), n & /*$data*/
      256 && (a.qubit_nodes = /*$data*/
      i[8].circuit_nodes), n & /*$data, section_meta*/
      272 && (a.qubit_index = /*$data*/
      i[8][
        /*section_meta*/
        i[4].key
      ].nodes), n & /*$data*/
      256 && (a.qubit_info = /*$data*/
      i[8].properties.qubits), n & /*$data*/
      256 && (a.gate_info = /*$data*/
      i[8].properties.gates), n & /*addToBasket*/
      2 && (a.addToBasket = /*addToBasket*/
      i[1]), n & /*basket*/
      8 && (a.basket = /*basket*/
      i[3]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function f$(t) {
  let e, l;
  return e = new Sg({
    props: {
      key: (
        /*sub*/
        t[11]
      ),
      parentKey: (
        /*sub*/
        t[11]
      ),
      topLevelKey: (
        /*section_meta*/
        t[4].key
      ),
      value: (
        /*is_prop_timed*/
        (t[5] && /*$property_time*/
        t[9] !== "current" ? (
          /*$data*/
          t[8].timed_properties[
            /*$property_time*/
            t[9]
          ]
        ) : (
          /*$data*/
          t[8][
            /*section_meta*/
            t[4].key
          ]
        ))[
          /*sub*/
          t[11]
        ]
      ),
      level: 2,
      addToBasket: (
        /*addToBasket*/
        t[1]
      ),
      basket: (
        /*basket*/
        t[3]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      16 && (a.key = /*sub*/
      i[11]), n & /*section_meta*/
      16 && (a.parentKey = /*sub*/
      i[11]), n & /*section_meta*/
      16 && (a.topLevelKey = /*section_meta*/
      i[4].key), n & /*is_prop_timed, $property_time, $data, section_meta*/
      816 && (a.value = /*is_prop_timed*/
      (i[5] && /*$property_time*/
      i[9] !== "current" ? (
        /*$data*/
        i[8].timed_properties[
          /*$property_time*/
          i[9]
        ]
      ) : (
        /*$data*/
        i[8][
          /*section_meta*/
          i[4].key
        ]
      ))[
        /*sub*/
        i[11]
      ]), n & /*addToBasket*/
      2 && (a.addToBasket = /*addToBasket*/
      i[1]), n & /*basket*/
      8 && (a.basket = /*basket*/
      i[3]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function _$(t) {
  let e, l;
  return e = new tr({
    props: {
      key: (
        /*sub*/
        t[11]
      ),
      value: (
        /*is_prop_timed*/
        (t[5] && /*$property_time*/
        t[9] !== "current" ? (
          /*$data*/
          t[8].timed_properties[
            /*$property_time*/
            t[9]
          ]
        ) : (
          /*$data*/
          t[8][
            /*section_meta*/
            t[4].key
          ]
        ))[
          /*sub*/
          t[11]
        ].join(", ")
      ),
      parentKey: (
        /*sub*/
        t[11]
      ),
      topLevelKey: (
        /*section_meta*/
        t[4].key
      ),
      level: 2,
      addToBasket: (
        /*addToBasket*/
        t[1]
      ),
      basket: (
        /*basket*/
        t[3]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      16 && (a.key = /*sub*/
      i[11]), n & /*is_prop_timed, $property_time, $data, section_meta*/
      816 && (a.value = /*is_prop_timed*/
      (i[5] && /*$property_time*/
      i[9] !== "current" ? (
        /*$data*/
        i[8].timed_properties[
          /*$property_time*/
          i[9]
        ]
      ) : (
        /*$data*/
        i[8][
          /*section_meta*/
          i[4].key
        ]
      ))[
        /*sub*/
        i[11]
      ].join(", ")), n & /*section_meta*/
      16 && (a.parentKey = /*sub*/
      i[11]), n & /*section_meta*/
      16 && (a.topLevelKey = /*section_meta*/
      i[4].key), n & /*addToBasket*/
      2 && (a.addToBasket = /*addToBasket*/
      i[1]), n & /*basket*/
      8 && (a.basket = /*basket*/
      i[3]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function c$(t) {
  let e, l;
  return e = new O5({
    props: {
      key: (
        /*sub*/
        t[11]
      ),
      value: (
        /*is_prop_timed*/
        (t[5] && /*$property_time*/
        t[9] !== "current" ? (
          /*$data*/
          t[8].timed_properties[
            /*$property_time*/
            t[9]
          ]
        ) : (
          /*$data*/
          t[8][
            /*section_meta*/
            t[4].key
          ]
        ))[
          /*sub*/
          t[11]
        ]
      ),
      parentKey: (
        /*sub*/
        t[11]
      ),
      topLevelKey: (
        /*section_meta*/
        t[4].key
      ),
      level: 2,
      addToBasket: (
        /*addToBasket*/
        t[1]
      ),
      basket: (
        /*basket*/
        t[3]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[2]
      ),
      property_time: (
        /*property_time*/
        t[6]
      ),
      code_header: "backend.properties().qubit_property(",
      code_footer: ")"
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      16 && (a.key = /*sub*/
      i[11]), n & /*is_prop_timed, $property_time, $data, section_meta*/
      816 && (a.value = /*is_prop_timed*/
      (i[5] && /*$property_time*/
      i[9] !== "current" ? (
        /*$data*/
        i[8].timed_properties[
          /*$property_time*/
          i[9]
        ]
      ) : (
        /*$data*/
        i[8][
          /*section_meta*/
          i[4].key
        ]
      ))[
        /*sub*/
        i[11]
      ]), n & /*section_meta*/
      16 && (a.parentKey = /*sub*/
      i[11]), n & /*section_meta*/
      16 && (a.topLevelKey = /*section_meta*/
      i[4].key), n & /*addToBasket*/
      2 && (a.addToBasket = /*addToBasket*/
      i[1]), n & /*basket*/
      8 && (a.basket = /*basket*/
      i[3]), n & /*openTimeMachine*/
      4 && (a.openTimeMachine = /*openTimeMachine*/
      i[2]), n & /*property_time*/
      64 && (a.property_time = /*property_time*/
      i[6]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function d$(t) {
  var i;
  let e, l;
  return e = new Y4({
    props: {
      key: (
        /*sub*/
        t[11]
      ),
      value: (
        /*is_prop_timed*/
        (i = t[5] && /*$property_time*/
        t[9] !== "current" ? (
          /*$data*/
          t[8].timed_properties[
            /*$property_time*/
            t[9]
          ]
        ) : (
          /*$data*/
          t[8][
            /*section_meta*/
            t[4].key
          ]
        )) == null ? void 0 : i[
          /*sub*/
          t[11]
        ]
      ),
      parentKey: (
        /*sub*/
        t[11]
      ),
      topLevelKey: (
        /*section_meta*/
        t[4].key
      ),
      level: 2,
      addToBasket: (
        /*addToBasket*/
        t[1]
      ),
      basket: (
        /*basket*/
        t[3]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[2]
      ),
      code_header: "backend.properties().general_qlists[",
      code_footer: "]"
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(n, a) {
      ce(e, n, a), l = !0;
    },
    p(n, a) {
      var s;
      const r = {};
      a & /*section_meta*/
      16 && (r.key = /*sub*/
      n[11]), a & /*is_prop_timed, $property_time, $data, section_meta*/
      816 && (r.value = /*is_prop_timed*/
      (s = n[5] && /*$property_time*/
      n[9] !== "current" ? (
        /*$data*/
        n[8].timed_properties[
          /*$property_time*/
          n[9]
        ]
      ) : (
        /*$data*/
        n[8][
          /*section_meta*/
          n[4].key
        ]
      )) == null ? void 0 : s[
        /*sub*/
        n[11]
      ]), a & /*section_meta*/
      16 && (r.parentKey = /*sub*/
      n[11]), a & /*section_meta*/
      16 && (r.topLevelKey = /*section_meta*/
      n[4].key), a & /*addToBasket*/
      2 && (r.addToBasket = /*addToBasket*/
      n[1]), a & /*basket*/
      8 && (r.basket = /*basket*/
      n[3]), a & /*openTimeMachine*/
      4 && (r.openTimeMachine = /*openTimeMachine*/
      n[2]), e.$set(r);
    },
    i(n) {
      l || (S(e.$$.fragment, n), l = !0);
    },
    o(n) {
      D(e.$$.fragment, n), l = !1;
    },
    d(n) {
      de(e, n);
    }
  };
}
function h$(t) {
  let e, l;
  return e = new Sg({
    props: {
      key: (
        /*sub*/
        t[11]
      ),
      value: (
        /*is_prop_timed*/
        (t[5] && /*$property_time*/
        t[9] !== "current" ? (
          /*$data*/
          t[8].timed_properties[
            /*$property_time*/
            t[9]
          ]
        ) : (
          /*$data*/
          t[8][
            /*section_meta*/
            t[4].key
          ]
        ))[
          /*sub*/
          t[11]
        ]
      ),
      parentKey: (
        /*sub*/
        t[11]
      ),
      topLevelKey: (
        /*section_meta*/
        t[4].key
      ),
      level: 2,
      addToBasket: (
        /*addToBasket*/
        t[1]
      ),
      basket: (
        /*basket*/
        t[3]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[2]
      ),
      code_header: "backend.properties().gate_property(",
      code_footer: ")"
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      16 && (a.key = /*sub*/
      i[11]), n & /*is_prop_timed, $property_time, $data, section_meta*/
      816 && (a.value = /*is_prop_timed*/
      (i[5] && /*$property_time*/
      i[9] !== "current" ? (
        /*$data*/
        i[8].timed_properties[
          /*$property_time*/
          i[9]
        ]
      ) : (
        /*$data*/
        i[8][
          /*section_meta*/
          i[4].key
        ]
      ))[
        /*sub*/
        i[11]
      ]), n & /*section_meta*/
      16 && (a.parentKey = /*sub*/
      i[11]), n & /*section_meta*/
      16 && (a.topLevelKey = /*section_meta*/
      i[4].key), n & /*addToBasket*/
      2 && (a.addToBasket = /*addToBasket*/
      i[1]), n & /*basket*/
      8 && (a.basket = /*basket*/
      i[3]), n & /*openTimeMachine*/
      4 && (a.openTimeMachine = /*openTimeMachine*/
      i[2]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function p$(t) {
  let e, l;
  return e = new D4({
    props: {
      key: (
        /*sub*/
        t[11]
      ),
      value: (
        /*is_prop_timed*/
        (t[5] && /*$property_time*/
        t[9] !== "current" ? (
          /*$data*/
          t[8].timed_properties[
            /*$property_time*/
            t[9]
          ]
        ) : (
          /*$data*/
          t[8][
            /*section_meta*/
            t[4].key
          ]
        ))[
          /*sub*/
          t[11]
        ]
      ),
      parentKey: (
        /*sub*/
        t[11]
      ),
      topLevelKey: (
        /*section_meta*/
        t[4].key
      ),
      level: 2,
      addToBasket: (
        /*addToBasket*/
        t[1]
      ),
      basket: (
        /*basket*/
        t[3]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[2]
      ),
      code_header: 'list(fliter(lambda x: x.name == "',
      code_footer: '", backend.properties().general))[0]'
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      16 && (a.key = /*sub*/
      i[11]), n & /*is_prop_timed, $property_time, $data, section_meta*/
      816 && (a.value = /*is_prop_timed*/
      (i[5] && /*$property_time*/
      i[9] !== "current" ? (
        /*$data*/
        i[8].timed_properties[
          /*$property_time*/
          i[9]
        ]
      ) : (
        /*$data*/
        i[8][
          /*section_meta*/
          i[4].key
        ]
      ))[
        /*sub*/
        i[11]
      ]), n & /*section_meta*/
      16 && (a.parentKey = /*sub*/
      i[11]), n & /*section_meta*/
      16 && (a.topLevelKey = /*section_meta*/
      i[4].key), n & /*addToBasket*/
      2 && (a.addToBasket = /*addToBasket*/
      i[1]), n & /*basket*/
      8 && (a.basket = /*basket*/
      i[3]), n & /*openTimeMachine*/
      4 && (a.openTimeMachine = /*openTimeMachine*/
      i[2]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Zd(t) {
  let e, l, i, n;
  const a = [
    p$,
    h$,
    d$,
    c$,
    _$,
    f$,
    u$,
    o$,
    s$,
    r$,
    a$
  ], r = [];
  function s(o, u) {
    return (
      /*sub*/
      o[11] === "general" ? 0 : (
        /*sub*/
        o[11] === "gates" ? 1 : (
          /*sub*/
          o[11] === "general_qlists" ? 2 : (
            /*sub*/
            o[11] === "qubits" ? 3 : (
              /*sub*/
              o[11] === "faulty_qubits" ? 4 : (
                /*sub*/
                o[11] === "faulty_gates" ? 5 : (
                  /*sub*/
                  o[11] === "circuit_view" ? 6 : (
                    /*sub*/
                    o[11] === "distance_matrix" ? 7 : (
                      /*sub*/
                      o[11] === "qubit_freq_est" ? 8 : (
                        /*sub*/
                        o[11] === "meas_freq_est" ? 9 : 10
                      )
                    )
                  )
                )
              )
            )
          )
        )
      )
    );
  }
  return e = s(t), l = r[e] = a[e](t), {
    c() {
      l.c(), i = Be();
    },
    m(o, u) {
      r[e].m(o, u), C(o, i, u), n = !0;
    },
    p(o, u) {
      let c = e;
      e = s(o), e === c ? r[e].p(o, u) : (ge(), D(r[c], 1, 1, () => {
        r[c] = null;
      }), be(), l = r[e], l ? l.p(o, u) : (l = r[e] = a[e](o), l.c()), S(l, 1), l.m(i.parentNode, i));
    },
    i(o) {
      n || (S(l), n = !0);
    },
    o(o) {
      D(l), n = !1;
    },
    d(o) {
      o && T(i), r[e].d(o);
    }
  };
}
function m$(t) {
  let e, l, i = (
    /*$data*/
    t[8] && /*section_meta*/
    t[4] && Wd(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, e, a), l = !0;
    },
    p(n, [a]) {
      /*$data*/
      n[8] && /*section_meta*/
      n[4] ? i ? (i.p(n, a), a & /*$data, section_meta*/
      272 && S(i, 1)) : (i = Wd(n), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d(n);
    }
  };
}
function g$(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, (k) => l(8, i = k)), u), r, s = ae, o = () => (s(), s = rt(g, (k) => l(9, r = k)), g);
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => s());
  let { data: u = Pe() } = e;
  a();
  let { addToBasket: c = () => {
  } } = e, { openTimeMachine: d = () => {
  } } = e, { basket: h } = e, { section_meta: p } = e, { is_prop_timed: b } = e, { property_time: g = Pe() } = e;
  o();
  let v = !1;
  function y() {
    l(7, v = !v);
  }
  return yt(() => {
    (p == null ? void 0 : p.key) === "properties" && (p == null ? void 0 : p.title) === "Overall" && l(7, v = !0);
  }), t.$$set = (k) => {
    "data" in k && a(l(0, u = k.data)), "addToBasket" in k && l(1, c = k.addToBasket), "openTimeMachine" in k && l(2, d = k.openTimeMachine), "basket" in k && l(3, h = k.basket), "section_meta" in k && l(4, p = k.section_meta), "is_prop_timed" in k && l(5, b = k.is_prop_timed), "property_time" in k && o(l(6, g = k.property_time));
  }, [
    u,
    c,
    d,
    h,
    p,
    b,
    g,
    v,
    i,
    r,
    y
  ];
}
class b$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, g$, m$, Le, {
      data: 0,
      addToBasket: 1,
      openTimeMachine: 2,
      basket: 3,
      section_meta: 4,
      is_prop_timed: 5,
      property_time: 6
    });
  }
}
function xd(t, e, l) {
  const i = t.slice();
  return i[10] = e[l], i[12] = l, i;
}
function eh(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-rs5kk");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler*/
        t[8]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s & /*$basket, key*/
      129 && (o.on = /*$basket*/
      r[7].includes(
        /*key*/
        r[0]
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function v$(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), f(e, "class", "svelte-rs5kk");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function k$(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), f(e, "class", "svelte-rs5kk");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function th(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(`op_${/*key*/
        t[0]}_${/*gate*/
        t[10].name} = ${/*code_header*/
        t[5]}${/*gate*/
        t[10].name}${/*code_footer*/
        t[6]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_1*/
      t[9](
        /*gate*/
        t[10]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-rs5kk");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o & /*$basket, key, value, code_header, code_footer*/
      227 && (u.on = /*$basket*/
      t[7].includes(`op_${/*key*/
      t[0]}_${/*gate*/
      t[10].name} = ${/*code_header*/
      t[5]}${/*gate*/
      t[10].name}${/*code_footer*/
      t[6]}`)), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function lh(t) {
  var P;
  let e, l, i = (
    /*gate*/
    t[10].name + ""
  ), n, a, r, s = (
    /*gate*/
    t[10].type + ""
  ), o, u, c, d = (
    /*gate*/
    (t[10].num_qubits || "") + ""
  ), h, p, b, g = (
    /*gate*/
    (t[10].num_clbits || "") + ""
  ), v, y, k, w = (
    /*gate*/
    (((P = t[10].params) == null ? void 0 : P.join(", ")) || "") + ""
  ), $, q, j, O = (
    /*gate*/
    (t[10].mutable || "") + ""
  ), z, N, M, H, B, R = (
    /*addToBasket*/
    t[2] && th(t)
  );
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = A(), r = m("td"), o = E(s), u = A(), c = m("td"), h = E(d), p = A(), b = m("td"), v = E(g), y = A(), k = m("td"), $ = E(w), q = A(), j = m("td"), z = E(O), N = A(), M = m("th"), R && R.c(), H = A(), f(l, "class", "svelte-rs5kk"), f(r, "class", "svelte-rs5kk"), f(c, "class", "svelte-rs5kk"), f(b, "class", "svelte-rs5kk"), f(k, "class", "svelte-rs5kk"), f(j, "class", "svelte-rs5kk"), f(M, "class", "svelte-rs5kk");
    },
    m(I, L) {
      C(I, e, L), _(e, l), _(l, n), _(e, a), _(e, r), _(r, o), _(e, u), _(e, c), _(c, h), _(e, p), _(e, b), _(b, v), _(e, y), _(e, k), _(k, $), _(e, q), _(e, j), _(j, z), _(e, N), _(e, M), R && R.m(M, null), _(e, H), B = !0;
    },
    p(I, L) {
      var F;
      (!B || L & /*value*/
      2) && i !== (i = /*gate*/
      I[10].name + "") && Y(n, i), (!B || L & /*value*/
      2) && s !== (s = /*gate*/
      I[10].type + "") && Y(o, s), (!B || L & /*value*/
      2) && d !== (d = /*gate*/
      (I[10].num_qubits || "") + "") && Y(h, d), (!B || L & /*value*/
      2) && g !== (g = /*gate*/
      (I[10].num_clbits || "") + "") && Y(v, g), (!B || L & /*value*/
      2) && w !== (w = /*gate*/
      (((F = I[10].params) == null ? void 0 : F.join(", ")) || "") + "") && Y($, w), (!B || L & /*value*/
      2) && O !== (O = /*gate*/
      (I[10].mutable || "") + "") && Y(z, O), /*addToBasket*/
      I[2] ? R ? (R.p(I, L), L & /*addToBasket*/
      4 && S(R, 1)) : (R = th(I), R.c(), S(R, 1), R.m(M, null)) : R && (ge(), D(R, 1, 1, () => {
        R = null;
      }), be());
    },
    i(I) {
      B || (S(R), B = !0);
    },
    o(I) {
      D(R), B = !1;
    },
    d(I) {
      I && T(e), R && R.d();
    }
  };
}
function ih(t) {
  let e, l = mt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), f(e, "class", "desc svelte-rs5kk");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = mt[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function y$(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h = (
    /*addToBasket*/
    t[2] && eh(t)
  );
  function p($, q) {
    if (
      /*level*/
      $[4] == 1
    )
      return k$;
    if (
      /*level*/
      $[4] == 2
    )
      return v$;
  }
  let b = p(t), g = b && b(t), v = we(
    /*value*/
    t[1]
  ), y = [];
  for (let $ = 0; $ < v.length; $ += 1)
    y[$] = lh(xd(t, v, $));
  const k = ($) => D(y[$], 1, 1, () => {
    y[$] = null;
  });
  let w = mt[
    /*key*/
    t[0]
  ] && ih(t);
  return {
    c() {
      e = m("article"), h && h.c(), l = A(), g && g.c(), i = A(), n = m("div"), a = m("div"), r = m("table"), s = m("thead"), s.innerHTML = '<tr><th class="svelte-rs5kk">Name</th> <th class="svelte-rs5kk">Type</th> <th class="svelte-rs5kk">#Qubits</th> <th class="svelte-rs5kk">#ClBits</th> <th class="svelte-rs5kk">Params</th> <th class="svelte-rs5kk">Mutable?</th> <th class="svelte-rs5kk">-</th></tr>', o = A(), u = m("tbody");
      for (let $ = 0; $ < y.length; $ += 1)
        y[$].c();
      c = A(), w && w.c(), f(s, "class", "svelte-rs5kk"), f(r, "class", "svelte-rs5kk"), f(a, "class", "value svelte-rs5kk"), f(n, "class", "content-wrap"), f(e, "class", "svelte-rs5kk");
    },
    m($, q) {
      C($, e, q), h && h.m(e, null), _(e, l), g && g.m(e, null), _(e, i), _(e, n), _(n, a), _(a, r), _(r, s), _(r, o), _(r, u);
      for (let j = 0; j < y.length; j += 1)
        y[j] && y[j].m(u, null);
      _(e, c), w && w.m(e, null), d = !0;
    },
    p($, [q]) {
      if (/*addToBasket*/
      $[2] ? h ? (h.p($, q), q & /*addToBasket*/
      4 && S(h, 1)) : (h = eh($), h.c(), S(h, 1), h.m(e, l)) : h && (ge(), D(h, 1, 1, () => {
        h = null;
      }), be()), b === (b = p($)) && g ? g.p($, q) : (g && g.d(1), g = b && b($), g && (g.c(), g.m(e, i))), q & /*addToBasket, key, value, code_header, code_footer, $basket*/
      231) {
        v = we(
          /*value*/
          $[1]
        );
        let j;
        for (j = 0; j < v.length; j += 1) {
          const O = xd($, v, j);
          y[j] ? (y[j].p(O, q), S(y[j], 1)) : (y[j] = lh(O), y[j].c(), S(y[j], 1), y[j].m(u, null));
        }
        for (ge(), j = v.length; j < y.length; j += 1)
          k(j);
        be();
      }
      mt[
        /*key*/
        $[0]
      ] ? w ? w.p($, q) : (w = ih($), w.c(), w.m(e, null)) : w && (w.d(1), w = null);
    },
    i($) {
      if (!d) {
        S(h);
        for (let q = 0; q < v.length; q += 1)
          S(y[q]);
        d = !0;
      }
    },
    o($) {
      D(h), y = y.filter(Boolean);
      for (let q = 0; q < y.length; q += 1)
        D(y[q]);
      d = !1;
    },
    d($) {
      $ && T(e), h && h.d(), g && g.d(), Ge(y, $), w && w.d();
    }
  };
}
function w$(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, (g) => l(7, i = g)), u);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s = [], addToBasket: o, basket: u, level: c = 1, code_header: d = "", code_footer: h = "" } = e;
  a();
  const p = () => {
    o(r);
  }, b = (g) => {
    o(`op_${r}_${g.name} = ${d}${g.name}${h}`);
  };
  return t.$$set = (g) => {
    "key" in g && l(0, r = g.key), "value" in g && l(1, s = g.value), "addToBasket" in g && l(2, o = g.addToBasket), "basket" in g && a(l(3, u = g.basket)), "level" in g && l(4, c = g.level), "code_header" in g && l(5, d = g.code_header), "code_footer" in g && l(6, h = g.code_footer);
  }, [
    r,
    s,
    o,
    u,
    c,
    d,
    h,
    i,
    p,
    b
  ];
}
class $$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, w$, y$, Le, {
      key: 0,
      value: 1,
      addToBasket: 2,
      basket: 3,
      level: 4,
      code_header: 5,
      code_footer: 6
    });
  }
}
function nh(t, e, l) {
  const i = t.slice();
  return i[19] = e[l], i[21] = l, i;
}
function ah(t, e, l) {
  const i = t.slice();
  return i[22] = e[l], i;
}
function rh(t, e, l) {
  const i = t.slice();
  return i[22] = e[l], i;
}
function sh(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-7dhgf1");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler*/
        t[13]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s & /*$basket, key*/
      1025 && (o.on = /*$basket*/
      r[10].includes(
        /*key*/
        r[0]
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function q$(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), f(e, "class", "svelte-7dhgf1");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function j$(t) {
  let e, l = ft[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), f(e, "class", "svelte-7dhgf1");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ft[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function oh(t) {
  let e, l = (
    /*g*/
    t[22] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*g*/
      t[22], dt(e, e.__value), e.selected = a = /*filter*/
      t[7].gates.includes(
        /*g*/
        t[22]
      );
    },
    m(r, s) {
      C(r, e, s), _(e, i);
    },
    p(r, s) {
      s & /*gates*/
      256 && l !== (l = /*g*/
      r[22] + "") && Y(i, l), s & /*gates*/
      256 && n !== (n = /*g*/
      r[22]) && (e.__value = n, dt(e, e.__value)), s & /*filter, gates*/
      384 && a !== (a = /*filter*/
      r[7].gates.includes(
        /*g*/
        r[22]
      )) && (e.selected = a);
    },
    d(r) {
      r && T(e);
    }
  };
}
function uh(t) {
  let e, l = (
    /*g*/
    t[22] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*g*/
      t[22], dt(e, e.__value), e.selected = a = /*filter*/
      t[7].qubits.includes(
        /*g*/
        t[22]
      );
    },
    m(r, s) {
      C(r, e, s), _(e, i);
    },
    p(r, s) {
      s & /*qubits*/
      512 && l !== (l = /*g*/
      r[22] + "") && Y(i, l), s & /*qubits*/
      512 && n !== (n = /*g*/
      r[22]) && (e.__value = n, dt(e, e.__value)), s & /*filter, qubits*/
      640 && a !== (a = /*filter*/
      r[7].qubits.includes(
        /*g*/
        r[22]
      )) && (e.selected = a);
    },
    d(r) {
      r && T(e);
    }
  };
}
function fh(t) {
  var X, V;
  let e, l, i = (
    /*gate*/
    t[19].name + ""
  ), n, a, r, s = (
    /*gate*/
    (((X = t[19].qubits) == null ? void 0 : X.join(", ")) || "") + ""
  ), o, u, c, d = (
    /*gate*/
    (t[19].num_qubits || "") + ""
  ), h, p, b, g = (
    /*gate*/
    (t[19].num_clbits || "") + ""
  ), v, y, k, w = (
    /*gate*/
    (t[19].duration || "") + ""
  ), $, q, j, O = (
    /*gate*/
    (t[19].mutable || "") + ""
  ), z, N, M, H = (
    /*gate*/
    (((V = t[19].params) == null ? void 0 : V.join(", ")) || "") + ""
  ), B, R, P, I, L, F = (
    /*addToBasket*/
    t[2] && _h(t)
  );
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = A(), r = m("td"), o = E(s), u = A(), c = m("td"), h = E(d), p = A(), b = m("td"), v = E(g), y = A(), k = m("td"), $ = E(w), q = A(), j = m("td"), z = E(O), N = A(), M = m("td"), B = E(H), R = A(), P = m("td"), F && F.c(), I = A(), f(l, "class", "svelte-7dhgf1"), f(r, "class", "svelte-7dhgf1"), f(c, "class", "svelte-7dhgf1"), f(b, "class", "svelte-7dhgf1"), f(k, "class", "svelte-7dhgf1"), f(j, "class", "svelte-7dhgf1"), f(M, "class", "svelte-7dhgf1"), f(P, "class", "svelte-7dhgf1");
    },
    m(Q, J) {
      C(Q, e, J), _(e, l), _(l, n), _(e, a), _(e, r), _(r, o), _(e, u), _(e, c), _(c, h), _(e, p), _(e, b), _(b, v), _(e, y), _(e, k), _(k, $), _(e, q), _(e, j), _(j, z), _(e, N), _(e, M), _(M, B), _(e, R), _(e, P), F && F.m(P, null), _(e, I), L = !0;
    },
    p(Q, J) {
      var te, ie;
      (!L || J & /*value*/
      2) && i !== (i = /*gate*/
      Q[19].name + "") && Y(n, i), (!L || J & /*value*/
      2) && s !== (s = /*gate*/
      (((te = Q[19].qubits) == null ? void 0 : te.join(", ")) || "") + "") && Y(o, s), (!L || J & /*value*/
      2) && d !== (d = /*gate*/
      (Q[19].num_qubits || "") + "") && Y(h, d), (!L || J & /*value*/
      2) && g !== (g = /*gate*/
      (Q[19].num_clbits || "") + "") && Y(v, g), (!L || J & /*value*/
      2) && w !== (w = /*gate*/
      (Q[19].duration || "") + "") && Y($, w), (!L || J & /*value*/
      2) && O !== (O = /*gate*/
      (Q[19].mutable || "") + "") && Y(z, O), (!L || J & /*value*/
      2) && H !== (H = /*gate*/
      (((ie = Q[19].params) == null ? void 0 : ie.join(", ")) || "") + "") && Y(B, H), /*addToBasket*/
      Q[2] ? F ? (F.p(Q, J), J & /*addToBasket*/
      4 && S(F, 1)) : (F = _h(Q), F.c(), S(F, 1), F.m(P, null)) : F && (ge(), D(F, 1, 1, () => {
        F = null;
      }), be());
    },
    i(Q) {
      L || (S(F), L = !0);
    },
    o(Q) {
      D(F), L = !1;
    },
    d(Q) {
      Q && T(e), F && F.d();
    }
  };
}
function _h(t) {
  var s, o;
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(`instruction_${/*gate*/
        t[19].name}_${/*gate*/
        (s = t[19].qubits) == null ? void 0 : s.join(", ")} = ${/*code_header*/
        t[5]}x.name == "${/*gate*/
        t[19].name}" and x.qubits == [${/*gate*/
        (o = t[19].qubits) == null ? void 0 : o.join(", ")}]${/*code_footer*/
        t[6]}`)
      )
    }
  });
  function r() {
    return (
      /*click_handler_3*/
      t[18](
        /*gate*/
        t[19]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-7dhgf1");
    },
    m(u, c) {
      C(u, e, c), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(u, c) {
      var h, p;
      t = u;
      const d = {};
      c & /*$basket, value, code_header, code_footer*/
      1122 && (d.on = /*$basket*/
      t[10].includes(`instruction_${/*gate*/
      t[19].name}_${/*gate*/
      (h = t[19].qubits) == null ? void 0 : h.join(", ")} = ${/*code_header*/
      t[5]}x.name == "${/*gate*/
      t[19].name}" and x.qubits == [${/*gate*/
      (p = t[19].qubits) == null ? void 0 : p.join(", ")}]${/*code_footer*/
      t[6]}`)), l.$set(d);
    },
    i(u) {
      i || (S(l.$$.fragment, u), i = !0);
    },
    o(u) {
      D(l.$$.fragment, u), i = !1;
    },
    d(u) {
      u && T(e), de(l), n = !1, a();
    }
  };
}
function ch(t) {
  let e = (!/*filter*/
  t[7].gates || /*filter*/
  t[7].gates.length == 0 || /*filter*/
  t[7].gates && /*filter*/
  t[7].gates.includes(
    /*gate*/
    t[19].name
  )) && (!/*filter*/
  t[7].qubits || /*filter*/
  t[7].qubits.length == 0 || /*filter*/
  t[7].qubits && /*gate*/
  t[19].qubits.some(
    /*func*/
    t[12]
  )), l, i, n = e && fh(t);
  return {
    c() {
      n && n.c(), l = Be();
    },
    m(a, r) {
      n && n.m(a, r), C(a, l, r), i = !0;
    },
    p(a, r) {
      r & /*filter, value*/
      130 && (e = (!/*filter*/
      a[7].gates || /*filter*/
      a[7].gates.length == 0 || /*filter*/
      a[7].gates && /*filter*/
      a[7].gates.includes(
        /*gate*/
        a[19].name
      )) && (!/*filter*/
      a[7].qubits || /*filter*/
      a[7].qubits.length == 0 || /*filter*/
      a[7].qubits && /*gate*/
      a[19].qubits.some(
        /*func*/
        a[12]
      ))), e ? n ? (n.p(a, r), r & /*filter, value*/
      130 && S(n, 1)) : (n = fh(a), n.c(), S(n, 1), n.m(l.parentNode, l)) : n && (ge(), D(n, 1, 1, () => {
        n = null;
      }), be());
    },
    i(a) {
      i || (S(n), i = !0);
    },
    o(a) {
      D(n), i = !1;
    },
    d(a) {
      a && T(l), n && n.d(a);
    }
  };
}
function dh(t) {
  let e, l = mt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), f(e, "class", "desc svelte-7dhgf1");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = mt[
        /*key*/
        n[0]
      ] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function T$(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R = (
    /*addToBasket*/
    t[2] && sh(t)
  );
  function P(G, W) {
    if (
      /*level*/
      G[4] == 1
    )
      return j$;
    if (
      /*level*/
      G[4] == 2
    )
      return q$;
  }
  let I = P(t), L = I && I(t), F = we(
    /*gates*/
    t[8]
  ), X = [];
  for (let G = 0; G < F.length; G += 1)
    X[G] = oh(rh(t, F, G));
  let V = we(
    /*qubits*/
    t[9]
  ), Q = [];
  for (let G = 0; G < V.length; G += 1)
    Q[G] = uh(ah(t, V, G));
  let J = we(
    /*value*/
    t[1]
  ), te = [];
  for (let G = 0; G < J.length; G += 1)
    te[G] = ch(nh(t, J, G));
  const ie = (G) => D(te[G], 1, 1, () => {
    te[G] = null;
  });
  let U = mt[
    /*key*/
    t[0]
  ] && dh(t);
  return {
    c() {
      e = m("article"), R && R.c(), l = A(), L && L.c(), i = A(), n = m("div"), a = m("div"), r = m("div"), s = m("label"), s.textContent = "Gates", o = A(), u = m("button"), u.textContent = "×", c = A(), d = m("select");
      for (let G = 0; G < X.length; G += 1)
        X[G].c();
      h = A(), p = m("div"), b = m("label"), b.textContent = "Qubits", g = A(), v = m("button"), v.textContent = "×", y = A(), k = m("select");
      for (let G = 0; G < Q.length; G += 1)
        Q[G].c();
      w = A(), $ = m("div"), q = m("table"), j = m("thead"), j.innerHTML = '<tr><th class="svelte-7dhgf1">Gate</th> <th class="svelte-7dhgf1">Qubits</th> <th class="svelte-7dhgf1">#Qubits</th> <th class="svelte-7dhgf1">#Clbits</th> <th class="svelte-7dhgf1">Duration</th> <th class="svelte-7dhgf1">Mutable?</th> <th class="svelte-7dhgf1">Params</th> <th class="svelte-7dhgf1">-</th></tr>', O = A(), z = m("tbody");
      for (let G = 0; G < te.length; G += 1)
        te[G].c();
      N = A(), U && U.c(), f(s, "for", "gates"), f(s, "class", "svelte-7dhgf1"), f(u, "class", "svelte-7dhgf1"), f(d, "class", "filter svelte-7dhgf1"), f(d, "name", "gates"), f(d, "id", "gates"), d.multiple = !0, f(r, "class", "svelte-7dhgf1"), f(b, "for", "qubits"), f(b, "class", "svelte-7dhgf1"), f(v, "class", "svelte-7dhgf1"), f(k, "class", "filter svelte-7dhgf1"), f(k, "name", "qubits"), f(k, "id", "qubits"), k.multiple = !0, f(p, "class", "svelte-7dhgf1"), f(a, "class", "filter-wrap svelte-7dhgf1"), f(j, "class", "svelte-7dhgf1"), f(q, "class", "svelte-7dhgf1"), f($, "class", "value svelte-7dhgf1"), f(n, "class", "content-wrap svelte-7dhgf1"), f(e, "class", "svelte-7dhgf1");
    },
    m(G, W) {
      C(G, e, W), R && R.m(e, null), _(e, l), L && L.m(e, null), _(e, i), _(e, n), _(n, a), _(a, r), _(r, s), _(r, o), _(r, u), _(r, c), _(r, d);
      for (let Z = 0; Z < X.length; Z += 1)
        X[Z] && X[Z].m(d, null);
      _(a, h), _(a, p), _(p, b), _(p, g), _(p, v), _(p, y), _(p, k);
      for (let Z = 0; Z < Q.length; Z += 1)
        Q[Z] && Q[Z].m(k, null);
      _(n, w), _(n, $), _($, q), _(q, j), _(q, O), _(q, z);
      for (let Z = 0; Z < te.length; Z += 1)
        te[Z] && te[Z].m(z, null);
      _(e, N), U && U.m(e, null), M = !0, H || (B = [
        le(
          u,
          "click",
          /*click_handler_1*/
          t[14]
        ),
        le(
          d,
          "change",
          /*change_handler*/
          t[15]
        ),
        le(
          v,
          "click",
          /*click_handler_2*/
          t[16]
        ),
        le(
          k,
          "change",
          /*change_handler_1*/
          t[17]
        )
      ], H = !0);
    },
    p(G, [W]) {
      if (/*addToBasket*/
      G[2] ? R ? (R.p(G, W), W & /*addToBasket*/
      4 && S(R, 1)) : (R = sh(G), R.c(), S(R, 1), R.m(e, l)) : R && (ge(), D(R, 1, 1, () => {
        R = null;
      }), be()), I === (I = P(G)) && L ? L.p(G, W) : (L && L.d(1), L = I && I(G), L && (L.c(), L.m(e, i))), W & /*gates, filter*/
      384) {
        F = we(
          /*gates*/
          G[8]
        );
        let Z;
        for (Z = 0; Z < F.length; Z += 1) {
          const ee = rh(G, F, Z);
          X[Z] ? X[Z].p(ee, W) : (X[Z] = oh(ee), X[Z].c(), X[Z].m(d, null));
        }
        for (; Z < X.length; Z += 1)
          X[Z].d(1);
        X.length = F.length;
      }
      if (W & /*qubits, filter*/
      640) {
        V = we(
          /*qubits*/
          G[9]
        );
        let Z;
        for (Z = 0; Z < V.length; Z += 1) {
          const ee = ah(G, V, Z);
          Q[Z] ? Q[Z].p(ee, W) : (Q[Z] = uh(ee), Q[Z].c(), Q[Z].m(k, null));
        }
        for (; Z < Q.length; Z += 1)
          Q[Z].d(1);
        Q.length = V.length;
      }
      if (W & /*addToBasket, value, code_header, code_footer, $basket, filter*/
      1254) {
        J = we(
          /*value*/
          G[1]
        );
        let Z;
        for (Z = 0; Z < J.length; Z += 1) {
          const ee = nh(G, J, Z);
          te[Z] ? (te[Z].p(ee, W), S(te[Z], 1)) : (te[Z] = ch(ee), te[Z].c(), S(te[Z], 1), te[Z].m(z, null));
        }
        for (ge(), Z = J.length; Z < te.length; Z += 1)
          ie(Z);
        be();
      }
      mt[
        /*key*/
        G[0]
      ] ? U ? U.p(G, W) : (U = dh(G), U.c(), U.m(e, null)) : U && (U.d(1), U = null);
    },
    i(G) {
      if (!M) {
        S(R);
        for (let W = 0; W < J.length; W += 1)
          S(te[W]);
        M = !0;
      }
    },
    o(G) {
      D(R), te = te.filter(Boolean);
      for (let W = 0; W < te.length; W += 1)
        D(te[W]);
      M = !1;
    },
    d(G) {
      G && T(e), R && R.d(), L && L.d(), Ge(X, G), Ge(Q, G), Ge(te, G), U && U.d(), H = !1, vt(B);
    }
  };
}
function C$(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, (z) => l(10, i = z)), u);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: u, level: c = 1, code_header: d = "", code_type: h = "", code_footer: p = "" } = e;
  a();
  let b = { gates: [], qubits: [] }, g = [], v = [];
  yt(() => {
    s && (l(8, g = Array.from(new Set(s.map((z) => z.name)))), l(9, v = Array.from(new Set(s.map((z) => z.qubits).flat()))));
  });
  const y = (z) => b.qubits.includes(z), k = () => {
    o(r);
  }, w = (z) => {
    l(7, b.gates = [], b);
  }, $ = (z) => {
    l(7, b.gates = Array.from(z.target.selectedOptions).map((N) => N.value), b);
  }, q = (z) => {
    l(7, b.qubits = [], b);
  }, j = (z) => {
    l(7, b.qubits = Array.from(z.target.selectedOptions).map((N) => parseInt(N.value)), b);
  }, O = (z) => {
    var N, M;
    o(`instruction_${z.name}_${(N = z.qubits) == null ? void 0 : N.join(", ")} = ${d}x.name == "${z.name}" and x.qubits == [${(M = z.qubits) == null ? void 0 : M.join(", ")}]${p}`);
  };
  return t.$$set = (z) => {
    "key" in z && l(0, r = z.key), "value" in z && l(1, s = z.value), "addToBasket" in z && l(2, o = z.addToBasket), "basket" in z && a(l(3, u = z.basket)), "level" in z && l(4, c = z.level), "code_header" in z && l(5, d = z.code_header), "code_type" in z && l(11, h = z.code_type), "code_footer" in z && l(6, p = z.code_footer);
  }, [
    r,
    s,
    o,
    u,
    c,
    d,
    p,
    b,
    g,
    v,
    i,
    h,
    y,
    k,
    w,
    $,
    q,
    j,
    O
  ];
}
class S$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, C$, T$, Le, {
      key: 0,
      value: 1,
      addToBasket: 2,
      basket: 3,
      level: 4,
      code_header: 5,
      code_type: 11,
      code_footer: 6
    });
  }
}
function hh(t, e, l) {
  const i = t.slice();
  return i[12] = e[l], i;
}
function ph(t, e, l) {
  const i = t.slice();
  return i[12] = e[l], i;
}
function mh(t, e, l) {
  const i = t.slice();
  return i[17] = e[l], i[19] = l, i;
}
function gh(t) {
  let e, l, i, n;
  l = new Cg({
    props: {
      title: (
        /*section_meta*/
        t[6].title
      ),
      toggleSection: (
        /*toggleSection*/
        t[10]
      ),
      hide: (
        /*hide*/
        t[0]
      ),
      level: 1
    }
  });
  let a = !/*hide*/
  t[0] && bh(t);
  return {
    c() {
      e = m("section"), he(l.$$.fragment), i = A(), a && a.c(), f(e, "class", "svelte-eg8s2l");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), _(e, i), a && a.m(e, null), n = !0;
    },
    p(r, s) {
      const o = {};
      s & /*section_meta*/
      64 && (o.title = /*section_meta*/
      r[6].title), s & /*hide*/
      1 && (o.hide = /*hide*/
      r[0]), l.$set(o), /*hide*/
      r[0] ? a && (ge(), D(a, 1, 1, () => {
        a = null;
      }), be()) : a ? (a.p(r, s), s & /*hide*/
      1 && S(a, 1)) : (a = bh(r), a.c(), S(a, 1), a.m(e, null));
    },
    i(r) {
      n || (S(l.$$.fragment, r), S(a), n = !0);
    },
    o(r) {
      D(l.$$.fragment, r), D(a), n = !1;
    },
    d(r) {
      r && T(e), de(l), a && a.d();
    }
  };
}
function bh(t) {
  var p, b;
  let e, l, i, n, a, r = (
    /*is_prop_timed*/
    t[7] && vh(t)
  ), s = we(
    /*section_meta*/
    (p = t[6]) == null ? void 0 : p.subsections
  ), o = [];
  for (let g = 0; g < s.length; g += 1)
    o[g] = yh(ph(t, s, g));
  const u = (g) => D(o[g], 1, 1, () => {
    o[g] = null;
  });
  let c = we(
    /*section_meta*/
    (b = t[6]) == null ? void 0 : b.subsections
  ), d = [];
  for (let g = 0; g < c.length; g += 1)
    d[g] = $h(hh(t, c, g));
  const h = (g) => D(d[g], 1, 1, () => {
    d[g] = null;
  });
  return {
    c() {
      r && r.c(), e = A(), l = m("div");
      for (let g = 0; g < o.length; g += 1)
        o[g].c();
      i = A();
      for (let g = 0; g < d.length; g += 1)
        d[g].c();
      n = Be(), f(l, "class", "panel svelte-eg8s2l");
    },
    m(g, v) {
      r && r.m(g, v), C(g, e, v), C(g, l, v);
      for (let y = 0; y < o.length; y += 1)
        o[y] && o[y].m(l, null);
      C(g, i, v);
      for (let y = 0; y < d.length; y += 1)
        d[y] && d[y].m(g, v);
      C(g, n, v), a = !0;
    },
    p(g, v) {
      var y, k;
      if (/*is_prop_timed*/
      g[7] ? r ? r.p(g, v) : (r = vh(g), r.c(), r.m(e.parentNode, e)) : r && (r.d(1), r = null), v & /*section_meta, $data, addToBasket, basket, openTimeMachine*/
      364) {
        s = we(
          /*section_meta*/
          (y = g[6]) == null ? void 0 : y.subsections
        );
        let w;
        for (w = 0; w < s.length; w += 1) {
          const $ = ph(g, s, w);
          o[w] ? (o[w].p($, v), S(o[w], 1)) : (o[w] = yh($), o[w].c(), S(o[w], 1), o[w].m(l, null));
        }
        for (ge(), w = s.length; w < o.length; w += 1)
          u(w);
        be();
      }
      if (v & /*section_meta, addToBasket, basket, data, openTimeMachine, is_prop_timed, property_time*/
      254) {
        c = we(
          /*section_meta*/
          (k = g[6]) == null ? void 0 : k.subsections
        );
        let w;
        for (w = 0; w < c.length; w += 1) {
          const $ = hh(g, c, w);
          d[w] ? (d[w].p($, v), S(d[w], 1)) : (d[w] = $h($), d[w].c(), S(d[w], 1), d[w].m(n.parentNode, n));
        }
        for (ge(), w = c.length; w < d.length; w += 1)
          h(w);
        be();
      }
    },
    i(g) {
      if (!a) {
        for (let v = 0; v < s.length; v += 1)
          S(o[v]);
        for (let v = 0; v < c.length; v += 1)
          S(d[v]);
        a = !0;
      }
    },
    o(g) {
      o = o.filter(Boolean);
      for (let v = 0; v < o.length; v += 1)
        D(o[v]);
      d = d.filter(Boolean);
      for (let v = 0; v < d.length; v += 1)
        D(d[v]);
      a = !1;
    },
    d(g) {
      g && (T(e), T(l), T(i), T(n)), r && r.d(g), Ge(o, g), Ge(d, g);
    }
  };
}
function vh(t) {
  let e, l, i, n, a, r, s, o, u, c, d = we(Object.keys(
    /*$data*/
    t[8].timed_properties
  )), h = [];
  for (let p = 0; p < d.length; p += 1)
    h[p] = kh(mh(t, d, p));
  return {
    c() {
      e = m("div"), l = m("div"), i = m("label"), i.textContent = "Collected at:", n = A(), a = m("select"), r = m("option"), s = E("Current");
      for (let p = 0; p < h.length; p += 1)
        h[p].c();
      f(i, "for", "property-time-machine"), f(i, "class", "svelte-eg8s2l"), r.__value = "current", dt(r, r.__value), r.selected = o = /*$property_time*/
      t[9] === "current", f(r, "class", "svelte-eg8s2l"), f(a, "id", "property-time-machine"), f(a, "class", "svelte-eg8s2l"), f(l, "class", "input-wrap svelte-eg8s2l"), f(e, "class", "input-row sticky svelte-eg8s2l");
    },
    m(p, b) {
      C(p, e, b), _(e, l), _(l, i), _(l, n), _(l, a), _(a, r), _(r, s);
      for (let g = 0; g < h.length; g += 1)
        h[g] && h[g].m(a, null);
      u || (c = le(
        a,
        "change",
        /*change_handler*/
        t[11]
      ), u = !0);
    },
    p(p, b) {
      if (b & /*$property_time*/
      512 && o !== (o = /*$property_time*/
      p[9] === "current") && (r.selected = o), b & /*Object, $data, $property_time*/
      768) {
        d = we(Object.keys(
          /*$data*/
          p[8].timed_properties
        ));
        let g;
        for (g = 0; g < d.length; g += 1) {
          const v = mh(p, d, g);
          h[g] ? h[g].p(v, b) : (h[g] = kh(v), h[g].c(), h[g].m(a, null));
        }
        for (; g < h.length; g += 1)
          h[g].d(1);
        h.length = d.length;
      }
    },
    d(p) {
      p && T(e), Ge(h, p), u = !1, c();
    }
  };
}
function kh(t) {
  let e, l = (
    /*time*/
    t[17] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*time*/
      t[17], dt(e, e.__value), e.selected = a = /*$property_time*/
      t[9] === /*time*/
      t[17], f(e, "class", "svelte-eg8s2l");
    },
    m(r, s) {
      C(r, e, s), _(e, i);
    },
    p(r, s) {
      s & /*$data*/
      256 && l !== (l = /*time*/
      r[17] + "") && Y(i, l), s & /*$data*/
      256 && n !== (n = /*time*/
      r[17]) && (e.__value = n, dt(e, e.__value)), s & /*$property_time, $data*/
      768 && a !== (a = /*$property_time*/
      r[9] === /*time*/
      r[17]) && (e.selected = a);
    },
    d(r) {
      r && T(e);
    }
  };
}
function M$(t) {
  let e, l;
  return e = new tr({
    props: {
      key: (
        /*sub*/
        t[12]
      ),
      value: (
        /*$data*/
        t[8][
          /*sub*/
          t[12]
        ]
      ),
      level: 1,
      addToBasket: (
        /*addToBasket*/
        t[2]
      ),
      basket: (
        /*basket*/
        t[5]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[3]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      64 && (a.key = /*sub*/
      i[12]), n & /*$data, section_meta*/
      320 && (a.value = /*$data*/
      i[8][
        /*sub*/
        i[12]
      ]), n & /*addToBasket*/
      4 && (a.addToBasket = /*addToBasket*/
      i[2]), n & /*basket*/
      32 && (a.basket = /*basket*/
      i[5]), n & /*openTimeMachine*/
      8 && (a.openTimeMachine = /*openTimeMachine*/
      i[3]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function z$(t) {
  let e, l;
  return e = new S$({
    props: {
      key: (
        /*sub*/
        t[12]
      ),
      value: (
        /*$data*/
        t[8][
          /*sub*/
          t[12]
        ]
      ),
      level: 1,
      addToBasket: (
        /*addToBasket*/
        t[2]
      ),
      basket: (
        /*basket*/
        t[5]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[3]
      ),
      code_header: "list(fliter(lambda x: ",
      code_footer: ", backend.operations))[0]"
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      64 && (a.key = /*sub*/
      i[12]), n & /*$data, section_meta*/
      320 && (a.value = /*$data*/
      i[8][
        /*sub*/
        i[12]
      ]), n & /*addToBasket*/
      4 && (a.addToBasket = /*addToBasket*/
      i[2]), n & /*basket*/
      32 && (a.basket = /*basket*/
      i[5]), n & /*openTimeMachine*/
      8 && (a.openTimeMachine = /*openTimeMachine*/
      i[3]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function N$(t) {
  let e, l;
  return e = new $$({
    props: {
      key: (
        /*sub*/
        t[12]
      ),
      value: (
        /*$data*/
        t[8][
          /*sub*/
          t[12]
        ]
      ),
      level: 1,
      addToBasket: (
        /*addToBasket*/
        t[2]
      ),
      basket: (
        /*basket*/
        t[5]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[3]
      ),
      code_header: 'list(fliter(lambda x: x.name == "',
      code_footer: '", backend.operations))[0]'
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      64 && (a.key = /*sub*/
      i[12]), n & /*$data, section_meta*/
      320 && (a.value = /*$data*/
      i[8][
        /*sub*/
        i[12]
      ]), n & /*addToBasket*/
      4 && (a.addToBasket = /*addToBasket*/
      i[2]), n & /*basket*/
      32 && (a.basket = /*basket*/
      i[5]), n & /*openTimeMachine*/
      8 && (a.openTimeMachine = /*openTimeMachine*/
      i[3]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function A$(t) {
  let e, l;
  return e = new tr({
    props: {
      key: (
        /*sub*/
        t[12]
      ),
      value: (
        /*$data*/
        t[8][
          /*sub*/
          t[12]
        ]
      ),
      level: 1
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      64 && (a.key = /*sub*/
      i[12]), n & /*$data, section_meta*/
      320 && (a.value = /*$data*/
      i[8][
        /*sub*/
        i[12]
      ]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function yh(t) {
  let e, l, i, n;
  const a = [A$, N$, z$, M$], r = [];
  function s(o, u) {
    return (
      /*sub*/
      o[12] === "asof" ? 0 : (
        /*sub*/
        o[12] === "operations" ? 1 : (
          /*sub*/
          o[12] === "instructions" ? 2 : (
            /*sub*/
            o[12].key ? -1 : 3
          )
        )
      )
    );
  }
  return ~(e = s(t)) && (l = r[e] = a[e](t)), {
    c() {
      l && l.c(), i = Be();
    },
    m(o, u) {
      ~e && r[e].m(o, u), C(o, i, u), n = !0;
    },
    p(o, u) {
      let c = e;
      e = s(o), e === c ? ~e && r[e].p(o, u) : (l && (ge(), D(r[c], 1, 1, () => {
        r[c] = null;
      }), be()), ~e ? (l = r[e], l ? l.p(o, u) : (l = r[e] = a[e](o), l.c()), S(l, 1), l.m(i.parentNode, i)) : l = null);
    },
    i(o) {
      n || (S(l), n = !0);
    },
    o(o) {
      D(l), n = !1;
    },
    d(o) {
      o && T(i), ~e && r[e].d(o);
    }
  };
}
function wh(t) {
  let e, l;
  return e = new b$({
    props: {
      section_meta: (
        /*sub*/
        t[12]
      ),
      addToBasket: (
        /*addToBasket*/
        t[2]
      ),
      basket: (
        /*basket*/
        t[5]
      ),
      data: (
        /*data*/
        t[1]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[3]
      ),
      is_prop_timed: (
        /*is_prop_timed*/
        t[7]
      ),
      property_time: (
        /*property_time*/
        t[4]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*section_meta*/
      64 && (a.section_meta = /*sub*/
      i[12]), n & /*addToBasket*/
      4 && (a.addToBasket = /*addToBasket*/
      i[2]), n & /*basket*/
      32 && (a.basket = /*basket*/
      i[5]), n & /*data*/
      2 && (a.data = /*data*/
      i[1]), n & /*openTimeMachine*/
      8 && (a.openTimeMachine = /*openTimeMachine*/
      i[3]), n & /*is_prop_timed*/
      128 && (a.is_prop_timed = /*is_prop_timed*/
      i[7]), n & /*property_time*/
      16 && (a.property_time = /*property_time*/
      i[4]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function $h(t) {
  let e, l, i = (
    /*sub*/
    t[12].key && /*sub*/
    t[12].order && wh(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, e, a), l = !0;
    },
    p(n, a) {
      /*sub*/
      n[12].key && /*sub*/
      n[12].order ? i ? (i.p(n, a), a & /*section_meta*/
      64 && S(i, 1)) : (i = wh(n), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d(n);
    }
  };
}
function B$(t) {
  let e, l, i = (
    /*$data*/
    t[8] && /*section_meta*/
    t[6] && gh(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, e, a), l = !0;
    },
    p(n, [a]) {
      /*$data*/
      n[8] && /*section_meta*/
      n[6] ? i ? (i.p(n, a), a & /*$data, section_meta*/
      320 && S(i, 1)) : (i = gh(n), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d(n);
    }
  };
}
function P$(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, (w) => l(8, i = w)), u), r, s = ae, o = () => (s(), s = rt(h, (w) => l(9, r = w)), h);
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => s());
  let { data: u = Pe() } = e;
  a();
  let { addToBasket: c = () => {
  } } = e, { openTimeMachine: d = () => {
  } } = e, { property_time: h = Pe() } = e;
  o();
  let { basket: p } = e, { section_meta: b } = e, { hide: g = !1 } = e;
  function v() {
    l(0, g = !g);
  }
  let y = !1;
  yt(() => {
    l(7, y = i.property_times && b.title === "Properties");
  });
  const k = (w) => {
    h.set(w.target.value);
  };
  return t.$$set = (w) => {
    "data" in w && a(l(1, u = w.data)), "addToBasket" in w && l(2, c = w.addToBasket), "openTimeMachine" in w && l(3, d = w.openTimeMachine), "property_time" in w && o(l(4, h = w.property_time)), "basket" in w && l(5, p = w.basket), "section_meta" in w && l(6, b = w.section_meta), "hide" in w && l(0, g = w.hide);
  }, [
    g,
    u,
    c,
    d,
    h,
    p,
    b,
    y,
    i,
    r,
    v,
    k
  ];
}
class zl extends Ve {
  constructor(e) {
    super(), Qe(this, e, P$, B$, Le, {
      data: 1,
      addToBasket: 2,
      openTimeMachine: 3,
      property_time: 4,
      basket: 5,
      section_meta: 6,
      hide: 0
    });
  }
}
function E$(t) {
  let e, l;
  return {
    c() {
      e = m("div"), f(e, "class", "in-table-bar svelte-rqx7ym"), f(e, "style", l = `width: ${/*value*/
      (t[0] - /*min*/
      t[1]) / /*max*/
      (t[2] - /*min*/
      t[1]) * 100}%; ${/*color*/
      t[3] ? "background-color:" + /*color*/
      t[3] + ";" : ""}`);
    },
    m(i, n) {
      C(i, e, n);
    },
    p(i, [n]) {
      n & /*value, min, max, color*/
      15 && l !== (l = `width: ${/*value*/
      (i[0] - /*min*/
      i[1]) / /*max*/
      (i[2] - /*min*/
      i[1]) * 100}%; ${/*color*/
      i[3] ? "background-color:" + /*color*/
      i[3] + ";" : ""}`) && f(e, "style", l);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e);
    }
  };
}
function O$(t, e, l) {
  let { value: i = 0, min: n = 0, max: a = 1, color: r = "dodgerblue" } = e;
  return t.$$set = (s) => {
    "value" in s && l(0, i = s.value), "min" in s && l(1, n = s.min), "max" in s && l(2, a = s.max), "color" in s && l(3, r = s.color);
  }, [i, n, a, r];
}
class Ji extends Ve {
  constructor(e) {
    super(), Qe(this, e, O$, E$, Le, { value: 0, min: 1, max: 2, color: 3 });
  }
}
function qh(t, e, l) {
  const i = t.slice();
  return i[11] = e[l], i[13] = l, i;
}
function jh(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*basket_codes*/
          t[5].total
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1gm7n3s");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler*/
        t[8]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s & /*$basket, basket_codes*/
      160 && (o.on = /*$basket*/
      r[7].includes(
        /*basket_codes*/
        r[5].total
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function Th(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*basket_codes*/
          t[5].curr
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1gm7n3s");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler_1*/
        t[9]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s & /*$basket, basket_codes*/
      160 && (o.on = /*$basket*/
      r[7].includes(
        /*basket_codes*/
        r[5].curr
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function Ch(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*basket_codes*/
          t[5][
            /*di*/
            t[13]
          ]
        )
      )
    }
  });
  function r() {
    return (
      /*click_handler_2*/
      t[10](
        /*di*/
        t[13]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-1gm7n3s");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o & /*$basket, basket_codes*/
      160 && (u.on = /*$basket*/
      t[7].includes(
        /*basket_codes*/
        t[5][
          /*di*/
          t[13]
        ]
      )), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function Sh(t) {
  let e, l, i = (
    /*dp*/
    t[11].date + ""
  ), n, a, r, s = (
    /*dp*/
    t[11].data.asof + ""
  ), o, u, c, d = (
    /*dp*/
    t[11].data.value + ""
  ), h, p, b = (
    /*dp*/
    t[11].data.unit + ""
  ), g, v, y, k, w, $, q, j, O;
  w = new Ji({
    props: {
      value: (
        /*dp*/
        t[11].data.value
      ),
      min: (
        /*minValue*/
        t[4]
      ),
      max: (
        /*maxValue*/
        t[3]
      )
    }
  });
  let z = (
    /*addToBasket*/
    t[1] && Ch(t)
  );
  return {
    c() {
      e = m("tr"), l = m("td"), n = E(i), a = A(), r = m("td"), o = E(s), u = A(), c = m("td"), h = E(d), p = E(" ("), g = E(b), v = E(")"), y = A(), k = m("td"), he(w.$$.fragment), $ = A(), q = m("td"), z && z.c(), j = A(), f(l, "class", "svelte-1gm7n3s"), f(r, "class", "svelte-1gm7n3s"), f(c, "class", "svelte-1gm7n3s"), f(k, "class", "in-table-bar-cell svelte-1gm7n3s"), f(q, "class", "svelte-1gm7n3s");
    },
    m(N, M) {
      C(N, e, M), _(e, l), _(l, n), _(e, a), _(e, r), _(r, o), _(e, u), _(e, c), _(c, h), _(c, p), _(c, g), _(c, v), _(e, y), _(e, k), ce(w, k, null), _(e, $), _(e, q), z && z.m(q, null), _(e, j), O = !0;
    },
    p(N, M) {
      (!O || M & /*$timeMachineData*/
      64) && i !== (i = /*dp*/
      N[11].date + "") && Y(n, i), (!O || M & /*$timeMachineData*/
      64) && s !== (s = /*dp*/
      N[11].data.asof + "") && Y(o, s), (!O || M & /*$timeMachineData*/
      64) && d !== (d = /*dp*/
      N[11].data.value + "") && Y(h, d), (!O || M & /*$timeMachineData*/
      64) && b !== (b = /*dp*/
      N[11].data.unit + "") && Y(g, b);
      const H = {};
      M & /*$timeMachineData*/
      64 && (H.value = /*dp*/
      N[11].data.value), M & /*minValue*/
      16 && (H.min = /*minValue*/
      N[4]), M & /*maxValue*/
      8 && (H.max = /*maxValue*/
      N[3]), w.$set(H), /*addToBasket*/
      N[1] ? z ? (z.p(N, M), M & /*addToBasket*/
      2 && S(z, 1)) : (z = Ch(N), z.c(), S(z, 1), z.m(q, null)) : z && (ge(), D(z, 1, 1, () => {
        z = null;
      }), be());
    },
    i(N) {
      O || (S(w.$$.fragment, N), S(z), O = !0);
    },
    o(N) {
      D(w.$$.fragment, N), D(z), O = !1;
    },
    d(N) {
      N && T(e), de(w), z && z.d();
    }
  };
}
function I$(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $ = (
    /*$timeMachineData*/
    t[6].curr_data.asof + ""
  ), q, j, O, z = (
    /*$timeMachineData*/
    t[6].curr_data.value + ""
  ), N, M, H = (
    /*$timeMachineData*/
    t[6].curr_data.unit + ""
  ), B, R, P, I, L, F, X, V, Q, J = (
    /*addToBasket*/
    t[1] && jh(t)
  );
  L = new Ji({
    props: {
      value: (
        /*$timeMachineData*/
        t[6].curr_data.value
      ),
      min: (
        /*minValue*/
        t[4]
      ),
      max: (
        /*maxValue*/
        t[3]
      )
    }
  });
  let te = (
    /*addToBasket*/
    t[1] && Th(t)
  ), ie = we(
    /*$timeMachineData*/
    t[6].history_data
  ), U = [];
  for (let W = 0; W < ie.length; W += 1)
    U[W] = Sh(qh(t, ie, W));
  const G = (W) => D(U[W], 1, 1, () => {
    U[W] = null;
  });
  return {
    c() {
      e = m("div"), l = m("table"), i = m("thead"), n = m("tr"), a = m("th"), a.textContent = "Time point", r = A(), s = m("th"), s.textContent = "As of", o = A(), u = m("th"), u.textContent = "Value", c = A(), d = m("th"), d.textContent = "→", h = A(), p = m("th"), J && J.c(), b = A(), g = m("tbody"), v = m("tr"), y = m("td"), y.textContent = "Current", k = A(), w = m("td"), q = E($), j = A(), O = m("td"), N = E(z), M = E(" ("), B = E(H), R = E(")"), P = A(), I = m("td"), he(L.$$.fragment), F = A(), X = m("td"), te && te.c(), V = A();
      for (let W = 0; W < U.length; W += 1)
        U[W].c();
      f(a, "class", "svelte-1gm7n3s"), f(s, "class", "svelte-1gm7n3s"), f(u, "class", "svelte-1gm7n3s"), f(d, "class", "svelte-1gm7n3s"), f(p, "class", "svelte-1gm7n3s"), f(y, "class", "svelte-1gm7n3s"), f(w, "class", "svelte-1gm7n3s"), f(O, "class", "svelte-1gm7n3s"), f(I, "class", "in-table-bar-cell svelte-1gm7n3s"), f(X, "class", "svelte-1gm7n3s"), f(l, "class", "svelte-1gm7n3s"), f(e, "class", "time-machine-body svelte-1gm7n3s");
    },
    m(W, Z) {
      C(W, e, Z), _(e, l), _(l, i), _(i, n), _(n, a), _(n, r), _(n, s), _(n, o), _(n, u), _(n, c), _(n, d), _(n, h), _(n, p), J && J.m(p, null), _(l, b), _(l, g), _(g, v), _(v, y), _(v, k), _(v, w), _(w, q), _(v, j), _(v, O), _(O, N), _(O, M), _(O, B), _(O, R), _(v, P), _(v, I), ce(L, I, null), _(v, F), _(v, X), te && te.m(X, null), _(g, V);
      for (let ee = 0; ee < U.length; ee += 1)
        U[ee] && U[ee].m(g, null);
      Q = !0;
    },
    p(W, [Z]) {
      /*addToBasket*/
      W[1] ? J ? (J.p(W, Z), Z & /*addToBasket*/
      2 && S(J, 1)) : (J = jh(W), J.c(), S(J, 1), J.m(p, null)) : J && (ge(), D(J, 1, 1, () => {
        J = null;
      }), be()), (!Q || Z & /*$timeMachineData*/
      64) && $ !== ($ = /*$timeMachineData*/
      W[6].curr_data.asof + "") && Y(q, $), (!Q || Z & /*$timeMachineData*/
      64) && z !== (z = /*$timeMachineData*/
      W[6].curr_data.value + "") && Y(N, z), (!Q || Z & /*$timeMachineData*/
      64) && H !== (H = /*$timeMachineData*/
      W[6].curr_data.unit + "") && Y(B, H);
      const ee = {};
      if (Z & /*$timeMachineData*/
      64 && (ee.value = /*$timeMachineData*/
      W[6].curr_data.value), Z & /*minValue*/
      16 && (ee.min = /*minValue*/
      W[4]), Z & /*maxValue*/
      8 && (ee.max = /*maxValue*/
      W[3]), L.$set(ee), /*addToBasket*/
      W[1] ? te ? (te.p(W, Z), Z & /*addToBasket*/
      2 && S(te, 1)) : (te = Th(W), te.c(), S(te, 1), te.m(X, null)) : te && (ge(), D(te, 1, 1, () => {
        te = null;
      }), be()), Z & /*addToBasket, basket_codes, $basket, $timeMachineData, minValue, maxValue*/
      250) {
        ie = we(
          /*$timeMachineData*/
          W[6].history_data
        );
        let ye;
        for (ye = 0; ye < ie.length; ye += 1) {
          const qe = qh(W, ie, ye);
          U[ye] ? (U[ye].p(qe, Z), S(U[ye], 1)) : (U[ye] = Sh(qe), U[ye].c(), S(U[ye], 1), U[ye].m(g, null));
        }
        for (ge(), ye = ie.length; ye < U.length; ye += 1)
          G(ye);
        be();
      }
    },
    i(W) {
      if (!Q) {
        S(J), S(L.$$.fragment, W), S(te);
        for (let Z = 0; Z < ie.length; Z += 1)
          S(U[Z]);
        Q = !0;
      }
    },
    o(W) {
      D(J), D(L.$$.fragment, W), D(te), U = U.filter(Boolean);
      for (let Z = 0; Z < U.length; Z += 1)
        D(U[Z]);
      Q = !1;
    },
    d(W) {
      W && T(e), J && J.d(), de(L), te && te.d(), Ge(U, W);
    }
  };
}
function D$(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, (k) => l(6, i = k)), u), r, s = ae, o = () => (s(), s = rt(d, (k) => l(7, r = k)), d);
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => s());
  let { timeMachineData: u = Pe(), addToBasket: c, basket: d } = e;
  a(), o();
  let h = -1 / 0, p = 1 / 0, b = {};
  yt(() => {
    l(3, h = i.curr_data.value > h ? i.curr_data.value : h), l(4, p = i.curr_data.value < p ? i.curr_data.value : p), l(5, b.curr = `${i.key}_curr = ${i.code_header}${i.code_key}${i.code_footer}`, b), l(5, b.total = `${i.key}_timed = [${i.key}_curr`, b);
    let k = 0;
    for (let w of i.history_data)
      l(3, h = w.data.value > h ? w.data.value : h), l(4, p = w.data.value < p ? w.data.value : p), l(5, b[k] = `${i.key}_h_${k} = ${i.code_header}${i.code_key}${i.code_footer}`, b), l(5, b[k] = b[k].replace(".properties()", ".properties(datetime=" + Tg(w.date) + ")"), b), l(5, b.total += `, ${i.key}_h_${k}`, b), k++;
    l(5, b.total += "]", b), l(4, p -= (h - p) / 4);
  });
  const g = () => {
    if (r.includes(b.total)) {
      r.includes(b.curr) && c(b.curr);
      let k = 0;
      for (let w of i.history_data)
        r.includes(b[k]) && c(b[k]), k++;
    } else {
      r.includes(b.curr) || c(b.curr);
      let k = 0;
      for (let w of i.history_data)
        r.includes(b[k]) || c(b[k]), k++;
    }
    c(b.total);
  }, v = () => {
    c(b.curr), !r.includes(b.curr) && r.includes(b.total) && c(b.total);
  }, y = (k) => {
    c(b[k]), !r.includes(b[k]) && r.includes(b.total) && c(b.total);
  };
  return t.$$set = (k) => {
    "timeMachineData" in k && a(l(0, u = k.timeMachineData)), "addToBasket" in k && l(1, c = k.addToBasket), "basket" in k && o(l(2, d = k.basket));
  }, [
    u,
    c,
    d,
    h,
    p,
    b,
    i,
    r,
    g,
    v,
    y
  ];
}
class R$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, D$, I$, Le, {
      timeMachineData: 0,
      addToBasket: 1,
      basket: 2
    });
  }
}
function Mh(t, e, l) {
  const i = t.slice();
  return i[11] = e[l], i[13] = l, i;
}
function zh(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*basket_codes*/
          t[5].total
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-ymle7z");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler*/
        t[8]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s & /*$basket, basket_codes*/
      160 && (o.on = /*$basket*/
      r[7].includes(
        /*basket_codes*/
        r[5].total
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function Nh(t) {
  let e, l, i, n, a;
  return l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*basket_codes*/
          t[5].curr
        )
      )
    }
  }), {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-ymle7z");
    },
    m(r, s) {
      C(r, e, s), ce(l, e, null), i = !0, n || (a = le(
        e,
        "click",
        /*click_handler_1*/
        t[9]
      ), n = !0);
    },
    p(r, s) {
      const o = {};
      s & /*$basket, basket_codes*/
      160 && (o.on = /*$basket*/
      r[7].includes(
        /*basket_codes*/
        r[5].curr
      )), l.$set(o);
    },
    i(r) {
      i || (S(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && T(e), de(l), n = !1, a();
    }
  };
}
function Ah(t) {
  let e, l, i, n, a;
  l = new Tt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*basket_codes*/
          t[5][
            /*di*/
            t[13]
          ]
        )
      )
    }
  });
  function r() {
    return (
      /*click_handler_2*/
      t[10](
        /*di*/
        t[13]
      )
    );
  }
  return {
    c() {
      e = m("button"), he(l.$$.fragment), f(e, "class", "basket svelte-ymle7z");
    },
    m(s, o) {
      C(s, e, o), ce(l, e, null), i = !0, n || (a = le(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const u = {};
      o & /*$basket, basket_codes*/
      160 && (u.on = /*$basket*/
      t[7].includes(
        /*basket_codes*/
        t[5][
          /*di*/
          t[13]
        ]
      )), l.$set(u);
    },
    i(s) {
      i || (S(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && T(e), de(l), n = !1, a();
    }
  };
}
function Bh(t) {
  let e, l, i = (
    /*dp*/
    t[11].date + ""
  ), n, a, r, s = (
    /*dp*/
    t[11].data.parameters.gate_error.asof + ""
  ), o, u, c, d = (
    /*dp*/
    t[11].data.parameters.gate_error.value + ""
  ), h, p, b, g, v, y, k = (
    /*dp*/
    t[11].data.parameters.gate_length.asof + ""
  ), w, $, q, j = (
    /*dp*/
    t[11].data.parameters.gate_length.value + ""
  ), O, z, N = (
    /*dp*/
    t[11].data.parameters.gate_length.unit + ""
  ), M, H, B, R, P, I, L, F, X;
  g = new Ji({
    props: {
      value: (
        /*dp*/
        t[11].data.parameters.gate_error.value
      ),
      min: (
        /*minValue*/
        t[4][0]
      ),
      max: (
        /*maxValue*/
        t[3][0]
      )
    }
  }), P = new Ji({
    props: {
      value: (
        /*dp*/
        t[11].data.parameters.gate_length.value
      ),
      min: (
        /*minValue*/
        t[4][1]
      ),
      max: (
        /*maxValue*/
        t[3][1]
      ),
      color: "hotpink"
    }
  });
  let V = (
    /*addToBasket*/
    t[1] && Ah(t)
  );
  return {
    c() {
      e = m("tr"), l = m("td"), n = E(i), a = A(), r = m("td"), o = E(s), u = A(), c = m("td"), h = E(d), p = A(), b = m("td"), he(g.$$.fragment), v = A(), y = m("td"), w = E(k), $ = A(), q = m("td"), O = E(j), z = E(`
            (`), M = E(N), H = E(")"), B = A(), R = m("td"), he(P.$$.fragment), I = A(), L = m("td"), V && V.c(), F = A(), f(l, "class", "svelte-ymle7z"), f(r, "class", "svelte-ymle7z"), f(c, "class", "svelte-ymle7z"), f(b, "class", "in-table-bar-cell svelte-ymle7z"), f(y, "class", "svelte-ymle7z"), f(q, "class", "svelte-ymle7z"), f(R, "class", "in-table-bar-cell svelte-ymle7z"), f(L, "class", "svelte-ymle7z");
    },
    m(Q, J) {
      C(Q, e, J), _(e, l), _(l, n), _(e, a), _(e, r), _(r, o), _(e, u), _(e, c), _(c, h), _(e, p), _(e, b), ce(g, b, null), _(e, v), _(e, y), _(y, w), _(e, $), _(e, q), _(q, O), _(q, z), _(q, M), _(q, H), _(e, B), _(e, R), ce(P, R, null), _(e, I), _(e, L), V && V.m(L, null), _(e, F), X = !0;
    },
    p(Q, J) {
      (!X || J & /*$timeMachineData*/
      64) && i !== (i = /*dp*/
      Q[11].date + "") && Y(n, i), (!X || J & /*$timeMachineData*/
      64) && s !== (s = /*dp*/
      Q[11].data.parameters.gate_error.asof + "") && Y(o, s), (!X || J & /*$timeMachineData*/
      64) && d !== (d = /*dp*/
      Q[11].data.parameters.gate_error.value + "") && Y(h, d);
      const te = {};
      J & /*$timeMachineData*/
      64 && (te.value = /*dp*/
      Q[11].data.parameters.gate_error.value), J & /*minValue*/
      16 && (te.min = /*minValue*/
      Q[4][0]), J & /*maxValue*/
      8 && (te.max = /*maxValue*/
      Q[3][0]), g.$set(te), (!X || J & /*$timeMachineData*/
      64) && k !== (k = /*dp*/
      Q[11].data.parameters.gate_length.asof + "") && Y(w, k), (!X || J & /*$timeMachineData*/
      64) && j !== (j = /*dp*/
      Q[11].data.parameters.gate_length.value + "") && Y(O, j), (!X || J & /*$timeMachineData*/
      64) && N !== (N = /*dp*/
      Q[11].data.parameters.gate_length.unit + "") && Y(M, N);
      const ie = {};
      J & /*$timeMachineData*/
      64 && (ie.value = /*dp*/
      Q[11].data.parameters.gate_length.value), J & /*minValue*/
      16 && (ie.min = /*minValue*/
      Q[4][1]), J & /*maxValue*/
      8 && (ie.max = /*maxValue*/
      Q[3][1]), P.$set(ie), /*addToBasket*/
      Q[1] ? V ? (V.p(Q, J), J & /*addToBasket*/
      2 && S(V, 1)) : (V = Ah(Q), V.c(), S(V, 1), V.m(L, null)) : V && (ge(), D(V, 1, 1, () => {
        V = null;
      }), be());
    },
    i(Q) {
      X || (S(g.$$.fragment, Q), S(P.$$.fragment, Q), S(V), X = !0);
    },
    o(Q) {
      D(g.$$.fragment, Q), D(P.$$.fragment, Q), D(V), X = !1;
    },
    d(Q) {
      Q && T(e), de(g), de(P), V && V.d();
    }
  };
}
function H$(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M = (
    /*$timeMachineData*/
    t[6].curr_data.parameters.gate_error.asof + ""
  ), H, B, R, P = (
    /*$timeMachineData*/
    t[6].curr_data.parameters.gate_error.value + ""
  ), I, L, F, X, V, Q, J = (
    /*$timeMachineData*/
    t[6].curr_data.parameters.gate_length.asof + ""
  ), te, ie, U, G = (
    /*$timeMachineData*/
    t[6].curr_data.parameters.gate_length.value + ""
  ), W, Z, ee = (
    /*$timeMachineData*/
    t[6].curr_data.parameters.gate_length.unit + ""
  ), ye, qe, je, fe, _e, K, ke, ue, ne, oe = (
    /*addToBasket*/
    t[1] && zh(t)
  );
  X = new Ji({
    props: {
      value: (
        /*$timeMachineData*/
        t[6].curr_data.parameters.gate_error.value
      ),
      min: (
        /*minValue*/
        t[4][0]
      ),
      max: (
        /*maxValue*/
        t[3][0]
      )
    }
  }), _e = new Ji({
    props: {
      value: (
        /*$timeMachineData*/
        t[6].curr_data.parameters.gate_length.value
      ),
      min: (
        /*minValue*/
        t[4][1]
      ),
      max: (
        /*maxValue*/
        t[3][1]
      ),
      color: "hotpink"
    }
  });
  let x = (
    /*addToBasket*/
    t[1] && Nh(t)
  ), ve = we(
    /*$timeMachineData*/
    t[6].history_data
  ), se = [];
  for (let Ce = 0; Ce < ve.length; Ce += 1)
    se[Ce] = Bh(Mh(t, ve, Ce));
  const Re = (Ce) => D(se[Ce], 1, 1, () => {
    se[Ce] = null;
  });
  return {
    c() {
      e = m("div"), l = m("table"), i = m("thead"), n = m("tr"), a = m("th"), a.textContent = "Time point", r = A(), s = m("th"), s.textContent = "As of", o = A(), u = m("th"), u.textContent = "Error", c = A(), d = m("th"), d.textContent = "→", h = A(), p = m("th"), p.textContent = "As of", b = A(), g = m("th"), g.textContent = "Length", v = A(), y = m("th"), y.textContent = "→", k = A(), w = m("th"), oe && oe.c(), $ = A(), q = m("tbody"), j = m("tr"), O = m("td"), O.textContent = "Current", z = A(), N = m("td"), H = E(M), B = A(), R = m("td"), I = E(P), L = A(), F = m("td"), he(X.$$.fragment), V = A(), Q = m("td"), te = E(J), ie = A(), U = m("td"), W = E(G), Z = E(`
          (`), ye = E(ee), qe = E(")"), je = A(), fe = m("td"), he(_e.$$.fragment), K = A(), ke = m("td"), x && x.c(), ue = A();
      for (let Ce = 0; Ce < se.length; Ce += 1)
        se[Ce].c();
      f(a, "class", "svelte-ymle7z"), f(s, "class", "svelte-ymle7z"), f(u, "class", "svelte-ymle7z"), f(d, "class", "svelte-ymle7z"), f(p, "class", "svelte-ymle7z"), f(g, "class", "svelte-ymle7z"), f(y, "class", "svelte-ymle7z"), f(w, "class", "svelte-ymle7z"), f(O, "class", "svelte-ymle7z"), f(N, "class", "svelte-ymle7z"), f(R, "class", "svelte-ymle7z"), f(F, "class", "in-table-bar-cell svelte-ymle7z"), f(Q, "class", "svelte-ymle7z"), f(U, "class", "svelte-ymle7z"), f(fe, "class", "in-table-bar-cell svelte-ymle7z"), f(ke, "class", "svelte-ymle7z"), f(l, "class", "svelte-ymle7z"), f(e, "class", "time-machine-body svelte-ymle7z");
    },
    m(Ce, pe) {
      C(Ce, e, pe), _(e, l), _(l, i), _(i, n), _(n, a), _(n, r), _(n, s), _(n, o), _(n, u), _(n, c), _(n, d), _(n, h), _(n, p), _(n, b), _(n, g), _(n, v), _(n, y), _(n, k), _(n, w), oe && oe.m(w, null), _(l, $), _(l, q), _(q, j), _(j, O), _(j, z), _(j, N), _(N, H), _(j, B), _(j, R), _(R, I), _(j, L), _(j, F), ce(X, F, null), _(j, V), _(j, Q), _(Q, te), _(j, ie), _(j, U), _(U, W), _(U, Z), _(U, ye), _(U, qe), _(j, je), _(j, fe), ce(_e, fe, null), _(j, K), _(j, ke), x && x.m(ke, null), _(q, ue);
      for (let De = 0; De < se.length; De += 1)
        se[De] && se[De].m(q, null);
      ne = !0;
    },
    p(Ce, [pe]) {
      /*addToBasket*/
      Ce[1] ? oe ? (oe.p(Ce, pe), pe & /*addToBasket*/
      2 && S(oe, 1)) : (oe = zh(Ce), oe.c(), S(oe, 1), oe.m(w, null)) : oe && (ge(), D(oe, 1, 1, () => {
        oe = null;
      }), be()), (!ne || pe & /*$timeMachineData*/
      64) && M !== (M = /*$timeMachineData*/
      Ce[6].curr_data.parameters.gate_error.asof + "") && Y(H, M), (!ne || pe & /*$timeMachineData*/
      64) && P !== (P = /*$timeMachineData*/
      Ce[6].curr_data.parameters.gate_error.value + "") && Y(I, P);
      const De = {};
      pe & /*$timeMachineData*/
      64 && (De.value = /*$timeMachineData*/
      Ce[6].curr_data.parameters.gate_error.value), pe & /*minValue*/
      16 && (De.min = /*minValue*/
      Ce[4][0]), pe & /*maxValue*/
      8 && (De.max = /*maxValue*/
      Ce[3][0]), X.$set(De), (!ne || pe & /*$timeMachineData*/
      64) && J !== (J = /*$timeMachineData*/
      Ce[6].curr_data.parameters.gate_length.asof + "") && Y(te, J), (!ne || pe & /*$timeMachineData*/
      64) && G !== (G = /*$timeMachineData*/
      Ce[6].curr_data.parameters.gate_length.value + "") && Y(W, G), (!ne || pe & /*$timeMachineData*/
      64) && ee !== (ee = /*$timeMachineData*/
      Ce[6].curr_data.parameters.gate_length.unit + "") && Y(ye, ee);
      const re = {};
      if (pe & /*$timeMachineData*/
      64 && (re.value = /*$timeMachineData*/
      Ce[6].curr_data.parameters.gate_length.value), pe & /*minValue*/
      16 && (re.min = /*minValue*/
      Ce[4][1]), pe & /*maxValue*/
      8 && (re.max = /*maxValue*/
      Ce[3][1]), _e.$set(re), /*addToBasket*/
      Ce[1] ? x ? (x.p(Ce, pe), pe & /*addToBasket*/
      2 && S(x, 1)) : (x = Nh(Ce), x.c(), S(x, 1), x.m(ke, null)) : x && (ge(), D(x, 1, 1, () => {
        x = null;
      }), be()), pe & /*addToBasket, basket_codes, $basket, $timeMachineData, minValue, maxValue*/
      250) {
        ve = we(
          /*$timeMachineData*/
          Ce[6].history_data
        );
        let Se;
        for (Se = 0; Se < ve.length; Se += 1) {
          const Ue = Mh(Ce, ve, Se);
          se[Se] ? (se[Se].p(Ue, pe), S(se[Se], 1)) : (se[Se] = Bh(Ue), se[Se].c(), S(se[Se], 1), se[Se].m(q, null));
        }
        for (ge(), Se = ve.length; Se < se.length; Se += 1)
          Re(Se);
        be();
      }
    },
    i(Ce) {
      if (!ne) {
        S(oe), S(X.$$.fragment, Ce), S(_e.$$.fragment, Ce), S(x);
        for (let pe = 0; pe < ve.length; pe += 1)
          S(se[pe]);
        ne = !0;
      }
    },
    o(Ce) {
      D(oe), D(X.$$.fragment, Ce), D(_e.$$.fragment, Ce), D(x), se = se.filter(Boolean);
      for (let pe = 0; pe < se.length; pe += 1)
        D(se[pe]);
      ne = !1;
    },
    d(Ce) {
      Ce && T(e), oe && oe.d(), de(X), de(_e), x && x.d(), Ge(se, Ce);
    }
  };
}
function F$(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, (k) => l(6, i = k)), u), r, s = ae, o = () => (s(), s = rt(d, (k) => l(7, r = k)), d);
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => s());
  let { timeMachineData: u = Pe(), addToBasket: c, basket: d } = e;
  a(), o();
  let h = [-1 / 0, -1 / 0], p = [1 / 0, 1 / 0], b = {};
  yt(() => {
    let k = [
      i.curr_data.parameters.gate_error.value,
      i.curr_data.parameters.gate_length.value
    ];
    l(3, h = [
      k[0] > h[0] ? k[0] : h[0],
      k[1] > h[1] ? k[1] : h[1]
    ]), l(4, p = [
      k[0] < p[0] ? k[0] : p[0],
      k[1] < p[1] ? k[1] : p[1]
    ]), l(5, b.curr = `gate_${i.curr_data.gate}_${i.curr_data.qubits.join("_")}_curr = ${i.code_header}gate=${i.curr_data.gate}, qubits=[${i.curr_data.qubits.join(", ")}]${i.code_footer}`, b), l(5, b.total = `gate_${i.key}_timed = [gate_${i.curr_data.gate}_${i.curr_data.qubits.join("_")}_curr`, b);
    let w = 0;
    for (let $ of i.history_data) {
      let q = [$.data.parameters.gate_error.value, $.data.parameters.gate_length.value];
      l(3, h = [
        q[0] > h[0] ? q[0] : h[0],
        q[1] > h[1] ? q[1] : h[1]
      ]), l(4, p = [
        q[0] < p[0] ? q[0] : p[0],
        q[1] < p[1] ? q[1] : p[1]
      ]), l(5, b[w] = `gate_${$.data.gate}_${$.data.qubits.join("_")}_h_${w} = ${i.code_header.replace("properties()", "properties(datetime=" + Tg($.date) + ")")}gate=${$.data.gate}, qubits=[${$.data.qubits.join(", ")}]${i.code_footer}`, b), l(5, b.total += `, gate_${$.data.gate}_${$.data.qubits.join("_")}_h_${w}`, b), w++;
    }
    l(4, p[0] -= (h[0] - p[0]) / 4, p), l(4, p[1] -= (h[1] - p[1]) / 4, p), l(5, b.total += "]", b);
  });
  const g = () => {
    if (r.includes(b.total)) {
      r.includes(b.curr) && c(b.curr);
      let k = 0;
      for (let w of i.history_data)
        r.includes(b[k]) && c(b[k]), k++;
    } else {
      r.includes(b.curr) || c(b.curr);
      let k = 0;
      for (let w of i.history_data)
        r.includes(b[k]) || c(b[k]), k++;
    }
    c(b.total);
  }, v = () => {
    c(b.curr), !r.includes(b.curr) && r.includes(b.total) && c(b.total);
  }, y = (k) => {
    c(b[k]), !r.includes(b[k]) && r.includes(b.total) && c(b.total);
  };
  return t.$$set = (k) => {
    "timeMachineData" in k && a(l(0, u = k.timeMachineData)), "addToBasket" in k && l(1, c = k.addToBasket), "basket" in k && o(l(2, d = k.basket));
  }, [
    u,
    c,
    d,
    h,
    p,
    b,
    i,
    r,
    g,
    v,
    y
  ];
}
class L$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, F$, H$, Le, {
      timeMachineData: 0,
      addToBasket: 1,
      basket: 2
    });
  }
}
function Q$(t) {
  let e, l;
  return e = new L$({
    props: {
      addToBasket: (
        /*addToBasket*/
        t[2]
      ),
      basket: (
        /*basket*/
        t[3]
      ),
      timeMachineData: (
        /*timeMachineData*/
        t[0]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*addToBasket*/
      4 && (a.addToBasket = /*addToBasket*/
      i[2]), n & /*basket*/
      8 && (a.basket = /*basket*/
      i[3]), n & /*timeMachineData*/
      1 && (a.timeMachineData = /*timeMachineData*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function V$(t) {
  let e, l;
  return e = new R$({
    props: {
      addToBasket: (
        /*addToBasket*/
        t[2]
      ),
      basket: (
        /*basket*/
        t[3]
      ),
      timeMachineData: (
        /*timeMachineData*/
        t[0]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*addToBasket*/
      4 && (a.addToBasket = /*addToBasket*/
      i[2]), n & /*basket*/
      8 && (a.basket = /*basket*/
      i[3]), n & /*timeMachineData*/
      1 && (a.timeMachineData = /*timeMachineData*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function X$(t) {
  let e, l, i, n, a, r = (
    /*$timeMachineData*/
    t[4].parentKey + ""
  ), s, o, u = (
    /*$timeMachineData*/
    (t[4].title_key || /*$timeMachineData*/
    t[4].key) + ""
  ), c, d, h, p, b, g, v, y, k, w;
  const $ = [V$, Q$], q = [];
  function j(O, z) {
    return (
      /*$timeMachineData*/
      O[4].datatype === "nudv-map" ? 0 : (
        /*$timeMachineData*/
        O[4].datatype === "gates" ? 1 : -1
      )
    );
  }
  return ~(g = j(t)) && (v = q[g] = $[g](t)), {
    c() {
      e = m("div"), l = m("div"), i = m("h2"), n = E("History of "), a = m("code"), s = E(r), o = E("."), c = E(u), d = A(), h = m("button"), h.textContent = "×", p = A(), b = m("div"), v && v.c(), f(a, "class", "svelte-sjkial"), f(h, "class", "close svelte-sjkial"), f(i, "class", "svelte-sjkial"), f(b, "class", "time-machine-body svelte-sjkial"), f(l, "class", "time-machine-modal svelte-sjkial"), f(e, "class", "time-machine-fade svelte-sjkial"), f(e, "tabindex", "-1");
    },
    m(O, z) {
      C(O, e, z), _(e, l), _(l, i), _(i, n), _(i, a), _(a, s), _(a, o), _(a, c), _(i, d), _(i, h), _(l, p), _(l, b), ~g && q[g].m(b, null), y = !0, k || (w = le(
        h,
        "click",
        /*click_handler*/
        t[5]
      ), k = !0);
    },
    p(O, [z]) {
      (!y || z & /*$timeMachineData*/
      16) && r !== (r = /*$timeMachineData*/
      O[4].parentKey + "") && Y(s, r), (!y || z & /*$timeMachineData*/
      16) && u !== (u = /*$timeMachineData*/
      (O[4].title_key || /*$timeMachineData*/
      O[4].key) + "") && Y(c, u);
      let N = g;
      g = j(O), g === N ? ~g && q[g].p(O, z) : (v && (ge(), D(q[N], 1, 1, () => {
        q[N] = null;
      }), be()), ~g ? (v = q[g], v ? v.p(O, z) : (v = q[g] = $[g](O), v.c()), S(v, 1), v.m(b, null)) : v = null);
    },
    i(O) {
      y || (S(v), y = !0);
    },
    o(O) {
      D(v), y = !1;
    },
    d(O) {
      O && T(e), ~g && q[g].d(), k = !1, w();
    }
  };
}
function G$(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(r, (d) => l(4, i = d)), r);
  t.$$.on_destroy.push(() => n());
  let { timeMachineData: r = Pe(), closeTimeMachine: s = () => {
  }, addToBasket: o, basket: u } = e;
  a(), yt(() => {
  });
  const c = () => {
    s();
  };
  return t.$$set = (d) => {
    "timeMachineData" in d && a(l(0, r = d.timeMachineData)), "closeTimeMachine" in d && l(1, s = d.closeTimeMachine), "addToBasket" in d && l(2, o = d.addToBasket), "basket" in d && l(3, u = d.basket);
  }, [
    r,
    s,
    o,
    u,
    i,
    c
  ];
}
class Y$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, G$, X$, Le, {
      timeMachineData: 0,
      closeTimeMachine: 1,
      addToBasket: 2,
      basket: 3
    });
  }
}
function K$(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y;
  return {
    c() {
      e = m("div"), l = m("h4"), l.textContent = "Configure output code", i = A(), n = m("div"), a = m("div"), r = m("label"), r.textContent = "Backend variable name", s = A(), o = m("input"), c = A(), d = m("div"), h = m("label"), h.textContent = "Output code as a function", p = A(), b = m("input"), f(l, "class", "svelte-nkjr63"), f(r, "for", "code_config-var_name"), f(r, "class", "svelte-nkjr63"), f(o, "type", "text"), f(o, "id", "code_config-var_name"), o.value = u = /*$code_config*/
      t[1].backend_var_name, f(o, "class", "svelte-nkjr63"), f(a, "class", "input-wrap svelte-nkjr63"), f(h, "for", "code_config-as_function"), f(h, "class", "svelte-nkjr63"), f(b, "type", "checkbox"), f(b, "id", "code_config-as_function"), b.checked = g = /*$code_config*/
      t[1].as_function, f(d, "class", "input-wrap svelte-nkjr63"), f(n, "class", "input-row svelte-nkjr63"), f(e, "class", "code-config-wrap svelte-nkjr63");
    },
    m(k, w) {
      C(k, e, w), _(e, l), _(e, i), _(e, n), _(n, a), _(a, r), _(a, s), _(a, o), _(n, c), _(n, d), _(d, h), _(d, p), _(d, b), v || (y = [
        le(
          o,
          "change",
          /*change_handler*/
          t[2]
        ),
        le(
          b,
          "change",
          /*change_handler_1*/
          t[3]
        )
      ], v = !0);
    },
    p(k, [w]) {
      w & /*$code_config*/
      2 && u !== (u = /*$code_config*/
      k[1].backend_var_name) && o.value !== u && (o.value = u), w & /*$code_config*/
      2 && g !== (g = /*$code_config*/
      k[1].as_function) && (b.checked = g);
    },
    i: ae,
    o: ae,
    d(k) {
      k && T(e), v = !1, vt(y);
    }
  };
}
function U$(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(r, (u) => l(1, i = u)), r);
  t.$$.on_destroy.push(() => n());
  let { code_config: r = Pe({}) } = e;
  a();
  const s = (u) => {
    r.update((c) => (c.backend_var_name = u.target.value, c));
  }, o = (u) => {
    r.update((c) => (c.as_function = u.target.checked, c));
  };
  return t.$$set = (u) => {
    "code_config" in u && a(l(0, r = u.code_config));
  }, [r, i, s, o];
}
class W$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, U$, K$, Le, { code_config: 0 });
  }
}
function Ph(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k;
  return e = new zl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      section_meta: Ml[0],
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      )
    }
  }), i = new zl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      section_meta: Ml[1],
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      )
    }
  }), a = new zl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      ),
      section_meta: Ml[2],
      hide: !0
    }
  }), s = new zl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      ),
      property_time: (
        /*property_time*/
        t[7]
      ),
      section_meta: Ml[3]
    }
  }), u = new zl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      ),
      section_meta: Ml[4],
      hide: !0
    }
  }), d = new zl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      ),
      section_meta: Ml[5],
      hide: !0
    }
  }), p = new zl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      ),
      section_meta: Ml[6],
      hide: !0
    }
  }), g = new zl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      ),
      section_meta: Ml[7],
      hide: !0
    }
  }), y = new zl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      ),
      section_meta: Ml[8]
    }
  }), {
    c() {
      he(e.$$.fragment), l = A(), he(i.$$.fragment), n = A(), he(a.$$.fragment), r = A(), he(s.$$.fragment), o = A(), he(u.$$.fragment), c = A(), he(d.$$.fragment), h = A(), he(p.$$.fragment), b = A(), he(g.$$.fragment), v = A(), he(y.$$.fragment);
    },
    m(w, $) {
      ce(e, w, $), C(w, l, $), ce(i, w, $), C(w, n, $), ce(a, w, $), C(w, r, $), ce(s, w, $), C(w, o, $), ce(u, w, $), C(w, c, $), ce(d, w, $), C(w, h, $), ce(p, w, $), C(w, b, $), ce(g, w, $), C(w, v, $), ce(y, w, $), k = !0;
    },
    p: ae,
    i(w) {
      k || (S(e.$$.fragment, w), S(i.$$.fragment, w), S(a.$$.fragment, w), S(s.$$.fragment, w), S(u.$$.fragment, w), S(d.$$.fragment, w), S(p.$$.fragment, w), S(g.$$.fragment, w), S(y.$$.fragment, w), k = !0);
    },
    o(w) {
      D(e.$$.fragment, w), D(i.$$.fragment, w), D(a.$$.fragment, w), D(s.$$.fragment, w), D(u.$$.fragment, w), D(d.$$.fragment, w), D(p.$$.fragment, w), D(g.$$.fragment, w), D(y.$$.fragment, w), k = !1;
    },
    d(w) {
      w && (T(l), T(n), T(r), T(o), T(c), T(h), T(b), T(v)), de(e, w), de(i, w), de(a, w), de(s, w), de(u, w), de(d, w), de(p, w), de(g, w), de(y, w);
    }
  };
}
function Eh(t) {
  let e, l;
  return e = new Y$({
    props: {
      timeMachineData: (
        /*timeMachineData*/
        t[9]
      ),
      closeTimeMachine: (
        /*closeTimeMachine*/
        t[11]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p: ae,
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function J$(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h;
  r = new W$({
    props: { code_config: (
      /*code_config*/
      t[6]
    ) }
  });
  let p = (
    /*$data*/
    t[1] && Ph(t)
  ), b = (
    /*showTimeMachine*/
    t[0] && Eh(t)
  );
  return {
    c() {
      e = m("section"), l = m("h3"), i = E(`Machine information
    `), n = m("button"), n.textContent = "Copy reusable code", a = A(), he(r.$$.fragment), s = A(), p && p.c(), o = A(), b && b.c(), u = Be(), f(n, "class", "svelte-1pb9xsa"), f(l, "class", "svelte-1pb9xsa"), f(e, "class", "wrap svelte-1pb9xsa"), f(e, "id", "machine-viewer-wrap");
    },
    m(g, v) {
      C(g, e, v), _(e, l), _(l, i), _(l, n), _(e, a), ce(r, e, null), _(e, s), p && p.m(e, null), C(g, o, v), b && b.m(g, v), C(g, u, v), c = !0, d || (h = le(
        n,
        "click",
        /*click_handler*/
        t[15]
      ), d = !0);
    },
    p(g, [v]) {
      /*$data*/
      g[1] ? p ? (p.p(g, v), v & /*$data*/
      2 && S(p, 1)) : (p = Ph(g), p.c(), S(p, 1), p.m(e, null)) : p && (ge(), D(p, 1, 1, () => {
        p = null;
      }), be()), /*showTimeMachine*/
      g[0] ? b ? (b.p(g, v), v & /*showTimeMachine*/
      1 && S(b, 1)) : (b = Eh(g), b.c(), S(b, 1), b.m(u.parentNode, u)) : b && (ge(), D(b, 1, 1, () => {
        b = null;
      }), be());
    },
    i(g) {
      c || (S(r.$$.fragment, g), S(p), S(b), c = !0);
    },
    o(g) {
      D(r.$$.fragment, g), D(p), D(b), c = !1;
    },
    d(g) {
      g && (T(e), T(o), T(u)), de(r), p && p.d(), b && b.d(g), d = !1, h();
    }
  };
}
function Z$(t, e, l) {
  let i, n, a, r, { model: s } = e, { data_key: o = "machine_data", output_key: u = "code" } = e, c = s.get(o), d = JSON.parse(c), h = `change:${o}`, p = () => circ = s.get(o), b = Pe();
  at(t, b, (N) => l(1, i = N));
  let g = Pe([]);
  at(t, g, (N) => l(16, n = N));
  let v = Pe("");
  at(t, v, (N) => l(2, r = N));
  let y = Pe({
    backend_var_name: "backend",
    as_function: !0
  });
  at(t, y, (N) => l(17, a = N));
  let k = Pe("current");
  yt(() => {
    b.set(d), s.on(h, p), g.subscribe((N) => {
      v.set(cc(N, a));
    }), y.subscribe((N) => {
      v.set(cc(n, N));
    }), v.subscribe((N) => {
      s.set(u, N), s.save_changes();
    }), console.log(i);
  }), fi(() => {
    s.off(h, p);
  });
  function w(N) {
    g.update((M) => (M.includes(N) ? M.splice(M.indexOf(N), 1) : M.push(N), M));
  }
  let $ = !1, q = Pe();
  function j(N) {
    let M = i.timed_properties, H = [];
    if (N.datatype === "nudv-map")
      for (const B of Object.keys(M)) {
        let R = { date: B };
        N.subtype === "qubit-property" ? R.data = M[B][N.parentKey][N.qubit_index][N.property] : R.data = M[B][N.parentKey][N.key], H.push(R);
      }
    else if (N.datatype === "gates")
      for (const B of Object.keys(M)) {
        let R = M[B][N.parentKey].filter((P) => P.gate === N.data.gate && P.qubits.join("-") === N.data.qubits.join("-"))[0];
        H.push({ date: B, data: R });
      }
    l(0, $ = !0), q.set({
      datatype: N.datatype,
      key: N.key,
      title_key: N.title_key,
      parentKey: N.parentKey,
      topLevelKey: N.topLevelKey,
      code_header: N.code_header,
      code_footer: N.code_footer,
      code_key: N.code_key,
      curr_data: N.data,
      history_data: H
    });
  }
  function O() {
    l(0, $ = !1);
  }
  const z = (N) => {
    ii(r);
  };
  return t.$$set = (N) => {
    "model" in N && l(12, s = N.model), "data_key" in N && l(13, o = N.data_key), "output_key" in N && l(14, u = N.output_key);
  }, [
    $,
    i,
    r,
    b,
    g,
    v,
    y,
    k,
    w,
    q,
    j,
    O,
    s,
    o,
    u,
    z
  ];
}
class x$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, Z$, J$, Le, { model: 12, data_key: 13, output_key: 14 });
  }
}
const e6 = 14, t6 = 10, l6 = 250, Ta = 22, Yt = 10, i6 = 2, n6 = 2, a6 = "#FF5733", r6 = "#0b7ad6", s6 = "#000000", Oh = 36, o6 = 5, u6 = {
  h: "H",
  v: "V",
  horizontal: "H",
  vertical: "V"
}, ql = "H", Pl = "V";
function f6(t, e) {
  let l = {}, i = Object.keys(t.data), n = i.length, a = u6[e.direction];
  l.dir = a;
  let r = e.band_width || e6, s = e.band_gap || t6, o = e.x_axis_area_size || Ta, u = e.y_axis_area_size || (a === ql ? Ta * 3 : Ta * 2), c = e.padding || Yt, d = e.chart_height || l6, h = e.legend === void 0 || e.legend ? Oh : 0, p = e.legend === void 0 || e.legend ? Oh + Yt : 0, b = e.legend_rect_size || o6, g = e.dot_radius || i6, v = e.rule_width || n6, y = e.true_color || a6, k = e.hypo_color || r6, w = e.interval_color || s6;
  if (l.padding = c, a === Pl) {
    let $ = 0;
    if (i.some((j) => j.length > 5)) {
      $ = -25;
      let j = Math.max(...i.map((O) => O.length));
      o = Math.ceil(o + Ta * (j / 10));
    }
    let q = (r + s * 2) * n;
    l.width = q + u + c * 2, l.height = d + o + c * 2 + p, l.y_axis = {
      width: u,
      height: d,
      x: Yt,
      y: Yt + p
    }, l.x_axis = {
      width: q,
      height: o,
      x: Yt + u,
      y: Yt + d + p,
      rotate: $
    }, l.chart = {
      width: q,
      height: d,
      x: Yt + u,
      y: Yt + p,
      band_total_width: r + s * 2,
      band_width: r,
      band_gap: s,
      dot_radius: g,
      rule_width: v,
      true_color: y,
      hypo_color: k,
      interval_color: w
    };
  } else if (a === ql) {
    let $ = (r + s * 2) * n;
    l.height = $ + o + c * 2 + p, l.width = d + u + c * 2, l.y_axis = {
      width: u,
      height: $,
      x: Yt,
      y: Yt + p
    }, l.x_axis = {
      width: d,
      height: o,
      x: Yt + u,
      y: Yt + $ + p
    }, l.chart = {
      width: d,
      height: $,
      x: Yt + u,
      y: Yt + p,
      band_total_width: r + s * 2,
      band_width: r,
      band_gap: s,
      dot_radius: g,
      rule_width: v,
      true_color: y,
      hypo_color: k,
      interval_color: w
    };
  }
  return (e.legend === void 0 || e.legend) && (l.legend = {
    height: h,
    x: Yt,
    y: Yt,
    true_color: y,
    hypo_color: k,
    legend_rect_size: b
  }), l.viewBox = [0, 0, l.width, l.height], l;
}
function _6(t, e, l) {
  let i = {}, n = Object.keys(t.data);
  n = n.toSorted(ai);
  let a = 0;
  if (t.metadata.bootstrap)
    a = 1;
  else
    for (let s of n) {
      let o = Mr(t.counts[s]);
      o > a && (a = o);
    }
  let r = n.map((s, o) => l.chart.band_total_width * o);
  return l.dir === Pl ? (i.y = Rl([0, a], [l.chart.height, 0]).nice(), i.x = Rr(n, r)) : l.dir === ql && (i.x = Rl([0, a], [0, l.chart.width]).nice(), i.y = Rr(n, r)), i;
}
function c6(t) {
  let e, l, i, n, a, r, s, o, u;
  return {
    c() {
      e = Xe("g"), l = Xe("rect"), f(
        l,
        "id",
        /*id*/
        t[0]
      ), f(
        l,
        "data-index",
        /*index*/
        t[1]
      ), f(
        l,
        "data-state",
        /*state*/
        t[2]
      ), f(l, "class", "mark dot"), f(
        l,
        "fill",
        /*fill*/
        t[5]
      ), f(l, "y", i = /*sizing*/
      t[6].chart.band_total_width / 2), f(l, "x", n = /*scaleX*/
      t[3](
        /*quant_value*/
        t[7]
      )), f(l, "height", a = /*sizing*/
      t[6].chart.band_width), f(l, "width", r = /*sizing*/
      t[6].chart.rule_width), f(l, "transform", s = `translate(-${/*sizing*/
      t[6].chart.rule_width / 2} -${/*sizing*/
      t[6].chart.band_width / 2})`), f(e, "class", "mark-wrap"), f(
        e,
        "data-index",
        /*index*/
        t[1]
      ), f(
        e,
        "data-state",
        /*state*/
        t[2]
      ), f(e, "transform", o = `translate(0 ${/*scaleY*/
      t[4](
        /*state*/
        t[2]
      )})`), f(e, "height", u = /*sizing*/
      t[6].chart.band_total_width);
    },
    m(c, d) {
      C(c, e, d), _(e, l);
    },
    p(c, d) {
      d & /*id*/
      1 && f(
        l,
        "id",
        /*id*/
        c[0]
      ), d & /*index*/
      2 && f(
        l,
        "data-index",
        /*index*/
        c[1]
      ), d & /*state*/
      4 && f(
        l,
        "data-state",
        /*state*/
        c[2]
      ), d & /*fill*/
      32 && f(
        l,
        "fill",
        /*fill*/
        c[5]
      ), d & /*sizing*/
      64 && i !== (i = /*sizing*/
      c[6].chart.band_total_width / 2) && f(l, "y", i), d & /*scaleX, quant_value*/
      136 && n !== (n = /*scaleX*/
      c[3](
        /*quant_value*/
        c[7]
      )) && f(l, "x", n), d & /*sizing*/
      64 && a !== (a = /*sizing*/
      c[6].chart.band_width) && f(l, "height", a), d & /*sizing*/
      64 && r !== (r = /*sizing*/
      c[6].chart.rule_width) && f(l, "width", r), d & /*sizing*/
      64 && s !== (s = `translate(-${/*sizing*/
      c[6].chart.rule_width / 2} -${/*sizing*/
      c[6].chart.band_width / 2})`) && f(l, "transform", s), d & /*index*/
      2 && f(
        e,
        "data-index",
        /*index*/
        c[1]
      ), d & /*state*/
      4 && f(
        e,
        "data-state",
        /*state*/
        c[2]
      ), d & /*scaleY, state*/
      20 && o !== (o = `translate(0 ${/*scaleY*/
      c[4](
        /*state*/
        c[2]
      )})`) && f(e, "transform", o), d & /*sizing*/
      64 && u !== (u = /*sizing*/
      c[6].chart.band_total_width) && f(e, "height", u);
    },
    d(c) {
      c && T(e);
    }
  };
}
function d6(t) {
  let e, l, i, n, a, r, s, o, u;
  return {
    c() {
      e = Xe("g"), l = Xe("rect"), f(
        l,
        "id",
        /*id*/
        t[0]
      ), f(
        l,
        "data-index",
        /*index*/
        t[1]
      ), f(
        l,
        "data-state",
        /*state*/
        t[2]
      ), f(l, "class", "mark dot"), f(
        l,
        "fill",
        /*fill*/
        t[5]
      ), f(l, "x", i = /*sizing*/
      t[6].chart.band_total_width / 2), f(l, "y", n = /*scaleY*/
      t[4](
        /*quant_value*/
        t[7]
      )), f(l, "width", a = /*sizing*/
      t[6].chart.band_width), f(l, "height", r = /*sizing*/
      t[6].chart.rule_width), f(l, "transform", s = `translate(-${/*sizing*/
      t[6].chart.band_width / 2} -${/*sizing*/
      t[6].chart.rule_width / 2})`), f(e, "class", "mark-wrap"), f(
        e,
        "data-index",
        /*index*/
        t[1]
      ), f(
        e,
        "data-state",
        /*state*/
        t[2]
      ), f(e, "transform", o = `translate(${/*scaleX*/
      t[3](
        /*state*/
        t[2]
      )} 0)`), f(e, "width", u = /*sizing*/
      t[6].chart.band_total_width);
    },
    m(c, d) {
      C(c, e, d), _(e, l);
    },
    p(c, d) {
      d & /*id*/
      1 && f(
        l,
        "id",
        /*id*/
        c[0]
      ), d & /*index*/
      2 && f(
        l,
        "data-index",
        /*index*/
        c[1]
      ), d & /*state*/
      4 && f(
        l,
        "data-state",
        /*state*/
        c[2]
      ), d & /*fill*/
      32 && f(
        l,
        "fill",
        /*fill*/
        c[5]
      ), d & /*sizing*/
      64 && i !== (i = /*sizing*/
      c[6].chart.band_total_width / 2) && f(l, "x", i), d & /*scaleY, quant_value*/
      144 && n !== (n = /*scaleY*/
      c[4](
        /*quant_value*/
        c[7]
      )) && f(l, "y", n), d & /*sizing*/
      64 && a !== (a = /*sizing*/
      c[6].chart.band_width) && f(l, "width", a), d & /*sizing*/
      64 && r !== (r = /*sizing*/
      c[6].chart.rule_width) && f(l, "height", r), d & /*sizing*/
      64 && s !== (s = `translate(-${/*sizing*/
      c[6].chart.band_width / 2} -${/*sizing*/
      c[6].chart.rule_width / 2})`) && f(l, "transform", s), d & /*index*/
      2 && f(
        e,
        "data-index",
        /*index*/
        c[1]
      ), d & /*state*/
      4 && f(
        e,
        "data-state",
        /*state*/
        c[2]
      ), d & /*scaleX, state*/
      12 && o !== (o = `translate(${/*scaleX*/
      c[3](
        /*state*/
        c[2]
      )} 0)`) && f(e, "transform", o), d & /*sizing*/
      64 && u !== (u = /*sizing*/
      c[6].chart.band_total_width) && f(e, "width", u);
    },
    d(c) {
      c && T(e);
    }
  };
}
function h6(t) {
  let e;
  function l(a, r) {
    if (
      /*sizing*/
      a[6].dir === Pl
    )
      return d6;
    if (
      /*sizing*/
      a[6].dir === ql
    )
      return c6;
  }
  let i = l(t), n = i && i(t);
  return {
    c() {
      n && n.c(), e = Be();
    },
    m(a, r) {
      n && n.m(a, r), C(a, e, r);
    },
    p(a, [r]) {
      i === (i = l(a)) && n ? n.p(a, r) : (n && n.d(1), n = i && i(a), n && (n.c(), n.m(e.parentNode, e)));
    },
    i: ae,
    o: ae,
    d(a) {
      a && T(e), n && n.d(a);
    }
  };
}
function p6(t, e, l) {
  let { id: i = "", index: n, state: a = "", datum: r = {}, scaleX: s = () => {
  }, scaleY: o = () => {
  }, fill: u = "#000000", sizing: c = {}, key: d = "", HOPS: h = !1, HOPS_speed: p = 500, count_data: b = [] } = e, g, v, y = 0;
  function k(w, $) {
    y = 0, w ? v = setInterval(
      () => {
        l(7, g = b[y]), y = (y + 1) % b.length;
      },
      $
    ) : l(7, g = r[d]);
  }
  return yt(() => {
    k(h, p);
  }), fi(() => {
    clearInterval(v);
  }), t.$$set = (w) => {
    "id" in w && l(0, i = w.id), "index" in w && l(1, n = w.index), "state" in w && l(2, a = w.state), "datum" in w && l(8, r = w.datum), "scaleX" in w && l(3, s = w.scaleX), "scaleY" in w && l(4, o = w.scaleY), "fill" in w && l(5, u = w.fill), "sizing" in w && l(6, c = w.sizing), "key" in w && l(9, d = w.key), "HOPS" in w && l(10, h = w.HOPS), "HOPS_speed" in w && l(11, p = w.HOPS_speed), "count_data" in w && l(12, b = w.count_data);
  }, [
    i,
    n,
    a,
    s,
    o,
    u,
    c,
    g,
    r,
    d,
    h,
    p,
    b
  ];
}
class Ih extends Ve {
  constructor(e) {
    super(), Qe(this, e, p6, h6, Le, {
      id: 0,
      index: 1,
      state: 2,
      datum: 8,
      scaleX: 3,
      scaleY: 4,
      fill: 5,
      sizing: 6,
      key: 9,
      HOPS: 10,
      HOPS_speed: 11,
      count_data: 12
    });
  }
}
function m6(t) {
  let e, l, i, n, a, r, s, o;
  return {
    c() {
      e = Xe("g"), l = Xe("line"), f(
        l,
        "id",
        /*id*/
        t[0]
      ), f(
        l,
        "data-index",
        /*index*/
        t[1]
      ), f(
        l,
        "data-state",
        /*state*/
        t[2]
      ), f(l, "class", "mark interval"), f(
        l,
        "stroke",
        /*stroke*/
        t[7]
      ), f(l, "stroke-width", "1"), f(l, "y1", i = /*sizing*/
      t[8].chart.band_total_width / 2 - 0.5), f(l, "y2", n = /*sizing*/
      t[8].chart.band_total_width / 2 - 0.5), f(l, "x1", a = /*scaleX*/
      t[5](
        /*datum*/
        t[3][
          /*key*/
          t[4]
        ][0]
      )), f(l, "x2", r = /*scaleX*/
      t[5](
        /*datum*/
        t[3][
          /*key*/
          t[4]
        ][1]
      )), f(e, "class", "mark-wrap"), f(
        e,
        "data-index",
        /*index*/
        t[1]
      ), f(
        e,
        "data-state",
        /*state*/
        t[2]
      ), f(e, "transform", s = `translate(0 ${/*scaleY*/
      t[6](
        /*state*/
        t[2]
      )})`), f(e, "height", o = /*sizing*/
      t[8].chart.band_total_width);
    },
    m(u, c) {
      C(u, e, c), _(e, l);
    },
    p(u, c) {
      c & /*id*/
      1 && f(
        l,
        "id",
        /*id*/
        u[0]
      ), c & /*index*/
      2 && f(
        l,
        "data-index",
        /*index*/
        u[1]
      ), c & /*state*/
      4 && f(
        l,
        "data-state",
        /*state*/
        u[2]
      ), c & /*stroke*/
      128 && f(
        l,
        "stroke",
        /*stroke*/
        u[7]
      ), c & /*sizing*/
      256 && i !== (i = /*sizing*/
      u[8].chart.band_total_width / 2 - 0.5) && f(l, "y1", i), c & /*sizing*/
      256 && n !== (n = /*sizing*/
      u[8].chart.band_total_width / 2 - 0.5) && f(l, "y2", n), c & /*scaleX, datum, key*/
      56 && a !== (a = /*scaleX*/
      u[5](
        /*datum*/
        u[3][
          /*key*/
          u[4]
        ][0]
      )) && f(l, "x1", a), c & /*scaleX, datum, key*/
      56 && r !== (r = /*scaleX*/
      u[5](
        /*datum*/
        u[3][
          /*key*/
          u[4]
        ][1]
      )) && f(l, "x2", r), c & /*index*/
      2 && f(
        e,
        "data-index",
        /*index*/
        u[1]
      ), c & /*state*/
      4 && f(
        e,
        "data-state",
        /*state*/
        u[2]
      ), c & /*scaleY, state*/
      68 && s !== (s = `translate(0 ${/*scaleY*/
      u[6](
        /*state*/
        u[2]
      )})`) && f(e, "transform", s), c & /*sizing*/
      256 && o !== (o = /*sizing*/
      u[8].chart.band_total_width) && f(e, "height", o);
    },
    d(u) {
      u && T(e);
    }
  };
}
function g6(t) {
  let e, l, i, n, a, r, s, o;
  return {
    c() {
      e = Xe("g"), l = Xe("line"), f(
        l,
        "id",
        /*id*/
        t[0]
      ), f(
        l,
        "data-index",
        /*index*/
        t[1]
      ), f(
        l,
        "data-state",
        /*state*/
        t[2]
      ), f(l, "class", "mark interval"), f(
        l,
        "stroke",
        /*stroke*/
        t[7]
      ), f(l, "stroke-width", "1"), f(l, "x1", i = /*sizing*/
      t[8].chart.band_total_width / 2 - 0.5), f(l, "x2", n = /*sizing*/
      t[8].chart.band_total_width / 2 - 0.5), f(l, "y1", a = /*scaleY*/
      t[6](
        /*datum*/
        t[3][
          /*key*/
          t[4]
        ][0]
      )), f(l, "y2", r = /*scaleY*/
      t[6](
        /*datum*/
        t[3][
          /*key*/
          t[4]
        ][1]
      )), f(e, "class", "interval-wrap"), f(
        e,
        "data-index",
        /*index*/
        t[1]
      ), f(
        e,
        "data-state",
        /*state*/
        t[2]
      ), f(e, "transform", s = `translate(${/*scaleX*/
      t[5](
        /*state*/
        t[2]
      )} 0)`), f(e, "width", o = /*sizing*/
      t[8].chart.band_total_width);
    },
    m(u, c) {
      C(u, e, c), _(e, l);
    },
    p(u, c) {
      c & /*id*/
      1 && f(
        l,
        "id",
        /*id*/
        u[0]
      ), c & /*index*/
      2 && f(
        l,
        "data-index",
        /*index*/
        u[1]
      ), c & /*state*/
      4 && f(
        l,
        "data-state",
        /*state*/
        u[2]
      ), c & /*stroke*/
      128 && f(
        l,
        "stroke",
        /*stroke*/
        u[7]
      ), c & /*sizing*/
      256 && i !== (i = /*sizing*/
      u[8].chart.band_total_width / 2 - 0.5) && f(l, "x1", i), c & /*sizing*/
      256 && n !== (n = /*sizing*/
      u[8].chart.band_total_width / 2 - 0.5) && f(l, "x2", n), c & /*scaleY, datum, key*/
      88 && a !== (a = /*scaleY*/
      u[6](
        /*datum*/
        u[3][
          /*key*/
          u[4]
        ][0]
      )) && f(l, "y1", a), c & /*scaleY, datum, key*/
      88 && r !== (r = /*scaleY*/
      u[6](
        /*datum*/
        u[3][
          /*key*/
          u[4]
        ][1]
      )) && f(l, "y2", r), c & /*index*/
      2 && f(
        e,
        "data-index",
        /*index*/
        u[1]
      ), c & /*state*/
      4 && f(
        e,
        "data-state",
        /*state*/
        u[2]
      ), c & /*scaleX, state*/
      36 && s !== (s = `translate(${/*scaleX*/
      u[5](
        /*state*/
        u[2]
      )} 0)`) && f(e, "transform", s), c & /*sizing*/
      256 && o !== (o = /*sizing*/
      u[8].chart.band_total_width) && f(e, "width", o);
    },
    d(u) {
      u && T(e);
    }
  };
}
function b6(t) {
  let e;
  function l(a, r) {
    if (
      /*sizing*/
      a[8].dir === Pl
    )
      return g6;
    if (
      /*sizing*/
      a[8].dir === ql
    )
      return m6;
  }
  let i = l(t), n = i && i(t);
  return {
    c() {
      n && n.c(), e = Be();
    },
    m(a, r) {
      n && n.m(a, r), C(a, e, r);
    },
    p(a, [r]) {
      i === (i = l(a)) && n ? n.p(a, r) : (n && n.d(1), n = i && i(a), n && (n.c(), n.m(e.parentNode, e)));
    },
    i: ae,
    o: ae,
    d(a) {
      a && T(e), n && n.d(a);
    }
  };
}
function v6(t, e, l) {
  let { id: i = "", index: n, state: a = "", datum: r = {}, key: s = "", scaleX: o = () => {
  }, scaleY: u = () => {
  }, stroke: c = "#000000", sizing: d = {} } = e;
  return t.$$set = (h) => {
    "id" in h && l(0, i = h.id), "index" in h && l(1, n = h.index), "state" in h && l(2, a = h.state), "datum" in h && l(3, r = h.datum), "key" in h && l(4, s = h.key), "scaleX" in h && l(5, o = h.scaleX), "scaleY" in h && l(6, u = h.scaleY), "stroke" in h && l(7, c = h.stroke), "sizing" in h && l(8, d = h.sizing);
  }, [i, n, a, r, s, o, u, c, d];
}
class k6 extends Ve {
  constructor(e) {
    super(), Qe(this, e, v6, b6, Le, {
      id: 0,
      index: 1,
      state: 2,
      datum: 3,
      key: 4,
      scaleX: 5,
      scaleY: 6,
      stroke: 7,
      sizing: 8
    });
  }
}
function y6(t) {
  let e, l, i, n, a, r, s, o, u;
  return {
    c() {
      e = Xe("g"), a = A(), r = Xe("g"), f(e, "id", l = /*id*/
      t[0] + "-group"), f(e, "class", i = "axis " + /*role*/
      t[1] + " quantitative"), f(e, "transform", n = `translate(${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].x + /*sizing*/
      t[3][
        /*role*/
        t[1]
      ].width} ${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].y})`), f(r, "id", s = /*id*/
      t[0] + "-group-grid"), f(r, "class", o = "grid " + /*role*/
      t[1] + " quantitative"), f(r, "transform", u = `translate(${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].x + /*sizing*/
      t[3][
        /*role*/
        t[1]
      ].width} ${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].y})`);
    },
    m(c, d) {
      C(c, e, d), C(c, a, d), C(c, r, d);
    },
    p(c, d) {
      d & /*id*/
      1 && l !== (l = /*id*/
      c[0] + "-group") && f(e, "id", l), d & /*role*/
      2 && i !== (i = "axis " + /*role*/
      c[1] + " quantitative") && f(e, "class", i), d & /*sizing, role*/
      10 && n !== (n = `translate(${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].x + /*sizing*/
      c[3][
        /*role*/
        c[1]
      ].width} ${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].y})`) && f(e, "transform", n), d & /*id*/
      1 && s !== (s = /*id*/
      c[0] + "-group-grid") && f(r, "id", s), d & /*role*/
      2 && o !== (o = "grid " + /*role*/
      c[1] + " quantitative") && f(r, "class", o), d & /*sizing, role*/
      10 && u !== (u = `translate(${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].x + /*sizing*/
      c[3][
        /*role*/
        c[1]
      ].width} ${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].y})`) && f(r, "transform", u);
    },
    d(c) {
      c && (T(e), T(a), T(r));
    }
  };
}
function w6(t) {
  let e, l, i, n;
  return {
    c() {
      e = Xe("g"), f(e, "id", l = /*id*/
      t[0] + "-group"), f(e, "class", i = "axis " + /*role*/
      t[1] + " nominal"), f(e, "transform", n = `translate(${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].x + /*nominal_offset*/
      t[4]} ${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].y + 1})`);
    },
    m(a, r) {
      C(a, e, r);
    },
    p(a, r) {
      r & /*id*/
      1 && l !== (l = /*id*/
      a[0] + "-group") && f(e, "id", l), r & /*role*/
      2 && i !== (i = "axis " + /*role*/
      a[1] + " nominal") && f(e, "class", i), r & /*sizing, role, nominal_offset*/
      26 && n !== (n = `translate(${/*sizing*/
      a[3][
        /*role*/
        a[1]
      ].x + /*nominal_offset*/
      a[4]} ${/*sizing*/
      a[3][
        /*role*/
        a[1]
      ].y + 1})`) && f(e, "transform", n);
    },
    d(a) {
      a && T(e);
    }
  };
}
function $6(t) {
  let e, l, i, n;
  return {
    c() {
      e = Xe("g"), f(e, "id", l = /*id*/
      t[0] + "-group"), f(e, "class", i = "axis " + /*role*/
      t[1] + " nominal"), f(e, "transform", n = `translate(${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].x + /*sizing*/
      t[3][
        /*role*/
        t[1]
      ].width - 1} ${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].y + /*nominal_offset*/
      t[4]})`);
    },
    m(a, r) {
      C(a, e, r);
    },
    p(a, r) {
      r & /*id*/
      1 && l !== (l = /*id*/
      a[0] + "-group") && f(e, "id", l), r & /*role*/
      2 && i !== (i = "axis " + /*role*/
      a[1] + " nominal") && f(e, "class", i), r & /*sizing, role, nominal_offset*/
      26 && n !== (n = `translate(${/*sizing*/
      a[3][
        /*role*/
        a[1]
      ].x + /*sizing*/
      a[3][
        /*role*/
        a[1]
      ].width - 1} ${/*sizing*/
      a[3][
        /*role*/
        a[1]
      ].y + /*nominal_offset*/
      a[4]})`) && f(e, "transform", n);
    },
    d(a) {
      a && T(e);
    }
  };
}
function q6(t) {
  let e, l, i, n, a, r, s, o, u;
  return {
    c() {
      e = Xe("g"), a = A(), r = Xe("g"), f(e, "id", l = /*id*/
      t[0] + "-group"), f(e, "class", i = "axis " + /*role*/
      t[1] + " quantitative"), f(e, "transform", n = `translate(${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].x} ${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].y})`), f(r, "id", s = /*id*/
      t[0] + "-group-grid"), f(r, "class", o = "grid " + /*role*/
      t[1] + " quantitative"), f(r, "transform", u = `translate(${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].x} ${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].y})`);
    },
    m(c, d) {
      C(c, e, d), C(c, a, d), C(c, r, d);
    },
    p(c, d) {
      d & /*id*/
      1 && l !== (l = /*id*/
      c[0] + "-group") && f(e, "id", l), d & /*role*/
      2 && i !== (i = "axis " + /*role*/
      c[1] + " quantitative") && f(e, "class", i), d & /*sizing, role*/
      10 && n !== (n = `translate(${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].x} ${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].y})`) && f(e, "transform", n), d & /*id*/
      1 && s !== (s = /*id*/
      c[0] + "-group-grid") && f(r, "id", s), d & /*role*/
      2 && o !== (o = "grid " + /*role*/
      c[1] + " quantitative") && f(r, "class", o), d & /*sizing, role*/
      10 && u !== (u = `translate(${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].x} ${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].y})`) && f(r, "transform", u);
    },
    d(c) {
      c && (T(e), T(a), T(r));
    }
  };
}
function Dh(t) {
  let e;
  function l(a, r) {
    if (
      /*role*/
      a[1] === "x_axis" && /*sizing*/
      a[3].dir === ql
    )
      return q6;
    if (
      /*role*/
      a[1] === "y_axis" && /*sizing*/
      a[3].dir === ql
    )
      return $6;
    if (
      /*role*/
      a[1] === "x_axis" && /*sizing*/
      a[3].dir === Pl
    )
      return w6;
    if (
      /*role*/
      a[1] === "y_axis" && /*sizing*/
      a[3].dir === Pl
    )
      return y6;
  }
  let i = l(t), n = i && i(t);
  return {
    c() {
      n && n.c(), e = Be();
    },
    m(a, r) {
      n && n.m(a, r), C(a, e, r);
    },
    p(a, r) {
      i === (i = l(a)) && n ? n.p(a, r) : (n && n.d(1), n = i && i(a), n && (n.c(), n.m(e.parentNode, e)));
    },
    d(a) {
      a && T(e), n && n.d(a);
    }
  };
}
function j6(t) {
  let e = (
    /*scales*/
    t[2]
  ), l, i = Dh(t);
  return {
    c() {
      i.c(), l = Be();
    },
    m(n, a) {
      i.m(n, a), C(n, l, a);
    },
    p(n, [a]) {
      a & /*scales*/
      4 && Le(e, e = /*scales*/
      n[2]) ? (i.d(1), i = Dh(n), i.c(), i.m(l.parentNode, l)) : i.p(n, a);
    },
    i: ae,
    o: ae,
    d(n) {
      n && T(l), i.d(n);
    }
  };
}
function T6(t, e, l) {
  let { id: i, role: n, scales: a = Pe({}), sizing: r, bootstrap: s = !1 } = e, o, u, c, d, h = 0, p = 0;
  function b(g) {
    o = void 0, u = void 0, c = void 0, d = void 0, l(4, h = 0), p = 0, u = _u("#" + i + "-group"), n === "x_axis" ? (o = t2().scale(g), r.dir === ql ? (o.tickFormat(Wt(s ? ".3" : ",.0f")), c = xb().scale(g), c.tickFormat((v) => null).tickSize(r.chart.height)) : r.dir === Pl && (p = r.x_axis.rotate)) : n === "y_axis" && (o = l2().scale(g), r.dir === ql || r.dir === Pl && (o.tickFormat(Wt(s ? ".3" : ",.0f")), c = e2().scale(g), c.tickFormat((v) => null).tickSize(r.chart.width))), l(4, h = r.chart.band_total_width / 2), u.call(o), p && u.selectAll("text").style("text-anchor", "end").attr("dx", "-.5em").attr("dy", ".10em").attr("transform", `rotate(${p})`), c && (d = _u("#" + i + "-group-grid"), d.call(c));
  }
  return yt(() => {
    a.subscribe((g) => {
      g && b(n === "y_axis" ? g == null ? void 0 : g.y : g == null ? void 0 : g.x);
    });
  }), t.$$set = (g) => {
    "id" in g && l(0, i = g.id), "role" in g && l(1, n = g.role), "scales" in g && l(2, a = g.scales), "sizing" in g && l(3, r = g.sizing), "bootstrap" in g && l(5, s = g.bootstrap);
  }, [i, n, a, r, h, s];
}
class Rh extends Ve {
  constructor(e) {
    super(), Qe(this, e, T6, j6, Le, {
      id: 0,
      role: 1,
      scales: 2,
      sizing: 3,
      bootstrap: 5
    });
  }
}
function C6(t) {
  let e, l, i, n, a, r, s, o;
  return {
    c() {
      e = Xe("g"), l = Xe("rect"), f(
        l,
        "id",
        /*id*/
        t[0]
      ), f(
        l,
        "data-index",
        /*index*/
        t[1]
      ), f(
        l,
        "data-state",
        /*state*/
        t[2]
      ), f(l, "class", "click-wrap"), f(l, "fill", "transparent"), f(l, "x", 0), f(l, "y", 0), f(l, "height", i = /*sizing*/
      t[6].chart.band_total_width), f(l, "width", n = /*sizing*/
      t[6].chart.width), f(e, "class", "mark-wrap"), f(
        e,
        "data-index",
        /*index*/
        t[1]
      ), f(
        e,
        "data-state",
        /*state*/
        t[2]
      ), f(e, "transform", a = `translate(0 ${/*scaleY*/
      t[5](
        /*state*/
        t[2]
      )})`), f(e, "height", r = /*sizing*/
      t[6].chart.band_total_width);
    },
    m(u, c) {
      C(u, e, c), _(e, l), s || (o = le(
        l,
        "click",
        /*click_handler_1*/
        t[9]
      ), s = !0);
    },
    p(u, c) {
      c & /*id*/
      1 && f(
        l,
        "id",
        /*id*/
        u[0]
      ), c & /*index*/
      2 && f(
        l,
        "data-index",
        /*index*/
        u[1]
      ), c & /*state*/
      4 && f(
        l,
        "data-state",
        /*state*/
        u[2]
      ), c & /*sizing*/
      64 && i !== (i = /*sizing*/
      u[6].chart.band_total_width) && f(l, "height", i), c & /*sizing*/
      64 && n !== (n = /*sizing*/
      u[6].chart.width) && f(l, "width", n), c & /*index*/
      2 && f(
        e,
        "data-index",
        /*index*/
        u[1]
      ), c & /*state*/
      4 && f(
        e,
        "data-state",
        /*state*/
        u[2]
      ), c & /*scaleY, state*/
      36 && a !== (a = `translate(0 ${/*scaleY*/
      u[5](
        /*state*/
        u[2]
      )})`) && f(e, "transform", a), c & /*sizing*/
      64 && r !== (r = /*sizing*/
      u[6].chart.band_total_width) && f(e, "height", r);
    },
    d(u) {
      u && T(e), s = !1, o();
    }
  };
}
function S6(t) {
  let e, l, i, n, a, r, s, o;
  return {
    c() {
      e = Xe("g"), l = Xe("rect"), f(
        l,
        "id",
        /*id*/
        t[0]
      ), f(
        l,
        "data-index",
        /*index*/
        t[1]
      ), f(
        l,
        "data-state",
        /*state*/
        t[2]
      ), f(l, "class", "click-wrap"), f(l, "fill", "transparent"), f(l, "x", 0), f(l, "y", 0), f(l, "width", i = /*sizing*/
      t[6].chart.band_total_width), f(l, "height", n = /*sizing*/
      t[6].chart.height), f(e, "class", "click-wrap"), f(
        e,
        "data-index",
        /*index*/
        t[1]
      ), f(
        e,
        "data-state",
        /*state*/
        t[2]
      ), f(e, "transform", a = `translate(${/*scaleX*/
      t[4](
        /*state*/
        t[2]
      )} 0)`), f(e, "width", r = /*sizing*/
      t[6].chart.band_total_width);
    },
    m(u, c) {
      C(u, e, c), _(e, l), s || (o = le(
        l,
        "click",
        /*click_handler*/
        t[8]
      ), s = !0);
    },
    p(u, c) {
      c & /*id*/
      1 && f(
        l,
        "id",
        /*id*/
        u[0]
      ), c & /*index*/
      2 && f(
        l,
        "data-index",
        /*index*/
        u[1]
      ), c & /*state*/
      4 && f(
        l,
        "data-state",
        /*state*/
        u[2]
      ), c & /*sizing*/
      64 && i !== (i = /*sizing*/
      u[6].chart.band_total_width) && f(l, "width", i), c & /*sizing*/
      64 && n !== (n = /*sizing*/
      u[6].chart.height) && f(l, "height", n), c & /*index*/
      2 && f(
        e,
        "data-index",
        /*index*/
        u[1]
      ), c & /*state*/
      4 && f(
        e,
        "data-state",
        /*state*/
        u[2]
      ), c & /*scaleX, state*/
      20 && a !== (a = `translate(${/*scaleX*/
      u[4](
        /*state*/
        u[2]
      )} 0)`) && f(e, "transform", a), c & /*sizing*/
      64 && r !== (r = /*sizing*/
      u[6].chart.band_total_width) && f(e, "width", r);
    },
    d(u) {
      u && T(e), s = !1, o();
    }
  };
}
function M6(t) {
  let e;
  function l(a, r) {
    if (
      /*sizing*/
      a[6].dir === Pl
    )
      return S6;
    if (
      /*sizing*/
      a[6].dir === ql
    )
      return C6;
  }
  let i = l(t), n = i && i(t);
  return {
    c() {
      n && n.c(), e = Be();
    },
    m(a, r) {
      n && n.m(a, r), C(a, e, r);
    },
    p(a, [r]) {
      i === (i = l(a)) && n ? n.p(a, r) : (n && n.d(1), n = i && i(a), n && (n.c(), n.m(e.parentNode, e)));
    },
    i: ae,
    o: ae,
    d(a) {
      a && T(e), n && n.d(a);
    }
  };
}
function z6(t, e, l) {
  let { id: i = "", index: n, state: a = "", datum: r = {}, scaleX: s = () => {
  }, scaleY: o = () => {
  }, sizing: u = {}, show_info: c = () => {
  } } = e;
  const d = (p) => {
    c(r);
  }, h = (p) => {
    c(r);
  };
  return t.$$set = (p) => {
    "id" in p && l(0, i = p.id), "index" in p && l(1, n = p.index), "state" in p && l(2, a = p.state), "datum" in p && l(3, r = p.datum), "scaleX" in p && l(4, s = p.scaleX), "scaleY" in p && l(5, o = p.scaleY), "sizing" in p && l(6, u = p.sizing), "show_info" in p && l(7, c = p.show_info);
  }, [
    i,
    n,
    a,
    r,
    s,
    o,
    u,
    c,
    d,
    h
  ];
}
class N6 extends Ve {
  constructor(e) {
    super(), Qe(this, e, z6, M6, Le, {
      id: 0,
      index: 1,
      state: 2,
      datum: 3,
      scaleX: 4,
      scaleY: 5,
      sizing: 6,
      show_info: 7
    });
  }
}
function Hh(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $;
  return {
    c() {
      e = Xe("g"), l = Xe("rect"), o = Xe("text"), u = E(`Measure counts
    `), d = Xe("rect"), y = Xe("text"), k = E("Error-adjusted counts"), f(l, "id", i = /*id*/
      t[0] + "-true"), f(l, "fill", n = /*sizing*/
      t[1].legend.true_color), f(l, "x", "0"), f(l, "y", a = (14 - /*sizing*/
      t[1].legend.legend_rect_size) / 2 - 1), f(l, "width", r = /*sizing*/
      t[1].legend.legend_rect_size), f(l, "height", s = /*sizing*/
      t[1].legend.legend_rect_size), f(o, "x", c = /*sizing*/
      t[1].legend.legend_rect_size + /*sizing*/
      t[1].padding), f(o, "y", 14 / 2), f(o, "alignment-baseline", "middle"), f(d, "id", h = /*id*/
      t[0] + "-true"), f(d, "fill", p = /*sizing*/
      t[1].legend.hypo_color), f(d, "x", "0"), f(d, "y", b = (14 - /*sizing*/
      t[1].legend.legend_rect_size) / 2 + 14 - 1), f(d, "width", g = /*sizing*/
      t[1].legend.legend_rect_size), f(d, "height", v = /*sizing*/
      t[1].legend.legend_rect_size), f(y, "x", w = /*sizing*/
      t[1].legend.legend_rect_size + /*sizing*/
      t[1].padding), f(y, "y", 14 / 2 + 14), f(y, "alignment-baseline", "middle"), f(e, "class", "legend"), f(e, "role", "legend-group"), f(
        e,
        "id",
        /*id*/
        t[0]
      ), f(e, "transform", $ = `translate(${/*sizing*/
      t[1].legend.x} ${/*sizing*/
      t[1].legend.y})`);
    },
    m(q, j) {
      C(q, e, j), _(e, l), _(e, o), _(o, u), _(e, d), _(e, y), _(y, k);
    },
    p(q, j) {
      j & /*id*/
      1 && i !== (i = /*id*/
      q[0] + "-true") && f(l, "id", i), j & /*sizing*/
      2 && n !== (n = /*sizing*/
      q[1].legend.true_color) && f(l, "fill", n), j & /*sizing*/
      2 && a !== (a = (14 - /*sizing*/
      q[1].legend.legend_rect_size) / 2 - 1) && f(l, "y", a), j & /*sizing*/
      2 && r !== (r = /*sizing*/
      q[1].legend.legend_rect_size) && f(l, "width", r), j & /*sizing*/
      2 && s !== (s = /*sizing*/
      q[1].legend.legend_rect_size) && f(l, "height", s), j & /*sizing*/
      2 && c !== (c = /*sizing*/
      q[1].legend.legend_rect_size + /*sizing*/
      q[1].padding) && f(o, "x", c), j & /*id*/
      1 && h !== (h = /*id*/
      q[0] + "-true") && f(d, "id", h), j & /*sizing*/
      2 && p !== (p = /*sizing*/
      q[1].legend.hypo_color) && f(d, "fill", p), j & /*sizing*/
      2 && b !== (b = (14 - /*sizing*/
      q[1].legend.legend_rect_size) / 2 + 14 - 1) && f(d, "y", b), j & /*sizing*/
      2 && g !== (g = /*sizing*/
      q[1].legend.legend_rect_size) && f(d, "width", g), j & /*sizing*/
      2 && v !== (v = /*sizing*/
      q[1].legend.legend_rect_size) && f(d, "height", v), j & /*sizing*/
      2 && w !== (w = /*sizing*/
      q[1].legend.legend_rect_size + /*sizing*/
      q[1].padding) && f(y, "x", w), j & /*id*/
      1 && f(
        e,
        "id",
        /*id*/
        q[0]
      ), j & /*sizing*/
      2 && $ !== ($ = `translate(${/*sizing*/
      q[1].legend.x} ${/*sizing*/
      q[1].legend.y})`) && f(e, "transform", $);
    },
    d(q) {
      q && T(e);
    }
  };
}
function A6(t) {
  let e, l = (
    /*sizing*/
    t[1] && Hh(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*sizing*/
      i[1] ? l ? l.p(i, n) : (l = Hh(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function B6(t, e, l) {
  let { id: i = "", sizing: n = {} } = e;
  return t.$$set = (a) => {
    "id" in a && l(0, i = a.id), "sizing" in a && l(1, n = a.sizing);
  }, [i, n];
}
class P6 extends Ve {
  constructor(e) {
    super(), Qe(this, e, B6, A6, Le, { id: 0, sizing: 1 });
  }
}
function Fh(t, e, l) {
  const i = t.slice();
  return i[15] = e[l], i[17] = l, i;
}
function Lh(t) {
  let e, l, i = (
    /*$sizing*/
    t[8] && /*$data*/
    t[7] && /*$design*/
    t[6] && /*$scales*/
    t[9] && Qh(t)
  );
  return {
    c() {
      e = m("div"), i && i.c(), f(e, "class", "vis-wrap svelte-1ryqbkw");
    },
    m(n, a) {
      C(n, e, a), i && i.m(e, null), l = !0;
    },
    p(n, a) {
      /*$sizing*/
      n[8] && /*$data*/
      n[7] && /*$design*/
      n[6] && /*$scales*/
      n[9] ? i ? (i.p(n, a), a & /*$sizing, $data, $design, $scales*/
      960 && S(i, 1)) : (i = Qh(n), i.c(), S(i, 1), i.m(e, null)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d();
    }
  };
}
function Qh(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v = (
    /*$sizing*/
    t[8].legend && Vh(t)
  );
  a = new Rh({
    props: {
      id: (
        /*id*/
        t[2] + "-axis-x"
      ),
      role: "x_axis",
      scales: (
        /*scales*/
        t[11]
      ),
      sizing: (
        /*$sizing*/
        t[8]
      ),
      bootstrap: (
        /*$data*/
        t[7].metadata.bootstrap
      )
    }
  }), r = new Rh({
    props: {
      id: (
        /*id*/
        t[2] + "-axis-y"
      ),
      role: "y_axis",
      scales: (
        /*scales*/
        t[11]
      ),
      sizing: (
        /*$sizing*/
        t[8]
      ),
      bootstrap: (
        /*$data*/
        t[7].metadata.bootstrap
      )
    }
  });
  let y = we(Object.keys(
    /*$data*/
    t[7].data
  )), k = [];
  for (let $ = 0; $ < y.length; $ += 1)
    k[$] = Gh(Fh(t, y, $));
  const w = ($) => D(k[$], 1, 1, () => {
    k[$] = null;
  });
  return {
    c() {
      e = Xe("svg"), l = Xe("style"), i = E(`.axis {
              font-family: Iosevka;
              font-size: 11px;
            }
            .legend {
              font-family: Iosevka;
              font-size: 12px;
            }
            .axis.nominal path.domain,
            .axis.nominal .tick line {
              stroke-width: 0;
            }
            .grid .tick line {
              stroke: #ccc;
            }
            .click-wrap:hover {
              fill: #ffd500;
              fill-opacity: 0.1;
            }
          `), v && v.c(), n = Be(), he(a.$$.fragment), he(r.$$.fragment), s = Xe("g");
      for (let $ = 0; $ < k.length; $ += 1)
        k[$].c();
      f(l, "class", "svelte-1ryqbkw"), f(s, "id", o = /*id*/
      t[2] + "-chart"), f(s, "width", u = /*$sizing*/
      t[8].chart.width), f(s, "height", c = /*$sizing*/
      t[8].chart.height), f(s, "transform", d = `translate(${/*$sizing*/
      t[8].chart.x} ${/*$sizing*/
      t[8].chart.y})`), f(s, "class", "svelte-1ryqbkw"), f(
        e,
        "id",
        /*id*/
        t[2]
      ), f(e, "width", h = /*$sizing*/
      t[8].width), f(e, "height", p = /*$sizing*/
      t[8].height), f(e, "viewBox", b = /*$sizing*/
      t[8].viewBox.join(" ")), f(e, "class", "svelte-1ryqbkw");
    },
    m($, q) {
      C($, e, q), _(e, l), _(l, i), v && v.m(e, null), _(e, n), ce(a, e, null), ce(r, e, null), _(e, s);
      for (let j = 0; j < k.length; j += 1)
        k[j] && k[j].m(s, null);
      g = !0;
    },
    p($, q) {
      /*$sizing*/
      $[8].legend ? v ? (v.p($, q), q & /*$sizing*/
      256 && S(v, 1)) : (v = Vh($), v.c(), S(v, 1), v.m(e, n)) : v && (ge(), D(v, 1, 1, () => {
        v = null;
      }), be());
      const j = {};
      q & /*id*/
      4 && (j.id = /*id*/
      $[2] + "-axis-x"), q & /*$sizing*/
      256 && (j.sizing = /*$sizing*/
      $[8]), q & /*$data*/
      128 && (j.bootstrap = /*$data*/
      $[7].metadata.bootstrap), a.$set(j);
      const O = {};
      if (q & /*id*/
      4 && (O.id = /*id*/
      $[2] + "-axis-y"), q & /*$sizing*/
      256 && (O.sizing = /*$sizing*/
      $[8]), q & /*$data*/
      128 && (O.bootstrap = /*$data*/
      $[7].metadata.bootstrap), r.$set(O), q & /*id, Object, $data, $scales, $sizing, show_info, $design*/
      9156) {
        y = we(Object.keys(
          /*$data*/
          $[7].data
        ));
        let z;
        for (z = 0; z < y.length; z += 1) {
          const N = Fh($, y, z);
          k[z] ? (k[z].p(N, q), S(k[z], 1)) : (k[z] = Gh(N), k[z].c(), S(k[z], 1), k[z].m(s, null));
        }
        for (ge(), z = y.length; z < k.length; z += 1)
          w(z);
        be();
      }
      (!g || q & /*id*/
      4 && o !== (o = /*id*/
      $[2] + "-chart")) && f(s, "id", o), (!g || q & /*$sizing*/
      256 && u !== (u = /*$sizing*/
      $[8].chart.width)) && f(s, "width", u), (!g || q & /*$sizing*/
      256 && c !== (c = /*$sizing*/
      $[8].chart.height)) && f(s, "height", c), (!g || q & /*$sizing*/
      256 && d !== (d = `translate(${/*$sizing*/
      $[8].chart.x} ${/*$sizing*/
      $[8].chart.y})`)) && f(s, "transform", d), (!g || q & /*id*/
      4) && f(
        e,
        "id",
        /*id*/
        $[2]
      ), (!g || q & /*$sizing*/
      256 && h !== (h = /*$sizing*/
      $[8].width)) && f(e, "width", h), (!g || q & /*$sizing*/
      256 && p !== (p = /*$sizing*/
      $[8].height)) && f(e, "height", p), (!g || q & /*$sizing*/
      256 && b !== (b = /*$sizing*/
      $[8].viewBox.join(" "))) && f(e, "viewBox", b);
    },
    i($) {
      if (!g) {
        S(v), S(a.$$.fragment, $), S(r.$$.fragment, $);
        for (let q = 0; q < y.length; q += 1)
          S(k[q]);
        g = !0;
      }
    },
    o($) {
      D(v), D(a.$$.fragment, $), D(r.$$.fragment, $), k = k.filter(Boolean);
      for (let q = 0; q < k.length; q += 1)
        D(k[q]);
      g = !1;
    },
    d($) {
      $ && T(e), v && v.d(), de(a), de(r), Ge(k, $);
    }
  };
}
function Vh(t) {
  let e, l;
  return e = new P6({
    props: { id: "legend", sizing: (
      /*$sizing*/
      t[8]
    ) }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$sizing*/
      256 && (a.sizing = /*$sizing*/
      i[8]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Xh(t) {
  let e, l;
  return e = new k6({
    props: {
      id: (
        /*id*/
        t[2] + "-interval-" + /*state*/
        t[15].replace(/s/gi, "_")
      ),
      index: (
        /*i*/
        t[17]
      ),
      state: (
        /*state*/
        t[15]
      ),
      datum: (
        /*$data*/
        t[7].data[
          /*state*/
          t[15]
        ]
      ),
      key: (
        /*$data*/
        t[7].metadata.bootstrap ? "prob_interval" : "interval"
      ),
      scaleX: (
        /*$scales*/
        t[9].x
      ),
      scaleY: (
        /*$scales*/
        t[9].y
      ),
      stroke: (
        /*$sizing*/
        t[8].chart.interval_color
      ),
      sizing: (
        /*$sizing*/
        t[8]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*id, $data*/
      132 && (a.id = /*id*/
      i[2] + "-interval-" + /*state*/
      i[15].replace(/s/gi, "_")), n & /*$data*/
      128 && (a.state = /*state*/
      i[15]), n & /*$data*/
      128 && (a.datum = /*$data*/
      i[7].data[
        /*state*/
        i[15]
      ]), n & /*$data*/
      128 && (a.key = /*$data*/
      i[7].metadata.bootstrap ? "prob_interval" : "interval"), n & /*$scales*/
      512 && (a.scaleX = /*$scales*/
      i[9].x), n & /*$scales*/
      512 && (a.scaleY = /*$scales*/
      i[9].y), n & /*$sizing*/
      256 && (a.stroke = /*$sizing*/
      i[8].chart.interval_color), n & /*$sizing*/
      256 && (a.sizing = /*$sizing*/
      i[8]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Gh(t) {
  let e, l, i, n, a;
  e = new Ih({
    props: {
      id: (
        /*id*/
        t[2] + "-mark-" + /*state*/
        t[15].replace(/s/gi, "_") + "-true"
      ),
      index: (
        /*i*/
        t[17]
      ),
      state: (
        /*state*/
        t[15]
      ),
      datum: (
        /*$data*/
        t[7].data[
          /*state*/
          t[15]
        ]
      ),
      key: (
        /*$data*/
        t[7].metadata.bootstrap ? "prob_measure" : "measure"
      ),
      scaleX: (
        /*$scales*/
        t[9].x
      ),
      scaleY: (
        /*$scales*/
        t[9].y
      ),
      fill: (
        /*$sizing*/
        t[8].chart.true_color
      ),
      sizing: (
        /*$sizing*/
        t[8]
      )
    }
  }), l = new Ih({
    props: {
      id: (
        /*id*/
        t[2] + "-mark-" + /*state*/
        t[15].replace(/s/gi, "_") + "-hypo"
      ),
      index: (
        /*i*/
        t[17]
      ),
      state: (
        /*state*/
        t[15]
      ),
      datum: (
        /*$data*/
        t[7].data[
          /*state*/
          t[15]
        ]
      ),
      key: (
        /*$data*/
        t[7].metadata.bootstrap ? "prob_mean" : "mean"
      ),
      scaleX: (
        /*$scales*/
        t[9].x
      ),
      scaleY: (
        /*$scales*/
        t[9].y
      ),
      fill: (
        /*$sizing*/
        t[8].chart.hypo_color
      ),
      sizing: (
        /*$sizing*/
        t[8]
      ),
      HOPS: (
        /*$design*/
        t[6].HOPS
      ),
      HOPS_speed: (
        /*$design*/
        t[6].HOPS_speed
      ),
      count_data: (
        /*$data*/
        t[7].metadata.bootstrap ? (
          /*$data*/
          t[7].probs[
            /*state*/
            t[15]
          ]
        ) : (
          /*$data*/
          t[7].counts[
            /*state*/
            t[15]
          ]
        )
      )
    }
  });
  let r = !/*$design*/
  t[6].HOPS && Xh(t);
  return n = new N6({
    props: {
      id: (
        /*id*/
        t[2] + "-mark-" + /*state*/
        t[15].replace(/s/gi, "_") + "-click"
      ),
      index: (
        /*i*/
        t[17]
      ),
      state: (
        /*state*/
        t[15]
      ),
      datum: (
        /*$data*/
        t[7].data[
          /*state*/
          t[15]
        ]
      ),
      scaleX: (
        /*$scales*/
        t[9].x
      ),
      scaleY: (
        /*$scales*/
        t[9].y
      ),
      sizing: (
        /*$sizing*/
        t[8]
      ),
      show_info: (
        /*show_info*/
        t[13]
      )
    }
  }), {
    c() {
      he(e.$$.fragment), he(l.$$.fragment), r && r.c(), i = Be(), he(n.$$.fragment);
    },
    m(s, o) {
      ce(e, s, o), ce(l, s, o), r && r.m(s, o), C(s, i, o), ce(n, s, o), a = !0;
    },
    p(s, o) {
      const u = {};
      o & /*id, $data*/
      132 && (u.id = /*id*/
      s[2] + "-mark-" + /*state*/
      s[15].replace(/s/gi, "_") + "-true"), o & /*$data*/
      128 && (u.state = /*state*/
      s[15]), o & /*$data*/
      128 && (u.datum = /*$data*/
      s[7].data[
        /*state*/
        s[15]
      ]), o & /*$data*/
      128 && (u.key = /*$data*/
      s[7].metadata.bootstrap ? "prob_measure" : "measure"), o & /*$scales*/
      512 && (u.scaleX = /*$scales*/
      s[9].x), o & /*$scales*/
      512 && (u.scaleY = /*$scales*/
      s[9].y), o & /*$sizing*/
      256 && (u.fill = /*$sizing*/
      s[8].chart.true_color), o & /*$sizing*/
      256 && (u.sizing = /*$sizing*/
      s[8]), e.$set(u);
      const c = {};
      o & /*id, $data*/
      132 && (c.id = /*id*/
      s[2] + "-mark-" + /*state*/
      s[15].replace(/s/gi, "_") + "-hypo"), o & /*$data*/
      128 && (c.state = /*state*/
      s[15]), o & /*$data*/
      128 && (c.datum = /*$data*/
      s[7].data[
        /*state*/
        s[15]
      ]), o & /*$data*/
      128 && (c.key = /*$data*/
      s[7].metadata.bootstrap ? "prob_mean" : "mean"), o & /*$scales*/
      512 && (c.scaleX = /*$scales*/
      s[9].x), o & /*$scales*/
      512 && (c.scaleY = /*$scales*/
      s[9].y), o & /*$sizing*/
      256 && (c.fill = /*$sizing*/
      s[8].chart.hypo_color), o & /*$sizing*/
      256 && (c.sizing = /*$sizing*/
      s[8]), o & /*$design*/
      64 && (c.HOPS = /*$design*/
      s[6].HOPS), o & /*$design*/
      64 && (c.HOPS_speed = /*$design*/
      s[6].HOPS_speed), o & /*$data*/
      128 && (c.count_data = /*$data*/
      s[7].metadata.bootstrap ? (
        /*$data*/
        s[7].probs[
          /*state*/
          s[15]
        ]
      ) : (
        /*$data*/
        s[7].counts[
          /*state*/
          s[15]
        ]
      )), l.$set(c), /*$design*/
      s[6].HOPS ? r && (ge(), D(r, 1, 1, () => {
        r = null;
      }), be()) : r ? (r.p(s, o), o & /*$design*/
      64 && S(r, 1)) : (r = Xh(s), r.c(), S(r, 1), r.m(i.parentNode, i));
      const d = {};
      o & /*id, $data*/
      132 && (d.id = /*id*/
      s[2] + "-mark-" + /*state*/
      s[15].replace(/s/gi, "_") + "-click"), o & /*$data*/
      128 && (d.state = /*state*/
      s[15]), o & /*$data*/
      128 && (d.datum = /*$data*/
      s[7].data[
        /*state*/
        s[15]
      ]), o & /*$scales*/
      512 && (d.scaleX = /*$scales*/
      s[9].x), o & /*$scales*/
      512 && (d.scaleY = /*$scales*/
      s[9].y), o & /*$sizing*/
      256 && (d.sizing = /*$sizing*/
      s[8]), n.$set(d);
    },
    i(s) {
      a || (S(e.$$.fragment, s), S(l.$$.fragment, s), S(r), S(n.$$.fragment, s), a = !0);
    },
    o(s) {
      D(e.$$.fragment, s), D(l.$$.fragment, s), D(r), D(n.$$.fragment, s), a = !1;
    },
    d(s) {
      s && T(i), de(e, s), de(l, s), r && r.d(s), de(n, s);
    }
  };
}
function Yh(t) {
  let e, l, i, n, a, r, s, o = (
    /*info_point*/
    t[5].state + ""
  ), u, c, d, h, p, b, g = (
    /*info_point*/
    t[5].measure + ""
  ), v, y, k = (
    /*perc_format*/
    t[12](
      /*info_point*/
      t[5].prob_measure
    ) + ""
  ), w, $, q, j, O, z, N, M = (
    /*info_point*/
    t[5].mean + ""
  ), H, B, R = (
    /*perc_format*/
    t[12](
      /*info_point*/
      t[5].prob_mean
    ) + ""
  ), P, I, L, F, X, V, Q, J, te = (
    /*info_point*/
    t[5].interval.join(", ") + ""
  ), ie, U, G = (
    /*info_point*/
    t[5].prob_interval.map(
      /*perc_format*/
      t[12]
    ).join(", ") + ""
  ), W, Z;
  return {
    c() {
      e = m("div"), l = m("div"), i = m("table"), n = m("tr"), a = m("th"), a.textContent = "State", r = A(), s = m("td"), u = E(o), c = A(), d = m("tr"), h = m("th"), h.textContent = "Measured counts", p = A(), b = m("td"), v = E(g), y = E(" ("), w = E(k), $ = E(")"), q = A(), j = m("tr"), O = m("th"), O.textContent = "Error-adjusted count mean", z = A(), N = m("td"), H = E(M), B = E(" ("), P = E(R), I = E(")"), L = A(), F = m("tr"), X = m("th"), X.textContent = "Error-adjusted interval", V = A(), Q = m("td"), J = E("["), ie = E(te), U = E("] (["), W = E(G), Z = E("])"), f(a, "class", "svelte-1ryqbkw"), f(s, "class", "svelte-1ryqbkw"), f(n, "class", "svelte-1ryqbkw"), f(h, "class", "svelte-1ryqbkw"), f(b, "class", "svelte-1ryqbkw"), f(d, "class", "svelte-1ryqbkw"), f(O, "class", "svelte-1ryqbkw"), f(N, "class", "svelte-1ryqbkw"), f(j, "class", "svelte-1ryqbkw"), f(X, "class", "svelte-1ryqbkw"), f(Q, "class", "svelte-1ryqbkw"), f(F, "class", "svelte-1ryqbkw"), f(i, "class", "svelte-1ryqbkw"), f(l, "class", "info-box svelte-1ryqbkw"), f(e, "class", "info-wrap svelte-1ryqbkw");
    },
    m(ee, ye) {
      C(ee, e, ye), _(e, l), _(l, i), _(i, n), _(n, a), _(n, r), _(n, s), _(s, u), _(i, c), _(i, d), _(d, h), _(d, p), _(d, b), _(b, v), _(b, y), _(b, w), _(b, $), _(i, q), _(i, j), _(j, O), _(j, z), _(j, N), _(N, H), _(N, B), _(N, P), _(N, I), _(i, L), _(i, F), _(F, X), _(F, V), _(F, Q), _(Q, J), _(Q, ie), _(Q, U), _(Q, W), _(Q, Z);
    },
    p(ee, ye) {
      ye & /*info_point*/
      32 && o !== (o = /*info_point*/
      ee[5].state + "") && Y(u, o), ye & /*info_point*/
      32 && g !== (g = /*info_point*/
      ee[5].measure + "") && Y(v, g), ye & /*info_point*/
      32 && k !== (k = /*perc_format*/
      ee[12](
        /*info_point*/
        ee[5].prob_measure
      ) + "") && Y(w, k), ye & /*info_point*/
      32 && M !== (M = /*info_point*/
      ee[5].mean + "") && Y(H, M), ye & /*info_point*/
      32 && R !== (R = /*perc_format*/
      ee[12](
        /*info_point*/
        ee[5].prob_mean
      ) + "") && Y(P, R), ye & /*info_point*/
      32 && te !== (te = /*info_point*/
      ee[5].interval.join(", ") + "") && Y(ie, te), ye & /*info_point*/
      32 && G !== (G = /*info_point*/
      ee[5].prob_interval.map(
        /*perc_format*/
        ee[12]
      ).join(", ") + "") && Y(W, G);
    },
    d(ee) {
      ee && T(e);
    }
  };
}
function E6(t) {
  let e, l, i, n = !/*redrawing*/
  t[3] && Lh(t), a = (
    /*show_info_box*/
    t[4] && /*info_point*/
    t[5] && Yh(t)
  );
  return {
    c() {
      e = m("div"), n && n.c(), l = A(), a && a.c(), f(e, "class", "vis-flex-group svelte-1ryqbkw");
    },
    m(r, s) {
      C(r, e, s), n && n.m(e, null), _(e, l), a && a.m(e, null), i = !0;
    },
    p(r, [s]) {
      /*redrawing*/
      r[3] ? n && (ge(), D(n, 1, 1, () => {
        n = null;
      }), be()) : n ? (n.p(r, s), s & /*redrawing*/
      8 && S(n, 1)) : (n = Lh(r), n.c(), S(n, 1), n.m(e, l)), /*show_info_box*/
      r[4] && /*info_point*/
      r[5] ? a ? a.p(r, s) : (a = Yh(r), a.c(), a.m(e, null)) : a && (a.d(1), a = null);
    },
    i(r) {
      i || (S(n), i = !0);
    },
    o(r) {
      D(n), i = !1;
    },
    d(r) {
      r && T(e), n && n.d(), a && a.d();
    }
  };
}
function O6(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(h, (j) => l(6, i = j)), h), r, s = ae, o = () => (s(), s = rt(d, (j) => l(7, r = j)), d), u, c;
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => s());
  let { data: d = Pe(), design: h = Pe(), id: p } = e;
  o(), a();
  let b = Pe(), g = Pe();
  at(t, b, (j) => l(8, u = j)), at(t, g, (j) => l(9, c = j));
  let v = Wt(".2%");
  function y(j, O) {
    return O && (cu("svg .axis text").remove(), b.set(f6(j, O))), {};
  }
  let k = !1, w = !1, $;
  function q(j) {
    l(4, w = !0), l(5, $ = j);
  }
  return yt(() => {
    d.subscribe((j) => {
      l(3, k = !0), y(j, i), setTimeout(
        () => {
          l(3, k = !1);
        },
        100
      );
    }), h.subscribe((j) => {
      l(3, k = !0), y(r, j), setTimeout(
        () => {
          l(3, k = !1);
        },
        100
      );
    }), b.subscribe((j) => {
      l(3, k = !0), j && g.set(_6(r, i, j)), setTimeout(
        () => {
          l(3, k = !1);
        },
        100
      );
    });
  }), fi(() => {
    cu("g.axis").remove();
  }), t.$$set = (j) => {
    "data" in j && o(l(0, d = j.data)), "design" in j && a(l(1, h = j.design)), "id" in j && l(2, p = j.id);
  }, [
    d,
    h,
    p,
    k,
    w,
    $,
    i,
    r,
    u,
    c,
    b,
    g,
    v,
    q
  ];
}
class I6 extends Ve {
  constructor(e) {
    super(), Qe(this, e, O6, E6, Le, { data: 0, design: 1, id: 2 });
  }
}
function Kh(t) {
  let e, l, i, n, a, r, s, o = (
    /*$data*/
    t[1].metadata.sampling_counts + ""
  ), u, c, d, h, p, b = (
    /*$data*/
    t[1].metadata.sample_size + ""
  ), g, v, y, k, w, $ = (
    /*$data*/
    t[1].metadata.ci_alpha + ""
  ), q, j, O, z, N, M = (
    /*$data*/
    t[1].metadata.bootstrap + ""
  ), H, B, R, P, I, L = (
    /*$data*/
    t[1].metadata.esp + ""
  ), F, X, V = (
    /*$data*/
    t[1].mean_sim_error && Uh(t)
  );
  return {
    c() {
      e = m("div"), l = m("h2"), l.textContent = "Meta information", i = A(), n = m("ul"), a = m("li"), r = m("strong"), r.textContent = "Sampling counts", s = E(": "), u = E(o), c = A(), d = m("li"), h = m("strong"), h.textContent = "Sample size", p = E(": "), g = E(b), v = A(), y = m("li"), k = m("strong"), k.textContent = "CI %", w = E(": "), q = E($), j = A(), O = m("li"), z = m("strong"), z.textContent = "Bootstrap?", N = E(": "), H = E(M), B = A(), R = m("li"), P = m("strong"), P.textContent = "Estimated Success Probability (ESP)", I = E(": "), F = E(L), X = A(), V && V.c(), f(l, "class", "svelte-18xk1o2"), f(r, "class", "svelte-18xk1o2"), f(a, "class", "svelte-18xk1o2"), f(h, "class", "svelte-18xk1o2"), f(d, "class", "svelte-18xk1o2"), f(k, "class", "svelte-18xk1o2"), f(y, "class", "svelte-18xk1o2"), f(z, "class", "svelte-18xk1o2"), f(O, "class", "svelte-18xk1o2"), f(P, "class", "svelte-18xk1o2"), f(R, "class", "svelte-18xk1o2"), f(n, "class", "svelte-18xk1o2"), f(e, "class", "meta_info svelte-18xk1o2");
    },
    m(Q, J) {
      C(Q, e, J), _(e, l), _(e, i), _(e, n), _(n, a), _(a, r), _(a, s), _(a, u), _(n, c), _(n, d), _(d, h), _(d, p), _(d, g), _(n, v), _(n, y), _(y, k), _(y, w), _(y, q), _(n, j), _(n, O), _(O, z), _(O, N), _(O, H), _(n, B), _(n, R), _(R, P), _(R, I), _(R, F), _(n, X), V && V.m(n, null);
    },
    p(Q, J) {
      J & /*$data*/
      2 && o !== (o = /*$data*/
      Q[1].metadata.sampling_counts + "") && Y(u, o), J & /*$data*/
      2 && b !== (b = /*$data*/
      Q[1].metadata.sample_size + "") && Y(g, b), J & /*$data*/
      2 && $ !== ($ = /*$data*/
      Q[1].metadata.ci_alpha + "") && Y(q, $), J & /*$data*/
      2 && M !== (M = /*$data*/
      Q[1].metadata.bootstrap + "") && Y(H, M), J & /*$data*/
      2 && L !== (L = /*$data*/
      Q[1].metadata.esp + "") && Y(F, L), /*$data*/
      Q[1].mean_sim_error ? V ? V.p(Q, J) : (V = Uh(Q), V.c(), V.m(n, null)) : V && (V.d(1), V = null);
    },
    d(Q) {
      Q && T(e), V && V.d();
    }
  };
}
function Uh(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].mean_sim_error + ""
  ), a;
  return {
    c() {
      e = m("li"), l = m("strong"), l.textContent = "Mean simulation error", i = E(": "), a = E(n), f(l, "class", "svelte-18xk1o2"), f(e, "class", "svelte-18xk1o2");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(e, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].mean_sim_error + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function Wh(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R, P, I, L, F = (
    /*$design*/
    t[2].HOPS && Jh(t)
  );
  return {
    c() {
      e = m("div"), l = m("h2"), l.textContent = "Design controls", i = A(), n = m("div"), a = m("div"), r = m("input"), c = A(), d = m("label"), h = E("Use HOPS"), b = A(), F && F.c(), g = A(), v = m("div"), y = m("label"), k = E("Direction"), $ = A(), q = m("select"), j = m("option"), O = E("Horizontal"), N = m("option"), M = E("Vertical"), f(l, "class", "svelte-18xk1o2"), f(r, "type", "checkbox"), f(r, "id", s = /*id*/
      t[0] + "-design-hops"), f(r, "name", o = /*id*/
      t[0] + "-design-hops"), r.checked = u = /*$design*/
      t[2].HOPS, f(r, "class", "svelte-18xk1o2"), f(d, "for", p = /*id*/
      t[0] + "-design-hops"), f(d, "class", "svelte-18xk1o2"), f(a, "class", "svelte-18xk1o2"), f(y, "for", w = /*id*/
      t[0] + "-design-dir"), f(y, "class", "svelte-18xk1o2"), j.__value = "horizontal", dt(j, j.__value), j.selected = z = /*$design*/
      t[2].direction == "horizontal", f(j, "class", "svelte-18xk1o2"), N.__value = "vertical", dt(N, N.__value), N.selected = H = /*$design*/
      t[2].direction == "vertical", f(N, "class", "svelte-18xk1o2"), f(q, "type", "checkbox"), f(q, "id", B = /*id*/
      t[0] + "-design-dir"), f(q, "name", R = /*id*/
      t[0] + "-design-dir"), f(q, "class", "svelte-18xk1o2"), f(v, "class", "svelte-18xk1o2"), f(n, "class", "control-box svelte-18xk1o2"), f(e, "class", "control svelte-18xk1o2");
    },
    m(X, V) {
      C(X, e, V), _(e, l), _(e, i), _(e, n), _(n, a), _(a, r), _(a, c), _(a, d), _(d, h), _(n, b), F && F.m(n, null), _(n, g), _(n, v), _(v, y), _(y, k), _(v, $), _(v, q), _(q, j), _(j, O), _(q, N), _(N, M), _l(
        q,
        /*$design*/
        t[2].direction
      ), I || (L = [
        le(
          r,
          "change",
          /*change_handler*/
          t[8]
        ),
        le(
          q,
          "change",
          /*change_handler_2*/
          t[10]
        )
      ], I = !0);
    },
    p(X, V) {
      V & /*id*/
      1 && s !== (s = /*id*/
      X[0] + "-design-hops") && f(r, "id", s), V & /*id*/
      1 && o !== (o = /*id*/
      X[0] + "-design-hops") && f(r, "name", o), V & /*$design*/
      4 && u !== (u = /*$design*/
      X[2].HOPS) && (r.checked = u), V & /*id*/
      1 && p !== (p = /*id*/
      X[0] + "-design-hops") && f(d, "for", p), /*$design*/
      X[2].HOPS ? F ? F.p(X, V) : (F = Jh(X), F.c(), F.m(n, g)) : F && (F.d(1), F = null), V & /*id*/
      1 && w !== (w = /*id*/
      X[0] + "-design-dir") && f(y, "for", w), V & /*$design*/
      4 && z !== (z = /*$design*/
      X[2].direction == "horizontal") && (j.selected = z), V & /*$design*/
      4 && H !== (H = /*$design*/
      X[2].direction == "vertical") && (N.selected = H), V & /*id*/
      1 && B !== (B = /*id*/
      X[0] + "-design-dir") && f(q, "id", B), V & /*id*/
      1 && R !== (R = /*id*/
      X[0] + "-design-dir") && f(q, "name", R), V & /*$design*/
      4 && P !== (P = /*$design*/
      X[2].direction) && _l(
        q,
        /*$design*/
        X[2].direction
      );
    },
    d(X) {
      X && T(e), F && F.d(), I = !1, vt(L);
    }
  };
}
function Jh(t) {
  let e, l, i, n, a, r, s, o, u, c, d;
  return {
    c() {
      e = m("div"), l = m("input"), r = A(), s = m("label"), o = E("HOPS animation speed"), f(l, "type", "number"), f(l, "id", i = /*id*/
      t[0] + "-design-hops-speed"), f(l, "name", n = /*id*/
      t[0] + "-design-hops-speed"), l.value = a = /*$design*/
      t[2].HOPS_speed, f(l, "by", "1"), f(l, "class", "svelte-18xk1o2"), f(s, "for", u = /*id*/
      t[0] + "-design-hops-speed"), f(s, "class", "svelte-18xk1o2"), f(e, "class", "svelte-18xk1o2");
    },
    m(h, p) {
      C(h, e, p), _(e, l), _(e, r), _(e, s), _(s, o), c || (d = le(
        l,
        "change",
        /*change_handler_1*/
        t[9]
      ), c = !0);
    },
    p(h, p) {
      p & /*id*/
      1 && i !== (i = /*id*/
      h[0] + "-design-hops-speed") && f(l, "id", i), p & /*id*/
      1 && n !== (n = /*id*/
      h[0] + "-design-hops-speed") && f(l, "name", n), p & /*$design*/
      4 && a !== (a = /*$design*/
      h[2].HOPS_speed) && l.value !== a && (l.value = a), p & /*id*/
      1 && u !== (u = /*id*/
      h[0] + "-design-hops-speed") && f(s, "for", u);
    },
    d(h) {
      h && T(e), c = !1, d();
    }
  };
}
function D6(t) {
  let e, l, i, n, a, r, s, o, u, c = (
    /*$data*/
    t[1] && Kh(t)
  ), d = (
    /*$design*/
    t[2] && Wh(t)
  );
  return o = new I6({
    props: {
      id: (
        /*id*/
        t[0]
      ),
      data: (
        /*data*/
        t[3]
      ),
      design: (
        /*design*/
        t[4]
      )
    }
  }), {
    c() {
      e = m("div"), l = m("h1"), l.textContent = "Hypothetical error adjustment for measured outcomes", i = A(), n = m("section"), c && c.c(), a = A(), d && d.c(), r = A(), s = m("section"), he(o.$$.fragment), f(l, "class", "svelte-18xk1o2"), f(n, "class", "meta svelte-18xk1o2"), f(s, "class", "content svelte-18xk1o2"), f(e, "class", "wrap svelte-18xk1o2");
    },
    m(h, p) {
      C(h, e, p), _(e, l), _(e, i), _(e, n), c && c.m(n, null), _(n, a), d && d.m(n, null), _(e, r), _(e, s), ce(o, s, null), u = !0;
    },
    p(h, [p]) {
      /*$data*/
      h[1] ? c ? c.p(h, p) : (c = Kh(h), c.c(), c.m(n, a)) : c && (c.d(1), c = null), /*$design*/
      h[2] ? d ? d.p(h, p) : (d = Wh(h), d.c(), d.m(n, null)) : d && (d.d(1), d = null);
      const b = {};
      p & /*id*/
      1 && (b.id = /*id*/
      h[0]), o.$set(b);
    },
    i(h) {
      u || (S(o.$$.fragment, h), u = !0);
    },
    o(h) {
      D(o.$$.fragment, h), u = !1;
    },
    d(h) {
      h && T(e), c && c.d(), d && d.d(), de(o);
    }
  };
}
function R6(t, e, l) {
  let i, n, { model: a } = e, { key_data: r = "vis_data", key_design: s = "design" } = e, o = JSON.parse(a.get(r)), u = JSON.parse(a.get(s)), c = `change:${r}`, d = () => circ = a.get(r), h = Pe();
  at(t, h, ($) => l(1, i = $));
  let p = Pe();
  at(t, p, ($) => l(2, n = $));
  let b = {};
  Pe().subscribe(($) => {
    $ && (b[$.id] = $);
  });
  let v;
  yt(() => {
    l(0, v = "uv-" + Number(/* @__PURE__ */ new Date())), h.set(o), p.set(u), a.on(c, d);
  }), fi(() => {
    a.off(c, d);
  });
  const y = ($) => {
    p.update((q) => (q.HOPS = $.target.checked, q));
  }, k = ($) => {
    p.update((q) => (q.HOPS_speed = parseInt($.target.value), q));
  }, w = ($) => {
    p.update((q) => (q.direction = $.target.value, q));
  };
  return t.$$set = ($) => {
    "model" in $ && l(5, a = $.model), "key_data" in $ && l(6, r = $.key_data), "key_design" in $ && l(7, s = $.key_design);
  }, [
    v,
    i,
    n,
    h,
    p,
    a,
    r,
    s,
    y,
    k,
    w
  ];
}
class H6 extends Ve {
  constructor(e) {
    super(), Qe(this, e, R6, D6, Le, { model: 5, key_data: 6, key_design: 7 });
  }
}
function Zh(t) {
  var J, te, ie, U, G, W;
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M = (
    /*$data*/
    t[1].job_id && xh(t)
  ), H = (
    /*$data*/
    t[1].creation_date && ep(t)
  ), B = (
    /*$data*/
    t[1].done !== void 0 && tp(t)
  ), R = (
    /*$data*/
    t[1].program_id && lp(t)
  ), P = (
    /*$data*/
    t[1].n_shots !== void 0 && ip(t)
  ), I = (
    /*$data*/
    ((J = t[1].metrics) == null ? void 0 : J.circuit_depths) !== void 0 && np(t)
  ), L = (
    /*$data*/
    ((te = t[1]) == null ? void 0 : te.physical_qubits) && ap(t)
  ), F = (
    /*$data*/
    t[1].est_start_time && rp(t)
  ), X = (
    /*$data*/
    ((U = (ie = t[1].metrics) == null ? void 0 : ie.usage) == null ? void 0 : U.quantum_seconds) !== void 0 && /*$data*/
    ((W = (G = t[1].metrics) == null ? void 0 : G.usage) == null ? void 0 : W.seconds) !== void 0 && sp(t)
  ), V = (
    /*$data*/
    t[1].init_qubits !== void 0 && op(t)
  ), Q = (
    /*$data*/
    t[1].backend_name && up(t)
  );
  return {
    c() {
      e = m("article"), l = m("h4"), l.textContent = "Job metadata", i = A(), n = m("div"), a = m("table"), M && M.c(), r = A(), H && H.c(), s = A(), B && B.c(), o = A(), R && R.c(), u = A(), c = m("article"), d = m("h4"), d.textContent = "Usage size", h = A(), p = m("div"), b = m("table"), P && P.c(), g = A(), I && I.c(), v = A(), L && L.c(), y = A(), k = m("article"), w = m("h4"), w.textContent = "Usage information", $ = A(), q = m("div"), j = m("table"), F && F.c(), O = A(), X && X.c(), z = A(), V && V.c(), N = A(), Q && Q.c(), f(a, "class", "svelte-1hp7is1"), f(n, "class", "content-wrap"), f(e, "class", "panel svelte-1hp7is1"), f(b, "class", "svelte-1hp7is1"), f(p, "class", "content-wrap"), f(c, "class", "panel svelte-1hp7is1"), f(j, "class", "svelte-1hp7is1"), f(q, "class", "content-wrap"), f(k, "class", "panel svelte-1hp7is1");
    },
    m(Z, ee) {
      C(Z, e, ee), _(e, l), _(e, i), _(e, n), _(n, a), M && M.m(a, null), _(a, r), H && H.m(a, null), _(a, s), B && B.m(a, null), _(a, o), R && R.m(a, null), C(Z, u, ee), C(Z, c, ee), _(c, d), _(c, h), _(c, p), _(p, b), P && P.m(b, null), _(b, g), I && I.m(b, null), _(b, v), L && L.m(b, null), C(Z, y, ee), C(Z, k, ee), _(k, w), _(k, $), _(k, q), _(q, j), F && F.m(j, null), _(j, O), X && X.m(j, null), _(j, z), V && V.m(j, null), _(j, N), Q && Q.m(j, null);
    },
    p(Z, ee) {
      var ye, qe, je, fe, _e, K;
      /*$data*/
      Z[1].job_id ? M ? M.p(Z, ee) : (M = xh(Z), M.c(), M.m(a, r)) : M && (M.d(1), M = null), /*$data*/
      Z[1].creation_date ? H ? H.p(Z, ee) : (H = ep(Z), H.c(), H.m(a, s)) : H && (H.d(1), H = null), /*$data*/
      Z[1].done !== void 0 ? B ? B.p(Z, ee) : (B = tp(Z), B.c(), B.m(a, o)) : B && (B.d(1), B = null), /*$data*/
      Z[1].program_id ? R ? R.p(Z, ee) : (R = lp(Z), R.c(), R.m(a, null)) : R && (R.d(1), R = null), /*$data*/
      Z[1].n_shots !== void 0 ? P ? P.p(Z, ee) : (P = ip(Z), P.c(), P.m(b, g)) : P && (P.d(1), P = null), /*$data*/
      ((ye = Z[1].metrics) == null ? void 0 : ye.circuit_depths) !== void 0 ? I ? I.p(Z, ee) : (I = np(Z), I.c(), I.m(b, v)) : I && (I.d(1), I = null), /*$data*/
      (qe = Z[1]) != null && qe.physical_qubits ? L ? L.p(Z, ee) : (L = ap(Z), L.c(), L.m(b, null)) : L && (L.d(1), L = null), /*$data*/
      Z[1].est_start_time ? F ? F.p(Z, ee) : (F = rp(Z), F.c(), F.m(j, O)) : F && (F.d(1), F = null), /*$data*/
      ((fe = (je = Z[1].metrics) == null ? void 0 : je.usage) == null ? void 0 : fe.quantum_seconds) !== void 0 && /*$data*/
      ((K = (_e = Z[1].metrics) == null ? void 0 : _e.usage) == null ? void 0 : K.seconds) !== void 0 ? X ? X.p(Z, ee) : (X = sp(Z), X.c(), X.m(j, z)) : X && (X.d(1), X = null), /*$data*/
      Z[1].init_qubits !== void 0 ? V ? V.p(Z, ee) : (V = op(Z), V.c(), V.m(j, N)) : V && (V.d(1), V = null), /*$data*/
      Z[1].backend_name ? Q ? Q.p(Z, ee) : (Q = up(Z), Q.c(), Q.m(j, null)) : Q && (Q.d(1), Q = null);
    },
    d(Z) {
      Z && (T(e), T(u), T(c), T(y), T(k)), M && M.d(), H && H.d(), B && B.d(), R && R.d(), P && P.d(), I && I.d(), L && L.d(), F && F.d(), X && X.d(), V && V.d(), Q && Q.d();
    }
  };
}
function xh(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].job_id + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Job ID", i = m("td"), a = E(n), f(l, "class", "svelte-1hp7is1"), f(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].job_id + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function ep(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].creation_date + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Job created", i = m("td"), a = E(n), f(l, "class", "svelte-1hp7is1"), f(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].creation_date + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function tp(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].done ? "Done" : "Running"
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Job done?", i = m("td"), a = E(n), f(l, "class", "svelte-1hp7is1"), f(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].done ? "Done" : "Running") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function lp(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].program_id + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Program ID", i = m("td"), a = E(n), f(l, "class", "svelte-1hp7is1"), f(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].program_id + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function ip(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].n_shots + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "# Shots", i = m("td"), a = E(n), f(l, "class", "svelte-1hp7is1"), f(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].n_shots + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function np(t) {
  let e, l, i, n = Wt(",d")(
    /*$data*/
    t[1].metrics.circuit_depths[0]
  ) + "", a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Circuit depth", i = m("td"), a = E(n), f(l, "class", "svelte-1hp7is1"), f(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = Wt(",d")(
        /*$data*/
        r[1].metrics.circuit_depths[0]
      ) + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function ap(t) {
  var r;
  let e, l, i, n = (
    /*$data*/
    ((r = t[1].physical_qubits) == null ? void 0 : r.length) + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "# Qubits", i = m("td"), a = E(n), f(l, "class", "svelte-1hp7is1"), f(i, "class", "svelte-1hp7is1");
    },
    m(s, o) {
      C(s, e, o), _(e, l), _(e, i), _(i, a);
    },
    p(s, o) {
      var u;
      o & /*$data*/
      2 && n !== (n = /*$data*/
      ((u = s[1].physical_qubits) == null ? void 0 : u.length) + "") && Y(a, n);
    },
    d(s) {
      s && T(e);
    }
  };
}
function rp(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].est_start_time + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Start time (est)", i = m("td"), a = E(n), f(l, "class", "svelte-1hp7is1"), f(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].est_start_time + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function sp(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].metrics.usage.quantum_seconds + ""
  ), a, r, s = (
    /*$data*/
    t[1].metrics.usage.seconds + ""
  ), o, u;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Duration (sec.) ", i = m("td"), a = E(n), r = E(" (quantum) / "), o = E(s), u = E(" (total)"), f(l, "class", "svelte-1hp7is1"), f(i, "class", "svelte-1hp7is1");
    },
    m(c, d) {
      C(c, e, d), _(e, l), _(e, i), _(i, a), _(i, r), _(i, o), _(i, u);
    },
    p(c, d) {
      d & /*$data*/
      2 && n !== (n = /*$data*/
      c[1].metrics.usage.quantum_seconds + "") && Y(a, n), d & /*$data*/
      2 && s !== (s = /*$data*/
      c[1].metrics.usage.seconds + "") && Y(o, s);
    },
    d(c) {
      c && T(e);
    }
  };
}
function op(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].init_qubits + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Qubits initialized", i = m("td"), a = E(n), f(l, "class", "svelte-1hp7is1"), f(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].init_qubits + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function up(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].backend_name + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Backend name", i = m("td"), a = E(n), f(l, "class", "svelte-1hp7is1"), f(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].backend_name + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function F6(t) {
  let e, l = (
    /*$data*/
    t[1] && Zh(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*$data*/
      i[1] ? l ? l.p(i, n) : (l = Zh(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function L6(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(r, (s) => l(1, i = s)), r);
  t.$$.on_destroy.push(() => n());
  let { data: r = Pe() } = e;
  return a(), t.$$set = (s) => {
    "data" in s && a(l(0, r = s.data));
  }, [r, i];
}
class Q6 extends Ve {
  constructor(e) {
    super(), Qe(this, e, L6, F6, Le, { data: 0 });
  }
}
const Zt = 50, Ft = 300, wr = 30, Qt = 20, Nl = 0.75, dl = 30;
function V6(t) {
  return t.split("").reverse().join("");
}
function X6(t, e) {
  let l = t.map((a) => e ? V6(a) : a), i = l.map((a, r) => [a, r]);
  i = i.toSorted((a, r) => a[0].localeCompare(r[0]));
  let n = {};
  return i.forEach((a) => {
    n[a[0]] = a[1];
  }), l = i.map((a) => a[0]), { wrapped_state_bistrings: l, bitstring_arg_map: n };
}
function $r(t, e, l = {}) {
  var N;
  if (!t)
    return null;
  let i = (l == null ? void 0 : l.reverse_state_vector) !== void 0 ? l == null ? void 0 : l.reverse_state_vector : !0, n = l.see_uncertainty !== !1 && e !== void 0 && (e == null ? void 0 : e.data) !== void 0 && (e == null ? void 0 : e.counts) !== void 0 && (e == null ? void 0 : e.probs) !== void 0 && (e == null ? void 0 : e.metadata) !== void 0, a = n ? (N = e.metadata) == null ? void 0 : N.bootstrap : !1, r = Wt(a ? ".6f" : ",d"), s = Wt(a ? ".10f" : ",d"), o = [], u = Object.keys(t), { wrapped_state_bistrings: c, bitstring_arg_map: d } = X6(u, i);
  c = c.toSorted();
  for (let M = 0; M < (c == null ? void 0 : c.length); M++) {
    let H = c[M], B = u[d[H]], R = t[B] || 0;
    o.push({
      state: H,
      original_state: B,
      count: R,
      unceratinty: n ? e.data[B] : void 0,
      unceratinty_counts: n ? e.counts[B] : void 0,
      unceratinty_probs: n ? e.probs[B] : void 0
    });
  }
  let h = 0, p = Ft + wr, b, g, v, y, k, w = (o == null ? void 0 : o.length) * Qt;
  h = w + Zt;
  let $;
  n && a ? $ = Math.max(...o.map((M) => Math.max(...M.unceratinty_probs))) : n && !a ? $ = Math.max(...o.map((M) => Math.max(...M.unceratinty_counts, M.count))) : $ = Math.max(...o.map((M) => M.count));
  let q = Rl().domain([0, $]).range([0, Ft]).nice(), j = q.invert(Ft), O = Y6(j);
  g = {
    type: "g",
    id: "count-histogram-y-axis",
    role: "count-histogram-y-axis",
    width: Zt,
    height: Ft,
    x: Ie,
    y: Ie,
    elem: [{
      type: "rect",
      x: 0 - Ie,
      y: -5,
      width: Zt + Ie,
      height: Ft + 10,
      fill: it,
      "stroke-width": 0
    }, {
      type: "line",
      id: "count-histogram-y-axis-domain",
      x1: Zt - 1,
      x2: Zt - 1,
      y1: 0,
      y2: Ft,
      stroke: ze,
      "stroke-width": 1
    }, {
      type: "text",
      id: "count-histogram-y-axis-title",
      x: Zt + 10,
      y: 7.5,
      text: a ? "Prob." : "Count",
      "font-size": 12,
      fill: ze,
      "text-anchor": "start",
      "alignment-baseline": "top",
      "font-style": "italic"
    }]
  }, v = {
    type: "g",
    id: "count-histogram-y-axis",
    role: "count-histogram-y-axis",
    width: w,
    height: Ft,
    x: Ie + Zt,
    y: Ie,
    elem: []
  }, h += Zt;
  for (let M = 0; M <= j; M += O) {
    let H = {
      type: "g",
      id: "count-histogram-y-axis-tick",
      width: Zt,
      x: 0,
      y: Ft - q(M),
      elem: []
    }, B = {
      type: "line",
      x1: Zt - 1,
      x2: Zt - 6,
      y1: -0.5,
      y2: -0.5,
      stroke: ze,
      "stroke-width": 1
    }, R = {
      type: "text",
      x: Zt - 10,
      y: 0,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: r(M),
      "font-size": 12
    };
    H.elem.push(B, R), g.elem.push(H), v.elem.push({
      type: "line",
      x1: 0,
      x2: w,
      y1: Ft - q(M) - 0.5,
      y2: Ft - q(M) - 0.5,
      stroke: "#dddddd",
      "stroke-width": 1
    });
  }
  b = {
    type: "g",
    id: "count-histogram-bar-group",
    role: "count-histogram-bar-group",
    width: w,
    height: Ft,
    x: Ie + Zt,
    y: Ie,
    elem: []
  }, y = {
    type: "g",
    id: "count-histogram-x-axis",
    role: "count-histogram-x-axis",
    width: w,
    height: wr,
    x: Ie + Zt,
    y: Ie + Ft,
    elem: [{
      type: "line",
      id: "count-histogram-y-axis-domain",
      x1: 0,
      x2: w,
      y1: -0.5,
      y2: -0.5,
      stroke: ze,
      "stroke-width": 1
    }]
  };
  let z = 0;
  for (let M of o) {
    let H = Qt * z, B = a ? M.unceratinty.prob_measure : M.count, R = q(B), P = {
      type: "g",
      id: "count-histogram-bar-item-" + z,
      role: "count-histogram-bar--group",
      width: Qt,
      height: Ft,
      x: H,
      y: 0,
      elem: [{
        type: "rect",
        id: "count-histogram-bar-" + z,
        width: Qt * Nl,
        x: Qt * (1 - Nl) / 2,
        height: 4,
        y: Ft - R - 2,
        fill: Ut[1],
        "stroke-width": 0
      }],
      data: {
        tooltip_content: {
          State: M.state,
          Count: M.count,
          Probability: n ? s(M.unceratinty.prob_measure) : void 0,
          "HEA-prob. mean": n ? s(M.unceratinty.prob_mean) : void 0,
          "HEA-prob. interval": n ? "[" + M.unceratinty.prob_interval.map(s).join(", ") + "]" : void 0,
          "HEA-count mean": n ? s(M.unceratinty.mean) : void 0,
          "HEA-count interval": n ? "[" + M.unceratinty.interval.map(s).join(", ") + "]" : void 0
        }
      }
    };
    if (n) {
      let L = a ? M.unceratinty.prob_mean : M.unceratinty.mean, F = q(L), X = (a ? M.unceratinty.prob_interval : M.unceratinty.interval).map(q);
      P.elem.push({
        type: "rect",
        id: "count-histogram-hea-bar-" + z,
        width: Qt * Nl,
        x: Qt * (1 - Nl) / 2,
        height: 4,
        y: Ft - F - 2,
        fill: Ut[0],
        "fill-opacity": 0.7,
        "stroke-width": 0
      }, {
        type: "line",
        id: "count-histogram-hea-interval-" + z,
        width: Qt * Nl,
        x1: Qt / 2 - 0.5,
        x2: Qt / 2 - 0.5,
        y1: Ft - X[0],
        y2: Ft - X[1],
        stroke: ze,
        "stroke-width": 1
      });
    } else
      P.elem.push({
        type: "text",
        id: "count-histogram-bar-count-" + z,
        x: Qt / 2,
        y: Ft - R + 9,
        "text-anchor": "middle",
        "alignment-baseline": "middle",
        "font-size": 9,
        fill: "gray",
        text: r(B) || 0
      });
    P.elem.push({
      type: "click-wrap",
      id: "count-histogram-bar-click-wrap-" + z,
      role: "count-histogram-bar-click-wrap",
      width: Qt,
      x: 0,
      height: Ft,
      y: 0,
      data: {
        state: M.state,
        count: M.count,
        probability: n ? M.unceratinty.prob_measure : void 0,
        hea_probability_mean: n ? M.unceratinty.prob_mean : void 0,
        hea_probability_interval: n ? M.unceratinty.prob_interval : void 0,
        hea_count_mean: n ? M.unceratinty.mean : void 0,
        hea_count_interval: n ? M.unceratinty.interval : void 0
      }
    }), b.elem.push(P);
    let I = {
      type: "g",
      id: "count-histogram-x-axis-group-" + z,
      width: Qt,
      height: Ft,
      x: H,
      y: 0,
      elem: [{
        type: "line",
        id: "count-histogram-x-axis-" + z,
        x1: Qt / 2 - 0.5,
        x2: Qt / 2 - 0.5,
        y1: 0,
        y2: 5,
        "stroke-width": 1
      }, {
        type: "text",
        id: "count-histogram-x-axis-marker-" + z,
        role: "count-histogram-x-axis-marker",
        x: Qt / 2 - 5,
        y: 15,
        "text-anchor": "end",
        "alignment-baseline": "middle",
        "font-size": 10,
        text: M.state,
        transform: "rotate(-40 0 0)"
      }]
    };
    y.elem.push(I), z++;
  }
  return n && (k = {
    type: "g",
    id: "count-histogram-legend-group",
    role: "count-histogram-legend-group",
    width: w,
    height: dl,
    x: Ie + Zt,
    y: Ie + Ft + wr + At,
    elem: []
  }, k.elem.push({
    type: "g",
    id: "count-histogram-legend-original-group",
    role: "count-histogram-legend-item-group",
    width: 100,
    height: dl,
    x: 0,
    y: 0,
    elem: [{
      type: "rect",
      width: Qt * Nl,
      x: 0,
      height: 4,
      y: dl / 2 - 2,
      fill: Ut[1],
      "stroke-width": 0
    }, {
      type: "text",
      x: Qt * Nl + Ze,
      y: dl / 2 + 2,
      fill: ze,
      text: "Original " + (a ? "probability" : "count"),
      "font-size": 12,
      "text-anchor": "start",
      "alignment-baseline": "middle"
    }]
  }), k.elem.push({
    type: "g",
    id: "count-histogram-legend-hea-group",
    role: "count-histogram-legend-item-group",
    width: 100,
    height: dl,
    x: 170,
    y: 0,
    elem: [{
      type: "rect",
      width: Qt * Nl,
      x: 0,
      height: 4,
      y: dl / 2 - 2,
      fill: Ut[0],
      "stroke-width": 0
    }, {
      type: "text",
      x: Qt * Nl + Ze,
      y: dl / 2 + 2,
      fill: ze,
      text: "Hypothetical error-adjusted (HEA) " + (a ? "probability" : "count"),
      "font-size": 12,
      "text-anchor": "start",
      "alignment-baseline": "middle"
    }]
  }), k.elem.push({
    type: "g",
    id: "count-histogram-legend-hea-group",
    role: "count-histogram-legend-item-group",
    width: 100,
    height: dl,
    x: 500,
    y: 0,
    elem: [{
      type: "line",
      x1: 0,
      x2: 0,
      y1: 7,
      y2: dl - 7,
      "stroke-width": 1,
      stroke: ze
    }, {
      type: "text",
      x: 1 + Ze,
      y: dl / 2 + 2,
      fill: ze,
      text: "HEA " + (a ? "probability" : "count") + " interval",
      "font-size": 12,
      "text-anchor": "start",
      "alignment-baseline": "middle"
    }]
  }), p += dl + At), {
    type: "svg",
    width: h + Ie * 2,
    height: p + Ie * 2,
    viewBox: [0, 0, h + Ie * 2, p + Ie * 2],
    groups: {
      bar_group: b,
      y_axis_group: g,
      y_grid_group: v,
      x_axis_group: y,
      legend_group: k
    }
  };
}
let G6 = [100, 50, 25, 10, 5, 1, 0.5, 0.25, 0.1, 0.05, 0.025, 0.01, 5e-3, 25e-4, 1e-3];
function Y6(t) {
  for (let e of G6) {
    if (t > 1 && t % e == 0 && t / e > 1)
      return e;
    if (t < 1 && t % e < 1e-3 && t / e > 1)
      return e;
  }
}
function fp(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[7] ? "Show" : "Hide"
  ), r, s, o, u, c, d, h, p, b, g, v, y, k = (
    /*images*/
    t[4]["count-histogram"] && _p(t)
  ), w = !/*$hide1*/
  t[7] && cp(t), $ = !/*$hide1*/
  t[7] && dp(t), q = !/*$hide1*/
  t[7] && yp(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`Counts with hypothetical error adjustment
      `), n = m("button"), r = E(a), s = A(), o = m("button"), o.textContent = "Image", u = A(), k && k.c(), c = A(), d = m("div"), w && w.c(), h = A(), p = m("div"), $ && $.c(), b = A(), q && q.c(), f(o, "class", "save-make svelte-ef6jyv"), f(d, "class", "content-wrap"), f(p, "class", "content-wrap"), f(e, "class", "panel svelte-ef6jyv");
    },
    m(j, O) {
      C(j, e, O), _(e, l), _(l, i), _(l, n), _(n, r), _(l, s), _(l, o), _(l, u), k && k.m(l, null), _(e, c), _(e, d), w && w.m(d, null), _(e, h), _(e, p), $ && $.m(p, null), _(e, b), q && q.m(e, null), g = !0, v || (y = [
        le(
          n,
          "click",
          /*click_handler*/
          t[16]
        ),
        le(
          o,
          "click",
          /*click_handler_1*/
          t[17]
        )
      ], v = !0);
    },
    p(j, O) {
      (!g || O & /*$hide1*/
      128) && a !== (a = /*$hide1*/
      j[7] ? "Show" : "Hide") && Y(r, a), /*images*/
      j[4]["count-histogram"] ? k ? k.p(j, O) : (k = _p(j), k.c(), k.m(l, null)) : k && (k.d(1), k = null), /*$hide1*/
      j[7] ? w && (w.d(1), w = null) : w ? w.p(j, O) : (w = cp(j), w.c(), w.m(d, null)), /*$hide1*/
      j[7] ? $ && (ge(), D($, 1, 1, () => {
        $ = null;
      }), be()) : $ ? ($.p(j, O), O & /*$hide1*/
      128 && S($, 1)) : ($ = dp(j), $.c(), S($, 1), $.m(p, null)), /*$hide1*/
      j[7] ? q && (q.d(1), q = null) : q ? q.p(j, O) : (q = yp(j), q.c(), q.m(e, null));
    },
    i(j) {
      g || (S($), g = !0);
    },
    o(j) {
      D($), g = !1;
    },
    d(j) {
      j && T(e), k && k.d(), w && w.d(), $ && $.d(), q && q.d(), v = !1, vt(y);
    }
  };
}
function _p(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("a"), l = E("PNG"), n = A(), a = m("a"), r = E("SVG"), f(e, "class", "save-download svelte-ef6jyv"), f(e, "href", i = /*images*/
      t[4]["count-histogram"].png), f(e, "download", ""), f(a, "class", "save-download svelte-ef6jyv"), f(a, "href", s = /*images*/
      t[4]["count-histogram"].svg), f(a, "download", "");
    },
    m(o, u) {
      C(o, e, u), _(e, l), C(o, n, u), C(o, a, u), _(a, r);
    },
    p(o, u) {
      u & /*images*/
      16 && i !== (i = /*images*/
      o[4]["count-histogram"].png) && f(e, "href", i), u & /*images*/
      16 && s !== (s = /*images*/
      o[4]["count-histogram"].svg) && f(a, "href", s);
    },
    d(o) {
      o && (T(e), T(n), T(a));
    }
  };
}
function cp(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p;
  function b($, q) {
    var j;
    return (
      /*$config*/
      (j = $[5]) != null && j.reverse_state_vector ? U6 : K6
    );
  }
  let g = b(t), v = g(t);
  function y($, q) {
    var j;
    return (
      /*$config*/
      (j = $[5]) != null && j.see_uncertainty ? J6 : W6
    );
  }
  let k = y(t), w = k(t);
  return {
    c() {
      var $, q;
      e = m("div"), l = m("input"), n = A(), a = m("label"), v.c(), r = A(), s = m("div"), o = m("input"), c = A(), d = m("label"), w.c(), f(l, "id", "config"), f(l, "type", "checkbox"), l.checked = i = /*$config*/
      ($ = t[5]) == null ? void 0 : $.reverse_state_vector, f(a, "for", "config"), f(a, "class", "svelte-ef6jyv"), f(e, "class", "input-wrap svelte-ef6jyv"), f(o, "id", "config2"), f(o, "type", "checkbox"), o.checked = u = /*$config*/
      (q = t[5]) == null ? void 0 : q.see_uncertainty, f(d, "for", "config2"), f(d, "class", "svelte-ef6jyv"), f(s, "class", "input-wrap svelte-ef6jyv");
    },
    m($, q) {
      C($, e, q), _(e, l), _(e, n), _(e, a), v.m(a, null), C($, r, q), C($, s, q), _(s, o), _(s, c), _(s, d), w.m(d, null), h || (p = [
        le(
          l,
          "change",
          /*change_handler*/
          t[18]
        ),
        le(
          o,
          "change",
          /*change_handler_1*/
          t[19]
        )
      ], h = !0);
    },
    p($, q) {
      var j, O;
      q & /*$config*/
      32 && i !== (i = /*$config*/
      (j = $[5]) == null ? void 0 : j.reverse_state_vector) && (l.checked = i), g !== (g = b($)) && (v.d(1), v = g($), v && (v.c(), v.m(a, null))), q & /*$config*/
      32 && u !== (u = /*$config*/
      (O = $[5]) == null ? void 0 : O.see_uncertainty) && (o.checked = u), k !== (k = y($)) && (w.d(1), w = k($), w && (w.c(), w.m(d, null)));
    },
    d($) {
      $ && (T(e), T(r), T(s)), v.d(), w.d(), h = !1, vt(p);
    }
  };
}
function K6(t) {
  let e;
  return {
    c() {
      e = E("The bitstring is original (Qubit N ← Qubit 0).");
    },
    m(l, i) {
      C(l, e, i);
    },
    d(l) {
      l && T(e);
    }
  };
}
function U6(t) {
  let e;
  return {
    c() {
      e = E("The bitstring is reversed (Qubit 0 → Qubit N).");
    },
    m(l, i) {
      C(l, e, i);
    },
    d(l) {
      l && T(e);
    }
  };
}
function W6(t) {
  let e;
  return {
    c() {
      e = E("Hypothetical Error-Adjsutmen (HEA) turned off");
    },
    m(l, i) {
      C(l, e, i);
    },
    d(l) {
      l && T(e);
    }
  };
}
function J6(t) {
  let e;
  return {
    c() {
      e = E("Hypothetical Error-Adjsutmen (HEA) turned on");
    },
    m(l, i) {
      C(l, e, i);
    },
    d(l) {
      l && T(e);
    }
  };
}
function dp(t) {
  var n;
  let e, l, i = (
    /*$drawPlan*/
    ((n = t[8]) == null ? void 0 : n.groups) && hp(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(a, r) {
      i && i.m(a, r), C(a, e, r), l = !0;
    },
    p(a, r) {
      var s;
      /*$drawPlan*/
      (s = a[8]) != null && s.groups ? i ? (i.p(a, r), r & /*$drawPlan*/
      256 && S(i, 1)) : (i = hp(a), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(a) {
      l || (S(i), l = !0);
    },
    o(a) {
      D(i), l = !1;
    },
    d(a) {
      a && T(e), i && i.d(a);
    }
  };
}
function hp(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N = (
    /*$drawPlan*/
    t[8].groups.y_axis_group && pp(t)
  ), M = (
    /*$drawPlan*/
    t[8].groups.y_axis_group && mp(t)
  ), H = (
    /*$drawPlan*/
    t[8].groups.y_grid_group && gp(t)
  ), B = (
    /*$drawPlan*/
    t[8].groups.bar_group && bp(t)
  ), R = (
    /*$drawPlan*/
    t[8].groups.x_axis_group && vp(t)
  ), P = (
    /*$drawPlan*/
    t[8].groups.legend_group && kp(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = Xe("svg"), n = Xe("style"), a = E(`g {
                    font-family: Iosevka;
                    font-size: 14px;
                  }
                `), N && N.c(), d = A(), h = m("div"), p = Xe("svg"), b = Xe("style"), g = E(`g {
                    font-family: Iosevka;
                    font-size: 14px;
                  }
                `), M && M.c(), v = Be(), H && H.c(), y = Be(), B && B.c(), k = Be(), R && R.c(), w = Be(), P && P.c(), f(i, "id", r = /*id*/
      t[1] + "-sticky"), f(i, "width", s = /*$drawPlan*/
      t[8].groups.y_axis_group.x + /*$drawPlan*/
      t[8].groups.y_axis_group.width), f(i, "height", o = /*$drawPlan*/
      t[8].height), f(i, "viewBox", u = /*$drawPlan*/
      t[8].viewBox.map(
        /*func*/
        t[20]
      ).join(" ")), f(l, "class", "count-histogram-sticky svelte-ef6jyv"), f(l, "style", c = `width: ${/*$drawPlan*/
      t[8].groups.y_axis_group.x + /*$drawPlan*/
      t[8].groups.y_axis_group.width}px; height:${/*$drawPlan*/
      t[8].height}px;`), f(
        p,
        "id",
        /*id*/
        t[1]
      ), f(p, "width", $ = /*$drawPlan*/
      t[8].width), f(p, "height", q = /*$drawPlan*/
      t[8].height), f(p, "viewBox", j = /*$drawPlan*/
      t[8].viewBox.join(" ")), f(h, "class", "count-histogram-main svelte-ef6jyv"), f(e, "id", O = /*id*/
      t[1] + "-wrapper"), f(e, "class", "count-histogram-wrapper svelte-ef6jyv"), Mt(e, "position", "relative"), Mt(e, "width", "100%"), Mt(e, "overflow-x", "scroll"), Mt(e, "overflow-y", "hidden");
    },
    m(I, L) {
      C(I, e, L), _(e, l), _(l, i), _(i, n), _(n, a), N && N.m(i, null), _(e, d), _(e, h), _(h, p), _(p, b), _(b, g), M && M.m(p, null), _(p, v), H && H.m(p, null), _(p, y), B && B.m(p, null), _(p, k), R && R.m(p, null), _(p, w), P && P.m(p, null), z = !0;
    },
    p(I, L) {
      /*$drawPlan*/
      I[8].groups.y_axis_group ? N ? (N.p(I, L), L & /*$drawPlan*/
      256 && S(N, 1)) : (N = pp(I), N.c(), S(N, 1), N.m(i, null)) : N && (ge(), D(N, 1, 1, () => {
        N = null;
      }), be()), (!z || L & /*id*/
      2 && r !== (r = /*id*/
      I[1] + "-sticky")) && f(i, "id", r), (!z || L & /*$drawPlan*/
      256 && s !== (s = /*$drawPlan*/
      I[8].groups.y_axis_group.x + /*$drawPlan*/
      I[8].groups.y_axis_group.width)) && f(i, "width", s), (!z || L & /*$drawPlan*/
      256 && o !== (o = /*$drawPlan*/
      I[8].height)) && f(i, "height", o), (!z || L & /*$drawPlan*/
      256 && u !== (u = /*$drawPlan*/
      I[8].viewBox.map(
        /*func*/
        I[20]
      ).join(" "))) && f(i, "viewBox", u), (!z || L & /*$drawPlan*/
      256 && c !== (c = `width: ${/*$drawPlan*/
      I[8].groups.y_axis_group.x + /*$drawPlan*/
      I[8].groups.y_axis_group.width}px; height:${/*$drawPlan*/
      I[8].height}px;`)) && f(l, "style", c), /*$drawPlan*/
      I[8].groups.y_axis_group ? M ? (M.p(I, L), L & /*$drawPlan*/
      256 && S(M, 1)) : (M = mp(I), M.c(), S(M, 1), M.m(p, v)) : M && (ge(), D(M, 1, 1, () => {
        M = null;
      }), be()), /*$drawPlan*/
      I[8].groups.y_grid_group ? H ? (H.p(I, L), L & /*$drawPlan*/
      256 && S(H, 1)) : (H = gp(I), H.c(), S(H, 1), H.m(p, y)) : H && (ge(), D(H, 1, 1, () => {
        H = null;
      }), be()), /*$drawPlan*/
      I[8].groups.bar_group ? B ? (B.p(I, L), L & /*$drawPlan*/
      256 && S(B, 1)) : (B = bp(I), B.c(), S(B, 1), B.m(p, k)) : B && (ge(), D(B, 1, 1, () => {
        B = null;
      }), be()), /*$drawPlan*/
      I[8].groups.x_axis_group ? R ? (R.p(I, L), L & /*$drawPlan*/
      256 && S(R, 1)) : (R = vp(I), R.c(), S(R, 1), R.m(p, w)) : R && (ge(), D(R, 1, 1, () => {
        R = null;
      }), be()), /*$drawPlan*/
      I[8].groups.legend_group ? P ? (P.p(I, L), L & /*$drawPlan*/
      256 && S(P, 1)) : (P = kp(I), P.c(), S(P, 1), P.m(p, null)) : P && (ge(), D(P, 1, 1, () => {
        P = null;
      }), be()), (!z || L & /*id*/
      2) && f(
        p,
        "id",
        /*id*/
        I[1]
      ), (!z || L & /*$drawPlan*/
      256 && $ !== ($ = /*$drawPlan*/
      I[8].width)) && f(p, "width", $), (!z || L & /*$drawPlan*/
      256 && q !== (q = /*$drawPlan*/
      I[8].height)) && f(p, "height", q), (!z || L & /*$drawPlan*/
      256 && j !== (j = /*$drawPlan*/
      I[8].viewBox.join(" "))) && f(p, "viewBox", j), (!z || L & /*id*/
      2 && O !== (O = /*id*/
      I[1] + "-wrapper")) && f(e, "id", O);
    },
    i(I) {
      z || (S(N), S(M), S(H), S(B), S(R), S(P), z = !0);
    },
    o(I) {
      D(N), D(M), D(H), D(B), D(R), D(P), z = !1;
    },
    d(I) {
      I && T(e), N && N.d(), M && M.d(), H && H.d(), B && B.d(), R && R.d(), P && P.d();
    }
  };
}
function pp(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[8].groups.y_axis_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      256 && (a.data = /*$drawPlan*/
      i[8].groups.y_axis_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function mp(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[8].groups.y_axis_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      256 && (a.data = /*$drawPlan*/
      i[8].groups.y_axis_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function gp(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[8].groups.y_grid_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      256 && (a.data = /*$drawPlan*/
      i[8].groups.y_grid_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function bp(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[8].groups.bar_group
      ),
      openTooltip: (
        /*openTooltip*/
        t[12]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[14]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[13]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      256 && (a.data = /*$drawPlan*/
      i[8].groups.bar_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function vp(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[8].groups.x_axis_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      256 && (a.data = /*$drawPlan*/
      i[8].groups.x_axis_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function kp(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[8].groups.legend_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      256 && (a.data = /*$drawPlan*/
      i[8].groups.legend_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function yp(t) {
  let e;
  function l(a, r) {
    return (
      /*showTooltip*/
      a[2] ? x6 : Z6
    );
  }
  let i = l(t), n = i(t);
  return {
    c() {
      e = m("div"), n.c(), f(e, "class", "tooltip-space svelte-ef6jyv");
    },
    m(a, r) {
      C(a, e, r), n.m(e, null);
    },
    p(a, r) {
      i === (i = l(a)) && n ? n.p(a, r) : (n.d(1), n = i(a), n && (n.c(), n.m(e, null)));
    },
    d(a) {
      a && T(e), n.d();
    }
  };
}
function Z6(t) {
  let e;
  return {
    c() {
      e = m("div"), e.textContent = "Hover or click an item to see details", f(e, "class", "g-tooltip deactive svelte-ef6jyv");
    },
    m(l, i) {
      C(l, e, i);
    },
    p: ae,
    d(l) {
      l && T(e);
    }
  };
}
function x6(t) {
  let e;
  return {
    c() {
      e = m("div"), f(e, "class", "g-tooltip svelte-ef6jyv");
    },
    m(l, i) {
      C(l, e, i), e.innerHTML = /*tootlip_content*/
      t[3];
    },
    p(l, i) {
      i & /*tootlip_content*/
      8 && (e.innerHTML = /*tootlip_content*/
      l[3]);
    },
    d(l) {
      l && T(e);
    }
  };
}
function e8(t) {
  let e, l, i = (
    /*$data*/
    t[6] && fp(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, e, a), l = !0;
    },
    p(n, [a]) {
      /*$data*/
      n[6] ? i ? (i.p(n, a), a & /*$data*/
      64 && S(i, 1)) : (i = fp(n), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d(n);
    }
  };
}
function t8(t, e, l) {
  let i, n, a = ae, r = () => (a(), a = rt(u, (B) => l(6, n = B)), u), s, o;
  t.$$.on_destroy.push(() => a());
  let { data: u = Pe(), id: c = "count-histogram" } = e;
  r();
  let d = Pe(!0);
  at(t, d, (B) => l(7, s = B));
  let h = Pe();
  at(t, h, (B) => l(8, o = B));
  let p = Pe({
    reverse_state_vector: !0,
    see_uncertainty: !0
  });
  at(t, p, (B) => l(5, i = B)), yt(() => {
    h.set($r(n == null ? void 0 : n.counts, n.uncertainty_data, i)), p.subscribe((B) => {
      h.set($r(n == null ? void 0 : n.counts, n.uncertainty_data, B));
    }), u.subscribe((B) => {
      h.set($r(B == null ? void 0 : B.counts, B.uncertainty_data, i));
    });
  });
  let b = !1, g, v = !1, y = 999;
  function k(B, R, P, I) {
    v && !P || y < I || (l(2, b = !0), B.clientX + 5, B.clientY + 5, l(3, g = R), v = P, y = I || 0);
  }
  function w(B) {
    b && (B.clientX + 5, B.clientY + 5);
  }
  function $(B) {
    v || l(2, b = !1), B && (l(2, b = !1), y = 999);
  }
  let q = {}, j = Pe();
  j.subscribe((B) => {
    B && l(4, q[B.id] = B, q);
  });
  const O = (B) => d.set(!s), z = (B) => {
    Li("count-histogram", j);
  }, N = (B) => {
    p.update((R) => (R.reverse_state_vector = B.target.checked, R));
  }, M = (B) => {
    p.update((R) => (R.see_uncertainty = B.target.checked, R));
  }, H = (B, R) => R == 2 ? o.groups.y_axis_group.x + o.groups.y_axis_group.width : B;
  return t.$$set = (B) => {
    "data" in B && r(l(0, u = B.data)), "id" in B && l(1, c = B.id);
  }, [
    u,
    c,
    b,
    g,
    q,
    i,
    n,
    s,
    o,
    d,
    h,
    p,
    k,
    w,
    $,
    j,
    O,
    z,
    N,
    M,
    H
  ];
}
class l8 extends Ve {
  constructor(e) {
    super(), Qe(this, e, t8, e8, Le, { data: 0, id: 1 });
  }
}
function wp(t) {
  let e, l, i, n, a, r = (
    /*$hide1*/
    t[6] ? "Show" : "Hide"
  ), s, o, u, c, d, h, p, b, g = !/*$hide1*/
  t[6] && /*$pagination*/
  t[7].total_page > 1 && $p(t), v = !/*$hide1*/
  t[6] && qp(t), y = !/*$hide1*/
  t[6] && Pp(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(
        /*panel_name*/
        t[0]
      ), n = A(), a = m("button"), s = E(r), o = A(), g && g.c(), u = A(), c = m("div"), v && v.c(), d = A(), y && y.c(), f(c, "class", "content-wrap"), f(e, "class", "panel svelte-1ws4qni");
    },
    m(k, w) {
      C(k, e, w), _(e, l), _(l, i), _(l, n), _(l, a), _(a, s), _(l, o), g && g.m(l, null), _(e, u), _(e, c), v && v.m(c, null), _(e, d), y && y.m(e, null), h = !0, p || (b = le(
        a,
        "click",
        /*click_handler*/
        t[15]
      ), p = !0);
    },
    p(k, w) {
      (!h || w & /*panel_name*/
      1) && Y(
        i,
        /*panel_name*/
        k[0]
      ), (!h || w & /*$hide1*/
      64) && r !== (r = /*$hide1*/
      k[6] ? "Show" : "Hide") && Y(s, r), !/*$hide1*/
      k[6] && /*$pagination*/
      k[7].total_page > 1 ? g ? g.p(k, w) : (g = $p(k), g.c(), g.m(l, null)) : g && (g.d(1), g = null), /*$hide1*/
      k[6] ? v && (ge(), D(v, 1, 1, () => {
        v = null;
      }), be()) : v ? (v.p(k, w), w & /*$hide1*/
      64 && S(v, 1)) : (v = qp(k), v.c(), S(v, 1), v.m(c, null)), /*$hide1*/
      k[6] ? y && (y.d(1), y = null) : y ? y.p(k, w) : (y = Pp(k), y.c(), y.m(e, null));
    },
    i(k) {
      h || (S(v), h = !0);
    },
    o(k) {
      D(v), h = !1;
    },
    d(k) {
      k && T(e), g && g.d(), v && v.d(), y && y.d(), p = !1, b();
    }
  };
}
function $p(t) {
  let e, l, i, n, a, r = (
    /*$pagination*/
    t[7].range.map(
      /*func*/
      t[17]
    ).join("...") + ""
  ), s, o, u = (
    /*$pagination*/
    t[7].total_page + ""
  ), c, d, h, p, b, g, v, y, k, w, $;
  return {
    c() {
      e = E(`Showing layer
        `), l = m("input"), a = E(`
        (`), s = E(r), o = E(") / "), c = E(u), d = A(), h = m("button"), p = E("← Prev"), g = A(), v = m("button"), y = E("Next →"), f(l, "type", "number"), f(l, "min", 1), f(l, "max", i = /*$pagination*/
      t[7].total_page), l.value = n = /*$pagination*/
      t[7].page, h.disabled = b = /*$pagination*/
      t[7].page <= 1, v.disabled = k = /*$pagination*/
      t[7].page > /*$pagination*/
      t[7].total_page;
    },
    m(q, j) {
      C(q, e, j), C(q, l, j), C(q, a, j), C(q, s, j), C(q, o, j), C(q, c, j), C(q, d, j), C(q, h, j), _(h, p), C(q, g, j), C(q, v, j), _(v, y), w || ($ = [
        le(
          l,
          "change",
          /*change_handler*/
          t[16]
        ),
        le(
          h,
          "click",
          /*click_handler_1*/
          t[18]
        ),
        le(
          v,
          "click",
          /*click_handler_2*/
          t[19]
        )
      ], w = !0);
    },
    p(q, j) {
      j & /*$pagination*/
      128 && i !== (i = /*$pagination*/
      q[7].total_page) && f(l, "max", i), j & /*$pagination*/
      128 && n !== (n = /*$pagination*/
      q[7].page) && l.value !== n && (l.value = n), j & /*$pagination, circuit_data*/
      130 && r !== (r = /*$pagination*/
      q[7].range.map(
        /*func*/
        q[17]
      ).join("...") + "") && Y(s, r), j & /*$pagination*/
      128 && u !== (u = /*$pagination*/
      q[7].total_page + "") && Y(c, u), j & /*$pagination*/
      128 && b !== (b = /*$pagination*/
      q[7].page <= 1) && (h.disabled = b), j & /*$pagination*/
      128 && k !== (k = /*$pagination*/
      q[7].page > /*$pagination*/
      q[7].total_page) && (v.disabled = k);
    },
    d(q) {
      q && (T(e), T(l), T(a), T(s), T(o), T(c), T(d), T(h), T(g), T(v)), w = !1, vt($);
    }
  };
}
function qp(t) {
  let e, l, i = (
    /*drawPlan*/
    t[3] && jp(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, e, a), l = !0;
    },
    p(n, a) {
      /*drawPlan*/
      n[3] ? i ? (i.p(n, a), a & /*drawPlan*/
      8 && S(i, 1)) : (i = jp(n), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d(n);
    }
  };
}
function jp(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H = (
    /*drawPlan*/
    t[3].groups.phase_marker && Tp(t)
  ), B = (
    /*drawPlan*/
    t[3].groups.qubit_group && Cp(t)
  ), R = (
    /*drawPlan*/
    t[3].groups.esp_axis_group && Sp(t)
  ), P = (
    /*drawPlan*/
    t[3].groups.phase_marker && Mp(t)
  ), I = (
    /*drawPlan*/
    t[3].groups.moment_group && zp(t)
  ), L = (
    /*drawPlan*/
    t[3].groups.qubit_group && Np(t)
  ), F = (
    /*drawPlan*/
    t[3].groups.circuit_line_group && Ap(t)
  ), X = (
    /*drawPlan*/
    t[3].groups.circuit_group && Bp(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = Xe("svg"), n = Xe("style"), a = E(`g {
                    font-family: Iosevka;
                    font-size: 14px;
                  }
                `), H && H.c(), r = Be(), B && B.c(), s = Be(), R && R.c(), p = A(), b = m("div"), g = Xe("svg"), v = Xe("style"), y = E(`g {
                    font-family: Iosevka;
                    font-size: 14px;
                  }
                `), P && P.c(), k = Be(), I && I.c(), w = Be(), L && L.c(), $ = Be(), F && F.c(), q = Be(), X && X.c(), f(i, "id", o = /*id*/
      t[2] + "-sticky"), f(i, "width", u = /*drawPlan*/
      t[3].groups.qubit_group.x + /*drawPlan*/
      t[3].groups.qubit_group.width), f(i, "height", c = /*drawPlan*/
      t[3].height), f(i, "viewBox", d = /*drawPlan*/
      t[3].viewBox.map(
        /*func_1*/
        t[20]
      ).join(" ")), f(l, "class", "circuit-sticky svelte-1ws4qni"), f(l, "style", h = `width: ${/*drawPlan*/
      t[3].groups.qubit_group.x + /*drawPlan*/
      t[3].groups.qubit_group.width}px; height:${/*drawPlan*/
      t[3].height}px;`), f(
        g,
        "id",
        /*id*/
        t[2]
      ), f(g, "width", j = /*drawPlan*/
      t[3].width), f(g, "height", O = /*drawPlan*/
      t[3].height), f(g, "viewBox", z = /*drawPlan*/
      t[3].viewBox.join(" ")), f(b, "class", "circuit-main svelte-1ws4qni"), f(e, "id", N = /*id*/
      t[2] + "-wrapper"), f(e, "class", "ciruit-view-wrapper svelte-1ws4qni"), Mt(e, "position", "relative"), Mt(e, "width", "100%"), Mt(e, "overflow-x", "scroll"), Mt(e, "overflow-y", "hidden");
    },
    m(V, Q) {
      C(V, e, Q), _(e, l), _(l, i), _(i, n), _(n, a), H && H.m(i, null), _(i, r), B && B.m(i, null), _(i, s), R && R.m(i, null), _(e, p), _(e, b), _(b, g), _(g, v), _(v, y), P && P.m(g, null), _(g, k), I && I.m(g, null), _(g, w), L && L.m(g, null), _(g, $), F && F.m(g, null), _(g, q), X && X.m(g, null), M = !0;
    },
    p(V, Q) {
      /*drawPlan*/
      V[3].groups.phase_marker ? H ? (H.p(V, Q), Q & /*drawPlan*/
      8 && S(H, 1)) : (H = Tp(V), H.c(), S(H, 1), H.m(i, r)) : H && (ge(), D(H, 1, 1, () => {
        H = null;
      }), be()), /*drawPlan*/
      V[3].groups.qubit_group ? B ? (B.p(V, Q), Q & /*drawPlan*/
      8 && S(B, 1)) : (B = Cp(V), B.c(), S(B, 1), B.m(i, s)) : B && (ge(), D(B, 1, 1, () => {
        B = null;
      }), be()), /*drawPlan*/
      V[3].groups.esp_axis_group ? R ? (R.p(V, Q), Q & /*drawPlan*/
      8 && S(R, 1)) : (R = Sp(V), R.c(), S(R, 1), R.m(i, null)) : R && (ge(), D(R, 1, 1, () => {
        R = null;
      }), be()), (!M || Q & /*id*/
      4 && o !== (o = /*id*/
      V[2] + "-sticky")) && f(i, "id", o), (!M || Q & /*drawPlan*/
      8 && u !== (u = /*drawPlan*/
      V[3].groups.qubit_group.x + /*drawPlan*/
      V[3].groups.qubit_group.width)) && f(i, "width", u), (!M || Q & /*drawPlan*/
      8 && c !== (c = /*drawPlan*/
      V[3].height)) && f(i, "height", c), (!M || Q & /*drawPlan*/
      8 && d !== (d = /*drawPlan*/
      V[3].viewBox.map(
        /*func_1*/
        V[20]
      ).join(" "))) && f(i, "viewBox", d), (!M || Q & /*drawPlan*/
      8 && h !== (h = `width: ${/*drawPlan*/
      V[3].groups.qubit_group.x + /*drawPlan*/
      V[3].groups.qubit_group.width}px; height:${/*drawPlan*/
      V[3].height}px;`)) && f(l, "style", h), /*drawPlan*/
      V[3].groups.phase_marker ? P ? (P.p(V, Q), Q & /*drawPlan*/
      8 && S(P, 1)) : (P = Mp(V), P.c(), S(P, 1), P.m(g, k)) : P && (ge(), D(P, 1, 1, () => {
        P = null;
      }), be()), /*drawPlan*/
      V[3].groups.moment_group ? I ? (I.p(V, Q), Q & /*drawPlan*/
      8 && S(I, 1)) : (I = zp(V), I.c(), S(I, 1), I.m(g, w)) : I && (ge(), D(I, 1, 1, () => {
        I = null;
      }), be()), /*drawPlan*/
      V[3].groups.qubit_group ? L ? (L.p(V, Q), Q & /*drawPlan*/
      8 && S(L, 1)) : (L = Np(V), L.c(), S(L, 1), L.m(g, $)) : L && (ge(), D(L, 1, 1, () => {
        L = null;
      }), be()), /*drawPlan*/
      V[3].groups.circuit_line_group ? F ? (F.p(V, Q), Q & /*drawPlan*/
      8 && S(F, 1)) : (F = Ap(V), F.c(), S(F, 1), F.m(g, q)) : F && (ge(), D(F, 1, 1, () => {
        F = null;
      }), be()), /*drawPlan*/
      V[3].groups.circuit_group ? X ? (X.p(V, Q), Q & /*drawPlan*/
      8 && S(X, 1)) : (X = Bp(V), X.c(), S(X, 1), X.m(g, null)) : X && (ge(), D(X, 1, 1, () => {
        X = null;
      }), be()), (!M || Q & /*id*/
      4) && f(
        g,
        "id",
        /*id*/
        V[2]
      ), (!M || Q & /*drawPlan*/
      8 && j !== (j = /*drawPlan*/
      V[3].width)) && f(g, "width", j), (!M || Q & /*drawPlan*/
      8 && O !== (O = /*drawPlan*/
      V[3].height)) && f(g, "height", O), (!M || Q & /*drawPlan*/
      8 && z !== (z = /*drawPlan*/
      V[3].viewBox.join(" "))) && f(g, "viewBox", z), (!M || Q & /*id*/
      4 && N !== (N = /*id*/
      V[2] + "-wrapper")) && f(e, "id", N);
    },
    i(V) {
      M || (S(H), S(B), S(R), S(P), S(I), S(L), S(F), S(X), M = !0);
    },
    o(V) {
      D(H), D(B), D(R), D(P), D(I), D(L), D(F), D(X), M = !1;
    },
    d(V) {
      V && T(e), H && H.d(), B && B.d(), R && R.d(), P && P.d(), I && I.d(), L && L.d(), F && F.d(), X && X.d();
    }
  };
}
function Tp(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.phase_marker
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      8 && (a.data = /*drawPlan*/
      i[3].groups.phase_marker), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Cp(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.qubit_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      8 && (a.data = /*drawPlan*/
      i[3].groups.qubit_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Sp(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.esp_axis_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      8 && (a.data = /*drawPlan*/
      i[3].groups.esp_axis_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Mp(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.phase_marker
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      8 && (a.data = /*drawPlan*/
      i[3].groups.phase_marker), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function zp(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.moment_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      8 && (a.data = /*drawPlan*/
      i[3].groups.moment_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Np(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.qubit_group
      ),
      openTooltip: (
        /*openTooltip*/
        t[11]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[13]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[12]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      8 && (a.data = /*drawPlan*/
      i[3].groups.qubit_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Ap(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.circuit_line_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      8 && (a.data = /*drawPlan*/
      i[3].groups.circuit_line_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Bp(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.circuit_group
      ),
      openTooltip: (
        /*openTooltip*/
        t[11]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[13]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[12]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*drawPlan*/
      8 && (a.data = /*drawPlan*/
      i[3].groups.circuit_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function Pp(t) {
  let e;
  function l(a, r) {
    return (
      /*showTooltip*/
      a[4] ? n8 : i8
    );
  }
  let i = l(t), n = i(t);
  return {
    c() {
      e = m("div"), n.c(), f(e, "class", "tooltip-space svelte-1ws4qni");
    },
    m(a, r) {
      C(a, e, r), n.m(e, null);
    },
    p(a, r) {
      i === (i = l(a)) && n ? n.p(a, r) : (n.d(1), n = i(a), n && (n.c(), n.m(e, null)));
    },
    d(a) {
      a && T(e), n.d();
    }
  };
}
function i8(t) {
  let e;
  return {
    c() {
      e = m("div"), e.textContent = "Hover or click an item to see details", f(e, "class", "g-tooltip deactive svelte-1ws4qni");
    },
    m(l, i) {
      C(l, e, i);
    },
    p: ae,
    d(l) {
      l && T(e);
    }
  };
}
function n8(t) {
  let e;
  return {
    c() {
      e = m("div"), f(e, "class", "g-tooltip svelte-1ws4qni");
    },
    m(l, i) {
      C(l, e, i), e.innerHTML = /*tootlip_content*/
      t[5];
    },
    p(l, i) {
      i & /*tootlip_content*/
      32 && (e.innerHTML = /*tootlip_content*/
      l[5]);
    },
    d(l) {
      l && T(e);
    }
  };
}
function a8(t) {
  let e, l, i = (
    /*circuit_data*/
    t[1] && wp(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, e, a), l = !0;
    },
    p(n, [a]) {
      /*circuit_data*/
      n[1] ? i ? (i.p(n, a), a & /*circuit_data*/
      2 && S(i, 1)) : (i = wp(n), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d(n);
    }
  };
}
const Ii = 50;
function Ep(t, e) {
  if (!t.layers)
    return [];
  let l = [];
  for (const i of t.layers)
    for (const n of i.operations)
      for (const a of n[e]) {
        let r = a.index + "___" + a.register.name + "___" + a.register.size;
        l.includes(r) || l.push(r);
      }
  return l.map((i) => {
    let n = i.split("___");
    return {
      index: parseInt(n[0]),
      register: { name: n[1], size: parseInt(n[2]) }
    };
  });
}
function r8(t, e, l) {
  let i, n, { panel_name: a = "Circuit", circuit_data: r, is_original: s = !1, id: o = "circuit" } = e, u = Pe(!0);
  at(t, u, (P) => l(6, i = P));
  let c = Pe({ total_page: 0, page: 0, range: [0, 0] });
  at(t, c, (P) => l(7, n = P));
  let d, h = !0, p = [], b = [];
  function g(P, I) {
    var L;
    if (!P.layers) {
      l(3, d = void 0);
      return;
    }
    p = Ep(P, "qubits"), b = Ep(P, "clbits"), P.qubits = p, P.num_qubits = p == null ? void 0 : p.length, P.clbits = b, P.num_clbits = b == null ? void 0 : b.length, l(3, d = Cr(P, {
      pagination: I,
      show_moments: !0,
      is_original: s,
      filter_unused_qubits: h,
      no_match: !0,
      first_layer_index: ((L = P.layer_index) == null ? void 0 : L[0]) || 0
    }));
  }
  yt(() => {
    var L;
    c.subscribe((F) => {
      g(r, F);
    });
    let P = ((L = r.layers) == null ? void 0 : L.length) || 0, I = Math.ceil(P / Ii);
    c.set({
      total_layers: P,
      total_page: I,
      page: 1,
      range: [0, Math.min(Ii, P)]
    });
  });
  function v(P) {
    c.update((I) => (I.page = Math.min(I.total_page, Math.max(1, P)), I.range = [
      Math.min(I.total_layers - 1, Math.max(0, (P - 1) * Ii)),
      Math.min(I.total_layers - 1, Math.max(0, P * Ii))
    ], console.log(I), I));
  }
  let y = !1, k, w = !1, $ = 999;
  function q(P, I, L, F) {
    w && !L || $ < F || (l(4, y = !0), P.clientX + 5, P.clientY + 5, l(5, k = I), w = L, $ = F || 0);
  }
  function j(P) {
    y && (P.clientX + 5, P.clientY + 5);
  }
  function O(P) {
    w || l(4, y = !1), P && (l(4, y = !1), $ = 999);
  }
  const z = (P) => u.set(!i), N = (P) => {
    v(parseInt(P.target.value));
  }, M = (P) => {
    var I;
    return (((I = r.layer_index) == null ? void 0 : I[0]) || 0) + P;
  }, H = (P) => {
    v(n.page - 1);
  }, B = (P) => {
    v(n.page + 1);
  }, R = (P, I) => I == 2 ? d.groups.qubit_group.x + d.groups.qubit_group.width : P;
  return t.$$set = (P) => {
    "panel_name" in P && l(0, a = P.panel_name), "circuit_data" in P && l(1, r = P.circuit_data), "is_original" in P && l(14, s = P.is_original), "id" in P && l(2, o = P.id);
  }, t.$$.update = () => {
    var P;
    if (t.$$.dirty & /*circuit_data*/
    2) {
      let I = ((P = r.layers) == null ? void 0 : P.length) || 0, L = Math.ceil(I / Ii);
      c.set({
        total_layers: I,
        total_page: L,
        page: 1,
        range: [0, Math.min(Ii, I)]
      });
    }
  }, [
    a,
    r,
    o,
    d,
    y,
    k,
    i,
    n,
    u,
    c,
    v,
    q,
    j,
    O,
    s,
    z,
    N,
    M,
    H,
    B,
    R
  ];
}
class Op extends Ve {
  constructor(e) {
    super(), Qe(this, e, r8, a8, Le, {
      panel_name: 0,
      circuit_data: 1,
      is_original: 14,
      id: 2
    });
  }
}
function Ip(t, e, l) {
  const i = t.slice();
  return i[11] = e[l], i[13] = l, i;
}
function Dp(t, e, l) {
  const i = t.slice();
  return i[14] = e[l], i[16] = l, i;
}
function Rp(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[2] ? "Show" : "Hide"
  ), r, s, o, u, c, d, h, p, b = (
    /*$hide2*/
    t[3] ? "Show" : "Hide"
  ), g, v, y, k, w, $, q, j, O = (
    /*$hide3*/
    t[4] ? "Show" : "Hide"
  ), z, N, M, H, B, R = !/*$hide1*/
  t[2] && Hp(t), P = !/*$hide2*/
  t[3] && Xp(t), I = !/*$hide3*/
  t[4] && Kp(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E("Backend information "), n = m("button"), r = E(a), s = A(), o = m("div"), R && R.c(), u = A(), c = m("article"), d = m("h4"), h = E("Backend general parameters "), p = m("button"), g = E(b), v = A(), y = m("div"), P && P.c(), k = A(), w = m("article"), $ = m("h4"), q = E("Qubit groups "), j = m("button"), z = E(O), N = A(), M = m("div"), I && I.c(), f(o, "class", "content-wrap svelte-eeto7c"), f(e, "class", "panel meta svelte-eeto7c"), f(y, "class", "content-wrap svelte-eeto7c"), f(c, "class", "panel generic svelte-eeto7c"), f(M, "class", "content-wrap svelte-eeto7c"), f(w, "class", "panel generic-q svelte-eeto7c");
    },
    m(L, F) {
      C(L, e, F), _(e, l), _(l, i), _(l, n), _(n, r), _(e, s), _(e, o), R && R.m(o, null), C(L, u, F), C(L, c, F), _(c, d), _(d, h), _(d, p), _(p, g), _(c, v), _(c, y), P && P.m(y, null), C(L, k, F), C(L, w, F), _(w, $), _($, q), _($, j), _(j, z), _(w, N), _(w, M), I && I.m(M, null), H || (B = [
        le(
          n,
          "click",
          /*click_handler*/
          t[8]
        ),
        le(
          p,
          "click",
          /*click_handler_1*/
          t[9]
        ),
        le(
          j,
          "click",
          /*click_handler_2*/
          t[10]
        )
      ], H = !0);
    },
    p(L, F) {
      F & /*$hide1*/
      4 && a !== (a = /*$hide1*/
      L[2] ? "Show" : "Hide") && Y(r, a), /*$hide1*/
      L[2] ? R && (R.d(1), R = null) : R ? R.p(L, F) : (R = Hp(L), R.c(), R.m(o, null)), F & /*$hide2*/
      8 && b !== (b = /*$hide2*/
      L[3] ? "Show" : "Hide") && Y(g, b), /*$hide2*/
      L[3] ? P && (P.d(1), P = null) : P ? P.p(L, F) : (P = Xp(L), P.c(), P.m(y, null)), F & /*$hide3*/
      16 && O !== (O = /*$hide3*/
      L[4] ? "Show" : "Hide") && Y(z, O), /*$hide3*/
      L[4] ? I && (I.d(1), I = null) : I ? I.p(L, F) : (I = Kp(L), I.c(), I.m(M, null));
    },
    d(L) {
      L && (T(e), T(u), T(c), T(k), T(w)), R && R.d(), P && P.d(), I && I.d(), H = !1, vt(B);
    }
  };
}
function Hp(t) {
  var u, c, d, h;
  let e, l, i, n, a = (
    /*$data*/
    ((u = t[1].machine_data) == null ? void 0 : u.backend_name) && Fp(t)
  ), r = (
    /*data*/
    ((c = t[0].machine_data) == null ? void 0 : c.backend_version) && Lp(t)
  ), s = (
    /*data*/
    ((d = t[0].backend_properties) == null ? void 0 : d.last_update_date) && Qp(t)
  ), o = (
    /*$data*/
    ((h = t[1].machine_data) == null ? void 0 : h.basis_gates) && Vp(t)
  );
  return {
    c() {
      e = m("table"), a && a.c(), l = A(), r && r.c(), i = A(), s && s.c(), n = A(), o && o.c(), f(e, "class", "svelte-eeto7c");
    },
    m(p, b) {
      C(p, e, b), a && a.m(e, null), _(e, l), r && r.m(e, null), _(e, i), s && s.m(e, null), _(e, n), o && o.m(e, null);
    },
    p(p, b) {
      var g, v, y, k;
      /*$data*/
      (g = p[1].machine_data) != null && g.backend_name ? a ? a.p(p, b) : (a = Fp(p), a.c(), a.m(e, l)) : a && (a.d(1), a = null), /*data*/
      (v = p[0].machine_data) != null && v.backend_version ? r ? r.p(p, b) : (r = Lp(p), r.c(), r.m(e, i)) : r && (r.d(1), r = null), /*data*/
      (y = p[0].backend_properties) != null && y.last_update_date ? s ? s.p(p, b) : (s = Qp(p), s.c(), s.m(e, n)) : s && (s.d(1), s = null), /*$data*/
      (k = p[1].machine_data) != null && k.basis_gates ? o ? o.p(p, b) : (o = Vp(p), o.c(), o.m(e, null)) : o && (o.d(1), o = null);
    },
    d(p) {
      p && T(e), a && a.d(), r && r.d(), s && s.d(), o && o.d();
    }
  };
}
function Fp(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].machine_data.backend_name + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Backend name", i = m("td"), a = E(n), f(l, "class", "svelte-eeto7c"), f(i, "class", "svelte-eeto7c");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].machine_data.backend_name + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function Lp(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].machine_data.backend_version + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Backend version", i = m("td"), a = E(n), f(l, "class", "svelte-eeto7c"), f(i, "class", "svelte-eeto7c");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].machine_data.backend_version + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function Qp(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].backend_properties.last_update_date + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Last updated", i = m("td"), a = E(n), f(l, "class", "svelte-eeto7c"), f(i, "class", "svelte-eeto7c");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].backend_properties.last_update_date + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function Vp(t) {
  var r;
  let e, l, i, n = (
    /*$data*/
    ((r = t[1].machine_data.basis_gates) == null ? void 0 : r.join(", ")) + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Basis gates", i = m("td"), a = E(n), f(l, "class", "svelte-eeto7c"), f(i, "class", "svelte-eeto7c");
    },
    m(s, o) {
      C(s, e, o), _(e, l), _(e, i), _(i, a);
    },
    p(s, o) {
      var u;
      o & /*$data*/
      2 && n !== (n = /*$data*/
      ((u = s[1].machine_data.basis_gates) == null ? void 0 : u.join(", ")) + "") && Y(a, n);
    },
    d(s) {
      s && T(e);
    }
  };
}
function Xp(t) {
  var i;
  let e, l = (
    /*$data*/
    ((i = t[1].backend_properties) == null ? void 0 : i.general) && Gp(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(n, a) {
      l && l.m(n, a), C(n, e, a);
    },
    p(n, a) {
      var r;
      /*$data*/
      (r = n[1].backend_properties) != null && r.general ? l ? l.p(n, a) : (l = Gp(n), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    d(n) {
      n && T(e), l && l.d(n);
    }
  };
}
function Gp(t) {
  let e, l, i, n, a = we(Object.keys(
    /*$data*/
    t[1].backend_properties.general
  )), r = [];
  for (let s = 0; s < a.length; s += 1)
    r[s] = Yp(Dp(t, a, s));
  return {
    c() {
      e = m("table"), l = m("thead"), l.innerHTML = '<tr><th class="svelte-eeto7c">Name</th> <th class="svelte-eeto7c">Value</th> <th class="svelte-eeto7c">Unit</th> <th class="svelte-eeto7c">As of</th></tr>', i = A(), n = m("tbody");
      for (let s = 0; s < r.length; s += 1)
        r[s].c();
      f(l, "class", "svelte-eeto7c"), f(e, "class", "svelte-eeto7c");
    },
    m(s, o) {
      C(s, e, o), _(e, l), _(e, i), _(e, n);
      for (let u = 0; u < r.length; u += 1)
        r[u] && r[u].m(n, null);
    },
    p(s, o) {
      if (o & /*$data, Object*/
      2) {
        a = we(Object.keys(
          /*$data*/
          s[1].backend_properties.general
        ));
        let u;
        for (u = 0; u < a.length; u += 1) {
          const c = Dp(s, a, u);
          r[u] ? r[u].p(c, o) : (r[u] = Yp(c), r[u].c(), r[u].m(n, null));
        }
        for (; u < r.length; u += 1)
          r[u].d(1);
        r.length = a.length;
      }
    },
    d(s) {
      s && T(e), Ge(r, s);
    }
  };
}
function Yp(t) {
  let e, l, i = (
    /*key*/
    t[14] + ""
  ), n, a, r, s = (
    /*$data*/
    t[1].backend_properties.general[
      /*key*/
      t[14]
    ].value + ""
  ), o, u, c, d = (
    /*$data*/
    t[1].backend_properties.general[
      /*key*/
      t[14]
    ].unit + ""
  ), h, p, b, g = (
    /*$data*/
    t[1].backend_properties.general[
      /*key*/
      t[14]
    ].asof + ""
  ), v, y;
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = A(), r = m("td"), o = E(s), u = A(), c = m("td"), h = E(d), p = A(), b = m("td"), v = E(g), y = A(), f(l, "class", "svelte-eeto7c"), f(r, "class", "svelte-eeto7c"), f(c, "class", "svelte-eeto7c"), f(b, "class", "svelte-eeto7c");
    },
    m(k, w) {
      C(k, e, w), _(e, l), _(l, n), _(e, a), _(e, r), _(r, o), _(e, u), _(e, c), _(c, h), _(e, p), _(e, b), _(b, v), _(e, y);
    },
    p(k, w) {
      w & /*$data*/
      2 && i !== (i = /*key*/
      k[14] + "") && Y(n, i), w & /*$data*/
      2 && s !== (s = /*$data*/
      k[1].backend_properties.general[
        /*key*/
        k[14]
      ].value + "") && Y(o, s), w & /*$data*/
      2 && d !== (d = /*$data*/
      k[1].backend_properties.general[
        /*key*/
        k[14]
      ].unit + "") && Y(h, d), w & /*$data*/
      2 && g !== (g = /*$data*/
      k[1].backend_properties.general[
        /*key*/
        k[14]
      ].asof + "") && Y(v, g);
    },
    d(k) {
      k && T(e);
    }
  };
}
function Kp(t) {
  var i;
  let e, l = (
    /*$data*/
    ((i = t[1].backend_properties) == null ? void 0 : i.general_qlists) && Up(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(n, a) {
      l && l.m(n, a), C(n, e, a);
    },
    p(n, a) {
      var r;
      /*$data*/
      (r = n[1].backend_properties) != null && r.general_qlists ? l ? l.p(n, a) : (l = Up(n), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    d(n) {
      n && T(e), l && l.d(n);
    }
  };
}
function Up(t) {
  let e, l = we(
    /*$data*/
    t[1].backend_properties.general_qlists
  ), i = [];
  for (let n = 0; n < l.length; n += 1)
    i[n] = Wp(Ip(t, l, n));
  return {
    c() {
      for (let n = 0; n < i.length; n += 1)
        i[n].c();
      e = Be();
    },
    m(n, a) {
      for (let r = 0; r < i.length; r += 1)
        i[r] && i[r].m(n, a);
      C(n, e, a);
    },
    p(n, a) {
      if (a & /*$data*/
      2) {
        l = we(
          /*$data*/
          n[1].backend_properties.general_qlists
        );
        let r;
        for (r = 0; r < l.length; r += 1) {
          const s = Ip(n, l, r);
          i[r] ? i[r].p(s, a) : (i[r] = Wp(s), i[r].c(), i[r].m(e.parentNode, e));
        }
        for (; r < i.length; r += 1)
          i[r].d(1);
        i.length = l.length;
      }
    },
    d(n) {
      n && T(e), Ge(i, n);
    }
  };
}
function Wp(t) {
  let e, l = (
    /*a_set*/
    t[11].name + ""
  ), i, n, a, r, s = (
    /*a_set*/
    t[11].qubits.join(", ") + ""
  ), o;
  return {
    c() {
      e = m("strong"), i = E(l), n = A(), a = m("br"), r = A(), o = E(s);
    },
    m(u, c) {
      C(u, e, c), _(e, i), C(u, n, c), C(u, a, c), C(u, r, c), C(u, o, c);
    },
    p(u, c) {
      c & /*$data*/
      2 && l !== (l = /*a_set*/
      u[11].name + "") && Y(i, l), c & /*$data*/
      2 && s !== (s = /*a_set*/
      u[11].qubits.join(", ") + "") && Y(o, s);
    },
    d(u) {
      u && (T(e), T(n), T(a), T(r), T(o));
    }
  };
}
function s8(t) {
  let e, l = (
    /*$data*/
    t[1] && Rp(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*$data*/
      i[1] ? l ? l.p(i, n) : (l = Rp(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function o8(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, (v) => l(1, i = v)), u), r, s, o;
  t.$$.on_destroy.push(() => n());
  let { data: u = Pe() } = e;
  a();
  let c = Pe(!1), d = Pe(!1), h = Pe(!1);
  at(t, c, (v) => l(2, r = v)), at(t, d, (v) => l(3, s = v)), at(t, h, (v) => l(4, o = v));
  const p = (v) => c.set(!r), b = (v) => d.set(!s), g = (v) => h.set(!o);
  return t.$$set = (v) => {
    "data" in v && a(l(0, u = v.data));
  }, [
    u,
    i,
    r,
    s,
    o,
    c,
    d,
    h,
    p,
    b,
    g
  ];
}
class u8 extends Ve {
  constructor(e) {
    super(), Qe(this, e, o8, s8, Le, { data: 0 });
  }
}
const Jp = [
  { key: "natural_number", name: "Natural Number" },
  { key: "truth_table", name: "Truth Table" },
  { key: "pivot_table", name: "Categorical Table" },
  { key: "image_1d", name: "Image (1D)" },
  { key: "image_3d", name: "Image (3D)" },
  { key: "max_cut", name: "Max Cut" }
], ul = 40, Kt = 300, Zp = 30, hl = 20, xp = 0.75, f8 = Wt(",d");
function _8(t) {
  var v;
  if (!t)
    return null;
  let e = [], l = (v = Object.keys(t)[0]) == null ? void 0 : v.length;
  parseInt(Array.from(Array(l).keys()).map((y) => "1").join(""), 2);
  let i = Object.keys(t);
  if (i.length > 0)
    for (let y = 0; y < i[0].length; y++)
      i.every((k) => k[y] === "0");
  for (const y of Object.keys(t))
    e.push({
      original_state_vector: y,
      number: parseInt(y, 2),
      count: t[y]
    });
  e.sort((y, k) => y.number - k.number);
  let n = 0, a = Kt + Zp, r, s, o, u, c = (e == null ? void 0 : e.length) * hl;
  n = c + ul;
  let d = Math.max(...e.map((y) => y.count)), h = Rl().domain([0, d]).range([0, Kt]).nice(), p = h.invert(Kt), b = d8(p);
  s = {
    type: "g",
    id: "natural-number-view-y-axis",
    role: "natural-number-view-y-axis",
    width: ul,
    height: Kt,
    x: Ie,
    y: Ie,
    elem: [{
      type: "line",
      id: "natural-number-view-y-axis-domain",
      x1: ul - 1,
      x2: ul - 1,
      y1: 0,
      y2: Kt,
      stroke: ze,
      "stroke-width": 1
    }]
  }, o = {
    type: "g",
    id: "natural-number-view-y-axis",
    role: "natural-number-view-y-axis",
    width: c,
    height: Kt,
    x: Ie + ul,
    y: Ie,
    elem: []
  }, n += ul;
  for (let y = 0; y <= p; y += b) {
    let k = {
      type: "g",
      id: "natural-number-view-y-axis-tick",
      width: ul,
      x: 0,
      y: Kt - h(y),
      elem: []
    }, w = {
      type: "line",
      x1: ul - 1,
      x2: ul - 6,
      y1: -0.5,
      y2: -0.5,
      stroke: ze,
      "stroke-width": 1
    }, $ = {
      type: "text",
      x: ul - 10,
      y: 0,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: f8(y),
      "font-size": 12
    };
    k.elem.push(w, $), s.elem.push(k), o.elem.push({
      type: "line",
      x1: 0,
      x2: c,
      y1: Kt - h(y) - 0.5,
      y2: Kt - h(y) - 0.5,
      stroke: "#dddddd",
      "stroke-width": 1
    });
  }
  r = {
    type: "g",
    id: "natural-number-view-bar-group",
    role: "natural-number-view-bar-group",
    width: c,
    height: Kt,
    x: Ie + ul,
    y: Ie,
    elem: []
  }, u = {
    type: "g",
    id: "natural-number-view-x-axis",
    role: "natural-number-view-x-axis",
    width: c,
    height: Zp,
    x: Ie + ul,
    y: Ie + Kt,
    elem: [{
      type: "line",
      id: "natural-number-view-y-axis-domain",
      x1: 0,
      x2: c,
      y1: -0.5,
      y2: -0.5,
      stroke: ze,
      "stroke-width": 1
    }]
  };
  let g = 0;
  for (let y of e) {
    let k = hl * g, w = h(y.count), $ = {
      type: "g",
      id: "natural-number-view-bar-item-" + g,
      role: "natural-number-view-bar--group",
      width: hl,
      height: Kt,
      x: k,
      y: 0,
      elem: [{
        type: "rect",
        id: "natural-number-view-bar-" + g,
        width: hl * xp,
        x: hl * (1 - xp) / 2,
        height: 4,
        y: Kt - w - 2,
        fill: Ut[0],
        "stroke-width": 0
      }, {
        type: "text",
        id: "natural-number-view-bar-count-" + g,
        x: hl / 2,
        y: Kt - w + 9,
        "text-anchor": "middle",
        "alignment-baseline": "middle",
        "font-size": 9,
        fill: "gray",
        text: y.count || 0
      }, {
        type: "click-wrap",
        id: "natural-number-view-bar-click-wrap-" + g,
        role: "natural-number-view-bar-click-wrap",
        width: hl,
        x: 0,
        height: Kt,
        y: 0,
        data: {
          number: y.number,
          count: y.count
        }
      }],
      data: {
        tooltip_content: {
          Number: y.number,
          Count: y.count,
          "State vector": y.original_state_vector
        }
      }
    };
    r.elem.push($);
    let q = {
      type: "g",
      id: "natural-number-view-x-axis-group-" + g,
      width: hl,
      height: Kt,
      x: k,
      y: 0,
      elem: [{
        type: "line",
        id: "natural-number-view-x-axis-" + g,
        x1: hl / 2 - 0.5,
        x2: hl / 2 - 0.5,
        y1: 0,
        y2: 5,
        "stroke-width": 1
      }, {
        type: "text",
        id: "natural-number-view-x-axis-marker-" + g,
        role: "natural-number-view-x-axis-marker",
        x: hl / 2,
        y: 15,
        "text-anchor": "middle",
        "alignment-baseline": "middle",
        "font-size": 10,
        text: y.number
      }]
    };
    u.elem.push(q), g++;
  }
  return {
    type: "svg",
    width: n + Ie * 2,
    height: a + Ie * 2,
    viewBox: [0, 0, n + Ie * 2, a + Ie * 2],
    groups: {
      bar_group: r,
      y_axis_group: s,
      y_grid_group: o,
      x_axis_group: u
    }
  };
}
let c8 = [100, 50, 25, 10, 5, 1];
function d8(t) {
  for (let e of c8)
    if (t % e == 0 && t / e > 1)
      return e;
}
const zt = 25, Vt = 25, kl = 50, qr = 200, e1 = 15;
function h8(t, e) {
  var b;
  if (!t)
    return null;
  let l = [], i = (e == null ? void 0 : e.filter_true) !== void 0 ? e == null ? void 0 : e.filter_true : !1;
  for (const g of Object.keys(t)) {
    let v = m8(g);
    i && !v.truth || l.push({
      original_state_vector: g,
      reversed_state_vector: g8(g),
      truth_state: v,
      count: t[g]
    });
  }
  let n = Object.keys(l[0].truth_state.symbols), a = n == null ? void 0 : n.length;
  l.sort((g, v) => v.count - g.count);
  let r = ((b = l[0].original_state_vector) == null ? void 0 : b.length) * 12 * 0.6 + 10, s = r + a * Vt + kl + Ze + qr + Ze, o = zt * ((l == null ? void 0 : l.length) + 1), u, c, d = Math.max(...l.map((g) => g.count)), h = Rl().domain([0, d]).range([0, qr]).nice();
  u = {
    type: "g",
    id: "truth-table-header-group",
    role: "truth-table-header-group",
    width: s,
    height: zt,
    x: Ie,
    y: Ie,
    elem: [{
      type: "rect",
      id: "truth-table-header-background",
      role: "truth-table-header-background",
      width: s,
      height: zt,
      x: 0,
      y: 0,
      fill: it,
      "stroke-width": 0
    }]
  }, u.elem.push({
    type: "line",
    x1: 0.5,
    x2: 0.5,
    y1: 0.5,
    y2: zt - 0.5,
    "stroke-width": 1,
    stroke: ze
  }), u.elem.push({
    type: "text",
    id: "truth-table-header-symbol-state",
    x: r / 2,
    y: zt / 2 + 6,
    fill: ze,
    text: "State",
    "font-weight": 700,
    "text-anchor": "middle",
    "alignment-baseline": "bottom"
  }), u.elem.push({
    type: "line",
    x1: r,
    x2: r,
    y1: 0.5,
    y2: zt - 0.5,
    "stroke-width": 1,
    stroke: ze
  });
  for (let g = 0; g < a; g++)
    u.elem.push({
      type: "text",
      id: "truth-table-header-symbol-" + n[g],
      x: r + Vt * g + Vt / 2,
      y: zt / 2 + 6,
      fill: ze,
      text: n[g],
      "font-weight": 700,
      "text-anchor": "middle",
      "alignment-baseline": "bottom"
    }), u.elem.push({
      type: "line",
      x1: r + Vt * (g + 1),
      x2: r + Vt * (g + 1),
      y1: 0.5,
      y2: zt - 0.5,
      "stroke-width": 1,
      stroke: ze
    });
  u.elem.push({
    type: "text",
    id: "truth-table-header-truth",
    x: r + Vt * a + kl / 2,
    y: zt / 2 + 6,
    fill: ze,
    text: "Truth",
    "font-weight": 700,
    "text-anchor": "middle",
    "alignment-baseline": "bottom"
  }), u.elem.push({
    type: "line",
    x1: r + Vt * a + kl,
    x2: r + Vt * a + kl,
    y1: 0.5,
    y2: zt - 0.5,
    "stroke-width": 1,
    stroke: ze
  }), u.elem.push({
    type: "text",
    id: "truth-table-header-count",
    x: r + Vt * a + kl + Ze + qr / 2,
    y: zt / 2 + 6,
    fill: ze,
    text: "Count",
    "font-weight": 700,
    "text-anchor": "middle",
    "alignment-baseline": "bottom"
  }), u.elem.push({
    type: "line",
    x1: s - 0.5,
    x2: s - 0.5,
    y1: 0.5,
    y2: zt - 0.5,
    "stroke-width": 1,
    stroke: ze
  }), u.elem.push({
    type: "line",
    x1: 0,
    x2: s,
    y1: zt - 0.5,
    y2: zt - 0.5,
    "stroke-width": 1,
    stroke: ze
  }), u.elem.push({
    type: "line",
    x1: 0,
    x2: s,
    y1: 0.5,
    y2: 0.5,
    "stroke-width": 1,
    stroke: ze
  }), c = {
    type: "g",
    id: "truth-table-item-group",
    role: "truth-table-item-group",
    width: s,
    height: zt * (l == null ? void 0 : l.length),
    x: Ie,
    y: Ie + zt,
    elem: []
  };
  let p = 0;
  for (const g of l) {
    let v = {
      type: "g",
      id: "truth-table-row-group-" + p,
      x: 0,
      y: zt * p,
      width: s,
      height: zt,
      elem: [{
        type: "rect",
        x: 0,
        y: 0.5,
        width: s,
        height: zt - 1,
        fill: it,
        "stroke-width": 0
      }],
      data: {
        tooltip_content: {
          State: g.original_state_vector,
          Symbols: Object.keys(g.truth_state.symbols).join(" "),
          "Symbols-truth": Object.values(g.truth_state.symbols).map((y) => y ? "T" : "F").join(" "),
          Truth: g.truth_state.truth,
          Count: g.count
        }
      }
    };
    v.elem.push({
      type: "line",
      x1: 0.5,
      x2: 0.5,
      y1: 0,
      y2: zt,
      "stroke-width": 1,
      stroke: ze
    }), v.elem.push({
      type: "text",
      id: "truth-table-row-group-" + p + "-state",
      x: r / 2,
      y: zt / 2 + 6,
      fill: ze,
      text: g.original_state_vector,
      "text-anchor": "middle",
      "alignment-baseline": "bottom"
    }), v.elem.push({
      type: "line",
      x1: r,
      x2: r,
      y1: 0,
      y2: zt,
      "stroke-width": 1,
      stroke: ze
    });
    for (let y = 0; y < a; y++)
      v.elem.push({
        type: "text",
        id: "truth-table-row-group-" + p + "-" + n[y],
        x: r + Vt * y + Vt / 2,
        y: zt / 2 + 6,
        fill: g.truth_state.symbols[n[y]] ? ze : "#999999",
        text: g.truth_state.symbols[n[y]] ? "T" : "F",
        "font-weight": g.truth_state.symbols[n[y]] ? "900" : "400",
        "text-anchor": "middle",
        "alignment-baseline": "bottom"
      }), v.elem.push({
        type: "line",
        x1: r + Vt * (y + 1),
        x2: r + Vt * (y + 1),
        y1: 0,
        y2: zt,
        "stroke-width": 1,
        stroke: ze
      });
    v.elem.push({
      type: "text",
      id: "truth-table-row-group-" + p + "-truth",
      x: r + Vt * a + kl / 2,
      y: zt / 2 + 6,
      fill: g.truth_state.truth ? ze : "#999999",
      text: g.truth_state.truth ? "T" : "F",
      "font-weight": g.truth_state.truth ? "700" : "400",
      "text-anchor": "middle",
      "alignment-baseline": "bottom"
    }), v.elem.push({
      type: "line",
      x1: r + Vt * a + kl,
      x2: r + Vt * a + kl,
      y1: 0.5,
      y2: zt - 0.5,
      "stroke-width": 1,
      stroke: ze
    }), v.elem.push({
      type: "rect",
      id: "truth-table-row-group-" + p + "-count-bar",
      x: r + Vt * a + kl + Ze,
      y: zt / 2 - e1 / 2,
      width: h(g.count),
      height: e1,
      fill: Ut[2],
      text: g.count,
      "text-anchor": "end",
      "alignment-baseline": "bottom"
    }), v.elem.push({
      type: "text",
      id: "truth-table-row-group-" + p + "-count",
      x: r + Vt * a + kl + Ze + 5,
      y: zt / 2 + 5,
      fill: ze,
      text: g.count,
      "text-anchor": "start",
      "alignment-baseline": "bottom"
    }), v.elem.push({
      type: "line",
      x1: s - 0.5,
      x2: s - 0.5,
      y1: 0.5,
      y2: zt - 0.5,
      "stroke-width": 1,
      stroke: ze
    }), v.elem.push({
      type: "line",
      x1: 0.5,
      x2: s - 0.5,
      y1: zt,
      y2: zt,
      "stroke-width": 1,
      stroke: ze
    }), c.elem.push(v), p++;
  }
  return {
    type: "svg",
    width: s + Ie * 2,
    height: o + Ie * 2,
    viewBox: [0, 0, s + Ie * 2, o + Ie * 2],
    groups: {
      header_group: u,
      item_group: c
    }
  };
}
let p8 = "abcdefghijklmnopqrstiuvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
function m8(t) {
  let e = t.split(""), l = e[0] === "1", i = e.slice(1).reverse().map((a, r) => [p8[r], a == "1"]), n = {};
  for (const a of i)
    n[a[0]] = a[1];
  return {
    truth: l,
    symbols: n
  };
}
function g8(t) {
  return t.split("").reverse().join("");
}
function b8(t, e) {
  let l = [];
  for (const i of Object.keys(t)) {
    let n = i.split(""), a = i == null ? void 0 : i.length, s = { count: t[i], state: i };
    n.forEach((o, u) => {
      s[(a - u - 1).toString()] = o;
    }), l.push(s);
  }
  return l;
}
function v8(t, e) {
  let l = [], i = {};
  if ((e == null ? void 0 : e.length) == 0)
    return {
      data: t,
      sub_total: Lr(t)
    };
  let n = e.toSorted();
  for (const r of n)
    if ((l == null ? void 0 : l.length) == 0)
      l.push("0", "1");
    else {
      let s = l.map((u) => u + "0"), o = l.map((u) => u + "1");
      l = s, s.push(...o);
    }
  for (const r of l)
    i[r] = 0;
  for (const r of t) {
    let s = n.map((o) => r[o]).join("");
    i[s] += r.count;
  }
  let a = [];
  for (const r of Object.keys(i)) {
    let s = {
      pivot: r,
      count: i[r]
    }, o = r.split("");
    r.length, o.forEach((u, c) => {
      s[n[c]] = u;
    }), a.push(s);
  }
  return {
    data: a,
    sub_total: Lr(a)
  };
}
function Lr(t) {
  if (!t)
    return [];
  if (t.constructor.name !== "Array")
    return;
  let e = Object.keys(t[0] || {}).filter((n) => !isNaN(parseInt(n))), l = {};
  for (const n of t)
    for (let a of e)
      l[a] === void 0 && (l[a] = { 0: 0, 1: 0 }), l[a][n[a]] += n.count;
  let i = [];
  for (let n of e)
    i.push({
      bit: n,
      0: l[n][0],
      1: l[n][1]
    });
  return i;
}
function Bg(t, e) {
  var c;
  let l = t.image_pixelized, i = t.mode, n = t.image_size, a = (e == null ? void 0 : e.resolution) || 1, r = n[0] * a, s = n[1] * a, o = {
    type: "g",
    x: 0,
    y: 0,
    width: r,
    height: s,
    elem: []
  };
  for (let d = 0; d < (l == null ? void 0 : l.length); d++)
    for (let h = 0; h < ((c = l[d]) == null ? void 0 : c.length); h++) {
      let p = {
        type: "rect",
        x: h * a,
        y: d * a,
        width: a,
        height: a,
        "stroke-width": 0
      }, b = l[d][h];
      i === "brightness" ? (p.fill = ze, p["fill-opacity"] = (255 - b[0]) / 255) : i === "rgb" && (p.fill = `rgb(${b.map((g) => g).join(", ")})`), o.elem.push(p);
    }
  return {
    type: "svg",
    width: r,
    height: s,
    viewBox: [0, 0, r, s],
    groups: {
      image_group: o
    }
  };
}
function k8(t, e) {
  var y;
  if (!t)
    return;
  let l = Math.pow(2, (y = Object.keys(t)[0]) == null ? void 0 : y.length) || 0, i = e == null ? void 0 : e.dir, n, a = e == null ? void 0 : e.image_width, r = e == null ? void 0 : e.image_height;
  a !== void 0 && r !== void 0 ? n = [a, r, 1] : a !== void 0 && r === void 0 ? (r = l / a, n = [a, r, 1]) : a === void 0 && r !== void 0 ? (a = l / r, n = [a, r, 1]) : n = [Math.floor(l), 1, 1];
  let s = n[0] * n[1] * n[2] || 0, o;
  !n || (n == null ? void 0 : n.length) < 2 ? o = [l, 1, 1] : o = [n[0], n[1], 1];
  let u = i;
  i || (u = "row");
  let c = e == null ? void 0 : e.magnitude, d = (e == null ? void 0 : e.n_shots) || Object.values(t).reduce((k, w) => k + w, 0), h = [];
  for (let k in t) {
    let w = parseInt(k, 2);
    if (w < l && w < s) {
      let $ = t[k];
      h[w] = Math.sqrt($ / d) * c;
    }
  }
  let p = s > 0 ? Pg(h, o, u) : [], b = [o[0], o[1]], g = {
    image: h,
    image_pixelized: p,
    data_shape: o,
    image_size: b,
    mode: "brightness",
    dir: u
  }, v = Bg(g, e);
  return v.data = g, v;
}
function y8(t, e) {
  var k;
  if (!t)
    return;
  let l = e == null ? void 0 : e.dir, i, n = Math.pow(2, (k = Object.keys(t)[0]) == null ? void 0 : k.length) || 0, a = e == null ? void 0 : e.image_width, r = e == null ? void 0 : e.image_height;
  a !== void 0 && r !== void 0 ? i = [a, r, 3] : a !== void 0 && r === void 0 ? (r = Math.floor(n / a / 3), i = [a, 3]) : a === void 0 && r !== void 0 ? (a = Matth.floor(n / r / 3), i = [a, r, 3]) : i = [Math.floor(n / 3), 1, 3];
  let s = i[0] * i[1] * i[2] || 0, o = i, u = l;
  l || (u = "row");
  let c = e == null ? void 0 : e.magnitude, d = (e == null ? void 0 : e.n_shots) || Object.values(t).reduce((w, $) => w + $, 0), h = [];
  for (let w in t) {
    let $ = parseInt(w, 2);
    if ($ < n && $ < s) {
      let q = t[w];
      h[$] = Math.sqrt(q / d) * c;
    }
  }
  let p = 0;
  for (const w of h)
    h[p] || (h[p] = 0), p++;
  let b = s > 0 ? Pg(h, o, u) : [], g = [o[0], o[1]], v = {
    image: h,
    image_pixelized: b,
    data_shape: o,
    image_size: g,
    mode: "rgb",
    dir: u
  }, y = Bg(v, e);
  return y.data = v, y;
}
function Pg(t, e, l) {
  let i = [], n = e[0], a = e[1], r = e[2], s = [], o = Math.floor(t.length / r);
  for (let u = 0; u < r; u++)
    s.push(o * u);
  for (let u = 0; u < a; u++)
    i.push(Array.from(Array(n).keys()));
  for (let u = 0; u < a; u++)
    for (let c = 0; c < n; c++)
      i[u][c] = [];
  for (let u = 0; u < a; u++)
    for (let c = 0; c < n; c++) {
      i[u][c] = [];
      let d = l === "row" ? u * n + c : c * a + u;
      for (let h = 0; h < r; h++)
        i[u][c].push(t[s[h] + d]);
    }
  return i;
}
const El = 10, w8 = ["#00796B", "#512DA8"];
function $8(t, e, l) {
  const i = JSON.parse((l == null ? void 0 : l.graph_design) ?? "null"), n = (l == null ? void 0 : l.hamiltonian) ?? null;
  if (l == null || l.final_params, i == null || n == null)
    return console.warn(), {
      warning: (i == null ? "Graph is not provided. To provide, use JobData.setAdditionals('graph_design', rx.node_link_json(#YOUR_GRAPH#))" : "") + (n == null ? "Hamiltonian not provided. " : "") + "To provide, use JobData.setAdditionals('hamiltonian', #YOUR_HAMILTONIAN#.to_list())."
    };
  const a = i.links.map((w) => ({ ...w })), r = i.nodes.map((w) => ({ ...w })), s = Math.sqrt(r.length), o = Math.round(s * 100), u = o;
  xy(r).force("charge", ew().strength(-30)).force("link", Xy(a).id((w) => w.id).strength(1).distance(20).iterations(10));
  const c = {
    type: "g",
    width: o,
    height: u,
    x: El,
    y: El,
    elem: a.map((w) => ({
      type: "line",
      x1: o / 2 + w.source.x * s,
      x2: o / 2 + w.target.x * s,
      y1: u / 2 + w.source.y * s,
      y2: u / 2 + w.target.y * s,
      stroke: "#454545",
      "stroke-width": 2,
      data: {
        source: w.source.id,
        target: w.target.id
      }
    }))
  }, d = {
    type: "g",
    id: "max-cut-edge-group",
    width: o,
    height: u,
    x: El,
    y: El,
    elem: r.map((w, $) => ({
      type: "g",
      id: `max-cut-edge-group-${$}`,
      x: o / 2 + w.x * s,
      y: u / 2 + w.y * s,
      elem: [{
        type: "circle",
        cx: 10 / 2,
        cy: 10 / 2,
        r: 10,
        stroke: "#454545",
        "stroke-width": 2,
        fill: "#ffffff"
      }, {
        type: "text",
        x: 10 / 2,
        y: 10 / 2 + 1,
        "text-anchor": "middle",
        "alignment-baseline": "middle",
        "font-size": 12,
        fill: "#ffffff",
        text: $
      }],
      data: {
        node: $
      }
    }))
  };
  let h = Object.keys(t).map((w) => [w, t[w]]).toSorted((w, $) => $[1] - w[1]), p = {
    type: "svg",
    width: o + El * 2,
    height: u + El * 2,
    viewBox: [0, 0, o + El * 2, u + El * 2],
    groups: {
      edge_group: c,
      node_group: d
    }
  }, b = A8(n).map((w) => N8(w)), g = n.map((w) => P8(w[1])), v = 1e3, y = [];
  for (const w of h) {
    let $ = w[0], q = w[1], j = parseInt($, 2), O = q8(j, b, g);
    if (O.real < v) {
      v = O.real;
      let z = t1($, i.links), N = l1($);
      y = [{ bit_key: $, integer_key: j, count: q, value: z, cost: O.real, cut: N }];
    } else if (O.real == v) {
      let z = t1($, i.links), N = l1($);
      y.push({ bit_key: $, integer_key: j, count: q, value: z, cost: O.real, cut: N });
    }
  }
  return y.map((w, $) => {
    let q = JSON.parse(JSON.stringify(p));
    return q.groups.edge_group.id = `max-cut-edge-group-${$}`, q.groups.edge_group.elem.forEach((j) => {
      j8(j.data.source, j.data.target, w.cut) !== null ? j.data.cut_edge = !1 : (j["stroke-dasharray"] = "5,5", j.stroke = "#FF9800", j.data.cut_edge = !0);
    }), q.groups.node_group.id = `max-cut-node-group-${$}`, q.groups.node_group.elem.forEach((j, O) => {
      j.id = `max-cut-node-group-${$}-${O}`;
      let z = T8(j.data.node, w.cut);
      j.data.group = z, j.elem[0].fill = w8[z];
    }), { meta: w, layout: q };
  });
}
function q8(t, e, l) {
  let i = Math.max(...e.map((c) => c.length)), n = z8(t, i), a = e.map((c) => S8(c, n)), s = M8(a).map((c) => C8(c));
  return l.map((c, d) => c.multiply(s[d])).reduce((c, d) => c.add(d), new ui(0, 0));
}
function t1(t, e) {
  let l = t.split("").map((n) => parseInt(n)), i = 0;
  for (const n of e) {
    let a = n.source, r = n.target;
    i += l[a] * (1 - l[r]) + l[r] * (1 - l[a]);
  }
  return i;
}
function l1(t) {
  let e = t.split(""), l = [[], []];
  for (let i = 0; i < e.length; i++)
    e[i] === "0" ? l[0].push(i) : l[1].push(i);
  return l;
}
function j8(t, e, l) {
  for (let i = 0; i < l.length; i++) {
    let n = l[i];
    if (n.includes(t) && n.includes(e))
      return i;
  }
  return null;
}
function T8(t, e) {
  for (let l = 0; l < e.length; l++)
    if (e[l].includes(t))
      return l;
  return null;
}
function C8(t) {
  return t.toString(2).split("").filter((e) => e == "1").length % 2 == 1 ? new ui(-1, 0) : new ui(1, 0);
}
function S8(t, e) {
  const l = [];
  for (let i = 0; i < t.length; i++)
    l.push(t[i] & e[i]);
  return l;
}
function M8(t) {
  return t.map((e) => e.reduce((l, i) => l ^ i, 0));
}
function z8(t, e, l = "big", i = !1) {
  if (!Number.isInteger(t))
    throw new TypeError("Value must be an integer.");
  if (!Number.isInteger(e) || e <= 0)
    throw new TypeError("Byte length must be a positive integer.");
  if (l !== "big" && l !== "little")
    throw new TypeError('Byte order must be "big" or "little".');
  const n = new Uint8Array(e);
  if (i) {
    const a = 2 ** (e * 8 - 1) - 1, r = -(2 ** (e * 8 - 1));
    if (t > a || t < r)
      throw new RangeError(`Value out of range for signed ${e}-byte integer.`);
    t < 0 && (t = 2 ** (e * 8) + t);
  } else {
    const a = 2 ** (e * 8) - 1;
    if (t > a || t < 0)
      throw new RangeError(`Value out of range for unsigned ${e}-byte integer.`);
  }
  for (let a = 0; a < e; a++) {
    const r = l === "big" ? e - 1 - a : a;
    n[r] = t & 255, t >>= 8;
  }
  return n;
}
function N8(t) {
  let e = [], l = 0, i = 0;
  for (let n = 0; n < t.length; n++)
    (t[n] ? 1 : 0) === 1 && (l |= 1 << i), i++, i === 8 && (e.push(l), l = 0, i = 0);
  return i > 0 && e.push(l), e;
}
function A8(t) {
  return t.map((e) => e[0].split("").map((l) => l == "Z").reverse());
}
class ui {
  constructor(e, l) {
    this.real = e, this.imag = l;
  }
  multiply(e) {
    return new ui(
      this.real * e.real - this.imag * e.imag,
      this.real * e.imag + this.imag * e.real
    );
  }
  add(e) {
    return new ui(
      this.real + e.real,
      this.imag + e.imag
    );
  }
}
const B8 = /\s*([\+\-])?([\d]+\.[\d]+)\s*([\+\-])\s*([\d]+\.[\d]+)j\s*/;
function P8(t) {
  let e = t.match(B8);
  if (e) {
    let l = e[1], i = e[2], n = e[3], a = e[4];
    return new ui(parseFloat((l || "") + i), parseFloat(n + a));
  }
  return null;
}
function i1(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z = (
    /*$drawPlan*/
    t[4].groups.y_axis_group && n1(t)
  ), N = (
    /*$drawPlan*/
    t[4].groups.y_axis_group && a1(t)
  ), M = (
    /*$drawPlan*/
    t[4].groups.y_grid_group && r1(t)
  ), H = (
    /*$drawPlan*/
    t[4].groups.bar_group && s1(t)
  ), B = (
    /*$drawPlan*/
    t[4].groups.x_axis_group && o1(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = Xe("svg"), n = Xe("style"), a = E(`g {
              font-family: Iosevka;
              font-size: 14px;
            }
          `), z && z.c(), d = A(), h = m("div"), p = Xe("svg"), b = Xe("style"), g = E(`g {
              font-family: Iosevka;
              font-size: 14px;
            }
          `), N && N.c(), v = Be(), M && M.c(), y = Be(), H && H.c(), k = Be(), B && B.c(), f(i, "id", r = /*id*/
      t[1] + "-sticky"), f(i, "width", s = /*$drawPlan*/
      t[4].groups.y_axis_group.x + /*$drawPlan*/
      t[4].groups.y_axis_group.width), f(i, "height", o = /*$drawPlan*/
      t[4].height), f(i, "viewBox", u = /*$drawPlan*/
      t[4].viewBox.map(
        /*func*/
        t[8]
      ).join(" ")), f(l, "class", "count-histogram-sticky svelte-1h6j252"), f(l, "style", c = `width: ${/*$drawPlan*/
      t[4].groups.y_axis_group.x + /*$drawPlan*/
      t[4].groups.y_axis_group.width}px; height:${/*$drawPlan*/
      t[4].height}px;`), f(
        p,
        "id",
        /*id*/
        t[1]
      ), f(p, "width", w = /*$drawPlan*/
      t[4].width), f(p, "height", $ = /*$drawPlan*/
      t[4].height), f(p, "viewBox", q = /*$drawPlan*/
      t[4].viewBox.join(" ")), f(h, "class", "count-histogram-main svelte-1h6j252"), f(e, "id", j = /*id*/
      t[1] + "-wrapper"), f(e, "class", "count-histogram-wrapper svelte-1h6j252"), Mt(e, "position", "relative"), Mt(e, "width", "100%"), Mt(e, "overflow-x", "scroll"), Mt(e, "overflow-y", "hidden");
    },
    m(R, P) {
      C(R, e, P), _(e, l), _(l, i), _(i, n), _(n, a), z && z.m(i, null), _(e, d), _(e, h), _(h, p), _(p, b), _(b, g), N && N.m(p, null), _(p, v), M && M.m(p, null), _(p, y), H && H.m(p, null), _(p, k), B && B.m(p, null), O = !0;
    },
    p(R, P) {
      /*$drawPlan*/
      R[4].groups.y_axis_group ? z ? (z.p(R, P), P & /*$drawPlan*/
      16 && S(z, 1)) : (z = n1(R), z.c(), S(z, 1), z.m(i, null)) : z && (ge(), D(z, 1, 1, () => {
        z = null;
      }), be()), (!O || P & /*id*/
      2 && r !== (r = /*id*/
      R[1] + "-sticky")) && f(i, "id", r), (!O || P & /*$drawPlan*/
      16 && s !== (s = /*$drawPlan*/
      R[4].groups.y_axis_group.x + /*$drawPlan*/
      R[4].groups.y_axis_group.width)) && f(i, "width", s), (!O || P & /*$drawPlan*/
      16 && o !== (o = /*$drawPlan*/
      R[4].height)) && f(i, "height", o), (!O || P & /*$drawPlan*/
      16 && u !== (u = /*$drawPlan*/
      R[4].viewBox.map(
        /*func*/
        R[8]
      ).join(" "))) && f(i, "viewBox", u), (!O || P & /*$drawPlan*/
      16 && c !== (c = `width: ${/*$drawPlan*/
      R[4].groups.y_axis_group.x + /*$drawPlan*/
      R[4].groups.y_axis_group.width}px; height:${/*$drawPlan*/
      R[4].height}px;`)) && f(l, "style", c), /*$drawPlan*/
      R[4].groups.y_axis_group ? N ? (N.p(R, P), P & /*$drawPlan*/
      16 && S(N, 1)) : (N = a1(R), N.c(), S(N, 1), N.m(p, v)) : N && (ge(), D(N, 1, 1, () => {
        N = null;
      }), be()), /*$drawPlan*/
      R[4].groups.y_grid_group ? M ? (M.p(R, P), P & /*$drawPlan*/
      16 && S(M, 1)) : (M = r1(R), M.c(), S(M, 1), M.m(p, y)) : M && (ge(), D(M, 1, 1, () => {
        M = null;
      }), be()), /*$drawPlan*/
      R[4].groups.bar_group ? H ? (H.p(R, P), P & /*$drawPlan*/
      16 && S(H, 1)) : (H = s1(R), H.c(), S(H, 1), H.m(p, k)) : H && (ge(), D(H, 1, 1, () => {
        H = null;
      }), be()), /*$drawPlan*/
      R[4].groups.x_axis_group ? B ? (B.p(R, P), P & /*$drawPlan*/
      16 && S(B, 1)) : (B = o1(R), B.c(), S(B, 1), B.m(p, null)) : B && (ge(), D(B, 1, 1, () => {
        B = null;
      }), be()), (!O || P & /*id*/
      2) && f(
        p,
        "id",
        /*id*/
        R[1]
      ), (!O || P & /*$drawPlan*/
      16 && w !== (w = /*$drawPlan*/
      R[4].width)) && f(p, "width", w), (!O || P & /*$drawPlan*/
      16 && $ !== ($ = /*$drawPlan*/
      R[4].height)) && f(p, "height", $), (!O || P & /*$drawPlan*/
      16 && q !== (q = /*$drawPlan*/
      R[4].viewBox.join(" "))) && f(p, "viewBox", q), (!O || P & /*id*/
      2 && j !== (j = /*id*/
      R[1] + "-wrapper")) && f(e, "id", j);
    },
    i(R) {
      O || (S(z), S(N), S(M), S(H), S(B), O = !0);
    },
    o(R) {
      D(z), D(N), D(M), D(H), D(B), O = !1;
    },
    d(R) {
      R && T(e), z && z.d(), N && N.d(), M && M.d(), H && H.d(), B && B.d();
    }
  };
}
function n1(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.y_axis_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      16 && (a.data = /*$drawPlan*/
      i[4].groups.y_axis_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function a1(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.y_axis_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      16 && (a.data = /*$drawPlan*/
      i[4].groups.y_axis_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function r1(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.y_grid_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      16 && (a.data = /*$drawPlan*/
      i[4].groups.y_grid_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function s1(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.bar_group
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      16 && (a.data = /*$drawPlan*/
      i[4].groups.bar_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function o1(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.x_axis_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      16 && (a.data = /*$drawPlan*/
      i[4].groups.x_axis_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function E8(t) {
  let e;
  return {
    c() {
      e = m("div"), e.textContent = "Hover or click an item to see details", f(e, "class", "g-tooltip deactive svelte-1h6j252");
    },
    m(l, i) {
      C(l, e, i);
    },
    p: ae,
    d(l) {
      l && T(e);
    }
  };
}
function O8(t) {
  let e;
  return {
    c() {
      e = m("div"), f(e, "class", "g-tooltip svelte-1h6j252");
    },
    m(l, i) {
      C(l, e, i), e.innerHTML = /*tootlip_content*/
      t[3];
    },
    p(l, i) {
      i & /*tootlip_content*/
      8 && (e.innerHTML = /*tootlip_content*/
      l[3]);
    },
    d(l) {
      l && T(e);
    }
  };
}
function I8(t) {
  var u;
  let e, l, i, n, a = (
    /*$drawPlan*/
    ((u = t[4]) == null ? void 0 : u.groups) && i1(t)
  );
  function r(c, d) {
    return (
      /*showTooltip*/
      c[2] ? O8 : E8
    );
  }
  let s = r(t), o = s(t);
  return {
    c() {
      e = m("div"), a && a.c(), l = A(), i = m("div"), o.c(), f(e, "class", "content-wrap"), f(i, "class", "tooltip-space svelte-1h6j252");
    },
    m(c, d) {
      C(c, e, d), a && a.m(e, null), C(c, l, d), C(c, i, d), o.m(i, null), n = !0;
    },
    p(c, [d]) {
      var h;
      /*$drawPlan*/
      (h = c[4]) != null && h.groups ? a ? (a.p(c, d), d & /*$drawPlan*/
      16 && S(a, 1)) : (a = i1(c), a.c(), S(a, 1), a.m(e, null)) : a && (ge(), D(a, 1, 1, () => {
        a = null;
      }), be()), s === (s = r(c)) && o ? o.p(c, d) : (o.d(1), o = s(c), o && (o.c(), o.m(i, null)));
    },
    i(c) {
      n || (S(a), n = !0);
    },
    o(c) {
      D(a), n = !1;
    },
    d(c) {
      c && (T(e), T(l), T(i)), a && a.d(), o.d();
    }
  };
}
function D8(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(r, (v) => l(4, i = v)), r);
  t.$$.on_destroy.push(() => n());
  let { drawPlan: r = Pe(), id: s = "natural-number-view" } = e;
  a();
  let o = !1, u, c = !1, d = 999;
  function h(v, y, k, w) {
    c && !k || d < w || (l(2, o = !0), v.clientX + 5, v.clientY + 5, l(3, u = y), c = k, d = w || 0);
  }
  function p(v) {
    o && (v.clientX + 5, v.clientY + 5);
  }
  function b(v) {
    c || l(2, o = !1), v && (l(2, o = !1), d = 999);
  }
  const g = (v, y) => y == 2 ? i.groups.y_axis_group.x + i.groups.y_axis_group.width : v;
  return t.$$set = (v) => {
    "drawPlan" in v && a(l(0, r = v.drawPlan)), "id" in v && l(1, s = v.id);
  }, [
    r,
    s,
    o,
    u,
    i,
    h,
    p,
    b,
    g
  ];
}
class R8 extends Ve {
  constructor(e) {
    super(), Qe(this, e, D8, I8, Le, { drawPlan: 0, id: 1 });
  }
}
function u1(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j = (
    /*$drawPlan*/
    t[4].groups.header_group && f1(t)
  ), O = (
    /*$drawPlan*/
    t[4].groups.header_group && _1(t)
  ), z = (
    /*$drawPlan*/
    t[4].groups.item_group && c1(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = Xe("svg"), n = Xe("style"), a = E(`g {
              font-family: Iosevka;
              font-size: 14px;
            }
          `), j && j.c(), d = A(), h = m("div"), p = Xe("svg"), b = Xe("style"), g = E(`g {
              font-family: Iosevka;
              font-size: 14px;
            }
          `), O && O.c(), v = Be(), z && z.c(), f(i, "id", r = /*id*/
      t[1] + "-sticky"), f(i, "width", s = /*$drawPlan*/
      t[4].width + Ie * 2), f(i, "height", o = /*$drawPlan*/
      t[4].groups.header_group.height + Ie), f(i, "viewBox", u = [
        0,
        0,
        /*$drawPlan*/
        t[4].width + Ie * 2,
        /*$drawPlan*/
        t[4].groups.header_group.height + Ie
      ].join(" ")), f(l, "class", "count-histogram-sticky svelte-x1kk7w"), f(l, "style", c = `width: ${/*$drawPlan*/
      t[4].width + Ie * 2}px; height:${/*$drawPlan*/
      t[4].groups.header_group.height + Ie}px;`), f(
        p,
        "id",
        /*id*/
        t[1]
      ), f(p, "width", y = /*$drawPlan*/
      t[4].width), f(p, "height", k = /*$drawPlan*/
      t[4].height), f(p, "viewBox", w = /*$drawPlan*/
      t[4].viewBox.join(" ")), f(h, "class", "count-histogram-main svelte-x1kk7w"), f(e, "id", $ = /*id*/
      t[1] + "-wrapper"), f(e, "class", "count-histogram-wrapper svelte-x1kk7w"), Mt(e, "position", "relative"), Mt(e, "width", "100%"), Mt(e, "overflow-x", "scroll"), Mt(e, "overflow-y", "hidden");
    },
    m(N, M) {
      C(N, e, M), _(e, l), _(l, i), _(i, n), _(n, a), j && j.m(i, null), _(e, d), _(e, h), _(h, p), _(p, b), _(b, g), O && O.m(p, null), _(p, v), z && z.m(p, null), q = !0;
    },
    p(N, M) {
      /*$drawPlan*/
      N[4].groups.header_group ? j ? (j.p(N, M), M & /*$drawPlan*/
      16 && S(j, 1)) : (j = f1(N), j.c(), S(j, 1), j.m(i, null)) : j && (ge(), D(j, 1, 1, () => {
        j = null;
      }), be()), (!q || M & /*id*/
      2 && r !== (r = /*id*/
      N[1] + "-sticky")) && f(i, "id", r), (!q || M & /*$drawPlan*/
      16 && s !== (s = /*$drawPlan*/
      N[4].width + Ie * 2)) && f(i, "width", s), (!q || M & /*$drawPlan*/
      16 && o !== (o = /*$drawPlan*/
      N[4].groups.header_group.height + Ie)) && f(i, "height", o), (!q || M & /*$drawPlan*/
      16 && u !== (u = [
        0,
        0,
        /*$drawPlan*/
        N[4].width + Ie * 2,
        /*$drawPlan*/
        N[4].groups.header_group.height + Ie
      ].join(" "))) && f(i, "viewBox", u), (!q || M & /*$drawPlan*/
      16 && c !== (c = `width: ${/*$drawPlan*/
      N[4].width + Ie * 2}px; height:${/*$drawPlan*/
      N[4].groups.header_group.height + Ie}px;`)) && f(l, "style", c), /*$drawPlan*/
      N[4].groups.header_group ? O ? (O.p(N, M), M & /*$drawPlan*/
      16 && S(O, 1)) : (O = _1(N), O.c(), S(O, 1), O.m(p, v)) : O && (ge(), D(O, 1, 1, () => {
        O = null;
      }), be()), /*$drawPlan*/
      N[4].groups.item_group ? z ? (z.p(N, M), M & /*$drawPlan*/
      16 && S(z, 1)) : (z = c1(N), z.c(), S(z, 1), z.m(p, null)) : z && (ge(), D(z, 1, 1, () => {
        z = null;
      }), be()), (!q || M & /*id*/
      2) && f(
        p,
        "id",
        /*id*/
        N[1]
      ), (!q || M & /*$drawPlan*/
      16 && y !== (y = /*$drawPlan*/
      N[4].width)) && f(p, "width", y), (!q || M & /*$drawPlan*/
      16 && k !== (k = /*$drawPlan*/
      N[4].height)) && f(p, "height", k), (!q || M & /*$drawPlan*/
      16 && w !== (w = /*$drawPlan*/
      N[4].viewBox.join(" "))) && f(p, "viewBox", w), (!q || M & /*id*/
      2 && $ !== ($ = /*id*/
      N[1] + "-wrapper")) && f(e, "id", $);
    },
    i(N) {
      q || (S(j), S(O), S(z), q = !0);
    },
    o(N) {
      D(j), D(O), D(z), q = !1;
    },
    d(N) {
      N && T(e), j && j.d(), O && O.d(), z && z.d();
    }
  };
}
function f1(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.header_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      16 && (a.data = /*$drawPlan*/
      i[4].groups.header_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function _1(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.header_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      16 && (a.data = /*$drawPlan*/
      i[4].groups.header_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function c1(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.item_group
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      16 && (a.data = /*$drawPlan*/
      i[4].groups.item_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function H8(t) {
  let e;
  return {
    c() {
      e = m("div"), e.textContent = "Hover or click an item to see details", f(e, "class", "g-tooltip deactive svelte-x1kk7w");
    },
    m(l, i) {
      C(l, e, i);
    },
    p: ae,
    d(l) {
      l && T(e);
    }
  };
}
function F8(t) {
  let e;
  return {
    c() {
      e = m("div"), f(e, "class", "g-tooltip svelte-x1kk7w");
    },
    m(l, i) {
      C(l, e, i), e.innerHTML = /*tootlip_content*/
      t[3];
    },
    p(l, i) {
      i & /*tootlip_content*/
      8 && (e.innerHTML = /*tootlip_content*/
      l[3]);
    },
    d(l) {
      l && T(e);
    }
  };
}
function L8(t) {
  var u;
  let e, l, i, n, a = (
    /*$drawPlan*/
    ((u = t[4]) == null ? void 0 : u.groups) && u1(t)
  );
  function r(c, d) {
    return (
      /*showTooltip*/
      c[2] ? F8 : H8
    );
  }
  let s = r(t), o = s(t);
  return {
    c() {
      e = m("div"), a && a.c(), l = A(), i = m("div"), o.c(), f(e, "class", "content-wrap svelte-x1kk7w"), f(i, "class", "tooltip-space svelte-x1kk7w");
    },
    m(c, d) {
      C(c, e, d), a && a.m(e, null), C(c, l, d), C(c, i, d), o.m(i, null), n = !0;
    },
    p(c, [d]) {
      var h;
      /*$drawPlan*/
      (h = c[4]) != null && h.groups ? a ? (a.p(c, d), d & /*$drawPlan*/
      16 && S(a, 1)) : (a = u1(c), a.c(), S(a, 1), a.m(e, null)) : a && (ge(), D(a, 1, 1, () => {
        a = null;
      }), be()), s === (s = r(c)) && o ? o.p(c, d) : (o.d(1), o = s(c), o && (o.c(), o.m(i, null)));
    },
    i(c) {
      n || (S(a), n = !0);
    },
    o(c) {
      D(a), n = !1;
    },
    d(c) {
      c && (T(e), T(l), T(i)), a && a.d(), o.d();
    }
  };
}
function Q8(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(r, (g) => l(4, i = g)), r);
  t.$$.on_destroy.push(() => n());
  let { drawPlan: r = Pe(), id: s = "natural-number-view" } = e;
  a();
  let o = !1, u, c = !1, d = 999;
  function h(g, v, y, k) {
    c && !y || d < k || (l(2, o = !0), g.clientX + 5, g.clientY + 5, l(3, u = v), c = y, d = k || 0);
  }
  function p(g) {
    o && (g.clientX + 5, g.clientY + 5);
  }
  function b(g) {
    c || l(2, o = !1), g && (l(2, o = !1), d = 999);
  }
  return t.$$set = (g) => {
    "drawPlan" in g && a(l(0, r = g.drawPlan)), "id" in g && l(1, s = g.id);
  }, [
    r,
    s,
    o,
    u,
    i,
    h,
    p,
    b
  ];
}
class V8 extends Ve {
  constructor(e) {
    super(), Qe(this, e, Q8, L8, Le, { drawPlan: 0, id: 1 });
  }
}
function d1(t, e, l) {
  const i = t.slice();
  return i[17] = e[l], i[19] = l, i;
}
function h1(t, e, l) {
  const i = t.slice();
  return i[17] = e[l], i[19] = l, i;
}
function p1(t, e, l) {
  const i = t.slice();
  return i[21] = e[l], i[23] = l, i;
}
function m1(t, e, l) {
  const i = t.slice();
  return i[21] = e[l], i[23] = l, i;
}
function g1(t, e, l) {
  const i = t.slice();
  return i[21] = e[l], i[23] = l, i;
}
function b1(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R, P, I, L, F, X = we(
    /*$clbits*/
    t[4]
  ), V = [];
  for (let W = 0; W < X.length; W += 1)
    V[W] = v1(g1(t, X, W));
  let Q = we(
    /*$clbits*/
    t[4]
  ), J = [];
  for (let W = 0; W < Q.length; W += 1)
    J[W] = k1(m1(t, Q, W));
  let te = we(
    /*$data_to_show*/
    t[3]
  ), ie = [];
  for (let W = 0; W < te.length; W += 1)
    ie[W] = w1(h1(t, te, W));
  let U = we(
    /*$sub_totals*/
    t[7]
  ), G = [];
  for (let W = 0; W < U.length; W += 1)
    G[W] = $1(d1(t, U, W));
  return {
    c() {
      e = m("div"), l = m("h5"), l.textContent = "Pivot by states", i = A(), n = m("div");
      for (let W = 0; W < V.length; W += 1)
        V[W].c();
      a = A(), r = m("div"), s = m("button"), s.textContent = "Clear all", o = A(), u = m("div"), c = m("div"), d = m("h5"), d.textContent = "Counts", h = A(), p = m("table"), b = m("thead"), g = m("tr"), v = m("th"), v.textContent = "State", y = A();
      for (let W = 0; W < J.length; W += 1)
        J[W].c();
      k = A(), w = m("th"), w.textContent = "Count", $ = A(), q = m("tbody");
      for (let W = 0; W < ie.length; W += 1)
        ie[W].c();
      O = A(), z = m("div"), N = m("h5"), N.textContent = "Subtotals", M = A(), H = m("table"), B = m("thead"), B.innerHTML = '<tr><th class="svelte-2hdyso">Bit</th> <th class="svelte-2hdyso">0</th> <th class="svelte-2hdyso">1</th> <th class="svelte-2hdyso">Total</th></tr>', R = A(), P = m("tbody");
      for (let W = 0; W < G.length; W += 1)
        G[W].c();
      f(l, "class", "svelte-2hdyso"), f(s, "class", "svelte-2hdyso"), f(n, "class", "pivot-wrap svelte-2hdyso"), f(d, "class", "svelte-2hdyso"), f(v, "class", "svelte-2hdyso"), f(w, "class", "svelte-2hdyso"), f(b, "class", "svelte-2hdyso"), f(p, "class", "svelte-2hdyso"), f(c, "id", j = /*id*/
      t[1] + "-wrapper"), f(c, "class", "pivot-table-wrapper svelte-2hdyso"), f(N, "class", "svelte-2hdyso"), f(B, "class", "svelte-2hdyso"), f(H, "class", "svelte-2hdyso"), f(z, "id", I = /*id*/
      t[1] + "-sub-total"), f(z, "class", "pivot-table-wrapper svelte-2hdyso"), f(u, "class", "tables svelte-2hdyso");
    },
    m(W, Z) {
      C(W, e, Z), _(e, l), _(e, i), _(e, n);
      for (let ee = 0; ee < V.length; ee += 1)
        V[ee] && V[ee].m(n, null);
      _(n, a), _(n, r), _(r, s), C(W, o, Z), C(W, u, Z), _(u, c), _(c, d), _(c, h), _(c, p), _(p, b), _(b, g), _(g, v), _(g, y);
      for (let ee = 0; ee < J.length; ee += 1)
        J[ee] && J[ee].m(g, null);
      _(g, k), _(g, w), _(p, $), _(p, q);
      for (let ee = 0; ee < ie.length; ee += 1)
        ie[ee] && ie[ee].m(q, null);
      _(u, O), _(u, z), _(z, N), _(z, M), _(z, H), _(H, B), _(H, R), _(H, P);
      for (let ee = 0; ee < G.length; ee += 1)
        G[ee] && G[ee].m(P, null);
      L || (F = le(
        s,
        "click",
        /*click_handler*/
        t[14]
      ), L = !0);
    },
    p(W, Z) {
      if (Z & /*$clbits, $pivot, pivot, pivot_set*/
      1584) {
        X = we(
          /*$clbits*/
          W[4]
        );
        let ee;
        for (ee = 0; ee < X.length; ee += 1) {
          const ye = g1(W, X, ee);
          V[ee] ? V[ee].p(ye, Z) : (V[ee] = v1(ye), V[ee].c(), V[ee].m(n, a));
        }
        for (; ee < V.length; ee += 1)
          V[ee].d(1);
        V.length = X.length;
      }
      if (Z & /*$clbits*/
      16) {
        Q = we(
          /*$clbits*/
          W[4]
        );
        let ee;
        for (ee = 0; ee < Q.length; ee += 1) {
          const ye = m1(W, Q, ee);
          J[ee] ? J[ee].p(ye, Z) : (J[ee] = k1(ye), J[ee].c(), J[ee].m(g, k));
        }
        for (; ee < J.length; ee += 1)
          J[ee].d(1);
        J.length = Q.length;
      }
      if (Z & /*$data_to_show, $clbits, $pivot_set*/
      88) {
        te = we(
          /*$data_to_show*/
          W[3]
        );
        let ee;
        for (ee = 0; ee < te.length; ee += 1) {
          const ye = h1(W, te, ee);
          ie[ee] ? ie[ee].p(ye, Z) : (ie[ee] = w1(ye), ie[ee].c(), ie[ee].m(q, null));
        }
        for (; ee < ie.length; ee += 1)
          ie[ee].d(1);
        ie.length = te.length;
      }
      if (Z & /*id*/
      2 && j !== (j = /*id*/
      W[1] + "-wrapper") && f(c, "id", j), Z & /*$sub_totals*/
      128) {
        U = we(
          /*$sub_totals*/
          W[7]
        );
        let ee;
        for (ee = 0; ee < U.length; ee += 1) {
          const ye = d1(W, U, ee);
          G[ee] ? G[ee].p(ye, Z) : (G[ee] = $1(ye), G[ee].c(), G[ee].m(P, null));
        }
        for (; ee < G.length; ee += 1)
          G[ee].d(1);
        G.length = U.length;
      }
      Z & /*id*/
      2 && I !== (I = /*id*/
      W[1] + "-sub-total") && f(z, "id", I);
    },
    d(W) {
      W && (T(e), T(o), T(u)), Ge(V, W), Ge(J, W), Ge(ie, W), Ge(G, W), L = !1, F();
    }
  };
}
function v1(t) {
  let e, l, i, n, a, r, s = (
    /*bit*/
    t[21] + ""
  ), o, u, c, d;
  function h(...p) {
    return (
      /*change_handler*/
      t[13](
        /*bit*/
        t[21],
        ...p
      )
    );
  }
  return {
    c() {
      e = m("div"), l = m("input"), a = A(), r = m("label"), o = E(s), f(l, "id", i = "pivot-by-" + /*bit*/
      t[21]), f(l, "type", "checkbox"), l.checked = n = /*$pivot*/
      t[5][
        /*bit*/
        t[21]
      ], f(r, "for", u = "pivot-by-" + /*bit*/
      t[21]), f(r, "class", "svelte-2hdyso"), f(e, "class", "input-wrap svelte-2hdyso");
    },
    m(p, b) {
      C(p, e, b), _(e, l), _(e, a), _(e, r), _(r, o), c || (d = le(l, "change", h), c = !0);
    },
    p(p, b) {
      t = p, b & /*$clbits*/
      16 && i !== (i = "pivot-by-" + /*bit*/
      t[21]) && f(l, "id", i), b & /*$pivot, $clbits*/
      48 && n !== (n = /*$pivot*/
      t[5][
        /*bit*/
        t[21]
      ]) && (l.checked = n), b & /*$clbits*/
      16 && s !== (s = /*bit*/
      t[21] + "") && Y(o, s), b & /*$clbits*/
      16 && u !== (u = "pivot-by-" + /*bit*/
      t[21]) && f(r, "for", u);
    },
    d(p) {
      p && T(e), c = !1, d();
    }
  };
}
function k1(t) {
  let e, l = (
    /*bit*/
    t[21] + ""
  ), i;
  return {
    c() {
      e = m("th"), i = E(l), f(e, "class", "svelte-2hdyso");
    },
    m(n, a) {
      C(n, e, a), _(e, i);
    },
    p(n, a) {
      a & /*$clbits*/
      16 && l !== (l = /*bit*/
      n[21] + "") && Y(i, l);
    },
    d(n) {
      n && T(e);
    }
  };
}
function X8(t) {
  let e = (
    /*row*/
    t[17].state + ""
  ), l;
  return {
    c() {
      l = E(e);
    },
    m(i, n) {
      C(i, l, n);
    },
    p(i, n) {
      n & /*$data_to_show*/
      8 && e !== (e = /*row*/
      i[17].state + "") && Y(l, e);
    },
    d(i) {
      i && T(l);
    }
  };
}
function G8(t) {
  let e;
  return {
    c() {
      e = E("-");
    },
    m(l, i) {
      C(l, e, i);
    },
    p: ae,
    d(l) {
      l && T(e);
    }
  };
}
function Y8(t) {
  let e;
  return {
    c() {
      e = E("-");
    },
    m(l, i) {
      C(l, e, i);
    },
    p: ae,
    d(l) {
      l && T(e);
    }
  };
}
function K8(t) {
  let e = (
    /*row*/
    t[17][
      /*bit*/
      t[21]
    ] + ""
  ), l;
  return {
    c() {
      l = E(e);
    },
    m(i, n) {
      C(i, l, n);
    },
    p(i, n) {
      n & /*$data_to_show, $clbits*/
      24 && e !== (e = /*row*/
      i[17][
        /*bit*/
        i[21]
      ] + "") && Y(l, e);
    },
    d(i) {
      i && T(l);
    }
  };
}
function U8(t) {
  let e = (
    /*row*/
    t[17][
      /*bit*/
      t[21]
    ] + ""
  ), l;
  return {
    c() {
      l = E(e);
    },
    m(i, n) {
      C(i, l, n);
    },
    p(i, n) {
      n & /*$data_to_show, $clbits*/
      24 && e !== (e = /*row*/
      i[17][
        /*bit*/
        i[21]
      ] + "") && Y(l, e);
    },
    d(i) {
      i && T(l);
    }
  };
}
function y1(t) {
  let e, l;
  function i(r, s) {
    var o, u;
    return s & /*$pivot_set, $clbits*/
    80 && (l = null), l == null && (l = !!/*$pivot_set*/
    (((o = r[6]) == null ? void 0 : o.length) > 0 && /*$pivot_set*/
    r[6].includes(
      /*bit*/
      r[21]
    ))), l ? U8 : (
      /*$pivot_set*/
      ((u = r[6]) == null ? void 0 : u.length) == 0 ? K8 : Y8
    );
  }
  let n = i(t, -1), a = n(t);
  return {
    c() {
      e = m("td"), a.c(), f(e, "class", "svelte-2hdyso");
    },
    m(r, s) {
      C(r, e, s), a.m(e, null);
    },
    p(r, s) {
      n === (n = i(r, s)) && a ? a.p(r, s) : (a.d(1), a = n(r), a && (a.c(), a.m(e, null)));
    },
    d(r) {
      r && T(e), a.d();
    }
  };
}
function w1(t) {
  let e, l, i, n, a, r = (
    /*row*/
    t[17].count + ""
  ), s, o;
  function u(b, g) {
    var v;
    return (
      /*$pivot_set*/
      ((v = b[6]) == null ? void 0 : v.length) > 0 ? G8 : X8
    );
  }
  let c = u(t), d = c(t), h = we(
    /*$clbits*/
    t[4]
  ), p = [];
  for (let b = 0; b < h.length; b += 1)
    p[b] = y1(p1(t, h, b));
  return {
    c() {
      e = m("tr"), l = m("th"), d.c(), i = A();
      for (let b = 0; b < p.length; b += 1)
        p[b].c();
      n = A(), a = m("td"), s = E(r), o = A(), f(l, "class", "svelte-2hdyso"), f(a, "class", "svelte-2hdyso");
    },
    m(b, g) {
      C(b, e, g), _(e, l), d.m(l, null), _(e, i);
      for (let v = 0; v < p.length; v += 1)
        p[v] && p[v].m(e, null);
      _(e, n), _(e, a), _(a, s), _(e, o);
    },
    p(b, g) {
      if (c === (c = u(b)) && d ? d.p(b, g) : (d.d(1), d = c(b), d && (d.c(), d.m(l, null))), g & /*$data_to_show, $clbits, $pivot_set*/
      88) {
        h = we(
          /*$clbits*/
          b[4]
        );
        let v;
        for (v = 0; v < h.length; v += 1) {
          const y = p1(b, h, v);
          p[v] ? p[v].p(y, g) : (p[v] = y1(y), p[v].c(), p[v].m(e, n));
        }
        for (; v < p.length; v += 1)
          p[v].d(1);
        p.length = h.length;
      }
      g & /*$data_to_show*/
      8 && r !== (r = /*row*/
      b[17].count + "") && Y(s, r);
    },
    d(b) {
      b && T(e), d.d(), Ge(p, b);
    }
  };
}
function $1(t) {
  let e, l, i = (
    /*row*/
    t[17].bit + ""
  ), n, a, r, s = (
    /*row*/
    t[17][0] + ""
  ), o, u, c, d = (
    /*row*/
    t[17][1] + ""
  ), h, p, b, g = (
    /*row*/
    t[17][0] + /*row*/
    t[17][1] + ""
  ), v, y;
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = A(), r = m("td"), o = E(s), u = A(), c = m("td"), h = E(d), p = A(), b = m("td"), v = E(g), y = A(), f(l, "class", "svelte-2hdyso"), f(r, "class", "svelte-2hdyso"), f(c, "class", "svelte-2hdyso"), f(b, "class", "svelte-2hdyso");
    },
    m(k, w) {
      C(k, e, w), _(e, l), _(l, n), _(e, a), _(e, r), _(r, o), _(e, u), _(e, c), _(c, h), _(e, p), _(e, b), _(b, v), _(e, y);
    },
    p(k, w) {
      w & /*$sub_totals*/
      128 && i !== (i = /*row*/
      k[17].bit + "") && Y(n, i), w & /*$sub_totals*/
      128 && s !== (s = /*row*/
      k[17][0] + "") && Y(o, s), w & /*$sub_totals*/
      128 && d !== (d = /*row*/
      k[17][1] + "") && Y(h, d), w & /*$sub_totals*/
      128 && g !== (g = /*row*/
      k[17][0] + /*row*/
      k[17][1] + "") && Y(v, g);
    },
    d(k) {
      k && T(e);
    }
  };
}
function W8(t) {
  let e, l = (
    /*$data_to_show*/
    t[3] && b1(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*$data_to_show*/
      i[3] ? l ? l.p(i, n) : (l = b1(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function J8(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(b, (z) => l(15, i = z)), b), r, s = ae, o = () => (s(), s = rt(v, (z) => l(16, r = z)), v), u, c, d, h, p;
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => s());
  let { drawPlan: b = Pe(), id: g = "pivot-table-view", problem_type: v = Pe() } = e;
  a(), o();
  let y = Pe(), k = Pe({}), w = Pe([]), $ = Pe([]), q = Pe([]);
  at(t, y, (z) => l(3, u = z)), at(t, k, (z) => l(5, d = z)), at(t, w, (z) => l(6, h = z)), at(t, $, (z) => l(4, c = z)), at(t, q, (z) => l(7, p = z)), yt(() => {
    b.subscribe((z) => {
      if (r === "pivot_table") {
        y.set(z), q.set(Lr(z));
        let N = {};
        Object.keys(z[0]).filter((M) => !isNaN(parseInt(M))).forEach((M) => {
          N[M] = !1;
        }), k.set(N), $.set(Object.keys(N));
      }
    }), w.subscribe((z) => {
      if (r === "pivot_table") {
        let { data: N, sub_total: M } = v8(i, z);
        y.set(N), q.set(M);
      }
    });
  });
  const j = (z, N) => {
    k.update((M) => (M[z] = N.target.checked, M)), w.update((M) => (N.target.checked ? M.includes(z) || M.push(z) : M.includes(z) && M.splice(M.indexOf(z), 1), M));
  }, O = (z) => {
    w.set([]), k.update((N) => (Object.keys(N).forEach((M) => {
      N[M] = !1;
    }), N));
  };
  return t.$$set = (z) => {
    "drawPlan" in z && a(l(0, b = z.drawPlan)), "id" in z && l(1, g = z.id), "problem_type" in z && o(l(2, v = z.problem_type));
  }, [
    b,
    g,
    v,
    u,
    c,
    d,
    h,
    p,
    y,
    k,
    w,
    $,
    q,
    j,
    O
  ];
}
class Z8 extends Ve {
  constructor(e) {
    super(), Qe(this, e, J8, W8, Le, { drawPlan: 0, id: 1, problem_type: 2 });
  }
}
function q1(t) {
  let e, l, i, n, a, r, s, o, u, c, d = (
    /*$drawPlan*/
    t[2].groups.image_group && j1(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = Xe("svg"), n = Xe("style"), a = E(`g {
              font-family: Iosevka;
              font-size: 14px;
            }
          `), d && d.c(), f(
        i,
        "id",
        /*id*/
        t[1]
      ), f(i, "width", r = /*$drawPlan*/
      t[2].width), f(i, "height", s = /*$drawPlan*/
      t[2].height), f(i, "viewBox", o = /*$drawPlan*/
      t[2].viewBox.join(" ")), f(l, "class", "image-view-main"), f(e, "id", u = /*id*/
      t[1] + "-wrapper"), f(e, "class", "image-view-wrapper"), Mt(e, "position", "relative"), Mt(e, "width", "100%"), Mt(e, "overflow-x", "scroll"), Mt(e, "overflow-y", "hidden");
    },
    m(h, p) {
      C(h, e, p), _(e, l), _(l, i), _(i, n), _(n, a), d && d.m(i, null), c = !0;
    },
    p(h, p) {
      /*$drawPlan*/
      h[2].groups.image_group ? d ? (d.p(h, p), p & /*$drawPlan*/
      4 && S(d, 1)) : (d = j1(h), d.c(), S(d, 1), d.m(i, null)) : d && (ge(), D(d, 1, 1, () => {
        d = null;
      }), be()), (!c || p & /*id*/
      2) && f(
        i,
        "id",
        /*id*/
        h[1]
      ), (!c || p & /*$drawPlan*/
      4 && r !== (r = /*$drawPlan*/
      h[2].width)) && f(i, "width", r), (!c || p & /*$drawPlan*/
      4 && s !== (s = /*$drawPlan*/
      h[2].height)) && f(i, "height", s), (!c || p & /*$drawPlan*/
      4 && o !== (o = /*$drawPlan*/
      h[2].viewBox.join(" "))) && f(i, "viewBox", o), (!c || p & /*id*/
      2 && u !== (u = /*id*/
      h[1] + "-wrapper")) && f(e, "id", u);
    },
    i(h) {
      c || (S(d), c = !0);
    },
    o(h) {
      D(d), c = !1;
    },
    d(h) {
      h && T(e), d && d.d();
    }
  };
}
function j1(t) {
  let e, l;
  return e = new ut({
    props: {
      data: (
        /*$drawPlan*/
        t[2].groups.image_group
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$drawPlan*/
      4 && (a.data = /*$drawPlan*/
      i[2].groups.image_group), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function x8(t) {
  var n;
  let e, l, i = (
    /*$drawPlan*/
    ((n = t[2]) == null ? void 0 : n.groups) && q1(t)
  );
  return {
    c() {
      e = m("div"), i && i.c(), f(e, "class", "content-wrap");
    },
    m(a, r) {
      C(a, e, r), i && i.m(e, null), l = !0;
    },
    p(a, [r]) {
      var s;
      /*$drawPlan*/
      (s = a[2]) != null && s.groups ? i ? (i.p(a, r), r & /*$drawPlan*/
      4 && S(i, 1)) : (i = q1(a), i.c(), S(i, 1), i.m(e, null)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(a) {
      l || (S(i), l = !0);
    },
    o(a) {
      D(i), l = !1;
    },
    d(a) {
      a && T(e), i && i.d();
    }
  };
}
function e7(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(r, (u) => l(2, i = u)), r);
  t.$$.on_destroy.push(() => n());
  let { drawPlan: r = Pe(), id: s = "image-view", problem_type: o = Pe() } = e;
  return a(), yt(() => {
    console.log(i);
  }), t.$$set = (u) => {
    "drawPlan" in u && a(l(0, r = u.drawPlan)), "id" in u && l(1, s = u.id), "problem_type" in u && l(3, o = u.problem_type);
  }, [r, s, i, o];
}
class t7 extends Ve {
  constructor(e) {
    super(), Qe(this, e, e7, x8, Le, { drawPlan: 0, id: 1, problem_type: 3 });
  }
}
function T1(t, e, l) {
  const i = t.slice();
  return i[3] = e[l], i[5] = l, i;
}
function C1(t) {
  let e, l, i = we(
    /*$drawPlan*/
    t[2]
  ), n = [];
  for (let r = 0; r < i.length; r += 1)
    n[r] = S1(T1(t, i, r));
  const a = (r) => D(n[r], 1, 1, () => {
    n[r] = null;
  });
  return {
    c() {
      e = m("div");
      for (let r = 0; r < n.length; r += 1)
        n[r].c();
      f(e, "class", "max-cut-wrap svelte-1ena1gn");
    },
    m(r, s) {
      C(r, e, s);
      for (let o = 0; o < n.length; o += 1)
        n[o] && n[o].m(e, null);
      l = !0;
    },
    p(r, s) {
      if (s & /*id, $drawPlan*/
      6) {
        i = we(
          /*$drawPlan*/
          r[2]
        );
        let o;
        for (o = 0; o < i.length; o += 1) {
          const u = T1(r, i, o);
          n[o] ? (n[o].p(u, s), S(n[o], 1)) : (n[o] = S1(u), n[o].c(), S(n[o], 1), n[o].m(e, null));
        }
        for (ge(), o = i.length; o < n.length; o += 1)
          a(o);
        be();
      }
    },
    i(r) {
      if (!l) {
        for (let s = 0; s < i.length; s += 1)
          S(n[s]);
        l = !0;
      }
    },
    o(r) {
      n = n.filter(Boolean);
      for (let s = 0; s < n.length; s += 1)
        D(n[s]);
      l = !1;
    },
    d(r) {
      r && T(e), Ge(n, r);
    }
  };
}
function S1(t) {
  let e, l, i, n, a, r, s, o = (
    /*plan*/
    t[3].meta.bit_key + ""
  ), u, c, d, h, p = (
    /*plan*/
    t[3].meta.count + ""
  ), b, g, v, y, k = (
    /*plan*/
    t[3].meta.cost + ""
  ), w, $, q, j, O = (
    /*plan*/
    t[3].meta.cut.map(M1).join(" / ") + ""
  ), z, N, M, H, B, R, P, I, L, F, X, V, Q, J;
  return P = new ut({
    props: {
      data: (
        /*plan*/
        t[3].layout.groups.edge_group
      )
    }
  }), I = new ut({
    props: {
      data: (
        /*plan*/
        t[3].layout.groups.node_group
      )
    }
  }), {
    c() {
      e = m("div"), l = m("div"), i = m("h4"), i.textContent = `Likely cut #${/*pi*/
      t[5] + 1}`, n = A(), a = m("ul"), r = m("li"), s = E("Bitstring: "), u = E(o), c = A(), d = m("li"), h = E("Count: "), b = E(p), g = A(), v = m("li"), y = E("Cost: "), w = E(k), $ = A(), q = m("li"), j = E("Cuts: "), z = E(O), N = A(), M = m("div"), H = Xe("svg"), B = Xe("style"), R = E(`g {
                font-family: Iosevka;
                font-size: 14px;
              }
            `), he(P.$$.fragment), he(I.$$.fragment), Q = A(), f(i, "class", "svelte-1ena1gn"), f(a, "class", "svelte-1ena1gn"), f(l, "class", "max-cut-meta svelte-1ena1gn"), f(H, "id", L = /*id*/
      t[1] + "-" + /*pi*/
      t[5]), f(H, "width", F = /*plan*/
      t[3].layout.width), f(H, "height", X = /*plan*/
      t[3].layout.height), f(H, "viewBox", V = /*plan*/
      t[3].layout.viewBox.join(" ")), f(M, "class", "max-cut-vis"), f(e, "class", "max-cut-item svelte-1ena1gn");
    },
    m(te, ie) {
      C(te, e, ie), _(e, l), _(l, i), _(l, n), _(l, a), _(a, r), _(r, s), _(r, u), _(a, c), _(a, d), _(d, h), _(d, b), _(a, g), _(a, v), _(v, y), _(v, w), _(a, $), _(a, q), _(q, j), _(q, z), _(e, N), _(e, M), _(M, H), _(H, B), _(B, R), ce(P, H, null), ce(I, H, null), _(e, Q), J = !0;
    },
    p(te, ie) {
      (!J || ie & /*$drawPlan*/
      4) && o !== (o = /*plan*/
      te[3].meta.bit_key + "") && Y(u, o), (!J || ie & /*$drawPlan*/
      4) && p !== (p = /*plan*/
      te[3].meta.count + "") && Y(b, p), (!J || ie & /*$drawPlan*/
      4) && k !== (k = /*plan*/
      te[3].meta.cost + "") && Y(w, k), (!J || ie & /*$drawPlan*/
      4) && O !== (O = /*plan*/
      te[3].meta.cut.map(M1).join(" / ") + "") && Y(z, O);
      const U = {};
      ie & /*$drawPlan*/
      4 && (U.data = /*plan*/
      te[3].layout.groups.edge_group), P.$set(U);
      const G = {};
      ie & /*$drawPlan*/
      4 && (G.data = /*plan*/
      te[3].layout.groups.node_group), I.$set(G), (!J || ie & /*id*/
      2 && L !== (L = /*id*/
      te[1] + "-" + /*pi*/
      te[5])) && f(H, "id", L), (!J || ie & /*$drawPlan*/
      4 && F !== (F = /*plan*/
      te[3].layout.width)) && f(H, "width", F), (!J || ie & /*$drawPlan*/
      4 && X !== (X = /*plan*/
      te[3].layout.height)) && f(H, "height", X), (!J || ie & /*$drawPlan*/
      4 && V !== (V = /*plan*/
      te[3].layout.viewBox.join(" "))) && f(H, "viewBox", V);
    },
    i(te) {
      J || (S(P.$$.fragment, te), S(I.$$.fragment, te), J = !0);
    },
    o(te) {
      D(P.$$.fragment, te), D(I.$$.fragment, te), J = !1;
    },
    d(te) {
      te && T(e), de(P), de(I);
    }
  };
}
function l7(t) {
  let e, l, i = (
    /*$drawPlan*/
    t[2] && C1(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, e, a), l = !0;
    },
    p(n, [a]) {
      /*$drawPlan*/
      n[2] ? i ? (i.p(n, a), a & /*$drawPlan*/
      4 && S(i, 1)) : (i = C1(n), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d(n);
    }
  };
}
const M1 = (t) => `(${t.join(", ")})`;
function i7(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(r, (o) => l(2, i = o)), r);
  t.$$.on_destroy.push(() => n());
  let { drawPlan: r = Pe(), id: s = "max-cut-view" } = e;
  return a(), t.$$set = (o) => {
    "drawPlan" in o && a(l(0, r = o.drawPlan)), "id" in o && l(1, s = o.id);
  }, [r, s, i];
}
class n7 extends Ve {
  constructor(e) {
    super(), Qe(this, e, i7, l7, Le, { drawPlan: 0, id: 1 });
  }
}
function z1(t, e, l) {
  const i = t.slice();
  return i[30] = e[l], i;
}
function N1(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[7] ? "Show" : "Hide"
  ), r, s, o, u, c, d, h, p, b, g = (
    /*images*/
    t[3][
      /*id*/
      t[2]
    ] && A1(t)
  ), v = !/*$hide1*/
  t[7] && B1(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`Problem-specific results view

      `), n = m("button"), r = E(a), s = A(), o = m("button"), o.textContent = "Image", u = A(), g && g.c(), c = A(), d = m("div"), v && v.c(), f(o, "class", "save-make svelte-1rd32np"), f(d, "class", "content-wrap"), f(e, "class", "panel svelte-1rd32np");
    },
    m(y, k) {
      C(y, e, k), _(e, l), _(l, i), _(l, n), _(n, r), _(l, s), _(l, o), _(l, u), g && g.m(l, null), _(e, c), _(e, d), v && v.m(d, null), h = !0, p || (b = [
        le(
          n,
          "click",
          /*click_handler*/
          t[13]
        ),
        le(
          o,
          "click",
          /*click_handler_1*/
          t[14]
        )
      ], p = !0);
    },
    p(y, k) {
      (!h || k[0] & /*$hide1*/
      128) && a !== (a = /*$hide1*/
      y[7] ? "Show" : "Hide") && Y(r, a), /*images*/
      y[3][
        /*id*/
        y[2]
      ] ? g ? g.p(y, k) : (g = A1(y), g.c(), g.m(l, null)) : g && (g.d(1), g = null), /*$hide1*/
      y[7] ? v && (ge(), D(v, 1, 1, () => {
        v = null;
      }), be()) : v ? (v.p(y, k), k[0] & /*$hide1*/
      128 && S(v, 1)) : (v = B1(y), v.c(), S(v, 1), v.m(d, null));
    },
    i(y) {
      h || (S(v), h = !0);
    },
    o(y) {
      D(v), h = !1;
    },
    d(y) {
      y && T(e), g && g.d(), v && v.d(), p = !1, vt(b);
    }
  };
}
function A1(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("a"), l = E("PNG"), n = A(), a = m("a"), r = E("SVG"), f(e, "class", "save-download svelte-1rd32np"), f(e, "href", i = /*images*/
      t[3][
        /*id*/
        t[2]
      ].png), f(e, "download", ""), f(a, "class", "save-download svelte-1rd32np"), f(a, "href", s = /*images*/
      t[3][
        /*id*/
        t[2]
      ].svg), f(a, "download", "");
    },
    m(o, u) {
      C(o, e, u), _(e, l), C(o, n, u), C(o, a, u), _(a, r);
    },
    p(o, u) {
      u[0] & /*images, id*/
      12 && i !== (i = /*images*/
      o[3][
        /*id*/
        o[2]
      ].png) && f(e, "href", i), u[0] & /*images, id*/
      12 && s !== (s = /*images*/
      o[3][
        /*id*/
        o[2]
      ].svg) && f(a, "href", s);
    },
    d(o) {
      o && (T(e), T(n), T(a));
    }
  };
}
function B1(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h = we(Jp), p = [];
  for (let k = 0; k < h.length; k += 1)
    p[k] = P1(z1(t, h, k));
  function b(k, w) {
    if (
      /*$problem_type*/
      k[5] === "truth_table"
    )
      return r7;
    if (
      /*$problem_type*/
      k[5] === "image_1d" || /*$problem_type*/
      k[5] === "image_3d"
    )
      return a7;
  }
  let g = b(t), v = g && g(t), y = (
    /*$drawPlan*/
    t[8] && O1(t)
  );
  return {
    c() {
      e = m("div"), l = m("label"), l.textContent = "Choose a problem type:", i = A(), n = m("select"), a = m("option");
      for (let k = 0; k < p.length; k += 1)
        p[k].c();
      r = A(), v && v.c(), s = A(), o = m("div"), y && y.c(), f(l, "for", "problem-type"), f(l, "class", "svelte-1rd32np"), a.__value = null, dt(a, a.__value), f(n, "id", "problem-type"), f(n, "class", "svelte-1rd32np"), f(e, "class", "input-wrap svelte-1rd32np"), f(o, "class", "vis-wrap");
    },
    m(k, w) {
      C(k, e, w), _(e, l), _(e, i), _(e, n), _(n, a);
      for (let $ = 0; $ < p.length; $ += 1)
        p[$] && p[$].m(n, null);
      C(k, r, w), v && v.m(k, w), C(k, s, w), C(k, o, w), y && y.m(o, null), u = !0, c || (d = le(
        n,
        "change",
        /*change_handler*/
        t[15]
      ), c = !0);
    },
    p(k, w) {
      if (w[0] & /*$problem_type*/
      32) {
        h = we(Jp);
        let $;
        for ($ = 0; $ < h.length; $ += 1) {
          const q = z1(k, h, $);
          p[$] ? p[$].p(q, w) : (p[$] = P1(q), p[$].c(), p[$].m(n, null));
        }
        for (; $ < p.length; $ += 1)
          p[$].d(1);
        p.length = h.length;
      }
      g === (g = b(k)) && v ? v.p(k, w) : (v && v.d(1), v = g && g(k), v && (v.c(), v.m(s.parentNode, s))), /*$drawPlan*/
      k[8] ? y ? (y.p(k, w), w[0] & /*$drawPlan*/
      256 && S(y, 1)) : (y = O1(k), y.c(), S(y, 1), y.m(o, null)) : y && (ge(), D(y, 1, 1, () => {
        y = null;
      }), be());
    },
    i(k) {
      u || (S(y), u = !0);
    },
    o(k) {
      D(y), u = !1;
    },
    d(k) {
      k && (T(e), T(r), T(s), T(o)), Ge(p, k), v && v.d(k), y && y.d(), c = !1, d();
    }
  };
}
function P1(t) {
  let e, l = (
    /*t*/
    t[30].name + ""
  ), i, n;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = /*t*/
      t[30].key, dt(e, e.__value), e.selected = n = /*t*/
      t[30].key === /*$problem_type*/
      t[5];
    },
    m(a, r) {
      C(a, e, r), _(e, i);
    },
    p(a, r) {
      r[0] & /*$problem_type*/
      32 && n !== (n = /*t*/
      a[30].key === /*$problem_type*/
      a[5]) && (e.selected = n);
    },
    d(a) {
      a && T(e);
    }
  };
}
function a7(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B = (
    /*$problem_type*/
    (t[5] === "image_3d" || /*$problem_type*/
    t[5] === "image_1d") && E1(t)
  );
  return {
    c() {
      var R, P, I, L;
      e = m("div"), l = m("div"), i = m("label"), i.textContent = "Image width (px):", n = A(), a = m("input"), s = A(), o = m("div"), u = m("label"), u.textContent = "Image height (px):", c = A(), d = m("input"), p = A(), B && B.c(), b = A(), g = m("div"), v = m("label"), v.textContent = "Magnitude:", y = A(), k = m("input"), $ = A(), q = m("div"), j = m("label"), j.textContent = "Zoom by:", O = A(), z = m("input"), f(i, "for", "image_width"), f(i, "class", "svelte-1rd32np"), f(a, "id", "image_width"), f(a, "type", "number"), a.value = r = /*$config*/
      (R = t[4]) == null ? void 0 : R.image_width, f(l, "class", "input-wrap svelte-1rd32np"), f(u, "for", "image_height"), f(u, "class", "svelte-1rd32np"), f(d, "id", "image_height"), f(d, "type", "number"), d.value = h = /*$config*/
      (P = t[4]) == null ? void 0 : P.image_height, f(o, "class", "input-wrap svelte-1rd32np"), f(v, "for", "magnitude"), f(v, "class", "svelte-1rd32np"), f(k, "id", "magnitude"), f(k, "type", "number"), k.value = w = /*$config*/
      (I = t[4]) == null ? void 0 : I.magnitude, f(g, "class", "input-wrap svelte-1rd32np"), f(j, "for", "resolution"), f(j, "class", "svelte-1rd32np"), f(z, "id", "resolution"), f(z, "type", "number"), z.value = N = /*$config*/
      (L = t[4]) == null ? void 0 : L.resolution, f(q, "class", "input-wrap svelte-1rd32np"), f(e, "class", "input-group svelte-1rd32np");
    },
    m(R, P) {
      C(R, e, P), _(e, l), _(l, i), _(l, n), _(l, a), _(e, s), _(e, o), _(o, u), _(o, c), _(o, d), _(e, p), B && B.m(e, null), _(e, b), _(e, g), _(g, v), _(g, y), _(g, k), _(e, $), _(e, q), _(q, j), _(q, O), _(q, z), M || (H = [
        le(
          a,
          "change",
          /*change_handler_2*/
          t[17]
        ),
        le(
          d,
          "change",
          /*change_handler_3*/
          t[18]
        ),
        le(
          k,
          "change",
          /*change_handler_5*/
          t[20]
        ),
        le(
          z,
          "change",
          /*change_handler_6*/
          t[21]
        )
      ], M = !0);
    },
    p(R, P) {
      var I, L, F, X;
      P[0] & /*$config*/
      16 && r !== (r = /*$config*/
      (I = R[4]) == null ? void 0 : I.image_width) && a.value !== r && (a.value = r), P[0] & /*$config*/
      16 && h !== (h = /*$config*/
      (L = R[4]) == null ? void 0 : L.image_height) && d.value !== h && (d.value = h), /*$problem_type*/
      R[5] === "image_3d" || /*$problem_type*/
      R[5] === "image_1d" ? B ? B.p(R, P) : (B = E1(R), B.c(), B.m(e, b)) : B && (B.d(1), B = null), P[0] & /*$config*/
      16 && w !== (w = /*$config*/
      (F = R[4]) == null ? void 0 : F.magnitude) && k.value !== w && (k.value = w), P[0] & /*$config*/
      16 && N !== (N = /*$config*/
      (X = R[4]) == null ? void 0 : X.resolution) && z.value !== N && (z.value = N);
    },
    d(R) {
      R && T(e), B && B.d(), M = !1, vt(H);
    }
  };
}
function r7(t) {
  let e, l, i, n, a, r, s;
  function o(d, h) {
    var p;
    return (
      /*$config*/
      (p = d[4]) != null && p.filter_true ? o7 : s7
    );
  }
  let u = o(t), c = u(t);
  return {
    c() {
      var d;
      e = m("div"), l = m("input"), n = A(), a = m("label"), c.c(), f(l, "id", "config-truth"), f(l, "type", "checkbox"), l.checked = i = /*$config*/
      (d = t[4]) == null ? void 0 : d.filter_true, f(a, "for", "config-truth"), f(a, "class", "svelte-1rd32np"), f(e, "class", "input-wrap svelte-1rd32np");
    },
    m(d, h) {
      C(d, e, h), _(e, l), _(e, n), _(e, a), c.m(a, null), r || (s = le(
        l,
        "change",
        /*change_handler_1*/
        t[16]
      ), r = !0);
    },
    p(d, h) {
      var p;
      h[0] & /*$config*/
      16 && i !== (i = /*$config*/
      (p = d[4]) == null ? void 0 : p.filter_true) && (l.checked = i), u !== (u = o(d)) && (c.d(1), c = u(d), c && (c.c(), c.m(a, null)));
    },
    d(d) {
      d && T(e), c.d(), r = !1, s();
    }
  };
}
function E1(t) {
  let e, l, i, n, a, r, s, o, u;
  return {
    c() {
      e = m("div"), l = m("label"), l.textContent = "Direction:", i = A(), n = m("select"), a = m("option"), a.textContent = "Row-first", r = m("option"), r.textContent = "Column-first", f(l, "for", "dir"), f(l, "class", "svelte-1rd32np"), a.__value = "row", dt(a, a.__value), r.__value = "col", dt(r, r.__value), f(n, "id", "dir"), f(n, "type", "number"), f(n, "class", "svelte-1rd32np"), f(e, "class", "input-wrap svelte-1rd32np");
    },
    m(c, d) {
      var h;
      C(c, e, d), _(e, l), _(e, i), _(e, n), _(n, a), _(n, r), _l(
        n,
        /*$config*/
        (h = t[4]) == null ? void 0 : h.dir
      ), o || (u = le(
        n,
        "change",
        /*change_handler_4*/
        t[19]
      ), o = !0);
    },
    p(c, d) {
      var h, p;
      d[0] & /*$config*/
      16 && s !== (s = /*$config*/
      (h = c[4]) == null ? void 0 : h.dir) && _l(
        n,
        /*$config*/
        (p = c[4]) == null ? void 0 : p.dir
      );
    },
    d(c) {
      c && T(e), o = !1, u();
    }
  };
}
function s7(t) {
  let e;
  return {
    c() {
      e = E("Show all outcomes.");
    },
    m(l, i) {
      C(l, e, i);
    },
    d(l) {
      l && T(e);
    }
  };
}
function o7(t) {
  let e;
  return {
    c() {
      e = E("Show only true outcomes.");
    },
    m(l, i) {
      C(l, e, i);
    },
    d(l) {
      l && T(e);
    }
  };
}
function O1(t) {
  let e, l, i, n;
  const a = [
    d7,
    c7,
    _7,
    f7,
    u7
  ], r = [];
  function s(o, u) {
    return (
      /*$problem_type*/
      o[5] === "natural_number" ? 0 : (
        /*$problem_type*/
        o[5] === "truth_table" ? 1 : (
          /*$problem_type*/
          o[5] === "pivot_table" ? 2 : (
            /*$problem_type*/
            o[5] === "image_1d" || /*$problem_type*/
            o[5] === "image_3d" ? 3 : (
              /*$problem_type*/
              o[5] == "max_cut" ? 4 : -1
            )
          )
        )
      )
    );
  }
  return ~(e = s(t)) && (l = r[e] = a[e](t)), {
    c() {
      l && l.c(), i = Be();
    },
    m(o, u) {
      ~e && r[e].m(o, u), C(o, i, u), n = !0;
    },
    p(o, u) {
      let c = e;
      e = s(o), e === c ? ~e && r[e].p(o, u) : (l && (ge(), D(r[c], 1, 1, () => {
        r[c] = null;
      }), be()), ~e ? (l = r[e], l ? l.p(o, u) : (l = r[e] = a[e](o), l.c()), S(l, 1), l.m(i.parentNode, i)) : l = null);
    },
    i(o) {
      n || (S(l), n = !0);
    },
    o(o) {
      D(l), n = !1;
    },
    d(o) {
      o && T(i), ~e && r[e].d(o);
    }
  };
}
function u7(t) {
  let e, l;
  return e = new n7({
    props: {
      drawPlan: (
        /*drawPlan*/
        t[10]
      ),
      id: (
        /*id*/
        t[2]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*id*/
      4 && (a.id = /*id*/
      i[2]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function f7(t) {
  let e, l;
  return e = new t7({
    props: {
      drawPlan: (
        /*drawPlan*/
        t[10]
      ),
      id: (
        /*id*/
        t[2]
      ),
      problem_type: (
        /*problem_type*/
        t[11]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*id*/
      4 && (a.id = /*id*/
      i[2]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function _7(t) {
  let e, l;
  return e = new Z8({
    props: {
      drawPlan: (
        /*drawPlan*/
        t[10]
      ),
      id: (
        /*id*/
        t[2]
      ),
      problem_type: (
        /*problem_type*/
        t[11]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*id*/
      4 && (a.id = /*id*/
      i[2]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function c7(t) {
  let e, l;
  return e = new V8({
    props: {
      drawPlan: (
        /*drawPlan*/
        t[10]
      ),
      id: (
        /*id*/
        t[2]
      ),
      problem_type: (
        /*problem_type*/
        t[11]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*id*/
      4 && (a.id = /*id*/
      i[2]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function d7(t) {
  let e, l;
  return e = new R8({
    props: {
      drawPlan: (
        /*drawPlan*/
        t[10]
      ),
      id: (
        /*id*/
        t[2]
      ),
      problem_type: (
        /*problem_type*/
        t[11]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*id*/
      4 && (a.id = /*id*/
      i[2]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function h7(t) {
  let e, l, i = (
    /*$data*/
    t[6] && N1(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, e, a), l = !0;
    },
    p(n, a) {
      /*$data*/
      n[6] ? i ? (i.p(n, a), a[0] & /*$data*/
      64 && S(i, 1)) : (i = N1(n), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d(n);
    }
  };
}
function p7(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(p, (P) => l(4, i = P)), p), r, s, o = ae, u = () => (o(), o = rt(h, (P) => l(6, s = P)), h), c, d;
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => o());
  let { data: h = Pe(), config: p = Pe({}), id: b = "problem-view" } = e;
  u(), a();
  let g = Pe(!0);
  at(t, g, (P) => l(7, c = P));
  let v = Pe();
  at(t, v, (P) => l(8, d = P));
  let y = Pe("natural_number");
  at(t, y, (P) => l(5, r = P));
  function k(P, I, L) {
    delete w[b], I === "natural_number" ? v.set(_8(P)) : I === "truth_table" ? v.set(h8(P, L)) : I === "pivot_table" ? v.set(b8(P)) : I === "image_1d" ? v.set(k8(P, L)) : I === "image_3d" ? v.set(y8(P, L)) : I === "max_cut" && v.set($8(P, L, s.additionals));
  }
  yt(() => {
    s.n_shots && p.update((P) => (P.n_shots = s.n_shots, P)), y.subscribe((P) => {
      k(s.counts, P, i);
    }), p.subscribe((P) => {
      k(s.counts, r, P);
    }), h.subscribe((P) => {
      k(P.counts, r, i);
    });
  });
  let w = {}, $ = Pe();
  $.subscribe((P) => {
    P && l(3, w[P.id] = P, w);
  });
  const q = (P) => g.set(!c), j = (P) => {
    Li(b, $);
  }, O = (P) => {
    console.log(P.target.value), P.target.value ? y.set(P.target.value) : y.set(void 0);
  }, z = (P) => {
    p.update((I) => (I.filter_true = P.target.checked, I));
  }, N = (P) => {
    p.update((I) => (I.image_width = parseInt(P.target.value), I));
  }, M = (P) => {
    p.update((I) => (I.image_height = parseInt(P.target.value), I));
  }, H = (P) => {
    p.update((I) => (I.dir = P.target.value, I));
  }, B = (P) => {
    p.update((I) => (I.magnitude = parseFloat(P.target.value), I));
  }, R = (P) => {
    p.update((I) => (I.resolution = parseFloat(P.target.value), I));
  };
  return t.$$set = (P) => {
    "data" in P && u(l(0, h = P.data)), "config" in P && a(l(1, p = P.config)), "id" in P && l(2, b = P.id);
  }, [
    h,
    p,
    b,
    w,
    i,
    r,
    s,
    c,
    d,
    g,
    v,
    y,
    $,
    q,
    j,
    O,
    z,
    N,
    M,
    H,
    B,
    R
  ];
}
class m7 extends Ve {
  constructor(e) {
    super(), Qe(this, e, p7, h7, Le, { data: 0, config: 1, id: 2 }, null, [-1, -1]);
  }
}
function I1(t, e, l) {
  const i = t.slice();
  return i[45] = e[l], i[47] = l, i;
}
function D1(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[3] ? "Show" : "Hide"
  ), r, s, o, u, c, d, h = !/*$hide1*/
  t[3] && R1(t), p = !/*$hide1*/
  t[3] && H1(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`Physical qubit properties
      `), n = m("button"), r = E(a), s = A(), h && h.c(), o = A(), u = m("div"), p && p.c(), f(n, "class", "svelte-a86gs2"), f(u, "class", "content-wrap svelte-a86gs2"), f(e, "class", "panel qubits svelte-a86gs2");
    },
    m(b, g) {
      C(b, e, g), _(e, l), _(l, i), _(l, n), _(n, r), _(e, s), h && h.m(e, null), _(e, o), _(e, u), p && p.m(u, null), c || (d = le(
        n,
        "click",
        /*click_handler*/
        t[9]
      ), c = !0);
    },
    p(b, g) {
      g[0] & /*$hide1*/
      8 && a !== (a = /*$hide1*/
      b[3] ? "Show" : "Hide") && Y(r, a), /*$hide1*/
      b[3] ? h && (h.d(1), h = null) : h ? h.p(b, g) : (h = R1(b), h.c(), h.m(e, o)), /*$hide1*/
      b[3] ? p && (p.d(1), p = null) : p ? p.p(b, g) : (p = H1(b), p.c(), p.m(u, null));
    },
    d(b) {
      b && T(e), h && h.d(), p && p.d(), c = !1, d();
    }
  };
}
function R1(t) {
  let e, l, i, n, a, r, s;
  function o(d, h) {
    var p;
    return (
      /*$config*/
      (p = d[4]) != null && p.filter_used ? b7 : g7
    );
  }
  let u = o(t), c = u(t);
  return {
    c() {
      var d;
      e = m("div"), l = m("input"), n = A(), a = m("label"), c.c(), f(l, "id", "config-truth"), f(l, "type", "checkbox"), l.checked = i = /*$config*/
      (d = t[4]) == null ? void 0 : d.filter_used, f(a, "for", "config"), f(a, "class", "svelte-a86gs2"), f(e, "class", "input-wrap svelte-a86gs2");
    },
    m(d, h) {
      C(d, e, h), _(e, l), _(e, n), _(e, a), c.m(a, null), r || (s = le(
        l,
        "change",
        /*change_handler*/
        t[10]
      ), r = !0);
    },
    p(d, h) {
      var p;
      h[0] & /*$config*/
      16 && i !== (i = /*$config*/
      (p = d[4]) == null ? void 0 : p.filter_used) && (l.checked = i), u !== (u = o(d)) && (c.d(1), c = u(d), c && (c.c(), c.m(a, null)));
    },
    d(d) {
      d && T(e), c.d(), r = !1, s();
    }
  };
}
function g7(t) {
  let e;
  return {
    c() {
      e = E("Show all qubits.");
    },
    m(l, i) {
      C(l, e, i);
    },
    d(l) {
      l && T(e);
    }
  };
}
function b7(t) {
  let e;
  return {
    c() {
      e = E("Show only the qubits used in the circuit.");
    },
    m(l, i) {
      C(l, e, i);
    },
    d(l) {
      l && T(e);
    }
  };
}
function H1(t) {
  var i;
  let e, l = (
    /*$data*/
    ((i = t[2].backend_properties) == null ? void 0 : i.qubits) && F1(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(n, a) {
      l && l.m(n, a), C(n, e, a);
    },
    p(n, a) {
      var r;
      /*$data*/
      (r = n[2].backend_properties) != null && r.qubits ? l ? l.p(n, a) : (l = F1(n), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    d(n) {
      n && T(e), l && l.d(n);
    }
  };
}
function F1(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N, M, H, B, R, P, I, L, F, X, V, Q, J, te, ie;
  function U(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].index !== "a" ? k7 : v7
    );
  }
  let G = U(t), W = G(t);
  function Z(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].T1 !== "a" ? w7 : y7
    );
  }
  let ee = Z(t), ye = ee(t);
  function qe(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].T1d !== "a" ? q7 : $7
    );
  }
  let je = qe(t), fe = je(t);
  function _e(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].T2 !== "a" ? T7 : j7
    );
  }
  let K = _e(t), ke = K(t);
  function ue(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].T2d !== "a" ? S7 : C7
    );
  }
  let ne = ue(t), oe = ne(t);
  function x(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].anharmonicity !== "a" ? z7 : M7
    );
  }
  let ve = x(t), se = ve(t);
  function Re(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].anharmonicityd !== "a" ? A7 : N7
    );
  }
  let Ce = Re(t), pe = Ce(t);
  function De(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].frequency !== "a" ? P7 : B7
    );
  }
  let re = De(t), Se = re(t);
  function Ue(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].frequencyd !== "a" ? O7 : E7
    );
  }
  let Ke = Ue(t), xe = Ke(t);
  function wt(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].prob_meas0_prep1 !== "a" ? D7 : I7
    );
  }
  let $t = wt(t), st = $t(t);
  function qt(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].prob_meas0_prep1d !== "a" ? H7 : R7
    );
  }
  let Dt = qt(t), ot = Dt(t);
  function ht(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].prob_meas1_prep0 !== "a" ? L7 : F7
    );
  }
  let Me = ht(t), me = Me(t);
  function Oe(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].prob_meas1_prep0d !== "a" ? V7 : Q7
    );
  }
  let Fe = Oe(t), Ee = Fe(t);
  function We(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].readout_error !== "a" ? G7 : X7
    );
  }
  let Ye = We(t), He = Ye(t);
  function et(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].readout_errord !== "a" ? K7 : Y7
    );
  }
  let gt = et(t), Ct = gt(t);
  function cl(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].readout_length !== "a" ? W7 : U7
    );
  }
  let Jt = cl(t), Rt = Jt(t);
  function Ht(Ne, lt) {
    return (
      /*sort_reg*/
      Ne[1].readout_lengthd !== "a" ? Z7 : J7
    );
  }
  let Et = Ht(t), pt = Et(t), Ot = we(
    /*$data*/
    t[2].backend_properties.qubits
  ), bt = [];
  for (let Ne = 0; Ne < Ot.length; Ne += 1)
    bt[Ne] = Q1(I1(t, Ot, Ne));
  return {
    c() {
      e = m("table"), l = m("thead"), i = m("tr"), n = m("th"), a = E("I "), W.c(), r = A(), s = m("th"), o = E("T1 "), ye.c(), u = Be(), fe.c(), c = A(), d = m("th"), h = E("T2 "), ke.c(), p = Be(), oe.c(), b = A(), g = m("th"), v = E("Anharmonic. "), se.c(), y = Be(), pe.c(), k = A(), w = m("th"), $ = E("Frequency "), Se.c(), q = Be(), xe.c(), j = A(), O = m("th"), z = E("Meas0Prob1 "), st.c(), N = Be(), ot.c(), M = A(), H = m("th"), B = E("Meas1Prob0 "), me.c(), R = Be(), Ee.c(), P = A(), I = m("th"), L = E("Readout Error "), He.c(), F = Be(), Ct.c(), X = A(), V = m("th"), Q = E("Readout Length "), Rt.c(), J = Be(), pt.c(), te = A(), ie = m("tbody");
      for (let Ne = 0; Ne < bt.length; Ne += 1)
        bt[Ne].c();
      f(n, "class", "svelte-a86gs2"), f(s, "class", "svelte-a86gs2"), f(d, "class", "svelte-a86gs2"), f(g, "class", "svelte-a86gs2"), f(w, "class", "svelte-a86gs2"), f(O, "class", "svelte-a86gs2"), f(H, "class", "svelte-a86gs2"), f(I, "class", "svelte-a86gs2"), f(V, "class", "svelte-a86gs2"), f(l, "class", "svelte-a86gs2"), f(e, "class", "svelte-a86gs2");
    },
    m(Ne, lt) {
      C(Ne, e, lt), _(e, l), _(l, i), _(i, n), _(n, a), W.m(n, null), _(i, r), _(i, s), _(s, o), ye.m(s, null), _(s, u), fe.m(s, null), _(i, c), _(i, d), _(d, h), ke.m(d, null), _(d, p), oe.m(d, null), _(i, b), _(i, g), _(g, v), se.m(g, null), _(g, y), pe.m(g, null), _(i, k), _(i, w), _(w, $), Se.m(w, null), _(w, q), xe.m(w, null), _(i, j), _(i, O), _(O, z), st.m(O, null), _(O, N), ot.m(O, null), _(i, M), _(i, H), _(H, B), me.m(H, null), _(H, R), Ee.m(H, null), _(i, P), _(i, I), _(I, L), He.m(I, null), _(I, F), Ct.m(I, null), _(i, X), _(i, V), _(V, Q), Rt.m(V, null), _(V, J), pt.m(V, null), _(e, te), _(e, ie);
      for (let _t = 0; _t < bt.length; _t += 1)
        bt[_t] && bt[_t].m(ie, null);
    },
    p(Ne, lt) {
      if (G === (G = U(Ne)) && W ? W.p(Ne, lt) : (W.d(1), W = G(Ne), W && (W.c(), W.m(n, null))), ee === (ee = Z(Ne)) && ye ? ye.p(Ne, lt) : (ye.d(1), ye = ee(Ne), ye && (ye.c(), ye.m(s, u))), je === (je = qe(Ne)) && fe ? fe.p(Ne, lt) : (fe.d(1), fe = je(Ne), fe && (fe.c(), fe.m(s, null))), K === (K = _e(Ne)) && ke ? ke.p(Ne, lt) : (ke.d(1), ke = K(Ne), ke && (ke.c(), ke.m(d, p))), ne === (ne = ue(Ne)) && oe ? oe.p(Ne, lt) : (oe.d(1), oe = ne(Ne), oe && (oe.c(), oe.m(d, null))), ve === (ve = x(Ne)) && se ? se.p(Ne, lt) : (se.d(1), se = ve(Ne), se && (se.c(), se.m(g, y))), Ce === (Ce = Re(Ne)) && pe ? pe.p(Ne, lt) : (pe.d(1), pe = Ce(Ne), pe && (pe.c(), pe.m(g, null))), re === (re = De(Ne)) && Se ? Se.p(Ne, lt) : (Se.d(1), Se = re(Ne), Se && (Se.c(), Se.m(w, q))), Ke === (Ke = Ue(Ne)) && xe ? xe.p(Ne, lt) : (xe.d(1), xe = Ke(Ne), xe && (xe.c(), xe.m(w, null))), $t === ($t = wt(Ne)) && st ? st.p(Ne, lt) : (st.d(1), st = $t(Ne), st && (st.c(), st.m(O, N))), Dt === (Dt = qt(Ne)) && ot ? ot.p(Ne, lt) : (ot.d(1), ot = Dt(Ne), ot && (ot.c(), ot.m(O, null))), Me === (Me = ht(Ne)) && me ? me.p(Ne, lt) : (me.d(1), me = Me(Ne), me && (me.c(), me.m(H, R))), Fe === (Fe = Oe(Ne)) && Ee ? Ee.p(Ne, lt) : (Ee.d(1), Ee = Fe(Ne), Ee && (Ee.c(), Ee.m(H, null))), Ye === (Ye = We(Ne)) && He ? He.p(Ne, lt) : (He.d(1), He = Ye(Ne), He && (He.c(), He.m(I, F))), gt === (gt = et(Ne)) && Ct ? Ct.p(Ne, lt) : (Ct.d(1), Ct = gt(Ne), Ct && (Ct.c(), Ct.m(I, null))), Jt === (Jt = cl(Ne)) && Rt ? Rt.p(Ne, lt) : (Rt.d(1), Rt = Jt(Ne), Rt && (Rt.c(), Rt.m(V, J))), Et === (Et = Ht(Ne)) && pt ? pt.p(Ne, lt) : (pt.d(1), pt = Et(Ne), pt && (pt.c(), pt.m(V, null))), lt[0] & /*$data, $config*/
      20) {
        Ot = we(
          /*$data*/
          Ne[2].backend_properties.qubits
        );
        let _t;
        for (_t = 0; _t < Ot.length; _t += 1) {
          const St = I1(Ne, Ot, _t);
          bt[_t] ? bt[_t].p(St, lt) : (bt[_t] = Q1(St), bt[_t].c(), bt[_t].m(ie, null));
        }
        for (; _t < bt.length; _t += 1)
          bt[_t].d(1);
        bt.length = Ot.length;
      }
    },
    d(Ne) {
      Ne && T(e), W.d(), ye.d(), fe.d(), ke.d(), oe.d(), se.d(), pe.d(), Se.d(), xe.d(), st.d(), ot.d(), me.d(), Ee.d(), He.d(), Ct.d(), Rt.d(), pt.d(), Ge(bt, Ne);
    }
  };
}
function v7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_2*/
        t[12]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function k7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_1*/
        t[11]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function y7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_4*/
        t[14]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function w7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_3*/
        t[13]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function $7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_6*/
        t[16]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function q7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_5*/
        t[15]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function j7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_8*/
        t[18]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function T7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_7*/
        t[17]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function C7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_10*/
        t[20]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function S7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_9*/
        t[19]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function M7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_12*/
        t[22]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function z7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_11*/
        t[21]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function N7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_14*/
        t[24]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function A7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_13*/
        t[23]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function B7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_16*/
        t[26]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function P7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_15*/
        t[25]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function E7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_18*/
        t[28]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function O7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_17*/
        t[27]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function I7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_20*/
        t[30]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function D7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_19*/
        t[29]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function R7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_22*/
        t[32]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function H7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_21*/
        t[31]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function F7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_24*/
        t[34]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function L7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_23*/
        t[33]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function Q7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_26*/
        t[36]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function V7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_25*/
        t[35]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function X7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_28*/
        t[38]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function G7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_27*/
        t[37]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function Y7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_30*/
        t[40]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function K7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_29*/
        t[39]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function U7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_32*/
        t[42]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function W7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_31*/
        t[41]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function J7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_34*/
        t[44]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function Z7(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", f(e, "class", "svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), l || (i = le(
        e,
        "click",
        /*click_handler_33*/
        t[43]
      ), l = !0);
    },
    p: ae,
    d(n) {
      n && T(e), l = !1, i();
    }
  };
}
function L1(t) {
  let e, l, i = (
    /*qubit*/
    t[45].index.value + ""
  ), n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q;
  function j(qe, je) {
    return (
      /*qubit*/
      qe[45].T1 !== void 0 ? eq : x7
    );
  }
  let O = j(t), z = O(t);
  function N(qe, je) {
    return (
      /*qubit*/
      qe[45].T2 !== void 0 ? lq : tq
    );
  }
  let M = N(t), H = M(t);
  function B(qe, je) {
    return (
      /*qubit*/
      qe[45].anharmonicity !== void 0 ? nq : iq
    );
  }
  let R = B(t), P = R(t);
  function I(qe, je) {
    return (
      /*qubit*/
      qe[45].frequency !== void 0 ? rq : aq
    );
  }
  let L = I(t), F = L(t);
  function X(qe, je) {
    return (
      /*qubit*/
      qe[45].prob_meas0_prep1 !== void 0 ? oq : sq
    );
  }
  let V = X(t), Q = V(t);
  function J(qe, je) {
    return (
      /*qubit*/
      qe[45].prob_meas1_prep0 !== void 0 ? fq : uq
    );
  }
  let te = J(t), ie = te(t);
  function U(qe, je) {
    return (
      /*qubit*/
      qe[45].readout_error !== void 0 ? cq : _q
    );
  }
  let G = U(t), W = G(t);
  function Z(qe, je) {
    return (
      /*qubit*/
      qe[45].readout_length !== void 0 ? hq : dq
    );
  }
  let ee = Z(t), ye = ee(t);
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = A(), r = m("td"), z.c(), s = A(), o = m("td"), H.c(), u = A(), c = m("td"), P.c(), d = A(), h = m("td"), F.c(), p = A(), b = m("td"), Q.c(), g = A(), v = m("td"), ie.c(), y = A(), k = m("td"), W.c(), w = A(), $ = m("td"), ye.c(), q = A(), f(l, "class", "svelte-a86gs2"), f(r, "class", "svelte-a86gs2"), f(o, "class", "svelte-a86gs2"), f(c, "class", "svelte-a86gs2"), f(h, "class", "svelte-a86gs2"), f(b, "class", "svelte-a86gs2"), f(v, "class", "svelte-a86gs2"), f(k, "class", "svelte-a86gs2"), f($, "class", "svelte-a86gs2");
    },
    m(qe, je) {
      C(qe, e, je), _(e, l), _(l, n), _(e, a), _(e, r), z.m(r, null), _(e, s), _(e, o), H.m(o, null), _(e, u), _(e, c), P.m(c, null), _(e, d), _(e, h), F.m(h, null), _(e, p), _(e, b), Q.m(b, null), _(e, g), _(e, v), ie.m(v, null), _(e, y), _(e, k), W.m(k, null), _(e, w), _(e, $), ye.m($, null), _(e, q);
    },
    p(qe, je) {
      je[0] & /*$data*/
      4 && i !== (i = /*qubit*/
      qe[45].index.value + "") && Y(n, i), O === (O = j(qe)) && z ? z.p(qe, je) : (z.d(1), z = O(qe), z && (z.c(), z.m(r, null))), M === (M = N(qe)) && H ? H.p(qe, je) : (H.d(1), H = M(qe), H && (H.c(), H.m(o, null))), R === (R = B(qe)) && P ? P.p(qe, je) : (P.d(1), P = R(qe), P && (P.c(), P.m(c, null))), L === (L = I(qe)) && F ? F.p(qe, je) : (F.d(1), F = L(qe), F && (F.c(), F.m(h, null))), V === (V = X(qe)) && Q ? Q.p(qe, je) : (Q.d(1), Q = V(qe), Q && (Q.c(), Q.m(b, null))), te === (te = J(qe)) && ie ? ie.p(qe, je) : (ie.d(1), ie = te(qe), ie && (ie.c(), ie.m(v, null))), G === (G = U(qe)) && W ? W.p(qe, je) : (W.d(1), W = G(qe), W && (W.c(), W.m(k, null))), ee === (ee = Z(qe)) && ye ? ye.p(qe, je) : (ye.d(1), ye = ee(qe), ye && (ye.c(), ye.m($, null)));
    },
    d(qe) {
      qe && T(e), z.d(), H.d(), P.d(), F.d(), Q.d(), ie.d(), W.d(), ye.d();
    }
  };
}
function x7(t) {
  let e, l, i;
  return {
    c() {
      e = E("-"), l = m("br"), i = m("span"), i.textContent = "(-)", f(i, "class", "asof svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), C(n, l, a), C(n, i, a);
    },
    p: ae,
    d(n) {
      n && (T(e), T(l), T(i));
    }
  };
}
function eq(t) {
  let e = (
    /*qubit*/
    t[45].T1.value + ""
  ), l, i, n, a, r = (
    /*qubit*/
    t[45].T1.asof + ""
  ), s, o;
  return {
    c() {
      l = E(e), i = m("br"), n = m("span"), a = E("("), s = E(r), o = E(")"), f(n, "class", "asof svelte-a86gs2");
    },
    m(u, c) {
      C(u, l, c), C(u, i, c), C(u, n, c), _(n, a), _(n, s), _(n, o);
    },
    p(u, c) {
      c[0] & /*$data*/
      4 && e !== (e = /*qubit*/
      u[45].T1.value + "") && Y(l, e), c[0] & /*$data*/
      4 && r !== (r = /*qubit*/
      u[45].T1.asof + "") && Y(s, r);
    },
    d(u) {
      u && (T(l), T(i), T(n));
    }
  };
}
function tq(t) {
  let e, l, i;
  return {
    c() {
      e = E("-"), l = m("br"), i = m("span"), i.textContent = "(-)", f(i, "class", "asof svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), C(n, l, a), C(n, i, a);
    },
    p: ae,
    d(n) {
      n && (T(e), T(l), T(i));
    }
  };
}
function lq(t) {
  let e = (
    /*qubit*/
    t[45].T2.value + ""
  ), l, i, n, a, r = (
    /*qubit*/
    t[45].T2.asof + ""
  ), s, o;
  return {
    c() {
      l = E(e), i = m("br"), n = m("span"), a = E("("), s = E(r), o = E(")"), f(n, "class", "asof svelte-a86gs2");
    },
    m(u, c) {
      C(u, l, c), C(u, i, c), C(u, n, c), _(n, a), _(n, s), _(n, o);
    },
    p(u, c) {
      c[0] & /*$data*/
      4 && e !== (e = /*qubit*/
      u[45].T2.value + "") && Y(l, e), c[0] & /*$data*/
      4 && r !== (r = /*qubit*/
      u[45].T2.asof + "") && Y(s, r);
    },
    d(u) {
      u && (T(l), T(i), T(n));
    }
  };
}
function iq(t) {
  let e, l, i;
  return {
    c() {
      e = E("-"), l = m("br"), i = m("span"), i.textContent = "(-)", f(i, "class", "asof svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), C(n, l, a), C(n, i, a);
    },
    p: ae,
    d(n) {
      n && (T(e), T(l), T(i));
    }
  };
}
function nq(t) {
  let e = (
    /*qubit*/
    t[45].anharmonicity.value + ""
  ), l, i, n, a, r = (
    /*qubit*/
    t[45].anharmonicity.asof + ""
  ), s, o;
  return {
    c() {
      l = E(e), i = m("br"), n = m("span"), a = E("("), s = E(r), o = E(")"), f(n, "class", "asof svelte-a86gs2");
    },
    m(u, c) {
      C(u, l, c), C(u, i, c), C(u, n, c), _(n, a), _(n, s), _(n, o);
    },
    p(u, c) {
      c[0] & /*$data*/
      4 && e !== (e = /*qubit*/
      u[45].anharmonicity.value + "") && Y(l, e), c[0] & /*$data*/
      4 && r !== (r = /*qubit*/
      u[45].anharmonicity.asof + "") && Y(s, r);
    },
    d(u) {
      u && (T(l), T(i), T(n));
    }
  };
}
function aq(t) {
  let e, l, i;
  return {
    c() {
      e = E("-"), l = m("br"), i = m("span"), i.textContent = "(-)", f(i, "class", "asof svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), C(n, l, a), C(n, i, a);
    },
    p: ae,
    d(n) {
      n && (T(e), T(l), T(i));
    }
  };
}
function rq(t) {
  let e = (
    /*qubit*/
    t[45].frequency.value + ""
  ), l, i, n, a, r = (
    /*qubit*/
    t[45].frequency.asof + ""
  ), s, o;
  return {
    c() {
      l = E(e), i = m("br"), n = m("span"), a = E("("), s = E(r), o = E(")"), f(n, "class", "asof svelte-a86gs2");
    },
    m(u, c) {
      C(u, l, c), C(u, i, c), C(u, n, c), _(n, a), _(n, s), _(n, o);
    },
    p(u, c) {
      c[0] & /*$data*/
      4 && e !== (e = /*qubit*/
      u[45].frequency.value + "") && Y(l, e), c[0] & /*$data*/
      4 && r !== (r = /*qubit*/
      u[45].frequency.asof + "") && Y(s, r);
    },
    d(u) {
      u && (T(l), T(i), T(n));
    }
  };
}
function sq(t) {
  let e, l, i;
  return {
    c() {
      e = E("-"), l = m("br"), i = m("span"), i.textContent = "(-)", f(i, "class", "asof svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), C(n, l, a), C(n, i, a);
    },
    p: ae,
    d(n) {
      n && (T(e), T(l), T(i));
    }
  };
}
function oq(t) {
  let e = (
    /*qubit*/
    t[45].prob_meas0_prep1.value + ""
  ), l, i, n, a, r = (
    /*qubit*/
    t[45].prob_meas0_prep1.asof + ""
  ), s, o;
  return {
    c() {
      l = E(e), i = m("br"), n = m("span"), a = E("("), s = E(r), o = E(")"), f(n, "class", "asof svelte-a86gs2");
    },
    m(u, c) {
      C(u, l, c), C(u, i, c), C(u, n, c), _(n, a), _(n, s), _(n, o);
    },
    p(u, c) {
      c[0] & /*$data*/
      4 && e !== (e = /*qubit*/
      u[45].prob_meas0_prep1.value + "") && Y(l, e), c[0] & /*$data*/
      4 && r !== (r = /*qubit*/
      u[45].prob_meas0_prep1.asof + "") && Y(s, r);
    },
    d(u) {
      u && (T(l), T(i), T(n));
    }
  };
}
function uq(t) {
  let e, l, i;
  return {
    c() {
      e = E("-"), l = m("br"), i = m("span"), i.textContent = "(-)", f(i, "class", "asof svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), C(n, l, a), C(n, i, a);
    },
    p: ae,
    d(n) {
      n && (T(e), T(l), T(i));
    }
  };
}
function fq(t) {
  let e = (
    /*qubit*/
    t[45].prob_meas1_prep0.value + ""
  ), l, i, n, a, r = (
    /*qubit*/
    t[45].prob_meas1_prep0.asof + ""
  ), s, o;
  return {
    c() {
      l = E(e), i = m("br"), n = m("span"), a = E("("), s = E(r), o = E(")"), f(n, "class", "asof svelte-a86gs2");
    },
    m(u, c) {
      C(u, l, c), C(u, i, c), C(u, n, c), _(n, a), _(n, s), _(n, o);
    },
    p(u, c) {
      c[0] & /*$data*/
      4 && e !== (e = /*qubit*/
      u[45].prob_meas1_prep0.value + "") && Y(l, e), c[0] & /*$data*/
      4 && r !== (r = /*qubit*/
      u[45].prob_meas1_prep0.asof + "") && Y(s, r);
    },
    d(u) {
      u && (T(l), T(i), T(n));
    }
  };
}
function _q(t) {
  let e, l, i;
  return {
    c() {
      e = E("-"), l = m("br"), i = m("span"), i.textContent = "(-)", f(i, "class", "asof svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), C(n, l, a), C(n, i, a);
    },
    p: ae,
    d(n) {
      n && (T(e), T(l), T(i));
    }
  };
}
function cq(t) {
  let e = (
    /*qubit*/
    t[45].readout_error.value + ""
  ), l, i, n, a, r = (
    /*qubit*/
    t[45].readout_error.asof + ""
  ), s, o;
  return {
    c() {
      l = E(e), i = m("br"), n = m("span"), a = E("("), s = E(r), o = E(")"), f(n, "class", "asof svelte-a86gs2");
    },
    m(u, c) {
      C(u, l, c), C(u, i, c), C(u, n, c), _(n, a), _(n, s), _(n, o);
    },
    p(u, c) {
      c[0] & /*$data*/
      4 && e !== (e = /*qubit*/
      u[45].readout_error.value + "") && Y(l, e), c[0] & /*$data*/
      4 && r !== (r = /*qubit*/
      u[45].readout_error.asof + "") && Y(s, r);
    },
    d(u) {
      u && (T(l), T(i), T(n));
    }
  };
}
function dq(t) {
  let e, l, i;
  return {
    c() {
      e = E("-"), l = m("br"), i = m("span"), i.textContent = "(-)", f(i, "class", "asof svelte-a86gs2");
    },
    m(n, a) {
      C(n, e, a), C(n, l, a), C(n, i, a);
    },
    p: ae,
    d(n) {
      n && (T(e), T(l), T(i));
    }
  };
}
function hq(t) {
  let e = (
    /*qubit*/
    t[45].readout_length.value + ""
  ), l, i, n, a, r = (
    /*qubit*/
    t[45].readout_length.asof + ""
  ), s, o;
  return {
    c() {
      l = E(e), i = m("br"), n = m("span"), a = E("("), s = E(r), o = E(")"), f(n, "class", "asof svelte-a86gs2");
    },
    m(u, c) {
      C(u, l, c), C(u, i, c), C(u, n, c), _(n, a), _(n, s), _(n, o);
    },
    p(u, c) {
      c[0] & /*$data*/
      4 && e !== (e = /*qubit*/
      u[45].readout_length.value + "") && Y(l, e), c[0] & /*$data*/
      4 && r !== (r = /*qubit*/
      u[45].readout_length.asof + "") && Y(s, r);
    },
    d(u) {
      u && (T(l), T(i), T(n));
    }
  };
}
function Q1(t) {
  let e = !/*$config*/
  t[4].filter_used || /*$config*/
  t[4].filter_used && /*$data*/
  t[2].physical_qubits.includes(
    /*qubit*/
    t[45].index.value
  ), l, i = e && L1(t);
  return {
    c() {
      i && i.c(), l = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, l, a);
    },
    p(n, a) {
      a[0] & /*$config, $data*/
      20 && (e = !/*$config*/
      n[4].filter_used || /*$config*/
      n[4].filter_used && /*$data*/
      n[2].physical_qubits.includes(
        /*qubit*/
        n[45].index.value
      )), e ? i ? i.p(n, a) : (i = L1(n), i.c(), i.m(l.parentNode, l)) : i && (i.d(1), i = null);
    },
    d(n) {
      n && T(l), i && i.d(n);
    }
  };
}
function pq(t) {
  let e, l = (
    /*$data*/
    t[2] && D1(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, n) {
      /*$data*/
      i[2] ? l ? l.p(i, n) : (l = D1(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function mq(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(o, (K) => l(2, i = K)), o), r, s;
  t.$$.on_destroy.push(() => n());
  let { data: o = Pe() } = e;
  a();
  let u = {}, c = Pe({ filter_used: !0 });
  at(t, c, (K) => l(4, s = K));
  let d = Pe(!0);
  at(t, d, (K) => l(3, r = K));
  function h(K, ke, ue) {
    return ue == "a" ? (K = K.toSorted((ne, oe) => {
      var x, ve;
      return ((x = ne[ke]) == null ? void 0 : x.value) - ((ve = oe[ke]) == null ? void 0 : ve.value);
    }), l(1, u[ke] = "a", u)) : (K = K.toSorted((ne, oe) => {
      var x, ve;
      return ((x = oe[ke]) == null ? void 0 : x.value) - ((ve = ne[ke]) == null ? void 0 : ve.value);
    }), l(1, u[ke] = "d", u)), K;
  }
  function p(K, ke, ue) {
    return ue == "a" ? (K = K.toSorted((ne, oe) => {
      var x, ve;
      return new Date((x = ne[ke]) == null ? void 0 : x.asof) - new Date((ve = oe[ke]) == null ? void 0 : ve.asof);
    }), l(1, u[ke + "d"] = "a", u)) : (K = K.toSorted((ne, oe) => {
      var x, ve;
      return new Date((x = oe[ke]) == null ? void 0 : x.asof) - new Date((ve = ne[ke]) == null ? void 0 : ve.asof);
    }), l(1, u[ke + "d"] = "d", u)), K;
  }
  const b = (K) => d.set(!r), g = (K) => {
    c.update((ke) => (ke.filter_used = K.target.checked, ke));
  }, v = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "index", "a"), K));
  }, y = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "index", "d"), K));
  }, k = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "T1", "a"), K));
  }, w = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "T1", "d"), K));
  }, $ = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "T1", "a"), K));
  }, q = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "T1", "d"), K));
  }, j = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "T2", "a"), K));
  }, O = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "T2", "d"), K));
  }, z = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "T2", "a"), K));
  }, N = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "T2", "d"), K));
  }, M = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "anharmonicity", "a"), K));
  }, H = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "anharmonicity", "d"), K));
  }, B = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "anharmonicity", "a"), K));
  }, R = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "anharmonicity", "d"), K));
  }, P = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "frequency", "a"), K));
  }, I = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "frequency", "d"), K));
  }, L = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "frequency", "a"), K));
  }, F = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "frequency", "d"), K));
  }, X = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "prob_meas0_prep1", "a"), K));
  }, V = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "prob_meas0_prep1", "d"), K));
  }, Q = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "prob_meas0_prep1", "a"), K));
  }, J = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "prob_meas0_prep1", "d"), K));
  }, te = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "prob_meas1_prep0", "a"), K));
  }, ie = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "prob_meas1_prep0", "d"), K));
  }, U = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "prob_meas1_prep0", "a"), K));
  }, G = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "prob_meas1_prep0", "d"), K));
  }, W = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "readout_error", "a"), K));
  }, Z = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "readout_error", "d"), K));
  }, ee = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "readout_error", "a"), K));
  }, ye = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "readout_error", "d"), K));
  }, qe = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "readout_length", "a"), K));
  }, je = () => {
    o.update((K) => (K.backend_properties.qubits = h(K.backend_properties.qubits, "readout_length", "d"), K));
  }, fe = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "readout_length", "a"), K));
  }, _e = () => {
    o.update((K) => (K.backend_properties.qubits = p(K.backend_properties.qubits, "readout_length", "d"), K));
  };
  return t.$$set = (K) => {
    "data" in K && a(l(0, o = K.data));
  }, [
    o,
    u,
    i,
    r,
    s,
    c,
    d,
    h,
    p,
    b,
    g,
    v,
    y,
    k,
    w,
    $,
    q,
    j,
    O,
    z,
    N,
    M,
    H,
    B,
    R,
    P,
    I,
    L,
    F,
    X,
    V,
    Q,
    J,
    te,
    ie,
    U,
    G,
    W,
    Z,
    ee,
    ye,
    qe,
    je,
    fe,
    _e
  ];
}
class gq extends Ve {
  constructor(e) {
    super(), Qe(this, e, mq, pq, Le, { data: 0 }, null, [-1, -1]);
  }
}
function Qr(t) {
  return t.gate + "--" + t.qubits.map((e) => e.index).join("-");
}
function V1(t, e, l) {
  const i = t.slice();
  return i[15] = e[l], i[17] = l, i;
}
function X1(t, e, l) {
  const i = t.slice();
  return i[18] = e[l], i;
}
function G1(t, e, l) {
  const i = t.slice();
  return i[18] = e[l], i;
}
function Y1(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[4] ? "Show" : "Hide"
  ), r, s, o, u, c, d = !/*$hide1*/
  t[4] && K1(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`Physical qubit properties
      `), n = m("button"), r = E(a), s = A(), o = m("div"), d && d.c(), f(n, "class", "svelte-hp4j9k"), f(o, "class", "content-wrap svelte-hp4j9k"), f(e, "class", "panel qubits svelte-hp4j9k");
    },
    m(h, p) {
      C(h, e, p), _(e, l), _(l, i), _(l, n), _(n, r), _(e, s), _(e, o), d && d.m(o, null), u || (c = le(
        n,
        "click",
        /*click_handler*/
        t[9]
      ), u = !0);
    },
    p(h, p) {
      p & /*$hide1*/
      16 && a !== (a = /*$hide1*/
      h[4] ? "Show" : "Hide") && Y(r, a), /*$hide1*/
      h[4] ? d && (d.d(1), d = null) : d ? d.p(h, p) : (d = K1(h), d.c(), d.m(o, null));
    },
    d(h) {
      h && T(e), d && d.d(), u = !1, c();
    }
  };
}
function K1(t) {
  var P;
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N = we(
    /*gates*/
    t[1]
  ), M = [];
  for (let I = 0; I < N.length; I += 1)
    M[I] = U1(G1(t, N, I));
  let H = we(
    /*qubits*/
    t[2]
  ), B = [];
  for (let I = 0; I < H.length; I += 1)
    B[I] = W1(X1(t, H, I));
  let R = (
    /*$data*/
    ((P = t[3].backend_properties) == null ? void 0 : P.gates) && J1(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = m("label"), i.textContent = "Used qubits", n = A(), a = m("input"), s = A(), o = m("div"), u = m("label"), u.textContent = "Gates", c = A(), d = m("button"), d.textContent = "×", h = A(), p = m("select");
      for (let I = 0; I < M.length; I += 1)
        M[I].c();
      b = A(), g = m("div"), v = m("label"), v.textContent = "Qubits", y = A(), k = m("button"), k.textContent = "×", w = A(), $ = m("select");
      for (let I = 0; I < B.length; I += 1)
        B[I].c();
      q = A(), j = m("div"), R && R.c(), f(i, "for", "used"), f(i, "class", "svelte-hp4j9k"), f(a, "type", "checkbox"), a.checked = r = /*$filter*/
      t[5].only_used, f(l, "class", "svelte-hp4j9k"), f(u, "for", "gates"), f(u, "class", "svelte-hp4j9k"), f(d, "class", "svelte-hp4j9k"), f(p, "class", "filter svelte-hp4j9k"), f(p, "name", "gates"), f(p, "id", "gates"), p.multiple = !0, f(o, "class", "svelte-hp4j9k"), f(v, "for", "qubits"), f(v, "class", "svelte-hp4j9k"), f(k, "class", "svelte-hp4j9k"), f($, "class", "filter svelte-hp4j9k"), f($, "name", "qubits"), f($, "id", "qubits"), $.multiple = !0, f(g, "class", "svelte-hp4j9k"), f(e, "class", "filter-wrap svelte-hp4j9k"), f(j, "class", "value");
    },
    m(I, L) {
      C(I, e, L), _(e, l), _(l, i), _(l, n), _(l, a), _(e, s), _(e, o), _(o, u), _(o, c), _(o, d), _(o, h), _(o, p);
      for (let F = 0; F < M.length; F += 1)
        M[F] && M[F].m(p, null);
      _(e, b), _(e, g), _(g, v), _(g, y), _(g, k), _(g, w), _(g, $);
      for (let F = 0; F < B.length; F += 1)
        B[F] && B[F].m($, null);
      C(I, q, L), C(I, j, L), R && R.m(j, null), O || (z = [
        le(
          a,
          "change",
          /*change_handler*/
          t[10]
        ),
        le(
          d,
          "click",
          /*click_handler_1*/
          t[11]
        ),
        le(
          p,
          "change",
          /*change_handler_1*/
          t[12]
        ),
        le(
          k,
          "click",
          /*click_handler_2*/
          t[13]
        ),
        le(
          $,
          "change",
          /*change_handler_2*/
          t[14]
        )
      ], O = !0);
    },
    p(I, L) {
      var F;
      if (L & /*$filter*/
      32 && r !== (r = /*$filter*/
      I[5].only_used) && (a.checked = r), L & /*gates, $filter*/
      34) {
        N = we(
          /*gates*/
          I[1]
        );
        let X;
        for (X = 0; X < N.length; X += 1) {
          const V = G1(I, N, X);
          M[X] ? M[X].p(V, L) : (M[X] = U1(V), M[X].c(), M[X].m(p, null));
        }
        for (; X < M.length; X += 1)
          M[X].d(1);
        M.length = N.length;
      }
      if (L & /*qubits, $filter*/
      36) {
        H = we(
          /*qubits*/
          I[2]
        );
        let X;
        for (X = 0; X < H.length; X += 1) {
          const V = X1(I, H, X);
          B[X] ? B[X].p(V, L) : (B[X] = W1(V), B[X].c(), B[X].m($, null));
        }
        for (; X < B.length; X += 1)
          B[X].d(1);
        B.length = H.length;
      }
      /*$data*/
      (F = I[3].backend_properties) != null && F.gates ? R ? R.p(I, L) : (R = J1(I), R.c(), R.m(j, null)) : R && (R.d(1), R = null);
    },
    d(I) {
      I && (T(e), T(q), T(j)), Ge(M, I), Ge(B, I), R && R.d(), O = !1, vt(z);
    }
  };
}
function U1(t) {
  let e, l = (
    /*g*/
    t[18] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*g*/
      t[18], dt(e, e.__value), e.selected = a = /*$filter*/
      t[5].gates.includes(
        /*g*/
        t[18]
      );
    },
    m(r, s) {
      C(r, e, s), _(e, i);
    },
    p(r, s) {
      s & /*gates*/
      2 && l !== (l = /*g*/
      r[18] + "") && Y(i, l), s & /*gates*/
      2 && n !== (n = /*g*/
      r[18]) && (e.__value = n, dt(e, e.__value)), s & /*$filter, gates*/
      34 && a !== (a = /*$filter*/
      r[5].gates.includes(
        /*g*/
        r[18]
      )) && (e.selected = a);
    },
    d(r) {
      r && T(e);
    }
  };
}
function W1(t) {
  let e, l = (
    /*g*/
    t[18] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*g*/
      t[18], dt(e, e.__value), e.selected = a = /*$filter*/
      t[5].qubits.includes(
        /*g*/
        t[18]
      );
    },
    m(r, s) {
      C(r, e, s), _(e, i);
    },
    p(r, s) {
      s & /*qubits*/
      4 && l !== (l = /*g*/
      r[18] + "") && Y(i, l), s & /*qubits*/
      4 && n !== (n = /*g*/
      r[18]) && (e.__value = n, dt(e, e.__value)), s & /*$filter, qubits*/
      36 && a !== (a = /*$filter*/
      r[5].qubits.includes(
        /*g*/
        r[18]
      )) && (e.selected = a);
    },
    d(r) {
      r && T(e);
    }
  };
}
function J1(t) {
  let e, l, i, n, a = we(
    /*$data*/
    t[3].backend_properties.gates
  ), r = [];
  for (let s = 0; s < a.length; s += 1)
    r[s] = x1(V1(t, a, s));
  return {
    c() {
      e = m("table"), l = m("thead"), l.innerHTML = '<tr><th class="svelte-hp4j9k">Gate</th> <th class="svelte-hp4j9k">Qubits</th> <th class="svelte-hp4j9k">Error</th> <th class="svelte-hp4j9k">Length</th></tr>', i = A(), n = m("tbody");
      for (let s = 0; s < r.length; s += 1)
        r[s].c();
      f(l, "class", "svelte-hp4j9k"), f(e, "class", "svelte-hp4j9k");
    },
    m(s, o) {
      C(s, e, o), _(e, l), _(e, i), _(e, n);
      for (let u = 0; u < r.length; u += 1)
        r[u] && r[u].m(n, null);
    },
    p(s, o) {
      if (o & /*$data, $filter, filter*/
      104) {
        a = we(
          /*$data*/
          s[3].backend_properties.gates
        );
        let u;
        for (u = 0; u < a.length; u += 1) {
          const c = V1(s, a, u);
          r[u] ? r[u].p(c, o) : (r[u] = x1(c), r[u].c(), r[u].m(n, null));
        }
        for (; u < r.length; u += 1)
          r[u].d(1);
        r.length = a.length;
      }
    },
    d(s) {
      s && T(e), Ge(r, s);
    }
  };
}
function Z1(t) {
  var L, F, X, V;
  let e, l, i = (
    /*gate*/
    t[15].gate + ""
  ), n, a, r, s = (
    /*gate*/
    t[15].qubits.join(",") + ""
  ), o, u, c, d = (
    /*gate*/
    ((L = t[15].parameters.gate_error) == null ? void 0 : L.value) + ""
  ), h, p, b, g, v = (
    /*gate*/
    ((F = t[15].parameters.gate_error) == null ? void 0 : F.asof) + ""
  ), y, k, w, $ = (
    /*gate*/
    ((X = t[15].parameters.gate_length) == null ? void 0 : X.value) + ""
  ), q, j, O = (
    /*gate*/
    t[15].parameters.gate_length.unit + ""
  ), z, N, M, H, B, R = (
    /*gate*/
    ((V = t[15].parameters.gate_length) == null ? void 0 : V.asof) + ""
  ), P, I;
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = A(), r = m("td"), o = E(s), u = A(), c = m("td"), h = E(d), p = m("br"), b = A(), g = m("span"), y = E(v), k = A(), w = m("td"), q = E($), j = E(" ("), z = E(O), N = E(")"), M = m("br"), H = A(), B = m("span"), P = E(R), I = A(), f(l, "class", "svelte-hp4j9k"), f(r, "class", "svelte-hp4j9k"), f(g, "class", "asof svelte-hp4j9k"), f(c, "class", "svelte-hp4j9k"), f(B, "class", "asof svelte-hp4j9k"), f(w, "class", "svelte-hp4j9k");
    },
    m(Q, J) {
      C(Q, e, J), _(e, l), _(l, n), _(e, a), _(e, r), _(r, o), _(e, u), _(e, c), _(c, h), _(c, p), _(c, b), _(c, g), _(g, y), _(e, k), _(e, w), _(w, q), _(w, j), _(w, z), _(w, N), _(w, M), _(w, H), _(w, B), _(B, P), _(e, I);
    },
    p(Q, J) {
      var te, ie, U, G;
      J & /*$data*/
      8 && i !== (i = /*gate*/
      Q[15].gate + "") && Y(n, i), J & /*$data*/
      8 && s !== (s = /*gate*/
      Q[15].qubits.join(",") + "") && Y(o, s), J & /*$data*/
      8 && d !== (d = /*gate*/
      ((te = Q[15].parameters.gate_error) == null ? void 0 : te.value) + "") && Y(h, d), J & /*$data*/
      8 && v !== (v = /*gate*/
      ((ie = Q[15].parameters.gate_error) == null ? void 0 : ie.asof) + "") && Y(y, v), J & /*$data*/
      8 && $ !== ($ = /*gate*/
      ((U = Q[15].parameters.gate_length) == null ? void 0 : U.value) + "") && Y(q, $), J & /*$data*/
      8 && O !== (O = /*gate*/
      Q[15].parameters.gate_length.unit + "") && Y(z, O), J & /*$data*/
      8 && R !== (R = /*gate*/
      ((G = Q[15].parameters.gate_length) == null ? void 0 : G.asof) + "") && Y(P, R);
    },
    d(Q) {
      Q && T(e);
    }
  };
}
function x1(t) {
  var n, a;
  let e = (!/*$filter*/
  t[5].gates || /*$filter*/
  ((n = t[5].gates) == null ? void 0 : n.length) == 0 || /*$filter*/
  t[5].gates && /*$filter*/
  t[5].gates.includes(
    /*gate*/
    t[15].gate
  )) && (!/*$filter*/
  t[5].qubits || /*$filter*/
  ((a = t[5].qubits) == null ? void 0 : a.length) == 0 || /*$filter*/
  t[5].qubits && /*gate*/
  t[15].qubits.some(
    /*func*/
    t[8]
  )) && (!/*$filter*/
  t[5].only_used || /*$filter*/
  t[5].only_used && /*$data*/
  t[3].physical_gates.includes(Qr(
    /*gate*/
    t[15]
  ))), l, i = e && Z1(t);
  return {
    c() {
      i && i.c(), l = Be();
    },
    m(r, s) {
      i && i.m(r, s), C(r, l, s);
    },
    p(r, s) {
      var o, u;
      s & /*$filter, $data*/
      40 && (e = (!/*$filter*/
      r[5].gates || /*$filter*/
      ((o = r[5].gates) == null ? void 0 : o.length) == 0 || /*$filter*/
      r[5].gates && /*$filter*/
      r[5].gates.includes(
        /*gate*/
        r[15].gate
      )) && (!/*$filter*/
      r[5].qubits || /*$filter*/
      ((u = r[5].qubits) == null ? void 0 : u.length) == 0 || /*$filter*/
      r[5].qubits && /*gate*/
      r[15].qubits.some(
        /*func*/
        r[8]
      )) && (!/*$filter*/
      r[5].only_used || /*$filter*/
      r[5].only_used && /*$data*/
      r[3].physical_gates.includes(Qr(
        /*gate*/
        r[15]
      )))), e ? i ? i.p(r, s) : (i = Z1(r), i.c(), i.m(l.parentNode, l)) : i && (i.d(1), i = null);
    },
    d(r) {
      r && T(l), i && i.d(r);
    }
  };
}
function bq(t) {
  let e, l = (
    /*$data*/
    t[3] && Y1(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*$data*/
      i[3] ? l ? l.p(i, n) : (l = Y1(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
function vq(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(o, ($) => l(3, i = $)), o), r, s;
  t.$$.on_destroy.push(() => n());
  let { data: o = Pe() } = e;
  a();
  let u = Pe({ gates: [], qubits: [], only_used: !1 }), c = [], d = [];
  at(t, u, ($) => l(5, s = $));
  let h = Pe(!0);
  at(t, h, ($) => l(4, r = $)), yt(() => {
    var $;
    ($ = i == null ? void 0 : i.backend_properties) != null && $.gates && (l(1, c = Array.from(new Set(i.backend_properties.gates.map((q) => q.gate)))), l(2, d = Array.from(new Set(i.backend_properties.gates.map((q) => q.qubits).flat()))));
  });
  const p = ($) => u.qubits.includes($), b = ($) => h.set(!r), g = ($) => {
    u.update((q) => (q.only_used = $.target.checked, q));
  }, v = ($) => {
    u.update((q) => (q.gates = [], q));
  }, y = ($) => {
    u.update((q) => (q.gates = Array.from($.target.selectedOptions).map((j) => j.value), q));
  }, k = ($) => {
    u.update((q) => (q.qubits = [], q));
  }, w = ($) => {
    u.update((q) => (q.qubits = Array.from($.target.selectedOptions).map((j) => parseInt(j.value)), q));
  };
  return t.$$set = ($) => {
    "data" in $ && a(l(0, o = $.data));
  }, [
    o,
    c,
    d,
    i,
    r,
    s,
    u,
    h,
    p,
    b,
    g,
    v,
    y,
    k,
    w
  ];
}
class kq extends Ve {
  constructor(e) {
    super(), Qe(this, e, vq, bq, Le, { data: 0 });
  }
}
function em(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[2] ? "Show" : "Hide"
  ), r, s, o, u, c, d = !/*$hide1*/
  t[2] && tm(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`Faulty gates and qubits
      `), n = m("button"), r = E(a), s = A(), o = m("div"), d && d.c(), f(n, "class", "svelte-14lfkj4"), f(o, "class", "content-wrap svelte-14lfkj4"), f(e, "class", "panel qubits svelte-14lfkj4");
    },
    m(h, p) {
      C(h, e, p), _(e, l), _(l, i), _(l, n), _(n, r), _(e, s), _(e, o), d && d.m(o, null), u || (c = le(
        n,
        "click",
        /*click_handler*/
        t[4]
      ), u = !0);
    },
    p(h, p) {
      p & /*$hide1*/
      4 && a !== (a = /*$hide1*/
      h[2] ? "Show" : "Hide") && Y(r, a), /*$hide1*/
      h[2] ? d && (d.d(1), d = null) : d ? d.p(h, p) : (d = tm(h), d.c(), d.m(o, null));
    },
    d(h) {
      h && T(e), d && d.d(), u = !1, c();
    }
  };
}
function tm(t) {
  var a, r;
  let e, l, i = (
    /*$data*/
    ((a = t[1].backend_properties) == null ? void 0 : a.faulty_gates) && lm(t)
  ), n = (
    /*$data*/
    ((r = t[1].backend_properties) == null ? void 0 : r.faulty_qubits) && im(t)
  );
  return {
    c() {
      i && i.c(), e = A(), n && n.c(), l = Be();
    },
    m(s, o) {
      i && i.m(s, o), C(s, e, o), n && n.m(s, o), C(s, l, o);
    },
    p(s, o) {
      var u, c;
      /*$data*/
      (u = s[1].backend_properties) != null && u.faulty_gates ? i ? i.p(s, o) : (i = lm(s), i.c(), i.m(e.parentNode, e)) : i && (i.d(1), i = null), /*$data*/
      (c = s[1].backend_properties) != null && c.faulty_qubits ? n ? n.p(s, o) : (n = im(s), n.c(), n.m(l.parentNode, l)) : n && (n.d(1), n = null);
    },
    d(s) {
      s && (T(e), T(l)), i && i.d(s), n && n.d(s);
    }
  };
}
function lm(t) {
  let e, l, i;
  function n(s, o) {
    var u;
    return (
      /*$data*/
      ((u = s[1].backend_properties.faulty_gates) == null ? void 0 : u.length) == 0 ? wq : yq
    );
  }
  let a = n(t), r = a(t);
  return {
    c() {
      e = m("h5"), e.textContent = "Faulty gates", l = A(), i = m("div"), r.c(), f(e, "class", "svelte-14lfkj4"), f(i, "class", "list svelte-14lfkj4");
    },
    m(s, o) {
      C(s, e, o), C(s, l, o), C(s, i, o), r.m(i, null);
    },
    p(s, o) {
      a === (a = n(s)) && r ? r.p(s, o) : (r.d(1), r = a(s), r && (r.c(), r.m(i, null)));
    },
    d(s) {
      s && (T(e), T(l), T(i)), r.d();
    }
  };
}
function yq(t) {
  let e = (
    /*$data*/
    t[1].backend_properties.faulty_gates.map(nm).join(", ") + ""
  ), l;
  return {
    c() {
      l = E(e);
    },
    m(i, n) {
      C(i, l, n);
    },
    p(i, n) {
      n & /*$data*/
      2 && e !== (e = /*$data*/
      i[1].backend_properties.faulty_gates.map(nm).join(", ") + "") && Y(l, e);
    },
    d(i) {
      i && T(l);
    }
  };
}
function wq(t) {
  let e;
  return {
    c() {
      e = E("None");
    },
    m(l, i) {
      C(l, e, i);
    },
    p: ae,
    d(l) {
      l && T(e);
    }
  };
}
function im(t) {
  let e, l, i;
  function n(s, o) {
    var u;
    return (
      /*$data*/
      ((u = s[1].backend_properties.faulty_qubits) == null ? void 0 : u.length) == 0 ? qq : $q
    );
  }
  let a = n(t), r = a(t);
  return {
    c() {
      e = m("h5"), e.textContent = "Faulty qubits", l = A(), i = m("div"), r.c(), f(e, "class", "svelte-14lfkj4"), f(i, "class", "list svelte-14lfkj4");
    },
    m(s, o) {
      C(s, e, o), C(s, l, o), C(s, i, o), r.m(i, null);
    },
    p(s, o) {
      a === (a = n(s)) && r ? r.p(s, o) : (r.d(1), r = a(s), r && (r.c(), r.m(i, null)));
    },
    d(s) {
      s && (T(e), T(l), T(i)), r.d();
    }
  };
}
function $q(t) {
  let e = (
    /*$data*/
    t[1].backend_properties.faulty_qubits.join(", ") + ""
  ), l;
  return {
    c() {
      l = E(e);
    },
    m(i, n) {
      C(i, l, n);
    },
    p(i, n) {
      n & /*$data*/
      2 && e !== (e = /*$data*/
      i[1].backend_properties.faulty_qubits.join(", ") + "") && Y(l, e);
    },
    d(i) {
      i && T(l);
    }
  };
}
function qq(t) {
  let e;
  return {
    c() {
      e = E("None");
    },
    m(l, i) {
      C(l, e, i);
    },
    p: ae,
    d(l) {
      l && T(e);
    }
  };
}
function jq(t) {
  let e, l = (
    /*$data*/
    t[1] && em(t)
  );
  return {
    c() {
      l && l.c(), e = Be();
    },
    m(i, n) {
      l && l.m(i, n), C(i, e, n);
    },
    p(i, [n]) {
      /*$data*/
      i[1] ? l ? l.p(i, n) : (l = em(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ae,
    o: ae,
    d(i) {
      i && T(e), l && l.d(i);
    }
  };
}
const nm = (t) => t.gate + " (" + t.qubits.join(", ") + ")";
function Tq(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(s, (c) => l(1, i = c)), s), r;
  t.$$.on_destroy.push(() => n());
  let { data: s = Pe() } = e;
  a();
  let o = Pe(!0);
  at(t, o, (c) => l(2, r = c)), yt(() => {
  });
  const u = (c) => o.set(!r);
  return t.$$set = (c) => {
    "data" in c && a(l(0, s = c.data));
  }, [s, i, r, o, u];
}
class Cq extends Ve {
  constructor(e) {
    super(), Qe(this, e, Tq, jq, Le, { data: 0 });
  }
}
function am(t, e, l) {
  const i = t.slice();
  return i[44] = e[l], i;
}
function rm(t, e, l) {
  const i = t.slice();
  return i[47] = e[l], i[49] = l, i;
}
function sm(t, e, l) {
  const i = t.slice();
  return i[50] = e[l], i;
}
function om(t, e, l) {
  const i = t.slice();
  return i[50] = e[l], i;
}
function um(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[17] ? "Show" : "Hide"
  ), r, s, o, u, c, d, h = !/*$hide1*/
  t[17] && fm(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`Machine view
      `), n = m("button"), r = E(a), s = A(), o = m("div"), h && h.c(), f(o, "class", "content-wrap svelte-19xd6a8"), Mt(o, "padding-bottom", "3.5rem"), Mt(o, "overflow-y", "hidden"), f(e, "class", "panel svelte-19xd6a8");
    },
    m(p, b) {
      C(p, e, b), _(e, l), _(l, i), _(l, n), _(n, r), _(e, s), _(e, o), h && h.m(o, null), u = !0, c || (d = le(
        n,
        "click",
        /*click_handler*/
        t[26]
      ), c = !0);
    },
    p(p, b) {
      (!u || b[0] & /*$hide1*/
      131072) && a !== (a = /*$hide1*/
      p[17] ? "Show" : "Hide") && Y(r, a), /*$hide1*/
      p[17] ? h && (ge(), D(h, 1, 1, () => {
        h = null;
      }), be()) : h ? (h.p(p, b), b[0] & /*$hide1*/
      131072 && S(h, 1)) : (h = fm(p), h.c(), S(h, 1), h.m(o, null));
    },
    i(p) {
      u || (S(h), u = !0);
    },
    o(p) {
      D(h), u = !1;
    },
    d(p) {
      p && T(e), h && h.d(), c = !1, d();
    }
  };
}
function fm(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z, N = we(
    /*qubit_info_list*/
    t[8]
  ), M = [];
  for (let F = 0; F < N.length; F += 1)
    M[F] = _m(om(t, N, F));
  let H = (
    /*qubit_stats*/
    t[12] && /*colorScale*/
    t[3] && cm(t)
  ), B = we(
    /*edge_info_list*/
    t[9]
  ), R = [];
  for (let F = 0; F < B.length; F += 1)
    R[F] = dm(sm(t, B, F));
  let P = (
    /*edge_stats*/
    t[13] && /*edgeColorScale*/
    t[4] && hm(t)
  ), I = (
    /*qubit_edges*/
    t[1] && /*node_map*/
    t[5] && pm(t)
  ), L = (
    /*showTooltip*/
    t[14] && bm(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = m("label"), i.textContent = "For Qubits:", n = A(), a = m("select");
      for (let F = 0; F < M.length; F += 1)
        M[F].c();
      r = A(), s = m("div"), H && H.c(), o = A(), u = m("div"), c = m("label"), c.textContent = "For Edges:", d = A(), h = m("select");
      for (let F = 0; F < R.length; F += 1)
        R[F].c();
      p = A(), b = m("div"), P && P.c(), g = A(), v = m("div"), y = A(), k = m("div"), I && I.c(), $ = A(), L && L.c(), q = Be(), f(i, "for", "qubit_rep"), f(i, "class", "svelte-19xd6a8"), f(a, "name", "qubit_rep"), f(a, "id", "qubit_rep"), f(a, "class", "svelte-19xd6a8"), f(s, "class", "stats svelte-19xd6a8"), f(c, "for", "edge_rep"), f(c, "class", "svelte-19xd6a8"), f(h, "name", "edge_rep"), f(h, "id", "edge_rep"), f(h, "class", "svelte-19xd6a8"), f(b, "class", "stats svelte-19xd6a8"), f(e, "class", "controls svelte-19xd6a8"), f(v, "class", "circuit-background-map svelte-19xd6a8"), f(v, "style", "width: 100%; height:100%; padding-bottom: 3rem;"), f(k, "class", "circuit svelte-19xd6a8"), f(k, "style", w = `width: ${/*width*/
      t[6]}px; height: ${/*height*/
      t[7]}px; padding: ${Zi}px; padding-bottom: 3rem;`);
    },
    m(F, X) {
      C(F, e, X), _(e, l), _(l, i), _(l, n), _(l, a);
      for (let V = 0; V < M.length; V += 1)
        M[V] && M[V].m(a, null);
      _(l, r), _(l, s), H && H.m(s, null), _(e, o), _(e, u), _(u, c), _(u, d), _(u, h);
      for (let V = 0; V < R.length; V += 1)
        R[V] && R[V].m(h, null);
      _(u, p), _(u, b), P && P.m(b, null), C(F, g, X), C(F, v, X), C(F, y, X), C(F, k, X), I && I.m(k, null), C(F, $, X), L && L.m(F, X), C(F, q, X), j = !0, O || (z = [
        le(
          a,
          "change",
          /*change_handler*/
          t[27]
        ),
        le(
          h,
          "change",
          /*change_handler_1*/
          t[28]
        ),
        le(
          v,
          "click",
          /*click_handler_1*/
          t[29]
        )
      ], O = !0);
    },
    p(F, X) {
      if (X[0] & /*qubit_info_list*/
      256) {
        N = we(
          /*qubit_info_list*/
          F[8]
        );
        let V;
        for (V = 0; V < N.length; V += 1) {
          const Q = om(F, N, V);
          M[V] ? M[V].p(Q, X) : (M[V] = _m(Q), M[V].c(), M[V].m(a, null));
        }
        for (; V < M.length; V += 1)
          M[V].d(1);
        M.length = N.length;
      }
      if (/*qubit_stats*/
      F[12] && /*colorScale*/
      F[3] ? H ? (H.p(F, X), X[0] & /*qubit_stats, colorScale*/
      4104 && S(H, 1)) : (H = cm(F), H.c(), S(H, 1), H.m(s, null)) : H && (ge(), D(H, 1, 1, () => {
        H = null;
      }), be()), X[0] & /*edge_info_list*/
      512) {
        B = we(
          /*edge_info_list*/
          F[9]
        );
        let V;
        for (V = 0; V < B.length; V += 1) {
          const Q = sm(F, B, V);
          R[V] ? R[V].p(Q, X) : (R[V] = dm(Q), R[V].c(), R[V].m(h, null));
        }
        for (; V < R.length; V += 1)
          R[V].d(1);
        R.length = B.length;
      }
      /*edge_stats*/
      F[13] && /*edgeColorScale*/
      F[4] ? P ? (P.p(F, X), X[0] & /*edge_stats, edgeColorScale*/
      8208 && S(P, 1)) : (P = hm(F), P.c(), S(P, 1), P.m(b, null)) : P && (ge(), D(P, 1, 1, () => {
        P = null;
      }), be()), /*qubit_edges*/
      F[1] && /*node_map*/
      F[5] ? I ? (I.p(F, X), X[0] & /*qubit_edges, node_map*/
      34 && S(I, 1)) : (I = pm(F), I.c(), S(I, 1), I.m(k, null)) : I && (ge(), D(I, 1, 1, () => {
        I = null;
      }), be()), (!j || X[0] & /*width, height*/
      192 && w !== (w = `width: ${/*width*/
      F[6]}px; height: ${/*height*/
      F[7]}px; padding: ${Zi}px; padding-bottom: 3rem;`)) && f(k, "style", w), /*showTooltip*/
      F[14] ? L ? L.p(F, X) : (L = bm(F), L.c(), L.m(q.parentNode, q)) : L && (L.d(1), L = null);
    },
    i(F) {
      j || (S(H), S(P), S(I), j = !0);
    },
    o(F) {
      D(H), D(P), D(I), j = !1;
    },
    d(F) {
      F && (T(e), T(g), T(v), T(y), T(k), T($), T(q)), Ge(M, F), H && H.d(), Ge(R, F), P && P.d(), I && I.d(), L && L.d(F), O = !1, vt(z);
    }
  };
}
function _m(t) {
  let e, l = (
    /*item*/
    (t[50].feature || /*item*/
    t[50].gate) + ""
  ), i, n, a = (
    /*item*/
    t[50].gate ? "- " + /*item*/
    t[50].type : ""
  ), r, s;
  return {
    c() {
      e = m("option"), i = E(l), n = A(), r = E(a), e.__value = s = JSON.stringify(
        /*item*/
        t[50]
      ), dt(e, e.__value);
    },
    m(o, u) {
      C(o, e, u), _(e, i), _(e, n), _(e, r);
    },
    p(o, u) {
      u[0] & /*qubit_info_list*/
      256 && l !== (l = /*item*/
      (o[50].feature || /*item*/
      o[50].gate) + "") && Y(i, l), u[0] & /*qubit_info_list*/
      256 && a !== (a = /*item*/
      o[50].gate ? "- " + /*item*/
      o[50].type : "") && Y(r, a), u[0] & /*qubit_info_list*/
      256 && s !== (s = JSON.stringify(
        /*item*/
        o[50]
      )) && (e.__value = s, dt(e, e.__value));
    },
    d(o) {
      o && T(e);
    }
  };
}
function cm(t) {
  let e, l;
  return e = new lr({
    props: {
      data: (
        /*qubit_stats*/
        t[12]
      ),
      colorScale: (
        /*colorScale*/
        t[3]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*qubit_stats*/
      4096 && (a.data = /*qubit_stats*/
      i[12]), n[0] & /*colorScale*/
      8 && (a.colorScale = /*colorScale*/
      i[3]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function dm(t) {
  let e, l = (
    /*item*/
    (t[50].gate || /*item*/
    t[50].feature) + ""
  ), i, n, a = (
    /*item*/
    t[50].gate ? "- " + /*item*/
    t[50].type : ""
  ), r, s;
  return {
    c() {
      e = m("option"), i = E(l), n = A(), r = E(a), e.__value = s = JSON.stringify(
        /*item*/
        t[50]
      ), dt(e, e.__value);
    },
    m(o, u) {
      C(o, e, u), _(e, i), _(e, n), _(e, r);
    },
    p(o, u) {
      u[0] & /*edge_info_list*/
      512 && l !== (l = /*item*/
      (o[50].gate || /*item*/
      o[50].feature) + "") && Y(i, l), u[0] & /*edge_info_list*/
      512 && a !== (a = /*item*/
      o[50].gate ? "- " + /*item*/
      o[50].type : "") && Y(r, a), u[0] & /*edge_info_list*/
      512 && s !== (s = JSON.stringify(
        /*item*/
        o[50]
      )) && (e.__value = s, dt(e, e.__value));
    },
    d(o) {
      o && T(e);
    }
  };
}
function hm(t) {
  let e, l;
  return e = new lr({
    props: {
      data: (
        /*edge_stats*/
        t[13]
      ),
      colorScale: (
        /*edgeColorScale*/
        t[4]
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*edge_stats*/
      8192 && (a.data = /*edge_stats*/
      i[13]), n[0] & /*edgeColorScale*/
      16 && (a.colorScale = /*edgeColorScale*/
      i[4]), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function pm(t) {
  let e, l, i, n = we(
    /*qubit_edges*/
    t[1]
  ), a = [];
  for (let c = 0; c < n.length; c += 1)
    a[c] = mm(rm(t, n, c));
  const r = (c) => D(a[c], 1, 1, () => {
    a[c] = null;
  });
  let s = we(
    /*qubit_index*/
    t[2]
  ), o = [];
  for (let c = 0; c < s.length; c += 1)
    o[c] = gm(am(t, s, c));
  const u = (c) => D(o[c], 1, 1, () => {
    o[c] = null;
  });
  return {
    c() {
      for (let c = 0; c < a.length; c += 1)
        a[c].c();
      e = A();
      for (let c = 0; c < o.length; c += 1)
        o[c].c();
      l = Be();
    },
    m(c, d) {
      for (let h = 0; h < a.length; h += 1)
        a[h] && a[h].m(c, d);
      C(c, e, d);
      for (let h = 0; h < o.length; h += 1)
        o[h] && o[h].m(c, d);
      C(c, l, d), i = !0;
    },
    p(c, d) {
      if (d[0] & /*qubit_edges, node_map, edge_info_values, $edge_info_selected, edgeColorScale, openTooltip, hideTooltip, moveTooltip, $data*/
      59050034) {
        n = we(
          /*qubit_edges*/
          c[1]
        );
        let h;
        for (h = 0; h < n.length; h += 1) {
          const p = rm(c, n, h);
          a[h] ? (a[h].p(p, d), S(a[h], 1)) : (a[h] = mm(p), a[h].c(), S(a[h], 1), a[h].m(e.parentNode, e));
        }
        for (ge(), h = n.length; h < a.length; h += 1)
          r(h);
        be();
      }
      if (d[0] & /*qubit_index, node_map, $qubit_info_selected, qubit_info_values, colorScale, openTooltip, hideTooltip, moveTooltip, $data*/
      59311148) {
        s = we(
          /*qubit_index*/
          c[2]
        );
        let h;
        for (h = 0; h < s.length; h += 1) {
          const p = am(c, s, h);
          o[h] ? (o[h].p(p, d), S(o[h], 1)) : (o[h] = gm(p), o[h].c(), S(o[h], 1), o[h].m(l.parentNode, l));
        }
        for (ge(), h = s.length; h < o.length; h += 1)
          u(h);
        be();
      }
    },
    i(c) {
      if (!i) {
        for (let d = 0; d < n.length; d += 1)
          S(a[d]);
        for (let d = 0; d < s.length; d += 1)
          S(o[d]);
        i = !0;
      }
    },
    o(c) {
      a = a.filter(Boolean);
      for (let d = 0; d < a.length; d += 1)
        D(a[d]);
      o = o.filter(Boolean);
      for (let d = 0; d < o.length; d += 1)
        D(o[d]);
      i = !1;
    },
    d(c) {
      c && (T(e), T(l)), Ge(a, c), Ge(o, c);
    }
  };
}
function mm(t) {
  var i, n;
  let e, l;
  return e = new Mg({
    props: {
      edge: (
        /*edge*/
        t[47]
      ),
      edge_nodes: (
        /*edge*/
        (i = t[47]) == null ? void 0 : i.toSorted(km).map(
          /*func_1*/
          t[30]
        )
      ),
      qubit_gap: Ya,
      edge_width: Eg,
      padding: Zi,
      edge_info_value: (
        /*edge_info_values*/
        (n = t[11][
          /*edge*/
          t[47].join("-")
        ] || /*edge_info_values*/
        t[11][
          /*edge*/
          t[47][1] + "-" + /*edge*/
          t[47][0]
        ]) == null ? void 0 : n.parameters["gate_" + /*$edge_info_selected*/
        t[18].type]
      ),
      colorScale: (
        /*edgeColorScale*/
        t[4]
      ),
      edge_info_selected: (
        /*$edge_info_selected*/
        t[18]
      ),
      info_type: (
        /*$edge_info_selected*/
        t[18].type
      ),
      openTooltip: (
        /*openTooltip*/
        t[23]
      ),
      hideTooltip: (
        /*hideTooltip*/
        t[25]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[24]
      ),
      is_used: (
        /*edge*/
        t[47].every(
          /*func_2*/
          t[31]
        )
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(a, r) {
      ce(e, a, r), l = !0;
    },
    p(a, r) {
      var o, u;
      const s = {};
      r[0] & /*qubit_edges*/
      2 && (s.edge = /*edge*/
      a[47]), r[0] & /*qubit_edges, node_map*/
      34 && (s.edge_nodes = /*edge*/
      (o = a[47]) == null ? void 0 : o.toSorted(km).map(
        /*func_1*/
        a[30]
      )), r[0] & /*edge_info_values, qubit_edges, $edge_info_selected*/
      264194 && (s.edge_info_value = /*edge_info_values*/
      (u = a[11][
        /*edge*/
        a[47].join("-")
      ] || /*edge_info_values*/
      a[11][
        /*edge*/
        a[47][1] + "-" + /*edge*/
        a[47][0]
      ]) == null ? void 0 : u.parameters["gate_" + /*$edge_info_selected*/
      a[18].type]), r[0] & /*edgeColorScale*/
      16 && (s.colorScale = /*edgeColorScale*/
      a[4]), r[0] & /*$edge_info_selected*/
      262144 && (s.edge_info_selected = /*$edge_info_selected*/
      a[18]), r[0] & /*$edge_info_selected*/
      262144 && (s.info_type = /*$edge_info_selected*/
      a[18].type), r[0] & /*qubit_edges, $data*/
      65538 && (s.is_used = /*edge*/
      a[47].every(
        /*func_2*/
        a[31]
      )), e.$set(s);
    },
    i(a) {
      l || (S(e.$$.fragment, a), l = !0);
    },
    o(a) {
      D(e.$$.fragment, a), l = !1;
    },
    d(a) {
      de(e, a);
    }
  };
}
function gm(t) {
  let e, l;
  return e = new zg({
    props: {
      qubit: (
        /*qi*/
        t[44]
      ),
      qubit_node: (
        /*node_map*/
        t[5][
          /*qi*/
          t[44]
        ]
      ),
      qubit_gap: Ya,
      edge_width: Eg,
      padding: Zi,
      qubit_info_value: (
        /*$qubit_info_selected*/
        t[19].feature ? (
          /*qubit_info_values*/
          t[10][
            /*qi*/
            t[44]
          ]
        ) : (
          /*qubit_info_values*/
          t[10][
            /*qi*/
            t[44]
          ].parameters["gate_" + /*$qubit_info_selected*/
          t[19].type]
        )
      ),
      info_type: (
        /*$qubit_info_selected*/
        t[19].type
      ),
      colorScale: (
        /*colorScale*/
        t[3]
      ),
      qubit_info_selected: (
        /*$qubit_info_selected*/
        t[19]
      ),
      openTooltip: (
        /*openTooltip*/
        t[23]
      ),
      hideTooltip: (
        /*hideTooltip*/
        t[25]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[24]
      ),
      is_used: (
        /*$data*/
        t[16].physical_qubits.includes(
          /*qi*/
          t[44]
        )
      )
    }
  }), {
    c() {
      he(e.$$.fragment);
    },
    m(i, n) {
      ce(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*qubit_index*/
      4 && (a.qubit = /*qi*/
      i[44]), n[0] & /*node_map, qubit_index*/
      36 && (a.qubit_node = /*node_map*/
      i[5][
        /*qi*/
        i[44]
      ]), n[0] & /*$qubit_info_selected, qubit_info_values, qubit_index*/
      525316 && (a.qubit_info_value = /*$qubit_info_selected*/
      i[19].feature ? (
        /*qubit_info_values*/
        i[10][
          /*qi*/
          i[44]
        ]
      ) : (
        /*qubit_info_values*/
        i[10][
          /*qi*/
          i[44]
        ].parameters["gate_" + /*$qubit_info_selected*/
        i[19].type]
      )), n[0] & /*$qubit_info_selected*/
      524288 && (a.info_type = /*$qubit_info_selected*/
      i[19].type), n[0] & /*colorScale*/
      8 && (a.colorScale = /*colorScale*/
      i[3]), n[0] & /*$qubit_info_selected*/
      524288 && (a.qubit_info_selected = /*$qubit_info_selected*/
      i[19]), n[0] & /*$data, qubit_index*/
      65540 && (a.is_used = /*$data*/
      i[16].physical_qubits.includes(
        /*qi*/
        i[44]
      )), e.$set(a);
    },
    i(i) {
      l || (S(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      de(e, i);
    }
  };
}
function bm(t) {
  let e, l, i = (
    /*tooltipInfo*/
    t[15].item + ""
  ), n, a, r = (
    /*tooltipInfo*/
    (t[15].key.gate || /*tooltipInfo*/
    t[15].key.feature) + ""
  ), s, o, u = (
    /*tooltipInfo*/
    (t[15].key.type ? (
      /*tooltipInfo*/
      t[15].key.type
    ) : "") + ""
  ), c, d, h, p, b, g, v = (
    /*tooltipInfo*/
    t[15].value.value + ""
  ), y, k, w, $, q, j = (
    /*tooltipInfo*/
    t[15].value.asof + ""
  ), O, z, N, M, H, B, R, P, I = (
    /*tooltipInfo*/
    t[15].value.unit && vm(t)
  );
  return {
    c() {
      e = m("div"), l = m("h5"), n = E(i), a = E("–"), s = E(r), o = A(), c = E(u), d = A(), h = m("table"), p = m("tr"), b = m("th"), b.textContent = "Value", g = m("td"), y = E(v), k = A(), w = m("tr"), $ = m("th"), $.textContent = "Date", q = m("td"), O = E(j), z = A(), I && I.c(), N = A(), M = m("div"), H = m("button"), H.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16"><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"></path></svg>', f(l, "class", "svelte-19xd6a8"), f(b, "class", "svelte-19xd6a8"), f(g, "class", "svelte-19xd6a8"), f($, "class", "svelte-19xd6a8"), f(q, "class", "svelte-19xd6a8"), f(h, "class", "svelte-19xd6a8"), f(H, "class", "close svelte-19xd6a8"), Mt(M, "text-align", "right"), f(e, "class", "tooltip svelte-19xd6a8"), f(e, "style", B = `right: calc(${/*width*/
      t[6]}px + 1rem)`);
    },
    m(L, F) {
      C(L, e, F), _(e, l), _(l, n), _(l, a), _(l, s), _(l, o), _(l, c), _(e, d), _(e, h), _(h, p), _(p, b), _(p, g), _(g, y), _(h, k), _(h, w), _(w, $), _(w, q), _(q, O), _(h, z), I && I.m(h, null), _(e, N), _(e, M), _(M, H), R || (P = le(
        H,
        "click",
        /*click_handler_2*/
        t[32]
      ), R = !0);
    },
    p(L, F) {
      F[0] & /*tooltipInfo*/
      32768 && i !== (i = /*tooltipInfo*/
      L[15].item + "") && Y(n, i), F[0] & /*tooltipInfo*/
      32768 && r !== (r = /*tooltipInfo*/
      (L[15].key.gate || /*tooltipInfo*/
      L[15].key.feature) + "") && Y(s, r), F[0] & /*tooltipInfo*/
      32768 && u !== (u = /*tooltipInfo*/
      (L[15].key.type ? (
        /*tooltipInfo*/
        L[15].key.type
      ) : "") + "") && Y(c, u), F[0] & /*tooltipInfo*/
      32768 && v !== (v = /*tooltipInfo*/
      L[15].value.value + "") && Y(y, v), F[0] & /*tooltipInfo*/
      32768 && j !== (j = /*tooltipInfo*/
      L[15].value.asof + "") && Y(O, j), /*tooltipInfo*/
      L[15].value.unit ? I ? I.p(L, F) : (I = vm(L), I.c(), I.m(h, null)) : I && (I.d(1), I = null), F[0] & /*width*/
      64 && B !== (B = `right: calc(${/*width*/
      L[6]}px + 1rem)`) && f(e, "style", B);
    },
    d(L) {
      L && T(e), I && I.d(), R = !1, P();
    }
  };
}
function vm(t) {
  let e, l, i, n = (
    /*tooltipInfo*/
    t[15].value.unit + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Unit", i = m("td"), a = E(n), f(l, "class", "svelte-19xd6a8"), f(i, "class", "svelte-19xd6a8");
    },
    m(r, s) {
      C(r, e, s), _(e, l), _(e, i), _(i, a);
    },
    p(r, s) {
      s[0] & /*tooltipInfo*/
      32768 && n !== (n = /*tooltipInfo*/
      r[15].value.unit + "") && Y(a, n);
    },
    d(r) {
      r && T(e);
    }
  };
}
function Sq(t) {
  let e, l, i = (
    /*$data*/
    t[16] && um(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, e, a), l = !0;
    },
    p(n, a) {
      /*$data*/
      n[16] ? i ? (i.p(n, a), a[0] & /*$data*/
      65536 && S(i, 1)) : (i = um(n), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d(n);
    }
  };
}
let Ya = 45, Eg = 15, Zi = 20;
const km = (t, e) => t - e;
function Mq(t, e, l) {
  let i, n = ae, a = () => (n(), n = rt(u, (fe) => l(16, i = fe)), u), r, s, o;
  t.$$.on_destroy.push(() => n());
  let { data: u = Pe() } = e;
  a();
  let c, d, h, p, b;
  const g = ["id", "rz", "sx", "x"], v = ["cx", "ecr"];
  let y = Pe(!0);
  at(t, y, (fe) => l(17, r = fe));
  let k, w, $, q = 0, j = 0, O = 0, z = 0, N = [], M = [], H = Pe(), B = Pe();
  at(t, H, (fe) => l(19, o = fe)), at(t, B, (fe) => l(18, s = fe));
  function R(fe) {
    q = Math.max(...fe.map((ke) => ke.y)) + 1, j = Math.max(...fe.map((ke) => ke.x)) + 1, l(6, O = (j - 1) * Ya + Zi * 2), l(7, z = q * Ya + Zi * 2), l(5, $ = {});
    for (const ke of fe)
      l(5, $[ke.index] = ke, $);
    p && l(8, N = Object.keys(p[0]).filter((ke) => ke !== "index").map((ke) => ({ feature: ke })));
    let _e = [], K = [];
    l(9, M = []), b.forEach((ke) => {
      v.includes(ke.gate) && !K.includes(ke.gate) && (M.push({ gate: ke.gate, type: "error" }), M.push({ gate: ke.gate, type: "length" }), K.push(ke.gate)), g.includes(ke.gate) && !_e.includes(ke.gate) && (N.push({ gate: ke.gate, type: "error" }), N.push({ gate: ke.gate, type: "length" }), _e.push(ke.gate));
    }), H.set(N[0]), B.set(M[0]);
  }
  let P = [], I = {}, L, F;
  H.subscribe((fe) => {
    if (l(10, P = []), fe != null && fe.feature) {
      l(10, P = p.map((ue) => ue[fe.feature]));
      let _e = P.map((ue) => ue.value), [K, ke] = [Math.min(..._e), Math.max(..._e)];
      l(12, L = {
        min: K,
        max: ke,
        mean: Qi(_e),
        median: Vi(_e),
        values: _e
      }), ["frequency", "readout_error"].includes(fe.feature) ? l(3, k = yl(Dl).domain([ke, K])) : l(3, k = yl(Dl).domain([K, ke]));
    } else if (fe != null && fe.gate) {
      l(10, P = b.filter((ue) => ue.gate === fe.gate).map((ue) => (ue.qubit = ue.qubits[0], ue)).toSorted((ue, ne) => ue.qubit - ne.qubit));
      let _e = P.map((ue) => ue.parameters["gate_" + fe.type].value), [K, ke] = [Math.min(..._e), Math.max(..._e)];
      l(12, L = {
        min: K,
        max: ke,
        mean: Qi(_e),
        median: Vi(_e),
        values: _e
      }), l(3, k = yl(Dl).domain([ke, K]));
    }
  }), B.subscribe((fe) => {
    if (l(11, I = {}), fe != null && fe.gate) {
      b.filter((ne) => ne.gate === fe.gate).forEach((ne) => {
        l(11, I[ne.qubits.join("-")] = ne, I);
      });
      let K = Object.keys(I).map((ne) => {
        var oe;
        return (oe = I[ne].parameters["gate_" + fe.type]) == null ? void 0 : oe.value;
      }), [ke, ue] = [Math.min(...K), Math.max(...K)];
      l(13, F = {
        min: ke,
        max: ue,
        mean: Qi(K),
        median: Vi(K),
        values: K
      }), l(4, w = yl(Dl).domain([ue, ke]));
    }
  });
  let X = !1, V = !1, Q = {};
  function J(fe, _e, K, ke, ue, ne, oe) {
    V && !oe || (l(14, X = !0), l(15, Q = { item: _e, key: K, value: ke }), V = oe, Array.from(document.querySelectorAll(".circuit-element")).forEach((x) => {
      x.style.outline = null;
    }), document.querySelector("#" + ue) && (document.querySelector("#" + ue).style.outline = "2px solid black"));
  }
  function te(fe) {
    X && (tooltipX = fe.screenX - mouse_adj.x, tooltipY = fe.screenY - mouse_adj.y);
  }
  function ie(fe) {
    V || l(14, X = !1), fe && (l(14, X = !1), l(15, Q = void 0), V = !1, Array.from(document.querySelectorAll(".circuit-element")).forEach((_e) => {
      _e.style.outline = null;
    }));
  }
  function U(fe) {
    var _e, K, ke, ue, ne;
    d = (_e = fe.machine_design) == null ? void 0 : _e.nodes, l(1, c = (K = fe.machine_design) == null ? void 0 : K.edges), l(2, h = (ke = fe.machine_design) == null ? void 0 : ke.index), p = (ue = fe.backend_properties) == null ? void 0 : ue.qubits, b = (ne = fe.backend_properties) == null ? void 0 : ne.gates;
  }
  yt(() => {
    u.subscribe((fe) => {
      U(fe), d && R(d);
    });
  });
  const G = (fe) => y.set(!r), W = (fe) => {
    H.set(JSON.parse(fe.target.value));
  }, Z = (fe) => {
    B.set(JSON.parse(fe.target.value));
  }, ee = () => {
    ie(!0);
  }, ye = (fe) => $[fe], qe = (fe) => i.physical_qubits.includes(fe), je = () => {
    ie(!0);
  };
  return t.$$set = (fe) => {
    "data" in fe && a(l(0, u = fe.data));
  }, [
    u,
    c,
    h,
    k,
    w,
    $,
    O,
    z,
    N,
    M,
    P,
    I,
    L,
    F,
    X,
    Q,
    i,
    r,
    s,
    o,
    y,
    H,
    B,
    J,
    te,
    ie,
    G,
    W,
    Z,
    ee,
    ye,
    qe,
    je
  ];
}
class zq extends Ve {
  constructor(e) {
    super(), Qe(this, e, Mq, Sq, Le, { data: 0 }, null, [-1, -1]);
  }
}
function ym(t) {
  let e, l, i, n, a, r, s, o, u, c, d, h, p, b, g, v, y, k, w, $, q, j, O, z;
  return a = new Q6({ props: { data: (
    /*data*/
    t[1]
  ) } }), s = new l8({ props: { data: (
    /*data*/
    t[1]
  ) } }), u = new m7({ props: { data: (
    /*data*/
    t[1]
  ) } }), d = new Op({
    props: {
      panel_name: "Original circuit",
      id: "original-circuit",
      circuit_data: {
        layers: (
          /*$data*/
          t[0].original_circuit_layout
        ),
        qubits: [],
        qubits: [],
        global_phase: (
          /*$data*/
          t[0].original_circuit_global_phase
        ),
        layer_index: (
          /*$data*/
          t[0].original_circuit_layout_index
        )
      },
      bit_match: (
        /*$data*/
        t[0].bit_match
      ),
      pagination: {
        page: (
          /*$data*/
          t[0].original_circuit_page
        ),
        range: (
          /*$data*/
          t[0].original_circuit_page_range
        ),
        total_page: (
          /*$data*/
          t[0].original_circuit_total_page
        )
      }
    }
  }), p = new Op({
    props: {
      panel_name: "Transpiled circuit",
      id: "transpiled-circuit",
      circuit_data: {
        layers: (
          /*$data*/
          t[0].transpiled_circuit_layout
        ),
        qubits: [],
        global_phase: (
          /*$data*/
          t[0].transpiled_circuit_global_phase
        ),
        layer_index: (
          /*$data*/
          t[0].transpiled_circuit_layout_index
        )
      },
      bit_match: (
        /*$data*/
        t[0].bit_match
      ),
      pagination: {
        page: (
          /*$data*/
          t[0].transpiled_circuit_page
        ),
        range: (
          /*$data*/
          t[0].transpiled_circuit_page_range
        ),
        total_page: (
          /*$data*/
          t[0].transpiled_circuit_total_page
        )
      }
    }
  }), g = new zq({ props: { data: (
    /*data*/
    t[1]
  ) } }), y = new u8({ props: { data: (
    /*data*/
    t[1]
  ) } }), w = new gq({ props: { data: (
    /*data*/
    t[1]
  ) } }), q = new kq({ props: { data: (
    /*data*/
    t[1]
  ) } }), O = new Cq({ props: { data: (
    /*data*/
    t[1]
  ) } }), {
    c() {
      e = m("div"), l = m("h3"), l.textContent = "Quantum Job Viewer", i = A(), n = m("div"), he(a.$$.fragment), r = A(), he(s.$$.fragment), o = A(), he(u.$$.fragment), c = A(), he(d.$$.fragment), h = A(), he(p.$$.fragment), b = A(), he(g.$$.fragment), v = A(), he(y.$$.fragment), k = A(), he(w.$$.fragment), $ = A(), he(q.$$.fragment), j = A(), he(O.$$.fragment), f(l, "class", "svelte-1147w99"), f(n, "class", "panel-wrapper svelte-1147w99"), f(e, "class", "wrap svelte-1147w99");
    },
    m(N, M) {
      C(N, e, M), _(e, l), _(e, i), _(e, n), ce(a, n, null), _(n, r), ce(s, n, null), _(n, o), ce(u, n, null), _(n, c), ce(d, n, null), _(n, h), ce(p, n, null), _(n, b), ce(g, n, null), _(n, v), ce(y, n, null), _(n, k), ce(w, n, null), _(n, $), ce(q, n, null), _(n, j), ce(O, n, null), z = !0;
    },
    p(N, M) {
      const H = {};
      M & /*$data*/
      1 && (H.circuit_data = {
        layers: (
          /*$data*/
          N[0].original_circuit_layout
        ),
        qubits: [],
        qubits: [],
        global_phase: (
          /*$data*/
          N[0].original_circuit_global_phase
        ),
        layer_index: (
          /*$data*/
          N[0].original_circuit_layout_index
        )
      }), M & /*$data*/
      1 && (H.bit_match = /*$data*/
      N[0].bit_match), M & /*$data*/
      1 && (H.pagination = {
        page: (
          /*$data*/
          N[0].original_circuit_page
        ),
        range: (
          /*$data*/
          N[0].original_circuit_page_range
        ),
        total_page: (
          /*$data*/
          N[0].original_circuit_total_page
        )
      }), d.$set(H);
      const B = {};
      M & /*$data*/
      1 && (B.circuit_data = {
        layers: (
          /*$data*/
          N[0].transpiled_circuit_layout
        ),
        qubits: [],
        global_phase: (
          /*$data*/
          N[0].transpiled_circuit_global_phase
        ),
        layer_index: (
          /*$data*/
          N[0].transpiled_circuit_layout_index
        )
      }), M & /*$data*/
      1 && (B.bit_match = /*$data*/
      N[0].bit_match), M & /*$data*/
      1 && (B.pagination = {
        page: (
          /*$data*/
          N[0].transpiled_circuit_page
        ),
        range: (
          /*$data*/
          N[0].transpiled_circuit_page_range
        ),
        total_page: (
          /*$data*/
          N[0].transpiled_circuit_total_page
        )
      }), p.$set(B);
    },
    i(N) {
      z || (S(a.$$.fragment, N), S(s.$$.fragment, N), S(u.$$.fragment, N), S(d.$$.fragment, N), S(p.$$.fragment, N), S(g.$$.fragment, N), S(y.$$.fragment, N), S(w.$$.fragment, N), S(q.$$.fragment, N), S(O.$$.fragment, N), z = !0);
    },
    o(N) {
      D(a.$$.fragment, N), D(s.$$.fragment, N), D(u.$$.fragment, N), D(d.$$.fragment, N), D(p.$$.fragment, N), D(g.$$.fragment, N), D(y.$$.fragment, N), D(w.$$.fragment, N), D(q.$$.fragment, N), D(O.$$.fragment, N), z = !1;
    },
    d(N) {
      N && T(e), de(a), de(s), de(u), de(d), de(p), de(g), de(y), de(w), de(q), de(O);
    }
  };
}
function Nq(t) {
  let e, l, i = (
    /*$data*/
    t[0] && ym(t)
  );
  return {
    c() {
      i && i.c(), e = Be();
    },
    m(n, a) {
      i && i.m(n, a), C(n, e, a), l = !0;
    },
    p(n, [a]) {
      /*$data*/
      n[0] ? i ? (i.p(n, a), a & /*$data*/
      1 && S(i, 1)) : (i = ym(n), i.c(), S(i, 1), i.m(e.parentNode, e)) : i && (ge(), D(i, 1, 1, () => {
        i = null;
      }), be());
    },
    i(n) {
      l || (S(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && T(e), i && i.d(n);
    }
  };
}
function Aq(t, e, l) {
  let i, { model: n } = e, { key_data: a = "data", key_update: r = "data_update" } = e, s = JSON.parse(n.get(a)), o = `change:${r}`, u = () => {
    let d = JSON.parse(n.get(r));
    console.log(d), c.update((h) => (d.set && Object.keys(d.set).forEach((p) => {
      h[p] = d.set[p];
    }), d.append && Object.keys(d.append).forEach((p) => {
      if (h[p] || (d.append[p].constructor.name === "Array" ? h[p] = [] : d.append[p].constructor.name === "String" ? h[p] = "" : d.append[p].constructor.name === "Object" && (h[p] = {})), h[p].constructor.name === "Array")
        h[p].push(...d.append[p]);
      else if (h[p].constructor.name === "String")
        h[p] = h[p] + d.append[p];
      else if (h[p].constructor.name === "Object")
        for (let b in d.append[p])
          h[p][b] = d.append[p][b];
    }), h)), console.log(i);
  }, c = Pe();
  return at(t, c, (d) => l(0, i = d)), yt(() => {
    c.subscribe((d) => {
      var h;
      if (d && !d.physical_qubits) {
        d.physical_qubits = [], d.bit_match && (d.physical_qubits = d.bit_match.filter((b) => !b.is_ancilla).map((b) => b.to));
        let p = /* @__PURE__ */ new Set();
        if (d.transpiled_circuit_layout)
          for (const b of d.transpiled_circuit_layout)
            for (const g of b.operations)
              p.add(Qr(g));
        d.physical_gates = Array.from(p);
      }
      (h = d == null ? void 0 : d.backend_properties) != null && h.qubits && d.backend_properties.qubits.forEach((p, b) => {
        p.index = { value: b };
      });
    }), c.set(s), console.log(i), n.on(o, u);
  }), fi(() => {
    n.off(o, u);
  }), t.$$set = (d) => {
    "model" in d && l(2, n = d.model), "key_data" in d && l(3, a = d.key_data), "key_update" in d && l(4, r = d.key_update);
  }, [i, c, n, a, r];
}
class Bq extends Ve {
  constructor(e) {
    super(), Qe(this, e, Aq, Nq, Le, { model: 2, key_data: 3, key_update: 4 });
  }
}
function Iq({ model: t, el: e }) {
  if (t.get("mode") === "view") {
    let l = new b3({ target: e, props: { model: t } });
    return () => l.$destroy();
  } else if (t.get("mode") === "write") {
    let l = new m4({ target: e, props: { model: t } });
    return () => l.$destroy();
  } else if (t.get("mode") === "machine") {
    let l = new x$({ target: e, props: { model: t } });
    return () => l.$destroy();
  } else if (t.get("mode") === "result") {
    let l = new Bq({ target: e, props: { model: t } });
    return () => l.$destroy();
  } else if (t.get("mode") === "uncertainty") {
    let l = new H6({ target: e, props: { model: t } });
    return () => l.$destroy();
  }
}
export {
  Iq as render
};
