var p0 = Object.defineProperty;
var m0 = (t, e, l) => e in t ? p0(t, e, { enumerable: !0, configurable: !0, writable: !0, value: l }) : t[e] = l;
var Wa = (t, e, l) => (m0(t, typeof e != "symbol" ? e + "" : e, l), l);
function ne() {
}
const g0 = (t) => t;
function Xr(t, e) {
  for (const l in e)
    t[l] = e[l];
  return (
    /** @type {T & S} */
    t
  );
}
function lm(t) {
  return t();
}
function Gr() {
  return /* @__PURE__ */ Object.create(null);
}
function wt(t) {
  t.forEach(lm);
}
function im(t) {
  return typeof t == "function";
}
function Fe(t, e) {
  return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
}
function b0(t) {
  return Object.keys(t).length === 0;
}
function st(t, ...e) {
  if (t == null) {
    for (const i of e)
      i(void 0);
    return ne;
  }
  const l = t.subscribe(...e);
  return l.unsubscribe ? () => l.unsubscribe() : l;
}
function at(t, e, l) {
  t.$$.on_destroy.push(st(e, l));
}
function Yt(t) {
  return t ?? "";
}
function Ta(t, e, l) {
  return t.set(l), e;
}
const nm = typeof window < "u";
let k0 = nm ? () => window.performance.now() : () => Date.now(), am = nm ? (t) => requestAnimationFrame(t) : ne;
const Oi = /* @__PURE__ */ new Set();
function rm(t) {
  Oi.forEach((e) => {
    e.c(t) || (Oi.delete(e), e.f());
  }), Oi.size !== 0 && am(rm);
}
function v0(t) {
  let e;
  return Oi.size === 0 && am(rm), {
    promise: new Promise((l) => {
      Oi.add(e = { c: t, f: l });
    }),
    abort() {
      Oi.delete(e);
    }
  };
}
function f(t, e) {
  t.appendChild(e);
}
function S(t, e, l) {
  t.insertBefore(e, l || null);
}
function C(t) {
  t.parentNode && t.parentNode.removeChild(t);
}
function Ye(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 Ge(t) {
  return document.createElementNS("http://www.w3.org/2000/svg", t);
}
function E(t) {
  return document.createTextNode(t);
}
function N() {
  return E(" ");
}
function Ae() {
  return E("");
}
function te(t, e, l, i) {
  return t.addEventListener(e, l, i), () => t.removeEventListener(e, l, i);
}
function u(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 : u(t, e, l);
}
function sm(t) {
  return t === "" ? null : +t;
}
function y0(t) {
  return Array.from(t.childNodes);
}
function U(t, e) {
  e = "" + e, t.data !== e && (t.data = /** @type {string} */
  e);
}
function pt(t, e) {
  t.value = e ?? "";
}
function At(t, e, l, i) {
  l == null ? t.style.removeProperty(e) : t.style.setProperty(e, l, i ? "important" : "");
}
function fl(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 mn;
function pn(t) {
  mn = t;
}
function om() {
  if (!mn)
    throw new Error("Function called outside component initialization");
  return mn;
}
function Tt(t) {
  om().$$.on_mount.push(t);
}
function ri(t) {
  om().$$.on_destroy.push(t);
}
const Pi = [], Yr = [];
let Ei = [];
const Kr = [], w0 = /* @__PURE__ */ Promise.resolve();
let gr = !1;
function $0() {
  gr || (gr = !0, w0.then(um));
}
function br(t) {
  Ei.push(t);
}
const Ja = /* @__PURE__ */ new Set();
let si = 0;
function um() {
  if (si !== 0)
    return;
  const t = mn;
  do {
    try {
      for (; si < Pi.length; ) {
        const e = Pi[si];
        si++, pn(e), q0(e.$$);
      }
    } catch (e) {
      throw Pi.length = 0, si = 0, e;
    }
    for (pn(null), Pi.length = 0, si = 0; Yr.length; )
      Yr.pop()();
    for (let e = 0; e < Ei.length; e += 1) {
      const l = Ei[e];
      Ja.has(l) || (Ja.add(l), l());
    }
    Ei.length = 0;
  } while (Pi.length);
  for (; Kr.length; )
    Kr.pop()();
  gr = !1, Ja.clear(), pn(t);
}
function q0(t) {
  if (t.fragment !== null) {
    t.update(), wt(t.before_update);
    const e = t.dirty;
    t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(br);
  }
}
function j0(t) {
  const e = [], l = [];
  Ei.forEach((i) => t.indexOf(i) === -1 ? e.push(i) : l.push(i)), l.forEach((i) => i()), Ei = e;
}
const va = /* @__PURE__ */ new Set();
let xl;
function be() {
  xl = {
    r: 0,
    c: [],
    p: xl
    // parent group
  };
}
function ke() {
  xl.r || wt(xl.c), xl = xl.p;
}
function T(t, e) {
  t && t.i && (va.delete(t), t.i(e));
}
function D(t, e, l, i) {
  if (t && t.o) {
    if (va.has(t))
      return;
    va.add(t), xl.c.push(() => {
      va.delete(t), i && (l && t.d(1), i());
    }), t.o(e);
  } else
    i && i();
}
function $e(t) {
  return (t == null ? void 0 : t.length) !== void 0 ? t : Array.from(t);
}
function pe(t) {
  t && t.c();
}
function de(t, e, l) {
  const { fragment: i, after_update: n } = t.$$;
  i && i.m(e, l), br(() => {
    const a = t.$$.on_mount.map(lm).filter(im);
    t.$$.on_destroy ? t.$$.on_destroy.push(...a) : wt(a), t.$$.on_mount = [];
  }), n.forEach(br);
}
function he(t, e) {
  const l = t.$$;
  l.fragment !== null && (j0(l.after_update), wt(l.on_destroy), l.fragment && l.fragment.d(e), l.on_destroy = l.fragment = null, l.ctx = []);
}
function T0(t, e) {
  t.$$.dirty[0] === -1 && (Pi.push(t), $0(), 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 = mn;
  pn(t);
  const _ = t.$$ = {
    fragment: null,
    ctx: [],
    // state
    props: a,
    update: ne,
    not_equal: n,
    bound: Gr(),
    // lifecycle
    on_mount: [],
    on_destroy: [],
    on_disconnect: [],
    before_update: [],
    after_update: [],
    context: new Map(e.context || (o ? o.$$.context : [])),
    // everything else
    callbacks: Gr(),
    dirty: s,
    skip_bound: !1,
    root: e.target || o.$$.root
  };
  r && r(_.root);
  let c = !1;
  if (_.ctx = l ? l(t, e.props || {}, (d, h, ...p) => {
    const g = p.length ? p[0] : h;
    return _.ctx && n(_.ctx[d], _.ctx[d] = g) && (!_.skip_bound && _.bound[d] && _.bound[d](g), c && T0(t, d)), h;
  }) : [], _.update(), c = !0, wt(_.before_update), _.fragment = i ? i(_.ctx) : !1, e.target) {
    if (e.hydrate) {
      const d = y0(e.target);
      _.fragment && _.fragment.l(d), d.forEach(C);
    } else
      _.fragment && _.fragment.c();
    e.intro && T(t.$$.fragment), de(t, e.target, e.anchor), um();
  }
  pn(o);
}
class Ve {
  constructor() {
    /**
     * ### PRIVATE API
     *
     * Do not use, may change at any time
     *
     * @type {any}
     */
    Wa(this, "$$");
    /**
     * ### PRIVATE API
     *
     * Do not use, may change at any time
     *
     * @type {any}
     */
    Wa(this, "$$set");
  }
  /** @returns {void} */
  $destroy() {
    he(this, 1), this.$destroy = ne;
  }
  /**
   * @template {Extract<keyof Events, string>} K
   * @param {K} type
   * @param {((e: Events[K]) => void) | null | undefined} callback
   * @returns {() => void}
   */
  $on(e, l) {
    if (!im(l))
      return ne;
    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 && !b0(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
  }
}
const C0 = "4";
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(C0);
const oi = [];
function Oe(t, e = ne) {
  let l;
  const i = /* @__PURE__ */ new Set();
  function n(s) {
    if (Fe(t, s) && (t = s, l)) {
      const o = !oi.length;
      for (const _ of i)
        _[1](), oi.push(_, t);
      if (o) {
        for (let _ = 0; _ < oi.length; _ += 2)
          oi[_][0](oi[_ + 1]);
        oi.length = 0;
      }
    }
  }
  function a(s) {
    n(s(t));
  }
  function r(s, o = ne) {
    const _ = [s, o];
    return i.add(_), i.size === 1 && (l = e(n, a) || ne), s(t), () => {
      i.delete(_), i.size === 0 && l && (l(), l = null);
    };
  }
  return { set: n, update: a, subscribe: r };
}
const qe = 24, Pt = 6, et = 6, Ur = 48, tt = 24, De = 10, ui = 12, Ui = 14, ml = 48, jl = 24, Ot = 70, S0 = 25, Bl = 16, Me = "#000000", it = "#ffffff", Wr = 70, Wi = 10, Wt = [
  "#4285f4",
  "#db4437",
  "#f4b400",
  "#0f9d58",
  "#ab47bc",
  "#00acc1",
  "#ff7043",
  "#9e9d24",
  "#5c6bc0",
  "#f06292",
  "#00796b",
  "#c2185b",
  "#7e57c2",
  "#03a9f4",
  "#8bc34a",
  "#fdd835",
  "#fb8c00",
  "#8d6e63",
  "#9e9e9e",
  "#607d8b"
], M0 = [
  // no-target
  "cp"
], z0 = [
  // 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"
], N0 = [
  // double-target
  "cswap"
], A0 = [
  "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 = (Pt + qe) * i, s = qe;
  else if (a) {
    r = (Pt + qe) * i;
    let _ = (e ? Object.keys(e).length : t.qubits[0].register.size) - i + 1;
    s = Pt * _ + qe * (_ + 1);
  } else {
    r = (Pt + qe) * i;
    let o = n - i;
    s = Pt * o + qe * (o + 1);
  }
  return {
    y: r,
    height: s
  };
}
function $t(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 = (Pt + qe) * r, i;
}
let Il = tt, fi = "cx", Jr = {
  name: fi,
  width: Il,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${fi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Il,
      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 = $t(t, n, l), o = $t(t, a, l), _ = {
      id: `layer-${e}--${fi}--connect`,
      type: "line",
      x1: Il / 2 - 0.5,
      x2: Il / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + (o > s ? 0 : qe),
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = {
      id: `layer-${e}--${fi}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: Me,
      width: 6,
      height: 6,
      x: Il / 2 - 3,
      y: s + qe / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${fi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Il,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${fi}--target-marker`,
      type: "text",
      x: Il / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "X"
    };
    return i.elem.push(h), i;
  }
}, $n = tt * 1.65, _i = "iswap", Zr = {
  name: _i,
  width: $n,
  plan: function(t, e, l) {
    var _, c;
    let i = {
      id: `layer-${e}--${_i}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: $n,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${_i}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: $n,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${_i}--qubit-1`,
      type: "text",
      x: et / 2,
      y: qe / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (_ = t.qubits[0]) == null ? void 0 : _.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${_i}--qubit-2`,
      type: "text",
      x: et / 2,
      y: n.height - qe / 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}--${_i}--marker`,
      type: "text",
      x: $n - et / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: "ISWAP"
    };
    return i.elem.push(o), i;
  }
}, Dl = tt, ci = "measure", xr = {
  name: ci,
  width: Dl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${ci}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Dl,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height - qe - De;
    let a = {
      id: `layer-${e}--${ci}--qubit`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Dl,
      x: 0,
      y: 0,
      height: qe
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${ci}--marker`,
      type: "text",
      x: Dl / 2,
      y: qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "M"
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${ci}--connect`,
      type: "line",
      x1: Dl / 2 - 0.5,
      x2: Dl / 2 - 0.5,
      y1: qe,
      y2: n.height - qe * 2 + Pt,
      "stroke-width": 1
    };
    i.elem.push(s);
    let o = {
      id: `layer-${e}--${ci}--clbit`,
      type: "text",
      x: Dl / 2,
      y: n.height + Pt - qe * 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;
  }
}, B0 = [2, 3, 4, 6, 8, 16, 32];
function St(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 B0)
      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 P0(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 Za = "http://www.w3.org/2000/svg";
function O0(t, e) {
  let l = document.querySelector(`#${t} defs`), i = document.querySelector(`#${t}`);
  l || (l = document.createElementNS(Za, "defs"));
  let n = document.createElementNS(Za, "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(Za, "stop");
    r.setAttribute("offset", a.offset), r.setAttribute("stop-color", a["stop-color"]), n.appendChild(r);
  }), l.appendChild(n), i.appendChild(l);
}
function Ii(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), _ = document.createElement("canvas");
  _.setAttribute("width", i), _.setAttribute("height", n), document.body.appendChild(_);
  let c = _.getContext("2d"), d = new Image();
  d.onload = () => {
    c.drawImage(d, 0, 0);
    let h = _.toDataURL("image/png");
    URL.revokeObjectURL(h), e && e.set && e.set({ png: h, id: t, svg: o }), _.remove();
  }, d.src = o;
}
function es(t, e) {
  let l = Math.pow(10, e);
  return Math.round(t * l) / l;
}
let qn = tt * 2.3, jn = "rz", ts = {
  name: jn,
  width: qn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${jn}--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}--${jn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: qn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${jn}--marker`,
      type: "text",
      x: qn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `Rz(${St(t.params[0])})`
    };
    return i.elem.push(r), i;
  }
}, Tn = tt, Cn = "sx", ls = {
  name: Cn,
  width: Tn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Cn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Tn,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Cn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: Tn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Cn}--marker`,
      type: "text",
      x: Tn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "√X"
    };
    return i.elem.push(r), i;
  }
}, xa = tt * 1.65, E0 = "custom", I0 = {
  name: E0,
  is_custom: !0,
  width: xa,
  plan: function(t, e, l, i) {
    let n = {
      id: `layer-${l}--${e}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: xa,
      height: 0,
      elem: []
    }, a = nt(t, i);
    n.y = a.y, n.height = a.height;
    let r = e.toUpperCase().length;
    n.width = Math.max(
      xa,
      r * 0.75 * 9 + 10
    );
    let s = {
      id: `layer-${l}--${e}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      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: et / 2,
        y: d.y + qe / 2 - a.y,
        "text-anchor": "start",
        "alignment-baseline": "middle",
        text: c == null ? void 0 : c.index
      };
      n.elem.push(h), o++;
    }
    let _ = {
      id: `layer-${l}--${e}--marker`,
      type: "text",
      x: n.width - et / 2,
      y: a.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: e.toUpperCase()
    };
    return n.elem.push(_), n;
  }
}, er = 10, tr = "barrier", is = {
  name: tr,
  is_custom: !0,
  width: er,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${tr}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: er,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${tr}--wrap`,
      type: "rect",
      "stroke-width": 1,
      stroke: "#cccccc",
      fill: "#cccccc",
      width: er,
      x: 0,
      y: 0,
      height: n.height
    };
    return i.elem.push(a), i;
  }
}, Sn = tt, Mn = "h", ns = {
  name: Mn,
  width: Sn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Mn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Sn,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Mn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: Sn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Mn}--marker`,
      type: "text",
      x: Sn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "H"
    };
    return i.elem.push(r), i;
  }
}, zn = tt, Nn = "x", as = {
  name: Nn,
  width: zn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Nn}--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}--${Nn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: zn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Nn}--marker`,
      type: "text",
      x: zn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "X"
    };
    return i.elem.push(r), i;
  }
}, An = tt, Ji = "y", rs = {
  name: Ji,
  width: An,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Ji}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: An,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Ji}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: An,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Ji}--marker`,
      type: "text",
      x: An / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: Ji.toUpperCase()
    };
    return i.elem.push(r), i;
  }
}, lr = tt, ir = "z", ss = {
  name: ir,
  width: lr,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${ir}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: lr,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${ir}--marker`,
      type: "rect",
      "stroke-width": 0,
      fill: Me,
      width: 6,
      height: 6,
      x: lr / 2 - 3,
      y: qe / 2 - 3
    };
    return i.elem.push(a), i;
  }
}, Bn = tt, Pn = "id", os = {
  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: Me,
      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: "I"
    };
    return i.elem.push(r), i;
  }
}, On = tt, Zi = "s", us = {
  name: Zi,
  width: On,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Zi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: On,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Zi}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: On,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Zi}--marker`,
      type: "text",
      x: On / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: Zi.toUpperCase()
    };
    return i.elem.push(r), i;
  }
}, En = tt, In = "sdg", fs = {
  name: In,
  width: En,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${In}--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}--${In}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: En,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${In}--marker`,
      type: "text",
      x: En / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "S†"
    };
    return i.elem.push(r), i;
  }
}, Dn = tt, Rn = "sxdg", _s = {
  name: Rn,
  width: Dn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Rn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Dn,
      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: Me,
      fill: it,
      width: Dn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Rn}--marker`,
      type: "text",
      x: Dn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "√X†"
    };
    return i.elem.push(r), i;
  }
}, Hn = tt, xi = "t", cs = {
  name: xi,
  width: Hn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${xi}--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}--${xi}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: Hn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${xi}--marker`,
      type: "text",
      x: Hn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: xi.toUpperCase()
    };
    return i.elem.push(r), i;
  }
}, Ln = tt, Fn = "tdg", ds = {
  name: Fn,
  width: Ln,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Fn}--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}--${Fn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: Ln,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Fn}--marker`,
      type: "text",
      x: Ln / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "T†"
    };
    return i.elem.push(r), i;
  }
}, Qn = tt * 2.8, Vn = "r", hs = {
  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: Me,
      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: `R(${St(t.params[0])},${St(t.params[1])})`
    };
    return i.elem.push(r), i;
  }
}, Xn = tt * 2.3, Gn = "rx", ps = {
  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: Me,
      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: `Rx(${St(t.params[0])})`
    };
    return i.elem.push(r), i;
  }
}, Yn = tt * 2.3, Kn = "ry", ms = {
  name: Kn,
  width: Yn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Kn}--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}--${Kn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: Yn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Kn}--marker`,
      type: "text",
      x: Yn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `Ry(${St(t.params[0])})`
    };
    return i.elem.push(r), i;
  }
}, Un = tt * 2.25, Wn = "p", gs = {
  name: Wn,
  width: Un,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Wn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Un,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Wn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: Un,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Wn}--marker`,
      type: "text",
      x: Un / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `P(${St(t.params[0])})`
    };
    return i.elem.push(r), i;
  }
}, Jn = tt * 4, Zn = "u", bs = {
  name: Zn,
  width: Jn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Zn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Jn,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Zn}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: Jn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Zn}--marker`,
      type: "text",
      x: Jn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `U(${St(t.params[0])},${St(t.params[1])},${St(t.params[2])})`
    };
    return i.elem.push(r), i;
  }
}, xn = tt * 2.3, ea = "u1", ks = {
  name: ea,
  width: xn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${ea}--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}--${ea}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: xn,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${ea}--marker`,
      type: "text",
      x: xn / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `U1(${St(t.params[0])})`
    };
    return i.elem.push(r), i;
  }
}, ta = tt * 2.6, la = "u2", vs = {
  name: la,
  width: ta,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${la}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ta,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${la}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: ta,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${la}--marker`,
      type: "text",
      x: ta / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `U2(${St(t.params[0])},${St(t.params[1])})`
    };
    return i.elem.push(r), i;
  }
}, ia = tt * 3, na = "u3", ys = {
  name: na,
  width: ia,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${na}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ia,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${na}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: ia,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${na}--marker`,
      type: "text",
      x: ia / 2,
      y: n.height / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `U3(${St(t.params[0])},${St(t.params[1])},${St(t.params[2])})`
    };
    return i.elem.push(r), i;
  }
}, aa = tt * 1.4, di = "ecr", ws = {
  name: di,
  width: aa,
  plan: function(t, e, l) {
    var _, c;
    let i = {
      id: `layer-${e}--${di}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: aa,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${di}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: aa,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${di}--qubit-1`,
      type: "text",
      x: et / 2,
      y: qe / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (_ = t.qubits[0]) == null ? void 0 : _.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${di}--qubit-2`,
      type: "text",
      x: et / 2,
      y: n.height - qe / 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}--${di}--marker`,
      type: "text",
      x: aa - et / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: "ECR"
    };
    return i.elem.push(o), i;
  }
}, Rl = tt, hi = "mcx", D0 = {
  name: hi,
  width: Rl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${hi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Rl,
      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((b) => $t(t, b, l)), o = $t(t, a, l), _ = Math.min(...s, o), c = Math.max(...s, o), d = {
      id: `layer-${e}--${hi}--connect`,
      type: "line",
      x1: Rl / 2 - 0.5,
      x2: Rl / 2 - 0.5,
      y1: _ + qe / 2,
      y2: c + qe / 2,
      "stroke-width": 1
    };
    i.elem.push(d);
    let h = 0;
    for (let b in n) {
      let k = {
        id: `layer-${e}--${hi}--control` + h,
        type: "rect",
        "stroke-width": 0,
        fill: Me,
        width: 6,
        height: 6,
        x: Rl / 2 - 3,
        y: s[h] + qe / 2 - 3
      };
      i.elem.push(k), h++;
    }
    let p = {
      id: `layer-${e}--${hi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Rl,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(p);
    let g = {
      id: `layer-${e}--${hi}--target-marker`,
      type: "text",
      x: Rl / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "X"
    };
    return i.elem.push(g), i;
  }
}, Hl = tt, pi = "ch", $s = {
  name: pi,
  width: Hl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${pi}--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 = $t(t, n, l), o = $t(t, a, l), _ = {
      id: `layer-${e}--${pi}--connect`,
      type: "line",
      x1: Hl / 2 - 0.5,
      x2: Hl / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + (o > s ? 0 : qe),
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = {
      id: `layer-${e}--${pi}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: Me,
      width: 6,
      height: 6,
      x: Hl / 2 - 3,
      y: s + qe / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${pi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Hl,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${pi}--target-marker`,
      type: "text",
      x: Hl / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "H"
    };
    return i.elem.push(h), i;
  }
}, Ll = tt, mi = "cs", qs = {
  name: mi,
  width: Ll,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${mi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Ll,
      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 = $t(t, n, l), o = $t(t, a, l), _ = {
      id: `layer-${e}--${mi}--connect`,
      type: "line",
      x1: Ll / 2 - 0.5,
      x2: Ll / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + (o > s ? 0 : qe),
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = {
      id: `layer-${e}--${mi}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: Me,
      width: 6,
      height: 6,
      x: Ll / 2 - 3,
      y: s + qe / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${mi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Ll,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${mi}--target-marker`,
      type: "text",
      x: Ll / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "S"
    };
    return i.elem.push(h), i;
  }
}, Fl = tt, gi = "csdg", js = {
  name: gi,
  width: Fl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${gi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Fl,
      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 = $t(t, n, l), o = $t(t, a, l), _ = {
      id: `layer-${e}--${gi}--connect`,
      type: "line",
      x1: Fl / 2 - 0.5,
      x2: Fl / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + (o > s ? 0 : qe),
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = {
      id: `layer-${e}--${gi}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: Me,
      width: 6,
      height: 6,
      x: Fl / 2 - 3,
      y: s + qe / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${gi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Fl,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${gi}--target-marker`,
      type: "text",
      x: Fl / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "S†"
    };
    return i.elem.push(h), i;
  }
}, Ql = tt, bi = "csx", Ts = {
  name: bi,
  width: Ql,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${bi}--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 = $t(t, n, l), o = $t(t, a, l), _ = {
      id: `layer-${e}--${bi}--connect`,
      type: "line",
      x1: Ql / 2 - 0.5,
      x2: Ql / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + (o > s ? 0 : qe),
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = {
      id: `layer-${e}--${bi}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: Me,
      width: 6,
      height: 6,
      x: Ql / 2 - 3,
      y: s + qe / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${bi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Ql,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${bi}--target-marker`,
      type: "text",
      x: Ql / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "√X"
    };
    return i.elem.push(h), i;
  }
}, Vl = tt, ki = "cy", Cs = {
  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 = $t(t, n, l), o = $t(t, a, l), _ = {
      id: `layer-${e}--${ki}--connect`,
      type: "line",
      x1: Vl / 2 - 0.5,
      x2: Vl / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + (o > s ? 0 : qe),
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = {
      id: `layer-${e}--${ki}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: Me,
      width: 6,
      height: 6,
      x: Vl / 2 - 3,
      y: s + qe / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${ki}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Vl,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${ki}--target-marker`,
      type: "text",
      x: Vl / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "Y"
    };
    return i.elem.push(h), i;
  }
}, en = tt, ra = "cz", Ss = {
  name: ra,
  width: en,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${ra}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: en,
      height: 0,
      elem: []
    }, n = t.qubits, a = nt(t, l);
    i.y = a.y, i.height = a.height;
    let r = n.map((d) => $t(t, d, l)), s = Math.min(...r), o = Math.max(...r), _ = {
      id: `layer-${e}--${ra}--connect`,
      type: "line",
      x1: en / 2 - 0.5,
      x2: en / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + qe / 2,
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = 0;
    for (let d in n) {
      let h = {
        id: `layer-${e}--${ra}--control` + c,
        type: "rect",
        "stroke-width": 0,
        fill: Me,
        width: 6,
        height: 6,
        x: en / 2 - 3,
        y: r[c] + qe / 2 - 3
      };
      i.elem.push(h), c++;
    }
    return i;
  }
}, tn = tt, sa = "ccz", Ms = {
  name: sa,
  width: tn,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${sa}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: tn,
      height: 0,
      elem: []
    }, n = t.qubits, a = nt(t, l);
    i.y = a.y, i.height = a.height;
    let r = n.map((d) => $t(t, d, l)), s = Math.min(...r), o = Math.max(...r), _ = {
      id: `layer-${e}--${sa}--connect`,
      type: "line",
      x1: tn / 2 - 0.5,
      x2: tn / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + qe / 2,
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = 0;
    for (let d in n) {
      let h = {
        id: `layer-${e}--${sa}--control` + c,
        type: "rect",
        "stroke-width": 0,
        fill: Me,
        width: 6,
        height: 6,
        x: tn / 2 - 3,
        y: r[c] + qe / 2 - 3
      };
      i.elem.push(h), c++;
    }
    return i;
  }
}, ln = tt, oa = "swap", zs = {
  name: oa,
  width: ln,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${oa}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ln,
      height: 0,
      elem: []
    }, n = t.qubits, a = nt(t, l);
    i.y = a.y, i.height = a.height;
    let r = n.map((d) => $t(t, d, l)), s = Math.min(...r), o = Math.max(...r), _ = {
      id: `layer-${e}--${oa}--connect`,
      type: "line",
      x1: ln / 2 - 0.5,
      x2: ln / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + qe / 2,
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = 0;
    for (let d in n) {
      let h = {
        id: `layer-${e}--${oa}--swap-${c}-marker`,
        type: "x",
        cx: ln / 2,
        cy: r[c] + qe / 2,
        width: tt / 2,
        height: tt / 2,
        "stroke-width": 1,
        stroke: Me
      };
      i.elem.push(h), c++;
    }
    return i;
  }
}, nr = tt * 2 + Pt, gl = "dcx", Ns = {
  name: gl,
  width: nr,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${gl}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: nr,
      height: 0,
      elem: []
    }, n = (nr - Pt) / 2;
    {
      let r = t.qubits[0], s = t.qubits[1], o = nt(t, l);
      i.y = o.y, i.height = o.height;
      let _ = $t(t, r, l), c = $t(t, s, l), d = {
        id: `layer-${e}--${gl}--1--connect`,
        type: "line",
        x1: n / 2 - 0.5,
        x2: n / 2 - 0.5,
        y1: _ + qe / 2,
        y2: c + (c > _ ? 0 : qe),
        "stroke-width": 1
      };
      i.elem.push(d);
      let h = {
        id: `layer-${e}--${gl}--1--control`,
        type: "rect",
        "stroke-width": 0,
        fill: Me,
        width: 6,
        height: 6,
        x: n / 2 - 3,
        y: _ + qe / 2 - 3
      };
      i.elem.push(h);
      let p = {
        id: `layer-${e}--${gl}--1--target-box`,
        type: "rect",
        "stroke-width": 1,
        stroke: Me,
        fill: it,
        width: n,
        x: 0,
        y: c,
        height: qe
      };
      i.elem.push(p);
      let g = {
        id: `layer-${e}--${gl}--1--target-marker`,
        type: "text",
        x: n / 2,
        y: c + qe / 2,
        "text-anchor": "middle",
        "alignment-baseline": "middle",
        text: "X"
      };
      i.elem.push(g);
    }
    let a = n + Pt;
    {
      let r = t.qubits[1], s = t.qubits[0], o = nt(t, l);
      i.y = o.y, i.height = o.height;
      let _ = $t(t, r, l), c = $t(t, s, l), d = {
        id: `layer-${e}--${gl}--2--connect`,
        type: "line",
        x1: a + n / 2 - 0.5,
        x2: a + n / 2 - 0.5,
        y1: _ + qe / 2,
        y2: c + (c > _ ? 0 : qe),
        "stroke-width": 1
      };
      i.elem.push(d);
      let h = {
        id: `layer-${e}--${gl}--2--control`,
        type: "rect",
        "stroke-width": 0,
        fill: Me,
        width: 6,
        height: 6,
        x: a + n / 2 - 3,
        y: _ + qe / 2 - 3
      };
      i.elem.push(h);
      let p = {
        id: `layer-${e}--${gl}--2--target-box`,
        type: "rect",
        "stroke-width": 1,
        stroke: Me,
        fill: it,
        width: n,
        x: a,
        y: c,
        height: qe
      };
      i.elem.push(p);
      let g = {
        id: `layer-${e}--${gl}--2--target-marker`,
        type: "text",
        x: a + n / 2,
        y: c + qe / 2,
        "text-anchor": "middle",
        "alignment-baseline": "middle",
        text: "X"
      };
      i.elem.push(g);
    }
    return i;
  }
}, Xl = tt, vi = "mrcx", R0 = {
  name: vi,
  width: Xl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${vi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: Xl,
      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((b) => $t(t, b, l)), o = $t(t, a, l), _ = Math.min(...s, o), c = Math.max(...s, o), d = {
      id: `layer-${e}--${vi}--connect`,
      type: "line",
      x1: Xl / 2 - 0.5,
      x2: Xl / 2 - 0.5,
      y1: _ + qe / 2,
      y2: c + qe / 2,
      "stroke-width": 1
    };
    i.elem.push(d);
    let h = 0;
    for (let b in n) {
      let k = {
        id: `layer-${e}--${vi}--control` + h,
        type: "rect",
        "stroke-width": 0,
        fill: Me,
        width: 6,
        height: 6,
        x: Xl / 2 - 3,
        y: s[h] + qe / 2 - 3
      };
      i.elem.push(k), h++;
    }
    let p = {
      id: `layer-${e}--${vi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Xl,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(p);
    let g = {
      id: `layer-${e}--${vi}--target-marker`,
      type: "text",
      x: Xl / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: "X"
    };
    return i.elem.push(g), i;
  }
}, yi = tt, nn = "cswap", As = {
  name: nn,
  width: yi,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${nn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: yi,
      height: 0,
      elem: []
    }, n = t.qubits, a = nt(t, l);
    i.y = a.y, i.height = a.height;
    let r = n.map((d) => $t(t, d, l)), s = Math.min(...r), o = Math.max(...r), _ = {
      id: `layer-${e}--${nn}--connect`,
      type: "line",
      x1: yi / 2 - 0.5,
      x2: yi / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + qe / 2,
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = 0;
    for (let d in n) {
      if (console.log(c, c < 1), c < 1) {
        let h = {
          id: `layer-${e}--${nn}--swap-${c}-control-marker`,
          type: "rect",
          "stroke-width": 0,
          fill: Me,
          width: 6,
          height: 6,
          x: yi / 2 - 3,
          y: r[c] + qe / 2 - 3
        };
        i.elem.push(h);
      } else {
        let h = {
          id: `layer-${e}--${nn}--swap-${c}-marker`,
          type: "x",
          cx: yi / 2,
          cy: r[c] + qe / 2,
          width: tt / 2,
          height: tt / 2,
          "stroke-width": 1,
          stroke: Me
        };
        i.elem.push(h);
      }
      c++;
    }
    return i;
  }
}, Gl = tt * 2.3, wi = "crx", Bs = {
  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 = $t(t, n, l), o = $t(t, a, l), _ = {
      id: `layer-${e}--${wi}--connect`,
      type: "line",
      x1: Gl / 2 - 0.5,
      x2: Gl / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + (o > s ? 0 : qe),
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = {
      id: `layer-${e}--${wi}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: Me,
      width: 6,
      height: 6,
      x: Gl / 2 - 3,
      y: s + qe / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${wi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Gl,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${wi}--target-marker`,
      type: "text",
      x: Gl / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `Rx(${St(t.params[0])})`
    };
    return i.elem.push(h), i;
  }
}, Yl = tt * 2.3, $i = "cry", Ps = {
  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 = $t(t, n, l), o = $t(t, a, l), _ = {
      id: `layer-${e}--${$i}--connect`,
      type: "line",
      x1: Yl / 2 - 0.5,
      x2: Yl / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + (o > s ? 0 : qe),
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = {
      id: `layer-${e}--${$i}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: Me,
      width: 6,
      height: 6,
      x: Yl / 2 - 3,
      y: s + qe / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${$i}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Yl,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${$i}--target-marker`,
      type: "text",
      x: Yl / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `Ry(${St(t.params[0])})`
    };
    return i.elem.push(h), i;
  }
}, Kl = tt * 2.3, qi = "crz", Os = {
  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[0], a = t.qubits[1], r = nt(t, l);
    i.y = r.y, i.height = r.height;
    let s = $t(t, n, l), o = $t(t, a, l), _ = {
      id: `layer-${e}--${qi}--connect`,
      type: "line",
      x1: Kl / 2 - 0.5,
      x2: Kl / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + (o > s ? 0 : qe),
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = {
      id: `layer-${e}--${qi}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: Me,
      width: 6,
      height: 6,
      x: Kl / 2 - 3,
      y: s + qe / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${qi}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Kl,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${qi}--target-marker`,
      type: "text",
      x: Kl / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `Rz(${St(t.params[0])})`
    };
    return i.elem.push(h), i;
  }
}, Ul = tt * 5, ji = "cu", Es = {
  name: ji,
  width: Ul,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${ji}--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 = $t(t, n, l), o = $t(t, a, l), _ = {
      id: `layer-${e}--${ji}--connect`,
      type: "line",
      x1: Ul / 2 - 0.5,
      x2: Ul / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + (o > s ? 0 : qe),
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = {
      id: `layer-${e}--${ji}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: Me,
      width: 6,
      height: 6,
      x: Ul / 2 - 3,
      y: s + qe / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${ji}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Ul,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${ji}--target-marker`,
      type: "text",
      x: Ul / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `U(${St(t.params[0])},${St(t.params[1])},${St(t.params[2])},${St(t.params[3])})`
    };
    return i.elem.push(h), i;
  }
}, Wl = tt * 2.3, Ti = "cu1", Is = {
  name: Ti,
  width: Wl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Ti}--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 = $t(t, n, l), o = $t(t, a, l), _ = {
      id: `layer-${e}--${Ti}--connect`,
      type: "line",
      x1: Wl / 2 - 0.5,
      x2: Wl / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + (o > s ? 0 : qe),
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = {
      id: `layer-${e}--${Ti}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: Me,
      width: 6,
      height: 6,
      x: Wl / 2 - 3,
      y: s + qe / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${Ti}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Wl,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${Ti}--target-marker`,
      type: "text",
      x: Wl / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `Ru1(${St(t.params[0])})`
    };
    return i.elem.push(h), i;
  }
}, Jl = tt * 3, Ci = "cu3", Ds = {
  name: Ci,
  width: Jl,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${Ci}--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 = $t(t, n, l), o = $t(t, a, l), _ = {
      id: `layer-${e}--${Ci}--connect`,
      type: "line",
      x1: Jl / 2 - 0.5,
      x2: Jl / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + (o > s ? 0 : qe),
      "stroke-width": 1
    };
    i.elem.push(_);
    let c = {
      id: `layer-${e}--${Ci}--control`,
      type: "rect",
      "stroke-width": 0,
      fill: Me,
      width: 6,
      height: 6,
      x: Jl / 2 - 3,
      y: s + qe / 2 - 3
    };
    i.elem.push(c);
    let d = {
      id: `layer-${e}--${Ci}--target-box`,
      type: "rect",
      "stroke-width": 1,
      stroke: Me,
      fill: it,
      width: Jl,
      x: 0,
      y: o,
      height: qe
    };
    i.elem.push(d);
    let h = {
      id: `layer-${e}--${Ci}--target-marker`,
      type: "text",
      x: Jl / 2,
      y: o + qe / 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      text: `U3(${St(t.params[0])},${St(t.params[1])},${St(t.params[2])})`
    };
    return i.elem.push(h), i;
  }
}, ar = tt * 2.7, an = "cp", Rs = {
  name: an,
  width: ar,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${an}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ar,
      height: 0,
      elem: []
    }, n = t.qubits, a = nt(t, l);
    i.y = a.y, i.height = a.height;
    let r = n.map((p) => $t(t, p, l)), s = Math.min(...r), o = Math.max(...r), _ = (s + o) / 2 + qe / 2, c = {
      id: `layer-${e}--${an}--connect`,
      type: "line",
      x1: tt / 2 - 0.5,
      x2: tt / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + qe / 2,
      "stroke-width": 1
    };
    i.elem.push(c);
    let d = 0;
    for (let p in n) {
      let g = {
        id: `layer-${e}--${an}--control` + d,
        type: "rect",
        "stroke-width": 0,
        fill: Me,
        width: 6,
        height: 6,
        x: tt / 2 - 3,
        y: r[d] + qe / 2 - 3
      };
      i.elem.push(g), d++;
    }
    let h = {
      id: `layer-${e}--${an}--param-text` + d,
      type: "text",
      "stroke-width": 0,
      fill: Me,
      width: ar - tt,
      height: qe,
      x: tt - 3,
      y: _,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: `${St(t.params[0])}`
    };
    return i.elem.push(h), i;
  }
}, rr = tt * 2.7, rn = "rzz", Hs = {
  name: rn,
  width: rr,
  plan: function(t, e, l) {
    let i = {
      id: `layer-${e}--${rn}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: rr,
      height: 0,
      elem: []
    }, n = t.qubits, a = nt(t, l);
    i.y = a.y, i.height = a.height;
    let r = n.map((p) => $t(t, p, l)), s = Math.min(...r), o = Math.max(...r), _ = (s + o) / 2 + qe / 2, c = {
      id: `layer-${e}--${rn}--connect`,
      type: "line",
      x1: tt / 2 - 0.5,
      x2: tt / 2 - 0.5,
      y1: s + qe / 2,
      y2: o + qe / 2,
      "stroke-width": 1
    };
    i.elem.push(c);
    let d = 0;
    for (let p in n) {
      let g = {
        id: `layer-${e}--${rn}--control` + d,
        type: "rect",
        "stroke-width": 0,
        fill: Me,
        width: 6,
        height: 6,
        x: tt / 2 - 3,
        y: r[d] + qe / 2 - 3
      };
      i.elem.push(g), d++;
    }
    let h = {
      id: `layer-${e}--${rn}--param-text` + d,
      type: "text",
      "stroke-width": 0,
      fill: Me,
      width: rr - tt,
      height: qe,
      x: tt - 3,
      y: _,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: `ZZ(${St(t.params[0])})`
    };
    return i.elem.push(h), i;
  }
}, ua = tt * 2.6, Si = "rxx", Ls = {
  name: Si,
  width: ua,
  plan: function(t, e, l) {
    var _, c;
    let i = {
      id: `layer-${e}--${Si}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: ua,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${Si}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: ua,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Si}--qubit-1`,
      type: "text",
      x: et / 2,
      y: qe / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (_ = t.qubits[0]) == null ? void 0 : _.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${Si}--qubit-2`,
      type: "text",
      x: et / 2,
      y: n.height - qe / 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}--${Si}--marker`,
      type: "text",
      x: ua - et / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: `Rxx(${St(t.params[0])})`
    };
    return i.elem.push(o), i;
  }
}, fa = tt * 2.6, Mi = "ryy", Fs = {
  name: Mi,
  width: fa,
  plan: function(t, e, l) {
    var _, c;
    let i = {
      id: `layer-${e}--${Mi}--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}--${Mi}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: fa,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Mi}--qubit-1`,
      type: "text",
      x: et / 2,
      y: qe / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (_ = t.qubits[0]) == null ? void 0 : _.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${Mi}--qubit-2`,
      type: "text",
      x: et / 2,
      y: n.height - qe / 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}--${Mi}--marker`,
      type: "text",
      x: fa - et / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: `Ryy(${St(t.params[0])})`
    };
    return i.elem.push(o), i;
  }
}, _a = tt * 2.6, zi = "rzx", Qs = {
  name: zi,
  width: _a,
  plan: function(t, e, l) {
    var _, c;
    let i = {
      id: `layer-${e}--${zi}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: _a,
      height: 0,
      elem: []
    }, n = nt(t, l);
    i.y = n.y, i.height = n.height;
    let a = {
      id: `layer-${e}--${zi}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: _a,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${zi}--qubit-1`,
      type: "text",
      x: et / 2,
      y: qe / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (_ = t.qubits[0]) == null ? void 0 : _.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${zi}--qubit-2`,
      type: "text",
      x: et / 2,
      y: n.height - qe / 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}--${zi}--marker`,
      type: "text",
      x: _a - et / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: `Rzx(${St(t.params[0])})`
    };
    return i.elem.push(o), i;
  }
}, ca = tt * 4, Ni = "xx_minus_yy", Vs = {
  name: Ni,
  width: ca,
  plan: function(t, e, l) {
    var _, c;
    let i = {
      id: `layer-${e}--${Ni}--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}--${Ni}--wrap`,
      type: "rect",
      strokeWidth: 1,
      strokeColor: Me,
      fill: it,
      width: ca,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Ni}--qubit-1`,
      type: "text",
      x: et / 2,
      y: qe / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (_ = t.qubits[0]) == null ? void 0 : _.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${Ni}--qubit-2`,
      type: "text",
      x: et / 2,
      y: n.height - qe / 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}--${Ni}--marker`,
      type: "text",
      x: ca - et / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: `(XX-YY)(${get_radian_names(t.params[0])},${get_radian_names(t.params[1])})`
    };
    return i.elem.push(o), i;
  }
}, da = tt * 4, Ai = "xx_plus_yy", Xs = {
  name: Ai,
  width: da,
  plan: function(t, e, l) {
    var _, c;
    let i = {
      id: `layer-${e}--${Ai}--group`,
      type: "g",
      x: 0,
      y: 0,
      width: da,
      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: Me,
      fill: it,
      width: da,
      x: 0,
      y: 0,
      height: n.height
    };
    i.elem.push(a);
    let r = {
      id: `layer-${e}--${Ai}--qubit-1`,
      type: "text",
      x: et / 2,
      y: qe / 2,
      "text-anchor": "start",
      "alignment-baseline": "middle",
      text: (_ = t.qubits[0]) == null ? void 0 : _.index
    };
    i.elem.push(r);
    let s = {
      id: `layer-${e}--${Ai}--qubit-2`,
      type: "text",
      x: et / 2,
      y: n.height - qe / 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: da - et / 2,
      y: n.height / 2,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: `(XX+YY)(${get_radian_names(t.params[0])},${get_radian_names(t.params[1])})`
    };
    return i.elem.push(o), i;
  }
};
function H0(t, e, l) {
  let i;
  return ["mcx", "cccx", "c3x", "ccccx", "c4x", "ccx"].includes(t.gate) ? i = D0.plan(t, e, l) : t.gate === $s.name ? i = $s.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 === Jr.name ? i = Jr.plan(t, e, l) : t.gate === Cs.name ? i = Cs.plan(t, e, l) : t.gate === gs.name ? i = gs.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 === ts.name ? i = ts.plan(t, e, l) : t.gate === bs.name ? i = bs.plan(t, e, l) : t.gate === ks.name ? i = ks.plan(t, e, l) : t.gate === vs.name ? i = vs.plan(t, e, l) : t.gate === ys.name ? i = ys.plan(t, e, l) : t.gate === ns.name ? i = ns.plan(t, e, l) : t.gate === as.name ? i = as.plan(t, e, l) : t.gate === rs.name ? i = rs.plan(t, e, l) : t.gate === ss.name ? i = ss.plan(t, e, l) : t.gate === us.name ? i = us.plan(t, e, l) : t.gate === fs.name ? i = fs.plan(t, e, l) : t.gate === os.name ? i = os.plan(t, e, l) : t.gate === ls.name ? i = ls.plan(t, e, l) : t.gate === _s.name ? i = _s.plan(t, e, l) : t.gate === cs.name ? i = cs.plan(t, e, l) : t.gate === ds.name ? i = ds.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 === Ss.name ? i = Ss.plan(t, e, l) : t.gate === As.name ? i = As.plan(t, e, l) : t.gate === Zr.name ? i = Zr.plan(t, e, l) : t.gate === ws.name ? i = ws.plan(t, e, l) : t.gate === Ns.name ? i = Ns.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 === Os.name ? i = Os.plan(t, e, l) : t.gate === Es.name ? i = Es.plan(t, e, l) : t.gate === Is.name ? i = Is.plan(t, e, l) : t.gate === Ds.name ? i = Ds.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 === Ls.name ? i = Ls.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) : ["rccx", "rcccx"].includes(t.gate) ? i = R0.plan(t, e, l) : t.gate === is.name ? i = is.plan(t, e, l) : t.gate === xr.name ? i = xr.plan(t, e, l) : i = I0.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 L0(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 _ = 0; _ < 5; _++)
    a.elem.push({
      type: "text",
      id: "esp-y-axis--label",
      role: "esp-y-axis--label",
      text: _ / 4,
      x: t.x - et * 2,
      y: t.height - t.height * (_ / 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 - et - 1,
    x2: t.x - et - 1,
    y1: -0.5,
    y2: t.height + 0.5,
    stroke: Me,
    "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 _ = 0; _ < 5; _++)
    s.elem.push({
      type: "line",
      id: "esp-h-grid--line",
      role: "esp-h-grid--line",
      x1: -et - 1,
      x2: t.width,
      y1: t.height * (_ / 4),
      y2: t.height * (_ / 4),
      stroke: Me,
      "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 _ = 0; _ < e.layers.length; _++) {
    let c = e.layers[_], d = l[_].width, h = {
      id: `esp-bar-${_}--group`,
      type: "g",
      role: "esp-bar--group",
      x: l[_].x,
      y: 0,
      width: d,
      height: t.height,
      elem: [],
      data: {
        layer_index: _,
        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-${_}--bar-this`,
      role: "esp-bar--bar-this",
      x: d / 2 - Wi,
      y: t.height - p,
      width: Wi,
      height: p,
      "stroke-width": 0,
      fill: "orange"
    });
    let g = c.esp_total * t.height;
    h.elem.push({
      type: "rect",
      id: `esp-bar-${_}--bar-total`,
      role: "esp-bar--bar-total",
      x: d / 2,
      y: t.height - g,
      width: Wi,
      height: g,
      "stroke-width": 0,
      fill: "red"
    }), h.elem.push({
      type: "click-wrap",
      id: `esp-bar-${_}--click-wrap`,
      role: "esp-bar-click-wrap",
      x: d / 2 - Wi,
      y: 0,
      width: Wi * 2,
      height: t.height,
      data: {
        layer_index: _,
        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 kr(t, e) {
  var z, H, B, R, P, O, F, L, 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, _ = !(e != null && e.is_original) && ((z = e == null ? void 0 : e.match) == null ? void 0 : z.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 = Ur + (!(e != null && e.is_original) && ((B = e == null ? void 0 : e.match) != null && B.bit_match) ? Ur * 1.25 : 0), p = t.qubits.map((Q) => Q.index), g = p.length;
  d && ((R = t.match) != null && R.bit_match) ? (p = t.match.bit_match.filter((Q) => !Q.is_ancilla).map((Q) => Q.to), g = p.length) : d && (d = !1);
  let b;
  t.global_phase && (b = {
    type: "g",
    x: De,
    y: De,
    role: "global-phase",
    id: "global-phase",
    elem: []
  }, b.elem.push({
    type: "text",
    x: h,
    y: ui,
    role: "global-phase--marker",
    id: "global-phase--marker",
    "text-anchor": "end",
    "font-size": 10,
    text: `Global phase: ${St(t.global_phase)}`
  }));
  let k = 0, y = {};
  if (g > 0) {
    l += h, n = qe * g + Pt * (g - 1), i += n;
    for (let Q of t.qubits)
      if (!(d && !p.includes(Q.index))) {
        y[Q.index] = k;
        let Z = "", ae;
        !(e != null && e.no_match) && (e != null && e.is_original) ? ae = c.filter((Y) => Y.from == Q.index)[0] : e != null && e.no_match || (ae = c.filter((Y) => Y.to == Q.index)[0]);
        let se = Wt[(ae == null ? void 0 : ae.from) || t.qubits.length];
        _ && (ae && !ae.is_ancilla ? Z = Q.register.name + ae.from + " > " : ae && ae.is_ancilla && (Z = "ancilla/" + ae.to + " > "));
        let K = {
          type: "g",
          x: 0,
          y: (qe + Pt) * k,
          width: h,
          height: qe,
          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: ae,
            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: se
          },
          elem: []
        };
        K.elem.push({
          type: "rect",
          x: 0,
          y: 0,
          width: h,
          height: qe,
          role: "qubit-background",
          "fill-opacity": 0.2,
          stroke: "transparent",
          _class: `qubit-background qubit-${Q.index}` + (e != null && e.is_original ? " original" : " transpiled")
        }), K.elem.push({
          type: "text",
          text: Z + Q.register.name + Q.index,
          "text-anchor": "end",
          "alignment-baseline": "middle",
          x: h,
          y: qe / 2,
          width: h,
          height: qe,
          role: "qubit",
          _class: `qubit qubit-${Q.index}` + (e != null && e.is_original ? " original" : " transpiled")
        }), K.elem.push({
          type: "click-wrap",
          x: 0,
          y: 0,
          width: h,
          height: qe,
          role: "qubit-group-click-wrap",
          data: {
            qubit: Q,
            bit_match: ae,
            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: se
          }
        }), a.push(K), r.push({
          type: "line",
          x1: 0,
          y1: k * (qe + Pt) + qe / 2 - 0.5,
          "stroke-width": 1
        }), k += 1;
      }
  }
  t.num_clbits > 0 && (i += qe + Pt, a.push({
    type: "text",
    text: "C/" + t.num_clbits,
    "text-anchor": "end",
    "alignment-baseline": "middle",
    x: h,
    y: n + Pt + qe / 2,
    width: h,
    height: qe,
    role: "clbit",
    data: t.clbits
  }), a.push({
    type: "click-wrap",
    x: 0,
    y: n + Pt,
    width: h,
    height: qe,
    role: "qubit-group-click-wrap",
    data: t.clbits
  }), r.push({
    type: "double-line",
    x1: 0,
    y1: n + Pt + qe / 2 - 2,
    "stroke-width": 4
  }));
  let v = 0, w = [], q = et, $ = (P = s == null ? void 0 : s.range) != null && P[0] ? Math.max((O = s == null ? void 0 : s.range) == null ? void 0 : O[0], 0) : 0, j = (F = s == null ? void 0 : s.range) != null && F[1] ? Math.min((L = s == null ? void 0 : s.range) == null ? void 0 : L[1], t.layers.length) : t.layers.length;
  for (let Q = 0; Q < t.layers.length; Q++) {
    if (Q < $ || Q >= j)
      continue;
    let Z = t.layers[Q], ae = {
      id: `layer-${o + Q}--group`,
      type: "g",
      role: "layer-group",
      _class: `layer-wrap layer-${o + Q}` + (e != null && e.is_original ? " original" : " transpiled"),
      x: q,
      y: 0,
      width: 0,
      height: i,
      elem: [],
      data: {
        layer: Z,
        layer_index: o + Q,
        tooltip_content: {
          priority: 2,
          Layer: Q,
          "# Operations": Z.operations.length,
          Qubits: ""
        }
      }
    }, se = 0, K = [], Y = Z.operations.length;
    for (let W = 0; W < Z.operations.length; W++) {
      let J = Z.operations[W], ee = H0(J, o + Q, y), we, Re;
      !(e != null && e.no_match) && (e != null && e.is_original) ? (we = vr((X = e == null ? void 0 : e.match) == null ? void 0 : X.layer_match, "o-t", o + Q, W), Re = Wt[(o + Q + W * Y) % Wt.length]) : e != null && e.no_match || (we = vr((V = e == null ? void 0 : e.match) == null ? void 0 : V.layer_match, "t-o", o + Q, W), we && (Re = Wt[(we.layer + we.operation * Y) % Wt.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 = we, ee.data.match_color = Re, 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}--${J.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
      })), ae.elem.push(ee), se = Math.max(se, (ee == null ? void 0 : ee.width) || 32), J.qubits.forEach((ve) => {
        K.includes(ve.index) || K.push(ve.index);
      });
    }
    ae.width = se, ae.data.tooltip_content.Qubits = "[" + K.join(", ") + "]", ae.elem.forEach((W) => {
      W && W.width < se && (W.x += (se - W.width) / 2);
    }), ae.elem.unshift({
      id: `layer-${o + Q}--interaction-wrap`,
      _class: "interation-wrap",
      type: "rect",
      x: -(et / 2),
      y: e != null && e.show_moments ? -ui - Pt - De : 0,
      width: se + et,
      height: e != null && e.show_moments ? i + ui + Pt + De * 2 : i,
      fill: "rgba(0, 0, 0, 0)",
      stroke: "transparent"
    }), q = q + se + et, v = v + se + et, w.push(ae);
  }
  v = v + et, l += v + et, r.forEach((Q) => {
    Q.x2 = v, Q.y2 = Q.y1;
  });
  let I, A;
  t.esp !== void 0 && ([I, A] = L0(
    {
      x: De + h + et,
      y: i + Pt * 4,
      width: v,
      height: Wr
    },
    t,
    w
  ), i += Wr + Pt * 4);
  let M = {
    type: "svg",
    width: l + De * 2,
    height: i + De * 2,
    viewBox: [0, 0, l + De * 2, i + De * 2],
    groups: {
      qubit_group: {
        id: "qubits--group",
        type: "g",
        x: De,
        y: De,
        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: De + h + et,
        y: De,
        width: v,
        height: i,
        elem: r,
        role: "circuit_lines"
      },
      circuit_group: {
        id: "circuit-body--group",
        type: "g",
        x: De + h + et,
        y: De,
        width: v,
        height: i,
        elem: w,
        role: "circuit_body",
        data: t.layers
      },
      phase_marker: b,
      esp_group: A,
      esp_axis_group: I
    }
  };
  if (e != null && e.show_moments) {
    let Q = {
      id: "moment--group",
      type: "g",
      x: De + h + et,
      y: De,
      width: v,
      height: ui,
      elem: []
    };
    Q.elem = w.map((ae, se) => ({
      id: `moment-${ae.data.layer_index}--marker`,
      type: "text",
      text: ae.data.layer_index,
      x: ae.x + ae.width / 2,
      y: ui / 2,
      "font-size": 10,
      data: ae.data,
      "text-anchor": "middle",
      "alignment-baseline": "middle"
    }));
    let Z = ui + Pt;
    M.height += Z, M.viewBox[3] += Z, M.groups.qubit_group.y += Z, M.groups.circuit_line_group.y += Z, M.groups.circuit_group.y += Z, M.groups.esp_group && (M.groups.esp_group.y += Z), M.groups.esp_axis_group && (M.groups.esp_axis_group.y += Z), M.groups.moment_group = Q;
  }
  return M;
}
function vr(t, e, l, i) {
  var n, a;
  if (e === "o-t") {
    let r = (n = t.filter((s) => {
      var o, _;
      return ((o = s == null ? void 0 : s.from) == null ? void 0 : o[0]) == l && ((_ = s == null ? void 0 : s.from) == null ? void 0 : _[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 Gs(t) {
  let e, l, i, n, a, r, s, o, _, c, d;
  return {
    c() {
      e = Ge("polygon"), u(e, "id", l = /*data*/
      t[0].id), u(e, "class", i = /*data*/
      t[0]._class), u(e, "data-role", n = /*data*/
      t[0].role), u(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}`), u(e, "stroke", r = /*data*/
      t[0].stroke || Me), u(e, "stroke-width", s = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), u(e, "fill", o = /*data*/
      t[0].fill || it), u(e, "fill-opacity", _ = /*data*/
      t[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        t[0]["fill-opacity"]
      ) : 1), u(e, "transform", c = `rotate(${/*data*/
      (t[0].rotate || 0) + 90})`), u(e, "transform-origin", d = `${/*data*/
      t[0].x} ${/*data*/
      t[0].y}`);
    },
    m(h, p) {
      S(h, e, p);
    },
    p(h, p) {
      p & /*data*/
      1 && l !== (l = /*data*/
      h[0].id) && u(e, "id", l), p & /*data*/
      1 && i !== (i = /*data*/
      h[0]._class) && u(e, "class", i), p & /*data*/
      1 && n !== (n = /*data*/
      h[0].role) && u(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}`) && u(e, "points", a), p & /*data*/
      1 && r !== (r = /*data*/
      h[0].stroke || Me) && u(e, "stroke", r), p & /*data*/
      1 && s !== (s = /*data*/
      h[0]["stroke-width"] !== void 0 ? (
        /*data*/
        h[0]["stroke-width"]
      ) : 1) && u(e, "stroke-width", s), p & /*data*/
      1 && o !== (o = /*data*/
      h[0].fill || it) && u(e, "fill", o), p & /*data*/
      1 && _ !== (_ = /*data*/
      h[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        h[0]["fill-opacity"]
      ) : 1) && u(e, "fill-opacity", _), p & /*data*/
      1 && c !== (c = `rotate(${/*data*/
      (h[0].rotate || 0) + 90})`) && u(e, "transform", c), p & /*data*/
      1 && d !== (d = `${/*data*/
      h[0].x} ${/*data*/
      h[0].y}`) && u(e, "transform-origin", d);
    },
    d(h) {
      h && C(e);
    }
  };
}
function F0(t) {
  let e, l = (
    /*data*/
    t[0] && Gs(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = Gs(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function Q0(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
class V0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, Q0, F0, Fe, { data: 0 });
  }
}
function Ys(t) {
  let e, l, i, n, a, r, s, o, _, c, d;
  return {
    c() {
      e = Ge("circle"), u(e, "id", l = /*data*/
      t[0].id), u(e, "class", i = /*data*/
      t[0]._class), u(e, "data-role", n = /*data*/
      t[0].role), u(e, "cx", a = /*data*/
      t[0].cx), u(e, "cy", r = /*data*/
      t[0].cy), u(e, "r", s = /*data*/
      t[0].r), u(e, "stroke", o = /*data*/
      t[0].stroke || Me), u(e, "stroke-width", _ = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), u(e, "fill", c = /*data*/
      t[0].fill || it), u(e, "fill-opacity", d = /*data*/
      t[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        t[0]["fill-opacity"]
      ) : 1);
    },
    m(h, p) {
      S(h, e, p);
    },
    p(h, p) {
      p & /*data*/
      1 && l !== (l = /*data*/
      h[0].id) && u(e, "id", l), p & /*data*/
      1 && i !== (i = /*data*/
      h[0]._class) && u(e, "class", i), p & /*data*/
      1 && n !== (n = /*data*/
      h[0].role) && u(e, "data-role", n), p & /*data*/
      1 && a !== (a = /*data*/
      h[0].cx) && u(e, "cx", a), p & /*data*/
      1 && r !== (r = /*data*/
      h[0].cy) && u(e, "cy", r), p & /*data*/
      1 && s !== (s = /*data*/
      h[0].r) && u(e, "r", s), p & /*data*/
      1 && o !== (o = /*data*/
      h[0].stroke || Me) && u(e, "stroke", o), p & /*data*/
      1 && _ !== (_ = /*data*/
      h[0]["stroke-width"] !== void 0 ? (
        /*data*/
        h[0]["stroke-width"]
      ) : 1) && u(e, "stroke-width", _), p & /*data*/
      1 && c !== (c = /*data*/
      h[0].fill || it) && u(e, "fill", c), p & /*data*/
      1 && d !== (d = /*data*/
      h[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        h[0]["fill-opacity"]
      ) : 1) && u(e, "fill-opacity", d);
    },
    d(h) {
      h && C(e);
    }
  };
}
function X0(t) {
  let e, l = (
    /*data*/
    t[0] && Ys(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = Ys(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function G0(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
class Y0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, G0, X0, Fe, { data: 0 });
  }
}
function Ks(t) {
  let e, l, i, n, a, r, s, o, _, c;
  return {
    c() {
      e = Ge("rect"), u(e, "id", l = /*data*/
      t[0].id), u(e, "class", i = /*data*/
      t[0]._class + " click-wrap"), u(e, "data-role", n = /*data*/
      t[0].role), u(e, "x", a = /*data*/
      t[0].x), u(e, "y", r = /*data*/
      t[0].y), u(e, "width", s = /*data*/
      t[0].width), u(e, "height", o = /*data*/
      t[0].height), u(e, "stroke", "transparent"), u(e, "stroke-width", "0"), u(e, "fill", "transparent");
    },
    m(d, h) {
      S(d, e, h), _ || (c = te(
        e,
        "dblclick",
        /*dblclick_handler*/
        t[2]
      ), _ = !0);
    },
    p(d, h) {
      h & /*data*/
      1 && l !== (l = /*data*/
      d[0].id) && u(e, "id", l), h & /*data*/
      1 && i !== (i = /*data*/
      d[0]._class + " click-wrap") && u(e, "class", i), h & /*data*/
      1 && n !== (n = /*data*/
      d[0].role) && u(e, "data-role", n), h & /*data*/
      1 && a !== (a = /*data*/
      d[0].x) && u(e, "x", a), h & /*data*/
      1 && r !== (r = /*data*/
      d[0].y) && u(e, "y", r), h & /*data*/
      1 && s !== (s = /*data*/
      d[0].width) && u(e, "width", s), h & /*data*/
      1 && o !== (o = /*data*/
      d[0].height) && u(e, "height", o);
    },
    d(d) {
      d && C(e), _ = !1, c();
    }
  };
}
function K0(t) {
  let e, l = (
    /*data*/
    t[0] && Ks(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = Ks(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function U0(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 W0 = class extends Ve {
  constructor(e) {
    super(), Qe(this, e, U0, K0, Fe, { data: 0, open_tool: 1 });
  }
};
function Us(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w;
  return {
    c() {
      e = Ge("line"), c = N(), d = Ge("line"), u(e, "id", l = /*data*/
      t[0].id + "--top"), u(e, "class", i = /*data*/
      t[0]._class), u(e, "data-role", n = /*data*/
      t[0].role), u(e, "x1", a = /*data*/
      t[0].x1), u(e, "y1", r = /*data*/
      t[0].y1 - /*gap*/
      t[1] / 2), u(e, "x2", s = /*data*/
      t[0].x2 !== void 0 ? (
        /*data*/
        t[0].x2
      ) : (
        /*data*/
        t[0].x1
      )), u(e, "y2", o = /*data*/
      (t[0].y2 !== void 0 ? (
        /*data*/
        t[0].y2
      ) : (
        /*data*/
        t[0].y1
      )) - /*gap*/
      t[1] / 2), u(e, "stroke", _ = /*data*/
      t[0].stroke || Me), u(e, "stroke-width", 1), u(d, "id", h = /*data*/
      t[0].id + "--bottom"), u(d, "class", p = /*data*/
      t[0]._class), u(d, "data-role", g = /*data*/
      t[0].role), u(d, "x1", b = /*data*/
      t[0].x1), u(d, "y1", k = /*data*/
      t[0].y1 + /*gap*/
      t[1] / 2), u(d, "x2", y = /*data*/
      t[0].x2 !== void 0 ? (
        /*data*/
        t[0].x2
      ) : (
        /*data*/
        t[0].x1
      )), u(d, "y2", v = /*data*/
      (t[0].y2 !== void 0 ? (
        /*data*/
        t[0].y2
      ) : (
        /*data*/
        t[0].y1
      )) + /*gap*/
      t[1] / 2), u(d, "stroke", w = /*data*/
      t[0].stroke || Me), u(d, "stroke-width", 1);
    },
    m(q, $) {
      S(q, e, $), S(q, c, $), S(q, d, $);
    },
    p(q, $) {
      $ & /*data*/
      1 && l !== (l = /*data*/
      q[0].id + "--top") && u(e, "id", l), $ & /*data*/
      1 && i !== (i = /*data*/
      q[0]._class) && u(e, "class", i), $ & /*data*/
      1 && n !== (n = /*data*/
      q[0].role) && u(e, "data-role", n), $ & /*data*/
      1 && a !== (a = /*data*/
      q[0].x1) && u(e, "x1", a), $ & /*data, gap*/
      3 && r !== (r = /*data*/
      q[0].y1 - /*gap*/
      q[1] / 2) && u(e, "y1", r), $ & /*data*/
      1 && s !== (s = /*data*/
      q[0].x2 !== void 0 ? (
        /*data*/
        q[0].x2
      ) : (
        /*data*/
        q[0].x1
      )) && u(e, "x2", s), $ & /*data, gap*/
      3 && o !== (o = /*data*/
      (q[0].y2 !== void 0 ? (
        /*data*/
        q[0].y2
      ) : (
        /*data*/
        q[0].y1
      )) - /*gap*/
      q[1] / 2) && u(e, "y2", o), $ & /*data*/
      1 && _ !== (_ = /*data*/
      q[0].stroke || Me) && u(e, "stroke", _), $ & /*data*/
      1 && h !== (h = /*data*/
      q[0].id + "--bottom") && u(d, "id", h), $ & /*data*/
      1 && p !== (p = /*data*/
      q[0]._class) && u(d, "class", p), $ & /*data*/
      1 && g !== (g = /*data*/
      q[0].role) && u(d, "data-role", g), $ & /*data*/
      1 && b !== (b = /*data*/
      q[0].x1) && u(d, "x1", b), $ & /*data, gap*/
      3 && k !== (k = /*data*/
      q[0].y1 + /*gap*/
      q[1] / 2) && u(d, "y1", k), $ & /*data*/
      1 && y !== (y = /*data*/
      q[0].x2 !== void 0 ? (
        /*data*/
        q[0].x2
      ) : (
        /*data*/
        q[0].x1
      )) && u(d, "x2", y), $ & /*data, gap*/
      3 && v !== (v = /*data*/
      (q[0].y2 !== void 0 ? (
        /*data*/
        q[0].y2
      ) : (
        /*data*/
        q[0].y1
      )) + /*gap*/
      q[1] / 2) && u(d, "y2", v), $ & /*data*/
      1 && w !== (w = /*data*/
      q[0].stroke || Me) && u(d, "stroke", w);
    },
    d(q) {
      q && (C(e), C(c), C(d));
    }
  };
}
function J0(t) {
  let e, l = (
    /*data*/
    t[0] && Us(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = Us(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function Z0(t, e, l) {
  let { data: i = {} } = e, n = 0;
  return Tt(() => {
    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 x0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, Z0, J0, Fe, { data: 0 });
  }
}
function Ws(t, e, l) {
  const i = t.slice();
  return i[11] = e[l], i;
}
function Js(t) {
  let e, l, i, n, a, r, s, o, _, c, d = $e(
    /*data*/
    t[0].elem
  ), h = [];
  for (let g = 0; g < d.length; g += 1)
    h[g] = Zs(Ws(t, d, g));
  const p = (g) => D(h[g], 1, 1, () => {
    h[g] = null;
  });
  return {
    c() {
      e = Ge("g");
      for (let g = 0; g < h.length; g += 1)
        h[g].c();
      u(e, "id", l = /*data*/
      t[0].id), u(e, "class", i = /*data*/
      t[0]._class), u(e, "data-role", n = /*data*/
      t[0].role), u(e, "height", a = /*data*/
      t[0].height), u(e, "width", r = /*data*/
      t[0].width), u(e, "transform", s = `translate(${/*data*/
      t[0].x} ${/*data*/
      t[0].y})`);
    },
    m(g, b) {
      S(g, e, b);
      for (let k = 0; k < h.length; k += 1)
        h[k] && h[k].m(e, null);
      o = !0, _ || (c = [
        te(
          e,
          "mouseover",
          /*mouseover_handler*/
          t[5]
        ),
        te(
          e,
          "mousemove",
          /*mousemove_handler*/
          t[6]
        ),
        te(
          e,
          "mouseout",
          /*mouseout_handler*/
          t[7]
        ),
        te(
          e,
          "click",
          /*click_handler*/
          t[8]
        ),
        te(
          e,
          "blur",
          /*blur_handler*/
          t[9]
        ),
        te(
          e,
          "focus",
          /*focus_handler*/
          t[10]
        )
      ], _ = !0);
    },
    p(g, b) {
      if (b & /*data, open_tool, openTooltip, closeTooltip, moveTooltip*/
      31) {
        d = $e(
          /*data*/
          g[0].elem
        );
        let k;
        for (k = 0; k < d.length; k += 1) {
          const y = Ws(g, d, k);
          h[k] ? (h[k].p(y, b), T(h[k], 1)) : (h[k] = Zs(y), h[k].c(), T(h[k], 1), h[k].m(e, null));
        }
        for (be(), k = d.length; k < h.length; k += 1)
          p(k);
        ke();
      }
      (!o || b & /*data*/
      1 && l !== (l = /*data*/
      g[0].id)) && u(e, "id", l), (!o || b & /*data*/
      1 && i !== (i = /*data*/
      g[0]._class)) && u(e, "class", i), (!o || b & /*data*/
      1 && n !== (n = /*data*/
      g[0].role)) && u(e, "data-role", n), (!o || b & /*data*/
      1 && a !== (a = /*data*/
      g[0].height)) && u(e, "height", a), (!o || b & /*data*/
      1 && r !== (r = /*data*/
      g[0].width)) && u(e, "width", r), (!o || b & /*data*/
      1 && s !== (s = `translate(${/*data*/
      g[0].x} ${/*data*/
      g[0].y})`)) && u(e, "transform", s);
    },
    i(g) {
      if (!o) {
        for (let b = 0; b < d.length; b += 1)
          T(h[b]);
        o = !0;
      }
    },
    o(g) {
      h = h.filter(Boolean);
      for (let b = 0; b < h.length; b += 1)
        D(h[b]);
      o = !1;
    },
    d(g) {
      g && C(e), Ye(h, g), _ = !1, wt(c);
    }
  };
}
function Zs(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*el*/
        t[11]
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      ),
      openTooltip: (
        /*openTooltip*/
        t[2]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[3]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[4]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function eg(t) {
  let e, l, i = (
    /*data*/
    t[0] && Js(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(n, a) {
      i && i.m(n, a), S(n, e, a), l = !0;
    },
    p(n, [a]) {
      /*data*/
      n[0] ? i ? (i.p(n, a), a & /*data*/
      1 && T(i, 1)) : (i = Js(n), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d(n);
    }
  };
}
function xs(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 _;
    return document.querySelector(`#circuit-viewer-${t.data.unit_id} #${o}-sticky .qubit-background.qubit-${(_ = t.data.bit_match) == null ? void 0 : _.to}`);
  }), i = t.data.matched_machine_id.map((o) => {
    var _;
    return document.querySelector(`#circuit-viewer-${t.data.unit_id} #${o} #qubit-node-${(_ = t.data.bit_match) == null ? void 0 : _.to}--group`);
  })) : t._class.includes(" transpiled") ? (e = t.data.matched_circuit_id.map((o) => {
    var _;
    return document.querySelector(`#circuit-viewer-${t.data.unit_id} #${o}-sticky .qubit-background.qubit-${(_ = t.data.bit_match) == null ? void 0 : _.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 _;
    return document.querySelector(`#circuit-viewer-${t.data.unit_id} #${o} #qubit-node-${(_ = t.data.bit_match) == null ? void 0 : _.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 ha(t) {
  var i, n, a, r, s, o, _, 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((g) => document.querySelector(`#circuit-viewer-${t.data.unit_id} #${g} #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((g) => document.querySelector(`#circuit-viewer-${t.data.unit_id} #${g} .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 g;
    return document.querySelector(`#circuit-viewer-${t.data.unit_id} #${p} #layer-${(g = t.data.layer_match) == null ? void 0 : g.layer}--interaction-wrap`);
  })), l = ((c = (_ = (o = t == null ? void 0 : t.data) == null ? void 0 : o.layer_match) == null ? void 0 : _.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 g, b;
    return document.querySelector(`#circuit-viewer-${t.data.unit_id} #${p} .gate-wrap.layer-${(g = t.data.layer_match) == null ? void 0 : g.layer}.gate-${(b = t.data.layer_match) == null ? void 0 : b.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 eo(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 sr(t) {
  return "<table>" + Object.keys(t).map((e) => e === "priority" ? "" : `<tr><th>${e}:</th><td>${t[e]}</td></tr>`).join(" ") + "</table>";
}
function tg(t, e, l) {
  let { data: i = {}, open_tool: n = () => {
  }, openTooltip: a = () => {
  }, closeTooltip: r = () => {
  }, moveTooltip: s = () => {
  } } = e;
  const o = (g) => {
    var b;
    if (i.role === "qubit-group" || i.role === "qubit-node--group") {
      let [k, y, v] = xs(i);
      k && (k.style.fill = i.data.match_color), y && (y.style.fill = i.data.match_color), v && (v.style.outline = `2px solid  ${i.data.match_color}`);
    } else if (i.role === "gate-group") {
      let [k, y] = ha(i);
      k && k.forEach((v) => {
        v && (v.style.fill = i.data.match_color, v.style.fillOpacity = 0.2);
      }), y && y.forEach((v) => {
        v && (v.style.outline = `2px solid  ${i.data.match_color}`);
      });
    } else if (i.role === "op-layer-operation-group") {
      let [k, y] = ha(i);
      k && k.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 [v] = eo(i);
      v && v.forEach((w) => {
        w && (w.style.outline = `2px solid  ${i.data.match_color}`);
      });
    }
    if ((b = i == null ? void 0 : i.data) != null && b.tooltip_content) {
      let k = sr(i.data.tooltip_content);
      a(g, k, !1, i.data.tooltip_content.priority);
    }
  }, _ = (g) => {
    s(g);
  }, c = (g) => {
    var b;
    if (i.role === "qubit-group" || i.role === "qubit-node--group") {
      let [k, y, v] = xs(i);
      k && (k.style.fill = "transparent"), y && (y.style.fill = "transparent"), v && (v.style.outline = null);
    } else if (i.role === "gate-group") {
      let [k, y] = ha(i);
      k && k.forEach((v) => {
        v && (v.style.fill = "transparent");
      }), y && y.forEach((v) => {
        v && (v.style.outline = null);
      });
    } else if (i.role === "op-layer-operation-group") {
      let [k, y] = ha(i);
      k && k.forEach((w) => {
        w && (w.style.outline = null);
      }), y && y.forEach((w) => {
        w && (w.style.outline = null);
      });
      let [v] = eo(i);
      v && v.forEach((w) => {
        w && (w.style.outline = null);
      });
    }
    (b = i == null ? void 0 : i.data) != null && b.tooltip_content && r();
  }, d = (g) => {
    var b;
    if (g.preventDefault(), (b = i == null ? void 0 : i.data) != null && b.tooltip_content) {
      let k = sr(i.data.tooltip_content);
      a(g, k, !0, i.data.tooltip_content.priority);
    }
  }, h = (g) => {
    g.preventDefault(), r(!0);
  }, p = (g) => {
    var b;
    if (g.preventDefault(), (b = i == null ? void 0 : i.data) != null && b.tooltip_content) {
      let k = sr(i.data.tooltip_content);
      a(g, k, !0, i.data.tooltip_content.priority);
    }
  };
  return t.$$set = (g) => {
    "data" in g && l(0, i = g.data), "open_tool" in g && l(1, n = g.open_tool), "openTooltip" in g && l(2, a = g.openTooltip), "closeTooltip" in g && l(3, r = g.closeTooltip), "moveTooltip" in g && l(4, s = g.moveTooltip);
  }, [
    i,
    n,
    a,
    r,
    s,
    o,
    _,
    c,
    d,
    h,
    p
  ];
}
class lg extends Ve {
  constructor(e) {
    super(), Qe(this, e, tg, eg, Fe, {
      data: 0,
      open_tool: 1,
      openTooltip: 2,
      closeTooltip: 3,
      moveTooltip: 4
    });
  }
}
function to(t) {
  let e, l, i, n, a, r, s, o, _, c, d;
  return {
    c() {
      e = Ge("line"), u(e, "id", l = /*data*/
      t[0].id), u(e, "class", i = /*data*/
      t[0]._class), u(e, "data-role", n = /*data*/
      t[0].role), u(e, "x1", a = /*data*/
      t[0].x1), u(e, "y1", r = /*data*/
      t[0].y1), u(e, "x2", s = /*data*/
      t[0].x2 !== void 0 ? (
        /*data*/
        t[0].x2
      ) : (
        /*data*/
        t[0].x1
      )), u(e, "y2", o = /*data*/
      t[0].y2 !== void 0 ? (
        /*data*/
        t[0].y2
      ) : (
        /*data*/
        t[0].y1
      )), u(e, "stroke", _ = /*data*/
      t[0].stroke || Me), u(e, "stroke-width", c = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), u(e, "stroke-opacity", d = /*data*/
      t[0]["stroke-opacity"] !== void 0 ? (
        /*data*/
        t[0]["stroke-opacity"]
      ) : 1);
    },
    m(h, p) {
      S(h, e, p);
    },
    p(h, p) {
      p & /*data*/
      1 && l !== (l = /*data*/
      h[0].id) && u(e, "id", l), p & /*data*/
      1 && i !== (i = /*data*/
      h[0]._class) && u(e, "class", i), p & /*data*/
      1 && n !== (n = /*data*/
      h[0].role) && u(e, "data-role", n), p & /*data*/
      1 && a !== (a = /*data*/
      h[0].x1) && u(e, "x1", a), p & /*data*/
      1 && r !== (r = /*data*/
      h[0].y1) && u(e, "y1", r), p & /*data*/
      1 && s !== (s = /*data*/
      h[0].x2 !== void 0 ? (
        /*data*/
        h[0].x2
      ) : (
        /*data*/
        h[0].x1
      )) && u(e, "x2", s), p & /*data*/
      1 && o !== (o = /*data*/
      h[0].y2 !== void 0 ? (
        /*data*/
        h[0].y2
      ) : (
        /*data*/
        h[0].y1
      )) && u(e, "y2", o), p & /*data*/
      1 && _ !== (_ = /*data*/
      h[0].stroke || Me) && u(e, "stroke", _), p & /*data*/
      1 && c !== (c = /*data*/
      h[0]["stroke-width"] !== void 0 ? (
        /*data*/
        h[0]["stroke-width"]
      ) : 1) && u(e, "stroke-width", c), p & /*data*/
      1 && d !== (d = /*data*/
      h[0]["stroke-opacity"] !== void 0 ? (
        /*data*/
        h[0]["stroke-opacity"]
      ) : 1) && u(e, "stroke-opacity", d);
    },
    d(h) {
      h && C(e);
    }
  };
}
function ig(t) {
  let e, l = (
    /*data*/
    t[0] && to(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*data*/
      i[0] ? l ? l.p(i, n) : (l = to(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function ng(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
class fm extends Ve {
  constructor(e) {
    super(), Qe(this, e, ng, ig, Fe, { data: 0 });
  }
}
function lo(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p;
  return {
    c() {
      e = Ge("rect"), u(e, "id", l = /*data*/
      t[0].id), u(e, "class", i = /*data*/
      t[0]._class), u(e, "data-role", n = /*data*/
      t[0].role), u(e, "x", a = /*data*/
      t[0].x), u(e, "y", r = /*data*/
      t[0].y), u(e, "width", s = /*data*/
      t[0].width), u(e, "height", o = /*data*/
      t[0].height), u(e, "stroke", _ = /*data*/
      t[0].stroke || Me), u(e, "stroke-width", c = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), u(e, "fill", d = /*data*/
      t[0].fill || it), u(e, "fill-opacity", h = /*data*/
      t[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        t[0]["fill-opacity"]
      ) : 1), u(e, "transform", p = /*data*/
      t[0].transform);
    },
    m(g, b) {
      S(g, e, b);
    },
    p(g, b) {
      b & /*data*/
      1 && l !== (l = /*data*/
      g[0].id) && u(e, "id", l), b & /*data*/
      1 && i !== (i = /*data*/
      g[0]._class) && u(e, "class", i), b & /*data*/
      1 && n !== (n = /*data*/
      g[0].role) && u(e, "data-role", n), b & /*data*/
      1 && a !== (a = /*data*/
      g[0].x) && u(e, "x", a), b & /*data*/
      1 && r !== (r = /*data*/
      g[0].y) && u(e, "y", r), b & /*data*/
      1 && s !== (s = /*data*/
      g[0].width) && u(e, "width", s), b & /*data*/
      1 && o !== (o = /*data*/
      g[0].height) && u(e, "height", o), b & /*data*/
      1 && _ !== (_ = /*data*/
      g[0].stroke || Me) && u(e, "stroke", _), b & /*data*/
      1 && c !== (c = /*data*/
      g[0]["stroke-width"] !== void 0 ? (
        /*data*/
        g[0]["stroke-width"]
      ) : 1) && u(e, "stroke-width", c), b & /*data*/
      1 && d !== (d = /*data*/
      g[0].fill || it) && u(e, "fill", d), b & /*data*/
      1 && h !== (h = /*data*/
      g[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        g[0]["fill-opacity"]
      ) : 1) && u(e, "fill-opacity", h), b & /*data*/
      1 && p !== (p = /*data*/
      g[0].transform) && u(e, "transform", p);
    },
    d(g) {
      g && C(e);
    }
  };
}
function ag(t) {
  let e, l = (
    /*data*/
    t[0] && lo(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(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: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function rg(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
class sg extends Ve {
  constructor(e) {
    super(), Qe(this, e, rg, ag, Fe, { data: 0 });
  }
}
function io(t) {
  let e, l = (
    /*data*/
    t[0].text + ""
  ), i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w;
  return {
    c() {
      e = Ge("text"), i = E(l), u(e, "id", n = /*data*/
      t[0].id), u(e, "class", a = Yt(
        /*data*/
        t[0]._class
      ) + " svelte-128zimx"), u(e, "data-role", r = /*data*/
      t[0].role), u(e, "x", s = /*data*/
      t[0].x), u(e, "y", o = /*data*/
      t[0].y), u(e, "width", _ = /*data*/
      t[0].width), u(e, "height", c = /*data*/
      t[0].height), u(e, "text-anchor", d = /*data*/
      t[0]["text-anchor"]), u(e, "alignment-baseline", h = /*data*/
      t[0]["alignment-baseline"]), u(e, "font-size", p = /*data*/
      t[0]["font-size"] || 12), u(e, "font-weight", g = /*data*/
      t[0]["font-weight"]), u(e, "font-style", b = /*data*/
      t[0]["font-style"]), u(e, "fill", k = /*data*/
      t[0].fill), u(e, "transform", y = /*data*/
      t[0].transform), u(e, "stroke", v = /*data*/
      t[0].stroke || "#000000"), u(e, "stroke-width", w = /*data*/
      t[0]["stroke-width"] || 0);
    },
    m(q, $) {
      S(q, e, $), f(e, i);
    },
    p(q, $) {
      $ & /*data*/
      1 && l !== (l = /*data*/
      q[0].text + "") && U(i, l), $ & /*data*/
      1 && n !== (n = /*data*/
      q[0].id) && u(e, "id", n), $ & /*data*/
      1 && a !== (a = Yt(
        /*data*/
        q[0]._class
      ) + " svelte-128zimx") && u(e, "class", a), $ & /*data*/
      1 && r !== (r = /*data*/
      q[0].role) && u(e, "data-role", r), $ & /*data*/
      1 && s !== (s = /*data*/
      q[0].x) && u(e, "x", s), $ & /*data*/
      1 && o !== (o = /*data*/
      q[0].y) && u(e, "y", o), $ & /*data*/
      1 && _ !== (_ = /*data*/
      q[0].width) && u(e, "width", _), $ & /*data*/
      1 && c !== (c = /*data*/
      q[0].height) && u(e, "height", c), $ & /*data*/
      1 && d !== (d = /*data*/
      q[0]["text-anchor"]) && u(e, "text-anchor", d), $ & /*data*/
      1 && h !== (h = /*data*/
      q[0]["alignment-baseline"]) && u(e, "alignment-baseline", h), $ & /*data*/
      1 && p !== (p = /*data*/
      q[0]["font-size"] || 12) && u(e, "font-size", p), $ & /*data*/
      1 && g !== (g = /*data*/
      q[0]["font-weight"]) && u(e, "font-weight", g), $ & /*data*/
      1 && b !== (b = /*data*/
      q[0]["font-style"]) && u(e, "font-style", b), $ & /*data*/
      1 && k !== (k = /*data*/
      q[0].fill) && u(e, "fill", k), $ & /*data*/
      1 && y !== (y = /*data*/
      q[0].transform) && u(e, "transform", y), $ & /*data*/
      1 && v !== (v = /*data*/
      q[0].stroke || "#000000") && u(e, "stroke", v), $ & /*data*/
      1 && w !== (w = /*data*/
      q[0]["stroke-width"] || 0) && u(e, "stroke-width", w);
    },
    d(q) {
      q && C(e);
    }
  };
}
function og(t) {
  let e, l = (
    /*data*/
    t[0] && io(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(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: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function ug(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
class _m extends Ve {
  constructor(e) {
    super(), Qe(this, e, ug, og, Fe, { data: 0 });
  }
}
function no(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R;
  return {
    c() {
      e = Ge("g"), l = Ge("line"), b = N(), k = Ge("g"), y = Ge("line"), u(l, "id", i = /*data*/
      t[0].id + "-0"), u(l, "x1", n = /*data*/
      t[0].cx), u(l, "y1", a = /*data*/
      t[0].cy), u(l, "x2", r = /*data*/
      t[0].cx + /*data*/
      t[0].width), u(l, "y2", s = /*data*/
      t[0].cy + /*data*/
      t[0].height), u(l, "stroke", o = /*data*/
      t[0].stroke || Me), u(l, "stroke-width", _ = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), u(l, "stroke-opacity", c = /*data*/
      t[0]["stroke-opacity"] !== void 0 ? (
        /*data*/
        t[0]["stroke-opacity"]
      ) : 1), u(l, "transform", d = `translate(-${/*data*/
      t[0].width / 2}, -${/*data*/
      t[0].height / 2})`), u(e, "id", h = /*data*/
      t[0].id), u(e, "class", p = /*data*/
      t[0]._class), u(e, "data-role", g = /*data*/
      t[0].role), u(y, "id", v = /*data*/
      t[0].id + "-0"), u(y, "x1", w = /*data*/
      t[0].cx + /*data*/
      t[0].width), u(y, "y1", q = /*data*/
      t[0].cy), u(y, "x2", $ = /*data*/
      t[0].cx), u(y, "y2", j = /*data*/
      t[0].cy + /*data*/
      t[0].height), u(y, "stroke", I = /*data*/
      t[0].stroke || Me), u(y, "stroke-width", A = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), u(y, "stroke-opacity", M = /*data*/
      t[0]["stroke-opacity"] !== void 0 ? (
        /*data*/
        t[0]["stroke-opacity"]
      ) : 1), u(y, "transform", z = `translate(-${/*data*/
      t[0].width / 2}, -${/*data*/
      t[0].height / 2})`), u(k, "id", H = /*data*/
      t[0].id), u(k, "class", B = /*data*/
      t[0]._class), u(k, "data-role", R = /*data*/
      t[0].role);
    },
    m(P, O) {
      S(P, e, O), f(e, l), S(P, b, O), S(P, k, O), f(k, y);
    },
    p(P, O) {
      O & /*data*/
      1 && i !== (i = /*data*/
      P[0].id + "-0") && u(l, "id", i), O & /*data*/
      1 && n !== (n = /*data*/
      P[0].cx) && u(l, "x1", n), O & /*data*/
      1 && a !== (a = /*data*/
      P[0].cy) && u(l, "y1", a), O & /*data*/
      1 && r !== (r = /*data*/
      P[0].cx + /*data*/
      P[0].width) && u(l, "x2", r), O & /*data*/
      1 && s !== (s = /*data*/
      P[0].cy + /*data*/
      P[0].height) && u(l, "y2", s), O & /*data*/
      1 && o !== (o = /*data*/
      P[0].stroke || Me) && u(l, "stroke", o), O & /*data*/
      1 && _ !== (_ = /*data*/
      P[0]["stroke-width"] !== void 0 ? (
        /*data*/
        P[0]["stroke-width"]
      ) : 1) && u(l, "stroke-width", _), O & /*data*/
      1 && c !== (c = /*data*/
      P[0]["stroke-opacity"] !== void 0 ? (
        /*data*/
        P[0]["stroke-opacity"]
      ) : 1) && u(l, "stroke-opacity", c), O & /*data*/
      1 && d !== (d = `translate(-${/*data*/
      P[0].width / 2}, -${/*data*/
      P[0].height / 2})`) && u(l, "transform", d), O & /*data*/
      1 && h !== (h = /*data*/
      P[0].id) && u(e, "id", h), O & /*data*/
      1 && p !== (p = /*data*/
      P[0]._class) && u(e, "class", p), O & /*data*/
      1 && g !== (g = /*data*/
      P[0].role) && u(e, "data-role", g), O & /*data*/
      1 && v !== (v = /*data*/
      P[0].id + "-0") && u(y, "id", v), O & /*data*/
      1 && w !== (w = /*data*/
      P[0].cx + /*data*/
      P[0].width) && u(y, "x1", w), O & /*data*/
      1 && q !== (q = /*data*/
      P[0].cy) && u(y, "y1", q), O & /*data*/
      1 && $ !== ($ = /*data*/
      P[0].cx) && u(y, "x2", $), O & /*data*/
      1 && j !== (j = /*data*/
      P[0].cy + /*data*/
      P[0].height) && u(y, "y2", j), O & /*data*/
      1 && I !== (I = /*data*/
      P[0].stroke || Me) && u(y, "stroke", I), O & /*data*/
      1 && A !== (A = /*data*/
      P[0]["stroke-width"] !== void 0 ? (
        /*data*/
        P[0]["stroke-width"]
      ) : 1) && u(y, "stroke-width", A), O & /*data*/
      1 && M !== (M = /*data*/
      P[0]["stroke-opacity"] !== void 0 ? (
        /*data*/
        P[0]["stroke-opacity"]
      ) : 1) && u(y, "stroke-opacity", M), O & /*data*/
      1 && z !== (z = `translate(-${/*data*/
      P[0].width / 2}, -${/*data*/
      P[0].height / 2})`) && u(y, "transform", z), O & /*data*/
      1 && H !== (H = /*data*/
      P[0].id) && u(k, "id", H), O & /*data*/
      1 && B !== (B = /*data*/
      P[0]._class) && u(k, "class", B), O & /*data*/
      1 && R !== (R = /*data*/
      P[0].role) && u(k, "data-role", R);
    },
    d(P) {
      P && (C(e), C(b), C(k));
    }
  };
}
function fg(t) {
  let e, l = (
    /*data*/
    t[0] && no(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(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: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function _g(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
class cg extends Ve {
  constructor(e) {
    super(), Qe(this, e, _g, fg, Fe, { data: 0 });
  }
}
function ao(t) {
  let e, l, i, n, a, r, s, o, _, c;
  return {
    c() {
      e = Ge("path"), u(e, "id", l = /*data*/
      t[0].id), u(e, "class", i = /*data*/
      t[0]._class), u(e, "data-role", n = /*data*/
      t[0].role), u(e, "d", a = /*data*/
      t[0].path), u(e, "stroke", r = /*data*/
      t[0].stroke || Me), u(e, "stroke-width", s = /*data*/
      t[0]["stroke-width"] !== void 0 ? (
        /*data*/
        t[0]["stroke-width"]
      ) : 1), u(e, "fill", o = /*data*/
      t[0].fill || it), u(e, "fill-opacity", _ = /*data*/
      t[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        t[0]["fill-opacity"]
      ) : 1), u(e, "transform", c = /*data*/
      t[0].transform);
    },
    m(d, h) {
      S(d, e, h);
    },
    p(d, h) {
      h & /*data*/
      1 && l !== (l = /*data*/
      d[0].id) && u(e, "id", l), h & /*data*/
      1 && i !== (i = /*data*/
      d[0]._class) && u(e, "class", i), h & /*data*/
      1 && n !== (n = /*data*/
      d[0].role) && u(e, "data-role", n), h & /*data*/
      1 && a !== (a = /*data*/
      d[0].path) && u(e, "d", a), h & /*data*/
      1 && r !== (r = /*data*/
      d[0].stroke || Me) && u(e, "stroke", r), h & /*data*/
      1 && s !== (s = /*data*/
      d[0]["stroke-width"] !== void 0 ? (
        /*data*/
        d[0]["stroke-width"]
      ) : 1) && u(e, "stroke-width", s), h & /*data*/
      1 && o !== (o = /*data*/
      d[0].fill || it) && u(e, "fill", o), h & /*data*/
      1 && _ !== (_ = /*data*/
      d[0]["fill-opacity"] !== void 0 ? (
        /*data*/
        d[0]["fill-opacity"]
      ) : 1) && u(e, "fill-opacity", _), h & /*data*/
      1 && c !== (c = /*data*/
      d[0].transform) && u(e, "transform", c);
    },
    d(d) {
      d && C(e);
    }
  };
}
function dg(t) {
  let e, l = (
    /*data*/
    t[0] && ao(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(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: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function hg(t, e, l) {
  let { data: i = {} } = e;
  return t.$$set = (n) => {
    "data" in n && l(0, i = n.data);
  }, [i];
}
let pg = class extends Ve {
  constructor(e) {
    super(), Qe(this, e, hg, dg, Fe, { data: 0 });
  }
};
function mg(t) {
  let e, l;
  return e = new pg({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function gg(t) {
  let e, l;
  return e = new cg({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function bg(t) {
  let e, l;
  return e = new _m({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function kg(t) {
  let e, l;
  return e = new V0({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function vg(t) {
  let e, l;
  return e = new Y0({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function yg(t) {
  let e, l;
  return e = new sg({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function wg(t) {
  let e, l;
  return e = new x0({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function $g(t) {
  let e, l;
  return e = new fm({ props: { data: (
    /*data*/
    t[0]
  ) } }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*data*/
      1 && (a.data = /*data*/
      i[0]), e.$set(a);
    },
    i(i) {
      l || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function qg(t) {
  let e, l;
  return e = new W0({
    props: {
      data: (
        /*data*/
        t[0]
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function jg(t) {
  let e, l;
  return e = new lg({
    props: {
      data: (
        /*data*/
        t[0]
      ),
      open_tool: (
        /*open_tool*/
        t[1]
      ),
      openTooltip: (
        /*openTooltip*/
        t[2]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[3]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[4]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Tg(t) {
  let e, l, i, n;
  const a = [
    jg,
    qg,
    $g,
    wg,
    yg,
    vg,
    kg,
    bg,
    gg,
    mg
  ], r = [];
  function s(o, _) {
    var c, d, h, p, g, b, k, y, v, 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*/
              ((g = o[0]) == null ? void 0 : g.type) === "rect" ? 4 : (
                /*data*/
                ((b = o[0]) == null ? void 0 : b.type) === "circle" ? 5 : (
                  /*data*/
                  ((k = o[0]) == null ? void 0 : k.type) === "arrow-end" ? 6 : (
                    /*data*/
                    ((y = o[0]) == null ? void 0 : y.type) === "text" ? 7 : (
                      /*data*/
                      ((v = o[0]) == null ? void 0 : v.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 = Ae();
    },
    m(o, _) {
      ~e && r[e].m(o, _), S(o, i, _), n = !0;
    },
    p(o, [_]) {
      let c = e;
      e = s(o), e === c ? ~e && r[e].p(o, _) : (l && (be(), D(r[c], 1, 1, () => {
        r[c] = null;
      }), ke()), ~e ? (l = r[e], l ? l.p(o, _) : (l = r[e] = a[e](o), l.c()), T(l, 1), l.m(i.parentNode, i)) : l = null);
    },
    i(o) {
      n || (T(l), n = !0);
    },
    o(o) {
      D(l), n = !1;
    },
    d(o) {
      o && C(i), ~e && r[e].d(o);
    }
  };
}
function Cg(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 kt extends Ve {
  constructor(e) {
    super(), Qe(this, e, Cg, Tg, Fe, {
      data: 0,
      open_tool: 1,
      openTooltip: 2,
      closeTooltip: 3,
      moveTooltip: 4
    });
  }
}
function ro(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R = (
    /*drawPlan*/
    t[4].groups.phase_marker && so(t)
  ), P = (
    /*drawPlan*/
    t[4].groups.qubit_group && oo(t)
  ), O = (
    /*drawPlan*/
    t[4].groups.esp_axis_group && uo(t)
  ), F = (
    /*drawPlan*/
    t[4].groups.phase_marker && fo(t)
  ), L = (
    /*drawPlan*/
    t[4].groups.moment_group && _o(t)
  ), X = (
    /*drawPlan*/
    t[4].groups.qubit_group && co(t)
  ), V = (
    /*drawPlan*/
    t[4].groups.circuit_line_group && ho(t)
  ), Q = (
    /*drawPlan*/
    t[4].groups.circuit_group && po(t)
  ), Z = (
    /*drawPlan*/
    t[4].groups.esp_axis_group && mo(t)
  ), ae = (
    /*drawPlan*/
    t[4].groups.esp_group && go(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = Ge("svg"), n = Ge("style"), a = E(`g {
            font-family: Iosevka;
            font-size: 14px;
          }
        `), R && R.c(), r = Ae(), P && P.c(), s = Ae(), O && O.c(), p = N(), g = m("div"), b = Ge("svg"), k = Ge("style"), y = E(`g {
            font-family: Iosevka;
            font-size: 14px;
          }
        `), F && F.c(), v = Ae(), L && L.c(), w = Ae(), X && X.c(), q = Ae(), V && V.c(), $ = Ae(), Q && Q.c(), j = Ae(), Z && Z.c(), I = Ae(), ae && ae.c(), u(i, "id", o = /*id*/
      t[0] + "-sticky"), u(i, "width", _ = /*drawPlan*/
      t[4].groups.qubit_group.x + /*drawPlan*/
      t[4].groups.qubit_group.width), u(i, "height", c = /*drawPlan*/
      t[4].height), u(i, "viewBox", d = /*drawPlan*/
      t[4].viewBox.map(
        /*func*/
        t[16]
      ).join(" ")), u(l, "class", "circuit-sticky svelte-1011ir3"), u(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;`), u(
        b,
        "id",
        /*id*/
        t[0]
      ), u(b, "width", A = /*drawPlan*/
      t[4].width), u(b, "height", M = /*drawPlan*/
      t[4].height), u(b, "viewBox", z = /*drawPlan*/
      t[4].viewBox.join(" ")), u(g, "class", "circuit-main svelte-1011ir3"), u(e, "id", H = /*id*/
      t[0] + "-wrapper"), u(e, "class", "ciruit-view-wrapper svelte-1011ir3"), At(e, "position", "relative"), At(e, "width", "100%"), At(e, "overflow-x", "scroll"), At(e, "overflow-y", "hidden");
    },
    m(se, K) {
      S(se, e, K), f(e, l), f(l, i), f(i, n), f(n, a), R && R.m(i, null), f(i, r), P && P.m(i, null), f(i, s), O && O.m(i, null), f(e, p), f(e, g), f(g, b), f(b, k), f(k, y), F && F.m(b, null), f(b, v), L && L.m(b, null), f(b, w), X && X.m(b, null), f(b, q), V && V.m(b, null), f(b, $), Q && Q.m(b, null), f(b, j), Z && Z.m(b, null), f(b, I), ae && ae.m(b, null), B = !0;
    },
    p(se, K) {
      /*drawPlan*/
      se[4].groups.phase_marker ? R ? (R.p(se, K), K & /*drawPlan*/
      16 && T(R, 1)) : (R = so(se), R.c(), T(R, 1), R.m(i, r)) : R && (be(), D(R, 1, 1, () => {
        R = null;
      }), ke()), /*drawPlan*/
      se[4].groups.qubit_group ? P ? (P.p(se, K), K & /*drawPlan*/
      16 && T(P, 1)) : (P = oo(se), P.c(), T(P, 1), P.m(i, s)) : P && (be(), D(P, 1, 1, () => {
        P = null;
      }), ke()), /*drawPlan*/
      se[4].groups.esp_axis_group ? O ? (O.p(se, K), K & /*drawPlan*/
      16 && T(O, 1)) : (O = uo(se), O.c(), T(O, 1), O.m(i, null)) : O && (be(), D(O, 1, 1, () => {
        O = null;
      }), ke()), (!B || K & /*id*/
      1 && o !== (o = /*id*/
      se[0] + "-sticky")) && u(i, "id", o), (!B || K & /*drawPlan*/
      16 && _ !== (_ = /*drawPlan*/
      se[4].groups.qubit_group.x + /*drawPlan*/
      se[4].groups.qubit_group.width)) && u(i, "width", _), (!B || K & /*drawPlan*/
      16 && c !== (c = /*drawPlan*/
      se[4].height)) && u(i, "height", c), (!B || K & /*drawPlan*/
      16 && d !== (d = /*drawPlan*/
      se[4].viewBox.map(
        /*func*/
        se[16]
      ).join(" "))) && u(i, "viewBox", d), (!B || K & /*drawPlan*/
      16 && h !== (h = `width: ${/*drawPlan*/
      se[4].groups.qubit_group.x + /*drawPlan*/
      se[4].groups.qubit_group.width}px; height:${/*drawPlan*/
      se[4].height}px;`)) && u(l, "style", h), /*drawPlan*/
      se[4].groups.phase_marker ? F ? (F.p(se, K), K & /*drawPlan*/
      16 && T(F, 1)) : (F = fo(se), F.c(), T(F, 1), F.m(b, v)) : F && (be(), D(F, 1, 1, () => {
        F = null;
      }), ke()), /*drawPlan*/
      se[4].groups.moment_group ? L ? (L.p(se, K), K & /*drawPlan*/
      16 && T(L, 1)) : (L = _o(se), L.c(), T(L, 1), L.m(b, w)) : L && (be(), D(L, 1, 1, () => {
        L = null;
      }), ke()), /*drawPlan*/
      se[4].groups.qubit_group ? X ? (X.p(se, K), K & /*drawPlan*/
      16 && T(X, 1)) : (X = co(se), X.c(), T(X, 1), X.m(b, q)) : X && (be(), D(X, 1, 1, () => {
        X = null;
      }), ke()), /*drawPlan*/
      se[4].groups.circuit_line_group ? V ? (V.p(se, K), K & /*drawPlan*/
      16 && T(V, 1)) : (V = ho(se), V.c(), T(V, 1), V.m(b, $)) : V && (be(), D(V, 1, 1, () => {
        V = null;
      }), ke()), /*drawPlan*/
      se[4].groups.circuit_group ? Q ? (Q.p(se, K), K & /*drawPlan*/
      16 && T(Q, 1)) : (Q = po(se), Q.c(), T(Q, 1), Q.m(b, j)) : Q && (be(), D(Q, 1, 1, () => {
        Q = null;
      }), ke()), /*drawPlan*/
      se[4].groups.esp_axis_group ? Z ? (Z.p(se, K), K & /*drawPlan*/
      16 && T(Z, 1)) : (Z = mo(se), Z.c(), T(Z, 1), Z.m(b, I)) : Z && (be(), D(Z, 1, 1, () => {
        Z = null;
      }), ke()), /*drawPlan*/
      se[4].groups.esp_group ? ae ? (ae.p(se, K), K & /*drawPlan*/
      16 && T(ae, 1)) : (ae = go(se), ae.c(), T(ae, 1), ae.m(b, null)) : ae && (be(), D(ae, 1, 1, () => {
        ae = null;
      }), ke()), (!B || K & /*id*/
      1) && u(
        b,
        "id",
        /*id*/
        se[0]
      ), (!B || K & /*drawPlan*/
      16 && A !== (A = /*drawPlan*/
      se[4].width)) && u(b, "width", A), (!B || K & /*drawPlan*/
      16 && M !== (M = /*drawPlan*/
      se[4].height)) && u(b, "height", M), (!B || K & /*drawPlan*/
      16 && z !== (z = /*drawPlan*/
      se[4].viewBox.join(" "))) && u(b, "viewBox", z), (!B || K & /*id*/
      1 && H !== (H = /*id*/
      se[0] + "-wrapper")) && u(e, "id", H);
    },
    i(se) {
      B || (T(R), T(P), T(O), T(F), T(L), T(X), T(V), T(Q), T(Z), T(ae), B = !0);
    },
    o(se) {
      D(R), D(P), D(O), D(F), D(L), D(X), D(V), D(Q), D(Z), D(ae), B = !1;
    },
    d(se) {
      se && C(e), R && R.d(), P && P.d(), O && O.d(), F && F.d(), L && L.d(), X && X.d(), V && V.d(), Q && Q.d(), Z && Z.d(), ae && ae.d();
    }
  };
}
function so(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*drawPlan*/
        t[4].groups.phase_marker
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function oo(t) {
  let e, l;
  return e = new kt({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function uo(t) {
  let e, l;
  return e = new kt({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function fo(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*drawPlan*/
        t[4].groups.phase_marker
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function _o(t) {
  let e, l;
  return e = new kt({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function co(t) {
  let e, l;
  return e = new kt({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function ho(t) {
  let e, l;
  return e = new kt({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function po(t) {
  let e, l;
  return e = new kt({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function mo(t) {
  let e, l;
  return e = new kt({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function go(t) {
  let e, l;
  return e = new kt({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Sg(t) {
  let e;
  return {
    c() {
      e = m("div"), e.textContent = "Click or hover to see details. Double-click for further details.", u(e, "class", "g-tooltip deactive svelte-1011ir3");
    },
    m(l, i) {
      S(l, e, i);
    },
    p: ne,
    d(l) {
      l && C(e);
    }
  };
}
function Mg(t) {
  let e;
  return {
    c() {
      e = m("div"), u(e, "class", "g-tooltip svelte-1011ir3");
    },
    m(l, i) {
      S(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 && C(e);
    }
  };
}
function zg(t) {
  let e, l, i, n = (
    /*drawPlan*/
    t[4] && ro(t)
  );
  function a(o, _) {
    return (
      /*showTooltip*/
      o[2] ? Mg : Sg
    );
  }
  let r = a(t), s = r(t);
  return {
    c() {
      n && n.c(), e = N(), s.c(), l = Ae();
    },
    m(o, _) {
      n && n.m(o, _), S(o, e, _), s.m(o, _), S(o, l, _), i = !0;
    },
    p(o, [_]) {
      /*drawPlan*/
      o[4] ? n ? (n.p(o, _), _ & /*drawPlan*/
      16 && T(n, 1)) : (n = ro(o), n.c(), T(n, 1), n.m(e.parentNode, e)) : n && (be(), D(n, 1, 1, () => {
        n = null;
      }), ke()), r === (r = a(o)) && s ? s.p(o, _) : (s.d(1), s = r(o), s && (s.c(), s.m(l.parentNode, l)));
    },
    i(o) {
      i || (T(n), i = !0);
    },
    o(o) {
      D(n), i = !1;
    },
    d(o) {
      o && (C(e), C(l)), n && n.d(o), s.d(o);
    }
  };
}
function Ng(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: _ = Oe(), open_tool: c = () => {
  }, filter_unused_qubits: d = !0, unit_id: h } = e, p = !1, g, b = !1, k = 999;
  function y(j, I, A, M) {
    b && !A || k < M || (l(2, p = !0), j.clientX + 5, j.clientY + 5, l(3, g = I), b = A, k = M || 0);
  }
  function v(j) {
    p && (j.clientX + 5, j.clientY + 5);
  }
  function w(j) {
    b || l(2, p = !1), j && (l(2, p = !1), k = 999);
  }
  let q;
  Tt(() => {
    l(4, q = kr(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
    })), _.subscribe((j) => {
      var A, M, z, H, B;
      let I = document.querySelector(`#${r} #layer-${j}--group`);
      if (I) {
        let R = document.querySelector("#" + r + "-wrapper"), P = document.querySelector("#" + r + "-sticky"), O = (A = R.getClientRects()[0]) == null ? void 0 : A.left, F = (M = R.getClientRects()[0]) == null ? void 0 : M.width, L = (z = P.getClientRects()[0]) == null ? void 0 : z.width, X = ((H = I.getClientRects()[0]) == null ? void 0 : H.left) - O - L, V = (B = I.getClientRects()[0]) == null ? void 0 : B.width;
        X < 0 ? R.scrollBy({
          top: 0,
          left: -F / 3,
          behavior: "smooth"
        }) : X + V > F - L && R.scrollBy({
          top: 0,
          left: F / 3,
          behavior: "smooth"
        });
      }
    });
  });
  const $ = (j, I) => I == 2 ? q.groups.qubit_group.x + q.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, _ = 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, q = kr(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,
    g,
    q,
    y,
    v,
    w,
    i,
    n,
    a,
    s,
    o,
    _,
    d,
    h,
    $
  ];
}
class cm extends Ve {
  constructor(e) {
    super(), Qe(this, e, Ng, zg, Fe, {
      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 bo(t, e, l) {
  const i = t.slice();
  return i[1] = e[l], i[3] = l, i;
}
function ko(t) {
  let e, l, i, n = (
    /*info*/
    t[0].layer_index + ""
  ), a, r, s, o, _, c, d, h = (
    /*info*/
    t[0].layer_index + ""
  ), p, g, b, k, y, v = (
    /*info*/
    t[0].esp_this + ""
  ), w, q, $, j, I, A = (
    /*info*/
    t[0].esp_total + ""
  ), M, z, H = $e(
    /*info*/
    t[0].operations
  ), B = [];
  for (let R = 0; R < H.length; R += 1)
    B[R] = vo(bo(t, H, R));
  return {
    c() {
      e = m("div"), l = m("h2"), i = E("ESP for Layer "), a = E(n), r = N(), s = m("div"), o = m("table"), _ = m("tr"), c = m("th"), c.textContent = "Layer (moment)", d = m("td"), p = E(h), g = N(), b = m("tr"), k = m("th"), k.textContent = "Current ESP", y = m("td"), w = E(v), q = N(), $ = m("tr"), j = m("th"), j.textContent = "Cumulative ESP", I = m("td"), M = E(A), z = N();
      for (let R = 0; R < B.length; R += 1)
        B[R].c();
      u(l, "class", "svelte-1fh3lcn"), u(c, "class", "svelte-1fh3lcn"), u(d, "class", "svelte-1fh3lcn"), u(_, "class", "svelte-1fh3lcn"), u(k, "class", "svelte-1fh3lcn"), u(y, "class", "svelte-1fh3lcn"), u(b, "class", "svelte-1fh3lcn"), u(j, "class", "svelte-1fh3lcn"), u(I, "class", "svelte-1fh3lcn"), u($, "class", "svelte-1fh3lcn"), u(o, "class", "svelte-1fh3lcn"), u(s, "class", "info-section svelte-1fh3lcn"), u(e, "class", "svelte-1fh3lcn");
    },
    m(R, P) {
      S(R, e, P), f(e, l), f(l, i), f(l, a), f(e, r), f(e, s), f(s, o), f(o, _), f(_, c), f(_, d), f(d, p), f(o, g), f(o, b), f(b, k), f(b, y), f(y, w), f(o, q), f(o, $), f($, j), f($, I), f(I, M), f(o, z);
      for (let O = 0; O < B.length; O += 1)
        B[O] && B[O].m(o, null);
    },
    p(R, P) {
      if (P & /*info*/
      1 && n !== (n = /*info*/
      R[0].layer_index + "") && U(a, n), P & /*info*/
      1 && h !== (h = /*info*/
      R[0].layer_index + "") && U(p, h), P & /*info*/
      1 && v !== (v = /*info*/
      R[0].esp_this + "") && U(w, v), P & /*info*/
      1 && A !== (A = /*info*/
      R[0].esp_total + "") && U(M, A), P & /*info*/
      1) {
        H = $e(
          /*info*/
          R[0].operations
        );
        let O;
        for (O = 0; O < H.length; O += 1) {
          const F = bo(R, H, O);
          B[O] ? B[O].p(F, P) : (B[O] = vo(F), B[O].c(), B[O].m(o, null));
        }
        for (; O < B.length; O += 1)
          B[O].d(1);
        B.length = H.length;
      }
    },
    d(R) {
      R && C(e), Ye(B, R);
    }
  };
}
function vo(t) {
  var w;
  let e, l, i, n = (
    /*op*/
    t[1].gate + ""
  ), a, r, s, o, _, c = (
    /*op*/
    t[1].qubits.map(yo).join(", ") + ""
  ), d, h, p, g, b, k = (
    /*info*/
    ((w = t[0].detail[
      /*oi*/
      t[3]
    ]) == null ? void 0 : w.gate_error) + ""
  ), y, v;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = `Operation ${/*oi*/
      t[3]}`, i = m("td"), a = E(n), r = N(), s = m("tr"), o = m("th"), o.textContent = "Qubits", _ = m("td"), d = E(c), h = N(), p = m("tr"), g = m("th"), g.textContent = "Gate_error", b = m("td"), y = E(k), v = N(), u(l, "class", "svelte-1fh3lcn"), u(i, "class", "svelte-1fh3lcn"), u(e, "class", "first svelte-1fh3lcn"), u(o, "class", "svelte-1fh3lcn"), u(_, "class", "svelte-1fh3lcn"), u(s, "class", "svelte-1fh3lcn"), u(g, "class", "svelte-1fh3lcn"), u(b, "class", "svelte-1fh3lcn"), u(p, "class", "svelte-1fh3lcn");
    },
    m(q, $) {
      S(q, e, $), f(e, l), f(e, i), f(i, a), S(q, r, $), S(q, s, $), f(s, o), f(s, _), f(_, d), S(q, h, $), S(q, p, $), f(p, g), f(p, b), f(b, y), f(p, v);
    },
    p(q, $) {
      var j;
      $ & /*info*/
      1 && n !== (n = /*op*/
      q[1].gate + "") && U(a, n), $ & /*info*/
      1 && c !== (c = /*op*/
      q[1].qubits.map(yo).join(", ") + "") && U(d, c), $ & /*info*/
      1 && k !== (k = /*info*/
      ((j = q[0].detail[
        /*oi*/
        q[3]
      ]) == null ? void 0 : j.gate_error) + "") && U(y, k);
    },
    d(q) {
      q && (C(e), C(r), C(s), C(h), C(p));
    }
  };
}
function Ag(t) {
  let e, l = (
    /*info*/
    t[0] && ko(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*info*/
      i[0] ? l ? l.p(i, n) : (l = ko(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
const yo = (t) => t.index;
function Bg(t, e, l) {
  let { info: i } = e;
  return t.$$set = (n) => {
    "info" in n && l(0, i = n.info);
  }, [i];
}
class Pg extends Ve {
  constructor(e) {
    super(), Qe(this, e, Bg, Ag, Fe, { info: 0 });
  }
}
function wo(t) {
  let e, l, i, n, a, r, s, o, _, c = (
    /*info*/
    t[0].gate_error_info.layer + ""
  ), d, h, p, g, b, k = (
    /*info*/
    t[0].gate_error_info.operation + ""
  ), y, v, w, q, $, j = (
    /*info*/
    t[0].gate_error_info.gate + ""
  ), I, A, M, z, H, B = (
    /*info*/
    t[0].gate_error_info.qubits.join(",") + ""
  ), R, P, O, F, L, X = (
    /*info*/
    t[0].gate_error_info.gate_error + ""
  ), V, Q, Z, ae, se, K = (
    /*info*/
    t[0].gate_error_info.gate_duration + ""
  ), Y, W, J = (
    /*info*/
    t[0].gate_error_info.duration_unit && $o(t)
  );
  return {
    c() {
      e = m("div"), l = m("h2"), l.textContent = "Gate Error Information", i = N(), n = m("div"), a = m("table"), r = m("tbody"), s = m("tr"), o = m("th"), o.textContent = "Layer", _ = m("td"), d = E(c), h = N(), p = m("tr"), g = m("th"), g.textContent = "Operation", b = m("td"), y = E(k), v = N(), w = m("tr"), q = m("th"), q.textContent = "Gate", $ = m("td"), I = E(j), A = N(), M = m("tr"), z = m("th"), z.textContent = "Qubits", H = m("td"), R = E(B), P = N(), O = m("tr"), F = m("th"), F.textContent = "Gate error", L = m("td"), V = E(X), Q = N(), Z = m("tr"), ae = m("th"), ae.textContent = "Gate duration", se = m("td"), Y = E(K), W = N(), J && J.c(), u(l, "class", "svelte-1h3inn9"), u(o, "class", "svelte-1h3inn9"), u(_, "class", "svelte-1h3inn9"), u(s, "class", "svelte-1h3inn9"), u(g, "class", "svelte-1h3inn9"), u(b, "class", "svelte-1h3inn9"), u(p, "class", "svelte-1h3inn9"), u(q, "class", "svelte-1h3inn9"), u($, "class", "svelte-1h3inn9"), u(w, "class", "svelte-1h3inn9"), u(z, "class", "svelte-1h3inn9"), u(H, "class", "svelte-1h3inn9"), u(M, "class", "svelte-1h3inn9"), u(F, "class", "svelte-1h3inn9"), u(L, "class", "svelte-1h3inn9"), u(O, "class", "svelte-1h3inn9"), u(ae, "class", "svelte-1h3inn9"), u(se, "class", "svelte-1h3inn9"), u(Z, "class", "svelte-1h3inn9"), u(r, "class", "svelte-1h3inn9"), u(a, "class", "svelte-1h3inn9"), u(n, "class", "info-section svelte-1h3inn9"), u(e, "class", "svelte-1h3inn9");
    },
    m(ee, we) {
      S(ee, e, we), f(e, l), f(e, i), f(e, n), f(n, a), f(a, r), f(r, s), f(s, o), f(s, _), f(_, d), f(r, h), f(r, p), f(p, g), f(p, b), f(b, y), f(r, v), f(r, w), f(w, q), f(w, $), f($, I), f(r, A), f(r, M), f(M, z), f(M, H), f(H, R), f(r, P), f(r, O), f(O, F), f(O, L), f(L, V), f(r, Q), f(r, Z), f(Z, ae), f(Z, se), f(se, Y), f(se, W), J && J.m(se, null);
    },
    p(ee, we) {
      we & /*info*/
      1 && c !== (c = /*info*/
      ee[0].gate_error_info.layer + "") && U(d, c), we & /*info*/
      1 && k !== (k = /*info*/
      ee[0].gate_error_info.operation + "") && U(y, k), we & /*info*/
      1 && j !== (j = /*info*/
      ee[0].gate_error_info.gate + "") && U(I, j), we & /*info*/
      1 && B !== (B = /*info*/
      ee[0].gate_error_info.qubits.join(",") + "") && U(R, B), we & /*info*/
      1 && X !== (X = /*info*/
      ee[0].gate_error_info.gate_error + "") && U(V, X), we & /*info*/
      1 && K !== (K = /*info*/
      ee[0].gate_error_info.gate_duration + "") && U(Y, K), /*info*/
      ee[0].gate_error_info.duration_unit ? J ? J.p(ee, we) : (J = $o(ee), J.c(), J.m(se, null)) : J && (J.d(1), J = null);
    },
    d(ee) {
      ee && C(e), J && J.d();
    }
  };
}
function $o(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) {
      S(a, e, r), S(a, i, r), S(a, n, r);
    },
    p(a, r) {
      r & /*info*/
      1 && l !== (l = /*info*/
      a[0].gate_error_info.duration_unit + "") && U(i, l);
    },
    d(a) {
      a && (C(e), C(i), C(n));
    }
  };
}
function Og(t) {
  let e, l = (
    /*info*/
    t[0] && wo(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*info*/
      i[0] ? l ? l.p(i, n) : (l = wo(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function Eg(t, e, l) {
  let { info: i } = e;
  return t.$$set = (n) => {
    "info" in n && l(0, i = n.info);
  }, [i];
}
class Ig extends Ve {
  constructor(e) {
    super(), Qe(this, e, Eg, Og, Fe, { info: 0 });
  }
}
function qo(t, e, l) {
  const i = t.slice();
  return i[1] = e[l], i[3] = l, i;
}
function jo(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, _, c = (
    /*info*/
    t[0].this_circuit_id === "transpiled-circuit" ? "(transpiled)" : ""
  ), d, h, p, g, b, k, y, v = (
    /*info*/
    t[0].operation.gate + ""
  ), w, q, $, j, I, A = (
    /*info*/
    t[0].layer_index + ""
  ), M, z, H, B, R, P = (
    /*info*/
    t[0].operation_index + ""
  ), O, F, L, X, V, Q = (
    /*info*/
    t[0].operation.num_qubits + ""
  ), Z, ae, se, K, Y, W, J = (
    /*info*/
    t[0].operation.num_clbits + ""
  ), ee, we, Re, ve, me, fe = (
    /*info*/
    t[0].operation.num_qubits > 0 && To(t)
  ), G = (
    /*info*/
    t[0].operation.num_clbits > 0 && Co(t)
  ), ye = (
    /*info*/
    t[0].operation.params && So(t)
  ), ue = (
    /*info*/
    ((oe = t[0].layer_match) == null ? void 0 : oe.matches) && /*info*/
    t[0].this_circuit_id === "original-circuit" && zo(t)
  ), le = (
    /*info*/
    ((x = t[0].layer_match) == null ? void 0 : x.colleagues) && /*info*/
    t[0].this_circuit_id === "transpiled-circuit" && No(t)
  );
  return {
    c() {
      e = m("div"), l = m("h2"), i = E("Operation "), a = E(n), r = N(), o = E(s), _ = N(), d = E(c), h = N(), p = m("div"), g = m("table"), b = m("tr"), k = m("th"), k.textContent = "Gate name", y = m("td"), w = E(v), q = N(), $ = m("tr"), j = m("th"), j.textContent = "Layer (moment)", I = m("td"), M = E(A), z = N(), H = m("tr"), B = m("th"), B.textContent = "Operation index", R = m("td"), O = E(P), F = N(), L = m("tr"), X = m("th"), X.textContent = "# Qubits", V = m("td"), Z = E(Q), ae = N(), fe && fe.c(), se = N(), K = m("tr"), Y = m("th"), Y.textContent = "# bits", W = m("td"), ee = E(J), we = N(), G && G.c(), Re = N(), ye && ye.c(), ve = N(), ue && ue.c(), me = N(), le && le.c(), u(l, "class", "svelte-w2ec5n"), u(k, "class", "svelte-w2ec5n"), u(y, "class", "svelte-w2ec5n"), u(j, "class", "svelte-w2ec5n"), u(I, "class", "svelte-w2ec5n"), u(B, "class", "svelte-w2ec5n"), u(R, "class", "svelte-w2ec5n"), u(X, "class", "svelte-w2ec5n"), u(V, "class", "svelte-w2ec5n"), u(Y, "class", "svelte-w2ec5n"), u(W, "class", "svelte-w2ec5n"), u(g, "class", "svelte-w2ec5n"), u(p, "class", "info-section svelte-w2ec5n");
    },
    m(ge, re) {
      S(ge, e, re), f(e, l), f(l, i), f(l, a), f(l, r), f(l, o), f(l, _), f(l, d), f(e, h), f(e, p), f(p, g), f(g, b), f(b, k), f(b, y), f(y, w), f(g, q), f(g, $), f($, j), f($, I), f(I, M), f(g, z), f(g, H), f(H, B), f(H, R), f(R, O), f(g, F), f(g, L), f(L, X), f(L, V), f(V, Z), f(g, ae), fe && fe.m(g, null), f(g, se), f(g, K), f(K, Y), f(K, W), f(W, ee), f(g, we), G && G.m(g, null), f(g, Re), ye && ye.m(g, null), f(g, ve), ue && ue.m(g, null), f(g, me), le && le.m(g, null);
    },
    p(ge, re) {
      var Ie, je;
      re & /*info*/
      1 && n !== (n = /*info*/
      ge[0].operation.gate + "") && U(a, n), re & /*info*/
      1 && s !== (s = /*info*/
      ge[0].this_circuit_id === "original-circuit" ? "(original)" : "") && U(o, s), re & /*info*/
      1 && c !== (c = /*info*/
      ge[0].this_circuit_id === "transpiled-circuit" ? "(transpiled)" : "") && U(d, c), re & /*info*/
      1 && v !== (v = /*info*/
      ge[0].operation.gate + "") && U(w, v), re & /*info*/
      1 && A !== (A = /*info*/
      ge[0].layer_index + "") && U(M, A), re & /*info*/
      1 && P !== (P = /*info*/
      ge[0].operation_index + "") && U(O, P), re & /*info*/
      1 && Q !== (Q = /*info*/
      ge[0].operation.num_qubits + "") && U(Z, Q), /*info*/
      ge[0].operation.num_qubits > 0 ? fe ? fe.p(ge, re) : (fe = To(ge), fe.c(), fe.m(g, se)) : fe && (fe.d(1), fe = null), re & /*info*/
      1 && J !== (J = /*info*/
      ge[0].operation.num_clbits + "") && U(ee, J), /*info*/
      ge[0].operation.num_clbits > 0 ? G ? G.p(ge, re) : (G = Co(ge), G.c(), G.m(g, Re)) : G && (G.d(1), G = null), /*info*/
      ge[0].operation.params ? ye ? ye.p(ge, re) : (ye = So(ge), ye.c(), ye.m(g, ve)) : ye && (ye.d(1), ye = null), /*info*/
      (Ie = ge[0].layer_match) != null && Ie.matches && /*info*/
      ge[0].this_circuit_id === "original-circuit" ? ue ? ue.p(ge, re) : (ue = zo(ge), ue.c(), ue.m(g, me)) : ue && (ue.d(1), ue = null), /*info*/
      (je = ge[0].layer_match) != null && je.colleagues && /*info*/
      ge[0].this_circuit_id === "transpiled-circuit" ? le ? le.p(ge, re) : (le = No(ge), le.c(), le.m(g, null)) : le && (le.d(1), le = null);
    },
    d(ge) {
      ge && C(e), fe && fe.d(), G && G.d(), ye && ye.d(), ue && ue.d(), le && le.d();
    }
  };
}
function To(t) {
  let e, l, i, n = (
    /*info*/
    t[0].operation.qubits.map(Ao).join(", ") + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Qubits", i = m("td"), a = E(n), u(l, "class", "svelte-w2ec5n"), u(i, "class", "svelte-w2ec5n");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*info*/
      1 && n !== (n = /*info*/
      r[0].operation.qubits.map(Ao).join(", ") + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Co(t) {
  let e, l, i, n = (
    /*info*/
    t[0].operation.clbits.map(Bo).join(", ") + ""
  ), a;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Bits", i = m("td"), a = E(n), u(l, "class", "svelte-w2ec5n"), u(i, "class", "svelte-w2ec5n");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*info*/
      1 && n !== (n = /*info*/
      r[0].operation.clbits.map(Bo).join(", ") + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function So(t) {
  let e, l = $e(
    /*info*/
    t[0].operation.params
  ), i = [];
  for (let n = 0; n < l.length; n += 1)
    i[n] = Mo(qo(t, l, n));
  return {
    c() {
      for (let n = 0; n < i.length; n += 1)
        i[n].c();
      e = Ae();
    },
    m(n, a) {
      for (let r = 0; r < i.length; r += 1)
        i[r] && i[r].m(n, a);
      S(n, e, a);
    },
    p(n, a) {
      if (a & /*info*/
      1) {
        l = $e(
          /*info*/
          n[0].operation.params
        );
        let r;
        for (r = 0; r < l.length; r += 1) {
          const s = qo(n, l, r);
          i[r] ? i[r].p(s, a) : (i[r] = Mo(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 && C(e), Ye(i, n);
    }
  };
}
function Mo(t) {
  let e, l, i, n = St(
    /*param*/
    t[1],
    !0
  ) + "", a, r;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = `Parameter ${/*pi*/
      t[3] + 1}`, i = m("td"), a = E(n), r = N(), u(l, "class", "svelte-w2ec5n"), u(i, "class", "svelte-w2ec5n");
    },
    m(s, o) {
      S(s, e, o), f(e, l), f(e, i), f(i, a), f(e, r);
    },
    p(s, o) {
      o & /*info*/
      1 && n !== (n = St(
        /*param*/
        s[1],
        !0
      ) + "") && U(a, n);
    },
    d(s) {
      s && C(e);
    }
  };
}
function zo(t) {
  let e, l, i, n = (
    /*info*/
    t[0].layer_match.matches.map(Po).join(", ") + ""
  ), a, r, s, o, _, 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 = N(), s = m("tr"), o = m("th"), o.textContent = "Complete match?", _ = m("td"), d = E(c), u(l, "class", "svelte-w2ec5n"), u(i, "class", "svelte-w2ec5n"), u(o, "class", "svelte-w2ec5n"), u(_, "class", "svelte-w2ec5n");
    },
    m(h, p) {
      S(h, e, p), f(e, l), f(e, i), f(i, a), S(h, r, p), S(h, s, p), f(s, o), f(s, _), f(_, d);
    },
    p(h, p) {
      p & /*info*/
      1 && n !== (n = /*info*/
      h[0].layer_match.matches.map(Po).join(", ") + "") && U(a, n), p & /*info*/
      1 && c !== (c = /*info*/
      h[0].layer_match.complete + "") && U(d, c);
    },
    d(h) {
      h && (C(e), C(r), C(s));
    }
  };
}
function No(t) {
  let e, l, i, n = (
    /*info*/
    t[0].layer_match.layer + ""
  ), a, r, s = (
    /*info*/
    t[0].layer_match.operation + ""
  ), o, _, c, d, h, p = (
    /*info*/
    t[0].layer_match.colleagues.map(Oo).join(", ") + ""
  ), g, b, k, y, v, w = (
    /*info*/
    t[0].layer_match.complete + ""
  ), q;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Transpiled from", i = m("td"), a = E(n), r = E("-"), o = E(s), _ = N(), c = m("tr"), d = m("th"), d.textContent = "Other in-group ops", h = m("td"), g = E(p), b = N(), k = m("tr"), y = m("th"), y.textContent = "Complete match?", v = m("td"), q = E(w), u(l, "class", "svelte-w2ec5n"), u(i, "class", "svelte-w2ec5n"), u(d, "class", "svelte-w2ec5n"), u(h, "class", "svelte-w2ec5n"), u(y, "class", "svelte-w2ec5n"), u(v, "class", "svelte-w2ec5n");
    },
    m($, j) {
      S($, e, j), f(e, l), f(e, i), f(i, a), f(i, r), f(i, o), S($, _, j), S($, c, j), f(c, d), f(c, h), f(h, g), S($, b, j), S($, k, j), f(k, y), f(k, v), f(v, q);
    },
    p($, j) {
      j & /*info*/
      1 && n !== (n = /*info*/
      $[0].layer_match.layer + "") && U(a, n), j & /*info*/
      1 && s !== (s = /*info*/
      $[0].layer_match.operation + "") && U(o, s), j & /*info*/
      1 && p !== (p = /*info*/
      $[0].layer_match.colleagues.map(Oo).join(", ") + "") && U(g, p), j & /*info*/
      1 && w !== (w = /*info*/
      $[0].layer_match.complete + "") && U(q, w);
    },
    d($) {
      $ && (C(e), C(_), C(c), C(b), C(k));
    }
  };
}
function Dg(t) {
  let e, l = (
    /*info*/
    t[0] && jo(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(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: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
const Ao = (t) => t.index, Bo = (t) => t.index, Po = (t) => `${t[0]}-${t[1]}`, Oo = (t) => `${t[0]}-${t[1]}`;
function Rg(t, e, l) {
  let { info: i } = e;
  return t.$$set = (n) => {
    "info" in n && l(0, i = n.info);
  }, [i];
}
class Hg extends Ve {
  constructor(e) {
    super(), Qe(this, e, Rg, Dg, Fe, { info: 0 });
  }
}
function Eo(t, e, l) {
  const i = t.slice();
  return i[1] = e[l], i;
}
function Io(t) {
  let e, l, i, n = $e(
    /*info*/
    t[0].gate_info
  ), a = [];
  for (let r = 0; r < n.length; r += 1)
    a[r] = Ho(Eo(t, n, r));
  return {
    c() {
      e = m("div"), l = m("h2"), l.textContent = "Gate Operation Information", i = N();
      for (let r = 0; r < a.length; r += 1)
        a[r].c();
      u(l, "class", "svelte-dn9fba"), u(e, "class", "svelte-dn9fba");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(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 = $e(
          /*info*/
          r[0].gate_info
        );
        let o;
        for (o = 0; o < n.length; o += 1) {
          const _ = Eo(r, n, o);
          a[o] ? a[o].p(_, s) : (a[o] = Ho(_), 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 && C(e), Ye(a, r);
    }
  };
}
function Do(t) {
  let e, l, i, n = (
    /*item*/
    t[1].gate_error.value + ""
  ), a, r, s, o, _, 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 = N(), s = m("tr"), o = m("th"), o.textContent = "As of", _ = m("td"), d = E(c), u(l, "class", "svelte-dn9fba"), u(i, "class", "svelte-dn9fba"), u(e, "class", "svelte-dn9fba"), u(o, "class", "svelte-dn9fba"), u(_, "class", "svelte-dn9fba"), u(s, "class", "svelte-dn9fba");
    },
    m(h, p) {
      S(h, e, p), f(e, l), f(e, i), f(i, a), S(h, r, p), S(h, s, p), f(s, o), f(s, _), f(_, d);
    },
    p(h, p) {
      p & /*info*/
      1 && n !== (n = /*item*/
      h[1].gate_error.value + "") && U(a, n), p & /*info*/
      1 && c !== (c = /*item*/
      h[1].gate_error.asof + "") && U(d, c);
    },
    d(h) {
      h && (C(e), C(r), C(s));
    }
  };
}
function Ro(t) {
  let e, l, i, n = (
    /*item*/
    t[1].gate_length.value + ""
  ), a, r, s = (
    /*item*/
    t[1].gate_length.unit + ""
  ), o, _, c, d, h, p, g = (
    /*item*/
    t[1].gate_length.asof + ""
  ), b;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Gate length", i = m("td"), a = E(n), r = E(" ("), o = E(s), _ = E(")"), c = N(), d = m("tr"), h = m("th"), h.textContent = "As of", p = m("td"), b = E(g), u(l, "class", "svelte-dn9fba"), u(i, "class", "svelte-dn9fba"), u(e, "class", "svelte-dn9fba"), u(h, "class", "svelte-dn9fba"), u(p, "class", "svelte-dn9fba"), u(d, "class", "svelte-dn9fba");
    },
    m(k, y) {
      S(k, e, y), f(e, l), f(e, i), f(i, a), f(i, r), f(i, o), f(i, _), S(k, c, y), S(k, d, y), f(d, h), f(d, p), f(p, b);
    },
    p(k, y) {
      y & /*info*/
      1 && n !== (n = /*item*/
      k[1].gate_length.value + "") && U(a, n), y & /*info*/
      1 && s !== (s = /*item*/
      k[1].gate_length.unit + "") && U(o, s), y & /*info*/
      1 && g !== (g = /*item*/
      k[1].gate_length.asof + "") && U(b, g);
    },
    d(k) {
      k && (C(e), C(c), C(d));
    }
  };
}
function Ho(t) {
  let e, l, i, n, a, r, s = (
    /*item*/
    t[1].gate + ""
  ), o, _, c, d, h, p, g = (
    /*item*/
    t[1].qubits.join(", ") + ""
  ), b, k, y, v, w = (
    /*item*/
    t[1].gate_error && Do(t)
  ), q = (
    /*item*/
    t[1].gate_length && Ro(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), _ = N(), c = m("tbody"), d = m("tr"), h = m("th"), h.textContent = "Qubits", p = m("td"), b = E(g), k = N(), w && w.c(), y = N(), q && q.c(), v = N(), u(a, "class", "svelte-dn9fba"), u(r, "class", "svelte-dn9fba"), u(n, "class", "svelte-dn9fba"), u(i, "class", "svelte-dn9fba"), u(h, "class", "svelte-dn9fba"), u(p, "class", "svelte-dn9fba"), u(d, "class", "svelte-dn9fba"), u(c, "class", "svelte-dn9fba"), u(l, "class", "svelte-dn9fba"), u(e, "class", "info-section svelte-dn9fba");
    },
    m($, j) {
      S($, e, j), f(e, l), f(l, i), f(i, n), f(n, a), f(n, r), f(r, o), f(l, _), f(l, c), f(c, d), f(d, h), f(d, p), f(p, b), f(c, k), w && w.m(c, null), f(c, y), q && q.m(c, null), f(e, v);
    },
    p($, j) {
      j & /*info*/
      1 && s !== (s = /*item*/
      $[1].gate + "") && U(o, s), j & /*info*/
      1 && g !== (g = /*item*/
      $[1].qubits.join(", ") + "") && U(b, g), /*item*/
      $[1].gate_error ? w ? w.p($, j) : (w = Do($), w.c(), w.m(c, y)) : w && (w.d(1), w = null), /*item*/
      $[1].gate_length ? q ? q.p($, j) : (q = Ro($), q.c(), q.m(c, null)) : q && (q.d(1), q = null);
    },
    d($) {
      $ && C(e), w && w.d(), q && q.d();
    }
  };
}
function Lg(t) {
  let e, l = (
    /*info*/
    t[0] && Io(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*info*/
      i[0] ? l ? l.p(i, n) : (l = Io(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function Fg(t, e, l) {
  let { info: i } = e;
  return t.$$set = (n) => {
    "info" in n && l(0, i = n.info);
  }, [i];
}
class Qg extends Ve {
  constructor(e) {
    super(), Qe(this, e, Fg, Lg, Fe, { info: 0 });
  }
}
function Lo(t) {
  let e, l, i, n = (
    /*info*/
    t[0].qubit.index + ""
  ), a, r, s = (
    /*info*/
    t[0].this_circuit_id === "original-circuit" ? "(original)" : ""
  ), o, _, c = (
    /*info*/
    t[0].this_circuit_id === "transpiled-circuit" ? "(transpiled)" : ""
  ), d, h, p, g, b, k, y, v = (
    /*info*/
    t[0].qubit.index + ""
  ), w, q, $, j = (
    /*info*/
    t[0].qubit.register && Fo(t)
  ), I = (
    /*info*/
    t[0].bit_match !== void 0 && Qo(t)
  );
  return {
    c() {
      e = m("div"), l = m("h2"), i = E("Qubit "), a = E(n), r = N(), o = E(s), _ = N(), d = E(c), h = N(), p = m("div"), g = m("table"), b = m("tr"), k = m("th"), k.textContent = "Qubit index", y = m("td"), w = E(v), q = N(), j && j.c(), $ = N(), I && I.c(), u(l, "class", "svelte-rb4g2h"), u(k, "class", "svelte-rb4g2h"), u(y, "class", "svelte-rb4g2h"), u(b, "class", "svelte-rb4g2h"), u(g, "class", "svelte-rb4g2h"), u(p, "class", "info-section svelte-rb4g2h"), u(e, "class", "svelte-rb4g2h");
    },
    m(A, M) {
      S(A, e, M), f(e, l), f(l, i), f(l, a), f(l, r), f(l, o), f(l, _), f(l, d), f(e, h), f(e, p), f(p, g), f(g, b), f(b, k), f(b, y), f(y, w), f(g, q), j && j.m(g, null), f(g, $), I && I.m(g, null);
    },
    p(A, M) {
      M & /*info*/
      1 && n !== (n = /*info*/
      A[0].qubit.index + "") && U(a, n), M & /*info*/
      1 && s !== (s = /*info*/
      A[0].this_circuit_id === "original-circuit" ? "(original)" : "") && U(o, s), M & /*info*/
      1 && c !== (c = /*info*/
      A[0].this_circuit_id === "transpiled-circuit" ? "(transpiled)" : "") && U(d, c), M & /*info*/
      1 && v !== (v = /*info*/
      A[0].qubit.index + "") && U(w, v), /*info*/
      A[0].qubit.register ? j ? j.p(A, M) : (j = Fo(A), j.c(), j.m(g, $)) : j && (j.d(1), j = null), /*info*/
      A[0].bit_match !== void 0 ? I ? I.p(A, M) : (I = Qo(A), I.c(), I.m(g, null)) : I && (I.d(1), I = null);
    },
    d(A) {
      A && C(e), j && j.d(), I && I.d();
    }
  };
}
function Fo(t) {
  let e, l, i, n = (
    /*info*/
    t[0].qubit.register.name + ""
  ), a, r, s = (
    /*info*/
    t[0].qubit.register.size + ""
  ), o, _;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Register", i = m("td"), a = E(n), r = E(" ("), o = E(s), _ = E(")"), u(l, "class", "svelte-rb4g2h"), u(i, "class", "svelte-rb4g2h"), u(e, "class", "svelte-rb4g2h");
    },
    m(c, d) {
      S(c, e, d), f(e, l), f(e, i), f(i, a), f(i, r), f(i, o), f(i, _);
    },
    p(c, d) {
      d & /*info*/
      1 && n !== (n = /*info*/
      c[0].qubit.register.name + "") && U(a, n), d & /*info*/
      1 && s !== (s = /*info*/
      c[0].qubit.register.size + "") && U(o, s);
    },
    d(c) {
      c && C(e);
    }
  };
}
function Qo(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), u(l, "class", "svelte-rb4g2h"), u(i, "class", "svelte-rb4g2h"), u(e, "class", "svelte-rb4g2h");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*info*/
      1 && n !== (n = /*info*/
      r[0].bit_match.to + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Vg(t) {
  let e, l = (
    /*info*/
    t[0] && Lo(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*info*/
      i[0] ? l ? l.p(i, n) : (l = Lo(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function Xg(t, e, l) {
  let { info: i } = e;
  return t.$$set = (n) => {
    "info" in n && l(0, i = n.info);
  }, [i];
}
class Gg extends Ve {
  constructor(e) {
    super(), Qe(this, e, Xg, Vg, Fe, { info: 0 });
  }
}
function Vo(t) {
  let e, l, i, n, a, r, s, o, _, c = (
    /*info*/
    t[0].original_qubit_id + ""
  ), d, h, p, g, b, k = (
    /*info*/
    t[0].qubit_id + ""
  ), y, v, w, q, $ = (
    /*info*/
    t[0].readout_error && Xo(t)
  ), j = (
    /*info*/
    t[0].esp_value && /*$machine_moment_at*/
    t[2] !== void 0 && Go(t)
  ), I = (
    /*info*/
    t[0].cummul_duration !== void 0 && /*$machine_moment_at*/
    t[2] !== void 0 && Yo(t)
  );
  return {
    c() {
      e = m("div"), l = m("h2"), l.textContent = "Machine Qubit Information", i = N(), n = m("div"), a = m("table"), r = m("tbody"), s = m("tr"), o = m("th"), o.textContent = "From", _ = m("td"), d = E(c), h = N(), p = m("tr"), g = m("th"), g.textContent = "To", b = m("td"), y = E(k), v = N(), $ && $.c(), w = N(), j && j.c(), q = N(), I && I.c(), u(l, "class", "svelte-1u88l4o"), u(o, "class", "svelte-1u88l4o"), u(_, "class", "svelte-1u88l4o"), u(s, "class", "svelte-1u88l4o"), u(g, "class", "svelte-1u88l4o"), u(b, "class", "svelte-1u88l4o"), u(p, "class", "svelte-1u88l4o"), u(r, "class", "svelte-1u88l4o"), u(a, "class", "svelte-1u88l4o"), u(n, "class", "info-section svelte-1u88l4o"), u(e, "class", "svelte-1u88l4o");
    },
    m(A, M) {
      S(A, e, M), f(e, l), f(e, i), f(e, n), f(n, a), f(a, r), f(r, s), f(s, o), f(s, _), f(_, d), f(r, h), f(r, p), f(p, g), f(p, b), f(b, y), f(r, v), $ && $.m(r, null), f(r, w), j && j.m(r, null), f(r, q), I && I.m(r, null);
    },
    p(A, M) {
      M & /*info*/
      1 && c !== (c = /*info*/
      A[0].original_qubit_id + "") && U(d, c), M & /*info*/
      1 && k !== (k = /*info*/
      A[0].qubit_id + "") && U(y, k), /*info*/
      A[0].readout_error ? $ ? $.p(A, M) : ($ = Xo(A), $.c(), $.m(r, w)) : $ && ($.d(1), $ = null), /*info*/
      A[0].esp_value && /*$machine_moment_at*/
      A[2] !== void 0 ? j ? j.p(A, M) : (j = Go(A), j.c(), j.m(r, q)) : j && (j.d(1), j = null), /*info*/
      A[0].cummul_duration !== void 0 && /*$machine_moment_at*/
      A[2] !== void 0 ? I ? I.p(A, M) : (I = Yo(A), I.c(), I.m(r, null)) : I && (I.d(1), I = null);
    },
    d(A) {
      A && C(e), $ && $.d(), j && j.d(), I && I.d();
    }
  };
}
function Xo(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), u(l, "class", "svelte-1u88l4o"), u(i, "class", "svelte-1u88l4o"), u(e, "class", "svelte-1u88l4o");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*info*/
      1 && n !== (n = /*info*/
      r[0].readout_error.value + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Go(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), u(l, "class", "svelte-1u88l4o"), u(a, "class", "svelte-1u88l4o"), u(e, "class", "svelte-1u88l4o");
    },
    m(o, _) {
      S(o, e, _), f(e, l), f(l, i), f(l, n), f(e, a), f(a, s);
    },
    p(o, _) {
      _ & /*$machine_moment_at*/
      4 && U(
        n,
        /*$machine_moment_at*/
        o[2]
      ), _ & /*info, $machine_moment_at*/
      5 && r !== (r = /*info*/
      o[0].esp_value[
        /*$machine_moment_at*/
        o[2]
      ] + "") && U(s, r);
    },
    d(o) {
      o && C(e);
    }
  };
}
function Yo(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), u(l, "class", "svelte-1u88l4o"), u(a, "class", "svelte-1u88l4o"), u(e, "class", "svelte-1u88l4o");
    },
    m(o, _) {
      S(o, e, _), f(e, l), f(l, i), f(l, n), f(e, a), f(a, s);
    },
    p(o, _) {
      _ & /*$machine_moment_at*/
      4 && U(
        n,
        /*$machine_moment_at*/
        o[2]
      ), _ & /*info*/
      1 && r !== (r = /*info*/
      o[0].cummul_duration + "") && U(s, r);
    },
    d(o) {
      o && C(e);
    }
  };
}
function Yg(t) {
  let e, l = (
    /*info*/
    t[0] && Vo(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*info*/
      i[0] ? l ? l.p(i, n) : (l = Vo(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function Kg(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(s, (o) => l(2, i = o)), s);
  t.$$.on_destroy.push(() => n());
  let { info: r, machine_moment_at: s = Oe() } = 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 Ug extends Ve {
  constructor(e) {
    super(), Qe(this, e, Kg, Yg, Fe, { info: 0, machine_moment_at: 1 });
  }
}
function ei(t) {
  try {
    navigator.clipboard.writeText(t), alert("Copied!");
  } catch {
    alert("Copy failed.. :(");
  }
}
function Ko(t) {
  let e, l, i, n = (
    /*info*/
    t[0].qasm_version + ""
  ), a, r, s = (
    /*info*/
    t[0].title + ""
  ), o, _, c, d, h, p, g = (
    /*info*/
    t[0].qasm + ""
  ), b, k, y;
  return {
    c() {
      e = m("div"), l = m("h2"), i = E("QASM"), a = E(n), r = E(" for "), o = E(s), _ = N(), c = m("button"), c.textContent = "Copy", d = N(), h = m("div"), p = m("pre"), b = E(g), u(c, "class", "svelte-1c6sep5"), u(l, "class", "svelte-1c6sep5"), u(p, "class", "svelte-1c6sep5"), u(h, "class", "info-section svelte-1c6sep5"), u(e, "class", "svelte-1c6sep5");
    },
    m(v, w) {
      S(v, e, w), f(e, l), f(l, i), f(l, a), f(l, r), f(l, o), f(l, _), f(l, c), f(e, d), f(e, h), f(h, p), f(p, b), k || (y = te(
        c,
        "click",
        /*click_handler*/
        t[1]
      ), k = !0);
    },
    p(v, w) {
      w & /*info*/
      1 && n !== (n = /*info*/
      v[0].qasm_version + "") && U(a, n), w & /*info*/
      1 && s !== (s = /*info*/
      v[0].title + "") && U(o, s), w & /*info*/
      1 && g !== (g = /*info*/
      v[0].qasm + "") && U(b, g);
    },
    d(v) {
      v && C(e), k = !1, y();
    }
  };
}
function Wg(t) {
  let e, l = (
    /*info*/
    t[0] && Ko(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*info*/
      i[0] ? l ? l.p(i, n) : (l = Ko(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function Jg(t, e, l) {
  let { info: i } = e;
  const n = (a) => {
    ei(i.qasm);
  };
  return t.$$set = (a) => {
    "info" in a && l(0, i = a.info);
  }, [i, n];
}
class Zg extends Ve {
  constructor(e) {
    super(), Qe(this, e, Jg, Wg, Fe, { info: 0 });
  }
}
function li(t, e) {
  return t == null || e == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function xg(t, e) {
  return t == null || e == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function dm(t) {
  let e, l, i;
  t.length !== 2 ? (e = li, l = (s, o) => li(t(s), o), i = (s, o) => t(s) - o) : (e = t === li || t === xg ? t : eb, l = t, i = t);
  function n(s, o, _ = 0, c = s.length) {
    if (_ < c) {
      if (e(o, o) !== 0)
        return c;
      do {
        const d = _ + c >>> 1;
        l(s[d], o) < 0 ? _ = d + 1 : c = d;
      } while (_ < c);
    }
    return _;
  }
  function a(s, o, _ = 0, c = s.length) {
    if (_ < c) {
      if (e(o, o) !== 0)
        return c;
      do {
        const d = _ + c >>> 1;
        l(s[d], o) <= 0 ? _ = d + 1 : c = d;
      } while (_ < c);
    }
    return _;
  }
  function r(s, o, _ = 0, c = s.length) {
    const d = n(s, o, _, c - 1);
    return d > _ && i(s[d - 1], o) > -i(s[d], o) ? d - 1 : d;
  }
  return { left: n, center: r, right: a };
}
function eb() {
  return 0;
}
function tb(t) {
  return t === null ? NaN : +t;
}
function* lb(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 ib = dm(li), nb = ib.right;
dm(tb).center;
const hm = nb;
function ab(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 or(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 Uo extends Map {
  constructor(e, l = ob) {
    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(Wo(this, e));
  }
  has(e) {
    return super.has(Wo(this, e));
  }
  set(e, l) {
    return super.set(rb(this, e), l);
  }
  delete(e) {
    return super.delete(sb(this, e));
  }
}
function Wo({ _intern: t, _key: e }, l) {
  const i = e(l);
  return t.has(i) ? t.get(i) : l;
}
function rb({ _intern: t, _key: e }, l) {
  const i = e(l);
  return t.has(i) ? t.get(i) : (t.set(i, l), l);
}
function sb({ _intern: t, _key: e }, l) {
  const i = e(l);
  return t.has(i) && (l = t.get(i), t.delete(i)), l;
}
function ob(t) {
  return t !== null && typeof t == "object" ? t.valueOf() : t;
}
function ub(t) {
  return t;
}
function fb(t = li) {
  if (t === li)
    return pm;
  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 pm(t, e) {
  return (t == null || !(t >= t)) - (e == null || !(e >= e)) || (t < e ? -1 : t > e ? 1 : 0);
}
var _b = Array.prototype, cb = _b.slice;
function ur(t) {
  return () => t;
}
const db = Math.sqrt(50), hb = Math.sqrt(10), pb = Math.sqrt(2);
function Ca(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 >= db ? 10 : a >= hb ? 5 : a >= pb ? 2 : 1;
  let s, o, _;
  return n < 0 ? (_ = Math.pow(10, -n) / r, s = Math.round(t * _), o = Math.round(e * _), s / _ < t && ++s, o / _ > e && --o, _ = -_) : (_ = Math.pow(10, n) * r, s = Math.round(t / _), o = Math.round(e / _), s * _ < t && ++s, o * _ > e && --o), o < s && 0.5 <= l && l < 2 ? Ca(t, e, l * 2) : [s, o, _];
}
function mm(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 ? Ca(e, t, l) : Ca(t, e, l);
  if (!(a >= n))
    return [];
  const s = a - n + 1, o = new Array(s);
  if (i)
    if (r < 0)
      for (let _ = 0; _ < s; ++_)
        o[_] = (a - _) / -r;
    else
      for (let _ = 0; _ < s; ++_)
        o[_] = (a - _) * r;
  else if (r < 0)
    for (let _ = 0; _ < s; ++_)
      o[_] = (n + _) / -r;
  else
    for (let _ = 0; _ < s; ++_)
      o[_] = (n + _) * r;
  return o;
}
function Li(t, e, l) {
  return e = +e, t = +t, l = +l, Ca(t, e, l)[2];
}
function mb(t, e, l) {
  e = +e, t = +t, l = +l;
  const i = e < t, n = i ? Li(e, t, l) : Li(t, e, l);
  return (i ? -1 : 1) * (n < 0 ? 1 / -n : n);
}
function gb(t, e, l) {
  let i;
  for (; ; ) {
    const n = Li(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 bb(t) {
  return Math.max(1, Math.ceil(Math.log(ab(t)) / Math.LN2) + 1);
}
function kb() {
  var t = ub, e = or, l = bb;
  function i(n) {
    Array.isArray(n) || (n = Array.from(n));
    var a, r = n.length, s, o, _ = new Array(r);
    for (a = 0; a < r; ++a)
      _[a] = t(n[a], a, n);
    var c = e(_), d = c[0], h = c[1], p = l(_, d, h);
    if (!Array.isArray(p)) {
      const w = h, q = +p;
      if (e === or && ([d, h] = gb(d, h, q)), p = mm(d, h, q), p[0] <= d && (o = Li(d, h, q)), p[p.length - 1] >= h)
        if (w >= h && e === or) {
          const $ = Li(d, h, q);
          isFinite($) && ($ > 0 ? h = (Math.floor(h / $) + 1) * $ : $ < 0 && (h = (Math.ceil(h * -$) + 1) / -$));
        } else
          p.pop();
    }
    for (var g = p.length, b = 0, k = g; p[b] <= d; )
      ++b;
    for (; p[k - 1] > h; )
      --k;
    (b || k < g) && (p = p.slice(b, k), g = k - b);
    var y = new Array(g + 1), v;
    for (a = 0; a <= g; ++a)
      v = y[a] = [], v.x0 = a > 0 ? p[a - 1] : d, v.x1 = a < g ? p[a] : h;
    if (isFinite(o)) {
      if (o > 0)
        for (a = 0; a < r; ++a)
          (s = _[a]) != null && d <= s && s <= h && y[Math.min(g, Math.floor((s - d) / o))].push(n[a]);
      else if (o < 0) {
        for (a = 0; a < r; ++a)
          if ((s = _[a]) != null && d <= s && s <= h) {
            const w = Math.floor((d - s) * o);
            y[Math.min(g, w + (p[w] <= s))].push(n[a]);
          }
      }
    } else
      for (a = 0; a < r; ++a)
        (s = _[a]) != null && d <= s && s <= h && y[hm(p, s, 0, g)].push(n[a]);
    return y;
  }
  return i.value = function(n) {
    return arguments.length ? (t = typeof n == "function" ? n : ur(n), i) : t;
  }, i.domain = function(n) {
    return arguments.length ? (e = typeof n == "function" ? n : ur([n[0], n[1]]), i) : e;
  }, i.thresholds = function(n) {
    return arguments.length ? (l = typeof n == "function" ? n : ur(Array.isArray(n) ? cb.call(n) : n), i) : l;
  }, i;
}
function yr(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 Jo(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 gm(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 ? pm : fb(n); i > l; ) {
    if (i - l > 600) {
      const o = i - l + 1, _ = 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) * (_ - o / 2 < 0 ? -1 : 1), p = Math.max(l, Math.floor(e - _ * d / o + h)), g = Math.min(i, Math.floor(e + (o - _) * d / o + h));
      gm(t, e, p, g, n);
    }
    const a = t[e];
    let r = l, s = i;
    for (sn(t, l, e), n(t[i], a) > 0 && sn(t, l, i); r < s; ) {
      for (sn(t, r, s), ++r, --s; n(t[r], a) < 0; )
        ++r;
      for (; n(t[s], a) > 0; )
        --s;
    }
    n(t[l], a) === 0 ? sn(t, l, s) : (++s, sn(t, s, i)), s <= e && (l = s + 1), e <= s && (i = s - 1);
  }
  return t;
}
function sn(t, e, l) {
  const i = t[e];
  t[e] = t[l], t[l] = i;
}
function vb(t, e, l) {
  if (t = Float64Array.from(lb(t, l)), !(!(i = t.length) || isNaN(e = +e))) {
    if (e <= 0 || i < 2)
      return Jo(t);
    if (e >= 1)
      return yr(t);
    var i, n = (i - 1) * e, a = Math.floor(n), r = yr(gm(t, a).subarray(0, a + 1)), s = Jo(t.subarray(a + 1));
    return r + (s - r) * (n - a);
  }
}
function Di(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 Ri(t, e) {
  return vb(t, 0.5, e);
}
function yb(t) {
  return t;
}
var ya = 1, wa = 2, wr = 3, _n = 4, Zo = 1e-6;
function wb(t) {
  return "translate(" + t + ",0)";
}
function $b(t) {
  return "translate(0," + t + ")";
}
function qb(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 Tb() {
  return !this.__axis;
}
function La(t, e) {
  var l = [], i = null, n = null, a = 6, r = 6, s = 3, o = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, _ = t === ya || t === _n ? -1 : 1, c = t === _n || t === wa ? "x" : "y", d = t === ya || t === wr ? wb : $b;
  function h(p) {
    var g = i ?? (e.ticks ? e.ticks.apply(e, l) : e.domain()), b = n ?? (e.tickFormat ? e.tickFormat.apply(e, l) : yb), k = Math.max(a, 0) + s, y = e.range(), v = +y[0] + o, w = +y[y.length - 1] + o, q = (e.bandwidth ? jb : qb)(e.copy(), o), $ = p.selection ? p.selection() : p, j = $.selectAll(".domain").data([null]), I = $.selectAll(".tick").data(g, e).order(), A = I.exit(), M = I.enter().append("g").attr("class", "tick"), z = I.select("line"), H = I.select("text");
    j = j.merge(j.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), I = I.merge(M), z = z.merge(M.append("line").attr("stroke", "currentColor").attr(c + "2", _ * a)), H = H.merge(M.append("text").attr("fill", "currentColor").attr(c, _ * k).attr("dy", t === ya ? "0em" : t === wr ? "0.71em" : "0.32em")), p !== $ && (j = j.transition(p), I = I.transition(p), z = z.transition(p), H = H.transition(p), A = A.transition(p).attr("opacity", Zo).attr("transform", function(B) {
      return isFinite(B = q(B)) ? d(B + o) : this.getAttribute("transform");
    }), M.attr("opacity", Zo).attr("transform", function(B) {
      var R = this.parentNode.__axis;
      return d((R && isFinite(R = R(B)) ? R : q(B)) + o);
    })), A.remove(), j.attr("d", t === _n || t === wa ? r ? "M" + _ * r + "," + v + "H" + o + "V" + w + "H" + _ * r : "M" + o + "," + v + "V" + w : r ? "M" + v + "," + _ * r + "V" + o + "H" + w + "V" + _ * r : "M" + v + "," + o + "H" + w), I.attr("opacity", 1).attr("transform", function(B) {
      return d(q(B) + o);
    }), z.attr(c + "2", _ * a), H.attr(c, _ * k).text(b), $.filter(Tb).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", t === wa ? "start" : t === _n ? "end" : "middle"), $.each(function() {
      this.__axis = q;
    });
  }
  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 Cb(t) {
  return La(ya, t);
}
function Sb(t) {
  return La(wa, t);
}
function Mb(t) {
  return La(wr, t);
}
function zb(t) {
  return La(_n, t);
}
var Nb = { value: () => {
} };
function bm() {
  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 $a(l);
}
function $a(t) {
  this._ = t;
}
function Ab(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 };
  });
}
$a.prototype = bm.prototype = {
  constructor: $a,
  on: function(t, e) {
    var l = this._, i = Ab(t + "", l), n, a = -1, r = i.length;
    if (arguments.length < 2) {
      for (; ++a < r; )
        if ((n = (t = i[a]).type) && (n = Bb(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] = xo(l[n], t.name, e);
      else if (e == null)
        for (n in l)
          l[n] = xo(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 $a(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 Bb(t, e) {
  for (var l = 0, i = t.length, n; l < i; ++l)
    if ((n = t[l]).name === e)
      return n.value;
}
function xo(t, e, l) {
  for (var i = 0, n = t.length; i < n; ++i)
    if (t[i].name === e) {
      t[i] = Nb, t = t.slice(0, i).concat(t.slice(i + 1));
      break;
    }
  return l != null && t.push({ name: e, value: l }), t;
}
var $r = "http://www.w3.org/1999/xhtml";
const eu = {
  svg: "http://www.w3.org/2000/svg",
  xhtml: $r,
  xlink: "http://www.w3.org/1999/xlink",
  xml: "http://www.w3.org/XML/1998/namespace",
  xmlns: "http://www.w3.org/2000/xmlns/"
};
function Fa(t) {
  var e = t += "", l = e.indexOf(":");
  return l >= 0 && (e = t.slice(0, l)) !== "xmlns" && (t = t.slice(l + 1)), eu.hasOwnProperty(e) ? { space: eu[e], local: t } : t;
}
function Pb(t) {
  return function() {
    var e = this.ownerDocument, l = this.namespaceURI;
    return l === $r && e.documentElement.namespaceURI === $r ? e.createElement(t) : e.createElementNS(l, t);
  };
}
function Ob(t) {
  return function() {
    return this.ownerDocument.createElementNS(t.space, t.local);
  };
}
function km(t) {
  var e = Fa(t);
  return (e.local ? Ob : Pb)(e);
}
function Eb() {
}
function Or(t) {
  return t == null ? Eb : function() {
    return this.querySelector(t);
  };
}
function Ib(t) {
  typeof t != "function" && (t = Or(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, _, c = 0; c < r; ++c)
      (o = a[c]) && (_ = t.call(o, o.__data__, c, a)) && ("__data__" in o && (_.__data__ = o.__data__), s[c] = _);
  return new el(i, this._parents);
}
function vm(t) {
  return t == null ? [] : Array.isArray(t) ? t : Array.from(t);
}
function Db() {
  return [];
}
function ym(t) {
  return t == null ? Db : function() {
    return this.querySelectorAll(t);
  };
}
function Rb(t) {
  return function() {
    return vm(t.apply(this, arguments));
  };
}
function Hb(t) {
  typeof t == "function" ? t = Rb(t) : t = ym(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, _ = 0; _ < s; ++_)
      (o = r[_]) && (i.push(t.call(o, o.__data__, _, r)), n.push(o));
  return new el(i, n);
}
function wm(t) {
  return function() {
    return this.matches(t);
  };
}
function $m(t) {
  return function(e) {
    return e.matches(t);
  };
}
var Lb = Array.prototype.find;
function Fb(t) {
  return function() {
    return Lb.call(this.children, t);
  };
}
function Qb() {
  return this.firstElementChild;
}
function Vb(t) {
  return this.select(t == null ? Qb : Fb(typeof t == "function" ? t : $m(t)));
}
var Xb = Array.prototype.filter;
function Gb() {
  return Array.from(this.children);
}
function Yb(t) {
  return function() {
    return Xb.call(this.children, t);
  };
}
function Kb(t) {
  return this.selectAll(t == null ? Gb : Yb(typeof t == "function" ? t : $m(t)));
}
function Ub(t) {
  typeof t != "function" && (t = wm(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, _ = 0; _ < r; ++_)
      (o = a[_]) && t.call(o, o.__data__, _, a) && s.push(o);
  return new el(i, this._parents);
}
function qm(t) {
  return new Array(t.length);
}
function Wb() {
  return new el(this._enter || this._groups.map(qm), this._parents);
}
function Sa(t, e) {
  this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = e;
}
Sa.prototype = {
  constructor: Sa,
  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 Jb(t) {
  return function() {
    return t;
  };
}
function Zb(t, e, l, i, n, a) {
  for (var r = 0, s, o = e.length, _ = a.length; r < _; ++r)
    (s = e[r]) ? (s.__data__ = a[r], i[r] = s) : l[r] = new Sa(t, a[r]);
  for (; r < o; ++r)
    (s = e[r]) && (n[r] = s);
}
function xb(t, e, l, i, n, a, r) {
  var s, o, _ = /* @__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) + "", _.has(p) ? n[s] = o : _.set(p, o));
  for (s = 0; s < d; ++s)
    p = r.call(t, a[s], s, a) + "", (o = _.get(p)) ? (i[s] = o, o.__data__ = a[s], _.delete(p)) : l[s] = new Sa(t, a[s]);
  for (s = 0; s < c; ++s)
    (o = e[s]) && _.get(h[s]) === o && (n[s] = o);
}
function ek(t) {
  return t.__data__;
}
function tk(t, e) {
  if (!arguments.length)
    return Array.from(this, ek);
  var l = e ? xb : Zb, i = this._parents, n = this._groups;
  typeof t != "function" && (t = Jb(t));
  for (var a = n.length, r = new Array(a), s = new Array(a), o = new Array(a), _ = 0; _ < a; ++_) {
    var c = i[_], d = n[_], h = d.length, p = lk(t.call(c, c && c.__data__, _, i)), g = p.length, b = s[_] = new Array(g), k = r[_] = new Array(g), y = o[_] = new Array(h);
    l(c, d, b, k, y, p, e);
    for (var v = 0, w = 0, q, $; v < g; ++v)
      if (q = b[v]) {
        for (v >= w && (w = v + 1); !($ = k[w]) && ++w < g; )
          ;
        q._next = $ || null;
      }
  }
  return r = new el(r, i), r._enter = s, r._exit = o, r;
}
function lk(t) {
  return typeof t == "object" && "length" in t ? t : Array.from(t);
}
function ik() {
  return new el(this._exit || this._groups.map(qm), this._parents);
}
function nk(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 ak(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 _ = l[o], c = i[o], d = _.length, h = s[o] = new Array(d), p, g = 0; g < d; ++g)
      (p = _[g] || c[g]) && (h[g] = p);
  for (; o < n; ++o)
    s[o] = l[o];
  return new el(s, this._parents);
}
function rk() {
  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 sk(t) {
  t || (t = ok);
  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), _, c = 0; c < s; ++c)
      (_ = r[c]) && (o[c] = _);
    o.sort(e);
  }
  return new el(n, this._parents).order();
}
function ok(t, e) {
  return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function uk() {
  var t = arguments[0];
  return arguments[0] = this, t.apply(null, arguments), this;
}
function fk() {
  return Array.from(this);
}
function _k() {
  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 ck() {
  let t = 0;
  for (const e of this)
    ++t;
  return t;
}
function dk() {
  return !this.node();
}
function hk(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 pk(t) {
  return function() {
    this.removeAttribute(t);
  };
}
function mk(t) {
  return function() {
    this.removeAttributeNS(t.space, t.local);
  };
}
function gk(t, e) {
  return function() {
    this.setAttribute(t, e);
  };
}
function bk(t, e) {
  return function() {
    this.setAttributeNS(t.space, t.local, e);
  };
}
function kk(t, e) {
  return function() {
    var l = e.apply(this, arguments);
    l == null ? this.removeAttribute(t) : this.setAttribute(t, l);
  };
}
function vk(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 yk(t, e) {
  var l = Fa(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 ? mk : pk : typeof e == "function" ? l.local ? vk : kk : l.local ? bk : gk)(l, e));
}
function jm(t) {
  return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView;
}
function wk(t) {
  return function() {
    this.style.removeProperty(t);
  };
}
function $k(t, e, l) {
  return function() {
    this.style.setProperty(t, e, l);
  };
}
function qk(t, e, l) {
  return function() {
    var i = e.apply(this, arguments);
    i == null ? this.style.removeProperty(t) : this.style.setProperty(t, i, l);
  };
}
function jk(t, e, l) {
  return arguments.length > 1 ? this.each((e == null ? wk : typeof e == "function" ? qk : $k)(t, e, l ?? "")) : Fi(this.node(), t);
}
function Fi(t, e) {
  return t.style.getPropertyValue(e) || jm(t).getComputedStyle(t, null).getPropertyValue(e);
}
function Tk(t) {
  return function() {
    delete this[t];
  };
}
function Ck(t, e) {
  return function() {
    this[t] = e;
  };
}
function Sk(t, e) {
  return function() {
    var l = e.apply(this, arguments);
    l == null ? delete this[t] : this[t] = l;
  };
}
function Mk(t, e) {
  return arguments.length > 1 ? this.each((e == null ? Tk : typeof e == "function" ? Sk : Ck)(t, e)) : this.node()[t];
}
function Tm(t) {
  return t.trim().split(/^|\s+/);
}
function Er(t) {
  return t.classList || new Cm(t);
}
function Cm(t) {
  this._node = t, this._names = Tm(t.getAttribute("class") || "");
}
Cm.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 Sm(t, e) {
  for (var l = Er(t), i = -1, n = e.length; ++i < n; )
    l.add(e[i]);
}
function Mm(t, e) {
  for (var l = Er(t), i = -1, n = e.length; ++i < n; )
    l.remove(e[i]);
}
function zk(t) {
  return function() {
    Sm(this, t);
  };
}
function Nk(t) {
  return function() {
    Mm(this, t);
  };
}
function Ak(t, e) {
  return function() {
    (e.apply(this, arguments) ? Sm : Mm)(this, t);
  };
}
function Bk(t, e) {
  var l = Tm(t + "");
  if (arguments.length < 2) {
    for (var i = Er(this.node()), n = -1, a = l.length; ++n < a; )
      if (!i.contains(l[n]))
        return !1;
    return !0;
  }
  return this.each((typeof e == "function" ? Ak : e ? zk : Nk)(l, e));
}
function Pk() {
  this.textContent = "";
}
function Ok(t) {
  return function() {
    this.textContent = t;
  };
}
function Ek(t) {
  return function() {
    var e = t.apply(this, arguments);
    this.textContent = e ?? "";
  };
}
function Ik(t) {
  return arguments.length ? this.each(t == null ? Pk : (typeof t == "function" ? Ek : Ok)(t)) : this.node().textContent;
}
function Dk() {
  this.innerHTML = "";
}
function Rk(t) {
  return function() {
    this.innerHTML = t;
  };
}
function Hk(t) {
  return function() {
    var e = t.apply(this, arguments);
    this.innerHTML = e ?? "";
  };
}
function Lk(t) {
  return arguments.length ? this.each(t == null ? Dk : (typeof t == "function" ? Hk : Rk)(t)) : this.node().innerHTML;
}
function Fk() {
  this.nextSibling && this.parentNode.appendChild(this);
}
function Qk() {
  return this.each(Fk);
}
function Vk() {
  this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
}
function Xk() {
  return this.each(Vk);
}
function Gk(t) {
  var e = typeof t == "function" ? t : km(t);
  return this.select(function() {
    return this.appendChild(e.apply(this, arguments));
  });
}
function Yk() {
  return null;
}
function Kk(t, e) {
  var l = typeof t == "function" ? t : km(t), i = e == null ? Yk : typeof e == "function" ? e : Or(e);
  return this.select(function() {
    return this.insertBefore(l.apply(this, arguments), i.apply(this, arguments) || null);
  });
}
function Uk() {
  var t = this.parentNode;
  t && t.removeChild(this);
}
function Wk() {
  return this.each(Uk);
}
function Jk() {
  var t = this.cloneNode(!1), e = this.parentNode;
  return e ? e.insertBefore(t, this.nextSibling) : t;
}
function Zk() {
  var t = this.cloneNode(!0), e = this.parentNode;
  return e ? e.insertBefore(t, this.nextSibling) : t;
}
function xk(t) {
  return this.select(t ? Zk : Jk);
}
function ev(t) {
  return arguments.length ? this.property("__data__", t) : this.node().__data__;
}
function tv(t) {
  return function(e) {
    t.call(this, e, this.__data__);
  };
}
function lv(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 iv(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 nv(t, e, l) {
  return function() {
    var i = this.__on, n, a = tv(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 av(t, e, l) {
  var i = lv(t + ""), n, a = i.length, r;
  if (arguments.length < 2) {
    var s = this.node().__on;
    if (s) {
      for (var o = 0, _ = s.length, c; o < _; ++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 ? nv : iv, n = 0; n < a; ++n)
    this.each(s(i[n], e, l));
  return this;
}
function zm(t, e, l) {
  var i = jm(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 rv(t, e) {
  return function() {
    return zm(this, t, e);
  };
}
function sv(t, e) {
  return function() {
    return zm(this, t, e.apply(this, arguments));
  };
}
function ov(t, e) {
  return this.each((typeof e == "function" ? sv : rv)(t, e));
}
function* uv() {
  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 Ir = [null];
function el(t, e) {
  this._groups = t, this._parents = e;
}
function vn() {
  return new el([[document.documentElement]], Ir);
}
function fv() {
  return this;
}
el.prototype = vn.prototype = {
  constructor: el,
  select: Ib,
  selectAll: Hb,
  selectChild: Vb,
  selectChildren: Kb,
  filter: Ub,
  data: tk,
  enter: Wb,
  exit: ik,
  join: nk,
  merge: ak,
  selection: fv,
  order: rk,
  sort: sk,
  call: uk,
  nodes: fk,
  node: _k,
  size: ck,
  empty: dk,
  each: hk,
  attr: yk,
  style: jk,
  property: Mk,
  classed: Bk,
  text: Ik,
  html: Lk,
  raise: Qk,
  lower: Xk,
  append: Gk,
  insert: Kk,
  remove: Wk,
  clone: xk,
  datum: ev,
  on: av,
  dispatch: ov,
  [Symbol.iterator]: uv
};
function tu(t) {
  return typeof t == "string" ? new el([[document.querySelector(t)]], [document.documentElement]) : new el([[t]], Ir);
}
function lu(t) {
  return typeof t == "string" ? new el([document.querySelectorAll(t)], [document.documentElement]) : new el([vm(t)], Ir);
}
function Dr(t, e, l) {
  t.prototype = e.prototype = l, l.constructor = t;
}
function Nm(t, e) {
  var l = Object.create(t.prototype);
  for (var i in e)
    l[i] = e[i];
  return l;
}
function yn() {
}
var gn = 0.7, Ma = 1 / gn, Hi = "\\s*([+-]?\\d+)\\s*", bn = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", vl = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", _v = /^#([0-9a-f]{3,8})$/, cv = new RegExp(`^rgb\\(${Hi},${Hi},${Hi}\\)$`), dv = new RegExp(`^rgb\\(${vl},${vl},${vl}\\)$`), hv = new RegExp(`^rgba\\(${Hi},${Hi},${Hi},${bn}\\)$`), pv = new RegExp(`^rgba\\(${vl},${vl},${vl},${bn}\\)$`), mv = new RegExp(`^hsl\\(${bn},${vl},${vl}\\)$`), gv = new RegExp(`^hsla\\(${bn},${vl},${vl},${bn}\\)$`), iu = {
  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
};
Dr(yn, ni, {
  copy(t) {
    return Object.assign(new this.constructor(), this, t);
  },
  displayable() {
    return this.rgb().displayable();
  },
  hex: nu,
  // Deprecated! Use color.formatHex.
  formatHex: nu,
  formatHex8: bv,
  formatHsl: kv,
  formatRgb: au,
  toString: au
});
function nu() {
  return this.rgb().formatHex();
}
function bv() {
  return this.rgb().formatHex8();
}
function kv() {
  return Am(this).formatHsl();
}
function au() {
  return this.rgb().formatRgb();
}
function ni(t) {
  var e, l;
  return t = (t + "").trim().toLowerCase(), (e = _v.exec(t)) ? (l = e[1].length, e = parseInt(e[1], 16), l === 6 ? ru(e) : l === 3 ? new ll(e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, (e & 15) << 4 | e & 15, 1) : l === 8 ? pa(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, (e & 255) / 255) : l === 4 ? pa(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 = cv.exec(t)) ? new ll(e[1], e[2], e[3], 1) : (e = dv.exec(t)) ? new ll(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, 1) : (e = hv.exec(t)) ? pa(e[1], e[2], e[3], e[4]) : (e = pv.exec(t)) ? pa(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, e[4]) : (e = mv.exec(t)) ? uu(e[1], e[2] / 100, e[3] / 100, 1) : (e = gv.exec(t)) ? uu(e[1], e[2] / 100, e[3] / 100, e[4]) : iu.hasOwnProperty(t) ? ru(iu[t]) : t === "transparent" ? new ll(NaN, NaN, NaN, 0) : null;
}
function ru(t) {
  return new ll(t >> 16 & 255, t >> 8 & 255, t & 255, 1);
}
function pa(t, e, l, i) {
  return i <= 0 && (t = e = l = NaN), new ll(t, e, l, i);
}
function vv(t) {
  return t instanceof yn || (t = ni(t)), t ? (t = t.rgb(), new ll(t.r, t.g, t.b, t.opacity)) : new ll();
}
function za(t, e, l, i) {
  return arguments.length === 1 ? vv(t) : new ll(t, e, l, i ?? 1);
}
function ll(t, e, l, i) {
  this.r = +t, this.g = +e, this.b = +l, this.opacity = +i;
}
Dr(ll, za, Nm(yn, {
  brighter(t) {
    return t = t == null ? Ma : Math.pow(Ma, t), new ll(this.r * t, this.g * t, this.b * t, this.opacity);
  },
  darker(t) {
    return t = t == null ? gn : Math.pow(gn, t), new ll(this.r * t, this.g * t, this.b * t, this.opacity);
  },
  rgb() {
    return this;
  },
  clamp() {
    return new ll(ii(this.r), ii(this.g), ii(this.b), Na(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: su,
  // Deprecated! Use color.formatHex.
  formatHex: su,
  formatHex8: yv,
  formatRgb: ou,
  toString: ou
}));
function su() {
  return `#${ti(this.r)}${ti(this.g)}${ti(this.b)}`;
}
function yv() {
  return `#${ti(this.r)}${ti(this.g)}${ti(this.b)}${ti((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}
function ou() {
  const t = Na(this.opacity);
  return `${t === 1 ? "rgb(" : "rgba("}${ii(this.r)}, ${ii(this.g)}, ${ii(this.b)}${t === 1 ? ")" : `, ${t})`}`;
}
function Na(t) {
  return isNaN(t) ? 1 : Math.max(0, Math.min(1, t));
}
function ii(t) {
  return Math.max(0, Math.min(255, Math.round(t) || 0));
}
function ti(t) {
  return t = ii(t), (t < 16 ? "0" : "") + t.toString(16);
}
function uu(t, e, l, i) {
  return i <= 0 ? t = e = l = NaN : l <= 0 || l >= 1 ? t = e = NaN : e <= 0 && (t = NaN), new hl(t, e, l, i);
}
function Am(t) {
  if (t instanceof hl)
    return new hl(t.h, t.s, t.l, t.opacity);
  if (t instanceof yn || (t = ni(t)), !t)
    return new hl();
  if (t instanceof hl)
    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 hl(r, s, o, t.opacity);
}
function wv(t, e, l, i) {
  return arguments.length === 1 ? Am(t) : new hl(t, e, l, i ?? 1);
}
function hl(t, e, l, i) {
  this.h = +t, this.s = +e, this.l = +l, this.opacity = +i;
}
Dr(hl, wv, Nm(yn, {
  brighter(t) {
    return t = t == null ? Ma : Math.pow(Ma, t), new hl(this.h, this.s, this.l * t, this.opacity);
  },
  darker(t) {
    return t = t == null ? gn : Math.pow(gn, t), new hl(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 ll(
      fr(t >= 240 ? t - 240 : t + 120, n, i),
      fr(t, n, i),
      fr(t < 120 ? t + 240 : t - 120, n, i),
      this.opacity
    );
  },
  clamp() {
    return new hl(fu(this.h), ma(this.s), ma(this.l), Na(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 = Na(this.opacity);
    return `${t === 1 ? "hsl(" : "hsla("}${fu(this.h)}, ${ma(this.s) * 100}%, ${ma(this.l) * 100}%${t === 1 ? ")" : `, ${t})`}`;
  }
}));
function fu(t) {
  return t = (t || 0) % 360, t < 0 ? t + 360 : t;
}
function ma(t) {
  return Math.max(0, Math.min(1, t || 0));
}
function fr(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 $v(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 qv(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 $v((l - i / e) * e, r, n, a, s);
  };
}
const Rr = (t) => () => t;
function jv(t, e) {
  return function(l) {
    return t + l * e;
  };
}
function Tv(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 Cv(t) {
  return (t = +t) == 1 ? Bm : function(e, l) {
    return l - e ? Tv(e, l, t) : Rr(isNaN(e) ? l : e);
  };
}
function Bm(t, e) {
  var l = e - t;
  return l ? jv(t, l) : Rr(isNaN(t) ? e : t);
}
const Aa = function t(e) {
  var l = Cv(e);
  function i(n, a) {
    var r = l((n = za(n)).r, (a = za(a)).r), s = l(n.g, a.g), o = l(n.b, a.b), _ = Bm(n.opacity, a.opacity);
    return function(c) {
      return n.r = r(c), n.g = s(c), n.b = o(c), n.opacity = _(c), n + "";
    };
  }
  return i.gamma = t, i;
}(1);
function Sv(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 = za(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 Mv = Sv(qv);
function zv(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 Nv(t) {
  return ArrayBuffer.isView(t) && !(t instanceof DataView);
}
function Av(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] = Qa(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 Bv(t, e) {
  var l = /* @__PURE__ */ new Date();
  return t = +t, e = +e, function(i) {
    return l.setTime(t * (1 - i) + e * i), l;
  };
}
function dl(t, e) {
  return t = +t, e = +e, function(l) {
    return t * (1 - l) + e * l;
  };
}
function Pv(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] = Qa(t[n], e[n]) : i[n] = e[n];
  return function(a) {
    for (n in l)
      i[n] = l[n](a);
    return i;
  };
}
var qr = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, _r = new RegExp(qr.source, "g");
function Ov(t) {
  return function() {
    return t;
  };
}
function Ev(t) {
  return function(e) {
    return t(e) + "";
  };
}
function Pm(t, e) {
  var l = qr.lastIndex = _r.lastIndex = 0, i, n, a, r = -1, s = [], o = [];
  for (t = t + "", e = e + ""; (i = qr.exec(t)) && (n = _r.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: dl(i, n) })), l = _r.lastIndex;
  return l < e.length && (a = e.slice(l), s[r] ? s[r] += a : s[++r] = a), s.length < 2 ? o[0] ? Ev(o[0].x) : Ov(e) : (e = o.length, function(_) {
    for (var c = 0, d; c < e; ++c)
      s[(d = o[c]).i] = d.x(_);
    return s.join("");
  });
}
function Qa(t, e) {
  var l = typeof e, i;
  return e == null || l === "boolean" ? Rr(e) : (l === "number" ? dl : l === "string" ? (i = ni(e)) ? (e = i, Aa) : Pm : e instanceof ni ? Aa : e instanceof Date ? Bv : Nv(e) ? zv : Array.isArray(e) ? Av : typeof e.valueOf != "function" && typeof e.toString != "function" || isNaN(e) ? Pv : dl)(t, e);
}
function Om(t, e) {
  return t = +t, e = +e, function(l) {
    return Math.round(t * (1 - l) + e * l);
  };
}
var _u = 180 / Math.PI, jr = {
  translateX: 0,
  translateY: 0,
  rotate: 0,
  skewX: 0,
  scaleX: 1,
  scaleY: 1
};
function Em(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) * _u,
    skewX: Math.atan(o) * _u,
    scaleX: r,
    scaleY: s
  };
}
var ga;
function Iv(t) {
  const e = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(t + "");
  return e.isIdentity ? jr : Em(e.a, e.b, e.c, e.d, e.e, e.f);
}
function Dv(t) {
  return t == null || (ga || (ga = document.createElementNS("http://www.w3.org/2000/svg", "g")), ga.setAttribute("transform", t), !(t = ga.transform.baseVal.consolidate())) ? jr : (t = t.matrix, Em(t.a, t.b, t.c, t.d, t.e, t.f));
}
function Im(t, e, l, i) {
  function n(_) {
    return _.length ? _.pop() + " " : "";
  }
  function a(_, c, d, h, p, g) {
    if (_ !== d || c !== h) {
      var b = p.push("translate(", null, e, null, l);
      g.push({ i: b - 4, x: dl(_, d) }, { i: b - 2, x: dl(c, h) });
    } else
      (d || h) && p.push("translate(" + d + e + h + l);
  }
  function r(_, c, d, h) {
    _ !== c ? (_ - c > 180 ? c += 360 : c - _ > 180 && (_ += 360), h.push({ i: d.push(n(d) + "rotate(", null, i) - 2, x: dl(_, c) })) : c && d.push(n(d) + "rotate(" + c + i);
  }
  function s(_, c, d, h) {
    _ !== c ? h.push({ i: d.push(n(d) + "skewX(", null, i) - 2, x: dl(_, c) }) : c && d.push(n(d) + "skewX(" + c + i);
  }
  function o(_, c, d, h, p, g) {
    if (_ !== d || c !== h) {
      var b = p.push(n(p) + "scale(", null, ",", null, ")");
      g.push({ i: b - 4, x: dl(_, d) }, { i: b - 2, x: dl(c, h) });
    } else
      (d !== 1 || h !== 1) && p.push(n(p) + "scale(" + d + "," + h + ")");
  }
  return function(_, c) {
    var d = [], h = [];
    return _ = t(_), c = t(c), a(_.translateX, _.translateY, c.translateX, c.translateY, d, h), r(_.rotate, c.rotate, d, h), s(_.skewX, c.skewX, d, h), o(_.scaleX, _.scaleY, c.scaleX, c.scaleY, d, h), _ = c = null, function(p) {
      for (var g = -1, b = h.length, k; ++g < b; )
        d[(k = h[g]).i] = k.x(p);
      return d.join("");
    };
  };
}
var Rv = Im(Iv, "px, ", "px)", "deg)"), Hv = Im(Dv, ", ", ")", ")"), Qi = 0, cn = 0, on = 0, Dm = 1e3, Ba, dn, Pa = 0, ai = 0, Va = 0, kn = typeof performance == "object" && performance.now ? performance : Date, Rm = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(t) {
  setTimeout(t, 17);
};
function Hr() {
  return ai || (Rm(Lv), ai = kn.now() + Va);
}
function Lv() {
  ai = 0;
}
function Oa() {
  this._call = this._time = this._next = null;
}
Oa.prototype = Lr.prototype = {
  constructor: Oa,
  restart: function(t, e, l) {
    if (typeof t != "function")
      throw new TypeError("callback is not a function");
    l = (l == null ? Hr() : +l) + (e == null ? 0 : +e), !this._next && dn !== this && (dn ? dn._next = this : Ba = this, dn = this), this._call = t, this._time = l, Tr();
  },
  stop: function() {
    this._call && (this._call = null, this._time = 1 / 0, Tr());
  }
};
function Lr(t, e, l) {
  var i = new Oa();
  return i.restart(t, e, l), i;
}
function Fv() {
  Hr(), ++Qi;
  for (var t = Ba, e; t; )
    (e = ai - t._time) >= 0 && t._call.call(void 0, e), t = t._next;
  --Qi;
}
function cu() {
  ai = (Pa = kn.now()) + Va, Qi = cn = 0;
  try {
    Fv();
  } finally {
    Qi = 0, Vv(), ai = 0;
  }
}
function Qv() {
  var t = kn.now(), e = t - Pa;
  e > Dm && (Va -= e, Pa = t);
}
function Vv() {
  for (var t, e = Ba, 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 : Ba = l);
  dn = t, Tr(i);
}
function Tr(t) {
  if (!Qi) {
    cn && (cn = clearTimeout(cn));
    var e = t - ai;
    e > 24 ? (t < 1 / 0 && (cn = setTimeout(cu, t - kn.now() - Va)), on && (on = clearInterval(on))) : (on || (Pa = kn.now(), on = setInterval(Qv, Dm)), Qi = 1, Rm(cu));
  }
}
function du(t, e, l) {
  var i = new Oa();
  return e = e == null ? 0 : +e, i.restart((n) => {
    i.stop(), t(n + e);
  }, e, l), i;
}
var Xv = bm("start", "end", "cancel", "interrupt"), Gv = [], Hm = 0, hu = 1, Cr = 2, qa = 3, pu = 4, Sr = 5, ja = 6;
function Xa(t, e, l, i, n, a) {
  var r = t.__transition;
  if (!r)
    t.__transition = {};
  else if (l in r)
    return;
  Yv(t, l, {
    name: e,
    index: i,
    // For context during callback.
    group: n,
    // For context during callback.
    on: Xv,
    tween: Gv,
    time: a.time,
    delay: a.delay,
    duration: a.duration,
    ease: a.ease,
    timer: null,
    state: Hm
  });
}
function Fr(t, e) {
  var l = pl(t, e);
  if (l.state > Hm)
    throw new Error("too late; already scheduled");
  return l;
}
function $l(t, e) {
  var l = pl(t, e);
  if (l.state > qa)
    throw new Error("too late; already running");
  return l;
}
function pl(t, e) {
  var l = t.__transition;
  if (!l || !(l = l[e]))
    throw new Error("transition not found");
  return l;
}
function Yv(t, e, l) {
  var i = t.__transition, n;
  i[e] = l, l.timer = Lr(a, 0, l.time);
  function a(_) {
    l.state = hu, l.timer.restart(r, l.delay, l.time), l.delay <= _ && r(_ - l.delay);
  }
  function r(_) {
    var c, d, h, p;
    if (l.state !== hu)
      return o();
    for (c in i)
      if (p = i[c], p.name === l.name) {
        if (p.state === qa)
          return du(r);
        p.state === pu ? (p.state = ja, p.timer.stop(), p.on.call("interrupt", t, t.__data__, p.index, p.group), delete i[c]) : +c < e && (p.state = ja, p.timer.stop(), p.on.call("cancel", t, t.__data__, p.index, p.group), delete i[c]);
      }
    if (du(function() {
      l.state === qa && (l.state = pu, l.timer.restart(s, l.delay, l.time), s(_));
    }), l.state = Cr, l.on.call("start", t, t.__data__, l.index, l.group), l.state === Cr) {
      for (l.state = qa, 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(_) {
    for (var c = _ < l.duration ? l.ease.call(null, _ / l.duration) : (l.timer.restart(o), l.state = Sr, 1), d = -1, h = n.length; ++d < h; )
      n[d].call(t, c);
    l.state === Sr && (l.on.call("end", t, t.__data__, l.index, l.group), o());
  }
  function o() {
    l.state = ja, l.timer.stop(), delete i[e];
    for (var _ in i)
      return;
    delete t.__transition;
  }
}
function Kv(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 > Cr && i.state < Sr, i.state = ja, i.timer.stop(), i.on.call(n ? "interrupt" : "cancel", t, t.__data__, i.index, i.group), delete l[r];
    }
    a && delete t.__transition;
  }
}
function Uv(t) {
  return this.each(function() {
    Kv(this, t);
  });
}
function Wv(t, e) {
  var l, i;
  return function() {
    var n = $l(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 Jv(t, e, l) {
  var i, n;
  if (typeof l != "function")
    throw new Error();
  return function() {
    var a = $l(this, t), r = a.tween;
    if (r !== i) {
      n = (i = r).slice();
      for (var s = { name: e, value: l }, o = 0, _ = n.length; o < _; ++o)
        if (n[o].name === e) {
          n[o] = s;
          break;
        }
      o === _ && n.push(s);
    }
    a.tween = n;
  };
}
function Zv(t, e) {
  var l = this._id;
  if (t += "", arguments.length < 2) {
    for (var i = pl(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 ? Wv : Jv)(l, t, e));
}
function Qr(t, e, l) {
  var i = t._id;
  return t.each(function() {
    var n = $l(this, i);
    (n.value || (n.value = {}))[e] = l.apply(this, arguments);
  }), function(n) {
    return pl(n, i).value[e];
  };
}
function Lm(t, e) {
  var l;
  return (typeof e == "number" ? dl : e instanceof ni ? Aa : (l = ni(e)) ? (e = l, Aa) : Pm)(t, e);
}
function xv(t) {
  return function() {
    this.removeAttribute(t);
  };
}
function e2(t) {
  return function() {
    this.removeAttributeNS(t.space, t.local);
  };
}
function t2(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 l2(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 i2(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 n2(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 a2(t, e) {
  var l = Fa(t), i = l === "transform" ? Hv : Lm;
  return this.attrTween(t, typeof e == "function" ? (l.local ? n2 : i2)(l, i, Qr(this, "attr." + t, e)) : e == null ? (l.local ? e2 : xv)(l) : (l.local ? l2 : t2)(l, i, e));
}
function r2(t, e) {
  return function(l) {
    this.setAttribute(t, e.call(this, l));
  };
}
function s2(t, e) {
  return function(l) {
    this.setAttributeNS(t.space, t.local, e.call(this, l));
  };
}
function o2(t, e) {
  var l, i;
  function n() {
    var a = e.apply(this, arguments);
    return a !== i && (l = (i = a) && s2(t, a)), l;
  }
  return n._value = e, n;
}
function u2(t, e) {
  var l, i;
  function n() {
    var a = e.apply(this, arguments);
    return a !== i && (l = (i = a) && r2(t, a)), l;
  }
  return n._value = e, n;
}
function f2(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 = Fa(t);
  return this.tween(l, (i.local ? o2 : u2)(i, e));
}
function _2(t, e) {
  return function() {
    Fr(this, t).delay = +e.apply(this, arguments);
  };
}
function c2(t, e) {
  return e = +e, function() {
    Fr(this, t).delay = e;
  };
}
function d2(t) {
  var e = this._id;
  return arguments.length ? this.each((typeof t == "function" ? _2 : c2)(e, t)) : pl(this.node(), e).delay;
}
function h2(t, e) {
  return function() {
    $l(this, t).duration = +e.apply(this, arguments);
  };
}
function p2(t, e) {
  return e = +e, function() {
    $l(this, t).duration = e;
  };
}
function m2(t) {
  var e = this._id;
  return arguments.length ? this.each((typeof t == "function" ? h2 : p2)(e, t)) : pl(this.node(), e).duration;
}
function g2(t, e) {
  if (typeof e != "function")
    throw new Error();
  return function() {
    $l(this, t).ease = e;
  };
}
function b2(t) {
  var e = this._id;
  return arguments.length ? this.each(g2(e, t)) : pl(this.node(), e).ease;
}
function k2(t, e) {
  return function() {
    var l = e.apply(this, arguments);
    if (typeof l != "function")
      throw new Error();
    $l(this, t).ease = l;
  };
}
function v2(t) {
  if (typeof t != "function")
    throw new Error();
  return this.each(k2(this._id, t));
}
function y2(t) {
  typeof t != "function" && (t = wm(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, _ = 0; _ < r; ++_)
      (o = a[_]) && t.call(o, o.__data__, _, a) && s.push(o);
  return new zl(i, this._parents, this._name, this._id);
}
function w2(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], _ = l[s], c = o.length, d = r[s] = new Array(c), h, p = 0; p < c; ++p)
      (h = o[p] || _[p]) && (d[p] = h);
  for (; s < i; ++s)
    r[s] = e[s];
  return new zl(r, this._parents, this._name, this._id);
}
function $2(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 q2(t, e, l) {
  var i, n, a = $2(e) ? Fr : $l;
  return function() {
    var r = a(this, t), s = r.on;
    s !== i && (n = (i = s).copy()).on(e, l), r.on = n;
  };
}
function j2(t, e) {
  var l = this._id;
  return arguments.length < 2 ? pl(this.node(), l).on.on(t) : this.each(q2(l, t, e));
}
function T2(t) {
  return function() {
    var e = this.parentNode;
    for (var l in this.__transition)
      if (+l !== t)
        return;
    e && e.removeChild(this);
  };
}
function C2() {
  return this.on("end.remove", T2(this._id));
}
function S2(t) {
  var e = this._name, l = this._id;
  typeof t != "function" && (t = Or(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, _ = 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__), _[h] = d, Xa(_[h], e, l, h, _, pl(c, l)));
  return new zl(a, this._parents, e, l);
}
function M2(t) {
  var e = this._name, l = this._id;
  typeof t != "function" && (t = ym(t));
  for (var i = this._groups, n = i.length, a = [], r = [], s = 0; s < n; ++s)
    for (var o = i[s], _ = o.length, c, d = 0; d < _; ++d)
      if (c = o[d]) {
        for (var h = t.call(c, c.__data__, d, o), p, g = pl(c, l), b = 0, k = h.length; b < k; ++b)
          (p = h[b]) && Xa(p, e, l, b, h, g);
        a.push(h), r.push(c);
      }
  return new zl(a, r, e, l);
}
var z2 = vn.prototype.constructor;
function N2() {
  return new z2(this._groups, this._parents);
}
function A2(t, e) {
  var l, i, n;
  return function() {
    var a = Fi(this, t), r = (this.style.removeProperty(t), Fi(this, t));
    return a === r ? null : a === l && r === i ? n : n = e(l = a, i = r);
  };
}
function Fm(t) {
  return function() {
    this.style.removeProperty(t);
  };
}
function B2(t, e, l) {
  var i, n = l + "", a;
  return function() {
    var r = Fi(this, t);
    return r === n ? null : r === i ? a : a = e(i = r, l);
  };
}
function P2(t, e, l) {
  var i, n, a;
  return function() {
    var r = Fi(this, t), s = l(this), o = s + "";
    return s == null && (o = s = (this.style.removeProperty(t), Fi(this, t))), r === o ? null : r === i && o === n ? a : (n = o, a = e(i = r, s));
  };
}
function O2(t, e) {
  var l, i, n, a = "style." + e, r = "end." + a, s;
  return function() {
    var o = $l(this, t), _ = o.on, c = o.value[a] == null ? s || (s = Fm(e)) : void 0;
    (_ !== l || n !== c) && (i = (l = _).copy()).on(r, n = c), o.on = i;
  };
}
function E2(t, e, l) {
  var i = (t += "") == "transform" ? Rv : Lm;
  return e == null ? this.styleTween(t, A2(t, i)).on("end.style." + t, Fm(t)) : typeof e == "function" ? this.styleTween(t, P2(t, i, Qr(this, "style." + t, e))).each(O2(this._id, t)) : this.styleTween(t, B2(t, i, e), l).on("end.style." + t, null);
}
function I2(t, e, l) {
  return function(i) {
    this.style.setProperty(t, e.call(this, i), l);
  };
}
function D2(t, e, l) {
  var i, n;
  function a() {
    var r = e.apply(this, arguments);
    return r !== n && (i = (n = r) && I2(t, r, l)), i;
  }
  return a._value = e, a;
}
function R2(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, D2(t, e, l ?? ""));
}
function H2(t) {
  return function() {
    this.textContent = t;
  };
}
function L2(t) {
  return function() {
    var e = t(this);
    this.textContent = e ?? "";
  };
}
function F2(t) {
  return this.tween("text", typeof t == "function" ? L2(Qr(this, "text", t)) : H2(t == null ? "" : t + ""));
}
function Q2(t) {
  return function(e) {
    this.textContent = t.call(this, e);
  };
}
function V2(t) {
  var e, l;
  function i() {
    var n = t.apply(this, arguments);
    return n !== l && (e = (l = n) && Q2(n)), e;
  }
  return i._value = t, i;
}
function X2(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, V2(t));
}
function G2() {
  for (var t = this._name, e = this._id, l = Qm(), i = this._groups, n = i.length, a = 0; a < n; ++a)
    for (var r = i[a], s = r.length, o, _ = 0; _ < s; ++_)
      if (o = r[_]) {
        var c = pl(o, e);
        Xa(o, t, l, _, r, {
          time: c.time + c.delay + c.duration,
          delay: 0,
          duration: c.duration,
          ease: c.ease
        });
      }
  return new zl(i, this._parents, t, l);
}
function Y2() {
  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 _ = $l(this, i), c = _.on;
      c !== t && (e = (t = c).copy(), e._.cancel.push(s), e._.interrupt.push(s), e._.end.push(o)), _.on = e;
    }), n === 0 && a();
  });
}
var K2 = 0;
function zl(t, e, l, i) {
  this._groups = t, this._parents = e, this._name = l, this._id = i;
}
function Qm() {
  return ++K2;
}
var Tl = vn.prototype;
zl.prototype = {
  constructor: zl,
  select: S2,
  selectAll: M2,
  selectChild: Tl.selectChild,
  selectChildren: Tl.selectChildren,
  filter: y2,
  merge: w2,
  selection: N2,
  transition: G2,
  call: Tl.call,
  nodes: Tl.nodes,
  node: Tl.node,
  size: Tl.size,
  empty: Tl.empty,
  each: Tl.each,
  on: j2,
  attr: a2,
  attrTween: f2,
  style: E2,
  styleTween: R2,
  text: F2,
  textTween: X2,
  remove: C2,
  tween: Zv,
  delay: d2,
  duration: m2,
  ease: b2,
  easeVarying: v2,
  end: Y2,
  [Symbol.iterator]: Tl[Symbol.iterator]
};
function U2(t) {
  return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
}
var W2 = {
  time: null,
  // Set on use.
  delay: 0,
  duration: 250,
  ease: U2
};
function J2(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 Z2(t) {
  var e, l;
  t instanceof zl ? (e = t._id, t = t._name) : (e = Qm(), (l = W2).time = Hr(), 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, _ = 0; _ < s; ++_)
      (o = r[_]) && Xa(o, t, e, _, r, l || J2(o, e));
  return new zl(i, this._parents, t, e);
}
vn.prototype.interrupt = Uv;
vn.prototype.transition = Z2;
const Mr = Math.PI, zr = 2 * Mr, Zl = 1e-6, x2 = zr - Zl;
function Vm(t) {
  this._ += t[0];
  for (let e = 1, l = t.length; e < l; ++e)
    this._ += arguments[e] + t[e];
}
function ey(t) {
  let e = Math.floor(t);
  if (!(e >= 0))
    throw new Error(`invalid digits: ${t}`);
  if (e > 15)
    return Vm;
  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 ty {
  constructor(e) {
    this._x0 = this._y0 = // start of current subpath
    this._x1 = this._y1 = null, this._ = "", this._append = e == null ? Vm : ey(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, _ = 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 > Zl)
      if (!(Math.abs(d * o - _ * c) > Zl) || !a)
        this._append`L${this._x1 = e},${this._y1 = l}`;
      else {
        let p = i - r, g = n - s, b = o * o + _ * _, k = p * p + g * g, y = Math.sqrt(b), v = Math.sqrt(h), w = a * Math.tan((Mr - Math.acos((b + h - k) / (2 * y * v))) / 2), q = w / v, $ = w / y;
        Math.abs(q - 1) > Zl && this._append`L${e + q * c},${l + q * d}`, this._append`A${a},${a},0,0,${+(d * p > c * g)},${this._x1 = e + $ * o},${this._y1 = l + $ * _}`;
      }
  }
  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), _ = e + s, c = l + o, d = 1 ^ r, h = r ? n - a : a - n;
    this._x1 === null ? this._append`M${_},${c}` : (Math.abs(this._x1 - _) > Zl || Math.abs(this._y1 - c) > Zl) && this._append`L${_},${c}`, i && (h < 0 && (h = h % zr + zr), h > x2 ? this._append`A${i},${i},0,1,${d},${e - s},${l - o}A${i},${i},0,1,${d},${this._x1 = _},${this._y1 = c}` : h > Zl && this._append`A${i},${i},0,${+(h >= Mr)},${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 ly(t) {
  return Math.abs(t = Math.round(t)) >= 1e21 ? t.toLocaleString("en").replace(/,/g, "") : t.toString(10);
}
function Ea(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 Vi(t) {
  return t = Ea(Math.abs(t)), t ? t[1] : NaN;
}
function iy(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 ny(t) {
  return function(e) {
    return e.replace(/[0-9]/g, function(l) {
      return t[+l];
    });
  };
}
var ay = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function Ia(t) {
  if (!(e = ay.exec(t)))
    throw new Error("invalid format: " + t);
  var e;
  return new Vr({
    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]
  });
}
Ia.prototype = Vr.prototype;
function Vr(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 + "";
}
Vr.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 ry(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 Xm;
function sy(t, e) {
  var l = Ea(t, e);
  if (!l)
    return t + "";
  var i = l[0], n = l[1], a = n - (Xm = 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") + Ea(t, Math.max(0, e + a - 1))[0];
}
function mu(t, e) {
  var l = Ea(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 gu = {
  "%": (t, e) => (t * 100).toFixed(e),
  b: (t) => Math.round(t).toString(2),
  c: (t) => t + "",
  d: ly,
  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: sy,
  X: (t) => Math.round(t).toString(16).toUpperCase(),
  x: (t) => Math.round(t).toString(16)
};
function bu(t) {
  return t;
}
var ku = Array.prototype.map, vu = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
function oy(t) {
  var e = t.grouping === void 0 || t.thousands === void 0 ? bu : iy(ku.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 ? bu : ny(ku.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 _(d) {
    d = Ia(d);
    var h = d.fill, p = d.align, g = d.sign, b = d.symbol, k = d.zero, y = d.width, v = d.comma, w = d.precision, q = d.trim, $ = d.type;
    $ === "n" ? (v = !0, $ = "g") : gu[$] || (w === void 0 && (w = 12), q = !0, $ = "g"), (k || h === "0" && p === "=") && (k = !0, h = "0", p = "=");
    var j = b === "$" ? l : b === "#" && /[boxX]/.test($) ? "0" + $.toLowerCase() : "", I = b === "$" ? i : /[%p]/.test($) ? r : "", A = gu[$], M = /[defgprs%]/.test($);
    w = w === void 0 ? 6 : /[gprs]/.test($) ? Math.max(1, Math.min(21, w)) : Math.max(0, Math.min(20, w));
    function z(H) {
      var B = j, R = I, P, O, F;
      if ($ === "c")
        R = A(H) + R, H = "";
      else {
        H = +H;
        var L = H < 0 || 1 / H < 0;
        if (H = isNaN(H) ? o : A(Math.abs(H), w), q && (H = ry(H)), L && +H == 0 && g !== "+" && (L = !1), B = (L ? g === "(" ? g : s : g === "-" || g === "(" ? "" : g) + B, R = ($ === "s" ? vu[8 + Xm / 3] : "") + R + (L && g === "(" ? ")" : ""), M) {
          for (P = -1, O = H.length; ++P < O; )
            if (F = H.charCodeAt(P), 48 > F || F > 57) {
              R = (F === 46 ? n + H.slice(P + 1) : H.slice(P)) + R, H = H.slice(0, P);
              break;
            }
        }
      }
      v && !k && (H = e(H, 1 / 0));
      var X = B.length + H.length + R.length, V = X < y ? new Array(y - X + 1).join(h) : "";
      switch (v && k && (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 z.toString = function() {
      return d + "";
    }, z;
  }
  function c(d, h) {
    var p = _((d = Ia(d), d.type = "f", d)), g = Math.max(-8, Math.min(8, Math.floor(Vi(h) / 3))) * 3, b = Math.pow(10, -g), k = vu[8 + g / 3];
    return function(y) {
      return p(b * y) + k;
    };
  }
  return {
    format: _,
    formatPrefix: c
  };
}
var ba, Jt, Gm;
uy({
  thousands: ",",
  grouping: [3],
  currency: ["$", ""]
});
function uy(t) {
  return ba = oy(t), Jt = ba.format, Gm = ba.formatPrefix, ba;
}
function fy(t) {
  return Math.max(0, -Vi(Math.abs(t)));
}
function _y(t, e) {
  return Math.max(0, Math.max(-8, Math.min(8, Math.floor(Vi(e) / 3))) * 3 - Vi(Math.abs(t)));
}
function cy(t, e) {
  return t = Math.abs(t), e = Math.abs(e) - t, Math.max(0, Vi(e) - Vi(t)) + 1;
}
function Ym(t, e) {
  switch (arguments.length) {
    case 0:
      break;
    case 1:
      this.range(t);
      break;
    default:
      this.range(e).domain(t);
      break;
  }
  return this;
}
function dy(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 yu = Symbol("implicit");
function Nr() {
  var t = new Uo(), e = [], l = [], i = yu;
  function n(a) {
    let r = t.get(a);
    if (r === void 0) {
      if (i !== yu)
        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 Uo();
    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 Nr(e, l).unknown(i);
  }, Ym.apply(n, arguments), n;
}
function hy(t) {
  return function() {
    return t;
  };
}
function py(t) {
  return +t;
}
var wu = [0, 1];
function Pl(t) {
  return t;
}
function Ar(t, e) {
  return (e -= t = +t) ? function(l) {
    return (l - t) / e;
  } : hy(isNaN(e) ? NaN : 0.5);
}
function my(t, e) {
  var l;
  return t > e && (l = t, t = e, e = l), function(i) {
    return Math.max(t, Math.min(e, i));
  };
}
function gy(t, e, l) {
  var i = t[0], n = t[1], a = e[0], r = e[1];
  return n < i ? (i = Ar(n, i), a = l(r, a)) : (i = Ar(i, n), a = l(a, r)), function(s) {
    return a(i(s));
  };
}
function by(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] = Ar(t[r], t[r + 1]), a[r] = l(e[r], e[r + 1]);
  return function(s) {
    var o = hm(t, s, 1, i) - 1;
    return a[o](n[o](s));
  };
}
function ky(t, e) {
  return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());
}
function vy() {
  var t = wu, e = wu, l = Qa, i, n, a, r = Pl, s, o, _;
  function c() {
    var h = Math.min(t.length, e.length);
    return r !== Pl && (r = my(t[0], t[h - 1])), s = h > 2 ? by : gy, o = _ = 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((_ || (_ = s(e, t.map(i), dl)))(h)));
  }, d.domain = function(h) {
    return arguments.length ? (t = Array.from(h, py), 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 = Om, c();
  }, d.clamp = function(h) {
    return arguments.length ? (r = h ? !0 : Pl, c()) : r !== Pl;
  }, 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 yy() {
  return vy()(Pl, Pl);
}
function wy(t, e, l, i) {
  var n = mb(t, e, l), a;
  switch (i = Ia(i ?? ",f"), i.type) {
    case "s": {
      var r = Math.max(Math.abs(t), Math.abs(e));
      return i.precision == null && !isNaN(a = _y(n, r)) && (i.precision = a), Gm(i, r);
    }
    case "":
    case "e":
    case "g":
    case "p":
    case "r": {
      i.precision == null && !isNaN(a = cy(n, Math.max(Math.abs(t), Math.abs(e)))) && (i.precision = a - (i.type === "e"));
      break;
    }
    case "f":
    case "%": {
      i.precision == null && !isNaN(a = fy(n)) && (i.precision = a - (i.type === "%") * 2);
      break;
    }
  }
  return Jt(i);
}
function Km(t) {
  var e = t.domain;
  return t.ticks = function(l) {
    var i = e();
    return mm(i[0], i[i.length - 1], l ?? 10);
  }, t.tickFormat = function(l, i) {
    var n = e();
    return wy(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, _, c = 10;
    for (s < r && (_ = r, r = s, s = _, _ = n, n = a, a = _); c-- > 0; ) {
      if (_ = Li(r, s, l), _ === o)
        return i[n] = r, i[a] = s, e(i);
      if (_ > 0)
        r = Math.floor(r / _) * _, s = Math.ceil(s / _) * _;
      else if (_ < 0)
        r = Math.ceil(r * _) / _, s = Math.floor(s * _) / _;
      else
        break;
      o = _;
    }
    return t;
  }, t;
}
function El() {
  var t = yy();
  return t.copy = function() {
    return ky(t, El());
  }, Ym.apply(t, arguments), Km(t);
}
function $y() {
  var t = 0, e = 1, l, i, n, a, r = Pl, s = !1, o;
  function _(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));
  }
  _.domain = function(d) {
    return arguments.length ? ([t, e] = d, l = a(t = +t), i = a(e = +e), n = l === i ? 0 : 1 / (i - l), _) : [t, e];
  }, _.clamp = function(d) {
    return arguments.length ? (s = !!d, _) : s;
  }, _.interpolator = function(d) {
    return arguments.length ? (r = d, _) : r;
  };
  function c(d) {
    return function(h) {
      var p, g;
      return arguments.length ? ([p, g] = h, r = d(p, g), _) : [r(0), r(1)];
    };
  }
  return _.range = c(Qa), _.rangeRound = c(Om), _.unknown = function(d) {
    return arguments.length ? (o = d, _) : o;
  }, function(d) {
    return a = d, l = d(t), i = d(e), n = l === i ? 0 : 1 / (i - l), _;
  };
}
function qy(t, e) {
  return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown());
}
function kl() {
  var t = Km($y()(Pl));
  return t.copy = function() {
    return qy(t, kl());
  }, dy.apply(t, arguments);
}
function wn(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 jy = (t) => Mv(t[t.length - 1]);
var Ty = new Array(3).concat(
  "fc8d59ffffbf91cf60",
  "d7191cfdae61a6d96a1a9641",
  "d7191cfdae61ffffbfa6d96a1a9641",
  "d73027fc8d59fee08bd9ef8b91cf601a9850",
  "d73027fc8d59fee08bffffbfd9ef8b91cf601a9850",
  "d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850",
  "d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850",
  "a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837",
  "a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837"
).map(wn);
const Cy = jy(Ty);
function Ga(t) {
  var e = t.length;
  return function(l) {
    return t[Math.max(0, Math.min(e - 1, Math.floor(l * e)))];
  };
}
Ga(wn("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));
var Ol = Ga(wn("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));
Ga(wn("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));
Ga(wn("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
function Gt(t) {
  return function() {
    return t;
  };
}
function Um(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 ty(e);
}
function Wm(t) {
  return typeof t == "object" && "length" in t ? t : Array.from(t);
}
function Jm(t) {
  this._context = t;
}
Jm.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 Zm(t) {
  return new Jm(t);
}
function xm(t) {
  return t[0];
}
function e0(t) {
  return t[1];
}
function Sy(t, e) {
  var l = Gt(!0), i = null, n = Zm, a = null, r = Um(s);
  t = typeof t == "function" ? t : t === void 0 ? xm : Gt(t), e = typeof e == "function" ? e : e === void 0 ? e0 : Gt(e);
  function s(o) {
    var _, c = (o = Wm(o)).length, d, h = !1, p;
    for (i == null && (a = n(p = r())), _ = 0; _ <= c; ++_)
      !(_ < c && l(d = o[_], _, o)) === h && ((h = !h) ? a.lineStart() : a.lineEnd()), h && a.point(+t(d, _, o), +e(d, _, o));
    if (p)
      return a = null, p + "" || null;
  }
  return s.x = function(o) {
    return arguments.length ? (t = typeof o == "function" ? o : Gt(+o), s) : t;
  }, s.y = function(o) {
    return arguments.length ? (e = typeof o == "function" ? o : Gt(+o), s) : e;
  }, s.defined = function(o) {
    return arguments.length ? (l = typeof o == "function" ? o : Gt(!!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 My(t, e, l) {
  var i = null, n = Gt(!0), a = null, r = Zm, s = null, o = Um(_);
  t = typeof t == "function" ? t : t === void 0 ? xm : Gt(+t), e = typeof e == "function" ? e : Gt(e === void 0 ? 0 : +e), l = typeof l == "function" ? l : l === void 0 ? e0 : Gt(+l);
  function _(d) {
    var h, p, g, b = (d = Wm(d)).length, k, y = !1, v, w = new Array(b), q = new Array(b);
    for (a == null && (s = r(v = o())), h = 0; h <= b; ++h) {
      if (!(h < b && n(k = d[h], h, d)) === y)
        if (y = !y)
          p = h, s.areaStart(), s.lineStart();
        else {
          for (s.lineEnd(), s.lineStart(), g = h - 1; g >= p; --g)
            s.point(w[g], q[g]);
          s.lineEnd(), s.areaEnd();
        }
      y && (w[h] = +t(k, h, d), q[h] = +e(k, h, d), s.point(i ? +i(k, h, d) : w[h], l ? +l(k, h, d) : q[h]));
    }
    if (v)
      return s = null, v + "" || null;
  }
  function c() {
    return Sy().defined(n).curve(r).context(a);
  }
  return _.x = function(d) {
    return arguments.length ? (t = typeof d == "function" ? d : Gt(+d), i = null, _) : t;
  }, _.x0 = function(d) {
    return arguments.length ? (t = typeof d == "function" ? d : Gt(+d), _) : t;
  }, _.x1 = function(d) {
    return arguments.length ? (i = d == null ? null : typeof d == "function" ? d : Gt(+d), _) : i;
  }, _.y = function(d) {
    return arguments.length ? (e = typeof d == "function" ? d : Gt(+d), l = null, _) : e;
  }, _.y0 = function(d) {
    return arguments.length ? (e = typeof d == "function" ? d : Gt(+d), _) : e;
  }, _.y1 = function(d) {
    return arguments.length ? (l = d == null ? null : typeof d == "function" ? d : Gt(+d), _) : l;
  }, _.lineX0 = _.lineY0 = function() {
    return c().x(t).y(e);
  }, _.lineY1 = function() {
    return c().x(t).y(l);
  }, _.lineX1 = function() {
    return c().x(i).y(e);
  }, _.defined = function(d) {
    return arguments.length ? (n = typeof d == "function" ? d : Gt(!!d), _) : n;
  }, _.curve = function(d) {
    return arguments.length ? (r = d, a != null && (s = r(a)), _) : r;
  }, _.context = function(d) {
    return arguments.length ? (d == null ? a = s = null : s = r(a = d), _) : a;
  }, _;
}
class zy {
  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 Ny(t) {
  return new zy(t, !0);
}
function hn(t, e, l) {
  this.k = t, this.x = e, this.y = l;
}
hn.prototype = {
  constructor: hn,
  scale: function(t) {
    return t === 1 ? this : new hn(this.k * t, this.x, this.y);
  },
  translate: function(t, e) {
    return t === 0 & e === 0 ? this : new hn(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 + ")";
  }
};
hn.prototype;
let Ay = Jt(",d");
const cr = 20, t0 = 5;
function dr(t, e, l = {}) {
  let i = (l == null ? void 0 : l.unit_dt) || t0, n = (l == null ? void 0 : l.pulse_row_height) || S0;
  if (!t || t.length == 0 || !e || Object.keys(e).length == 0)
    return;
  let a = 0, r = 0, s, o, _ = {}, c = 0, d = [];
  for (const k in e)
    _[e[k].channel_type] || (_[e[k].channel_type] = { color: Wt[c] }, c += 1), d.push(k);
  d = d.map((k) => {
    var y, v;
    return [(y = k.match(/[a-z]+/)) == null ? void 0 : y[0], parseInt((v = k.match(/[0-9]+/)) == null ? void 0 : v[0])];
  }).toSorted((k, y) => k[1] - y[1]).map((k) => k.join(""));
  let h = {}, p = d.map((k, y) => {
    let v = e[k];
    return h[k] = y, v;
  }), g = El().domain([0, 0.5]).range([0, n]), b = (k) => k / 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: De,
      y: De,
      width: 0,
      height: 0,
      elem: []
    }, s = {
      type: "g",
      role: "pulse-axis-group",
      id: "pulse-axis-group",
      _class: "pulse-axis-group",
      x: De,
      y: De,
      width: 0,
      height: 0,
      elem: []
    };
    let k = n * p.length;
    o.height = k, s.height = k, r = o.height > r ? o.height : r;
    let y = t.map((I) => I.time_at + I.duration), v = Math.max(...y), w = b(v);
    o.width = w + Ot + et, a += o.width, s.width = Ot;
    let q = 0;
    for (const I of p) {
      let A = {
        type: "g",
        role: "pulse-area-row-group",
        id: "pulse-area-row-group-" + I.name,
        _class: "pulse-area-row-group",
        x: 0,
        y: n * q,
        width: 0,
        height: n,
        elem: []
      }, M = {
        type: "g",
        role: "pulse-area-row-name-group",
        id: "pulse-area-row-name-group-" + I.name,
        _class: "pulse-area-row-name-group",
        x: 0,
        y: 0,
        width: 0,
        height: 0,
        elem: []
      };
      M.elem.push({
        type: "text",
        x: Ot,
        y: n / 2 - 6 + 4.5,
        "font-size": 12,
        "text-anchor": "end",
        "alignment-baseline": "center",
        text: I.channel_type.replace(/Channel$/, ""),
        "font-weight": 700,
        "line-height": 1
      }), M.elem.push({
        type: "text",
        x: Ot,
        y: n / 2 + 6 + 4.5,
        "font-size": 12,
        "text-anchor": "end",
        "alignment-baseline": "center",
        text: "(" + I.name + ")",
        "font-weight": 400,
        "line-height": 1
      }), A.elem.push(M);
      let z = JSON.parse(JSON.stringify(M));
      z.y = n * q, z.elem.splice(0, 0, {
        type: "rect",
        x: 0,
        y: 0,
        width: Ot,
        height: n,
        "stroke-width": 0,
        fill: it
      }), s.elem.push(z), A.elem.push({
        type: "rect",
        x: Ot + et,
        y: 0,
        width: w,
        height: n,
        fill: Me,
        "fill-opacity": 0.05,
        "stroke-width": 0
      }), A.elem.push({
        type: "line",
        x1: Ot + et,
        y1: n,
        x2: Ot + et + w,
        y2: n,
        "stroke-width": 1
      });
      let H = {
        type: "g",
        role: "pulse-area-vis-group",
        id: "pulse-area-vis-group-" + I.name,
        _class: "pulse-area-vis-group",
        x: Ot + et,
        y: 0,
        width: w,
        height: n,
        elem: []
      };
      A.elem.push(H), o.elem.push(A), q++;
    }
    for (const I of t) {
      let A = b(I.time_at), M = b(I.time_at + I.duration);
      if (I.component_type === "Play") {
        let z = g(I.amplitude), H = o.elem[h[I.name]].elem.length - 1, B = l0(A, M, z, n);
        o.elem[h[I.name]].elem[H].elem.push({
          _class: `pulse-path--layer-${I.layer_index}--op-${I.op_index}`,
          type: "path",
          path: B,
          fill: _[I.channel_type].color,
          "fill-opacity": 0.5,
          "stroke-width": 0
        });
      } else if (I.component_type === "ShiftPhase") {
        let z = o.elem[h[I.name]].elem.length - 1;
        o.elem[h[I.name]].elem[z].elem.push({
          _class: `pulse-path--layer-${I.layer_index}--op-${I.op_index}`,
          type: "rect",
          x: A - 1,
          y: n * 0.2,
          width: 2,
          height: n * 0.8,
          fill: _[I.channel_type].color,
          "fill-opacity": 0.7,
          "stroke-width": 0
        });
      }
    }
    let $ = {
      type: "g",
      role: "pulse-data-x-axis-group",
      id: "pulse-data-x-axis-group",
      _class: "pulse-data-x-axis-group",
      x: Ot + et,
      y: k,
      width: w,
      height: Bl,
      elem: []
    }, j = 0;
    for (; j < v; ) {
      let I = {
        type: "g",
        role: "pulse-data-x-axis-group",
        id: "pulse-data-x-axis-group-" + j,
        _class: "pulse-data-x-axis-group",
        x: b(j),
        y: 0,
        elem: [{
          type: "line",
          x1: -0.5,
          y1: 0,
          x2: -0.5,
          y2: 6,
          "stroke-width": 1,
          stroke: Me
        }, {
          type: "text",
          x: -1,
          y: Bl,
          "font-size": 10,
          "text-anchor": "middle",
          "alignment-baseline": "bottom",
          text: Ay(j),
          "font-weight": 400
        }]
      };
      $.elem.push(I), j += 500;
    }
    o.elem.push($), o.height += Bl, r += Bl;
  }
  return {
    type: "svg",
    width: a + De * 2,
    height: r + De * 2,
    viewBox: [0, 0, a + De * 2, r + De * 2],
    groups: {
      axis_group: s,
      area_group: o
    },
    scales: {
      dt_scale: b,
      amp_scale: g
    }
  };
}
function l0(t, e, l, i) {
  let n = [];
  return e - t < cr * 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 + cr,
    y: l
  }, {
    x: e - cr,
    y: l
  }, {
    x: e,
    y: i
  }), My().x((r) => r.x).y0((r) => i).y1((r) => r.y).curve(Ny)(n);
}
let By = Jt(",d");
const Py = 5, Oy = 50;
function $u(t, e = {}) {
  if (!t)
    return;
  let l = {};
  for (const b of t)
    l[b.name] || (l[b.name] = {
      channel_type: b.channel_type,
      channel_index: b.channel_index,
      name: b.name
    });
  let i = (e == null ? void 0 : e.unit_dt) || Py, n = (e == null ? void 0 : e.pulse_row_height) || Oy;
  if (!t || t.length == 0 || !l || Object.keys(l).length == 0)
    return;
  let a = 0, r = 0, s, o = {}, _ = 0, c = [];
  for (const b in l)
    o[l[b].channel_type] || (o[l[b].channel_type] = { color: Wt[_] }, _ += 1), c.push(b);
  c = c.map((b) => {
    var k, y;
    return [(k = b.match(/[a-z]+/)) == null ? void 0 : k[0], parseInt((y = b.match(/[0-9]+/)) == null ? void 0 : y[0])];
  }).toSorted((b, k) => b[1] - k[1]).map((b) => b.join(""));
  let d = {}, h = c.map((b, k) => {
    let y = l[b];
    return d[b] = k, y;
  }), p = El().domain([0, 0.5]).range([0, n]), g = (b) => b / 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: De,
      y: De,
      width: 0,
      height: 0,
      elem: []
    };
    let b = n * h.length;
    s.height = b, r = s.height > r ? s.height : r;
    let k = t.map((j) => j.time_at + j.duration), y = Math.max(...k), v = g(y);
    s.width = v + Ot + et, a += s.width;
    let w = 0;
    for (const j of h) {
      let I = {
        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: []
      }, A = {
        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: []
      };
      A.elem.push({
        type: "text",
        x: Ot,
        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
      }), A.elem.push({
        type: "text",
        x: Ot,
        y: n / 2 + 6 + 4.5,
        "font-size": 12,
        "text-anchor": "end",
        "alignment-baseline": "center",
        text: "(" + j.name + ")",
        "font-weight": 400,
        "line-height": 1
      }), I.elem.push(A), I.elem.push({
        type: "rect",
        x: Ot + et,
        y: 0,
        width: v,
        height: n,
        fill: Me,
        "fill-opacity": 0.05,
        "stroke-width": 0
      }), I.elem.push({
        type: "line",
        x1: Ot + et,
        y1: n,
        x2: Ot + et + v,
        y2: n,
        "stroke-width": 1
      });
      let M = {
        type: "g",
        role: "mini-pulse-area-vis-group",
        id: "mini-pulse-area-vis-group-" + j.name,
        _class: "mini-pulse-area-vis-group",
        x: Ot + et,
        y: 0,
        width: v,
        height: n,
        elem: []
      };
      I.elem.push(M), s.elem.push(I), w++;
    }
    for (const j of t) {
      let I = g(j.time_at), A = g(j.time_at + j.duration);
      if (j.component_type === "Play") {
        let M = p(j.amplitude), z = s.elem[d[j.name]].elem.length - 1, H = l0(I, A, M, n);
        s.elem[d[j.name]].elem[z].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 M = s.elem[d[j.name]].elem.length - 1;
        s.elem[d[j.name]].elem[M].elem.push({
          _class: `mini-pulse-path--layer-${j.layer_index}--op-${j.op_index}`,
          type: "rect",
          x: I - 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 q = {
      type: "g",
      role: "mini-pulse-data-x-axis-group",
      id: "mini-pulse-data-x-axis-group",
      _class: "mini-pulse-data-x-axis-group",
      x: Ot + et,
      y: b,
      width: v,
      height: Bl,
      elem: []
    }, $ = 0;
    for (; $ < y; ) {
      let j = {
        type: "g",
        role: "mini-pulse-data-x-axis-group",
        id: "mini-pulse-data-x-axis-group-" + $,
        _class: "mini-pulse-data-x-axis-group",
        x: g($),
        y: 0,
        elem: [{
          type: "line",
          x1: -0.5,
          y1: 0,
          x2: -0.5,
          y2: 6,
          "stroke-width": 1,
          stroke: Me
        }, {
          type: "text",
          x: -1,
          y: Bl,
          "font-size": 10,
          "text-anchor": "middle",
          "alignment-baseline": "bottom",
          text: By($),
          "font-weight": 400
        }]
      };
      q.elem.push(j), $ += 500;
    }
    s.elem.push(q), s.height += Bl, r += Bl;
  }
  return {
    type: "svg",
    width: a + De * 2,
    height: r + De * 2,
    viewBox: [0, 0, a + De * 2, r + De * 2],
    groups: {
      area_group: s
    },
    scales: {
      dt_scale: g,
      amp_scale: p
    }
  };
}
function qu(t, e, l) {
  const i = t.slice();
  return i[6] = e[l], i;
}
function ju(t) {
  var F;
  let e, l, i, n = (
    /*info*/
    t[0].operation.gate + ""
  ), a, r, s = (
    /*info*/
    ((F = t[0].operation.qubit_index) == null ? void 0 : F.join(", ")) + ""
  ), o, _, c, d, h, p, g, b, k, y = (
    /*info*/
    t[0].pulse_data.duration + ""
  ), v, w, q, $, j, I, A, M, z, H, B, R = (
    /*$pulse_vis*/
    t[2] && Tu(t)
  ), P = $e(
    /*info*/
    t[0].pulse_data.pulse_schedule
  ), O = [];
  for (let L = 0; L < P.length; L += 1)
    O[L] = Pu(qu(t, P, L));
  return {
    c() {
      e = m("div"), l = m("h2"), i = E("Pulse for '"), a = E(n), r = E("' gate on qubits ("), o = E(s), _ = E(")"), c = N(), d = m("div"), h = m("table"), p = m("tbody"), g = m("tr"), b = m("th"), b.textContent = "Duration", k = m("td"), v = E(y), w = N(), R && R.c(), q = N(), $ = m("h3"), $.textContent = "Schedules", j = N(), I = m("div"), A = m("table"), M = m("thead"), M.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>', z = N(), H = m("tbody");
      for (let L = 0; L < O.length; L += 1)
        O[L].c();
      u(l, "class", "svelte-1mijona"), u(b, "class", "svelte-1mijona"), u(k, "class", "svelte-1mijona"), u(h, "class", "svelte-1mijona"), u($, "class", "svelte-1mijona"), u(A, "class", "svelte-1mijona"), u(I, "class", "schedule-table-wrap svelte-1mijona"), u(d, "class", "info-section svelte-1mijona");
    },
    m(L, X) {
      S(L, e, X), f(e, l), f(l, i), f(l, a), f(l, r), f(l, o), f(l, _), f(e, c), f(e, d), f(d, h), f(h, p), f(p, g), f(g, b), f(g, k), f(k, v), f(d, w), R && R.m(d, null), f(d, q), f(d, $), f(d, j), f(d, I), f(I, A), f(A, M), f(A, z), f(A, H);
      for (let V = 0; V < O.length; V += 1)
        O[V] && O[V].m(H, null);
      B = !0;
    },
    p(L, X) {
      var V;
      if ((!B || X & /*info*/
      1) && n !== (n = /*info*/
      L[0].operation.gate + "") && U(a, n), (!B || X & /*info*/
      1) && s !== (s = /*info*/
      ((V = L[0].operation.qubit_index) == null ? void 0 : V.join(", ")) + "") && U(o, s), (!B || X & /*info*/
      1) && y !== (y = /*info*/
      L[0].pulse_data.duration + "") && U(v, y), /*$pulse_vis*/
      L[2] ? R ? (R.p(L, X), X & /*$pulse_vis*/
      4 && T(R, 1)) : (R = Tu(L), R.c(), T(R, 1), R.m(d, q)) : R && (be(), D(R, 1, 1, () => {
        R = null;
      }), ke()), X & /*info, undefined*/
      1) {
        P = $e(
          /*info*/
          L[0].pulse_data.pulse_schedule
        );
        let Q;
        for (Q = 0; Q < P.length; Q += 1) {
          const Z = qu(L, P, Q);
          O[Q] ? O[Q].p(Z, X) : (O[Q] = Pu(Z), O[Q].c(), O[Q].m(H, null));
        }
        for (; Q < O.length; Q += 1)
          O[Q].d(1);
        O.length = P.length;
      }
    },
    i(L) {
      B || (T(R), B = !0);
    },
    o(L) {
      D(R), B = !1;
    },
    d(L) {
      L && C(e), R && R.d(), Ye(O, L);
    }
  };
}
function Tu(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k = (
    /*images*/
    t[1]["mini-pulse-view"] && Cu(t)
  ), y = (
    /*$pulse_vis*/
    t[2].groups.area_group && Su(t)
  );
  return {
    c() {
      e = m("h3"), l = E("Pulse amplitude "), i = m("button"), i.textContent = "Image", n = N(), k && k.c(), a = N(), r = m("div"), s = Ge("svg"), o = Ge("style"), _ = E(`g {
                font-family: Iosevka;
                font-size: 14px;
              }
            `), y && y.c(), u(i, "class", "save-make svelte-1mijona"), u(e, "class", "svelte-1mijona"), u(s, "id", "mini-pulse-view"), u(s, "width", c = /*$pulse_vis*/
      t[2].width), u(s, "height", d = /*$pulse_vis*/
      t[2].height), u(s, "viewBox", h = /*$pulse_vis*/
      t[2].viewBox.join(" ")), u(r, "class", "mini-pulse-view");
    },
    m(v, w) {
      S(v, e, w), f(e, l), f(e, i), f(e, n), k && k.m(e, null), S(v, a, w), S(v, r, w), f(r, s), f(s, o), f(o, _), y && y.m(s, null), p = !0, g || (b = te(
        i,
        "click",
        /*click_handler*/
        t[5]
      ), g = !0);
    },
    p(v, w) {
      /*images*/
      v[1]["mini-pulse-view"] ? k ? k.p(v, w) : (k = Cu(v), k.c(), k.m(e, null)) : k && (k.d(1), k = null), /*$pulse_vis*/
      v[2].groups.area_group ? y ? (y.p(v, w), w & /*$pulse_vis*/
      4 && T(y, 1)) : (y = Su(v), y.c(), T(y, 1), y.m(s, null)) : y && (be(), D(y, 1, 1, () => {
        y = null;
      }), ke()), (!p || w & /*$pulse_vis*/
      4 && c !== (c = /*$pulse_vis*/
      v[2].width)) && u(s, "width", c), (!p || w & /*$pulse_vis*/
      4 && d !== (d = /*$pulse_vis*/
      v[2].height)) && u(s, "height", d), (!p || w & /*$pulse_vis*/
      4 && h !== (h = /*$pulse_vis*/
      v[2].viewBox.join(" "))) && u(s, "viewBox", h);
    },
    i(v) {
      p || (T(y), p = !0);
    },
    o(v) {
      D(y), p = !1;
    },
    d(v) {
      v && (C(e), C(a), C(r)), k && k.d(), y && y.d(), g = !1, b();
    }
  };
}
function Cu(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("a"), l = E("PNG"), n = N(), a = m("a"), r = E("SVG"), u(e, "class", "save-download svelte-1mijona"), u(e, "href", i = /*images*/
      t[1]["mini-pulse-view"].png), u(e, "download", ""), u(a, "class", "save-download svelte-1mijona"), u(a, "href", s = /*images*/
      t[1]["mini-pulse-view"].svg), u(a, "download", "");
    },
    m(o, _) {
      S(o, e, _), f(e, l), S(o, n, _), S(o, a, _), f(a, r);
    },
    p(o, _) {
      _ & /*images*/
      2 && i !== (i = /*images*/
      o[1]["mini-pulse-view"].png) && u(e, "href", i), _ & /*images*/
      2 && s !== (s = /*images*/
      o[1]["mini-pulse-view"].svg) && u(a, "href", s);
    },
    d(o) {
      o && (C(e), C(n), C(a));
    }
  };
}
function Su(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$pulse_vis*/
        t[2].groups.area_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Mu(t) {
  let e, l = (
    /*sched*/
    t[6].phase + ""
  ), i, n;
  return {
    c() {
      e = E("Phase ("), i = E(l), n = E(")");
    },
    m(a, r) {
      S(a, e, r), S(a, i, r), S(a, n, r);
    },
    p(a, r) {
      r & /*info*/
      1 && l !== (l = /*sched*/
      a[6].phase + "") && U(i, l);
    },
    d(a) {
      a && (C(e), C(i), C(n));
    }
  };
}
function zu(t) {
  let e, l = (
    /*sched*/
    t[6].angle + ""
  ), i, n;
  return {
    c() {
      e = E("Angle ("), i = E(l), n = E(")");
    },
    m(a, r) {
      S(a, e, r), S(a, i, r), S(a, n, r);
    },
    p(a, r) {
      r & /*info*/
      1 && l !== (l = /*sched*/
      a[6].angle + "") && U(i, l);
    },
    d(a) {
      a && (C(e), C(i), C(n));
    }
  };
}
function Nu(t) {
  let e, l = (
    /*sched*/
    t[6].sigma + ""
  ), i, n;
  return {
    c() {
      e = E("Sigma ("), i = E(l), n = E(")");
    },
    m(a, r) {
      S(a, e, r), S(a, i, r), S(a, n, r);
    },
    p(a, r) {
      r & /*info*/
      1 && l !== (l = /*sched*/
      a[6].sigma + "") && U(i, l);
    },
    d(a) {
      a && (C(e), C(i), C(n));
    }
  };
}
function Au(t) {
  let e, l = (
    /*sched*/
    t[6].beta + ""
  ), i, n;
  return {
    c() {
      e = E("Beta ("), i = E(l), n = E(")");
    },
    m(a, r) {
      S(a, e, r), S(a, i, r), S(a, n, r);
    },
    p(a, r) {
      r & /*info*/
      1 && l !== (l = /*sched*/
      a[6].beta + "") && U(i, l);
    },
    d(a) {
      a && (C(e), C(i), C(n));
    }
  };
}
function Bu(t) {
  let e, l = (
    /*sched*/
    t[6].freq + ""
  ), i, n;
  return {
    c() {
      e = E("Freq ("), i = E(l), n = E(")");
    },
    m(a, r) {
      S(a, e, r), S(a, i, r), S(a, n, r);
    },
    p(a, r) {
      r & /*info*/
      1 && l !== (l = /*sched*/
      a[6].freq + "") && U(i, l);
    },
    d(a) {
      a && (C(e), C(i), C(n));
    }
  };
}
function Pu(t) {
  let e, l, i = (
    /*sched*/
    t[6].time_at + ""
  ), n, a, r, s = (
    /*sched*/
    t[6].duration + ""
  ), o, _, c, d = (
    /*sched*/
    t[6].component_type + ""
  ), h, p, g, b = (
    /*sched*/
    t[6].channel_type + ""
  ), k, y, v, w = (
    /*sched*/
    (t[6].amplitude !== void 0 ? (
      /*sched*/
      t[6].amplitude
    ) : "") + ""
  ), q, $, j, I, A, M, z, H, B = (
    /*sched*/
    t[6].phase && Mu(t)
  ), R = (
    /*sched*/
    t[6].angle && zu(t)
  ), P = (
    /*sched*/
    t[6].sigma && Nu(t)
  ), O = (
    /*sched*/
    t[6].beta && Au(t)
  ), F = (
    /*sched*/
    t[6].freq && Bu(t)
  );
  return {
    c() {
      e = m("tr"), l = m("td"), n = E(i), a = N(), r = m("td"), o = E(s), _ = N(), c = m("td"), h = E(d), p = N(), g = m("td"), k = E(b), y = N(), v = m("td"), q = E(w), $ = N(), j = m("td"), B && B.c(), I = N(), R && R.c(), A = N(), P && P.c(), M = N(), O && O.c(), z = N(), F && F.c(), H = N(), u(l, "class", "svelte-1mijona"), u(r, "class", "svelte-1mijona"), u(c, "class", "svelte-1mijona"), u(g, "class", "svelte-1mijona"), u(v, "class", "svelte-1mijona"), u(j, "class", "svelte-1mijona");
    },
    m(L, X) {
      S(L, e, X), f(e, l), f(l, n), f(e, a), f(e, r), f(r, o), f(e, _), f(e, c), f(c, h), f(e, p), f(e, g), f(g, k), f(e, y), f(e, v), f(v, q), f(e, $), f(e, j), B && B.m(j, null), f(j, I), R && R.m(j, null), f(j, A), P && P.m(j, null), f(j, M), O && O.m(j, null), f(j, z), F && F.m(j, null), f(e, H);
    },
    p(L, X) {
      X & /*info*/
      1 && i !== (i = /*sched*/
      L[6].time_at + "") && U(n, i), X & /*info*/
      1 && s !== (s = /*sched*/
      L[6].duration + "") && U(o, s), X & /*info*/
      1 && d !== (d = /*sched*/
      L[6].component_type + "") && U(h, d), X & /*info*/
      1 && b !== (b = /*sched*/
      L[6].channel_type + "") && U(k, b), X & /*info*/
      1 && w !== (w = /*sched*/
      (L[6].amplitude !== void 0 ? (
        /*sched*/
        L[6].amplitude
      ) : "") + "") && U(q, w), /*sched*/
      L[6].phase ? B ? B.p(L, X) : (B = Mu(L), B.c(), B.m(j, I)) : B && (B.d(1), B = null), /*sched*/
      L[6].angle ? R ? R.p(L, X) : (R = zu(L), R.c(), R.m(j, A)) : R && (R.d(1), R = null), /*sched*/
      L[6].sigma ? P ? P.p(L, X) : (P = Nu(L), P.c(), P.m(j, M)) : P && (P.d(1), P = null), /*sched*/
      L[6].beta ? O ? O.p(L, X) : (O = Au(L), O.c(), O.m(j, z)) : O && (O.d(1), O = null), /*sched*/
      L[6].freq ? F ? F.p(L, X) : (F = Bu(L), F.c(), F.m(j, null)) : F && (F.d(1), F = null);
    },
    d(L) {
      L && C(e), B && B.d(), R && R.d(), P && P.d(), O && O.d(), F && F.d();
    }
  };
}
function Ey(t) {
  let e, l, i = (
    /*info*/
    t[0] && ju(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(n, a) {
      i && i.m(n, a), S(n, e, a), l = !0;
    },
    p(n, [a]) {
      /*info*/
      n[0] ? i ? (i.p(n, a), a & /*info*/
      1 && T(i, 1)) : (i = ju(n), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d(n);
    }
  };
}
function Iy(t, e, l) {
  let i, { info: n } = e, a = Oe();
  at(t, a, (_) => l(2, i = _));
  let r = {}, s = Oe();
  s.subscribe((_) => {
    _ && l(1, r[_.id] = _, r);
  }), Tt(() => {
    var _;
    (_ = n == null ? void 0 : n.pulse_data) != null && _.pulse_schedule && a.set($u(n.pulse_data.pulse_schedule));
  });
  const o = (_) => {
    Ii("mini-pulse-view", s);
  };
  return t.$$set = (_) => {
    "info" in _ && l(0, n = _.info);
  }, t.$$.update = () => {
    var _;
    t.$$.dirty & /*info*/
    1 && (_ = n == null ? void 0 : n.pulse_data) != null && _.pulse_schedule && a.set($u(n.pulse_data.pulse_schedule));
  }, [n, r, i, a, s, o];
}
class Dy extends Ve {
  constructor(e) {
    super(), Qe(this, e, Iy, Ey, Fe, { info: 0 });
  }
}
function Ou(t) {
  let e, l, i, n, a, r, s, o, _, c = (
    /*info*/
    t[0].qubit && Eu(t)
  ), d = (
    /*info*/
    t[0].operation && Iu(t)
  ), h = (
    /*info*/
    t[0].readout_error && Du(t)
  ), p = (
    /*info*/
    t[0].gate_info && Ru(t)
  ), g = (
    /*info*/
    t[0].gate_error_info && Hu(t)
  ), b = (
    /*info*/
    t[0].esp_this && Lu(t)
  ), k = (
    /*info*/
    t[0].qasm && Fu(t)
  ), y = (
    /*info*/
    t[0].pulse_data && Qu(t)
  );
  return {
    c() {
      c && c.c(), e = N(), d && d.c(), l = N(), h && h.c(), i = N(), p && p.c(), n = N(), g && g.c(), a = N(), b && b.c(), r = N(), k && k.c(), s = N(), y && y.c(), o = Ae();
    },
    m(v, w) {
      c && c.m(v, w), S(v, e, w), d && d.m(v, w), S(v, l, w), h && h.m(v, w), S(v, i, w), p && p.m(v, w), S(v, n, w), g && g.m(v, w), S(v, a, w), b && b.m(v, w), S(v, r, w), k && k.m(v, w), S(v, s, w), y && y.m(v, w), S(v, o, w), _ = !0;
    },
    p(v, w) {
      /*info*/
      v[0].qubit ? c ? (c.p(v, w), w & /*info*/
      1 && T(c, 1)) : (c = Eu(v), c.c(), T(c, 1), c.m(e.parentNode, e)) : c && (be(), D(c, 1, 1, () => {
        c = null;
      }), ke()), /*info*/
      v[0].operation ? d ? (d.p(v, w), w & /*info*/
      1 && T(d, 1)) : (d = Iu(v), d.c(), T(d, 1), d.m(l.parentNode, l)) : d && (be(), D(d, 1, 1, () => {
        d = null;
      }), ke()), /*info*/
      v[0].readout_error ? h ? (h.p(v, w), w & /*info*/
      1 && T(h, 1)) : (h = Du(v), h.c(), T(h, 1), h.m(i.parentNode, i)) : h && (be(), D(h, 1, 1, () => {
        h = null;
      }), ke()), /*info*/
      v[0].gate_info ? p ? (p.p(v, w), w & /*info*/
      1 && T(p, 1)) : (p = Ru(v), p.c(), T(p, 1), p.m(n.parentNode, n)) : p && (be(), D(p, 1, 1, () => {
        p = null;
      }), ke()), /*info*/
      v[0].gate_error_info ? g ? (g.p(v, w), w & /*info*/
      1 && T(g, 1)) : (g = Hu(v), g.c(), T(g, 1), g.m(a.parentNode, a)) : g && (be(), D(g, 1, 1, () => {
        g = null;
      }), ke()), /*info*/
      v[0].esp_this ? b ? (b.p(v, w), w & /*info*/
      1 && T(b, 1)) : (b = Lu(v), b.c(), T(b, 1), b.m(r.parentNode, r)) : b && (be(), D(b, 1, 1, () => {
        b = null;
      }), ke()), /*info*/
      v[0].qasm ? k ? (k.p(v, w), w & /*info*/
      1 && T(k, 1)) : (k = Fu(v), k.c(), T(k, 1), k.m(s.parentNode, s)) : k && (be(), D(k, 1, 1, () => {
        k = null;
      }), ke()), /*info*/
      v[0].pulse_data ? y ? (y.p(v, w), w & /*info*/
      1 && T(y, 1)) : (y = Qu(v), y.c(), T(y, 1), y.m(o.parentNode, o)) : y && (be(), D(y, 1, 1, () => {
        y = null;
      }), ke());
    },
    i(v) {
      _ || (T(c), T(d), T(h), T(p), T(g), T(b), T(k), T(y), _ = !0);
    },
    o(v) {
      D(c), D(d), D(h), D(p), D(g), D(b), D(k), D(y), _ = !1;
    },
    d(v) {
      v && (C(e), C(l), C(i), C(n), C(a), C(r), C(s), C(o)), c && c.d(v), d && d.d(v), h && h.d(v), p && p.d(v), g && g.d(v), b && b.d(v), k && k.d(v), y && y.d(v);
    }
  };
}
function Eu(t) {
  let e, l, i;
  return l = new Gg({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), pe(l.$$.fragment), u(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      S(n, e, a), de(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (T(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && C(e), he(l);
    }
  };
}
function Iu(t) {
  let e, l, i;
  return l = new Hg({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), pe(l.$$.fragment), u(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      S(n, e, a), de(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (T(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && C(e), he(l);
    }
  };
}
function Du(t) {
  let e, l, i;
  return l = new Ug({
    props: {
      info: (
        /*info*/
        t[0]
      ),
      machine_moment_at: (
        /*machine_moment_at*/
        t[1]
      )
    }
  }), {
    c() {
      e = m("article"), pe(l.$$.fragment), u(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      S(n, e, a), de(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 || (T(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && C(e), he(l);
    }
  };
}
function Ru(t) {
  let e, l, i;
  return l = new Qg({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), pe(l.$$.fragment), u(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      S(n, e, a), de(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (T(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && C(e), he(l);
    }
  };
}
function Hu(t) {
  let e, l, i;
  return l = new Ig({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), pe(l.$$.fragment), u(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      S(n, e, a), de(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (T(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && C(e), he(l);
    }
  };
}
function Lu(t) {
  let e, l, i;
  return l = new Pg({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), pe(l.$$.fragment), u(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      S(n, e, a), de(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (T(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && C(e), he(l);
    }
  };
}
function Fu(t) {
  let e, l, i;
  return l = new Zg({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), pe(l.$$.fragment), u(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      S(n, e, a), de(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (T(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && C(e), he(l);
    }
  };
}
function Qu(t) {
  let e, l, i;
  return l = new Dy({ props: { info: (
    /*info*/
    t[0]
  ) } }), {
    c() {
      e = m("article"), pe(l.$$.fragment), u(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      S(n, e, a), de(l, e, null), i = !0;
    },
    p(n, a) {
      const r = {};
      a & /*info*/
      1 && (r.info = /*info*/
      n[0]), l.$set(r);
    },
    i(n) {
      i || (T(l.$$.fragment, n), i = !0);
    },
    o(n) {
      D(l.$$.fragment, n), i = !1;
    },
    d(n) {
      n && C(e), he(l);
    }
  };
}
function Ry(t) {
  let e, l, i = (
    /*info*/
    t[0] && Ou(t)
  );
  return {
    c() {
      e = m("div"), i && i.c(), u(e, "class", "svelte-m7xawd");
    },
    m(n, a) {
      S(n, e, a), i && i.m(e, null), l = !0;
    },
    p(n, [a]) {
      /*info*/
      n[0] ? i ? (i.p(n, a), a & /*info*/
      1 && T(i, 1)) : (i = Ou(n), i.c(), T(i, 1), i.m(e, null)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d();
    }
  };
}
function Hy(t, e, l) {
  let { info: i, machine_moment_at: n = Oe() } = 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 Ly extends Ve {
  constructor(e) {
    super(), Qe(this, e, Hy, Ry, Fe, { info: 0, machine_moment_at: 1 });
  }
}
const Fy = 1.6;
function Qy(t, e) {
  return t / 1e9 * Fy * e;
}
let un = 160, Vu = 100, fn = 30;
function Xu(t, e, l) {
  var B, R, P, O, F, L, X, V, Q, Z, ae, se, K, Y, W, J, ee, we, Re, ve, me, fe, G, ye, ue, le, 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, ge) => {
    s[ge] = x.index, o[x.index] = ge;
  });
  let _, c, d = r.map((x) => x.x), h = r.map((x) => x.y);
  _ = Math.min(...d), c = Math.min(...h), r = r.map((x) => (x.x = x.x - _, x.y = x.y - c, x));
  let p = 0, g = 0, b = {
    type: "g",
    role: "machine-circuit",
    id: "machine-circuit",
    _class: "machine-circuit",
    x: 0,
    y: 0,
    width: 0,
    height: 0,
    elem: []
  };
  b.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 k = {
    type: "g",
    role: "qubit-nodes",
    id: "qubit-nodes",
    _class: "qubit-nodes",
    x: De,
    y: De + fn + Pt,
    width: 0,
    height: 0,
    elem: []
  }, y = {};
  for (const x of r) {
    let ge = t.readout_errors[x.index], re = t.gate_info.filter((Ue) => {
      var Ke;
      return (Ke = Ue == null ? void 0 : Ue.qubits) == null ? void 0 : Ke.includes(x.index);
    }), Ie;
    (O = l == null ? void 0 : l.match) != null && O.bit_match && (Ie = (F = l == null ? void 0 : l.match) == null ? void 0 : F.bit_match.filter((Ue) => Ue.to === x.index)[0]);
    let je = {
      readout_error: ge,
      gate_info: re,
      qubit_id: x.index,
      original_qubit_id: Ie.from,
      match_color: Wt[Ie.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
    }, _e = {
      type: "g",
      role: "qubit-node--group",
      id: `qubit-node-${x.index}--group`,
      _class: "qubit-node--group",
      x: 0,
      y: 0,
      width: ml,
      height: ml,
      elem: [],
      data: je
    }, Ee = x.x * (jl + ml), ie = x.y * (jl + ml), Te = ml / 2;
    _e.x = Ee, _e.y = ie, _e.elem.push({
      type: "circle",
      role: "qubit-node--node",
      id: `qubit-node-${x.index}--node`,
      _class: "qubit-node--node",
      cx: Te,
      cy: Te,
      r: Te,
      stroke: Me,
      "stroke-width": 2,
      fill: l == null ? void 0 : l.nodeColorScale(1)
      // "fill-opacity": (1 - readout_error.value)
    }), _e.elem.push({
      type: "text",
      role: "qubit-node--marker",
      id: `qubit-node-${x.index}--marker`,
      _class: "qubit-node--marker",
      text: x.index,
      x: Te,
      y: Te + 2,
      "text-anchor": "middle",
      "alignment-baseline": "middle",
      stroke: Me,
      "stroke-width": 0,
      fill: Me
    }), _e.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: ml,
      height: ml,
      data: je
    }), y[x.index] = [
      [Ee + Te, ie],
      [Ee, ie + Te],
      [Ee + 2 * Te, ie + Te],
      [Ee + Te, ie + 2 * Te]
    ], y[x.index].x = Ee, y[x.index].y = ie, y[x.index].cx = Ee + Te, y[x.index].cy = ie + Te, p = Math.max(p, _e.x + _e.width), g = Math.max(g, _e.y + _e.height), k.elem.push(_e);
  }
  k.width = p, k.height = g;
  let v = {
    type: "g",
    role: "qubit-edges",
    id: "qubit-edges",
    _class: "qubit-edges",
    x: De,
    y: De,
    width: 0,
    height: 0,
    elem: []
  }, w = {};
  for (const x of (L = t == null ? void 0 : t.design) == null ? void 0 : L.edges)
    if (n.includes(x[0]) && n.includes(x[1])) {
      let ge = x.toSorted().join(">"), re = x.join(">");
      w[ge] ? ge !== re && (w[ge].bi_dir = !0) : w[ge] = {
        nodes: x,
        from_to: Xy(y[x[0]], y[x[1]]),
        bi_dir: !1
      };
    }
  let q = 0, $ = {};
  for (const x in w) {
    let ge = w[x], re = (V = (X = ge.from_to) == null ? void 0 : X[0]) == null ? void 0 : V[0], Ie = (Z = (Q = ge.from_to) == null ? void 0 : Q[1]) == null ? void 0 : Z[0], je = (se = (ae = ge.from_to) == null ? void 0 : ae[0]) == null ? void 0 : se[1], _e = (Y = (K = ge.from_to) == null ? void 0 : K[1]) == null ? void 0 : Y[1], Ee = Math.min(re, Ie), ie = Math.min(je, _e), Te = Math.max(re, Ie) - Math.min(re, Ie), Ue = Math.max(je, _e) - Math.min(je, _e), Ke = Yy([Te, -Ue], [Te, 0]), We = Ke + 180, vt = {
      type: "g",
      role: "qubit-edge--group",
      id: `qubit-edge-${q}--group`,
      _class: "qubit-edge--group",
      x: Ee,
      y: ie + fn + Pt,
      width: Te,
      height: Ue,
      elem: []
    };
    vt.elem.push({
      type: "line",
      role: "qubit-edge--edge",
      id: `qubit-edge-${q}--edge`,
      _class: "qubit-edge--edge",
      x1: 0,
      x2: Te,
      y1: 0,
      y2: Ue,
      stroke: Me,
      "stroke-width": 1
    }), (ge.bi_dir || (!ge.bi_dir && Yu(ge.from_to[0], ge.from_to[1])) > 0) && vt.elem.push({
      type: "arrow-end",
      role: "qubit-edge--edge-arrow-1",
      id: `qubit-edge-${q}--edge-arrow-1`,
      _class: "qubit-edge--edge-arrow",
      x: Te,
      y: Ue,
      fill: Me,
      "stroke-width": 0,
      rotate: Ke
    }), (ge.bi_dir || (!ge.bi_dir && Yu(ge.from_to[0], ge.from_to[1])) < 1) && vt.elem.push({
      type: "arrow-end",
      role: "qubit-edge--edge-arrow-2",
      id: `qubit-edge-${q}--edge-arrow-2`,
      _class: "qubit-edge--edge-arrow",
      x: 0,
      y: 0,
      fill: Me,
      "stroke-width": 0,
      rotate: We
    });
    let qt = Te + De / 2, rt = Ue + De * 2;
    vt.elem.push({
      type: "rect",
      role: "qubit-edge--highlight-wrap",
      id: `qubit-edge-${q}--highlight-wrap`,
      _class: "qubit-edge--highlight-wrap highlight-wrap",
      x: Te / 2 - qt / 2,
      y: Ue / 2 - rt / 2,
      width: qt,
      height: rt,
      "stroke-width": 0,
      "fill-opacity": 0
    }), $[x] = `qubit-edge-${q}`, q++, v.elem.push(vt);
  }
  b.width = p, b.height = g, b.elem.push(k), b.elem.push(v);
  let j = e.esp, I = [], A = [], M = [], z = 0, H = 0;
  for (const x of e.layers) {
    let ge = {
      type: "g",
      role: "op-layer-group",
      id: `layer-${z}--op-layer-group`,
      _class: "op-layer-group",
      x: De,
      y: De + fn + Pt,
      width: p,
      height: g,
      elem: [],
      data: {}
    }, re = 0, Ie = 0, je = {
      type: "g",
      x: p + et * 2,
      y: De + 8,
      elem: []
    };
    je.elem.push({
      type: "text",
      x: 0,
      y: 0,
      "text-anchor": "start",
      "alignment-baseline": "bottom",
      "font-weight": 700,
      text: "Layer info"
    }), je.elem.push({
      type: "text",
      x: 0,
      y: 14,
      "font-size": 12,
      "text-anchor": "start",
      "alignment-baseline": "bottom",
      text: `Layer: ${z}` + (z === e.layers.length - 1 ? " (last)" : "")
    }), A[z] = A[z - 1] || 1;
    let _e = x.operations.length;
    for (const Ee of x.operations) {
      let ie = (W = t.gate_info.filter(
        (He) => Uy(Ee.qubits.map((Ze) => Ze.index), He == null ? void 0 : He.qubits) && He.gate == Ee.gate
      )) == null ? void 0 : W[0], Te = ((J = ie == null ? void 0 : ie.gate_length) == null ? void 0 : J.value) || 0;
      Ie = Math.max(Te, Ie);
      let Ue = Ee.gate, Ke = ((ee = ie == null ? void 0 : ie.gate_error) == null ? void 0 : ee.value) || 0, We = (ie == null ? void 0 : ie.qubits) || Ee.qubits.map((He) => He.index);
      Ee.gate === "measure" && (Ke = (we = t.readout_errors[Ee.qubits[0].index]) == null ? void 0 : we.value), A[z] = A[z] * (1 - Ke), I[z] || (I[z] = r.map(() => 0));
      for (let He in I[z]) {
        let Ze = parseInt(He), _t = s[Ze];
        k.elem[Ze] && (I[z][Ze] = ((Re = I[z - 1]) == null ? void 0 : Re[Ze]) || 1, k.elem[Ze].data.esp_value || (k.elem[Ze].data.esp_value = []), ((ve = ie == null ? void 0 : ie.qubits) != null && ve.includes(_t) || Ee.gate === "measure" && Ee.qubits[0].index === _t) && (I[z][Ze] = I[z][Ze] * (1 - Ke)), k.elem[Ze].data.esp_value[z] = I[z][Ze]);
      }
      let { edges: vt, edge_ids: qt } = Vy(ie, $), rt, mt = vr((me = l == null ? void 0 : l.match) == null ? void 0 : me.layer_match, "t-o", z, re);
      mt ? rt = Wt[(mt.layer + mt.operation * _e) % Wt.length] : rt = "#454545";
      let Rt = Ue + "__" + We.join("_"), ot = [], ut = [], Ce = [], ce = [];
      M0.includes(Ee.gate) ? ot = We : z0.includes(Ee.gate) ? (ot = We.slice(0, -1), ut = We.slice(-1)) : N0.includes(Ee.gate) ? (ot = We.slice(0, -2), ut = We.slice(-2)) : A0.includes(Ee.gate) ? ce = We : ut = We, Ce = Ee.params.map((He) => St(He));
      let Be = (fe = e == null ? void 0 : e.pulse_data) == null ? void 0 : fe[Rt], Le = {
        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: z,
        operation_index: re,
        operation: {
          gate: Ue,
          qubits: Ee.qubits,
          qubit_index: We,
          num_qubits: We.length,
          num_clbits: Ee.clbits.length,
          clbits: Ee.clbits
        },
        original_layer_index: mt == null ? void 0 : mt.layer,
        original_operation_index: mt == null ? void 0 : mt.operation,
        duration: Te,
        unit: (G = ie == null ? void 0 : ie.gate_length) == null ? void 0 : G.unit,
        edges: vt,
        edge_ids: qt,
        match_color: rt,
        gate_error: Ke,
        esp_qubit_wise: I[z],
        esp_cumulative: A[z],
        pulse_data: Be
      }, Pe = {
        type: "g",
        role: "op-layer-operation-group",
        id: `layer-${z}--operation-${re}--op-group`,
        _class: "op-layer-group on-machine",
        x: 0,
        y: 0,
        is_timed: !0,
        duration: Te,
        elem: [],
        data: Le
      };
      ge.data.unit = (ye = ie == null ? void 0 : ie.gate_length) == null ? void 0 : ye.unit;
      for (const He of Ee.qubits) {
        let Ze = [(ue = y[He.index]) == null ? void 0 : ue.cx, (le = y[He.index]) == null ? void 0 : le.cy];
        if (ot.includes(He.index))
          Pe.elem.push({
            type: "rect",
            id: `layer-${z}--operation-${re}--gate-${Ee.gate}--qubit-${He.index}`,
            role: "layer-op-gate-control",
            _class: "layer-op-gate-control",
            width: 8,
            height: 8,
            x: Ze[0] - 4,
            y: Ze[1] + jl / 2 - 2,
            fill: rt,
            "stroke-width": 1
          }), Pe.elem.push({
            type: "click-wrap",
            id: `layer-${z}--operation-${re}--gate-${Ee.gate}--qubit-${He.index}--click-wrap`,
            role: "machine-gate-click-wrap",
            width: 8,
            height: 8,
            x: Ze[0] - 4,
            y: Ze[1] + jl / 2 - 2,
            data: Le
          });
        else if (ut.includes(He.index)) {
          let _t = Ee.gate;
          Ce.length > 0 && (_t += `(${Ce.join(",")})`);
          let Ct = (_t.length + 2) * 6;
          Pe.elem.push({
            type: "rect",
            id: `layer-${z}--operation-${re}--gate-${Ee.gate}--qubit-${He.index}`,
            role: "layer-op-gate-target",
            _class: "layer-op-gate-target",
            width: Ct,
            height: jl * 0.8,
            x: Ze[0] - Ct / 2,
            y: Ze[1] + jl / 2 - 3,
            "stroke-width": 1,
            fill: rt
          }), Pe.elem.push({
            type: "text",
            id: `layer-${z}--operation-${re}--gate-${Ee.gate}--qubit-${He.index}--marker`,
            role: "layer-op-gate-target-marker",
            _class: "layer-op-gate-target-marker",
            x: Ze[0],
            y: Ze[1] + jl - 4,
            "font-size": 12,
            "text-anchor": "middle",
            "alignment-baseline": "middle",
            fill: "white",
            text: _t
          }), Pe.elem.push({
            type: "click-wrap",
            id: `layer-${z}--operation-${re}--gate-${Ee.gate}--qubit-${He.index}--click-wrap`,
            role: "machine-gate-click-wrap",
            width: Ct,
            height: jl * 0.8,
            x: Ze[0] - Ct / 2,
            y: Ze[1] + jl / 2 - 3,
            data: Le
          });
        } else
          ce.includes(He.index) && (Pe.elem.push({
            type: "rect",
            id: `layer-${z}--operation-${re}--gate-${Ee.gate}--qubit-${He.index}`,
            role: "layer-op-gate-swap",
            _class: "layer-op-gate-swap",
            width: 12,
            height: 12,
            x: Ze[0] - 6,
            y: Ze[1] + ml / 3 - 6,
            fill: rt,
            "stroke-width": 0
          }), Pe.elem.push({
            type: "text",
            id: `layer-${z}--operation-${re}--gate-${Ee.gate}--qubit-${He.index}`,
            role: "layer-op-gate-swap-marker",
            _class: "layer-op-gate-swap-marker",
            "font-size": 12,
            x: Ze[0] - 5,
            y: Ze[1] + ml / 3 - 5,
            "text-anchor": "middle",
            "alignment-baseline": "middle",
            fill: "white",
            text: "×"
          }), Pe.elem.push({
            type: "click-wrap",
            id: `layer-${z}--operation-${re}--gate-${Ee.gate}--qubit-${He.index}--click-wrap`,
            role: "machine-gate-click-wrap",
            width: 12,
            height: 12,
            x: Ze[0] - 6,
            y: Ze[1] + ml / 3 - 6,
            data: Le
          }));
      }
      if (Ee.qubits.length > 0)
        for (let He = 0; He < Ee.length; He++) {
          let Ze = Ee.qubits[He];
          for (let _t = He + 1; _t < Ee.length; _t++) {
            let Ct = Ee.qubits[_t], tl = [Ze.index, Ct.index].toSorted().join(">");
            $[tl] && Pe.data.edges.push($[tl]);
          }
        }
      H += Ie;
      let Je = p + et * 2, Xe = re * 20 + De + 16 + 64;
      if (Ke !== void 0) {
        let He = I[z][o[We[0]]], Ze = {
          type: "g",
          role: "op-gate-error-group",
          id: `layer-${z}--operation-${re}--gate-error`,
          _class: "op-gate-error",
          x: Je,
          y: Xe,
          elem: []
        };
        re == 0 && ge.elem.push({
          x: Je,
          y: Xe - 4,
          "text-anchor": "start",
          "alignment-baseline": "bottom",
          "font-weight": 700,
          type: "text",
          text: "ESP info"
        }), Ze.elem.push({
          type: "rect",
          role: "op-gate-error-group-bar-wrap",
          id: `layer-${z}--operation-${re}--gate-error--bar-wrap`,
          _class: "op-gate-error-bar-wrap",
          x: 0,
          y: 0,
          width: un - De,
          height: Ui
        }), Ze.elem.push({
          type: "rect",
          role: "op-gate-error-group-bar",
          id: `layer-${z}--operation-${re}--gate-error--bar`,
          _class: "op-gate-error-bar",
          x: 0,
          y: 0,
          width: (un - De) * (He - j) / (1 - j),
          height: Ui,
          fill: l == null ? void 0 : l.nodeColorScale((He - j) / (1 - j))
        }), Ze.elem.push({
          type: "text",
          role: "op-gate-error-group-label",
          id: `layer-${z}--operation-${re}--gate-error--label`,
          _class: "op-gate-error-label",
          x: 2,
          y: 11,
          "font-size": 10,
          "text-anchor": "start",
          "alignment-baseline": "bottom",
          fill: "white",
          text: Ee.gate + `(${We.join(",")}): ` + He.toString().slice(0, 7)
        }), Ze.elem.push({
          type: "click-wrap",
          role: "op-gate-error-group-click-wrap",
          id: `layer-${z}--operation-${re}--gate-error--click-wrap`,
          _class: "op-gate-error-click-wrap",
          x: un - Vu,
          y: 2,
          width: Vu - De,
          height: Ui,
          data: {
            gate_error_info: {
              gate_error: Ke,
              layer: z,
              operation: re,
              qubits: We,
              gate: Ee.gate,
              gate_duration: Te,
              duration_unit: (oe = ie == null ? void 0 : ie.gate_length) == null ? void 0 : oe.unit,
              esp: He
            }
          }
        }), Pe.elem.push(Ze), Xe + Ui > g && (g = Xe + Ui);
      }
      ge.elem.push(Pe), re++;
    }
    je.elem.push({
      type: "text",
      x: 0,
      y: 28,
      "font-size": 12,
      "text-anchor": "start",
      "alignment-baseline": "bottom",
      text: `Duration: ${Ie.toString().slice(0, 7)} (${ge.data.unit || "ns"})`
    }), je.elem.push({
      type: "text",
      x: 0,
      y: 42,
      "font-size": 12,
      "text-anchor": "start",
      "alignment-baseline": "bottom",
      text: `Cummulative: ${H.toString().slice(0, 7)} (${ge.data.unit || "ns"})`
    }), ge.data.cummul_duration = H, ge.elem.push(je), z++, ge.is_timed = !0, ge.duration = Ie, M.push(ge);
  }
  return {
    type: "svg",
    width: p + De * 2 + un + et * 2,
    height: g + De * 2 + fn + Pt,
    viewBox: [0, 0, p + De * 4 + un, g + De * 2 + fn + Pt],
    groups: {
      machine: b
    },
    operations: M,
    bit_map: {
      qubit_rel_map: o,
      qubit_pos_map: s
    },
    meta_info: {
      cummul_duration: H
    }
  };
}
function Vy(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 Xy(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 = Gy(n, a);
          r < l && (l = r, i = [n, a]);
        }
  }
  return i;
}
function Gy(t, e) {
  return Math.sqrt(
    Math.pow(t[0] - e[0], 2) + Math.pow(t[1] - e[1], 2)
  );
}
function Yy(t, e) {
  let l = Math.acos(
    Ky(t, e) / (Gu(t) * Gu(e))
  );
  return isNaN(l) && (l = Math.PI / 2), l / Math.PI * 180;
}
function Ky(t, e) {
  return t[0] * e[0] + t[1] * e[1];
}
function Gu(t) {
  return Math.sqrt(
    Math.pow(t[0], 2) + Math.pow(t[1], 2)
  );
}
function Yu(t, e) {
  return t[0] <= e[0] && t[1] <= e[1] ? 1 : -1;
}
function Uy(t, e) {
  return t.join(",") === e.join(",");
}
function Ku(t, e, l) {
  const i = t.slice();
  return i[5] = e[l], i[7] = l, i;
}
function Uu(t) {
  let e, l, i;
  return {
    c() {
      e = m("div"), u(e, "style", l = `width: ${/*unit_width*/
      t[4]}px;`), u(e, "class", i = Yt(`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) {
      S(n, e, a);
    },
    p(n, a) {
      a & /*unit_width*/
      16 && l !== (l = `width: ${/*unit_width*/
      n[4]}px;`) && u(e, "style", l), a & /*cumulative, curr*/
      10 && i !== (i = Yt(`p ${/*cumulative*/
      n[3] ? (
        /*i*/
        n[7] <= /*curr*/
        n[1] ? "o" : "x"
      ) : (
        /*curr*/
        n[1] == /*i*/
        n[7] ? "o" : "x"
      )}`) + " svelte-k5l8cv") && u(e, "class", i);
    },
    d(n) {
      n && C(e);
    }
  };
}
function Wy(t) {
  let e, l, i, n, a, r, s = (
    /*curr*/
    t[1] + 1 + ""
  ), o, _, c, d, h = $e({ length: (
    /*total*/
    t[0]
  ) }), p = [];
  for (let g = 0; g < h.length; g += 1)
    p[g] = Uu(Ku(t, h, g));
  return {
    c() {
      e = m("div"), l = m("div");
      for (let g = 0; g < p.length; g += 1)
        p[g].c();
      n = N(), a = m("div"), r = E("("), o = E(s), _ = E(" / "), c = E(
        /*total*/
        t[0]
      ), d = E(")"), u(l, "style", i = `width: ${/*width*/
      t[2]}px;`), u(l, "class", "w svelte-k5l8cv"), u(a, "class", "notion svelte-k5l8cv"), u(e, "class", "f svelte-k5l8cv");
    },
    m(g, b) {
      S(g, e, b), f(e, l);
      for (let k = 0; k < p.length; k += 1)
        p[k] && p[k].m(l, null);
      f(e, n), f(e, a), f(a, r), f(a, o), f(a, _), f(a, c), f(a, d);
    },
    p(g, [b]) {
      if (b & /*unit_width, cumulative, curr, total*/
      27) {
        h = $e({ length: (
          /*total*/
          g[0]
        ) });
        let k;
        for (k = 0; k < h.length; k += 1) {
          const y = Ku(g, h, k);
          p[k] ? p[k].p(y, b) : (p[k] = Uu(y), p[k].c(), p[k].m(l, null));
        }
        for (; k < p.length; k += 1)
          p[k].d(1);
        p.length = h.length;
      }
      b & /*width*/
      4 && i !== (i = `width: ${/*width*/
      g[2]}px;`) && u(l, "style", i), b & /*curr*/
      2 && s !== (s = /*curr*/
      g[1] + 1 + "") && U(o, s), b & /*total*/
      1 && U(
        c,
        /*total*/
        g[0]
      );
    },
    i: ne,
    o: ne,
    d(g) {
      g && C(e), Ye(p, g);
    }
  };
}
function Jy(t, e, l) {
  let { total: i = 0, curr: n = 0, width: a = 200, cumulative: r = !1 } = e, s = 0;
  return Tt(() => {
    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 Zy extends Ve {
  constructor(e) {
    super(), Qe(this, e, Jy, Wy, Fe, {
      total: 0,
      curr: 1,
      width: 2,
      cumulative: 3
    });
  }
}
function Wu(t) {
  return Object.prototype.toString.call(t) === "[object Date]";
}
function Br(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) => Br(t[a], n));
    return (n) => i.map((a) => a(n));
  }
  if (l === "object") {
    if (!t || !e)
      throw new Error("Object cannot be null");
    if (Wu(t) && Wu(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] = Br(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 Ju(t, e = {}) {
  const l = Oe(t);
  let i, n = t;
  function a(r, s) {
    if (t == null)
      return l.set(t = r), Promise.resolve();
    n = r;
    let o = i, _ = !1, {
      delay: c = 0,
      duration: d = 400,
      easing: h = g0,
      interpolate: p = Br
    } = Xr(Xr({}, e), s);
    if (d === 0)
      return o && (o.abort(), o = null), l.set(t = n), Promise.resolve();
    const g = k0() + c;
    let b;
    return i = v0((k) => {
      if (k < g)
        return !0;
      _ || (b = p(t, r), typeof d == "function" && (d = d(t, r)), _ = !0), o && (o.abort(), o = null);
      const y = k - g;
      return y > /** @type {number} */
      d ? (l.set(t = r), !1) : (l.set(t = b(h(y / d))), !0);
    }), i.promise;
  }
  return {
    set: a,
    update: (r, s) => a(r(n, t), s),
    subscribe: l.subscribe
  };
}
function xy(t) {
  let e, l, i, n, a, r, s, o, _, 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) + ""
  ), g, b;
  return {
    c() {
      e = m("div"), l = m("div"), i = m("div"), n = N(), a = m("div"), o = N(), _ = m("div"), d = E(c), h = E(`%
    (`), g = E(p), b = E("ns)"), u(i, "class", "b svelte-1c1h349"), u(a, "class", "p svelte-1c1h349"), u(a, "style", r = `width: ${/*duration*/
      t[0] == 0 ? (
        /*width*/
        t[1]
      ) : (
        /*$progress*/
        t[3] / /*duration*/
        t[0] * /*width*/
        t[1]
      )}px`), u(l, "style", s = `width: ${/*width*/
      t[1]}px;`), u(l, "class", "w svelte-1c1h349"), u(_, "class", "notion svelte-1c1h349"), u(e, "class", "f svelte-1c1h349");
    },
    m(k, y) {
      S(k, e, y), f(e, l), f(l, i), f(l, n), f(l, a), f(e, o), f(e, _), f(_, d), f(_, h), f(_, g), f(_, b);
    },
    p(k, [y]) {
      y & /*duration, width, $progress*/
      11 && r !== (r = `width: ${/*duration*/
      k[0] == 0 ? (
        /*width*/
        k[1]
      ) : (
        /*$progress*/
        k[3] / /*duration*/
        k[0] * /*width*/
        k[1]
      )}px`) && u(a, "style", r), y & /*width*/
      2 && s !== (s = `width: ${/*width*/
      k[1]}px;`) && u(l, "style", s), y & /*duration, $progress*/
      9 && c !== (c = /*duration*/
      (k[0] == 0 ? "100" : Math.round(
        /*$progress*/
        k[3] / /*duration*/
        k[0] * 1e4
      ) / 100) + "") && U(d, c), y & /*duration*/
      1 && p !== (p = /*duration*/
      k[0].toString().slice(0, 7) + "") && U(g, p);
    },
    i: ne,
    o: ne,
    d(k) {
      k && C(e);
    }
  };
}
function ew(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(o, (_) => l(3, i = _)), o);
  t.$$.on_destroy.push(() => n());
  let { duration: r = 100, width: s = 200 } = e, o;
  return Tt(() => {
    a(l(2, o = Ju(0, { duration: r }))), Ta(o, i = r, i);
  }), t.$$set = (_) => {
    "duration" in _ && l(0, r = _.duration), "width" in _ && l(1, s = _.width);
  }, t.$$.update = () => {
    t.$$.dirty & /*duration*/
    1 && (a(l(2, o = Ju(0, { duration: r }))), Ta(o, i = r, i));
  }, [r, s, o, i];
}
class tw extends Ve {
  constructor(e) {
    super(), Qe(this, e, ew, xy, Fe, { duration: 0, width: 1 });
  }
}
function Zu(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R, P, O, F, L, X, V, Q, Z, ae, se, K, Y, W, J, ee = (
    /*$drawPlan*/
    t[6].groups.machine && xu(t)
  );
  const we = [iw, lw], Re = [];
  function ve(fe, G) {
    return (
      /*$drawPlan*/
      fe[6].operations && !/*$autoplay*/
      fe[12] ? 0 : (
        /*$drawPlan*/
        fe[6].operations && /*$autoplay*/
        fe[12] ? 1 : -1
      )
    );
  }
  ~(X = ve(t)) && (V = Re[X] = we[X](t));
  let me = (
    /*$drawPlan*/
    t[6].operations && ef(t)
  );
  return {
    c() {
      e = m("h5"), e.textContent = "Cost estimate", l = N(), i = m("div"), n = m("div"), a = m("label"), r = E("Shots"), o = N(), _ = m("input"), d = N(), h = m("div"), p = m("label"), g = E("Time (ns)"), k = N(), y = m("input"), w = N(), q = m("div"), $ = m("label"), j = E("Estimated costs $"), A = N(), M = m("input"), H = N(), B = m("p"), B.textContent = `The estimated cost is only for the operations. The actual cost includes
    qubit initialization, etc.`, R = N(), P = Ge("svg"), O = Ge("style"), F = E(`g {
        font-family: Iosevka;
        font-size: 14px;
      }
    `), ee && ee.c(), L = Ae(), V && V.c(), se = N(), me && me.c(), K = Ae(), u(e, "class", "svelte-18z7n1k"), u(a, "for", s = "cost-exp-shots-" + /*id*/
      t[1]), u(a, "class", "svelte-18z7n1k"), u(_, "id", c = "cost-exp-shots-" + /*id*/
      t[1]), u(_, "type", "number"), u(_, "class", "svelte-18z7n1k"), u(n, "class", "input-wrap svelte-18z7n1k"), u(p, "for", b = "cost-exp-shots-" + /*id*/
      t[1]), u(p, "class", "svelte-18z7n1k"), u(y, "id", v = "cost-exp-shots-" + /*id*/
      t[1]), u(y, "type", "number"), y.disabled = !0, y.value = /*cost_time*/
      t[8], u(y, "class", "svelte-18z7n1k"), u(h, "class", "input-wrap svelte-18z7n1k"), u($, "for", I = "cost-exp-shots-" + /*id*/
      t[1]), u($, "class", "svelte-18z7n1k"), u(M, "id", z = "cost-exp-shots-" + /*id*/
      t[1]), u(M, "type", "number"), M.disabled = !0, M.value = /*cost_charge*/
      t[7], u(M, "class", "svelte-18z7n1k"), u(q, "class", "input-wrap svelte-18z7n1k"), u(i, "class", "cost-explorer svelte-18z7n1k"), u(B, "class", "note svelte-18z7n1k"), u(
        P,
        "id",
        /*id*/
        t[1]
      ), u(P, "width", Q = /*$drawPlan*/
      t[6].width), u(P, "height", Z = /*$drawPlan*/
      t[6].height), u(P, "viewBox", ae = /*$drawPlan*/
      t[6].viewBox.join(" "));
    },
    m(fe, G) {
      S(fe, e, G), S(fe, l, G), S(fe, i, G), f(i, n), f(n, a), f(a, r), f(n, o), f(n, _), pt(
        _,
        /*cost_shots*/
        t[5]
      ), f(i, d), f(i, h), f(h, p), f(p, g), f(h, k), f(h, y), f(i, w), f(i, q), f(q, $), f($, j), f(q, A), f(q, M), S(fe, H, G), S(fe, B, G), S(fe, R, G), S(fe, P, G), f(P, O), f(O, F), ee && ee.m(P, null), f(P, L), ~X && Re[X].m(P, null), S(fe, se, G), me && me.m(fe, G), S(fe, K, G), Y = !0, W || (J = te(
        _,
        "input",
        /*input0_input_handler*/
        t[30]
      ), W = !0);
    },
    p(fe, G) {
      (!Y || G[0] & /*id*/
      2 && s !== (s = "cost-exp-shots-" + /*id*/
      fe[1])) && u(a, "for", s), (!Y || G[0] & /*id*/
      2 && c !== (c = "cost-exp-shots-" + /*id*/
      fe[1])) && u(_, "id", c), G[0] & /*cost_shots*/
      32 && sm(_.value) !== /*cost_shots*/
      fe[5] && pt(
        _,
        /*cost_shots*/
        fe[5]
      ), (!Y || G[0] & /*id*/
      2 && b !== (b = "cost-exp-shots-" + /*id*/
      fe[1])) && u(p, "for", b), (!Y || G[0] & /*id*/
      2 && v !== (v = "cost-exp-shots-" + /*id*/
      fe[1])) && u(y, "id", v), (!Y || G[0] & /*cost_time*/
      256 && y.value !== /*cost_time*/
      fe[8]) && (y.value = /*cost_time*/
      fe[8]), (!Y || G[0] & /*id*/
      2 && I !== (I = "cost-exp-shots-" + /*id*/
      fe[1])) && u($, "for", I), (!Y || G[0] & /*id*/
      2 && z !== (z = "cost-exp-shots-" + /*id*/
      fe[1])) && u(M, "id", z), (!Y || G[0] & /*cost_charge*/
      128 && M.value !== /*cost_charge*/
      fe[7]) && (M.value = /*cost_charge*/
      fe[7]), /*$drawPlan*/
      fe[6].groups.machine ? ee ? (ee.p(fe, G), G[0] & /*$drawPlan*/
      64 && T(ee, 1)) : (ee = xu(fe), ee.c(), T(ee, 1), ee.m(P, L)) : ee && (be(), D(ee, 1, 1, () => {
        ee = null;
      }), ke());
      let ye = X;
      X = ve(fe), X === ye ? ~X && Re[X].p(fe, G) : (V && (be(), D(Re[ye], 1, 1, () => {
        Re[ye] = null;
      }), ke()), ~X ? (V = Re[X], V ? V.p(fe, G) : (V = Re[X] = we[X](fe), V.c()), T(V, 1), V.m(P, null)) : V = null), (!Y || G[0] & /*id*/
      2) && u(
        P,
        "id",
        /*id*/
        fe[1]
      ), (!Y || G[0] & /*$drawPlan*/
      64 && Q !== (Q = /*$drawPlan*/
      fe[6].width)) && u(P, "width", Q), (!Y || G[0] & /*$drawPlan*/
      64 && Z !== (Z = /*$drawPlan*/
      fe[6].height)) && u(P, "height", Z), (!Y || G[0] & /*$drawPlan*/
      64 && ae !== (ae = /*$drawPlan*/
      fe[6].viewBox.join(" "))) && u(P, "viewBox", ae), /*$drawPlan*/
      fe[6].operations ? me ? (me.p(fe, G), G[0] & /*$drawPlan*/
      64 && T(me, 1)) : (me = ef(fe), me.c(), T(me, 1), me.m(K.parentNode, K)) : me && (be(), D(me, 1, 1, () => {
        me = null;
      }), ke());
    },
    i(fe) {
      Y || (T(ee), T(V), T(me), Y = !0);
    },
    o(fe) {
      D(ee), D(V), D(me), Y = !1;
    },
    d(fe) {
      fe && (C(e), C(l), C(i), C(H), C(B), C(R), C(P), C(se), C(K)), ee && ee.d(), ~X && Re[X].d(), me && me.d(fe), W = !1, J();
    }
  };
}
function xu(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[6].groups.machine
      ),
      open_tool: (
        /*open_tool*/
        t[3]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function lw(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[6].operations[
          /*$anim_curr_layer*/
          t[9]
        ]
      ),
      open_tool: (
        /*open_tool*/
        t[3]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function iw(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[6].operations[
          /*$curr_layer*/
          t[13]
        ]
      ),
      open_tool: (
        /*open_tool*/
        t[3]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function ef(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R, P, O, F, L, X, V, Q, Z, ae, se, K, Y, W, J, ee, we, Re, ve = 5 / /*time_factors*/
  t[18][
    /*$time_factor*/
    t[11]
  ] + "", me, fe, G, ye, ue, le = (
    /*$keep_timescale*/
    t[10] && /*$autoplay*/
    t[12] && tf(t)
  );
  return i = new Zy({
    props: {
      total: (
        /*$drawPlan*/
        t[6].operations.length
      ),
      curr: (
        /*$autoplay*/
        t[12] ? (
          /*$anim_curr_layer*/
          t[9]
        ) : (
          /*$curr_layer*/
          t[13]
        )
      )
    }
  }), {
    c() {
      le && le.c(), e = N(), l = m("div"), pe(i.$$.fragment), n = N(), a = m("div"), r = m("button"), s = E("To first"), _ = N(), c = m("button"), d = E("← Prev"), p = N(), g = m("button"), b = E("Next →"), y = N(), v = m("button"), w = E("To last"), $ = N(), j = m("div"), I = m("button"), A = E("Autoplay"), M = N(), z = m("button"), H = E("Stop"), R = N(), P = m("button"), O = E("Slower"), L = N(), X = m("button"), V = E("Faster"), Z = N(), ae = m("br"), se = N(), K = m("div"), Y = m("input"), W = N(), J = m("label"), J.textContent = "Keep times", ee = N(), we = m("span"), Re = E("Speed: "), me = E(ve), fe = E("x"), u(l, "class", "button-wrap svelte-18z7n1k"), r.disabled = o = /*$curr_layer*/
      t[13] == 0 || /*$autoplay*/
      t[12], u(r, "class", "svelte-18z7n1k"), c.disabled = h = /*$curr_layer*/
      t[13] == 0 || /*$autoplay*/
      t[12], u(c, "class", "svelte-18z7n1k"), g.disabled = k = /*$curr_layer*/
      t[13] == /*$drawPlan*/
      t[6].operations.length - 1 || /*$autoplay*/
      t[12], u(g, "class", "svelte-18z7n1k"), v.disabled = q = /*$curr_layer*/
      t[13] == /*$drawPlan*/
      t[6].operations.length - 1 || /*$autoplay*/
      t[12], u(v, "class", "svelte-18z7n1k"), u(a, "class", "button-wrap svelte-18z7n1k"), I.disabled = /*$autoplay*/
      t[12], u(I, "class", "svelte-18z7n1k"), z.disabled = B = !/*$autoplay*/
      t[12], u(z, "class", "svelte-18z7n1k"), P.disabled = F = /*$time_factor*/
      t[11] == 0, u(P, "class", "svelte-18z7n1k"), X.disabled = Q = /*$time_factor*/
      t[11] == /*time_factors*/
      t[18].length - 1, u(X, "class", "svelte-18z7n1k"), u(Y, "type", "checkbox"), u(Y, "name", "match-time-scale"), u(Y, "class", "svelte-18z7n1k"), u(J, "for", "match-time-scale"), u(J, "class", "svelte-18z7n1k"), u(we, "class", "speed svelte-18z7n1k"), At(K, "margin-top", "0.25rem"), u(j, "class", "button-wrap svelte-18z7n1k");
    },
    m(oe, x) {
      le && le.m(oe, x), S(oe, e, x), S(oe, l, x), de(i, l, null), S(oe, n, x), S(oe, a, x), f(a, r), f(r, s), f(a, _), f(a, c), f(c, d), f(a, p), f(a, g), f(g, b), f(a, y), f(a, v), f(v, w), S(oe, $, x), S(oe, j, x), f(j, I), f(I, A), f(j, M), f(j, z), f(z, H), f(j, R), f(j, P), f(P, O), f(j, L), f(j, X), f(X, V), f(j, Z), f(j, ae), f(j, se), f(j, K), f(K, Y), f(K, W), f(K, J), f(K, ee), f(K, we), f(we, Re), f(we, me), f(we, fe), G = !0, ye || (ue = [
        te(
          r,
          "click",
          /*click_handler*/
          t[31]
        ),
        te(
          c,
          "click",
          /*click_handler_1*/
          t[32]
        ),
        te(
          g,
          "click",
          /*click_handler_2*/
          t[33]
        ),
        te(
          v,
          "click",
          /*click_handler_3*/
          t[34]
        ),
        te(
          I,
          "click",
          /*click_handler_4*/
          t[35]
        ),
        te(
          z,
          "click",
          /*click_handler_5*/
          t[36]
        ),
        te(
          P,
          "click",
          /*click_handler_6*/
          t[37]
        ),
        te(
          X,
          "click",
          /*click_handler_7*/
          t[38]
        ),
        te(
          Y,
          "change",
          /*change_handler*/
          t[39]
        )
      ], ye = !0);
    },
    p(oe, x) {
      /*$keep_timescale*/
      oe[10] && /*$autoplay*/
      oe[12] ? le ? (le.p(oe, x), x[0] & /*$keep_timescale, $autoplay*/
      5120 && T(le, 1)) : (le = tf(oe), le.c(), T(le, 1), le.m(e.parentNode, e)) : le && (be(), D(le, 1, 1, () => {
        le = null;
      }), ke());
      const ge = {};
      x[0] & /*$drawPlan*/
      64 && (ge.total = /*$drawPlan*/
      oe[6].operations.length), x[0] & /*$autoplay, $anim_curr_layer, $curr_layer*/
      12800 && (ge.curr = /*$autoplay*/
      oe[12] ? (
        /*$anim_curr_layer*/
        oe[9]
      ) : (
        /*$curr_layer*/
        oe[13]
      )), i.$set(ge), (!G || x[0] & /*$curr_layer, $autoplay*/
      12288 && o !== (o = /*$curr_layer*/
      oe[13] == 0 || /*$autoplay*/
      oe[12])) && (r.disabled = o), (!G || x[0] & /*$curr_layer, $autoplay*/
      12288 && h !== (h = /*$curr_layer*/
      oe[13] == 0 || /*$autoplay*/
      oe[12])) && (c.disabled = h), (!G || x[0] & /*$curr_layer, $drawPlan, $autoplay*/
      12352 && k !== (k = /*$curr_layer*/
      oe[13] == /*$drawPlan*/
      oe[6].operations.length - 1 || /*$autoplay*/
      oe[12])) && (g.disabled = k), (!G || x[0] & /*$curr_layer, $drawPlan, $autoplay*/
      12352 && q !== (q = /*$curr_layer*/
      oe[13] == /*$drawPlan*/
      oe[6].operations.length - 1 || /*$autoplay*/
      oe[12])) && (v.disabled = q), (!G || x[0] & /*$autoplay*/
      4096) && (I.disabled = /*$autoplay*/
      oe[12]), (!G || x[0] & /*$autoplay*/
      4096 && B !== (B = !/*$autoplay*/
      oe[12])) && (z.disabled = B), (!G || x[0] & /*$time_factor*/
      2048 && F !== (F = /*$time_factor*/
      oe[11] == 0)) && (P.disabled = F), (!G || x[0] & /*$time_factor*/
      2048 && Q !== (Q = /*$time_factor*/
      oe[11] == /*time_factors*/
      oe[18].length - 1)) && (X.disabled = Q), (!G || x[0] & /*$time_factor*/
      2048) && ve !== (ve = 5 / /*time_factors*/
      oe[18][
        /*$time_factor*/
        oe[11]
      ] + "") && U(me, ve);
    },
    i(oe) {
      G || (T(le), T(i.$$.fragment, oe), G = !0);
    },
    o(oe) {
      D(le), D(i.$$.fragment, oe), G = !1;
    },
    d(oe) {
      oe && (C(e), C(l), C(n), C(a), C($), C(j)), le && le.d(oe), he(i), ye = !1, wt(ue);
    }
  };
}
function tf(t) {
  var n, a;
  let e, l, i;
  return l = new tw({
    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"), pe(l.$$.fragment), u(e, "class", "button-wrap svelte-18z7n1k");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0;
    },
    p(r, s) {
      var _, c;
      const o = {};
      s[0] & /*$drawPlan, $autoplay, $anim_curr_layer, $curr_layer*/
      12864 && (o.duration = /*$drawPlan*/
      (c = (_ = r[6].operations) == null ? void 0 : _[
        /*$autoplay*/
        r[12] ? (
          /*$anim_curr_layer*/
          r[9]
        ) : (
          /*$curr_layer*/
          r[13]
        )
      ]) == null ? void 0 : c.duration), l.$set(o);
    },
    i(r) {
      i || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l);
    }
  };
}
function nw(t) {
  let e, l, i = (
    /*data*/
    t[0] && /*$drawPlan*/
    t[6] && Zu(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(n, a) {
      i && i.m(n, a), S(n, e, a), l = !0;
    },
    p(n, a) {
      /*data*/
      n[0] && /*$drawPlan*/
      n[6] ? i ? (i.p(n, a), a[0] & /*data, $drawPlan*/
      65 && T(i, 1)) : (i = Zu(n), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d(n);
    }
  };
}
function aw(t) {
  return new Promise((e) => {
    setTimeout(e, t);
  });
}
function rw(t, e, l) {
  let i, n, a = ne, r = () => (a(), a = st(I, (re) => l(43, n = re)), I), s, o, _, c, d = ne, h = () => (d(), d = st(z, (re) => l(12, c = re)), z), p;
  t.$$.on_destroy.push(() => a()), t.$$.on_destroy.push(() => d());
  let { data: g, id: b, original_circuit_id: k, transpiled_circuit_id: y, pulse_view_id: v, match: w, operation_data: q, machine_moment_at: $ = Oe(0), machine_dt_at: j = Oe(0), op_schedule: I = Oe([]), open_tool: A = () => {
  }, filter_unused_qubits: M = !1, autoplay: z = Oe(!1) } = e;
  r(), h();
  let H = window, B = Oe();
  at(t, B, (re) => l(6, i = re));
  let R = Oe(null), P = Oe(0);
  at(t, R, (re) => l(13, p = re)), at(t, P, (re) => l(9, s = re));
  let O = Oe(!1), F = !1;
  at(t, O, (re) => l(10, o = re));
  let L = kl(Cy);
  R.subscribe((re) => {
    var Ie;
    Y(), re >= 0 && re <= ((Ie = i == null ? void 0 : i.operations) == null ? void 0 : Ie.length) - 1 && K(re), W(re);
  }), P.subscribe((re) => {
    var Ie;
    Y(), re >= 0 && re <= ((Ie = i == null ? void 0 : i.operations) == null ? void 0 : Ie.length) - 1 && K(re), W(re);
  }), B.subscribe((re) => {
    re != null && re.operations && (R.set(0), W(0));
  });
  let X = [];
  Tt(() => {
    var re;
    g && (B.set(Xu(g, q, {
      id: b,
      original_circuit_id: k,
      transpiled_circuit_id: y,
      pulse_view_id: v,
      match: w,
      nodeColorScale: L,
      filter_unused_qubits: M
    })), (re = i.operations) == null || re.map((Ie) => Ie.duration).reduce((Ie, je) => Ie + je, 0), W(0));
  });
  let V = [
    1e3 / 50,
    1e3 / 100,
    1e3 / 150,
    1e3 / 200,
    1e3 / 250,
    1e3 / 300,
    1e3 / 350,
    1e3 / 400
  ], Q = Oe(3);
  at(t, Q, (re) => l(11, _ = re));
  function Z() {
    Q.update((re) => Math.max(re - 1, 0));
  }
  function ae() {
    Q.update((re) => Math.min(re + 1, V.length - 1));
  }
  async function se() {
    if (F = !0, P.set(0), !!(i != null && i.operations)) {
      for (const re of i == null ? void 0 : i.operations) {
        if (!F) {
          z.set(!1), R.set(s);
          return;
        }
        let Ie = V[_] * (o ? n[s] : 100);
        if (Ie > 0) {
          let je = (n[s + 1] === void 0 ? n[s] : n[s + 1]) - n[s], _e = Lr((Ee) => {
            j.set(n[s] + je * Ee / Ie), Ee > Ie && _e.stop();
          });
          await aw(Ie);
        }
        if (!F) {
          z.set(!1), R.set(s);
          return;
        }
        P.update((je) => Math.min(je + 1, i.operations.length - 1));
      }
      z.set(!1), R.set(0);
    }
  }
  function K(re) {
    var Ee;
    X = [];
    let Ie = (Ee = i == null ? void 0 : i.operations) == null ? void 0 : Ee[re], je = [], _e = [];
    if (Ie != null && Ie.elem) {
      let ie = Ie.elem.filter((Ue) => Ue.role === "op-layer-operation-group");
      ie && ie.forEach((Ue) => {
        Ue.data.edge_ids.forEach((Rt) => {
          let ot = document.querySelector(`#${b} #${Rt}--group .highlight-wrap`);
          ot && (ot.classList.add("edge-highlighted"), ot.style.fill = Ue.data.match_color, ot.style.fillOpacity = "0.4");
        });
        let We = Ue.data.operation_index, vt = document.querySelector(`#${y} .gate-wrap.layer-${re}.gate-${We}.transpiled`);
        vt && (vt.classList.add("op-highlighted"), vt.style.outline = `2px solid ${Ue.data.match_color}`);
        let qt = Ue.data.original_layer_index;
        _e.push(qt);
        let rt = Ue.data.original_operation_index, mt = document.querySelector(`#${k} .gate-wrap.layer-${qt}.gate-${rt}.original`);
        mt && (mt.classList.add("op-highlighted"), mt.style.outline = `2px solid ${Ue.data.match_color}`), je.push(Ue.data.match_color);
      });
      let Te = document.querySelector(`#${y} #layer-${re}--interaction-wrap`);
      if (Te) {
        let Ue = P0(je), Ke = Ue ? `tg-l-${re}` : null;
        Ke && (O0(y, { id: Ke, grad_data: Ue }), X.push(Ke)), Te.classList.add("layer-highlighted"), Te.style.fill = Ke ? `url(#${Ke})` : je[0] || "#000000", Te.style.fillOpacity = "0.2";
      }
      _e.forEach((Ue, Ke) => {
        let We = document.querySelector(`#${k} #layer-${Ue}--interaction-wrap`);
        We && (We.classList.add("layer-highlighted"), We.style.fill = je[Ke], We.style.fillOpacity = "0.2");
      });
    }
  }
  function Y() {
    let re = Array.from(H ? document.querySelectorAll(`#${y} .edge-highlighted`) : []);
    re == null || re.forEach((ie) => {
      ie.classList.remove("edge-highlighted"), ie.style.fill = "#ffffff", ie.style.fillOpacity = 0;
    });
    let Ie = Array.from(H ? document.querySelectorAll(`#${y} .layer-highlighted`) : []);
    Ie == null || Ie.forEach((ie) => {
      ie.classList.remove("layer-highlighted"), ie.style.fillOpacity = 0;
    });
    let je = Array.from(H ? document.querySelectorAll(`#${y} .op-highlighted`) : []);
    je == null || je.forEach((ie) => {
      ie.classList.remove("op-highlighted"), ie.style.outline = null;
    });
    let _e = Array.from(H ? document.querySelectorAll(`#${k} .layer-highlighted`) : []);
    _e == null || _e.forEach((ie) => {
      ie.classList.remove("layer-highlighted"), ie.style.fillOpacity = 0;
    });
    let Ee = Array.from(H ? document.querySelectorAll(`#${k} .op-highlighted`) : []);
    Ee == null || Ee.forEach((ie) => {
      ie.classList.remove("op-highlighted"), ie.style.outline = null;
    });
  }
  function W(re) {
    var _e, Ee, ie, Te, Ue;
    let Ie = (Ee = (_e = i == null ? void 0 : i.operations[re].elem) == null ? void 0 : _e.filter((Ke) => Ke.role === "op-layer-operation-group")) == null ? void 0 : Ee[0], je = ((ie = i == null ? void 0 : i.bit_map) == null ? void 0 : ie.qubit_rel_map) || {};
    Ie && ((Ue = (Te = g == null ? void 0 : g.design) == null ? void 0 : Te.nodes) == null || Ue.forEach((Ke, We) => {
      var vt, qt;
      if (je[Ke.index] !== void 0) {
        $.set(re), j.set(n[re]);
        let rt = (((qt = (vt = Ie.data) == null ? void 0 : vt.esp_qubit_wise) == null ? void 0 : qt[je[Ke.index]]) - q.esp) / (1 - q.esp), mt = document.querySelector(`#${b} #qubit-node-${Ke.index}--node`);
        mt && mt.setAttribute("fill", L(rt));
      }
    }));
  }
  function J() {
    F = !1;
  }
  z.subscribe((re) => {
    re ? se() : J();
  });
  let ee = 1e3, we = 0, Re;
  function ve() {
    ee = sm(this.value), l(5, ee);
  }
  const me = () => {
    R.update((re) => 0);
  }, fe = () => {
    R.update((re) => re - 1);
  }, G = () => {
    R.update((re) => re + 1);
  }, ye = () => {
    R.update((re) => i.operations.length - 1);
  }, ue = () => {
    z.set(!0);
  }, le = () => {
    z.set(!1);
  }, oe = () => {
    Z();
  }, x = () => {
    ae();
  }, ge = (re) => {
    O.set(re.target.checked);
  };
  return t.$$set = (re) => {
    "data" in re && l(0, g = re.data), "id" in re && l(1, b = re.id), "original_circuit_id" in re && l(22, k = re.original_circuit_id), "transpiled_circuit_id" in re && l(23, y = re.transpiled_circuit_id), "pulse_view_id" in re && l(24, v = re.pulse_view_id), "match" in re && l(25, w = re.match), "operation_data" in re && l(26, q = re.operation_data), "machine_moment_at" in re && l(27, $ = re.machine_moment_at), "machine_dt_at" in re && l(28, j = re.machine_dt_at), "op_schedule" in re && r(l(2, I = re.op_schedule)), "open_tool" in re && l(3, A = re.open_tool), "filter_unused_qubits" in re && l(29, M = re.filter_unused_qubits), "autoplay" in re && h(l(4, z = re.autoplay));
  }, t.$$.update = () => {
    var re;
    t.$$.dirty[0] & /*data, operation_data, id, original_circuit_id, transpiled_circuit_id, pulse_view_id, match, filter_unused_qubits, $drawPlan*/
    666894403 && g && (B.set(Xu(g, q, {
      id: b,
      original_circuit_id: k,
      transpiled_circuit_id: y,
      pulse_view_id: v,
      match: w,
      nodeColorScale: L,
      filter_unused_qubits: M
    })), (re = i == null ? void 0 : i.operations) == null || re.map((Ie) => Ie.duration).reduce((Ie, je) => Ie + je, 0), W(0)), t.$$.dirty[0] & /*$drawPlan, cost_shots*/
    96 && (l(7, we = Qy(i.meta_info.cummul_duration, ee)), l(8, Re = ee * i.meta_info.cummul_duration));
  }, [
    g,
    b,
    I,
    A,
    z,
    ee,
    i,
    we,
    Re,
    s,
    o,
    _,
    c,
    p,
    B,
    R,
    P,
    O,
    V,
    Q,
    Z,
    ae,
    k,
    y,
    v,
    w,
    q,
    $,
    j,
    M,
    ve,
    me,
    fe,
    G,
    ye,
    ue,
    le,
    oe,
    x,
    ge
  ];
}
class sw extends Ve {
  constructor(e) {
    super(), Qe(
      this,
      e,
      rw,
      nw,
      Fe,
      {
        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 lf(t, e, l) {
  const i = t.slice();
  return i[4] = e[l], i;
}
function nf(t) {
  var a;
  let e, l, i = (
    /*backend*/
    ((a = t[0]) == null ? void 0 : a.machine_data) && af(t)
  ), n = (
    /*params*/
    t[1] && rf(t)
  );
  return {
    c() {
      e = m("table"), i && i.c(), l = N(), n && n.c(), u(e, "class", "svelte-1yxnwb0");
    },
    m(r, s) {
      S(r, e, s), i && i.m(e, null), f(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 = af(r), i.c(), i.m(e, l)) : i && (i.d(1), i = null), /*params*/
      r[1] ? n ? n.p(r, s) : (n = rf(r), n.c(), n.m(e, null)) : n && (n.d(1), n = null);
    },
    d(r) {
      r && C(e), i && i.d(), n && n.d();
    }
  };
}
function af(t) {
  var v, w, q, $, j, I;
  let e, l, i, n, a = (
    /*backend*/
    ((w = (v = t[0]) == null ? void 0 : v.machine_data) == null ? void 0 : w.backend_name) + ""
  ), r, s, o = (
    /*backend*/
    (($ = (q = t[0]) == null ? void 0 : q.machine_data) == null ? void 0 : $.backend_version) + ""
  ), _, c, d, h, p, g, b, k = (
    /*backend*/
    ((I = (j = t[0]) == null ? void 0 : j.machine_data) == null ? void 0 : I.gates.map(uf).join(", ")) + ""
  ), y;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Backend", i = N(), n = m("td"), r = E(a), s = E(" ("), _ = E(o), c = E(")"), d = N(), h = m("tr"), p = m("th"), p.textContent = "Supported Gates", g = N(), b = m("td"), y = E(k), u(l, "class", "svelte-1yxnwb0"), u(n, "class", "svelte-1yxnwb0"), u(p, "class", "svelte-1yxnwb0"), u(b, "class", "svelte-1yxnwb0");
    },
    m(A, M) {
      S(A, e, M), f(e, l), f(e, i), f(e, n), f(n, r), f(n, s), f(n, _), f(n, c), S(A, d, M), S(A, h, M), f(h, p), f(h, g), f(h, b), f(b, y);
    },
    p(A, M) {
      var z, H, B, R, P, O;
      M & /*backend*/
      1 && a !== (a = /*backend*/
      ((H = (z = A[0]) == null ? void 0 : z.machine_data) == null ? void 0 : H.backend_name) + "") && U(r, a), M & /*backend*/
      1 && o !== (o = /*backend*/
      ((R = (B = A[0]) == null ? void 0 : B.machine_data) == null ? void 0 : R.backend_version) + "") && U(_, o), M & /*backend*/
      1 && k !== (k = /*backend*/
      ((O = (P = A[0]) == null ? void 0 : P.machine_data) == null ? void 0 : O.gates.map(uf).join(", ")) + "") && U(y, k);
    },
    d(A) {
      A && (C(e), C(d), C(h));
    }
  };
}
function rf(t) {
  let e, l = $e(Object.keys(
    /*params*/
    t[1]
  )), i = [];
  for (let n = 0; n < l.length; n += 1)
    i[n] = of(lf(t, l, n));
  return {
    c() {
      for (let n = 0; n < i.length; n += 1)
        i[n].c();
      e = Ae();
    },
    m(n, a) {
      for (let r = 0; r < i.length; r += 1)
        i[r] && i[r].m(n, a);
      S(n, e, a);
    },
    p(n, a) {
      if (a & /*params, Object, undefined*/
      2) {
        l = $e(Object.keys(
          /*params*/
          n[1]
        ));
        let r;
        for (r = 0; r < l.length; r += 1) {
          const s = lf(n, l, r);
          i[r] ? i[r].p(s, a) : (i[r] = of(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 && C(e), Ye(i, n);
    }
  };
}
function sf(t) {
  let e, l, i = (
    /*key*/
    t[4] + ""
  ), n, a, r, s = (
    /*params*/
    t[1][
      /*key*/
      t[4]
    ] + ""
  ), o, _;
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = N(), r = m("td"), o = E(s), _ = N(), u(l, "class", "svelte-1yxnwb0"), u(r, "class", "svelte-1yxnwb0");
    },
    m(c, d) {
      S(c, e, d), f(e, l), f(l, n), f(e, a), f(e, r), f(r, o), f(e, _);
    },
    p(c, d) {
      d & /*params*/
      2 && i !== (i = /*key*/
      c[4] + "") && U(n, i), d & /*params*/
      2 && s !== (s = /*params*/
      c[1][
        /*key*/
        c[4]
      ] + "") && U(o, s);
    },
    d(c) {
      c && C(e);
    }
  };
}
function of(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" && sf(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(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 = sf(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function ow(t) {
  let e, l, i, n, a = (
    /*show*/
    t[2] ? "Close" : "Open"
  ), r, s, o, _, c = (
    /*show*/
    t[2] && nf(t)
  );
  return {
    c() {
      e = m("div"), l = m("h3"), i = E("Machine & transpilation information "), n = m("button"), r = E(a), s = N(), c && c.c(), u(n, "class", "svelte-1yxnwb0"), u(l, "class", "svelte-1yxnwb0"), u(e, "class", "machine-info-wrap svelte-1yxnwb0");
    },
    m(d, h) {
      S(d, e, h), f(e, l), f(l, i), f(l, n), f(n, r), f(e, s), c && c.m(e, null), o || (_ = te(
        n,
        "click",
        /*click_handler*/
        t[3]
      ), o = !0);
    },
    p(d, [h]) {
      h & /*show*/
      4 && a !== (a = /*show*/
      d[2] ? "Close" : "Open") && U(r, a), /*show*/
      d[2] ? c ? c.p(d, h) : (c = nf(d), c.c(), c.m(e, null)) : c && (c.d(1), c = null);
    },
    i: ne,
    o: ne,
    d(d) {
      d && C(e), c && c.d(), o = !1, _();
    }
  };
}
const uf = (t) => t.name;
function uw(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 fw extends Ve {
  constructor(e) {
    super(), Qe(this, e, uw, ow, Fe, { backend: 0, params: 1 });
  }
}
function ff(t, e, l) {
  const i = t.slice();
  return i[2] = e[l], i[4] = l, i;
}
function _f(t, e, l) {
  const i = t.slice();
  return i[2] = e[l], i[4] = l, i;
}
function cf(t, e, l) {
  const i = t.slice();
  return i[2] = e[l], i[4] = l, i;
}
function df(t, e, l) {
  const i = t.slice();
  return i[7] = e[l], i;
}
function hf(t, e, l) {
  const i = t.slice();
  return i[2] = e[l], i[4] = l, i;
}
function pf(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 gf(t, e, l) {
  const i = t.slice();
  return i[2] = e[l], i[4] = l, i;
}
function bf(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R, P, O, F, L, X, V, Q, Z, ae, se, K, Y, W, J, ee, we, Re = $e(
    /*transpile_data*/
    t[0]
  ), ve = [];
  for (let _e = 0; _e < Re.length; _e += 1)
    ve[_e] = kf(gf(t, Re, _e));
  let me = $e(
    /*transpile_data*/
    t[0]
  ), fe = [];
  for (let _e = 0; _e < me.length; _e += 1)
    fe[_e] = vf(mf(t, me, _e));
  let G = $e(
    /*transpile_data*/
    t[0]
  ), ye = [];
  for (let _e = 0; _e < G.length; _e += 1)
    ye[_e] = yf(pf(t, G, _e));
  let ue = $e(
    /*specified_parameters*/
    t[1]
  ), le = [];
  for (let _e = 0; _e < ue.length; _e += 1)
    le[_e] = $f(df(t, ue, _e));
  let oe = $e(
    /*transpile_data*/
    t[0]
  ), x = [];
  for (let _e = 0; _e < oe.length; _e += 1)
    x[_e] = qf(cf(t, oe, _e));
  let ge = $e(
    /*transpile_data*/
    t[0]
  ), re = [];
  for (let _e = 0; _e < ge.length; _e += 1)
    re[_e] = jf(_f(t, ge, _e));
  let Ie = $e(
    /*transpile_data*/
    t[0]
  ), je = [];
  for (let _e = 0; _e < Ie.length; _e += 1)
    je[_e] = Tf(ff(t, Ie, _e));
  return {
    c() {
      e = m("table"), l = m("thead"), i = m("tr"), n = m("th"), a = N();
      for (let _e = 0; _e < ve.length; _e += 1)
        ve[_e].c();
      r = N(), s = m("tbody"), o = m("tr"), _ = m("th"), _.textContent = "Backend", c = N(), d = m("td"), p = N(), g = m("tr"), b = m("th"), b.textContent = "Name", k = N();
      for (let _e = 0; _e < fe.length; _e += 1)
        fe[_e].c();
      y = N(), v = m("tr"), w = m("th"), w.textContent = "#Qubits", q = N();
      for (let _e = 0; _e < ye.length; _e += 1)
        ye[_e].c();
      $ = N(), j = m("tr"), I = m("th"), I.textContent = "Params", A = N(), M = m("td"), H = N();
      for (let _e = 0; _e < le.length; _e += 1)
        le[_e].c();
      B = N(), R = m("tr"), P = m("th"), P.textContent = "Post", O = N(), F = m("td"), X = N(), V = m("tr"), Q = m("th"), Q.textContent = "#Layers", Z = N();
      for (let _e = 0; _e < x.length; _e += 1)
        x[_e].c();
      ae = N(), se = m("tr"), K = m("th"), K.textContent = "#Operations", Y = N();
      for (let _e = 0; _e < re.length; _e += 1)
        re[_e].c();
      W = N(), J = m("tr"), ee = m("th"), ee.textContent = "ESP", we = N();
      for (let _e = 0; _e < je.length; _e += 1)
        je[_e].c();
      u(n, "class", "svelte-652jkj"), u(_, "class", "gap svelte-652jkj"), u(d, "colspan", h = /*transpile_data*/
      t[0].length || 0), u(d, "class", "gap svelte-652jkj"), u(b, "class", "svelte-652jkj"), u(w, "class", "svelte-652jkj"), u(I, "class", "gap svelte-652jkj"), u(M, "colspan", z = /*transpile_data*/
      t[0].length || 0), u(M, "class", "gap svelte-652jkj"), u(P, "class", "gap svelte-652jkj"), u(F, "colspan", L = /*transpile_data*/
      t[0].length || 0), u(F, "class", "gap svelte-652jkj"), u(Q, "class", "svelte-652jkj"), u(K, "class", "svelte-652jkj"), u(ee, "class", "svelte-652jkj"), u(e, "class", "svelte-652jkj");
    },
    m(_e, Ee) {
      S(_e, e, Ee), f(e, l), f(l, i), f(i, n), f(i, a);
      for (let ie = 0; ie < ve.length; ie += 1)
        ve[ie] && ve[ie].m(i, null);
      f(e, r), f(e, s), f(s, o), f(o, _), f(o, c), f(o, d), f(s, p), f(s, g), f(g, b), f(g, k);
      for (let ie = 0; ie < fe.length; ie += 1)
        fe[ie] && fe[ie].m(g, null);
      f(s, y), f(s, v), f(v, w), f(v, q);
      for (let ie = 0; ie < ye.length; ie += 1)
        ye[ie] && ye[ie].m(v, null);
      f(s, $), f(s, j), f(j, I), f(j, A), f(j, M), f(s, H);
      for (let ie = 0; ie < le.length; ie += 1)
        le[ie] && le[ie].m(s, null);
      f(s, B), f(s, R), f(R, P), f(R, O), f(R, F), f(s, X), f(s, V), f(V, Q), f(V, Z);
      for (let ie = 0; ie < x.length; ie += 1)
        x[ie] && x[ie].m(V, null);
      f(s, ae), f(s, se), f(se, K), f(se, Y);
      for (let ie = 0; ie < re.length; ie += 1)
        re[ie] && re[ie].m(se, null);
      f(s, W), f(s, J), f(J, ee), f(J, we);
      for (let ie = 0; ie < je.length; ie += 1)
        je[ie] && je[ie].m(J, null);
    },
    p(_e, Ee) {
      if (Ee & /*transpile_data*/
      1) {
        Re = $e(
          /*transpile_data*/
          _e[0]
        );
        let ie;
        for (ie = 0; ie < Re.length; ie += 1) {
          const Te = gf(_e, Re, ie);
          ve[ie] ? ve[ie].p(Te, Ee) : (ve[ie] = kf(Te), ve[ie].c(), ve[ie].m(i, null));
        }
        for (; ie < ve.length; ie += 1)
          ve[ie].d(1);
        ve.length = Re.length;
      }
      if (Ee & /*transpile_data*/
      1 && h !== (h = /*transpile_data*/
      _e[0].length || 0) && u(d, "colspan", h), Ee & /*shorten_backend_name, transpile_data*/
      1) {
        me = $e(
          /*transpile_data*/
          _e[0]
        );
        let ie;
        for (ie = 0; ie < me.length; ie += 1) {
          const Te = mf(_e, me, ie);
          fe[ie] ? fe[ie].p(Te, Ee) : (fe[ie] = vf(Te), fe[ie].c(), fe[ie].m(g, null));
        }
        for (; ie < fe.length; ie += 1)
          fe[ie].d(1);
        fe.length = me.length;
      }
      if (Ee & /*transpile_data*/
      1) {
        G = $e(
          /*transpile_data*/
          _e[0]
        );
        let ie;
        for (ie = 0; ie < G.length; ie += 1) {
          const Te = pf(_e, G, ie);
          ye[ie] ? ye[ie].p(Te, Ee) : (ye[ie] = yf(Te), ye[ie].c(), ye[ie].m(v, null));
        }
        for (; ie < ye.length; ie += 1)
          ye[ie].d(1);
        ye.length = G.length;
      }
      if (Ee & /*transpile_data*/
      1 && z !== (z = /*transpile_data*/
      _e[0].length || 0) && u(M, "colspan", z), Ee & /*transpile_data, specified_parameters*/
      3) {
        ue = $e(
          /*specified_parameters*/
          _e[1]
        );
        let ie;
        for (ie = 0; ie < ue.length; ie += 1) {
          const Te = df(_e, ue, ie);
          le[ie] ? le[ie].p(Te, Ee) : (le[ie] = $f(Te), le[ie].c(), le[ie].m(s, B));
        }
        for (; ie < le.length; ie += 1)
          le[ie].d(1);
        le.length = ue.length;
      }
      if (Ee & /*transpile_data*/
      1 && L !== (L = /*transpile_data*/
      _e[0].length || 0) && u(F, "colspan", L), Ee & /*transpile_data*/
      1) {
        oe = $e(
          /*transpile_data*/
          _e[0]
        );
        let ie;
        for (ie = 0; ie < oe.length; ie += 1) {
          const Te = cf(_e, oe, ie);
          x[ie] ? x[ie].p(Te, Ee) : (x[ie] = qf(Te), x[ie].c(), x[ie].m(V, null));
        }
        for (; ie < x.length; ie += 1)
          x[ie].d(1);
        x.length = oe.length;
      }
      if (Ee & /*transpile_data*/
      1) {
        ge = $e(
          /*transpile_data*/
          _e[0]
        );
        let ie;
        for (ie = 0; ie < ge.length; ie += 1) {
          const Te = _f(_e, ge, ie);
          re[ie] ? re[ie].p(Te, Ee) : (re[ie] = jf(Te), re[ie].c(), re[ie].m(se, null));
        }
        for (; ie < re.length; ie += 1)
          re[ie].d(1);
        re.length = ge.length;
      }
      if (Ee & /*transpile_data*/
      1) {
        Ie = $e(
          /*transpile_data*/
          _e[0]
        );
        let ie;
        for (ie = 0; ie < Ie.length; ie += 1) {
          const Te = ff(_e, Ie, ie);
          je[ie] ? je[ie].p(Te, Ee) : (je[ie] = Tf(Te), je[ie].c(), je[ie].m(J, null));
        }
        for (; ie < je.length; ie += 1)
          je[ie].d(1);
        je.length = Ie.length;
      }
    },
    d(_e) {
      _e && C(e), Ye(ve, _e), Ye(fe, _e), Ye(ye, _e), Ye(le, _e), Ye(x, _e), Ye(re, _e), Ye(je, _e);
    }
  };
}
function kf(t) {
  let e;
  return {
    c() {
      e = m("td"), e.textContent = `#${/*ti*/
      t[4]} `, u(e, "class", "svelte-652jkj");
    },
    m(l, i) {
      S(l, e, i);
    },
    p: ne,
    d(l) {
      l && C(e);
    }
  };
}
function vf(t) {
  var a, r, s;
  let e, l = Sf(
    /*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 = N(), u(e, "class", "svelte-652jkj");
    },
    m(o, _) {
      S(o, e, _), f(e, i), f(e, n);
    },
    p(o, _) {
      var c, d, h;
      _ & /*transpile_data*/
      1 && l !== (l = Sf(
        /*trans*/
        (h = (d = (c = o[2]) == null ? void 0 : c.backend) == null ? void 0 : d.machine_data) == null ? void 0 : h.backend_name
      ) + "") && U(i, l);
    },
    d(o) {
      o && C(e);
    }
  };
}
function yf(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 = N(), u(e, "class", "svelte-652jkj");
    },
    m(o, _) {
      S(o, e, _), f(e, i), f(e, n);
    },
    p(o, _) {
      var c, d, h;
      _ & /*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) + "") && U(i, l);
    },
    d(o) {
      o && C(e);
    }
  };
}
function wf(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), u(e, "class", "svelte-652jkj");
    },
    m(r, s) {
      S(r, e, s), f(e, i);
    },
    p(r, s) {
      var o, _;
      s & /*transpile_data, specified_parameters*/
      3 && l !== (l = /*trans*/
      ((_ = (o = r[2]) == null ? void 0 : o.transpile_param) == null ? void 0 : _[
        /*key*/
        r[7]
      ]) + "") && U(i, l);
    },
    d(r) {
      r && C(e);
    }
  };
}
function $f(t) {
  let e, l, i = (
    /*key*/
    t[7] + ""
  ), n, a, r = $e(
    /*transpile_data*/
    t[0]
  ), s = [];
  for (let o = 0; o < r.length; o += 1)
    s[o] = wf(hf(t, r, o));
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = N();
      for (let o = 0; o < s.length; o += 1)
        s[o].c();
      u(l, "class", "svelte-652jkj");
    },
    m(o, _) {
      S(o, e, _), f(e, l), f(l, n), f(e, a);
      for (let c = 0; c < s.length; c += 1)
        s[c] && s[c].m(e, null);
    },
    p(o, _) {
      if (_ & /*specified_parameters*/
      2 && i !== (i = /*key*/
      o[7] + "") && U(n, i), _ & /*transpile_data, specified_parameters*/
      3) {
        r = $e(
          /*transpile_data*/
          o[0]
        );
        let c;
        for (c = 0; c < r.length; c += 1) {
          const d = hf(o, r, c);
          s[c] ? s[c].p(d, _) : (s[c] = wf(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 && C(e), Ye(s, o);
    }
  };
}
function qf(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 = N(), u(e, "class", "svelte-652jkj");
    },
    m(s, o) {
      S(s, e, o), f(e, i), f(e, n);
    },
    p(s, o) {
      var _, c;
      o & /*transpile_data*/
      1 && l !== (l = /*trans*/
      ((c = (_ = s[2]) == null ? void 0 : _.layers) == null ? void 0 : c.length) + "") && U(i, l);
    },
    d(s) {
      s && C(e);
    }
  };
}
function jf(t) {
  var a, r;
  let e, l = (
    /*trans*/
    ((r = (a = t[2]) == null ? void 0 : a.layers) == null ? void 0 : r.map(Mf).reduce(zf, 0)) + ""
  ), i, n;
  return {
    c() {
      e = m("td"), i = E(l), n = N(), u(e, "class", "svelte-652jkj");
    },
    m(s, o) {
      S(s, e, o), f(e, i), f(e, n);
    },
    p(s, o) {
      var _, c;
      o & /*transpile_data*/
      1 && l !== (l = /*trans*/
      ((c = (_ = s[2]) == null ? void 0 : _.layers) == null ? void 0 : c.map(Mf).reduce(zf, 0)) + "") && U(i, l);
    },
    d(s) {
      s && C(e);
    }
  };
}
function Tf(t) {
  var a;
  let e, l = es(
    /*trans*/
    (a = t[2]) == null ? void 0 : a.esp,
    8
  ) + "", i, n;
  return {
    c() {
      e = m("td"), i = E(l), n = N(), u(e, "class", "svelte-652jkj");
    },
    m(r, s) {
      S(r, e, s), f(e, i), f(e, n);
    },
    p(r, s) {
      var o;
      s & /*transpile_data*/
      1 && l !== (l = es(
        /*trans*/
        (o = r[2]) == null ? void 0 : o.esp,
        8
      ) + "") && U(i, l);
    },
    d(r) {
      r && C(e);
    }
  };
}
function _w(t) {
  let e, l = (
    /*transpile_data*/
    t[0] && bf(t)
  );
  return {
    c() {
      e = m("div"), l && l.c(), u(e, "class", "svelte-652jkj");
    },
    m(i, n) {
      S(i, e, n), l && l.m(e, null);
    },
    p(i, [n]) {
      /*transpile_data*/
      i[0] ? l ? l.p(i, n) : (l = bf(i), l.c(), l.m(e, null)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d();
    }
  };
}
function Cf(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 Sf(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 Mf = (t) => t.operations.length, zf = (t, e) => t + e;
function cw(t, e, l) {
  let { transpile_data: i = [] } = e, n = [];
  return Tt(() => {
    l(1, n = Cf(i));
  }), t.$$set = (a) => {
    "transpile_data" in a && l(0, i = a.transpile_data);
  }, t.$$.update = () => {
    t.$$.dirty & /*transpile_data*/
    1 && l(1, n = Cf(i));
  }, [i, n];
}
class dw extends Ve {
  constructor(e) {
    super(), Qe(this, e, cw, _w, Fe, { transpile_data: 0 });
  }
}
function Nf(t, e) {
  let l = 0, i = [], n = [], a = {}, r = 0;
  for (const s of t) {
    let o = 0, _ = 0;
    for (const c of s.operations) {
      let d = c.gate, h = c.qubits.map((b) => b.index), p = d + "__" + h.join("_"), g = e == null ? void 0 : e[p];
      if (g) {
        o = g.duration > o ? g.duration : o;
        for (const b of g.pulse_schedule) {
          let k = JSON.parse(JSON.stringify(b));
          k.time_at = k.time_at + l, k.layer_index = r, k.op_index = _, i.push(k), a[k.name] || (a[k.name] = {
            name: k.name,
            channel_type: k.channel_type,
            channel_index: k.channel_index,
            component_type: k.component_type,
            pulse_type: k.pulse_type
          });
        }
      }
      _++;
    }
    l += o, n.push(l), r++;
  }
  return n.unshift(0), { schedule: i, channels: a, operation_schedule: n };
}
function Af(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A;
  return {
    c() {
      e = m("div"), l = m("div"), i = m("button"), n = E("Width: 1/"), a = E(
        /*$unit_dt*/
        t[9]
      ), r = N(), s = m("button"), s.textContent = "←", o = N(), _ = m("button"), _.textContent = "→", c = N(), d = m("button"), d.textContent = "↺", h = N(), p = m("div"), g = m("button"), b = E("Height: "), k = E(
        /*$pulse_row_height*/
        t[10]
      ), y = N(), v = m("button"), v.textContent = "↑", w = N(), q = m("button"), q.textContent = "↓", $ = N(), j = m("button"), j.textContent = "↺", i.disabled = !0, u(i, "class", "svelte-wurcqz"), u(s, "alt", "narrower"), u(s, "class", "svelte-wurcqz"), u(_, "alt", "wider"), u(_, "class", "svelte-wurcqz"), u(d, "class", "svelte-wurcqz"), u(l, "class", "sizing-button-wrap svelte-wurcqz"), g.disabled = !0, u(g, "class", "svelte-wurcqz"), u(v, "alt", "shallower"), u(v, "class", "svelte-wurcqz"), u(q, "alt", "deeper"), u(q, "class", "svelte-wurcqz"), u(j, "alt", "reset"), u(j, "class", "svelte-wurcqz"), u(p, "class", "sizing-button-wrap svelte-wurcqz"), u(e, "class", "sizing-options svelte-wurcqz");
    },
    m(M, z) {
      S(M, e, z), f(e, l), f(l, i), f(i, n), f(i, a), f(l, r), f(l, s), f(l, o), f(l, _), f(l, c), f(l, d), f(e, h), f(e, p), f(p, g), f(g, b), f(g, k), f(p, y), f(p, v), f(p, w), f(p, q), f(p, $), f(p, j), I || (A = [
        te(
          s,
          "click",
          /*click_handler_2*/
          t[23]
        ),
        te(
          _,
          "click",
          /*click_handler_3*/
          t[24]
        ),
        te(
          d,
          "click",
          /*click_handler_4*/
          t[25]
        ),
        te(
          v,
          "click",
          /*click_handler_5*/
          t[26]
        ),
        te(
          q,
          "click",
          /*click_handler_6*/
          t[27]
        ),
        te(
          j,
          "click",
          /*click_handler_7*/
          t[28]
        )
      ], I = !0);
    },
    p(M, z) {
      z[0] & /*$unit_dt*/
      512 && U(
        a,
        /*$unit_dt*/
        M[9]
      ), z[0] & /*$pulse_row_height*/
      1024 && U(
        k,
        /*$pulse_row_height*/
        M[10]
      );
    },
    d(M) {
      M && C(e), I = !1, wt(A);
    }
  };
}
function Bf(t) {
  var I, A, M, z, H;
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $ = (
    /*$drawPlan*/
    t[11].groups.axis_group && Pf(t)
  ), j = (
    /*$drawPlan*/
    t[11].groups.area_group && Of(t)
  );
  return b = new _m({
    props: {
      data: {
        id: (
          /*id*/
          t[0] + "-dt-marker-text"
        ),
        x: De + Ot + et - 1 + /*$drawPlan*/
        ((I = t[11].scales) == null ? void 0 : I.dt_scale(
          /*$machine_dt_at*/
          t[12]
        )) + /*$drawPlan*/
        (((A = t[11].scales) == null ? void 0 : A.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*/
          ((M = t[11].scales) == null ? void 0 : M.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)"
      }
    }
  }), k = new fm({
    props: {
      data: {
        id: (
          /*id*/
          t[0] + "-dt-marker"
        ),
        x1: De + Ot + et - 1 + /*$drawPlan*/
        ((z = t[11].scales) == null ? void 0 : z.dt_scale(
          /*$machine_dt_at*/
          t[12]
        )),
        x2: De + Ot + et - 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 = Ge("svg"), i = Ge("style"), n = E(`g {
            font-family: Iosevka;
            font-size: 14px;
          }
        `), $ && $.c(), _ = N(), c = m("div"), d = Ge("svg"), h = Ge("style"), p = E(`g {
            font-family: Iosevka;
            font-size: 14px;
          }
        `), j && j.c(), g = Ge("g"), pe(b.$$.fragment), pe(k.$$.fragment), u(l, "id", a = /*id*/
      t[0] + "-sticky"), u(l, "class", "sticky-axis"), u(l, "width", De + Ot), u(l, "height", r = /*$drawPlan*/
      t[11].height), u(l, "viewBox", s = [
        0,
        0,
        De + Ot,
        /*$drawPlan*/
        t[11].height
      ].join(" ")), u(e, "class", "pulse-sticky svelte-wurcqz"), u(e, "style", o = `width: ${De + Ot}px; height:${De + /*$drawPlan*/
      t[11].height}px;`), u(
        d,
        "id",
        /*id*/
        t[0]
      ), u(d, "width", y = /*$drawPlan*/
      t[11].width), u(d, "height", v = /*$drawPlan*/
      t[11].height), u(d, "viewBox", w = /*$drawPlan*/
      t[11].viewBox.join(" ")), u(c, "class", "pulse-main svelte-wurcqz");
    },
    m(B, R) {
      S(B, e, R), f(e, l), f(l, i), f(i, n), $ && $.m(l, null), S(B, _, R), S(B, c, R), f(c, d), f(d, h), f(h, p), j && j.m(d, null), f(d, g), de(b, g, null), de(k, g, null), q = !0;
    },
    p(B, R) {
      var F, L, X, V, Q;
      /*$drawPlan*/
      B[11].groups.axis_group ? $ ? ($.p(B, R), R[0] & /*$drawPlan*/
      2048 && T($, 1)) : ($ = Pf(B), $.c(), T($, 1), $.m(l, null)) : $ && (be(), D($, 1, 1, () => {
        $ = null;
      }), ke()), (!q || R[0] & /*id*/
      1 && a !== (a = /*id*/
      B[0] + "-sticky")) && u(l, "id", a), (!q || R[0] & /*$drawPlan*/
      2048 && r !== (r = /*$drawPlan*/
      B[11].height)) && u(l, "height", r), (!q || R[0] & /*$drawPlan*/
      2048 && s !== (s = [
        0,
        0,
        De + Ot,
        /*$drawPlan*/
        B[11].height
      ].join(" "))) && u(l, "viewBox", s), (!q || R[0] & /*$drawPlan*/
      2048 && o !== (o = `width: ${De + Ot}px; height:${De + /*$drawPlan*/
      B[11].height}px;`)) && u(e, "style", o), /*$drawPlan*/
      B[11].groups.area_group ? j ? (j.p(B, R), R[0] & /*$drawPlan*/
      2048 && T(j, 1)) : (j = Of(B), j.c(), T(j, 1), j.m(d, g)) : j && (be(), D(j, 1, 1, () => {
        j = null;
      }), ke());
      const P = {};
      R[0] & /*id, $drawPlan, $machine_dt_at, $machine_moment_at*/
      14337 && (P.data = {
        id: (
          /*id*/
          B[0] + "-dt-marker-text"
        ),
        x: De + Ot + et - 1 + /*$drawPlan*/
        ((F = B[11].scales) == null ? void 0 : F.dt_scale(
          /*$machine_dt_at*/
          B[12]
        )) + /*$drawPlan*/
        (((L = B[11].scales) == null ? void 0 : L.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)"
      }), b.$set(P);
      const O = {};
      R[0] & /*id, $drawPlan, $machine_dt_at*/
      6145 && (O.data = {
        id: (
          /*id*/
          B[0] + "-dt-marker"
        ),
        x1: De + Ot + et - 1 + /*$drawPlan*/
        ((V = B[11].scales) == null ? void 0 : V.dt_scale(
          /*$machine_dt_at*/
          B[12]
        )),
        x2: De + Ot + et - 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 }
      }), k.$set(O), (!q || R[0] & /*id*/
      1) && u(
        d,
        "id",
        /*id*/
        B[0]
      ), (!q || R[0] & /*$drawPlan*/
      2048 && y !== (y = /*$drawPlan*/
      B[11].width)) && u(d, "width", y), (!q || R[0] & /*$drawPlan*/
      2048 && v !== (v = /*$drawPlan*/
      B[11].height)) && u(d, "height", v), (!q || R[0] & /*$drawPlan*/
      2048 && w !== (w = /*$drawPlan*/
      B[11].viewBox.join(" "))) && u(d, "viewBox", w);
    },
    i(B) {
      q || (T($), T(j), T(b.$$.fragment, B), T(k.$$.fragment, B), q = !0);
    },
    o(B) {
      D($), D(j), D(b.$$.fragment, B), D(k.$$.fragment, B), q = !1;
    },
    d(B) {
      B && (C(e), C(_), C(c)), $ && $.d(), j && j.d(), he(b), he(k);
    }
  };
}
function Pf(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[11].groups.axis_group
      ),
      open_tool: (
        /*open_tool*/
        t[5]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Of(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[11].groups.area_group
      ),
      open_tool: (
        /*open_tool*/
        t[5]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function hw(t) {
  let e, l, i, n, a = (
    /*showPulseView*/
    t[8] ? "Hide" : "Show"
  ), r, s, o, _, c = (
    /*showViewControl*/
    t[7] ? "Hide" : "Show"
  ), d, h, p, g, b, k, y, v, w, q = (
    /*showViewControl*/
    t[7] && Af(t)
  ), $ = (
    /*circuit_layers*/
    t[1] && /*pulse_data*/
    t[2] && /*$drawPlan*/
    t[11] && /*showPulseView*/
    t[8] && Bf(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 = N(), _ = m("button"), d = E(c), h = E(" view control"), p = N(), q && q.c(), g = N(), b = m("div"), $ && $.c(), u(n, "class", "svelte-wurcqz"), u(_, "class", "svelte-wurcqz"), u(l, "class", "svelte-wurcqz"), u(b, "class", "pulse-vis-wrap svelte-wurcqz"), u(b, "id", k = /*id*/
      t[0] + "-wrapper");
    },
    m(j, I) {
      S(j, e, I), f(e, l), f(l, i), f(l, n), f(n, r), f(n, s), f(l, o), f(l, _), f(_, d), f(_, h), f(e, p), q && q.m(e, null), S(j, g, I), S(j, b, I), $ && $.m(b, null), y = !0, v || (w = [
        te(
          n,
          "click",
          /*click_handler*/
          t[21]
        ),
        te(
          _,
          "click",
          /*click_handler_1*/
          t[22]
        )
      ], v = !0);
    },
    p(j, I) {
      (!y || I[0] & /*showPulseView*/
      256) && a !== (a = /*showPulseView*/
      j[8] ? "Hide" : "Show") && U(r, a), (!y || I[0] & /*showViewControl*/
      128) && c !== (c = /*showViewControl*/
      j[7] ? "Hide" : "Show") && U(d, c), /*showViewControl*/
      j[7] ? q ? q.p(j, I) : (q = Af(j), q.c(), q.m(e, null)) : q && (q.d(1), q = null), /*circuit_layers*/
      j[1] && /*pulse_data*/
      j[2] && /*$drawPlan*/
      j[11] && /*showPulseView*/
      j[8] ? $ ? ($.p(j, I), I[0] & /*circuit_layers, pulse_data, $drawPlan, showPulseView*/
      2310 && T($, 1)) : ($ = Bf(j), $.c(), T($, 1), $.m(b, null)) : $ && (be(), D($, 1, 1, () => {
        $ = null;
      }), ke()), (!y || I[0] & /*id*/
      1 && k !== (k = /*id*/
      j[0] + "-wrapper")) && u(b, "id", k);
    },
    i(j) {
      y || (T($), y = !0);
    },
    o(j) {
      D($), y = !1;
    },
    d(j) {
      j && (C(e), C(g), C(b)), q && q.d(), $ && $.d(), v = !1, wt(w);
    }
  };
}
function pw(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(M, (Y) => l(30, i = Y)), M), r, s, o, _, c, d = ne, h = () => (d(), d = st(j, (Y) => l(12, c = Y)), j), p, g = ne, b = () => (g(), g = st($, (Y) => l(13, p = Y)), $);
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => d()), t.$$.on_destroy.push(() => g());
  let { id: k, transpiled_circuit_id: y, original_circuit_id: v, circuit_layers: w, pulse_data: q, machine_moment_at: $ = Oe(0), machine_dt_at: j = Oe(0), op_schedule: I = Oe([]), open_tool: A = () => {
  }, autoplay: M = Oe(!1) } = e;
  b(), h(), a();
  let z = Oe(10), H = Oe(25);
  at(t, z, (Y) => l(9, r = Y)), at(t, H, (Y) => l(10, o = Y));
  let B = Oe([]), R = {}, P = Oe();
  at(t, B, (Y) => l(31, s = Y)), at(t, P, (Y) => l(11, _ = Y)), Tt(() => {
    B.subscribe((ee) => {
      P.set(dr(ee, R, {
        unit_dt: r,
        pulse_row_height: o
      }));
    }), z.subscribe((ee) => {
      P.set(dr(s, R, {
        unit_dt: ee,
        pulse_row_height: o
      }));
    }), H.subscribe((ee) => {
      P.set(dr(s, R, { unit_dt: r, pulse_row_height: ee }));
    });
    let { schedule: Y, channels: W, operation_schedule: J } = Nf(w, q);
    R = W, B.set(Y), I.set(J), j.subscribe((ee) => {
      setTimeout(
        () => {
          var Re, ve, me, fe;
          let we = document.querySelector("#" + k + "-dt-marker");
          if (we) {
            let G = document.querySelector("#" + k + "-wrapper"), ye = document.querySelector("#" + k + "-sticky"), ue = (Re = G.getClientRects()[0]) == null ? void 0 : Re.left, le = (ve = G.getClientRects()[0]) == null ? void 0 : ve.width, oe = (me = ye.getClientRects()[0]) == null ? void 0 : me.width, x = ((fe = we.getClientRects()[0]) == null ? void 0 : fe.left) - ue - oe, ge = 2;
            x < 0 ? G.scrollBy({
              top: 0,
              left: -le / 3,
              behavior: i ? "instant" : "smooth"
            }) : x + ge > le - oe && G.scrollBy({
              top: 0,
              left: le / 3,
              behavior: i ? "instant" : "smooth"
            });
          }
        },
        50
      );
    });
  });
  let O = !1, F = !0;
  const L = () => {
    l(8, F = !F);
  }, X = () => {
    l(7, O = !O);
  }, V = () => {
    z.update((Y) => Math.min(Y + 2, 20));
  }, Q = () => {
    z.update((Y) => Math.max(Y - 2, 1));
  }, Z = () => {
    z.set(t0);
  }, ae = () => {
    H.update((Y) => Math.max(Y - 2, 10));
  }, se = () => {
    H.update((Y) => Math.min(Y + 2, 100));
  }, K = () => {
    H.set(Ot);
  };
  return t.$$set = (Y) => {
    "id" in Y && l(0, k = Y.id), "transpiled_circuit_id" in Y && l(18, y = Y.transpiled_circuit_id), "original_circuit_id" in Y && l(19, v = Y.original_circuit_id), "circuit_layers" in Y && l(1, w = Y.circuit_layers), "pulse_data" in Y && l(2, q = Y.pulse_data), "machine_moment_at" in Y && b(l(3, $ = Y.machine_moment_at)), "machine_dt_at" in Y && h(l(4, j = Y.machine_dt_at)), "op_schedule" in Y && l(20, I = Y.op_schedule), "open_tool" in Y && l(5, A = Y.open_tool), "autoplay" in Y && a(l(6, M = Y.autoplay));
  }, t.$$.update = () => {
    if (t.$$.dirty[0] & /*circuit_layers, pulse_data*/
    6) {
      let { schedule: Y, channels: W } = Nf(w, q);
      R = W, B.set(Y);
    }
  }, [
    k,
    w,
    q,
    $,
    j,
    A,
    M,
    O,
    F,
    r,
    o,
    _,
    c,
    p,
    z,
    H,
    B,
    P,
    y,
    v,
    I,
    L,
    X,
    V,
    Q,
    Z,
    ae,
    se,
    K
  ];
}
class mw extends Ve {
  constructor(e) {
    super(), Qe(
      this,
      e,
      pw,
      hw,
      Fe,
      {
        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 Ef(t, e, l) {
  const i = t.slice();
  return i[37] = e[l], i[39] = l, i;
}
function If(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("a"), l = E("PNG"), n = N(), a = m("a"), r = E("SVG"), u(e, "class", "save-download svelte-ttpui0"), u(e, "href", i = /*images*/
      t[6]["original-circuit"].png), u(e, "download", ""), u(a, "class", "save-download svelte-ttpui0"), u(a, "href", s = /*images*/
      t[6]["original-circuit"].svg), u(a, "download", "");
    },
    m(o, _) {
      S(o, e, _), f(e, l), S(o, n, _), S(o, a, _), f(a, r);
    },
    p(o, _) {
      _[0] & /*images*/
      64 && i !== (i = /*images*/
      o[6]["original-circuit"].png) && u(e, "href", i), _[0] & /*images*/
      64 && s !== (s = /*images*/
      o[6]["original-circuit"].svg) && u(a, "href", s);
    },
    d(o) {
      o && (C(e), C(n), C(a));
    }
  };
}
function Df(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("span"), e.textContent = "QASM2:", l = N(), i = m("button"), i.textContent = "Copy", n = N(), a = m("button"), a.textContent = "Show", u(e, "class", "save-make-label svelte-ttpui0"), u(i, "class", "save-make svelte-ttpui0"), u(a, "class", "save-make svelte-ttpui0");
    },
    m(o, _) {
      S(o, e, _), S(o, l, _), S(o, i, _), S(o, n, _), S(o, a, _), r || (s = [
        te(
          i,
          "click",
          /*click_handler_1*/
          t[19]
        ),
        te(
          a,
          "click",
          /*click_handler_2*/
          t[20]
        )
      ], r = !0);
    },
    p: ne,
    d(o) {
      o && (C(e), C(l), C(i), C(n), C(a)), r = !1, wt(s);
    }
  };
}
function Rf(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("span"), e.textContent = "QASM3:", l = N(), i = m("button"), i.textContent = "Copy", n = N(), a = m("button"), a.textContent = "Show", u(e, "class", "save-make-label svelte-ttpui0"), u(i, "class", "save-make svelte-ttpui0"), u(a, "class", "save-make svelte-ttpui0");
    },
    m(o, _) {
      S(o, e, _), S(o, l, _), S(o, i, _), S(o, n, _), S(o, a, _), r || (s = [
        te(
          i,
          "click",
          /*click_handler_3*/
          t[21]
        ),
        te(
          a,
          "click",
          /*click_handler_4*/
          t[22]
        )
      ], r = !0);
    },
    p: ne,
    d(o) {
      o && (C(e), C(l), C(i), C(n), C(a)), r = !1, wt(s);
    }
  };
}
function Hf(t) {
  var n;
  let e, l, i;
  return l = new dw({
    props: {
      transpile_data: (
        /*$data*/
        (n = t[8]) == null ? void 0 : n.transpiled
      )
    }
  }), {
    c() {
      e = m("div"), pe(l.$$.fragment), u(e, "class", "info-section-wrap svelte-ttpui0");
    },
    m(a, r) {
      S(a, e, r), de(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 || (T(l.$$.fragment, a), i = !0);
    },
    o(a) {
      D(l.$$.fragment, a), i = !1;
    },
    d(a) {
      a && C(e), he(l);
    }
  };
}
function Lf(t) {
  let e, l;
  return e = new Ly({
    props: {
      info: (
        /*$selected_info*/
        t[10].data
      ),
      machine_moment_at: (
        /*machine_moment_at*/
        t[0][
          /*$transpile_at*/
          t[9]
        ]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Ff(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("a"), l = E("PNG"), n = N(), a = m("a"), r = E("SVG"), u(e, "class", "save-download svelte-ttpui0"), u(e, "href", i = /*images*/
      t[6]["transpiled-circuit-" + /*ti*/
      t[39]].png), u(e, "download", ""), u(a, "class", "save-download svelte-ttpui0"), u(a, "href", s = /*images*/
      t[6]["transpiled-circuit-" + /*ti*/
      t[39]].svg), u(a, "download", "");
    },
    m(o, _) {
      S(o, e, _), f(e, l), S(o, n, _), S(o, a, _), f(a, r);
    },
    p(o, _) {
      _[0] & /*images*/
      64 && i !== (i = /*images*/
      o[6]["transpiled-circuit-" + /*ti*/
      o[39]].png) && u(e, "href", i), _[0] & /*images*/
      64 && s !== (s = /*images*/
      o[6]["transpiled-circuit-" + /*ti*/
      o[39]].svg) && u(a, "href", s);
    },
    d(o) {
      o && (C(e), C(n), C(a));
    }
  };
}
function Qf(t) {
  let e, l, i, n, a, r, s;
  function o(...c) {
    return (
      /*click_handler_8*/
      t[26](
        /*trans_circuit*/
        t[37],
        ...c
      )
    );
  }
  function _(...c) {
    return (
      /*click_handler_9*/
      t[27](
        /*ti*/
        t[39],
        /*trans_circuit*/
        t[37],
        ...c
      )
    );
  }
  return {
    c() {
      e = m("span"), e.textContent = "QASM2:", l = N(), i = m("button"), i.textContent = "Copy", n = N(), a = m("button"), a.textContent = "Show", u(e, "class", "save-make-label svelte-ttpui0"), u(i, "class", "save-make svelte-ttpui0"), u(a, "class", "save-make svelte-ttpui0");
    },
    m(c, d) {
      S(c, e, d), S(c, l, d), S(c, i, d), S(c, n, d), S(c, a, d), r || (s = [
        te(i, "click", o),
        te(a, "click", _)
      ], r = !0);
    },
    p(c, d) {
      t = c;
    },
    d(c) {
      c && (C(e), C(l), C(i), C(n), C(a)), r = !1, wt(s);
    }
  };
}
function Vf(t) {
  let e, l, i, n, a, r, s;
  function o(...c) {
    return (
      /*click_handler_10*/
      t[28](
        /*trans_circuit*/
        t[37],
        ...c
      )
    );
  }
  function _(...c) {
    return (
      /*click_handler_11*/
      t[29](
        /*ti*/
        t[39],
        /*trans_circuit*/
        t[37],
        ...c
      )
    );
  }
  return {
    c() {
      e = m("span"), e.textContent = "QASM3:", l = N(), i = m("button"), i.textContent = "Copy", n = N(), a = m("button"), a.textContent = "Show", u(e, "class", "save-make-label svelte-ttpui0"), u(i, "class", "save-make svelte-ttpui0"), u(a, "class", "save-make svelte-ttpui0");
    },
    m(c, d) {
      S(c, e, d), S(c, l, d), S(c, i, d), S(c, n, d), S(c, a, d), r || (s = [
        te(i, "click", o),
        te(a, "click", _)
      ], r = !0);
    },
    p(c, d) {
      t = c;
    },
    d(c) {
      c && (C(e), C(l), C(i), C(n), C(a)), r = !1, wt(s);
    }
  };
}
function Xf(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("a"), l = E("PNG"), n = N(), a = m("a"), r = E("SVG"), u(e, "class", "save-download svelte-ttpui0"), u(e, "href", i = /*images*/
      t[6]["on-machine-" + /*ti*/
      t[39]].png), u(e, "download", ""), u(a, "class", "save-download svelte-ttpui0"), u(a, "href", s = /*images*/
      t[6]["on-machine-" + /*ti*/
      t[39]].svg), u(a, "download", "");
    },
    m(o, _) {
      S(o, e, _), f(e, l), S(o, n, _), S(o, a, _), f(a, r);
    },
    p(o, _) {
      _[0] & /*images*/
      64 && i !== (i = /*images*/
      o[6]["on-machine-" + /*ti*/
      o[39]].png) && u(e, "href", i), _[0] & /*images*/
      64 && s !== (s = /*images*/
      o[6]["on-machine-" + /*ti*/
      o[39]].svg) && u(a, "href", s);
    },
    d(o) {
      o && (C(e), C(n), C(a));
    }
  };
}
function Gf(t) {
  var Re, ve, me, fe, G, ye, ue;
  let e, l, i, n, a = (
    /*ti*/
    t[39] + 1 + ""
  ), r, s, o, _ = (
    /*filter_unused_qubits*/
    t[5][
      /*ti*/
      t[39]
    ] ? "Show" : "Filter"
  ), c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R, P, O, F, L, X, V, Q;
  function Z(...le) {
    return (
      /*click_handler_6*/
      t[24](
        /*ti*/
        t[39],
        ...le
      )
    );
  }
  function ae(...le) {
    return (
      /*click_handler_7*/
      t[25](
        /*ti*/
        t[39],
        ...le
      )
    );
  }
  let se = (
    /*images*/
    t[6]["transpiled-circuit-" + /*ti*/
    t[39]] && Ff(t)
  ), K = (
    /*trans_circuit*/
    ((Re = t[37]) == null ? void 0 : Re.qasm2) && Qf(t)
  ), Y = (
    /*trans_circuit*/
    ((ve = t[37]) == null ? void 0 : ve.qasm3) && Vf(t)
  );
  v = new fw({
    props: {
      backend: (
        /*trans_circuit*/
        (me = t[37]) == null ? void 0 : me.backend
      ),
      params: (
        /*trans_circuit*/
        (fe = t[37]) == null ? void 0 : fe.transpile_param
      )
    }
  }), $ = new cm({
    props: {
      id: "transpiled-circuit-" + /*ti*/
      t[39],
      circuit_data: (
        /*trans_circuit*/
        t[37]
      ),
      is_original: !1,
      match: (
        /*trans_circuit*/
        (G = t[37]) == null ? void 0 : G.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(...le) {
    return (
      /*click_handler_12*/
      t[30](
        /*ti*/
        t[39],
        ...le
      )
    );
  }
  let J = (
    /*images*/
    t[6]["on-machine-" + /*ti*/
    t[39]] && Xf(t)
  );
  P = new sw({
    props: {
      data: (
        /*trans_circuit*/
        (ye = t[37]) == null ? void 0 : ye.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]
      )
    }
  }), L = new mw({
    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(...le) {
    return (
      /*focus_handler*/
      t[31](
        /*ti*/
        t[39],
        ...le
      )
    );
  }
  function we(...le) {
    return (
      /*click_handler_13*/
      t[32](
        /*ti*/
        t[39],
        ...le
      )
    );
  }
  return {
    c() {
      e = m("div"), l = m("section"), i = m("h1"), n = E("Transpiled Circuit "), r = E(a), s = N(), o = m("button"), c = E(_), d = E(" unused qubits"), h = N(), p = m("button"), p.textContent = "Image", g = N(), se && se.c(), b = N(), K && K.c(), k = N(), Y && Y.c(), y = N(), pe(v.$$.fragment), w = N(), q = m("div"), pe($.$$.fragment), j = N(), I = m("section"), A = m("h1"), M = E("On-machine view "), z = m("button"), z.textContent = "Image", H = N(), J && J.c(), B = N(), R = m("div"), pe(P.$$.fragment), O = N(), F = m("div"), pe(L.$$.fragment), u(o, "class", "save-make svelte-ttpui0"), u(p, "class", "save-make svelte-ttpui0"), u(i, "class", "svelte-ttpui0"), u(q, "class", "circuit svelte-ttpui0"), u(l, "class", "circuit-view-wrap circuit-section svelte-ttpui0"), u(z, "class", "save-make svelte-ttpui0"), u(A, "class", "svelte-ttpui0"), u(R, "class", "circuit svelte-ttpui0"), u(F, "class", "circuit svelte-ttpui0"), u(I, "class", "circuit-view-wrap machine-section svelte-ttpui0"), u(e, "class", "transpiled-wrap svelte-ttpui0");
    },
    m(le, oe) {
      S(le, e, oe), f(e, l), f(l, i), f(i, n), f(i, r), f(i, s), f(i, o), f(o, c), f(o, d), f(i, h), f(i, p), f(i, g), se && se.m(i, null), f(i, b), K && K.m(i, null), f(i, k), Y && Y.m(i, null), f(l, y), de(v, l, null), f(l, w), f(l, q), de($, q, null), f(e, j), f(e, I), f(I, A), f(A, M), f(A, z), f(A, H), J && J.m(A, null), f(I, B), f(I, R), de(P, R, null), f(I, O), f(I, F), de(L, F, null), X = !0, V || (Q = [
        te(o, "click", Z),
        te(p, "click", ae),
        te(z, "click", W),
        te(e, "focus", ee),
        te(e, "click", we)
      ], V = !0);
    },
    p(le, oe) {
      var je, _e, Ee, ie, Te, Ue, Ke;
      t = le, (!X || oe[0] & /*filter_unused_qubits*/
      32) && _ !== (_ = /*filter_unused_qubits*/
      t[5][
        /*ti*/
        t[39]
      ] ? "Show" : "Filter") && U(c, _), /*images*/
      t[6]["transpiled-circuit-" + /*ti*/
      t[39]] ? se ? se.p(t, oe) : (se = Ff(t), se.c(), se.m(i, b)) : se && (se.d(1), se = null), /*trans_circuit*/
      (je = t[37]) != null && je.qasm2 ? K ? K.p(t, oe) : (K = Qf(t), K.c(), K.m(i, k)) : K && (K.d(1), K = null), /*trans_circuit*/
      (_e = t[37]) != null && _e.qasm3 ? Y ? Y.p(t, oe) : (Y = Vf(t), Y.c(), Y.m(i, null)) : Y && (Y.d(1), Y = null);
      const x = {};
      oe[0] & /*$data*/
      256 && (x.backend = /*trans_circuit*/
      (Ee = t[37]) == null ? void 0 : Ee.backend), oe[0] & /*$data*/
      256 && (x.params = /*trans_circuit*/
      (ie = t[37]) == null ? void 0 : ie.transpile_param), v.$set(x);
      const ge = {};
      oe[0] & /*$data*/
      256 && (ge.circuit_data = /*trans_circuit*/
      t[37]), oe[0] & /*$data*/
      256 && (ge.match = /*trans_circuit*/
      (Te = t[37]) == null ? void 0 : Te.match), oe[0] & /*machine_moment_at*/
      1 && (ge.machine_moment_at = /*machine_moment_at*/
      t[0][
        /*ti*/
        t[39]
      ]), oe[0] & /*filter_unused_qubits*/
      32 && (ge.filter_unused_qubits = /*filter_unused_qubits*/
      t[5][
        /*ti*/
        t[39]
      ]), oe[0] & /*unit_id*/
      128 && (ge.unit_id = /*unit_id*/
      t[7]), $.$set(ge), /*images*/
      t[6]["on-machine-" + /*ti*/
      t[39]] ? J ? J.p(t, oe) : (J = Xf(t), J.c(), J.m(A, null)) : J && (J.d(1), J = null);
      const re = {};
      oe[0] & /*$data*/
      256 && (re.data = /*trans_circuit*/
      (Ue = t[37]) == null ? void 0 : Ue.backend), oe[0] & /*$data*/
      256 && (re.match = /*trans_circuit*/
      (Ke = t[37]) == null ? void 0 : Ke.match), oe[0] & /*$data*/
      256 && (re.operation_data = /*trans_circuit*/
      t[37]), oe[0] & /*machine_moment_at*/
      1 && (re.machine_moment_at = /*machine_moment_at*/
      t[0][
        /*ti*/
        t[39]
      ]), oe[0] & /*filter_unused_qubits*/
      32 && (re.filter_unused_qubits = /*filter_unused_qubits*/
      t[5][
        /*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]
      ]), oe[0] & /*unit_id*/
      128 && (re.unit_id = /*unit_id*/
      t[7]), P.$set(re);
      const Ie = {};
      oe[0] & /*$data*/
      256 && (Ie.circuit_layers = /*trans_circuit*/
      t[37].layers), oe[0] & /*$data*/
      256 && (Ie.pulse_data = /*trans_circuit*/
      t[37].pulse_data), oe[0] & /*$data*/
      256 && (Ie.gate_data = /*trans_circuit*/
      t[37].backend.gate_info), oe[0] & /*machine_moment_at*/
      1 && (Ie.machine_moment_at = /*machine_moment_at*/
      t[0][
        /*ti*/
        t[39]
      ]), oe[0] & /*machine_dt_at*/
      4 && (Ie.machine_dt_at = /*machine_dt_at*/
      t[2][
        /*ti*/
        t[39]
      ]), oe[0] & /*operation_schedules*/
      2 && (Ie.op_schedule = /*operation_schedules*/
      t[1][
        /*ti*/
        t[39]
      ]), oe[0] & /*autoplays*/
      8 && (Ie.autoplay = /*autoplays*/
      t[3][
        /*ti*/
        t[39]
      ]), L.$set(Ie);
    },
    i(le) {
      X || (T(v.$$.fragment, le), T($.$$.fragment, le), T(P.$$.fragment, le), T(L.$$.fragment, le), X = !0);
    },
    o(le) {
      D(v.$$.fragment, le), D($.$$.fragment, le), D(P.$$.fragment, le), D(L.$$.fragment, le), X = !1;
    },
    d(le) {
      le && C(e), se && se.d(), K && K.d(), Y && Y.d(), he(v), he($), J && J.d(), he(P), he(L), V = !1, wt(Q);
    }
  };
}
function gw(t) {
  var W, J, ee, we, Re, ve, me, fe, G, ye;
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v = (
    /*show_transpile_summary*/
    t[4] ? "Hide" : "Show"
  ), w, q, $, j, I, A, M, z, H, B, R, P, O, F, L, X = (
    /*images*/
    t[6]["original-circuit"] && If(t)
  ), V = (
    /*$data*/
    ((J = (W = t[8]) == null ? void 0 : W.original) == null ? void 0 : J.qasm2) && Df(t)
  ), Q = (
    /*$data*/
    ((we = (ee = t[8]) == null ? void 0 : ee.original) == null ? void 0 : we.qasm3) && Rf(t)
  );
  h = new cm({
    props: {
      id: "original-circuit",
      circuit_data: (
        /*$data*/
        (Re = t[8]) == null ? void 0 : Re.original
      ),
      is_original: !0,
      match: (
        /*$data*/
        (me = (ve = t[8]) == null ? void 0 : ve.transpiled[
          /*$transpile_at*/
          t[9]
        ]) == null ? void 0 : me.match
      ),
      matched_circuit_id: (
        /*$data*/
        (fe = t[8]) == null ? void 0 : fe.transpiled.map(Yf)
      ),
      matched_machine_id: (
        /*$data*/
        (G = t[8]) == null ? void 0 : G.transpiled.map(Kf)
      ),
      open_tool: (
        /*open_tool*/
        t[15]
      ),
      filter_unused_qubits: !1,
      unit_id: (
        /*unit_id*/
        t[7]
      )
    }
  });
  let Z = (
    /*show_transpile_summary*/
    t[4] && Hf(t)
  ), ae = (
    /*$selected_info*/
    t[10] && Lf(t)
  ), se = $e(
    /*$data*/
    ((ye = t[8]) == null ? void 0 : ye.transpiled) || []
  ), K = [];
  for (let ue = 0; ue < se.length; ue += 1)
    K[ue] = Gf(Ef(t, se, ue));
  const Y = (ue) => D(K[ue], 1, 1, () => {
    K[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 = N(), X && X.c(), o = N(), V && V.c(), _ = N(), Q && Q.c(), c = N(), d = m("div"), pe(h.$$.fragment), p = N(), g = m("section"), b = m("h1"), k = E("Transpilation Summary "), y = m("button"), w = E(v), q = N(), Z && Z.c(), $ = N(), j = m("section"), I = m("h1"), I.textContent = "Information & Interaction", A = N(), M = m("div"), ae && ae.c(), z = N(), H = m("div");
      for (let ue = 0; ue < K.length; ue += 1)
        K[ue].c();
      B = N(), 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.`, u(r, "class", "save-make svelte-ttpui0"), u(n, "class", "svelte-ttpui0"), u(d, "class", "circuit svelte-ttpui0"), u(i, "class", "circuit-view-wrap original svelte-ttpui0"), u(y, "class", "save-make svelte-ttpui0"), u(b, "class", "svelte-ttpui0"), u(g, "class", "circuit-view-wrap transpile-summary svelte-ttpui0"), u(I, "class", "svelte-ttpui0"), u(M, "class", "info-section-wrap svelte-ttpui0"), u(j, "class", "circuit-view-wrap info-section-group svelte-ttpui0"), u(l, "class", "original-circuit-column svelte-ttpui0"), u(R, "class", "note svelte-ttpui0"), u(H, "class", "transpiled-circuit-column svelte-ttpui0"), u(e, "class", "frame svelte-ttpui0"), u(e, "id", P = "circuit-viewer-" + /*unit_id*/
      t[7]);
    },
    m(ue, le) {
      S(ue, e, le), f(e, l), f(l, i), f(i, n), f(n, a), f(n, r), f(n, s), X && X.m(n, null), f(n, o), V && V.m(n, null), f(n, _), Q && Q.m(n, null), f(i, c), f(i, d), de(h, d, null), f(l, p), f(l, g), f(g, b), f(b, k), f(b, y), f(y, w), f(g, q), Z && Z.m(g, null), f(l, $), f(l, j), f(j, I), f(j, A), f(j, M), ae && ae.m(M, null), f(e, z), f(e, H);
      for (let oe = 0; oe < K.length; oe += 1)
        K[oe] && K[oe].m(H, null);
      f(H, B), f(H, R), O = !0, F || (L = [
        te(
          r,
          "click",
          /*click_handler*/
          t[18]
        ),
        te(
          y,
          "click",
          /*click_handler_5*/
          t[23]
        )
      ], F = !0);
    },
    p(ue, le) {
      var x, ge, re, Ie, je, _e, Ee, ie, Te, Ue;
      /*images*/
      ue[6]["original-circuit"] ? X ? X.p(ue, le) : (X = If(ue), X.c(), X.m(n, o)) : X && (X.d(1), X = null), /*$data*/
      (ge = (x = ue[8]) == null ? void 0 : x.original) != null && ge.qasm2 ? V ? V.p(ue, le) : (V = Df(ue), V.c(), V.m(n, _)) : V && (V.d(1), V = null), /*$data*/
      (Ie = (re = ue[8]) == null ? void 0 : re.original) != null && Ie.qasm3 ? Q ? Q.p(ue, le) : (Q = Rf(ue), Q.c(), Q.m(n, null)) : Q && (Q.d(1), Q = null);
      const oe = {};
      if (le[0] & /*$data*/
      256 && (oe.circuit_data = /*$data*/
      (je = ue[8]) == null ? void 0 : je.original), le[0] & /*$data, $transpile_at*/
      768 && (oe.match = /*$data*/
      (Ee = (_e = ue[8]) == null ? void 0 : _e.transpiled[
        /*$transpile_at*/
        ue[9]
      ]) == null ? void 0 : Ee.match), le[0] & /*$data*/
      256 && (oe.matched_circuit_id = /*$data*/
      (ie = ue[8]) == null ? void 0 : ie.transpiled.map(Yf)), le[0] & /*$data*/
      256 && (oe.matched_machine_id = /*$data*/
      (Te = ue[8]) == null ? void 0 : Te.transpiled.map(Kf)), le[0] & /*unit_id*/
      128 && (oe.unit_id = /*unit_id*/
      ue[7]), h.$set(oe), (!O || le[0] & /*show_transpile_summary*/
      16) && v !== (v = /*show_transpile_summary*/
      ue[4] ? "Hide" : "Show") && U(w, v), /*show_transpile_summary*/
      ue[4] ? Z ? (Z.p(ue, le), le[0] & /*show_transpile_summary*/
      16 && T(Z, 1)) : (Z = Hf(ue), Z.c(), T(Z, 1), Z.m(g, null)) : Z && (be(), D(Z, 1, 1, () => {
        Z = null;
      }), ke()), /*$selected_info*/
      ue[10] ? ae ? (ae.p(ue, le), le[0] & /*$selected_info*/
      1024 && T(ae, 1)) : (ae = Lf(ue), ae.c(), T(ae, 1), ae.m(M, null)) : ae && (be(), D(ae, 1, 1, () => {
        ae = null;
      }), ke()), le[0] & /*transpile_at, $data, open_tool, machine_moment_at, machine_dt_at, operation_schedules, autoplays, filter_unused_qubits, unit_id, images, images_loader*/
      53743) {
        se = $e(
          /*$data*/
          ((Ue = ue[8]) == null ? void 0 : Ue.transpiled) || []
        );
        let Ke;
        for (Ke = 0; Ke < se.length; Ke += 1) {
          const We = Ef(ue, se, Ke);
          K[Ke] ? (K[Ke].p(We, le), T(K[Ke], 1)) : (K[Ke] = Gf(We), K[Ke].c(), T(K[Ke], 1), K[Ke].m(H, B));
        }
        for (be(), Ke = se.length; Ke < K.length; Ke += 1)
          Y(Ke);
        ke();
      }
      (!O || le[0] & /*unit_id*/
      128 && P !== (P = "circuit-viewer-" + /*unit_id*/
      ue[7])) && u(e, "id", P);
    },
    i(ue) {
      if (!O) {
        T(h.$$.fragment, ue), T(Z), T(ae);
        for (let le = 0; le < se.length; le += 1)
          T(K[le]);
        O = !0;
      }
    },
    o(ue) {
      D(h.$$.fragment, ue), D(Z), D(ae), K = K.filter(Boolean);
      for (let le = 0; le < K.length; le += 1)
        D(K[le]);
      O = !1;
    },
    d(ue) {
      ue && C(e), X && X.d(), V && V.d(), Q && Q.d(), he(h), Z && Z.d(), ae && ae.d(), Ye(K, ue), F = !1, wt(L);
    }
  };
}
const Yf = (t, e) => "transpiled-circuit-" + e, Kf = (t, e) => "on-machine-" + e;
function bw(t, e, l) {
  let i, n, a, { model: r } = e, { key_circ: s = "circ" } = e, o = r.get(s), _ = JSON.parse(o), c = `change:${s}`, d = () => o = r.get(s), h = Oe();
  at(t, h, (K) => l(8, i = K));
  let p = [Oe(0)], g = [Oe([])], b = [Oe(0)], k = Oe(0);
  at(t, k, (K) => l(9, n = K));
  let y = [Oe(!1)], v = !0, w = [], q = Oe();
  at(t, q, (K) => l(10, a = K));
  let $ = {}, j = Oe();
  j.subscribe((K) => {
    K && l(6, $[K.id] = K, $);
  });
  function I(K) {
    q.set(K);
  }
  let A = "";
  Tt(() => {
    var K, Y, W, J, ee;
    l(7, A = crypto.randomUUID()), h.set(_), r.on(c, d), l(0, p = (K = i == null ? void 0 : i.transpiled) == null ? void 0 : K.map(() => Oe(0))), l(2, b = (Y = i == null ? void 0 : i.transpiled) == null ? void 0 : Y.map(() => Oe(0))), l(1, g = (W = i == null ? void 0 : i.transpiled) == null ? void 0 : W.map(() => Oe([]))), l(5, w = (J = i == null ? void 0 : i.transpiled) == null ? void 0 : J.map(() => !0)), l(3, y = (ee = i == null ? void 0 : i.transpiled) == null ? void 0 : ee.map(() => Oe(!1))), console.log(i);
  }), ri(() => {
    r.off(c, d);
  });
  const M = (K) => {
    Ii("original-circuit", j);
  }, z = (K) => {
    var Y;
    ei((Y = i == null ? void 0 : i.original) == null ? void 0 : Y.qasm2);
  }, H = (K) => {
    var Y;
    I({
      data: {
        qasm_version: 2,
        title: "Original Circuit",
        qasm: (Y = i == null ? void 0 : i.original) == null ? void 0 : Y.qasm2
      }
    });
  }, B = (K) => {
    var Y;
    ei((Y = i == null ? void 0 : i.original) == null ? void 0 : Y.qasm3);
  }, R = (K) => {
    var Y;
    I({
      data: {
        qasm_version: 3,
        title: "Original Circuit",
        qasm: (Y = i == null ? void 0 : i.original) == null ? void 0 : Y.qasm3
      }
    });
  }, P = () => {
    l(4, v = !v);
  }, O = (K, Y) => {
    l(5, w[K] = !w[K], w);
  }, F = (K, Y) => {
    Ii("transpiled-circuit-" + K, j);
  }, L = (K, Y) => {
    ei(K == null ? void 0 : K.qasm2);
  }, X = (K, Y, W) => {
    I({
      data: {
        qasm_version: 2,
        title: "Transpiled Circuit " + (K + 1),
        qasm: Y == null ? void 0 : Y.qasm2
      }
    });
  }, V = (K, Y) => {
    ei(K == null ? void 0 : K.qasm3);
  }, Q = (K, Y, W) => {
    I({
      data: {
        qasm_version: 3,
        title: "Transpiled Circuit " + (K + 1),
        qasm: Y == null ? void 0 : Y.qasm3
      }
    });
  }, Z = (K, Y) => {
    Ii("on-machine-" + K, j);
  }, ae = (K, Y) => {
    k.set(K);
  }, se = (K, Y) => {
    k.set(K);
  };
  return t.$$set = (K) => {
    "model" in K && l(16, r = K.model), "key_circ" in K && l(17, s = K.key_circ);
  }, [
    p,
    g,
    b,
    y,
    v,
    w,
    $,
    A,
    i,
    n,
    a,
    h,
    k,
    q,
    j,
    I,
    r,
    s,
    M,
    z,
    H,
    B,
    R,
    P,
    O,
    F,
    L,
    X,
    V,
    Q,
    Z,
    ae,
    se
  ];
}
class kw extends Ve {
  constructor(e) {
    super(), Qe(this, e, bw, gw, Fe, { model: 16, key_circ: 17 }, null, [-1, -1]);
  }
}
const yl = {
  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
  }
}, Uf = Object.keys(yl).map((t) => yl[t]), Et = {
  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 Jf(((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 Jf(((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."
  }
}, Wf = Object.keys(Et).map((t) => Et[t]);
function Jf(t) {
  return Array(...new Set(t));
}
function vw(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 yw(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 ww() {
  return `
counts = job.result().get_counts(circuit)
display_function(QCNN_total_states, counts, shots, num_states, magnitude, dims, image_mode)
  `;
}
const Zf = "from patoka.shors_utils import c_amodN, qft_dagger";
function $w(t, e, l, i) {
  return `
SHORS_COUNT_QUBITS = [${t.join(", ")}]
SHORS_ORACLE_QUBITS = [${e.join(", ")}]
SHORS_MOD = ${l}
SHORS_FACTOR = ${i}
`;
}
const qw = `
# 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 xf(t, e) {
  var $, j, I, A, M, z, H, B, R, P, O, F, L, X, V, Q, Z, ae, se, K, Y, W, J, ee, we, Re, ve, me, fe, G, ye, ue, le, oe, x, ge, re, Ie, je, _e, Ee, ie, Te, Ue, Ke, We, vt, qt, rt, mt, Rt, 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", _ = t.num_clbits === "auto", c = [], d = yl[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, g = !1, b, k = !1, y = [];
  if (t != null && t.operations) {
    let ut = 0;
    for (const Ce of t.operations)
      if (!Ce.deactive) {
        let ce = Et[Ce.operation_def];
        if ((ce == null ? void 0 : ce.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 Be = Ce.apply_to;
          if (o) {
            let Le = Ce.qubit_size || 5, Pe = c.length - 1;
            Be = [];
            for (let Je = 0; Je < Le; Je++)
              c.push(Pe + Je + 1), Be.push(Pe + Je + 1);
          }
          l.push(`qft_${ut} = QFT(${Be.length}).to_gate()`), l.push(`circuit.append(qft_${ut}, [${Be.join(", ")}])`), _ && y.push(...Be);
        } else if ((ce == null ? void 0 : ce.key) === "superposition") {
          l.push(""), l.push("# Superposition");
          let Be = Ce.apply_to;
          if (o) {
            let Le = c.length - 1;
            c.push(Le + 1), Be = [Le + 1];
          }
          Be.forEach((Le) => {
            l.push(`circuit.h(${Le})`);
          }), _ && y.push(...Be);
        } else if ((ce == null ? void 0 : ce.key) === "superposition_probbed") {
          l.push(""), l.push("# Superposition with probabilities"), i.includes("import numpy as np") || i.push("import numpy as np");
          let Be = Ce.apply_to;
          if (o) {
            let Le = c.length - 1;
            c.push(Le + 1), Be = [Le + 1];
          }
          Be.forEach((Le) => {
            var Pe;
            l.push(`circuit.rx(2 * np.arccos(np.sqrt(${(Pe = Ce.globals) == null ? void 0 : Pe.prob})), ${Le})`);
          }), _ && y.push(...Be);
        } else if ((ce == null ? void 0 : ce.key) === "entanglement") {
          l.push(""), l.push("# Entanglement");
          let Be = Ce.apply_to;
          if (o && !Ce.qubits_manual && !(($ = Ce.qubits_manual) != null && $.length)) {
            let Le = 2;
            if (c.length < Le) {
              let Pe = c.length - 1;
              Be = c.map((Je) => Je);
              for (let Je = Pe + 1; Je < Le; Je++)
                c.push(Je), Be.push(Je);
            } else
              Be = [c[0], c[1]];
          }
          l.push(`circuit.h(${Be[0]})`), l.push(`circuit.cx(${Be.join(", ")})`), _ && y.push(...Be);
        } else if ((ce == null ? void 0 : ce.key) === "group_entanglement") {
          l.push(""), l.push("# Grouped Entanglement");
          let Be = Ce.apply_to;
          if (o && !Ce.qubits_manual && !((j = Ce.qubits_manual) != null && j.length)) {
            let Le = Ce.qubit_size || 2;
            if (c.length < Le) {
              let Pe = c.length - 1;
              Be = c.map((Je) => Je);
              for (let Je = Pe + 1; Je < Le; Je++)
                c.push(1), Be.push(Je);
            } else
              Be = c;
          }
          if (((I = Ce == null ? void 0 : Ce.globals) == null ? void 0 : I.type) === "linear")
            Be.forEach((Le, Pe) => {
              Pe < Be.length - 1 && l.push(`circuit.cx(${Le}, ${Be[Pe + 1]})`);
            });
          else if (((A = Ce == null ? void 0 : Ce.globals) == null ? void 0 : A.type) === "full")
            for (let Le = 0; Le < Be.length - 1; Le++) {
              let Pe = Be[Le];
              for (let Je = Le + 1; Je < Be.length; Je++) {
                let Xe = Be[Je];
                l.push(`circuit.cx(${Pe}, ${Xe})`);
              }
            }
          else
            (((M = Ce == null ? void 0 : Ce.globals) == null ? void 0 : M.type) === "circular" || !((z = Ce == null ? void 0 : Ce.globals) != null && z.type)) && Be.forEach((Le, Pe) => {
              Pe < Be.length - 1 ? l.push(`circuit.cx(${Le}, ${Be[Pe + 1]})`) : l.push(`circuit.cx(${Le}, ${Be[0]})`);
            });
          _ && y.push(...Be);
        } else if ((ce == null ? void 0 : ce.key) === "interference") {
          l.push(""), l.push("# Interference");
          let Be = Ce.apply_to;
          if (o) {
            let Le = Ce.qubit_size || 1, Pe = c.length - 1;
            Be = [];
            for (let Je = 0; Je < Le; Je++)
              c.push(Pe + Je + 1), Be.push(Pe + Je + 1);
          }
          Be.forEach((Le, Pe) => {
            var Je;
            l.push(`circuit.rz(${Le},${((Je = Ce.params) == null ? void 0 : Je.theta) || 0})`);
          }), _ && y.push(...Be);
        } else if ((ce == null ? void 0 : ce.key) === "BTT") {
          l.push(""), i.push("from revkit import netlist, oracle_synth, truth_table"), i.push("import revkit.export.qiskit");
          let Be = Ce.apply_to;
          if (o && !Ce.qubits_manual && !((H = Ce.qubits_manual) != null && H.length)) {
            let Pe = ce.variables.n_symbols(Ce) + 1;
            if (c.length < Pe) {
              let Je = c.length - 1;
              Be = [];
              for (let Xe = Je + 1; Xe < Pe; Xe++)
                c.push(Xe), Be.push(Xe);
            } else
              Be = c.slice(0, Pe).map((Je) => Je);
          }
          (B = Ce == null ? void 0 : Ce.globals) != null && B.random_all && (l.push("# Superpose every qubit"), Ce.apply_to.forEach((Le, Pe) => {
            Pe < Ce.apply_to.length - 1 && l.push(`circuit.h(${Le})`);
          })), (R = Ce == null ? void 0 : Ce.globals) != null && R.boolean_expression && (l.push("# Boolean Truth Table Function Oracle"), l.push(`tt_bool_${ut} = revkit.truth_table.from_expression("${Ce.globals.boolean_expression}")`), l.push(`oracle_${ut} = revkit.oracle_synth(tt_bool_${ut})`), l.push(`oracle_gate_${ut} = oracle_${ut}.to_qiskit().to_gate()`), l.push(`circuit.append(oracle_gate_${ut}, [${Ce.apply_to.join(", ")}])`)), _ && y.push(...Be);
        } else if ((ce == null ? void 0 : ce.key) === "SHOR_period") {
          i.includes("import numpy as np") || i.push("import numpy as np"), i.includes(Zf) || i.push(Zf);
          let Be = (O = (P = Ce.qubit_registers) == null ? void 0 : P.oracle) == null ? void 0 : O.apply_to, Le = (L = (F = Ce.qubit_registers) == null ? void 0 : F.counter) == null ? void 0 : L.apply_to;
          if (o) {
            let Pe = ce.variables.oracle_size(Ce), Je = 6;
            if (!((V = (X = Ce.qubit_registers) == null ? void 0 : X.oracle) != null && V.qubits_manual) && !((ae = (Z = (Q = Ce.qubit_registers) == null ? void 0 : Q.oracle) == null ? void 0 : Z.qubits_manual) != null && ae.length))
              if (c.length < Pe) {
                let Xe = c.length - 1;
                Be = [];
                for (let He = Xe + 1; He < Pe; He++)
                  c.push(He), Be.push(He);
              } else
                Be = c.slice(0, Pe).map((Xe) => Xe);
            if (!((K = (se = Ce.qubit_registers) == null ? void 0 : se.counter) != null && K.qubits_manual) && !((J = (W = (Y = Ce.qubit_registers) == null ? void 0 : Y.counter) == null ? void 0 : W.qubits_manual) != null && J.length))
              if (c.length < Pe + Je) {
                let Xe = c.length - 1;
                Le = [];
                for (let He = Xe + 1; He < Pe + Je; He++)
                  c.push(He), Le.push(He);
              } else
                Be = c.slice(Pe, Pe + Je).map((Xe) => Xe);
          }
          if (l.push("# Shor's algorithm for finding a modular period"), ((ee = Ce.params) == null ? void 0 : ee.divider) !== void 0 && ((we = Ce.params) == null ? void 0 : we.factor) !== void 0) {
            let Pe = $w(
              Le || [],
              Be || [],
              (Re = Ce.params) == null ? void 0 : Re.divider,
              (ve = Ce.params) == null ? void 0 : ve.factor
            );
            l.push(Pe), l.push(qw);
          }
          _ && y.push(...Le);
        } else if ((ce == null ? void 0 : ce.key) === "BV") {
          let Be = (((fe = (me = Ce.qubit_registers) == null ? void 0 : me.string) == null ? void 0 : fe.apply_to) || []).toSorted((Xe, He) => Xe - He), Le = ((ye = (G = Ce.qubit_registers) == null ? void 0 : G.store) == null ? void 0 : ye.apply_to) || [], Pe = (ue = Ce.params) == null ? void 0 : ue.string;
          if (o) {
            let Xe = ce.variables.string_size(Ce), He = 1;
            if (!((oe = (le = Ce.qubit_registers) == null ? void 0 : le.string) != null && oe.qubits_manual) && !((re = (ge = (x = Ce.qubit_registers) == null ? void 0 : x.string) == null ? void 0 : ge.qubits_manual) != null && re.length))
              if (c.length < Xe) {
                let Ze = c.length - 1;
                Be = [];
                for (let _t = Ze + 1; _t < Xe; _t++)
                  c.push(_t), Be.push(_t);
              } else
                Be = c.slice(0, Xe).map((Ze) => Ze);
            if (!((je = (Ie = Ce.qubit_registers) == null ? void 0 : Ie.store) != null && je.qubits_manual) && !((ie = (Ee = (_e = Ce.qubit_registers) == null ? void 0 : _e.store) == null ? void 0 : Ee.qubits_manual) != null && ie.length))
              if (c.length < Xe + He) {
                let Ze = c.length - 1;
                Le = [];
                for (let _t = Ze + 1; _t < Xe + He; _t++)
                  c.push(_t), Le.push(_t);
              } else
                oracle_qubits = c.slice(Xe, Xe + He).map((Ze) => Ze);
          }
          l.push(`# Bernstein-Vazirani algorithm for finding hidden bits (bitstring: ${Pe})`), l.push(`for i in [${Be.join(", ")}]:`), l.push("    circuit.h(i)"), l.push(`circuit.x(${Le[0]})`), l.push(`circuit.h(${Le[0]})`);
          let Je = 0;
          if (Pe)
            for (const Xe in Be)
              Pe[Je] == "1" && l.push(`circuit.cx(${Xe}, ${Le[0]})`), Je++;
          l.push("circuit.barrier()"), l.push(`for i in [${Be.join(", ")}]:`), l.push("    circuit.h(i)"), l.push(`circuit.h(${Le[0]})`), _ && y.push(...Be);
        } else if ((ce == null ? void 0 : ce.key) === "qnn_input_angle") {
          l.push(""), l.push("# QNN Input Entry"), i.includes("import numpy as np") || i.push("import numpy as np");
          let Be = Ce.apply_to;
          if (o && !Ce.qubits_manual && !((Te = Ce.qubits_manual) != null && Te.length)) {
            let Pe = Ce.qubit_size || 1;
            if (c.length < Pe) {
              let Je = c.length - 1;
              Be = c.map((Xe) => Xe);
              for (let Xe = Je + 1; Xe < Pe; Xe++)
                c.push(1), Be.push(Xe);
            } else
              Be = c;
          }
          let Le = [];
          Be.forEach((Pe, Je) => {
            var Xe, He, Ze, _t;
            l.push(`circuit.h(${Pe})`), (Xe = Ce.params) != null && Xe["angle/" + Pe] && ((He = Ce.params) != null && He["angle_dir/" + Pe]) && (Le.push((Ze = Ce.params) == null ? void 0 : Ze["angle/" + Pe]), l.push(`circuit.${(_t = Ce.params) == null ? void 0 : _t["angle_dir/" + Pe]}(qnn_inputs[${Je}], ${Pe})`));
          }), r.push(`qnn_inputs = np.array([${Le.join(", ")}])`), _ && y.push(...Be);
        } else if ((ce == null ? void 0 : ce.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 Be = [];
          Ce.apply_to.forEach((Pe, Je) => {
            var Xe, He, Ze;
            (Xe = Ce.params) != null && Xe["angle/" + Pe] && ((He = Ce.params) != null && He["angle_dir/" + Pe]) && Be.push((Ze = Ce.params) == null ? void 0 : Ze["angle/" + Pe]);
          }), l.push(`qnn_weights = np.concatenate((qnn_weights, np.array([${Be.join(", ")}])))`), Ce.apply_to.forEach((Pe, Je) => {
            var Xe, He, Ze, _t;
            (Xe = Ce.params) != null && Xe["angle/" + Pe] && ((He = Ce.params) != null && He["angle_dir/" + Pe]) && (l.push(`circuit.${(Ze = Ce.params) == null ? void 0 : Ze["angle_dir/" + Pe]}(qnn_weights[${s}], ${Pe})`), Be.push((_t = Ce.params) == null ? void 0 : _t["angle/" + Pe]), s += 1);
          });
          let Le = Ce.apply_to;
          _ && y.push(...Le);
        } else if ((ce == null ? void 0 : ce.key) === "image_convolution_filters") {
          let Be = {
            avg: "avg_filter",
            sobel: "sobel_filter",
            blur: "laplacian_of_gaussian"
          }, Le = [
            "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 = Ce == null ? void 0 : Ce.globals) != null && Ue.filter ? `from patoka.image_convolution_utils import ${Be[(Ke = Ce == null ? void 0 : Ce.globals) == null ? void 0 : Ke.filter]} ` : "",
            "from qiskit.circuit.library import StatePreparation"
          ];
          for (const Je of Le)
            i.includes(Je) || i.push(Je);
          let Pe = yw(
            (We = Ce == null ? void 0 : Ce.globals) == null ? void 0 : We.image_file,
            (vt = Ce == null ? void 0 : Ce.globals) == null ? void 0 : vt.filter,
            (qt = Ce == null ? void 0 : Ce.globals) == null ? void 0 : qt.color_mode,
            (rt = Ce == null ? void 0 : Ce.globals) == null ? void 0 : rt.sigma
          );
          l.push(Pe), p = !0, g = !0, b = ww(), k = !0;
        }
        ut++;
      }
  }
  let v = 0;
  o ? v = Math.max(...c) + 1 : (t == null || t.qubits, v = t == null ? void 0 : t.num_qubits), y = Array.from(new Set(y)), y.sort();
  let w = 0, q = [];
  if (_ ? (q = y.map((ut, Ce) => Ce), w = Math.max(...q) + 1) : (q = t == null ? void 0 : t.clbits, w = t == null ? void 0 : t.num_qubits), p || l.splice(0, 0, `circuit = QuantumCircuit(${v || 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")
    ((mt = t == null ? void 0 : t.pauli_obs) == null ? void 0 : mt.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((ut) => '"' + ut.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 (!g && (t != null && t.measure_all))
      l.push(""), l.push("# Measure"), l.push(`circuit.measure([${t.qubits.join(", ")}], [${t.clbits.join(", ")}])`);
    else if (!g && (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((ut, Ce) => Ce).join(", ")}])`);
    else if (!g && (t != null && t.measure) && (t == null ? void 0 : t.measure.length) > 0) {
      l.push(""), l.push("# Measure");
      let ut = t.clbits.slice(0, t.measure.length);
      l.push(`circuit.measure([${t.measure.join(", ")}], [${ut.join(", ")}])`);
    } else
      !g && q.length > 0 && l.push(`circuit.measure([${y.join(", ")}], [${q.join(", ")}])`);
    d ? d.name === "Aer" ? (n.push("transpiled = transpile(circuit, aer_sim)"), k ? (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)"), k ? (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(""), b ? n.push(b) : (n.push("counts = job.result().get_counts()"), n.push("plot_histogram(counts)"));
  }
  if ((Rt = t.sharing) != null && Rt.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 ut = `circuit_qasm2_${(/* @__PURE__ */ new Date()).getTime()}.qasm`;
    l.push(`with open("${ut}", "w") as f:`), l.push("    f.write(circuit_qasm2)"), l.push(`# to load: run qasm3.load([path]/${ut}) 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 ut = `circuit_qasm3_${(/* @__PURE__ */ new Date()).getTime()}.qasm`;
    l.push(`with open("${ut}", "w") as f:`), l.push("    f.write(circuit_qasm3)"), l.push(`# to load: run qasm3.load([path]/${ut}) after setting the appropriate path`);
  }
  return i.join(`
`) + `

` + r.join(`
`) + `

` + l.join(`
`) + `

` + n.join(`
`) + `

` + a.join(`
`);
}
function e_(t, e, l) {
  const i = t.slice();
  return i[6] = e[l], i[8] = l, i;
}
function t_(t) {
  let e, l = (
    /*m*/
    t[6].name + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), n = N(), e.__value = /*m*/
      t[6].name, pt(e, e.__value), e.selected = a = /*m*/
      t[6].name === /*$data*/
      t[1].machine;
    },
    m(r, s) {
      S(r, e, s), f(e, i), f(e, n);
    },
    p(r, s) {
      s & /*$data*/
      2 && a !== (a = /*m*/
      r[6].name === /*$data*/
      r[1].machine) && (e.selected = a);
    },
    d(r) {
      r && C(e);
    }
  };
}
function jw(t) {
  let e;
  return {
    c() {
      e = E(`This
        machine cannot be used as a simulator.`);
    },
    m(l, i) {
      S(l, e, i);
    },
    d(l) {
      l && C(e);
    }
  };
}
function Tw(t) {
  let e;
  return {
    c() {
      e = E("This machine is only available as a simulator.");
    },
    m(l, i) {
      S(l, e, i);
    },
    d(l) {
      l && C(e);
    }
  };
}
function l_(t) {
  let e, l, i = yl[
    /*$data*/
    t[1].machine
  ].description + "", n;
  return {
    c() {
      e = m("span"), l = m("strong"), n = E(i), u(e, "class", "note svelte-r85cdz");
    },
    m(a, r) {
      S(a, e, r), f(e, l), f(l, n);
    },
    p(a, r) {
      r & /*$data*/
      2 && i !== (i = yl[
        /*$data*/
        a[1].machine
      ].description + "") && U(n, i);
    },
    d(a) {
      a && C(e);
    }
  };
}
function i_(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].machine_qubits + ""
  ), a, r, s, o = (
    /*$data*/
    t[1].num_qubits + ""
  ), _, 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, `), _ = E(o), c = E(" qubits are used."), u(e, "class", "warning svelte-r85cdz");
    },
    m(d, h) {
      S(d, e, h), f(e, l), f(l, i), f(l, a), f(l, r), f(e, s), f(e, _), f(e, c);
    },
    p(d, h) {
      h & /*$data*/
      2 && n !== (n = /*$data*/
      d[1].machine_qubits + "") && U(a, n), h & /*$data*/
      2 && o !== (o = /*$data*/
      d[1].num_qubits + "") && U(_, o);
    },
    d(d) {
      d && C(e);
    }
  };
}
function Cw(t) {
  var oe;
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R, P, O, F, L = (
    /*$data*/
    t[1].machine + ""
  ), X, V, Q, Z = (
    /*$data*/
    t[1].machine_qubits + ""
  ), ae, se, K, Y, W, J, ee, we, Re, ve = $e(Uf), me = [];
  for (let x = 0; x < ve.length; x += 1)
    me[x] = t_(e_(t, ve, x));
  function fe(x, ge) {
    if (
      /*$data*/
      x[1].no_machine
    )
      return Tw;
    if (
      /*$data*/
      x[1].no_sim
    )
      return jw;
  }
  let G = fe(t), ye = G && G(t), ue = ((oe = yl[
    /*$data*/
    t[1].machine
  ]) == null ? void 0 : oe.description) && l_(t), le = (
    /*$data*/
    t[1].num_qubits > /*$data*/
    t[1].machine_qubits && i_(t)
  );
  return {
    c() {
      e = m("article"), l = m("h4"), l.textContent = "1. What machine do you want? How many bits do you need?", i = N(), n = m("div"), a = m("div"), r = m("label"), r.textContent = "Machine", s = N(), o = m("select"), _ = m("option"), _.textContent = "-";
      for (let x = 0; x < me.length; x += 1)
        me[x].c();
      d = N(), h = m("div"), p = m("label"), p.textContent = "Simulator?", g = N(), b = m("div"), k = m("input"), w = N(), q = m("div"), $ = m("label"), $.textContent = "# Qubits", j = m("input"), A = N(), M = m("div"), z = m("label"), z.textContent = "# Classical bits", H = m("input"), R = N(), P = m("div"), O = m("span"), F = E("The chosen machine ("), X = E(L), V = E(`) supports upto
      `), Q = m("strong"), ae = E(Z), se = E(`
      qubits.
      `), ye && ye.c(), K = 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.`), Y = N(), 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.", J = N(), ue && ue.c(), ee = N(), le && le.c(), u(l, "class", "svelte-r85cdz"), u(r, "for", "machine"), u(r, "class", "svelte-r85cdz"), _.__value = "-", pt(_, _.__value), u(o, "id", "machine"), u(o, "name", "machine"), u(o, "class", "svelte-r85cdz"), u(a, "class", "input-form svelte-r85cdz"), u(p, "for", "machine-simulator"), u(p, "class", "svelte-r85cdz"), u(k, "type", "checkbox"), u(k, "id", "machine-simulator"), u(k, "name", "machine-simulator"), k.checked = y = /*$data*/
      t[1].is_simulator, k.disabled = v = /*$data*/
      t[1].sim_not_choosable, u(k, "class", "svelte-r85cdz"), u(b, "class", "checkbox-group solo svelte-r85cdz"), u(h, "class", "input-form svelte-r85cdz"), u($, "for", "num_qubits"), u($, "class", "svelte-r85cdz"), u(j, "type", "text"), u(j, "id", "num_qubits"), u(j, "name", "num_qubits"), j.value = I = /*$data*/
      t[1].num_qubits || "", u(j, "class", "svelte-r85cdz"), u(q, "class", "input-form svelte-r85cdz"), u(z, "for", "num_clbits"), u(z, "class", "svelte-r85cdz"), u(H, "type", "text"), u(H, "id", "num_clbits"), u(H, "name", "num_clbits"), H.value = B = /*$data*/
      t[1].num_clbits || "", u(H, "class", "svelte-r85cdz"), u(M, "class", "input-form svelte-r85cdz"), u(n, "class", "input-row svelte-r85cdz"), u(O, "class", "note svelte-r85cdz"), u(W, "class", "note svelte-r85cdz"), u(e, "class", "svelte-r85cdz");
    },
    m(x, ge) {
      S(x, e, ge), f(e, l), f(e, i), f(e, n), f(n, a), f(a, r), f(a, s), f(a, o), f(o, _);
      for (let re = 0; re < me.length; re += 1)
        me[re] && me[re].m(o, null);
      fl(
        o,
        /*$data*/
        t[1].machine
      ), f(n, d), f(n, h), f(h, p), f(h, g), f(h, b), f(b, k), f(n, w), f(n, q), f(q, $), f(q, j), f(n, A), f(n, M), f(M, z), f(M, H), f(e, R), f(e, P), f(P, O), f(O, F), f(O, X), f(O, V), f(O, Q), f(Q, ae), f(O, se), ye && ye.m(O, null), f(O, K), f(P, Y), f(P, W), f(P, J), ue && ue.m(P, null), f(e, ee), le && le.m(e, null), we || (Re = [
        te(
          o,
          "change",
          /*change_handler*/
          t[2]
        ),
        te(
          k,
          "change",
          /*change_handler_1*/
          t[3]
        ),
        te(
          j,
          "change",
          /*change_handler_2*/
          t[4]
        ),
        te(
          H,
          "change",
          /*change_handler_3*/
          t[5]
        )
      ], we = !0);
    },
    p(x, [ge]) {
      var re;
      if (ge & /*$data*/
      2) {
        ve = $e(Uf);
        let Ie;
        for (Ie = 0; Ie < ve.length; Ie += 1) {
          const je = e_(x, ve, Ie);
          me[Ie] ? me[Ie].p(je, ge) : (me[Ie] = t_(je), me[Ie].c(), me[Ie].m(o, null));
        }
        for (; Ie < me.length; Ie += 1)
          me[Ie].d(1);
        me.length = ve.length;
      }
      ge & /*$data*/
      2 && c !== (c = /*$data*/
      x[1].machine) && fl(
        o,
        /*$data*/
        x[1].machine
      ), ge & /*$data*/
      2 && y !== (y = /*$data*/
      x[1].is_simulator) && (k.checked = y), ge & /*$data*/
      2 && v !== (v = /*$data*/
      x[1].sim_not_choosable) && (k.disabled = v), ge & /*$data*/
      2 && I !== (I = /*$data*/
      x[1].num_qubits || "") && j.value !== I && (j.value = I), ge & /*$data*/
      2 && B !== (B = /*$data*/
      x[1].num_clbits || "") && H.value !== B && (H.value = B), ge & /*$data*/
      2 && L !== (L = /*$data*/
      x[1].machine + "") && U(X, L), ge & /*$data*/
      2 && Z !== (Z = /*$data*/
      x[1].machine_qubits + "") && U(ae, Z), G !== (G = fe(x)) && (ye && ye.d(1), ye = G && G(x), ye && (ye.c(), ye.m(O, K))), (re = yl[
        /*$data*/
        x[1].machine
      ]) != null && re.description ? ue ? ue.p(x, ge) : (ue = l_(x), ue.c(), ue.m(P, null)) : ue && (ue.d(1), ue = null), /*$data*/
      x[1].num_qubits > /*$data*/
      x[1].machine_qubits ? le ? le.p(x, ge) : (le = i_(x), le.c(), le.m(e, null)) : le && (le.d(1), le = null);
    },
    i: ne,
    o: ne,
    d(x) {
      x && C(e), Ye(me, x), ye && ye.d(), ue && ue.d(), le && le.d(), we = !1, wt(Re);
    }
  };
}
function Sw(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(r, (d) => l(1, i = d)), r);
  t.$$.on_destroy.push(() => n());
  let { data: r = Oe({}) } = 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));
  }, _ = (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, g) => g)), 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, g) => g)), h));
  };
  return t.$$set = (d) => {
    "data" in d && a(l(0, r = d.data));
  }, [
    r,
    i,
    s,
    o,
    _,
    c
  ];
}
class Mw extends Ve {
  constructor(e) {
    super(), Qe(this, e, Sw, Cw, Fe, { data: 0 });
  }
}
function zw(t) {
  let e, l, i, n, a, r;
  return {
    c() {
      e = m("div"), l = m("button"), i = E(
        /*label*/
        t[1]
      ), u(l, "class", n = Yt(
        /*checked*/
        t[2] ? "checked" : "unchecked"
      ) + " svelte-1eeukdp"), l.disabled = /*deactive*/
      t[3], u(
        l,
        "id",
        /*id*/
        t[0]
      ), u(e, "class", "checkbox-item svelte-1eeukdp");
    },
    m(s, o) {
      S(s, e, o), f(e, l), f(l, i), a || (r = te(
        l,
        "click",
        /*click_handler*/
        t[5]
      ), a = !0);
    },
    p(s, [o]) {
      o & /*label*/
      2 && U(
        i,
        /*label*/
        s[1]
      ), o & /*checked*/
      4 && n !== (n = Yt(
        /*checked*/
        s[2] ? "checked" : "unchecked"
      ) + " svelte-1eeukdp") && u(l, "class", n), o & /*deactive*/
      8 && (l.disabled = /*deactive*/
      s[3]), o & /*id*/
      1 && u(
        l,
        "id",
        /*id*/
        s[0]
      );
    },
    i: ne,
    o: ne,
    d(s) {
      s && C(e), a = !1, r();
    }
  };
}
function Nw(t, e, l) {
  let { id: i = "", label: n = "", checked: a = !1, deactive: r = !1, oncheck: s = () => {
  } } = e;
  const o = (_) => s(!a);
  return t.$$set = (_) => {
    "id" in _ && l(0, i = _.id), "label" in _ && l(1, n = _.label), "checked" in _ && l(2, a = _.checked), "deactive" in _ && l(3, r = _.deactive), "oncheck" in _ && l(4, s = _.oncheck);
  }, [i, n, a, r, s, o];
}
class Nl extends Ve {
  constructor(e) {
    super(), Qe(this, e, Nw, zw, Fe, {
      id: 0,
      label: 1,
      checked: 2,
      deactive: 3,
      oncheck: 4
    });
  }
}
function n_(t, e, l) {
  const i = t.slice();
  return i[9] = e[l], i[11] = l, i;
}
function Aw(t) {
  let e, l, i = (
    /*param*/
    t[0].name + ""
  ), n, a, r = (
    /*param*/
    t[0].type + ""
  ), s, o, _, c, d, h, p, g, b, k, y, v, w, q = $e(
    /*param*/
    t[0].option
  ), $ = [];
  for (let j = 0; j < q.length; j += 1)
    $[j] = a_(n_(t, q, j));
  return {
    c() {
      var j, I;
      e = m("div"), l = m("label"), n = E(i), a = E(" ("), s = E(r), o = E(")"), c = N(), d = m("select"), h = m("option"), p = E("-");
      for (let A = 0; A < $.length; A += 1)
        $[A].c();
      u(l, "for", _ = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), u(l, "class", "svelte-7uzics"), h.__value = "null", pt(h, h.__value), h.selected = g = !/*$data*/
      ((I = (j = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : j.params) != null && I[
        /*param*/
        t[0].key
      ]), u(d, "name", b = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), u(d, "id", k = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), u(d, "class", "svelte-7uzics"), u(e, "class", "input-form svelte-7uzics");
    },
    m(j, I) {
      var A, M;
      S(j, e, I), f(e, l), f(l, n), f(l, a), f(l, s), f(l, o), f(e, c), f(e, d), f(d, h), f(h, p);
      for (let z = 0; z < $.length; z += 1)
        $[z] && $[z].m(d, null);
      fl(
        d,
        /*$data*/
        ((M = (A = t[4].operations[
          /*oi*/
          t[2]
        ]) == null ? void 0 : A.params) == null ? void 0 : M[
          /*param*/
          t[0].key
        ]) || ""
      ), v || (w = te(
        d,
        "change",
        /*change_handler_3*/
        t[8]
      ), v = !0);
    },
    p(j, I) {
      var A, M, z, H, B, R;
      if (I & /*param*/
      1 && i !== (i = /*param*/
      j[0].name + "") && U(n, i), I & /*param*/
      1 && r !== (r = /*param*/
      j[0].type + "") && U(s, r), I & /*param, oi, pi*/
      13 && _ !== (_ = `param-${/*param*/
      j[0].key}-${/*oi*/
      j[2]}-${/*pi*/
      j[3]}`) && u(l, "for", _), I & /*$data, oi, param*/
      21 && g !== (g = !/*$data*/
      ((M = (A = j[4].operations[
        /*oi*/
        j[2]
      ]) == null ? void 0 : A.params) != null && M[
        /*param*/
        j[0].key
      ])) && (h.selected = g), I & /*param, $data, oi*/
      21) {
        q = $e(
          /*param*/
          j[0].option
        );
        let P;
        for (P = 0; P < q.length; P += 1) {
          const O = n_(j, q, P);
          $[P] ? $[P].p(O, I) : ($[P] = a_(O), $[P].c(), $[P].m(d, null));
        }
        for (; P < $.length; P += 1)
          $[P].d(1);
        $.length = q.length;
      }
      I & /*param, oi, pi*/
      13 && b !== (b = `param-${/*param*/
      j[0].key}-${/*oi*/
      j[2]}-${/*pi*/
      j[3]}`) && u(d, "name", b), I & /*param, oi, pi*/
      13 && k !== (k = `param-${/*param*/
      j[0].key}-${/*oi*/
      j[2]}-${/*pi*/
      j[3]}`) && u(d, "id", k), I & /*$data, oi, param*/
      21 && y !== (y = /*$data*/
      ((H = (z = j[4].operations[
        /*oi*/
        j[2]
      ]) == null ? void 0 : z.params) == null ? void 0 : H[
        /*param*/
        j[0].key
      ]) || "") && fl(
        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 && C(e), Ye($, j), v = !1, w();
    }
  };
}
function Bw(t) {
  let e, l, i = (
    /*param*/
    t[0].name + ""
  ), n, a, r = (
    /*param*/
    t[0].type + ""
  ), s, o, _, c, d, h, p, g, b, k;
  return {
    c() {
      var y, v;
      e = m("div"), l = m("label"), n = E(i), a = E(" ("), s = E(r), o = E(")"), c = N(), d = m("input"), u(l, "for", _ = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), u(l, "class", "svelte-7uzics"), u(d, "type", "text"), u(d, "name", h = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), u(d, "id", p = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), d.value = g = /*$data*/
      ((v = (y = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : y.params) == null ? void 0 : v[
        /*param*/
        t[0].key
      ]) || "", u(d, "class", "svelte-7uzics"), u(e, "class", "input-form svelte-7uzics");
    },
    m(y, v) {
      S(y, e, v), f(e, l), f(l, n), f(l, a), f(l, s), f(l, o), f(e, c), f(e, d), b || (k = te(
        d,
        "change",
        /*change_handler_2*/
        t[7]
      ), b = !0);
    },
    p(y, v) {
      var w, q;
      v & /*param*/
      1 && i !== (i = /*param*/
      y[0].name + "") && U(n, i), v & /*param*/
      1 && r !== (r = /*param*/
      y[0].type + "") && U(s, r), v & /*param, oi, pi*/
      13 && _ !== (_ = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && u(l, "for", _), v & /*param, oi, pi*/
      13 && h !== (h = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && u(d, "name", h), v & /*param, oi, pi*/
      13 && p !== (p = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && u(d, "id", p), v & /*$data, oi, param*/
      21 && g !== (g = /*$data*/
      ((q = (w = y[4].operations[
        /*oi*/
        y[2]
      ]) == null ? void 0 : w.params) == null ? void 0 : q[
        /*param*/
        y[0].key
      ]) || "") && d.value !== g && (d.value = g);
    },
    d(y) {
      y && C(e), b = !1, k();
    }
  };
}
function Pw(t) {
  let e, l, i = (
    /*param*/
    t[0].name + ""
  ), n, a, r = (
    /*param*/
    t[0].type + ""
  ), s, o, _, c, d, h, p, g, b, k;
  return {
    c() {
      var y, v;
      e = m("div"), l = m("label"), n = E(i), a = E(" ("), s = E(r), o = E(")"), c = N(), d = m("input"), u(l, "for", _ = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), u(l, "class", "svelte-7uzics"), u(d, "type", "number"), u(d, "name", h = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), u(d, "id", p = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), d.value = g = /*$data*/
      ((v = (y = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : y.params) == null ? void 0 : v[
        /*param*/
        t[0].key
      ]) || "", u(d, "class", "svelte-7uzics"), u(e, "class", "input-form svelte-7uzics");
    },
    m(y, v) {
      S(y, e, v), f(e, l), f(l, n), f(l, a), f(l, s), f(l, o), f(e, c), f(e, d), b || (k = te(
        d,
        "change",
        /*change_handler_1*/
        t[6]
      ), b = !0);
    },
    p(y, v) {
      var w, q;
      v & /*param*/
      1 && i !== (i = /*param*/
      y[0].name + "") && U(n, i), v & /*param*/
      1 && r !== (r = /*param*/
      y[0].type + "") && U(s, r), v & /*param, oi, pi*/
      13 && _ !== (_ = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && u(l, "for", _), v & /*param, oi, pi*/
      13 && h !== (h = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && u(d, "name", h), v & /*param, oi, pi*/
      13 && p !== (p = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && u(d, "id", p), v & /*$data, oi, param*/
      21 && g !== (g = /*$data*/
      ((q = (w = y[4].operations[
        /*oi*/
        y[2]
      ]) == null ? void 0 : w.params) == null ? void 0 : q[
        /*param*/
        y[0].key
      ]) || "") && d.value !== g && (d.value = g);
    },
    d(y) {
      y && C(e), b = !1, k();
    }
  };
}
function Ow(t) {
  let e, l, i = (
    /*param*/
    t[0].name + ""
  ), n, a, r = (
    /*param*/
    t[0].type + ""
  ), s, o, _, c, d, h, p, g, b, k;
  return {
    c() {
      var y, v;
      e = m("div"), l = m("label"), n = E(i), a = E(" ("), s = E(r), o = E(")"), c = N(), d = m("input"), u(l, "for", _ = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), u(l, "class", "svelte-7uzics"), u(d, "type", "text"), u(d, "name", h = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), u(d, "id", p = `param-${/*param*/
      t[0].key}-${/*oi*/
      t[2]}-${/*pi*/
      t[3]}`), u(d, "match", "^[0-9]+[\\.\\/][0-9]+$"), d.value = g = /*$data*/
      ((v = (y = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : y.params) == null ? void 0 : v[
        /*param*/
        t[0].key
      ]) || "", u(d, "class", "svelte-7uzics"), u(e, "class", "input-form svelte-7uzics");
    },
    m(y, v) {
      S(y, e, v), f(e, l), f(l, n), f(l, a), f(l, s), f(l, o), f(e, c), f(e, d), b || (k = te(
        d,
        "change",
        /*change_handler*/
        t[5]
      ), b = !0);
    },
    p(y, v) {
      var w, q;
      v & /*param*/
      1 && i !== (i = /*param*/
      y[0].name + "") && U(n, i), v & /*param*/
      1 && r !== (r = /*param*/
      y[0].type + "") && U(s, r), v & /*param, oi, pi*/
      13 && _ !== (_ = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && u(l, "for", _), v & /*param, oi, pi*/
      13 && h !== (h = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && u(d, "name", h), v & /*param, oi, pi*/
      13 && p !== (p = `param-${/*param*/
      y[0].key}-${/*oi*/
      y[2]}-${/*pi*/
      y[3]}`) && u(d, "id", p), v & /*$data, oi, param*/
      21 && g !== (g = /*$data*/
      ((q = (w = y[4].operations[
        /*oi*/
        y[2]
      ]) == null ? void 0 : w.params) == null ? void 0 : q[
        /*param*/
        y[0].key
      ]) || "") && d.value !== g && (d.value = g);
    },
    d(y) {
      y && C(e), b = !1, k();
    }
  };
}
function a_(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, pt(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) {
      S(r, e, s), f(e, i);
    },
    p(r, s) {
      var o, _;
      s & /*param*/
      1 && l !== (l = /*opt*/
      r[9].name + "") && U(i, l), s & /*param*/
      1 && n !== (n = /*opt*/
      r[9].key) && (e.__value = n, pt(e, e.__value)), s & /*$data, oi, param*/
      21 && a !== (a = /*$data*/
      (((_ = (o = r[4].operations[
        /*oi*/
        r[2]
      ]) == null ? void 0 : o.params) == null ? void 0 : _[
        /*param*/
        r[0].key
      ]) || "") === /*opt*/
      r[9].key) && (e.selected = a);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Ew(t) {
  let e;
  function l(a, r) {
    if (
      /*param*/
      a[0].type === "radian"
    )
      return Ow;
    if (
      /*param*/
      a[0].type === "number"
    )
      return Pw;
    if (
      /*param*/
      a[0].type === "string"
    )
      return Bw;
    if (
      /*param*/
      a[0].type === "select"
    )
      return Aw;
  }
  let i = l(t), n = i && i(t);
  return {
    c() {
      n && n.c(), e = Ae();
    },
    m(a, r) {
      n && n.m(a, r), S(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: ne,
    o: ne,
    d(a) {
      a && C(e), n && n.d(a);
    }
  };
}
function Iw(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(s, (g) => l(4, i = g)), s);
  t.$$.on_destroy.push(() => n());
  let { param: r = {}, data: s = Oe(), oi: o, pi: _ } = e;
  a();
  const c = (g) => {
    s.update((b) => (b.operations[o].params || (b.operations[o].params = {}), b.operations[o].params[r.key] = g.target.value, b));
  }, d = (g) => {
    s.update((b) => (b.operations[o].params || (b.operations[o].params = {}), b.operations[o].params[r.key] = parseFloat(g.target.value), b));
  }, h = (g) => {
    s.update((b) => (b.operations[o].params || (b.operations[o].params = {}), b.operations[o].params[r.key] = g.target.value, b));
  }, p = (g) => {
    s.update((b) => (b.operations[o].params || (b.operations[o].params = {}), g.target.value === "null" ? delete b.operations[o].params[r.key] : b.operations[o].params[r.key] = g.target.value, b));
  };
  return t.$$set = (g) => {
    "param" in g && l(0, r = g.param), "data" in g && a(l(1, s = g.data)), "oi" in g && l(2, o = g.oi), "pi" in g && l(3, _ = g.pi);
  }, [
    r,
    s,
    o,
    _,
    i,
    c,
    d,
    h,
    p
  ];
}
class i0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, Iw, Ew, Fe, { param: 0, data: 1, oi: 2, pi: 3 });
  }
}
function r_(t, e, l) {
  const i = t.slice();
  return i[10] = e[l], i[12] = l, i;
}
function Dw(t) {
  let e, l, i, n, a, r, s, o, _, c = $e(
    /*glb*/
    t[0].option
  ), d = [];
  for (let h = 0; h < c.length; h += 1)
    d[h] = s_(r_(t, c, h));
  return {
    c() {
      var h, p;
      e = m("select"), l = m("option"), i = E("-");
      for (let g = 0; g < d.length; g += 1)
        d[g].c();
      l.__value = "null", pt(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
      ]), u(e, "name", a = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), u(e, "id", r = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), u(e, "class", "svelte-7uzics");
    },
    m(h, p) {
      var g, b;
      S(h, e, p), f(e, l), f(l, i);
      for (let k = 0; k < d.length; k += 1)
        d[k] && d[k].m(e, null);
      fl(
        e,
        /*$data*/
        ((b = (g = t[4].operations[
          /*oi*/
          t[2]
        ]) == null ? void 0 : g.globals) == null ? void 0 : b[
          /*glb*/
          t[0].key
        ]) || ""
      ), o || (_ = te(
        e,
        "change",
        /*change_handler_4*/
        t[9]
      ), o = !0);
    },
    p(h, p) {
      var g, b, k, y, v, w;
      if (p & /*$data, oi, glb*/
      21 && n !== (n = !/*$data*/
      ((b = (g = h[4].operations[
        /*oi*/
        h[2]
      ]) == null ? void 0 : g.globals) != null && b[
        /*glb*/
        h[0].key
      ])) && (l.selected = n), p & /*glb, $data, oi*/
      21) {
        c = $e(
          /*glb*/
          h[0].option
        );
        let q;
        for (q = 0; q < c.length; q += 1) {
          const $ = r_(h, c, q);
          d[q] ? d[q].p($, p) : (d[q] = s_($), d[q].c(), d[q].m(e, null));
        }
        for (; q < d.length; q += 1)
          d[q].d(1);
        d.length = c.length;
      }
      p & /*oi, gi, glb*/
      13 && a !== (a = `global-${/*oi*/
      h[2]}-${/*gi*/
      h[3]}`) && u(e, "name", a), p & /*oi, gi, glb*/
      13 && r !== (r = `global-${/*oi*/
      h[2]}-${/*gi*/
      h[3]}`) && u(e, "id", r), p & /*$data, oi, glb*/
      21 && s !== (s = /*$data*/
      ((y = (k = h[4].operations[
        /*oi*/
        h[2]
      ]) == null ? void 0 : k.globals) == null ? void 0 : y[
        /*glb*/
        h[0].key
      ]) || "") && fl(
        e,
        /*$data*/
        ((w = (v = h[4].operations[
          /*oi*/
          h[2]
        ]) == null ? void 0 : v.globals) == null ? void 0 : w[
          /*glb*/
          h[0].key
        ]) || ""
      );
    },
    d(h) {
      h && C(e), Ye(d, h), o = !1, _();
    }
  };
}
function Rw(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      var o, _;
      e = m("div"), l = m("input"), u(l, "type", "checkbox"), u(l, "name", i = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), u(l, "id", n = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), l.checked = a = /*$data*/
      (_ = (o = t[4].operations[
        /*oi*/
        t[2]
      ]) == null ? void 0 : o.globals) == null ? void 0 : _[
        /*glb*/
        t[0].key
      ], u(l, "class", "svelte-7uzics"), u(e, "class", "checkbox-group solo svelte-7uzics");
    },
    m(o, _) {
      S(o, e, _), f(e, l), r || (s = te(
        l,
        "change",
        /*change_handler_3*/
        t[8]
      ), r = !0);
    },
    p(o, _) {
      var c, d;
      _ & /*oi, gi, glb*/
      13 && i !== (i = `global-${/*oi*/
      o[2]}-${/*gi*/
      o[3]}`) && u(l, "name", i), _ & /*oi, gi, glb*/
      13 && n !== (n = `global-${/*oi*/
      o[2]}-${/*gi*/
      o[3]}`) && u(l, "id", n), _ & /*$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 && C(e), r = !1, s();
    }
  };
}
function Hw(t) {
  let e, l, i, n, a, r;
  return {
    c() {
      var s, o;
      e = m("input"), At(e, "width", "300px"), u(e, "type", "text"), u(e, "name", l = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), u(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
      ]) || "", u(e, "class", "svelte-7uzics");
    },
    m(s, o) {
      S(s, e, o), a || (r = te(
        e,
        "change",
        /*change_handler_2*/
        t[7]
      ), a = !0);
    },
    p(s, o) {
      var _, c;
      o & /*oi, gi, glb*/
      13 && l !== (l = `global-${/*oi*/
      s[2]}-${/*gi*/
      s[3]}`) && u(e, "name", l), o & /*oi, gi, glb*/
      13 && i !== (i = `global-${/*oi*/
      s[2]}-${/*gi*/
      s[3]}`) && u(e, "id", i), o & /*$data, oi, glb*/
      21 && n !== (n = /*$data*/
      ((c = (_ = s[4].operations[
        /*oi*/
        s[2]
      ]) == null ? void 0 : _.globals) == null ? void 0 : c[
        /*glb*/
        s[0].key
      ]) || "") && e.value !== n && (e.value = n);
    },
    d(s) {
      s && C(e), a = !1, r();
    }
  };
}
function Lw(t) {
  let e, l, i, n, a, r;
  return {
    c() {
      var s, o;
      e = m("input"), At(e, "width", "300px"), u(e, "type", "number"), u(e, "name", l = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), u(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
      ]) || "", u(e, "class", "svelte-7uzics");
    },
    m(s, o) {
      S(s, e, o), a || (r = te(
        e,
        "change",
        /*change_handler_1*/
        t[6]
      ), a = !0);
    },
    p(s, o) {
      var _, c;
      o & /*oi, gi, glb*/
      13 && l !== (l = `global-${/*oi*/
      s[2]}-${/*gi*/
      s[3]}`) && u(e, "name", l), o & /*oi, gi, glb*/
      13 && i !== (i = `global-${/*oi*/
      s[2]}-${/*gi*/
      s[3]}`) && u(e, "id", i), o & /*$data, oi, glb*/
      21 && n !== (n = /*$data*/
      ((c = (_ = s[4].operations[
        /*oi*/
        s[2]
      ]) == null ? void 0 : _.globals) == null ? void 0 : c[
        /*glb*/
        s[0].key
      ]) || "") && e.value !== n && (e.value = n);
    },
    d(s) {
      s && C(e), a = !1, r();
    }
  };
}
function Fw(t) {
  let e, l, i, n, a, r;
  return {
    c() {
      var s, o;
      e = m("input"), At(e, "width", "300px"), u(e, "type", "text"), u(e, "name", l = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), u(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
      ]) || "", u(e, "class", "svelte-7uzics");
    },
    m(s, o) {
      S(s, e, o), a || (r = te(
        e,
        "change",
        /*change_handler*/
        t[5]
      ), a = !0);
    },
    p(s, o) {
      var _, c;
      o & /*oi, gi, glb*/
      13 && l !== (l = `global-${/*oi*/
      s[2]}-${/*gi*/
      s[3]}`) && u(e, "name", l), o & /*oi, gi, glb*/
      13 && i !== (i = `global-${/*oi*/
      s[2]}-${/*gi*/
      s[3]}`) && u(e, "id", i), o & /*$data, oi, glb*/
      21 && n !== (n = /*$data*/
      ((c = (_ = s[4].operations[
        /*oi*/
        s[2]
      ]) == null ? void 0 : _.globals) == null ? void 0 : c[
        /*glb*/
        s[0].key
      ]) || "") && e.value !== n && (e.value = n);
    },
    d(s) {
      s && C(e), a = !1, r();
    }
  };
}
function s_(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, pt(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) {
      S(r, e, s), f(e, i);
    },
    p(r, s) {
      var o, _;
      s & /*glb*/
      1 && l !== (l = /*opt*/
      r[10].name + "") && U(i, l), s & /*glb*/
      1 && n !== (n = /*opt*/
      r[10].key) && (e.__value = n, pt(e, e.__value)), s & /*$data, oi, glb*/
      21 && a !== (a = /*$data*/
      (((_ = (o = r[4].operations[
        /*oi*/
        r[2]
      ]) == null ? void 0 : o.globals) == null ? void 0 : _[
        /*glb*/
        r[0].key
      ]) || "") === /*opt*/
      r[10].key) && (e.selected = a);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Qw(t) {
  let e, l, i = (
    /*glb*/
    t[0].name + ""
  ), n, a, r;
  function s(c, d) {
    if (
      /*glb*/
      c[0].type === "bool_exp"
    )
      return Fw;
    if (
      /*glb*/
      c[0].type === "number"
    )
      return Lw;
    if (
      /*glb*/
      c[0].type === "string"
    )
      return Hw;
    if (
      /*glb*/
      c[0].type === "boolean"
    )
      return Rw;
    if (
      /*glb*/
      c[0].type === "select"
    )
      return Dw;
  }
  let o = s(t), _ = o && o(t);
  return {
    c() {
      e = m("div"), l = m("label"), n = E(i), r = N(), _ && _.c(), u(l, "for", a = `global-${/*oi*/
      t[2]}-${/*gi*/
      t[3]}`), u(l, "class", "svelte-7uzics"), u(e, "class", "input-form svelte-7uzics");
    },
    m(c, d) {
      S(c, e, d), f(e, l), f(l, n), f(e, r), _ && _.m(e, null);
    },
    p(c, [d]) {
      d & /*glb*/
      1 && i !== (i = /*glb*/
      c[0].name + "") && U(n, i), d & /*oi, gi, glb*/
      13 && a !== (a = `global-${/*oi*/
      c[2]}-${/*gi*/
      c[3]}`) && u(l, "for", a), o === (o = s(c)) && _ ? _.p(c, d) : (_ && _.d(1), _ = o && o(c), _ && (_.c(), _.m(e, null)));
    },
    i: ne,
    o: ne,
    d(c) {
      c && C(e), _ && _.d();
    }
  };
}
function Vw(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(s, (b) => l(4, i = b)), s);
  t.$$.on_destroy.push(() => n());
  let { glb: r = {}, data: s = Oe(), oi: o, gi: _ } = e;
  a();
  const c = (b) => {
    s.update((k) => (k.operations[o].globals || (k.operations[o].globals = {}), k.operations[o].globals[r.key] = b.target.value, k));
  }, d = (b) => {
    s.update((k) => (k.operations[o].globals || (k.operations[o].globals = {}), k.operations[o].globals[r.key] = b.target.value, k));
  }, h = (b) => {
    s.update((k) => (k.operations[o].globals || (k.operations[o].globals = {}), k.operations[o].globals[r.key] = b.target.value, k));
  }, p = (b) => {
    s.update((k) => (k.operations[o].globals || (k.operations[o].globals = {}), k.operations[o].globals[r.key] = b.target.checked, k));
  }, g = (b) => {
    s.update((k) => (k.operations[o].globals || (k.operations[o].globals = {}), b.target.value === "null" ? delete k.operations[o].globals[r.key] : k.operations[o].globals[r.key] = b.target.value, k));
  };
  return t.$$set = (b) => {
    "glb" in b && l(0, r = b.glb), "data" in b && a(l(1, s = b.data)), "oi" in b && l(2, o = b.oi), "gi" in b && l(3, _ = b.gi);
  }, [
    r,
    s,
    o,
    _,
    i,
    c,
    d,
    h,
    p,
    g
  ];
}
class Xw extends Ve {
  constructor(e) {
    super(), Qe(this, e, Vw, Qw, Fe, { glb: 0, data: 1, oi: 2, gi: 3 });
  }
}
function o_(t, e, l) {
  const i = t.slice();
  return i[19] = e[l], i[21] = l, i;
}
function u_(t, e, l) {
  const i = t.slice();
  return i[22] = e[l], i[24] = l, i;
}
function f_(t, e, l) {
  const i = t.slice();
  return i[25] = e[l], i[27] = l, i;
}
function __(t, e, l) {
  const i = t.slice();
  return i[28] = e[l], i[30] = l, i;
}
function c_(t, e, l) {
  const i = t.slice();
  return i[31] = e[l], i[33] = l, i;
}
function d_(t, e, l) {
  const i = t.slice();
  return i[31] = e[l], i[33] = l, i;
}
function h_(t, e, l) {
  const i = t.slice();
  return i[38] = e[l], i;
}
function p_(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 g_(t, e, l) {
  const i = t.slice();
  return i[38] = e[l], i;
}
function b_(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", u(e, "class", "svelte-1tjl940");
    },
    m(a, r) {
      S(a, e, r), l || (i = te(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && C(e), l = !1, i();
    }
  };
}
function k_(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", u(e, "class", "svelte-1tjl940");
    },
    m(a, r) {
      S(a, e, r), l || (i = te(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && C(e), l = !1, i();
    }
  };
}
function Gw(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", u(e, "class", "svelte-1tjl940");
    },
    m(a, r) {
      S(a, e, r), l || (i = te(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && C(e), l = !1, i();
    }
  };
}
function v_(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", u(e, "class", "svelte-1tjl940");
    },
    m(a, r) {
      S(a, e, r), l || (i = te(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && C(e), l = !1, i();
    }
  };
}
function y_(t) {
  let e, l = (
    /*item*/
    t[38].name + ""
  ), i, n;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = /*item*/
      t[38].key, pt(e, e.__value), e.selected = n = /*item*/
      t[38].key === /*op*/
      t[19].operation_def, u(e, "class", "svelte-1tjl940");
    },
    m(a, r) {
      S(a, e, r), f(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 && C(e);
    }
  };
}
function Yw(t) {
  let e, l, i, n, a, r, s, o;
  function _(...g) {
    return (
      /*func_3*/
      t[15](
        /*oi*/
        t[21],
        ...g
      )
    );
  }
  a = new Nl({
    props: {
      id: `op-${/*oi*/
      t[21]}-qubit-reset`,
      checked: !1,
      oncheck: _,
      label: "Reset"
    }
  });
  let c = (
    /*$data*/
    t[1].num_qubits && w_(t)
  ), d = $e(
    /*$data*/
    t[1].qubits || []
  ), h = [];
  for (let g = 0; g < d.length; g += 1)
    h[g] = $_(h_(t, d, g));
  const p = (g) => D(h[g], 1, 1, () => {
    h[g] = null;
  });
  return {
    c() {
      e = m("div"), l = m("label"), l.textContent = "Qubits to apply", i = N(), n = m("div"), pe(a.$$.fragment), r = N(), c && c.c(), s = N();
      for (let g = 0; g < h.length; g += 1)
        h[g].c();
      u(l, "class", "svelte-1tjl940"), u(n, "class", "checkbox-group svelte-1tjl940"), u(e, "class", "input-form svelte-1tjl940");
    },
    m(g, b) {
      S(g, e, b), f(e, l), f(e, i), f(e, n), de(a, n, null), f(n, r), c && c.m(n, null), f(n, s);
      for (let k = 0; k < h.length; k += 1)
        h[k] && h[k].m(n, null);
      o = !0;
    },
    p(g, b) {
      t = g;
      const k = {};
      if (b[0] & /*data*/
      1 && (k.oncheck = _), a.$set(k), /*$data*/
      t[1].num_qubits ? c ? (c.p(t, b), b[0] & /*$data*/
      2 && T(c, 1)) : (c = w_(t), c.c(), T(c, 1), c.m(n, s)) : c && (be(), D(c, 1, 1, () => {
        c = null;
      }), ke()), b[0] & /*$data, data*/
      3) {
        d = $e(
          /*$data*/
          t[1].qubits || []
        );
        let y;
        for (y = 0; y < d.length; y += 1) {
          const v = h_(t, d, y);
          h[y] ? (h[y].p(v, b), T(h[y], 1)) : (h[y] = $_(v), h[y].c(), T(h[y], 1), h[y].m(n, null));
        }
        for (be(), y = d.length; y < h.length; y += 1)
          p(y);
        ke();
      }
    },
    i(g) {
      if (!o) {
        T(a.$$.fragment, g), T(c);
        for (let b = 0; b < d.length; b += 1)
          T(h[b]);
        o = !0;
      }
    },
    o(g) {
      D(a.$$.fragment, g), D(c), h = h.filter(Boolean);
      for (let b = 0; b < h.length; b += 1)
        D(h[b]);
      o = !1;
    },
    d(g) {
      g && C(e), he(a), c && c.d(), Ye(h, g);
    }
  };
}
function Kw(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p;
  function g(...k) {
    return (
      /*change_handler_3*/
      t[13](
        /*oi*/
        t[21],
        ...k
      )
    );
  }
  function b(...k) {
    return (
      /*change_handler_4*/
      t[14](
        /*oi*/
        t[21],
        ...k
      )
    );
  }
  return {
    c() {
      e = m("div"), l = m("label"), l.textContent = "Qubits to apply", i = N(), n = m("input"), r = N(), s = m("div"), o = m("label"), o.textContent = "Qubits", _ = N(), c = m("input"), u(l, "for", `op-${/*oi*/
      t[21]}-qubit-num_qubits`), u(l, "class", "svelte-1tjl940"), u(n, "type", "number"), u(n, "name", "num_qubits"), u(n, "id", `op-${/*oi*/
      t[21]}-qubit-num_qubits`), n.value = a = /*op*/
      t[19].qubit_size, u(n, "class", "svelte-1tjl940"), u(e, "class", "input-form svelte-1tjl940"), u(o, "for", `op-${/*oi*/
      t[21]}-qubit-qubits_manual`), u(o, "class", "svelte-1tjl940"), u(c, "type", "text"), u(c, "name", "qubits_manual"), u(c, "id", `op-${/*oi*/
      t[21]}-qubit-qubits_manual`), c.value = d = /*$data*/
      t[1].operations[
        /*oi*/
        t[21]
      ].qubits_manual || "", u(c, "class", "svelte-1tjl940"), u(s, "class", "input-form svelte-1tjl940");
    },
    m(k, y) {
      S(k, e, y), f(e, l), f(e, i), f(e, n), S(k, r, y), S(k, s, y), f(s, o), f(s, _), f(s, c), h || (p = [
        te(n, "change", g),
        te(c, "change", b)
      ], h = !0);
    },
    p(k, y) {
      t = k, 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: ne,
    o: ne,
    d(k) {
      k && (C(e), C(r), C(s)), h = !1, wt(p);
    }
  };
}
function Uw(t) {
  var r, s;
  let e, l, i = $e((s = Et[
    /*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] = T_(p_(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 = Ae();
    },
    m(o, _) {
      for (let c = 0; c < n.length; c += 1)
        n[c] && n[c].m(o, _);
      S(o, e, _), l = !0;
    },
    p(o, _) {
      var c, d;
      if (_[0] & /*$data, data*/
      3) {
        i = $e((d = Et[
          /*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 = p_(o, i, h);
          n[h] ? (n[h].p(p, _), T(n[h], 1)) : (n[h] = T_(p), n[h].c(), T(n[h], 1), n[h].m(e.parentNode, e));
        }
        for (be(), h = i.length; h < n.length; h += 1)
          a(h);
        ke();
      }
    },
    i(o) {
      if (!l) {
        for (let _ = 0; _ < i.length; _ += 1)
          T(n[_]);
        l = !0;
      }
    },
    o(o) {
      n = n.filter(Boolean);
      for (let _ = 0; _ < n.length; _ += 1)
        D(n[_]);
      l = !1;
    },
    d(o) {
      o && C(e), Ye(n, o);
    }
  };
}
function w_(t) {
  let e, l;
  function i(...n) {
    return (
      /*func_4*/
      t[16](
        /*oi*/
        t[21],
        ...n
      )
    );
  }
  return e = new Nl({
    props: {
      id: `op-${/*oi*/
      t[21]}-qubit-all`,
      checked: (
        /*op*/
        t[19].apply_all
      ),
      oncheck: i,
      label: "All"
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(n, a) {
      de(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 || (T(e.$$.fragment, n), l = !0);
    },
    o(n) {
      D(e.$$.fragment, n), l = !1;
    },
    d(n) {
      he(e, n);
    }
  };
}
function $_(t) {
  let e, l;
  function i(...n) {
    return (
      /*func_5*/
      t[17](
        /*oi*/
        t[21],
        /*item*/
        t[38],
        ...n
      )
    );
  }
  return e = new Nl({
    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() {
      pe(e.$$.fragment);
    },
    m(n, a) {
      de(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 || (T(e.$$.fragment, n), l = !0);
    },
    o(n) {
      D(e.$$.fragment, n), l = !1;
    },
    d(n) {
      he(e, n);
    }
  };
}
function Ww(t) {
  let e, l, i, n = (
    /*reg*/
    t[35] + ""
  ), a, r, s, o, _, c, d, h;
  function p(...v) {
    return (
      /*func*/
      t[10](
        /*oi*/
        t[21],
        /*reg*/
        t[35],
        ...v
      )
    );
  }
  o = new Nl({
    props: {
      id: `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-reset`,
      checked: !1,
      oncheck: p,
      label: "Reset"
    }
  });
  let g = (
    /*$data*/
    t[1].num_qubits && /*$data*/
    t[1].num_qubits !== "auto" && q_(t)
  ), b = $e(
    /*$data*/
    t[1].qubits || []
  ), k = [];
  for (let v = 0; v < b.length; v += 1)
    k[v] = j_(m_(t, b, v));
  const y = (v) => D(k[v], 1, 1, () => {
    k[v] = null;
  });
  return {
    c() {
      e = m("div"), l = m("label"), i = E("Qubits to apply for "), a = E(n), r = N(), s = m("div"), pe(o.$$.fragment), _ = N(), g && g.c(), c = N();
      for (let v = 0; v < k.length; v += 1)
        k[v].c();
      d = N(), u(l, "class", "svelte-1tjl940"), u(s, "class", "checkbox-group svelte-1tjl940"), u(e, "class", "input-form svelte-1tjl940");
    },
    m(v, w) {
      S(v, e, w), f(e, l), f(l, i), f(l, a), f(e, r), f(e, s), de(o, s, null), f(s, _), g && g.m(s, null), f(s, c);
      for (let q = 0; q < k.length; q += 1)
        k[q] && k[q].m(s, null);
      f(e, d), h = !0;
    },
    p(v, w) {
      t = v, (!h || w[0] & /*$data*/
      2) && n !== (n = /*reg*/
      t[35] + "") && U(a, n);
      const q = {};
      if (w[0] & /*$data*/
      2 && (q.id = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-reset`), w[0] & /*data, $data*/
      3 && (q.oncheck = p), o.$set(q), /*$data*/
      t[1].num_qubits && /*$data*/
      t[1].num_qubits !== "auto" ? g ? (g.p(t, w), w[0] & /*$data*/
      2 && T(g, 1)) : (g = q_(t), g.c(), T(g, 1), g.m(s, c)) : g && (be(), D(g, 1, 1, () => {
        g = null;
      }), ke()), w[0] & /*$data, data*/
      3) {
        b = $e(
          /*$data*/
          t[1].qubits || []
        );
        let $;
        for ($ = 0; $ < b.length; $ += 1) {
          const j = m_(t, b, $);
          k[$] ? (k[$].p(j, w), T(k[$], 1)) : (k[$] = j_(j), k[$].c(), T(k[$], 1), k[$].m(s, null));
        }
        for (be(), $ = b.length; $ < k.length; $ += 1)
          y($);
        ke();
      }
    },
    i(v) {
      if (!h) {
        T(o.$$.fragment, v), T(g);
        for (let w = 0; w < b.length; w += 1)
          T(k[w]);
        h = !0;
      }
    },
    o(v) {
      D(o.$$.fragment, v), D(g), k = k.filter(Boolean);
      for (let w = 0; w < k.length; w += 1)
        D(k[w]);
      h = !1;
    },
    d(v) {
      v && C(e), he(o), g && g.d(), Ye(k, v);
    }
  };
}
function Jw(t) {
  let e, l, i, n = (
    /*reg*/
    t[35] + ""
  ), a, r, s, o, _, c, d, h, p, g, b = (
    /*reg*/
    t[35] + ""
  ), k, y, v, w, q, $, j, I, A;
  function M(...H) {
    return (
      /*change_handler_1*/
      t[8](
        /*oi*/
        t[21],
        /*reg*/
        t[35],
        /*reg_i*/
        t[37],
        ...H
      )
    );
  }
  function z(...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 = N(), o = m("input"), d = N(), h = m("div"), p = m("label"), g = E("Qubits "), k = E(b), v = N(), w = m("input"), j = N(), u(l, "for", r = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-num_qubits`), u(l, "class", "svelte-1tjl940"), u(o, "type", "number"), u(o, "name", "num_qubits"), u(o, "id", _ = `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, u(o, "class", "svelte-1tjl940"), u(e, "class", "input-form svelte-1tjl940"), u(p, "for", y = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-qubits_manual`), u(p, "class", "svelte-1tjl940"), u(w, "type", "text"), u(w, "name", "qubits_manual"), u(w, "id", q = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-qubits_manual`), w.value = $ = /*op*/
      ((P = (R = t[19].qubit_registers) == null ? void 0 : R[
        /*reg*/
        t[35]
      ]) == null ? void 0 : P.qubits_manual) || "", u(w, "class", "svelte-1tjl940"), u(h, "class", "input-form svelte-1tjl940");
    },
    m(H, B) {
      S(H, e, B), f(e, l), f(l, i), f(l, a), f(e, s), f(e, o), S(H, d, B), S(H, h, B), f(h, p), f(p, g), f(p, k), f(h, v), f(h, w), f(h, j), I || (A = [
        te(o, "change", M),
        te(w, "change", z)
      ], I = !0);
    },
    p(H, B) {
      var R, P, O, F;
      t = H, B[0] & /*$data*/
      2 && n !== (n = /*reg*/
      t[35] + "") && U(a, n), B[0] & /*$data*/
      2 && r !== (r = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-num_qubits`) && u(l, "for", r), B[0] & /*$data*/
      2 && _ !== (_ = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-num_qubits`) && u(o, "id", _), 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 && b !== (b = /*reg*/
      t[35] + "") && U(k, b), B[0] & /*$data*/
      2 && y !== (y = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-qubits_manual`) && u(p, "for", y), B[0] & /*$data*/
      2 && q !== (q = `op-${/*oi*/
      t[21]}-qubit-${/*reg*/
      t[35]}-qubits_manual`) && u(w, "id", q), B[0] & /*$data*/
      2 && $ !== ($ = /*op*/
      ((F = (O = t[19].qubit_registers) == null ? void 0 : O[
        /*reg*/
        t[35]
      ]) == null ? void 0 : F.qubits_manual) || "") && w.value !== $ && (w.value = $);
    },
    i: ne,
    o: ne,
    d(H) {
      H && (C(e), C(d), C(h)), I = !1, wt(A);
    }
  };
}
function q_(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 Nl({
    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() {
      pe(e.$$.fragment);
    },
    m(r, s) {
      de(e, r, s), l = !0;
    },
    p(r, s) {
      var _, 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 = (_ = t[19].qubit_registers) == null ? void 0 : _[
        /*reg*/
        t[35]
      ]) == null ? void 0 : c.apply_all), s[0] & /*data, $data*/
      3 && (o.oncheck = i), e.$set(o);
    },
    i(r) {
      l || (T(e.$$.fragment, r), l = !0);
    },
    o(r) {
      D(e.$$.fragment, r), l = !1;
    },
    d(r) {
      he(e, r);
    }
  };
}
function j_(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 Nl({
    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() {
      pe(e.$$.fragment);
    },
    m(r, s) {
      de(e, r, s), l = !0;
    },
    p(r, s) {
      var _, 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 = (_ = t[19].qubit_registers) == null ? void 0 : _[
        /*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 || (T(e.$$.fragment, r), l = !0);
    },
    o(r) {
      D(e.$$.fragment, r), l = !1;
    },
    d(r) {
      he(e, r);
    }
  };
}
function T_(t) {
  let e, l, i, n;
  const a = [Jw, Ww], r = [];
  function s(o, _) {
    var c, d;
    return (
      /*$data*/
      o[1].num_qubits === "auto" && ((d = Et[
        /*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 = Ae();
    },
    m(o, _) {
      ~e && r[e].m(o, _), S(o, i, _), n = !0;
    },
    p(o, _) {
      let c = e;
      e = s(o), e === c ? ~e && r[e].p(o, _) : (l && (be(), D(r[c], 1, 1, () => {
        r[c] = null;
      }), ke()), ~e ? (l = r[e], l ? l.p(o, _) : (l = r[e] = a[e](o), l.c()), T(l, 1), l.m(i.parentNode, i)) : l = null);
    },
    i(o) {
      n || (T(l), n = !0);
    },
    o(o) {
      D(l), n = !1;
    },
    d(o) {
      o && C(i), ~e && r[e].d(o);
    }
  };
}
function C_(t) {
  var r, s;
  let e, l, i = $e((s = Et[
    /*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] = S_(d_(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();
      u(e, "class", "input-row svelte-1tjl940");
    },
    m(o, _) {
      S(o, e, _);
      for (let c = 0; c < n.length; c += 1)
        n[c] && n[c].m(e, null);
      l = !0;
    },
    p(o, _) {
      var c, d;
      if (_[0] & /*data, $data*/
      3) {
        i = $e((d = Et[
          /*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 = d_(o, i, h);
          n[h] ? (n[h].p(p, _), T(n[h], 1)) : (n[h] = S_(p), n[h].c(), T(n[h], 1), n[h].m(e, null));
        }
        for (be(), h = i.length; h < n.length; h += 1)
          a(h);
        ke();
      }
    },
    i(o) {
      if (!l) {
        for (let _ = 0; _ < i.length; _ += 1)
          T(n[_]);
        l = !0;
      }
    },
    o(o) {
      n = n.filter(Boolean);
      for (let _ = 0; _ < n.length; _ += 1)
        D(n[_]);
      l = !1;
    },
    d(o) {
      o && C(e), Ye(n, o);
    }
  };
}
function S_(t) {
  let e, l;
  return e = new i0({
    props: {
      data: (
        /*data*/
        t[0]
      ),
      param: (
        /*param*/
        t[31]
      ),
      oi: (
        /*oi*/
        t[21]
      ),
      pi: (
        /*pi*/
        t[33]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function M_(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 && z_(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(r, s) {
      i && i.m(r, s), S(r, e, s), l = !0;
    },
    p(r, s) {
      var o, _;
      /*$data*/
      ((_ = (o = r[1].operations[
        /*oi*/
        r[21]
      ]) == null ? void 0 : o.apply_to) == null ? void 0 : _.length) > 0 ? i ? (i.p(r, s), s[0] & /*$data*/
      2 && T(i, 1)) : (i = z_(r), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(r) {
      l || (T(i), l = !0);
    },
    o(r) {
      D(i), l = !1;
    },
    d(r) {
      r && C(e), i && i.d(r);
    }
  };
}
function z_(t) {
  var r;
  let e, l, i = $e(
    /*$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] = A_(__(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 = Ae();
    },
    m(s, o) {
      for (let _ = 0; _ < n.length; _ += 1)
        n[_] && n[_].m(s, o);
      S(s, e, o), l = !0;
    },
    p(s, o) {
      var _;
      if (o[0] & /*$data, data*/
      3) {
        i = $e(
          /*$data*/
          (_ = s[1].operations[
            /*oi*/
            s[21]
          ]) == null ? void 0 : _.apply_to
        );
        let c;
        for (c = 0; c < i.length; c += 1) {
          const d = __(s, i, c);
          n[c] ? (n[c].p(d, o), T(n[c], 1)) : (n[c] = A_(d), n[c].c(), T(n[c], 1), n[c].m(e.parentNode, e));
        }
        for (be(), c = i.length; c < n.length; c += 1)
          a(c);
        ke();
      }
    },
    i(s) {
      if (!l) {
        for (let o = 0; o < i.length; o += 1)
          T(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 && C(e), Ye(n, s);
    }
  };
}
function N_(t) {
  let e, l;
  return e = new i0({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function A_(t) {
  var s, o;
  let e, l, i, n = $e((o = Et[
    /*op*/
    (s = t[19]) == null ? void 0 : s.operation_def
  ]) == null ? void 0 : o.params_per_bit), a = [];
  for (let _ = 0; _ < n.length; _ += 1)
    a[_] = N_(c_(t, n, _));
  const r = (_) => D(a[_], 1, 1, () => {
    a[_] = null;
  });
  return {
    c() {
      e = m("div");
      for (let _ = 0; _ < a.length; _ += 1)
        a[_].c();
      l = N(), u(e, "class", "input-row svelte-1tjl940");
    },
    m(_, c) {
      S(_, e, c);
      for (let d = 0; d < a.length; d += 1)
        a[d] && a[d].m(e, null);
      f(e, l), i = !0;
    },
    p(_, c) {
      var d, h;
      if (c[0] & /*data, $data*/
      3) {
        n = $e((h = Et[
          /*op*/
          (d = _[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 g = c_(_, n, p);
          a[p] ? (a[p].p(g, c), T(a[p], 1)) : (a[p] = N_(g), a[p].c(), T(a[p], 1), a[p].m(e, l));
        }
        for (be(), p = n.length; p < a.length; p += 1)
          r(p);
        ke();
      }
    },
    i(_) {
      if (!i) {
        for (let c = 0; c < n.length; c += 1)
          T(a[c]);
        i = !0;
      }
    },
    o(_) {
      a = a.filter(Boolean);
      for (let c = 0; c < a.length; c += 1)
        D(a[c]);
      i = !1;
    },
    d(_) {
      _ && C(e), Ye(a, _);
    }
  };
}
function B_(t) {
  var r, s;
  let e, l, i = $e((s = Et[
    /*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] = P_(f_(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();
      u(e, "class", "input-row svelte-1tjl940");
    },
    m(o, _) {
      S(o, e, _);
      for (let c = 0; c < n.length; c += 1)
        n[c] && n[c].m(e, null);
      l = !0;
    },
    p(o, _) {
      var c, d;
      if (_[0] & /*$data, data*/
      3) {
        i = $e((d = Et[
          /*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 = f_(o, i, h);
          n[h] ? (n[h].p(p, _), T(n[h], 1)) : (n[h] = P_(p), n[h].c(), T(n[h], 1), n[h].m(e, null));
        }
        for (be(), h = i.length; h < n.length; h += 1)
          a(h);
        ke();
      }
    },
    i(o) {
      if (!l) {
        for (let _ = 0; _ < i.length; _ += 1)
          T(n[_]);
        l = !0;
      }
    },
    o(o) {
      n = n.filter(Boolean);
      for (let _ = 0; _ < n.length; _ += 1)
        D(n[_]);
      l = !1;
    },
    d(o) {
      o && C(e), Ye(n, o);
    }
  };
}
function P_(t) {
  let e, l;
  return e = new Xw({
    props: {
      glb: (
        /*glb*/
        t[25]
      ),
      gi: (
        /*gi*/
        t[27]
      ),
      data: (
        /*data*/
        t[0]
      ),
      oi: (
        /*oi*/
        t[21]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function O_(t) {
  var n, a;
  let e, l = $e((a = Et[
    /*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] = E_(u_(t, l, r));
  return {
    c() {
      e = m("div");
      for (let r = 0; r < i.length; r += 1)
        i[r].c();
      u(e, "class", "input-row svelte-1tjl940");
    },
    m(r, s) {
      S(r, e, s);
      for (let o = 0; o < i.length; o += 1)
        i[o] && i[o].m(e, null);
    },
    p(r, s) {
      var o, _;
      if (s[0] & /*$data*/
      2) {
        l = $e((_ = Et[
          /*op*/
          (o = r[19]) == null ? void 0 : o.operation_def
        ]) == null ? void 0 : _.constraints);
        let c;
        for (c = 0; c < l.length; c += 1) {
          const d = u_(r, l, c);
          i[c] ? i[c].p(d, s) : (i[c] = E_(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 && C(e), Ye(i, r);
    }
  };
}
function Zw(t) {
  let e, l, i = (
    /*co*/
    t[22].success + ""
  ), n, a;
  return {
    c() {
      e = m("div"), l = E("Constraint satisfied: "), n = E(i), a = N(), u(e, "class", "success svelte-1tjl940");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, n), f(e, a);
    },
    p(r, s) {
      s[0] & /*$data*/
      2 && i !== (i = /*co*/
      r[22].success + "") && U(n, i);
    },
    d(r) {
      r && C(e);
    }
  };
}
function xw(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 = N(), a = E(n), r = N(), u(l, "class", "svelte-1tjl940"), u(e, "class", "warning svelte-1tjl940");
    },
    m(s, o) {
      S(s, e, o), f(e, l), f(e, i), f(e, a), f(e, r);
    },
    p(s, o) {
      o[0] & /*$data*/
      2 && n !== (n = /*co*/
      s[22].warning + "") && U(a, n);
    },
    d(s) {
      s && C(e);
    }
  };
}
function E_(t) {
  let e, l;
  function i(r, s) {
    var o, _;
    return s[0] & /*$data*/
    2 && (e = null), e == null && (e = !vw(
      /*co*/
      r[22],
      /*op*/
      r[19],
      (_ = Et[
        /*op*/
        (o = r[19]) == null ? void 0 : o.operation_def
      ]) == null ? void 0 : _.variables,
      /*$data*/
      r[1].num_qubits === "auto"
    )), e ? xw : Zw;
  }
  let n = i(t, [-1, -1]), a = n(t);
  return {
    c() {
      a.c(), l = Ae();
    },
    m(r, s) {
      a.m(r, s), S(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 && C(l), a.d(r);
    }
  };
}
function I_(t) {
  var r, s;
  let e, l, i = ((s = Et[
    /*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 = N(), u(l, "class", "note svelte-1tjl940"), u(e, "class", "svelte-1tjl940");
    },
    m(o, _) {
      S(o, e, _), f(e, l), f(l, n), f(e, a);
    },
    p(o, _) {
      var c, d;
      _[0] & /*$data*/
      2 && i !== (i = ((d = Et[
        /*op*/
        (c = o[19]) == null ? void 0 : c.operation_def
      ]) == null ? void 0 : d.notes) + "") && U(n, i);
    },
    d(o) {
      o && C(e);
    }
  };
}
function D_(t) {
  var ue, le, oe, x, ge, re, Ie, je, _e, Ee;
  let e, l, i = (
    /*op*/
    t[19].deactive ? "[Deactive]" : ""
  ), n, a, r = (
    /*oi*/
    t[21] + 1 + ""
  ), s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R, P, O, F, L, X, V, Q = !/*op*/
  t[19].deactive && b_(t), Z = (
    /*op*/
    t[19].deactive && k_(t)
  );
  function ae(...ie) {
    return (
      /*click_handler_2*/
      t[4](
        /*oi*/
        t[21],
        ...ie
      )
    );
  }
  let se = (
    /*oi*/
    t[21] > 0 && Gw(t)
  ), K = (
    /*oi*/
    t[21] < /*$data*/
    t[1].operations.length - 1 && v_(t)
  ), Y = $e(Wf), W = [];
  for (let ie = 0; ie < Y.length; ie += 1)
    W[ie] = y_(g_(t, Y, ie));
  function J(...ie) {
    return (
      /*change_handler*/
      t[7](
        /*oi*/
        t[21],
        ...ie
      )
    );
  }
  const ee = [Uw, Kw, Yw], we = [];
  function Re(ie, Te) {
    var Ue, Ke, We, vt;
    return (Ke = Et[
      /*op*/
      (Ue = ie[19]) == null ? void 0 : Ue.operation_def
    ]) != null && Ke.qubit_registers ? 0 : (
      /*$data*/
      ie[1].num_qubits === "auto" && ((vt = Et[
        /*op*/
        (We = ie[19]) == null ? void 0 : We.operation_def
      ]) != null && vt.needs_size) ? 1 : 2
    );
  }
  M = Re(t), z = we[M] = ee[M](t);
  let ve = ((le = Et[
    /*op*/
    (ue = t[19]) == null ? void 0 : ue.operation_def
  ]) == null ? void 0 : le.params) && C_(t), me = ((x = Et[
    /*op*/
    (oe = t[19]) == null ? void 0 : oe.operation_def
  ]) == null ? void 0 : x.params_per_bit) && M_(t), fe = ((re = Et[
    /*op*/
    (ge = t[19]) == null ? void 0 : ge.operation_def
  ]) == null ? void 0 : re.globals) && B_(t), G = ((je = Et[
    /*op*/
    (Ie = t[19]) == null ? void 0 : Ie.operation_def
  ]) == null ? void 0 : je.constraints) && O_(t), ye = ((Ee = Et[
    /*op*/
    (_e = t[19]) == null ? void 0 : _e.operation_def
  ]) == null ? void 0 : Ee.notes) && I_(t);
  return {
    c() {
      e = m("div"), l = m("h5"), n = E(i), a = E(" Operation "), s = E(r), o = N(), _ = m("span"), Q && Q.c(), c = N(), Z && Z.c(), d = N(), h = m("button"), h.textContent = "× Remove", p = N(), se && se.c(), g = N(), K && K.c(), b = N(), k = m("div"), y = m("div"), v = m("label"), v.textContent = "Operation type", w = N(), q = m("select"), $ = m("option"), $.textContent = "-";
      for (let ie = 0; ie < W.length; ie += 1)
        W[ie].c();
      A = N(), z.c(), H = N(), ve && ve.c(), B = N(), me && me.c(), R = N(), fe && fe.c(), P = N(), G && G.c(), O = N(), ye && ye.c(), F = Ae(), u(h, "class", "svelte-1tjl940"), u(_, "class", "header-button-group svelte-1tjl940"), u(l, "class", "svelte-1tjl940"), u(v, "for", "op_type-" + /*oi*/
      t[21]), u(v, "class", "svelte-1tjl940"), $.__value = "-", pt($, $.__value), u($, "class", "svelte-1tjl940"), u(q, "id", "op_type-" + /*oi*/
      t[21]), u(q, "name", "op_type-" + /*oi*/
      t[21]), q.disabled = I = !/*$data*/
      t[1].num_qubits, u(q, "class", "svelte-1tjl940"), u(y, "class", "input-form svelte-1tjl940"), u(k, "class", "input-row svelte-1tjl940"), u(e, "class", "op-wrap svelte-1tjl940");
    },
    m(ie, Te) {
      S(ie, e, Te), f(e, l), f(l, n), f(l, a), f(l, s), f(l, o), f(l, _), Q && Q.m(_, null), f(_, c), Z && Z.m(_, null), f(_, d), f(_, h), f(_, p), se && se.m(_, null), f(_, g), K && K.m(_, null), f(e, b), f(e, k), f(k, y), f(y, v), f(y, w), f(y, q), f(q, $);
      for (let Ue = 0; Ue < W.length; Ue += 1)
        W[Ue] && W[Ue].m(q, null);
      fl(
        q,
        /*op*/
        t[19].operation_def
      ), f(k, A), we[M].m(k, null), f(e, H), ve && ve.m(e, null), f(e, B), me && me.m(e, null), f(e, R), fe && fe.m(e, null), f(e, P), G && G.m(e, null), S(ie, O, Te), ye && ye.m(ie, Te), S(ie, F, Te), L = !0, X || (V = [
        te(h, "click", ae),
        te(q, "change", J)
      ], X = !0);
    },
    p(ie, Te) {
      var Ke, We, vt, qt, rt, mt, Rt, ot, ut, Ce;
      if (t = ie, (!L || Te[0] & /*$data*/
      2) && i !== (i = /*op*/
      t[19].deactive ? "[Deactive]" : "") && U(n, i), /*op*/
      t[19].deactive ? Q && (Q.d(1), Q = null) : Q ? Q.p(t, Te) : (Q = b_(t), Q.c(), Q.m(_, c)), /*op*/
      t[19].deactive ? Z ? Z.p(t, Te) : (Z = k_(t), Z.c(), Z.m(_, d)) : Z && (Z.d(1), Z = null), /*oi*/
      t[21] > 0 && se.p(t, Te), /*oi*/
      t[21] < /*$data*/
      t[1].operations.length - 1 ? K ? K.p(t, Te) : (K = v_(t), K.c(), K.m(_, null)) : K && (K.d(1), K = null), Te[0] & /*$data*/
      2) {
        Y = $e(Wf);
        let ce;
        for (ce = 0; ce < Y.length; ce += 1) {
          const Be = g_(t, Y, ce);
          W[ce] ? W[ce].p(Be, Te) : (W[ce] = y_(Be), W[ce].c(), W[ce].m(q, null));
        }
        for (; ce < W.length; ce += 1)
          W[ce].d(1);
        W.length = Y.length;
      }
      (!L || Te[0] & /*$data*/
      2 && j !== (j = /*op*/
      t[19].operation_def)) && fl(
        q,
        /*op*/
        t[19].operation_def
      ), (!L || Te[0] & /*$data*/
      2 && I !== (I = !/*$data*/
      t[1].num_qubits)) && (q.disabled = I);
      let Ue = M;
      M = Re(t), M === Ue ? we[M].p(t, Te) : (be(), D(we[Ue], 1, 1, () => {
        we[Ue] = null;
      }), ke(), z = we[M], z ? z.p(t, Te) : (z = we[M] = ee[M](t), z.c()), T(z, 1), z.m(k, null)), (We = Et[
        /*op*/
        (Ke = t[19]) == null ? void 0 : Ke.operation_def
      ]) != null && We.params ? ve ? (ve.p(t, Te), Te[0] & /*$data*/
      2 && T(ve, 1)) : (ve = C_(t), ve.c(), T(ve, 1), ve.m(e, B)) : ve && (be(), D(ve, 1, 1, () => {
        ve = null;
      }), ke()), (qt = Et[
        /*op*/
        (vt = t[19]) == null ? void 0 : vt.operation_def
      ]) != null && qt.params_per_bit ? me ? (me.p(t, Te), Te[0] & /*$data*/
      2 && T(me, 1)) : (me = M_(t), me.c(), T(me, 1), me.m(e, R)) : me && (be(), D(me, 1, 1, () => {
        me = null;
      }), ke()), (mt = Et[
        /*op*/
        (rt = t[19]) == null ? void 0 : rt.operation_def
      ]) != null && mt.globals ? fe ? (fe.p(t, Te), Te[0] & /*$data*/
      2 && T(fe, 1)) : (fe = B_(t), fe.c(), T(fe, 1), fe.m(e, P)) : fe && (be(), D(fe, 1, 1, () => {
        fe = null;
      }), ke()), (ot = Et[
        /*op*/
        (Rt = t[19]) == null ? void 0 : Rt.operation_def
      ]) != null && ot.constraints ? G ? G.p(t, Te) : (G = O_(t), G.c(), G.m(e, null)) : G && (G.d(1), G = null), (Ce = Et[
        /*op*/
        (ut = t[19]) == null ? void 0 : ut.operation_def
      ]) != null && Ce.notes ? ye ? ye.p(t, Te) : (ye = I_(t), ye.c(), ye.m(F.parentNode, F)) : ye && (ye.d(1), ye = null);
    },
    i(ie) {
      L || (T(z), T(ve), T(me), T(fe), L = !0);
    },
    o(ie) {
      D(z), D(ve), D(me), D(fe), L = !1;
    },
    d(ie) {
      ie && (C(e), C(O), C(F)), Q && Q.d(), Z && Z.d(), se && se.d(), K && K.d(), Ye(W, ie), we[M].d(), ve && ve.d(), me && me.d(), fe && fe.d(), G && G.d(), ye && ye.d(ie), X = !1, wt(V);
    }
  };
}
function R_(t) {
  let e;
  return {
    c() {
      e = m("hr"), u(e, "class", "svelte-1tjl940");
    },
    m(l, i) {
      S(l, e, i);
    },
    d(l) {
      l && C(e);
    }
  };
}
function e3(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"
  ), _, c, d, h, p, g, b, k, y, v, w, q, $, j, I = $e(
    /*$data*/
    t[1].operations || []
  ), A = [];
  for (let P = 0; P < I.length; P += 1)
    A[P] = D_(o_(t, I, P));
  const M = (P) => D(A[P], 1, 1, () => {
    A[P] = null;
  });
  let z = (
    /*$data*/
    ((R = t[1].operations) == null ? void 0 : R.length) > 0 && R_()
  );
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`2. Define operations
    `), n = m("span"), r = E(a), s = E(" active opeartion"), _ = E(o), c = E("."), d = N(), h = m("div");
      for (let P = 0; P < A.length; P += 1)
        A[P].c();
      p = N(), z && z.c(), g = N(), b = m("div"), k = m("button"), k.textContent = "Add an operation", y = N(), v = m("span"), v.textContent = "Deactive operations are excluded from the final circuit code.", u(n, "class", "note svelte-1tjl940"), u(l, "class", "svelte-1tjl940"), u(h, "class", "content-wrap svelte-1tjl940"), u(k, "class", "svelte-1tjl940"), u(b, "class", "input-row svelte-1tjl940"), u(v, "class", "note svelte-1tjl940"), u(e, "class", w = Yt(
        /*$data*/
        t[1].num_qubits ? "" : "deactive"
      ) + " svelte-1tjl940");
    },
    m(P, O) {
      S(P, e, O), f(e, l), f(l, i), f(l, n), f(n, r), f(n, s), f(n, _), f(n, c), f(e, d), f(e, h);
      for (let F = 0; F < A.length; F += 1)
        A[F] && A[F].m(h, null);
      f(e, p), z && z.m(e, null), f(e, g), f(e, b), f(b, k), f(e, y), f(e, v), q = !0, $ || (j = te(
        k,
        "click",
        /*click_handler_5*/
        t[18]
      ), $ = !0);
    },
    p(P, O) {
      var F, L, X;
      if ((!q || O[0] & /*$data*/
      2) && a !== (a = /*$data*/
      ((F = P[1]) == null ? void 0 : F.num_operations) + "") && U(r, a), (!q || O[0] & /*$data*/
      2) && o !== (o = /*$data*/
      ((L = P[1]) == null ? void 0 : L.num_operations) == 1 ? "" : "s") && U(_, o), O[0] & /*$data, data*/
      3) {
        I = $e(
          /*$data*/
          P[1].operations || []
        );
        let V;
        for (V = 0; V < I.length; V += 1) {
          const Q = o_(P, I, V);
          A[V] ? (A[V].p(Q, O), T(A[V], 1)) : (A[V] = D_(Q), A[V].c(), T(A[V], 1), A[V].m(h, null));
        }
        for (be(), V = I.length; V < A.length; V += 1)
          M(V);
        ke();
      }
      /*$data*/
      ((X = P[1].operations) == null ? void 0 : X.length) > 0 ? z || (z = R_(), z.c(), z.m(e, g)) : z && (z.d(1), z = null), (!q || O[0] & /*$data*/
      2 && w !== (w = Yt(
        /*$data*/
        P[1].num_qubits ? "" : "deactive"
      ) + " svelte-1tjl940")) && u(e, "class", w);
    },
    i(P) {
      if (!q) {
        for (let O = 0; O < I.length; O += 1)
          T(A[O]);
        q = !0;
      }
    },
    o(P) {
      A = A.filter(Boolean);
      for (let O = 0; O < A.length; O += 1)
        D(A[O]);
      q = !1;
    },
    d(P) {
      P && C(e), Ye(A, P), z && z.d(), $ = !1, j();
    }
  };
}
function t3(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(r, (A) => l(1, i = A)), r);
  t.$$.on_destroy.push(() => n());
  let { data: r = Oe({}) } = e;
  a();
  const s = (A, M) => {
    r.update((z) => (z.operations[A].deactive = !0, z));
  }, o = (A, M) => {
    r.update((z) => (z.operations[A].deactive = !1, z));
  }, _ = (A, M) => {
    r.update((z) => (z.operations.splice(A, 1), z));
  }, c = (A, M) => {
    r.update((z) => ([z.operations[A], z.operations[A - 1]] = [z.operations[A - 1], z.operations[A]], z));
  }, d = (A, M) => {
    r.update((z) => ([z.operations[A], z.operations[A + 1]] = [z.operations[A + 1], z.operations[A]], z));
  }, h = (A, M) => {
    r.update((z) => (z.operations[A].operation_def = M.target.value, z));
  }, p = (A, M, z, H) => {
    r.update((B) => (B.operations[A].qubit_registers || (B.operations[A].qubit_registers = {}), B.operations[A].qubit_registers[M] || (B.operations[A].qubit_registers[M] = { apply_all: !1, apply_to: [] }), B.operations[A].qubit_registers[M].size = parseInt(H.target.value), B.operations[A].qubit_registers[M].size > 0 && (B.operations[A].qubit_registers[M].apply_to = Array.from(Array(B.operations[A].qubit_registers[M].size).keys()).map((R) => z * 1e3 + R)), B));
  }, g = (A, M, z) => {
    r.update((H) => (H.operations[A].qubit_registers || (H.operations[A].qubit_registers = {}), H.operations[A].qubit_registers[M] || (H.operations[A].qubit_registers[M] = { apply_all: !1, apply_to: [] }), z.target.value.length > 0 ? (H.operations[A].qubit_registers[M].qubits_manual = z.target.value, H.operations[A].qubit_registers[M].apply_to = z.target.value.split(",").map((B) => parseInt(B.trim()))) : (delete H.operations[A].qubit_registers[M].qubits_manual, H.operations[A].qubit_registers[M].apply_to = []), H));
  }, b = (A, M, z) => {
    r.update((H) => {
      var B, R, P;
      return (P = (R = (B = H.operations) == null ? void 0 : B[A]) == null ? void 0 : R.qubit_registers) != null && P[M] && (H.operations[A].qubit_registers[M] = { apply_all: !1, apply_to: [] }), H;
    });
  }, k = (A, M, z) => {
    r.update((H) => (H.operations[A].qubit_registers || (H.operations[A].qubit_registers = {}), H.operations[A].qubit_registers[M] || (H.operations[A].qubit_registers[M] = { apply_all: !1, apply_to: [] }), H.operations[A].qubit_registers[M].apply_all = z, z ? H.operations[A].qubit_registers[M].apply_to = H.qubits.map((B) => B) : H.operations[A].qubit_registers[M].apply_to = [], H));
  }, y = (A, M, z, H) => {
    r.update((B) => {
      var R, P;
      return B.operations[A].qubit_registers || (B.operations[A].qubit_registers = {}), B.operations[A].qubit_registers[M] || (B.operations[A].qubit_registers[M] = { apply_all: !1, apply_to: [] }), H && !((R = B.operations[A].qubit_registers[M]) != null && R.apply_to.includes(z)) ? B.operations[A].qubit_registers[M].apply_to.push(z) : !H && ((P = B.operations[A].qubit_registers[M]) != null && P.apply_to.includes(z)) && B.operations[A].qubit_registers[M].apply_to.splice(B.operations[A].qubit_registers[M].apply_to.indexOf(z), 1), B;
    });
  }, v = (A, M) => {
    r.update((z) => (z.operations[A].qubit_size = parseInt(M.target.value), z.operations[A].qubit_size > 0 && (z.operations[A].apply_to = Array.from(Array(z.operations[A].qubit_size).keys())), z));
  }, w = (A, M) => {
    r.update((z) => (M.target.value.length > 0 ? (z.operations[A].qubits_manual = M.target.value, z.operations[A].apply_to = M.target.value.split(",").map((H) => parseInt(H.trim()))) : (delete z.operations[A].qubits_manual, z.operations[A].apply_to = []), z));
  }, q = (A, M) => {
    r.update((z) => {
      var H;
      return (H = z.operations) != null && H[A] && (z.operations[A].apply_to = [], z.operations[A].apply_all = !1), z;
    });
  }, $ = (A, M) => {
    r.update((z) => (z.operations[A].apply_all = M, M ? z.operations[A].apply_to = z.qubits.map((H) => H) : z.operations[A].apply_to = [], z));
  }, j = (A, M, z) => {
    r.update((H) => (z && !H.operations[A].apply_to.includes(M) ? H.operations[A].apply_to.push(M) : !z && H.operations[A].apply_to.includes(M) && H.operations[A].apply_to.splice(H.operations[A].apply_to.indexOf(M), 1), H));
  }, I = (A) => {
    r.update((M) => (M.operations || (M.operations = []), M.num_operations || (M.num_operations = 0), M.operations.push({
      operation_def: void 0,
      apply_to: [],
      apply_all: !1
    }), M));
  };
  return t.$$set = (A) => {
    "data" in A && a(l(0, r = A.data));
  }, [
    r,
    i,
    s,
    o,
    _,
    c,
    d,
    h,
    p,
    g,
    b,
    k,
    y,
    v,
    w,
    q,
    $,
    j,
    I
  ];
}
class l3 extends Ve {
  constructor(e) {
    super(), Qe(this, e, t3, e3, Fe, { data: 0 }, null, [-1, -1]);
  }
}
function i3(t, e) {
  let l = t - e;
  if (l < 0)
    return null;
  {
    let i = "I".repeat(l);
    return n0(e).map((n) => n + i);
  }
}
const H_ = ["X", "Y", "Z"];
function n0(t) {
  if (t == 1)
    return H_;
  let e = [];
  for (const l of H_) {
    let i = n0(t - 1).map((n) => l + n);
    e.push(...i);
  }
  return e;
}
function L_(t, e, l) {
  const i = t.slice();
  return i[12] = e[l], i[14] = l, i;
}
function F_(t, e, l) {
  const i = t.slice();
  return i[15] = e[l], i[17] = l, i;
}
function Q_(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", u(e, "class", "svelte-1fuex22");
    },
    m(a, r) {
      S(a, e, r), l || (i = te(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && C(e), l = !1, i();
    }
  };
}
function V_(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", u(e, "class", "svelte-1fuex22");
    },
    m(a, r) {
      S(a, e, r), l || (i = te(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && C(e), l = !1, i();
    }
  };
}
function n3(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", u(e, "class", "svelte-1fuex22");
    },
    m(a, r) {
      S(a, e, r), l || (i = te(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && C(e), l = !1, i();
    }
  };
}
function X_(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", u(e, "class", "svelte-1fuex22");
    },
    m(a, r) {
      S(a, e, r), l || (i = te(e, "click", n), l = !0);
    },
    p(a, r) {
      t = a;
    },
    d(a) {
      a && C(e), l = !1, i();
    }
  };
}
function G_(t) {
  let e = (
    /*xi*/
    t[17] > 0 ? " | " : ""
  ), l, i;
  return {
    c() {
      l = E(e), i = E(
        /*xi*/
        t[17]
      );
    },
    m(n, a) {
      S(n, l, a), S(n, i, a);
    },
    p: ne,
    d(n) {
      n && (C(l), C(i));
    }
  };
}
function Y_(t) {
  let e, l, i = (
    /*pauli*/
    t[12].deactive ? "[Deactive]" : ""
  ), n, a, r = (
    /*pi*/
    t[14] + 1 + ""
  ), s, o, _ = (
    /*pauli*/
    t[12].observable + ""
  ), c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R, P, O, F = !/*pauli*/
  t[12].deactive && Q_(t), L = (
    /*pauli*/
    t[12].deactive && V_(t)
  );
  function X(...K) {
    return (
      /*click_handler_2*/
      t[6](
        /*pi*/
        t[14],
        ...K
      )
    );
  }
  let V = (
    /*pi*/
    t[14] > 0 && n3(t)
  ), Q = (
    /*pi*/
    t[14] < /*$data*/
    t[1].pauli_obs.length - 1 && X_(t)
  ), Z = $e({
    length: (
      /*$data*/
      t[1].machine_qubits ? (
        /*$data*/
        t[1].machine_qubits
      ) : (
        /*$data*/
        t[1].num_qubits
      )
    )
  }), ae = [];
  for (let K = 0; K < Z.length; K += 1)
    ae[K] = G_(F_(t, Z, K));
  function se(...K) {
    return (
      /*change_handler*/
      t[9](
        /*pi*/
        t[14],
        ...K
      )
    );
  }
  return {
    c() {
      e = m("div"), l = m("h5"), n = E(i), a = E(" Observable "), s = E(r), o = E(". ("), c = E(_), d = E(`)
          `), h = m("span"), F && F.c(), p = N(), L && L.c(), g = N(), b = m("button"), b.textContent = "× Remove", k = N(), V && V.c(), y = N(), Q && Q.c(), v = N(), w = m("div"), q = m("div"), $ = m("label");
      for (let K = 0; K < ae.length; K += 1)
        ae[K].c();
      j = N(), I = m("input"), H = N(), B = m("span"), R = N(), u(b, "class", "svelte-1fuex22"), u(h, "class", "header-button-group svelte-1fuex22"), u(l, "class", "svelte-1fuex22"), u($, "for", `pauli-obs-${/*pi*/
      t[14]}`), u($, "class", "pauli-label svelte-1fuex22"), u(I, "type", "text"), u(I, "class", "pauli-input-form svelte-1fuex22"), u(I, "id", `pauli-obs-${/*pi*/
      t[14]}`), u(I, "name", `pauli-obs-${/*pi*/
      t[14]}`), I.value = A = /*$data*/
      t[1].pauli_obs[
        /*pi*/
        t[14]
      ].observable, u(I, "pattern", M = `[iIxXyYzZ]${/*$data*/
      t[1].machine_qubits ? `{${/*$data*/
      t[1].machine_qubits}}` : "+"}`), u(I, "style", z = `width: ${/*$data*/
      t[1].pauli_obs[
        /*pi*/
        t[14]
      ].observable.length * 2}rem; letter-spacing: 1rem;`), u(B, "class", "validity svelte-1fuex22"), u(q, "class", "pauli-input svelte-1fuex22"), u(w, "class", "pauli-input-row svelte-1fuex22"), u(e, "class", "op-wrap svelte-1fuex22");
    },
    m(K, Y) {
      S(K, e, Y), f(e, l), f(l, n), f(l, a), f(l, s), f(l, o), f(l, c), f(l, d), f(l, h), F && F.m(h, null), f(h, p), L && L.m(h, null), f(h, g), f(h, b), f(h, k), V && V.m(h, null), f(h, y), Q && Q.m(h, null), f(e, v), f(e, w), f(w, q), f(q, $);
      for (let W = 0; W < ae.length; W += 1)
        ae[W] && ae[W].m($, null);
      f(q, j), f(q, I), f(q, H), f(q, B), f(e, R), P || (O = [
        te(b, "click", X),
        te(I, "change", se)
      ], P = !0);
    },
    p(K, Y) {
      if (t = K, Y & /*$data*/
      2 && i !== (i = /*pauli*/
      t[12].deactive ? "[Deactive]" : "") && U(n, i), Y & /*$data*/
      2 && _ !== (_ = /*pauli*/
      t[12].observable + "") && U(c, _), /*pauli*/
      t[12].deactive ? F && (F.d(1), F = null) : F ? F.p(t, Y) : (F = Q_(t), F.c(), F.m(h, p)), /*pauli*/
      t[12].deactive ? L ? L.p(t, Y) : (L = V_(t), L.c(), L.m(h, g)) : L && (L.d(1), L = null), /*pi*/
      t[14] > 0 && V.p(t, Y), /*pi*/
      t[14] < /*$data*/
      t[1].pauli_obs.length - 1 ? Q ? Q.p(t, Y) : (Q = X_(t), Q.c(), Q.m(h, null)) : Q && (Q.d(1), Q = null), Y & /*$data*/
      2) {
        Z = $e({
          length: (
            /*$data*/
            t[1].machine_qubits ? (
              /*$data*/
              t[1].machine_qubits
            ) : (
              /*$data*/
              t[1].num_qubits
            )
          )
        });
        let W;
        for (W = 0; W < Z.length; W += 1) {
          const J = F_(t, Z, W);
          ae[W] ? ae[W].p(J, Y) : (ae[W] = G_(J), ae[W].c(), ae[W].m($, null));
        }
        for (; W < ae.length; W += 1)
          ae[W].d(1);
        ae.length = Z.length;
      }
      Y & /*$data*/
      2 && A !== (A = /*$data*/
      t[1].pauli_obs[
        /*pi*/
        t[14]
      ].observable) && I.value !== A && (I.value = A), Y & /*$data*/
      2 && M !== (M = `[iIxXyYzZ]${/*$data*/
      t[1].machine_qubits ? `{${/*$data*/
      t[1].machine_qubits}}` : "+"}`) && u(I, "pattern", M), Y & /*$data*/
      2 && z !== (z = `width: ${/*$data*/
      t[1].pauli_obs[
        /*pi*/
        t[14]
      ].observable.length * 2}rem; letter-spacing: 1rem;`) && u(I, "style", z);
    },
    d(K) {
      K && C(e), F && F.d(), L && L.d(), V && V.d(), Q && Q.d(), Ye(ae, K), P = !1, wt(O);
    }
  };
}
function K_(t) {
  let e, l, i, n;
  return {
    c() {
      e = m("div"), l = m("strong"), l.textContent = "Warning:", i = N(), n = E(
        /*$pauli_warning*/
        t[2]
      ), u(l, "class", "svelte-1fuex22"), u(e, "class", "warning svelte-1fuex22");
    },
    m(a, r) {
      S(a, e, r), f(e, l), f(e, i), f(e, n);
    },
    p(a, r) {
      r & /*$pauli_warning*/
      4 && U(
        n,
        /*$pauli_warning*/
        a[2]
      );
    },
    d(a) {
      a && C(e);
    }
  };
}
function a3(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"
  ), _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z = $e(
    /*$data*/
    t[1].pauli_obs || []
  ), H = [];
  for (let O = 0; O < z.length; O += 1)
    H[O] = Y_(L_(t, z, O));
  let B = (
    /*$pauli_warning*/
    t[2] && K_(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"), _ = E(o), c = E("."), d = N(), 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 = N(), g = m("div");
      for (let O = 0; O < H.length; O += 1)
        H[O].c();
      b = N(), k = m("div"), y = m("button"), y.textContent = "Add a Pauli observable", v = N(), w = m("button"), w.textContent = "Generate Pauli obersvable permutations", q = N(), $ = m("span"), $.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 = N(), B && B.c(), u(n, "class", "note svelte-1fuex22"), u(h, "class", "note svelte-1fuex22"), u(l, "class", "svelte-1fuex22"), u(g, "class", "content-wrap svelte-1fuex22"), u(y, "class", "svelte-1fuex22"), u(w, "class", "svelte-1fuex22"), u(k, "class", "input-row svelte-1fuex22"), u($, "class", "note svelte-1fuex22"), u(e, "class", I = Yt(
        /*$data*/
        t[1].num_qubits ? "" : "deactive"
      ) + " svelte-1fuex22");
    },
    m(O, F) {
      S(O, e, F), f(e, l), f(l, i), f(l, n), f(n, r), f(n, s), f(n, _), f(n, c), f(l, d), f(l, h), f(e, p), f(e, g);
      for (let L = 0; L < H.length; L += 1)
        H[L] && H[L].m(g, null);
      f(e, b), f(e, k), f(k, y), f(k, v), f(k, w), f(e, q), f(e, $), f(e, j), B && B.m(e, null), A || (M = [
        te(
          y,
          "click",
          /*click_handler_5*/
          t[10]
        ),
        te(
          w,
          "click",
          /*click_handler_6*/
          t[11]
        )
      ], A = !0);
    },
    p(O, [F]) {
      var L, X;
      if (F & /*$data*/
      2 && a !== (a = /*$data*/
      ((L = O[1]) == null ? void 0 : L.num_pauli_obs) + "") && U(r, a), F & /*$data*/
      2 && o !== (o = /*$data*/
      ((X = O[1]) == null ? void 0 : X.num_pauli_obs) == 1 ? "" : "s") && U(_, o), F & /*$data, data, RegExp, pauli_warning*/
      11) {
        z = $e(
          /*$data*/
          O[1].pauli_obs || []
        );
        let V;
        for (V = 0; V < z.length; V += 1) {
          const Q = L_(O, z, V);
          H[V] ? H[V].p(Q, F) : (H[V] = Y_(Q), H[V].c(), H[V].m(g, null));
        }
        for (; V < H.length; V += 1)
          H[V].d(1);
        H.length = z.length;
      }
      /*$pauli_warning*/
      O[2] ? B ? B.p(O, F) : (B = K_(O), B.c(), B.m(e, null)) : B && (B.d(1), B = null), F & /*$data*/
      2 && I !== (I = Yt(
        /*$data*/
        O[1].num_qubits ? "" : "deactive"
      ) + " svelte-1fuex22") && u(e, "class", I);
    },
    i: ne,
    o: ne,
    d(O) {
      O && C(e), Ye(H, O), B && B.d(), A = !1, wt(M);
    }
  };
}
function r3(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(o, (y) => l(1, i = y)), o), r;
  t.$$.on_destroy.push(() => n());
  let s = Oe();
  at(t, s, (y) => l(2, r = y));
  let { data: o = Oe({}) } = e;
  a();
  const _ = (y, v) => {
    o.update((w) => (w.pauli_obs[y].deactive = !0, w));
  }, c = (y, v) => {
    o.update((w) => (w.pauli_obs[y].deactive = !1, w));
  }, d = (y, v) => {
    o.update((w) => (w.pauli_obs.splice(y, 1), w));
  }, h = (y, v) => {
    o.update((w) => ([w.pauli_obs[y], w.pauli_obs[y - 1]] = [w.pauli_obs[y - 1], w.pauli_obs[y]], w));
  }, p = (y, v) => {
    o.update((w) => ([w.pauli_obs[y], w.pauli_obs[y + 1]] = [w.pauli_obs[y + 1], w.pauli_obs[y]], w));
  }, g = (y, v) => {
    o.update((w) => {
      let q = v.target.value.toUpperCase(), $ = `[iIxXyYzZ]${i.machine_qubits ? `{${i.machine_qubits}}` : "+"}`;
      return w.pauli_obs[y] || (w.pauli_obs[y] = {}), q.match(new RegExp($, "g")) ? (w.pauli_obs[y].observable = q, s.set()) : (w.pauli_obs[y].observable = w.pauli_obs[y].observable, s.set(v.target.value + " is not an allowed Pauli operator.")), w;
    });
  }, b = (y) => {
    o.update((v) => {
      v.pauli_obs || (v.pauli_obs = []);
      let w = i.machine_qubits ? i.machine_qubits : i.num_qubits;
      return v.pauli_obs.push("I".repeat(w)), v;
    });
  }, k = (y) => {
    o.update((v) => {
      v.pauli_obs || (v.pauli_obs = []);
      let w = i.machine_qubits ? i.machine_qubits : i.num_qubits, q = i.num_qubits, $ = i3(w, q);
      return v.pauli_obs = $.map((j) => ({ observable: j })), v;
    });
  };
  return t.$$set = (y) => {
    "data" in y && a(l(0, o = y.data));
  }, [
    o,
    i,
    r,
    s,
    _,
    c,
    d,
    h,
    p,
    g,
    b,
    k
  ];
}
class s3 extends Ve {
  constructor(e) {
    super(), Qe(this, e, r3, a3, Fe, { data: 0 });
  }
}
function U_(t, e, l) {
  const i = t.slice();
  return i[7] = e[l], i;
}
function o3(t) {
  let e;
  return {
    c() {
      e = m("span"), e.textContent = "Auto-selected", u(e, "class", "auto-selected svelte-1q1n3c9");
    },
    m(l, i) {
      S(l, e, i);
    },
    p: ne,
    i: ne,
    o: ne,
    d(l) {
      l && C(e);
    }
  };
}
function u3(t) {
  let e, l, i, n, a, r;
  e = new Nl({
    props: {
      id: "measure-reset",
      checked: !1,
      oncheck: (
        /*func*/
        t[4]
      ),
      label: "Reset"
    }
  }), i = new Nl({
    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 = $e(
    /*$data*/
    t[1].qubits || []
  ), o = [];
  for (let c = 0; c < s.length; c += 1)
    o[c] = W_(U_(t, s, c));
  const _ = (c) => D(o[c], 1, 1, () => {
    o[c] = null;
  });
  return {
    c() {
      pe(e.$$.fragment), l = N(), pe(i.$$.fragment), n = N();
      for (let c = 0; c < o.length; c += 1)
        o[c].c();
      a = Ae();
    },
    m(c, d) {
      de(e, c, d), S(c, l, d), de(i, c, d), S(c, n, d);
      for (let h = 0; h < o.length; h += 1)
        o[h] && o[h].m(c, d);
      S(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 = $e(
          /*$data*/
          c[1].qubits || []
        );
        let g;
        for (g = 0; g < s.length; g += 1) {
          const b = U_(c, s, g);
          o[g] ? (o[g].p(b, d), T(o[g], 1)) : (o[g] = W_(b), o[g].c(), T(o[g], 1), o[g].m(a.parentNode, a));
        }
        for (be(), g = s.length; g < o.length; g += 1)
          _(g);
        ke();
      }
    },
    i(c) {
      if (!r) {
        T(e.$$.fragment, c), T(i.$$.fragment, c);
        for (let d = 0; d < s.length; d += 1)
          T(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 && (C(l), C(n), C(a)), he(e, c), he(i, c), Ye(o, c);
    }
  };
}
function W_(t) {
  var n;
  let e, l;
  function i(...a) {
    return (
      /*func_2*/
      t[6](
        /*item*/
        t[7],
        ...a
      )
    );
  }
  return e = new Nl({
    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() {
      pe(e.$$.fragment);
    },
    m(a, r) {
      de(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 || (T(e.$$.fragment, a), l = !0);
    },
    o(a) {
      D(e.$$.fragment, a), l = !1;
    },
    d(a) {
      he(e, a);
    }
  };
}
function J_(t) {
  let e, l;
  return {
    c() {
      e = m("div"), l = E(
        /*$measure_warning*/
        t[2]
      ), u(e, "class", "warning svelte-1q1n3c9");
    },
    m(i, n) {
      S(i, e, n), f(e, l);
    },
    p(i, n) {
      n & /*$measure_warning*/
      4 && U(
        l,
        /*$measure_warning*/
        i[2]
      );
    },
    d(i) {
      i && C(e);
    }
  };
}
function f3(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g;
  const b = [u3, o3], k = [];
  function y(w, q) {
    return (
      /*$data*/
      w[1].clbits === "auto" ? 0 : 1
    );
  }
  c = y(t), d = k[c] = b[c](t);
  let v = (
    /*$measure_warning*/
    t[2] && J_(t)
  );
  return {
    c() {
      e = m("article"), l = m("h4"), l.textContent = "3a. Measure", i = N(), n = m("div"), a = m("div"), r = m("div"), s = m("label"), s.textContent = "Qubits to measure", o = N(), _ = m("div"), d.c(), h = N(), v && v.c(), u(l, "class", "svelte-1q1n3c9"), u(s, "class", "svelte-1q1n3c9"), u(_, "class", "checkbox-group svelte-1q1n3c9"), u(r, "class", "input-form svelte-1q1n3c9"), u(a, "class", "input-row svelte-1q1n3c9"), u(n, "class", "content-wrap svelte-1q1n3c9"), u(e, "class", p = Yt(
        /*$data*/
        t[1].num_clbits && /*$data*/
        t[1].num_qubits ? "" : "deactive"
      ) + " svelte-1q1n3c9");
    },
    m(w, q) {
      S(w, e, q), f(e, l), f(e, i), f(e, n), f(n, a), f(a, r), f(r, s), f(r, o), f(r, _), k[c].m(_, null), f(e, h), v && v.m(e, null), g = !0;
    },
    p(w, [q]) {
      let $ = c;
      c = y(w), c === $ ? k[c].p(w, q) : (be(), D(k[$], 1, 1, () => {
        k[$] = null;
      }), ke(), d = k[c], d ? d.p(w, q) : (d = k[c] = b[c](w), d.c()), T(d, 1), d.m(_, null)), /*$measure_warning*/
      w[2] ? v ? v.p(w, q) : (v = J_(w), v.c(), v.m(e, null)) : v && (v.d(1), v = null), (!g || q & /*$data*/
      2 && p !== (p = Yt(
        /*$data*/
        w[1].num_clbits && /*$data*/
        w[1].num_qubits ? "" : "deactive"
      ) + " svelte-1q1n3c9")) && u(e, "class", p);
    },
    i(w) {
      g || (T(d), g = !0);
    },
    o(w) {
      D(d), g = !1;
    },
    d(w) {
      w && C(e), k[c].d(), v && v.d();
    }
  };
}
function _3(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(o, (h) => l(1, i = h)), o), r;
  t.$$.on_destroy.push(() => n());
  let s = Oe();
  at(t, s, (h) => l(2, r = h));
  let { data: o = Oe({}) } = e;
  a();
  const _ = (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((g) => {
      var b, k;
      if (g.measure || (g.measure = []), s.set(), p && !g.measure.includes(h)) {
        if (g.num_clbits <= ((b = g.measure) == null ? void 0 : b.length))
          return s.set(`More classical bits are needed to measure the qubit ${h}.`), g;
        g.measure.push(h);
      } else
        !p && g.measure.includes(h) && g.measure.splice(g.measure.indexOf(h), 1);
      return g.num_clbits >= ((k = g.measure) == null ? void 0 : k.length) && s.set(), g;
    });
  };
  return t.$$set = (h) => {
    "data" in h && a(l(0, o = h.data));
  }, [o, i, r, s, _, c, d];
}
class c3 extends Ve {
  constructor(e) {
    super(), Qe(this, e, _3, f3, Fe, { data: 0 });
  }
}
function d3(t) {
  let e, l;
  return e = new c3({ props: { data: (
    /*data*/
    t[2]
  ) } }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(e, i, n), l = !0;
    },
    p: ne,
    i(i) {
      l || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function h3(t) {
  let e, l;
  return e = new s3({ props: { data: (
    /*data*/
    t[2]
  ) } }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(e, i, n), l = !0;
    },
    p: ne,
    i(i) {
      l || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Z_(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j;
  return {
    c() {
      e = m("article"), l = m("h4"), l.textContent = "4. Sharing options", i = N(), n = m("div"), a = m("div"), r = m("label"), r.textContent = "Add sharing options", s = N(), o = m("div"), _ = m("div"), c = m("input"), h = N(), p = m("label"), p.textContent = "QASM 2", g = N(), b = m("div"), k = m("input"), v = N(), w = m("label"), w.textContent = "QASM 3", u(l, "class", "svelte-2993p9"), u(r, "class", "svelte-2993p9"), u(c, "type", "checkbox"), u(c, "id", "reporting-measure"), c.checked = d = /*$data*/
      t[1].sharing.qasm2, u(c, "class", "svelte-2993p9"), u(p, "for", "reporting-measure"), u(p, "class", "svelte-2993p9"), u(_, "class", "checkbox-item svelte-2993p9"), u(k, "type", "checkbox"), u(k, "id", "reporting-measure"), k.checked = y = /*$data*/
      t[1].sharing.qasm3, u(k, "class", "svelte-2993p9"), u(w, "for", "reporting-measure"), u(w, "class", "svelte-2993p9"), u(b, "class", "checkbox-item svelte-2993p9"), u(o, "class", "checkbox-group svelte-2993p9"), u(a, "class", "input-form svelte-2993p9"), u(n, "class", "input-row svelte-2993p9"), u(e, "class", q = Yt(
        /*$data*/
        t[1].num_qubits ? "" : "deactive"
      ) + " svelte-2993p9");
    },
    m(I, A) {
      S(I, e, A), f(e, l), f(e, i), f(e, n), f(n, a), f(a, r), f(a, s), f(a, o), f(o, _), f(_, c), f(_, h), f(_, p), f(o, g), f(o, b), f(b, k), f(b, v), f(b, w), $ || (j = [
        te(
          c,
          "change",
          /*change_handler_2*/
          t[9]
        ),
        te(
          k,
          "change",
          /*change_handler_3*/
          t[10]
        )
      ], $ = !0);
    },
    p(I, A) {
      A & /*$data*/
      2 && d !== (d = /*$data*/
      I[1].sharing.qasm2) && (c.checked = d), A & /*$data*/
      2 && y !== (y = /*$data*/
      I[1].sharing.qasm3) && (k.checked = y), A & /*$data*/
      2 && q !== (q = Yt(
        /*$data*/
        I[1].num_qubits ? "" : "deactive"
      ) + " svelte-2993p9") && u(e, "class", q);
    },
    d(I) {
      I && C(e), $ = !1, wt(j);
    }
  };
}
function p3(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R, P, O, F, L, X, V, Q, Z, ae, se, K, Y, W, J, ee;
  s = new Mw({ props: { data: (
    /*data*/
    t[2]
  ) } }), _ = new l3({ props: { data: (
    /*data*/
    t[2]
  ) } });
  const we = [h3, d3], Re = [];
  function ve(fe, G) {
    return (
      /*$data*/
      fe[1].reporting === "observe" ? 0 : (
        /*$data*/
        fe[1].reporting === "measure" ? 1 : -1
      )
    );
  }
  ~(F = ve(t)) && (L = Re[F] = we[F](t));
  let me = (
    /*$data*/
    t[1].sharing && Z_(t)
  );
  return {
    c() {
      e = m("section"), l = m("h3"), i = E(`Writing a quantum circuit
    `), n = m("button"), n.textContent = "Reset", a = N(), r = m("div"), pe(s.$$.fragment), o = N(), pe(_.$$.fragment), c = N(), d = m("article"), h = m("h4"), h.textContent = "3. Measure? or Observe?", p = N(), g = m("div"), b = m("div"), k = m("label"), k.textContent = "Choose reporting method", y = N(), v = m("div"), w = m("div"), q = m("input"), j = N(), I = m("label"), I.textContent = "Measure", A = N(), M = m("div"), z = m("input"), B = N(), R = m("label"), R.textContent = "Pauli-Observables", O = N(), L && L.c(), X = N(), me && me.c(), V = N(), Q = m("article"), Z = m("h4"), Z.textContent = "Get your circuit code (in Qiskit)", ae = N(), se = m("div"), K = m("button"), K.textContent = "Copy", u(n, "class", "svelte-2993p9"), u(l, "class", "svelte-2993p9"), u(h, "class", "svelte-2993p9"), u(k, "class", "svelte-2993p9"), u(q, "type", "radio"), u(q, "id", "reporting-measure"), u(q, "name", "reporting"), q.checked = $ = /*$data*/
      t[1].reporting === "measure", u(q, "class", "svelte-2993p9"), u(I, "for", "reporting-measure"), u(I, "class", "svelte-2993p9"), u(w, "class", "checkbox-item svelte-2993p9"), u(z, "type", "radio"), u(z, "id", "reporting-observe"), u(z, "name", "reporting"), z.checked = H = /*$data*/
      t[1].reporting === "observe", u(z, "class", "svelte-2993p9"), u(R, "for", "reporting-observe"), u(R, "class", "svelte-2993p9"), u(M, "class", "checkbox-item svelte-2993p9"), u(v, "class", "checkbox-group svelte-2993p9"), u(b, "class", "input-form svelte-2993p9"), u(g, "class", "input-row svelte-2993p9"), u(d, "class", P = Yt(
        /*$data*/
        t[1].num_qubits ? "" : "deactive"
      ) + " svelte-2993p9"), u(Z, "class", "svelte-2993p9"), u(K, "class", "copy-qiskit svelte-2993p9"), u(se, "class", "input-row svelte-2993p9"), u(Q, "class", Y = Yt(
        /*$data*/
        t[1].num_qubits ? "" : "deactive"
      ) + " svelte-2993p9"), u(r, "class", "content svelte-2993p9"), u(e, "class", "circuit-write-wrap svelte-2993p9");
    },
    m(fe, G) {
      S(fe, e, G), f(e, l), f(l, i), f(l, n), f(e, a), f(e, r), de(s, r, null), f(r, o), de(_, r, null), f(r, c), f(r, d), f(d, h), f(d, p), f(d, g), f(g, b), f(b, k), f(b, y), f(b, v), f(v, w), f(w, q), f(w, j), f(w, I), f(v, A), f(v, M), f(M, z), f(M, B), f(M, R), f(r, O), ~F && Re[F].m(r, null), f(r, X), me && me.m(r, null), f(r, V), f(r, Q), f(Q, Z), f(Q, ae), f(Q, se), f(se, K), W = !0, J || (ee = [
        te(
          n,
          "click",
          /*click_handler*/
          t[6]
        ),
        te(
          q,
          "change",
          /*change_handler*/
          t[7]
        ),
        te(
          z,
          "change",
          /*change_handler_1*/
          t[8]
        ),
        te(
          K,
          "click",
          /*click_handler_1*/
          t[11]
        )
      ], J = !0);
    },
    p(fe, [G]) {
      (!W || G & /*$data*/
      2 && $ !== ($ = /*$data*/
      fe[1].reporting === "measure")) && (q.checked = $), (!W || G & /*$data*/
      2 && H !== (H = /*$data*/
      fe[1].reporting === "observe")) && (z.checked = H), (!W || G & /*$data*/
      2 && P !== (P = Yt(
        /*$data*/
        fe[1].num_qubits ? "" : "deactive"
      ) + " svelte-2993p9")) && u(d, "class", P);
      let ye = F;
      F = ve(fe), F === ye ? ~F && Re[F].p(fe, G) : (L && (be(), D(Re[ye], 1, 1, () => {
        Re[ye] = null;
      }), ke()), ~F ? (L = Re[F], L ? L.p(fe, G) : (L = Re[F] = we[F](fe), L.c()), T(L, 1), L.m(r, X)) : L = null), /*$data*/
      fe[1].sharing ? me ? me.p(fe, G) : (me = Z_(fe), me.c(), me.m(r, V)) : me && (me.d(1), me = null), (!W || G & /*$data*/
      2 && Y !== (Y = Yt(
        /*$data*/
        fe[1].num_qubits ? "" : "deactive"
      ) + " svelte-2993p9")) && u(Q, "class", Y);
    },
    i(fe) {
      W || (T(s.$$.fragment, fe), T(_.$$.fragment, fe), T(L), W = !0);
    },
    o(fe) {
      D(s.$$.fragment, fe), D(_.$$.fragment, fe), D(L), W = !1;
    },
    d(fe) {
      fe && C(e), he(s), he(_), ~F && Re[F].d(), me && me.d(), J = !1, wt(ee);
    }
  };
}
function m3(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}`, _ = () => count = n.get(r), c = Oe({});
  at(t, c, (v) => l(1, i = v));
  let d = Oe({});
  Tt(() => {
    n.get(r) && l(0, s = JSON.parse(n.get(r))), n.get(a), c.subscribe((v) => {
      var w, q, $, j, I;
      v.operations && (v.num_operations = ((q = (w = v.operations) == null ? void 0 : w.filter((A) => !A.deactive)) == null ? void 0 : q.length) || 0), v.pauli_obs && (v.num_pauli_obs = ((j = ($ = v.pauli_obs) == null ? void 0 : $.filter((A) => !A.deactive)) == null ? void 0 : j.length) || 0, v.pauli_obs.forEach((A) => {
        A.observable.length < v.machine_qubits ? A.observable = A.observable + "I".repeat(v.machine_qubits - A.observable.length) : A.observable.length > v.machine_qubits && (A.observable = A.observable.substring(0, v.machine_qubits));
      })), v.machine && (v.machine_qubits = (I = yl[v.machine]) == null ? void 0 : I.n_qubits, yl[v.machine].sim ? yl[v.machine].machine ? (v.no_sim = !1, v.no_machine = !1) : (v.no_machine = !0, v.no_sim = !1, v.is_simulator = !0) : (v.no_sim = !0, v.no_machine = !1, v.is_simulator = !1), v.no_sim || v.no_machine ? v.sim_not_choosable = !0 : v.sim_not_choosable = !1), v.measure && v.measure.length > 0 && v.measure.sort(), d.set(xf(v));
    }), d.subscribe((v) => {
      n.set(a, v), n.save_changes();
    }), c.set({
      machine: "Aer",
      is_simulator: s == null ? void 0 : s.is_simulator,
      sharing: { qasm2: !1, qasm3: !1 }
    }), n.on(o, _);
  }), ri(() => {
    n.off(o, _);
  });
  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 = (v) => {
    c.update((w) => (v.target.checked && (w.reporting = "measure"), w));
  }, g = (v) => {
    c.update((w) => (v.target.checked && (w.reporting = "observe"), w));
  }, b = (v) => {
    c.update((w) => (Ta(c, i.sharing.qasm2 = v.target.checked, i), w));
  }, k = (v) => {
    c.update((w) => (Ta(c, i.sharing.qasm3 = v.target.checked, i), w));
  }, y = (v) => {
    ei(xf(i));
  };
  return t.$$set = (v) => {
    "model" in v && l(3, n = v.model), "key_circ" in v && l(4, a = v.key_circ), "key_machine" in v && l(5, r = v.key_machine);
  }, [
    s,
    i,
    c,
    n,
    a,
    r,
    h,
    p,
    g,
    b,
    k,
    y
  ];
}
class g3 extends Ve {
  constructor(e) {
    super(), Qe(this, e, m3, p3, Fe, { model: 3, key_circ: 4, key_machine: 5 });
  }
}
const Cl = [
  {
    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",
  }
], ct = {
  // 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)"
}, bt = {
  // 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."
}, b3 = {
  // 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 x_(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} = ${b3[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 ec(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 a0(t) {
  let e = new Date(t);
  return "datetime(" + [
    e.getFullYear(),
    e.getMonth(),
    e.getDate(),
    e.getHours(),
    e.getMinutes(),
    e.getSeconds(),
    e.getMilliseconds()
  ].join(", ") + ")";
}
function k3(t) {
  let e, l, i, n, a, r = (
    /*hide*/
    t[2] ? "Open" : "Close"
  ), s, o, _, c = (
    /*note*/
    t[1] && tc(t)
  );
  return {
    c() {
      e = m("h2"), l = E(
        /*title*/
        t[0]
      ), i = N(), c && c.c(), n = N(), a = m("button"), s = E(r), u(a, "class", "svelte-agu7v9"), u(e, "class", "svelte-agu7v9");
    },
    m(d, h) {
      S(d, e, h), f(e, l), f(e, i), c && c.m(e, null), f(e, n), f(e, a), f(a, s), o || (_ = te(
        a,
        "click",
        /*click_handler_1*/
        t[6]
      ), o = !0);
    },
    p(d, h) {
      h & /*title*/
      1 && U(
        l,
        /*title*/
        d[0]
      ), /*note*/
      d[1] ? c ? c.p(d, h) : (c = tc(d), c.c(), c.m(e, n)) : c && (c.d(1), c = null), h & /*hide*/
      4 && r !== (r = /*hide*/
      d[2] ? "Open" : "Close") && U(s, r);
    },
    d(d) {
      d && C(e), c && c.d(), o = !1, _();
    }
  };
}
function v3(t) {
  let e, l, i, n, a, r = (
    /*hide*/
    t[2] ? "Open" : "Close"
  ), s, o, _, c = (
    /*note*/
    t[1] && lc(t)
  );
  return {
    c() {
      e = m("h1"), l = E(
        /*title*/
        t[0]
      ), i = N(), c && c.c(), n = N(), a = m("button"), s = E(r), u(a, "class", "svelte-agu7v9"), u(e, "class", "svelte-agu7v9");
    },
    m(d, h) {
      S(d, e, h), f(e, l), f(e, i), c && c.m(e, null), f(e, n), f(e, a), f(a, s), o || (_ = te(
        a,
        "click",
        /*click_handler*/
        t[5]
      ), o = !0);
    },
    p(d, h) {
      h & /*title*/
      1 && U(
        l,
        /*title*/
        d[0]
      ), /*note*/
      d[1] ? c ? c.p(d, h) : (c = lc(d), c.c(), c.m(e, n)) : c && (c.d(1), c = null), h & /*hide*/
      4 && r !== (r = /*hide*/
      d[2] ? "Open" : "Close") && U(s, r);
    },
    d(d) {
      d && C(e), c && c.d(), o = !1, _();
    }
  };
}
function tc(t) {
  let e, l;
  return {
    c() {
      e = m("small"), l = E(
        /*note*/
        t[1]
      ), u(e, "class", "svelte-agu7v9");
    },
    m(i, n) {
      S(i, e, n), f(e, l);
    },
    p(i, n) {
      n & /*note*/
      2 && U(
        l,
        /*note*/
        i[1]
      );
    },
    d(i) {
      i && C(e);
    }
  };
}
function lc(t) {
  let e, l;
  return {
    c() {
      e = m("small"), l = E(
        /*note*/
        t[1]
      ), u(e, "class", "svelte-agu7v9");
    },
    m(i, n) {
      S(i, e, n), f(e, l);
    },
    p(i, n) {
      n & /*note*/
      2 && U(
        l,
        /*note*/
        i[1]
      );
    },
    d(i) {
      i && C(e);
    }
  };
}
function y3(t) {
  let e;
  function l(a, r) {
    if (
      /*level*/
      a[3] == 1
    )
      return v3;
    if (
      /*level*/
      a[3] == 2
    )
      return k3;
  }
  let i = l(t), n = i && i(t);
  return {
    c() {
      n && n.c(), e = Ae();
    },
    m(a, r) {
      n && n.m(a, r), S(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: ne,
    o: ne,
    d(a) {
      a && C(e), n && n.d(a);
    }
  };
}
function w3(t, e, l) {
  let { title: i = "", note: n, hide: a, level: r = 1 } = e, { toggleSection: s = () => {
  } } = e;
  const o = () => {
    s();
  }, _ = () => {
    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, _];
}
class r0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, w3, y3, Fe, {
      title: 0,
      note: 1,
      hide: 2,
      level: 3,
      toggleSection: 4
    });
  }
}
function $3(t) {
  let e, l;
  return {
    c() {
      e = Ge("svg"), l = Ge("path"), u(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"), u(e, "xmlns", "http://www.w3.org/2000/svg"), u(e, "width", "16"), u(e, "height", "16"), u(e, "fill", "currentColor"), u(e, "class", "bi bi-cart"), u(e, "viewBox", "0 0 16 16");
    },
    m(i, n) {
      S(i, e, n), f(e, l);
    },
    d(i) {
      i && C(e);
    }
  };
}
function q3(t) {
  let e, l;
  return {
    c() {
      e = Ge("svg"), l = Ge("path"), u(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"), u(e, "xmlns", "http://www.w3.org/2000/svg"), u(e, "width", "16"), u(e, "height", "16"), u(e, "fill", "currentColor"), u(e, "class", "bi bi-cart-check-fill"), u(e, "viewBox", "0 0 16 16");
    },
    m(i, n) {
      S(i, e, n), f(e, l);
    },
    d(i) {
      i && C(e);
    }
  };
}
function j3(t) {
  let e;
  function l(a, r) {
    return (
      /*on*/
      a[0] ? q3 : $3
    );
  }
  let i = l(t), n = i(t);
  return {
    c() {
      n.c(), e = Ae();
    },
    m(a, r) {
      n.m(a, r), S(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: ne,
    o: ne,
    d(a) {
      a && C(e), n.d(a);
    }
  };
}
function T3(t, e, l) {
  let { on: i = !1 } = e;
  return t.$$set = (n) => {
    "on" in n && l(0, i = n.on);
  }, [i];
}
class zt extends Ve {
  constructor(e) {
    super(), Qe(this, e, T3, j3, Fe, { on: 0 });
  }
}
function ic(t, e, l) {
  const i = t.slice();
  return i[8] = e[l], i[10] = l, i;
}
function nc(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[5].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1wl619s");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function C3(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), u(e, "class", "svelte-1wl619s");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function S3(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), u(e, "class", "svelte-1wl619s");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function M3(t) {
  let e;
  return {
    c() {
      e = E(
        /*value*/
        t[1]
      );
    },
    m(l, i) {
      S(l, e, i);
    },
    p(l, i) {
      i & /*value*/
      2 && U(
        e,
        /*value*/
        l[1]
      );
    },
    i: ne,
    o: ne,
    d(l) {
      l && C(e);
    }
  };
}
function z3(t) {
  let e = (
    /*value*/
    t[1].join(", ") + ""
  ), l;
  return {
    c() {
      l = E(e);
    },
    m(i, n) {
      S(i, l, n);
    },
    p(i, n) {
      n & /*value*/
      2 && e !== (e = /*value*/
      i[1].join(", ") + "") && U(l, e);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(l);
    }
  };
}
function N3(t) {
  let e, l, i = $e(
    /*value*/
    t[1]
  ), n = [];
  for (let r = 0; r < i.length; r += 1)
    n[r] = rc(ic(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 = Ae();
    },
    m(r, s) {
      for (let o = 0; o < n.length; o += 1)
        n[o] && n[o].m(r, s);
      S(r, e, s), l = !0;
    },
    p(r, s) {
      if (s & /*value, addToBasket, $basket*/
      38) {
        i = $e(
          /*value*/
          r[1]
        );
        let o;
        for (o = 0; o < i.length; o += 1) {
          const _ = ic(r, i, o);
          n[o] ? (n[o].p(_, s), T(n[o], 1)) : (n[o] = rc(_), n[o].c(), T(n[o], 1), n[o].m(e.parentNode, e));
        }
        for (be(), o = i.length; o < n.length; o += 1)
          a(o);
        ke();
      }
    },
    i(r) {
      if (!l) {
        for (let s = 0; s < i.length; s += 1)
          T(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 && C(e), Ye(n, r);
    }
  };
}
function ac(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-1wl619s");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o & /*$basket*/
      32 && (_.on = /*$basket*/
      t[5].includes(`meas_map_${/*i*/
      t[10]} = backend.meas_map[${/*i*/
      t[10]}]`)), l.$set(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function rc(t) {
  let e, l, i, n = (
    /*i*/
    t[10] + 1 + ""
  ), a, r, s, o = (
    /*v*/
    t[8].join(", ") + ""
  ), _, c, d, h = (
    /*addToBasket*/
    t[2] && ac(t)
  );
  return {
    c() {
      e = m("div"), l = m("strong"), i = E("Group "), a = E(n), r = N(), h && h.c(), s = N(), _ = E(o), c = N(), u(l, "class", "svelte-1wl619s"), u(e, "class", "meas_grouping svelte-1wl619s");
    },
    m(p, g) {
      S(p, e, g), f(e, l), f(l, i), f(l, a), f(l, r), h && h.m(l, null), f(e, s), f(e, _), f(e, c), d = !0;
    },
    p(p, g) {
      /*addToBasket*/
      p[2] ? h ? (h.p(p, g), g & /*addToBasket*/
      4 && T(h, 1)) : (h = ac(p), h.c(), T(h, 1), h.m(l, null)) : h && (be(), D(h, 1, 1, () => {
        h = null;
      }), ke()), (!d || g & /*value*/
      2) && o !== (o = /*v*/
      p[8].join(", ") + "") && U(_, o);
    },
    i(p) {
      d || (T(h), d = !0);
    },
    o(p) {
      D(h), d = !1;
    },
    d(p) {
      p && C(e), h && h.d();
    }
  };
}
function sc(t) {
  let e, l = bt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), u(e, "class", "desc svelte-1wl619s");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = bt[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function A3(t) {
  let e, l, i, n, a, r, s, o, _ = (
    /*addToBasket*/
    t[2] && nc(t)
  );
  function c(y, v) {
    if (
      /*level*/
      y[4] == 1
    )
      return S3;
    if (
      /*level*/
      y[4] == 2
    )
      return C3;
  }
  let d = c(t), h = d && d(t);
  const p = [N3, z3, M3], g = [];
  function b(y, v) {
    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 = b(t)) && (r = g[a] = p[a](t));
  let k = bt[
    /*key*/
    t[0]
  ] && sc(t);
  return {
    c() {
      e = m("article"), _ && _.c(), l = N(), h && h.c(), i = N(), n = m("div"), r && r.c(), s = N(), k && k.c(), u(n, "class", "value svelte-1wl619s"), u(e, "class", "svelte-1wl619s");
    },
    m(y, v) {
      S(y, e, v), _ && _.m(e, null), f(e, l), h && h.m(e, null), f(e, i), f(e, n), ~a && g[a].m(n, null), f(e, s), k && k.m(e, null), o = !0;
    },
    p(y, [v]) {
      /*addToBasket*/
      y[2] ? _ ? (_.p(y, v), v & /*addToBasket*/
      4 && T(_, 1)) : (_ = nc(y), _.c(), T(_, 1), _.m(e, l)) : _ && (be(), D(_, 1, 1, () => {
        _ = null;
      }), ke()), d === (d = c(y)) && h ? h.p(y, v) : (h && h.d(1), h = d && d(y), h && (h.c(), h.m(e, i)));
      let w = a;
      a = b(y), a === w ? ~a && g[a].p(y, v) : (r && (be(), D(g[w], 1, 1, () => {
        g[w] = null;
      }), ke()), ~a ? (r = g[a], r ? r.p(y, v) : (r = g[a] = p[a](y), r.c()), T(r, 1), r.m(n, null)) : r = null), bt[
        /*key*/
        y[0]
      ] ? k ? k.p(y, v) : (k = sc(y), k.c(), k.m(e, null)) : k && (k.d(1), k = null);
    },
    i(y) {
      o || (T(_), T(r), o = !0);
    },
    o(y) {
      D(_), D(r), o = !1;
    },
    d(y) {
      y && C(e), _ && _.d(), h && h.d(), ~a && g[a].d(), k && k.d();
    }
  };
}
function B3(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (p) => l(5, i = p)), _);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: _, 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, _ = p.basket)), "level" in p && l(4, c = p.level);
  }, [
    r,
    s,
    o,
    _,
    c,
    i,
    d,
    h
  ];
}
class Ya extends Ve {
  constructor(e) {
    super(), Qe(this, e, B3, A3, Fe, {
      key: 0,
      value: 1,
      addToBasket: 2,
      basket: 3,
      level: 4
    });
  }
}
function P3(t) {
  let e, l, i, n;
  return {
    c() {
      e = Ge("svg"), l = Ge("path"), i = Ge("path"), n = Ge("path"), u(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"), u(i, "d", "M8 1a7 7 0 1 0 4.95 11.95l.707.707A8.001 8.001 0 1 1 8 0z"), u(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"), u(e, "xmlns", "http://www.w3.org/2000/svg"), u(e, "width", "16"), u(e, "height", "16"), u(e, "fill", "currentColor"), u(e, "class", "bi bi-clock-history"), u(e, "viewBox", "0 0 16 16");
    },
    m(a, r) {
      S(a, e, r), f(e, l), f(e, i), f(e, n);
    },
    p: ne,
    i: ne,
    o: ne,
    d(a) {
      a && C(e);
    }
  };
}
class ql extends Ve {
  constructor(e) {
    super(), Qe(this, e, null, P3, Fe, {});
  }
}
function oc(t, e, l) {
  const i = t.slice();
  return i[9] = e[l], i[16] = l, i;
}
function uc(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(
          /*key*/
          t[9]
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-jt5wrr");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function O3(t) {
  let e, l = ct[
    /*key*/
    t[9]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), u(e, "class", "svelte-jt5wrr");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      512 && l !== (l = ct[
        /*key*/
        n[9]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function E3(t) {
  let e, l = ct[
    /*key*/
    t[9]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), u(e, "class", "svelte-jt5wrr");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      512 && l !== (l = ct[
        /*key*/
        n[9]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function fc(t) {
  let e;
  return {
    c() {
      e = m("th"), e.textContent = "T", u(e, "class", "svelte-jt5wrr");
    },
    m(l, i) {
      S(l, e, i);
    },
    d(l) {
      l && C(e);
    }
  };
}
function _c(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-jt5wrr");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o & /*$basket, value, code_header, code_footer*/
      1073 && (_.on = /*$basket*/
      t[10].includes(`${/*key*/
      t[9]}_${/*ki*/
      t[16]} = ${/*code_header*/
      t[4]}${/*key*/
      t[9]}${/*code_footer*/
      t[5]}`)), l.$set(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function cc(t) {
  let e, l, i, n, a, r;
  i = new ql({});
  function s() {
    return (
      /*click_handler_2*/
      t[14](
        /*key*/
        t[9]
      )
    );
  }
  return {
    c() {
      e = m("td"), l = m("button"), pe(i.$$.fragment), u(l, "class", "basket svelte-jt5wrr"), u(e, "class", "svelte-jt5wrr");
    },
    m(o, _) {
      S(o, e, _), f(e, l), de(i, l, null), n = !0, a || (r = te(l, "click", s), a = !0);
    },
    p(o, _) {
      t = o;
    },
    i(o) {
      n || (T(i.$$.fragment, o), n = !0);
    },
    o(o) {
      D(i.$$.fragment, o), n = !1;
    },
    d(o) {
      o && C(e), he(i), a = !1, r();
    }
  };
}
function dc(t) {
  let e, l, i = (
    /*key*/
    t[9] + ""
  ), n, a, r = (
    /*value*/
    t[0][
      /*key*/
      t[9]
    ].value + ""
  ), s, o, _ = (
    /*value*/
    t[0][
      /*key*/
      t[9]
    ].unit + ""
  ), c, d, h = (
    /*value*/
    t[0][
      /*key*/
      t[9]
    ].asof + ""
  ), p, g, b, k, y, v, w = (
    /*addToBasket*/
    t[1] && _c(t)
  ), q = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && cc(t)
  );
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = m("td"), s = E(r), o = m("td"), c = E(_), d = m("td"), p = E(h), g = N(), b = m("td"), w && w.c(), k = N(), q && q.c(), y = N(), u(l, "class", "svelte-jt5wrr"), u(a, "class", "svelte-jt5wrr"), u(o, "class", "svelte-jt5wrr"), u(d, "class", "svelte-jt5wrr"), u(b, "class", "svelte-jt5wrr");
    },
    m($, j) {
      S($, e, j), f(e, l), f(l, n), f(e, a), f(a, s), f(e, o), f(o, c), f(e, d), f(d, p), f(e, g), f(e, b), w && w.m(b, null), f(e, k), q && q.m(e, null), f(e, y), v = !0;
    },
    p($, j) {
      (!v || j & /*value*/
      1) && i !== (i = /*key*/
      $[9] + "") && U(n, i), (!v || j & /*value*/
      1) && r !== (r = /*value*/
      $[0][
        /*key*/
        $[9]
      ].value + "") && U(s, r), (!v || j & /*value*/
      1) && _ !== (_ = /*value*/
      $[0][
        /*key*/
        $[9]
      ].unit + "") && U(c, _), (!v || j & /*value*/
      1) && h !== (h = /*value*/
      $[0][
        /*key*/
        $[9]
      ].asof + "") && U(p, h), /*addToBasket*/
      $[1] ? w ? (w.p($, j), j & /*addToBasket*/
      2 && T(w, 1)) : (w = _c($), w.c(), T(w, 1), w.m(b, null)) : w && (be(), D(w, 1, 1, () => {
        w = null;
      }), ke()), /*topLevelKey*/
      $[7] === "properties" && /*openTimeMachine*/
      $[8] ? q ? (q.p($, j), j & /*topLevelKey, openTimeMachine*/
      384 && T(q, 1)) : (q = cc($), q.c(), T(q, 1), q.m(e, y)) : q && (be(), D(q, 1, 1, () => {
        q = null;
      }), ke());
    },
    i($) {
      v || (T(w), T(q), v = !0);
    },
    o($) {
      D(w), D(q), v = !1;
    },
    d($) {
      $ && C(e), w && w.d(), q && q.d();
    }
  };
}
function hc(t) {
  let e, l = bt[
    /*key*/
    t[9]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), u(e, "class", "desc svelte-jt5wrr");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      512 && l !== (l = bt[
        /*key*/
        n[9]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function I3(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j = (
    /*addToBasket*/
    t[1] && uc(t)
  );
  function I(O, F) {
    if (
      /*level*/
      O[3] == 1
    )
      return E3;
    if (
      /*level*/
      O[3] == 2
    )
      return O3;
  }
  let A = I(t), M = A && A(t), z = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && fc()
  ), H = $e(Object.keys(
    /*value*/
    t[0]
  )), B = [];
  for (let O = 0; O < H.length; O += 1)
    B[O] = dc(oc(t, H, O));
  const R = (O) => D(B[O], 1, 1, () => {
    B[O] = null;
  });
  let P = bt[
    /*key*/
    t[9]
  ] && hc(t);
  return {
    c() {
      e = m("article"), j && j.c(), l = N(), M && M.c(), i = N(), n = m("div"), a = m("table"), r = m("thead"), s = m("tr"), o = m("th"), o.textContent = "Name", _ = N(), c = m("th"), c.textContent = "Value", d = N(), h = m("th"), h.textContent = "Unit", p = N(), g = m("th"), g.textContent = "As of", b = N(), k = m("th"), k.textContent = "-", y = N(), z && z.c(), v = N(), w = m("tbody");
      for (let O = 0; O < B.length; O += 1)
        B[O].c();
      q = N(), P && P.c(), u(o, "class", "svelte-jt5wrr"), u(c, "class", "svelte-jt5wrr"), u(h, "class", "svelte-jt5wrr"), u(g, "class", "svelte-jt5wrr"), u(k, "class", "svelte-jt5wrr"), u(r, "class", "svelte-jt5wrr"), u(a, "class", "svelte-jt5wrr"), u(n, "class", "value svelte-jt5wrr"), u(e, "class", "svelte-jt5wrr");
    },
    m(O, F) {
      S(O, e, F), j && j.m(e, null), f(e, l), M && M.m(e, null), f(e, i), f(e, n), f(n, a), f(a, r), f(r, s), f(s, o), f(s, _), f(s, c), f(s, d), f(s, h), f(s, p), f(s, g), f(s, b), f(s, k), f(s, y), z && z.m(s, null), f(a, v), f(a, w);
      for (let L = 0; L < B.length; L += 1)
        B[L] && B[L].m(w, null);
      f(e, q), P && P.m(e, null), $ = !0;
    },
    p(O, [F]) {
      if (/*addToBasket*/
      O[1] ? j ? (j.p(O, F), F & /*addToBasket*/
      2 && T(j, 1)) : (j = uc(O), j.c(), T(j, 1), j.m(e, l)) : j && (be(), D(j, 1, 1, () => {
        j = null;
      }), ke()), A === (A = I(O)) && M ? M.p(O, F) : (M && M.d(1), M = A && A(O), M && (M.c(), M.m(e, i))), /*topLevelKey*/
      O[7] === "properties" && /*openTimeMachine*/
      O[8] ? z || (z = fc(), z.c(), z.m(s, null)) : z && (z.d(1), z = null), F & /*openTimeMachine, Object, value, parentKey, topLevelKey, code_header, code_footer, addToBasket, $basket*/
      1523) {
        H = $e(Object.keys(
          /*value*/
          O[0]
        ));
        let L;
        for (L = 0; L < H.length; L += 1) {
          const X = oc(O, H, L);
          B[L] ? (B[L].p(X, F), T(B[L], 1)) : (B[L] = dc(X), B[L].c(), T(B[L], 1), B[L].m(w, null));
        }
        for (be(), L = H.length; L < B.length; L += 1)
          R(L);
        ke();
      }
      bt[
        /*key*/
        O[9]
      ] ? P ? P.p(O, F) : (P = hc(O), P.c(), P.m(e, null)) : P && (P.d(1), P = null);
    },
    i(O) {
      if (!$) {
        T(j);
        for (let F = 0; F < H.length; F += 1)
          T(B[F]);
        $ = !0;
      }
    },
    o(O) {
      D(j), B = B.filter(Boolean);
      for (let F = 0; F < B.length; F += 1)
        D(B[F]);
      $ = !1;
    },
    d(O) {
      O && C(e), j && j.d(), M && M.d(), z && z.d(), Ye(B, O), P && P.d();
    }
  };
}
function D3(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (q) => l(10, i = q)), _);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: _, level: c = 1, code_header: d = "", code_type: h = "", code_footer: p = "", parentKey: g = "", topLevelKey: b = "", openTimeMachine: k } = e;
  a();
  const y = () => {
    o(r);
  }, v = (q, $) => {
    o(`${q}_${$} = ${d}${q}${p}`);
  }, w = (q) => {
    k({
      datatype: "nudv-map",
      key: q,
      title_key: q,
      parentKey: g,
      topLevelKey: b,
      data: s[q],
      code_header: d,
      code_key: q,
      code_footer: p
    });
  };
  return t.$$set = (q) => {
    "key" in q && l(9, r = q.key), "value" in q && l(0, s = q.value), "addToBasket" in q && l(1, o = q.addToBasket), "basket" in q && a(l(2, _ = q.basket)), "level" in q && l(3, c = q.level), "code_header" in q && l(4, d = q.code_header), "code_type" in q && l(11, h = q.code_type), "code_footer" in q && l(5, p = q.code_footer), "parentKey" in q && l(6, g = q.parentKey), "topLevelKey" in q && l(7, b = q.topLevelKey), "openTimeMachine" in q && l(8, k = q.openTimeMachine);
  }, [
    s,
    o,
    _,
    c,
    d,
    p,
    g,
    b,
    k,
    r,
    i,
    h,
    y,
    v,
    w
  ];
}
class R3 extends Ve {
  constructor(e) {
    super(), Qe(this, e, D3, I3, Fe, {
      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 pc(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 gc(t, e, l) {
  const i = t.slice();
  return i[26] = e[l], i;
}
function bc(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[13].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1xxiico");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function H3(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), u(e, "class", "svelte-1xxiico");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function L3(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), u(e, "class", "svelte-1xxiico");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function kc(t) {
  let e, l = (
    /*g*/
    t[26] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*g*/
      t[26], pt(e, e.__value), e.selected = a = /*filter*/
      t[10].gates.includes(
        /*g*/
        t[26]
      );
    },
    m(r, s) {
      S(r, e, s), f(e, i);
    },
    p(r, s) {
      s & /*gates*/
      2048 && l !== (l = /*g*/
      r[26] + "") && U(i, l), s & /*gates*/
      2048 && n !== (n = /*g*/
      r[26]) && (e.__value = n, pt(e, e.__value)), s & /*filter, gates*/
      3072 && a !== (a = /*filter*/
      r[10].gates.includes(
        /*g*/
        r[26]
      )) && (e.selected = a);
    },
    d(r) {
      r && C(e);
    }
  };
}
function vc(t) {
  let e, l = (
    /*g*/
    t[26] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*g*/
      t[26], pt(e, e.__value), e.selected = a = /*filter*/
      t[10].qubits.includes(
        /*g*/
        t[26]
      );
    },
    m(r, s) {
      S(r, e, s), f(e, i);
    },
    p(r, s) {
      s & /*qubits*/
      4096 && l !== (l = /*g*/
      r[26] + "") && U(i, l), s & /*qubits*/
      4096 && n !== (n = /*g*/
      r[26]) && (e.__value = n, pt(e, e.__value)), s & /*filter, qubits*/
      5120 && a !== (a = /*filter*/
      r[10].qubits.includes(
        /*g*/
        r[26]
      )) && (e.selected = a);
    },
    d(r) {
      r && C(e);
    }
  };
}
function yc(t) {
  let e;
  return {
    c() {
      e = m("th"), e.textContent = "T", u(e, "class", "svelte-1xxiico");
    },
    m(l, i) {
      S(l, e, i);
    },
    d(l) {
      l && C(e);
    }
  };
}
function wc(t) {
  var ae, se, K, Y;
  let e, l, i = (
    /*gate*/
    t[23].gate + ""
  ), n, a, r, s = (
    /*gate*/
    t[23].qubits.join(",") + ""
  ), o, _, c, d = (
    /*gate*/
    ((ae = t[23].parameters.gate_error) == null ? void 0 : ae.value) + ""
  ), h, p, g, b, k = (
    /*gate*/
    ((se = t[23].parameters.gate_error) == null ? void 0 : se.asof) + ""
  ), y, v, w, q = (
    /*gate*/
    ((K = t[23].parameters.gate_length) == null ? void 0 : K.value) + ""
  ), $, j, I = (
    /*gate*/
    t[23].parameters.gate_length.unit + ""
  ), A, M, z, H, B, R = (
    /*gate*/
    ((Y = t[23].parameters.gate_length) == null ? void 0 : Y.asof) + ""
  ), P, O, F, L, X, V, Q = (
    /*addToBasket*/
    t[2] && $c(t)
  ), Z = (
    /*topLevelKey*/
    t[8] === "properties" && /*openTimeMachine*/
    t[9] && qc(t)
  );
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = N(), r = m("td"), o = E(s), _ = N(), c = m("td"), h = E(d), p = m("br"), g = N(), b = m("span"), y = E(k), v = N(), w = m("td"), $ = E(q), j = E(" ("), A = E(I), M = E(")"), z = m("br"), H = N(), B = m("span"), P = E(R), O = N(), F = m("td"), Q && Q.c(), L = N(), Z && Z.c(), X = N(), u(l, "class", "svelte-1xxiico"), u(r, "class", "svelte-1xxiico"), u(b, "class", "asof svelte-1xxiico"), u(c, "class", "svelte-1xxiico"), u(B, "class", "asof svelte-1xxiico"), u(w, "class", "svelte-1xxiico"), u(F, "class", "svelte-1xxiico");
    },
    m(W, J) {
      S(W, e, J), f(e, l), f(l, n), f(e, a), f(e, r), f(r, o), f(e, _), f(e, c), f(c, h), f(c, p), f(c, g), f(c, b), f(b, y), f(e, v), f(e, w), f(w, $), f(w, j), f(w, A), f(w, M), f(w, z), f(w, H), f(w, B), f(B, P), f(e, O), f(e, F), Q && Q.m(F, null), f(e, L), Z && Z.m(e, null), f(e, X), V = !0;
    },
    p(W, J) {
      var ee, we, Re, ve;
      (!V || J & /*value*/
      2) && i !== (i = /*gate*/
      W[23].gate + "") && U(n, i), (!V || J & /*value*/
      2) && s !== (s = /*gate*/
      W[23].qubits.join(",") + "") && U(o, s), (!V || J & /*value*/
      2) && d !== (d = /*gate*/
      ((ee = W[23].parameters.gate_error) == null ? void 0 : ee.value) + "") && U(h, d), (!V || J & /*value*/
      2) && k !== (k = /*gate*/
      ((we = W[23].parameters.gate_error) == null ? void 0 : we.asof) + "") && U(y, k), (!V || J & /*value*/
      2) && q !== (q = /*gate*/
      ((Re = W[23].parameters.gate_length) == null ? void 0 : Re.value) + "") && U($, q), (!V || J & /*value*/
      2) && I !== (I = /*gate*/
      W[23].parameters.gate_length.unit + "") && U(A, I), (!V || J & /*value*/
      2) && R !== (R = /*gate*/
      ((ve = W[23].parameters.gate_length) == null ? void 0 : ve.asof) + "") && U(P, R), /*addToBasket*/
      W[2] ? Q ? (Q.p(W, J), J & /*addToBasket*/
      4 && T(Q, 1)) : (Q = $c(W), Q.c(), T(Q, 1), Q.m(F, null)) : Q && (be(), D(Q, 1, 1, () => {
        Q = null;
      }), ke()), /*topLevelKey*/
      W[8] === "properties" && /*openTimeMachine*/
      W[9] ? Z ? (Z.p(W, J), J & /*topLevelKey, openTimeMachine*/
      768 && T(Z, 1)) : (Z = qc(W), Z.c(), T(Z, 1), Z.m(e, X)) : Z && (be(), D(Z, 1, 1, () => {
        Z = null;
      }), ke());
    },
    i(W) {
      V || (T(Q), T(Z), V = !0);
    },
    o(W) {
      D(Q), D(Z), V = !1;
    },
    d(W) {
      W && C(e), Q && Q.d(), Z && Z.d();
    }
  };
}
function $c(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-1xxiico");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o & /*$basket, value, code_header, code_footer*/
      8290 && (_.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(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function qc(t) {
  let e, l, i, n, a, r;
  i = new ql({});
  function s() {
    return (
      /*click_handler_4*/
      t[22](
        /*gate*/
        t[23],
        /*gi*/
        t[25]
      )
    );
  }
  return {
    c() {
      e = m("td"), l = m("button"), pe(i.$$.fragment), u(l, "class", "basket svelte-1xxiico"), u(e, "class", "svelte-1xxiico");
    },
    m(o, _) {
      S(o, e, _), f(e, l), de(i, l, null), n = !0, a || (r = te(l, "click", s), a = !0);
    },
    p(o, _) {
      t = o;
    },
    i(o) {
      n || (T(i.$$.fragment, o), n = !0);
    },
    o(o) {
      D(i.$$.fragment, o), n = !1;
    },
    d(o) {
      o && C(e), he(i), a = !1, r();
    }
  };
}
function jc(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 && wc(t);
  return {
    c() {
      n && n.c(), l = Ae();
    },
    m(a, r) {
      n && n.m(a, r), S(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 && T(n, 1)) : (n = wc(a), n.c(), T(n, 1), n.m(l.parentNode, l)) : n && (be(), D(n, 1, 1, () => {
        n = null;
      }), ke());
    },
    i(a) {
      i || (T(n), i = !0);
    },
    o(a) {
      D(n), i = !1;
    },
    d(a) {
      a && C(l), n && n.d(a);
    }
  };
}
function Tc(t) {
  let e, l = bt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), u(e, "class", "desc svelte-1xxiico");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = bt[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function F3(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R, P, O, F, L, X, V, Q, Z, ae, se, K = (
    /*addToBasket*/
    t[2] && bc(t)
  );
  function Y(le, oe) {
    if (
      /*level*/
      le[4] == 1
    )
      return L3;
    if (
      /*level*/
      le[4] == 2
    )
      return H3;
  }
  let W = Y(t), J = W && W(t), ee = $e(
    /*gates*/
    t[11]
  ), we = [];
  for (let le = 0; le < ee.length; le += 1)
    we[le] = kc(gc(t, ee, le));
  let Re = $e(
    /*qubits*/
    t[12]
  ), ve = [];
  for (let le = 0; le < Re.length; le += 1)
    ve[le] = vc(mc(t, Re, le));
  let me = (
    /*topLevelKey*/
    t[8] === "properties" && /*openTimeMachine*/
    t[9] && yc()
  ), fe = $e(
    /*value*/
    t[1]
  ), G = [];
  for (let le = 0; le < fe.length; le += 1)
    G[le] = jc(pc(t, fe, le));
  const ye = (le) => D(G[le], 1, 1, () => {
    G[le] = null;
  });
  let ue = bt[
    /*key*/
    t[0]
  ] && Tc(t);
  return {
    c() {
      e = m("article"), K && K.c(), l = N(), J && J.c(), i = N(), n = m("div"), a = m("div"), r = m("div"), s = m("label"), s.textContent = "Gates", o = N(), _ = m("button"), _.textContent = "×", c = N(), d = m("select");
      for (let le = 0; le < we.length; le += 1)
        we[le].c();
      h = N(), p = m("div"), g = m("label"), g.textContent = "Qubits", b = N(), k = m("button"), k.textContent = "×", y = N(), v = m("select");
      for (let le = 0; le < ve.length; le += 1)
        ve[le].c();
      w = N(), q = m("div"), $ = m("table"), j = m("thead"), I = m("tr"), A = m("th"), A.textContent = "Gate", M = N(), z = m("th"), z.textContent = "Qubits", H = N(), B = m("th"), B.textContent = "Error", R = N(), P = m("th"), P.textContent = "Length", O = N(), F = m("th"), F.textContent = "-", L = N(), me && me.c(), X = N(), V = m("tbody");
      for (let le = 0; le < G.length; le += 1)
        G[le].c();
      Q = N(), ue && ue.c(), u(s, "for", "gates"), u(s, "class", "svelte-1xxiico"), u(_, "class", "svelte-1xxiico"), u(d, "class", "filter svelte-1xxiico"), u(d, "name", "gates"), u(d, "id", "gates"), d.multiple = !0, u(r, "class", "svelte-1xxiico"), u(g, "for", "qubits"), u(g, "class", "svelte-1xxiico"), u(k, "class", "svelte-1xxiico"), u(v, "class", "filter svelte-1xxiico"), u(v, "name", "qubits"), u(v, "id", "qubits"), v.multiple = !0, u(p, "class", "svelte-1xxiico"), u(a, "class", "filter-wrap svelte-1xxiico"), u(A, "class", "svelte-1xxiico"), u(z, "class", "svelte-1xxiico"), u(B, "class", "svelte-1xxiico"), u(P, "class", "svelte-1xxiico"), u(F, "class", "svelte-1xxiico"), u(j, "class", "svelte-1xxiico"), u($, "class", "svelte-1xxiico"), u(q, "class", "value svelte-1xxiico"), u(n, "class", "content-wrap svelte-1xxiico"), u(e, "class", "svelte-1xxiico");
    },
    m(le, oe) {
      S(le, e, oe), K && K.m(e, null), f(e, l), J && J.m(e, null), f(e, i), f(e, n), f(n, a), f(a, r), f(r, s), f(r, o), f(r, _), f(r, c), f(r, d);
      for (let x = 0; x < we.length; x += 1)
        we[x] && we[x].m(d, null);
      f(a, h), f(a, p), f(p, g), f(p, b), f(p, k), f(p, y), f(p, v);
      for (let x = 0; x < ve.length; x += 1)
        ve[x] && ve[x].m(v, null);
      f(n, w), f(n, q), f(q, $), f($, j), f(j, I), f(I, A), f(I, M), f(I, z), f(I, H), f(I, B), f(I, R), f(I, P), f(I, O), f(I, F), f(I, L), me && me.m(I, null), f($, X), f($, V);
      for (let x = 0; x < G.length; x += 1)
        G[x] && G[x].m(V, null);
      f(e, Q), ue && ue.m(e, null), Z = !0, ae || (se = [
        te(
          _,
          "click",
          /*click_handler_1*/
          t[17]
        ),
        te(
          d,
          "change",
          /*change_handler*/
          t[18]
        ),
        te(
          k,
          "click",
          /*click_handler_2*/
          t[19]
        ),
        te(
          v,
          "change",
          /*change_handler_1*/
          t[20]
        )
      ], ae = !0);
    },
    p(le, [oe]) {
      if (/*addToBasket*/
      le[2] ? K ? (K.p(le, oe), oe & /*addToBasket*/
      4 && T(K, 1)) : (K = bc(le), K.c(), T(K, 1), K.m(e, l)) : K && (be(), D(K, 1, 1, () => {
        K = null;
      }), ke()), W === (W = Y(le)) && J ? J.p(le, oe) : (J && J.d(1), J = W && W(le), J && (J.c(), J.m(e, i))), oe & /*gates, filter*/
      3072) {
        ee = $e(
          /*gates*/
          le[11]
        );
        let x;
        for (x = 0; x < ee.length; x += 1) {
          const ge = gc(le, ee, x);
          we[x] ? we[x].p(ge, oe) : (we[x] = kc(ge), we[x].c(), we[x].m(d, null));
        }
        for (; x < we.length; x += 1)
          we[x].d(1);
        we.length = ee.length;
      }
      if (oe & /*qubits, filter*/
      5120) {
        Re = $e(
          /*qubits*/
          le[12]
        );
        let x;
        for (x = 0; x < Re.length; x += 1) {
          const ge = mc(le, Re, x);
          ve[x] ? ve[x].p(ge, oe) : (ve[x] = vc(ge), ve[x].c(), ve[x].m(v, null));
        }
        for (; x < ve.length; x += 1)
          ve[x].d(1);
        ve.length = Re.length;
      }
      if (/*topLevelKey*/
      le[8] === "properties" && /*openTimeMachine*/
      le[9] ? me || (me = yc(), me.c(), me.m(I, null)) : me && (me.d(1), me = null), oe & /*openTimeMachine, value, parentKey, topLevelKey, code_header, code_footer, addToBasket, $basket, filter*/
      10214) {
        fe = $e(
          /*value*/
          le[1]
        );
        let x;
        for (x = 0; x < fe.length; x += 1) {
          const ge = pc(le, fe, x);
          G[x] ? (G[x].p(ge, oe), T(G[x], 1)) : (G[x] = jc(ge), G[x].c(), T(G[x], 1), G[x].m(V, null));
        }
        for (be(), x = fe.length; x < G.length; x += 1)
          ye(x);
        ke();
      }
      bt[
        /*key*/
        le[0]
      ] ? ue ? ue.p(le, oe) : (ue = Tc(le), ue.c(), ue.m(e, null)) : ue && (ue.d(1), ue = null);
    },
    i(le) {
      if (!Z) {
        T(K);
        for (let oe = 0; oe < fe.length; oe += 1)
          T(G[oe]);
        Z = !0;
      }
    },
    o(le) {
      D(K), G = G.filter(Boolean);
      for (let oe = 0; oe < G.length; oe += 1)
        D(G[oe]);
      Z = !1;
    },
    d(le) {
      le && C(e), K && K.d(), J && J.d(), Ye(we, le), Ye(ve, le), me && me.d(), Ye(G, le), ue && ue.d(), ae = !1, wt(se);
    }
  };
}
function Q3(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (B) => l(13, i = B)), _);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: _, level: c = 1, code_header: d = "", code_type: h = "", code_footer: p = "", parentKey: g = "", topLevelKey: b = "", openTimeMachine: k } = e;
  a();
  let y = { gates: [], qubits: [] }, v = [], w = [];
  Tt(() => {
    s && (l(11, v = Array.from(new Set(s.map((B) => B.gate)))), l(12, w = Array.from(new Set(s.map((B) => B.qubits).flat()))));
  });
  const q = (B) => y.qubits.includes(B), $ = () => {
    o(r);
  }, j = (B) => {
    l(10, y.gates = [], y);
  }, I = (B) => {
    l(10, y.gates = Array.from(B.target.selectedOptions).map((R) => R.value), y);
  }, A = (B) => {
    l(10, y.qubits = [], y);
  }, M = (B) => {
    l(10, y.qubits = Array.from(B.target.selectedOptions).map((R) => parseInt(R.value)), y);
  }, z = (B) => {
    o(`gate_${B.gate}_${B.qubits.join("_")} = ${d}gate="${B.gate}", qubits=[${B.qubits.join(", ")}]${p}`);
  }, H = (B, R) => {
    k({
      datatype: "gates",
      key: B.gate + "_" + B.qubits.join("_"),
      title_key: `gate[${B.qubits.join(",")}].${B.gate}`,
      index: R,
      parentKey: g,
      topLevelKey: b,
      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, _ = 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, g = B.parentKey), "topLevelKey" in B && l(8, b = B.topLevelKey), "openTimeMachine" in B && l(9, k = B.openTimeMachine);
  }, [
    r,
    s,
    o,
    _,
    c,
    d,
    p,
    g,
    b,
    k,
    y,
    v,
    w,
    i,
    h,
    q,
    $,
    j,
    I,
    A,
    M,
    z,
    H
  ];
}
class s0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, Q3, F3, Fe, {
      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 Cc(t, e, l) {
  const i = t.slice();
  return i[10] = e[l], i[12] = l, i;
}
function Sc(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-131ulv6");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function V3(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), u(e, "class", "svelte-131ulv6");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function X3(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), u(e, "class", "svelte-131ulv6");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function Mc(t) {
  let e, l, i = $e(
    /*value*/
    t[1]
  ), n = [];
  for (let r = 0; r < i.length; r += 1)
    n[r] = Nc(Cc(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 = Ae();
    },
    m(r, s) {
      for (let o = 0; o < n.length; o += 1)
        n[o] && n[o].m(r, s);
      S(r, e, s), l = !0;
    },
    p(r, s) {
      if (s & /*value, addToBasket, key, code_header, code_footer, $basket*/
      231) {
        i = $e(
          /*value*/
          r[1]
        );
        let o;
        for (o = 0; o < i.length; o += 1) {
          const _ = Cc(r, i, o);
          n[o] ? (n[o].p(_, s), T(n[o], 1)) : (n[o] = Nc(_), n[o].c(), T(n[o], 1), n[o].m(e.parentNode, e));
        }
        for (be(), o = i.length; o < n.length; o += 1)
          a(o);
        ke();
      }
    },
    i(r) {
      if (!l) {
        for (let s = 0; s < i.length; s += 1)
          T(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 && C(e), Ye(n, r);
    }
  };
}
function zc(t) {
  let e, l, i, n, a, r;
  l = new zt({
    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"), pe(l.$$.fragment), i = N(), u(e, "class", "basket x2 svelte-131ulv6");
    },
    m(o, _) {
      S(o, e, _), de(l, e, null), S(o, i, _), n = !0, a || (r = te(e, "click", s), a = !0);
    },
    p(o, _) {
      t = o;
      const c = {};
      _ & /*$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 || (T(l.$$.fragment, o), n = !0);
    },
    o(o) {
      D(l.$$.fragment, o), n = !1;
    },
    d(o) {
      o && (C(e), C(i)), he(l), a = !1, r();
    }
  };
}
function Nc(t) {
  let e, l, i = (
    /*a_set*/
    t[10].name + ""
  ), n, a, r, s, o = (
    /*a_set*/
    t[10].qubits.join(", ") + ""
  ), _, c, d, h = (
    /*addToBasket*/
    t[2] && zc(t)
  );
  return {
    c() {
      e = m("div"), l = m("strong"), n = E(i), a = N(), h && h.c(), r = m("br"), s = N(), _ = E(o), c = N(), u(e, "class", "value-row svelte-131ulv6");
    },
    m(p, g) {
      S(p, e, g), f(e, l), f(l, n), f(e, a), h && h.m(e, null), f(e, r), f(e, s), f(e, _), f(e, c), d = !0;
    },
    p(p, g) {
      (!d || g & /*value*/
      2) && i !== (i = /*a_set*/
      p[10].name + "") && U(n, i), /*addToBasket*/
      p[2] ? h ? (h.p(p, g), g & /*addToBasket*/
      4 && T(h, 1)) : (h = zc(p), h.c(), T(h, 1), h.m(e, r)) : h && (be(), D(h, 1, 1, () => {
        h = null;
      }), ke()), (!d || g & /*value*/
      2) && o !== (o = /*a_set*/
      p[10].qubits.join(", ") + "") && U(_, o);
    },
    i(p) {
      d || (T(h), d = !0);
    },
    o(p) {
      D(h), d = !1;
    },
    d(p) {
      p && C(e), h && h.d();
    }
  };
}
function Ac(t) {
  let e, l = bt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), u(e, "class", "desc svelte-131ulv6");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = bt[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function G3(t) {
  let e, l, i, n, a, r, s = (
    /*addToBasket*/
    t[2] && Sc(t)
  );
  function o(p, g) {
    if (
      /*level*/
      p[4] == 1
    )
      return X3;
    if (
      /*level*/
      p[4] == 2
    )
      return V3;
  }
  let _ = o(t), c = _ && _(t), d = (
    /*value*/
    t[1] !== void 0 && Mc(t)
  ), h = bt[
    /*key*/
    t[0]
  ] && Ac(t);
  return {
    c() {
      e = m("article"), s && s.c(), l = N(), c && c.c(), i = N(), n = m("div"), d && d.c(), a = N(), h && h.c(), u(n, "class", "value svelte-131ulv6"), u(e, "class", "svelte-131ulv6");
    },
    m(p, g) {
      S(p, e, g), s && s.m(e, null), f(e, l), c && c.m(e, null), f(e, i), f(e, n), d && d.m(n, null), f(e, a), h && h.m(e, null), r = !0;
    },
    p(p, [g]) {
      /*addToBasket*/
      p[2] ? s ? (s.p(p, g), g & /*addToBasket*/
      4 && T(s, 1)) : (s = Sc(p), s.c(), T(s, 1), s.m(e, l)) : s && (be(), D(s, 1, 1, () => {
        s = null;
      }), ke()), _ === (_ = o(p)) && c ? c.p(p, g) : (c && c.d(1), c = _ && _(p), c && (c.c(), c.m(e, i))), /*value*/
      p[1] !== void 0 ? d ? (d.p(p, g), g & /*value*/
      2 && T(d, 1)) : (d = Mc(p), d.c(), T(d, 1), d.m(n, null)) : d && (be(), D(d, 1, 1, () => {
        d = null;
      }), ke()), bt[
        /*key*/
        p[0]
      ] ? h ? h.p(p, g) : (h = Ac(p), h.c(), h.m(e, null)) : h && (h.d(1), h = null);
    },
    i(p) {
      r || (T(s), T(d), r = !0);
    },
    o(p) {
      D(s), D(d), r = !1;
    },
    d(p) {
      p && C(e), s && s.d(), c && c.d(), d && d.d(), h && h.d();
    }
  };
}
function Y3(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (b) => l(7, i = b)), _);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: _, level: c = 1, code_header: d = "", code_footer: h = "" } = e;
  a();
  const p = () => {
    o(r);
  }, g = (b) => {
    o(`${r}_${b} = ${d}${b}${h}`);
  };
  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, _ = b.basket)), "level" in b && l(4, c = b.level), "code_header" in b && l(5, d = b.code_header), "code_footer" in b && l(6, h = b.code_footer);
  }, [
    r,
    s,
    o,
    _,
    c,
    d,
    h,
    i,
    p,
    g
  ];
}
class K3 extends Ve {
  constructor(e) {
    super(), Qe(this, e, Y3, G3, Fe, {
      key: 0,
      value: 1,
      addToBasket: 2,
      basket: 3,
      level: 4,
      code_header: 5,
      code_footer: 6
    });
  }
}
function Bc(t, e, l) {
  const i = t.slice();
  return i[70] = e[l], i[72] = l, i;
}
function Pc(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function U3(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a[0] & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function W3(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a[0] & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function J3(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_2*/
        t[20]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function Z3(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_1*/
        t[19]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function x3(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_4*/
        t[22]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function e4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_3*/
        t[21]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function t4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_6*/
        t[24]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function l4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_5*/
        t[23]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function i4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_8*/
        t[26]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function n4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_7*/
        t[25]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function a4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_10*/
        t[28]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function r4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_9*/
        t[27]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function s4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_12*/
        t[30]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function o4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_11*/
        t[29]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function u4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_14*/
        t[32]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function f4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_13*/
        t[31]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function _4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_16*/
        t[34]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function c4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_15*/
        t[33]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function d4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_18*/
        t[36]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function h4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_17*/
        t[35]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function p4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_20*/
        t[38]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function m4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_19*/
        t[37]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function g4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_22*/
        t[40]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function b4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_21*/
        t[39]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function k4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_24*/
        t[42]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function v4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_23*/
        t[41]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function y4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_26*/
        t[44]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function w4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_25*/
        t[43]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function $4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_28*/
        t[46]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function q4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_27*/
        t[45]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function j4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_30*/
        t[48]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function T4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_29*/
        t[47]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function C4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_32*/
        t[50]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function S4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_31*/
        t[49]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function M4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_34*/
        t[52]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function z4(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_33*/
        t[51]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function Oc(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (_.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(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Ec(t) {
  let e, l, i, n, a;
  l = new ql({});
  function r() {
    return (
      /*click_handler_36*/
      t[54](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Ic(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (_.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(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Dc(t) {
  let e, l, i, n, a;
  l = new ql({});
  function r() {
    return (
      /*click_handler_38*/
      t[56](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Rc(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (_.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(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Hc(t) {
  let e, l, i, n, a;
  l = new ql({});
  function r() {
    return (
      /*click_handler_40*/
      t[58](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Lc(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (_.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(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Fc(t) {
  let e, l, i, n, a;
  l = new ql({});
  function r() {
    return (
      /*click_handler_42*/
      t[60](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function N4(t) {
  let e, l, i, n;
  return {
    c() {
      e = E("-"), l = m("br"), i = N(), n = m("span"), n.textContent = "(-)", u(n, "class", "asof svelte-1njjtck");
    },
    m(a, r) {
      S(a, e, r), S(a, l, r), S(a, i, r), S(a, n, r);
    },
    p: ne,
    i: ne,
    o: ne,
    d(a) {
      a && (C(e), C(l), C(i), C(n));
    }
  };
}
function A4(t) {
  var k, y;
  let e = (
    /*qubit*/
    ((k = t[70].prob_meas0_prep1) == null ? void 0 : k.value) + ""
  ), l, i, n, a, r, s = (
    /*qubit*/
    ((y = t[70].prob_meas0_prep1) == null ? void 0 : y.asof) + ""
  ), o, _, c, d, h, p, g = (
    /*addToBasket*/
    t[1] && Qc(t)
  ), b = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && Vc(t)
  );
  return {
    c() {
      l = E(e), i = m("br"), n = N(), a = m("span"), r = E("("), o = E(s), _ = E(")"), c = N(), g && g.c(), d = N(), b && b.c(), h = Ae(), u(a, "class", "asof svelte-1njjtck");
    },
    m(v, w) {
      S(v, l, w), S(v, i, w), S(v, n, w), S(v, a, w), f(a, r), f(a, o), f(a, _), S(v, c, w), g && g.m(v, w), S(v, d, w), b && b.m(v, w), S(v, h, w), p = !0;
    },
    p(v, w) {
      var q, $;
      (!p || w[0] & /*$value_react*/
      2048) && e !== (e = /*qubit*/
      ((q = v[70].prob_meas0_prep1) == null ? void 0 : q.value) + "") && U(l, e), (!p || w[0] & /*$value_react*/
      2048) && s !== (s = /*qubit*/
      (($ = v[70].prob_meas0_prep1) == null ? void 0 : $.asof) + "") && U(o, s), /*addToBasket*/
      v[1] ? g ? (g.p(v, w), w[0] & /*addToBasket*/
      2 && T(g, 1)) : (g = Qc(v), g.c(), T(g, 1), g.m(d.parentNode, d)) : g && (be(), D(g, 1, 1, () => {
        g = null;
      }), ke()), /*topLevelKey*/
      v[7] === "properties" && /*openTimeMachine*/
      v[8] ? b ? (b.p(v, w), w[0] & /*topLevelKey, openTimeMachine*/
      384 && T(b, 1)) : (b = Vc(v), b.c(), T(b, 1), b.m(h.parentNode, h)) : b && (be(), D(b, 1, 1, () => {
        b = null;
      }), ke());
    },
    i(v) {
      p || (T(g), T(b), p = !0);
    },
    o(v) {
      D(g), D(b), p = !1;
    },
    d(v) {
      v && (C(l), C(i), C(n), C(a), C(c), C(d), C(h)), g && g.d(v), b && b.d(v);
    }
  };
}
function Qc(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (_.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(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Vc(t) {
  let e, l, i, n, a;
  l = new ql({});
  function r() {
    return (
      /*click_handler_44*/
      t[62](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function B4(t) {
  let e, l, i, n;
  return {
    c() {
      e = E("-"), l = m("br"), i = N(), n = m("span"), n.textContent = "(-)", u(n, "class", "asof svelte-1njjtck");
    },
    m(a, r) {
      S(a, e, r), S(a, l, r), S(a, i, r), S(a, n, r);
    },
    p: ne,
    i: ne,
    o: ne,
    d(a) {
      a && (C(e), C(l), C(i), C(n));
    }
  };
}
function P4(t) {
  var b, k;
  let e = (
    /*qubit*/
    ((b = t[70].prob_meas1_prep0) == null ? void 0 : b.value) + ""
  ), l, i, n, a, r = (
    /*qubit*/
    ((k = t[70].prob_meas1_prep0) == null ? void 0 : k.asof) + ""
  ), s, o, _, c, d, h, p = (
    /*addToBasket*/
    t[1] && Xc(t)
  ), g = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && Gc(t)
  );
  return {
    c() {
      l = E(e), i = m("br"), n = m("span"), a = E("("), s = E(r), o = E(")"), _ = N(), p && p.c(), c = N(), g && g.c(), d = Ae(), u(n, "class", "asof svelte-1njjtck");
    },
    m(y, v) {
      S(y, l, v), S(y, i, v), S(y, n, v), f(n, a), f(n, s), f(n, o), S(y, _, v), p && p.m(y, v), S(y, c, v), g && g.m(y, v), S(y, d, v), h = !0;
    },
    p(y, v) {
      var w, q;
      (!h || v[0] & /*$value_react*/
      2048) && e !== (e = /*qubit*/
      ((w = y[70].prob_meas1_prep0) == null ? void 0 : w.value) + "") && U(l, e), (!h || v[0] & /*$value_react*/
      2048) && r !== (r = /*qubit*/
      ((q = y[70].prob_meas1_prep0) == null ? void 0 : q.asof) + "") && U(s, r), /*addToBasket*/
      y[1] ? p ? (p.p(y, v), v[0] & /*addToBasket*/
      2 && T(p, 1)) : (p = Xc(y), p.c(), T(p, 1), p.m(c.parentNode, c)) : p && (be(), D(p, 1, 1, () => {
        p = null;
      }), ke()), /*topLevelKey*/
      y[7] === "properties" && /*openTimeMachine*/
      y[8] ? g ? (g.p(y, v), v[0] & /*topLevelKey, openTimeMachine*/
      384 && T(g, 1)) : (g = Gc(y), g.c(), T(g, 1), g.m(d.parentNode, d)) : g && (be(), D(g, 1, 1, () => {
        g = null;
      }), ke());
    },
    i(y) {
      h || (T(p), T(g), h = !0);
    },
    o(y) {
      D(p), D(g), h = !1;
    },
    d(y) {
      y && (C(l), C(i), C(n), C(_), C(c), C(d)), p && p.d(y), g && g.d(y);
    }
  };
}
function Xc(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (_.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(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Gc(t) {
  let e, l, i, n, a;
  l = new ql({});
  function r() {
    return (
      /*click_handler_46*/
      t[64](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Yc(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (_.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(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Kc(t) {
  let e, l, i, n, a;
  l = new ql({});
  function r() {
    return (
      /*click_handler_48*/
      t[66](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Uc(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (_.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(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Wc(t) {
  let e, l, i, n, a;
  l = new ql({});
  function r() {
    return (
      /*click_handler_50*/
      t[68](
        /*qi*/
        t[72],
        /*qubit*/
        t[70]
      )
    );
  }
  return {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Jc(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-1njjtck");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o[0] & /*$basket, key, code_header, code_footer*/
      1073 && (_.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(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Zc(t) {
  let e, l, i = (
    /*qubit*/
    t[70].index.value + ""
  ), n, a, r, s = (
    /*qubit*/
    t[70].T1.value + ""
  ), o, _, c, d, h = (
    /*qubit*/
    t[70].T1.asof + ""
  ), p, g, b, k, y, v, w = (
    /*qubit*/
    t[70].T2.value + ""
  ), q, $, j, I, A = (
    /*qubit*/
    t[70].T2.asof + ""
  ), M, z, H, B, R, P, O = (
    /*qubit*/
    t[70].anharmonicity.value + ""
  ), F, L, X, V, Q = (
    /*qubit*/
    t[70].anharmonicity.asof + ""
  ), Z, ae, se, K, Y, W, J = (
    /*qubit*/
    t[70].frequency.value + ""
  ), ee, we, Re, ve, me = (
    /*qubit*/
    t[70].frequency.asof + ""
  ), fe, G, ye, ue, le, oe, x, ge, re, Ie, je, _e, Ee, ie, Te = (
    /*qubit*/
    t[70].readout_error.value + ""
  ), Ue, Ke, We, vt, qt = (
    /*qubit*/
    t[70].readout_error.asof + ""
  ), rt, mt, Rt, ot, ut, Ce, ce = (
    /*qubit*/
    t[70].readout_length.value + ""
  ), Be, Le, Pe, Je, Xe = (
    /*qubit*/
    t[70].readout_length.asof + ""
  ), He, Ze, _t, Ct, tl, jt, ft, Lt, It = (
    /*addToBasket*/
    t[1] && Oc(t)
  ), gt = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && Ec(t)
  ), Dt = (
    /*addToBasket*/
    t[1] && Ic(t)
  ), yt = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && Dc(t)
  ), ze = (
    /*addToBasket*/
    t[1] && Rc(t)
  ), lt = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && Hc(t)
  ), dt = (
    /*addToBasket*/
    t[1] && Lc(t)
  ), Nt = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && Fc(t)
  );
  const Yi = [A4, N4], il = [];
  function nl(Ne, xe) {
    var sl;
    return (
      /*qubit*/
      ((sl = Ne[70].prob_meas0_prep1) == null ? void 0 : sl.value) !== void 0 ? 0 : 1
    );
  }
  x = nl(t), ge = il[x] = Yi[x](t);
  const Ki = [P4, B4], al = [];
  function rl(Ne, xe) {
    var sl;
    return (
      /*qubit*/
      ((sl = Ne[70].prob_meas1_prep0) == null ? void 0 : sl.value) !== void 0 ? 0 : 1
    );
  }
  je = rl(t), _e = al[je] = Ki[je](t);
  let Ht = (
    /*addToBasket*/
    t[1] && Yc(t)
  ), ht = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && Kc(t)
  ), Qt = (
    /*addToBasket*/
    t[1] && Uc(t)
  ), Mt = (
    /*topLevelKey*/
    t[7] === "properties" && /*openTimeMachine*/
    t[8] && Wc(t)
  ), Se = (
    /*addToBasket*/
    t[1] && Jc(t)
  );
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = N(), r = m("td"), o = E(s), _ = m("br"), c = m("span"), d = E("("), p = E(h), g = E(")"), b = N(), It && It.c(), k = N(), gt && gt.c(), y = N(), v = m("td"), q = E(w), $ = m("br"), j = m("span"), I = E("("), M = E(A), z = E(")"), H = N(), Dt && Dt.c(), B = N(), yt && yt.c(), R = N(), P = m("td"), F = E(O), L = m("br"), X = m("span"), V = E("("), Z = E(Q), ae = E(")"), se = N(), ze && ze.c(), K = N(), lt && lt.c(), Y = N(), W = m("td"), ee = E(J), we = m("br"), Re = m("span"), ve = E("("), fe = E(me), G = E(")"), ye = N(), dt && dt.c(), ue = N(), Nt && Nt.c(), le = N(), oe = m("td"), ge.c(), re = N(), Ie = m("td"), _e.c(), Ee = N(), ie = m("td"), Ue = E(Te), Ke = m("br"), We = m("span"), vt = E("("), rt = E(qt), mt = E(")"), Rt = N(), Ht && Ht.c(), ot = N(), ht && ht.c(), ut = N(), Ce = m("td"), Be = E(ce), Le = m("br"), Pe = m("span"), Je = E("("), He = E(Xe), Ze = E(")"), _t = N(), Qt && Qt.c(), Ct = N(), Mt && Mt.c(), tl = N(), jt = m("td"), Se && Se.c(), ft = N(), u(l, "class", "svelte-1njjtck"), u(c, "class", "asof svelte-1njjtck"), u(r, "class", "svelte-1njjtck"), u(j, "class", "asof svelte-1njjtck"), u(v, "class", "svelte-1njjtck"), u(X, "class", "asof svelte-1njjtck"), u(P, "class", "svelte-1njjtck"), u(Re, "class", "asof svelte-1njjtck"), u(W, "class", "svelte-1njjtck"), u(oe, "class", "svelte-1njjtck"), u(Ie, "class", "svelte-1njjtck"), u(We, "class", "asof svelte-1njjtck"), u(ie, "class", "svelte-1njjtck"), u(Pe, "class", "asof svelte-1njjtck"), u(Ce, "class", "svelte-1njjtck"), u(jt, "class", "svelte-1njjtck");
    },
    m(Ne, xe) {
      S(Ne, e, xe), f(e, l), f(l, n), f(e, a), f(e, r), f(r, o), f(r, _), f(r, c), f(c, d), f(c, p), f(c, g), f(r, b), It && It.m(r, null), f(r, k), gt && gt.m(r, null), f(e, y), f(e, v), f(v, q), f(v, $), f(v, j), f(j, I), f(j, M), f(j, z), f(v, H), Dt && Dt.m(v, null), f(v, B), yt && yt.m(v, null), f(e, R), f(e, P), f(P, F), f(P, L), f(P, X), f(X, V), f(X, Z), f(X, ae), f(P, se), ze && ze.m(P, null), f(P, K), lt && lt.m(P, null), f(e, Y), f(e, W), f(W, ee), f(W, we), f(W, Re), f(Re, ve), f(Re, fe), f(Re, G), f(W, ye), dt && dt.m(W, null), f(W, ue), Nt && Nt.m(W, null), f(e, le), f(e, oe), il[x].m(oe, null), f(e, re), f(e, Ie), al[je].m(Ie, null), f(e, Ee), f(e, ie), f(ie, Ue), f(ie, Ke), f(ie, We), f(We, vt), f(We, rt), f(We, mt), f(ie, Rt), Ht && Ht.m(ie, null), f(ie, ot), ht && ht.m(ie, null), f(e, ut), f(e, Ce), f(Ce, Be), f(Ce, Le), f(Ce, Pe), f(Pe, Je), f(Pe, He), f(Pe, Ze), f(Ce, _t), Qt && Qt.m(Ce, null), f(Ce, Ct), Mt && Mt.m(Ce, null), f(e, tl), f(e, jt), Se && Se.m(jt, null), f(e, ft), Lt = !0;
    },
    p(Ne, xe) {
      (!Lt || xe[0] & /*$value_react*/
      2048) && i !== (i = /*qubit*/
      Ne[70].index.value + "") && U(n, i), (!Lt || xe[0] & /*$value_react*/
      2048) && s !== (s = /*qubit*/
      Ne[70].T1.value + "") && U(o, s), (!Lt || xe[0] & /*$value_react*/
      2048) && h !== (h = /*qubit*/
      Ne[70].T1.asof + "") && U(p, h), /*addToBasket*/
      Ne[1] ? It ? (It.p(Ne, xe), xe[0] & /*addToBasket*/
      2 && T(It, 1)) : (It = Oc(Ne), It.c(), T(It, 1), It.m(r, k)) : It && (be(), D(It, 1, 1, () => {
        It = null;
      }), ke()), /*topLevelKey*/
      Ne[7] === "properties" && /*openTimeMachine*/
      Ne[8] ? gt ? (gt.p(Ne, xe), xe[0] & /*topLevelKey, openTimeMachine*/
      384 && T(gt, 1)) : (gt = Ec(Ne), gt.c(), T(gt, 1), gt.m(r, null)) : gt && (be(), D(gt, 1, 1, () => {
        gt = null;
      }), ke()), (!Lt || xe[0] & /*$value_react*/
      2048) && w !== (w = /*qubit*/
      Ne[70].T2.value + "") && U(q, w), (!Lt || xe[0] & /*$value_react*/
      2048) && A !== (A = /*qubit*/
      Ne[70].T2.asof + "") && U(M, A), /*addToBasket*/
      Ne[1] ? Dt ? (Dt.p(Ne, xe), xe[0] & /*addToBasket*/
      2 && T(Dt, 1)) : (Dt = Ic(Ne), Dt.c(), T(Dt, 1), Dt.m(v, B)) : Dt && (be(), D(Dt, 1, 1, () => {
        Dt = null;
      }), ke()), /*topLevelKey*/
      Ne[7] === "properties" && /*openTimeMachine*/
      Ne[8] ? yt ? (yt.p(Ne, xe), xe[0] & /*topLevelKey, openTimeMachine*/
      384 && T(yt, 1)) : (yt = Dc(Ne), yt.c(), T(yt, 1), yt.m(v, null)) : yt && (be(), D(yt, 1, 1, () => {
        yt = null;
      }), ke()), (!Lt || xe[0] & /*$value_react*/
      2048) && O !== (O = /*qubit*/
      Ne[70].anharmonicity.value + "") && U(F, O), (!Lt || xe[0] & /*$value_react*/
      2048) && Q !== (Q = /*qubit*/
      Ne[70].anharmonicity.asof + "") && U(Z, Q), /*addToBasket*/
      Ne[1] ? ze ? (ze.p(Ne, xe), xe[0] & /*addToBasket*/
      2 && T(ze, 1)) : (ze = Rc(Ne), ze.c(), T(ze, 1), ze.m(P, K)) : ze && (be(), D(ze, 1, 1, () => {
        ze = null;
      }), ke()), /*topLevelKey*/
      Ne[7] === "properties" && /*openTimeMachine*/
      Ne[8] ? lt ? (lt.p(Ne, xe), xe[0] & /*topLevelKey, openTimeMachine*/
      384 && T(lt, 1)) : (lt = Hc(Ne), lt.c(), T(lt, 1), lt.m(P, null)) : lt && (be(), D(lt, 1, 1, () => {
        lt = null;
      }), ke()), (!Lt || xe[0] & /*$value_react*/
      2048) && J !== (J = /*qubit*/
      Ne[70].frequency.value + "") && U(ee, J), (!Lt || xe[0] & /*$value_react*/
      2048) && me !== (me = /*qubit*/
      Ne[70].frequency.asof + "") && U(fe, me), /*addToBasket*/
      Ne[1] ? dt ? (dt.p(Ne, xe), xe[0] & /*addToBasket*/
      2 && T(dt, 1)) : (dt = Lc(Ne), dt.c(), T(dt, 1), dt.m(W, ue)) : dt && (be(), D(dt, 1, 1, () => {
        dt = null;
      }), ke()), /*topLevelKey*/
      Ne[7] === "properties" && /*openTimeMachine*/
      Ne[8] ? Nt ? (Nt.p(Ne, xe), xe[0] & /*topLevelKey, openTimeMachine*/
      384 && T(Nt, 1)) : (Nt = Fc(Ne), Nt.c(), T(Nt, 1), Nt.m(W, null)) : Nt && (be(), D(Nt, 1, 1, () => {
        Nt = null;
      }), ke());
      let sl = x;
      x = nl(Ne), x === sl ? il[x].p(Ne, xe) : (be(), D(il[sl], 1, 1, () => {
        il[sl] = null;
      }), ke(), ge = il[x], ge ? ge.p(Ne, xe) : (ge = il[x] = Yi[x](Ne), ge.c()), T(ge, 1), ge.m(oe, null));
      let Ua = je;
      je = rl(Ne), je === Ua ? al[je].p(Ne, xe) : (be(), D(al[Ua], 1, 1, () => {
        al[Ua] = null;
      }), ke(), _e = al[je], _e ? _e.p(Ne, xe) : (_e = al[je] = Ki[je](Ne), _e.c()), T(_e, 1), _e.m(Ie, null)), (!Lt || xe[0] & /*$value_react*/
      2048) && Te !== (Te = /*qubit*/
      Ne[70].readout_error.value + "") && U(Ue, Te), (!Lt || xe[0] & /*$value_react*/
      2048) && qt !== (qt = /*qubit*/
      Ne[70].readout_error.asof + "") && U(rt, qt), /*addToBasket*/
      Ne[1] ? Ht ? (Ht.p(Ne, xe), xe[0] & /*addToBasket*/
      2 && T(Ht, 1)) : (Ht = Yc(Ne), Ht.c(), T(Ht, 1), Ht.m(ie, ot)) : Ht && (be(), D(Ht, 1, 1, () => {
        Ht = null;
      }), ke()), /*topLevelKey*/
      Ne[7] === "properties" && /*openTimeMachine*/
      Ne[8] ? ht ? (ht.p(Ne, xe), xe[0] & /*topLevelKey, openTimeMachine*/
      384 && T(ht, 1)) : (ht = Kc(Ne), ht.c(), T(ht, 1), ht.m(ie, null)) : ht && (be(), D(ht, 1, 1, () => {
        ht = null;
      }), ke()), (!Lt || xe[0] & /*$value_react*/
      2048) && ce !== (ce = /*qubit*/
      Ne[70].readout_length.value + "") && U(Be, ce), (!Lt || xe[0] & /*$value_react*/
      2048) && Xe !== (Xe = /*qubit*/
      Ne[70].readout_length.asof + "") && U(He, Xe), /*addToBasket*/
      Ne[1] ? Qt ? (Qt.p(Ne, xe), xe[0] & /*addToBasket*/
      2 && T(Qt, 1)) : (Qt = Uc(Ne), Qt.c(), T(Qt, 1), Qt.m(Ce, Ct)) : Qt && (be(), D(Qt, 1, 1, () => {
        Qt = null;
      }), ke()), /*topLevelKey*/
      Ne[7] === "properties" && /*openTimeMachine*/
      Ne[8] ? Mt ? (Mt.p(Ne, xe), xe[0] & /*topLevelKey, openTimeMachine*/
      384 && T(Mt, 1)) : (Mt = Wc(Ne), Mt.c(), T(Mt, 1), Mt.m(Ce, null)) : Mt && (be(), D(Mt, 1, 1, () => {
        Mt = null;
      }), ke()), /*addToBasket*/
      Ne[1] ? Se ? (Se.p(Ne, xe), xe[0] & /*addToBasket*/
      2 && T(Se, 1)) : (Se = Jc(Ne), Se.c(), T(Se, 1), Se.m(jt, null)) : Se && (be(), D(Se, 1, 1, () => {
        Se = null;
      }), ke());
    },
    i(Ne) {
      Lt || (T(It), T(gt), T(Dt), T(yt), T(ze), T(lt), T(dt), T(Nt), T(ge), T(_e), T(Ht), T(ht), T(Qt), T(Mt), T(Se), Lt = !0);
    },
    o(Ne) {
      D(It), D(gt), D(Dt), D(yt), D(ze), D(lt), D(dt), D(Nt), D(ge), D(_e), D(Ht), D(ht), D(Qt), D(Mt), D(Se), Lt = !1;
    },
    d(Ne) {
      Ne && C(e), It && It.d(), gt && gt.d(), Dt && Dt.d(), yt && yt.d(), ze && ze.d(), lt && lt.d(), dt && dt.d(), Nt && Nt.d(), il[x].d(), al[je].d(), Ht && Ht.d(), ht && ht.d(), Qt && Qt.d(), Mt && Mt.d(), Se && Se.d();
    }
  };
}
function xc(t) {
  let e, l = bt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), u(e, "class", "desc svelte-1njjtck");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a[0] & /*key*/
      1 && l !== (l = bt[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function O4(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R, P, O, F, L, X, V, Q, Z, ae, se, K, Y, W, J, ee, we, Re, ve, me = (
    /*addToBasket*/
    t[1] && Pc(t)
  );
  function fe(Se, Ne) {
    if (
      /*level*/
      Se[3] == 1
    )
      return W3;
    if (
      /*level*/
      Se[3] == 2
    )
      return U3;
  }
  let G = fe(t), ye = G && G(t);
  function ue(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].index !== "a" ? Z3 : J3
    );
  }
  let le = ue(t), oe = le(t);
  function x(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].T1 !== "a" ? e4 : x3
    );
  }
  let ge = x(t), re = ge(t);
  function Ie(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].T1d !== "a" ? l4 : t4
    );
  }
  let je = Ie(t), _e = je(t);
  function Ee(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].T2 !== "a" ? n4 : i4
    );
  }
  let ie = Ee(t), Te = ie(t);
  function Ue(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].T2d !== "a" ? r4 : a4
    );
  }
  let Ke = Ue(t), We = Ke(t);
  function vt(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].anharmonicity !== "a" ? o4 : s4
    );
  }
  let qt = vt(t), rt = qt(t);
  function mt(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].anharmonicityd !== "a" ? f4 : u4
    );
  }
  let Rt = mt(t), ot = Rt(t);
  function ut(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].frequency !== "a" ? c4 : _4
    );
  }
  let Ce = ut(t), ce = Ce(t);
  function Be(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].frequencyd !== "a" ? h4 : d4
    );
  }
  let Le = Be(t), Pe = Le(t);
  function Je(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].prob_meas0_prep1 !== "a" ? m4 : p4
    );
  }
  let Xe = Je(t), He = Xe(t);
  function Ze(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].prob_meas0_prep1d !== "a" ? b4 : g4
    );
  }
  let _t = Ze(t), Ct = _t(t);
  function tl(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].prob_meas1_prep0 !== "a" ? v4 : k4
    );
  }
  let jt = tl(t), ft = jt(t);
  function Lt(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].prob_meas1_prep0d !== "a" ? w4 : y4
    );
  }
  let It = Lt(t), gt = It(t);
  function Dt(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].readout_error !== "a" ? q4 : $4
    );
  }
  let yt = Dt(t), ze = yt(t);
  function lt(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].readout_errord !== "a" ? T4 : j4
    );
  }
  let dt = lt(t), Nt = dt(t);
  function Yi(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].readout_length !== "a" ? S4 : C4
    );
  }
  let il = Yi(t), nl = il(t);
  function Ki(Se, Ne) {
    return (
      /*sort_reg*/
      Se[9].readout_lengthd !== "a" ? z4 : M4
    );
  }
  let al = Ki(t), rl = al(t), Ht = $e(
    /*$value_react*/
    t[11]
  ), ht = [];
  for (let Se = 0; Se < Ht.length; Se += 1)
    ht[Se] = Zc(Bc(t, Ht, Se));
  const Qt = (Se) => D(ht[Se], 1, 1, () => {
    ht[Se] = null;
  });
  let Mt = bt[
    /*key*/
    t[0]
  ] && xc(t);
  return {
    c() {
      e = m("article"), me && me.c(), l = N(), ye && ye.c(), i = N(), n = m("div"), a = m("table"), r = m("thead"), s = m("tr"), o = m("th"), _ = E("I "), oe.c(), c = N(), d = m("th"), h = E("T1 "), re.c(), p = Ae(), _e.c(), g = N(), b = m("th"), k = E("T2 "), Te.c(), y = Ae(), We.c(), v = N(), w = m("th"), q = E("Anharmonic. "), rt.c(), $ = Ae(), ot.c(), j = N(), I = m("th"), A = E("Frequency "), ce.c(), M = Ae(), Pe.c(), z = N(), H = m("th"), B = E("Meas0Prob1 "), He.c(), R = Ae(), Ct.c(), P = N(), O = m("th"), F = E("Meas1Prob0 "), ft.c(), L = Ae(), gt.c(), X = N(), V = m("th"), Q = E("Readout Error "), ze.c(), Z = Ae(), Nt.c(), ae = N(), se = m("th"), K = E("Readout Length "), nl.c(), Y = Ae(), rl.c(), W = N(), J = m("th"), J.textContent = "-", ee = N(), we = m("tbody");
      for (let Se = 0; Se < ht.length; Se += 1)
        ht[Se].c();
      Re = N(), Mt && Mt.c(), u(o, "class", "svelte-1njjtck"), u(d, "class", "svelte-1njjtck"), u(b, "class", "svelte-1njjtck"), u(w, "class", "svelte-1njjtck"), u(I, "class", "svelte-1njjtck"), u(H, "class", "svelte-1njjtck"), u(O, "class", "svelte-1njjtck"), u(V, "class", "svelte-1njjtck"), u(se, "class", "svelte-1njjtck"), u(J, "class", "svelte-1njjtck"), u(r, "class", "svelte-1njjtck"), u(we, "class", "svelte-1njjtck"), u(a, "class", "svelte-1njjtck"), u(n, "class", "value svelte-1njjtck"), u(e, "class", "svelte-1njjtck");
    },
    m(Se, Ne) {
      S(Se, e, Ne), me && me.m(e, null), f(e, l), ye && ye.m(e, null), f(e, i), f(e, n), f(n, a), f(a, r), f(r, s), f(s, o), f(o, _), oe.m(o, null), f(s, c), f(s, d), f(d, h), re.m(d, null), f(d, p), _e.m(d, null), f(s, g), f(s, b), f(b, k), Te.m(b, null), f(b, y), We.m(b, null), f(s, v), f(s, w), f(w, q), rt.m(w, null), f(w, $), ot.m(w, null), f(s, j), f(s, I), f(I, A), ce.m(I, null), f(I, M), Pe.m(I, null), f(s, z), f(s, H), f(H, B), He.m(H, null), f(H, R), Ct.m(H, null), f(s, P), f(s, O), f(O, F), ft.m(O, null), f(O, L), gt.m(O, null), f(s, X), f(s, V), f(V, Q), ze.m(V, null), f(V, Z), Nt.m(V, null), f(s, ae), f(s, se), f(se, K), nl.m(se, null), f(se, Y), rl.m(se, null), f(s, W), f(s, J), f(a, ee), f(a, we);
      for (let xe = 0; xe < ht.length; xe += 1)
        ht[xe] && ht[xe].m(we, null);
      f(e, Re), Mt && Mt.m(e, null), ve = !0;
    },
    p(Se, Ne) {
      if (/*addToBasket*/
      Se[1] ? me ? (me.p(Se, Ne), Ne[0] & /*addToBasket*/
      2 && T(me, 1)) : (me = Pc(Se), me.c(), T(me, 1), me.m(e, l)) : me && (be(), D(me, 1, 1, () => {
        me = null;
      }), ke()), G === (G = fe(Se)) && ye ? ye.p(Se, Ne) : (ye && ye.d(1), ye = G && G(Se), ye && (ye.c(), ye.m(e, i))), le === (le = ue(Se)) && oe ? oe.p(Se, Ne) : (oe.d(1), oe = le(Se), oe && (oe.c(), oe.m(o, null))), ge === (ge = x(Se)) && re ? re.p(Se, Ne) : (re.d(1), re = ge(Se), re && (re.c(), re.m(d, p))), je === (je = Ie(Se)) && _e ? _e.p(Se, Ne) : (_e.d(1), _e = je(Se), _e && (_e.c(), _e.m(d, null))), ie === (ie = Ee(Se)) && Te ? Te.p(Se, Ne) : (Te.d(1), Te = ie(Se), Te && (Te.c(), Te.m(b, y))), Ke === (Ke = Ue(Se)) && We ? We.p(Se, Ne) : (We.d(1), We = Ke(Se), We && (We.c(), We.m(b, null))), qt === (qt = vt(Se)) && rt ? rt.p(Se, Ne) : (rt.d(1), rt = qt(Se), rt && (rt.c(), rt.m(w, $))), Rt === (Rt = mt(Se)) && ot ? ot.p(Se, Ne) : (ot.d(1), ot = Rt(Se), ot && (ot.c(), ot.m(w, null))), Ce === (Ce = ut(Se)) && ce ? ce.p(Se, Ne) : (ce.d(1), ce = Ce(Se), ce && (ce.c(), ce.m(I, M))), Le === (Le = Be(Se)) && Pe ? Pe.p(Se, Ne) : (Pe.d(1), Pe = Le(Se), Pe && (Pe.c(), Pe.m(I, null))), Xe === (Xe = Je(Se)) && He ? He.p(Se, Ne) : (He.d(1), He = Xe(Se), He && (He.c(), He.m(H, R))), _t === (_t = Ze(Se)) && Ct ? Ct.p(Se, Ne) : (Ct.d(1), Ct = _t(Se), Ct && (Ct.c(), Ct.m(H, null))), jt === (jt = tl(Se)) && ft ? ft.p(Se, Ne) : (ft.d(1), ft = jt(Se), ft && (ft.c(), ft.m(O, L))), It === (It = Lt(Se)) && gt ? gt.p(Se, Ne) : (gt.d(1), gt = It(Se), gt && (gt.c(), gt.m(O, null))), yt === (yt = Dt(Se)) && ze ? ze.p(Se, Ne) : (ze.d(1), ze = yt(Se), ze && (ze.c(), ze.m(V, Z))), dt === (dt = lt(Se)) && Nt ? Nt.p(Se, Ne) : (Nt.d(1), Nt = dt(Se), Nt && (Nt.c(), Nt.m(V, null))), il === (il = Yi(Se)) && nl ? nl.p(Se, Ne) : (nl.d(1), nl = il(Se), nl && (nl.c(), nl.m(se, Y))), al === (al = Ki(Se)) && rl ? rl.p(Se, Ne) : (rl.d(1), rl = al(Se), rl && (rl.c(), rl.m(se, null))), Ne[0] & /*addToBasket, key, code_header, code_footer, $basket, openTimeMachine, parentKey, topLevelKey, $value_react*/
      3571) {
        Ht = $e(
          /*$value_react*/
          Se[11]
        );
        let xe;
        for (xe = 0; xe < Ht.length; xe += 1) {
          const sl = Bc(Se, Ht, xe);
          ht[xe] ? (ht[xe].p(sl, Ne), T(ht[xe], 1)) : (ht[xe] = Zc(sl), ht[xe].c(), T(ht[xe], 1), ht[xe].m(we, null));
        }
        for (be(), xe = Ht.length; xe < ht.length; xe += 1)
          Qt(xe);
        ke();
      }
      bt[
        /*key*/
        Se[0]
      ] ? Mt ? Mt.p(Se, Ne) : (Mt = xc(Se), Mt.c(), Mt.m(e, null)) : Mt && (Mt.d(1), Mt = null);
    },
    i(Se) {
      if (!ve) {
        T(me);
        for (let Ne = 0; Ne < Ht.length; Ne += 1)
          T(ht[Ne]);
        ve = !0;
      }
    },
    o(Se) {
      D(me), ht = ht.filter(Boolean);
      for (let Ne = 0; Ne < ht.length; Ne += 1)
        D(ht[Ne]);
      ve = !1;
    },
    d(Se) {
      Se && C(e), me && me.d(), ye && ye.d(), oe.d(), re.d(), _e.d(), Te.d(), We.d(), rt.d(), ot.d(), ce.d(), Pe.d(), He.d(), Ct.d(), ft.d(), gt.d(), ze.d(), Nt.d(), nl.d(), rl.d(), Ye(ht, Se), Mt && Mt.d();
    }
  };
}
function E4(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(c, (ce) => l(10, i = ce)), c), r;
  t.$$.on_destroy.push(() => n());
  let { key: s = "", value: o, addToBasket: _, basket: c, level: d = 1, code_header: h = "", code_type: p = "", code_footer: g = "", parentKey: b = "", topLevelKey: k = "", openTimeMachine: y, property_time: v = Oe() } = e;
  a();
  let w = {}, q = Oe([]);
  at(t, q, (ce) => l(11, r = ce));
  function $(ce, Be) {
    Be == "a" ? (q.update((Le) => (Le.sort((Pe, Je) => {
      var Xe, He;
      return ((Xe = Pe[ce]) == null ? void 0 : Xe.value) - ((He = Je[ce]) == null ? void 0 : He.value);
    }), Le)), l(9, w[ce] = "a", w)) : (q.update((Le) => (Le.sort((Pe, Je) => {
      var Xe, He;
      return ((Xe = Je[ce]) == null ? void 0 : Xe.value) - ((He = Pe[ce]) == null ? void 0 : He.value);
    }), Le)), l(9, w[ce] = "d", w));
  }
  function j(ce, Be) {
    Be == "a" ? (q.update((Le) => (Le.sort((Pe, Je) => {
      var Xe, He;
      return new Date((Xe = Pe[ce]) == null ? void 0 : Xe.asof) - new Date((He = Je[ce]) == null ? void 0 : He.asof);
    }), Le)), l(9, w[ce + "d"] = "a", w)) : (q.update((Le) => (Le.sort((Pe, Je) => {
      var Xe, He;
      return new Date((Xe = Je[ce]) == null ? void 0 : Xe.asof) - new Date((He = Pe[ce]) == null ? void 0 : He.asof);
    }), Le)), l(9, w[ce + "d"] = "d", w));
  }
  Tt(() => {
    v.subscribe((ce) => {
      q.set(o.map((Be, Le) => (Be.index = { value: Le }, Be)));
    });
  });
  const I = () => {
    _(s);
  }, A = () => {
    $("index", "a");
  }, M = () => {
    $("index", "d");
  }, z = () => {
    $("T1", "a");
  }, H = () => {
    $("T1", "d");
  }, B = () => {
    j("T1", "a");
  }, R = () => {
    j("T1", "d");
  }, P = () => {
    $("T2", "a");
  }, O = () => {
    $("T2", "d");
  }, F = () => {
    j("T2", "a");
  }, L = () => {
    j("T2", "d");
  }, X = () => {
    $("anharmonicity", "a");
  }, V = () => {
    $("anharmonicity", "d");
  }, Q = () => {
    j("anharmonicity", "a");
  }, Z = () => {
    j("anharmonicity", "d");
  }, ae = () => {
    $("frequency", "a");
  }, se = () => {
    $("frequency", "d");
  }, K = () => {
    j("frequency", "a");
  }, Y = () => {
    j("frequency", "d");
  }, W = () => {
    $("prob_meas0_prep1", "a");
  }, J = () => {
    $("prob_meas0_prep1", "d");
  }, ee = () => {
    j("prob_meas0_prep1", "a");
  }, we = () => {
    j("prob_meas0_prep1", "d");
  }, Re = () => {
    $("prob_meas1_prep0", "a");
  }, ve = () => {
    $("prob_meas1_prep0", "d");
  }, me = () => {
    j("prob_meas1_prep0", "a");
  }, fe = () => {
    j("prob_meas1_prep0", "d");
  }, G = () => {
    $("readout_error", "a");
  }, ye = () => {
    $("readout_error", "d");
  }, ue = () => {
    j("readout_error", "a");
  }, le = () => {
    j("readout_error", "d");
  }, oe = () => {
    $("readout_length", "a");
  }, x = () => {
    $("readout_length", "d");
  }, ge = () => {
    j("readout_length", "a");
  }, re = () => {
    j("readout_length", "d");
  }, Ie = (ce) => {
    _(`qubit_${s}_${ce}_T1 = ${h}${ce}, name="T1"${g}`);
  }, je = (ce, Be) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${ce}_T1`,
      title_key: `qubit[${ce}].T1`,
      qubit_index: ce,
      property: "T1",
      parentKey: b,
      topLevelKey: k,
      data: Be.T1,
      code_header: `${h}${ce}, name="T1"`,
      code_footer: g,
      code_key: ""
    });
  }, _e = (ce) => {
    _(`qubit_${s}_${ce}_T2 = ${h}${ce}, name="T2"${g}`);
  }, Ee = (ce, Be) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${ce}_T2`,
      title_key: `qubit[${ce}].T2`,
      qubit_index: ce,
      property: "T2",
      parentKey: b,
      topLevelKey: k,
      data: Be.T2,
      code_header: `${h}${ce}, name="T2"`,
      code_footer: g,
      code_key: ""
    });
  }, ie = (ce) => {
    _(`qubit_${s}_${ce}_anharmonicity = ${h}${ce}, name="anharmonicity"${g}`);
  }, Te = (ce, Be) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${ce}_anharmonicity`,
      title_key: `qubit[${ce}].anharmonicity`,
      qubit_index: ce,
      property: "anharmonicity",
      parentKey: b,
      topLevelKey: k,
      data: Be.anharmonicity,
      code_header: `${h}${ce}, name="anharmonicity"`,
      code_footer: g,
      code_key: ""
    });
  }, Ue = (ce) => {
    _(`qubit_${s}_${ce}_frequency = ${h}${ce}, name="frequency"${g}`);
  }, Ke = (ce, Be) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${ce}_frequency`,
      title_key: `qubit[${ce}].frequency`,
      qubit_index: ce,
      property: "frequency",
      parentKey: b,
      topLevelKey: k,
      data: Be.frequency,
      code_header: `${h}${ce}, name="frequency"`,
      code_footer: g,
      code_key: ""
    });
  }, We = (ce) => {
    _(`qubit_${s}_${ce}_prob_meas0_prep1 = ${h}${ce}, name="prob_meas0_prep1"${g}`);
  }, vt = (ce, Be) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${ce}_prob_meas0_prep1`,
      title_key: `qubit[${ce}].prob_meas0_prep1`,
      qubit_index: ce,
      property: "prob_meas0_prep1",
      parentKey: b,
      topLevelKey: k,
      data: Be.prob_meas0_prep1,
      code_header: `${h}${ce}, name="prob_meas0_prep1"`,
      code_footer: g,
      code_key: ""
    });
  }, qt = (ce) => {
    _(`qubit_${s}_${ce}_prob_meas1_prep0 = ${h}${ce}, name="prob_meas1_prep0"${g}`);
  }, rt = (ce, Be) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${ce}_prob_meas1_prep0`,
      title_key: `qubit[${ce}].prob_meas1_prep0`,
      qubit_index: ce,
      property: "prob_meas1_prep0",
      parentKey: b,
      topLevelKey: k,
      data: Be.prob_meas1_prep0,
      code_header: `${h}${ce}, name="prob_meas1_prep0"`,
      code_footer: g,
      code_key: ""
    });
  }, mt = (ce) => {
    _(`qubit_${s}_${ce}_readout_error = ${h}${ce}, name="readout_error"${g}`);
  }, Rt = (ce, Be) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${ce}_readout_error`,
      title_key: `qubit[${ce}].readout_error`,
      qubit_index: ce,
      property: "readout_error",
      parentKey: b,
      topLevelKey: k,
      data: Be.readout_error,
      code_header: `${h}${ce}, name="readout_error"`,
      code_footer: g,
      code_key: ""
    });
  }, ot = (ce) => {
    _(`qubit_${s}_${ce}_readout_length = ${h}${ce}, name="readout_length"${g}`);
  }, ut = (ce, Be) => {
    y({
      datatype: "nudv-map",
      subtype: "qubit-property",
      key: `qubit_${ce}_readout_length`,
      title_key: `qubit[${ce}].readout_length`,
      qubit_index: ce,
      property: "readout_length",
      parentKey: b,
      topLevelKey: k,
      data: Be.readout_length,
      code_header: `${h}${ce}, name="readout_length"`,
      code_footer: g,
      code_key: ""
    });
  }, Ce = (ce) => {
    _(`qubit_${s}_${ce} = ${h}${ce}${g}`);
  };
  return t.$$set = (ce) => {
    "key" in ce && l(0, s = ce.key), "value" in ce && l(15, o = ce.value), "addToBasket" in ce && l(1, _ = ce.addToBasket), "basket" in ce && a(l(2, c = ce.basket)), "level" in ce && l(3, d = ce.level), "code_header" in ce && l(4, h = ce.code_header), "code_type" in ce && l(16, p = ce.code_type), "code_footer" in ce && l(5, g = ce.code_footer), "parentKey" in ce && l(6, b = ce.parentKey), "topLevelKey" in ce && l(7, k = ce.topLevelKey), "openTimeMachine" in ce && l(8, y = ce.openTimeMachine), "property_time" in ce && l(17, v = ce.property_time);
  }, [
    s,
    _,
    c,
    d,
    h,
    g,
    b,
    k,
    y,
    w,
    i,
    r,
    q,
    $,
    j,
    o,
    p,
    v,
    I,
    A,
    M,
    z,
    H,
    B,
    R,
    P,
    O,
    F,
    L,
    X,
    V,
    Q,
    Z,
    ae,
    se,
    K,
    Y,
    W,
    J,
    ee,
    we,
    Re,
    ve,
    me,
    fe,
    G,
    ye,
    ue,
    le,
    oe,
    x,
    ge,
    re,
    Ie,
    je,
    _e,
    Ee,
    ie,
    Te,
    Ue,
    Ke,
    We,
    vt,
    qt,
    rt,
    mt,
    Rt,
    ot,
    ut,
    Ce
  ];
}
class I4 extends Ve {
  constructor(e) {
    super(), Qe(
      this,
      e,
      E4,
      O4,
      Fe,
      {
        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 ed(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) ? R4 : D4
    );
  }
  let i = l(t), n = i(t);
  return {
    c() {
      n.c(), e = Ae();
    },
    m(a, r) {
      n.m(a, r), S(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 && C(e), n.d(a);
    }
  };
}
function D4(t) {
  let e, l, i, n, a;
  return {
    c() {
      var r, s, o, _, 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*/
      ((_ = t[1][0]) == null ? void 0 : _.x) * /*qubit_gap*/
      t[2]}px;
      background-color: ${/*colorScale*/
      t[6](
        /*edge_info_value*/
        (c = t[5]) == null ? void 0 : c.value
      )};`);
    },
    m(r, s) {
      S(r, e, s), n || (a = [
        te(
          e,
          "mouseover",
          /*mouseover_handler_1*/
          t[17]
        ),
        te(
          e,
          "focus",
          /*focus_handler_1*/
          t[18]
        ),
        te(
          e,
          "click",
          /*click_handler_1*/
          t[19]
        ),
        te(
          e,
          "mouseout",
          /*mouseout_handler_1*/
          t[20]
        ),
        te(
          e,
          "blur",
          /*blur_handler_1*/
          t[21]
        )
      ], n = !0);
    },
    p(r, s) {
      var o, _, 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*/
      126 && 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*/
        ((_ = r[1][0]) == null ? void 0 : _.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
      )};`) && xt(e, "style", i);
    },
    d(r) {
      r && C(e), n = !1, wt(a);
    }
  };
}
function R4(t) {
  let e, l, i, n, a;
  return {
    c() {
      var r, s, o, _, 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*/
      ((_ = t[1][0]) == null ? void 0 : _.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
      )};`);
    },
    m(r, s) {
      S(r, e, s), n || (a = [
        te(
          e,
          "mouseover",
          /*mouseover_handler*/
          t[12]
        ),
        te(
          e,
          "focus",
          /*focus_handler*/
          t[13]
        ),
        te(
          e,
          "click",
          /*click_handler*/
          t[14]
        ),
        te(
          e,
          "mouseout",
          /*mouseout_handler*/
          t[15]
        ),
        te(
          e,
          "blur",
          /*blur_handler*/
          t[16]
        )
      ], n = !0);
    },
    p(r, s) {
      var o, _, 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*/
      126 && 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*/
        ((_ = r[1][0]) == null ? void 0 : _.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
      )};`) && xt(e, "style", i);
    },
    d(r) {
      r && C(e), n = !1, wt(a);
    }
  };
}
function H4(t) {
  let e, l = (
    /*edge*/
    t[0] && /*edge_nodes*/
    t[1] && ed(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*edge*/
      i[0] && /*edge_nodes*/
      i[1] ? l ? l.p(i, n) : (l = ed(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function L4(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: _, colorScale: c = () => {
  }, openTooltip: d = () => {
  }, hideTooltip: h = () => {
  }, moveTooltip: p = () => {
  }, edge_info_selected: g } = e;
  const b = (M) => {
    d(M, "Edge " + i.join("-"), g, o, "edge-" + i.join("-"), i, !1);
  }, k = (M) => {
    d(M, "Edge " + i.join("-"), g, o, "edge-" + i.join("-"), i, !0);
  }, y = (M) => {
    d(M, "Edge " + i.join("-"), g, o, "edge-" + i.join("-"), i, !0);
  }, v = (M) => {
    h(!1);
  }, w = (M) => {
    h(!0);
  }, q = (M) => {
    d(M, "Edge " + i.join("-"), g, o, "edge-" + i.join("-"), i, !1);
  }, $ = (M) => {
    d(M, "Edge " + i.join("-"), g, o, "edge-" + i.join("-"), i, !0);
  }, j = (M) => {
    d(M, "Edge " + i.join("-"), g, o, "edge-" + i.join("-"), i, !0);
  }, I = (M) => {
    h(!1);
  }, A = (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(10, _ = 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(11, p = M.moveTooltip), "edge_info_selected" in M && l(9, g = M.edge_info_selected);
  }, [
    i,
    n,
    a,
    r,
    s,
    o,
    c,
    d,
    h,
    g,
    _,
    p,
    b,
    k,
    y,
    v,
    w,
    q,
    $,
    j,
    I,
    A
  ];
}
class o0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, L4, H4, Fe, {
      edge: 0,
      edge_nodes: 1,
      qubit_gap: 2,
      edge_width: 3,
      padding: 4,
      edge_info_value: 5,
      info_type: 10,
      colorScale: 6,
      openTooltip: 7,
      hideTooltip: 8,
      moveTooltip: 11,
      edge_info_selected: 9
    });
  }
}
function td(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: ${ec(
        /*colorScale*/
        t[6](
          /*qubit_info_value*/
          t[5].value
        )
      )}`);
    },
    m(s, o) {
      S(s, e, o), f(e, l), a || (r = [
        te(
          e,
          "mouseover",
          /*mouseover_handler*/
          t[13]
        ),
        te(
          e,
          "focus",
          /*focus_handler*/
          t[14]
        ),
        te(
          e,
          "click",
          /*click_handler*/
          t[15]
        ),
        te(
          e,
          "mouseout",
          /*mouseout_handler*/
          t[16]
        ),
        te(
          e,
          "blur",
          /*blur_handler*/
          t[17]
        )
      ], a = !0);
    },
    p(s, o) {
      o & /*qubit*/
      1 && U(
        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*/
      126 && 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: ${ec(
        /*colorScale*/
        s[6](
          /*qubit_info_value*/
          s[5].value
        )
      )}`) && xt(e, "style", n);
    },
    d(s) {
      s && C(e), a = !1, wt(r);
    }
  };
}
function F4(t) {
  let e, l = (
    /*qubit*/
    t[0] !== void 0 && /*qubit_node*/
    t[1] && td(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*qubit*/
      i[0] !== void 0 && /*qubit_node*/
      i[1] ? l ? l.p(i, n) : (l = td(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function Q4(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: _, info_type: c, colorScale: d = () => {
  }, openTooltip: h = () => {
  }, hideTooltip: p = () => {
  }, moveTooltip: g = () => {
  }, qubit_info_selected: b } = e;
  const k = ($) => {
    $.preventDefault(), h($, "Qubit " + i, b, _, "qubit-" + i, [i], !1);
  }, y = ($) => {
    console.log("/"), $.preventDefault(), h($, "Qubit " + i, b, _, "qubit-" + i, [i], !0);
  }, v = ($) => {
    $.preventDefault(), h($, "Qubit " + i, b, _, "qubit-" + i, [i], !0);
  }, w = ($) => {
    $.preventDefault(), p(!1);
  }, q = ($) => {
    console.log("/"), $.preventDefault(), p(!0);
  };
  return t.$$set = ($) => {
    "qubit" in $ && l(0, i = $.qubit), "qubit_node" in $ && l(1, n = $.qubit_node), "qubit_gap" in $ && l(2, a = $.qubit_gap), "edge_width" in $ && l(10, r = $.edge_width), "padding" in $ && l(3, s = $.padding), "qubit_radius" in $ && l(4, o = $.qubit_radius), "qubit_info_value" in $ && l(5, _ = $.qubit_info_value), "info_type" in $ && l(11, c = $.info_type), "colorScale" in $ && l(6, d = $.colorScale), "openTooltip" in $ && l(7, h = $.openTooltip), "hideTooltip" in $ && l(8, p = $.hideTooltip), "moveTooltip" in $ && l(12, g = $.moveTooltip), "qubit_info_selected" in $ && l(9, b = $.qubit_info_selected);
  }, [
    i,
    n,
    a,
    s,
    o,
    _,
    d,
    h,
    p,
    b,
    r,
    c,
    g,
    k,
    y,
    v,
    w,
    q
  ];
}
class u0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, Q4, F4, Fe, {
      qubit: 0,
      qubit_node: 1,
      qubit_gap: 2,
      edge_width: 10,
      padding: 3,
      qubit_radius: 4,
      qubit_info_value: 5,
      info_type: 11,
      colorScale: 6,
      openTooltip: 7,
      hideTooltip: 8,
      moveTooltip: 12,
      qubit_info_selected: 9
    });
  }
}
function ld(t, e, l) {
  const i = t.slice();
  return i[12] = e[l], i[14] = l, i;
}
function id(t) {
  let e, l;
  return {
    c() {
      e = m("div"), u(e, "class", "histogram-bin svelte-k599bk"), u(e, "style", l = `width: ${ul / /*counts*/
      t[6].length - 1}px;
        height: ${nd * /*count*/
      t[12] / /*max_count*/
      t[7]}px;
        background-color: ${/*colorScale*/
      t[0](
        /*bins*/
        t[5][
          /*ci*/
          t[14]
        ].x0
      )}`);
    },
    m(i, n) {
      S(i, e, n);
    },
    p(i, n) {
      n & /*counts, max_count, colorScale, bins*/
      225 && l !== (l = `width: ${ul / /*counts*/
      i[6].length - 1}px;
        height: ${nd * /*count*/
      i[12] / /*max_count*/
      i[7]}px;
        background-color: ${/*colorScale*/
      i[0](
        /*bins*/
        i[5][
          /*ci*/
          i[14]
        ].x0
      )}`) && u(e, "style", l);
    },
    d(i) {
      i && C(e);
    }
  };
}
function V4(t) {
  let e, l, i, n, a = (
    /*roundN*/
    t[8](
      /*mean*/
      t[3]
    ) + ""
  ), r, s, o, _, c, d, h, p, g, b, k, y = (
    /*roundN*/
    t[8](
      /*min*/
      t[1]
    ) + ""
  ), v, w, q, $, j = (
    /*roundN*/
    t[8](
      /*max*/
      t[2]
    ) + ""
  ), I, A = $e(
    /*counts*/
    t[6]
  ), M = [];
  for (let z = 0; z < A.length; z += 1)
    M[z] = id(ld(t, A, z));
  return {
    c() {
      e = m("div"), l = m("div"), i = m("span"), n = E("Med: "), r = E(a), o = N(), _ = m("div");
      for (let z = 0; z < M.length; z += 1)
        M[z].c();
      c = N(), d = m("div"), p = N(), g = m("div"), b = m("span"), k = E("Min: "), v = E(y), w = N(), q = m("span"), $ = E("Max: "), I = E(j), u(i, "class", "median svelte-k599bk"), u(i, "style", s = `left: ${/*median*/
      (t[4] - /*min*/
      t[1]) / /*max*/
      (t[2] - /*min*/
      t[1]) * ul}px; 
      transform: ${/*median*/
      (t[4] - /*min*/
      t[1]) / /*max*/
      (t[2] - /*min*/
      t[1]) * ul > 60 ? "translateX(-50%)" : ""};`), u(l, "class", "histogram-stats-wrap svelte-k599bk"), u(l, "style", `width: ${ul}px`), u(d, "class", "median-marker svelte-k599bk"), u(d, "style", h = `left:${/*median*/
      (t[4] - /*min*/
      t[1]) / /*max*/
      (t[2] - /*min*/
      t[1]) * ul}px;`), u(_, "class", "histogram-wrap svelte-k599bk"), u(_, "style", `width: ${ul}px`), u(b, "class", "min svelte-k599bk"), u(q, "class", "max svelte-k599bk"), u(g, "class", "histogram-stats-wrap svelte-k599bk"), u(g, "style", `width: ${ul}px`), u(e, "style", `width: ${ul}px; padding: `), u(e, "class", "svelte-k599bk");
    },
    m(z, H) {
      S(z, e, H), f(e, l), f(l, i), f(i, n), f(i, r), f(e, o), f(e, _);
      for (let B = 0; B < M.length; B += 1)
        M[B] && M[B].m(_, null);
      f(_, c), f(_, d), f(e, p), f(e, g), f(g, b), f(b, k), f(b, v), f(g, w), f(g, q), f(q, $), f(q, I);
    },
    p(z, [H]) {
      if (H & /*mean*/
      8 && a !== (a = /*roundN*/
      z[8](
        /*mean*/
        z[3]
      ) + "") && U(r, a), H & /*median, min, max*/
      22 && s !== (s = `left: ${/*median*/
      (z[4] - /*min*/
      z[1]) / /*max*/
      (z[2] - /*min*/
      z[1]) * ul}px; 
      transform: ${/*median*/
      (z[4] - /*min*/
      z[1]) / /*max*/
      (z[2] - /*min*/
      z[1]) * ul > 60 ? "translateX(-50%)" : ""};`) && u(i, "style", s), H & /*total_width, counts, bar_height, max_count, colorScale, bins*/
      225) {
        A = $e(
          /*counts*/
          z[6]
        );
        let B;
        for (B = 0; B < A.length; B += 1) {
          const R = ld(z, A, B);
          M[B] ? M[B].p(R, H) : (M[B] = id(R), M[B].c(), M[B].m(_, c));
        }
        for (; B < M.length; B += 1)
          M[B].d(1);
        M.length = A.length;
      }
      H & /*median, min, max*/
      22 && h !== (h = `left:${/*median*/
      (z[4] - /*min*/
      z[1]) / /*max*/
      (z[2] - /*min*/
      z[1]) * ul}px;`) && u(d, "style", h), H & /*min*/
      2 && y !== (y = /*roundN*/
      z[8](
        /*min*/
        z[1]
      ) + "") && U(v, y), H & /*max*/
      4 && j !== (j = /*roundN*/
      z[8](
        /*max*/
        z[2]
      ) + "") && U(I, j);
    },
    i: ne,
    o: ne,
    d(z) {
      z && C(e), Ye(M, z);
    }
  };
}
let ul = 200;
const nd = 40;
function X4(t, e, l) {
  let { data: i = {}, colorScale: n = () => {
  } } = e, a, r, s, o, _, c, d, h;
  function p(b) {
    l(1, a = b.min), l(2, r = b.max), l(3, s = b.mean), l(4, o = b.median), _ = b.values, l(5, c = kb().thresholds(20)(_)), l(6, d = c.map((k) => k.length)), l(7, h = Math.max(...d));
  }
  let g = (b) => Math.round(b * 1e4) / 1e4;
  return Tt(() => {
    p(i);
  }), t.$$set = (b) => {
    "data" in b && l(9, i = b.data), "colorScale" in b && l(0, n = b.colorScale);
  }, t.$$.update = () => {
    t.$$.dirty & /*data*/
    512 && p(i);
  }, [n, a, r, s, o, c, d, h, g, i];
}
class Ka extends Ve {
  constructor(e) {
    super(), Qe(this, e, X4, V4, Fe, { data: 9, colorScale: 0 });
  }
}
const ad = {
  x: 50,
  y: 120
};
function rd(t, e, l) {
  const i = t.slice();
  return i[48] = e[l], i;
}
function sd(t, e, l) {
  const i = t.slice();
  return i[51] = e[l], i[53] = l, i;
}
function od(t, e, l) {
  const i = t.slice();
  return i[54] = e[l], i;
}
function ud(t, e, l) {
  const i = t.slice();
  return i[54] = e[l], i;
}
function fd(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[21].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1xkxkc8");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function G4(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), u(e, "class", "svelte-1xkxkc8");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a[0] & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function Y4(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), u(e, "class", "svelte-1xkxkc8");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a[0] & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function _d(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 = N(), r = E(a), e.__value = s = JSON.stringify(
        /*item*/
        t[54]
      ), pt(e, e.__value);
    },
    m(o, _) {
      S(o, e, _), f(e, i), f(e, n), f(e, r);
    },
    p(o, _) {
      _[0] & /*qubit_info_list*/
      2048 && l !== (l = /*item*/
      (o[54].feature || /*item*/
      o[54].gate) + "") && U(i, l), _[0] & /*qubit_info_list*/
      2048 && a !== (a = /*item*/
      o[54].gate ? "- " + /*item*/
      o[54].type : "") && U(r, a), _[0] & /*qubit_info_list*/
      2048 && s !== (s = JSON.stringify(
        /*item*/
        o[54]
      )) && (e.__value = s, pt(e, e.__value));
    },
    d(o) {
      o && C(e);
    }
  };
}
function cd(t) {
  let e, l;
  return e = new Ka({
    props: {
      data: (
        /*qubit_stats*/
        t[15]
      ),
      colorScale: (
        /*colorScale*/
        t[6]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function dd(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 = N(), r = E(a), e.__value = s = JSON.stringify(
        /*item*/
        t[54]
      ), pt(e, e.__value);
    },
    m(o, _) {
      S(o, e, _), f(e, i), f(e, n), f(e, r);
    },
    p(o, _) {
      _[0] & /*edge_info_list*/
      4096 && l !== (l = /*item*/
      (o[54].gate || /*item*/
      o[54].feature) + "") && U(i, l), _[0] & /*edge_info_list*/
      4096 && a !== (a = /*item*/
      o[54].gate ? "- " + /*item*/
      o[54].type : "") && U(r, a), _[0] & /*edge_info_list*/
      4096 && s !== (s = JSON.stringify(
        /*item*/
        o[54]
      )) && (e.__value = s, pt(e, e.__value));
    },
    d(o) {
      o && C(e);
    }
  };
}
function hd(t) {
  let e, l;
  return e = new Ka({
    props: {
      data: (
        /*edge_stats*/
        t[16]
      ),
      colorScale: (
        /*edgeColorScale*/
        t[7]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function pd(t) {
  let e, l, i, n = $e(
    /*qubit_edges*/
    t[1]
  ), a = [];
  for (let c = 0; c < n.length; c += 1)
    a[c] = md(sd(t, n, c));
  const r = (c) => D(a[c], 1, 1, () => {
    a[c] = null;
  });
  let s = $e(
    /*qubit_index*/
    t[2]
  ), o = [];
  for (let c = 0; c < s.length; c += 1)
    o[c] = gd(rd(t, s, c));
  const _ = (c) => D(o[c], 1, 1, () => {
    o[c] = null;
  });
  return {
    c() {
      for (let c = 0; c < a.length; c += 1)
        a[c].c();
      e = N();
      for (let c = 0; c < o.length; c += 1)
        o[c].c();
      l = Ae();
    },
    m(c, d) {
      for (let h = 0; h < a.length; h += 1)
        a[h] && a[h].m(c, d);
      S(c, e, d);
      for (let h = 0; h < o.length; h += 1)
        o[h] && o[h].m(c, d);
      S(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 = $e(
          /*qubit_edges*/
          c[1]
        );
        let h;
        for (h = 0; h < n.length; h += 1) {
          const p = sd(c, n, h);
          a[h] ? (a[h].p(p, d), T(a[h], 1)) : (a[h] = md(p), a[h].c(), T(a[h], 1), a[h].m(e.parentNode, e));
        }
        for (be(), h = n.length; h < a.length; h += 1)
          r(h);
        ke();
      }
      if (d[0] & /*qubit_index, node_map, $qubit_info_selected, qubit_info_values, colorScale, openTooltip, hideTooltip, moveTooltip*/
      478159172) {
        s = $e(
          /*qubit_index*/
          c[2]
        );
        let h;
        for (h = 0; h < s.length; h += 1) {
          const p = rd(c, s, h);
          o[h] ? (o[h].p(p, d), T(o[h], 1)) : (o[h] = gd(p), o[h].c(), T(o[h], 1), o[h].m(l.parentNode, l));
        }
        for (be(), h = s.length; h < o.length; h += 1)
          _(h);
        ke();
      }
    },
    i(c) {
      if (!i) {
        for (let d = 0; d < n.length; d += 1)
          T(a[d]);
        for (let d = 0; d < s.length; d += 1)
          T(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 && (C(e), C(l)), Ye(a, c), Ye(o, c);
    }
  };
}
function md(t) {
  var i, n;
  let e, l;
  return e = new o0({
    props: {
      edge: (
        /*edge*/
        t[51]
      ),
      edge_nodes: (
        /*edge*/
        (i = t[51]) == null ? void 0 : i.toSorted(wd).map(
          /*func_1*/
          t[36]
        )
      ),
      qubit_gap: Da,
      edge_width: f0,
      padding: Ra,
      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() {
      pe(e.$$.fragment);
    },
    m(a, r) {
      de(e, a, r), l = !0;
    },
    p(a, r) {
      var o, _;
      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(wd).map(
        /*func_1*/
        a[36]
      )), r[0] & /*edge_info_values, qubit_edges, $edge_info_selected*/
      4210690 && (s.edge_info_value = /*edge_info_values*/
      (_ = a[14][
        /*edge*/
        a[51].join("-")
      ] || /*edge_info_values*/
      a[14][
        /*edge*/
        a[51][1] + "-" + /*edge*/
        a[51][0]
      ]) == null ? void 0 : _.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 || (T(e.$$.fragment, a), l = !0);
    },
    o(a) {
      D(e.$$.fragment, a), l = !1;
    },
    d(a) {
      he(e, a);
    }
  };
}
function gd(t) {
  let e, l;
  return e = new u0({
    props: {
      qubit: (
        /*qi*/
        t[48]
      ),
      qubit_node: (
        /*node_map*/
        t[8][
          /*qi*/
          t[48]
        ]
      ),
      qubit_gap: Da,
      edge_width: f0,
      padding: Ra,
      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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function bd(t) {
  let e, l = bt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), u(e, "class", "desc svelte-1xkxkc8");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a[0] & /*key*/
      1 && l !== (l = bt[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function kd(t) {
  let e, l, i = (
    /*tooltipInfo*/
    t[20].item + ""
  ), n, a, r = (
    /*tooltipInfo*/
    (t[20].key.gate || /*tooltipInfo*/
    t[20].key.feature) + ""
  ), s, o, _ = (
    /*tooltipInfo*/
    (t[20].key.type ? (
      /*tooltipInfo*/
      t[20].key.type
    ) : "") + ""
  ), c, d, h, p, g, b, k = (
    /*tooltipInfo*/
    t[20].value.value + ""
  ), y, v, w, q, $, j = (
    /*tooltipInfo*/
    t[20].value.asof + ""
  ), I, A, M, z, H, B, R, P, O, F, L = (
    /*tooltipInfo*/
    t[20].value.unit && vd(t)
  ), X = (
    /*addToBasket*/
    t[3] && yd(t)
  );
  return {
    c() {
      e = m("div"), l = m("h5"), n = E(i), a = E("–"), s = E(r), o = N(), c = E(_), d = N(), h = m("table"), p = m("tr"), g = m("th"), g.textContent = "Value", b = m("td"), y = E(k), v = N(), w = m("tr"), q = m("th"), q.textContent = "Date", $ = m("td"), I = E(j), A = N(), L && L.c(), M = N(), z = m("div"), X && X.c(), H = N(), 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>', u(l, "class", "svelte-1xkxkc8"), u(g, "class", "svelte-1xkxkc8"), u(b, "class", "svelte-1xkxkc8"), u(q, "class", "svelte-1xkxkc8"), u($, "class", "svelte-1xkxkc8"), u(h, "class", "svelte-1xkxkc8"), u(B, "class", "close svelte-1xkxkc8"), At(z, "text-align", "right"), u(e, "class", "tooltip svelte-1xkxkc8"), u(e, "style", R = `right: 1rem; top: ${/*tooltipY*/
      t[19]}px;`);
    },
    m(V, Q) {
      S(V, e, Q), f(e, l), f(l, n), f(l, a), f(l, s), f(l, o), f(l, c), f(e, d), f(e, h), f(h, p), f(p, g), f(p, b), f(b, y), f(h, v), f(h, w), f(w, q), f(w, $), f($, I), f(h, A), L && L.m(h, null), f(e, M), f(e, z), X && X.m(z, null), f(z, H), f(z, B), P = !0, O || (F = te(
        B,
        "click",
        /*click_handler_3*/
        t[38]
      ), O = !0);
    },
    p(V, Q) {
      (!P || Q[0] & /*tooltipInfo*/
      1048576) && i !== (i = /*tooltipInfo*/
      V[20].item + "") && U(n, i), (!P || Q[0] & /*tooltipInfo*/
      1048576) && r !== (r = /*tooltipInfo*/
      (V[20].key.gate || /*tooltipInfo*/
      V[20].key.feature) + "") && U(s, r), (!P || Q[0] & /*tooltipInfo*/
      1048576) && _ !== (_ = /*tooltipInfo*/
      (V[20].key.type ? (
        /*tooltipInfo*/
        V[20].key.type
      ) : "") + "") && U(c, _), (!P || Q[0] & /*tooltipInfo*/
      1048576) && k !== (k = /*tooltipInfo*/
      V[20].value.value + "") && U(y, k), (!P || Q[0] & /*tooltipInfo*/
      1048576) && j !== (j = /*tooltipInfo*/
      V[20].value.asof + "") && U(I, j), /*tooltipInfo*/
      V[20].value.unit ? L ? L.p(V, Q) : (L = vd(V), L.c(), L.m(h, null)) : L && (L.d(1), L = null), /*addToBasket*/
      V[3] ? X ? (X.p(V, Q), Q[0] & /*addToBasket*/
      8 && T(X, 1)) : (X = yd(V), X.c(), T(X, 1), X.m(z, H)) : X && (be(), D(X, 1, 1, () => {
        X = null;
      }), ke()), (!P || Q[0] & /*tooltipY*/
      524288 && R !== (R = `right: 1rem; top: ${/*tooltipY*/
      V[19]}px;`)) && u(e, "style", R);
    },
    i(V) {
      P || (T(X), P = !0);
    },
    o(V) {
      D(X), P = !1;
    },
    d(V) {
      V && C(e), L && L.d(), X && X.d(), O = !1, F();
    }
  };
}
function vd(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), u(l, "class", "svelte-1xkxkc8"), u(i, "class", "svelte-1xkxkc8");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s[0] & /*tooltipInfo*/
      1048576 && n !== (n = /*tooltipInfo*/
      r[20].value.unit + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function yd(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[21].includes(
          /*circuitElemCartKey*/
          t[17]
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1xkxkc8");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function K4(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B = (
    /*addToBasket*/
    t[3] && fd(t)
  );
  function R(Y, W) {
    if (
      /*level*/
      Y[5] == 1
    )
      return Y4;
    if (
      /*level*/
      Y[5] == 2
    )
      return G4;
  }
  let P = R(t), O = P && P(t), F = $e(
    /*qubit_info_list*/
    t[11]
  ), L = [];
  for (let Y = 0; Y < F.length; Y += 1)
    L[Y] = _d(ud(t, F, Y));
  let X = (
    /*qubit_stats*/
    t[15] && /*colorScale*/
    t[6] && cd(t)
  ), V = $e(
    /*edge_info_list*/
    t[12]
  ), Q = [];
  for (let Y = 0; Y < V.length; Y += 1)
    Q[Y] = dd(od(t, V, Y));
  let Z = (
    /*edge_stats*/
    t[16] && /*edgeColorScale*/
    t[7] && hd(t)
  ), ae = (
    /*qubit_edges*/
    t[1] && /*node_map*/
    t[8] && pd(t)
  ), se = bt[
    /*key*/
    t[0]
  ] && bd(t), K = (
    /*showTooltip*/
    t[18] && kd(t)
  );
  return {
    c() {
      e = m("article"), B && B.c(), l = N(), O && O.c(), i = N(), n = m("div"), a = m("div"), r = m("label"), r.textContent = "For Qubits:", s = N(), o = m("select");
      for (let Y = 0; Y < L.length; Y += 1)
        L[Y].c();
      _ = N(), c = m("div"), X && X.c(), d = N(), h = m("div"), p = m("label"), p.textContent = "For Edges:", g = N(), b = m("select");
      for (let Y = 0; Y < Q.length; Y += 1)
        Q[Y].c();
      k = N(), y = m("div"), Z && Z.c(), v = N(), w = m("div"), q = N(), $ = m("div"), ae && ae.c(), I = N(), se && se.c(), A = N(), K && K.c(), u(r, "for", "qubit_rep"), u(r, "class", "svelte-1xkxkc8"), u(o, "name", "qubit_rep"), u(o, "id", "qubit_rep"), u(o, "class", "svelte-1xkxkc8"), u(c, "class", "stats"), u(a, "class", "svelte-1xkxkc8"), u(p, "for", "edge_rep"), u(p, "class", "svelte-1xkxkc8"), u(b, "name", "edge_rep"), u(b, "id", "edge_rep"), u(b, "class", "svelte-1xkxkc8"), u(y, "class", "stats"), u(h, "class", "svelte-1xkxkc8"), u(n, "class", "controls svelte-1xkxkc8"), u(w, "class", "circuit-background-map svelte-1xkxkc8"), u($, "class", "circuit svelte-1xkxkc8"), u($, "style", j = `width: ${/*width*/
      t[9]}px; height: ${/*height*/
      t[10]}px; padding-bottom: 3rem;`), u(e, "class", "svelte-1xkxkc8");
    },
    m(Y, W) {
      S(Y, e, W), B && B.m(e, null), f(e, l), O && O.m(e, null), f(e, i), f(e, n), f(n, a), f(a, r), f(a, s), f(a, o);
      for (let J = 0; J < L.length; J += 1)
        L[J] && L[J].m(o, null);
      f(a, _), f(a, c), X && X.m(c, null), f(n, d), f(n, h), f(h, p), f(h, g), f(h, b);
      for (let J = 0; J < Q.length; J += 1)
        Q[J] && Q[J].m(b, null);
      f(h, k), f(h, y), Z && Z.m(y, null), f(e, v), f(e, w), f(e, q), f(e, $), ae && ae.m($, null), f(e, I), se && se.m(e, null), f(e, A), K && K.m(e, null), M = !0, z || (H = [
        te(
          o,
          "change",
          /*change_handler*/
          t[33]
        ),
        te(
          b,
          "change",
          /*change_handler_1*/
          t[34]
        ),
        te(
          w,
          "click",
          /*click_handler_1*/
          t[35]
        )
      ], z = !0);
    },
    p(Y, W) {
      if (/*addToBasket*/
      Y[3] ? B ? (B.p(Y, W), W[0] & /*addToBasket*/
      8 && T(B, 1)) : (B = fd(Y), B.c(), T(B, 1), B.m(e, l)) : B && (be(), D(B, 1, 1, () => {
        B = null;
      }), ke()), P === (P = R(Y)) && O ? O.p(Y, W) : (O && O.d(1), O = P && P(Y), O && (O.c(), O.m(e, i))), W[0] & /*qubit_info_list*/
      2048) {
        F = $e(
          /*qubit_info_list*/
          Y[11]
        );
        let J;
        for (J = 0; J < F.length; J += 1) {
          const ee = ud(Y, F, J);
          L[J] ? L[J].p(ee, W) : (L[J] = _d(ee), L[J].c(), L[J].m(o, null));
        }
        for (; J < L.length; J += 1)
          L[J].d(1);
        L.length = F.length;
      }
      if (/*qubit_stats*/
      Y[15] && /*colorScale*/
      Y[6] ? X ? (X.p(Y, W), W[0] & /*qubit_stats, colorScale*/
      32832 && T(X, 1)) : (X = cd(Y), X.c(), T(X, 1), X.m(c, null)) : X && (be(), D(X, 1, 1, () => {
        X = null;
      }), ke()), W[0] & /*edge_info_list*/
      4096) {
        V = $e(
          /*edge_info_list*/
          Y[12]
        );
        let J;
        for (J = 0; J < V.length; J += 1) {
          const ee = od(Y, V, J);
          Q[J] ? Q[J].p(ee, W) : (Q[J] = dd(ee), Q[J].c(), Q[J].m(b, null));
        }
        for (; J < Q.length; J += 1)
          Q[J].d(1);
        Q.length = V.length;
      }
      /*edge_stats*/
      Y[16] && /*edgeColorScale*/
      Y[7] ? Z ? (Z.p(Y, W), W[0] & /*edge_stats, edgeColorScale*/
      65664 && T(Z, 1)) : (Z = hd(Y), Z.c(), T(Z, 1), Z.m(y, null)) : Z && (be(), D(Z, 1, 1, () => {
        Z = null;
      }), ke()), /*qubit_edges*/
      Y[1] && /*node_map*/
      Y[8] ? ae ? (ae.p(Y, W), W[0] & /*qubit_edges, node_map*/
      258 && T(ae, 1)) : (ae = pd(Y), ae.c(), T(ae, 1), ae.m($, null)) : ae && (be(), D(ae, 1, 1, () => {
        ae = null;
      }), ke()), (!M || W[0] & /*width, height*/
      1536 && j !== (j = `width: ${/*width*/
      Y[9]}px; height: ${/*height*/
      Y[10]}px; padding-bottom: 3rem;`)) && u($, "style", j), bt[
        /*key*/
        Y[0]
      ] ? se ? se.p(Y, W) : (se = bd(Y), se.c(), se.m(e, A)) : se && (se.d(1), se = null), /*showTooltip*/
      Y[18] ? K ? (K.p(Y, W), W[0] & /*showTooltip*/
      262144 && T(K, 1)) : (K = kd(Y), K.c(), T(K, 1), K.m(e, null)) : K && (be(), D(K, 1, 1, () => {
        K = null;
      }), ke());
    },
    i(Y) {
      M || (T(B), T(X), T(Z), T(ae), T(K), M = !0);
    },
    o(Y) {
      D(B), D(X), D(Z), D(ae), D(K), M = !1;
    },
    d(Y) {
      Y && C(e), B && B.d(), O && O.d(), Ye(L, Y), X && X.d(), Ye(Q, Y), Z && Z.d(), ae && ae.d(), se && se.d(), K && K.d(), z = !1, wt(H);
    }
  };
}
let Da = 45, f0 = 15, Ra = 20;
const wd = (t, e) => t - e;
function U4(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(p, (ue) => l(21, i = ue)), p), r, s;
  t.$$.on_destroy.push(() => n());
  let { key: o = "", qubit_edges: _, qubit_nodes: c, qubit_index: d, addToBasket: h, basket: p, level: g = 1, qubit_info: b, gate_info: k } = e;
  a();
  const y = ["id", "rz", "sx"], v = ["cx", "ecr"];
  let w, q, $, j = 0, I = 0, A = 0, M = 0, z = [], H = [], B = Oe(), R = Oe();
  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, I = Math.max(...(ue == null ? void 0 : ue.map((x) => x.x)) ?? [0]) + 1, l(9, A = (I - 1) * Da + Ra * 2), l(10, M = j * Da + Ra * 2), l(8, $ = {}), ue)
      for (const x of ue)
        l(8, $[x.index] = x, $);
    b && l(11, z = Object.keys(b[0]).filter((x) => x !== "index").map((x) => ({ feature: x })));
    let le = [], oe = [];
    l(12, H = []), k.forEach((x) => {
      v.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) && !le.includes(x.gate) && (z.push({ gate: x.gate, type: "error" }), z.push({ gate: x.gate, type: "length" }), le.push(x.gate));
    }), B.set(z[0]), R.set(H[0]);
  }
  let O = [], F = {}, L, X, V, Q, Z;
  B.subscribe((ue) => {
    if (l(13, O = []), ue != null && ue.feature) {
      l(13, O = b.map((ge) => ge[ue.feature]));
      let le = O.map((ge) => ge.value), [oe, x] = [Math.min(...le), Math.max(...le)];
      l(15, L = {
        min: oe,
        max: x,
        mean: Di(le),
        median: Ri(le),
        values: le
      }), ["frequency", "readout_error"].includes(ue.feature) ? l(6, w = kl(Ol).domain([x, oe])) : l(6, w = kl(Ol).domain([oe, x]));
    } else if (ue != null && ue.gate) {
      l(13, O = k.filter((ge) => ge.gate === ue.gate).map((ge) => (ge.qubit = ge.qubits[0], ge)).toSorted((ge, re) => ge.qubit - re.qubit));
      let le = O.map((ge) => ge.parameters["gate_" + ue.type].value), [oe, x] = [Math.min(...le), Math.max(...le)];
      l(15, L = {
        min: oe,
        max: x,
        mean: Di(le),
        median: Ri(le),
        values: le
      }), l(6, w = kl(Ol).domain([x, oe]));
    }
  }), R.subscribe((ue) => {
    if (l(14, F = {}), ue != null && ue.gate) {
      k.filter((re) => re.gate === ue.gate).forEach((re) => {
        l(14, F[re.qubits.join("-")] = re, F);
      });
      let oe = Object.keys(F).map((re) => {
        var Ie;
        return (Ie = F[re].parameters["gate_" + ue.type]) == null ? void 0 : Ie.value;
      }), [x, ge] = [Math.min(...oe), Math.max(...oe)];
      l(16, X = {
        min: x,
        max: ge,
        mean: Di(oe),
        median: Ri(oe),
        values: oe
      }), l(7, q = kl(Ol).domain([ge, x]));
    }
  });
  let ae = !1, se, K = !1, Y = {};
  function W(ue, le, oe, x, ge, re, Ie) {
    K && !Ie || (l(18, ae = !0), l(20, Y = { item: le, key: oe, value: x }), K = Ie, l(19, se = ue.target.offsetTop + 100), Array.from(document.querySelectorAll(".circuit-element")).forEach((je) => {
      je.style.outline = null;
    }), document.querySelector("#" + ge) && (document.querySelector("#" + ge).style.outline = "2px solid black"), oe.feature === "T1" ? (Q = "backend.properties().t1(", Z = ")") : oe.feature === "T2" ? (Q = "backend.properties().t2(", Z = ")") : oe.feature === "frequency" ? (Q = "backend.properties().frequency(", Z = ")") : oe.feature === "readout_error" ? (Q = "backend.properties().readout_error(", Z = ")") : oe.feature === "readout_length" ? (Q = "backend.properties().readout_length(", Z = ")") : oe.feature === "prob_meas0_prep1" ? (Q = "backend.properties().qubit_property(", Z = ', "prob_meas0_prep1")') : oe.feature === "prob_meas1_prep0" ? (Q = "backend.properties().qubit_property(", Z = ', "prob_meas1_prep0")') : oe.gate && (Q = `backend.properties().gate_${oe.type}(${oe.gate}, [`, Z = "])"), l(17, V = `circuit_${oe.gate ? oe.gate + "_" + oe.type : oe.feature}_${re.join("_")} = ${Q}${re.join(",")}${Z}`));
  }
  function J(ue) {
    ae && (ue.screenX - ad.x, l(19, se = ue.screenY - ad.y));
  }
  function ee(ue) {
    K || l(18, ae = !1), ue && (l(18, ae = !1), l(20, Y = void 0), K = !1, Array.from(document.querySelectorAll(".circuit-element")).forEach((le) => {
      le.style.outline = null;
    }));
  }
  Tt(() => {
    P(c);
  });
  const we = () => {
    h(o);
  }, Re = (ue) => {
    B.set(JSON.parse(ue.target.value));
  }, ve = (ue) => {
    R.set(JSON.parse(ue.target.value));
  }, me = () => {
    ee(!0);
  }, fe = (ue) => $[ue], G = () => {
    h(V);
  }, ye = () => {
    ee(!0);
  };
  return t.$$set = (ue) => {
    "key" in ue && l(0, o = ue.key), "qubit_edges" in ue && l(1, _ = 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, g = ue.level), "qubit_info" in ue && l(30, b = ue.qubit_info), "gate_info" in ue && l(31, k = ue.gate_info);
  }, [
    o,
    _,
    d,
    h,
    p,
    g,
    w,
    q,
    $,
    A,
    M,
    z,
    H,
    O,
    F,
    L,
    X,
    V,
    ae,
    se,
    Y,
    i,
    r,
    s,
    B,
    R,
    W,
    J,
    ee,
    c,
    b,
    k,
    we,
    Re,
    ve,
    me,
    fe,
    G,
    ye
  ];
}
class W4 extends Ve {
  constructor(e) {
    super(), Qe(
      this,
      e,
      U4,
      K4,
      Fe,
      {
        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 $d(t, e, l) {
  const i = t.slice();
  return i[13] = e[l], i[15] = l, i;
}
function qd(t, e, l) {
  const i = t.slice();
  return i[13] = e[l], i[17] = l, i;
}
function jd(t, e, l) {
  const i = t.slice();
  return i[13] = e[l], i[17] = l, i;
}
function Td(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-aa04ir");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function J4(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), u(e, "class", "svelte-aa04ir");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function Z4(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), u(e, "class", "svelte-aa04ir");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function Cd(t) {
  let e;
  return {
    c() {
      e = m("th"), e.textContent = `${/*j*/
      t[17]}`, u(e, "class", "svelte-aa04ir");
    },
    m(l, i) {
      S(l, e, i);
    },
    p: ne,
    d(l) {
      l && C(e);
    }
  };
}
function Sd(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), u(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]
        ]
      )})`), u(e, "class", "svelte-aa04ir");
    },
    m(s, o) {
      S(s, e, o), f(e, i);
    },
    p(s, o) {
      var _, c, d, h;
      o & /*value*/
      2 && l !== (l = /*value*/
      ((c = (_ = s[1]) == null ? void 0 : _[
        /*i*/
        s[15]
      ]) == null ? void 0 : c[
        /*j*/
        s[17]
      ]) + "") && U(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]
        ]
      )})`) && u(e, "style", n);
    },
    d(s) {
      s && C(e);
    }
  };
}
function Md(t) {
  let e, l, i, n, a = $e(Array(
    /*size*/
    t[5][1]
  )), r = [];
  for (let s = 0; s < a.length; s += 1)
    r[s] = Sd(qd(t, a, s));
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = `${/*i*/
      t[15]}`, i = N();
      for (let s = 0; s < r.length; s += 1)
        r[s].c();
      n = N(), u(l, "class", "svelte-aa04ir");
    },
    m(s, o) {
      S(s, e, o), f(e, l), f(e, i);
      for (let _ = 0; _ < r.length; _ += 1)
        r[_] && r[_].m(e, null);
      f(e, n);
    },
    p(s, o) {
      if (o & /*colorFunc, value, size*/
      98) {
        a = $e(Array(
          /*size*/
          s[5][1]
        ));
        let _;
        for (_ = 0; _ < a.length; _ += 1) {
          const c = qd(s, a, _);
          r[_] ? r[_].p(c, o) : (r[_] = Sd(c), r[_].c(), r[_].m(e, n));
        }
        for (; _ < r.length; _ += 1)
          r[_].d(1);
        r.length = a.length;
      }
    },
    d(s) {
      s && C(e), Ye(r, s);
    }
  };
}
function zd(t) {
  let e, l = bt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), u(e, "class", "desc svelte-aa04ir");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = bt[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function x4(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g = (
    /*addToBasket*/
    t[2] && Td(t)
  );
  function b(I, A) {
    if (
      /*level*/
      I[4] == 1
    )
      return Z4;
    if (
      /*level*/
      I[4] == 2
    )
      return J4;
  }
  let k = b(t), y = k && k(t), v = $e(Array(
    /*size*/
    t[5][1]
  )), w = [];
  for (let I = 0; I < v.length; I += 1)
    w[I] = Cd(jd(t, v, I));
  let q = $e(Array(
    /*size*/
    t[5][0]
  )), $ = [];
  for (let I = 0; I < q.length; I += 1)
    $[I] = Md($d(t, q, I));
  let j = bt[
    /*key*/
    t[0]
  ] && zd(t);
  return {
    c() {
      e = m("article"), g && g.c(), l = N(), y && y.c(), i = N(), n = m("div"), a = m("table"), r = m("thead"), s = m("tr"), o = m("th"), _ = N();
      for (let I = 0; I < w.length; I += 1)
        w[I].c();
      c = N(), d = m("tbody");
      for (let I = 0; I < $.length; I += 1)
        $[I].c();
      h = N(), j && j.c(), u(o, "class", "svelte-aa04ir"), u(a, "class", "svelte-aa04ir"), u(n, "class", "content-wrap svelte-aa04ir"), u(e, "class", "svelte-aa04ir");
    },
    m(I, A) {
      S(I, e, A), g && g.m(e, null), f(e, l), y && y.m(e, null), f(e, i), f(e, n), f(n, a), f(a, r), f(r, s), f(s, o), f(s, _);
      for (let M = 0; M < w.length; M += 1)
        w[M] && w[M].m(s, null);
      f(a, c), f(a, d);
      for (let M = 0; M < $.length; M += 1)
        $[M] && $[M].m(d, null);
      f(e, h), j && j.m(e, null), p = !0;
    },
    p(I, [A]) {
      if (/*addToBasket*/
      I[2] ? g ? (g.p(I, A), A & /*addToBasket*/
      4 && T(g, 1)) : (g = Td(I), g.c(), T(g, 1), g.m(e, l)) : g && (be(), D(g, 1, 1, () => {
        g = null;
      }), ke()), k === (k = b(I)) && y ? y.p(I, A) : (y && y.d(1), y = k && k(I), y && (y.c(), y.m(e, i))), A & /*size*/
      32) {
        v = $e(Array(
          /*size*/
          I[5][1]
        ));
        let M;
        for (M = 0; M < v.length; M += 1) {
          const z = jd(I, v, M);
          w[M] ? w[M].p(z, A) : (w[M] = Cd(z), w[M].c(), w[M].m(s, null));
        }
        for (; M < w.length; M += 1)
          w[M].d(1);
        w.length = v.length;
      }
      if (A & /*Array, size, colorFunc, value*/
      98) {
        q = $e(Array(
          /*size*/
          I[5][0]
        ));
        let M;
        for (M = 0; M < q.length; M += 1) {
          const z = $d(I, q, M);
          $[M] ? $[M].p(z, A) : ($[M] = Md(z), $[M].c(), $[M].m(d, null));
        }
        for (; M < $.length; M += 1)
          $[M].d(1);
        $.length = q.length;
      }
      bt[
        /*key*/
        I[0]
      ] ? j ? j.p(I, A) : (j = zd(I), j.c(), j.m(e, null)) : j && (j.d(1), j = null);
    },
    i(I) {
      p || (T(g), p = !0);
    },
    o(I) {
      D(g), p = !1;
    },
    d(I) {
      I && C(e), g && g.d(), y && y.d(), Ye(w, I), Ye($, I), j && j.d();
    }
  };
}
function e5(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (v) => l(7, i = v)), _);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: _, level: c = 1, code_header: d = "", code_type: h = "", code_footer: p = "" } = e;
  a();
  let g = [0, 0], b = () => {
  }, k = 1;
  Tt(() => {
    var v;
    s && (l(5, g[0] = (s == null ? void 0 : s.length) || 0, g), l(5, g[1] = ((v = s == null ? void 0 : s[0]) == null ? void 0 : v.length) || 0, g), k = Math.max(...s == null ? void 0 : s.map((w) => Math.max(...w))), l(6, b = (w) => (1 - w / k) * 0.8));
  });
  const y = () => {
    o(r);
  };
  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, _ = v.basket)), "level" in v && l(4, c = v.level), "code_header" in v && l(8, d = v.code_header), "code_type" in v && l(9, h = v.code_type), "code_footer" in v && l(10, p = v.code_footer);
  }, [
    r,
    s,
    o,
    _,
    c,
    g,
    b,
    i,
    d,
    h,
    p,
    y
  ];
}
class t5 extends Ve {
  constructor(e) {
    super(), Qe(this, e, e5, x4, Fe, {
      key: 0,
      value: 1,
      addToBasket: 2,
      basket: 3,
      level: 4,
      code_header: 8,
      code_type: 9,
      code_footer: 10
    });
  }
}
function Nd(t, e, l) {
  const i = t.slice();
  return i[11] = e[l], i[13] = l, i;
}
function Ad(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1dv3ar6");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function l5(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), u(e, "class", "svelte-1dv3ar6");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function i5(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), u(e, "class", "svelte-1dv3ar6");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function Bd(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-1dv3ar6");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o & /*$basket, key, code_header, code_footer*/
      225 && (_.on = /*$basket*/
      t[7].includes(`${/*key*/
      t[0]}_${/*i*/
      t[13]} = ${/*code_header*/
      t[5]}${/*i*/
      t[13]}${/*code_footer*/
      t[6]}`)), l.$set(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Pd(t) {
  let e, l, i, n, a = (
    /*v*/
    t[11] + ""
  ), r, s, o, _, c, d = (
    /*addToBasket*/
    t[2] && Bd(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), l.textContent = `${/*i*/
      t[13]}`, i = N(), n = m("div"), r = E(a), s = N(), o = m("div"), d && d.c(), _ = N(), u(l, "class", "i svelte-1dv3ar6"), u(n, "class", "v svelte-1dv3ar6"), u(o, "class", "b svelte-1dv3ar6"), u(e, "class", "chip svelte-1dv3ar6");
    },
    m(h, p) {
      S(h, e, p), f(e, l), f(e, i), f(e, n), f(n, r), f(e, s), f(e, o), d && d.m(o, null), f(e, _), c = !0;
    },
    p(h, p) {
      (!c || p & /*value*/
      2) && a !== (a = /*v*/
      h[11] + "") && U(r, a), /*addToBasket*/
      h[2] ? d ? (d.p(h, p), p & /*addToBasket*/
      4 && T(d, 1)) : (d = Bd(h), d.c(), T(d, 1), d.m(o, null)) : d && (be(), D(d, 1, 1, () => {
        d = null;
      }), ke());
    },
    i(h) {
      c || (T(d), c = !0);
    },
    o(h) {
      D(d), c = !1;
    },
    d(h) {
      h && C(e), d && d.d();
    }
  };
}
function Od(t) {
  let e, l = bt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), u(e, "class", "desc svelte-1dv3ar6");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = bt[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function n5(t) {
  let e, l, i, n, a, r, s = (
    /*addToBasket*/
    t[2] && Ad(t)
  );
  function o(b, k) {
    if (
      /*level*/
      b[4] == 1
    )
      return i5;
    if (
      /*level*/
      b[4] == 2
    )
      return l5;
  }
  let _ = o(t), c = _ && _(t), d = $e(
    /*value*/
    t[1]
  ), h = [];
  for (let b = 0; b < d.length; b += 1)
    h[b] = Pd(Nd(t, d, b));
  const p = (b) => D(h[b], 1, 1, () => {
    h[b] = null;
  });
  let g = bt[
    /*key*/
    t[0]
  ] && Od(t);
  return {
    c() {
      e = m("article"), s && s.c(), l = N(), c && c.c(), i = N(), n = m("div");
      for (let b = 0; b < h.length; b += 1)
        h[b].c();
      a = N(), g && g.c(), u(n, "class", "value svelte-1dv3ar6"), u(e, "class", "svelte-1dv3ar6");
    },
    m(b, k) {
      S(b, e, k), s && s.m(e, null), f(e, l), c && c.m(e, null), f(e, i), f(e, n);
      for (let y = 0; y < h.length; y += 1)
        h[y] && h[y].m(n, null);
      f(e, a), g && g.m(e, null), r = !0;
    },
    p(b, [k]) {
      if (/*addToBasket*/
      b[2] ? s ? (s.p(b, k), k & /*addToBasket*/
      4 && T(s, 1)) : (s = Ad(b), s.c(), T(s, 1), s.m(e, l)) : s && (be(), D(s, 1, 1, () => {
        s = null;
      }), ke()), _ === (_ = o(b)) && c ? c.p(b, k) : (c && c.d(1), c = _ && _(b), c && (c.c(), c.m(e, i))), k & /*addToBasket, key, code_header, code_footer, $basket, value*/
      231) {
        d = $e(
          /*value*/
          b[1]
        );
        let y;
        for (y = 0; y < d.length; y += 1) {
          const v = Nd(b, d, y);
          h[y] ? (h[y].p(v, k), T(h[y], 1)) : (h[y] = Pd(v), h[y].c(), T(h[y], 1), h[y].m(n, null));
        }
        for (be(), y = d.length; y < h.length; y += 1)
          p(y);
        ke();
      }
      bt[
        /*key*/
        b[0]
      ] ? g ? g.p(b, k) : (g = Od(b), g.c(), g.m(e, null)) : g && (g.d(1), g = null);
    },
    i(b) {
      if (!r) {
        T(s);
        for (let k = 0; k < d.length; k += 1)
          T(h[k]);
        r = !0;
      }
    },
    o(b) {
      D(s), h = h.filter(Boolean);
      for (let k = 0; k < h.length; k += 1)
        D(h[k]);
      r = !1;
    },
    d(b) {
      b && C(e), s && s.d(), c && c.d(), Ye(h, b), g && g.d();
    }
  };
}
function a5(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (k) => l(7, i = k)), _);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: _, level: c = 1, code_header: d = "", code_type: h = "", code_footer: p = "" } = e;
  a(), Tt(() => {
  });
  const g = () => {
    o(r);
  }, b = (k) => {
    o(`${r}_${k} = ${d}${k}${p}`);
  };
  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, _ = k.basket)), "level" in k && l(4, c = k.level), "code_header" in k && l(5, d = k.code_header), "code_type" in k && l(8, h = k.code_type), "code_footer" in k && l(6, p = k.code_footer);
  }, [
    r,
    s,
    o,
    _,
    c,
    d,
    p,
    i,
    h,
    g,
    b
  ];
}
class _0 extends Ve {
  constructor(e) {
    super(), Qe(this, e, a5, n5, Fe, {
      key: 0,
      value: 1,
      addToBasket: 2,
      basket: 3,
      level: 4,
      code_header: 5,
      code_type: 8,
      code_footer: 6
    });
  }
}
function Ed(t, e, l) {
  const i = t.slice();
  return i[11] = e[l], i;
}
function Id(t) {
  let e, l, i, n;
  l = new r0({
    props: {
      title: (
        /*section_meta*/
        t[4].title || ct[
          /*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] && Dd(t);
  return {
    c() {
      e = m("section"), pe(l.$$.fragment), i = N(), a && a.c(), u(e, "class", "svelte-1fzr24z");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), f(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 || ct[
        /*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 && (be(), D(a, 1, 1, () => {
        a = null;
      }), ke()) : a ? (a.p(r, s), s & /*hide*/
      128 && T(a, 1)) : (a = Dd(r), a.c(), T(a, 1), a.m(e, null));
    },
    i(r) {
      n || (T(l.$$.fragment, r), T(a), n = !0);
    },
    o(r) {
      D(l.$$.fragment, r), D(a), n = !1;
    },
    d(r) {
      r && C(e), he(l), a && a.d();
    }
  };
}
function Dd(t) {
  var r;
  let e, l, i = $e(
    /*section_meta*/
    (r = t[4]) == null ? void 0 : r.order
  ), n = [];
  for (let s = 0; s < i.length; s += 1)
    n[s] = Rd(Ed(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();
      u(e, "class", "panel svelte-1fzr24z");
    },
    m(s, o) {
      S(s, e, o);
      for (let _ = 0; _ < n.length; _ += 1)
        n[_] && n[_].m(e, null);
      l = !0;
    },
    p(s, o) {
      var _;
      if (o & /*section_meta, is_prop_timed, $property_time, $data, addToBasket, basket, openTimeMachine, property_time*/
      894) {
        i = $e(
          /*section_meta*/
          (_ = s[4]) == null ? void 0 : _.order
        );
        let c;
        for (c = 0; c < i.length; c += 1) {
          const d = Ed(s, i, c);
          n[c] ? (n[c].p(d, o), T(n[c], 1)) : (n[c] = Rd(d), n[c].c(), T(n[c], 1), n[c].m(e, null));
        }
        for (be(), c = i.length; c < n.length; c += 1)
          a(c);
        ke();
      }
    },
    i(s) {
      if (!l) {
        for (let o = 0; o < i.length; o += 1)
          T(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 && C(e), Ye(n, s);
    }
  };
}
function r5(t) {
  var i;
  let e, l;
  return e = new Ya({
    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() {
      pe(e.$$.fragment);
    },
    m(n, a) {
      de(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 || (T(e.$$.fragment, n), l = !0);
    },
    o(n) {
      D(e.$$.fragment, n), l = !1;
    },
    d(n) {
      he(e, n);
    }
  };
}
function s5(t) {
  let e, l;
  return e = new _0({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function o5(t) {
  let e, l;
  return e = new _0({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function u5(t) {
  let e, l;
  return e = new t5({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function f5(t) {
  let e, l;
  return e = new W4({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function _5(t) {
  let e, l;
  return e = new s0({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function c5(t) {
  let e, l;
  return e = new Ya({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function d5(t) {
  let e, l;
  return e = new I4({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function h5(t) {
  var i;
  let e, l;
  return e = new K3({
    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() {
      pe(e.$$.fragment);
    },
    m(n, a) {
      de(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 || (T(e.$$.fragment, n), l = !0);
    },
    o(n) {
      D(e.$$.fragment, n), l = !1;
    },
    d(n) {
      he(e, n);
    }
  };
}
function p5(t) {
  let e, l;
  return e = new s0({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function m5(t) {
  let e, l;
  return e = new R3({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Rd(t) {
  let e, l, i, n;
  const a = [
    m5,
    p5,
    h5,
    d5,
    c5,
    _5,
    f5,
    u5,
    o5,
    s5,
    r5
  ], r = [];
  function s(o, _) {
    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 = Ae();
    },
    m(o, _) {
      r[e].m(o, _), S(o, i, _), n = !0;
    },
    p(o, _) {
      let c = e;
      e = s(o), e === c ? r[e].p(o, _) : (be(), D(r[c], 1, 1, () => {
        r[c] = null;
      }), ke(), l = r[e], l ? l.p(o, _) : (l = r[e] = a[e](o), l.c()), T(l, 1), l.m(i.parentNode, i));
    },
    i(o) {
      n || (T(l), n = !0);
    },
    o(o) {
      D(l), n = !1;
    },
    d(o) {
      o && C(i), r[e].d(o);
    }
  };
}
function g5(t) {
  let e, l, i = (
    /*$data*/
    t[8] && /*section_meta*/
    t[4] && Id(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(n, a) {
      i && i.m(n, a), S(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 && T(i, 1)) : (i = Id(n), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d(n);
    }
  };
}
function b5(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (v) => l(8, i = v)), _), r, s = ne, o = () => (s(), s = st(b, (v) => l(9, r = v)), b);
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => s());
  let { data: _ = Oe() } = e;
  a();
  let { addToBasket: c = () => {
  } } = e, { openTimeMachine: d = () => {
  } } = e, { basket: h } = e, { section_meta: p } = e, { is_prop_timed: g } = e, { property_time: b = Oe() } = e;
  o();
  let k = !1;
  function y() {
    l(7, k = !k);
  }
  return Tt(() => {
    (p == null ? void 0 : p.key) === "properties" && (p == null ? void 0 : p.title) === "Overall" && l(7, k = !0);
  }), t.$$set = (v) => {
    "data" in v && a(l(0, _ = v.data)), "addToBasket" in v && l(1, c = v.addToBasket), "openTimeMachine" in v && l(2, d = v.openTimeMachine), "basket" in v && l(3, h = v.basket), "section_meta" in v && l(4, p = v.section_meta), "is_prop_timed" in v && l(5, g = v.is_prop_timed), "property_time" in v && o(l(6, b = v.property_time));
  }, [
    _,
    c,
    d,
    h,
    p,
    g,
    b,
    k,
    i,
    r,
    y
  ];
}
class k5 extends Ve {
  constructor(e) {
    super(), Qe(this, e, b5, g5, Fe, {
      data: 0,
      addToBasket: 1,
      openTimeMachine: 2,
      basket: 3,
      section_meta: 4,
      is_prop_timed: 5,
      property_time: 6
    });
  }
}
function Hd(t, e, l) {
  const i = t.slice();
  return i[10] = e[l], i[12] = l, i;
}
function Ld(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-rs5kk");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function v5(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), u(e, "class", "svelte-rs5kk");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function y5(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), u(e, "class", "svelte-rs5kk");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function Fd(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-rs5kk");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o & /*$basket, key, value, code_header, code_footer*/
      227 && (_.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(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function Qd(t) {
  var P;
  let e, l, i = (
    /*gate*/
    t[10].name + ""
  ), n, a, r, s = (
    /*gate*/
    t[10].type + ""
  ), o, _, c, d = (
    /*gate*/
    (t[10].num_qubits || "") + ""
  ), h, p, g, b = (
    /*gate*/
    (t[10].num_clbits || "") + ""
  ), k, y, v, w = (
    /*gate*/
    (((P = t[10].params) == null ? void 0 : P.join(", ")) || "") + ""
  ), q, $, j, I = (
    /*gate*/
    (t[10].mutable || "") + ""
  ), A, M, z, H, B, R = (
    /*addToBasket*/
    t[2] && Fd(t)
  );
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = N(), r = m("td"), o = E(s), _ = N(), c = m("td"), h = E(d), p = N(), g = m("td"), k = E(b), y = N(), v = m("td"), q = E(w), $ = N(), j = m("td"), A = E(I), M = N(), z = m("th"), R && R.c(), H = N(), u(l, "class", "svelte-rs5kk"), u(r, "class", "svelte-rs5kk"), u(c, "class", "svelte-rs5kk"), u(g, "class", "svelte-rs5kk"), u(v, "class", "svelte-rs5kk"), u(j, "class", "svelte-rs5kk"), u(z, "class", "svelte-rs5kk");
    },
    m(O, F) {
      S(O, e, F), f(e, l), f(l, n), f(e, a), f(e, r), f(r, o), f(e, _), f(e, c), f(c, h), f(e, p), f(e, g), f(g, k), f(e, y), f(e, v), f(v, q), f(e, $), f(e, j), f(j, A), f(e, M), f(e, z), R && R.m(z, null), f(e, H), B = !0;
    },
    p(O, F) {
      var L;
      (!B || F & /*value*/
      2) && i !== (i = /*gate*/
      O[10].name + "") && U(n, i), (!B || F & /*value*/
      2) && s !== (s = /*gate*/
      O[10].type + "") && U(o, s), (!B || F & /*value*/
      2) && d !== (d = /*gate*/
      (O[10].num_qubits || "") + "") && U(h, d), (!B || F & /*value*/
      2) && b !== (b = /*gate*/
      (O[10].num_clbits || "") + "") && U(k, b), (!B || F & /*value*/
      2) && w !== (w = /*gate*/
      (((L = O[10].params) == null ? void 0 : L.join(", ")) || "") + "") && U(q, w), (!B || F & /*value*/
      2) && I !== (I = /*gate*/
      (O[10].mutable || "") + "") && U(A, I), /*addToBasket*/
      O[2] ? R ? (R.p(O, F), F & /*addToBasket*/
      4 && T(R, 1)) : (R = Fd(O), R.c(), T(R, 1), R.m(z, null)) : R && (be(), D(R, 1, 1, () => {
        R = null;
      }), ke());
    },
    i(O) {
      B || (T(R), B = !0);
    },
    o(O) {
      D(R), B = !1;
    },
    d(O) {
      O && C(e), R && R.d();
    }
  };
}
function Vd(t) {
  let e, l = bt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), u(e, "class", "desc svelte-rs5kk");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = bt[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function w5(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h = (
    /*addToBasket*/
    t[2] && Ld(t)
  );
  function p(q, $) {
    if (
      /*level*/
      q[4] == 1
    )
      return y5;
    if (
      /*level*/
      q[4] == 2
    )
      return v5;
  }
  let g = p(t), b = g && g(t), k = $e(
    /*value*/
    t[1]
  ), y = [];
  for (let q = 0; q < k.length; q += 1)
    y[q] = Qd(Hd(t, k, q));
  const v = (q) => D(y[q], 1, 1, () => {
    y[q] = null;
  });
  let w = bt[
    /*key*/
    t[0]
  ] && Vd(t);
  return {
    c() {
      e = m("article"), h && h.c(), l = N(), b && b.c(), i = N(), 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 = N(), _ = m("tbody");
      for (let q = 0; q < y.length; q += 1)
        y[q].c();
      c = N(), w && w.c(), u(s, "class", "svelte-rs5kk"), u(r, "class", "svelte-rs5kk"), u(a, "class", "value svelte-rs5kk"), u(n, "class", "content-wrap"), u(e, "class", "svelte-rs5kk");
    },
    m(q, $) {
      S(q, e, $), h && h.m(e, null), f(e, l), b && b.m(e, null), f(e, i), f(e, n), f(n, a), f(a, r), f(r, s), f(r, o), f(r, _);
      for (let j = 0; j < y.length; j += 1)
        y[j] && y[j].m(_, null);
      f(e, c), w && w.m(e, null), d = !0;
    },
    p(q, [$]) {
      if (/*addToBasket*/
      q[2] ? h ? (h.p(q, $), $ & /*addToBasket*/
      4 && T(h, 1)) : (h = Ld(q), h.c(), T(h, 1), h.m(e, l)) : h && (be(), D(h, 1, 1, () => {
        h = null;
      }), ke()), g === (g = p(q)) && b ? b.p(q, $) : (b && b.d(1), b = g && g(q), b && (b.c(), b.m(e, i))), $ & /*addToBasket, key, value, code_header, code_footer, $basket*/
      231) {
        k = $e(
          /*value*/
          q[1]
        );
        let j;
        for (j = 0; j < k.length; j += 1) {
          const I = Hd(q, k, j);
          y[j] ? (y[j].p(I, $), T(y[j], 1)) : (y[j] = Qd(I), y[j].c(), T(y[j], 1), y[j].m(_, null));
        }
        for (be(), j = k.length; j < y.length; j += 1)
          v(j);
        ke();
      }
      bt[
        /*key*/
        q[0]
      ] ? w ? w.p(q, $) : (w = Vd(q), w.c(), w.m(e, null)) : w && (w.d(1), w = null);
    },
    i(q) {
      if (!d) {
        T(h);
        for (let $ = 0; $ < k.length; $ += 1)
          T(y[$]);
        d = !0;
      }
    },
    o(q) {
      D(h), y = y.filter(Boolean);
      for (let $ = 0; $ < y.length; $ += 1)
        D(y[$]);
      d = !1;
    },
    d(q) {
      q && C(e), h && h.d(), b && b.d(), Ye(y, q), w && w.d();
    }
  };
}
function $5(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (b) => l(7, i = b)), _);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s = [], addToBasket: o, basket: _, level: c = 1, code_header: d = "", code_footer: h = "" } = e;
  a();
  const p = () => {
    o(r);
  }, g = (b) => {
    o(`op_${r}_${b.name} = ${d}${b.name}${h}`);
  };
  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, _ = b.basket)), "level" in b && l(4, c = b.level), "code_header" in b && l(5, d = b.code_header), "code_footer" in b && l(6, h = b.code_footer);
  }, [
    r,
    s,
    o,
    _,
    c,
    d,
    h,
    i,
    p,
    g
  ];
}
class q5 extends Ve {
  constructor(e) {
    super(), Qe(this, e, $5, w5, Fe, {
      key: 0,
      value: 1,
      addToBasket: 2,
      basket: 3,
      level: 4,
      code_header: 5,
      code_footer: 6
    });
  }
}
function Xd(t, e, l) {
  const i = t.slice();
  return i[19] = e[l], i[21] = l, i;
}
function Gd(t, e, l) {
  const i = t.slice();
  return i[22] = e[l], i;
}
function Yd(t, e, l) {
  const i = t.slice();
  return i[22] = e[l], i;
}
function Kd(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[10].includes(
          /*key*/
          t[0]
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-7dhgf1");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function j5(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h3"), i = E(l), u(e, "class", "svelte-7dhgf1");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function T5(t) {
  let e, l = ct[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("h2"), i = E(l), u(e, "class", "svelte-7dhgf1");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = ct[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function Ud(t) {
  let e, l = (
    /*g*/
    t[22] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*g*/
      t[22], pt(e, e.__value), e.selected = a = /*filter*/
      t[7].gates.includes(
        /*g*/
        t[22]
      );
    },
    m(r, s) {
      S(r, e, s), f(e, i);
    },
    p(r, s) {
      s & /*gates*/
      256 && l !== (l = /*g*/
      r[22] + "") && U(i, l), s & /*gates*/
      256 && n !== (n = /*g*/
      r[22]) && (e.__value = n, pt(e, e.__value)), s & /*filter, gates*/
      384 && a !== (a = /*filter*/
      r[7].gates.includes(
        /*g*/
        r[22]
      )) && (e.selected = a);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Wd(t) {
  let e, l = (
    /*g*/
    t[22] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*g*/
      t[22], pt(e, e.__value), e.selected = a = /*filter*/
      t[7].qubits.includes(
        /*g*/
        t[22]
      );
    },
    m(r, s) {
      S(r, e, s), f(e, i);
    },
    p(r, s) {
      s & /*qubits*/
      512 && l !== (l = /*g*/
      r[22] + "") && U(i, l), s & /*qubits*/
      512 && n !== (n = /*g*/
      r[22]) && (e.__value = n, pt(e, e.__value)), s & /*filter, qubits*/
      640 && a !== (a = /*filter*/
      r[7].qubits.includes(
        /*g*/
        r[22]
      )) && (e.selected = a);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Jd(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, _, c, d = (
    /*gate*/
    (t[19].num_qubits || "") + ""
  ), h, p, g, b = (
    /*gate*/
    (t[19].num_clbits || "") + ""
  ), k, y, v, w = (
    /*gate*/
    (t[19].duration || "") + ""
  ), q, $, j, I = (
    /*gate*/
    (t[19].mutable || "") + ""
  ), A, M, z, H = (
    /*gate*/
    (((V = t[19].params) == null ? void 0 : V.join(", ")) || "") + ""
  ), B, R, P, O, F, L = (
    /*addToBasket*/
    t[2] && Zd(t)
  );
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = N(), r = m("td"), o = E(s), _ = N(), c = m("td"), h = E(d), p = N(), g = m("td"), k = E(b), y = N(), v = m("td"), q = E(w), $ = N(), j = m("td"), A = E(I), M = N(), z = m("td"), B = E(H), R = N(), P = m("td"), L && L.c(), O = N(), u(l, "class", "svelte-7dhgf1"), u(r, "class", "svelte-7dhgf1"), u(c, "class", "svelte-7dhgf1"), u(g, "class", "svelte-7dhgf1"), u(v, "class", "svelte-7dhgf1"), u(j, "class", "svelte-7dhgf1"), u(z, "class", "svelte-7dhgf1"), u(P, "class", "svelte-7dhgf1");
    },
    m(Q, Z) {
      S(Q, e, Z), f(e, l), f(l, n), f(e, a), f(e, r), f(r, o), f(e, _), f(e, c), f(c, h), f(e, p), f(e, g), f(g, k), f(e, y), f(e, v), f(v, q), f(e, $), f(e, j), f(j, A), f(e, M), f(e, z), f(z, B), f(e, R), f(e, P), L && L.m(P, null), f(e, O), F = !0;
    },
    p(Q, Z) {
      var ae, se;
      (!F || Z & /*value*/
      2) && i !== (i = /*gate*/
      Q[19].name + "") && U(n, i), (!F || Z & /*value*/
      2) && s !== (s = /*gate*/
      (((ae = Q[19].qubits) == null ? void 0 : ae.join(", ")) || "") + "") && U(o, s), (!F || Z & /*value*/
      2) && d !== (d = /*gate*/
      (Q[19].num_qubits || "") + "") && U(h, d), (!F || Z & /*value*/
      2) && b !== (b = /*gate*/
      (Q[19].num_clbits || "") + "") && U(k, b), (!F || Z & /*value*/
      2) && w !== (w = /*gate*/
      (Q[19].duration || "") + "") && U(q, w), (!F || Z & /*value*/
      2) && I !== (I = /*gate*/
      (Q[19].mutable || "") + "") && U(A, I), (!F || Z & /*value*/
      2) && H !== (H = /*gate*/
      (((se = Q[19].params) == null ? void 0 : se.join(", ")) || "") + "") && U(B, H), /*addToBasket*/
      Q[2] ? L ? (L.p(Q, Z), Z & /*addToBasket*/
      4 && T(L, 1)) : (L = Zd(Q), L.c(), T(L, 1), L.m(P, null)) : L && (be(), D(L, 1, 1, () => {
        L = null;
      }), ke());
    },
    i(Q) {
      F || (T(L), F = !0);
    },
    o(Q) {
      D(L), F = !1;
    },
    d(Q) {
      Q && C(e), L && L.d();
    }
  };
}
function Zd(t) {
  var s, o;
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-7dhgf1");
    },
    m(_, c) {
      S(_, e, c), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(_, c) {
      var h, p;
      t = _;
      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(_) {
      i || (T(l.$$.fragment, _), i = !0);
    },
    o(_) {
      D(l.$$.fragment, _), i = !1;
    },
    d(_) {
      _ && C(e), he(l), n = !1, a();
    }
  };
}
function xd(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 && Jd(t);
  return {
    c() {
      n && n.c(), l = Ae();
    },
    m(a, r) {
      n && n.m(a, r), S(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 && T(n, 1)) : (n = Jd(a), n.c(), T(n, 1), n.m(l.parentNode, l)) : n && (be(), D(n, 1, 1, () => {
        n = null;
      }), ke());
    },
    i(a) {
      i || (T(n), i = !0);
    },
    o(a) {
      D(n), i = !1;
    },
    d(a) {
      a && C(l), n && n.d(a);
    }
  };
}
function eh(t) {
  let e, l = bt[
    /*key*/
    t[0]
  ] + "", i;
  return {
    c() {
      e = m("div"), i = E(l), u(e, "class", "desc svelte-7dhgf1");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*key*/
      1 && l !== (l = bt[
        /*key*/
        n[0]
      ] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function C5(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R = (
    /*addToBasket*/
    t[2] && Kd(t)
  );
  function P(Y, W) {
    if (
      /*level*/
      Y[4] == 1
    )
      return T5;
    if (
      /*level*/
      Y[4] == 2
    )
      return j5;
  }
  let O = P(t), F = O && O(t), L = $e(
    /*gates*/
    t[8]
  ), X = [];
  for (let Y = 0; Y < L.length; Y += 1)
    X[Y] = Ud(Yd(t, L, Y));
  let V = $e(
    /*qubits*/
    t[9]
  ), Q = [];
  for (let Y = 0; Y < V.length; Y += 1)
    Q[Y] = Wd(Gd(t, V, Y));
  let Z = $e(
    /*value*/
    t[1]
  ), ae = [];
  for (let Y = 0; Y < Z.length; Y += 1)
    ae[Y] = xd(Xd(t, Z, Y));
  const se = (Y) => D(ae[Y], 1, 1, () => {
    ae[Y] = null;
  });
  let K = bt[
    /*key*/
    t[0]
  ] && eh(t);
  return {
    c() {
      e = m("article"), R && R.c(), l = N(), F && F.c(), i = N(), n = m("div"), a = m("div"), r = m("div"), s = m("label"), s.textContent = "Gates", o = N(), _ = m("button"), _.textContent = "×", c = N(), d = m("select");
      for (let Y = 0; Y < X.length; Y += 1)
        X[Y].c();
      h = N(), p = m("div"), g = m("label"), g.textContent = "Qubits", b = N(), k = m("button"), k.textContent = "×", y = N(), v = m("select");
      for (let Y = 0; Y < Q.length; Y += 1)
        Q[Y].c();
      w = N(), q = m("div"), $ = 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>', I = N(), A = m("tbody");
      for (let Y = 0; Y < ae.length; Y += 1)
        ae[Y].c();
      M = N(), K && K.c(), u(s, "for", "gates"), u(s, "class", "svelte-7dhgf1"), u(_, "class", "svelte-7dhgf1"), u(d, "class", "filter svelte-7dhgf1"), u(d, "name", "gates"), u(d, "id", "gates"), d.multiple = !0, u(r, "class", "svelte-7dhgf1"), u(g, "for", "qubits"), u(g, "class", "svelte-7dhgf1"), u(k, "class", "svelte-7dhgf1"), u(v, "class", "filter svelte-7dhgf1"), u(v, "name", "qubits"), u(v, "id", "qubits"), v.multiple = !0, u(p, "class", "svelte-7dhgf1"), u(a, "class", "filter-wrap svelte-7dhgf1"), u(j, "class", "svelte-7dhgf1"), u($, "class", "svelte-7dhgf1"), u(q, "class", "value svelte-7dhgf1"), u(n, "class", "content-wrap svelte-7dhgf1"), u(e, "class", "svelte-7dhgf1");
    },
    m(Y, W) {
      S(Y, e, W), R && R.m(e, null), f(e, l), F && F.m(e, null), f(e, i), f(e, n), f(n, a), f(a, r), f(r, s), f(r, o), f(r, _), f(r, c), f(r, d);
      for (let J = 0; J < X.length; J += 1)
        X[J] && X[J].m(d, null);
      f(a, h), f(a, p), f(p, g), f(p, b), f(p, k), f(p, y), f(p, v);
      for (let J = 0; J < Q.length; J += 1)
        Q[J] && Q[J].m(v, null);
      f(n, w), f(n, q), f(q, $), f($, j), f($, I), f($, A);
      for (let J = 0; J < ae.length; J += 1)
        ae[J] && ae[J].m(A, null);
      f(e, M), K && K.m(e, null), z = !0, H || (B = [
        te(
          _,
          "click",
          /*click_handler_1*/
          t[14]
        ),
        te(
          d,
          "change",
          /*change_handler*/
          t[15]
        ),
        te(
          k,
          "click",
          /*click_handler_2*/
          t[16]
        ),
        te(
          v,
          "change",
          /*change_handler_1*/
          t[17]
        )
      ], H = !0);
    },
    p(Y, [W]) {
      if (/*addToBasket*/
      Y[2] ? R ? (R.p(Y, W), W & /*addToBasket*/
      4 && T(R, 1)) : (R = Kd(Y), R.c(), T(R, 1), R.m(e, l)) : R && (be(), D(R, 1, 1, () => {
        R = null;
      }), ke()), O === (O = P(Y)) && F ? F.p(Y, W) : (F && F.d(1), F = O && O(Y), F && (F.c(), F.m(e, i))), W & /*gates, filter*/
      384) {
        L = $e(
          /*gates*/
          Y[8]
        );
        let J;
        for (J = 0; J < L.length; J += 1) {
          const ee = Yd(Y, L, J);
          X[J] ? X[J].p(ee, W) : (X[J] = Ud(ee), X[J].c(), X[J].m(d, null));
        }
        for (; J < X.length; J += 1)
          X[J].d(1);
        X.length = L.length;
      }
      if (W & /*qubits, filter*/
      640) {
        V = $e(
          /*qubits*/
          Y[9]
        );
        let J;
        for (J = 0; J < V.length; J += 1) {
          const ee = Gd(Y, V, J);
          Q[J] ? Q[J].p(ee, W) : (Q[J] = Wd(ee), Q[J].c(), Q[J].m(v, null));
        }
        for (; J < Q.length; J += 1)
          Q[J].d(1);
        Q.length = V.length;
      }
      if (W & /*addToBasket, value, code_header, code_footer, $basket, filter*/
      1254) {
        Z = $e(
          /*value*/
          Y[1]
        );
        let J;
        for (J = 0; J < Z.length; J += 1) {
          const ee = Xd(Y, Z, J);
          ae[J] ? (ae[J].p(ee, W), T(ae[J], 1)) : (ae[J] = xd(ee), ae[J].c(), T(ae[J], 1), ae[J].m(A, null));
        }
        for (be(), J = Z.length; J < ae.length; J += 1)
          se(J);
        ke();
      }
      bt[
        /*key*/
        Y[0]
      ] ? K ? K.p(Y, W) : (K = eh(Y), K.c(), K.m(e, null)) : K && (K.d(1), K = null);
    },
    i(Y) {
      if (!z) {
        T(R);
        for (let W = 0; W < Z.length; W += 1)
          T(ae[W]);
        z = !0;
      }
    },
    o(Y) {
      D(R), ae = ae.filter(Boolean);
      for (let W = 0; W < ae.length; W += 1)
        D(ae[W]);
      z = !1;
    },
    d(Y) {
      Y && C(e), R && R.d(), F && F.d(), Ye(X, Y), Ye(Q, Y), Ye(ae, Y), K && K.d(), H = !1, wt(B);
    }
  };
}
function S5(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (A) => l(10, i = A)), _);
  t.$$.on_destroy.push(() => n());
  let { key: r = "", value: s, addToBasket: o, basket: _, level: c = 1, code_header: d = "", code_type: h = "", code_footer: p = "" } = e;
  a();
  let g = { gates: [], qubits: [] }, b = [], k = [];
  Tt(() => {
    s && (l(8, b = Array.from(new Set(s.map((A) => A.name)))), l(9, k = Array.from(new Set(s.map((A) => A.qubits).flat()))));
  });
  const y = (A) => g.qubits.includes(A), v = () => {
    o(r);
  }, w = (A) => {
    l(7, g.gates = [], g);
  }, q = (A) => {
    l(7, g.gates = Array.from(A.target.selectedOptions).map((M) => M.value), g);
  }, $ = (A) => {
    l(7, g.qubits = [], g);
  }, j = (A) => {
    l(7, g.qubits = Array.from(A.target.selectedOptions).map((M) => parseInt(M.value)), g);
  }, I = (A) => {
    var M, z;
    o(`instruction_${A.name}_${(M = A.qubits) == null ? void 0 : M.join(", ")} = ${d}x.name == "${A.name}" and x.qubits == [${(z = A.qubits) == null ? void 0 : z.join(", ")}]${p}`);
  };
  return t.$$set = (A) => {
    "key" in A && l(0, r = A.key), "value" in A && l(1, s = A.value), "addToBasket" in A && l(2, o = A.addToBasket), "basket" in A && a(l(3, _ = A.basket)), "level" in A && l(4, c = A.level), "code_header" in A && l(5, d = A.code_header), "code_type" in A && l(11, h = A.code_type), "code_footer" in A && l(6, p = A.code_footer);
  }, [
    r,
    s,
    o,
    _,
    c,
    d,
    p,
    g,
    b,
    k,
    i,
    h,
    y,
    v,
    w,
    q,
    $,
    j,
    I
  ];
}
class M5 extends Ve {
  constructor(e) {
    super(), Qe(this, e, S5, C5, Fe, {
      key: 0,
      value: 1,
      addToBasket: 2,
      basket: 3,
      level: 4,
      code_header: 5,
      code_type: 11,
      code_footer: 6
    });
  }
}
function th(t, e, l) {
  const i = t.slice();
  return i[12] = e[l], i;
}
function lh(t, e, l) {
  const i = t.slice();
  return i[12] = e[l], i;
}
function ih(t, e, l) {
  const i = t.slice();
  return i[17] = e[l], i[19] = l, i;
}
function nh(t) {
  let e, l, i, n;
  l = new r0({
    props: {
      title: (
        /*section_meta*/
        t[6].title
      ),
      toggleSection: (
        /*toggleSection*/
        t[10]
      ),
      hide: (
        /*hide*/
        t[0]
      ),
      level: 1
    }
  });
  let a = !/*hide*/
  t[0] && ah(t);
  return {
    c() {
      e = m("section"), pe(l.$$.fragment), i = N(), a && a.c(), u(e, "class", "svelte-eg8s2l");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), f(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 && (be(), D(a, 1, 1, () => {
        a = null;
      }), ke()) : a ? (a.p(r, s), s & /*hide*/
      1 && T(a, 1)) : (a = ah(r), a.c(), T(a, 1), a.m(e, null));
    },
    i(r) {
      n || (T(l.$$.fragment, r), T(a), n = !0);
    },
    o(r) {
      D(l.$$.fragment, r), D(a), n = !1;
    },
    d(r) {
      r && C(e), he(l), a && a.d();
    }
  };
}
function ah(t) {
  var p, g;
  let e, l, i, n, a, r = (
    /*is_prop_timed*/
    t[7] && rh(t)
  ), s = $e(
    /*section_meta*/
    (p = t[6]) == null ? void 0 : p.subsections
  ), o = [];
  for (let b = 0; b < s.length; b += 1)
    o[b] = oh(lh(t, s, b));
  const _ = (b) => D(o[b], 1, 1, () => {
    o[b] = null;
  });
  let c = $e(
    /*section_meta*/
    (g = t[6]) == null ? void 0 : g.subsections
  ), d = [];
  for (let b = 0; b < c.length; b += 1)
    d[b] = fh(th(t, c, b));
  const h = (b) => D(d[b], 1, 1, () => {
    d[b] = null;
  });
  return {
    c() {
      r && r.c(), e = N(), l = m("div");
      for (let b = 0; b < o.length; b += 1)
        o[b].c();
      i = N();
      for (let b = 0; b < d.length; b += 1)
        d[b].c();
      n = Ae(), u(l, "class", "panel svelte-eg8s2l");
    },
    m(b, k) {
      r && r.m(b, k), S(b, e, k), S(b, l, k);
      for (let y = 0; y < o.length; y += 1)
        o[y] && o[y].m(l, null);
      S(b, i, k);
      for (let y = 0; y < d.length; y += 1)
        d[y] && d[y].m(b, k);
      S(b, n, k), a = !0;
    },
    p(b, k) {
      var y, v;
      if (/*is_prop_timed*/
      b[7] ? r ? r.p(b, k) : (r = rh(b), r.c(), r.m(e.parentNode, e)) : r && (r.d(1), r = null), k & /*section_meta, $data, addToBasket, basket, openTimeMachine*/
      364) {
        s = $e(
          /*section_meta*/
          (y = b[6]) == null ? void 0 : y.subsections
        );
        let w;
        for (w = 0; w < s.length; w += 1) {
          const q = lh(b, s, w);
          o[w] ? (o[w].p(q, k), T(o[w], 1)) : (o[w] = oh(q), o[w].c(), T(o[w], 1), o[w].m(l, null));
        }
        for (be(), w = s.length; w < o.length; w += 1)
          _(w);
        ke();
      }
      if (k & /*section_meta, addToBasket, basket, data, openTimeMachine, is_prop_timed, property_time*/
      254) {
        c = $e(
          /*section_meta*/
          (v = b[6]) == null ? void 0 : v.subsections
        );
        let w;
        for (w = 0; w < c.length; w += 1) {
          const q = th(b, c, w);
          d[w] ? (d[w].p(q, k), T(d[w], 1)) : (d[w] = fh(q), d[w].c(), T(d[w], 1), d[w].m(n.parentNode, n));
        }
        for (be(), w = c.length; w < d.length; w += 1)
          h(w);
        ke();
      }
    },
    i(b) {
      if (!a) {
        for (let k = 0; k < s.length; k += 1)
          T(o[k]);
        for (let k = 0; k < c.length; k += 1)
          T(d[k]);
        a = !0;
      }
    },
    o(b) {
      o = o.filter(Boolean);
      for (let k = 0; k < o.length; k += 1)
        D(o[k]);
      d = d.filter(Boolean);
      for (let k = 0; k < d.length; k += 1)
        D(d[k]);
      a = !1;
    },
    d(b) {
      b && (C(e), C(l), C(i), C(n)), r && r.d(b), Ye(o, b), Ye(d, b);
    }
  };
}
function rh(t) {
  let e, l, i, n, a, r, s, o, _, c, d = $e(Object.keys(
    /*$data*/
    t[8].timed_properties
  )), h = [];
  for (let p = 0; p < d.length; p += 1)
    h[p] = sh(ih(t, d, p));
  return {
    c() {
      e = m("div"), l = m("div"), i = m("label"), i.textContent = "Collected at:", n = N(), a = m("select"), r = m("option"), s = E("Current");
      for (let p = 0; p < h.length; p += 1)
        h[p].c();
      u(i, "for", "property-time-machine"), u(i, "class", "svelte-eg8s2l"), r.__value = "current", pt(r, r.__value), r.selected = o = /*$property_time*/
      t[9] === "current", u(r, "class", "svelte-eg8s2l"), u(a, "id", "property-time-machine"), u(a, "class", "svelte-eg8s2l"), u(l, "class", "input-wrap svelte-eg8s2l"), u(e, "class", "input-row sticky svelte-eg8s2l");
    },
    m(p, g) {
      S(p, e, g), f(e, l), f(l, i), f(l, n), f(l, a), f(a, r), f(r, s);
      for (let b = 0; b < h.length; b += 1)
        h[b] && h[b].m(a, null);
      _ || (c = te(
        a,
        "change",
        /*change_handler*/
        t[11]
      ), _ = !0);
    },
    p(p, g) {
      if (g & /*$property_time*/
      512 && o !== (o = /*$property_time*/
      p[9] === "current") && (r.selected = o), g & /*Object, $data, $property_time*/
      768) {
        d = $e(Object.keys(
          /*$data*/
          p[8].timed_properties
        ));
        let b;
        for (b = 0; b < d.length; b += 1) {
          const k = ih(p, d, b);
          h[b] ? h[b].p(k, g) : (h[b] = sh(k), h[b].c(), h[b].m(a, null));
        }
        for (; b < h.length; b += 1)
          h[b].d(1);
        h.length = d.length;
      }
    },
    d(p) {
      p && C(e), Ye(h, p), _ = !1, c();
    }
  };
}
function sh(t) {
  let e, l = (
    /*time*/
    t[17] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*time*/
      t[17], pt(e, e.__value), e.selected = a = /*$property_time*/
      t[9] === /*time*/
      t[17], u(e, "class", "svelte-eg8s2l");
    },
    m(r, s) {
      S(r, e, s), f(e, i);
    },
    p(r, s) {
      s & /*$data*/
      256 && l !== (l = /*time*/
      r[17] + "") && U(i, l), s & /*$data*/
      256 && n !== (n = /*time*/
      r[17]) && (e.__value = n, pt(e, e.__value)), s & /*$property_time, $data*/
      768 && a !== (a = /*$property_time*/
      r[9] === /*time*/
      r[17]) && (e.selected = a);
    },
    d(r) {
      r && C(e);
    }
  };
}
function z5(t) {
  let e, l;
  return e = new Ya({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function N5(t) {
  let e, l;
  return e = new M5({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function A5(t) {
  let e, l;
  return e = new q5({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function B5(t) {
  let e, l;
  return e = new Ya({
    props: {
      key: (
        /*sub*/
        t[12]
      ),
      value: (
        /*$data*/
        t[8][
          /*sub*/
          t[12]
        ]
      ),
      level: 1
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function oh(t) {
  let e, l, i, n;
  const a = [B5, A5, N5, z5], r = [];
  function s(o, _) {
    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 = Ae();
    },
    m(o, _) {
      ~e && r[e].m(o, _), S(o, i, _), n = !0;
    },
    p(o, _) {
      let c = e;
      e = s(o), e === c ? ~e && r[e].p(o, _) : (l && (be(), D(r[c], 1, 1, () => {
        r[c] = null;
      }), ke()), ~e ? (l = r[e], l ? l.p(o, _) : (l = r[e] = a[e](o), l.c()), T(l, 1), l.m(i.parentNode, i)) : l = null);
    },
    i(o) {
      n || (T(l), n = !0);
    },
    o(o) {
      D(l), n = !1;
    },
    d(o) {
      o && C(i), ~e && r[e].d(o);
    }
  };
}
function uh(t) {
  let e, l;
  return e = new k5({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function fh(t) {
  let e, l, i = (
    /*sub*/
    t[12].key && /*sub*/
    t[12].order && uh(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(n, a) {
      i && i.m(n, a), S(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 && T(i, 1)) : (i = uh(n), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d(n);
    }
  };
}
function P5(t) {
  let e, l, i = (
    /*$data*/
    t[8] && /*section_meta*/
    t[6] && nh(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(n, a) {
      i && i.m(n, a), S(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 && T(i, 1)) : (i = nh(n), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d(n);
    }
  };
}
function O5(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (w) => l(8, i = w)), _), r, s = ne, o = () => (s(), s = st(h, (w) => l(9, r = w)), h);
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => s());
  let { data: _ = Oe() } = e;
  a();
  let { addToBasket: c = () => {
  } } = e, { openTimeMachine: d = () => {
  } } = e, { property_time: h = Oe() } = e;
  o();
  let { basket: p } = e, { section_meta: g } = e, { hide: b = !1 } = e;
  function k() {
    l(0, b = !b);
  }
  let y = !1;
  Tt(() => {
    l(7, y = i.property_times && g.title === "Properties");
  });
  const v = (w) => {
    h.set(w.target.value);
  };
  return t.$$set = (w) => {
    "data" in w && a(l(1, _ = 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, g = w.section_meta), "hide" in w && l(0, b = w.hide);
  }, [
    b,
    _,
    c,
    d,
    h,
    p,
    g,
    y,
    i,
    r,
    k,
    v
  ];
}
class Sl extends Ve {
  constructor(e) {
    super(), Qe(this, e, O5, P5, Fe, {
      data: 1,
      addToBasket: 2,
      openTimeMachine: 3,
      property_time: 4,
      basket: 5,
      section_meta: 6,
      hide: 0
    });
  }
}
function E5(t) {
  let e, l;
  return {
    c() {
      e = m("div"), u(e, "class", "in-table-bar svelte-rqx7ym"), u(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) {
      S(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] + ";" : ""}`) && u(e, "style", l);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e);
    }
  };
}
function I5(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 Xi extends Ve {
  constructor(e) {
    super(), Qe(this, e, I5, E5, Fe, { value: 0, min: 1, max: 2, color: 3 });
  }
}
function _h(t, e, l) {
  const i = t.slice();
  return i[11] = e[l], i[13] = l, i;
}
function ch(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*basket_codes*/
          t[5].total
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1gm7n3s");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function dh(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*basket_codes*/
          t[5].curr
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-1gm7n3s");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function hh(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-1gm7n3s");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o & /*$basket, basket_codes*/
      160 && (_.on = /*$basket*/
      t[7].includes(
        /*basket_codes*/
        t[5][
          /*di*/
          t[13]
        ]
      )), l.$set(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function ph(t) {
  let e, l, i = (
    /*dp*/
    t[11].date + ""
  ), n, a, r, s = (
    /*dp*/
    t[11].data.asof + ""
  ), o, _, c, d = (
    /*dp*/
    t[11].data.value + ""
  ), h, p, g = (
    /*dp*/
    t[11].data.unit + ""
  ), b, k, y, v, w, q, $, j, I;
  w = new Xi({
    props: {
      value: (
        /*dp*/
        t[11].data.value
      ),
      min: (
        /*minValue*/
        t[4]
      ),
      max: (
        /*maxValue*/
        t[3]
      )
    }
  });
  let A = (
    /*addToBasket*/
    t[1] && hh(t)
  );
  return {
    c() {
      e = m("tr"), l = m("td"), n = E(i), a = N(), r = m("td"), o = E(s), _ = N(), c = m("td"), h = E(d), p = E(" ("), b = E(g), k = E(")"), y = N(), v = m("td"), pe(w.$$.fragment), q = N(), $ = m("td"), A && A.c(), j = N(), u(l, "class", "svelte-1gm7n3s"), u(r, "class", "svelte-1gm7n3s"), u(c, "class", "svelte-1gm7n3s"), u(v, "class", "in-table-bar-cell svelte-1gm7n3s"), u($, "class", "svelte-1gm7n3s");
    },
    m(M, z) {
      S(M, e, z), f(e, l), f(l, n), f(e, a), f(e, r), f(r, o), f(e, _), f(e, c), f(c, h), f(c, p), f(c, b), f(c, k), f(e, y), f(e, v), de(w, v, null), f(e, q), f(e, $), A && A.m($, null), f(e, j), I = !0;
    },
    p(M, z) {
      (!I || z & /*$timeMachineData*/
      64) && i !== (i = /*dp*/
      M[11].date + "") && U(n, i), (!I || z & /*$timeMachineData*/
      64) && s !== (s = /*dp*/
      M[11].data.asof + "") && U(o, s), (!I || z & /*$timeMachineData*/
      64) && d !== (d = /*dp*/
      M[11].data.value + "") && U(h, d), (!I || z & /*$timeMachineData*/
      64) && g !== (g = /*dp*/
      M[11].data.unit + "") && U(b, g);
      const H = {};
      z & /*$timeMachineData*/
      64 && (H.value = /*dp*/
      M[11].data.value), z & /*minValue*/
      16 && (H.min = /*minValue*/
      M[4]), z & /*maxValue*/
      8 && (H.max = /*maxValue*/
      M[3]), w.$set(H), /*addToBasket*/
      M[1] ? A ? (A.p(M, z), z & /*addToBasket*/
      2 && T(A, 1)) : (A = hh(M), A.c(), T(A, 1), A.m($, null)) : A && (be(), D(A, 1, 1, () => {
        A = null;
      }), ke());
    },
    i(M) {
      I || (T(w.$$.fragment, M), T(A), I = !0);
    },
    o(M) {
      D(w.$$.fragment, M), D(A), I = !1;
    },
    d(M) {
      M && C(e), he(w), A && A.d();
    }
  };
}
function D5(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q = (
    /*$timeMachineData*/
    t[6].curr_data.asof + ""
  ), $, j, I, A = (
    /*$timeMachineData*/
    t[6].curr_data.value + ""
  ), M, z, H = (
    /*$timeMachineData*/
    t[6].curr_data.unit + ""
  ), B, R, P, O, F, L, X, V, Q, Z = (
    /*addToBasket*/
    t[1] && ch(t)
  );
  F = new Xi({
    props: {
      value: (
        /*$timeMachineData*/
        t[6].curr_data.value
      ),
      min: (
        /*minValue*/
        t[4]
      ),
      max: (
        /*maxValue*/
        t[3]
      )
    }
  });
  let ae = (
    /*addToBasket*/
    t[1] && dh(t)
  ), se = $e(
    /*$timeMachineData*/
    t[6].history_data
  ), K = [];
  for (let W = 0; W < se.length; W += 1)
    K[W] = ph(_h(t, se, W));
  const Y = (W) => D(K[W], 1, 1, () => {
    K[W] = null;
  });
  return {
    c() {
      e = m("div"), l = m("table"), i = m("thead"), n = m("tr"), a = m("th"), a.textContent = "Time point", r = N(), s = m("th"), s.textContent = "As of", o = N(), _ = m("th"), _.textContent = "Value", c = N(), d = m("th"), d.textContent = "→", h = N(), p = m("th"), Z && Z.c(), g = N(), b = m("tbody"), k = m("tr"), y = m("td"), y.textContent = "Current", v = N(), w = m("td"), $ = E(q), j = N(), I = m("td"), M = E(A), z = E(" ("), B = E(H), R = E(")"), P = N(), O = m("td"), pe(F.$$.fragment), L = N(), X = m("td"), ae && ae.c(), V = N();
      for (let W = 0; W < K.length; W += 1)
        K[W].c();
      u(a, "class", "svelte-1gm7n3s"), u(s, "class", "svelte-1gm7n3s"), u(_, "class", "svelte-1gm7n3s"), u(d, "class", "svelte-1gm7n3s"), u(p, "class", "svelte-1gm7n3s"), u(y, "class", "svelte-1gm7n3s"), u(w, "class", "svelte-1gm7n3s"), u(I, "class", "svelte-1gm7n3s"), u(O, "class", "in-table-bar-cell svelte-1gm7n3s"), u(X, "class", "svelte-1gm7n3s"), u(l, "class", "svelte-1gm7n3s"), u(e, "class", "time-machine-body svelte-1gm7n3s");
    },
    m(W, J) {
      S(W, e, J), f(e, l), f(l, i), f(i, n), f(n, a), f(n, r), f(n, s), f(n, o), f(n, _), f(n, c), f(n, d), f(n, h), f(n, p), Z && Z.m(p, null), f(l, g), f(l, b), f(b, k), f(k, y), f(k, v), f(k, w), f(w, $), f(k, j), f(k, I), f(I, M), f(I, z), f(I, B), f(I, R), f(k, P), f(k, O), de(F, O, null), f(k, L), f(k, X), ae && ae.m(X, null), f(b, V);
      for (let ee = 0; ee < K.length; ee += 1)
        K[ee] && K[ee].m(b, null);
      Q = !0;
    },
    p(W, [J]) {
      /*addToBasket*/
      W[1] ? Z ? (Z.p(W, J), J & /*addToBasket*/
      2 && T(Z, 1)) : (Z = ch(W), Z.c(), T(Z, 1), Z.m(p, null)) : Z && (be(), D(Z, 1, 1, () => {
        Z = null;
      }), ke()), (!Q || J & /*$timeMachineData*/
      64) && q !== (q = /*$timeMachineData*/
      W[6].curr_data.asof + "") && U($, q), (!Q || J & /*$timeMachineData*/
      64) && A !== (A = /*$timeMachineData*/
      W[6].curr_data.value + "") && U(M, A), (!Q || J & /*$timeMachineData*/
      64) && H !== (H = /*$timeMachineData*/
      W[6].curr_data.unit + "") && U(B, H);
      const ee = {};
      if (J & /*$timeMachineData*/
      64 && (ee.value = /*$timeMachineData*/
      W[6].curr_data.value), J & /*minValue*/
      16 && (ee.min = /*minValue*/
      W[4]), J & /*maxValue*/
      8 && (ee.max = /*maxValue*/
      W[3]), F.$set(ee), /*addToBasket*/
      W[1] ? ae ? (ae.p(W, J), J & /*addToBasket*/
      2 && T(ae, 1)) : (ae = dh(W), ae.c(), T(ae, 1), ae.m(X, null)) : ae && (be(), D(ae, 1, 1, () => {
        ae = null;
      }), ke()), J & /*addToBasket, basket_codes, $basket, $timeMachineData, minValue, maxValue*/
      250) {
        se = $e(
          /*$timeMachineData*/
          W[6].history_data
        );
        let we;
        for (we = 0; we < se.length; we += 1) {
          const Re = _h(W, se, we);
          K[we] ? (K[we].p(Re, J), T(K[we], 1)) : (K[we] = ph(Re), K[we].c(), T(K[we], 1), K[we].m(b, null));
        }
        for (be(), we = se.length; we < K.length; we += 1)
          Y(we);
        ke();
      }
    },
    i(W) {
      if (!Q) {
        T(Z), T(F.$$.fragment, W), T(ae);
        for (let J = 0; J < se.length; J += 1)
          T(K[J]);
        Q = !0;
      }
    },
    o(W) {
      D(Z), D(F.$$.fragment, W), D(ae), K = K.filter(Boolean);
      for (let J = 0; J < K.length; J += 1)
        D(K[J]);
      Q = !1;
    },
    d(W) {
      W && C(e), Z && Z.d(), he(F), ae && ae.d(), Ye(K, W);
    }
  };
}
function R5(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (v) => l(6, i = v)), _), r, s = ne, o = () => (s(), s = st(d, (v) => l(7, r = v)), d);
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => s());
  let { timeMachineData: _ = Oe(), addToBasket: c, basket: d } = e;
  a(), o();
  let h = -1 / 0, p = 1 / 0, g = {};
  Tt(() => {
    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, g.curr = `${i.key}_curr = ${i.code_header}${i.code_key}${i.code_footer}`, g), l(5, g.total = `${i.key}_timed = [${i.key}_curr`, g);
    let v = 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, g[v] = `${i.key}_h_${v} = ${i.code_header}${i.code_key}${i.code_footer}`, g), l(5, g[v] = g[v].replace(".properties()", ".properties(datetime=" + a0(w.date) + ")"), g), l(5, g.total += `, ${i.key}_h_${v}`, g), v++;
    l(5, g.total += "]", g), l(4, p -= (h - p) / 4);
  });
  const b = () => {
    if (r.includes(g.total)) {
      r.includes(g.curr) && c(g.curr);
      let v = 0;
      for (let w of i.history_data)
        r.includes(g[v]) && c(g[v]), v++;
    } else {
      r.includes(g.curr) || c(g.curr);
      let v = 0;
      for (let w of i.history_data)
        r.includes(g[v]) || c(g[v]), v++;
    }
    c(g.total);
  }, k = () => {
    c(g.curr), !r.includes(g.curr) && r.includes(g.total) && c(g.total);
  }, y = (v) => {
    c(g[v]), !r.includes(g[v]) && r.includes(g.total) && c(g.total);
  };
  return t.$$set = (v) => {
    "timeMachineData" in v && a(l(0, _ = v.timeMachineData)), "addToBasket" in v && l(1, c = v.addToBasket), "basket" in v && o(l(2, d = v.basket));
  }, [
    _,
    c,
    d,
    h,
    p,
    g,
    i,
    r,
    b,
    k,
    y
  ];
}
class H5 extends Ve {
  constructor(e) {
    super(), Qe(this, e, R5, D5, Fe, {
      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 gh(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*basket_codes*/
          t[5].total
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-ymle7z");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function bh(t) {
  let e, l, i, n, a;
  return l = new zt({
    props: {
      on: (
        /*$basket*/
        t[7].includes(
          /*basket_codes*/
          t[5].curr
        )
      )
    }
  }), {
    c() {
      e = m("button"), pe(l.$$.fragment), u(e, "class", "basket svelte-ymle7z");
    },
    m(r, s) {
      S(r, e, s), de(l, e, null), i = !0, n || (a = te(
        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 || (T(l.$$.fragment, r), i = !0);
    },
    o(r) {
      D(l.$$.fragment, r), i = !1;
    },
    d(r) {
      r && C(e), he(l), n = !1, a();
    }
  };
}
function kh(t) {
  let e, l, i, n, a;
  l = new zt({
    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"), pe(l.$$.fragment), u(e, "class", "basket svelte-ymle7z");
    },
    m(s, o) {
      S(s, e, o), de(l, e, null), i = !0, n || (a = te(e, "click", r), n = !0);
    },
    p(s, o) {
      t = s;
      const _ = {};
      o & /*$basket, basket_codes*/
      160 && (_.on = /*$basket*/
      t[7].includes(
        /*basket_codes*/
        t[5][
          /*di*/
          t[13]
        ]
      )), l.$set(_);
    },
    i(s) {
      i || (T(l.$$.fragment, s), i = !0);
    },
    o(s) {
      D(l.$$.fragment, s), i = !1;
    },
    d(s) {
      s && C(e), he(l), n = !1, a();
    }
  };
}
function vh(t) {
  let e, l, i = (
    /*dp*/
    t[11].date + ""
  ), n, a, r, s = (
    /*dp*/
    t[11].data.parameters.gate_error.asof + ""
  ), o, _, c, d = (
    /*dp*/
    t[11].data.parameters.gate_error.value + ""
  ), h, p, g, b, k, y, v = (
    /*dp*/
    t[11].data.parameters.gate_length.asof + ""
  ), w, q, $, j = (
    /*dp*/
    t[11].data.parameters.gate_length.value + ""
  ), I, A, M = (
    /*dp*/
    t[11].data.parameters.gate_length.unit + ""
  ), z, H, B, R, P, O, F, L, X;
  b = new Xi({
    props: {
      value: (
        /*dp*/
        t[11].data.parameters.gate_error.value
      ),
      min: (
        /*minValue*/
        t[4][0]
      ),
      max: (
        /*maxValue*/
        t[3][0]
      )
    }
  }), P = new Xi({
    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] && kh(t)
  );
  return {
    c() {
      e = m("tr"), l = m("td"), n = E(i), a = N(), r = m("td"), o = E(s), _ = N(), c = m("td"), h = E(d), p = N(), g = m("td"), pe(b.$$.fragment), k = N(), y = m("td"), w = E(v), q = N(), $ = m("td"), I = E(j), A = E(`
            (`), z = E(M), H = E(")"), B = N(), R = m("td"), pe(P.$$.fragment), O = N(), F = m("td"), V && V.c(), L = N(), u(l, "class", "svelte-ymle7z"), u(r, "class", "svelte-ymle7z"), u(c, "class", "svelte-ymle7z"), u(g, "class", "in-table-bar-cell svelte-ymle7z"), u(y, "class", "svelte-ymle7z"), u($, "class", "svelte-ymle7z"), u(R, "class", "in-table-bar-cell svelte-ymle7z"), u(F, "class", "svelte-ymle7z");
    },
    m(Q, Z) {
      S(Q, e, Z), f(e, l), f(l, n), f(e, a), f(e, r), f(r, o), f(e, _), f(e, c), f(c, h), f(e, p), f(e, g), de(b, g, null), f(e, k), f(e, y), f(y, w), f(e, q), f(e, $), f($, I), f($, A), f($, z), f($, H), f(e, B), f(e, R), de(P, R, null), f(e, O), f(e, F), V && V.m(F, null), f(e, L), X = !0;
    },
    p(Q, Z) {
      (!X || Z & /*$timeMachineData*/
      64) && i !== (i = /*dp*/
      Q[11].date + "") && U(n, i), (!X || Z & /*$timeMachineData*/
      64) && s !== (s = /*dp*/
      Q[11].data.parameters.gate_error.asof + "") && U(o, s), (!X || Z & /*$timeMachineData*/
      64) && d !== (d = /*dp*/
      Q[11].data.parameters.gate_error.value + "") && U(h, d);
      const ae = {};
      Z & /*$timeMachineData*/
      64 && (ae.value = /*dp*/
      Q[11].data.parameters.gate_error.value), Z & /*minValue*/
      16 && (ae.min = /*minValue*/
      Q[4][0]), Z & /*maxValue*/
      8 && (ae.max = /*maxValue*/
      Q[3][0]), b.$set(ae), (!X || Z & /*$timeMachineData*/
      64) && v !== (v = /*dp*/
      Q[11].data.parameters.gate_length.asof + "") && U(w, v), (!X || Z & /*$timeMachineData*/
      64) && j !== (j = /*dp*/
      Q[11].data.parameters.gate_length.value + "") && U(I, j), (!X || Z & /*$timeMachineData*/
      64) && M !== (M = /*dp*/
      Q[11].data.parameters.gate_length.unit + "") && U(z, M);
      const se = {};
      Z & /*$timeMachineData*/
      64 && (se.value = /*dp*/
      Q[11].data.parameters.gate_length.value), Z & /*minValue*/
      16 && (se.min = /*minValue*/
      Q[4][1]), Z & /*maxValue*/
      8 && (se.max = /*maxValue*/
      Q[3][1]), P.$set(se), /*addToBasket*/
      Q[1] ? V ? (V.p(Q, Z), Z & /*addToBasket*/
      2 && T(V, 1)) : (V = kh(Q), V.c(), T(V, 1), V.m(F, null)) : V && (be(), D(V, 1, 1, () => {
        V = null;
      }), ke());
    },
    i(Q) {
      X || (T(b.$$.fragment, Q), T(P.$$.fragment, Q), T(V), X = !0);
    },
    o(Q) {
      D(b.$$.fragment, Q), D(P.$$.fragment, Q), D(V), X = !1;
    },
    d(Q) {
      Q && C(e), he(b), he(P), V && V.d();
    }
  };
}
function L5(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z = (
    /*$timeMachineData*/
    t[6].curr_data.parameters.gate_error.asof + ""
  ), H, B, R, P = (
    /*$timeMachineData*/
    t[6].curr_data.parameters.gate_error.value + ""
  ), O, F, L, X, V, Q, Z = (
    /*$timeMachineData*/
    t[6].curr_data.parameters.gate_length.asof + ""
  ), ae, se, K, Y = (
    /*$timeMachineData*/
    t[6].curr_data.parameters.gate_length.value + ""
  ), W, J, ee = (
    /*$timeMachineData*/
    t[6].curr_data.parameters.gate_length.unit + ""
  ), we, Re, ve, me, fe, G, ye, ue, le, oe = (
    /*addToBasket*/
    t[1] && gh(t)
  );
  X = new Xi({
    props: {
      value: (
        /*$timeMachineData*/
        t[6].curr_data.parameters.gate_error.value
      ),
      min: (
        /*minValue*/
        t[4][0]
      ),
      max: (
        /*maxValue*/
        t[3][0]
      )
    }
  }), fe = new Xi({
    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] && bh(t)
  ), ge = $e(
    /*$timeMachineData*/
    t[6].history_data
  ), re = [];
  for (let je = 0; je < ge.length; je += 1)
    re[je] = vh(mh(t, ge, je));
  const Ie = (je) => D(re[je], 1, 1, () => {
    re[je] = null;
  });
  return {
    c() {
      e = m("div"), l = m("table"), i = m("thead"), n = m("tr"), a = m("th"), a.textContent = "Time point", r = N(), s = m("th"), s.textContent = "As of", o = N(), _ = m("th"), _.textContent = "Error", c = N(), d = m("th"), d.textContent = "→", h = N(), p = m("th"), p.textContent = "As of", g = N(), b = m("th"), b.textContent = "Length", k = N(), y = m("th"), y.textContent = "→", v = N(), w = m("th"), oe && oe.c(), q = N(), $ = m("tbody"), j = m("tr"), I = m("td"), I.textContent = "Current", A = N(), M = m("td"), H = E(z), B = N(), R = m("td"), O = E(P), F = N(), L = m("td"), pe(X.$$.fragment), V = N(), Q = m("td"), ae = E(Z), se = N(), K = m("td"), W = E(Y), J = E(`
          (`), we = E(ee), Re = E(")"), ve = N(), me = m("td"), pe(fe.$$.fragment), G = N(), ye = m("td"), x && x.c(), ue = N();
      for (let je = 0; je < re.length; je += 1)
        re[je].c();
      u(a, "class", "svelte-ymle7z"), u(s, "class", "svelte-ymle7z"), u(_, "class", "svelte-ymle7z"), u(d, "class", "svelte-ymle7z"), u(p, "class", "svelte-ymle7z"), u(b, "class", "svelte-ymle7z"), u(y, "class", "svelte-ymle7z"), u(w, "class", "svelte-ymle7z"), u(I, "class", "svelte-ymle7z"), u(M, "class", "svelte-ymle7z"), u(R, "class", "svelte-ymle7z"), u(L, "class", "in-table-bar-cell svelte-ymle7z"), u(Q, "class", "svelte-ymle7z"), u(K, "class", "svelte-ymle7z"), u(me, "class", "in-table-bar-cell svelte-ymle7z"), u(ye, "class", "svelte-ymle7z"), u(l, "class", "svelte-ymle7z"), u(e, "class", "time-machine-body svelte-ymle7z");
    },
    m(je, _e) {
      S(je, e, _e), f(e, l), f(l, i), f(i, n), f(n, a), f(n, r), f(n, s), f(n, o), f(n, _), f(n, c), f(n, d), f(n, h), f(n, p), f(n, g), f(n, b), f(n, k), f(n, y), f(n, v), f(n, w), oe && oe.m(w, null), f(l, q), f(l, $), f($, j), f(j, I), f(j, A), f(j, M), f(M, H), f(j, B), f(j, R), f(R, O), f(j, F), f(j, L), de(X, L, null), f(j, V), f(j, Q), f(Q, ae), f(j, se), f(j, K), f(K, W), f(K, J), f(K, we), f(K, Re), f(j, ve), f(j, me), de(fe, me, null), f(j, G), f(j, ye), x && x.m(ye, null), f($, ue);
      for (let Ee = 0; Ee < re.length; Ee += 1)
        re[Ee] && re[Ee].m($, null);
      le = !0;
    },
    p(je, [_e]) {
      /*addToBasket*/
      je[1] ? oe ? (oe.p(je, _e), _e & /*addToBasket*/
      2 && T(oe, 1)) : (oe = gh(je), oe.c(), T(oe, 1), oe.m(w, null)) : oe && (be(), D(oe, 1, 1, () => {
        oe = null;
      }), ke()), (!le || _e & /*$timeMachineData*/
      64) && z !== (z = /*$timeMachineData*/
      je[6].curr_data.parameters.gate_error.asof + "") && U(H, z), (!le || _e & /*$timeMachineData*/
      64) && P !== (P = /*$timeMachineData*/
      je[6].curr_data.parameters.gate_error.value + "") && U(O, P);
      const Ee = {};
      _e & /*$timeMachineData*/
      64 && (Ee.value = /*$timeMachineData*/
      je[6].curr_data.parameters.gate_error.value), _e & /*minValue*/
      16 && (Ee.min = /*minValue*/
      je[4][0]), _e & /*maxValue*/
      8 && (Ee.max = /*maxValue*/
      je[3][0]), X.$set(Ee), (!le || _e & /*$timeMachineData*/
      64) && Z !== (Z = /*$timeMachineData*/
      je[6].curr_data.parameters.gate_length.asof + "") && U(ae, Z), (!le || _e & /*$timeMachineData*/
      64) && Y !== (Y = /*$timeMachineData*/
      je[6].curr_data.parameters.gate_length.value + "") && U(W, Y), (!le || _e & /*$timeMachineData*/
      64) && ee !== (ee = /*$timeMachineData*/
      je[6].curr_data.parameters.gate_length.unit + "") && U(we, ee);
      const ie = {};
      if (_e & /*$timeMachineData*/
      64 && (ie.value = /*$timeMachineData*/
      je[6].curr_data.parameters.gate_length.value), _e & /*minValue*/
      16 && (ie.min = /*minValue*/
      je[4][1]), _e & /*maxValue*/
      8 && (ie.max = /*maxValue*/
      je[3][1]), fe.$set(ie), /*addToBasket*/
      je[1] ? x ? (x.p(je, _e), _e & /*addToBasket*/
      2 && T(x, 1)) : (x = bh(je), x.c(), T(x, 1), x.m(ye, null)) : x && (be(), D(x, 1, 1, () => {
        x = null;
      }), ke()), _e & /*addToBasket, basket_codes, $basket, $timeMachineData, minValue, maxValue*/
      250) {
        ge = $e(
          /*$timeMachineData*/
          je[6].history_data
        );
        let Te;
        for (Te = 0; Te < ge.length; Te += 1) {
          const Ue = mh(je, ge, Te);
          re[Te] ? (re[Te].p(Ue, _e), T(re[Te], 1)) : (re[Te] = vh(Ue), re[Te].c(), T(re[Te], 1), re[Te].m($, null));
        }
        for (be(), Te = ge.length; Te < re.length; Te += 1)
          Ie(Te);
        ke();
      }
    },
    i(je) {
      if (!le) {
        T(oe), T(X.$$.fragment, je), T(fe.$$.fragment, je), T(x);
        for (let _e = 0; _e < ge.length; _e += 1)
          T(re[_e]);
        le = !0;
      }
    },
    o(je) {
      D(oe), D(X.$$.fragment, je), D(fe.$$.fragment, je), D(x), re = re.filter(Boolean);
      for (let _e = 0; _e < re.length; _e += 1)
        D(re[_e]);
      le = !1;
    },
    d(je) {
      je && C(e), oe && oe.d(), he(X), he(fe), x && x.d(), Ye(re, je);
    }
  };
}
function F5(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (v) => l(6, i = v)), _), r, s = ne, o = () => (s(), s = st(d, (v) => l(7, r = v)), d);
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => s());
  let { timeMachineData: _ = Oe(), addToBasket: c, basket: d } = e;
  a(), o();
  let h = [-1 / 0, -1 / 0], p = [1 / 0, 1 / 0], g = {};
  Tt(() => {
    let v = [
      i.curr_data.parameters.gate_error.value,
      i.curr_data.parameters.gate_length.value
    ];
    l(3, h = [
      v[0] > h[0] ? v[0] : h[0],
      v[1] > h[1] ? v[1] : h[1]
    ]), l(4, p = [
      v[0] < p[0] ? v[0] : p[0],
      v[1] < p[1] ? v[1] : p[1]
    ]), l(5, g.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}`, g), l(5, g.total = `gate_${i.key}_timed = [gate_${i.curr_data.gate}_${i.curr_data.qubits.join("_")}_curr`, g);
    let w = 0;
    for (let q of i.history_data) {
      let $ = [q.data.parameters.gate_error.value, q.data.parameters.gate_length.value];
      l(3, h = [
        $[0] > h[0] ? $[0] : h[0],
        $[1] > h[1] ? $[1] : h[1]
      ]), l(4, p = [
        $[0] < p[0] ? $[0] : p[0],
        $[1] < p[1] ? $[1] : p[1]
      ]), l(5, g[w] = `gate_${q.data.gate}_${q.data.qubits.join("_")}_h_${w} = ${i.code_header.replace("properties()", "properties(datetime=" + a0(q.date) + ")")}gate=${q.data.gate}, qubits=[${q.data.qubits.join(", ")}]${i.code_footer}`, g), l(5, g.total += `, gate_${q.data.gate}_${q.data.qubits.join("_")}_h_${w}`, g), w++;
    }
    l(4, p[0] -= (h[0] - p[0]) / 4, p), l(4, p[1] -= (h[1] - p[1]) / 4, p), l(5, g.total += "]", g);
  });
  const b = () => {
    if (r.includes(g.total)) {
      r.includes(g.curr) && c(g.curr);
      let v = 0;
      for (let w of i.history_data)
        r.includes(g[v]) && c(g[v]), v++;
    } else {
      r.includes(g.curr) || c(g.curr);
      let v = 0;
      for (let w of i.history_data)
        r.includes(g[v]) || c(g[v]), v++;
    }
    c(g.total);
  }, k = () => {
    c(g.curr), !r.includes(g.curr) && r.includes(g.total) && c(g.total);
  }, y = (v) => {
    c(g[v]), !r.includes(g[v]) && r.includes(g.total) && c(g.total);
  };
  return t.$$set = (v) => {
    "timeMachineData" in v && a(l(0, _ = v.timeMachineData)), "addToBasket" in v && l(1, c = v.addToBasket), "basket" in v && o(l(2, d = v.basket));
  }, [
    _,
    c,
    d,
    h,
    p,
    g,
    i,
    r,
    b,
    k,
    y
  ];
}
class Q5 extends Ve {
  constructor(e) {
    super(), Qe(this, e, F5, L5, Fe, {
      timeMachineData: 0,
      addToBasket: 1,
      basket: 2
    });
  }
}
function V5(t) {
  let e, l;
  return e = new Q5({
    props: {
      addToBasket: (
        /*addToBasket*/
        t[2]
      ),
      basket: (
        /*basket*/
        t[3]
      ),
      timeMachineData: (
        /*timeMachineData*/
        t[0]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function X5(t) {
  let e, l;
  return e = new H5({
    props: {
      addToBasket: (
        /*addToBasket*/
        t[2]
      ),
      basket: (
        /*basket*/
        t[3]
      ),
      timeMachineData: (
        /*timeMachineData*/
        t[0]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function G5(t) {
  let e, l, i, n, a, r = (
    /*$timeMachineData*/
    t[4].parentKey + ""
  ), s, o, _ = (
    /*$timeMachineData*/
    (t[4].title_key || /*$timeMachineData*/
    t[4].key) + ""
  ), c, d, h, p, g, b, k, y, v, w;
  const q = [X5, V5], $ = [];
  function j(I, A) {
    return (
      /*$timeMachineData*/
      I[4].datatype === "nudv-map" ? 0 : (
        /*$timeMachineData*/
        I[4].datatype === "gates" ? 1 : -1
      )
    );
  }
  return ~(b = j(t)) && (k = $[b] = q[b](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(_), d = N(), h = m("button"), h.textContent = "×", p = N(), g = m("div"), k && k.c(), u(a, "class", "svelte-sjkial"), u(h, "class", "close svelte-sjkial"), u(i, "class", "svelte-sjkial"), u(g, "class", "time-machine-body svelte-sjkial"), u(l, "class", "time-machine-modal svelte-sjkial"), u(e, "class", "time-machine-fade svelte-sjkial"), u(e, "tabindex", "-1");
    },
    m(I, A) {
      S(I, e, A), f(e, l), f(l, i), f(i, n), f(i, a), f(a, s), f(a, o), f(a, c), f(i, d), f(i, h), f(l, p), f(l, g), ~b && $[b].m(g, null), y = !0, v || (w = te(
        h,
        "click",
        /*click_handler*/
        t[5]
      ), v = !0);
    },
    p(I, [A]) {
      (!y || A & /*$timeMachineData*/
      16) && r !== (r = /*$timeMachineData*/
      I[4].parentKey + "") && U(s, r), (!y || A & /*$timeMachineData*/
      16) && _ !== (_ = /*$timeMachineData*/
      (I[4].title_key || /*$timeMachineData*/
      I[4].key) + "") && U(c, _);
      let M = b;
      b = j(I), b === M ? ~b && $[b].p(I, A) : (k && (be(), D($[M], 1, 1, () => {
        $[M] = null;
      }), ke()), ~b ? (k = $[b], k ? k.p(I, A) : (k = $[b] = q[b](I), k.c()), T(k, 1), k.m(g, null)) : k = null);
    },
    i(I) {
      y || (T(k), y = !0);
    },
    o(I) {
      D(k), y = !1;
    },
    d(I) {
      I && C(e), ~b && $[b].d(), v = !1, w();
    }
  };
}
function Y5(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(r, (d) => l(4, i = d)), r);
  t.$$.on_destroy.push(() => n());
  let { timeMachineData: r = Oe(), closeTimeMachine: s = () => {
  }, addToBasket: o, basket: _ } = e;
  a(), Tt(() => {
  });
  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, _ = d.basket);
  }, [
    r,
    s,
    o,
    _,
    i,
    c
  ];
}
class K5 extends Ve {
  constructor(e) {
    super(), Qe(this, e, Y5, G5, Fe, {
      timeMachineData: 0,
      closeTimeMachine: 1,
      addToBasket: 2,
      basket: 3
    });
  }
}
function U5(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y;
  return {
    c() {
      e = m("div"), l = m("h4"), l.textContent = "Configure output code", i = N(), n = m("div"), a = m("div"), r = m("label"), r.textContent = "Backend variable name", s = N(), o = m("input"), c = N(), d = m("div"), h = m("label"), h.textContent = "Output code as a function", p = N(), g = m("input"), u(l, "class", "svelte-nkjr63"), u(r, "for", "code_config-var_name"), u(r, "class", "svelte-nkjr63"), u(o, "type", "text"), u(o, "id", "code_config-var_name"), o.value = _ = /*$code_config*/
      t[1].backend_var_name, u(o, "class", "svelte-nkjr63"), u(a, "class", "input-wrap svelte-nkjr63"), u(h, "for", "code_config-as_function"), u(h, "class", "svelte-nkjr63"), u(g, "type", "checkbox"), u(g, "id", "code_config-as_function"), g.checked = b = /*$code_config*/
      t[1].as_function, u(d, "class", "input-wrap svelte-nkjr63"), u(n, "class", "input-row svelte-nkjr63"), u(e, "class", "code-config-wrap svelte-nkjr63");
    },
    m(v, w) {
      S(v, e, w), f(e, l), f(e, i), f(e, n), f(n, a), f(a, r), f(a, s), f(a, o), f(n, c), f(n, d), f(d, h), f(d, p), f(d, g), k || (y = [
        te(
          o,
          "change",
          /*change_handler*/
          t[2]
        ),
        te(
          g,
          "change",
          /*change_handler_1*/
          t[3]
        )
      ], k = !0);
    },
    p(v, [w]) {
      w & /*$code_config*/
      2 && _ !== (_ = /*$code_config*/
      v[1].backend_var_name) && o.value !== _ && (o.value = _), w & /*$code_config*/
      2 && b !== (b = /*$code_config*/
      v[1].as_function) && (g.checked = b);
    },
    i: ne,
    o: ne,
    d(v) {
      v && C(e), k = !1, wt(y);
    }
  };
}
function W5(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(r, (_) => l(1, i = _)), r);
  t.$$.on_destroy.push(() => n());
  let { code_config: r = Oe({}) } = e;
  a();
  const s = (_) => {
    r.update((c) => (c.backend_var_name = _.target.value, c));
  }, o = (_) => {
    r.update((c) => (c.as_function = _.target.checked, c));
  };
  return t.$$set = (_) => {
    "code_config" in _ && a(l(0, r = _.code_config));
  }, [r, i, s, o];
}
class J5 extends Ve {
  constructor(e) {
    super(), Qe(this, e, W5, U5, Fe, { code_config: 0 });
  }
}
function yh(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v;
  return e = new Sl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      section_meta: Cl[0],
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      )
    }
  }), i = new Sl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      section_meta: Cl[1],
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      )
    }
  }), a = new Sl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      ),
      section_meta: Cl[2],
      hide: !0
    }
  }), s = new Sl({
    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: Cl[3]
    }
  }), _ = new Sl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      ),
      section_meta: Cl[4],
      hide: !0
    }
  }), d = new Sl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      ),
      section_meta: Cl[5],
      hide: !0
    }
  }), p = new Sl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      ),
      section_meta: Cl[6],
      hide: !0
    }
  }), b = new Sl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      ),
      section_meta: Cl[7],
      hide: !0
    }
  }), y = new Sl({
    props: {
      data: (
        /*data*/
        t[3]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      ),
      openTimeMachine: (
        /*openTimeMachine*/
        t[10]
      ),
      section_meta: Cl[8]
    }
  }), {
    c() {
      pe(e.$$.fragment), l = N(), pe(i.$$.fragment), n = N(), pe(a.$$.fragment), r = N(), pe(s.$$.fragment), o = N(), pe(_.$$.fragment), c = N(), pe(d.$$.fragment), h = N(), pe(p.$$.fragment), g = N(), pe(b.$$.fragment), k = N(), pe(y.$$.fragment);
    },
    m(w, q) {
      de(e, w, q), S(w, l, q), de(i, w, q), S(w, n, q), de(a, w, q), S(w, r, q), de(s, w, q), S(w, o, q), de(_, w, q), S(w, c, q), de(d, w, q), S(w, h, q), de(p, w, q), S(w, g, q), de(b, w, q), S(w, k, q), de(y, w, q), v = !0;
    },
    p: ne,
    i(w) {
      v || (T(e.$$.fragment, w), T(i.$$.fragment, w), T(a.$$.fragment, w), T(s.$$.fragment, w), T(_.$$.fragment, w), T(d.$$.fragment, w), T(p.$$.fragment, w), T(b.$$.fragment, w), T(y.$$.fragment, w), v = !0);
    },
    o(w) {
      D(e.$$.fragment, w), D(i.$$.fragment, w), D(a.$$.fragment, w), D(s.$$.fragment, w), D(_.$$.fragment, w), D(d.$$.fragment, w), D(p.$$.fragment, w), D(b.$$.fragment, w), D(y.$$.fragment, w), v = !1;
    },
    d(w) {
      w && (C(l), C(n), C(r), C(o), C(c), C(h), C(g), C(k)), he(e, w), he(i, w), he(a, w), he(s, w), he(_, w), he(d, w), he(p, w), he(b, w), he(y, w);
    }
  };
}
function wh(t) {
  let e, l;
  return e = new K5({
    props: {
      timeMachineData: (
        /*timeMachineData*/
        t[9]
      ),
      closeTimeMachine: (
        /*closeTimeMachine*/
        t[11]
      ),
      addToBasket: (
        /*addToBasket*/
        t[8]
      ),
      basket: (
        /*basket*/
        t[4]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(e, i, n), l = !0;
    },
    p: ne,
    i(i) {
      l || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Z5(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h;
  r = new J5({
    props: { code_config: (
      /*code_config*/
      t[6]
    ) }
  });
  let p = (
    /*$data*/
    t[1] && yh(t)
  ), g = (
    /*showTimeMachine*/
    t[0] && wh(t)
  );
  return {
    c() {
      e = m("section"), l = m("h3"), i = E(`Machine information
    `), n = m("button"), n.textContent = "Copy reusable code", a = N(), pe(r.$$.fragment), s = N(), p && p.c(), o = N(), g && g.c(), _ = Ae(), u(n, "class", "svelte-1pb9xsa"), u(l, "class", "svelte-1pb9xsa"), u(e, "class", "wrap svelte-1pb9xsa"), u(e, "id", "machine-viewer-wrap");
    },
    m(b, k) {
      S(b, e, k), f(e, l), f(l, i), f(l, n), f(e, a), de(r, e, null), f(e, s), p && p.m(e, null), S(b, o, k), g && g.m(b, k), S(b, _, k), c = !0, d || (h = te(
        n,
        "click",
        /*click_handler*/
        t[15]
      ), d = !0);
    },
    p(b, [k]) {
      /*$data*/
      b[1] ? p ? (p.p(b, k), k & /*$data*/
      2 && T(p, 1)) : (p = yh(b), p.c(), T(p, 1), p.m(e, null)) : p && (be(), D(p, 1, 1, () => {
        p = null;
      }), ke()), /*showTimeMachine*/
      b[0] ? g ? (g.p(b, k), k & /*showTimeMachine*/
      1 && T(g, 1)) : (g = wh(b), g.c(), T(g, 1), g.m(_.parentNode, _)) : g && (be(), D(g, 1, 1, () => {
        g = null;
      }), ke());
    },
    i(b) {
      c || (T(r.$$.fragment, b), T(p), T(g), c = !0);
    },
    o(b) {
      D(r.$$.fragment, b), D(p), D(g), c = !1;
    },
    d(b) {
      b && (C(e), C(o), C(_)), he(r), p && p.d(), g && g.d(b), d = !1, h();
    }
  };
}
function x5(t, e, l) {
  let i, n, a, r, { model: s } = e, { data_key: o = "machine_data", output_key: _ = "code" } = e, c = s.get(o), d = JSON.parse(c), h = `change:${o}`, p = () => circ = s.get(o), g = Oe();
  at(t, g, (M) => l(1, i = M));
  let b = Oe([]);
  at(t, b, (M) => l(16, n = M));
  let k = Oe("");
  at(t, k, (M) => l(2, r = M));
  let y = Oe({
    backend_var_name: "backend",
    as_function: !0
  });
  at(t, y, (M) => l(17, a = M));
  let v = Oe("current");
  Tt(() => {
    g.set(d), s.on(h, p), b.subscribe((M) => {
      k.set(x_(M, a));
    }), y.subscribe((M) => {
      k.set(x_(n, M));
    }), k.subscribe((M) => {
      s.set(_, M), s.save_changes();
    }), console.log(i);
  }), ri(() => {
    s.off(h, p);
  });
  function w(M) {
    b.update((z) => (z.includes(M) ? z.splice(z.indexOf(M), 1) : z.push(M), z));
  }
  let q = !1, $ = Oe();
  function j(M) {
    let z = i.timed_properties, H = [];
    if (M.datatype === "nudv-map")
      for (const B of Object.keys(z)) {
        let R = { date: B };
        M.subtype === "qubit-property" ? R.data = z[B][M.parentKey][M.qubit_index][M.property] : R.data = z[B][M.parentKey][M.key], H.push(R);
      }
    else if (M.datatype === "gates")
      for (const B of Object.keys(z)) {
        let R = z[B][M.parentKey].filter((P) => P.gate === M.data.gate && P.qubits.join("-") === M.data.qubits.join("-"))[0];
        H.push({ date: B, data: R });
      }
    l(0, q = !0), $.set({
      datatype: M.datatype,
      key: M.key,
      title_key: M.title_key,
      parentKey: M.parentKey,
      topLevelKey: M.topLevelKey,
      code_header: M.code_header,
      code_footer: M.code_footer,
      code_key: M.code_key,
      curr_data: M.data,
      history_data: H
    });
  }
  function I() {
    l(0, q = !1);
  }
  const A = (M) => {
    ei(r);
  };
  return t.$$set = (M) => {
    "model" in M && l(12, s = M.model), "data_key" in M && l(13, o = M.data_key), "output_key" in M && l(14, _ = M.output_key);
  }, [
    q,
    i,
    r,
    g,
    b,
    k,
    y,
    v,
    w,
    $,
    j,
    I,
    s,
    o,
    _,
    A
  ];
}
class e$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, x5, Z5, Fe, { model: 12, data_key: 13, output_key: 14 });
  }
}
const t$ = 14, l$ = 10, i$ = 250, ka = 22, Kt = 10, n$ = 2, a$ = 2, r$ = "#FF5733", s$ = "#0b7ad6", o$ = "#000000", $h = 36, u$ = 5, f$ = {
  h: "H",
  v: "V",
  horizontal: "H",
  vertical: "V"
}, wl = "H", Al = "V";
function _$(t, e) {
  let l = {}, i = Object.keys(t.data), n = i.length, a = f$[e.direction];
  l.dir = a;
  let r = e.band_width || t$, s = e.band_gap || l$, o = e.x_axis_area_size || ka, _ = e.y_axis_area_size || (a === wl ? ka * 3 : ka * 2), c = e.padding || Kt, d = e.chart_height || i$, h = e.legend === void 0 || e.legend ? $h : 0, p = e.legend === void 0 || e.legend ? $h + Kt : 0, g = e.legend_rect_size || u$, b = e.dot_radius || n$, k = e.rule_width || a$, y = e.true_color || r$, v = e.hypo_color || s$, w = e.interval_color || o$;
  if (l.padding = c, a === Al) {
    let q = 0;
    if (i.some((j) => j.length > 5)) {
      q = -25;
      let j = Math.max(...i.map((I) => I.length));
      o = Math.ceil(o + ka * (j / 10));
    }
    let $ = (r + s * 2) * n;
    l.width = $ + _ + c * 2, l.height = d + o + c * 2 + p, l.y_axis = {
      width: _,
      height: d,
      x: Kt,
      y: Kt + p
    }, l.x_axis = {
      width: $,
      height: o,
      x: Kt + _,
      y: Kt + d + p,
      rotate: q
    }, l.chart = {
      width: $,
      height: d,
      x: Kt + _,
      y: Kt + p,
      band_total_width: r + s * 2,
      band_width: r,
      band_gap: s,
      dot_radius: b,
      rule_width: k,
      true_color: y,
      hypo_color: v,
      interval_color: w
    };
  } else if (a === wl) {
    let q = (r + s * 2) * n;
    l.height = q + o + c * 2 + p, l.width = d + _ + c * 2, l.y_axis = {
      width: _,
      height: q,
      x: Kt,
      y: Kt + p
    }, l.x_axis = {
      width: d,
      height: o,
      x: Kt + _,
      y: Kt + q + p
    }, l.chart = {
      width: d,
      height: q,
      x: Kt + _,
      y: Kt + p,
      band_total_width: r + s * 2,
      band_width: r,
      band_gap: s,
      dot_radius: b,
      rule_width: k,
      true_color: y,
      hypo_color: v,
      interval_color: w
    };
  }
  return (e.legend === void 0 || e.legend) && (l.legend = {
    height: h,
    x: Kt,
    y: Kt,
    true_color: y,
    hypo_color: v,
    legend_rect_size: g
  }), l.viewBox = [0, 0, l.width, l.height], l;
}
function c$(t, e, l) {
  let i = {}, n = Object.keys(t.data);
  n = n.toSorted(li);
  let a = 0;
  if (t.metadata.bootstrap)
    a = 1;
  else
    for (let s of n) {
      let o = yr(t.counts[s]);
      o > a && (a = o);
    }
  let r = n.map((s, o) => l.chart.band_total_width * o);
  return l.dir === Al ? (i.y = El([0, a], [l.chart.height, 0]).nice(), i.x = Nr(n, r)) : l.dir === wl && (i.x = El([0, a], [0, l.chart.width]).nice(), i.y = Nr(n, r)), i;
}
function d$(t) {
  let e, l, i, n, a, r, s, o, _;
  return {
    c() {
      e = Ge("g"), l = Ge("rect"), u(
        l,
        "id",
        /*id*/
        t[0]
      ), u(
        l,
        "data-index",
        /*index*/
        t[1]
      ), u(
        l,
        "data-state",
        /*state*/
        t[2]
      ), u(l, "class", "mark dot"), u(
        l,
        "fill",
        /*fill*/
        t[5]
      ), u(l, "y", i = /*sizing*/
      t[6].chart.band_total_width / 2), u(l, "x", n = /*scaleX*/
      t[3](
        /*quant_value*/
        t[7]
      )), u(l, "height", a = /*sizing*/
      t[6].chart.band_width), u(l, "width", r = /*sizing*/
      t[6].chart.rule_width), u(l, "transform", s = `translate(-${/*sizing*/
      t[6].chart.rule_width / 2} -${/*sizing*/
      t[6].chart.band_width / 2})`), u(e, "class", "mark-wrap"), u(
        e,
        "data-index",
        /*index*/
        t[1]
      ), u(
        e,
        "data-state",
        /*state*/
        t[2]
      ), u(e, "transform", o = `translate(0 ${/*scaleY*/
      t[4](
        /*state*/
        t[2]
      )})`), u(e, "height", _ = /*sizing*/
      t[6].chart.band_total_width);
    },
    m(c, d) {
      S(c, e, d), f(e, l);
    },
    p(c, d) {
      d & /*id*/
      1 && u(
        l,
        "id",
        /*id*/
        c[0]
      ), d & /*index*/
      2 && u(
        l,
        "data-index",
        /*index*/
        c[1]
      ), d & /*state*/
      4 && u(
        l,
        "data-state",
        /*state*/
        c[2]
      ), d & /*fill*/
      32 && u(
        l,
        "fill",
        /*fill*/
        c[5]
      ), d & /*sizing*/
      64 && i !== (i = /*sizing*/
      c[6].chart.band_total_width / 2) && u(l, "y", i), d & /*scaleX, quant_value*/
      136 && n !== (n = /*scaleX*/
      c[3](
        /*quant_value*/
        c[7]
      )) && u(l, "x", n), d & /*sizing*/
      64 && a !== (a = /*sizing*/
      c[6].chart.band_width) && u(l, "height", a), d & /*sizing*/
      64 && r !== (r = /*sizing*/
      c[6].chart.rule_width) && u(l, "width", r), d & /*sizing*/
      64 && s !== (s = `translate(-${/*sizing*/
      c[6].chart.rule_width / 2} -${/*sizing*/
      c[6].chart.band_width / 2})`) && u(l, "transform", s), d & /*index*/
      2 && u(
        e,
        "data-index",
        /*index*/
        c[1]
      ), d & /*state*/
      4 && u(
        e,
        "data-state",
        /*state*/
        c[2]
      ), d & /*scaleY, state*/
      20 && o !== (o = `translate(0 ${/*scaleY*/
      c[4](
        /*state*/
        c[2]
      )})`) && u(e, "transform", o), d & /*sizing*/
      64 && _ !== (_ = /*sizing*/
      c[6].chart.band_total_width) && u(e, "height", _);
    },
    d(c) {
      c && C(e);
    }
  };
}
function h$(t) {
  let e, l, i, n, a, r, s, o, _;
  return {
    c() {
      e = Ge("g"), l = Ge("rect"), u(
        l,
        "id",
        /*id*/
        t[0]
      ), u(
        l,
        "data-index",
        /*index*/
        t[1]
      ), u(
        l,
        "data-state",
        /*state*/
        t[2]
      ), u(l, "class", "mark dot"), u(
        l,
        "fill",
        /*fill*/
        t[5]
      ), u(l, "x", i = /*sizing*/
      t[6].chart.band_total_width / 2), u(l, "y", n = /*scaleY*/
      t[4](
        /*quant_value*/
        t[7]
      )), u(l, "width", a = /*sizing*/
      t[6].chart.band_width), u(l, "height", r = /*sizing*/
      t[6].chart.rule_width), u(l, "transform", s = `translate(-${/*sizing*/
      t[6].chart.band_width / 2} -${/*sizing*/
      t[6].chart.rule_width / 2})`), u(e, "class", "mark-wrap"), u(
        e,
        "data-index",
        /*index*/
        t[1]
      ), u(
        e,
        "data-state",
        /*state*/
        t[2]
      ), u(e, "transform", o = `translate(${/*scaleX*/
      t[3](
        /*state*/
        t[2]
      )} 0)`), u(e, "width", _ = /*sizing*/
      t[6].chart.band_total_width);
    },
    m(c, d) {
      S(c, e, d), f(e, l);
    },
    p(c, d) {
      d & /*id*/
      1 && u(
        l,
        "id",
        /*id*/
        c[0]
      ), d & /*index*/
      2 && u(
        l,
        "data-index",
        /*index*/
        c[1]
      ), d & /*state*/
      4 && u(
        l,
        "data-state",
        /*state*/
        c[2]
      ), d & /*fill*/
      32 && u(
        l,
        "fill",
        /*fill*/
        c[5]
      ), d & /*sizing*/
      64 && i !== (i = /*sizing*/
      c[6].chart.band_total_width / 2) && u(l, "x", i), d & /*scaleY, quant_value*/
      144 && n !== (n = /*scaleY*/
      c[4](
        /*quant_value*/
        c[7]
      )) && u(l, "y", n), d & /*sizing*/
      64 && a !== (a = /*sizing*/
      c[6].chart.band_width) && u(l, "width", a), d & /*sizing*/
      64 && r !== (r = /*sizing*/
      c[6].chart.rule_width) && u(l, "height", r), d & /*sizing*/
      64 && s !== (s = `translate(-${/*sizing*/
      c[6].chart.band_width / 2} -${/*sizing*/
      c[6].chart.rule_width / 2})`) && u(l, "transform", s), d & /*index*/
      2 && u(
        e,
        "data-index",
        /*index*/
        c[1]
      ), d & /*state*/
      4 && u(
        e,
        "data-state",
        /*state*/
        c[2]
      ), d & /*scaleX, state*/
      12 && o !== (o = `translate(${/*scaleX*/
      c[3](
        /*state*/
        c[2]
      )} 0)`) && u(e, "transform", o), d & /*sizing*/
      64 && _ !== (_ = /*sizing*/
      c[6].chart.band_total_width) && u(e, "width", _);
    },
    d(c) {
      c && C(e);
    }
  };
}
function p$(t) {
  let e;
  function l(a, r) {
    if (
      /*sizing*/
      a[6].dir === Al
    )
      return h$;
    if (
      /*sizing*/
      a[6].dir === wl
    )
      return d$;
  }
  let i = l(t), n = i && i(t);
  return {
    c() {
      n && n.c(), e = Ae();
    },
    m(a, r) {
      n && n.m(a, r), S(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: ne,
    o: ne,
    d(a) {
      a && C(e), n && n.d(a);
    }
  };
}
function m$(t, e, l) {
  let { id: i = "", index: n, state: a = "", datum: r = {}, scaleX: s = () => {
  }, scaleY: o = () => {
  }, fill: _ = "#000000", sizing: c = {}, key: d = "", HOPS: h = !1, HOPS_speed: p = 500, count_data: g = [] } = e, b, k, y = 0;
  function v(w, q) {
    y = 0, w ? k = setInterval(
      () => {
        l(7, b = g[y]), y = (y + 1) % g.length;
      },
      q
    ) : l(7, b = r[d]);
  }
  return Tt(() => {
    v(h, p);
  }), ri(() => {
    clearInterval(k);
  }), 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, _ = 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, g = w.count_data);
  }, [
    i,
    n,
    a,
    s,
    o,
    _,
    c,
    b,
    r,
    d,
    h,
    p,
    g
  ];
}
class qh extends Ve {
  constructor(e) {
    super(), Qe(this, e, m$, p$, Fe, {
      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 g$(t) {
  let e, l, i, n, a, r, s, o;
  return {
    c() {
      e = Ge("g"), l = Ge("line"), u(
        l,
        "id",
        /*id*/
        t[0]
      ), u(
        l,
        "data-index",
        /*index*/
        t[1]
      ), u(
        l,
        "data-state",
        /*state*/
        t[2]
      ), u(l, "class", "mark interval"), u(
        l,
        "stroke",
        /*stroke*/
        t[7]
      ), u(l, "stroke-width", "1"), u(l, "y1", i = /*sizing*/
      t[8].chart.band_total_width / 2 - 0.5), u(l, "y2", n = /*sizing*/
      t[8].chart.band_total_width / 2 - 0.5), u(l, "x1", a = /*scaleX*/
      t[5](
        /*datum*/
        t[3][
          /*key*/
          t[4]
        ][0]
      )), u(l, "x2", r = /*scaleX*/
      t[5](
        /*datum*/
        t[3][
          /*key*/
          t[4]
        ][1]
      )), u(e, "class", "mark-wrap"), u(
        e,
        "data-index",
        /*index*/
        t[1]
      ), u(
        e,
        "data-state",
        /*state*/
        t[2]
      ), u(e, "transform", s = `translate(0 ${/*scaleY*/
      t[6](
        /*state*/
        t[2]
      )})`), u(e, "height", o = /*sizing*/
      t[8].chart.band_total_width);
    },
    m(_, c) {
      S(_, e, c), f(e, l);
    },
    p(_, c) {
      c & /*id*/
      1 && u(
        l,
        "id",
        /*id*/
        _[0]
      ), c & /*index*/
      2 && u(
        l,
        "data-index",
        /*index*/
        _[1]
      ), c & /*state*/
      4 && u(
        l,
        "data-state",
        /*state*/
        _[2]
      ), c & /*stroke*/
      128 && u(
        l,
        "stroke",
        /*stroke*/
        _[7]
      ), c & /*sizing*/
      256 && i !== (i = /*sizing*/
      _[8].chart.band_total_width / 2 - 0.5) && u(l, "y1", i), c & /*sizing*/
      256 && n !== (n = /*sizing*/
      _[8].chart.band_total_width / 2 - 0.5) && u(l, "y2", n), c & /*scaleX, datum, key*/
      56 && a !== (a = /*scaleX*/
      _[5](
        /*datum*/
        _[3][
          /*key*/
          _[4]
        ][0]
      )) && u(l, "x1", a), c & /*scaleX, datum, key*/
      56 && r !== (r = /*scaleX*/
      _[5](
        /*datum*/
        _[3][
          /*key*/
          _[4]
        ][1]
      )) && u(l, "x2", r), c & /*index*/
      2 && u(
        e,
        "data-index",
        /*index*/
        _[1]
      ), c & /*state*/
      4 && u(
        e,
        "data-state",
        /*state*/
        _[2]
      ), c & /*scaleY, state*/
      68 && s !== (s = `translate(0 ${/*scaleY*/
      _[6](
        /*state*/
        _[2]
      )})`) && u(e, "transform", s), c & /*sizing*/
      256 && o !== (o = /*sizing*/
      _[8].chart.band_total_width) && u(e, "height", o);
    },
    d(_) {
      _ && C(e);
    }
  };
}
function b$(t) {
  let e, l, i, n, a, r, s, o;
  return {
    c() {
      e = Ge("g"), l = Ge("line"), u(
        l,
        "id",
        /*id*/
        t[0]
      ), u(
        l,
        "data-index",
        /*index*/
        t[1]
      ), u(
        l,
        "data-state",
        /*state*/
        t[2]
      ), u(l, "class", "mark interval"), u(
        l,
        "stroke",
        /*stroke*/
        t[7]
      ), u(l, "stroke-width", "1"), u(l, "x1", i = /*sizing*/
      t[8].chart.band_total_width / 2 - 0.5), u(l, "x2", n = /*sizing*/
      t[8].chart.band_total_width / 2 - 0.5), u(l, "y1", a = /*scaleY*/
      t[6](
        /*datum*/
        t[3][
          /*key*/
          t[4]
        ][0]
      )), u(l, "y2", r = /*scaleY*/
      t[6](
        /*datum*/
        t[3][
          /*key*/
          t[4]
        ][1]
      )), u(e, "class", "interval-wrap"), u(
        e,
        "data-index",
        /*index*/
        t[1]
      ), u(
        e,
        "data-state",
        /*state*/
        t[2]
      ), u(e, "transform", s = `translate(${/*scaleX*/
      t[5](
        /*state*/
        t[2]
      )} 0)`), u(e, "width", o = /*sizing*/
      t[8].chart.band_total_width);
    },
    m(_, c) {
      S(_, e, c), f(e, l);
    },
    p(_, c) {
      c & /*id*/
      1 && u(
        l,
        "id",
        /*id*/
        _[0]
      ), c & /*index*/
      2 && u(
        l,
        "data-index",
        /*index*/
        _[1]
      ), c & /*state*/
      4 && u(
        l,
        "data-state",
        /*state*/
        _[2]
      ), c & /*stroke*/
      128 && u(
        l,
        "stroke",
        /*stroke*/
        _[7]
      ), c & /*sizing*/
      256 && i !== (i = /*sizing*/
      _[8].chart.band_total_width / 2 - 0.5) && u(l, "x1", i), c & /*sizing*/
      256 && n !== (n = /*sizing*/
      _[8].chart.band_total_width / 2 - 0.5) && u(l, "x2", n), c & /*scaleY, datum, key*/
      88 && a !== (a = /*scaleY*/
      _[6](
        /*datum*/
        _[3][
          /*key*/
          _[4]
        ][0]
      )) && u(l, "y1", a), c & /*scaleY, datum, key*/
      88 && r !== (r = /*scaleY*/
      _[6](
        /*datum*/
        _[3][
          /*key*/
          _[4]
        ][1]
      )) && u(l, "y2", r), c & /*index*/
      2 && u(
        e,
        "data-index",
        /*index*/
        _[1]
      ), c & /*state*/
      4 && u(
        e,
        "data-state",
        /*state*/
        _[2]
      ), c & /*scaleX, state*/
      36 && s !== (s = `translate(${/*scaleX*/
      _[5](
        /*state*/
        _[2]
      )} 0)`) && u(e, "transform", s), c & /*sizing*/
      256 && o !== (o = /*sizing*/
      _[8].chart.band_total_width) && u(e, "width", o);
    },
    d(_) {
      _ && C(e);
    }
  };
}
function k$(t) {
  let e;
  function l(a, r) {
    if (
      /*sizing*/
      a[8].dir === Al
    )
      return b$;
    if (
      /*sizing*/
      a[8].dir === wl
    )
      return g$;
  }
  let i = l(t), n = i && i(t);
  return {
    c() {
      n && n.c(), e = Ae();
    },
    m(a, r) {
      n && n.m(a, r), S(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: ne,
    o: ne,
    d(a) {
      a && C(e), n && n.d(a);
    }
  };
}
function v$(t, e, l) {
  let { id: i = "", index: n, state: a = "", datum: r = {}, key: s = "", scaleX: o = () => {
  }, scaleY: _ = () => {
  }, 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, _ = h.scaleY), "stroke" in h && l(7, c = h.stroke), "sizing" in h && l(8, d = h.sizing);
  }, [i, n, a, r, s, o, _, c, d];
}
class y$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, v$, k$, Fe, {
      id: 0,
      index: 1,
      state: 2,
      datum: 3,
      key: 4,
      scaleX: 5,
      scaleY: 6,
      stroke: 7,
      sizing: 8
    });
  }
}
function w$(t) {
  let e, l, i, n, a, r, s, o, _;
  return {
    c() {
      e = Ge("g"), a = N(), r = Ge("g"), u(e, "id", l = /*id*/
      t[0] + "-group"), u(e, "class", i = "axis " + /*role*/
      t[1] + " quantitative"), u(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})`), u(r, "id", s = /*id*/
      t[0] + "-group-grid"), u(r, "class", o = "grid " + /*role*/
      t[1] + " quantitative"), u(r, "transform", _ = `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) {
      S(c, e, d), S(c, a, d), S(c, r, d);
    },
    p(c, d) {
      d & /*id*/
      1 && l !== (l = /*id*/
      c[0] + "-group") && u(e, "id", l), d & /*role*/
      2 && i !== (i = "axis " + /*role*/
      c[1] + " quantitative") && u(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})`) && u(e, "transform", n), d & /*id*/
      1 && s !== (s = /*id*/
      c[0] + "-group-grid") && u(r, "id", s), d & /*role*/
      2 && o !== (o = "grid " + /*role*/
      c[1] + " quantitative") && u(r, "class", o), d & /*sizing, role*/
      10 && _ !== (_ = `translate(${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].x + /*sizing*/
      c[3][
        /*role*/
        c[1]
      ].width} ${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].y})`) && u(r, "transform", _);
    },
    d(c) {
      c && (C(e), C(a), C(r));
    }
  };
}
function $$(t) {
  let e, l, i, n;
  return {
    c() {
      e = Ge("g"), u(e, "id", l = /*id*/
      t[0] + "-group"), u(e, "class", i = "axis " + /*role*/
      t[1] + " nominal"), u(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) {
      S(a, e, r);
    },
    p(a, r) {
      r & /*id*/
      1 && l !== (l = /*id*/
      a[0] + "-group") && u(e, "id", l), r & /*role*/
      2 && i !== (i = "axis " + /*role*/
      a[1] + " nominal") && u(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})`) && u(e, "transform", n);
    },
    d(a) {
      a && C(e);
    }
  };
}
function q$(t) {
  let e, l, i, n;
  return {
    c() {
      e = Ge("g"), u(e, "id", l = /*id*/
      t[0] + "-group"), u(e, "class", i = "axis " + /*role*/
      t[1] + " nominal"), u(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) {
      S(a, e, r);
    },
    p(a, r) {
      r & /*id*/
      1 && l !== (l = /*id*/
      a[0] + "-group") && u(e, "id", l), r & /*role*/
      2 && i !== (i = "axis " + /*role*/
      a[1] + " nominal") && u(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]})`) && u(e, "transform", n);
    },
    d(a) {
      a && C(e);
    }
  };
}
function j$(t) {
  let e, l, i, n, a, r, s, o, _;
  return {
    c() {
      e = Ge("g"), a = N(), r = Ge("g"), u(e, "id", l = /*id*/
      t[0] + "-group"), u(e, "class", i = "axis " + /*role*/
      t[1] + " quantitative"), u(e, "transform", n = `translate(${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].x} ${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].y})`), u(r, "id", s = /*id*/
      t[0] + "-group-grid"), u(r, "class", o = "grid " + /*role*/
      t[1] + " quantitative"), u(r, "transform", _ = `translate(${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].x} ${/*sizing*/
      t[3][
        /*role*/
        t[1]
      ].y})`);
    },
    m(c, d) {
      S(c, e, d), S(c, a, d), S(c, r, d);
    },
    p(c, d) {
      d & /*id*/
      1 && l !== (l = /*id*/
      c[0] + "-group") && u(e, "id", l), d & /*role*/
      2 && i !== (i = "axis " + /*role*/
      c[1] + " quantitative") && u(e, "class", i), d & /*sizing, role*/
      10 && n !== (n = `translate(${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].x} ${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].y})`) && u(e, "transform", n), d & /*id*/
      1 && s !== (s = /*id*/
      c[0] + "-group-grid") && u(r, "id", s), d & /*role*/
      2 && o !== (o = "grid " + /*role*/
      c[1] + " quantitative") && u(r, "class", o), d & /*sizing, role*/
      10 && _ !== (_ = `translate(${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].x} ${/*sizing*/
      c[3][
        /*role*/
        c[1]
      ].y})`) && u(r, "transform", _);
    },
    d(c) {
      c && (C(e), C(a), C(r));
    }
  };
}
function jh(t) {
  let e;
  function l(a, r) {
    if (
      /*role*/
      a[1] === "x_axis" && /*sizing*/
      a[3].dir === wl
    )
      return j$;
    if (
      /*role*/
      a[1] === "y_axis" && /*sizing*/
      a[3].dir === wl
    )
      return q$;
    if (
      /*role*/
      a[1] === "x_axis" && /*sizing*/
      a[3].dir === Al
    )
      return $$;
    if (
      /*role*/
      a[1] === "y_axis" && /*sizing*/
      a[3].dir === Al
    )
      return w$;
  }
  let i = l(t), n = i && i(t);
  return {
    c() {
      n && n.c(), e = Ae();
    },
    m(a, r) {
      n && n.m(a, r), S(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 && C(e), n && n.d(a);
    }
  };
}
function T$(t) {
  let e = (
    /*scales*/
    t[2]
  ), l, i = jh(t);
  return {
    c() {
      i.c(), l = Ae();
    },
    m(n, a) {
      i.m(n, a), S(n, l, a);
    },
    p(n, [a]) {
      a & /*scales*/
      4 && Fe(e, e = /*scales*/
      n[2]) ? (i.d(1), i = jh(n), i.c(), i.m(l.parentNode, l)) : i.p(n, a);
    },
    i: ne,
    o: ne,
    d(n) {
      n && C(l), i.d(n);
    }
  };
}
function C$(t, e, l) {
  let { id: i, role: n, scales: a = Oe({}), sizing: r, bootstrap: s = !1 } = e, o, _, c, d, h = 0, p = 0;
  function g(b) {
    o = void 0, _ = void 0, c = void 0, d = void 0, l(4, h = 0), p = 0, _ = tu("#" + i + "-group"), n === "x_axis" ? (o = Mb().scale(b), r.dir === wl ? (o.tickFormat(Jt(s ? ".3" : ",.0f")), c = Cb().scale(b), c.tickFormat((k) => null).tickSize(r.chart.height)) : r.dir === Al && (p = r.x_axis.rotate)) : n === "y_axis" && (o = zb().scale(b), r.dir === wl || r.dir === Al && (o.tickFormat(Jt(s ? ".3" : ",.0f")), c = Sb().scale(b), c.tickFormat((k) => null).tickSize(r.chart.width))), l(4, h = r.chart.band_total_width / 2), _.call(o), p && _.selectAll("text").style("text-anchor", "end").attr("dx", "-.5em").attr("dy", ".10em").attr("transform", `rotate(${p})`), c && (d = tu("#" + i + "-group-grid"), d.call(c));
  }
  return Tt(() => {
    a.subscribe((b) => {
      b && g(n === "y_axis" ? b == null ? void 0 : b.y : b == null ? void 0 : b.x);
    });
  }), t.$$set = (b) => {
    "id" in b && l(0, i = b.id), "role" in b && l(1, n = b.role), "scales" in b && l(2, a = b.scales), "sizing" in b && l(3, r = b.sizing), "bootstrap" in b && l(5, s = b.bootstrap);
  }, [i, n, a, r, h, s];
}
class Th extends Ve {
  constructor(e) {
    super(), Qe(this, e, C$, T$, Fe, {
      id: 0,
      role: 1,
      scales: 2,
      sizing: 3,
      bootstrap: 5
    });
  }
}
function S$(t) {
  let e, l, i, n, a, r, s, o;
  return {
    c() {
      e = Ge("g"), l = Ge("rect"), u(
        l,
        "id",
        /*id*/
        t[0]
      ), u(
        l,
        "data-index",
        /*index*/
        t[1]
      ), u(
        l,
        "data-state",
        /*state*/
        t[2]
      ), u(l, "class", "click-wrap"), u(l, "fill", "transparent"), u(l, "x", 0), u(l, "y", 0), u(l, "height", i = /*sizing*/
      t[6].chart.band_total_width), u(l, "width", n = /*sizing*/
      t[6].chart.width), u(e, "class", "mark-wrap"), u(
        e,
        "data-index",
        /*index*/
        t[1]
      ), u(
        e,
        "data-state",
        /*state*/
        t[2]
      ), u(e, "transform", a = `translate(0 ${/*scaleY*/
      t[5](
        /*state*/
        t[2]
      )})`), u(e, "height", r = /*sizing*/
      t[6].chart.band_total_width);
    },
    m(_, c) {
      S(_, e, c), f(e, l), s || (o = te(
        l,
        "click",
        /*click_handler_1*/
        t[9]
      ), s = !0);
    },
    p(_, c) {
      c & /*id*/
      1 && u(
        l,
        "id",
        /*id*/
        _[0]
      ), c & /*index*/
      2 && u(
        l,
        "data-index",
        /*index*/
        _[1]
      ), c & /*state*/
      4 && u(
        l,
        "data-state",
        /*state*/
        _[2]
      ), c & /*sizing*/
      64 && i !== (i = /*sizing*/
      _[6].chart.band_total_width) && u(l, "height", i), c & /*sizing*/
      64 && n !== (n = /*sizing*/
      _[6].chart.width) && u(l, "width", n), c & /*index*/
      2 && u(
        e,
        "data-index",
        /*index*/
        _[1]
      ), c & /*state*/
      4 && u(
        e,
        "data-state",
        /*state*/
        _[2]
      ), c & /*scaleY, state*/
      36 && a !== (a = `translate(0 ${/*scaleY*/
      _[5](
        /*state*/
        _[2]
      )})`) && u(e, "transform", a), c & /*sizing*/
      64 && r !== (r = /*sizing*/
      _[6].chart.band_total_width) && u(e, "height", r);
    },
    d(_) {
      _ && C(e), s = !1, o();
    }
  };
}
function M$(t) {
  let e, l, i, n, a, r, s, o;
  return {
    c() {
      e = Ge("g"), l = Ge("rect"), u(
        l,
        "id",
        /*id*/
        t[0]
      ), u(
        l,
        "data-index",
        /*index*/
        t[1]
      ), u(
        l,
        "data-state",
        /*state*/
        t[2]
      ), u(l, "class", "click-wrap"), u(l, "fill", "transparent"), u(l, "x", 0), u(l, "y", 0), u(l, "width", i = /*sizing*/
      t[6].chart.band_total_width), u(l, "height", n = /*sizing*/
      t[6].chart.height), u(e, "class", "click-wrap"), u(
        e,
        "data-index",
        /*index*/
        t[1]
      ), u(
        e,
        "data-state",
        /*state*/
        t[2]
      ), u(e, "transform", a = `translate(${/*scaleX*/
      t[4](
        /*state*/
        t[2]
      )} 0)`), u(e, "width", r = /*sizing*/
      t[6].chart.band_total_width);
    },
    m(_, c) {
      S(_, e, c), f(e, l), s || (o = te(
        l,
        "click",
        /*click_handler*/
        t[8]
      ), s = !0);
    },
    p(_, c) {
      c & /*id*/
      1 && u(
        l,
        "id",
        /*id*/
        _[0]
      ), c & /*index*/
      2 && u(
        l,
        "data-index",
        /*index*/
        _[1]
      ), c & /*state*/
      4 && u(
        l,
        "data-state",
        /*state*/
        _[2]
      ), c & /*sizing*/
      64 && i !== (i = /*sizing*/
      _[6].chart.band_total_width) && u(l, "width", i), c & /*sizing*/
      64 && n !== (n = /*sizing*/
      _[6].chart.height) && u(l, "height", n), c & /*index*/
      2 && u(
        e,
        "data-index",
        /*index*/
        _[1]
      ), c & /*state*/
      4 && u(
        e,
        "data-state",
        /*state*/
        _[2]
      ), c & /*scaleX, state*/
      20 && a !== (a = `translate(${/*scaleX*/
      _[4](
        /*state*/
        _[2]
      )} 0)`) && u(e, "transform", a), c & /*sizing*/
      64 && r !== (r = /*sizing*/
      _[6].chart.band_total_width) && u(e, "width", r);
    },
    d(_) {
      _ && C(e), s = !1, o();
    }
  };
}
function z$(t) {
  let e;
  function l(a, r) {
    if (
      /*sizing*/
      a[6].dir === Al
    )
      return M$;
    if (
      /*sizing*/
      a[6].dir === wl
    )
      return S$;
  }
  let i = l(t), n = i && i(t);
  return {
    c() {
      n && n.c(), e = Ae();
    },
    m(a, r) {
      n && n.m(a, r), S(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: ne,
    o: ne,
    d(a) {
      a && C(e), n && n.d(a);
    }
  };
}
function N$(t, e, l) {
  let { id: i = "", index: n, state: a = "", datum: r = {}, scaleX: s = () => {
  }, scaleY: o = () => {
  }, sizing: _ = {}, 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, _ = p.sizing), "show_info" in p && l(7, c = p.show_info);
  }, [
    i,
    n,
    a,
    r,
    s,
    o,
    _,
    c,
    d,
    h
  ];
}
class A$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, N$, z$, Fe, {
      id: 0,
      index: 1,
      state: 2,
      datum: 3,
      scaleX: 4,
      scaleY: 5,
      sizing: 6,
      show_info: 7
    });
  }
}
function Ch(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q;
  return {
    c() {
      e = Ge("g"), l = Ge("rect"), o = Ge("text"), _ = E(`Measure counts
    `), d = Ge("rect"), y = Ge("text"), v = E("Error-adjusted counts"), u(l, "id", i = /*id*/
      t[0] + "-true"), u(l, "fill", n = /*sizing*/
      t[1].legend.true_color), u(l, "x", "0"), u(l, "y", a = (14 - /*sizing*/
      t[1].legend.legend_rect_size) / 2 - 1), u(l, "width", r = /*sizing*/
      t[1].legend.legend_rect_size), u(l, "height", s = /*sizing*/
      t[1].legend.legend_rect_size), u(o, "x", c = /*sizing*/
      t[1].legend.legend_rect_size + /*sizing*/
      t[1].padding), u(o, "y", 14 / 2), u(o, "alignment-baseline", "middle"), u(d, "id", h = /*id*/
      t[0] + "-true"), u(d, "fill", p = /*sizing*/
      t[1].legend.hypo_color), u(d, "x", "0"), u(d, "y", g = (14 - /*sizing*/
      t[1].legend.legend_rect_size) / 2 + 14 - 1), u(d, "width", b = /*sizing*/
      t[1].legend.legend_rect_size), u(d, "height", k = /*sizing*/
      t[1].legend.legend_rect_size), u(y, "x", w = /*sizing*/
      t[1].legend.legend_rect_size + /*sizing*/
      t[1].padding), u(y, "y", 14 / 2 + 14), u(y, "alignment-baseline", "middle"), u(e, "class", "legend"), u(e, "role", "legend-group"), u(
        e,
        "id",
        /*id*/
        t[0]
      ), u(e, "transform", q = `translate(${/*sizing*/
      t[1].legend.x} ${/*sizing*/
      t[1].legend.y})`);
    },
    m($, j) {
      S($, e, j), f(e, l), f(e, o), f(o, _), f(e, d), f(e, y), f(y, v);
    },
    p($, j) {
      j & /*id*/
      1 && i !== (i = /*id*/
      $[0] + "-true") && u(l, "id", i), j & /*sizing*/
      2 && n !== (n = /*sizing*/
      $[1].legend.true_color) && u(l, "fill", n), j & /*sizing*/
      2 && a !== (a = (14 - /*sizing*/
      $[1].legend.legend_rect_size) / 2 - 1) && u(l, "y", a), j & /*sizing*/
      2 && r !== (r = /*sizing*/
      $[1].legend.legend_rect_size) && u(l, "width", r), j & /*sizing*/
      2 && s !== (s = /*sizing*/
      $[1].legend.legend_rect_size) && u(l, "height", s), j & /*sizing*/
      2 && c !== (c = /*sizing*/
      $[1].legend.legend_rect_size + /*sizing*/
      $[1].padding) && u(o, "x", c), j & /*id*/
      1 && h !== (h = /*id*/
      $[0] + "-true") && u(d, "id", h), j & /*sizing*/
      2 && p !== (p = /*sizing*/
      $[1].legend.hypo_color) && u(d, "fill", p), j & /*sizing*/
      2 && g !== (g = (14 - /*sizing*/
      $[1].legend.legend_rect_size) / 2 + 14 - 1) && u(d, "y", g), j & /*sizing*/
      2 && b !== (b = /*sizing*/
      $[1].legend.legend_rect_size) && u(d, "width", b), j & /*sizing*/
      2 && k !== (k = /*sizing*/
      $[1].legend.legend_rect_size) && u(d, "height", k), j & /*sizing*/
      2 && w !== (w = /*sizing*/
      $[1].legend.legend_rect_size + /*sizing*/
      $[1].padding) && u(y, "x", w), j & /*id*/
      1 && u(
        e,
        "id",
        /*id*/
        $[0]
      ), j & /*sizing*/
      2 && q !== (q = `translate(${/*sizing*/
      $[1].legend.x} ${/*sizing*/
      $[1].legend.y})`) && u(e, "transform", q);
    },
    d($) {
      $ && C(e);
    }
  };
}
function B$(t) {
  let e, l = (
    /*sizing*/
    t[1] && Ch(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*sizing*/
      i[1] ? l ? l.p(i, n) : (l = Ch(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function P$(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 O$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, P$, B$, Fe, { id: 0, sizing: 1 });
  }
}
function Sh(t, e, l) {
  const i = t.slice();
  return i[15] = e[l], i[17] = l, i;
}
function Mh(t) {
  let e, l, i = (
    /*$sizing*/
    t[8] && /*$data*/
    t[7] && /*$design*/
    t[6] && /*$scales*/
    t[9] && zh(t)
  );
  return {
    c() {
      e = m("div"), i && i.c(), u(e, "class", "vis-wrap svelte-1ryqbkw");
    },
    m(n, a) {
      S(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 && T(i, 1)) : (i = zh(n), i.c(), T(i, 1), i.m(e, null)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d();
    }
  };
}
function zh(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k = (
    /*$sizing*/
    t[8].legend && Nh(t)
  );
  a = new Th({
    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 Th({
    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 = $e(Object.keys(
    /*$data*/
    t[7].data
  )), v = [];
  for (let q = 0; q < y.length; q += 1)
    v[q] = Bh(Sh(t, y, q));
  const w = (q) => D(v[q], 1, 1, () => {
    v[q] = null;
  });
  return {
    c() {
      e = Ge("svg"), l = Ge("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;
            }
          `), k && k.c(), n = Ae(), pe(a.$$.fragment), pe(r.$$.fragment), s = Ge("g");
      for (let q = 0; q < v.length; q += 1)
        v[q].c();
      u(l, "class", "svelte-1ryqbkw"), u(s, "id", o = /*id*/
      t[2] + "-chart"), u(s, "width", _ = /*$sizing*/
      t[8].chart.width), u(s, "height", c = /*$sizing*/
      t[8].chart.height), u(s, "transform", d = `translate(${/*$sizing*/
      t[8].chart.x} ${/*$sizing*/
      t[8].chart.y})`), u(s, "class", "svelte-1ryqbkw"), u(
        e,
        "id",
        /*id*/
        t[2]
      ), u(e, "width", h = /*$sizing*/
      t[8].width), u(e, "height", p = /*$sizing*/
      t[8].height), u(e, "viewBox", g = /*$sizing*/
      t[8].viewBox.join(" ")), u(e, "class", "svelte-1ryqbkw");
    },
    m(q, $) {
      S(q, e, $), f(e, l), f(l, i), k && k.m(e, null), f(e, n), de(a, e, null), de(r, e, null), f(e, s);
      for (let j = 0; j < v.length; j += 1)
        v[j] && v[j].m(s, null);
      b = !0;
    },
    p(q, $) {
      /*$sizing*/
      q[8].legend ? k ? (k.p(q, $), $ & /*$sizing*/
      256 && T(k, 1)) : (k = Nh(q), k.c(), T(k, 1), k.m(e, n)) : k && (be(), D(k, 1, 1, () => {
        k = null;
      }), ke());
      const j = {};
      $ & /*id*/
      4 && (j.id = /*id*/
      q[2] + "-axis-x"), $ & /*$sizing*/
      256 && (j.sizing = /*$sizing*/
      q[8]), $ & /*$data*/
      128 && (j.bootstrap = /*$data*/
      q[7].metadata.bootstrap), a.$set(j);
      const I = {};
      if ($ & /*id*/
      4 && (I.id = /*id*/
      q[2] + "-axis-y"), $ & /*$sizing*/
      256 && (I.sizing = /*$sizing*/
      q[8]), $ & /*$data*/
      128 && (I.bootstrap = /*$data*/
      q[7].metadata.bootstrap), r.$set(I), $ & /*id, Object, $data, $scales, $sizing, show_info, $design*/
      9156) {
        y = $e(Object.keys(
          /*$data*/
          q[7].data
        ));
        let A;
        for (A = 0; A < y.length; A += 1) {
          const M = Sh(q, y, A);
          v[A] ? (v[A].p(M, $), T(v[A], 1)) : (v[A] = Bh(M), v[A].c(), T(v[A], 1), v[A].m(s, null));
        }
        for (be(), A = y.length; A < v.length; A += 1)
          w(A);
        ke();
      }
      (!b || $ & /*id*/
      4 && o !== (o = /*id*/
      q[2] + "-chart")) && u(s, "id", o), (!b || $ & /*$sizing*/
      256 && _ !== (_ = /*$sizing*/
      q[8].chart.width)) && u(s, "width", _), (!b || $ & /*$sizing*/
      256 && c !== (c = /*$sizing*/
      q[8].chart.height)) && u(s, "height", c), (!b || $ & /*$sizing*/
      256 && d !== (d = `translate(${/*$sizing*/
      q[8].chart.x} ${/*$sizing*/
      q[8].chart.y})`)) && u(s, "transform", d), (!b || $ & /*id*/
      4) && u(
        e,
        "id",
        /*id*/
        q[2]
      ), (!b || $ & /*$sizing*/
      256 && h !== (h = /*$sizing*/
      q[8].width)) && u(e, "width", h), (!b || $ & /*$sizing*/
      256 && p !== (p = /*$sizing*/
      q[8].height)) && u(e, "height", p), (!b || $ & /*$sizing*/
      256 && g !== (g = /*$sizing*/
      q[8].viewBox.join(" "))) && u(e, "viewBox", g);
    },
    i(q) {
      if (!b) {
        T(k), T(a.$$.fragment, q), T(r.$$.fragment, q);
        for (let $ = 0; $ < y.length; $ += 1)
          T(v[$]);
        b = !0;
      }
    },
    o(q) {
      D(k), D(a.$$.fragment, q), D(r.$$.fragment, q), v = v.filter(Boolean);
      for (let $ = 0; $ < v.length; $ += 1)
        D(v[$]);
      b = !1;
    },
    d(q) {
      q && C(e), k && k.d(), he(a), he(r), Ye(v, q);
    }
  };
}
function Nh(t) {
  let e, l;
  return e = new O$({
    props: { id: "legend", sizing: (
      /*$sizing*/
      t[8]
    ) }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n & /*$sizing*/
      256 && (a.sizing = /*$sizing*/
      i[8]), e.$set(a);
    },
    i(i) {
      l || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Ah(t) {
  let e, l;
  return e = new y$({
    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() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Bh(t) {
  let e, l, i, n, a;
  e = new qh({
    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 qh({
    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 && Ah(t);
  return n = new A$({
    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() {
      pe(e.$$.fragment), pe(l.$$.fragment), r && r.c(), i = Ae(), pe(n.$$.fragment);
    },
    m(s, o) {
      de(e, s, o), de(l, s, o), r && r.m(s, o), S(s, i, o), de(n, s, o), a = !0;
    },
    p(s, o) {
      const _ = {};
      o & /*id, $data*/
      132 && (_.id = /*id*/
      s[2] + "-mark-" + /*state*/
      s[15].replace(/s/gi, "_") + "-true"), o & /*$data*/
      128 && (_.state = /*state*/
      s[15]), o & /*$data*/
      128 && (_.datum = /*$data*/
      s[7].data[
        /*state*/
        s[15]
      ]), o & /*$data*/
      128 && (_.key = /*$data*/
      s[7].metadata.bootstrap ? "prob_measure" : "measure"), o & /*$scales*/
      512 && (_.scaleX = /*$scales*/
      s[9].x), o & /*$scales*/
      512 && (_.scaleY = /*$scales*/
      s[9].y), o & /*$sizing*/
      256 && (_.fill = /*$sizing*/
      s[8].chart.true_color), o & /*$sizing*/
      256 && (_.sizing = /*$sizing*/
      s[8]), e.$set(_);
      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 && (be(), D(r, 1, 1, () => {
        r = null;
      }), ke()) : r ? (r.p(s, o), o & /*$design*/
      64 && T(r, 1)) : (r = Ah(s), r.c(), T(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 || (T(e.$$.fragment, s), T(l.$$.fragment, s), T(r), T(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 && C(i), he(e, s), he(l, s), r && r.d(s), he(n, s);
    }
  };
}
function Ph(t) {
  let e, l, i, n, a, r, s, o = (
    /*info_point*/
    t[5].state + ""
  ), _, c, d, h, p, g, b = (
    /*info_point*/
    t[5].measure + ""
  ), k, y, v = (
    /*perc_format*/
    t[12](
      /*info_point*/
      t[5].prob_measure
    ) + ""
  ), w, q, $, j, I, A, M, z = (
    /*info_point*/
    t[5].mean + ""
  ), H, B, R = (
    /*perc_format*/
    t[12](
      /*info_point*/
      t[5].prob_mean
    ) + ""
  ), P, O, F, L, X, V, Q, Z, ae = (
    /*info_point*/
    t[5].interval.join(", ") + ""
  ), se, K, Y = (
    /*info_point*/
    t[5].prob_interval.map(
      /*perc_format*/
      t[12]
    ).join(", ") + ""
  ), W, J;
  return {
    c() {
      e = m("div"), l = m("div"), i = m("table"), n = m("tr"), a = m("th"), a.textContent = "State", r = N(), s = m("td"), _ = E(o), c = N(), d = m("tr"), h = m("th"), h.textContent = "Measured counts", p = N(), g = m("td"), k = E(b), y = E(" ("), w = E(v), q = E(")"), $ = N(), j = m("tr"), I = m("th"), I.textContent = "Error-adjusted count mean", A = N(), M = m("td"), H = E(z), B = E(" ("), P = E(R), O = E(")"), F = N(), L = m("tr"), X = m("th"), X.textContent = "Error-adjusted interval", V = N(), Q = m("td"), Z = E("["), se = E(ae), K = E("] (["), W = E(Y), J = E("])"), u(a, "class", "svelte-1ryqbkw"), u(s, "class", "svelte-1ryqbkw"), u(n, "class", "svelte-1ryqbkw"), u(h, "class", "svelte-1ryqbkw"), u(g, "class", "svelte-1ryqbkw"), u(d, "class", "svelte-1ryqbkw"), u(I, "class", "svelte-1ryqbkw"), u(M, "class", "svelte-1ryqbkw"), u(j, "class", "svelte-1ryqbkw"), u(X, "class", "svelte-1ryqbkw"), u(Q, "class", "svelte-1ryqbkw"), u(L, "class", "svelte-1ryqbkw"), u(i, "class", "svelte-1ryqbkw"), u(l, "class", "info-box svelte-1ryqbkw"), u(e, "class", "info-wrap svelte-1ryqbkw");
    },
    m(ee, we) {
      S(ee, e, we), f(e, l), f(l, i), f(i, n), f(n, a), f(n, r), f(n, s), f(s, _), f(i, c), f(i, d), f(d, h), f(d, p), f(d, g), f(g, k), f(g, y), f(g, w), f(g, q), f(i, $), f(i, j), f(j, I), f(j, A), f(j, M), f(M, H), f(M, B), f(M, P), f(M, O), f(i, F), f(i, L), f(L, X), f(L, V), f(L, Q), f(Q, Z), f(Q, se), f(Q, K), f(Q, W), f(Q, J);
    },
    p(ee, we) {
      we & /*info_point*/
      32 && o !== (o = /*info_point*/
      ee[5].state + "") && U(_, o), we & /*info_point*/
      32 && b !== (b = /*info_point*/
      ee[5].measure + "") && U(k, b), we & /*info_point*/
      32 && v !== (v = /*perc_format*/
      ee[12](
        /*info_point*/
        ee[5].prob_measure
      ) + "") && U(w, v), we & /*info_point*/
      32 && z !== (z = /*info_point*/
      ee[5].mean + "") && U(H, z), we & /*info_point*/
      32 && R !== (R = /*perc_format*/
      ee[12](
        /*info_point*/
        ee[5].prob_mean
      ) + "") && U(P, R), we & /*info_point*/
      32 && ae !== (ae = /*info_point*/
      ee[5].interval.join(", ") + "") && U(se, ae), we & /*info_point*/
      32 && Y !== (Y = /*info_point*/
      ee[5].prob_interval.map(
        /*perc_format*/
        ee[12]
      ).join(", ") + "") && U(W, Y);
    },
    d(ee) {
      ee && C(e);
    }
  };
}
function E$(t) {
  let e, l, i, n = !/*redrawing*/
  t[3] && Mh(t), a = (
    /*show_info_box*/
    t[4] && /*info_point*/
    t[5] && Ph(t)
  );
  return {
    c() {
      e = m("div"), n && n.c(), l = N(), a && a.c(), u(e, "class", "vis-flex-group svelte-1ryqbkw");
    },
    m(r, s) {
      S(r, e, s), n && n.m(e, null), f(e, l), a && a.m(e, null), i = !0;
    },
    p(r, [s]) {
      /*redrawing*/
      r[3] ? n && (be(), D(n, 1, 1, () => {
        n = null;
      }), ke()) : n ? (n.p(r, s), s & /*redrawing*/
      8 && T(n, 1)) : (n = Mh(r), n.c(), T(n, 1), n.m(e, l)), /*show_info_box*/
      r[4] && /*info_point*/
      r[5] ? a ? a.p(r, s) : (a = Ph(r), a.c(), a.m(e, null)) : a && (a.d(1), a = null);
    },
    i(r) {
      i || (T(n), i = !0);
    },
    o(r) {
      D(n), i = !1;
    },
    d(r) {
      r && C(e), n && n.d(), a && a.d();
    }
  };
}
function I$(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(h, (j) => l(6, i = j)), h), r, s = ne, o = () => (s(), s = st(d, (j) => l(7, r = j)), d), _, c;
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => s());
  let { data: d = Oe(), design: h = Oe(), id: p } = e;
  o(), a();
  let g = Oe(), b = Oe();
  at(t, g, (j) => l(8, _ = j)), at(t, b, (j) => l(9, c = j));
  let k = Jt(".2%");
  function y(j, I) {
    return I && (lu("svg .axis text").remove(), g.set(_$(j, I))), {};
  }
  let v = !1, w = !1, q;
  function $(j) {
    l(4, w = !0), l(5, q = j);
  }
  return Tt(() => {
    d.subscribe((j) => {
      l(3, v = !0), y(j, i), setTimeout(
        () => {
          l(3, v = !1);
        },
        100
      );
    }), h.subscribe((j) => {
      l(3, v = !0), y(r, j), setTimeout(
        () => {
          l(3, v = !1);
        },
        100
      );
    }), g.subscribe((j) => {
      l(3, v = !0), j && b.set(c$(r, i, j)), setTimeout(
        () => {
          l(3, v = !1);
        },
        100
      );
    });
  }), ri(() => {
    lu("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,
    v,
    w,
    q,
    i,
    r,
    _,
    c,
    g,
    b,
    k,
    $
  ];
}
class D$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, I$, E$, Fe, { data: 0, design: 1, id: 2 });
  }
}
function Oh(t) {
  let e, l, i, n, a, r, s, o = (
    /*$data*/
    t[1].metadata.sampling_counts + ""
  ), _, c, d, h, p, g = (
    /*$data*/
    t[1].metadata.sample_size + ""
  ), b, k, y, v, w, q = (
    /*$data*/
    t[1].metadata.ci_alpha + ""
  ), $, j, I, A, M, z = (
    /*$data*/
    t[1].metadata.bootstrap + ""
  ), H, B, R, P, O, F = (
    /*$data*/
    t[1].metadata.esp + ""
  ), L, X, V = (
    /*$data*/
    t[1].mean_sim_error && Eh(t)
  );
  return {
    c() {
      e = m("div"), l = m("h2"), l.textContent = "Meta information", i = N(), n = m("ul"), a = m("li"), r = m("strong"), r.textContent = "Sampling counts", s = E(": "), _ = E(o), c = N(), d = m("li"), h = m("strong"), h.textContent = "Sample size", p = E(": "), b = E(g), k = N(), y = m("li"), v = m("strong"), v.textContent = "CI %", w = E(": "), $ = E(q), j = N(), I = m("li"), A = m("strong"), A.textContent = "Bootstrap?", M = E(": "), H = E(z), B = N(), R = m("li"), P = m("strong"), P.textContent = "Estimated Success Probability (ESP)", O = E(": "), L = E(F), X = N(), V && V.c(), u(l, "class", "svelte-18xk1o2"), u(r, "class", "svelte-18xk1o2"), u(a, "class", "svelte-18xk1o2"), u(h, "class", "svelte-18xk1o2"), u(d, "class", "svelte-18xk1o2"), u(v, "class", "svelte-18xk1o2"), u(y, "class", "svelte-18xk1o2"), u(A, "class", "svelte-18xk1o2"), u(I, "class", "svelte-18xk1o2"), u(P, "class", "svelte-18xk1o2"), u(R, "class", "svelte-18xk1o2"), u(n, "class", "svelte-18xk1o2"), u(e, "class", "meta_info svelte-18xk1o2");
    },
    m(Q, Z) {
      S(Q, e, Z), f(e, l), f(e, i), f(e, n), f(n, a), f(a, r), f(a, s), f(a, _), f(n, c), f(n, d), f(d, h), f(d, p), f(d, b), f(n, k), f(n, y), f(y, v), f(y, w), f(y, $), f(n, j), f(n, I), f(I, A), f(I, M), f(I, H), f(n, B), f(n, R), f(R, P), f(R, O), f(R, L), f(n, X), V && V.m(n, null);
    },
    p(Q, Z) {
      Z & /*$data*/
      2 && o !== (o = /*$data*/
      Q[1].metadata.sampling_counts + "") && U(_, o), Z & /*$data*/
      2 && g !== (g = /*$data*/
      Q[1].metadata.sample_size + "") && U(b, g), Z & /*$data*/
      2 && q !== (q = /*$data*/
      Q[1].metadata.ci_alpha + "") && U($, q), Z & /*$data*/
      2 && z !== (z = /*$data*/
      Q[1].metadata.bootstrap + "") && U(H, z), Z & /*$data*/
      2 && F !== (F = /*$data*/
      Q[1].metadata.esp + "") && U(L, F), /*$data*/
      Q[1].mean_sim_error ? V ? V.p(Q, Z) : (V = Eh(Q), V.c(), V.m(n, null)) : V && (V.d(1), V = null);
    },
    d(Q) {
      Q && C(e), V && V.d();
    }
  };
}
function Eh(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), u(l, "class", "svelte-18xk1o2"), u(e, "class", "svelte-18xk1o2");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(e, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].mean_sim_error + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Ih(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R, P, O, F, L = (
    /*$design*/
    t[2].HOPS && Dh(t)
  );
  return {
    c() {
      e = m("div"), l = m("h2"), l.textContent = "Design controls", i = N(), n = m("div"), a = m("div"), r = m("input"), c = N(), d = m("label"), h = E("Use HOPS"), g = N(), L && L.c(), b = N(), k = m("div"), y = m("label"), v = E("Direction"), q = N(), $ = m("select"), j = m("option"), I = E("Horizontal"), M = m("option"), z = E("Vertical"), u(l, "class", "svelte-18xk1o2"), u(r, "type", "checkbox"), u(r, "id", s = /*id*/
      t[0] + "-design-hops"), u(r, "name", o = /*id*/
      t[0] + "-design-hops"), r.checked = _ = /*$design*/
      t[2].HOPS, u(r, "class", "svelte-18xk1o2"), u(d, "for", p = /*id*/
      t[0] + "-design-hops"), u(d, "class", "svelte-18xk1o2"), u(a, "class", "svelte-18xk1o2"), u(y, "for", w = /*id*/
      t[0] + "-design-dir"), u(y, "class", "svelte-18xk1o2"), j.__value = "horizontal", pt(j, j.__value), j.selected = A = /*$design*/
      t[2].direction == "horizontal", u(j, "class", "svelte-18xk1o2"), M.__value = "vertical", pt(M, M.__value), M.selected = H = /*$design*/
      t[2].direction == "vertical", u(M, "class", "svelte-18xk1o2"), u($, "type", "checkbox"), u($, "id", B = /*id*/
      t[0] + "-design-dir"), u($, "name", R = /*id*/
      t[0] + "-design-dir"), u($, "class", "svelte-18xk1o2"), u(k, "class", "svelte-18xk1o2"), u(n, "class", "control-box svelte-18xk1o2"), u(e, "class", "control svelte-18xk1o2");
    },
    m(X, V) {
      S(X, e, V), f(e, l), f(e, i), f(e, n), f(n, a), f(a, r), f(a, c), f(a, d), f(d, h), f(n, g), L && L.m(n, null), f(n, b), f(n, k), f(k, y), f(y, v), f(k, q), f(k, $), f($, j), f(j, I), f($, M), f(M, z), fl(
        $,
        /*$design*/
        t[2].direction
      ), O || (F = [
        te(
          r,
          "change",
          /*change_handler*/
          t[8]
        ),
        te(
          $,
          "change",
          /*change_handler_2*/
          t[10]
        )
      ], O = !0);
    },
    p(X, V) {
      V & /*id*/
      1 && s !== (s = /*id*/
      X[0] + "-design-hops") && u(r, "id", s), V & /*id*/
      1 && o !== (o = /*id*/
      X[0] + "-design-hops") && u(r, "name", o), V & /*$design*/
      4 && _ !== (_ = /*$design*/
      X[2].HOPS) && (r.checked = _), V & /*id*/
      1 && p !== (p = /*id*/
      X[0] + "-design-hops") && u(d, "for", p), /*$design*/
      X[2].HOPS ? L ? L.p(X, V) : (L = Dh(X), L.c(), L.m(n, b)) : L && (L.d(1), L = null), V & /*id*/
      1 && w !== (w = /*id*/
      X[0] + "-design-dir") && u(y, "for", w), V & /*$design*/
      4 && A !== (A = /*$design*/
      X[2].direction == "horizontal") && (j.selected = A), V & /*$design*/
      4 && H !== (H = /*$design*/
      X[2].direction == "vertical") && (M.selected = H), V & /*id*/
      1 && B !== (B = /*id*/
      X[0] + "-design-dir") && u($, "id", B), V & /*id*/
      1 && R !== (R = /*id*/
      X[0] + "-design-dir") && u($, "name", R), V & /*$design*/
      4 && P !== (P = /*$design*/
      X[2].direction) && fl(
        $,
        /*$design*/
        X[2].direction
      );
    },
    d(X) {
      X && C(e), L && L.d(), O = !1, wt(F);
    }
  };
}
function Dh(t) {
  let e, l, i, n, a, r, s, o, _, c, d;
  return {
    c() {
      e = m("div"), l = m("input"), r = N(), s = m("label"), o = E("HOPS animation speed"), u(l, "type", "number"), u(l, "id", i = /*id*/
      t[0] + "-design-hops-speed"), u(l, "name", n = /*id*/
      t[0] + "-design-hops-speed"), l.value = a = /*$design*/
      t[2].HOPS_speed, u(l, "by", "1"), u(l, "class", "svelte-18xk1o2"), u(s, "for", _ = /*id*/
      t[0] + "-design-hops-speed"), u(s, "class", "svelte-18xk1o2"), u(e, "class", "svelte-18xk1o2");
    },
    m(h, p) {
      S(h, e, p), f(e, l), f(e, r), f(e, s), f(s, o), c || (d = te(
        l,
        "change",
        /*change_handler_1*/
        t[9]
      ), c = !0);
    },
    p(h, p) {
      p & /*id*/
      1 && i !== (i = /*id*/
      h[0] + "-design-hops-speed") && u(l, "id", i), p & /*id*/
      1 && n !== (n = /*id*/
      h[0] + "-design-hops-speed") && u(l, "name", n), p & /*$design*/
      4 && a !== (a = /*$design*/
      h[2].HOPS_speed) && l.value !== a && (l.value = a), p & /*id*/
      1 && _ !== (_ = /*id*/
      h[0] + "-design-hops-speed") && u(s, "for", _);
    },
    d(h) {
      h && C(e), c = !1, d();
    }
  };
}
function R$(t) {
  let e, l, i, n, a, r, s, o, _, c = (
    /*$data*/
    t[1] && Oh(t)
  ), d = (
    /*$design*/
    t[2] && Ih(t)
  );
  return o = new D$({
    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 = N(), n = m("section"), c && c.c(), a = N(), d && d.c(), r = N(), s = m("section"), pe(o.$$.fragment), u(l, "class", "svelte-18xk1o2"), u(n, "class", "meta svelte-18xk1o2"), u(s, "class", "content svelte-18xk1o2"), u(e, "class", "wrap svelte-18xk1o2");
    },
    m(h, p) {
      S(h, e, p), f(e, l), f(e, i), f(e, n), c && c.m(n, null), f(n, a), d && d.m(n, null), f(e, r), f(e, s), de(o, s, null), _ = !0;
    },
    p(h, [p]) {
      /*$data*/
      h[1] ? c ? c.p(h, p) : (c = Oh(h), c.c(), c.m(n, a)) : c && (c.d(1), c = null), /*$design*/
      h[2] ? d ? d.p(h, p) : (d = Ih(h), d.c(), d.m(n, null)) : d && (d.d(1), d = null);
      const g = {};
      p & /*id*/
      1 && (g.id = /*id*/
      h[0]), o.$set(g);
    },
    i(h) {
      _ || (T(o.$$.fragment, h), _ = !0);
    },
    o(h) {
      D(o.$$.fragment, h), _ = !1;
    },
    d(h) {
      h && C(e), c && c.d(), d && d.d(), he(o);
    }
  };
}
function H$(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)), _ = JSON.parse(a.get(s)), c = `change:${r}`, d = () => circ = a.get(r), h = Oe();
  at(t, h, (q) => l(1, i = q));
  let p = Oe();
  at(t, p, (q) => l(2, n = q));
  let g = {};
  Oe().subscribe((q) => {
    q && (g[q.id] = q);
  });
  let k;
  Tt(() => {
    l(0, k = "uv-" + Number(/* @__PURE__ */ new Date())), h.set(o), p.set(_), a.on(c, d);
  }), ri(() => {
    a.off(c, d);
  });
  const y = (q) => {
    p.update(($) => ($.HOPS = q.target.checked, $));
  }, v = (q) => {
    p.update(($) => ($.HOPS_speed = parseInt(q.target.value), $));
  }, w = (q) => {
    p.update(($) => ($.direction = q.target.value, $));
  };
  return t.$$set = (q) => {
    "model" in q && l(5, a = q.model), "key_data" in q && l(6, r = q.key_data), "key_design" in q && l(7, s = q.key_design);
  }, [
    k,
    i,
    n,
    h,
    p,
    a,
    r,
    s,
    y,
    v,
    w
  ];
}
class L$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, H$, R$, Fe, { model: 5, key_data: 6, key_design: 7 });
  }
}
function Rh(t) {
  var Z, ae, se, K, Y, W;
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z = (
    /*$data*/
    t[1].job_id && Hh(t)
  ), H = (
    /*$data*/
    t[1].creation_date && Lh(t)
  ), B = (
    /*$data*/
    t[1].done !== void 0 && Fh(t)
  ), R = (
    /*$data*/
    t[1].program_id && Qh(t)
  ), P = (
    /*$data*/
    t[1].n_shots !== void 0 && Vh(t)
  ), O = (
    /*$data*/
    ((Z = t[1].metrics) == null ? void 0 : Z.circuit_depths) !== void 0 && Xh(t)
  ), F = (
    /*$data*/
    ((ae = t[1]) == null ? void 0 : ae.physical_qubits) && Gh(t)
  ), L = (
    /*$data*/
    t[1].est_start_time && Yh(t)
  ), X = (
    /*$data*/
    ((K = (se = t[1].metrics) == null ? void 0 : se.usage) == null ? void 0 : K.quantum_seconds) !== void 0 && /*$data*/
    ((W = (Y = t[1].metrics) == null ? void 0 : Y.usage) == null ? void 0 : W.seconds) !== void 0 && Kh(t)
  ), V = (
    /*$data*/
    t[1].init_qubits !== void 0 && Uh(t)
  ), Q = (
    /*$data*/
    t[1].backend_name && Wh(t)
  );
  return {
    c() {
      e = m("article"), l = m("h4"), l.textContent = "Job metadata", i = N(), n = m("div"), a = m("table"), z && z.c(), r = N(), H && H.c(), s = N(), B && B.c(), o = N(), R && R.c(), _ = N(), c = m("article"), d = m("h4"), d.textContent = "Usage size", h = N(), p = m("div"), g = m("table"), P && P.c(), b = N(), O && O.c(), k = N(), F && F.c(), y = N(), v = m("article"), w = m("h4"), w.textContent = "Usage information", q = N(), $ = m("div"), j = m("table"), L && L.c(), I = N(), X && X.c(), A = N(), V && V.c(), M = N(), Q && Q.c(), u(a, "class", "svelte-1hp7is1"), u(n, "class", "content-wrap"), u(e, "class", "panel svelte-1hp7is1"), u(g, "class", "svelte-1hp7is1"), u(p, "class", "content-wrap"), u(c, "class", "panel svelte-1hp7is1"), u(j, "class", "svelte-1hp7is1"), u($, "class", "content-wrap"), u(v, "class", "panel svelte-1hp7is1");
    },
    m(J, ee) {
      S(J, e, ee), f(e, l), f(e, i), f(e, n), f(n, a), z && z.m(a, null), f(a, r), H && H.m(a, null), f(a, s), B && B.m(a, null), f(a, o), R && R.m(a, null), S(J, _, ee), S(J, c, ee), f(c, d), f(c, h), f(c, p), f(p, g), P && P.m(g, null), f(g, b), O && O.m(g, null), f(g, k), F && F.m(g, null), S(J, y, ee), S(J, v, ee), f(v, w), f(v, q), f(v, $), f($, j), L && L.m(j, null), f(j, I), X && X.m(j, null), f(j, A), V && V.m(j, null), f(j, M), Q && Q.m(j, null);
    },
    p(J, ee) {
      var we, Re, ve, me, fe, G;
      /*$data*/
      J[1].job_id ? z ? z.p(J, ee) : (z = Hh(J), z.c(), z.m(a, r)) : z && (z.d(1), z = null), /*$data*/
      J[1].creation_date ? H ? H.p(J, ee) : (H = Lh(J), H.c(), H.m(a, s)) : H && (H.d(1), H = null), /*$data*/
      J[1].done !== void 0 ? B ? B.p(J, ee) : (B = Fh(J), B.c(), B.m(a, o)) : B && (B.d(1), B = null), /*$data*/
      J[1].program_id ? R ? R.p(J, ee) : (R = Qh(J), R.c(), R.m(a, null)) : R && (R.d(1), R = null), /*$data*/
      J[1].n_shots !== void 0 ? P ? P.p(J, ee) : (P = Vh(J), P.c(), P.m(g, b)) : P && (P.d(1), P = null), /*$data*/
      ((we = J[1].metrics) == null ? void 0 : we.circuit_depths) !== void 0 ? O ? O.p(J, ee) : (O = Xh(J), O.c(), O.m(g, k)) : O && (O.d(1), O = null), /*$data*/
      (Re = J[1]) != null && Re.physical_qubits ? F ? F.p(J, ee) : (F = Gh(J), F.c(), F.m(g, null)) : F && (F.d(1), F = null), /*$data*/
      J[1].est_start_time ? L ? L.p(J, ee) : (L = Yh(J), L.c(), L.m(j, I)) : L && (L.d(1), L = null), /*$data*/
      ((me = (ve = J[1].metrics) == null ? void 0 : ve.usage) == null ? void 0 : me.quantum_seconds) !== void 0 && /*$data*/
      ((G = (fe = J[1].metrics) == null ? void 0 : fe.usage) == null ? void 0 : G.seconds) !== void 0 ? X ? X.p(J, ee) : (X = Kh(J), X.c(), X.m(j, A)) : X && (X.d(1), X = null), /*$data*/
      J[1].init_qubits !== void 0 ? V ? V.p(J, ee) : (V = Uh(J), V.c(), V.m(j, M)) : V && (V.d(1), V = null), /*$data*/
      J[1].backend_name ? Q ? Q.p(J, ee) : (Q = Wh(J), Q.c(), Q.m(j, null)) : Q && (Q.d(1), Q = null);
    },
    d(J) {
      J && (C(e), C(_), C(c), C(y), C(v)), z && z.d(), H && H.d(), B && B.d(), R && R.d(), P && P.d(), O && O.d(), F && F.d(), L && L.d(), X && X.d(), V && V.d(), Q && Q.d();
    }
  };
}
function Hh(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), u(l, "class", "svelte-1hp7is1"), u(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].job_id + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Lh(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), u(l, "class", "svelte-1hp7is1"), u(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].creation_date + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Fh(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), u(l, "class", "svelte-1hp7is1"), u(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].done ? "Done" : "Running") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Qh(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), u(l, "class", "svelte-1hp7is1"), u(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].program_id + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Vh(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), u(l, "class", "svelte-1hp7is1"), u(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].n_shots + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Xh(t) {
  let e, l, i, n = Jt(",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), u(l, "class", "svelte-1hp7is1"), u(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = Jt(",d")(
        /*$data*/
        r[1].metrics.circuit_depths[0]
      ) + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Gh(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), u(l, "class", "svelte-1hp7is1"), u(i, "class", "svelte-1hp7is1");
    },
    m(s, o) {
      S(s, e, o), f(e, l), f(e, i), f(i, a);
    },
    p(s, o) {
      var _;
      o & /*$data*/
      2 && n !== (n = /*$data*/
      ((_ = s[1].physical_qubits) == null ? void 0 : _.length) + "") && U(a, n);
    },
    d(s) {
      s && C(e);
    }
  };
}
function Yh(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), u(l, "class", "svelte-1hp7is1"), u(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].est_start_time + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Kh(t) {
  let e, l, i, n = (
    /*$data*/
    t[1].metrics.usage.quantum_seconds + ""
  ), a, r, s = (
    /*$data*/
    t[1].metrics.usage.seconds + ""
  ), o, _;
  return {
    c() {
      e = m("tr"), l = m("th"), l.textContent = "Duration (sec.) ", i = m("td"), a = E(n), r = E(" (quantum) / "), o = E(s), _ = E(" (total)"), u(l, "class", "svelte-1hp7is1"), u(i, "class", "svelte-1hp7is1");
    },
    m(c, d) {
      S(c, e, d), f(e, l), f(e, i), f(i, a), f(i, r), f(i, o), f(i, _);
    },
    p(c, d) {
      d & /*$data*/
      2 && n !== (n = /*$data*/
      c[1].metrics.usage.quantum_seconds + "") && U(a, n), d & /*$data*/
      2 && s !== (s = /*$data*/
      c[1].metrics.usage.seconds + "") && U(o, s);
    },
    d(c) {
      c && C(e);
    }
  };
}
function Uh(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), u(l, "class", "svelte-1hp7is1"), u(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].init_qubits + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Wh(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), u(l, "class", "svelte-1hp7is1"), u(i, "class", "svelte-1hp7is1");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].backend_name + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function F$(t) {
  let e, l = (
    /*$data*/
    t[1] && Rh(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*$data*/
      i[1] ? l ? l.p(i, n) : (l = Rh(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function Q$(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(r, (s) => l(1, i = s)), r);
  t.$$.on_destroy.push(() => n());
  let { data: r = Oe() } = e;
  return a(), t.$$set = (s) => {
    "data" in s && a(l(0, r = s.data));
  }, [r, i];
}
class V$ extends Ve {
  constructor(e) {
    super(), Qe(this, e, Q$, F$, Fe, { data: 0 });
  }
}
const Zt = 50, Ft = 300, hr = 30, Vt = 20, Ml = 0.75, _l = 30;
function X$(t) {
  return t.split("").reverse().join("");
}
function G$(t, e) {
  let l = t.map((a) => e ? X$(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 pr(t, e, l = {}) {
  var M;
  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 ? (M = e.metadata) == null ? void 0 : M.bootstrap : !1, r = Jt(a ? ".6f" : ",d"), s = Jt(a ? ".10f" : ",d"), o = [], _ = Object.keys(t), { wrapped_state_bistrings: c, bitstring_arg_map: d } = G$(_, i);
  c = c.toSorted();
  for (let z = 0; z < (c == null ? void 0 : c.length); z++) {
    let H = c[z], B = _[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 + hr, g, b, k, y, v, w = (o == null ? void 0 : o.length) * Vt;
  h = w + Zt;
  let q;
  n && a ? q = Math.max(...o.map((z) => Math.max(...z.unceratinty_probs))) : n && !a ? q = Math.max(...o.map((z) => Math.max(...z.unceratinty_counts))) : q = Math.max(...o.map((z) => z.count));
  let $ = El().domain([0, q]).range([0, Ft]).nice(), j = $.invert(Ft), I = K$(j);
  b = {
    type: "g",
    id: "count-histogram-y-axis",
    role: "count-histogram-y-axis",
    width: Zt,
    height: Ft,
    x: De,
    y: De,
    elem: [{
      type: "rect",
      x: 0 - De,
      y: -5,
      width: Zt + De,
      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: Me,
      "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: Me,
      "text-anchor": "start",
      "alignment-baseline": "top",
      "font-style": "italic"
    }]
  }, k = {
    type: "g",
    id: "count-histogram-y-axis",
    role: "count-histogram-y-axis",
    width: w,
    height: Ft,
    x: De + Zt,
    y: De,
    elem: []
  }, h += Zt;
  for (let z = 0; z <= j; z += I) {
    let H = {
      type: "g",
      id: "count-histogram-y-axis-tick",
      width: Zt,
      x: 0,
      y: Ft - $(z),
      elem: []
    }, B = {
      type: "line",
      x1: Zt - 1,
      x2: Zt - 6,
      y1: -0.5,
      y2: -0.5,
      stroke: Me,
      "stroke-width": 1
    }, R = {
      type: "text",
      x: Zt - 10,
      y: 0,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: r(z),
      "font-size": 12
    };
    H.elem.push(B, R), b.elem.push(H), k.elem.push({
      type: "line",
      x1: 0,
      x2: w,
      y1: Ft - $(z) - 0.5,
      y2: Ft - $(z) - 0.5,
      stroke: "#dddddd",
      "stroke-width": 1
    });
  }
  g = {
    type: "g",
    id: "count-histogram-bar-group",
    role: "count-histogram-bar-group",
    width: w,
    height: Ft,
    x: De + Zt,
    y: De,
    elem: []
  }, y = {
    type: "g",
    id: "count-histogram-x-axis",
    role: "count-histogram-x-axis",
    width: w,
    height: hr,
    x: De + Zt,
    y: De + Ft,
    elem: [{
      type: "line",
      id: "count-histogram-y-axis-domain",
      x1: 0,
      x2: w,
      y1: -0.5,
      y2: -0.5,
      stroke: Me,
      "stroke-width": 1
    }]
  };
  let A = 0;
  for (let z of o) {
    let H = Vt * A, B = a ? z.unceratinty.prob_measure : z.count, R = $(B), P = {
      type: "g",
      id: "count-histogram-bar-item-" + A,
      role: "count-histogram-bar--group",
      width: Vt,
      height: Ft,
      x: H,
      y: 0,
      elem: [{
        type: "rect",
        id: "count-histogram-bar-" + A,
        width: Vt * Ml,
        x: Vt * (1 - Ml) / 2,
        height: 4,
        y: Ft - R - 2,
        fill: Wt[1],
        "stroke-width": 0
      }],
      data: {
        tooltip_content: {
          State: z.state,
          Count: z.count,
          Probability: n ? s(z.unceratinty.prob_measure) : void 0,
          "HEA-prob. mean": n ? s(z.unceratinty.prob_mean) : void 0,
          "HEA-prob. interval": n ? "[" + z.unceratinty.prob_interval.map(s).join(", ") + "]" : void 0,
          "HEA-count mean": n ? s(z.unceratinty.mean) : void 0,
          "HEA-count interval": n ? "[" + z.unceratinty.interval.map(s).join(", ") + "]" : void 0
        }
      }
    };
    if (n) {
      let F = a ? z.unceratinty.prob_mean : z.unceratinty.mean, L = $(F), X = (a ? z.unceratinty.prob_interval : z.unceratinty.interval).map($);
      P.elem.push({
        type: "rect",
        id: "count-histogram-hea-bar-" + A,
        width: Vt * Ml,
        x: Vt * (1 - Ml) / 2,
        height: 4,
        y: Ft - L - 2,
        fill: Wt[0],
        "fill-opacity": 0.7,
        "stroke-width": 0
      }, {
        type: "line",
        id: "count-histogram-hea-interval-" + A,
        width: Vt * Ml,
        x1: Vt / 2 - 0.5,
        x2: Vt / 2 - 0.5,
        y1: Ft - X[0],
        y2: Ft - X[1],
        stroke: Me,
        "stroke-width": 1
      });
    } else
      P.elem.push({
        type: "text",
        id: "count-histogram-bar-count-" + A,
        x: Vt / 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-" + A,
      role: "count-histogram-bar-click-wrap",
      width: Vt,
      x: 0,
      height: Ft,
      y: 0,
      data: {
        state: z.state,
        count: z.count,
        probability: n ? z.unceratinty.prob_measure : void 0,
        hea_probability_mean: n ? z.unceratinty.prob_mean : void 0,
        hea_probability_interval: n ? z.unceratinty.prob_interval : void 0,
        hea_count_mean: n ? z.unceratinty.mean : void 0,
        hea_count_interval: n ? z.unceratinty.interval : void 0
      }
    }), g.elem.push(P);
    let O = {
      type: "g",
      id: "count-histogram-x-axis-group-" + A,
      width: Vt,
      height: Ft,
      x: H,
      y: 0,
      elem: [{
        type: "line",
        id: "count-histogram-x-axis-" + A,
        x1: Vt / 2 - 0.5,
        x2: Vt / 2 - 0.5,
        y1: 0,
        y2: 5,
        "stroke-width": 1
      }, {
        type: "text",
        id: "count-histogram-x-axis-marker-" + A,
        role: "count-histogram-x-axis-marker",
        x: Vt / 2 - 5,
        y: 15,
        "text-anchor": "end",
        "alignment-baseline": "middle",
        "font-size": 10,
        text: z.state,
        transform: "rotate(-40 0 0)"
      }]
    };
    y.elem.push(O), A++;
  }
  return n && (v = {
    type: "g",
    id: "count-histogram-legend-group",
    role: "count-histogram-legend-group",
    width: w,
    height: _l,
    x: De + Zt,
    y: De + Ft + hr + Pt,
    elem: []
  }, v.elem.push({
    type: "g",
    id: "count-histogram-legend-original-group",
    role: "count-histogram-legend-item-group",
    width: 100,
    height: _l,
    x: 0,
    y: 0,
    elem: [{
      type: "rect",
      width: Vt * Ml,
      x: 0,
      height: 4,
      y: _l / 2 - 2,
      fill: Wt[1],
      "stroke-width": 0
    }, {
      type: "text",
      x: Vt * Ml + et,
      y: _l / 2 + 2,
      fill: Me,
      text: "Original " + (a ? "probability" : "count"),
      "font-size": 12,
      "text-anchor": "start",
      "alignment-baseline": "middle"
    }]
  }), v.elem.push({
    type: "g",
    id: "count-histogram-legend-hea-group",
    role: "count-histogram-legend-item-group",
    width: 100,
    height: _l,
    x: 170,
    y: 0,
    elem: [{
      type: "rect",
      width: Vt * Ml,
      x: 0,
      height: 4,
      y: _l / 2 - 2,
      fill: Wt[0],
      "stroke-width": 0
    }, {
      type: "text",
      x: Vt * Ml + et,
      y: _l / 2 + 2,
      fill: Me,
      text: "Hypothetical error-adjusted (HEA) " + (a ? "probability" : "count"),
      "font-size": 12,
      "text-anchor": "start",
      "alignment-baseline": "middle"
    }]
  }), v.elem.push({
    type: "g",
    id: "count-histogram-legend-hea-group",
    role: "count-histogram-legend-item-group",
    width: 100,
    height: _l,
    x: 500,
    y: 0,
    elem: [{
      type: "line",
      x1: 0,
      x2: 0,
      y1: 7,
      y2: _l - 7,
      "stroke-width": 1,
      stroke: Me
    }, {
      type: "text",
      x: 1 + et,
      y: _l / 2 + 2,
      fill: Me,
      text: "HEA " + (a ? "probability" : "count") + " interval",
      "font-size": 12,
      "text-anchor": "start",
      "alignment-baseline": "middle"
    }]
  }), p += _l + Pt), {
    type: "svg",
    width: h + De * 2,
    height: p + De * 2,
    viewBox: [0, 0, h + De * 2, p + De * 2],
    groups: {
      bar_group: g,
      y_axis_group: b,
      y_grid_group: k,
      x_axis_group: y,
      legend_group: v
    }
  };
}
let Y$ = [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 K$(t) {
  for (let e of Y$) {
    if (t > 1 && t % e == 0 && t / e > 1)
      return e;
    if (t < 1 && t % e < 1e-3 && t / e > 1)
      return e;
  }
}
function Jh(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[7] ? "Show" : "Hide"
  ), r, s, o, _, c, d, h, p, g, b, k, y, v = (
    /*images*/
    t[4]["count-histogram"] && Zh(t)
  ), w = !/*$hide1*/
  t[7] && xh(t), q = !/*$hide1*/
  t[7] && e1(t), $ = !/*$hide1*/
  t[7] && o1(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`Counts with hypothetical error adjustment
      `), n = m("button"), r = E(a), s = N(), o = m("button"), o.textContent = "Image", _ = N(), v && v.c(), c = N(), d = m("div"), w && w.c(), h = N(), p = m("div"), q && q.c(), g = N(), $ && $.c(), u(o, "class", "save-make svelte-ef6jyv"), u(d, "class", "content-wrap"), u(p, "class", "content-wrap"), u(e, "class", "panel svelte-ef6jyv");
    },
    m(j, I) {
      S(j, e, I), f(e, l), f(l, i), f(l, n), f(n, r), f(l, s), f(l, o), f(l, _), v && v.m(l, null), f(e, c), f(e, d), w && w.m(d, null), f(e, h), f(e, p), q && q.m(p, null), f(e, g), $ && $.m(e, null), b = !0, k || (y = [
        te(
          n,
          "click",
          /*click_handler*/
          t[16]
        ),
        te(
          o,
          "click",
          /*click_handler_1*/
          t[17]
        )
      ], k = !0);
    },
    p(j, I) {
      (!b || I & /*$hide1*/
      128) && a !== (a = /*$hide1*/
      j[7] ? "Show" : "Hide") && U(r, a), /*images*/
      j[4]["count-histogram"] ? v ? v.p(j, I) : (v = Zh(j), v.c(), v.m(l, null)) : v && (v.d(1), v = null), /*$hide1*/
      j[7] ? w && (w.d(1), w = null) : w ? w.p(j, I) : (w = xh(j), w.c(), w.m(d, null)), /*$hide1*/
      j[7] ? q && (be(), D(q, 1, 1, () => {
        q = null;
      }), ke()) : q ? (q.p(j, I), I & /*$hide1*/
      128 && T(q, 1)) : (q = e1(j), q.c(), T(q, 1), q.m(p, null)), /*$hide1*/
      j[7] ? $ && ($.d(1), $ = null) : $ ? $.p(j, I) : ($ = o1(j), $.c(), $.m(e, null));
    },
    i(j) {
      b || (T(q), b = !0);
    },
    o(j) {
      D(q), b = !1;
    },
    d(j) {
      j && C(e), v && v.d(), w && w.d(), q && q.d(), $ && $.d(), k = !1, wt(y);
    }
  };
}
function Zh(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("a"), l = E("PNG"), n = N(), a = m("a"), r = E("SVG"), u(e, "class", "save-download svelte-ef6jyv"), u(e, "href", i = /*images*/
      t[4]["count-histogram"].png), u(e, "download", ""), u(a, "class", "save-download svelte-ef6jyv"), u(a, "href", s = /*images*/
      t[4]["count-histogram"].svg), u(a, "download", "");
    },
    m(o, _) {
      S(o, e, _), f(e, l), S(o, n, _), S(o, a, _), f(a, r);
    },
    p(o, _) {
      _ & /*images*/
      16 && i !== (i = /*images*/
      o[4]["count-histogram"].png) && u(e, "href", i), _ & /*images*/
      16 && s !== (s = /*images*/
      o[4]["count-histogram"].svg) && u(a, "href", s);
    },
    d(o) {
      o && (C(e), C(n), C(a));
    }
  };
}
function xh(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p;
  function g(q, $) {
    var j;
    return (
      /*$config*/
      (j = q[5]) != null && j.reverse_state_vector ? W$ : U$
    );
  }
  let b = g(t), k = b(t);
  function y(q, $) {
    var j;
    return (
      /*$config*/
      (j = q[5]) != null && j.see_uncertainty ? Z$ : J$
    );
  }
  let v = y(t), w = v(t);
  return {
    c() {
      var q, $;
      e = m("div"), l = m("input"), n = N(), a = m("label"), k.c(), r = N(), s = m("div"), o = m("input"), c = N(), d = m("label"), w.c(), u(l, "id", "config"), u(l, "type", "checkbox"), l.checked = i = /*$config*/
      (q = t[5]) == null ? void 0 : q.reverse_state_vector, u(a, "for", "config"), u(a, "class", "svelte-ef6jyv"), u(e, "class", "input-wrap svelte-ef6jyv"), u(o, "id", "config2"), u(o, "type", "checkbox"), o.checked = _ = /*$config*/
      ($ = t[5]) == null ? void 0 : $.see_uncertainty, u(d, "for", "config2"), u(d, "class", "svelte-ef6jyv"), u(s, "class", "input-wrap svelte-ef6jyv");
    },
    m(q, $) {
      S(q, e, $), f(e, l), f(e, n), f(e, a), k.m(a, null), S(q, r, $), S(q, s, $), f(s, o), f(s, c), f(s, d), w.m(d, null), h || (p = [
        te(
          l,
          "change",
          /*change_handler*/
          t[18]
        ),
        te(
          o,
          "change",
          /*change_handler_1*/
          t[19]
        )
      ], h = !0);
    },
    p(q, $) {
      var j, I;
      $ & /*$config*/
      32 && i !== (i = /*$config*/
      (j = q[5]) == null ? void 0 : j.reverse_state_vector) && (l.checked = i), b !== (b = g(q)) && (k.d(1), k = b(q), k && (k.c(), k.m(a, null))), $ & /*$config*/
      32 && _ !== (_ = /*$config*/
      (I = q[5]) == null ? void 0 : I.see_uncertainty) && (o.checked = _), v !== (v = y(q)) && (w.d(1), w = v(q), w && (w.c(), w.m(d, null)));
    },
    d(q) {
      q && (C(e), C(r), C(s)), k.d(), w.d(), h = !1, wt(p);
    }
  };
}
function U$(t) {
  let e;
  return {
    c() {
      e = E("The bitstring is original (Qubit N ← Qubit 0).");
    },
    m(l, i) {
      S(l, e, i);
    },
    d(l) {
      l && C(e);
    }
  };
}
function W$(t) {
  let e;
  return {
    c() {
      e = E("The bitstring is reversed (Qubit 0 → Qubit N).");
    },
    m(l, i) {
      S(l, e, i);
    },
    d(l) {
      l && C(e);
    }
  };
}
function J$(t) {
  let e;
  return {
    c() {
      e = E("Hypothetical Error-Adjsutmen (HEA) turned off");
    },
    m(l, i) {
      S(l, e, i);
    },
    d(l) {
      l && C(e);
    }
  };
}
function Z$(t) {
  let e;
  return {
    c() {
      e = E("Hypothetical Error-Adjsutmen (HEA) turned on");
    },
    m(l, i) {
      S(l, e, i);
    },
    d(l) {
      l && C(e);
    }
  };
}
function e1(t) {
  var n;
  let e, l, i = (
    /*$drawPlan*/
    ((n = t[8]) == null ? void 0 : n.groups) && t1(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(a, r) {
      i && i.m(a, r), S(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 && T(i, 1)) : (i = t1(a), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(a) {
      l || (T(i), l = !0);
    },
    o(a) {
      D(i), l = !1;
    },
    d(a) {
      a && C(e), i && i.d(a);
    }
  };
}
function t1(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M = (
    /*$drawPlan*/
    t[8].groups.y_axis_group && l1(t)
  ), z = (
    /*$drawPlan*/
    t[8].groups.y_axis_group && i1(t)
  ), H = (
    /*$drawPlan*/
    t[8].groups.y_grid_group && n1(t)
  ), B = (
    /*$drawPlan*/
    t[8].groups.bar_group && a1(t)
  ), R = (
    /*$drawPlan*/
    t[8].groups.x_axis_group && r1(t)
  ), P = (
    /*$drawPlan*/
    t[8].groups.legend_group && s1(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = Ge("svg"), n = Ge("style"), a = E(`g {
                    font-family: Iosevka;
                    font-size: 14px;
                  }
                `), M && M.c(), d = N(), h = m("div"), p = Ge("svg"), g = Ge("style"), b = E(`g {
                    font-family: Iosevka;
                    font-size: 14px;
                  }
                `), z && z.c(), k = Ae(), H && H.c(), y = Ae(), B && B.c(), v = Ae(), R && R.c(), w = Ae(), P && P.c(), u(i, "id", r = /*id*/
      t[1] + "-sticky"), u(i, "width", s = /*$drawPlan*/
      t[8].groups.y_axis_group.x + /*$drawPlan*/
      t[8].groups.y_axis_group.width), u(i, "height", o = /*$drawPlan*/
      t[8].height), u(i, "viewBox", _ = /*$drawPlan*/
      t[8].viewBox.map(
        /*func*/
        t[20]
      ).join(" ")), u(l, "class", "count-histogram-sticky svelte-ef6jyv"), u(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;`), u(
        p,
        "id",
        /*id*/
        t[1]
      ), u(p, "width", q = /*$drawPlan*/
      t[8].width), u(p, "height", $ = /*$drawPlan*/
      t[8].height), u(p, "viewBox", j = /*$drawPlan*/
      t[8].viewBox.join(" ")), u(h, "class", "count-histogram-main svelte-ef6jyv"), u(e, "id", I = /*id*/
      t[1] + "-wrapper"), u(e, "class", "count-histogram-wrapper svelte-ef6jyv"), At(e, "position", "relative"), At(e, "width", "100%"), At(e, "overflow-x", "scroll"), At(e, "overflow-y", "hidden");
    },
    m(O, F) {
      S(O, e, F), f(e, l), f(l, i), f(i, n), f(n, a), M && M.m(i, null), f(e, d), f(e, h), f(h, p), f(p, g), f(g, b), z && z.m(p, null), f(p, k), H && H.m(p, null), f(p, y), B && B.m(p, null), f(p, v), R && R.m(p, null), f(p, w), P && P.m(p, null), A = !0;
    },
    p(O, F) {
      /*$drawPlan*/
      O[8].groups.y_axis_group ? M ? (M.p(O, F), F & /*$drawPlan*/
      256 && T(M, 1)) : (M = l1(O), M.c(), T(M, 1), M.m(i, null)) : M && (be(), D(M, 1, 1, () => {
        M = null;
      }), ke()), (!A || F & /*id*/
      2 && r !== (r = /*id*/
      O[1] + "-sticky")) && u(i, "id", r), (!A || F & /*$drawPlan*/
      256 && s !== (s = /*$drawPlan*/
      O[8].groups.y_axis_group.x + /*$drawPlan*/
      O[8].groups.y_axis_group.width)) && u(i, "width", s), (!A || F & /*$drawPlan*/
      256 && o !== (o = /*$drawPlan*/
      O[8].height)) && u(i, "height", o), (!A || F & /*$drawPlan*/
      256 && _ !== (_ = /*$drawPlan*/
      O[8].viewBox.map(
        /*func*/
        O[20]
      ).join(" "))) && u(i, "viewBox", _), (!A || F & /*$drawPlan*/
      256 && c !== (c = `width: ${/*$drawPlan*/
      O[8].groups.y_axis_group.x + /*$drawPlan*/
      O[8].groups.y_axis_group.width}px; height:${/*$drawPlan*/
      O[8].height}px;`)) && u(l, "style", c), /*$drawPlan*/
      O[8].groups.y_axis_group ? z ? (z.p(O, F), F & /*$drawPlan*/
      256 && T(z, 1)) : (z = i1(O), z.c(), T(z, 1), z.m(p, k)) : z && (be(), D(z, 1, 1, () => {
        z = null;
      }), ke()), /*$drawPlan*/
      O[8].groups.y_grid_group ? H ? (H.p(O, F), F & /*$drawPlan*/
      256 && T(H, 1)) : (H = n1(O), H.c(), T(H, 1), H.m(p, y)) : H && (be(), D(H, 1, 1, () => {
        H = null;
      }), ke()), /*$drawPlan*/
      O[8].groups.bar_group ? B ? (B.p(O, F), F & /*$drawPlan*/
      256 && T(B, 1)) : (B = a1(O), B.c(), T(B, 1), B.m(p, v)) : B && (be(), D(B, 1, 1, () => {
        B = null;
      }), ke()), /*$drawPlan*/
      O[8].groups.x_axis_group ? R ? (R.p(O, F), F & /*$drawPlan*/
      256 && T(R, 1)) : (R = r1(O), R.c(), T(R, 1), R.m(p, w)) : R && (be(), D(R, 1, 1, () => {
        R = null;
      }), ke()), /*$drawPlan*/
      O[8].groups.legend_group ? P ? (P.p(O, F), F & /*$drawPlan*/
      256 && T(P, 1)) : (P = s1(O), P.c(), T(P, 1), P.m(p, null)) : P && (be(), D(P, 1, 1, () => {
        P = null;
      }), ke()), (!A || F & /*id*/
      2) && u(
        p,
        "id",
        /*id*/
        O[1]
      ), (!A || F & /*$drawPlan*/
      256 && q !== (q = /*$drawPlan*/
      O[8].width)) && u(p, "width", q), (!A || F & /*$drawPlan*/
      256 && $ !== ($ = /*$drawPlan*/
      O[8].height)) && u(p, "height", $), (!A || F & /*$drawPlan*/
      256 && j !== (j = /*$drawPlan*/
      O[8].viewBox.join(" "))) && u(p, "viewBox", j), (!A || F & /*id*/
      2 && I !== (I = /*id*/
      O[1] + "-wrapper")) && u(e, "id", I);
    },
    i(O) {
      A || (T(M), T(z), T(H), T(B), T(R), T(P), A = !0);
    },
    o(O) {
      D(M), D(z), D(H), D(B), D(R), D(P), A = !1;
    },
    d(O) {
      O && C(e), M && M.d(), z && z.d(), H && H.d(), B && B.d(), R && R.d(), P && P.d();
    }
  };
}
function l1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[8].groups.y_axis_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function i1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[8].groups.y_axis_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function n1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[8].groups.y_grid_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function a1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[8].groups.bar_group
      ),
      openTooltip: (
        /*openTooltip*/
        t[12]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[14]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[13]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function r1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[8].groups.x_axis_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function s1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[8].groups.legend_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function o1(t) {
  let e;
  function l(a, r) {
    return (
      /*showTooltip*/
      a[2] ? e6 : x$
    );
  }
  let i = l(t), n = i(t);
  return {
    c() {
      e = m("div"), n.c(), u(e, "class", "tooltip-space svelte-ef6jyv");
    },
    m(a, r) {
      S(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 && C(e), n.d();
    }
  };
}
function x$(t) {
  let e;
  return {
    c() {
      e = m("div"), e.textContent = "Hover or click an item to see details", u(e, "class", "g-tooltip deactive svelte-ef6jyv");
    },
    m(l, i) {
      S(l, e, i);
    },
    p: ne,
    d(l) {
      l && C(e);
    }
  };
}
function e6(t) {
  let e;
  return {
    c() {
      e = m("div"), u(e, "class", "g-tooltip svelte-ef6jyv");
    },
    m(l, i) {
      S(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 && C(e);
    }
  };
}
function t6(t) {
  let e, l, i = (
    /*$data*/
    t[6] && Jh(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(n, a) {
      i && i.m(n, a), S(n, e, a), l = !0;
    },
    p(n, [a]) {
      /*$data*/
      n[6] ? i ? (i.p(n, a), a & /*$data*/
      64 && T(i, 1)) : (i = Jh(n), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d(n);
    }
  };
}
function l6(t, e, l) {
  let i, n, a = ne, r = () => (a(), a = st(_, (B) => l(6, n = B)), _), s, o;
  t.$$.on_destroy.push(() => a());
  let { data: _ = Oe(), id: c = "count-histogram" } = e;
  r();
  let d = Oe(!0);
  at(t, d, (B) => l(7, s = B));
  let h = Oe();
  at(t, h, (B) => l(8, o = B));
  let p = Oe({
    reverse_state_vector: !0,
    see_uncertainty: !0
  });
  at(t, p, (B) => l(5, i = B)), Tt(() => {
    h.set(pr(n == null ? void 0 : n.counts, n.uncertainty_data, i)), p.subscribe((B) => {
      h.set(pr(n == null ? void 0 : n.counts, n.uncertainty_data, B));
    }), _.subscribe((B) => {
      h.set(pr(B == null ? void 0 : B.counts, B.uncertainty_data, i));
    });
  });
  let g = !1, b, k = !1, y = 999;
  function v(B, R, P, O) {
    k && !P || y < O || (l(2, g = !0), B.clientX + 5, B.clientY + 5, l(3, b = R), k = P, y = O || 0);
  }
  function w(B) {
    g && (B.clientX + 5, B.clientY + 5);
  }
  function q(B) {
    k || l(2, g = !1), B && (l(2, g = !1), y = 999);
  }
  let $ = {}, j = Oe();
  j.subscribe((B) => {
    B && l(4, $[B.id] = B, $);
  });
  const I = (B) => d.set(!s), A = (B) => {
    Ii("count-histogram", j);
  }, M = (B) => {
    p.update((R) => (R.reverse_state_vector = B.target.checked, R));
  }, z = (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, _ = B.data)), "id" in B && l(1, c = B.id);
  }, [
    _,
    c,
    g,
    b,
    $,
    i,
    n,
    s,
    o,
    d,
    h,
    p,
    v,
    w,
    q,
    j,
    I,
    A,
    M,
    z,
    H
  ];
}
class i6 extends Ve {
  constructor(e) {
    super(), Qe(this, e, l6, t6, Fe, { data: 0, id: 1 });
  }
}
function u1(t) {
  let e, l, i, n, a, r = (
    /*$hide1*/
    t[6] ? "Show" : "Hide"
  ), s, o, _, c, d, h, p, g, b = !/*$hide1*/
  t[6] && /*$pagination*/
  t[7].total_page > 1 && f1(t), k = !/*$hide1*/
  t[6] && _1(t), y = !/*$hide1*/
  t[6] && y1(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(
        /*panel_name*/
        t[0]
      ), n = N(), a = m("button"), s = E(r), o = N(), b && b.c(), _ = N(), c = m("div"), k && k.c(), d = N(), y && y.c(), u(c, "class", "content-wrap"), u(e, "class", "panel svelte-1ws4qni");
    },
    m(v, w) {
      S(v, e, w), f(e, l), f(l, i), f(l, n), f(l, a), f(a, s), f(l, o), b && b.m(l, null), f(e, _), f(e, c), k && k.m(c, null), f(e, d), y && y.m(e, null), h = !0, p || (g = te(
        a,
        "click",
        /*click_handler*/
        t[15]
      ), p = !0);
    },
    p(v, w) {
      (!h || w & /*panel_name*/
      1) && U(
        i,
        /*panel_name*/
        v[0]
      ), (!h || w & /*$hide1*/
      64) && r !== (r = /*$hide1*/
      v[6] ? "Show" : "Hide") && U(s, r), !/*$hide1*/
      v[6] && /*$pagination*/
      v[7].total_page > 1 ? b ? b.p(v, w) : (b = f1(v), b.c(), b.m(l, null)) : b && (b.d(1), b = null), /*$hide1*/
      v[6] ? k && (be(), D(k, 1, 1, () => {
        k = null;
      }), ke()) : k ? (k.p(v, w), w & /*$hide1*/
      64 && T(k, 1)) : (k = _1(v), k.c(), T(k, 1), k.m(c, null)), /*$hide1*/
      v[6] ? y && (y.d(1), y = null) : y ? y.p(v, w) : (y = y1(v), y.c(), y.m(e, null));
    },
    i(v) {
      h || (T(k), h = !0);
    },
    o(v) {
      D(k), h = !1;
    },
    d(v) {
      v && C(e), b && b.d(), k && k.d(), y && y.d(), p = !1, g();
    }
  };
}
function f1(t) {
  let e, l, i, n, a, r = (
    /*$pagination*/
    t[7].range.map(
      /*func*/
      t[17]
    ).join("...") + ""
  ), s, o, _ = (
    /*$pagination*/
    t[7].total_page + ""
  ), c, d, h, p, g, b, k, y, v, w, q;
  return {
    c() {
      e = E(`Showing layer
        `), l = m("input"), a = E(`
        (`), s = E(r), o = E(") / "), c = E(_), d = N(), h = m("button"), p = E("← Prev"), b = N(), k = m("button"), y = E("Next →"), u(l, "type", "number"), u(l, "min", 1), u(l, "max", i = /*$pagination*/
      t[7].total_page), l.value = n = /*$pagination*/
      t[7].page, h.disabled = g = /*$pagination*/
      t[7].page <= 1, k.disabled = v = /*$pagination*/
      t[7].page > /*$pagination*/
      t[7].total_page;
    },
    m($, j) {
      S($, e, j), S($, l, j), S($, a, j), S($, s, j), S($, o, j), S($, c, j), S($, d, j), S($, h, j), f(h, p), S($, b, j), S($, k, j), f(k, y), w || (q = [
        te(
          l,
          "change",
          /*change_handler*/
          t[16]
        ),
        te(
          h,
          "click",
          /*click_handler_1*/
          t[18]
        ),
        te(
          k,
          "click",
          /*click_handler_2*/
          t[19]
        )
      ], w = !0);
    },
    p($, j) {
      j & /*$pagination*/
      128 && i !== (i = /*$pagination*/
      $[7].total_page) && u(l, "max", i), j & /*$pagination*/
      128 && n !== (n = /*$pagination*/
      $[7].page) && l.value !== n && (l.value = n), j & /*$pagination, circuit_data*/
      130 && r !== (r = /*$pagination*/
      $[7].range.map(
        /*func*/
        $[17]
      ).join("...") + "") && U(s, r), j & /*$pagination*/
      128 && _ !== (_ = /*$pagination*/
      $[7].total_page + "") && U(c, _), j & /*$pagination*/
      128 && g !== (g = /*$pagination*/
      $[7].page <= 1) && (h.disabled = g), j & /*$pagination*/
      128 && v !== (v = /*$pagination*/
      $[7].page > /*$pagination*/
      $[7].total_page) && (k.disabled = v);
    },
    d($) {
      $ && (C(e), C(l), C(a), C(s), C(o), C(c), C(d), C(h), C(b), C(k)), w = !1, wt(q);
    }
  };
}
function _1(t) {
  let e, l, i = (
    /*drawPlan*/
    t[3] && c1(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(n, a) {
      i && i.m(n, a), S(n, e, a), l = !0;
    },
    p(n, a) {
      /*drawPlan*/
      n[3] ? i ? (i.p(n, a), a & /*drawPlan*/
      8 && T(i, 1)) : (i = c1(n), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d(n);
    }
  };
}
function c1(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H = (
    /*drawPlan*/
    t[3].groups.phase_marker && d1(t)
  ), B = (
    /*drawPlan*/
    t[3].groups.qubit_group && h1(t)
  ), R = (
    /*drawPlan*/
    t[3].groups.esp_axis_group && p1(t)
  ), P = (
    /*drawPlan*/
    t[3].groups.phase_marker && m1(t)
  ), O = (
    /*drawPlan*/
    t[3].groups.moment_group && g1(t)
  ), F = (
    /*drawPlan*/
    t[3].groups.qubit_group && b1(t)
  ), L = (
    /*drawPlan*/
    t[3].groups.circuit_line_group && k1(t)
  ), X = (
    /*drawPlan*/
    t[3].groups.circuit_group && v1(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = Ge("svg"), n = Ge("style"), a = E(`g {
                    font-family: Iosevka;
                    font-size: 14px;
                  }
                `), H && H.c(), r = Ae(), B && B.c(), s = Ae(), R && R.c(), p = N(), g = m("div"), b = Ge("svg"), k = Ge("style"), y = E(`g {
                    font-family: Iosevka;
                    font-size: 14px;
                  }
                `), P && P.c(), v = Ae(), O && O.c(), w = Ae(), F && F.c(), q = Ae(), L && L.c(), $ = Ae(), X && X.c(), u(i, "id", o = /*id*/
      t[2] + "-sticky"), u(i, "width", _ = /*drawPlan*/
      t[3].groups.qubit_group.x + /*drawPlan*/
      t[3].groups.qubit_group.width), u(i, "height", c = /*drawPlan*/
      t[3].height), u(i, "viewBox", d = /*drawPlan*/
      t[3].viewBox.map(
        /*func_1*/
        t[20]
      ).join(" ")), u(l, "class", "circuit-sticky svelte-1ws4qni"), u(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;`), u(
        b,
        "id",
        /*id*/
        t[2]
      ), u(b, "width", j = /*drawPlan*/
      t[3].width), u(b, "height", I = /*drawPlan*/
      t[3].height), u(b, "viewBox", A = /*drawPlan*/
      t[3].viewBox.join(" ")), u(g, "class", "circuit-main svelte-1ws4qni"), u(e, "id", M = /*id*/
      t[2] + "-wrapper"), u(e, "class", "ciruit-view-wrapper svelte-1ws4qni"), At(e, "position", "relative"), At(e, "width", "100%"), At(e, "overflow-x", "scroll"), At(e, "overflow-y", "hidden");
    },
    m(V, Q) {
      S(V, e, Q), f(e, l), f(l, i), f(i, n), f(n, a), H && H.m(i, null), f(i, r), B && B.m(i, null), f(i, s), R && R.m(i, null), f(e, p), f(e, g), f(g, b), f(b, k), f(k, y), P && P.m(b, null), f(b, v), O && O.m(b, null), f(b, w), F && F.m(b, null), f(b, q), L && L.m(b, null), f(b, $), X && X.m(b, null), z = !0;
    },
    p(V, Q) {
      /*drawPlan*/
      V[3].groups.phase_marker ? H ? (H.p(V, Q), Q & /*drawPlan*/
      8 && T(H, 1)) : (H = d1(V), H.c(), T(H, 1), H.m(i, r)) : H && (be(), D(H, 1, 1, () => {
        H = null;
      }), ke()), /*drawPlan*/
      V[3].groups.qubit_group ? B ? (B.p(V, Q), Q & /*drawPlan*/
      8 && T(B, 1)) : (B = h1(V), B.c(), T(B, 1), B.m(i, s)) : B && (be(), D(B, 1, 1, () => {
        B = null;
      }), ke()), /*drawPlan*/
      V[3].groups.esp_axis_group ? R ? (R.p(V, Q), Q & /*drawPlan*/
      8 && T(R, 1)) : (R = p1(V), R.c(), T(R, 1), R.m(i, null)) : R && (be(), D(R, 1, 1, () => {
        R = null;
      }), ke()), (!z || Q & /*id*/
      4 && o !== (o = /*id*/
      V[2] + "-sticky")) && u(i, "id", o), (!z || Q & /*drawPlan*/
      8 && _ !== (_ = /*drawPlan*/
      V[3].groups.qubit_group.x + /*drawPlan*/
      V[3].groups.qubit_group.width)) && u(i, "width", _), (!z || Q & /*drawPlan*/
      8 && c !== (c = /*drawPlan*/
      V[3].height)) && u(i, "height", c), (!z || Q & /*drawPlan*/
      8 && d !== (d = /*drawPlan*/
      V[3].viewBox.map(
        /*func_1*/
        V[20]
      ).join(" "))) && u(i, "viewBox", d), (!z || 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;`)) && u(l, "style", h), /*drawPlan*/
      V[3].groups.phase_marker ? P ? (P.p(V, Q), Q & /*drawPlan*/
      8 && T(P, 1)) : (P = m1(V), P.c(), T(P, 1), P.m(b, v)) : P && (be(), D(P, 1, 1, () => {
        P = null;
      }), ke()), /*drawPlan*/
      V[3].groups.moment_group ? O ? (O.p(V, Q), Q & /*drawPlan*/
      8 && T(O, 1)) : (O = g1(V), O.c(), T(O, 1), O.m(b, w)) : O && (be(), D(O, 1, 1, () => {
        O = null;
      }), ke()), /*drawPlan*/
      V[3].groups.qubit_group ? F ? (F.p(V, Q), Q & /*drawPlan*/
      8 && T(F, 1)) : (F = b1(V), F.c(), T(F, 1), F.m(b, q)) : F && (be(), D(F, 1, 1, () => {
        F = null;
      }), ke()), /*drawPlan*/
      V[3].groups.circuit_line_group ? L ? (L.p(V, Q), Q & /*drawPlan*/
      8 && T(L, 1)) : (L = k1(V), L.c(), T(L, 1), L.m(b, $)) : L && (be(), D(L, 1, 1, () => {
        L = null;
      }), ke()), /*drawPlan*/
      V[3].groups.circuit_group ? X ? (X.p(V, Q), Q & /*drawPlan*/
      8 && T(X, 1)) : (X = v1(V), X.c(), T(X, 1), X.m(b, null)) : X && (be(), D(X, 1, 1, () => {
        X = null;
      }), ke()), (!z || Q & /*id*/
      4) && u(
        b,
        "id",
        /*id*/
        V[2]
      ), (!z || Q & /*drawPlan*/
      8 && j !== (j = /*drawPlan*/
      V[3].width)) && u(b, "width", j), (!z || Q & /*drawPlan*/
      8 && I !== (I = /*drawPlan*/
      V[3].height)) && u(b, "height", I), (!z || Q & /*drawPlan*/
      8 && A !== (A = /*drawPlan*/
      V[3].viewBox.join(" "))) && u(b, "viewBox", A), (!z || Q & /*id*/
      4 && M !== (M = /*id*/
      V[2] + "-wrapper")) && u(e, "id", M);
    },
    i(V) {
      z || (T(H), T(B), T(R), T(P), T(O), T(F), T(L), T(X), z = !0);
    },
    o(V) {
      D(H), D(B), D(R), D(P), D(O), D(F), D(L), D(X), z = !1;
    },
    d(V) {
      V && C(e), H && H.d(), B && B.d(), R && R.d(), P && P.d(), O && O.d(), F && F.d(), L && L.d(), X && X.d();
    }
  };
}
function d1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.phase_marker
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function h1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.qubit_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function p1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.esp_axis_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function m1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.phase_marker
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function g1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.moment_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function b1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.qubit_group
      ),
      openTooltip: (
        /*openTooltip*/
        t[11]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[13]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[12]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function k1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.circuit_line_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function v1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*drawPlan*/
        t[3].groups.circuit_group
      ),
      openTooltip: (
        /*openTooltip*/
        t[11]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[13]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[12]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function y1(t) {
  let e;
  function l(a, r) {
    return (
      /*showTooltip*/
      a[4] ? a6 : n6
    );
  }
  let i = l(t), n = i(t);
  return {
    c() {
      e = m("div"), n.c(), u(e, "class", "tooltip-space svelte-1ws4qni");
    },
    m(a, r) {
      S(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 && C(e), n.d();
    }
  };
}
function n6(t) {
  let e;
  return {
    c() {
      e = m("div"), e.textContent = "Hover or click an item to see details", u(e, "class", "g-tooltip deactive svelte-1ws4qni");
    },
    m(l, i) {
      S(l, e, i);
    },
    p: ne,
    d(l) {
      l && C(e);
    }
  };
}
function a6(t) {
  let e;
  return {
    c() {
      e = m("div"), u(e, "class", "g-tooltip svelte-1ws4qni");
    },
    m(l, i) {
      S(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 && C(e);
    }
  };
}
function r6(t) {
  let e, l, i = (
    /*circuit_data*/
    t[1] && u1(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(n, a) {
      i && i.m(n, a), S(n, e, a), l = !0;
    },
    p(n, [a]) {
      /*circuit_data*/
      n[1] ? i ? (i.p(n, a), a & /*circuit_data*/
      2 && T(i, 1)) : (i = u1(n), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d(n);
    }
  };
}
const Bi = 50;
function w1(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 s6(t, e, l) {
  let i, n, { panel_name: a = "Circuit", circuit_data: r, is_original: s = !1, id: o = "circuit" } = e, _ = Oe(!0);
  at(t, _, (P) => l(6, i = P));
  let c = Oe({ total_page: 0, page: 0, range: [0, 0] });
  at(t, c, (P) => l(7, n = P));
  let d, h = !0, p = [], g = [];
  function b(P, O) {
    var F;
    if (!P.layers) {
      l(3, d = void 0);
      return;
    }
    p = w1(P, "qubits"), g = w1(P, "clbits"), P.qubits = p, P.num_qubits = p == null ? void 0 : p.length, P.clbits = g, P.num_clbits = g == null ? void 0 : g.length, l(3, d = kr(P, {
      pagination: O,
      show_moments: !0,
      is_original: s,
      filter_unused_qubits: h,
      no_match: !0,
      first_layer_index: ((F = P.layer_index) == null ? void 0 : F[0]) || 0
    }));
  }
  Tt(() => {
    var F;
    c.subscribe((L) => {
      b(r, L);
    });
    let P = ((F = r.layers) == null ? void 0 : F.length) || 0, O = Math.ceil(P / Bi);
    c.set({
      total_layers: P,
      total_page: O,
      page: 1,
      range: [0, Math.min(Bi, P)]
    });
  });
  function k(P) {
    c.update((O) => (O.page = Math.min(O.total_page, Math.max(1, P)), O.range = [
      Math.min(O.total_layers - 1, Math.max(0, (P - 1) * Bi)),
      Math.min(O.total_layers - 1, Math.max(0, P * Bi))
    ], console.log(O), O));
  }
  let y = !1, v, w = !1, q = 999;
  function $(P, O, F, L) {
    w && !F || q < L || (l(4, y = !0), P.clientX + 5, P.clientY + 5, l(5, v = O), w = F, q = L || 0);
  }
  function j(P) {
    y && (P.clientX + 5, P.clientY + 5);
  }
  function I(P) {
    w || l(4, y = !1), P && (l(4, y = !1), q = 999);
  }
  const A = (P) => _.set(!i), M = (P) => {
    k(parseInt(P.target.value));
  }, z = (P) => {
    var O;
    return (((O = r.layer_index) == null ? void 0 : O[0]) || 0) + P;
  }, H = (P) => {
    k(n.page - 1);
  }, B = (P) => {
    k(n.page + 1);
  }, R = (P, O) => O == 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 O = ((P = r.layers) == null ? void 0 : P.length) || 0, F = Math.ceil(O / Bi);
      c.set({
        total_layers: O,
        total_page: F,
        page: 1,
        range: [0, Math.min(Bi, O)]
      });
    }
  }, [
    a,
    r,
    o,
    d,
    y,
    v,
    i,
    n,
    _,
    c,
    k,
    $,
    j,
    I,
    s,
    A,
    M,
    z,
    H,
    B,
    R
  ];
}
class $1 extends Ve {
  constructor(e) {
    super(), Qe(this, e, s6, r6, Fe, {
      panel_name: 0,
      circuit_data: 1,
      is_original: 14,
      id: 2
    });
  }
}
function q1(t, e, l) {
  const i = t.slice();
  return i[11] = e[l], i[13] = l, i;
}
function j1(t, e, l) {
  const i = t.slice();
  return i[14] = e[l], i[16] = l, i;
}
function T1(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[2] ? "Show" : "Hide"
  ), r, s, o, _, c, d, h, p, g = (
    /*$hide2*/
    t[3] ? "Show" : "Hide"
  ), b, k, y, v, w, q, $, j, I = (
    /*$hide3*/
    t[4] ? "Show" : "Hide"
  ), A, M, z, H, B, R = !/*$hide1*/
  t[2] && C1(t), P = !/*$hide2*/
  t[3] && A1(t), O = !/*$hide3*/
  t[4] && O1(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E("Backend information "), n = m("button"), r = E(a), s = N(), o = m("div"), R && R.c(), _ = N(), c = m("article"), d = m("h4"), h = E("Backend general parameters "), p = m("button"), b = E(g), k = N(), y = m("div"), P && P.c(), v = N(), w = m("article"), q = m("h4"), $ = E("Qubit groups "), j = m("button"), A = E(I), M = N(), z = m("div"), O && O.c(), u(o, "class", "content-wrap"), u(e, "class", "panel meta svelte-ab2y8n"), u(y, "class", "content-wrap svelte-ab2y8n"), u(c, "class", "panel generic svelte-ab2y8n"), u(z, "class", "content-wrap svelte-ab2y8n"), u(w, "class", "panel generic-q svelte-ab2y8n");
    },
    m(F, L) {
      S(F, e, L), f(e, l), f(l, i), f(l, n), f(n, r), f(e, s), f(e, o), R && R.m(o, null), S(F, _, L), S(F, c, L), f(c, d), f(d, h), f(d, p), f(p, b), f(c, k), f(c, y), P && P.m(y, null), S(F, v, L), S(F, w, L), f(w, q), f(q, $), f(q, j), f(j, A), f(w, M), f(w, z), O && O.m(z, null), H || (B = [
        te(
          n,
          "click",
          /*click_handler*/
          t[8]
        ),
        te(
          p,
          "click",
          /*click_handler_1*/
          t[9]
        ),
        te(
          j,
          "click",
          /*click_handler_2*/
          t[10]
        )
      ], H = !0);
    },
    p(F, L) {
      L & /*$hide1*/
      4 && a !== (a = /*$hide1*/
      F[2] ? "Show" : "Hide") && U(r, a), /*$hide1*/
      F[2] ? R && (R.d(1), R = null) : R ? R.p(F, L) : (R = C1(F), R.c(), R.m(o, null)), L & /*$hide2*/
      8 && g !== (g = /*$hide2*/
      F[3] ? "Show" : "Hide") && U(b, g), /*$hide2*/
      F[3] ? P && (P.d(1), P = null) : P ? P.p(F, L) : (P = A1(F), P.c(), P.m(y, null)), L & /*$hide3*/
      16 && I !== (I = /*$hide3*/
      F[4] ? "Show" : "Hide") && U(A, I), /*$hide3*/
      F[4] ? O && (O.d(1), O = null) : O ? O.p(F, L) : (O = O1(F), O.c(), O.m(z, null));
    },
    d(F) {
      F && (C(e), C(_), C(c), C(v), C(w)), R && R.d(), P && P.d(), O && O.d(), H = !1, wt(B);
    }
  };
}
function C1(t) {
  var _, c, d, h;
  let e, l, i, n, a = (
    /*$data*/
    ((_ = t[1].machine_data) == null ? void 0 : _.backend_name) && S1(t)
  ), r = (
    /*data*/
    ((c = t[0].machine_data) == null ? void 0 : c.backend_version) && M1(t)
  ), s = (
    /*data*/
    ((d = t[0].backend_properties) == null ? void 0 : d.last_update_date) && z1(t)
  ), o = (
    /*$data*/
    ((h = t[1].machine_data) == null ? void 0 : h.basis_gates) && N1(t)
  );
  return {
    c() {
      e = m("table"), a && a.c(), l = N(), r && r.c(), i = N(), s && s.c(), n = N(), o && o.c(), u(e, "class", "svelte-ab2y8n");
    },
    m(p, g) {
      S(p, e, g), a && a.m(e, null), f(e, l), r && r.m(e, null), f(e, i), s && s.m(e, null), f(e, n), o && o.m(e, null);
    },
    p(p, g) {
      var b, k, y, v;
      /*$data*/
      (b = p[1].machine_data) != null && b.backend_name ? a ? a.p(p, g) : (a = S1(p), a.c(), a.m(e, l)) : a && (a.d(1), a = null), /*data*/
      (k = p[0].machine_data) != null && k.backend_version ? r ? r.p(p, g) : (r = M1(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, g) : (s = z1(p), s.c(), s.m(e, n)) : s && (s.d(1), s = null), /*$data*/
      (v = p[1].machine_data) != null && v.basis_gates ? o ? o.p(p, g) : (o = N1(p), o.c(), o.m(e, null)) : o && (o.d(1), o = null);
    },
    d(p) {
      p && C(e), a && a.d(), r && r.d(), s && s.d(), o && o.d();
    }
  };
}
function S1(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), u(l, "class", "svelte-ab2y8n"), u(i, "class", "svelte-ab2y8n");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].machine_data.backend_name + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function M1(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), u(l, "class", "svelte-ab2y8n"), u(i, "class", "svelte-ab2y8n");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].machine_data.backend_version + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function z1(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), u(l, "class", "svelte-ab2y8n"), u(i, "class", "svelte-ab2y8n");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s & /*$data*/
      2 && n !== (n = /*$data*/
      r[1].backend_properties.last_update_date + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function N1(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), u(l, "class", "svelte-ab2y8n"), u(i, "class", "svelte-ab2y8n");
    },
    m(s, o) {
      S(s, e, o), f(e, l), f(e, i), f(i, a);
    },
    p(s, o) {
      var _;
      o & /*$data*/
      2 && n !== (n = /*$data*/
      ((_ = s[1].machine_data.basis_gates) == null ? void 0 : _.join(", ")) + "") && U(a, n);
    },
    d(s) {
      s && C(e);
    }
  };
}
function A1(t) {
  var i;
  let e, l = (
    /*data*/
    ((i = t[0].backend_properties) == null ? void 0 : i.general) && B1(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(n, a) {
      l && l.m(n, a), S(n, e, a);
    },
    p(n, a) {
      var r;
      /*data*/
      (r = n[0].backend_properties) != null && r.general ? l ? l.p(n, a) : (l = B1(n), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    d(n) {
      n && C(e), l && l.d(n);
    }
  };
}
function B1(t) {
  let e, l, i, n, a = $e(Object.keys(
    /*$data*/
    t[1].backend_properties.general
  )), r = [];
  for (let s = 0; s < a.length; s += 1)
    r[s] = P1(j1(t, a, s));
  return {
    c() {
      e = m("table"), l = m("thead"), l.innerHTML = '<tr><th class="svelte-ab2y8n">Name</th> <th class="svelte-ab2y8n">Value</th> <th class="svelte-ab2y8n">Unit</th> <th class="svelte-ab2y8n">As of</th></tr>', i = N(), n = m("tbody");
      for (let s = 0; s < r.length; s += 1)
        r[s].c();
      u(l, "class", "svelte-ab2y8n"), u(e, "class", "svelte-ab2y8n");
    },
    m(s, o) {
      S(s, e, o), f(e, l), f(e, i), f(e, n);
      for (let _ = 0; _ < r.length; _ += 1)
        r[_] && r[_].m(n, null);
    },
    p(s, o) {
      if (o & /*$data, Object*/
      2) {
        a = $e(Object.keys(
          /*$data*/
          s[1].backend_properties.general
        ));
        let _;
        for (_ = 0; _ < a.length; _ += 1) {
          const c = j1(s, a, _);
          r[_] ? r[_].p(c, o) : (r[_] = P1(c), r[_].c(), r[_].m(n, null));
        }
        for (; _ < r.length; _ += 1)
          r[_].d(1);
        r.length = a.length;
      }
    },
    d(s) {
      s && C(e), Ye(r, s);
    }
  };
}
function P1(t) {
  let e, l, i = (
    /*key*/
    t[14] + ""
  ), n, a, r, s = (
    /*$data*/
    t[1].backend_properties.general[
      /*key*/
      t[14]
    ].value + ""
  ), o, _, c, d = (
    /*$data*/
    t[1].backend_properties.general[
      /*key*/
      t[14]
    ].unit + ""
  ), h, p, g, b = (
    /*$data*/
    t[1].backend_properties.general[
      /*key*/
      t[14]
    ].asof + ""
  ), k, y;
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = N(), r = m("td"), o = E(s), _ = N(), c = m("td"), h = E(d), p = N(), g = m("td"), k = E(b), y = N(), u(l, "class", "svelte-ab2y8n"), u(r, "class", "svelte-ab2y8n"), u(c, "class", "svelte-ab2y8n"), u(g, "class", "svelte-ab2y8n");
    },
    m(v, w) {
      S(v, e, w), f(e, l), f(l, n), f(e, a), f(e, r), f(r, o), f(e, _), f(e, c), f(c, h), f(e, p), f(e, g), f(g, k), f(e, y);
    },
    p(v, w) {
      w & /*$data*/
      2 && i !== (i = /*key*/
      v[14] + "") && U(n, i), w & /*$data*/
      2 && s !== (s = /*$data*/
      v[1].backend_properties.general[
        /*key*/
        v[14]
      ].value + "") && U(o, s), w & /*$data*/
      2 && d !== (d = /*$data*/
      v[1].backend_properties.general[
        /*key*/
        v[14]
      ].unit + "") && U(h, d), w & /*$data*/
      2 && b !== (b = /*$data*/
      v[1].backend_properties.general[
        /*key*/
        v[14]
      ].asof + "") && U(k, b);
    },
    d(v) {
      v && C(e);
    }
  };
}
function O1(t) {
  var i;
  let e, l = (
    /*$data*/
    ((i = t[1].backend_properties) == null ? void 0 : i.general_qlists) && E1(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(n, a) {
      l && l.m(n, a), S(n, e, a);
    },
    p(n, a) {
      var r;
      /*$data*/
      (r = n[1].backend_properties) != null && r.general_qlists ? l ? l.p(n, a) : (l = E1(n), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    d(n) {
      n && C(e), l && l.d(n);
    }
  };
}
function E1(t) {
  let e, l = $e(
    /*$data*/
    t[1].backend_properties.general_qlists
  ), i = [];
  for (let n = 0; n < l.length; n += 1)
    i[n] = I1(q1(t, l, n));
  return {
    c() {
      for (let n = 0; n < i.length; n += 1)
        i[n].c();
      e = Ae();
    },
    m(n, a) {
      for (let r = 0; r < i.length; r += 1)
        i[r] && i[r].m(n, a);
      S(n, e, a);
    },
    p(n, a) {
      if (a & /*$data*/
      2) {
        l = $e(
          /*$data*/
          n[1].backend_properties.general_qlists
        );
        let r;
        for (r = 0; r < l.length; r += 1) {
          const s = q1(n, l, r);
          i[r] ? i[r].p(s, a) : (i[r] = I1(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 && C(e), Ye(i, n);
    }
  };
}
function I1(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 = N(), a = m("br"), r = N(), o = E(s);
    },
    m(_, c) {
      S(_, e, c), f(e, i), S(_, n, c), S(_, a, c), S(_, r, c), S(_, o, c);
    },
    p(_, c) {
      c & /*$data*/
      2 && l !== (l = /*a_set*/
      _[11].name + "") && U(i, l), c & /*$data*/
      2 && s !== (s = /*a_set*/
      _[11].qubits.join(", ") + "") && U(o, s);
    },
    d(_) {
      _ && (C(e), C(n), C(a), C(r), C(o));
    }
  };
}
function o6(t) {
  let e, l = (
    /*$data*/
    t[1] && T1(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*$data*/
      i[1] ? l ? l.p(i, n) : (l = T1(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function u6(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (k) => l(1, i = k)), _), r, s, o;
  t.$$.on_destroy.push(() => n());
  let { data: _ = Oe() } = e;
  a();
  let c = Oe(!1), d = Oe(!1), h = Oe(!1);
  at(t, c, (k) => l(2, r = k)), at(t, d, (k) => l(3, s = k)), at(t, h, (k) => l(4, o = k));
  const p = (k) => c.set(!r), g = (k) => d.set(!s), b = (k) => h.set(!o);
  return t.$$set = (k) => {
    "data" in k && a(l(0, _ = k.data));
  }, [
    _,
    i,
    r,
    s,
    o,
    c,
    d,
    h,
    p,
    g,
    b
  ];
}
class f6 extends Ve {
  constructor(e) {
    super(), Qe(this, e, u6, o6, Fe, { data: 0 });
  }
}
const D1 = [
  { 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)" }
], ol = 40, Ut = 300, R1 = 30, cl = 20, H1 = 0.75, _6 = Jt(",d");
function c6(t) {
  var k;
  if (!t)
    return null;
  let e = [], l = (k = Object.keys(t)[0]) == null ? void 0 : k.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((v) => v[y] === "0");
  for (const y of Object.keys(t))
    e.push({
      original_state_vector: y,
      number: parseInt(d6(y), 2),
      count: t[y]
    });
  e.sort((y, v) => y.number - v.number);
  let n = 0, a = Ut + R1, r, s, o, _, c = (e == null ? void 0 : e.length) * cl;
  n = c + ol;
  let d = Math.max(...e.map((y) => y.count)), h = El().domain([0, d]).range([0, Ut]).nice(), p = h.invert(Ut), g = p6(p);
  s = {
    type: "g",
    id: "natural-number-view-y-axis",
    role: "natural-number-view-y-axis",
    width: ol,
    height: Ut,
    x: De,
    y: De,
    elem: [{
      type: "line",
      id: "natural-number-view-y-axis-domain",
      x1: ol - 1,
      x2: ol - 1,
      y1: 0,
      y2: Ut,
      stroke: Me,
      "stroke-width": 1
    }]
  }, o = {
    type: "g",
    id: "natural-number-view-y-axis",
    role: "natural-number-view-y-axis",
    width: c,
    height: Ut,
    x: De + ol,
    y: De,
    elem: []
  }, n += ol;
  for (let y = 0; y <= p; y += g) {
    let v = {
      type: "g",
      id: "natural-number-view-y-axis-tick",
      width: ol,
      x: 0,
      y: Ut - h(y),
      elem: []
    }, w = {
      type: "line",
      x1: ol - 1,
      x2: ol - 6,
      y1: -0.5,
      y2: -0.5,
      stroke: Me,
      "stroke-width": 1
    }, q = {
      type: "text",
      x: ol - 10,
      y: 0,
      "text-anchor": "end",
      "alignment-baseline": "middle",
      text: _6(y),
      "font-size": 12
    };
    v.elem.push(w, q), s.elem.push(v), o.elem.push({
      type: "line",
      x1: 0,
      x2: c,
      y1: Ut - h(y) - 0.5,
      y2: Ut - 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: Ut,
    x: De + ol,
    y: De,
    elem: []
  }, _ = {
    type: "g",
    id: "natural-number-view-x-axis",
    role: "natural-number-view-x-axis",
    width: c,
    height: R1,
    x: De + ol,
    y: De + Ut,
    elem: [{
      type: "line",
      id: "natural-number-view-y-axis-domain",
      x1: 0,
      x2: c,
      y1: -0.5,
      y2: -0.5,
      stroke: Me,
      "stroke-width": 1
    }]
  };
  let b = 0;
  for (let y of e) {
    let v = cl * b, w = h(y.count), q = {
      type: "g",
      id: "natural-number-view-bar-item-" + b,
      role: "natural-number-view-bar--group",
      width: cl,
      height: Ut,
      x: v,
      y: 0,
      elem: [{
        type: "rect",
        id: "natural-number-view-bar-" + b,
        width: cl * H1,
        x: cl * (1 - H1) / 2,
        height: 4,
        y: Ut - w - 2,
        fill: Wt[0],
        "stroke-width": 0
      }, {
        type: "text",
        id: "natural-number-view-bar-count-" + b,
        x: cl / 2,
        y: Ut - 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-" + b,
        role: "natural-number-view-bar-click-wrap",
        width: cl,
        x: 0,
        height: Ut,
        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(q);
    let $ = {
      type: "g",
      id: "natural-number-view-x-axis-group-" + b,
      width: cl,
      height: Ut,
      x: v,
      y: 0,
      elem: [{
        type: "line",
        id: "natural-number-view-x-axis-" + b,
        x1: cl / 2 - 0.5,
        x2: cl / 2 - 0.5,
        y1: 0,
        y2: 5,
        "stroke-width": 1
      }, {
        type: "text",
        id: "natural-number-view-x-axis-marker-" + b,
        role: "natural-number-view-x-axis-marker",
        x: cl / 2,
        y: 15,
        "text-anchor": "middle",
        "alignment-baseline": "middle",
        "font-size": 10,
        text: y.number
      }]
    };
    _.elem.push($), b++;
  }
  return {
    type: "svg",
    width: n + De * 2,
    height: a + De * 2,
    viewBox: [0, 0, n + De * 2, a + De * 2],
    groups: {
      bar_group: r,
      y_axis_group: s,
      y_grid_group: o,
      x_axis_group: _
    }
  };
}
function d6(t) {
  return t.split("").reverse().join("");
}
let h6 = [100, 50, 25, 10, 5, 1];
function p6(t) {
  for (let e of h6)
    if (t % e == 0 && t / e > 1)
      return e;
}
const Bt = 25, Xt = 25, bl = 50, mr = 200, L1 = 15;
function m6(t, e) {
  var g;
  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 b of Object.keys(t)) {
    let k = b6(b);
    i && !k.truth || l.push({
      original_state_vector: b,
      reversed_state_vector: k6(b),
      truth_state: k,
      count: t[b]
    });
  }
  let n = Object.keys(l[0].truth_state.symbols), a = n == null ? void 0 : n.length;
  l.sort((b, k) => k.count - b.count);
  let r = ((g = l[0].original_state_vector) == null ? void 0 : g.length) * 12 * 0.6 + 10, s = r + a * Xt + bl + et + mr + et, o = Bt * ((l == null ? void 0 : l.length) + 1), _, c, d = Math.max(...l.map((b) => b.count)), h = El().domain([0, d]).range([0, mr]).nice();
  _ = {
    type: "g",
    id: "truth-table-header-group",
    role: "truth-table-header-group",
    width: s,
    height: Bt,
    x: De,
    y: De,
    elem: [{
      type: "rect",
      id: "truth-table-header-background",
      role: "truth-table-header-background",
      width: s,
      height: Bt,
      x: 0,
      y: 0,
      fill: it,
      "stroke-width": 0
    }]
  }, _.elem.push({
    type: "line",
    x1: 0.5,
    x2: 0.5,
    y1: 0.5,
    y2: Bt - 0.5,
    "stroke-width": 1,
    stroke: Me
  }), _.elem.push({
    type: "text",
    id: "truth-table-header-symbol-state",
    x: r / 2,
    y: Bt / 2 + 6,
    fill: Me,
    text: "State",
    "font-weight": 700,
    "text-anchor": "middle",
    "alignment-baseline": "bottom"
  }), _.elem.push({
    type: "line",
    x1: r,
    x2: r,
    y1: 0.5,
    y2: Bt - 0.5,
    "stroke-width": 1,
    stroke: Me
  });
  for (let b = 0; b < a; b++)
    _.elem.push({
      type: "text",
      id: "truth-table-header-symbol-" + n[b],
      x: r + Xt * b + Xt / 2,
      y: Bt / 2 + 6,
      fill: Me,
      text: n[b],
      "font-weight": 700,
      "text-anchor": "middle",
      "alignment-baseline": "bottom"
    }), _.elem.push({
      type: "line",
      x1: r + Xt * (b + 1),
      x2: r + Xt * (b + 1),
      y1: 0.5,
      y2: Bt - 0.5,
      "stroke-width": 1,
      stroke: Me
    });
  _.elem.push({
    type: "text",
    id: "truth-table-header-truth",
    x: r + Xt * a + bl / 2,
    y: Bt / 2 + 6,
    fill: Me,
    text: "Truth",
    "font-weight": 700,
    "text-anchor": "middle",
    "alignment-baseline": "bottom"
  }), _.elem.push({
    type: "line",
    x1: r + Xt * a + bl,
    x2: r + Xt * a + bl,
    y1: 0.5,
    y2: Bt - 0.5,
    "stroke-width": 1,
    stroke: Me
  }), _.elem.push({
    type: "text",
    id: "truth-table-header-count",
    x: r + Xt * a + bl + et + mr / 2,
    y: Bt / 2 + 6,
    fill: Me,
    text: "Count",
    "font-weight": 700,
    "text-anchor": "middle",
    "alignment-baseline": "bottom"
  }), _.elem.push({
    type: "line",
    x1: s - 0.5,
    x2: s - 0.5,
    y1: 0.5,
    y2: Bt - 0.5,
    "stroke-width": 1,
    stroke: Me
  }), _.elem.push({
    type: "line",
    x1: 0,
    x2: s,
    y1: Bt - 0.5,
    y2: Bt - 0.5,
    "stroke-width": 1,
    stroke: Me
  }), _.elem.push({
    type: "line",
    x1: 0,
    x2: s,
    y1: 0.5,
    y2: 0.5,
    "stroke-width": 1,
    stroke: Me
  }), c = {
    type: "g",
    id: "truth-table-item-group",
    role: "truth-table-item-group",
    width: s,
    height: Bt * (l == null ? void 0 : l.length),
    x: De,
    y: De + Bt,
    elem: []
  };
  let p = 0;
  for (const b of l) {
    let k = {
      type: "g",
      id: "truth-table-row-group-" + p,
      x: 0,
      y: Bt * p,
      width: s,
      height: Bt,
      elem: [{
        type: "rect",
        x: 0,
        y: 0.5,
        width: s,
        height: Bt - 1,
        fill: it,
        "stroke-width": 0
      }],
      data: {
        tooltip_content: {
          State: b.original_state_vector,
          Symbols: Object.keys(b.truth_state.symbols).join(" "),
          "Symbols-truth": Object.values(b.truth_state.symbols).map((y) => y ? "T" : "F").join(" "),
          Truth: b.truth_state.truth,
          Count: b.count
        }
      }
    };
    k.elem.push({
      type: "line",
      x1: 0.5,
      x2: 0.5,
      y1: 0,
      y2: Bt,
      "stroke-width": 1,
      stroke: Me
    }), k.elem.push({
      type: "text",
      id: "truth-table-row-group-" + p + "-state",
      x: r / 2,
      y: Bt / 2 + 6,
      fill: Me,
      text: b.original_state_vector,
      "text-anchor": "middle",
      "alignment-baseline": "bottom"
    }), k.elem.push({
      type: "line",
      x1: r,
      x2: r,
      y1: 0,
      y2: Bt,
      "stroke-width": 1,
      stroke: Me
    });
    for (let y = 0; y < a; y++)
      k.elem.push({
        type: "text",
        id: "truth-table-row-group-" + p + "-" + n[y],
        x: r + Xt * y + Xt / 2,
        y: Bt / 2 + 6,
        fill: b.truth_state.symbols[n[y]] ? Me : "#999999",
        text: b.truth_state.symbols[n[y]] ? "T" : "F",
        "font-weight": b.truth_state.symbols[n[y]] ? "900" : "400",
        "text-anchor": "middle",
        "alignment-baseline": "bottom"
      }), k.elem.push({
        type: "line",
        x1: r + Xt * (y + 1),
        x2: r + Xt * (y + 1),
        y1: 0,
        y2: Bt,
        "stroke-width": 1,
        stroke: Me
      });
    k.elem.push({
      type: "text",
      id: "truth-table-row-group-" + p + "-truth",
      x: r + Xt * a + bl / 2,
      y: Bt / 2 + 6,
      fill: b.truth_state.truth ? Me : "#999999",
      text: b.truth_state.truth ? "T" : "F",
      "font-weight": b.truth_state.truth ? "700" : "400",
      "text-anchor": "middle",
      "alignment-baseline": "bottom"
    }), k.elem.push({
      type: "line",
      x1: r + Xt * a + bl,
      x2: r + Xt * a + bl,
      y1: 0.5,
      y2: Bt - 0.5,
      "stroke-width": 1,
      stroke: Me
    }), k.elem.push({
      type: "rect",
      id: "truth-table-row-group-" + p + "-count-bar",
      x: r + Xt * a + bl + et,
      y: Bt / 2 - L1 / 2,
      width: h(b.count),
      height: L1,
      fill: Wt[2],
      text: b.count,
      "text-anchor": "end",
      "alignment-baseline": "bottom"
    }), k.elem.push({
      type: "text",
      id: "truth-table-row-group-" + p + "-count",
      x: r + Xt * a + bl + et + 5,
      y: Bt / 2 + 5,
      fill: Me,
      text: b.count,
      "text-anchor": "start",
      "alignment-baseline": "bottom"
    }), k.elem.push({
      type: "line",
      x1: s - 0.5,
      x2: s - 0.5,
      y1: 0.5,
      y2: Bt - 0.5,
      "stroke-width": 1,
      stroke: Me
    }), k.elem.push({
      type: "line",
      x1: 0.5,
      x2: s - 0.5,
      y1: Bt,
      y2: Bt,
      "stroke-width": 1,
      stroke: Me
    }), c.elem.push(k), p++;
  }
  return {
    type: "svg",
    width: s + De * 2,
    height: o + De * 2,
    viewBox: [0, 0, s + De * 2, o + De * 2],
    groups: {
      header_group: _,
      item_group: c
    }
  };
}
let g6 = "abcdefghijklmnopqrstiuvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
function b6(t) {
  let e = t.split(""), l = e[0] === "1", i = e.slice(1).reverse().map((a, r) => [g6[r], a == "1"]), n = {};
  for (const a of i)
    n[a[0]] = a[1];
  return {
    truth: l,
    symbols: n
  };
}
function k6(t) {
  return t.split("").reverse().join("");
}
function v6(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, _) => {
      s[(a - _ - 1).toString()] = o;
    }), l.push(s);
  }
  return l;
}
function y6(t, e) {
  let l = [], i = {};
  if ((e == null ? void 0 : e.length) == 0)
    return {
      data: t,
      sub_total: Pr(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((_) => _ + "0"), o = l.map((_) => _ + "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((_, c) => {
      s[n[c]] = _;
    }), a.push(s);
  }
  return {
    data: a,
    sub_total: Pr(a)
  };
}
function Pr(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 c0(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
      }, g = l[d][h];
      i === "brightness" ? (p.fill = Me, p["fill-opacity"] = (255 - g[0]) / 255) : i === "rgb" && (p.fill = `rgb(${g.map((b) => b).join(", ")})`), o.elem.push(p);
    }
  return {
    type: "svg",
    width: r,
    height: s,
    viewBox: [0, 0, r, s],
    groups: {
      image_group: o
    }
  };
}
function w6(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 _ = i;
  i || (_ = "row");
  let c = e == null ? void 0 : e.magnitude, d = (e == null ? void 0 : e.n_shots) || Object.values(t).reduce((v, w) => v + w, 0), h = [];
  for (let v in t) {
    let w = parseInt(v, 2);
    if (w < l && w < s) {
      let q = t[v];
      h[w] = Math.sqrt(q / d) * c;
    }
  }
  let p = s > 0 ? d0(h, o, _) : [], g = [o[0], o[1]], b = {
    image: h,
    image_pixelized: p,
    data_shape: o,
    image_size: g,
    mode: "brightness",
    dir: _
  }, k = c0(b, e);
  return k.data = b, k;
}
function $6(t, e) {
  var v;
  if (!t)
    return;
  let l = e == null ? void 0 : e.dir, i, n = Math.pow(2, (v = Object.keys(t)[0]) == null ? void 0 : v.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, _ = l;
  l || (_ = "row");
  let c = e == null ? void 0 : e.magnitude, d = (e == null ? void 0 : e.n_shots) || Object.values(t).reduce((w, q) => w + q, 0), h = [];
  for (let w in t) {
    let q = parseInt(w, 2);
    if (q < n && q < s) {
      let $ = t[w];
      h[q] = Math.sqrt($ / d) * c;
    }
  }
  let p = 0;
  for (const w of h)
    h[p] || (h[p] = 0), p++;
  let g = s > 0 ? d0(h, o, _) : [], b = [o[0], o[1]], k = {
    image: h,
    image_pixelized: g,
    data_shape: o,
    image_size: b,
    mode: "rgb",
    dir: _
  }, y = c0(k, e);
  return y.data = k, y;
}
function d0(t, e, l) {
  let i = [], n = e[0], a = e[1], r = e[2], s = [], o = Math.floor(t.length / r);
  for (let _ = 0; _ < r; _++)
    s.push(o * _);
  for (let _ = 0; _ < a; _++)
    i.push(Array.from(Array(n).keys()));
  for (let _ = 0; _ < a; _++)
    for (let c = 0; c < n; c++)
      i[_][c] = [];
  for (let _ = 0; _ < a; _++)
    for (let c = 0; c < n; c++) {
      i[_][c] = [];
      let d = l === "row" ? _ * n + c : c * a + _;
      for (let h = 0; h < r; h++)
        i[_][c].push(t[s[h] + d]);
    }
  return i;
}
function F1(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A = (
    /*$drawPlan*/
    t[4].groups.y_axis_group && Q1(t)
  ), M = (
    /*$drawPlan*/
    t[4].groups.y_axis_group && V1(t)
  ), z = (
    /*$drawPlan*/
    t[4].groups.y_grid_group && X1(t)
  ), H = (
    /*$drawPlan*/
    t[4].groups.bar_group && G1(t)
  ), B = (
    /*$drawPlan*/
    t[4].groups.x_axis_group && Y1(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = Ge("svg"), n = Ge("style"), a = E(`g {
              font-family: Iosevka;
              font-size: 14px;
            }
          `), A && A.c(), d = N(), h = m("div"), p = Ge("svg"), g = Ge("style"), b = E(`g {
              font-family: Iosevka;
              font-size: 14px;
            }
          `), M && M.c(), k = Ae(), z && z.c(), y = Ae(), H && H.c(), v = Ae(), B && B.c(), u(i, "id", r = /*id*/
      t[1] + "-sticky"), u(i, "width", s = /*$drawPlan*/
      t[4].groups.y_axis_group.x + /*$drawPlan*/
      t[4].groups.y_axis_group.width), u(i, "height", o = /*$drawPlan*/
      t[4].height), u(i, "viewBox", _ = /*$drawPlan*/
      t[4].viewBox.map(
        /*func*/
        t[8]
      ).join(" ")), u(l, "class", "count-histogram-sticky svelte-1h6j252"), u(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;`), u(
        p,
        "id",
        /*id*/
        t[1]
      ), u(p, "width", w = /*$drawPlan*/
      t[4].width), u(p, "height", q = /*$drawPlan*/
      t[4].height), u(p, "viewBox", $ = /*$drawPlan*/
      t[4].viewBox.join(" ")), u(h, "class", "count-histogram-main svelte-1h6j252"), u(e, "id", j = /*id*/
      t[1] + "-wrapper"), u(e, "class", "count-histogram-wrapper svelte-1h6j252"), At(e, "position", "relative"), At(e, "width", "100%"), At(e, "overflow-x", "scroll"), At(e, "overflow-y", "hidden");
    },
    m(R, P) {
      S(R, e, P), f(e, l), f(l, i), f(i, n), f(n, a), A && A.m(i, null), f(e, d), f(e, h), f(h, p), f(p, g), f(g, b), M && M.m(p, null), f(p, k), z && z.m(p, null), f(p, y), H && H.m(p, null), f(p, v), B && B.m(p, null), I = !0;
    },
    p(R, P) {
      /*$drawPlan*/
      R[4].groups.y_axis_group ? A ? (A.p(R, P), P & /*$drawPlan*/
      16 && T(A, 1)) : (A = Q1(R), A.c(), T(A, 1), A.m(i, null)) : A && (be(), D(A, 1, 1, () => {
        A = null;
      }), ke()), (!I || P & /*id*/
      2 && r !== (r = /*id*/
      R[1] + "-sticky")) && u(i, "id", r), (!I || P & /*$drawPlan*/
      16 && s !== (s = /*$drawPlan*/
      R[4].groups.y_axis_group.x + /*$drawPlan*/
      R[4].groups.y_axis_group.width)) && u(i, "width", s), (!I || P & /*$drawPlan*/
      16 && o !== (o = /*$drawPlan*/
      R[4].height)) && u(i, "height", o), (!I || P & /*$drawPlan*/
      16 && _ !== (_ = /*$drawPlan*/
      R[4].viewBox.map(
        /*func*/
        R[8]
      ).join(" "))) && u(i, "viewBox", _), (!I || 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;`)) && u(l, "style", c), /*$drawPlan*/
      R[4].groups.y_axis_group ? M ? (M.p(R, P), P & /*$drawPlan*/
      16 && T(M, 1)) : (M = V1(R), M.c(), T(M, 1), M.m(p, k)) : M && (be(), D(M, 1, 1, () => {
        M = null;
      }), ke()), /*$drawPlan*/
      R[4].groups.y_grid_group ? z ? (z.p(R, P), P & /*$drawPlan*/
      16 && T(z, 1)) : (z = X1(R), z.c(), T(z, 1), z.m(p, y)) : z && (be(), D(z, 1, 1, () => {
        z = null;
      }), ke()), /*$drawPlan*/
      R[4].groups.bar_group ? H ? (H.p(R, P), P & /*$drawPlan*/
      16 && T(H, 1)) : (H = G1(R), H.c(), T(H, 1), H.m(p, v)) : H && (be(), D(H, 1, 1, () => {
        H = null;
      }), ke()), /*$drawPlan*/
      R[4].groups.x_axis_group ? B ? (B.p(R, P), P & /*$drawPlan*/
      16 && T(B, 1)) : (B = Y1(R), B.c(), T(B, 1), B.m(p, null)) : B && (be(), D(B, 1, 1, () => {
        B = null;
      }), ke()), (!I || P & /*id*/
      2) && u(
        p,
        "id",
        /*id*/
        R[1]
      ), (!I || P & /*$drawPlan*/
      16 && w !== (w = /*$drawPlan*/
      R[4].width)) && u(p, "width", w), (!I || P & /*$drawPlan*/
      16 && q !== (q = /*$drawPlan*/
      R[4].height)) && u(p, "height", q), (!I || P & /*$drawPlan*/
      16 && $ !== ($ = /*$drawPlan*/
      R[4].viewBox.join(" "))) && u(p, "viewBox", $), (!I || P & /*id*/
      2 && j !== (j = /*id*/
      R[1] + "-wrapper")) && u(e, "id", j);
    },
    i(R) {
      I || (T(A), T(M), T(z), T(H), T(B), I = !0);
    },
    o(R) {
      D(A), D(M), D(z), D(H), D(B), I = !1;
    },
    d(R) {
      R && C(e), A && A.d(), M && M.d(), z && z.d(), H && H.d(), B && B.d();
    }
  };
}
function Q1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.y_axis_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function V1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.y_axis_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function X1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.y_grid_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function G1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.bar_group
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Y1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.x_axis_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function q6(t) {
  let e;
  return {
    c() {
      e = m("div"), e.textContent = "Hover or click an item to see details", u(e, "class", "g-tooltip deactive svelte-1h6j252");
    },
    m(l, i) {
      S(l, e, i);
    },
    p: ne,
    d(l) {
      l && C(e);
    }
  };
}
function j6(t) {
  let e;
  return {
    c() {
      e = m("div"), u(e, "class", "g-tooltip svelte-1h6j252");
    },
    m(l, i) {
      S(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 && C(e);
    }
  };
}
function T6(t) {
  var _;
  let e, l, i, n, a = (
    /*$drawPlan*/
    ((_ = t[4]) == null ? void 0 : _.groups) && F1(t)
  );
  function r(c, d) {
    return (
      /*showTooltip*/
      c[2] ? j6 : q6
    );
  }
  let s = r(t), o = s(t);
  return {
    c() {
      e = m("div"), a && a.c(), l = N(), i = m("div"), o.c(), u(e, "class", "content-wrap"), u(i, "class", "tooltip-space svelte-1h6j252");
    },
    m(c, d) {
      S(c, e, d), a && a.m(e, null), S(c, l, d), S(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 && T(a, 1)) : (a = F1(c), a.c(), T(a, 1), a.m(e, null)) : a && (be(), D(a, 1, 1, () => {
        a = null;
      }), ke()), 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 || (T(a), n = !0);
    },
    o(c) {
      D(a), n = !1;
    },
    d(c) {
      c && (C(e), C(l), C(i)), a && a.d(), o.d();
    }
  };
}
function C6(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(r, (k) => l(4, i = k)), r);
  t.$$.on_destroy.push(() => n());
  let { drawPlan: r = Oe(), id: s = "natural-number-view" } = e;
  a();
  let o = !1, _, c = !1, d = 999;
  function h(k, y, v, w) {
    c && !v || d < w || (l(2, o = !0), k.clientX + 5, k.clientY + 5, l(3, _ = y), c = v, d = w || 0);
  }
  function p(k) {
    o && (k.clientX + 5, k.clientY + 5);
  }
  function g(k) {
    c || l(2, o = !1), k && (l(2, o = !1), d = 999);
  }
  const b = (k, y) => y == 2 ? i.groups.y_axis_group.x + i.groups.y_axis_group.width : k;
  return t.$$set = (k) => {
    "drawPlan" in k && a(l(0, r = k.drawPlan)), "id" in k && l(1, s = k.id);
  }, [
    r,
    s,
    o,
    _,
    i,
    h,
    p,
    g,
    b
  ];
}
class S6 extends Ve {
  constructor(e) {
    super(), Qe(this, e, C6, T6, Fe, { drawPlan: 0, id: 1 });
  }
}
function K1(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j = (
    /*$drawPlan*/
    t[4].groups.header_group && U1(t)
  ), I = (
    /*$drawPlan*/
    t[4].groups.header_group && W1(t)
  ), A = (
    /*$drawPlan*/
    t[4].groups.item_group && J1(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = Ge("svg"), n = Ge("style"), a = E(`g {
              font-family: Iosevka;
              font-size: 14px;
            }
          `), j && j.c(), d = N(), h = m("div"), p = Ge("svg"), g = Ge("style"), b = E(`g {
              font-family: Iosevka;
              font-size: 14px;
            }
          `), I && I.c(), k = Ae(), A && A.c(), u(i, "id", r = /*id*/
      t[1] + "-sticky"), u(i, "width", s = /*$drawPlan*/
      t[4].width + De * 2), u(i, "height", o = /*$drawPlan*/
      t[4].groups.header_group.height + De), u(i, "viewBox", _ = [
        0,
        0,
        /*$drawPlan*/
        t[4].width + De * 2,
        /*$drawPlan*/
        t[4].groups.header_group.height + De
      ].join(" ")), u(l, "class", "count-histogram-sticky svelte-x1kk7w"), u(l, "style", c = `width: ${/*$drawPlan*/
      t[4].width + De * 2}px; height:${/*$drawPlan*/
      t[4].groups.header_group.height + De}px;`), u(
        p,
        "id",
        /*id*/
        t[1]
      ), u(p, "width", y = /*$drawPlan*/
      t[4].width), u(p, "height", v = /*$drawPlan*/
      t[4].height), u(p, "viewBox", w = /*$drawPlan*/
      t[4].viewBox.join(" ")), u(h, "class", "count-histogram-main svelte-x1kk7w"), u(e, "id", q = /*id*/
      t[1] + "-wrapper"), u(e, "class", "count-histogram-wrapper svelte-x1kk7w"), At(e, "position", "relative"), At(e, "width", "100%"), At(e, "overflow-x", "scroll"), At(e, "overflow-y", "hidden");
    },
    m(M, z) {
      S(M, e, z), f(e, l), f(l, i), f(i, n), f(n, a), j && j.m(i, null), f(e, d), f(e, h), f(h, p), f(p, g), f(g, b), I && I.m(p, null), f(p, k), A && A.m(p, null), $ = !0;
    },
    p(M, z) {
      /*$drawPlan*/
      M[4].groups.header_group ? j ? (j.p(M, z), z & /*$drawPlan*/
      16 && T(j, 1)) : (j = U1(M), j.c(), T(j, 1), j.m(i, null)) : j && (be(), D(j, 1, 1, () => {
        j = null;
      }), ke()), (!$ || z & /*id*/
      2 && r !== (r = /*id*/
      M[1] + "-sticky")) && u(i, "id", r), (!$ || z & /*$drawPlan*/
      16 && s !== (s = /*$drawPlan*/
      M[4].width + De * 2)) && u(i, "width", s), (!$ || z & /*$drawPlan*/
      16 && o !== (o = /*$drawPlan*/
      M[4].groups.header_group.height + De)) && u(i, "height", o), (!$ || z & /*$drawPlan*/
      16 && _ !== (_ = [
        0,
        0,
        /*$drawPlan*/
        M[4].width + De * 2,
        /*$drawPlan*/
        M[4].groups.header_group.height + De
      ].join(" "))) && u(i, "viewBox", _), (!$ || z & /*$drawPlan*/
      16 && c !== (c = `width: ${/*$drawPlan*/
      M[4].width + De * 2}px; height:${/*$drawPlan*/
      M[4].groups.header_group.height + De}px;`)) && u(l, "style", c), /*$drawPlan*/
      M[4].groups.header_group ? I ? (I.p(M, z), z & /*$drawPlan*/
      16 && T(I, 1)) : (I = W1(M), I.c(), T(I, 1), I.m(p, k)) : I && (be(), D(I, 1, 1, () => {
        I = null;
      }), ke()), /*$drawPlan*/
      M[4].groups.item_group ? A ? (A.p(M, z), z & /*$drawPlan*/
      16 && T(A, 1)) : (A = J1(M), A.c(), T(A, 1), A.m(p, null)) : A && (be(), D(A, 1, 1, () => {
        A = null;
      }), ke()), (!$ || z & /*id*/
      2) && u(
        p,
        "id",
        /*id*/
        M[1]
      ), (!$ || z & /*$drawPlan*/
      16 && y !== (y = /*$drawPlan*/
      M[4].width)) && u(p, "width", y), (!$ || z & /*$drawPlan*/
      16 && v !== (v = /*$drawPlan*/
      M[4].height)) && u(p, "height", v), (!$ || z & /*$drawPlan*/
      16 && w !== (w = /*$drawPlan*/
      M[4].viewBox.join(" "))) && u(p, "viewBox", w), (!$ || z & /*id*/
      2 && q !== (q = /*id*/
      M[1] + "-wrapper")) && u(e, "id", q);
    },
    i(M) {
      $ || (T(j), T(I), T(A), $ = !0);
    },
    o(M) {
      D(j), D(I), D(A), $ = !1;
    },
    d(M) {
      M && C(e), j && j.d(), I && I.d(), A && A.d();
    }
  };
}
function U1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.header_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function W1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.header_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function J1(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[4].groups.item_group
      ),
      openTooltip: (
        /*openTooltip*/
        t[5]
      ),
      closeTooltip: (
        /*closeTooltip*/
        t[7]
      ),
      moveTooltip: (
        /*moveTooltip*/
        t[6]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function M6(t) {
  let e;
  return {
    c() {
      e = m("div"), e.textContent = "Hover or click an item to see details", u(e, "class", "g-tooltip deactive svelte-x1kk7w");
    },
    m(l, i) {
      S(l, e, i);
    },
    p: ne,
    d(l) {
      l && C(e);
    }
  };
}
function z6(t) {
  let e;
  return {
    c() {
      e = m("div"), u(e, "class", "g-tooltip svelte-x1kk7w");
    },
    m(l, i) {
      S(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 && C(e);
    }
  };
}
function N6(t) {
  var _;
  let e, l, i, n, a = (
    /*$drawPlan*/
    ((_ = t[4]) == null ? void 0 : _.groups) && K1(t)
  );
  function r(c, d) {
    return (
      /*showTooltip*/
      c[2] ? z6 : M6
    );
  }
  let s = r(t), o = s(t);
  return {
    c() {
      e = m("div"), a && a.c(), l = N(), i = m("div"), o.c(), u(e, "class", "content-wrap svelte-x1kk7w"), u(i, "class", "tooltip-space svelte-x1kk7w");
    },
    m(c, d) {
      S(c, e, d), a && a.m(e, null), S(c, l, d), S(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 && T(a, 1)) : (a = K1(c), a.c(), T(a, 1), a.m(e, null)) : a && (be(), D(a, 1, 1, () => {
        a = null;
      }), ke()), 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 || (T(a), n = !0);
    },
    o(c) {
      D(a), n = !1;
    },
    d(c) {
      c && (C(e), C(l), C(i)), a && a.d(), o.d();
    }
  };
}
function A6(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(r, (b) => l(4, i = b)), r);
  t.$$.on_destroy.push(() => n());
  let { drawPlan: r = Oe(), id: s = "natural-number-view" } = e;
  a();
  let o = !1, _, c = !1, d = 999;
  function h(b, k, y, v) {
    c && !y || d < v || (l(2, o = !0), b.clientX + 5, b.clientY + 5, l(3, _ = k), c = y, d = v || 0);
  }
  function p(b) {
    o && (b.clientX + 5, b.clientY + 5);
  }
  function g(b) {
    c || l(2, o = !1), b && (l(2, o = !1), d = 999);
  }
  return t.$$set = (b) => {
    "drawPlan" in b && a(l(0, r = b.drawPlan)), "id" in b && l(1, s = b.id);
  }, [
    r,
    s,
    o,
    _,
    i,
    h,
    p,
    g
  ];
}
class B6 extends Ve {
  constructor(e) {
    super(), Qe(this, e, A6, N6, Fe, { drawPlan: 0, id: 1 });
  }
}
function Z1(t, e, l) {
  const i = t.slice();
  return i[17] = e[l], i[19] = l, i;
}
function x1(t, e, l) {
  const i = t.slice();
  return i[17] = e[l], i[19] = l, i;
}
function ep(t, e, l) {
  const i = t.slice();
  return i[21] = e[l], i[23] = l, i;
}
function tp(t, e, l) {
  const i = t.slice();
  return i[21] = e[l], i[23] = l, i;
}
function lp(t, e, l) {
  const i = t.slice();
  return i[21] = e[l], i[23] = l, i;
}
function ip(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R, P, O, F, L, X = $e(
    /*$clbits*/
    t[4]
  ), V = [];
  for (let W = 0; W < X.length; W += 1)
    V[W] = np(lp(t, X, W));
  let Q = $e(
    /*$clbits*/
    t[4]
  ), Z = [];
  for (let W = 0; W < Q.length; W += 1)
    Z[W] = ap(tp(t, Q, W));
  let ae = $e(
    /*$data_to_show*/
    t[3]
  ), se = [];
  for (let W = 0; W < ae.length; W += 1)
    se[W] = sp(x1(t, ae, W));
  let K = $e(
    /*$sub_totals*/
    t[7]
  ), Y = [];
  for (let W = 0; W < K.length; W += 1)
    Y[W] = op(Z1(t, K, W));
  return {
    c() {
      e = m("div"), l = m("h5"), l.textContent = "Pivot by states", i = N(), n = m("div");
      for (let W = 0; W < V.length; W += 1)
        V[W].c();
      a = N(), r = m("div"), s = m("button"), s.textContent = "Clear all", o = N(), _ = m("div"), c = m("div"), d = m("h5"), d.textContent = "Counts", h = N(), p = m("table"), g = m("thead"), b = m("tr"), k = m("th"), k.textContent = "State", y = N();
      for (let W = 0; W < Z.length; W += 1)
        Z[W].c();
      v = N(), w = m("th"), w.textContent = "Count", q = N(), $ = m("tbody");
      for (let W = 0; W < se.length; W += 1)
        se[W].c();
      I = N(), A = m("div"), M = m("h5"), M.textContent = "Subtotals", z = N(), 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 = N(), P = m("tbody");
      for (let W = 0; W < Y.length; W += 1)
        Y[W].c();
      u(l, "class", "svelte-2hdyso"), u(s, "class", "svelte-2hdyso"), u(n, "class", "pivot-wrap svelte-2hdyso"), u(d, "class", "svelte-2hdyso"), u(k, "class", "svelte-2hdyso"), u(w, "class", "svelte-2hdyso"), u(g, "class", "svelte-2hdyso"), u(p, "class", "svelte-2hdyso"), u(c, "id", j = /*id*/
      t[1] + "-wrapper"), u(c, "class", "pivot-table-wrapper svelte-2hdyso"), u(M, "class", "svelte-2hdyso"), u(B, "class", "svelte-2hdyso"), u(H, "class", "svelte-2hdyso"), u(A, "id", O = /*id*/
      t[1] + "-sub-total"), u(A, "class", "pivot-table-wrapper svelte-2hdyso"), u(_, "class", "tables svelte-2hdyso");
    },
    m(W, J) {
      S(W, e, J), f(e, l), f(e, i), f(e, n);
      for (let ee = 0; ee < V.length; ee += 1)
        V[ee] && V[ee].m(n, null);
      f(n, a), f(n, r), f(r, s), S(W, o, J), S(W, _, J), f(_, c), f(c, d), f(c, h), f(c, p), f(p, g), f(g, b), f(b, k), f(b, y);
      for (let ee = 0; ee < Z.length; ee += 1)
        Z[ee] && Z[ee].m(b, null);
      f(b, v), f(b, w), f(p, q), f(p, $);
      for (let ee = 0; ee < se.length; ee += 1)
        se[ee] && se[ee].m($, null);
      f(_, I), f(_, A), f(A, M), f(A, z), f(A, H), f(H, B), f(H, R), f(H, P);
      for (let ee = 0; ee < Y.length; ee += 1)
        Y[ee] && Y[ee].m(P, null);
      F || (L = te(
        s,
        "click",
        /*click_handler*/
        t[14]
      ), F = !0);
    },
    p(W, J) {
      if (J & /*$clbits, $pivot, pivot, pivot_set*/
      1584) {
        X = $e(
          /*$clbits*/
          W[4]
        );
        let ee;
        for (ee = 0; ee < X.length; ee += 1) {
          const we = lp(W, X, ee);
          V[ee] ? V[ee].p(we, J) : (V[ee] = np(we), V[ee].c(), V[ee].m(n, a));
        }
        for (; ee < V.length; ee += 1)
          V[ee].d(1);
        V.length = X.length;
      }
      if (J & /*$clbits*/
      16) {
        Q = $e(
          /*$clbits*/
          W[4]
        );
        let ee;
        for (ee = 0; ee < Q.length; ee += 1) {
          const we = tp(W, Q, ee);
          Z[ee] ? Z[ee].p(we, J) : (Z[ee] = ap(we), Z[ee].c(), Z[ee].m(b, v));
        }
        for (; ee < Z.length; ee += 1)
          Z[ee].d(1);
        Z.length = Q.length;
      }
      if (J & /*$data_to_show, $clbits, $pivot_set*/
      88) {
        ae = $e(
          /*$data_to_show*/
          W[3]
        );
        let ee;
        for (ee = 0; ee < ae.length; ee += 1) {
          const we = x1(W, ae, ee);
          se[ee] ? se[ee].p(we, J) : (se[ee] = sp(we), se[ee].c(), se[ee].m($, null));
        }
        for (; ee < se.length; ee += 1)
          se[ee].d(1);
        se.length = ae.length;
      }
      if (J & /*id*/
      2 && j !== (j = /*id*/
      W[1] + "-wrapper") && u(c, "id", j), J & /*$sub_totals*/
      128) {
        K = $e(
          /*$sub_totals*/
          W[7]
        );
        let ee;
        for (ee = 0; ee < K.length; ee += 1) {
          const we = Z1(W, K, ee);
          Y[ee] ? Y[ee].p(we, J) : (Y[ee] = op(we), Y[ee].c(), Y[ee].m(P, null));
        }
        for (; ee < Y.length; ee += 1)
          Y[ee].d(1);
        Y.length = K.length;
      }
      J & /*id*/
      2 && O !== (O = /*id*/
      W[1] + "-sub-total") && u(A, "id", O);
    },
    d(W) {
      W && (C(e), C(o), C(_)), Ye(V, W), Ye(Z, W), Ye(se, W), Ye(Y, W), F = !1, L();
    }
  };
}
function np(t) {
  let e, l, i, n, a, r, s = (
    /*bit*/
    t[21] + ""
  ), o, _, c, d;
  function h(...p) {
    return (
      /*change_handler*/
      t[13](
        /*bit*/
        t[21],
        ...p
      )
    );
  }
  return {
    c() {
      e = m("div"), l = m("input"), a = N(), r = m("label"), o = E(s), u(l, "id", i = "pivot-by-" + /*bit*/
      t[21]), u(l, "type", "checkbox"), l.checked = n = /*$pivot*/
      t[5][
        /*bit*/
        t[21]
      ], u(r, "for", _ = "pivot-by-" + /*bit*/
      t[21]), u(r, "class", "svelte-2hdyso"), u(e, "class", "input-wrap svelte-2hdyso");
    },
    m(p, g) {
      S(p, e, g), f(e, l), f(e, a), f(e, r), f(r, o), c || (d = te(l, "change", h), c = !0);
    },
    p(p, g) {
      t = p, g & /*$clbits*/
      16 && i !== (i = "pivot-by-" + /*bit*/
      t[21]) && u(l, "id", i), g & /*$pivot, $clbits*/
      48 && n !== (n = /*$pivot*/
      t[5][
        /*bit*/
        t[21]
      ]) && (l.checked = n), g & /*$clbits*/
      16 && s !== (s = /*bit*/
      t[21] + "") && U(o, s), g & /*$clbits*/
      16 && _ !== (_ = "pivot-by-" + /*bit*/
      t[21]) && u(r, "for", _);
    },
    d(p) {
      p && C(e), c = !1, d();
    }
  };
}
function ap(t) {
  let e, l = (
    /*bit*/
    t[21] + ""
  ), i;
  return {
    c() {
      e = m("th"), i = E(l), u(e, "class", "svelte-2hdyso");
    },
    m(n, a) {
      S(n, e, a), f(e, i);
    },
    p(n, a) {
      a & /*$clbits*/
      16 && l !== (l = /*bit*/
      n[21] + "") && U(i, l);
    },
    d(n) {
      n && C(e);
    }
  };
}
function P6(t) {
  let e = (
    /*row*/
    t[17].state + ""
  ), l;
  return {
    c() {
      l = E(e);
    },
    m(i, n) {
      S(i, l, n);
    },
    p(i, n) {
      n & /*$data_to_show*/
      8 && e !== (e = /*row*/
      i[17].state + "") && U(l, e);
    },
    d(i) {
      i && C(l);
    }
  };
}
function O6(t) {
  let e;
  return {
    c() {
      e = E("-");
    },
    m(l, i) {
      S(l, e, i);
    },
    p: ne,
    d(l) {
      l && C(e);
    }
  };
}
function E6(t) {
  let e;
  return {
    c() {
      e = E("-");
    },
    m(l, i) {
      S(l, e, i);
    },
    p: ne,
    d(l) {
      l && C(e);
    }
  };
}
function I6(t) {
  let e = (
    /*row*/
    t[17][
      /*bit*/
      t[21]
    ] + ""
  ), l;
  return {
    c() {
      l = E(e);
    },
    m(i, n) {
      S(i, l, n);
    },
    p(i, n) {
      n & /*$data_to_show, $clbits*/
      24 && e !== (e = /*row*/
      i[17][
        /*bit*/
        i[21]
      ] + "") && U(l, e);
    },
    d(i) {
      i && C(l);
    }
  };
}
function D6(t) {
  let e = (
    /*row*/
    t[17][
      /*bit*/
      t[21]
    ] + ""
  ), l;
  return {
    c() {
      l = E(e);
    },
    m(i, n) {
      S(i, l, n);
    },
    p(i, n) {
      n & /*$data_to_show, $clbits*/
      24 && e !== (e = /*row*/
      i[17][
        /*bit*/
        i[21]
      ] + "") && U(l, e);
    },
    d(i) {
      i && C(l);
    }
  };
}
function rp(t) {
  let e, l;
  function i(r, s) {
    var o, _;
    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 ? D6 : (
      /*$pivot_set*/
      ((_ = r[6]) == null ? void 0 : _.length) == 0 ? I6 : E6
    );
  }
  let n = i(t, -1), a = n(t);
  return {
    c() {
      e = m("td"), a.c(), u(e, "class", "svelte-2hdyso");
    },
    m(r, s) {
      S(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 && C(e), a.d();
    }
  };
}
function sp(t) {
  let e, l, i, n, a, r = (
    /*row*/
    t[17].count + ""
  ), s, o;
  function _(g, b) {
    var k;
    return (
      /*$pivot_set*/
      ((k = g[6]) == null ? void 0 : k.length) > 0 ? O6 : P6
    );
  }
  let c = _(t), d = c(t), h = $e(
    /*$clbits*/
    t[4]
  ), p = [];
  for (let g = 0; g < h.length; g += 1)
    p[g] = rp(ep(t, h, g));
  return {
    c() {
      e = m("tr"), l = m("th"), d.c(), i = N();
      for (let g = 0; g < p.length; g += 1)
        p[g].c();
      n = N(), a = m("td"), s = E(r), o = N(), u(l, "class", "svelte-2hdyso"), u(a, "class", "svelte-2hdyso");
    },
    m(g, b) {
      S(g, e, b), f(e, l), d.m(l, null), f(e, i);
      for (let k = 0; k < p.length; k += 1)
        p[k] && p[k].m(e, null);
      f(e, n), f(e, a), f(a, s), f(e, o);
    },
    p(g, b) {
      if (c === (c = _(g)) && d ? d.p(g, b) : (d.d(1), d = c(g), d && (d.c(), d.m(l, null))), b & /*$data_to_show, $clbits, $pivot_set*/
      88) {
        h = $e(
          /*$clbits*/
          g[4]
        );
        let k;
        for (k = 0; k < h.length; k += 1) {
          const y = ep(g, h, k);
          p[k] ? p[k].p(y, b) : (p[k] = rp(y), p[k].c(), p[k].m(e, n));
        }
        for (; k < p.length; k += 1)
          p[k].d(1);
        p.length = h.length;
      }
      b & /*$data_to_show*/
      8 && r !== (r = /*row*/
      g[17].count + "") && U(s, r);
    },
    d(g) {
      g && C(e), d.d(), Ye(p, g);
    }
  };
}
function op(t) {
  let e, l, i = (
    /*row*/
    t[17].bit + ""
  ), n, a, r, s = (
    /*row*/
    t[17][0] + ""
  ), o, _, c, d = (
    /*row*/
    t[17][1] + ""
  ), h, p, g, b = (
    /*row*/
    t[17][0] + /*row*/
    t[17][1] + ""
  ), k, y;
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = N(), r = m("td"), o = E(s), _ = N(), c = m("td"), h = E(d), p = N(), g = m("td"), k = E(b), y = N(), u(l, "class", "svelte-2hdyso"), u(r, "class", "svelte-2hdyso"), u(c, "class", "svelte-2hdyso"), u(g, "class", "svelte-2hdyso");
    },
    m(v, w) {
      S(v, e, w), f(e, l), f(l, n), f(e, a), f(e, r), f(r, o), f(e, _), f(e, c), f(c, h), f(e, p), f(e, g), f(g, k), f(e, y);
    },
    p(v, w) {
      w & /*$sub_totals*/
      128 && i !== (i = /*row*/
      v[17].bit + "") && U(n, i), w & /*$sub_totals*/
      128 && s !== (s = /*row*/
      v[17][0] + "") && U(o, s), w & /*$sub_totals*/
      128 && d !== (d = /*row*/
      v[17][1] + "") && U(h, d), w & /*$sub_totals*/
      128 && b !== (b = /*row*/
      v[17][0] + /*row*/
      v[17][1] + "") && U(k, b);
    },
    d(v) {
      v && C(e);
    }
  };
}
function R6(t) {
  let e, l = (
    /*$data_to_show*/
    t[3] && ip(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*$data_to_show*/
      i[3] ? l ? l.p(i, n) : (l = ip(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function H6(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(g, (A) => l(15, i = A)), g), r, s = ne, o = () => (s(), s = st(k, (A) => l(16, r = A)), k), _, c, d, h, p;
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => s());
  let { drawPlan: g = Oe(), id: b = "pivot-table-view", problem_type: k = Oe() } = e;
  a(), o();
  let y = Oe(), v = Oe({}), w = Oe([]), q = Oe([]), $ = Oe([]);
  at(t, y, (A) => l(3, _ = A)), at(t, v, (A) => l(5, d = A)), at(t, w, (A) => l(6, h = A)), at(t, q, (A) => l(4, c = A)), at(t, $, (A) => l(7, p = A)), Tt(() => {
    g.subscribe((A) => {
      if (r === "pivot_table") {
        y.set(A), $.set(Pr(A));
        let M = {};
        Object.keys(A[0]).filter((z) => !isNaN(parseInt(z))).forEach((z) => {
          M[z] = !1;
        }), v.set(M), q.set(Object.keys(M));
      }
    }), w.subscribe((A) => {
      if (r === "pivot_table") {
        let { data: M, sub_total: z } = y6(i, A);
        y.set(M), $.set(z);
      }
    });
  });
  const j = (A, M) => {
    v.update((z) => (z[A] = M.target.checked, z)), w.update((z) => (M.target.checked ? z.includes(A) || z.push(A) : z.includes(A) && z.splice(z.indexOf(A), 1), z));
  }, I = (A) => {
    w.set([]), v.update((M) => (Object.keys(M).forEach((z) => {
      M[z] = !1;
    }), M));
  };
  return t.$$set = (A) => {
    "drawPlan" in A && a(l(0, g = A.drawPlan)), "id" in A && l(1, b = A.id), "problem_type" in A && o(l(2, k = A.problem_type));
  }, [
    g,
    b,
    k,
    _,
    c,
    d,
    h,
    p,
    y,
    v,
    w,
    q,
    $,
    j,
    I
  ];
}
class L6 extends Ve {
  constructor(e) {
    super(), Qe(this, e, H6, R6, Fe, { drawPlan: 0, id: 1, problem_type: 2 });
  }
}
function up(t) {
  let e, l, i, n, a, r, s, o, _, c, d = (
    /*$drawPlan*/
    t[2].groups.image_group && fp(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = Ge("svg"), n = Ge("style"), a = E(`g {
              font-family: Iosevka;
              font-size: 14px;
            }
          `), d && d.c(), u(
        i,
        "id",
        /*id*/
        t[1]
      ), u(i, "width", r = /*$drawPlan*/
      t[2].width), u(i, "height", s = /*$drawPlan*/
      t[2].height), u(i, "viewBox", o = /*$drawPlan*/
      t[2].viewBox.join(" ")), u(l, "class", "image-view-main"), u(e, "id", _ = /*id*/
      t[1] + "-wrapper"), u(e, "class", "image-view-wrapper"), At(e, "position", "relative"), At(e, "width", "100%"), At(e, "overflow-x", "scroll"), At(e, "overflow-y", "hidden");
    },
    m(h, p) {
      S(h, e, p), f(e, l), f(l, i), f(i, n), f(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 && T(d, 1)) : (d = fp(h), d.c(), T(d, 1), d.m(i, null)) : d && (be(), D(d, 1, 1, () => {
        d = null;
      }), ke()), (!c || p & /*id*/
      2) && u(
        i,
        "id",
        /*id*/
        h[1]
      ), (!c || p & /*$drawPlan*/
      4 && r !== (r = /*$drawPlan*/
      h[2].width)) && u(i, "width", r), (!c || p & /*$drawPlan*/
      4 && s !== (s = /*$drawPlan*/
      h[2].height)) && u(i, "height", s), (!c || p & /*$drawPlan*/
      4 && o !== (o = /*$drawPlan*/
      h[2].viewBox.join(" "))) && u(i, "viewBox", o), (!c || p & /*id*/
      2 && _ !== (_ = /*id*/
      h[1] + "-wrapper")) && u(e, "id", _);
    },
    i(h) {
      c || (T(d), c = !0);
    },
    o(h) {
      D(d), c = !1;
    },
    d(h) {
      h && C(e), d && d.d();
    }
  };
}
function fp(t) {
  let e, l;
  return e = new kt({
    props: {
      data: (
        /*$drawPlan*/
        t[2].groups.image_group
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function F6(t) {
  var n;
  let e, l, i = (
    /*$drawPlan*/
    ((n = t[2]) == null ? void 0 : n.groups) && up(t)
  );
  return {
    c() {
      e = m("div"), i && i.c(), u(e, "class", "content-wrap");
    },
    m(a, r) {
      S(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 && T(i, 1)) : (i = up(a), i.c(), T(i, 1), i.m(e, null)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(a) {
      l || (T(i), l = !0);
    },
    o(a) {
      D(i), l = !1;
    },
    d(a) {
      a && C(e), i && i.d();
    }
  };
}
function Q6(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(r, (_) => l(2, i = _)), r);
  t.$$.on_destroy.push(() => n());
  let { drawPlan: r = Oe(), id: s = "image-view", problem_type: o = Oe() } = e;
  return a(), Tt(() => {
    console.log(i);
  }), t.$$set = (_) => {
    "drawPlan" in _ && a(l(0, r = _.drawPlan)), "id" in _ && l(1, s = _.id), "problem_type" in _ && l(3, o = _.problem_type);
  }, [r, s, i, o];
}
class V6 extends Ve {
  constructor(e) {
    super(), Qe(this, e, Q6, F6, Fe, { drawPlan: 0, id: 1, problem_type: 3 });
  }
}
function _p(t, e, l) {
  const i = t.slice();
  return i[30] = e[l], i;
}
function cp(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[7] ? "Show" : "Hide"
  ), r, s, o, _, c, d, h, p, g, b = (
    /*images*/
    t[3]["problem-number"] && dp(t)
  ), k = !/*$hide1*/
  t[7] && hp(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`Problem-specific results view

      `), n = m("button"), r = E(a), s = N(), o = m("button"), o.textContent = "Image", _ = N(), b && b.c(), c = N(), d = m("div"), k && k.c(), u(o, "class", "save-make svelte-18o3ak5"), u(d, "class", "content-wrap"), u(e, "class", "panel svelte-18o3ak5");
    },
    m(y, v) {
      S(y, e, v), f(e, l), f(l, i), f(l, n), f(n, r), f(l, s), f(l, o), f(l, _), b && b.m(l, null), f(e, c), f(e, d), k && k.m(d, null), h = !0, p || (g = [
        te(
          n,
          "click",
          /*click_handler*/
          t[13]
        ),
        te(
          o,
          "click",
          /*click_handler_1*/
          t[14]
        )
      ], p = !0);
    },
    p(y, v) {
      (!h || v[0] & /*$hide1*/
      128) && a !== (a = /*$hide1*/
      y[7] ? "Show" : "Hide") && U(r, a), /*images*/
      y[3]["problem-number"] ? b ? b.p(y, v) : (b = dp(y), b.c(), b.m(l, null)) : b && (b.d(1), b = null), /*$hide1*/
      y[7] ? k && (be(), D(k, 1, 1, () => {
        k = null;
      }), ke()) : k ? (k.p(y, v), v[0] & /*$hide1*/
      128 && T(k, 1)) : (k = hp(y), k.c(), T(k, 1), k.m(d, null));
    },
    i(y) {
      h || (T(k), h = !0);
    },
    o(y) {
      D(k), h = !1;
    },
    d(y) {
      y && C(e), b && b.d(), k && k.d(), p = !1, wt(g);
    }
  };
}
function dp(t) {
  let e, l, i, n, a, r, s;
  return {
    c() {
      e = m("a"), l = E("PNG"), n = N(), a = m("a"), r = E("SVG"), u(e, "class", "save-download svelte-18o3ak5"), u(e, "href", i = /*images*/
      t[3]["problem-number"].png), u(e, "download", ""), u(a, "class", "save-download svelte-18o3ak5"), u(a, "href", s = /*images*/
      t[3]["problem-number"].svg), u(a, "download", "");
    },
    m(o, _) {
      S(o, e, _), f(e, l), S(o, n, _), S(o, a, _), f(a, r);
    },
    p(o, _) {
      _[0] & /*images*/
      8 && i !== (i = /*images*/
      o[3]["problem-number"].png) && u(e, "href", i), _[0] & /*images*/
      8 && s !== (s = /*images*/
      o[3]["problem-number"].svg) && u(a, "href", s);
    },
    d(o) {
      o && (C(e), C(n), C(a));
    }
  };
}
function hp(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h = $e(D1), p = [];
  for (let v = 0; v < h.length; v += 1)
    p[v] = pp(_p(t, h, v));
  function g(v, w) {
    if (
      /*$problem_type*/
      v[5] === "truth_table"
    )
      return G6;
    if (
      /*$problem_type*/
      v[5] === "image_1d" || /*$problem_type*/
      v[5] === "image_3d"
    )
      return X6;
  }
  let b = g(t), k = b && b(t), y = (
    /*$drawPlan*/
    t[8] && gp(t)
  );
  return {
    c() {
      e = m("div"), l = m("label"), l.textContent = "Choose a problem type:", i = N(), n = m("select"), a = m("option");
      for (let v = 0; v < p.length; v += 1)
        p[v].c();
      r = N(), k && k.c(), s = N(), o = m("div"), y && y.c(), u(l, "for", "problem-type"), u(l, "class", "svelte-18o3ak5"), a.__value = null, pt(a, a.__value), u(n, "id", "problem-type"), u(n, "class", "svelte-18o3ak5"), u(e, "class", "input-wrap svelte-18o3ak5"), u(o, "class", "vis-wrap");
    },
    m(v, w) {
      S(v, e, w), f(e, l), f(e, i), f(e, n), f(n, a);
      for (let q = 0; q < p.length; q += 1)
        p[q] && p[q].m(n, null);
      S(v, r, w), k && k.m(v, w), S(v, s, w), S(v, o, w), y && y.m(o, null), _ = !0, c || (d = te(
        n,
        "change",
        /*change_handler*/
        t[15]
      ), c = !0);
    },
    p(v, w) {
      if (w[0] & /*$problem_type*/
      32) {
        h = $e(D1);
        let q;
        for (q = 0; q < h.length; q += 1) {
          const $ = _p(v, h, q);
          p[q] ? p[q].p($, w) : (p[q] = pp($), p[q].c(), p[q].m(n, null));
        }
        for (; q < p.length; q += 1)
          p[q].d(1);
        p.length = h.length;
      }
      b === (b = g(v)) && k ? k.p(v, w) : (k && k.d(1), k = b && b(v), k && (k.c(), k.m(s.parentNode, s))), /*$drawPlan*/
      v[8] ? y ? (y.p(v, w), w[0] & /*$drawPlan*/
      256 && T(y, 1)) : (y = gp(v), y.c(), T(y, 1), y.m(o, null)) : y && (be(), D(y, 1, 1, () => {
        y = null;
      }), ke());
    },
    i(v) {
      _ || (T(y), _ = !0);
    },
    o(v) {
      D(y), _ = !1;
    },
    d(v) {
      v && (C(e), C(r), C(s), C(o)), Ye(p, v), k && k.d(v), y && y.d(), c = !1, d();
    }
  };
}
function pp(t) {
  let e, l = (
    /*t*/
    t[30].name + ""
  ), i, n;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = /*t*/
      t[30].key, pt(e, e.__value), e.selected = n = /*t*/
      t[30].key === /*$problem_type*/
      t[5];
    },
    m(a, r) {
      S(a, e, r), f(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 && C(e);
    }
  };
}
function X6(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B = (
    /*$problem_type*/
    (t[5] === "image_3d" || /*$problem_type*/
    t[5] === "image_1d") && mp(t)
  );
  return {
    c() {
      var R, P, O, F;
      e = m("div"), l = m("div"), i = m("label"), i.textContent = "Image width (px):", n = N(), a = m("input"), s = N(), o = m("div"), _ = m("label"), _.textContent = "Image height (px):", c = N(), d = m("input"), p = N(), B && B.c(), g = N(), b = m("div"), k = m("label"), k.textContent = "Magnitude:", y = N(), v = m("input"), q = N(), $ = m("div"), j = m("label"), j.textContent = "Zoom by:", I = N(), A = m("input"), u(i, "for", "image_width"), u(i, "class", "svelte-18o3ak5"), u(a, "id", "image_width"), u(a, "type", "number"), a.value = r = /*$config*/
      (R = t[4]) == null ? void 0 : R.image_width, u(l, "class", "input-wrap svelte-18o3ak5"), u(_, "for", "image_height"), u(_, "class", "svelte-18o3ak5"), u(d, "id", "image_height"), u(d, "type", "number"), d.value = h = /*$config*/
      (P = t[4]) == null ? void 0 : P.image_height, u(o, "class", "input-wrap svelte-18o3ak5"), u(k, "for", "magnitude"), u(k, "class", "svelte-18o3ak5"), u(v, "id", "magnitude"), u(v, "type", "number"), v.value = w = /*$config*/
      (O = t[4]) == null ? void 0 : O.magnitude, u(b, "class", "input-wrap svelte-18o3ak5"), u(j, "for", "resolution"), u(j, "class", "svelte-18o3ak5"), u(A, "id", "resolution"), u(A, "type", "number"), A.value = M = /*$config*/
      (F = t[4]) == null ? void 0 : F.resolution, u($, "class", "input-wrap svelte-18o3ak5"), u(e, "class", "input-group svelte-18o3ak5");
    },
    m(R, P) {
      S(R, e, P), f(e, l), f(l, i), f(l, n), f(l, a), f(e, s), f(e, o), f(o, _), f(o, c), f(o, d), f(e, p), B && B.m(e, null), f(e, g), f(e, b), f(b, k), f(b, y), f(b, v), f(e, q), f(e, $), f($, j), f($, I), f($, A), z || (H = [
        te(
          a,
          "change",
          /*change_handler_2*/
          t[17]
        ),
        te(
          d,
          "change",
          /*change_handler_3*/
          t[18]
        ),
        te(
          v,
          "change",
          /*change_handler_5*/
          t[20]
        ),
        te(
          A,
          "change",
          /*change_handler_6*/
          t[21]
        )
      ], z = !0);
    },
    p(R, P) {
      var O, F, L, X;
      P[0] & /*$config*/
      16 && r !== (r = /*$config*/
      (O = R[4]) == null ? void 0 : O.image_width) && a.value !== r && (a.value = r), P[0] & /*$config*/
      16 && h !== (h = /*$config*/
      (F = R[4]) == null ? void 0 : F.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 = mp(R), B.c(), B.m(e, g)) : B && (B.d(1), B = null), P[0] & /*$config*/
      16 && w !== (w = /*$config*/
      (L = R[4]) == null ? void 0 : L.magnitude) && v.value !== w && (v.value = w), P[0] & /*$config*/
      16 && M !== (M = /*$config*/
      (X = R[4]) == null ? void 0 : X.resolution) && A.value !== M && (A.value = M);
    },
    d(R) {
      R && C(e), B && B.d(), z = !1, wt(H);
    }
  };
}
function G6(t) {
  let e, l, i, n, a, r, s;
  function o(d, h) {
    var p;
    return (
      /*$config*/
      (p = d[4]) != null && p.filter_true ? K6 : Y6
    );
  }
  let _ = o(t), c = _(t);
  return {
    c() {
      var d;
      e = m("div"), l = m("input"), n = N(), a = m("label"), c.c(), u(l, "id", "config-truth"), u(l, "type", "checkbox"), l.checked = i = /*$config*/
      (d = t[4]) == null ? void 0 : d.filter_true, u(a, "for", "config-truth"), u(a, "class", "svelte-18o3ak5"), u(e, "class", "input-wrap svelte-18o3ak5");
    },
    m(d, h) {
      S(d, e, h), f(e, l), f(e, n), f(e, a), c.m(a, null), r || (s = te(
        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), _ !== (_ = o(d)) && (c.d(1), c = _(d), c && (c.c(), c.m(a, null)));
    },
    d(d) {
      d && C(e), c.d(), r = !1, s();
    }
  };
}
function mp(t) {
  let e, l, i, n, a, r, s, o, _;
  return {
    c() {
      e = m("div"), l = m("label"), l.textContent = "Direction:", i = N(), n = m("select"), a = m("option"), a.textContent = "Row-first", r = m("option"), r.textContent = "Column-first", u(l, "for", "dir"), u(l, "class", "svelte-18o3ak5"), a.__value = "row", pt(a, a.__value), r.__value = "col", pt(r, r.__value), u(n, "id", "dir"), u(n, "type", "number"), u(n, "class", "svelte-18o3ak5"), u(e, "class", "input-wrap svelte-18o3ak5");
    },
    m(c, d) {
      var h;
      S(c, e, d), f(e, l), f(e, i), f(e, n), f(n, a), f(n, r), fl(
        n,
        /*$config*/
        (h = t[4]) == null ? void 0 : h.dir
      ), o || (_ = te(
        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) && fl(
        n,
        /*$config*/
        (p = c[4]) == null ? void 0 : p.dir
      );
    },
    d(c) {
      c && C(e), o = !1, _();
    }
  };
}
function Y6(t) {
  let e;
  return {
    c() {
      e = E("Show all outcomes.");
    },
    m(l, i) {
      S(l, e, i);
    },
    d(l) {
      l && C(e);
    }
  };
}
function K6(t) {
  let e;
  return {
    c() {
      e = E("Show only true outcomes.");
    },
    m(l, i) {
      S(l, e, i);
    },
    d(l) {
      l && C(e);
    }
  };
}
function gp(t) {
  let e, l, i, n;
  const a = [Z6, J6, W6, U6], r = [];
  function s(o, _) {
    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 : -1
          )
        )
      )
    );
  }
  return ~(e = s(t)) && (l = r[e] = a[e](t)), {
    c() {
      l && l.c(), i = Ae();
    },
    m(o, _) {
      ~e && r[e].m(o, _), S(o, i, _), n = !0;
    },
    p(o, _) {
      let c = e;
      e = s(o), e === c ? ~e && r[e].p(o, _) : (l && (be(), D(r[c], 1, 1, () => {
        r[c] = null;
      }), ke()), ~e ? (l = r[e], l ? l.p(o, _) : (l = r[e] = a[e](o), l.c()), T(l, 1), l.m(i.parentNode, i)) : l = null);
    },
    i(o) {
      n || (T(l), n = !0);
    },
    o(o) {
      D(l), n = !1;
    },
    d(o) {
      o && C(i), ~e && r[e].d(o);
    }
  };
}
function U6(t) {
  let e, l;
  return e = new V6({
    props: {
      drawPlan: (
        /*drawPlan*/
        t[10]
      ),
      id: (
        /*id*/
        t[2]
      ),
      problem_type: (
        /*problem_type*/
        t[11]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function W6(t) {
  let e, l;
  return e = new L6({
    props: {
      drawPlan: (
        /*drawPlan*/
        t[10]
      ),
      id: (
        /*id*/
        t[2]
      ),
      problem_type: (
        /*problem_type*/
        t[11]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function J6(t) {
  let e, l;
  return e = new B6({
    props: {
      drawPlan: (
        /*drawPlan*/
        t[10]
      ),
      id: (
        /*id*/
        t[2]
      ),
      problem_type: (
        /*problem_type*/
        t[11]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Z6(t) {
  let e, l;
  return e = new S6({
    props: {
      drawPlan: (
        /*drawPlan*/
        t[10]
      ),
      id: (
        /*id*/
        t[2]
      ),
      problem_type: (
        /*problem_type*/
        t[11]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function x6(t) {
  let e, l, i = (
    /*$data*/
    t[6] && cp(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(n, a) {
      i && i.m(n, a), S(n, e, a), l = !0;
    },
    p(n, a) {
      /*$data*/
      n[6] ? i ? (i.p(n, a), a[0] & /*$data*/
      64 && T(i, 1)) : (i = cp(n), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d(n);
    }
  };
}
function e8(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(p, (P) => l(4, i = P)), p), r, s, o = ne, _ = () => (o(), o = st(h, (P) => l(6, s = P)), h), c, d;
  t.$$.on_destroy.push(() => n()), t.$$.on_destroy.push(() => o());
  let { data: h = Oe(), config: p = Oe({}), id: g = "problem-view" } = e;
  _(), a();
  let b = Oe(!0);
  at(t, b, (P) => l(7, c = P));
  let k = Oe();
  at(t, k, (P) => l(8, d = P));
  let y = Oe("image_1d");
  at(t, y, (P) => l(5, r = P));
  function v(P, O, F) {
    delete w[g], O === "natural_number" ? k.set(c6(P)) : O === "truth_table" ? k.set(m6(P, F)) : O === "pivot_table" ? k.set(v6(P)) : O === "image_1d" ? k.set(w6(P, F)) : O === "image_3d" && k.set($6(P, F));
  }
  Tt(() => {
    s.n_shots && p.update((P) => (P.n_shots = s.n_shots, P)), y.subscribe((P) => {
      v(s.counts, P, i);
    }), p.subscribe((P) => {
      v(s.counts, r, P);
    }), h.subscribe((P) => {
      v(P.counts, r, i);
    });
  });
  let w = {}, q = Oe();
  q.subscribe((P) => {
    P && l(3, w[P.id] = P, w);
  });
  const $ = (P) => b.set(!c), j = (P) => {
    Ii("problem-number", q);
  }, I = (P) => {
    console.log(P.target.value), P.target.value ? y.set(P.target.value) : y.set(void 0);
  }, A = (P) => {
    p.update((O) => (O.filter_true = P.target.checked, O));
  }, M = (P) => {
    p.update((O) => (O.image_width = parseInt(P.target.value), O));
  }, z = (P) => {
    p.update((O) => (O.image_height = parseInt(P.target.value), O));
  }, H = (P) => {
    p.update((O) => (O.dir = P.target.value, O));
  }, B = (P) => {
    p.update((O) => (O.magnitude = parseFloat(P.target.value), O));
  }, R = (P) => {
    p.update((O) => (O.resolution = parseFloat(P.target.value), O));
  };
  return t.$$set = (P) => {
    "data" in P && _(l(0, h = P.data)), "config" in P && a(l(1, p = P.config)), "id" in P && l(2, g = P.id);
  }, [
    h,
    p,
    g,
    w,
    i,
    r,
    s,
    c,
    d,
    b,
    k,
    y,
    q,
    $,
    j,
    I,
    A,
    M,
    z,
    H,
    B,
    R
  ];
}
class t8 extends Ve {
  constructor(e) {
    super(), Qe(this, e, e8, x6, Fe, { data: 0, config: 1, id: 2 }, null, [-1, -1]);
  }
}
function bp(t, e, l) {
  const i = t.slice();
  return i[45] = e[l], i[47] = l, i;
}
function kp(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[3] ? "Show" : "Hide"
  ), r, s, o, _, c, d, h = !/*$hide1*/
  t[3] && vp(t), p = !/*$hide1*/
  t[3] && yp(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`Physical qubit properties
      `), n = m("button"), r = E(a), s = N(), h && h.c(), o = N(), _ = m("div"), p && p.c(), u(n, "class", "svelte-1i1pekd"), u(_, "class", "content-wrap svelte-1i1pekd"), u(e, "class", "panel qubits svelte-1i1pekd");
    },
    m(g, b) {
      S(g, e, b), f(e, l), f(l, i), f(l, n), f(n, r), f(e, s), h && h.m(e, null), f(e, o), f(e, _), p && p.m(_, null), c || (d = te(
        n,
        "click",
        /*click_handler*/
        t[9]
      ), c = !0);
    },
    p(g, b) {
      b[0] & /*$hide1*/
      8 && a !== (a = /*$hide1*/
      g[3] ? "Show" : "Hide") && U(r, a), /*$hide1*/
      g[3] ? h && (h.d(1), h = null) : h ? h.p(g, b) : (h = vp(g), h.c(), h.m(e, o)), /*$hide1*/
      g[3] ? p && (p.d(1), p = null) : p ? p.p(g, b) : (p = yp(g), p.c(), p.m(_, null));
    },
    d(g) {
      g && C(e), h && h.d(), p && p.d(), c = !1, d();
    }
  };
}
function vp(t) {
  let e, l, i, n, a, r, s;
  function o(d, h) {
    var p;
    return (
      /*$config*/
      (p = d[4]) != null && p.filter_used ? i8 : l8
    );
  }
  let _ = o(t), c = _(t);
  return {
    c() {
      var d;
      e = m("div"), l = m("input"), n = N(), a = m("label"), c.c(), u(l, "id", "config-truth"), u(l, "type", "checkbox"), l.checked = i = /*$config*/
      (d = t[4]) == null ? void 0 : d.filter_used, u(a, "for", "config"), u(a, "class", "svelte-1i1pekd"), u(e, "class", "input-wrap svelte-1i1pekd");
    },
    m(d, h) {
      S(d, e, h), f(e, l), f(e, n), f(e, a), c.m(a, null), r || (s = te(
        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), _ !== (_ = o(d)) && (c.d(1), c = _(d), c && (c.c(), c.m(a, null)));
    },
    d(d) {
      d && C(e), c.d(), r = !1, s();
    }
  };
}
function l8(t) {
  let e;
  return {
    c() {
      e = E("Show all qubits.");
    },
    m(l, i) {
      S(l, e, i);
    },
    d(l) {
      l && C(e);
    }
  };
}
function i8(t) {
  let e;
  return {
    c() {
      e = E("Show only the qubits used in the circuit.");
    },
    m(l, i) {
      S(l, e, i);
    },
    d(l) {
      l && C(e);
    }
  };
}
function yp(t) {
  var i;
  let e, l = (
    /*$data*/
    ((i = t[2].backend_properties) == null ? void 0 : i.qubits) && wp(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(n, a) {
      l && l.m(n, a), S(n, e, a);
    },
    p(n, a) {
      var r;
      /*$data*/
      (r = n[2].backend_properties) != null && r.qubits ? l ? l.p(n, a) : (l = wp(n), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    d(n) {
      n && C(e), l && l.d(n);
    }
  };
}
function wp(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M, z, H, B, R, P, O, F, L, X, V, Q, Z, ae, se;
  function K(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].index !== "a" ? a8 : n8
    );
  }
  let Y = K(t), W = Y(t);
  function J(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].T1 !== "a" ? s8 : r8
    );
  }
  let ee = J(t), we = ee(t);
  function Re(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].T1d !== "a" ? u8 : o8
    );
  }
  let ve = Re(t), me = ve(t);
  function fe(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].T2 !== "a" ? _8 : f8
    );
  }
  let G = fe(t), ye = G(t);
  function ue(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].T2d !== "a" ? d8 : c8
    );
  }
  let le = ue(t), oe = le(t);
  function x(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].anharmonicity !== "a" ? p8 : h8
    );
  }
  let ge = x(t), re = ge(t);
  function Ie(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].anharmonicityd !== "a" ? g8 : m8
    );
  }
  let je = Ie(t), _e = je(t);
  function Ee(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].frequency !== "a" ? k8 : b8
    );
  }
  let ie = Ee(t), Te = ie(t);
  function Ue(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].frequencyd !== "a" ? y8 : v8
    );
  }
  let Ke = Ue(t), We = Ke(t);
  function vt(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].prob_meas0_prep1 !== "a" ? $8 : w8
    );
  }
  let qt = vt(t), rt = qt(t);
  function mt(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].prob_meas0_prep1d !== "a" ? j8 : q8
    );
  }
  let Rt = mt(t), ot = Rt(t);
  function ut(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].prob_meas1_prep0 !== "a" ? C8 : T8
    );
  }
  let Ce = ut(t), ce = Ce(t);
  function Be(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].prob_meas1_prep0d !== "a" ? M8 : S8
    );
  }
  let Le = Be(t), Pe = Le(t);
  function Je(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].readout_error !== "a" ? N8 : z8
    );
  }
  let Xe = Je(t), He = Xe(t);
  function Ze(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].readout_errord !== "a" ? B8 : A8
    );
  }
  let _t = Ze(t), Ct = _t(t);
  function tl(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].readout_length !== "a" ? O8 : P8
    );
  }
  let jt = tl(t), ft = jt(t);
  function Lt(ze, lt) {
    return (
      /*sort_reg*/
      ze[1].readout_lengthd !== "a" ? I8 : E8
    );
  }
  let It = Lt(t), gt = It(t), Dt = $e(
    /*$data*/
    t[2].backend_properties.qubits
  ), yt = [];
  for (let ze = 0; ze < Dt.length; ze += 1)
    yt[ze] = qp(bp(t, Dt, ze));
  return {
    c() {
      e = m("table"), l = m("thead"), i = m("tr"), n = m("th"), a = E("I "), W.c(), r = N(), s = m("th"), o = E("T1 "), we.c(), _ = Ae(), me.c(), c = N(), d = m("th"), h = E("T2 "), ye.c(), p = Ae(), oe.c(), g = N(), b = m("th"), k = E("Anharmonic. "), re.c(), y = Ae(), _e.c(), v = N(), w = m("th"), q = E("Frequency "), Te.c(), $ = Ae(), We.c(), j = N(), I = m("th"), A = E("Meas0Prob1 "), rt.c(), M = Ae(), ot.c(), z = N(), H = m("th"), B = E("Meas1Prob0 "), ce.c(), R = Ae(), Pe.c(), P = N(), O = m("th"), F = E("Readout Error "), He.c(), L = Ae(), Ct.c(), X = N(), V = m("th"), Q = E("Readout Length "), ft.c(), Z = Ae(), gt.c(), ae = N(), se = m("tbody");
      for (let ze = 0; ze < yt.length; ze += 1)
        yt[ze].c();
      u(n, "class", "svelte-1i1pekd"), u(s, "class", "svelte-1i1pekd"), u(d, "class", "svelte-1i1pekd"), u(b, "class", "svelte-1i1pekd"), u(w, "class", "svelte-1i1pekd"), u(I, "class", "svelte-1i1pekd"), u(H, "class", "svelte-1i1pekd"), u(O, "class", "svelte-1i1pekd"), u(V, "class", "svelte-1i1pekd"), u(l, "class", "svelte-1i1pekd"), u(e, "class", "svelte-1i1pekd");
    },
    m(ze, lt) {
      S(ze, e, lt), f(e, l), f(l, i), f(i, n), f(n, a), W.m(n, null), f(i, r), f(i, s), f(s, o), we.m(s, null), f(s, _), me.m(s, null), f(i, c), f(i, d), f(d, h), ye.m(d, null), f(d, p), oe.m(d, null), f(i, g), f(i, b), f(b, k), re.m(b, null), f(b, y), _e.m(b, null), f(i, v), f(i, w), f(w, q), Te.m(w, null), f(w, $), We.m(w, null), f(i, j), f(i, I), f(I, A), rt.m(I, null), f(I, M), ot.m(I, null), f(i, z), f(i, H), f(H, B), ce.m(H, null), f(H, R), Pe.m(H, null), f(i, P), f(i, O), f(O, F), He.m(O, null), f(O, L), Ct.m(O, null), f(i, X), f(i, V), f(V, Q), ft.m(V, null), f(V, Z), gt.m(V, null), f(e, ae), f(e, se);
      for (let dt = 0; dt < yt.length; dt += 1)
        yt[dt] && yt[dt].m(se, null);
    },
    p(ze, lt) {
      if (Y === (Y = K(ze)) && W ? W.p(ze, lt) : (W.d(1), W = Y(ze), W && (W.c(), W.m(n, null))), ee === (ee = J(ze)) && we ? we.p(ze, lt) : (we.d(1), we = ee(ze), we && (we.c(), we.m(s, _))), ve === (ve = Re(ze)) && me ? me.p(ze, lt) : (me.d(1), me = ve(ze), me && (me.c(), me.m(s, null))), G === (G = fe(ze)) && ye ? ye.p(ze, lt) : (ye.d(1), ye = G(ze), ye && (ye.c(), ye.m(d, p))), le === (le = ue(ze)) && oe ? oe.p(ze, lt) : (oe.d(1), oe = le(ze), oe && (oe.c(), oe.m(d, null))), ge === (ge = x(ze)) && re ? re.p(ze, lt) : (re.d(1), re = ge(ze), re && (re.c(), re.m(b, y))), je === (je = Ie(ze)) && _e ? _e.p(ze, lt) : (_e.d(1), _e = je(ze), _e && (_e.c(), _e.m(b, null))), ie === (ie = Ee(ze)) && Te ? Te.p(ze, lt) : (Te.d(1), Te = ie(ze), Te && (Te.c(), Te.m(w, $))), Ke === (Ke = Ue(ze)) && We ? We.p(ze, lt) : (We.d(1), We = Ke(ze), We && (We.c(), We.m(w, null))), qt === (qt = vt(ze)) && rt ? rt.p(ze, lt) : (rt.d(1), rt = qt(ze), rt && (rt.c(), rt.m(I, M))), Rt === (Rt = mt(ze)) && ot ? ot.p(ze, lt) : (ot.d(1), ot = Rt(ze), ot && (ot.c(), ot.m(I, null))), Ce === (Ce = ut(ze)) && ce ? ce.p(ze, lt) : (ce.d(1), ce = Ce(ze), ce && (ce.c(), ce.m(H, R))), Le === (Le = Be(ze)) && Pe ? Pe.p(ze, lt) : (Pe.d(1), Pe = Le(ze), Pe && (Pe.c(), Pe.m(H, null))), Xe === (Xe = Je(ze)) && He ? He.p(ze, lt) : (He.d(1), He = Xe(ze), He && (He.c(), He.m(O, L))), _t === (_t = Ze(ze)) && Ct ? Ct.p(ze, lt) : (Ct.d(1), Ct = _t(ze), Ct && (Ct.c(), Ct.m(O, null))), jt === (jt = tl(ze)) && ft ? ft.p(ze, lt) : (ft.d(1), ft = jt(ze), ft && (ft.c(), ft.m(V, Z))), It === (It = Lt(ze)) && gt ? gt.p(ze, lt) : (gt.d(1), gt = It(ze), gt && (gt.c(), gt.m(V, null))), lt[0] & /*$data, $config*/
      20) {
        Dt = $e(
          /*$data*/
          ze[2].backend_properties.qubits
        );
        let dt;
        for (dt = 0; dt < Dt.length; dt += 1) {
          const Nt = bp(ze, Dt, dt);
          yt[dt] ? yt[dt].p(Nt, lt) : (yt[dt] = qp(Nt), yt[dt].c(), yt[dt].m(se, null));
        }
        for (; dt < yt.length; dt += 1)
          yt[dt].d(1);
        yt.length = Dt.length;
      }
    },
    d(ze) {
      ze && C(e), W.d(), we.d(), me.d(), ye.d(), oe.d(), re.d(), _e.d(), Te.d(), We.d(), rt.d(), ot.d(), ce.d(), Pe.d(), He.d(), Ct.d(), ft.d(), gt.d(), Ye(yt, ze);
    }
  };
}
function n8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_2*/
        t[12]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function a8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_1*/
        t[11]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function r8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_4*/
        t[14]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function s8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_3*/
        t[13]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function o8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_6*/
        t[16]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function u8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_5*/
        t[15]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function f8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_8*/
        t[18]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function _8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_7*/
        t[17]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function c8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_10*/
        t[20]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function d8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_9*/
        t[19]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function h8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_12*/
        t[22]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function p8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_11*/
        t[21]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function m8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_14*/
        t[24]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function g8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_13*/
        t[23]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function b8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_16*/
        t[26]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function k8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_15*/
        t[25]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function v8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_18*/
        t[28]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function y8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_17*/
        t[27]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function w8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_20*/
        t[30]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function $8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_19*/
        t[29]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function q8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_22*/
        t[32]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function j8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_21*/
        t[31]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function T8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_24*/
        t[34]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function C8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_23*/
        t[33]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function S8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_26*/
        t[36]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function M8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_25*/
        t[35]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function z8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_28*/
        t[38]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function N8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_27*/
        t[37]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function A8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_30*/
        t[40]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function B8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_29*/
        t[39]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function P8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_32*/
        t[42]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function O8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑V", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_31*/
        t[41]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function E8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↓D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_34*/
        t[44]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function I8(t) {
  let e, l, i;
  return {
    c() {
      e = m("button"), e.textContent = "↑D", u(e, "class", "svelte-1i1pekd");
    },
    m(n, a) {
      S(n, e, a), l || (i = te(
        e,
        "click",
        /*click_handler_33*/
        t[43]
      ), l = !0);
    },
    p: ne,
    d(n) {
      n && C(e), l = !1, i();
    }
  };
}
function $p(t) {
  let e, l, i = (
    /*qubit*/
    t[45].index.value + ""
  ), n, a, r, s = (
    /*qubit*/
    t[45].T1.value + ""
  ), o, _, c, d, h = (
    /*qubit*/
    t[45].T1.asof + ""
  ), p, g, b, k, y = (
    /*qubit*/
    t[45].T2.value + ""
  ), v, w, q, $, j = (
    /*qubit*/
    t[45].T2.asof + ""
  ), I, A, M, z, H = (
    /*qubit*/
    t[45].anharmonicity.value + ""
  ), B, R, P, O, F = (
    /*qubit*/
    t[45].anharmonicity.asof + ""
  ), L, X, V, Q, Z = (
    /*qubit*/
    t[45].frequency.value + ""
  ), ae, se, K, Y, W = (
    /*qubit*/
    t[45].frequency.asof + ""
  ), J, ee, we, Re, ve = (
    /*qubit*/
    t[45].prob_meas0_prep1.value + ""
  ), me, fe, G, ye, ue = (
    /*qubit*/
    t[45].prob_meas0_prep1.asof + ""
  ), le, oe, x, ge, re = (
    /*qubit*/
    t[45].prob_meas1_prep0.value + ""
  ), Ie, je, _e, Ee, ie = (
    /*qubit*/
    t[45].prob_meas1_prep0.asof + ""
  ), Te, Ue, Ke, We, vt = (
    /*qubit*/
    t[45].readout_error.value + ""
  ), qt, rt, mt, Rt, ot = (
    /*qubit*/
    t[45].readout_error.asof + ""
  ), ut, Ce, ce, Be, Le = (
    /*qubit*/
    t[45].readout_length.value + ""
  ), Pe, Je, Xe, He, Ze = (
    /*qubit*/
    t[45].readout_length.asof + ""
  ), _t, Ct, tl;
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = N(), r = m("td"), o = E(s), _ = m("br"), c = m("span"), d = E("("), p = E(h), g = E(")"), b = N(), k = m("td"), v = E(y), w = m("br"), q = m("span"), $ = E("("), I = E(j), A = E(")"), M = N(), z = m("td"), B = E(H), R = m("br"), P = m("span"), O = E("("), L = E(F), X = E(")"), V = N(), Q = m("td"), ae = E(Z), se = m("br"), K = m("span"), Y = E("("), J = E(W), ee = E(")"), we = N(), Re = m("td"), me = E(ve), fe = m("br"), G = m("span"), ye = E("("), le = E(ue), oe = E(")"), x = N(), ge = m("td"), Ie = E(re), je = m("br"), _e = m("span"), Ee = E("("), Te = E(ie), Ue = E(")"), Ke = N(), We = m("td"), qt = E(vt), rt = m("br"), mt = m("span"), Rt = E("("), ut = E(ot), Ce = E(")"), ce = N(), Be = m("td"), Pe = E(Le), Je = m("br"), Xe = m("span"), He = E("("), _t = E(Ze), Ct = E(")"), tl = N(), u(l, "class", "svelte-1i1pekd"), u(c, "class", "asof svelte-1i1pekd"), u(r, "class", "svelte-1i1pekd"), u(q, "class", "asof svelte-1i1pekd"), u(k, "class", "svelte-1i1pekd"), u(P, "class", "asof svelte-1i1pekd"), u(z, "class", "svelte-1i1pekd"), u(K, "class", "asof svelte-1i1pekd"), u(Q, "class", "svelte-1i1pekd"), u(G, "class", "asof svelte-1i1pekd"), u(Re, "class", "svelte-1i1pekd"), u(_e, "class", "asof svelte-1i1pekd"), u(ge, "class", "svelte-1i1pekd"), u(mt, "class", "asof svelte-1i1pekd"), u(We, "class", "svelte-1i1pekd"), u(Xe, "class", "asof svelte-1i1pekd"), u(Be, "class", "svelte-1i1pekd");
    },
    m(jt, ft) {
      S(jt, e, ft), f(e, l), f(l, n), f(e, a), f(e, r), f(r, o), f(r, _), f(r, c), f(c, d), f(c, p), f(c, g), f(e, b), f(e, k), f(k, v), f(k, w), f(k, q), f(q, $), f(q, I), f(q, A), f(e, M), f(e, z), f(z, B), f(z, R), f(z, P), f(P, O), f(P, L), f(P, X), f(e, V), f(e, Q), f(Q, ae), f(Q, se), f(Q, K), f(K, Y), f(K, J), f(K, ee), f(e, we), f(e, Re), f(Re, me), f(Re, fe), f(Re, G), f(G, ye), f(G, le), f(G, oe), f(e, x), f(e, ge), f(ge, Ie), f(ge, je), f(ge, _e), f(_e, Ee), f(_e, Te), f(_e, Ue), f(e, Ke), f(e, We), f(We, qt), f(We, rt), f(We, mt), f(mt, Rt), f(mt, ut), f(mt, Ce), f(e, ce), f(e, Be), f(Be, Pe), f(Be, Je), f(Be, Xe), f(Xe, He), f(Xe, _t), f(Xe, Ct), f(e, tl);
    },
    p(jt, ft) {
      ft[0] & /*$data*/
      4 && i !== (i = /*qubit*/
      jt[45].index.value + "") && U(n, i), ft[0] & /*$data*/
      4 && s !== (s = /*qubit*/
      jt[45].T1.value + "") && U(o, s), ft[0] & /*$data*/
      4 && h !== (h = /*qubit*/
      jt[45].T1.asof + "") && U(p, h), ft[0] & /*$data*/
      4 && y !== (y = /*qubit*/
      jt[45].T2.value + "") && U(v, y), ft[0] & /*$data*/
      4 && j !== (j = /*qubit*/
      jt[45].T2.asof + "") && U(I, j), ft[0] & /*$data*/
      4 && H !== (H = /*qubit*/
      jt[45].anharmonicity.value + "") && U(B, H), ft[0] & /*$data*/
      4 && F !== (F = /*qubit*/
      jt[45].anharmonicity.asof + "") && U(L, F), ft[0] & /*$data*/
      4 && Z !== (Z = /*qubit*/
      jt[45].frequency.value + "") && U(ae, Z), ft[0] & /*$data*/
      4 && W !== (W = /*qubit*/
      jt[45].frequency.asof + "") && U(J, W), ft[0] & /*$data*/
      4 && ve !== (ve = /*qubit*/
      jt[45].prob_meas0_prep1.value + "") && U(me, ve), ft[0] & /*$data*/
      4 && ue !== (ue = /*qubit*/
      jt[45].prob_meas0_prep1.asof + "") && U(le, ue), ft[0] & /*$data*/
      4 && re !== (re = /*qubit*/
      jt[45].prob_meas1_prep0.value + "") && U(Ie, re), ft[0] & /*$data*/
      4 && ie !== (ie = /*qubit*/
      jt[45].prob_meas1_prep0.asof + "") && U(Te, ie), ft[0] & /*$data*/
      4 && vt !== (vt = /*qubit*/
      jt[45].readout_error.value + "") && U(qt, vt), ft[0] & /*$data*/
      4 && ot !== (ot = /*qubit*/
      jt[45].readout_error.asof + "") && U(ut, ot), ft[0] & /*$data*/
      4 && Le !== (Le = /*qubit*/
      jt[45].readout_length.value + "") && U(Pe, Le), ft[0] & /*$data*/
      4 && Ze !== (Ze = /*qubit*/
      jt[45].readout_length.asof + "") && U(_t, Ze);
    },
    d(jt) {
      jt && C(e);
    }
  };
}
function qp(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 && $p(t);
  return {
    c() {
      i && i.c(), l = Ae();
    },
    m(n, a) {
      i && i.m(n, a), S(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 = $p(n), i.c(), i.m(l.parentNode, l)) : i && (i.d(1), i = null);
    },
    d(n) {
      n && C(l), i && i.d(n);
    }
  };
}
function D8(t) {
  let e, l = (
    /*$data*/
    t[2] && kp(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, n) {
      /*$data*/
      i[2] ? l ? l.p(i, n) : (l = kp(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function R8(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(o, (G) => l(2, i = G)), o), r, s;
  t.$$.on_destroy.push(() => n());
  let { data: o = Oe() } = e;
  a();
  let _ = {}, c = Oe({ filter_used: !0 });
  at(t, c, (G) => l(4, s = G));
  let d = Oe(!0);
  at(t, d, (G) => l(3, r = G));
  function h(G, ye, ue) {
    return ue == "a" ? (G = G.toSorted((le, oe) => {
      var x, ge;
      return ((x = le[ye]) == null ? void 0 : x.value) - ((ge = oe[ye]) == null ? void 0 : ge.value);
    }), l(1, _[ye] = "a", _)) : (G = G.toSorted((le, oe) => {
      var x, ge;
      return ((x = oe[ye]) == null ? void 0 : x.value) - ((ge = le[ye]) == null ? void 0 : ge.value);
    }), l(1, _[ye] = "d", _)), G;
  }
  function p(G, ye, ue) {
    return ue == "a" ? (G = G.toSorted((le, oe) => {
      var x, ge;
      return new Date((x = le[ye]) == null ? void 0 : x.asof) - new Date((ge = oe[ye]) == null ? void 0 : ge.asof);
    }), l(1, _[ye + "d"] = "a", _)) : (G = G.toSorted((le, oe) => {
      var x, ge;
      return new Date((x = oe[ye]) == null ? void 0 : x.asof) - new Date((ge = le[ye]) == null ? void 0 : ge.asof);
    }), l(1, _[ye + "d"] = "d", _)), G;
  }
  const g = (G) => d.set(!r), b = (G) => {
    c.update((ye) => (ye.filter_used = G.target.checked, ye));
  }, k = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "index", "a"), G));
  }, y = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "index", "d"), G));
  }, v = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "T1", "a"), G));
  }, w = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "T1", "d"), G));
  }, q = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "T1", "a"), G));
  }, $ = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "T1", "d"), G));
  }, j = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "T2", "a"), G));
  }, I = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "T2", "d"), G));
  }, A = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "T2", "a"), G));
  }, M = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "T2", "d"), G));
  }, z = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "anharmonicity", "a"), G));
  }, H = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "anharmonicity", "d"), G));
  }, B = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "anharmonicity", "a"), G));
  }, R = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "anharmonicity", "d"), G));
  }, P = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "frequency", "a"), G));
  }, O = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "frequency", "d"), G));
  }, F = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "frequency", "a"), G));
  }, L = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "frequency", "d"), G));
  }, X = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "prob_meas0_prep1", "a"), G));
  }, V = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "prob_meas0_prep1", "d"), G));
  }, Q = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "prob_meas0_prep1", "a"), G));
  }, Z = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "prob_meas0_prep1", "d"), G));
  }, ae = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "prob_meas1_prep0", "a"), G));
  }, se = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "prob_meas1_prep0", "d"), G));
  }, K = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "prob_meas1_prep0", "a"), G));
  }, Y = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "prob_meas1_prep0", "d"), G));
  }, W = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "readout_error", "a"), G));
  }, J = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "readout_error", "d"), G));
  }, ee = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "readout_error", "a"), G));
  }, we = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "readout_error", "d"), G));
  }, Re = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "readout_length", "a"), G));
  }, ve = () => {
    o.update((G) => (G.backend_properties.qubits = h(G.backend_properties.qubits, "readout_length", "d"), G));
  }, me = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "readout_length", "a"), G));
  }, fe = () => {
    o.update((G) => (G.backend_properties.qubits = p(G.backend_properties.qubits, "readout_length", "d"), G));
  };
  return t.$$set = (G) => {
    "data" in G && a(l(0, o = G.data));
  }, [
    o,
    _,
    i,
    r,
    s,
    c,
    d,
    h,
    p,
    g,
    b,
    k,
    y,
    v,
    w,
    q,
    $,
    j,
    I,
    A,
    M,
    z,
    H,
    B,
    R,
    P,
    O,
    F,
    L,
    X,
    V,
    Q,
    Z,
    ae,
    se,
    K,
    Y,
    W,
    J,
    ee,
    we,
    Re,
    ve,
    me,
    fe
  ];
}
class H8 extends Ve {
  constructor(e) {
    super(), Qe(this, e, R8, D8, Fe, { data: 0 }, null, [-1, -1]);
  }
}
function jp(t, e, l) {
  const i = t.slice();
  return i[16] = e[l], i[18] = l, i;
}
function Tp(t, e, l) {
  const i = t.slice();
  return i[19] = e[l], i;
}
function Cp(t, e, l) {
  const i = t.slice();
  return i[19] = e[l], i;
}
function Sp(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[4] ? "Show" : "Hide"
  ), r, s, o, _, c, d = !/*hide1*/
  t[7] && L8(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`Physical qubit properties
      `), n = m("button"), r = E(a), s = N(), o = m("div"), d && d.c(), u(n, "class", "svelte-hp4j9k"), u(o, "class", "content-wrap svelte-hp4j9k"), u(e, "class", "panel qubits svelte-hp4j9k");
    },
    m(h, p) {
      S(h, e, p), f(e, l), f(l, i), f(l, n), f(n, r), f(e, s), f(e, o), d && d.m(o, null), _ || (c = te(
        n,
        "click",
        /*click_handler*/
        t[10]
      ), _ = !0);
    },
    p(h, p) {
      p & /*$hide1*/
      16 && a !== (a = /*$hide1*/
      h[4] ? "Show" : "Hide") && U(r, a), /*hide1*/
      h[7] || d.p(h, p);
    },
    d(h) {
      h && C(e), d && d.d(), _ = !1, c();
    }
  };
}
function L8(t) {
  var P;
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M = $e(
    /*gates*/
    t[1]
  ), z = [];
  for (let O = 0; O < M.length; O += 1)
    z[O] = Mp(Cp(t, M, O));
  let H = $e(
    /*qubits*/
    t[2]
  ), B = [];
  for (let O = 0; O < H.length; O += 1)
    B[O] = zp(Tp(t, H, O));
  let R = (
    /*$data*/
    ((P = t[3].backend_properties) == null ? void 0 : P.gates) && Np(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = m("label"), i.textContent = "Used qubits", n = N(), a = m("input"), s = N(), o = m("div"), _ = m("label"), _.textContent = "Gates", c = N(), d = m("button"), d.textContent = "×", h = N(), p = m("select");
      for (let O = 0; O < z.length; O += 1)
        z[O].c();
      g = N(), b = m("div"), k = m("label"), k.textContent = "Qubits", y = N(), v = m("button"), v.textContent = "×", w = N(), q = m("select");
      for (let O = 0; O < B.length; O += 1)
        B[O].c();
      $ = N(), j = m("div"), R && R.c(), u(i, "for", "used"), u(i, "class", "svelte-hp4j9k"), u(a, "type", "checkbox"), a.checked = r = /*$filter*/
      t[5].only_used, u(l, "class", "svelte-hp4j9k"), u(_, "for", "gates"), u(_, "class", "svelte-hp4j9k"), u(d, "class", "svelte-hp4j9k"), u(p, "class", "filter svelte-hp4j9k"), u(p, "name", "gates"), u(p, "id", "gates"), p.multiple = !0, u(o, "class", "svelte-hp4j9k"), u(k, "for", "qubits"), u(k, "class", "svelte-hp4j9k"), u(v, "class", "svelte-hp4j9k"), u(q, "class", "filter svelte-hp4j9k"), u(q, "name", "qubits"), u(q, "id", "qubits"), q.multiple = !0, u(b, "class", "svelte-hp4j9k"), u(e, "class", "filter-wrap svelte-hp4j9k"), u(j, "class", "value");
    },
    m(O, F) {
      S(O, e, F), f(e, l), f(l, i), f(l, n), f(l, a), f(e, s), f(e, o), f(o, _), f(o, c), f(o, d), f(o, h), f(o, p);
      for (let L = 0; L < z.length; L += 1)
        z[L] && z[L].m(p, null);
      f(e, g), f(e, b), f(b, k), f(b, y), f(b, v), f(b, w), f(b, q);
      for (let L = 0; L < B.length; L += 1)
        B[L] && B[L].m(q, null);
      S(O, $, F), S(O, j, F), R && R.m(j, null), I || (A = [
        te(
          a,
          "change",
          /*change_handler*/
          t[11]
        ),
        te(
          d,
          "click",
          /*click_handler_1*/
          t[12]
        ),
        te(
          p,
          "change",
          /*change_handler_1*/
          t[13]
        ),
        te(
          v,
          "click",
          /*click_handler_2*/
          t[14]
        ),
        te(
          q,
          "change",
          /*change_handler_2*/
          t[15]
        )
      ], I = !0);
    },
    p(O, F) {
      var L;
      if (F & /*$filter*/
      32 && r !== (r = /*$filter*/
      O[5].only_used) && (a.checked = r), F & /*gates, $filter*/
      34) {
        M = $e(
          /*gates*/
          O[1]
        );
        let X;
        for (X = 0; X < M.length; X += 1) {
          const V = Cp(O, M, X);
          z[X] ? z[X].p(V, F) : (z[X] = Mp(V), z[X].c(), z[X].m(p, null));
        }
        for (; X < z.length; X += 1)
          z[X].d(1);
        z.length = M.length;
      }
      if (F & /*qubits, $filter*/
      36) {
        H = $e(
          /*qubits*/
          O[2]
        );
        let X;
        for (X = 0; X < H.length; X += 1) {
          const V = Tp(O, H, X);
          B[X] ? B[X].p(V, F) : (B[X] = zp(V), B[X].c(), B[X].m(q, null));
        }
        for (; X < B.length; X += 1)
          B[X].d(1);
        B.length = H.length;
      }
      /*$data*/
      (L = O[3].backend_properties) != null && L.gates ? R ? R.p(O, F) : (R = Np(O), R.c(), R.m(j, null)) : R && (R.d(1), R = null);
    },
    d(O) {
      O && (C(e), C($), C(j)), Ye(z, O), Ye(B, O), R && R.d(), I = !1, wt(A);
    }
  };
}
function Mp(t) {
  let e, l = (
    /*g*/
    t[19] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*g*/
      t[19], pt(e, e.__value), e.selected = a = /*$filter*/
      t[5].gates.includes(
        /*g*/
        t[19]
      );
    },
    m(r, s) {
      S(r, e, s), f(e, i);
    },
    p(r, s) {
      s & /*gates*/
      2 && l !== (l = /*g*/
      r[19] + "") && U(i, l), s & /*gates*/
      2 && n !== (n = /*g*/
      r[19]) && (e.__value = n, pt(e, e.__value)), s & /*$filter, gates*/
      34 && a !== (a = /*$filter*/
      r[5].gates.includes(
        /*g*/
        r[19]
      )) && (e.selected = a);
    },
    d(r) {
      r && C(e);
    }
  };
}
function zp(t) {
  let e, l = (
    /*g*/
    t[19] + ""
  ), i, n, a;
  return {
    c() {
      e = m("option"), i = E(l), e.__value = n = /*g*/
      t[19], pt(e, e.__value), e.selected = a = /*$filter*/
      t[5].qubits.includes(
        /*g*/
        t[19]
      );
    },
    m(r, s) {
      S(r, e, s), f(e, i);
    },
    p(r, s) {
      s & /*qubits*/
      4 && l !== (l = /*g*/
      r[19] + "") && U(i, l), s & /*qubits*/
      4 && n !== (n = /*g*/
      r[19]) && (e.__value = n, pt(e, e.__value)), s & /*$filter, qubits*/
      36 && a !== (a = /*$filter*/
      r[5].qubits.includes(
        /*g*/
        r[19]
      )) && (e.selected = a);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Np(t) {
  let e, l, i, n, a = $e(
    /*$data*/
    t[3].backend_properties.gates
  ), r = [];
  for (let s = 0; s < a.length; s += 1)
    r[s] = Bp(jp(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 = N(), n = m("tbody");
      for (let s = 0; s < r.length; s += 1)
        r[s].c();
      u(l, "class", "svelte-hp4j9k"), u(e, "class", "svelte-hp4j9k");
    },
    m(s, o) {
      S(s, e, o), f(e, l), f(e, i), f(e, n);
      for (let _ = 0; _ < r.length; _ += 1)
        r[_] && r[_].m(n, null);
    },
    p(s, o) {
      if (o & /*$data, $filter, filter*/
      104) {
        a = $e(
          /*$data*/
          s[3].backend_properties.gates
        );
        let _;
        for (_ = 0; _ < a.length; _ += 1) {
          const c = jp(s, a, _);
          r[_] ? r[_].p(c, o) : (r[_] = Bp(c), r[_].c(), r[_].m(n, null));
        }
        for (; _ < r.length; _ += 1)
          r[_].d(1);
        r.length = a.length;
      }
    },
    d(s) {
      s && C(e), Ye(r, s);
    }
  };
}
function Ap(t) {
  var F, L, X, V;
  let e, l, i = (
    /*gate*/
    t[16].gate + ""
  ), n, a, r, s = (
    /*gate*/
    t[16].qubits.join(",") + ""
  ), o, _, c, d = (
    /*gate*/
    ((F = t[16].parameters.gate_error) == null ? void 0 : F.value) + ""
  ), h, p, g, b, k = (
    /*gate*/
    ((L = t[16].parameters.gate_error) == null ? void 0 : L.asof) + ""
  ), y, v, w, q = (
    /*gate*/
    ((X = t[16].parameters.gate_length) == null ? void 0 : X.value) + ""
  ), $, j, I = (
    /*gate*/
    t[16].parameters.gate_length.unit + ""
  ), A, M, z, H, B, R = (
    /*gate*/
    ((V = t[16].parameters.gate_length) == null ? void 0 : V.asof) + ""
  ), P, O;
  return {
    c() {
      e = m("tr"), l = m("th"), n = E(i), a = N(), r = m("td"), o = E(s), _ = N(), c = m("td"), h = E(d), p = m("br"), g = N(), b = m("span"), y = E(k), v = N(), w = m("td"), $ = E(q), j = E(" ("), A = E(I), M = E(")"), z = m("br"), H = N(), B = m("span"), P = E(R), O = N(), u(l, "class", "svelte-hp4j9k"), u(r, "class", "svelte-hp4j9k"), u(b, "class", "asof svelte-hp4j9k"), u(c, "class", "svelte-hp4j9k"), u(B, "class", "asof svelte-hp4j9k"), u(w, "class", "svelte-hp4j9k");
    },
    m(Q, Z) {
      S(Q, e, Z), f(e, l), f(l, n), f(e, a), f(e, r), f(r, o), f(e, _), f(e, c), f(c, h), f(c, p), f(c, g), f(c, b), f(b, y), f(e, v), f(e, w), f(w, $), f(w, j), f(w, A), f(w, M), f(w, z), f(w, H), f(w, B), f(B, P), f(e, O);
    },
    p(Q, Z) {
      var ae, se, K, Y;
      Z & /*$data*/
      8 && i !== (i = /*gate*/
      Q[16].gate + "") && U(n, i), Z & /*$data*/
      8 && s !== (s = /*gate*/
      Q[16].qubits.join(",") + "") && U(o, s), Z & /*$data*/
      8 && d !== (d = /*gate*/
      ((ae = Q[16].parameters.gate_error) == null ? void 0 : ae.value) + "") && U(h, d), Z & /*$data*/
      8 && k !== (k = /*gate*/
      ((se = Q[16].parameters.gate_error) == null ? void 0 : se.asof) + "") && U(y, k), Z & /*$data*/
      8 && q !== (q = /*gate*/
      ((K = Q[16].parameters.gate_length) == null ? void 0 : K.value) + "") && U($, q), Z & /*$data*/
      8 && I !== (I = /*gate*/
      Q[16].parameters.gate_length.unit + "") && U(A, I), Z & /*$data*/
      8 && R !== (R = /*gate*/
      ((Y = Q[16].parameters.gate_length) == null ? void 0 : Y.asof) + "") && U(P, R);
    },
    d(Q) {
      Q && C(e);
    }
  };
}
function Bp(t) {
  var a, r;
  let e = (!/*$filter*/
  t[5].gates || /*$filter*/
  ((a = t[5].gates) == null ? void 0 : a.length) == 0 || /*$filter*/
  t[5].gates && /*$filter*/
  t[5].gates.includes(
    /*gate*/
    t[16].gate
  )) && (!/*$filter*/
  t[5].qubits || /*$filter*/
  ((r = t[5].qubits) == null ? void 0 : r.length) == 0 || /*$filter*/
  t[5].qubits && /*gate*/
  t[16].qubits.some(
    /*func*/
    t[8]
  )) && (!/*$filter*/
  t[5].only_used || /*$filter*/
  t[5].only_used && /*$data*/
  t[3].physical_gates.some(i)), l;
  function i(...s) {
    return (
      /*func_1*/
      t[9](
        /*gate*/
        t[16],
        ...s
      )
    );
  }
  let n = e && Ap(t);
  return {
    c() {
      n && n.c(), l = Ae();
    },
    m(s, o) {
      n && n.m(s, o), S(s, l, o);
    },
    p(s, o) {
      var _, c;
      t = s, o & /*$filter, $data*/
      40 && (e = (!/*$filter*/
      t[5].gates || /*$filter*/
      ((_ = t[5].gates) == null ? void 0 : _.length) == 0 || /*$filter*/
      t[5].gates && /*$filter*/
      t[5].gates.includes(
        /*gate*/
        t[16].gate
      )) && (!/*$filter*/
      t[5].qubits || /*$filter*/
      ((c = t[5].qubits) == null ? void 0 : c.length) == 0 || /*$filter*/
      t[5].qubits && /*gate*/
      t[16].qubits.some(
        /*func*/
        t[8]
      )) && (!/*$filter*/
      t[5].only_used || /*$filter*/
      t[5].only_used && /*$data*/
      t[3].physical_gates.some(i))), e ? n ? n.p(t, o) : (n = Ap(t), n.c(), n.m(l.parentNode, l)) : n && (n.d(1), n = null);
    },
    d(s) {
      s && C(l), n && n.d(s);
    }
  };
}
function F8(t) {
  let e, l = (
    /*$data*/
    t[3] && Sp(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*$data*/
      i[3] ? l ? l.p(i, n) : (l = Sp(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
function Q8(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(o, ($) => l(3, i = $)), o), r, s;
  t.$$.on_destroy.push(() => n());
  let { data: o = Oe() } = e;
  a();
  let _ = Oe({ gates: [], qubits: [], only_used: !1 }), c = [], d = [];
  at(t, _, ($) => l(5, s = $));
  let h = Oe(!0);
  at(t, h, ($) => l(4, r = $)), Tt(() => {
    var $;
    ($ = i == null ? void 0 : i.backend_properties) != null && $.gates && (l(1, c = Array.from(new Set(i.backend_properties.gates.map((j) => j.gate)))), l(2, d = Array.from(new Set(i.backend_properties.gates.map((j) => j.qubits).flat()))));
  });
  const p = ($) => _.qubits.includes($), g = ($, j) => j.gate === $.gate && j.qubits.join("-") === $.qubits.join("-"), b = ($) => h.set(!r), k = ($) => {
    _.update((j) => (j.only_used = $.target.checked, j));
  }, y = ($) => {
    _.update((j) => (j.gates = [], j));
  }, v = ($) => {
    _.update((j) => (j.gates = Array.from($.target.selectedOptions).map((I) => I.value), j));
  }, w = ($) => {
    _.update((j) => (j.qubits = [], j));
  }, q = ($) => {
    _.update((j) => (j.qubits = Array.from($.target.selectedOptions).map((I) => parseInt(I.value)), j));
  };
  return t.$$set = ($) => {
    "data" in $ && a(l(0, o = $.data));
  }, [
    o,
    c,
    d,
    i,
    r,
    s,
    _,
    h,
    p,
    g,
    b,
    k,
    y,
    v,
    w,
    q
  ];
}
class V8 extends Ve {
  constructor(e) {
    super(), Qe(this, e, Q8, F8, Fe, { data: 0 });
  }
}
function Pp(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[2] ? "Show" : "Hide"
  ), r, s, o, _, c, d = !/*$hide1*/
  t[2] && Op(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`Faulty gates and qubits
      `), n = m("button"), r = E(a), s = N(), o = m("div"), d && d.c(), u(n, "class", "svelte-14lfkj4"), u(o, "class", "content-wrap svelte-14lfkj4"), u(e, "class", "panel qubits svelte-14lfkj4");
    },
    m(h, p) {
      S(h, e, p), f(e, l), f(l, i), f(l, n), f(n, r), f(e, s), f(e, o), d && d.m(o, null), _ || (c = te(
        n,
        "click",
        /*click_handler*/
        t[4]
      ), _ = !0);
    },
    p(h, p) {
      p & /*$hide1*/
      4 && a !== (a = /*$hide1*/
      h[2] ? "Show" : "Hide") && U(r, a), /*$hide1*/
      h[2] ? d && (d.d(1), d = null) : d ? d.p(h, p) : (d = Op(h), d.c(), d.m(o, null));
    },
    d(h) {
      h && C(e), d && d.d(), _ = !1, c();
    }
  };
}
function Op(t) {
  var a, r;
  let e, l, i = (
    /*$data*/
    ((a = t[1].backend_properties) == null ? void 0 : a.faulty_gates) && Ep(t)
  ), n = (
    /*$data*/
    ((r = t[1].backend_properties) == null ? void 0 : r.faulty_qubits) && Ip(t)
  );
  return {
    c() {
      i && i.c(), e = N(), n && n.c(), l = Ae();
    },
    m(s, o) {
      i && i.m(s, o), S(s, e, o), n && n.m(s, o), S(s, l, o);
    },
    p(s, o) {
      var _, c;
      /*$data*/
      (_ = s[1].backend_properties) != null && _.faulty_gates ? i ? i.p(s, o) : (i = Ep(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 = Ip(s), n.c(), n.m(l.parentNode, l)) : n && (n.d(1), n = null);
    },
    d(s) {
      s && (C(e), C(l)), i && i.d(s), n && n.d(s);
    }
  };
}
function Ep(t) {
  let e, l, i;
  function n(s, o) {
    var _;
    return (
      /*$data*/
      ((_ = s[1].backend_properties.faulty_gates) == null ? void 0 : _.length) == 0 ? G8 : X8
    );
  }
  let a = n(t), r = a(t);
  return {
    c() {
      e = m("h5"), e.textContent = "Faulty gates", l = N(), i = m("div"), r.c(), u(e, "class", "svelte-14lfkj4"), u(i, "class", "list svelte-14lfkj4");
    },
    m(s, o) {
      S(s, e, o), S(s, l, o), S(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 && (C(e), C(l), C(i)), r.d();
    }
  };
}
function X8(t) {
  let e = (
    /*$data*/
    t[1].backend_properties.faulty_gates.map(Dp).join(", ") + ""
  ), l;
  return {
    c() {
      l = E(e);
    },
    m(i, n) {
      S(i, l, n);
    },
    p(i, n) {
      n & /*$data*/
      2 && e !== (e = /*$data*/
      i[1].backend_properties.faulty_gates.map(Dp).join(", ") + "") && U(l, e);
    },
    d(i) {
      i && C(l);
    }
  };
}
function G8(t) {
  let e;
  return {
    c() {
      e = E("None");
    },
    m(l, i) {
      S(l, e, i);
    },
    p: ne,
    d(l) {
      l && C(e);
    }
  };
}
function Ip(t) {
  let e, l, i;
  function n(s, o) {
    var _;
    return (
      /*$data*/
      ((_ = s[1].backend_properties.faulty_qubits) == null ? void 0 : _.length) == 0 ? K8 : Y8
    );
  }
  let a = n(t), r = a(t);
  return {
    c() {
      e = m("h5"), e.textContent = "Faulty qubits", l = N(), i = m("div"), r.c(), u(e, "class", "svelte-14lfkj4"), u(i, "class", "list svelte-14lfkj4");
    },
    m(s, o) {
      S(s, e, o), S(s, l, o), S(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 && (C(e), C(l), C(i)), r.d();
    }
  };
}
function Y8(t) {
  let e = (
    /*$data*/
    t[1].backend_properties.faulty_qubits.join(", ") + ""
  ), l;
  return {
    c() {
      l = E(e);
    },
    m(i, n) {
      S(i, l, n);
    },
    p(i, n) {
      n & /*$data*/
      2 && e !== (e = /*$data*/
      i[1].backend_properties.faulty_qubits.join(", ") + "") && U(l, e);
    },
    d(i) {
      i && C(l);
    }
  };
}
function K8(t) {
  let e;
  return {
    c() {
      e = E("None");
    },
    m(l, i) {
      S(l, e, i);
    },
    p: ne,
    d(l) {
      l && C(e);
    }
  };
}
function U8(t) {
  let e, l = (
    /*$data*/
    t[1] && Pp(t)
  );
  return {
    c() {
      l && l.c(), e = Ae();
    },
    m(i, n) {
      l && l.m(i, n), S(i, e, n);
    },
    p(i, [n]) {
      /*$data*/
      i[1] ? l ? l.p(i, n) : (l = Pp(i), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null);
    },
    i: ne,
    o: ne,
    d(i) {
      i && C(e), l && l.d(i);
    }
  };
}
const Dp = (t) => t.gate + " (" + t.qubits.join(", ") + ")";
function W8(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(s, (c) => l(1, i = c)), s), r;
  t.$$.on_destroy.push(() => n());
  let { data: s = Oe() } = e;
  a();
  let o = Oe(!0);
  at(t, o, (c) => l(2, r = c)), Tt(() => {
  });
  const _ = (c) => o.set(!r);
  return t.$$set = (c) => {
    "data" in c && a(l(0, s = c.data));
  }, [s, i, r, o, _];
}
class J8 extends Ve {
  constructor(e) {
    super(), Qe(this, e, W8, U8, Fe, { data: 0 });
  }
}
function Rp(t, e, l) {
  const i = t.slice();
  return i[43] = e[l], i;
}
function Hp(t, e, l) {
  const i = t.slice();
  return i[46] = e[l], i[48] = l, i;
}
function Lp(t, e, l) {
  const i = t.slice();
  return i[49] = e[l], i;
}
function Fp(t, e, l) {
  const i = t.slice();
  return i[49] = e[l], i;
}
function Qp(t) {
  let e, l, i, n, a = (
    /*$hide1*/
    t[17] ? "Show" : "Hide"
  ), r, s, o, _, c, d, h = !/*$hide1*/
  t[17] && Vp(t);
  return {
    c() {
      e = m("article"), l = m("h4"), i = E(`Machine view
      `), n = m("button"), r = E(a), s = N(), o = m("div"), h && h.c(), u(o, "class", "content-wrap svelte-nl4zlu"), At(o, "padding-bottom", "3.5rem"), At(o, "overflow-y", "hidden"), u(e, "class", "panel svelte-nl4zlu");
    },
    m(p, g) {
      S(p, e, g), f(e, l), f(l, i), f(l, n), f(n, r), f(e, s), f(e, o), h && h.m(o, null), _ = !0, c || (d = te(
        n,
        "click",
        /*click_handler*/
        t[26]
      ), c = !0);
    },
    p(p, g) {
      (!_ || g[0] & /*$hide1*/
      131072) && a !== (a = /*$hide1*/
      p[17] ? "Show" : "Hide") && U(r, a), /*$hide1*/
      p[17] ? h && (be(), D(h, 1, 1, () => {
        h = null;
      }), ke()) : h ? (h.p(p, g), g[0] & /*$hide1*/
      131072 && T(h, 1)) : (h = Vp(p), h.c(), T(h, 1), h.m(o, null));
    },
    i(p) {
      _ || (T(h), _ = !0);
    },
    o(p) {
      D(h), _ = !1;
    },
    d(p) {
      p && C(e), h && h.d(), c = !1, d();
    }
  };
}
function Vp(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A, M = $e(
    /*qubit_info_list*/
    t[8]
  ), z = [];
  for (let L = 0; L < M.length; L += 1)
    z[L] = Xp(Fp(t, M, L));
  let H = (
    /*qubit_stats*/
    t[12] && /*colorScale*/
    t[3] && Gp(t)
  ), B = $e(
    /*edge_info_list*/
    t[9]
  ), R = [];
  for (let L = 0; L < B.length; L += 1)
    R[L] = Yp(Lp(t, B, L));
  let P = (
    /*edge_stats*/
    t[13] && /*edgeColorScale*/
    t[4] && Kp(t)
  ), O = (
    /*qubit_edges*/
    t[1] && /*node_map*/
    t[5] && Up(t)
  ), F = (
    /*showTooltip*/
    t[14] && Zp(t)
  );
  return {
    c() {
      e = m("div"), l = m("div"), i = m("label"), i.textContent = "For Qubits:", n = N(), a = m("select");
      for (let L = 0; L < z.length; L += 1)
        z[L].c();
      r = N(), s = m("div"), H && H.c(), o = N(), _ = m("div"), c = m("label"), c.textContent = "For Edges:", d = N(), h = m("select");
      for (let L = 0; L < R.length; L += 1)
        R[L].c();
      p = N(), g = m("div"), P && P.c(), b = N(), k = m("div"), y = N(), v = m("div"), O && O.c(), q = N(), F && F.c(), $ = Ae(), u(i, "for", "qubit_rep"), u(i, "class", "svelte-nl4zlu"), u(a, "name", "qubit_rep"), u(a, "id", "qubit_rep"), u(a, "class", "svelte-nl4zlu"), u(s, "class", "stats svelte-nl4zlu"), u(c, "for", "edge_rep"), u(c, "class", "svelte-nl4zlu"), u(h, "name", "edge_rep"), u(h, "id", "edge_rep"), u(h, "class", "svelte-nl4zlu"), u(g, "class", "stats svelte-nl4zlu"), u(e, "class", "controls svelte-nl4zlu"), u(k, "class", "circuit-background-map svelte-nl4zlu"), u(k, "style", "width: 100%; height:100%; padding-bottom: 3rem;"), u(v, "class", "circuit svelte-nl4zlu"), u(v, "style", w = `width: ${/*width*/
      t[6]}px; height: ${/*height*/
      t[7]}px; padding: ${Gi}px; padding-bottom: 3rem;`);
    },
    m(L, X) {
      S(L, e, X), f(e, l), f(l, i), f(l, n), f(l, a);
      for (let V = 0; V < z.length; V += 1)
        z[V] && z[V].m(a, null);
      f(l, r), f(l, s), H && H.m(s, null), f(e, o), f(e, _), f(_, c), f(_, d), f(_, h);
      for (let V = 0; V < R.length; V += 1)
        R[V] && R[V].m(h, null);
      f(_, p), f(_, g), P && P.m(g, null), S(L, b, X), S(L, k, X), S(L, y, X), S(L, v, X), O && O.m(v, null), S(L, q, X), F && F.m(L, X), S(L, $, X), j = !0, I || (A = [
        te(
          a,
          "change",
          /*change_handler*/
          t[27]
        ),
        te(
          h,
          "change",
          /*change_handler_1*/
          t[28]
        ),
        te(
          k,
          "click",
          /*click_handler_1*/
          t[29]
        )
      ], I = !0);
    },
    p(L, X) {
      if (X[0] & /*qubit_info_list*/
      256) {
        M = $e(
          /*qubit_info_list*/
          L[8]
        );
        let V;
        for (V = 0; V < M.length; V += 1) {
          const Q = Fp(L, M, V);
          z[V] ? z[V].p(Q, X) : (z[V] = Xp(Q), z[V].c(), z[V].m(a, null));
        }
        for (; V < z.length; V += 1)
          z[V].d(1);
        z.length = M.length;
      }
      if (/*qubit_stats*/
      L[12] && /*colorScale*/
      L[3] ? H ? (H.p(L, X), X[0] & /*qubit_stats, colorScale*/
      4104 && T(H, 1)) : (H = Gp(L), H.c(), T(H, 1), H.m(s, null)) : H && (be(), D(H, 1, 1, () => {
        H = null;
      }), ke()), X[0] & /*edge_info_list*/
      512) {
        B = $e(
          /*edge_info_list*/
          L[9]
        );
        let V;
        for (V = 0; V < B.length; V += 1) {
          const Q = Lp(L, B, V);
          R[V] ? R[V].p(Q, X) : (R[V] = Yp(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*/
      L[13] && /*edgeColorScale*/
      L[4] ? P ? (P.p(L, X), X[0] & /*edge_stats, edgeColorScale*/
      8208 && T(P, 1)) : (P = Kp(L), P.c(), T(P, 1), P.m(g, null)) : P && (be(), D(P, 1, 1, () => {
        P = null;
      }), ke()), /*qubit_edges*/
      L[1] && /*node_map*/
      L[5] ? O ? (O.p(L, X), X[0] & /*qubit_edges, node_map*/
      34 && T(O, 1)) : (O = Up(L), O.c(), T(O, 1), O.m(v, null)) : O && (be(), D(O, 1, 1, () => {
        O = null;
      }), ke()), (!j || X[0] & /*width, height*/
      192 && w !== (w = `width: ${/*width*/
      L[6]}px; height: ${/*height*/
      L[7]}px; padding: ${Gi}px; padding-bottom: 3rem;`)) && u(v, "style", w), /*showTooltip*/
      L[14] ? F ? F.p(L, X) : (F = Zp(L), F.c(), F.m($.parentNode, $)) : F && (F.d(1), F = null);
    },
    i(L) {
      j || (T(H), T(P), T(O), j = !0);
    },
    o(L) {
      D(H), D(P), D(O), j = !1;
    },
    d(L) {
      L && (C(e), C(b), C(k), C(y), C(v), C(q), C($)), Ye(z, L), H && H.d(), Ye(R, L), P && P.d(), O && O.d(), F && F.d(L), I = !1, wt(A);
    }
  };
}
function Xp(t) {
  let e, l = (
    /*item*/
    (t[49].feature || /*item*/
    t[49].gate) + ""
  ), i, n, a = (
    /*item*/
    t[49].gate ? "- " + /*item*/
    t[49].type : ""
  ), r, s;
  return {
    c() {
      e = m("option"), i = E(l), n = N(), r = E(a), e.__value = s = JSON.stringify(
        /*item*/
        t[49]
      ), pt(e, e.__value);
    },
    m(o, _) {
      S(o, e, _), f(e, i), f(e, n), f(e, r);
    },
    p(o, _) {
      _[0] & /*qubit_info_list*/
      256 && l !== (l = /*item*/
      (o[49].feature || /*item*/
      o[49].gate) + "") && U(i, l), _[0] & /*qubit_info_list*/
      256 && a !== (a = /*item*/
      o[49].gate ? "- " + /*item*/
      o[49].type : "") && U(r, a), _[0] & /*qubit_info_list*/
      256 && s !== (s = JSON.stringify(
        /*item*/
        o[49]
      )) && (e.__value = s, pt(e, e.__value));
    },
    d(o) {
      o && C(e);
    }
  };
}
function Gp(t) {
  let e, l;
  return e = new Ka({
    props: {
      data: (
        /*qubit_stats*/
        t[12]
      ),
      colorScale: (
        /*colorScale*/
        t[3]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Yp(t) {
  let e, l = (
    /*item*/
    (t[49].gate || /*item*/
    t[49].feature) + ""
  ), i, n, a = (
    /*item*/
    t[49].gate ? "- " + /*item*/
    t[49].type : ""
  ), r, s;
  return {
    c() {
      e = m("option"), i = E(l), n = N(), r = E(a), e.__value = s = JSON.stringify(
        /*item*/
        t[49]
      ), pt(e, e.__value);
    },
    m(o, _) {
      S(o, e, _), f(e, i), f(e, n), f(e, r);
    },
    p(o, _) {
      _[0] & /*edge_info_list*/
      512 && l !== (l = /*item*/
      (o[49].gate || /*item*/
      o[49].feature) + "") && U(i, l), _[0] & /*edge_info_list*/
      512 && a !== (a = /*item*/
      o[49].gate ? "- " + /*item*/
      o[49].type : "") && U(r, a), _[0] & /*edge_info_list*/
      512 && s !== (s = JSON.stringify(
        /*item*/
        o[49]
      )) && (e.__value = s, pt(e, e.__value));
    },
    d(o) {
      o && C(e);
    }
  };
}
function Kp(t) {
  let e, l;
  return e = new Ka({
    props: {
      data: (
        /*edge_stats*/
        t[13]
      ),
      colorScale: (
        /*edgeColorScale*/
        t[4]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(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 || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Up(t) {
  let e, l, i, n = $e(
    /*qubit_edges*/
    t[1]
  ), a = [];
  for (let c = 0; c < n.length; c += 1)
    a[c] = Wp(Hp(t, n, c));
  const r = (c) => D(a[c], 1, 1, () => {
    a[c] = null;
  });
  let s = $e(
    /*qubit_index*/
    t[2]
  ), o = [];
  for (let c = 0; c < s.length; c += 1)
    o[c] = Jp(Rp(t, s, c));
  const _ = (c) => D(o[c], 1, 1, () => {
    o[c] = null;
  });
  return {
    c() {
      for (let c = 0; c < a.length; c += 1)
        a[c].c();
      e = N();
      for (let c = 0; c < o.length; c += 1)
        o[c].c();
      l = Ae();
    },
    m(c, d) {
      for (let h = 0; h < a.length; h += 1)
        a[h] && a[h].m(c, d);
      S(c, e, d);
      for (let h = 0; h < o.length; h += 1)
        o[h] && o[h].m(c, d);
      S(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*/
      58984498) {
        n = $e(
          /*qubit_edges*/
          c[1]
        );
        let h;
        for (h = 0; h < n.length; h += 1) {
          const p = Hp(c, n, h);
          a[h] ? (a[h].p(p, d), T(a[h], 1)) : (a[h] = Wp(p), a[h].c(), T(a[h], 1), a[h].m(e.parentNode, e));
        }
        for (be(), h = n.length; h < a.length; h += 1)
          r(h);
        ke();
      }
      if (d[0] & /*qubit_index, node_map, $qubit_info_selected, qubit_info_values, colorScale, openTooltip, hideTooltip, moveTooltip*/
      59245612) {
        s = $e(
          /*qubit_index*/
          c[2]
        );
        let h;
        for (h = 0; h < s.length; h += 1) {
          const p = Rp(c, s, h);
          o[h] ? (o[h].p(p, d), T(o[h], 1)) : (o[h] = Jp(p), o[h].c(), T(o[h], 1), o[h].m(l.parentNode, l));
        }
        for (be(), h = s.length; h < o.length; h += 1)
          _(h);
        ke();
      }
    },
    i(c) {
      if (!i) {
        for (let d = 0; d < n.length; d += 1)
          T(a[d]);
        for (let d = 0; d < s.length; d += 1)
          T(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 && (C(e), C(l)), Ye(a, c), Ye(o, c);
    }
  };
}
function Wp(t) {
  var i, n;
  let e, l;
  return e = new o0({
    props: {
      edge: (
        /*edge*/
        t[46]
      ),
      edge_nodes: (
        /*edge*/
        (i = t[46]) == null ? void 0 : i.toSorted(em).map(
          /*func_1*/
          t[30]
        )
      ),
      qubit_gap: Ha,
      edge_width: h0,
      padding: Gi,
      edge_info_value: (
        /*edge_info_values*/
        (n = t[11][
          /*edge*/
          t[46].join("-")
        ] || /*edge_info_values*/
        t[11][
          /*edge*/
          t[46][1] + "-" + /*edge*/
          t[46][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]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(a, r) {
      de(e, a, r), l = !0;
    },
    p(a, r) {
      var o, _;
      const s = {};
      r[0] & /*qubit_edges*/
      2 && (s.edge = /*edge*/
      a[46]), r[0] & /*qubit_edges, node_map*/
      34 && (s.edge_nodes = /*edge*/
      (o = a[46]) == null ? void 0 : o.toSorted(em).map(
        /*func_1*/
        a[30]
      )), r[0] & /*edge_info_values, qubit_edges, $edge_info_selected*/
      264194 && (s.edge_info_value = /*edge_info_values*/
      (_ = a[11][
        /*edge*/
        a[46].join("-")
      ] || /*edge_info_values*/
      a[11][
        /*edge*/
        a[46][1] + "-" + /*edge*/
        a[46][0]
      ]) == null ? void 0 : _.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), e.$set(s);
    },
    i(a) {
      l || (T(e.$$.fragment, a), l = !0);
    },
    o(a) {
      D(e.$$.fragment, a), l = !1;
    },
    d(a) {
      he(e, a);
    }
  };
}
function Jp(t) {
  let e, l;
  return e = new u0({
    props: {
      qubit: (
        /*qi*/
        t[43]
      ),
      qubit_node: (
        /*node_map*/
        t[5][
          /*qi*/
          t[43]
        ]
      ),
      qubit_gap: Ha,
      edge_width: h0,
      padding: Gi,
      qubit_info_value: (
        /*$qubit_info_selected*/
        t[19].feature ? (
          /*qubit_info_values*/
          t[10][
            /*qi*/
            t[43]
          ]
        ) : (
          /*qubit_info_values*/
          t[10][
            /*qi*/
            t[43]
          ].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]
      )
    }
  }), {
    c() {
      pe(e.$$.fragment);
    },
    m(i, n) {
      de(e, i, n), l = !0;
    },
    p(i, n) {
      const a = {};
      n[0] & /*qubit_index*/
      4 && (a.qubit = /*qi*/
      i[43]), n[0] & /*node_map, qubit_index*/
      36 && (a.qubit_node = /*node_map*/
      i[5][
        /*qi*/
        i[43]
      ]), 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[43]
        ]
      ) : (
        /*qubit_info_values*/
        i[10][
          /*qi*/
          i[43]
        ].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]), e.$set(a);
    },
    i(i) {
      l || (T(e.$$.fragment, i), l = !0);
    },
    o(i) {
      D(e.$$.fragment, i), l = !1;
    },
    d(i) {
      he(e, i);
    }
  };
}
function Zp(t) {
  let e, l, i = (
    /*tooltipInfo*/
    t[15].item + ""
  ), n, a, r = (
    /*tooltipInfo*/
    (t[15].key.gate || /*tooltipInfo*/
    t[15].key.feature) + ""
  ), s, o, _ = (
    /*tooltipInfo*/
    (t[15].key.type ? (
      /*tooltipInfo*/
      t[15].key.type
    ) : "") + ""
  ), c, d, h, p, g, b, k = (
    /*tooltipInfo*/
    t[15].value.value + ""
  ), y, v, w, q, $, j = (
    /*tooltipInfo*/
    t[15].value.asof + ""
  ), I, A, M, z, H, B, R, P = (
    /*tooltipInfo*/
    t[15].value.unit && xp(t)
  );
  return {
    c() {
      e = m("div"), l = m("h5"), n = E(i), a = E("–"), s = E(r), o = N(), c = E(_), d = N(), h = m("table"), p = m("tr"), g = m("th"), g.textContent = "Value", b = m("td"), y = E(k), v = N(), w = m("tr"), q = m("th"), q.textContent = "Date", $ = m("td"), I = E(j), A = N(), P && P.c(), M = N(), z = 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>', u(l, "class", "svelte-nl4zlu"), u(g, "class", "svelte-nl4zlu"), u(b, "class", "svelte-nl4zlu"), u(q, "class", "svelte-nl4zlu"), u($, "class", "svelte-nl4zlu"), u(h, "class", "svelte-nl4zlu"), u(H, "class", "close svelte-nl4zlu"), At(z, "text-align", "right"), u(e, "class", "tooltip svelte-nl4zlu");
    },
    m(O, F) {
      S(O, e, F), f(e, l), f(l, n), f(l, a), f(l, s), f(l, o), f(l, c), f(e, d), f(e, h), f(h, p), f(p, g), f(p, b), f(b, y), f(h, v), f(h, w), f(w, q), f(w, $), f($, I), f(h, A), P && P.m(h, null), f(e, M), f(e, z), f(z, H), B || (R = te(
        H,
        "click",
        /*click_handler_2*/
        t[31]
      ), B = !0);
    },
    p(O, F) {
      F[0] & /*tooltipInfo*/
      32768 && i !== (i = /*tooltipInfo*/
      O[15].item + "") && U(n, i), F[0] & /*tooltipInfo*/
      32768 && r !== (r = /*tooltipInfo*/
      (O[15].key.gate || /*tooltipInfo*/
      O[15].key.feature) + "") && U(s, r), F[0] & /*tooltipInfo*/
      32768 && _ !== (_ = /*tooltipInfo*/
      (O[15].key.type ? (
        /*tooltipInfo*/
        O[15].key.type
      ) : "") + "") && U(c, _), F[0] & /*tooltipInfo*/
      32768 && k !== (k = /*tooltipInfo*/
      O[15].value.value + "") && U(y, k), F[0] & /*tooltipInfo*/
      32768 && j !== (j = /*tooltipInfo*/
      O[15].value.asof + "") && U(I, j), /*tooltipInfo*/
      O[15].value.unit ? P ? P.p(O, F) : (P = xp(O), P.c(), P.m(h, null)) : P && (P.d(1), P = null);
    },
    d(O) {
      O && C(e), P && P.d(), B = !1, R();
    }
  };
}
function xp(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), u(l, "class", "svelte-nl4zlu"), u(i, "class", "svelte-nl4zlu");
    },
    m(r, s) {
      S(r, e, s), f(e, l), f(e, i), f(i, a);
    },
    p(r, s) {
      s[0] & /*tooltipInfo*/
      32768 && n !== (n = /*tooltipInfo*/
      r[15].value.unit + "") && U(a, n);
    },
    d(r) {
      r && C(e);
    }
  };
}
function Z8(t) {
  let e, l, i = (
    /*$data*/
    t[16] && Qp(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(n, a) {
      i && i.m(n, a), S(n, e, a), l = !0;
    },
    p(n, a) {
      /*$data*/
      n[16] ? i ? (i.p(n, a), a[0] & /*$data*/
      65536 && T(i, 1)) : (i = Qp(n), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d(n);
    }
  };
}
let Ha = 45, h0 = 15, Gi = 20;
const em = (t, e) => t - e;
function x8(t, e, l) {
  let i, n = ne, a = () => (n(), n = st(_, (ve) => l(16, i = ve)), _), r, s, o;
  t.$$.on_destroy.push(() => n());
  let { data: _ = Oe() } = e;
  a();
  let c, d, h, p, g;
  const b = ["id", "rz", "sx", "x"], k = ["cx", "ecr"];
  let y = Oe(!0);
  at(t, y, (ve) => l(17, r = ve));
  let v, w, q, $ = 0, j = 0, I = 0, A = 0, M = [], z = [], H = Oe(), B = Oe();
  at(t, H, (ve) => l(19, o = ve)), at(t, B, (ve) => l(18, s = ve));
  function R(ve) {
    $ = Math.max(...ve.map((G) => G.y)) + 1, j = Math.max(...ve.map((G) => G.x)) + 1, l(6, I = (j - 1) * Ha + Gi * 2), l(7, A = $ * Ha + Gi * 2), l(5, q = {});
    for (const G of ve)
      l(5, q[G.index] = G, q);
    p && l(8, M = Object.keys(p[0]).filter((G) => G !== "index").map((G) => ({ feature: G })));
    let me = [], fe = [];
    l(9, z = []), g.forEach((G) => {
      k.includes(G.gate) && !fe.includes(G.gate) && (z.push({ gate: G.gate, type: "error" }), z.push({ gate: G.gate, type: "length" }), fe.push(G.gate)), b.includes(G.gate) && !me.includes(G.gate) && (M.push({ gate: G.gate, type: "error" }), M.push({ gate: G.gate, type: "length" }), me.push(G.gate));
    }), H.set(M[0]), B.set(z[0]);
  }
  let P = [], O = {}, F, L;
  H.subscribe((ve) => {
    if (l(10, P = []), ve != null && ve.feature) {
      l(10, P = p.map((ye) => ye[ve.feature]));
      let me = P.map((ye) => ye.value), [fe, G] = [Math.min(...me), Math.max(...me)];
      l(12, F = {
        min: fe,
        max: G,
        mean: Di(me),
        median: Ri(me),
        values: me
      }), ["frequency", "readout_error"].includes(ve.feature) ? l(3, v = kl(Ol).domain([G, fe])) : l(3, v = kl(Ol).domain([fe, G]));
    } else if (ve != null && ve.gate) {
      l(10, P = g.filter((ye) => ye.gate === ve.gate).map((ye) => (ye.qubit = ye.qubits[0], ye)).toSorted((ye, ue) => ye.qubit - ue.qubit));
      let me = P.map((ye) => ye.parameters["gate_" + ve.type].value), [fe, G] = [Math.min(...me), Math.max(...me)];
      l(12, F = {
        min: fe,
        max: G,
        mean: Di(me),
        median: Ri(me),
        values: me
      }), l(3, v = kl(Ol).domain([G, fe]));
    }
  }), B.subscribe((ve) => {
    if (l(11, O = {}), ve != null && ve.gate) {
      g.filter((ue) => ue.gate === ve.gate).forEach((ue) => {
        l(11, O[ue.qubits.join("-")] = ue, O);
      });
      let fe = Object.keys(O).map((ue) => {
        var le;
        return (le = O[ue].parameters["gate_" + ve.type]) == null ? void 0 : le.value;
      }), [G, ye] = [Math.min(...fe), Math.max(...fe)];
      l(13, L = {
        min: G,
        max: ye,
        mean: Di(fe),
        median: Ri(fe),
        values: fe
      }), l(4, w = kl(Ol).domain([ye, G]));
    }
  });
  let X = !1, V = !1, Q = {};
  function Z(ve, me, fe, G, ye, ue, le) {
    V && !le || (l(14, X = !0), l(15, Q = { item: me, key: fe, value: G }), V = le, Array.from(document.querySelectorAll(".circuit-element")).forEach((oe) => {
      oe.style.outline = null;
    }), document.querySelector("#" + ye) && (document.querySelector("#" + ye).style.outline = "2px solid black"));
  }
  function ae(ve) {
    X && (tooltipX = ve.screenX - mouse_adj.x, tooltipY = ve.screenY - mouse_adj.y);
  }
  function se(ve) {
    V || l(14, X = !1), ve && (l(14, X = !1), l(15, Q = void 0), V = !1, Array.from(document.querySelectorAll(".circuit-element")).forEach((me) => {
      me.style.outline = null;
    }));
  }
  function K(ve) {
    var me, fe, G, ye, ue;
    d = (me = ve.machine_design) == null ? void 0 : me.nodes, l(1, c = (fe = ve.machine_design) == null ? void 0 : fe.edges), l(2, h = (G = ve.machine_design) == null ? void 0 : G.index), p = (ye = ve.backend_properties) == null ? void 0 : ye.qubits, g = (ue = ve.backend_properties) == null ? void 0 : ue.gates;
  }
  Tt(() => {
    _.subscribe((ve) => {
      K(ve), d && R(d);
    });
  });
  const Y = (ve) => y.set(!r), W = (ve) => {
    H.set(JSON.parse(ve.target.value));
  }, J = (ve) => {
    B.set(JSON.parse(ve.target.value));
  }, ee = () => {
    se(!0);
  }, we = (ve) => q[ve], Re = () => {
    se(!0);
  };
  return t.$$set = (ve) => {
    "data" in ve && a(l(0, _ = ve.data));
  }, [
    _,
    c,
    h,
    v,
    w,
    q,
    I,
    A,
    M,
    z,
    P,
    O,
    F,
    L,
    X,
    Q,
    i,
    r,
    s,
    o,
    y,
    H,
    B,
    Z,
    ae,
    se,
    Y,
    W,
    J,
    ee,
    we,
    Re
  ];
}
class e7 extends Ve {
  constructor(e) {
    super(), Qe(this, e, x8, Z8, Fe, { data: 0 }, null, [-1, -1]);
  }
}
function tm(t) {
  let e, l, i, n, a, r, s, o, _, c, d, h, p, g, b, k, y, v, w, q, $, j, I, A;
  return a = new V$({ props: { data: (
    /*data*/
    t[1]
  ) } }), s = new i6({ props: { data: (
    /*data*/
    t[1]
  ) } }), _ = new t8({ props: { data: (
    /*data*/
    t[1]
  ) } }), d = new $1({
    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 $1({
    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
        )
      }
    }
  }), b = new e7({ props: { data: (
    /*data*/
    t[1]
  ) } }), y = new f6({ props: { data: (
    /*data*/
    t[1]
  ) } }), w = new H8({ props: { data: (
    /*data*/
    t[1]
  ) } }), $ = new V8({ props: { data: (
    /*data*/
    t[1]
  ) } }), I = new J8({ props: { data: (
    /*data*/
    t[1]
  ) } }), {
    c() {
      e = m("div"), l = m("h3"), l.textContent = "Quantum Job Viewer", i = N(), n = m("div"), pe(a.$$.fragment), r = N(), pe(s.$$.fragment), o = N(), pe(_.$$.fragment), c = N(), pe(d.$$.fragment), h = N(), pe(p.$$.fragment), g = N(), pe(b.$$.fragment), k = N(), pe(y.$$.fragment), v = N(), pe(w.$$.fragment), q = N(), pe($.$$.fragment), j = N(), pe(I.$$.fragment), u(l, "class", "svelte-1147w99"), u(n, "class", "panel-wrapper svelte-1147w99"), u(e, "class", "wrap svelte-1147w99");
    },
    m(M, z) {
      S(M, e, z), f(e, l), f(e, i), f(e, n), de(a, n, null), f(n, r), de(s, n, null), f(n, o), de(_, n, null), f(n, c), de(d, n, null), f(n, h), de(p, n, null), f(n, g), de(b, n, null), f(n, k), de(y, n, null), f(n, v), de(w, n, null), f(n, q), de($, n, null), f(n, j), de(I, n, null), A = !0;
    },
    p(M, z) {
      const H = {};
      z & /*$data*/
      1 && (H.circuit_data = {
        layers: (
          /*$data*/
          M[0].original_circuit_layout
        ),
        qubits: [],
        qubits: [],
        global_phase: (
          /*$data*/
          M[0].original_circuit_global_phase
        ),
        layer_index: (
          /*$data*/
          M[0].original_circuit_layout_index
        )
      }), z & /*$data*/
      1 && (H.bit_match = /*$data*/
      M[0].bit_match), z & /*$data*/
      1 && (H.pagination = {
        page: (
          /*$data*/
          M[0].original_circuit_page
        ),
        range: (
          /*$data*/
          M[0].original_circuit_page_range
        ),
        total_page: (
          /*$data*/
          M[0].original_circuit_total_page
        )
      }), d.$set(H);
      const B = {};
      z & /*$data*/
      1 && (B.circuit_data = {
        layers: (
          /*$data*/
          M[0].transpiled_circuit_layout
        ),
        qubits: [],
        global_phase: (
          /*$data*/
          M[0].transpiled_circuit_global_phase
        ),
        layer_index: (
          /*$data*/
          M[0].transpiled_circuit_layout_index
        )
      }), z & /*$data*/
      1 && (B.bit_match = /*$data*/
      M[0].bit_match), z & /*$data*/
      1 && (B.pagination = {
        page: (
          /*$data*/
          M[0].transpiled_circuit_page
        ),
        range: (
          /*$data*/
          M[0].transpiled_circuit_page_range
        ),
        total_page: (
          /*$data*/
          M[0].transpiled_circuit_total_page
        )
      }), p.$set(B);
    },
    i(M) {
      A || (T(a.$$.fragment, M), T(s.$$.fragment, M), T(_.$$.fragment, M), T(d.$$.fragment, M), T(p.$$.fragment, M), T(b.$$.fragment, M), T(y.$$.fragment, M), T(w.$$.fragment, M), T($.$$.fragment, M), T(I.$$.fragment, M), A = !0);
    },
    o(M) {
      D(a.$$.fragment, M), D(s.$$.fragment, M), D(_.$$.fragment, M), D(d.$$.fragment, M), D(p.$$.fragment, M), D(b.$$.fragment, M), D(y.$$.fragment, M), D(w.$$.fragment, M), D($.$$.fragment, M), D(I.$$.fragment, M), A = !1;
    },
    d(M) {
      M && C(e), he(a), he(s), he(_), he(d), he(p), he(b), he(y), he(w), he($), he(I);
    }
  };
}
function t7(t) {
  let e, l, i = (
    /*$data*/
    t[0] && tm(t)
  );
  return {
    c() {
      i && i.c(), e = Ae();
    },
    m(n, a) {
      i && i.m(n, a), S(n, e, a), l = !0;
    },
    p(n, [a]) {
      /*$data*/
      n[0] ? i ? (i.p(n, a), a & /*$data*/
      1 && T(i, 1)) : (i = tm(n), i.c(), T(i, 1), i.m(e.parentNode, e)) : i && (be(), D(i, 1, 1, () => {
        i = null;
      }), ke());
    },
    i(n) {
      l || (T(i), l = !0);
    },
    o(n) {
      D(i), l = !1;
    },
    d(n) {
      n && C(e), i && i.d(n);
    }
  };
}
function l7(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}`, _ = () => {
    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 g in d.append[p])
          h[p][g] = d.append[p][g];
    }), h)), console.log(i);
  }, c = Oe();
  return at(t, c, (d) => l(0, i = d)), Tt(() => {
    c.subscribe((d) => {
      var h;
      d && !d.physical_qubits && (d.physical_qubits = [], d.bit_match && (d.physical_qubits = d.bit_match.filter((p) => !p.is_ancilla).map((p) => p.to))), (h = d == null ? void 0 : d.backend_properties) != null && h.qubits && d.backend_properties.qubits.forEach((p, g) => {
        p.index = { value: g };
      });
    }), c.set(s), console.log(i), n.on(o, _);
  }), ri(() => {
    n.off(o, _);
  }), 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 i7 extends Ve {
  constructor(e) {
    super(), Qe(this, e, l7, t7, Fe, { model: 2, key_data: 3, key_update: 4 });
  }
}
function s7({ model: t, el: e }) {
  if (t.get("mode") === "view") {
    let l = new kw({ target: e, props: { model: t } });
    return () => l.$destroy();
  } else if (t.get("mode") === "write") {
    let l = new g3({ target: e, props: { model: t } });
    return () => l.$destroy();
  } else if (t.get("mode") === "machine") {
    let l = new e$({ target: e, props: { model: t } });
    return () => l.$destroy();
  } else if (t.get("mode") === "result") {
    let l = new i7({ target: e, props: { model: t } });
    return () => l.$destroy();
  } else if (t.get("mode") === "uncertainty") {
    let l = new L$({ target: e, props: { model: t } });
    return () => l.$destroy();
  }
}
export {
  s7 as render
};
