var ni = Object.defineProperty;
var ii = (t, e, i) => e in t ? ni(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
var nt = (t, e, i) => (ii(t, typeof e != "symbol" ? e + "" : e, i), i), $t = (t, e, i) => {
  if (!e.has(t))
    throw TypeError("Cannot " + i);
};
var a = (t, e, i) => ($t(t, e, "read from private field"), i ? i.call(t) : e.get(t)), W = (t, e, i) => {
  if (e.has(t))
    throw TypeError("Cannot add the same private member more than once");
  e instanceof WeakSet ? e.add(t) : e.set(t, i);
}, oe = (t, e, i, n) => ($t(t, e, "write to private field"), n ? n.call(t, i) : e.set(t, i), i);
var _t = (t, e, i, n) => ({
  set _(s) {
    oe(t, e, s, i);
  },
  get _() {
    return a(t, e, n);
  }
}), K = (t, e, i) => ($t(t, e, "access private method"), i);
const {
  SvelteComponent: SvelteComponent$e,
  append: append$d,
  attr: attr$d,
  detach: detach$e,
  init: init$e,
  insert: insert$e,
  noop: noop$7,
  safe_not_equal: safe_not_equal$f,
  set_style: set_style$6,
  svg_element: svg_element$5
} = window.__gradio__svelte__internal;
function create_fragment$e(t) {
  let e, i, n, s;
  return {
    c() {
      e = svg_element$5("svg"), i = svg_element$5("g"), n = svg_element$5("path"), s = svg_element$5("path"), attr$d(n, "d", "M18,6L6.087,17.913"), set_style$6(n, "fill", "none"), set_style$6(n, "fill-rule", "nonzero"), set_style$6(n, "stroke-width", "2px"), attr$d(i, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), attr$d(s, "d", "M4.364,4.364L19.636,19.636"), set_style$6(s, "fill", "none"), set_style$6(s, "fill-rule", "nonzero"), set_style$6(s, "stroke-width", "2px"), attr$d(e, "width", "100%"), attr$d(e, "height", "100%"), attr$d(e, "viewBox", "0 0 24 24"), attr$d(e, "version", "1.1"), attr$d(e, "xmlns", "http://www.w3.org/2000/svg"), attr$d(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), attr$d(e, "xml:space", "preserve"), attr$d(e, "stroke", "currentColor"), set_style$6(e, "fill-rule", "evenodd"), set_style$6(e, "clip-rule", "evenodd"), set_style$6(e, "stroke-linecap", "round"), set_style$6(e, "stroke-linejoin", "round");
    },
    m(l, h) {
      insert$e(l, e, h), append$d(e, i), append$d(i, n), append$d(e, s);
    },
    p: noop$7,
    i: noop$7,
    o: noop$7,
    d(l) {
      l && detach$e(e);
    }
  };
}
class Clear extends SvelteComponent$e {
  constructor(e) {
    super(), init$e(this, e, null, create_fragment$e, safe_not_equal$f, {});
  }
}
const DropdownArrow_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$d,
  append: append$c,
  attr: attr$c,
  detach: detach$d,
  init: init$d,
  insert: insert$d,
  noop: noop$6,
  safe_not_equal: safe_not_equal$e,
  svg_element: svg_element$4
} = window.__gradio__svelte__internal;
function create_fragment$d(t) {
  let e, i;
  return {
    c() {
      e = svg_element$4("svg"), i = svg_element$4("path"), attr$c(i, "d", "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"), attr$c(e, "xmlns", "http://www.w3.org/2000/svg"), attr$c(e, "width", "100%"), attr$c(e, "height", "100%"), attr$c(e, "viewBox", "0 0 24 24"), attr$c(e, "fill", "none"), attr$c(e, "stroke", "currentColor"), attr$c(e, "stroke-width", "1.5"), attr$c(e, "stroke-linecap", "round"), attr$c(e, "stroke-linejoin", "round"), attr$c(e, "class", "feather feather-edit-2");
    },
    m(n, s) {
      insert$d(n, e, s), append$c(e, i);
    },
    p: noop$6,
    i: noop$6,
    o: noop$6,
    d(n) {
      n && detach$d(e);
    }
  };
}
class Edit extends SvelteComponent$d {
  constructor(e) {
    super(), init$d(this, e, null, create_fragment$d, safe_not_equal$e, {});
  }
}
const {
  SvelteComponent: SvelteComponent$c,
  append: append$b,
  attr: attr$b,
  detach: detach$c,
  init: init$c,
  insert: insert$c,
  noop: noop$5,
  safe_not_equal: safe_not_equal$d,
  svg_element: svg_element$3
} = window.__gradio__svelte__internal;
function create_fragment$c(t) {
  let e, i, n;
  return {
    c() {
      e = svg_element$3("svg"), i = svg_element$3("path"), n = svg_element$3("polyline"), attr$b(i, "d", "M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"), attr$b(n, "points", "13 2 13 9 20 9"), attr$b(e, "xmlns", "http://www.w3.org/2000/svg"), attr$b(e, "width", "100%"), attr$b(e, "height", "100%"), attr$b(e, "viewBox", "0 0 24 24"), attr$b(e, "fill", "none"), attr$b(e, "stroke", "currentColor"), attr$b(e, "stroke-width", "1.5"), attr$b(e, "stroke-linecap", "round"), attr$b(e, "stroke-linejoin", "round"), attr$b(e, "class", "feather feather-file");
    },
    m(s, l) {
      insert$c(s, e, l), append$b(e, i), append$b(e, n);
    },
    p: noop$5,
    i: noop$5,
    o: noop$5,
    d(s) {
      s && detach$c(e);
    }
  };
}
let File$1 = class extends SvelteComponent$c {
  constructor(e) {
    super(), init$c(this, e, null, create_fragment$c, safe_not_equal$d, {});
  }
};
const {
  SvelteComponent: SvelteComponent$b,
  append: append$a,
  attr: attr$a,
  detach: detach$b,
  init: init$b,
  insert: insert$b,
  noop: noop$4,
  safe_not_equal: safe_not_equal$c,
  svg_element: svg_element$2
} = window.__gradio__svelte__internal;
function create_fragment$b(t) {
  let e, i, n;
  return {
    c() {
      e = svg_element$2("svg"), i = svg_element$2("polyline"), n = svg_element$2("path"), attr$a(i, "points", "1 4 1 10 7 10"), attr$a(n, "d", "M3.51 15a9 9 0 1 0 2.13-9.36L1 10"), attr$a(e, "xmlns", "http://www.w3.org/2000/svg"), attr$a(e, "width", "100%"), attr$a(e, "height", "100%"), attr$a(e, "viewBox", "0 0 24 24"), attr$a(e, "fill", "none"), attr$a(e, "stroke", "currentColor"), attr$a(e, "stroke-width", "2"), attr$a(e, "stroke-linecap", "round"), attr$a(e, "stroke-linejoin", "round"), attr$a(e, "class", "feather feather-rotate-ccw");
    },
    m(s, l) {
      insert$b(s, e, l), append$a(e, i), append$a(e, n);
    },
    p: noop$4,
    i: noop$4,
    o: noop$4,
    d(s) {
      s && detach$b(e);
    }
  };
}
class Undo extends SvelteComponent$b {
  constructor(e) {
    super(), init$b(this, e, null, create_fragment$b, safe_not_equal$c, {});
  }
}
const {
  SvelteComponent: SvelteComponent$a,
  append: append$9,
  attr: attr$9,
  detach: detach$a,
  init: init$a,
  insert: insert$a,
  noop: noop$3,
  safe_not_equal: safe_not_equal$b,
  svg_element: svg_element$1
} = window.__gradio__svelte__internal;
function create_fragment$a(t) {
  let e, i, n, s;
  return {
    c() {
      e = svg_element$1("svg"), i = svg_element$1("path"), n = svg_element$1("polyline"), s = svg_element$1("line"), attr$9(i, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), attr$9(n, "points", "17 8 12 3 7 8"), attr$9(s, "x1", "12"), attr$9(s, "y1", "3"), attr$9(s, "x2", "12"), attr$9(s, "y2", "15"), attr$9(e, "xmlns", "http://www.w3.org/2000/svg"), attr$9(e, "width", "90%"), attr$9(e, "height", "90%"), attr$9(e, "viewBox", "0 0 24 24"), attr$9(e, "fill", "none"), attr$9(e, "stroke", "currentColor"), attr$9(e, "stroke-width", "2"), attr$9(e, "stroke-linecap", "round"), attr$9(e, "stroke-linejoin", "round"), attr$9(e, "class", "feather feather-upload");
    },
    m(l, h) {
      insert$a(l, e, h), append$9(e, i), append$9(e, n), append$9(e, s);
    },
    p: noop$3,
    i: noop$3,
    o: noop$3,
    d(l) {
      l && detach$a(e);
    }
  };
}
let Upload$1 = class extends SvelteComponent$a {
  constructor(e) {
    super(), init$a(this, e, null, create_fragment$a, safe_not_equal$b, {});
  }
};
const PdfUploadText_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$9,
  append: append$8,
  attr: attr$8,
  create_component: create_component$5,
  destroy_component: destroy_component$5,
  detach: detach$9,
  element: element$9,
  init: init$9,
  insert: insert$9,
  mount_component: mount_component$5,
  safe_not_equal: safe_not_equal$a,
  text: text$4,
  toggle_class: toggle_class$8,
  transition_in: transition_in$8,
  transition_out: transition_out$8
} = window.__gradio__svelte__internal;
function create_fragment$9(t) {
  let e, i, n, s, l, h, _;
  return n = new Upload$1({}), {
    c() {
      e = element$9("div"), i = element$9("span"), create_component$5(n.$$.fragment), s = text$4(`
    Drop PDF
    `), l = element$9("span"), l.textContent = "- or -", h = text$4(`
    Click to Upload`), attr$8(i, "class", "icon-wrap svelte-kzcjhc"), toggle_class$8(
        i,
        "hovered",
        /*hovered*/
        t[0]
      ), attr$8(l, "class", "or svelte-kzcjhc"), attr$8(e, "class", "wrap svelte-kzcjhc");
    },
    m(c, o) {
      insert$9(c, e, o), append$8(e, i), mount_component$5(n, i, null), append$8(e, s), append$8(e, l), append$8(e, h), _ = !0;
    },
    p(c, [o]) {
      (!_ || o & /*hovered*/
      1) && toggle_class$8(
        i,
        "hovered",
        /*hovered*/
        c[0]
      );
    },
    i(c) {
      _ || (transition_in$8(n.$$.fragment, c), _ = !0);
    },
    o(c) {
      transition_out$8(n.$$.fragment, c), _ = !1;
    },
    d(c) {
      c && detach$9(e), destroy_component$5(n);
    }
  };
}
function instance$9(t, e, i) {
  let { hovered: n = !1 } = e;
  return t.$$set = (s) => {
    "hovered" in s && i(0, n = s.hovered);
  }, [n];
}
class PdfUploadText extends SvelteComponent$9 {
  constructor(e) {
    super(), init$9(this, e, instance$9, create_fragment$9, safe_not_equal$a, { hovered: 0 });
  }
}
const Block_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$8,
  assign: assign$1,
  create_slot: create_slot$3,
  detach: detach$8,
  element: element$8,
  get_all_dirty_from_scope: get_all_dirty_from_scope$3,
  get_slot_changes: get_slot_changes$3,
  get_spread_update: get_spread_update$1,
  init: init$8,
  insert: insert$8,
  safe_not_equal: safe_not_equal$9,
  set_dynamic_element_data,
  set_style: set_style$5,
  toggle_class: toggle_class$7,
  transition_in: transition_in$7,
  transition_out: transition_out$7,
  update_slot_base: update_slot_base$3
} = window.__gradio__svelte__internal;
function create_dynamic_element(t) {
  let e, i, n;
  const s = (
    /*#slots*/
    t[17].default
  ), l = create_slot$3(
    s,
    t,
    /*$$scope*/
    t[16],
    null
  );
  let h = [
    { "data-testid": (
      /*test_id*/
      t[7]
    ) },
    { id: (
      /*elem_id*/
      t[2]
    ) },
    {
      class: i = "block " + /*elem_classes*/
      t[3].join(" ") + " svelte-1t38q2d"
    }
  ], _ = {};
  for (let c = 0; c < h.length; c += 1)
    _ = assign$1(_, h[c]);
  return {
    c() {
      e = element$8(
        /*tag*/
        t[14]
      ), l && l.c(), set_dynamic_element_data(
        /*tag*/
        t[14]
      )(e, _), toggle_class$7(
        e,
        "hidden",
        /*visible*/
        t[10] === !1
      ), toggle_class$7(
        e,
        "padded",
        /*padding*/
        t[6]
      ), toggle_class$7(
        e,
        "border_focus",
        /*border_mode*/
        t[5] === "focus"
      ), toggle_class$7(e, "hide-container", !/*explicit_call*/
      t[8] && !/*container*/
      t[9]), set_style$5(e, "height", typeof /*height*/
      t[0] == "number" ? (
        /*height*/
        t[0] + "px"
      ) : void 0), set_style$5(e, "width", typeof /*width*/
      t[1] == "number" ? `calc(min(${/*width*/
      t[1]}px, 100%))` : void 0), set_style$5(
        e,
        "border-style",
        /*variant*/
        t[4]
      ), set_style$5(
        e,
        "overflow",
        /*allow_overflow*/
        t[11] ? "visible" : "hidden"
      ), set_style$5(
        e,
        "flex-grow",
        /*scale*/
        t[12]
      ), set_style$5(e, "min-width", `calc(min(${/*min_width*/
      t[13]}px, 100%))`), set_style$5(e, "border-width", "var(--block-border-width)");
    },
    m(c, o) {
      insert$8(c, e, o), l && l.m(e, null), n = !0;
    },
    p(c, o) {
      l && l.p && (!n || o & /*$$scope*/
      65536) && update_slot_base$3(
        l,
        s,
        c,
        /*$$scope*/
        c[16],
        n ? get_slot_changes$3(
          s,
          /*$$scope*/
          c[16],
          o,
          null
        ) : get_all_dirty_from_scope$3(
          /*$$scope*/
          c[16]
        ),
        null
      ), set_dynamic_element_data(
        /*tag*/
        c[14]
      )(e, _ = get_spread_update$1(h, [
        (!n || o & /*test_id*/
        128) && { "data-testid": (
          /*test_id*/
          c[7]
        ) },
        (!n || o & /*elem_id*/
        4) && { id: (
          /*elem_id*/
          c[2]
        ) },
        (!n || o & /*elem_classes*/
        8 && i !== (i = "block " + /*elem_classes*/
        c[3].join(" ") + " svelte-1t38q2d")) && { class: i }
      ])), toggle_class$7(
        e,
        "hidden",
        /*visible*/
        c[10] === !1
      ), toggle_class$7(
        e,
        "padded",
        /*padding*/
        c[6]
      ), toggle_class$7(
        e,
        "border_focus",
        /*border_mode*/
        c[5] === "focus"
      ), toggle_class$7(e, "hide-container", !/*explicit_call*/
      c[8] && !/*container*/
      c[9]), o & /*height*/
      1 && set_style$5(e, "height", typeof /*height*/
      c[0] == "number" ? (
        /*height*/
        c[0] + "px"
      ) : void 0), o & /*width*/
      2 && set_style$5(e, "width", typeof /*width*/
      c[1] == "number" ? `calc(min(${/*width*/
      c[1]}px, 100%))` : void 0), o & /*variant*/
      16 && set_style$5(
        e,
        "border-style",
        /*variant*/
        c[4]
      ), o & /*allow_overflow*/
      2048 && set_style$5(
        e,
        "overflow",
        /*allow_overflow*/
        c[11] ? "visible" : "hidden"
      ), o & /*scale*/
      4096 && set_style$5(
        e,
        "flex-grow",
        /*scale*/
        c[12]
      ), o & /*min_width*/
      8192 && set_style$5(e, "min-width", `calc(min(${/*min_width*/
      c[13]}px, 100%))`);
    },
    i(c) {
      n || (transition_in$7(l, c), n = !0);
    },
    o(c) {
      transition_out$7(l, c), n = !1;
    },
    d(c) {
      c && detach$8(e), l && l.d(c);
    }
  };
}
function create_fragment$8(t) {
  let e, i = (
    /*tag*/
    t[14] && create_dynamic_element(t)
  );
  return {
    c() {
      i && i.c();
    },
    m(n, s) {
      i && i.m(n, s), e = !0;
    },
    p(n, [s]) {
      /*tag*/
      n[14] && i.p(n, s);
    },
    i(n) {
      e || (transition_in$7(i, n), e = !0);
    },
    o(n) {
      transition_out$7(i, n), e = !1;
    },
    d(n) {
      i && i.d(n);
    }
  };
}
function instance$8(t, e, i) {
  let { $$slots: n = {}, $$scope: s } = e, { height: l = void 0 } = e, { width: h = void 0 } = e, { elem_id: _ = "" } = e, { elem_classes: c = [] } = e, { variant: o = "solid" } = e, { border_mode: r = "base" } = e, { padding: T = !0 } = e, { type: S = "normal" } = e, { test_id: w = void 0 } = e, { explicit_call: C = !1 } = e, { container: P = !0 } = e, { visible: b = !0 } = e, { allow_overflow: k = !0 } = e, { scale: F = null } = e, { min_width: x = 0 } = e, y = S === "fieldset" ? "fieldset" : "div";
  return t.$$set = (p) => {
    "height" in p && i(0, l = p.height), "width" in p && i(1, h = p.width), "elem_id" in p && i(2, _ = p.elem_id), "elem_classes" in p && i(3, c = p.elem_classes), "variant" in p && i(4, o = p.variant), "border_mode" in p && i(5, r = p.border_mode), "padding" in p && i(6, T = p.padding), "type" in p && i(15, S = p.type), "test_id" in p && i(7, w = p.test_id), "explicit_call" in p && i(8, C = p.explicit_call), "container" in p && i(9, P = p.container), "visible" in p && i(10, b = p.visible), "allow_overflow" in p && i(11, k = p.allow_overflow), "scale" in p && i(12, F = p.scale), "min_width" in p && i(13, x = p.min_width), "$$scope" in p && i(16, s = p.$$scope);
  }, [
    l,
    h,
    _,
    c,
    o,
    r,
    T,
    w,
    C,
    P,
    b,
    k,
    F,
    x,
    y,
    S,
    s,
    n
  ];
}
class Block extends SvelteComponent$8 {
  constructor(e) {
    super(), init$8(this, e, instance$8, create_fragment$8, safe_not_equal$9, {
      height: 0,
      width: 1,
      elem_id: 2,
      elem_classes: 3,
      variant: 4,
      border_mode: 5,
      padding: 6,
      type: 15,
      test_id: 7,
      explicit_call: 8,
      container: 9,
      visible: 10,
      allow_overflow: 11,
      scale: 12,
      min_width: 13
    });
  }
}
const Info_svelte_svelte_type_style_lang = "", BlockTitle_svelte_svelte_type_style_lang = "", BlockLabel_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$7,
  append: append$7,
  attr: attr$7,
  create_component: create_component$4,
  destroy_component: destroy_component$4,
  detach: detach$7,
  element: element$7,
  init: init$7,
  insert: insert$7,
  mount_component: mount_component$4,
  safe_not_equal: safe_not_equal$8,
  set_data: set_data$3,
  space: space$6,
  text: text$3,
  toggle_class: toggle_class$6,
  transition_in: transition_in$6,
  transition_out: transition_out$6
} = window.__gradio__svelte__internal;
function create_fragment$7(t) {
  let e, i, n, s, l, h;
  return n = new /*Icon*/
  t[1]({}), {
    c() {
      e = element$7("label"), i = element$7("span"), create_component$4(n.$$.fragment), s = space$6(), l = text$3(
        /*label*/
        t[0]
      ), attr$7(i, "class", "svelte-9gxdi0"), attr$7(e, "for", ""), attr$7(e, "data-testid", "block-label"), attr$7(e, "class", "svelte-9gxdi0"), toggle_class$6(e, "hide", !/*show_label*/
      t[2]), toggle_class$6(e, "sr-only", !/*show_label*/
      t[2]), toggle_class$6(
        e,
        "float",
        /*float*/
        t[4]
      ), toggle_class$6(
        e,
        "hide-label",
        /*disable*/
        t[3]
      );
    },
    m(_, c) {
      insert$7(_, e, c), append$7(e, i), mount_component$4(n, i, null), append$7(e, s), append$7(e, l), h = !0;
    },
    p(_, [c]) {
      (!h || c & /*label*/
      1) && set_data$3(
        l,
        /*label*/
        _[0]
      ), (!h || c & /*show_label*/
      4) && toggle_class$6(e, "hide", !/*show_label*/
      _[2]), (!h || c & /*show_label*/
      4) && toggle_class$6(e, "sr-only", !/*show_label*/
      _[2]), (!h || c & /*float*/
      16) && toggle_class$6(
        e,
        "float",
        /*float*/
        _[4]
      ), (!h || c & /*disable*/
      8) && toggle_class$6(
        e,
        "hide-label",
        /*disable*/
        _[3]
      );
    },
    i(_) {
      h || (transition_in$6(n.$$.fragment, _), h = !0);
    },
    o(_) {
      transition_out$6(n.$$.fragment, _), h = !1;
    },
    d(_) {
      _ && detach$7(e), destroy_component$4(n);
    }
  };
}
function instance$7(t, e, i) {
  let { label: n = null } = e, { Icon: s } = e, { show_label: l = !0 } = e, { disable: h = !1 } = e, { float: _ = !0 } = e;
  return t.$$set = (c) => {
    "label" in c && i(0, n = c.label), "Icon" in c && i(1, s = c.Icon), "show_label" in c && i(2, l = c.show_label), "disable" in c && i(3, h = c.disable), "float" in c && i(4, _ = c.float);
  }, [n, s, l, h, _];
}
class BlockLabel extends SvelteComponent$7 {
  constructor(e) {
    super(), init$7(this, e, instance$7, create_fragment$7, safe_not_equal$8, {
      label: 0,
      Icon: 1,
      show_label: 2,
      disable: 3,
      float: 4
    });
  }
}
const IconButton_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$6,
  append: append$6,
  attr: attr$6,
  bubble: bubble$2,
  create_component: create_component$3,
  destroy_component: destroy_component$3,
  detach: detach$6,
  element: element$6,
  init: init$6,
  insert: insert$6,
  listen: listen$2,
  mount_component: mount_component$3,
  safe_not_equal: safe_not_equal$7,
  set_data: set_data$2,
  space: space$5,
  text: text$2,
  toggle_class: toggle_class$5,
  transition_in: transition_in$5,
  transition_out: transition_out$5
} = window.__gradio__svelte__internal;
function create_if_block$4(t) {
  let e, i;
  return {
    c() {
      e = element$6("span"), i = text$2(
        /*label*/
        t[1]
      ), attr$6(e, "class", "svelte-xtz2g8");
    },
    m(n, s) {
      insert$6(n, e, s), append$6(e, i);
    },
    p(n, s) {
      s & /*label*/
      2 && set_data$2(
        i,
        /*label*/
        n[1]
      );
    },
    d(n) {
      n && detach$6(e);
    }
  };
}
function create_fragment$6(t) {
  let e, i, n, s, l, h, _, c = (
    /*show_label*/
    t[2] && create_if_block$4(t)
  );
  return s = new /*Icon*/
  t[0]({}), {
    c() {
      e = element$6("button"), c && c.c(), i = space$5(), n = element$6("div"), create_component$3(s.$$.fragment), attr$6(n, "class", "svelte-xtz2g8"), toggle_class$5(
        n,
        "small",
        /*size*/
        t[4] === "small"
      ), toggle_class$5(
        n,
        "large",
        /*size*/
        t[4] === "large"
      ), attr$6(
        e,
        "aria-label",
        /*label*/
        t[1]
      ), attr$6(
        e,
        "title",
        /*label*/
        t[1]
      ), attr$6(e, "class", "svelte-xtz2g8"), toggle_class$5(
        e,
        "pending",
        /*pending*/
        t[3]
      ), toggle_class$5(
        e,
        "padded",
        /*padded*/
        t[5]
      );
    },
    m(o, r) {
      insert$6(o, e, r), c && c.m(e, null), append$6(e, i), append$6(e, n), mount_component$3(s, n, null), l = !0, h || (_ = listen$2(
        e,
        "click",
        /*click_handler*/
        t[6]
      ), h = !0);
    },
    p(o, [r]) {
      /*show_label*/
      o[2] ? c ? c.p(o, r) : (c = create_if_block$4(o), c.c(), c.m(e, i)) : c && (c.d(1), c = null), (!l || r & /*size*/
      16) && toggle_class$5(
        n,
        "small",
        /*size*/
        o[4] === "small"
      ), (!l || r & /*size*/
      16) && toggle_class$5(
        n,
        "large",
        /*size*/
        o[4] === "large"
      ), (!l || r & /*label*/
      2) && attr$6(
        e,
        "aria-label",
        /*label*/
        o[1]
      ), (!l || r & /*label*/
      2) && attr$6(
        e,
        "title",
        /*label*/
        o[1]
      ), (!l || r & /*pending*/
      8) && toggle_class$5(
        e,
        "pending",
        /*pending*/
        o[3]
      ), (!l || r & /*padded*/
      32) && toggle_class$5(
        e,
        "padded",
        /*padded*/
        o[5]
      );
    },
    i(o) {
      l || (transition_in$5(s.$$.fragment, o), l = !0);
    },
    o(o) {
      transition_out$5(s.$$.fragment, o), l = !1;
    },
    d(o) {
      o && detach$6(e), c && c.d(), destroy_component$3(s), h = !1, _();
    }
  };
}
function instance$6(t, e, i) {
  let { Icon: n } = e, { label: s = "" } = e, { show_label: l = !1 } = e, { pending: h = !1 } = e, { size: _ = "small" } = e, { padded: c = !0 } = e;
  function o(r) {
    bubble$2.call(this, t, r);
  }
  return t.$$set = (r) => {
    "Icon" in r && i(0, n = r.Icon), "label" in r && i(1, s = r.label), "show_label" in r && i(2, l = r.show_label), "pending" in r && i(3, h = r.pending), "size" in r && i(4, _ = r.size), "padded" in r && i(5, c = r.padded);
  }, [n, s, l, h, _, c, o];
}
class IconButton extends SvelteComponent$6 {
  constructor(e) {
    super(), init$6(this, e, instance$6, create_fragment$6, safe_not_equal$7, {
      Icon: 0,
      label: 1,
      show_label: 2,
      pending: 3,
      size: 4,
      padded: 5
    });
  }
}
const Empty_svelte_svelte_type_style_lang = "", color_values = [
  { color: "red", primary: 600, secondary: 100 },
  { color: "green", primary: 600, secondary: 100 },
  { color: "blue", primary: 600, secondary: 100 },
  { color: "yellow", primary: 500, secondary: 100 },
  { color: "purple", primary: 600, secondary: 100 },
  { color: "teal", primary: 600, secondary: 100 },
  { color: "orange", primary: 600, secondary: 100 },
  { color: "cyan", primary: 600, secondary: 100 },
  { color: "lime", primary: 500, secondary: 100 },
  { color: "pink", primary: 600, secondary: 100 }
], tw_colors = {
  inherit: "inherit",
  current: "currentColor",
  transparent: "transparent",
  black: "#000",
  white: "#fff",
  slate: {
    50: "#f8fafc",
    100: "#f1f5f9",
    200: "#e2e8f0",
    300: "#cbd5e1",
    400: "#94a3b8",
    500: "#64748b",
    600: "#475569",
    700: "#334155",
    800: "#1e293b",
    900: "#0f172a",
    950: "#020617"
  },
  gray: {
    50: "#f9fafb",
    100: "#f3f4f6",
    200: "#e5e7eb",
    300: "#d1d5db",
    400: "#9ca3af",
    500: "#6b7280",
    600: "#4b5563",
    700: "#374151",
    800: "#1f2937",
    900: "#111827",
    950: "#030712"
  },
  zinc: {
    50: "#fafafa",
    100: "#f4f4f5",
    200: "#e4e4e7",
    300: "#d4d4d8",
    400: "#a1a1aa",
    500: "#71717a",
    600: "#52525b",
    700: "#3f3f46",
    800: "#27272a",
    900: "#18181b",
    950: "#09090b"
  },
  neutral: {
    50: "#fafafa",
    100: "#f5f5f5",
    200: "#e5e5e5",
    300: "#d4d4d4",
    400: "#a3a3a3",
    500: "#737373",
    600: "#525252",
    700: "#404040",
    800: "#262626",
    900: "#171717",
    950: "#0a0a0a"
  },
  stone: {
    50: "#fafaf9",
    100: "#f5f5f4",
    200: "#e7e5e4",
    300: "#d6d3d1",
    400: "#a8a29e",
    500: "#78716c",
    600: "#57534e",
    700: "#44403c",
    800: "#292524",
    900: "#1c1917",
    950: "#0c0a09"
  },
  red: {
    50: "#fef2f2",
    100: "#fee2e2",
    200: "#fecaca",
    300: "#fca5a5",
    400: "#f87171",
    500: "#ef4444",
    600: "#dc2626",
    700: "#b91c1c",
    800: "#991b1b",
    900: "#7f1d1d",
    950: "#450a0a"
  },
  orange: {
    50: "#fff7ed",
    100: "#ffedd5",
    200: "#fed7aa",
    300: "#fdba74",
    400: "#fb923c",
    500: "#f97316",
    600: "#ea580c",
    700: "#c2410c",
    800: "#9a3412",
    900: "#7c2d12",
    950: "#431407"
  },
  amber: {
    50: "#fffbeb",
    100: "#fef3c7",
    200: "#fde68a",
    300: "#fcd34d",
    400: "#fbbf24",
    500: "#f59e0b",
    600: "#d97706",
    700: "#b45309",
    800: "#92400e",
    900: "#78350f",
    950: "#451a03"
  },
  yellow: {
    50: "#fefce8",
    100: "#fef9c3",
    200: "#fef08a",
    300: "#fde047",
    400: "#facc15",
    500: "#eab308",
    600: "#ca8a04",
    700: "#a16207",
    800: "#854d0e",
    900: "#713f12",
    950: "#422006"
  },
  lime: {
    50: "#f7fee7",
    100: "#ecfccb",
    200: "#d9f99d",
    300: "#bef264",
    400: "#a3e635",
    500: "#84cc16",
    600: "#65a30d",
    700: "#4d7c0f",
    800: "#3f6212",
    900: "#365314",
    950: "#1a2e05"
  },
  green: {
    50: "#f0fdf4",
    100: "#dcfce7",
    200: "#bbf7d0",
    300: "#86efac",
    400: "#4ade80",
    500: "#22c55e",
    600: "#16a34a",
    700: "#15803d",
    800: "#166534",
    900: "#14532d",
    950: "#052e16"
  },
  emerald: {
    50: "#ecfdf5",
    100: "#d1fae5",
    200: "#a7f3d0",
    300: "#6ee7b7",
    400: "#34d399",
    500: "#10b981",
    600: "#059669",
    700: "#047857",
    800: "#065f46",
    900: "#064e3b",
    950: "#022c22"
  },
  teal: {
    50: "#f0fdfa",
    100: "#ccfbf1",
    200: "#99f6e4",
    300: "#5eead4",
    400: "#2dd4bf",
    500: "#14b8a6",
    600: "#0d9488",
    700: "#0f766e",
    800: "#115e59",
    900: "#134e4a",
    950: "#042f2e"
  },
  cyan: {
    50: "#ecfeff",
    100: "#cffafe",
    200: "#a5f3fc",
    300: "#67e8f9",
    400: "#22d3ee",
    500: "#06b6d4",
    600: "#0891b2",
    700: "#0e7490",
    800: "#155e75",
    900: "#164e63",
    950: "#083344"
  },
  sky: {
    50: "#f0f9ff",
    100: "#e0f2fe",
    200: "#bae6fd",
    300: "#7dd3fc",
    400: "#38bdf8",
    500: "#0ea5e9",
    600: "#0284c7",
    700: "#0369a1",
    800: "#075985",
    900: "#0c4a6e",
    950: "#082f49"
  },
  blue: {
    50: "#eff6ff",
    100: "#dbeafe",
    200: "#bfdbfe",
    300: "#93c5fd",
    400: "#60a5fa",
    500: "#3b82f6",
    600: "#2563eb",
    700: "#1d4ed8",
    800: "#1e40af",
    900: "#1e3a8a",
    950: "#172554"
  },
  indigo: {
    50: "#eef2ff",
    100: "#e0e7ff",
    200: "#c7d2fe",
    300: "#a5b4fc",
    400: "#818cf8",
    500: "#6366f1",
    600: "#4f46e5",
    700: "#4338ca",
    800: "#3730a3",
    900: "#312e81",
    950: "#1e1b4b"
  },
  violet: {
    50: "#f5f3ff",
    100: "#ede9fe",
    200: "#ddd6fe",
    300: "#c4b5fd",
    400: "#a78bfa",
    500: "#8b5cf6",
    600: "#7c3aed",
    700: "#6d28d9",
    800: "#5b21b6",
    900: "#4c1d95",
    950: "#2e1065"
  },
  purple: {
    50: "#faf5ff",
    100: "#f3e8ff",
    200: "#e9d5ff",
    300: "#d8b4fe",
    400: "#c084fc",
    500: "#a855f7",
    600: "#9333ea",
    700: "#7e22ce",
    800: "#6b21a8",
    900: "#581c87",
    950: "#3b0764"
  },
  fuchsia: {
    50: "#fdf4ff",
    100: "#fae8ff",
    200: "#f5d0fe",
    300: "#f0abfc",
    400: "#e879f9",
    500: "#d946ef",
    600: "#c026d3",
    700: "#a21caf",
    800: "#86198f",
    900: "#701a75",
    950: "#4a044e"
  },
  pink: {
    50: "#fdf2f8",
    100: "#fce7f3",
    200: "#fbcfe8",
    300: "#f9a8d4",
    400: "#f472b6",
    500: "#ec4899",
    600: "#db2777",
    700: "#be185d",
    800: "#9d174d",
    900: "#831843",
    950: "#500724"
  },
  rose: {
    50: "#fff1f2",
    100: "#ffe4e6",
    200: "#fecdd3",
    300: "#fda4af",
    400: "#fb7185",
    500: "#f43f5e",
    600: "#e11d48",
    700: "#be123c",
    800: "#9f1239",
    900: "#881337",
    950: "#4c0519"
  }
};
color_values.reduce(
  (t, { color: e, primary: i, secondary: n }) => ({
    ...t,
    [e]: {
      primary: tw_colors[e][i],
      secondary: tw_colors[e][n]
    }
  }),
  {}
);
const UploadText_svelte_svelte_type_style_lang = "", Toolbar_svelte_svelte_type_style_lang = "";
new Intl.Collator(0, { numeric: 1 }).compare;
function is_url$1(t) {
  try {
    const e = new URL(t);
    return e.protocol === "http:" || e.protocol === "https:";
  } catch {
    return !1;
  }
}
function get_fetchable_url_or_file$1(t, e, i) {
  return t == null ? i ? `/proxy=${i}file=` : `${e}/file=` : is_url$1(t) ? t : i ? `/proxy=${i}file=${t}` : `${e}/file=${t}`;
}
const Button_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$5,
  append: append$5,
  attr: attr$5,
  bubble: bubble$1,
  check_outros: check_outros$3,
  create_slot: create_slot$2,
  detach: detach$5,
  element: element$5,
  empty: empty$2,
  get_all_dirty_from_scope: get_all_dirty_from_scope$2,
  get_slot_changes: get_slot_changes$2,
  group_outros: group_outros$3,
  init: init$5,
  insert: insert$5,
  listen: listen$1,
  safe_not_equal: safe_not_equal$6,
  set_style: set_style$4,
  space: space$4,
  src_url_equal,
  toggle_class: toggle_class$4,
  transition_in: transition_in$4,
  transition_out: transition_out$4,
  update_slot_base: update_slot_base$2
} = window.__gradio__svelte__internal;
function create_else_block$2(t) {
  let e, i, n, s, l, h, _ = (
    /*icon*/
    t[7] && create_if_block_2$1(t)
  );
  const c = (
    /*#slots*/
    t[15].default
  ), o = create_slot$2(
    c,
    t,
    /*$$scope*/
    t[14],
    null
  );
  return {
    c() {
      e = element$5("button"), _ && _.c(), i = space$4(), o && o.c(), attr$5(e, "class", n = /*size*/
      t[4] + " " + /*variant*/
      t[3] + " " + /*elem_classes*/
      t[1].join(" ") + " svelte-8huxfn"), attr$5(
        e,
        "id",
        /*elem_id*/
        t[0]
      ), e.disabled = /*disabled*/
      t[8], toggle_class$4(e, "hidden", !/*visible*/
      t[2]), set_style$4(
        e,
        "flex-grow",
        /*scale*/
        t[9]
      ), set_style$4(
        e,
        "width",
        /*scale*/
        t[9] === 0 ? "fit-content" : null
      ), set_style$4(e, "min-width", typeof /*min_width*/
      t[10] == "number" ? `calc(min(${/*min_width*/
      t[10]}px, 100%))` : null);
    },
    m(r, T) {
      insert$5(r, e, T), _ && _.m(e, null), append$5(e, i), o && o.m(e, null), s = !0, l || (h = listen$1(
        e,
        "click",
        /*click_handler*/
        t[16]
      ), l = !0);
    },
    p(r, T) {
      /*icon*/
      r[7] ? _ ? _.p(r, T) : (_ = create_if_block_2$1(r), _.c(), _.m(e, i)) : _ && (_.d(1), _ = null), o && o.p && (!s || T & /*$$scope*/
      16384) && update_slot_base$2(
        o,
        c,
        r,
        /*$$scope*/
        r[14],
        s ? get_slot_changes$2(
          c,
          /*$$scope*/
          r[14],
          T,
          null
        ) : get_all_dirty_from_scope$2(
          /*$$scope*/
          r[14]
        ),
        null
      ), (!s || T & /*size, variant, elem_classes*/
      26 && n !== (n = /*size*/
      r[4] + " " + /*variant*/
      r[3] + " " + /*elem_classes*/
      r[1].join(" ") + " svelte-8huxfn")) && attr$5(e, "class", n), (!s || T & /*elem_id*/
      1) && attr$5(
        e,
        "id",
        /*elem_id*/
        r[0]
      ), (!s || T & /*disabled*/
      256) && (e.disabled = /*disabled*/
      r[8]), (!s || T & /*size, variant, elem_classes, visible*/
      30) && toggle_class$4(e, "hidden", !/*visible*/
      r[2]), T & /*scale*/
      512 && set_style$4(
        e,
        "flex-grow",
        /*scale*/
        r[9]
      ), T & /*scale*/
      512 && set_style$4(
        e,
        "width",
        /*scale*/
        r[9] === 0 ? "fit-content" : null
      ), T & /*min_width*/
      1024 && set_style$4(e, "min-width", typeof /*min_width*/
      r[10] == "number" ? `calc(min(${/*min_width*/
      r[10]}px, 100%))` : null);
    },
    i(r) {
      s || (transition_in$4(o, r), s = !0);
    },
    o(r) {
      transition_out$4(o, r), s = !1;
    },
    d(r) {
      r && detach$5(e), _ && _.d(), o && o.d(r), l = !1, h();
    }
  };
}
function create_if_block$3(t) {
  let e, i, n, s, l = (
    /*icon*/
    t[7] && create_if_block_1$3(t)
  );
  const h = (
    /*#slots*/
    t[15].default
  ), _ = create_slot$2(
    h,
    t,
    /*$$scope*/
    t[14],
    null
  );
  return {
    c() {
      e = element$5("a"), l && l.c(), i = space$4(), _ && _.c(), attr$5(
        e,
        "href",
        /*link*/
        t[6]
      ), attr$5(e, "rel", "noopener noreferrer"), attr$5(
        e,
        "aria-disabled",
        /*disabled*/
        t[8]
      ), attr$5(e, "class", n = /*size*/
      t[4] + " " + /*variant*/
      t[3] + " " + /*elem_classes*/
      t[1].join(" ") + " svelte-8huxfn"), attr$5(
        e,
        "id",
        /*elem_id*/
        t[0]
      ), toggle_class$4(e, "hidden", !/*visible*/
      t[2]), toggle_class$4(
        e,
        "disabled",
        /*disabled*/
        t[8]
      ), set_style$4(
        e,
        "flex-grow",
        /*scale*/
        t[9]
      ), set_style$4(
        e,
        "pointer-events",
        /*disabled*/
        t[8] ? "none" : null
      ), set_style$4(
        e,
        "width",
        /*scale*/
        t[9] === 0 ? "fit-content" : null
      ), set_style$4(e, "min-width", typeof /*min_width*/
      t[10] == "number" ? `calc(min(${/*min_width*/
      t[10]}px, 100%))` : null);
    },
    m(c, o) {
      insert$5(c, e, o), l && l.m(e, null), append$5(e, i), _ && _.m(e, null), s = !0;
    },
    p(c, o) {
      /*icon*/
      c[7] ? l ? l.p(c, o) : (l = create_if_block_1$3(c), l.c(), l.m(e, i)) : l && (l.d(1), l = null), _ && _.p && (!s || o & /*$$scope*/
      16384) && update_slot_base$2(
        _,
        h,
        c,
        /*$$scope*/
        c[14],
        s ? get_slot_changes$2(
          h,
          /*$$scope*/
          c[14],
          o,
          null
        ) : get_all_dirty_from_scope$2(
          /*$$scope*/
          c[14]
        ),
        null
      ), (!s || o & /*link*/
      64) && attr$5(
        e,
        "href",
        /*link*/
        c[6]
      ), (!s || o & /*disabled*/
      256) && attr$5(
        e,
        "aria-disabled",
        /*disabled*/
        c[8]
      ), (!s || o & /*size, variant, elem_classes*/
      26 && n !== (n = /*size*/
      c[4] + " " + /*variant*/
      c[3] + " " + /*elem_classes*/
      c[1].join(" ") + " svelte-8huxfn")) && attr$5(e, "class", n), (!s || o & /*elem_id*/
      1) && attr$5(
        e,
        "id",
        /*elem_id*/
        c[0]
      ), (!s || o & /*size, variant, elem_classes, visible*/
      30) && toggle_class$4(e, "hidden", !/*visible*/
      c[2]), (!s || o & /*size, variant, elem_classes, disabled*/
      282) && toggle_class$4(
        e,
        "disabled",
        /*disabled*/
        c[8]
      ), o & /*scale*/
      512 && set_style$4(
        e,
        "flex-grow",
        /*scale*/
        c[9]
      ), o & /*disabled*/
      256 && set_style$4(
        e,
        "pointer-events",
        /*disabled*/
        c[8] ? "none" : null
      ), o & /*scale*/
      512 && set_style$4(
        e,
        "width",
        /*scale*/
        c[9] === 0 ? "fit-content" : null
      ), o & /*min_width*/
      1024 && set_style$4(e, "min-width", typeof /*min_width*/
      c[10] == "number" ? `calc(min(${/*min_width*/
      c[10]}px, 100%))` : null);
    },
    i(c) {
      s || (transition_in$4(_, c), s = !0);
    },
    o(c) {
      transition_out$4(_, c), s = !1;
    },
    d(c) {
      c && detach$5(e), l && l.d(), _ && _.d(c);
    }
  };
}
function create_if_block_2$1(t) {
  let e, i, n;
  return {
    c() {
      e = element$5("img"), attr$5(e, "class", "button-icon svelte-8huxfn"), src_url_equal(e.src, i = /*icon_path*/
      t[11]) || attr$5(e, "src", i), attr$5(e, "alt", n = `${/*value*/
      t[5]} icon`);
    },
    m(s, l) {
      insert$5(s, e, l);
    },
    p(s, l) {
      l & /*icon_path*/
      2048 && !src_url_equal(e.src, i = /*icon_path*/
      s[11]) && attr$5(e, "src", i), l & /*value*/
      32 && n !== (n = `${/*value*/
      s[5]} icon`) && attr$5(e, "alt", n);
    },
    d(s) {
      s && detach$5(e);
    }
  };
}
function create_if_block_1$3(t) {
  let e, i, n;
  return {
    c() {
      e = element$5("img"), attr$5(e, "class", "button-icon svelte-8huxfn"), src_url_equal(e.src, i = /*icon_path*/
      t[11]) || attr$5(e, "src", i), attr$5(e, "alt", n = `${/*value*/
      t[5]} icon`);
    },
    m(s, l) {
      insert$5(s, e, l);
    },
    p(s, l) {
      l & /*icon_path*/
      2048 && !src_url_equal(e.src, i = /*icon_path*/
      s[11]) && attr$5(e, "src", i), l & /*value*/
      32 && n !== (n = `${/*value*/
      s[5]} icon`) && attr$5(e, "alt", n);
    },
    d(s) {
      s && detach$5(e);
    }
  };
}
function create_fragment$5(t) {
  let e, i, n, s;
  const l = [create_if_block$3, create_else_block$2], h = [];
  function _(c, o) {
    return (
      /*link*/
      c[6] && /*link*/
      c[6].length > 0 ? 0 : 1
    );
  }
  return e = _(t), i = h[e] = l[e](t), {
    c() {
      i.c(), n = empty$2();
    },
    m(c, o) {
      h[e].m(c, o), insert$5(c, n, o), s = !0;
    },
    p(c, [o]) {
      let r = e;
      e = _(c), e === r ? h[e].p(c, o) : (group_outros$3(), transition_out$4(h[r], 1, 1, () => {
        h[r] = null;
      }), check_outros$3(), i = h[e], i ? i.p(c, o) : (i = h[e] = l[e](c), i.c()), transition_in$4(i, 1), i.m(n.parentNode, n));
    },
    i(c) {
      s || (transition_in$4(i), s = !0);
    },
    o(c) {
      transition_out$4(i), s = !1;
    },
    d(c) {
      c && detach$5(n), h[e].d(c);
    }
  };
}
function instance$5(t, e, i) {
  let n, { $$slots: s = {}, $$scope: l } = e, { elem_id: h = "" } = e, { elem_classes: _ = [] } = e, { visible: c = !0 } = e, { variant: o = "secondary" } = e, { size: r = "lg" } = e, { value: T = null } = e, { link: S = null } = e, { icon: w = null } = e, { disabled: C = !1 } = e, { scale: P = null } = e, { min_width: b = void 0 } = e, { root: k = "" } = e, { proxy_url: F = null } = e;
  function x(y) {
    bubble$1.call(this, t, y);
  }
  return t.$$set = (y) => {
    "elem_id" in y && i(0, h = y.elem_id), "elem_classes" in y && i(1, _ = y.elem_classes), "visible" in y && i(2, c = y.visible), "variant" in y && i(3, o = y.variant), "size" in y && i(4, r = y.size), "value" in y && i(5, T = y.value), "link" in y && i(6, S = y.link), "icon" in y && i(7, w = y.icon), "disabled" in y && i(8, C = y.disabled), "scale" in y && i(9, P = y.scale), "min_width" in y && i(10, b = y.min_width), "root" in y && i(12, k = y.root), "proxy_url" in y && i(13, F = y.proxy_url), "$$scope" in y && i(14, l = y.$$scope);
  }, t.$$.update = () => {
    t.$$.dirty & /*icon, root, proxy_url*/
    12416 && i(11, n = get_fetchable_url_or_file$1(w, k, F));
  }, [
    h,
    _,
    c,
    o,
    r,
    T,
    S,
    w,
    C,
    P,
    b,
    n,
    k,
    F,
    l,
    s,
    x
  ];
}
class Button extends SvelteComponent$5 {
  constructor(e) {
    super(), init$5(this, e, instance$5, create_fragment$5, safe_not_equal$6, {
      elem_id: 0,
      elem_classes: 1,
      visible: 2,
      variant: 3,
      size: 4,
      value: 5,
      link: 6,
      icon: 7,
      disabled: 8,
      scale: 9,
      min_width: 10,
      root: 12,
      proxy_url: 13
    });
  }
}
function pretty_si(t) {
  let e = ["", "k", "M", "G", "T", "P", "E", "Z"], i = 0;
  for (; t > 1e3 && i < e.length - 1; )
    t /= 1e3, i++;
  let n = e[i];
  return (Number.isInteger(t) ? t : t.toFixed(1)) + n;
}
function noop$2() {
}
function run(t) {
  return t();
}
function run_all$1(t) {
  t.forEach(run);
}
function is_function(t) {
  return typeof t == "function";
}
function safe_not_equal$5(t, e) {
  return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
}
function subscribe(t, ...e) {
  if (t == null) {
    for (const n of e)
      n(void 0);
    return noop$2;
  }
  const i = t.subscribe(...e);
  return i.unsubscribe ? () => i.unsubscribe() : i;
}
const is_client = typeof window < "u";
let now = is_client ? () => window.performance.now() : () => Date.now(), raf = is_client ? (t) => requestAnimationFrame(t) : noop$2;
const tasks = /* @__PURE__ */ new Set();
function run_tasks(t) {
  tasks.forEach((e) => {
    e.c(t) || (tasks.delete(e), e.f());
  }), tasks.size !== 0 && raf(run_tasks);
}
function loop(t) {
  let e;
  return tasks.size === 0 && raf(run_tasks), {
    promise: new Promise((i) => {
      tasks.add(e = { c: t, f: i });
    }),
    abort() {
      tasks.delete(e);
    }
  };
}
const subscriber_queue = [];
function readable(t, e) {
  return {
    subscribe: writable(t, e).subscribe
  };
}
function writable(t, e = noop$2) {
  let i;
  const n = /* @__PURE__ */ new Set();
  function s(_) {
    if (safe_not_equal$5(t, _) && (t = _, i)) {
      const c = !subscriber_queue.length;
      for (const o of n)
        o[1](), subscriber_queue.push(o, t);
      if (c) {
        for (let o = 0; o < subscriber_queue.length; o += 2)
          subscriber_queue[o][0](subscriber_queue[o + 1]);
        subscriber_queue.length = 0;
      }
    }
  }
  function l(_) {
    s(_(t));
  }
  function h(_, c = noop$2) {
    const o = [_, c];
    return n.add(o), n.size === 1 && (i = e(s, l) || noop$2), _(t), () => {
      n.delete(o), n.size === 0 && i && (i(), i = null);
    };
  }
  return { set: s, update: l, subscribe: h };
}
function derived(t, e, i) {
  const n = !Array.isArray(t), s = n ? [t] : t;
  if (!s.every(Boolean))
    throw new Error("derived() expects stores as input, got a falsy value");
  const l = e.length < 2;
  return readable(i, (h, _) => {
    let c = !1;
    const o = [];
    let r = 0, T = noop$2;
    const S = () => {
      if (r)
        return;
      T();
      const C = e(n ? o[0] : o, h, _);
      l ? h(C) : T = is_function(C) ? C : noop$2;
    }, w = s.map(
      (C, P) => subscribe(
        C,
        (b) => {
          o[P] = b, r &= ~(1 << P), c && S();
        },
        () => {
          r |= 1 << P;
        }
      )
    );
    return c = !0, S(), function() {
      run_all$1(w), T(), c = !1;
    };
  });
}
function is_date(t) {
  return Object.prototype.toString.call(t) === "[object Date]";
}
function tick_spring(t, e, i, n) {
  if (typeof i == "number" || is_date(i)) {
    const s = n - i, l = (i - e) / (t.dt || 1 / 60), h = t.opts.stiffness * s, _ = t.opts.damping * l, c = (h - _) * t.inv_mass, o = (l + c) * t.dt;
    return Math.abs(o) < t.opts.precision && Math.abs(s) < t.opts.precision ? n : (t.settled = !1, is_date(i) ? new Date(i.getTime() + o) : i + o);
  } else {
    if (Array.isArray(i))
      return i.map(
        (s, l) => tick_spring(t, e[l], i[l], n[l])
      );
    if (typeof i == "object") {
      const s = {};
      for (const l in i)
        s[l] = tick_spring(t, e[l], i[l], n[l]);
      return s;
    } else
      throw new Error(`Cannot spring ${typeof i} values`);
  }
}
function spring(t, e = {}) {
  const i = writable(t), { stiffness: n = 0.15, damping: s = 0.8, precision: l = 0.01 } = e;
  let h, _, c, o = t, r = t, T = 1, S = 0, w = !1;
  function C(b, k = {}) {
    r = b;
    const F = c = {};
    return t == null || k.hard || P.stiffness >= 1 && P.damping >= 1 ? (w = !0, h = now(), o = b, i.set(t = r), Promise.resolve()) : (k.soft && (S = 1 / ((k.soft === !0 ? 0.5 : +k.soft) * 60), T = 0), _ || (h = now(), w = !1, _ = loop((x) => {
      if (w)
        return w = !1, _ = null, !1;
      T = Math.min(T + S, 1);
      const y = {
        inv_mass: T,
        opts: P,
        settled: !0,
        dt: (x - h) * 60 / 1e3
      }, p = tick_spring(y, o, t, r);
      return h = x, o = t, i.set(t = p), y.settled && (_ = null), !y.settled;
    })), new Promise((x) => {
      _.promise.then(() => {
        F === c && x();
      });
    }));
  }
  const P = {
    set: C,
    update: (b, k) => C(b(r, t), k),
    subscribe: i.subscribe,
    stiffness: n,
    damping: s,
    precision: l
  };
  return P;
}
const Loader_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$4,
  append: append$4,
  attr: attr$4,
  component_subscribe,
  detach: detach$4,
  element: element$4,
  init: init$4,
  insert: insert$4,
  noop: noop$1,
  safe_not_equal: safe_not_equal$4,
  set_style: set_style$3,
  svg_element,
  toggle_class: toggle_class$3
} = window.__gradio__svelte__internal, { onMount } = window.__gradio__svelte__internal;
function create_fragment$4(t) {
  let e, i, n, s, l, h, _, c, o, r, T, S;
  return {
    c() {
      e = element$4("div"), i = svg_element("svg"), n = svg_element("g"), s = svg_element("path"), l = svg_element("path"), h = svg_element("path"), _ = svg_element("path"), c = svg_element("g"), o = svg_element("path"), r = svg_element("path"), T = svg_element("path"), S = svg_element("path"), attr$4(s, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), attr$4(s, "fill", "#FF7C00"), attr$4(s, "fill-opacity", "0.4"), attr$4(s, "class", "svelte-43sxxs"), attr$4(l, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), attr$4(l, "fill", "#FF7C00"), attr$4(l, "class", "svelte-43sxxs"), attr$4(h, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), attr$4(h, "fill", "#FF7C00"), attr$4(h, "fill-opacity", "0.4"), attr$4(h, "class", "svelte-43sxxs"), attr$4(_, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), attr$4(_, "fill", "#FF7C00"), attr$4(_, "class", "svelte-43sxxs"), set_style$3(n, "transform", "translate(" + /*$top*/
      t[1][0] + "px, " + /*$top*/
      t[1][1] + "px)"), attr$4(o, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), attr$4(o, "fill", "#FF7C00"), attr$4(o, "fill-opacity", "0.4"), attr$4(o, "class", "svelte-43sxxs"), attr$4(r, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), attr$4(r, "fill", "#FF7C00"), attr$4(r, "class", "svelte-43sxxs"), attr$4(T, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), attr$4(T, "fill", "#FF7C00"), attr$4(T, "fill-opacity", "0.4"), attr$4(T, "class", "svelte-43sxxs"), attr$4(S, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), attr$4(S, "fill", "#FF7C00"), attr$4(S, "class", "svelte-43sxxs"), set_style$3(c, "transform", "translate(" + /*$bottom*/
      t[2][0] + "px, " + /*$bottom*/
      t[2][1] + "px)"), attr$4(i, "viewBox", "-1200 -1200 3000 3000"), attr$4(i, "fill", "none"), attr$4(i, "xmlns", "http://www.w3.org/2000/svg"), attr$4(i, "class", "svelte-43sxxs"), attr$4(e, "class", "svelte-43sxxs"), toggle_class$3(
        e,
        "margin",
        /*margin*/
        t[0]
      );
    },
    m(w, C) {
      insert$4(w, e, C), append$4(e, i), append$4(i, n), append$4(n, s), append$4(n, l), append$4(n, h), append$4(n, _), append$4(i, c), append$4(c, o), append$4(c, r), append$4(c, T), append$4(c, S);
    },
    p(w, [C]) {
      C & /*$top*/
      2 && set_style$3(n, "transform", "translate(" + /*$top*/
      w[1][0] + "px, " + /*$top*/
      w[1][1] + "px)"), C & /*$bottom*/
      4 && set_style$3(c, "transform", "translate(" + /*$bottom*/
      w[2][0] + "px, " + /*$bottom*/
      w[2][1] + "px)"), C & /*margin*/
      1 && toggle_class$3(
        e,
        "margin",
        /*margin*/
        w[0]
      );
    },
    i: noop$1,
    o: noop$1,
    d(w) {
      w && detach$4(e);
    }
  };
}
function instance$4(t, e, i) {
  let n, s, { margin: l = !0 } = e;
  const h = spring([0, 0]);
  component_subscribe(t, h, (S) => i(1, n = S));
  const _ = spring([0, 0]);
  component_subscribe(t, _, (S) => i(2, s = S));
  let c;
  async function o() {
    await Promise.all([h.set([125, 140]), _.set([-125, -140])]), await Promise.all([h.set([-125, 140]), _.set([125, -140])]), await Promise.all([h.set([-125, 0]), _.set([125, -0])]), await Promise.all([h.set([125, 0]), _.set([-125, 0])]);
  }
  async function r() {
    await o(), c || r();
  }
  async function T() {
    await Promise.all([h.set([125, 0]), _.set([-125, 0])]), r();
  }
  return onMount(() => (T(), () => c = !0)), t.$$set = (S) => {
    "margin" in S && i(0, l = S.margin);
  }, [l, n, s, h, _];
}
class Loader extends SvelteComponent$4 {
  constructor(e) {
    super(), init$4(this, e, instance$4, create_fragment$4, safe_not_equal$4, { margin: 0 });
  }
}
const index_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$3,
  append: append$3,
  attr: attr$3,
  binding_callbacks: binding_callbacks$2,
  check_outros: check_outros$2,
  create_component: create_component$2,
  create_slot: create_slot$1,
  destroy_component: destroy_component$2,
  destroy_each,
  detach: detach$3,
  element: element$3,
  empty: empty$1,
  ensure_array_like,
  get_all_dirty_from_scope: get_all_dirty_from_scope$1,
  get_slot_changes: get_slot_changes$1,
  group_outros: group_outros$2,
  init: init$3,
  insert: insert$3,
  mount_component: mount_component$2,
  noop,
  safe_not_equal: safe_not_equal$3,
  set_data: set_data$1,
  set_style: set_style$2,
  space: space$3,
  text: text$1,
  toggle_class: toggle_class$2,
  transition_in: transition_in$3,
  transition_out: transition_out$3,
  update_slot_base: update_slot_base$1
} = window.__gradio__svelte__internal, { tick: tick$2 } = window.__gradio__svelte__internal, { onDestroy } = window.__gradio__svelte__internal, get_error_slot_changes = (t) => ({}), get_error_slot_context = (t) => ({});
function get_each_context(t, e, i) {
  const n = t.slice();
  return n[38] = e[i], n[40] = i, n;
}
function get_each_context_1(t, e, i) {
  const n = t.slice();
  return n[38] = e[i], n;
}
function create_if_block_17(t) {
  let e, i = (
    /*i18n*/
    t[1]("common.error") + ""
  ), n, s, l;
  const h = (
    /*#slots*/
    t[29].error
  ), _ = create_slot$1(
    h,
    t,
    /*$$scope*/
    t[28],
    get_error_slot_context
  );
  return {
    c() {
      e = element$3("span"), n = text$1(i), s = space$3(), _ && _.c(), attr$3(e, "class", "error svelte-14miwb5");
    },
    m(c, o) {
      insert$3(c, e, o), append$3(e, n), insert$3(c, s, o), _ && _.m(c, o), l = !0;
    },
    p(c, o) {
      (!l || o[0] & /*i18n*/
      2) && i !== (i = /*i18n*/
      c[1]("common.error") + "") && set_data$1(n, i), _ && _.p && (!l || o[0] & /*$$scope*/
      268435456) && update_slot_base$1(
        _,
        h,
        c,
        /*$$scope*/
        c[28],
        l ? get_slot_changes$1(
          h,
          /*$$scope*/
          c[28],
          o,
          get_error_slot_changes
        ) : get_all_dirty_from_scope$1(
          /*$$scope*/
          c[28]
        ),
        get_error_slot_context
      );
    },
    i(c) {
      l || (transition_in$3(_, c), l = !0);
    },
    o(c) {
      transition_out$3(_, c), l = !1;
    },
    d(c) {
      c && (detach$3(e), detach$3(s)), _ && _.d(c);
    }
  };
}
function create_if_block$2(t) {
  let e, i, n, s, l, h, _, c, o, r = (
    /*variant*/
    t[8] === "default" && /*show_eta_bar*/
    t[18] && /*show_progress*/
    t[6] === "full" && create_if_block_16(t)
  );
  function T(x, y) {
    if (
      /*progress*/
      x[7]
    )
      return create_if_block_11;
    if (
      /*queue_position*/
      x[2] !== null && /*queue_size*/
      x[3] !== void 0 && /*queue_position*/
      x[2] >= 0
    )
      return create_if_block_14;
    if (
      /*queue_position*/
      x[2] === 0
    )
      return create_if_block_15;
  }
  let S = T(t), w = S && S(t), C = (
    /*timer*/
    t[5] && create_if_block_10(t)
  );
  const P = [create_if_block_2, create_if_block_9], b = [];
  function k(x, y) {
    return (
      /*last_progress_level*/
      x[15] != null ? 0 : (
        /*show_progress*/
        x[6] === "full" ? 1 : -1
      )
    );
  }
  ~(l = k(t)) && (h = b[l] = P[l](t));
  let F = !/*timer*/
  t[5] && create_if_block_1$2(t);
  return {
    c() {
      r && r.c(), e = space$3(), i = element$3("div"), w && w.c(), n = space$3(), C && C.c(), s = space$3(), h && h.c(), _ = space$3(), F && F.c(), c = empty$1(), attr$3(i, "class", "progress-text svelte-14miwb5"), toggle_class$2(
        i,
        "meta-text-center",
        /*variant*/
        t[8] === "center"
      ), toggle_class$2(
        i,
        "meta-text",
        /*variant*/
        t[8] === "default"
      );
    },
    m(x, y) {
      r && r.m(x, y), insert$3(x, e, y), insert$3(x, i, y), w && w.m(i, null), append$3(i, n), C && C.m(i, null), insert$3(x, s, y), ~l && b[l].m(x, y), insert$3(x, _, y), F && F.m(x, y), insert$3(x, c, y), o = !0;
    },
    p(x, y) {
      /*variant*/
      x[8] === "default" && /*show_eta_bar*/
      x[18] && /*show_progress*/
      x[6] === "full" ? r ? r.p(x, y) : (r = create_if_block_16(x), r.c(), r.m(e.parentNode, e)) : r && (r.d(1), r = null), S === (S = T(x)) && w ? w.p(x, y) : (w && w.d(1), w = S && S(x), w && (w.c(), w.m(i, n))), /*timer*/
      x[5] ? C ? C.p(x, y) : (C = create_if_block_10(x), C.c(), C.m(i, null)) : C && (C.d(1), C = null), (!o || y[0] & /*variant*/
      256) && toggle_class$2(
        i,
        "meta-text-center",
        /*variant*/
        x[8] === "center"
      ), (!o || y[0] & /*variant*/
      256) && toggle_class$2(
        i,
        "meta-text",
        /*variant*/
        x[8] === "default"
      );
      let p = l;
      l = k(x), l === p ? ~l && b[l].p(x, y) : (h && (group_outros$2(), transition_out$3(b[p], 1, 1, () => {
        b[p] = null;
      }), check_outros$2()), ~l ? (h = b[l], h ? h.p(x, y) : (h = b[l] = P[l](x), h.c()), transition_in$3(h, 1), h.m(_.parentNode, _)) : h = null), /*timer*/
      x[5] ? F && (F.d(1), F = null) : F ? F.p(x, y) : (F = create_if_block_1$2(x), F.c(), F.m(c.parentNode, c));
    },
    i(x) {
      o || (transition_in$3(h), o = !0);
    },
    o(x) {
      transition_out$3(h), o = !1;
    },
    d(x) {
      x && (detach$3(e), detach$3(i), detach$3(s), detach$3(_), detach$3(c)), r && r.d(x), w && w.d(), C && C.d(), ~l && b[l].d(x), F && F.d(x);
    }
  };
}
function create_if_block_16(t) {
  let e, i = `translateX(${/*eta_level*/
  (t[17] || 0) * 100 - 100}%)`;
  return {
    c() {
      e = element$3("div"), attr$3(e, "class", "eta-bar svelte-14miwb5"), set_style$2(e, "transform", i);
    },
    m(n, s) {
      insert$3(n, e, s);
    },
    p(n, s) {
      s[0] & /*eta_level*/
      131072 && i !== (i = `translateX(${/*eta_level*/
      (n[17] || 0) * 100 - 100}%)`) && set_style$2(e, "transform", i);
    },
    d(n) {
      n && detach$3(e);
    }
  };
}
function create_if_block_15(t) {
  let e;
  return {
    c() {
      e = text$1("processing |");
    },
    m(i, n) {
      insert$3(i, e, n);
    },
    p: noop,
    d(i) {
      i && detach$3(e);
    }
  };
}
function create_if_block_14(t) {
  let e, i = (
    /*queue_position*/
    t[2] + 1 + ""
  ), n, s, l, h;
  return {
    c() {
      e = text$1("queue: "), n = text$1(i), s = text$1("/"), l = text$1(
        /*queue_size*/
        t[3]
      ), h = text$1(" |");
    },
    m(_, c) {
      insert$3(_, e, c), insert$3(_, n, c), insert$3(_, s, c), insert$3(_, l, c), insert$3(_, h, c);
    },
    p(_, c) {
      c[0] & /*queue_position*/
      4 && i !== (i = /*queue_position*/
      _[2] + 1 + "") && set_data$1(n, i), c[0] & /*queue_size*/
      8 && set_data$1(
        l,
        /*queue_size*/
        _[3]
      );
    },
    d(_) {
      _ && (detach$3(e), detach$3(n), detach$3(s), detach$3(l), detach$3(h));
    }
  };
}
function create_if_block_11(t) {
  let e, i = ensure_array_like(
    /*progress*/
    t[7]
  ), n = [];
  for (let s = 0; s < i.length; s += 1)
    n[s] = create_each_block_1(get_each_context_1(t, i, s));
  return {
    c() {
      for (let s = 0; s < n.length; s += 1)
        n[s].c();
      e = empty$1();
    },
    m(s, l) {
      for (let h = 0; h < n.length; h += 1)
        n[h] && n[h].m(s, l);
      insert$3(s, e, l);
    },
    p(s, l) {
      if (l[0] & /*progress*/
      128) {
        i = ensure_array_like(
          /*progress*/
          s[7]
        );
        let h;
        for (h = 0; h < i.length; h += 1) {
          const _ = get_each_context_1(s, i, h);
          n[h] ? n[h].p(_, l) : (n[h] = create_each_block_1(_), n[h].c(), n[h].m(e.parentNode, e));
        }
        for (; h < n.length; h += 1)
          n[h].d(1);
        n.length = i.length;
      }
    },
    d(s) {
      s && detach$3(e), destroy_each(n, s);
    }
  };
}
function create_if_block_12(t) {
  let e, i = (
    /*p*/
    t[38].unit + ""
  ), n, s, l = " ", h;
  function _(r, T) {
    return (
      /*p*/
      r[38].length != null ? create_if_block_13 : create_else_block$1
    );
  }
  let c = _(t), o = c(t);
  return {
    c() {
      o.c(), e = space$3(), n = text$1(i), s = text$1(" | "), h = text$1(l);
    },
    m(r, T) {
      o.m(r, T), insert$3(r, e, T), insert$3(r, n, T), insert$3(r, s, T), insert$3(r, h, T);
    },
    p(r, T) {
      c === (c = _(r)) && o ? o.p(r, T) : (o.d(1), o = c(r), o && (o.c(), o.m(e.parentNode, e))), T[0] & /*progress*/
      128 && i !== (i = /*p*/
      r[38].unit + "") && set_data$1(n, i);
    },
    d(r) {
      r && (detach$3(e), detach$3(n), detach$3(s), detach$3(h)), o.d(r);
    }
  };
}
function create_else_block$1(t) {
  let e = pretty_si(
    /*p*/
    t[38].index || 0
  ) + "", i;
  return {
    c() {
      i = text$1(e);
    },
    m(n, s) {
      insert$3(n, i, s);
    },
    p(n, s) {
      s[0] & /*progress*/
      128 && e !== (e = pretty_si(
        /*p*/
        n[38].index || 0
      ) + "") && set_data$1(i, e);
    },
    d(n) {
      n && detach$3(i);
    }
  };
}
function create_if_block_13(t) {
  let e = pretty_si(
    /*p*/
    t[38].index || 0
  ) + "", i, n, s = pretty_si(
    /*p*/
    t[38].length
  ) + "", l;
  return {
    c() {
      i = text$1(e), n = text$1("/"), l = text$1(s);
    },
    m(h, _) {
      insert$3(h, i, _), insert$3(h, n, _), insert$3(h, l, _);
    },
    p(h, _) {
      _[0] & /*progress*/
      128 && e !== (e = pretty_si(
        /*p*/
        h[38].index || 0
      ) + "") && set_data$1(i, e), _[0] & /*progress*/
      128 && s !== (s = pretty_si(
        /*p*/
        h[38].length
      ) + "") && set_data$1(l, s);
    },
    d(h) {
      h && (detach$3(i), detach$3(n), detach$3(l));
    }
  };
}
function create_each_block_1(t) {
  let e, i = (
    /*p*/
    t[38].index != null && create_if_block_12(t)
  );
  return {
    c() {
      i && i.c(), e = empty$1();
    },
    m(n, s) {
      i && i.m(n, s), insert$3(n, e, s);
    },
    p(n, s) {
      /*p*/
      n[38].index != null ? i ? i.p(n, s) : (i = create_if_block_12(n), i.c(), i.m(e.parentNode, e)) : i && (i.d(1), i = null);
    },
    d(n) {
      n && detach$3(e), i && i.d(n);
    }
  };
}
function create_if_block_10(t) {
  let e, i = (
    /*eta*/
    t[0] ? `/${/*formatted_eta*/
    t[19]}` : ""
  ), n, s;
  return {
    c() {
      e = text$1(
        /*formatted_timer*/
        t[20]
      ), n = text$1(i), s = text$1("s");
    },
    m(l, h) {
      insert$3(l, e, h), insert$3(l, n, h), insert$3(l, s, h);
    },
    p(l, h) {
      h[0] & /*formatted_timer*/
      1048576 && set_data$1(
        e,
        /*formatted_timer*/
        l[20]
      ), h[0] & /*eta, formatted_eta*/
      524289 && i !== (i = /*eta*/
      l[0] ? `/${/*formatted_eta*/
      l[19]}` : "") && set_data$1(n, i);
    },
    d(l) {
      l && (detach$3(e), detach$3(n), detach$3(s));
    }
  };
}
function create_if_block_9(t) {
  let e, i;
  return e = new Loader({
    props: { margin: (
      /*variant*/
      t[8] === "default"
    ) }
  }), {
    c() {
      create_component$2(e.$$.fragment);
    },
    m(n, s) {
      mount_component$2(e, n, s), i = !0;
    },
    p(n, s) {
      const l = {};
      s[0] & /*variant*/
      256 && (l.margin = /*variant*/
      n[8] === "default"), e.$set(l);
    },
    i(n) {
      i || (transition_in$3(e.$$.fragment, n), i = !0);
    },
    o(n) {
      transition_out$3(e.$$.fragment, n), i = !1;
    },
    d(n) {
      destroy_component$2(e, n);
    }
  };
}
function create_if_block_2(t) {
  let e, i, n, s, l, h = `${/*last_progress_level*/
  t[15] * 100}%`, _ = (
    /*progress*/
    t[7] != null && create_if_block_3(t)
  );
  return {
    c() {
      e = element$3("div"), i = element$3("div"), _ && _.c(), n = space$3(), s = element$3("div"), l = element$3("div"), attr$3(i, "class", "progress-level-inner svelte-14miwb5"), attr$3(l, "class", "progress-bar svelte-14miwb5"), set_style$2(l, "width", h), attr$3(s, "class", "progress-bar-wrap svelte-14miwb5"), attr$3(e, "class", "progress-level svelte-14miwb5");
    },
    m(c, o) {
      insert$3(c, e, o), append$3(e, i), _ && _.m(i, null), append$3(e, n), append$3(e, s), append$3(s, l), t[30](l);
    },
    p(c, o) {
      /*progress*/
      c[7] != null ? _ ? _.p(c, o) : (_ = create_if_block_3(c), _.c(), _.m(i, null)) : _ && (_.d(1), _ = null), o[0] & /*last_progress_level*/
      32768 && h !== (h = `${/*last_progress_level*/
      c[15] * 100}%`) && set_style$2(l, "width", h);
    },
    i: noop,
    o: noop,
    d(c) {
      c && detach$3(e), _ && _.d(), t[30](null);
    }
  };
}
function create_if_block_3(t) {
  let e, i = ensure_array_like(
    /*progress*/
    t[7]
  ), n = [];
  for (let s = 0; s < i.length; s += 1)
    n[s] = create_each_block(get_each_context(t, i, s));
  return {
    c() {
      for (let s = 0; s < n.length; s += 1)
        n[s].c();
      e = empty$1();
    },
    m(s, l) {
      for (let h = 0; h < n.length; h += 1)
        n[h] && n[h].m(s, l);
      insert$3(s, e, l);
    },
    p(s, l) {
      if (l[0] & /*progress_level, progress*/
      16512) {
        i = ensure_array_like(
          /*progress*/
          s[7]
        );
        let h;
        for (h = 0; h < i.length; h += 1) {
          const _ = get_each_context(s, i, h);
          n[h] ? n[h].p(_, l) : (n[h] = create_each_block(_), n[h].c(), n[h].m(e.parentNode, e));
        }
        for (; h < n.length; h += 1)
          n[h].d(1);
        n.length = i.length;
      }
    },
    d(s) {
      s && detach$3(e), destroy_each(n, s);
    }
  };
}
function create_if_block_4(t) {
  let e, i, n, s, l = (
    /*i*/
    t[40] !== 0 && create_if_block_8()
  ), h = (
    /*p*/
    t[38].desc != null && create_if_block_7(t)
  ), _ = (
    /*p*/
    t[38].desc != null && /*progress_level*/
    t[14] && /*progress_level*/
    t[14][
      /*i*/
      t[40]
    ] != null && create_if_block_6()
  ), c = (
    /*progress_level*/
    t[14] != null && create_if_block_5(t)
  );
  return {
    c() {
      l && l.c(), e = space$3(), h && h.c(), i = space$3(), _ && _.c(), n = space$3(), c && c.c(), s = empty$1();
    },
    m(o, r) {
      l && l.m(o, r), insert$3(o, e, r), h && h.m(o, r), insert$3(o, i, r), _ && _.m(o, r), insert$3(o, n, r), c && c.m(o, r), insert$3(o, s, r);
    },
    p(o, r) {
      /*p*/
      o[38].desc != null ? h ? h.p(o, r) : (h = create_if_block_7(o), h.c(), h.m(i.parentNode, i)) : h && (h.d(1), h = null), /*p*/
      o[38].desc != null && /*progress_level*/
      o[14] && /*progress_level*/
      o[14][
        /*i*/
        o[40]
      ] != null ? _ || (_ = create_if_block_6(), _.c(), _.m(n.parentNode, n)) : _ && (_.d(1), _ = null), /*progress_level*/
      o[14] != null ? c ? c.p(o, r) : (c = create_if_block_5(o), c.c(), c.m(s.parentNode, s)) : c && (c.d(1), c = null);
    },
    d(o) {
      o && (detach$3(e), detach$3(i), detach$3(n), detach$3(s)), l && l.d(o), h && h.d(o), _ && _.d(o), c && c.d(o);
    }
  };
}
function create_if_block_8(t) {
  let e;
  return {
    c() {
      e = text$1(" /");
    },
    m(i, n) {
      insert$3(i, e, n);
    },
    d(i) {
      i && detach$3(e);
    }
  };
}
function create_if_block_7(t) {
  let e = (
    /*p*/
    t[38].desc + ""
  ), i;
  return {
    c() {
      i = text$1(e);
    },
    m(n, s) {
      insert$3(n, i, s);
    },
    p(n, s) {
      s[0] & /*progress*/
      128 && e !== (e = /*p*/
      n[38].desc + "") && set_data$1(i, e);
    },
    d(n) {
      n && detach$3(i);
    }
  };
}
function create_if_block_6(t) {
  let e;
  return {
    c() {
      e = text$1("-");
    },
    m(i, n) {
      insert$3(i, e, n);
    },
    d(i) {
      i && detach$3(e);
    }
  };
}
function create_if_block_5(t) {
  let e = (100 * /*progress_level*/
  (t[14][
    /*i*/
    t[40]
  ] || 0)).toFixed(1) + "", i, n;
  return {
    c() {
      i = text$1(e), n = text$1("%");
    },
    m(s, l) {
      insert$3(s, i, l), insert$3(s, n, l);
    },
    p(s, l) {
      l[0] & /*progress_level*/
      16384 && e !== (e = (100 * /*progress_level*/
      (s[14][
        /*i*/
        s[40]
      ] || 0)).toFixed(1) + "") && set_data$1(i, e);
    },
    d(s) {
      s && (detach$3(i), detach$3(n));
    }
  };
}
function create_each_block(t) {
  let e, i = (
    /*p*/
    (t[38].desc != null || /*progress_level*/
    t[14] && /*progress_level*/
    t[14][
      /*i*/
      t[40]
    ] != null) && create_if_block_4(t)
  );
  return {
    c() {
      i && i.c(), e = empty$1();
    },
    m(n, s) {
      i && i.m(n, s), insert$3(n, e, s);
    },
    p(n, s) {
      /*p*/
      n[38].desc != null || /*progress_level*/
      n[14] && /*progress_level*/
      n[14][
        /*i*/
        n[40]
      ] != null ? i ? i.p(n, s) : (i = create_if_block_4(n), i.c(), i.m(e.parentNode, e)) : i && (i.d(1), i = null);
    },
    d(n) {
      n && detach$3(e), i && i.d(n);
    }
  };
}
function create_if_block_1$2(t) {
  let e, i;
  return {
    c() {
      e = element$3("p"), i = text$1(
        /*loading_text*/
        t[9]
      ), attr$3(e, "class", "loading svelte-14miwb5");
    },
    m(n, s) {
      insert$3(n, e, s), append$3(e, i);
    },
    p(n, s) {
      s[0] & /*loading_text*/
      512 && set_data$1(
        i,
        /*loading_text*/
        n[9]
      );
    },
    d(n) {
      n && detach$3(e);
    }
  };
}
function create_fragment$3(t) {
  let e, i, n, s, l;
  const h = [create_if_block$2, create_if_block_17], _ = [];
  function c(o, r) {
    return (
      /*status*/
      o[4] === "pending" ? 0 : (
        /*status*/
        o[4] === "error" ? 1 : -1
      )
    );
  }
  return ~(i = c(t)) && (n = _[i] = h[i](t)), {
    c() {
      e = element$3("div"), n && n.c(), attr$3(e, "class", s = "wrap " + /*variant*/
      t[8] + " " + /*show_progress*/
      t[6] + " svelte-14miwb5"), toggle_class$2(e, "hide", !/*status*/
      t[4] || /*status*/
      t[4] === "complete" || /*show_progress*/
      t[6] === "hidden"), toggle_class$2(
        e,
        "translucent",
        /*variant*/
        t[8] === "center" && /*status*/
        (t[4] === "pending" || /*status*/
        t[4] === "error") || /*translucent*/
        t[11] || /*show_progress*/
        t[6] === "minimal"
      ), toggle_class$2(
        e,
        "generating",
        /*status*/
        t[4] === "generating"
      ), toggle_class$2(
        e,
        "border",
        /*border*/
        t[12]
      ), set_style$2(
        e,
        "position",
        /*absolute*/
        t[10] ? "absolute" : "static"
      ), set_style$2(
        e,
        "padding",
        /*absolute*/
        t[10] ? "0" : "var(--size-8) 0"
      );
    },
    m(o, r) {
      insert$3(o, e, r), ~i && _[i].m(e, null), t[31](e), l = !0;
    },
    p(o, r) {
      let T = i;
      i = c(o), i === T ? ~i && _[i].p(o, r) : (n && (group_outros$2(), transition_out$3(_[T], 1, 1, () => {
        _[T] = null;
      }), check_outros$2()), ~i ? (n = _[i], n ? n.p(o, r) : (n = _[i] = h[i](o), n.c()), transition_in$3(n, 1), n.m(e, null)) : n = null), (!l || r[0] & /*variant, show_progress*/
      320 && s !== (s = "wrap " + /*variant*/
      o[8] + " " + /*show_progress*/
      o[6] + " svelte-14miwb5")) && attr$3(e, "class", s), (!l || r[0] & /*variant, show_progress, status, show_progress*/
      336) && toggle_class$2(e, "hide", !/*status*/
      o[4] || /*status*/
      o[4] === "complete" || /*show_progress*/
      o[6] === "hidden"), (!l || r[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
      2384) && toggle_class$2(
        e,
        "translucent",
        /*variant*/
        o[8] === "center" && /*status*/
        (o[4] === "pending" || /*status*/
        o[4] === "error") || /*translucent*/
        o[11] || /*show_progress*/
        o[6] === "minimal"
      ), (!l || r[0] & /*variant, show_progress, status*/
      336) && toggle_class$2(
        e,
        "generating",
        /*status*/
        o[4] === "generating"
      ), (!l || r[0] & /*variant, show_progress, border*/
      4416) && toggle_class$2(
        e,
        "border",
        /*border*/
        o[12]
      ), r[0] & /*absolute*/
      1024 && set_style$2(
        e,
        "position",
        /*absolute*/
        o[10] ? "absolute" : "static"
      ), r[0] & /*absolute*/
      1024 && set_style$2(
        e,
        "padding",
        /*absolute*/
        o[10] ? "0" : "var(--size-8) 0"
      );
    },
    i(o) {
      l || (transition_in$3(n), l = !0);
    },
    o(o) {
      transition_out$3(n), l = !1;
    },
    d(o) {
      o && detach$3(e), ~i && _[i].d(), t[31](null);
    }
  };
}
let items = [], called = !1;
async function scroll_into_view(t, e = !0) {
  if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && e !== !0)) {
    if (items.push(t), !called)
      called = !0;
    else
      return;
    await tick$2(), requestAnimationFrame(() => {
      let i = [0, 0];
      for (let n = 0; n < items.length; n++) {
        const l = items[n].getBoundingClientRect();
        (n === 0 || l.top + window.scrollY <= i[0]) && (i[0] = l.top + window.scrollY, i[1] = n);
      }
      window.scrollTo({ top: i[0] - 20, behavior: "smooth" }), called = !1, items = [];
    });
  }
}
function instance$3(t, e, i) {
  let n, { $$slots: s = {}, $$scope: l } = e, { i18n: h } = e, { eta: _ = null } = e, { queue: c = !1 } = e, { queue_position: o } = e, { queue_size: r } = e, { status: T } = e, { scroll_to_output: S = !1 } = e, { timer: w = !0 } = e, { show_progress: C = "full" } = e, { message: P = null } = e, { progress: b = null } = e, { variant: k = "default" } = e, { loading_text: F = "Loading..." } = e, { absolute: x = !0 } = e, { translucent: y = !1 } = e, { border: p = !1 } = e, { autoscroll: E } = e, $, M = !1, m = 0, N = 0, D = null, X = 0, G = null, I, B = null, ee = !0;
  const Y = () => {
    i(25, m = performance.now()), i(26, N = 0), M = !0, q();
  };
  function q() {
    requestAnimationFrame(() => {
      i(26, N = (performance.now() - m) / 1e3), M && q();
    });
  }
  function le() {
    i(26, N = 0), M && (M = !1);
  }
  onDestroy(() => {
    M && le();
  });
  let pe = null;
  function we(R) {
    binding_callbacks$2[R ? "unshift" : "push"](() => {
      B = R, i(16, B), i(7, b), i(14, G), i(15, I);
    });
  }
  function be(R) {
    binding_callbacks$2[R ? "unshift" : "push"](() => {
      $ = R, i(13, $);
    });
  }
  return t.$$set = (R) => {
    "i18n" in R && i(1, h = R.i18n), "eta" in R && i(0, _ = R.eta), "queue" in R && i(21, c = R.queue), "queue_position" in R && i(2, o = R.queue_position), "queue_size" in R && i(3, r = R.queue_size), "status" in R && i(4, T = R.status), "scroll_to_output" in R && i(22, S = R.scroll_to_output), "timer" in R && i(5, w = R.timer), "show_progress" in R && i(6, C = R.show_progress), "message" in R && i(23, P = R.message), "progress" in R && i(7, b = R.progress), "variant" in R && i(8, k = R.variant), "loading_text" in R && i(9, F = R.loading_text), "absolute" in R && i(10, x = R.absolute), "translucent" in R && i(11, y = R.translucent), "border" in R && i(12, p = R.border), "autoscroll" in R && i(24, E = R.autoscroll), "$$scope" in R && i(28, l = R.$$scope);
  }, t.$$.update = () => {
    t.$$.dirty[0] & /*eta, old_eta, queue, timer_start*/
    169869313 && (_ === null ? i(0, _ = D) : c && i(0, _ = (performance.now() - m) / 1e3 + _), _ != null && (i(19, pe = _.toFixed(1)), i(27, D = _))), t.$$.dirty[0] & /*eta, timer_diff*/
    67108865 && i(17, X = _ === null || _ <= 0 || !N ? null : Math.min(N / _, 1)), t.$$.dirty[0] & /*progress*/
    128 && b != null && i(18, ee = !1), t.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
    114816 && (b != null ? i(14, G = b.map((R) => {
      if (R.index != null && R.length != null)
        return R.index / R.length;
      if (R.progress != null)
        return R.progress;
    })) : i(14, G = null), G ? (i(15, I = G[G.length - 1]), B && (I === 0 ? i(16, B.style.transition = "0", B) : i(16, B.style.transition = "150ms", B))) : i(15, I = void 0)), t.$$.dirty[0] & /*status*/
    16 && (T === "pending" ? Y() : le()), t.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
    20979728 && $ && S && (T === "pending" || T === "complete") && scroll_into_view($, E), t.$$.dirty[0] & /*status, message*/
    8388624, t.$$.dirty[0] & /*timer_diff*/
    67108864 && i(20, n = N.toFixed(1));
  }, [
    _,
    h,
    o,
    r,
    T,
    w,
    C,
    b,
    k,
    F,
    x,
    y,
    p,
    $,
    G,
    I,
    B,
    X,
    ee,
    pe,
    n,
    c,
    S,
    P,
    E,
    m,
    N,
    D,
    l,
    s,
    we,
    be
  ];
}
class Static extends SvelteComponent$3 {
  constructor(e) {
    super(), init$3(
      this,
      e,
      instance$3,
      create_fragment$3,
      safe_not_equal$3,
      {
        i18n: 1,
        eta: 0,
        queue: 21,
        queue_position: 2,
        queue_size: 3,
        status: 4,
        scroll_to_output: 22,
        timer: 5,
        show_progress: 6,
        message: 23,
        progress: 7,
        variant: 8,
        loading_text: 9,
        absolute: 10,
        translucent: 11,
        border: 12,
        autoscroll: 24
      },
      null,
      [-1, -1]
    );
  }
}
const ToastContent_svelte_svelte_type_style_lang = "", Toast_svelte_svelte_type_style_lang = "";
var fn = new Intl.Collator(0, { numeric: 1 }).compare;
function semiver(t, e, i) {
  return t = t.split("."), e = e.split("."), fn(t[0], e[0]) || fn(t[1], e[1]) || (e[2] = e.slice(2).join("."), i = /[.-]/.test(t[2] = t.slice(2).join(".")), i == /[.-]/.test(e[2]) ? fn(t[2], e[2]) : i ? -1 : 1);
}
function resolve_root(t, e, i) {
  return e.startsWith("http://") || e.startsWith("https://") ? i ? t : e : t + e;
}
function determine_protocol(t) {
  if (t.startsWith("http")) {
    const { protocol: e, host: i } = new URL(t);
    return i.endsWith("hf.space") ? {
      ws_protocol: "wss",
      host: i,
      http_protocol: e
    } : {
      ws_protocol: e === "https:" ? "wss" : "ws",
      http_protocol: e,
      host: i
    };
  } else if (t.startsWith("file:"))
    return {
      ws_protocol: "ws",
      http_protocol: "http:",
      host: "lite.local"
      // Special fake hostname only used for this case. This matches the hostname allowed in `is_self_host()` in `js/wasm/network/host.ts`.
    };
  return {
    ws_protocol: "wss",
    http_protocol: "https:",
    host: t
  };
}
const RE_SPACE_NAME = /^[^\/]*\/[^\/]*$/, RE_SPACE_DOMAIN = /.*hf\.space\/{0,1}$/;
async function process_endpoint(t, e) {
  const i = {};
  e && (i.Authorization = `Bearer ${e}`);
  const n = t.trim();
  if (RE_SPACE_NAME.test(n))
    try {
      const s = await fetch(
        `https://huggingface.co/api/spaces/${n}/host`,
        { headers: i }
      );
      if (s.status !== 200)
        throw new Error("Space metadata could not be loaded.");
      const l = (await s.json()).host;
      return {
        space_id: t,
        ...determine_protocol(l)
      };
    } catch (s) {
      throw new Error("Space metadata could not be loaded." + s.message);
    }
  if (RE_SPACE_DOMAIN.test(n)) {
    const { ws_protocol: s, http_protocol: l, host: h } = determine_protocol(n);
    return {
      space_id: h.replace(".hf.space", ""),
      ws_protocol: s,
      http_protocol: l,
      host: h
    };
  }
  return {
    space_id: !1,
    ...determine_protocol(n)
  };
}
function map_names_to_ids(t) {
  let e = {};
  return t.forEach(({ api_name: i }, n) => {
    i && (e[i] = n);
  }), e;
}
const RE_DISABLED_DISCUSSION = /^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;
async function discussions_enabled(t) {
  try {
    const i = (await fetch(
      `https://huggingface.co/api/spaces/${t}/discussions`,
      {
        method: "HEAD"
      }
    )).headers.get("x-error-message");
    return !(i && RE_DISABLED_DISCUSSION.test(i));
  } catch {
    return !1;
  }
}
function normalise_file(t, e, i) {
  if (t == null)
    return null;
  if (Array.isArray(t)) {
    const n = [];
    for (const s of t)
      s == null ? n.push(null) : n.push(normalise_file(s, e, i));
    return n;
  }
  return t.is_stream ? i == null ? new FileData({
    ...t,
    url: e + "/stream/" + t.path
  }) : new FileData({
    ...t,
    url: "/proxy=" + i + "stream/" + t.path
  }) : new FileData({
    ...t,
    url: get_fetchable_url_or_file(t.path, e, i)
  });
}
function is_url(t) {
  try {
    const e = new URL(t);
    return e.protocol === "http:" || e.protocol === "https:";
  } catch {
    return !1;
  }
}
function get_fetchable_url_or_file(t, e, i) {
  return t == null ? i ? `/proxy=${i}file=` : `${e}/file=` : is_url(t) ? t : i ? `/proxy=${i}file=${t}` : `${e}/file=${t}`;
}
async function upload(t, e, i = upload_files) {
  let n = (Array.isArray(t) ? t : [t]).map(
    (s) => s.blob
  );
  return await Promise.all(
    await i(e, n).then(
      async (s) => {
        if (s.error)
          throw new Error(s.error);
        return s.files ? s.files.map((l, h) => {
          const _ = new FileData({ ...t[h], path: l });
          return normalise_file(_, e, null);
        }) : [];
      }
    )
  );
}
async function prepare_files(t, e) {
  return t.map(
    (i, n) => new FileData({
      path: i.name,
      orig_name: i.name,
      blob: i,
      size: i.size,
      mime_type: i.type,
      is_stream: e
    })
  );
}
class FileData {
  constructor({
    path: e,
    url: i,
    orig_name: n,
    size: s,
    blob: l,
    is_stream: h,
    mime_type: _,
    alt_text: c
  }) {
    this.path = e, this.url = i, this.orig_name = n, this.size = s, this.blob = i ? void 0 : l, this.is_stream = h, this.mime_type = _, this.alt_text = c;
  }
}
const QUEUE_FULL_MSG = "This application is too busy. Keep trying!", BROKEN_CONNECTION_MSG = "Connection errored out.";
let NodeBlob;
function api_factory(t, e) {
  return { post_data: i, upload_files: n, client: s, handle_blob: l };
  async function i(h, _, c) {
    const o = { "Content-Type": "application/json" };
    c && (o.Authorization = `Bearer ${c}`);
    try {
      var r = await t(h, {
        method: "POST",
        body: JSON.stringify(_),
        headers: o
      });
    } catch {
      return [{ error: BROKEN_CONNECTION_MSG }, 500];
    }
    return [await r.json(), r.status];
  }
  async function n(h, _, c) {
    const o = {};
    c && (o.Authorization = `Bearer ${c}`);
    const r = 1e3, T = [];
    for (let w = 0; w < _.length; w += r) {
      const C = _.slice(w, w + r), P = new FormData();
      C.forEach((k) => {
        P.append("files", k);
      });
      try {
        var S = await t(`${h}/upload`, {
          method: "POST",
          body: P,
          headers: o
        });
      } catch {
        return { error: BROKEN_CONNECTION_MSG };
      }
      const b = await S.json();
      T.push(...b);
    }
    return { files: T };
  }
  async function s(h, _ = { normalise_files: !0 }) {
    return new Promise(async (c) => {
      const { status_callback: o, hf_token: r, normalise_files: T } = _, S = {
        predict: N,
        submit: D,
        view_api: G,
        component_server: X
      }, w = T ?? !0;
      if ((typeof window > "u" || !("WebSocket" in window)) && !global.Websocket) {
        const I = await import("./wrapper-98f94c21-d1a5537c.js");
        NodeBlob = (await Promise.resolve().then(() => __viteBrowserExternal)).Blob, global.WebSocket = I.WebSocket;
      }
      const { ws_protocol: C, http_protocol: P, host: b, space_id: k } = await process_endpoint(h, r), F = Math.random().toString(36).substring(2), x = {};
      let y, p = {}, E = !1;
      r && k && (E = await get_jwt(k, r));
      async function $(I) {
        if (y = I, p = map_names_to_ids((I == null ? void 0 : I.dependencies) || []), y.auth_required)
          return {
            config: y,
            ...S
          };
        try {
          M = await G(y);
        } catch (B) {
          console.error(`Could not get api details: ${B.message}`);
        }
        return {
          config: y,
          ...S
        };
      }
      let M;
      async function m(I) {
        if (o && o(I), I.status === "running")
          try {
            y = await resolve_config(
              t,
              `${P}//${b}`,
              r
            );
            const B = await $(y);
            c(B);
          } catch (B) {
            console.error(B), o && o({
              status: "error",
              message: "Could not load this space.",
              load_status: "error",
              detail: "NOT_FOUND"
            });
          }
      }
      try {
        y = await resolve_config(
          t,
          `${P}//${b}`,
          r
        );
        const I = await $(y);
        c(I);
      } catch (I) {
        console.error(I), k ? check_space_status(
          k,
          RE_SPACE_NAME.test(k) ? "space_name" : "subdomain",
          m
        ) : o && o({
          status: "error",
          message: "Could not load this space.",
          load_status: "error",
          detail: "NOT_FOUND"
        });
      }
      function N(I, B, ee) {
        let Y = !1, q = !1, le;
        if (typeof I == "number")
          le = y.dependencies[I];
        else {
          const pe = I.replace(/^\//, "");
          le = y.dependencies[p[pe]];
        }
        if (le.types.continuous)
          throw new Error(
            "Cannot call predict on this function as it may run forever. Use submit instead"
          );
        return new Promise((pe, we) => {
          const be = D(I, B, ee);
          let R;
          be.on("data", (d) => {
            q && (be.destroy(), pe(d)), Y = !0, R = d;
          }).on("status", (d) => {
            d.stage === "error" && we(d), d.stage === "complete" && (q = !0, Y && (be.destroy(), pe(R)));
          });
        });
      }
      function D(I, B, ee) {
        let Y, q;
        if (typeof I == "number")
          Y = I, q = M.unnamed_endpoints[Y];
        else {
          const Z = I.replace(/^\//, "");
          Y = p[Z], q = M.named_endpoints[I.trim()];
        }
        if (typeof Y != "number")
          throw new Error(
            "There is no endpoint matching that name of fn_index matching that number."
          );
        let le, pe, we = y.protocol ?? "sse";
        const be = typeof I == "number" ? "/predict" : I;
        let R, d = null, g = !1;
        const f = {};
        let v = "";
        typeof window < "u" && (v = new URLSearchParams(window.location.search).toString()), l(
          `${P}//${resolve_root(b, y.path, !0)}`,
          B,
          q,
          r
        ).then((Z) => {
          if (R = { data: Z || [], event_data: ee, fn_index: Y }, skip_queue(Y, y))
            A({
              type: "status",
              endpoint: be,
              stage: "pending",
              queue: !1,
              fn_index: Y,
              time: /* @__PURE__ */ new Date()
            }), i(
              `${P}//${resolve_root(b, y.path, !0)}/run${be.startsWith("/") ? be : `/${be}`}${v ? "?" + v : ""}`,
              {
                ...R,
                session_hash: F
              },
              r
            ).then(([ue, me]) => {
              const fe = w ? transform_output(
                ue.data,
                q,
                y.root,
                y.root_url
              ) : ue.data;
              me == 200 ? (A({
                type: "data",
                endpoint: be,
                fn_index: Y,
                data: fe,
                time: /* @__PURE__ */ new Date()
              }), A({
                type: "status",
                endpoint: be,
                fn_index: Y,
                stage: "complete",
                eta: ue.average_duration,
                queue: !1,
                time: /* @__PURE__ */ new Date()
              })) : A({
                type: "status",
                stage: "error",
                endpoint: be,
                fn_index: Y,
                message: ue.error,
                queue: !1,
                time: /* @__PURE__ */ new Date()
              });
            }).catch((ue) => {
              A({
                type: "status",
                stage: "error",
                message: ue.message,
                endpoint: be,
                fn_index: Y,
                queue: !1,
                time: /* @__PURE__ */ new Date()
              });
            });
          else if (we == "ws") {
            A({
              type: "status",
              stage: "pending",
              queue: !0,
              endpoint: be,
              fn_index: Y,
              time: /* @__PURE__ */ new Date()
            });
            let ue = new URL(`${C}://${resolve_root(
              b,
              y.path,
              !0
            )}
							/queue/join${v ? "?" + v : ""}`);
            E && ue.searchParams.set("__sign", E), le = e(ue), le.onclose = (me) => {
              me.wasClean || A({
                type: "status",
                stage: "error",
                broken: !0,
                message: BROKEN_CONNECTION_MSG,
                queue: !0,
                endpoint: be,
                fn_index: Y,
                time: /* @__PURE__ */ new Date()
              });
            }, le.onmessage = function(me) {
              const fe = JSON.parse(me.data), { type: Pe, status: Fe, data: Ee } = handle_message(
                fe,
                x[Y]
              );
              if (Pe === "update" && Fe && !g)
                A({
                  type: "status",
                  endpoint: be,
                  fn_index: Y,
                  time: /* @__PURE__ */ new Date(),
                  ...Fe
                }), Fe.stage === "error" && le.close();
              else if (Pe === "hash") {
                le.send(JSON.stringify({ fn_index: Y, session_hash: F }));
                return;
              } else
                Pe === "data" ? le.send(JSON.stringify({ ...R, session_hash: F })) : Pe === "complete" ? g = Fe : Pe === "log" ? A({
                  type: "log",
                  log: Ee.log,
                  level: Ee.level,
                  endpoint: be,
                  fn_index: Y
                }) : Pe === "generating" && A({
                  type: "status",
                  time: /* @__PURE__ */ new Date(),
                  ...Fe,
                  stage: Fe == null ? void 0 : Fe.stage,
                  queue: !0,
                  endpoint: be,
                  fn_index: Y
                });
              Ee && (A({
                type: "data",
                time: /* @__PURE__ */ new Date(),
                data: w ? transform_output(
                  Ee.data,
                  q,
                  y.root,
                  y.root_url
                ) : Ee.data,
                endpoint: be,
                fn_index: Y
              }), g && (A({
                type: "status",
                time: /* @__PURE__ */ new Date(),
                ...g,
                stage: Fe == null ? void 0 : Fe.stage,
                queue: !0,
                endpoint: be,
                fn_index: Y
              }), le.close()));
            }, semiver(y.version || "2.0.0", "3.6") < 0 && addEventListener(
              "open",
              () => le.send(JSON.stringify({ hash: F }))
            );
          } else {
            A({
              type: "status",
              stage: "pending",
              queue: !0,
              endpoint: be,
              fn_index: Y,
              time: /* @__PURE__ */ new Date()
            });
            var ce = new URLSearchParams({
              fn_index: Y.toString(),
              session_hash: F
            }).toString();
            let ue = new URL(
              `${P}//${resolve_root(
                b,
                y.path,
                !0
              )}/queue/join?${ce}`
            );
            pe = new EventSource(ue), pe.onmessage = async function(me) {
              const fe = JSON.parse(me.data), { type: Pe, status: Fe, data: Ee } = handle_message(
                fe,
                x[Y]
              );
              if (Pe === "update" && Fe && !g)
                A({
                  type: "status",
                  endpoint: be,
                  fn_index: Y,
                  time: /* @__PURE__ */ new Date(),
                  ...Fe
                }), Fe.stage === "error" && pe.close();
              else if (Pe === "data") {
                d = fe.event_id;
                let [De, _e] = await i(
                  `${P}//${resolve_root(
                    b,
                    y.path,
                    !0
                  )}/queue/data`,
                  {
                    ...R,
                    session_hash: F,
                    event_id: d
                  },
                  r
                );
                _e !== 200 && (A({
                  type: "status",
                  stage: "error",
                  message: BROKEN_CONNECTION_MSG,
                  queue: !0,
                  endpoint: be,
                  fn_index: Y,
                  time: /* @__PURE__ */ new Date()
                }), pe.close());
              } else
                Pe === "complete" ? g = Fe : Pe === "log" ? A({
                  type: "log",
                  log: Ee.log,
                  level: Ee.level,
                  endpoint: be,
                  fn_index: Y
                }) : Pe === "generating" && A({
                  type: "status",
                  time: /* @__PURE__ */ new Date(),
                  ...Fe,
                  stage: Fe == null ? void 0 : Fe.stage,
                  queue: !0,
                  endpoint: be,
                  fn_index: Y
                });
              Ee && (A({
                type: "data",
                time: /* @__PURE__ */ new Date(),
                data: w ? transform_output(
                  Ee.data,
                  q,
                  y.root,
                  y.root_url
                ) : Ee.data,
                endpoint: be,
                fn_index: Y
              }), g && (A({
                type: "status",
                time: /* @__PURE__ */ new Date(),
                ...g,
                stage: Fe == null ? void 0 : Fe.stage,
                queue: !0,
                endpoint: be,
                fn_index: Y
              }), pe.close()));
            };
          }
        });
        function A(Z) {
          const ue = f[Z.type] || [];
          ue == null || ue.forEach((me) => me(Z));
        }
        function O(Z, ce) {
          const ue = f, me = ue[Z] || [];
          return ue[Z] = me, me == null || me.push(ce), { on: O, off: H, cancel: z, destroy: ae };
        }
        function H(Z, ce) {
          const ue = f;
          let me = ue[Z] || [];
          return me = me == null ? void 0 : me.filter((fe) => fe !== ce), ue[Z] = me, { on: O, off: H, cancel: z, destroy: ae };
        }
        async function z() {
          const Z = {
            stage: "complete",
            queue: !1,
            time: /* @__PURE__ */ new Date()
          };
          g = Z, A({
            ...Z,
            type: "status",
            endpoint: be,
            fn_index: Y
          });
          let ce = {};
          we === "ws" ? (le && le.readyState === 0 ? le.addEventListener("open", () => {
            le.close();
          }) : le.close(), ce = { fn_index: Y, session_hash: F }) : (pe.close(), ce = { event_id: d });
          try {
            await t(
              `${P}//${resolve_root(
                b,
                y.path,
                !0
              )}/reset`,
              {
                headers: { "Content-Type": "application/json" },
                method: "POST",
                body: JSON.stringify(ce)
              }
            );
          } catch {
            console.warn(
              "The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable."
            );
          }
        }
        function ae() {
          for (const Z in f)
            f[Z].forEach((ce) => {
              H(Z, ce);
            });
        }
        return {
          on: O,
          off: H,
          cancel: z,
          destroy: ae
        };
      }
      async function X(I, B, ee) {
        var Y;
        const q = { "Content-Type": "application/json" };
        r && (q.Authorization = `Bearer ${r}`);
        let le, pe = y.components.find(
          (R) => R.id === I
        );
        (Y = pe == null ? void 0 : pe.props) != null && Y.root_url ? le = pe.props.root_url : le = `${P}//${resolve_root(
          b,
          y.path,
          !0
        )}/`;
        const we = await t(
          `${le}component_server/`,
          {
            method: "POST",
            body: JSON.stringify({
              data: ee,
              component_id: I,
              fn_name: B,
              session_hash: F
            }),
            headers: q
          }
        );
        if (!we.ok)
          throw new Error(
            "Could not connect to component server: " + we.statusText
          );
        return await we.json();
      }
      async function G(I) {
        if (M)
          return M;
        const B = { "Content-Type": "application/json" };
        r && (B.Authorization = `Bearer ${r}`);
        let ee;
        if (semiver(I.version || "2.0.0", "3.30") < 0 ? ee = await t(
          "https://gradio-space-api-fetcher-v2.hf.space/api",
          {
            method: "POST",
            body: JSON.stringify({
              serialize: !1,
              config: JSON.stringify(I)
            }),
            headers: B
          }
        ) : ee = await t(`${I.root}/info`, {
          headers: B
        }), !ee.ok)
          throw new Error(BROKEN_CONNECTION_MSG);
        let Y = await ee.json();
        return "api" in Y && (Y = Y.api), Y.named_endpoints["/predict"] && !Y.unnamed_endpoints[0] && (Y.unnamed_endpoints[0] = Y.named_endpoints["/predict"]), transform_api_info(Y, I, p);
      }
    });
  }
  async function l(h, _, c, o) {
    const r = await walk_and_store_blobs(
      _,
      void 0,
      [],
      !0,
      c
    );
    return Promise.all(
      r.map(async ({ path: T, blob: S, type: w }) => {
        if (S) {
          const C = (await n(h, [S], o)).files[0];
          return { path: T, file_url: C, type: w, name: S == null ? void 0 : S.name };
        }
        return { path: T, type: w };
      })
    ).then((T) => (T.forEach(({ path: S, file_url: w, type: C, name: P }) => {
      if (C === "Gallery")
        update_object(_, w, S);
      else if (w) {
        const b = new FileData({ path: w, orig_name: P });
        update_object(_, b, S);
      }
    }), _));
  }
}
const { post_data, upload_files, client, handle_blob } = api_factory(
  fetch,
  (...t) => new WebSocket(...t)
);
function transform_output(t, e, i, n) {
  return t.map((s, l) => {
    var h, _, c, o;
    return ((_ = (h = e == null ? void 0 : e.returns) == null ? void 0 : h[l]) == null ? void 0 : _.component) === "File" ? normalise_file(s, i, n) : ((o = (c = e == null ? void 0 : e.returns) == null ? void 0 : c[l]) == null ? void 0 : o.component) === "Gallery" ? s.map((r) => Array.isArray(r) ? [normalise_file(r[0], i, n), r[1]] : [normalise_file(r, i, n), null]) : typeof s == "object" && s.path ? normalise_file(s, i, n) : s;
  });
}
function get_type(t, e, i, n) {
  switch (t.type) {
    case "string":
      return "string";
    case "boolean":
      return "boolean";
    case "number":
      return "number";
  }
  if (i === "JSONSerializable" || i === "StringSerializable")
    return "any";
  if (i === "ListStringSerializable")
    return "string[]";
  if (e === "Image")
    return n === "parameter" ? "Blob | File | Buffer" : "string";
  if (i === "FileSerializable")
    return (t == null ? void 0 : t.type) === "array" ? n === "parameter" ? "(Blob | File | Buffer)[]" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]" : n === "parameter" ? "Blob | File | Buffer" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}";
  if (i === "GallerySerializable")
    return n === "parameter" ? "[(Blob | File | Buffer), (string | null)][]" : "[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]";
}
function get_description(t, e) {
  return e === "GallerySerializable" ? "array of [file, label] tuples" : e === "ListStringSerializable" ? "array of strings" : e === "FileSerializable" ? "array of files or single file" : t.description;
}
function transform_api_info(t, e, i) {
  const n = {
    named_endpoints: {},
    unnamed_endpoints: {}
  };
  for (const s in t) {
    const l = t[s];
    for (const h in l) {
      const _ = e.dependencies[h] ? h : i[h.replace("/", "")], c = l[h];
      n[s][h] = {}, n[s][h].parameters = {}, n[s][h].returns = {}, n[s][h].type = e.dependencies[_].types, n[s][h].parameters = c.parameters.map(
        ({ label: o, component: r, type: T, serializer: S }) => ({
          label: o,
          component: r,
          type: get_type(T, r, S, "parameter"),
          description: get_description(T, S)
        })
      ), n[s][h].returns = c.returns.map(
        ({ label: o, component: r, type: T, serializer: S }) => ({
          label: o,
          component: r,
          type: get_type(T, r, S, "return"),
          description: get_description(T, S)
        })
      );
    }
  }
  return n;
}
async function get_jwt(t, e) {
  try {
    return (await (await fetch(`https://huggingface.co/api/spaces/${t}/jwt`, {
      headers: {
        Authorization: `Bearer ${e}`
      }
    })).json()).token || !1;
  } catch (i) {
    return console.error(i), !1;
  }
}
function update_object(t, e, i) {
  for (; i.length > 1; )
    t = t[i.shift()];
  t[i.shift()] = e;
}
async function walk_and_store_blobs(t, e = void 0, i = [], n = !1, s = void 0) {
  if (Array.isArray(t)) {
    let l = [];
    return await Promise.all(
      t.map(async (h, _) => {
        var c;
        let o = i.slice();
        o.push(_);
        const r = await walk_and_store_blobs(
          t[_],
          n ? ((c = s == null ? void 0 : s.parameters[_]) == null ? void 0 : c.component) || void 0 : e,
          o,
          !1,
          s
        );
        l = l.concat(r);
      })
    ), l;
  } else {
    if (globalThis.Buffer && t instanceof globalThis.Buffer)
      return [
        {
          path: i,
          blob: e === "Image" ? !1 : new NodeBlob([t]),
          type: e
        }
      ];
    if (typeof t == "object") {
      let l = [];
      for (let h in t)
        if (t.hasOwnProperty(h)) {
          let _ = i.slice();
          _.push(h), l = l.concat(
            await walk_and_store_blobs(
              t[h],
              void 0,
              _,
              !1,
              s
            )
          );
        }
      return l;
    }
  }
  return [];
}
function skip_queue(t, e) {
  var i, n, s, l;
  return !(((n = (i = e == null ? void 0 : e.dependencies) == null ? void 0 : i[t]) == null ? void 0 : n.queue) === null ? e.enable_queue : (l = (s = e == null ? void 0 : e.dependencies) == null ? void 0 : s[t]) != null && l.queue) || !1;
}
async function resolve_config(t, e, i) {
  const n = {};
  if (i && (n.Authorization = `Bearer ${i}`), typeof window < "u" && window.gradio_config && location.origin !== "http://localhost:9876" && !window.gradio_config.dev_mode) {
    const s = window.gradio_config.root, l = window.gradio_config;
    return l.root = resolve_root(e, l.root, !1), { ...l, path: s };
  } else if (e) {
    let s = await t(`${e}/config`, {
      headers: n
    });
    if (s.status === 200) {
      const l = await s.json();
      return l.path = l.path ?? "", l.root = e, l;
    }
    throw new Error("Could not get config.");
  }
  throw new Error("No config or app endpoint found");
}
async function check_space_status(t, e, i) {
  let n = e === "subdomain" ? `https://huggingface.co/api/spaces/by-subdomain/${t}` : `https://huggingface.co/api/spaces/${t}`, s, l;
  try {
    if (s = await fetch(n), l = s.status, l !== 200)
      throw new Error();
    s = await s.json();
  } catch {
    i({
      status: "error",
      load_status: "error",
      message: "Could not get space status",
      detail: "NOT_FOUND"
    });
    return;
  }
  if (!s || l !== 200)
    return;
  const {
    runtime: { stage: h },
    id: _
  } = s;
  switch (h) {
    case "STOPPED":
    case "SLEEPING":
      i({
        status: "sleeping",
        load_status: "pending",
        message: "Space is asleep. Waking it up...",
        detail: h
      }), setTimeout(() => {
        check_space_status(t, e, i);
      }, 1e3);
      break;
    case "PAUSED":
      i({
        status: "paused",
        load_status: "error",
        message: "This space has been paused by the author. If you would like to try this demo, consider duplicating the space.",
        detail: h,
        discussions_enabled: await discussions_enabled(_)
      });
      break;
    case "RUNNING":
    case "RUNNING_BUILDING":
      i({
        status: "running",
        load_status: "complete",
        message: "",
        detail: h
      });
      break;
    case "BUILDING":
      i({
        status: "building",
        load_status: "pending",
        message: "Space is building...",
        detail: h
      }), setTimeout(() => {
        check_space_status(t, e, i);
      }, 1e3);
      break;
    default:
      i({
        status: "space_error",
        load_status: "error",
        message: "This space is experiencing an issue.",
        detail: h,
        discussions_enabled: await discussions_enabled(_)
      });
      break;
  }
}
function handle_message(t, e) {
  switch (t.msg) {
    case "send_data":
      return { type: "data" };
    case "send_hash":
      return { type: "hash" };
    case "queue_full":
      return {
        type: "update",
        status: {
          queue: !0,
          message: QUEUE_FULL_MSG,
          stage: "error",
          code: t.code,
          success: t.success
        }
      };
    case "estimation":
      return {
        type: "update",
        status: {
          queue: !0,
          stage: e || "pending",
          code: t.code,
          size: t.queue_size,
          position: t.rank,
          eta: t.rank_eta,
          success: t.success
        }
      };
    case "progress":
      return {
        type: "update",
        status: {
          queue: !0,
          stage: "pending",
          code: t.code,
          progress_data: t.progress_data,
          success: t.success
        }
      };
    case "log":
      return { type: "log", data: t };
    case "process_generating":
      return {
        type: "generating",
        status: {
          queue: !0,
          message: t.success ? null : t.output.error,
          stage: t.success ? "generating" : "error",
          code: t.code,
          progress_data: t.progress_data,
          eta: t.average_duration
        },
        data: t.success ? t.output : null
      };
    case "process_completed":
      return "error" in t.output ? {
        type: "update",
        status: {
          queue: !0,
          message: t.output.error,
          stage: "error",
          code: t.code,
          success: t.success
        }
      } : {
        type: "complete",
        status: {
          queue: !0,
          message: t.success ? void 0 : t.output.error,
          stage: t.success ? "complete" : "error",
          code: t.code,
          progress_data: t.progress_data,
          eta: t.output.average_duration
        },
        data: t.success ? t.output : null
      };
    case "process_starts":
      return {
        type: "update",
        status: {
          queue: !0,
          stage: "pending",
          code: t.code,
          size: t.rank,
          position: 0,
          success: t.success
        }
      };
  }
  return { type: "none", status: { stage: "error", queue: !0 } };
}
function getDefaultExportFromCjs(t) {
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
function getAugmentedNamespace(t) {
  if (t.__esModule)
    return t;
  var e = t.default;
  if (typeof e == "function") {
    var i = function n() {
      if (this instanceof n) {
        var s = [null];
        s.push.apply(s, arguments);
        var l = Function.bind.apply(e, s);
        return new l();
      }
      return e.apply(this, arguments);
    };
    i.prototype = e.prototype;
  } else
    i = {};
  return Object.defineProperty(i, "__esModule", { value: !0 }), Object.keys(t).forEach(function(n) {
    var s = Object.getOwnPropertyDescriptor(t, n);
    Object.defineProperty(i, n, s.get ? s : {
      enumerable: !0,
      get: function() {
        return t[n];
      }
    });
  }), i;
}
var isMergeableObject = function(e) {
  return isNonNullObject(e) && !isSpecial(e);
};
function isNonNullObject(t) {
  return !!t && typeof t == "object";
}
function isSpecial(t) {
  var e = Object.prototype.toString.call(t);
  return e === "[object RegExp]" || e === "[object Date]" || isReactElement(t);
}
var canUseSymbol = typeof Symbol == "function" && Symbol.for, REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
function isReactElement(t) {
  return t.$$typeof === REACT_ELEMENT_TYPE;
}
function emptyTarget(t) {
  return Array.isArray(t) ? [] : {};
}
function cloneUnlessOtherwiseSpecified(t, e) {
  return e.clone !== !1 && e.isMergeableObject(t) ? deepmerge(emptyTarget(t), t, e) : t;
}
function defaultArrayMerge(t, e, i) {
  return t.concat(e).map(function(n) {
    return cloneUnlessOtherwiseSpecified(n, i);
  });
}
function getMergeFunction(t, e) {
  if (!e.customMerge)
    return deepmerge;
  var i = e.customMerge(t);
  return typeof i == "function" ? i : deepmerge;
}
function getEnumerableOwnPropertySymbols(t) {
  return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter(function(e) {
    return Object.propertyIsEnumerable.call(t, e);
  }) : [];
}
function getKeys(t) {
  return Object.keys(t).concat(getEnumerableOwnPropertySymbols(t));
}
function propertyIsOnObject(t, e) {
  try {
    return e in t;
  } catch {
    return !1;
  }
}
function propertyIsUnsafe(t, e) {
  return propertyIsOnObject(t, e) && !(Object.hasOwnProperty.call(t, e) && Object.propertyIsEnumerable.call(t, e));
}
function mergeObject(t, e, i) {
  var n = {};
  return i.isMergeableObject(t) && getKeys(t).forEach(function(s) {
    n[s] = cloneUnlessOtherwiseSpecified(t[s], i);
  }), getKeys(e).forEach(function(s) {
    propertyIsUnsafe(t, s) || (propertyIsOnObject(t, s) && i.isMergeableObject(e[s]) ? n[s] = getMergeFunction(s, i)(t[s], e[s], i) : n[s] = cloneUnlessOtherwiseSpecified(e[s], i));
  }), n;
}
function deepmerge(t, e, i) {
  i = i || {}, i.arrayMerge = i.arrayMerge || defaultArrayMerge, i.isMergeableObject = i.isMergeableObject || isMergeableObject, i.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
  var n = Array.isArray(e), s = Array.isArray(t), l = n === s;
  return l ? n ? i.arrayMerge(t, e, i) : mergeObject(t, e, i) : cloneUnlessOtherwiseSpecified(e, i);
}
deepmerge.all = function(e, i) {
  if (!Array.isArray(e))
    throw new Error("first argument should be an array");
  return e.reduce(function(n, s) {
    return deepmerge(n, s, i);
  }, {});
};
var deepmerge_1 = deepmerge, cjs = deepmerge_1;
const deepmerge$1 = /* @__PURE__ */ getDefaultExportFromCjs(cjs);
var extendStatics = function(t, e) {
  return extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(i, n) {
    i.__proto__ = n;
  } || function(i, n) {
    for (var s in n)
      Object.prototype.hasOwnProperty.call(n, s) && (i[s] = n[s]);
  }, extendStatics(t, e);
};
function __extends(t, e) {
  if (typeof e != "function" && e !== null)
    throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
  extendStatics(t, e);
  function i() {
    this.constructor = t;
  }
  t.prototype = e === null ? Object.create(e) : (i.prototype = e.prototype, new i());
}
var __assign = function() {
  return __assign = Object.assign || function(e) {
    for (var i, n = 1, s = arguments.length; n < s; n++) {
      i = arguments[n];
      for (var l in i)
        Object.prototype.hasOwnProperty.call(i, l) && (e[l] = i[l]);
    }
    return e;
  }, __assign.apply(this, arguments);
};
function __spreadArray(t, e, i) {
  if (i || arguments.length === 2)
    for (var n = 0, s = e.length, l; n < s; n++)
      (l || !(n in e)) && (l || (l = Array.prototype.slice.call(e, 0, n)), l[n] = e[n]);
  return t.concat(l || Array.prototype.slice.call(e));
}
typeof SuppressedError == "function" && SuppressedError;
var ErrorKind;
(function(t) {
  t[t.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE", t[t.EMPTY_ARGUMENT = 2] = "EMPTY_ARGUMENT", t[t.MALFORMED_ARGUMENT = 3] = "MALFORMED_ARGUMENT", t[t.EXPECT_ARGUMENT_TYPE = 4] = "EXPECT_ARGUMENT_TYPE", t[t.INVALID_ARGUMENT_TYPE = 5] = "INVALID_ARGUMENT_TYPE", t[t.EXPECT_ARGUMENT_STYLE = 6] = "EXPECT_ARGUMENT_STYLE", t[t.INVALID_NUMBER_SKELETON = 7] = "INVALID_NUMBER_SKELETON", t[t.INVALID_DATE_TIME_SKELETON = 8] = "INVALID_DATE_TIME_SKELETON", t[t.EXPECT_NUMBER_SKELETON = 9] = "EXPECT_NUMBER_SKELETON", t[t.EXPECT_DATE_TIME_SKELETON = 10] = "EXPECT_DATE_TIME_SKELETON", t[t.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE", t[t.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS", t[t.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE", t[t.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE", t[t.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR", t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR", t[t.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT", t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT", t[t.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR", t[t.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR", t[t.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR", t[t.MISSING_OTHER_CLAUSE = 22] = "MISSING_OTHER_CLAUSE", t[t.INVALID_TAG = 23] = "INVALID_TAG", t[t.INVALID_TAG_NAME = 25] = "INVALID_TAG_NAME", t[t.UNMATCHED_CLOSING_TAG = 26] = "UNMATCHED_CLOSING_TAG", t[t.UNCLOSED_TAG = 27] = "UNCLOSED_TAG";
})(ErrorKind || (ErrorKind = {}));
var TYPE;
(function(t) {
  t[t.literal = 0] = "literal", t[t.argument = 1] = "argument", t[t.number = 2] = "number", t[t.date = 3] = "date", t[t.time = 4] = "time", t[t.select = 5] = "select", t[t.plural = 6] = "plural", t[t.pound = 7] = "pound", t[t.tag = 8] = "tag";
})(TYPE || (TYPE = {}));
var SKELETON_TYPE;
(function(t) {
  t[t.number = 0] = "number", t[t.dateTime = 1] = "dateTime";
})(SKELETON_TYPE || (SKELETON_TYPE = {}));
function isLiteralElement(t) {
  return t.type === TYPE.literal;
}
function isArgumentElement(t) {
  return t.type === TYPE.argument;
}
function isNumberElement(t) {
  return t.type === TYPE.number;
}
function isDateElement(t) {
  return t.type === TYPE.date;
}
function isTimeElement(t) {
  return t.type === TYPE.time;
}
function isSelectElement(t) {
  return t.type === TYPE.select;
}
function isPluralElement(t) {
  return t.type === TYPE.plural;
}
function isPoundElement(t) {
  return t.type === TYPE.pound;
}
function isTagElement(t) {
  return t.type === TYPE.tag;
}
function isNumberSkeleton(t) {
  return !!(t && typeof t == "object" && t.type === SKELETON_TYPE.number);
}
function isDateTimeSkeleton(t) {
  return !!(t && typeof t == "object" && t.type === SKELETON_TYPE.dateTime);
}
var SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/, DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
function parseDateTimeSkeleton(t) {
  var e = {};
  return t.replace(DATE_TIME_REGEX, function(i) {
    var n = i.length;
    switch (i[0]) {
      case "G":
        e.era = n === 4 ? "long" : n === 5 ? "narrow" : "short";
        break;
      case "y":
        e.year = n === 2 ? "2-digit" : "numeric";
        break;
      case "Y":
      case "u":
      case "U":
      case "r":
        throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");
      case "q":
      case "Q":
        throw new RangeError("`q/Q` (quarter) patterns are not supported");
      case "M":
      case "L":
        e.month = ["numeric", "2-digit", "short", "long", "narrow"][n - 1];
        break;
      case "w":
      case "W":
        throw new RangeError("`w/W` (week) patterns are not supported");
      case "d":
        e.day = ["numeric", "2-digit"][n - 1];
        break;
      case "D":
      case "F":
      case "g":
        throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");
      case "E":
        e.weekday = n === 4 ? "short" : n === 5 ? "narrow" : "short";
        break;
      case "e":
        if (n < 4)
          throw new RangeError("`e..eee` (weekday) patterns are not supported");
        e.weekday = ["short", "long", "narrow", "short"][n - 4];
        break;
      case "c":
        if (n < 4)
          throw new RangeError("`c..ccc` (weekday) patterns are not supported");
        e.weekday = ["short", "long", "narrow", "short"][n - 4];
        break;
      case "a":
        e.hour12 = !0;
        break;
      case "b":
      case "B":
        throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");
      case "h":
        e.hourCycle = "h12", e.hour = ["numeric", "2-digit"][n - 1];
        break;
      case "H":
        e.hourCycle = "h23", e.hour = ["numeric", "2-digit"][n - 1];
        break;
      case "K":
        e.hourCycle = "h11", e.hour = ["numeric", "2-digit"][n - 1];
        break;
      case "k":
        e.hourCycle = "h24", e.hour = ["numeric", "2-digit"][n - 1];
        break;
      case "j":
      case "J":
      case "C":
        throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");
      case "m":
        e.minute = ["numeric", "2-digit"][n - 1];
        break;
      case "s":
        e.second = ["numeric", "2-digit"][n - 1];
        break;
      case "S":
      case "A":
        throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");
      case "z":
        e.timeZoneName = n < 4 ? "short" : "long";
        break;
      case "Z":
      case "O":
      case "v":
      case "V":
      case "X":
      case "x":
        throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead");
    }
    return "";
  }), e;
}
var WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
function parseNumberSkeletonFromString(t) {
  if (t.length === 0)
    throw new Error("Number skeleton cannot be empty");
  for (var e = t.split(WHITE_SPACE_REGEX).filter(function(S) {
    return S.length > 0;
  }), i = [], n = 0, s = e; n < s.length; n++) {
    var l = s[n], h = l.split("/");
    if (h.length === 0)
      throw new Error("Invalid number skeleton");
    for (var _ = h[0], c = h.slice(1), o = 0, r = c; o < r.length; o++) {
      var T = r[o];
      if (T.length === 0)
        throw new Error("Invalid number skeleton");
    }
    i.push({ stem: _, options: c });
  }
  return i;
}
function icuUnitToEcma(t) {
  return t.replace(/^(.*?)-/, "");
}
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g, SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g, INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g, CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
function parseSignificantPrecision(t) {
  var e = {};
  return t[t.length - 1] === "r" ? e.roundingPriority = "morePrecision" : t[t.length - 1] === "s" && (e.roundingPriority = "lessPrecision"), t.replace(SIGNIFICANT_PRECISION_REGEX, function(i, n, s) {
    return typeof s != "string" ? (e.minimumSignificantDigits = n.length, e.maximumSignificantDigits = n.length) : s === "+" ? e.minimumSignificantDigits = n.length : n[0] === "#" ? e.maximumSignificantDigits = n.length : (e.minimumSignificantDigits = n.length, e.maximumSignificantDigits = n.length + (typeof s == "string" ? s.length : 0)), "";
  }), e;
}
function parseSign(t) {
  switch (t) {
    case "sign-auto":
      return {
        signDisplay: "auto"
      };
    case "sign-accounting":
    case "()":
      return {
        currencySign: "accounting"
      };
    case "sign-always":
    case "+!":
      return {
        signDisplay: "always"
      };
    case "sign-accounting-always":
    case "()!":
      return {
        signDisplay: "always",
        currencySign: "accounting"
      };
    case "sign-except-zero":
    case "+?":
      return {
        signDisplay: "exceptZero"
      };
    case "sign-accounting-except-zero":
    case "()?":
      return {
        signDisplay: "exceptZero",
        currencySign: "accounting"
      };
    case "sign-never":
    case "+_":
      return {
        signDisplay: "never"
      };
  }
}
function parseConciseScientificAndEngineeringStem(t) {
  var e;
  if (t[0] === "E" && t[1] === "E" ? (e = {
    notation: "engineering"
  }, t = t.slice(2)) : t[0] === "E" && (e = {
    notation: "scientific"
  }, t = t.slice(1)), e) {
    var i = t.slice(0, 2);
    if (i === "+!" ? (e.signDisplay = "always", t = t.slice(2)) : i === "+?" && (e.signDisplay = "exceptZero", t = t.slice(2)), !CONCISE_INTEGER_WIDTH_REGEX.test(t))
      throw new Error("Malformed concise eng/scientific notation");
    e.minimumIntegerDigits = t.length;
  }
  return e;
}
function parseNotationOptions(t) {
  var e = {}, i = parseSign(t);
  return i || e;
}
function parseNumberSkeleton(t) {
  for (var e = {}, i = 0, n = t; i < n.length; i++) {
    var s = n[i];
    switch (s.stem) {
      case "percent":
      case "%":
        e.style = "percent";
        continue;
      case "%x100":
        e.style = "percent", e.scale = 100;
        continue;
      case "currency":
        e.style = "currency", e.currency = s.options[0];
        continue;
      case "group-off":
      case ",_":
        e.useGrouping = !1;
        continue;
      case "precision-integer":
      case ".":
        e.maximumFractionDigits = 0;
        continue;
      case "measure-unit":
      case "unit":
        e.style = "unit", e.unit = icuUnitToEcma(s.options[0]);
        continue;
      case "compact-short":
      case "K":
        e.notation = "compact", e.compactDisplay = "short";
        continue;
      case "compact-long":
      case "KK":
        e.notation = "compact", e.compactDisplay = "long";
        continue;
      case "scientific":
        e = __assign(__assign(__assign({}, e), { notation: "scientific" }), s.options.reduce(function(c, o) {
          return __assign(__assign({}, c), parseNotationOptions(o));
        }, {}));
        continue;
      case "engineering":
        e = __assign(__assign(__assign({}, e), { notation: "engineering" }), s.options.reduce(function(c, o) {
          return __assign(__assign({}, c), parseNotationOptions(o));
        }, {}));
        continue;
      case "notation-simple":
        e.notation = "standard";
        continue;
      case "unit-width-narrow":
        e.currencyDisplay = "narrowSymbol", e.unitDisplay = "narrow";
        continue;
      case "unit-width-short":
        e.currencyDisplay = "code", e.unitDisplay = "short";
        continue;
      case "unit-width-full-name":
        e.currencyDisplay = "name", e.unitDisplay = "long";
        continue;
      case "unit-width-iso-code":
        e.currencyDisplay = "symbol";
        continue;
      case "scale":
        e.scale = parseFloat(s.options[0]);
        continue;
      case "integer-width":
        if (s.options.length > 1)
          throw new RangeError("integer-width stems only accept a single optional option");
        s.options[0].replace(INTEGER_WIDTH_REGEX, function(c, o, r, T, S, w) {
          if (o)
            e.minimumIntegerDigits = r.length;
          else {
            if (T && S)
              throw new Error("We currently do not support maximum integer digits");
            if (w)
              throw new Error("We currently do not support exact integer digits");
          }
          return "";
        });
        continue;
    }
    if (CONCISE_INTEGER_WIDTH_REGEX.test(s.stem)) {
      e.minimumIntegerDigits = s.stem.length;
      continue;
    }
    if (FRACTION_PRECISION_REGEX.test(s.stem)) {
      if (s.options.length > 1)
        throw new RangeError("Fraction-precision stems only accept a single optional option");
      s.stem.replace(FRACTION_PRECISION_REGEX, function(c, o, r, T, S, w) {
        return r === "*" ? e.minimumFractionDigits = o.length : T && T[0] === "#" ? e.maximumFractionDigits = T.length : S && w ? (e.minimumFractionDigits = S.length, e.maximumFractionDigits = S.length + w.length) : (e.minimumFractionDigits = o.length, e.maximumFractionDigits = o.length), "";
      });
      var l = s.options[0];
      l === "w" ? e = __assign(__assign({}, e), { trailingZeroDisplay: "stripIfInteger" }) : l && (e = __assign(__assign({}, e), parseSignificantPrecision(l)));
      continue;
    }
    if (SIGNIFICANT_PRECISION_REGEX.test(s.stem)) {
      e = __assign(__assign({}, e), parseSignificantPrecision(s.stem));
      continue;
    }
    var h = parseSign(s.stem);
    h && (e = __assign(__assign({}, e), h));
    var _ = parseConciseScientificAndEngineeringStem(s.stem);
    _ && (e = __assign(__assign({}, e), _));
  }
  return e;
}
var timeData = {
  AX: [
    "H"
  ],
  BQ: [
    "H"
  ],
  CP: [
    "H"
  ],
  CZ: [
    "H"
  ],
  DK: [
    "H"
  ],
  FI: [
    "H"
  ],
  ID: [
    "H"
  ],
  IS: [
    "H"
  ],
  ML: [
    "H"
  ],
  NE: [
    "H"
  ],
  RU: [
    "H"
  ],
  SE: [
    "H"
  ],
  SJ: [
    "H"
  ],
  SK: [
    "H"
  ],
  AS: [
    "h",
    "H"
  ],
  BT: [
    "h",
    "H"
  ],
  DJ: [
    "h",
    "H"
  ],
  ER: [
    "h",
    "H"
  ],
  GH: [
    "h",
    "H"
  ],
  IN: [
    "h",
    "H"
  ],
  LS: [
    "h",
    "H"
  ],
  PG: [
    "h",
    "H"
  ],
  PW: [
    "h",
    "H"
  ],
  SO: [
    "h",
    "H"
  ],
  TO: [
    "h",
    "H"
  ],
  VU: [
    "h",
    "H"
  ],
  WS: [
    "h",
    "H"
  ],
  "001": [
    "H",
    "h"
  ],
  AL: [
    "h",
    "H",
    "hB"
  ],
  TD: [
    "h",
    "H",
    "hB"
  ],
  "ca-ES": [
    "H",
    "h",
    "hB"
  ],
  CF: [
    "H",
    "h",
    "hB"
  ],
  CM: [
    "H",
    "h",
    "hB"
  ],
  "fr-CA": [
    "H",
    "h",
    "hB"
  ],
  "gl-ES": [
    "H",
    "h",
    "hB"
  ],
  "it-CH": [
    "H",
    "h",
    "hB"
  ],
  "it-IT": [
    "H",
    "h",
    "hB"
  ],
  LU: [
    "H",
    "h",
    "hB"
  ],
  NP: [
    "H",
    "h",
    "hB"
  ],
  PF: [
    "H",
    "h",
    "hB"
  ],
  SC: [
    "H",
    "h",
    "hB"
  ],
  SM: [
    "H",
    "h",
    "hB"
  ],
  SN: [
    "H",
    "h",
    "hB"
  ],
  TF: [
    "H",
    "h",
    "hB"
  ],
  VA: [
    "H",
    "h",
    "hB"
  ],
  CY: [
    "h",
    "H",
    "hb",
    "hB"
  ],
  GR: [
    "h",
    "H",
    "hb",
    "hB"
  ],
  CO: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  DO: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  KP: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  KR: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  NA: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  PA: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  PR: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  VE: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  AC: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  AI: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  BW: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  BZ: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  CC: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  CK: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  CX: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  DG: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  FK: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  GB: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  GG: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  GI: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  IE: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  IM: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  IO: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  JE: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  LT: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  MK: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  MN: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  MS: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NF: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NG: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NR: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NU: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  PN: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  SH: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  SX: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  TA: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  ZA: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  "af-ZA": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  AR: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  CL: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  CR: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  CU: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  EA: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-BO": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-BR": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-EC": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-ES": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-GQ": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-PE": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  GT: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  HN: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  IC: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  KG: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  KM: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  LK: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  MA: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  MX: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  NI: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  PY: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  SV: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  UY: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  JP: [
    "H",
    "h",
    "K"
  ],
  AD: [
    "H",
    "hB"
  ],
  AM: [
    "H",
    "hB"
  ],
  AO: [
    "H",
    "hB"
  ],
  AT: [
    "H",
    "hB"
  ],
  AW: [
    "H",
    "hB"
  ],
  BE: [
    "H",
    "hB"
  ],
  BF: [
    "H",
    "hB"
  ],
  BJ: [
    "H",
    "hB"
  ],
  BL: [
    "H",
    "hB"
  ],
  BR: [
    "H",
    "hB"
  ],
  CG: [
    "H",
    "hB"
  ],
  CI: [
    "H",
    "hB"
  ],
  CV: [
    "H",
    "hB"
  ],
  DE: [
    "H",
    "hB"
  ],
  EE: [
    "H",
    "hB"
  ],
  FR: [
    "H",
    "hB"
  ],
  GA: [
    "H",
    "hB"
  ],
  GF: [
    "H",
    "hB"
  ],
  GN: [
    "H",
    "hB"
  ],
  GP: [
    "H",
    "hB"
  ],
  GW: [
    "H",
    "hB"
  ],
  HR: [
    "H",
    "hB"
  ],
  IL: [
    "H",
    "hB"
  ],
  IT: [
    "H",
    "hB"
  ],
  KZ: [
    "H",
    "hB"
  ],
  MC: [
    "H",
    "hB"
  ],
  MD: [
    "H",
    "hB"
  ],
  MF: [
    "H",
    "hB"
  ],
  MQ: [
    "H",
    "hB"
  ],
  MZ: [
    "H",
    "hB"
  ],
  NC: [
    "H",
    "hB"
  ],
  NL: [
    "H",
    "hB"
  ],
  PM: [
    "H",
    "hB"
  ],
  PT: [
    "H",
    "hB"
  ],
  RE: [
    "H",
    "hB"
  ],
  RO: [
    "H",
    "hB"
  ],
  SI: [
    "H",
    "hB"
  ],
  SR: [
    "H",
    "hB"
  ],
  ST: [
    "H",
    "hB"
  ],
  TG: [
    "H",
    "hB"
  ],
  TR: [
    "H",
    "hB"
  ],
  WF: [
    "H",
    "hB"
  ],
  YT: [
    "H",
    "hB"
  ],
  BD: [
    "h",
    "hB",
    "H"
  ],
  PK: [
    "h",
    "hB",
    "H"
  ],
  AZ: [
    "H",
    "hB",
    "h"
  ],
  BA: [
    "H",
    "hB",
    "h"
  ],
  BG: [
    "H",
    "hB",
    "h"
  ],
  CH: [
    "H",
    "hB",
    "h"
  ],
  GE: [
    "H",
    "hB",
    "h"
  ],
  LI: [
    "H",
    "hB",
    "h"
  ],
  ME: [
    "H",
    "hB",
    "h"
  ],
  RS: [
    "H",
    "hB",
    "h"
  ],
  UA: [
    "H",
    "hB",
    "h"
  ],
  UZ: [
    "H",
    "hB",
    "h"
  ],
  XK: [
    "H",
    "hB",
    "h"
  ],
  AG: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  AU: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BB: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BS: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  CA: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  DM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  "en-001": [
    "h",
    "hb",
    "H",
    "hB"
  ],
  FJ: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  FM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GD: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GU: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GY: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  JM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  KI: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  KN: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  KY: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  LC: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  LR: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  MH: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  MP: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  MW: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  NZ: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SB: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SG: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SL: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SS: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SZ: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  TC: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  TT: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  UM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  US: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  VC: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  VG: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  VI: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  ZM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BO: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  EC: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  ES: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  GQ: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  PE: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  AE: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  "ar-001": [
    "h",
    "hB",
    "hb",
    "H"
  ],
  BH: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  DZ: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  EG: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  EH: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  HK: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  IQ: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  JO: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  KW: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  LB: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  LY: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  MO: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  MR: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  OM: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  PH: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  PS: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  QA: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  SA: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  SD: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  SY: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  TN: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  YE: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  AF: [
    "H",
    "hb",
    "hB",
    "h"
  ],
  LA: [
    "H",
    "hb",
    "hB",
    "h"
  ],
  CN: [
    "H",
    "hB",
    "hb",
    "h"
  ],
  LV: [
    "H",
    "hB",
    "hb",
    "h"
  ],
  TL: [
    "H",
    "hB",
    "hb",
    "h"
  ],
  "zu-ZA": [
    "H",
    "hB",
    "hb",
    "h"
  ],
  CD: [
    "hB",
    "H"
  ],
  IR: [
    "hB",
    "H"
  ],
  "hi-IN": [
    "hB",
    "h",
    "H"
  ],
  "kn-IN": [
    "hB",
    "h",
    "H"
  ],
  "ml-IN": [
    "hB",
    "h",
    "H"
  ],
  "te-IN": [
    "hB",
    "h",
    "H"
  ],
  KH: [
    "hB",
    "h",
    "H",
    "hb"
  ],
  "ta-IN": [
    "hB",
    "h",
    "hb",
    "H"
  ],
  BN: [
    "hb",
    "hB",
    "h",
    "H"
  ],
  MY: [
    "hb",
    "hB",
    "h",
    "H"
  ],
  ET: [
    "hB",
    "hb",
    "h",
    "H"
  ],
  "gu-IN": [
    "hB",
    "hb",
    "h",
    "H"
  ],
  "mr-IN": [
    "hB",
    "hb",
    "h",
    "H"
  ],
  "pa-IN": [
    "hB",
    "hb",
    "h",
    "H"
  ],
  TW: [
    "hB",
    "hb",
    "h",
    "H"
  ],
  KE: [
    "hB",
    "hb",
    "H",
    "h"
  ],
  MM: [
    "hB",
    "hb",
    "H",
    "h"
  ],
  TZ: [
    "hB",
    "hb",
    "H",
    "h"
  ],
  UG: [
    "hB",
    "hb",
    "H",
    "h"
  ]
};
function getBestPattern(t, e) {
  for (var i = "", n = 0; n < t.length; n++) {
    var s = t.charAt(n);
    if (s === "j") {
      for (var l = 0; n + 1 < t.length && t.charAt(n + 1) === s; )
        l++, n++;
      var h = 1 + (l & 1), _ = l < 2 ? 1 : 3 + (l >> 1), c = "a", o = getDefaultHourSymbolFromLocale(e);
      for ((o == "H" || o == "k") && (_ = 0); _-- > 0; )
        i += c;
      for (; h-- > 0; )
        i = o + i;
    } else
      s === "J" ? i += "H" : i += s;
  }
  return i;
}
function getDefaultHourSymbolFromLocale(t) {
  var e = t.hourCycle;
  if (e === void 0 && // @ts-ignore hourCycle(s) is not identified yet
  t.hourCycles && // @ts-ignore
  t.hourCycles.length && (e = t.hourCycles[0]), e)
    switch (e) {
      case "h24":
        return "k";
      case "h23":
        return "H";
      case "h12":
        return "h";
      case "h11":
        return "K";
      default:
        throw new Error("Invalid hourCycle");
    }
  var i = t.language, n;
  i !== "root" && (n = t.maximize().region);
  var s = timeData[n || ""] || timeData[i || ""] || timeData["".concat(i, "-001")] || timeData["001"];
  return s[0];
}
var _a, SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*")), SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
function createLocation(t, e) {
  return { start: t, end: e };
}
var hasNativeStartsWith = !!String.prototype.startsWith, hasNativeFromCodePoint = !!String.fromCodePoint, hasNativeFromEntries = !!Object.fromEntries, hasNativeCodePointAt = !!String.prototype.codePointAt, hasTrimStart = !!String.prototype.trimStart, hasTrimEnd = !!String.prototype.trimEnd, hasNativeIsSafeInteger = !!Number.isSafeInteger, isSafeInteger = hasNativeIsSafeInteger ? Number.isSafeInteger : function(t) {
  return typeof t == "number" && isFinite(t) && Math.floor(t) === t && Math.abs(t) <= 9007199254740991;
}, REGEX_SUPPORTS_U_AND_Y = !0;
try {
  var re = RE("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
  REGEX_SUPPORTS_U_AND_Y = ((_a = re.exec("a")) === null || _a === void 0 ? void 0 : _a[0]) === "a";
} catch {
  REGEX_SUPPORTS_U_AND_Y = !1;
}
var startsWith = hasNativeStartsWith ? (
  // Native
  function(e, i, n) {
    return e.startsWith(i, n);
  }
) : (
  // For IE11
  function(e, i, n) {
    return e.slice(n, n + i.length) === i;
  }
), fromCodePoint = hasNativeFromCodePoint ? String.fromCodePoint : (
  // IE11
  function() {
    for (var e = [], i = 0; i < arguments.length; i++)
      e[i] = arguments[i];
    for (var n = "", s = e.length, l = 0, h; s > l; ) {
      if (h = e[l++], h > 1114111)
        throw RangeError(h + " is not a valid code point");
      n += h < 65536 ? String.fromCharCode(h) : String.fromCharCode(((h -= 65536) >> 10) + 55296, h % 1024 + 56320);
    }
    return n;
  }
), fromEntries = (
  // native
  hasNativeFromEntries ? Object.fromEntries : (
    // Ponyfill
    function(e) {
      for (var i = {}, n = 0, s = e; n < s.length; n++) {
        var l = s[n], h = l[0], _ = l[1];
        i[h] = _;
      }
      return i;
    }
  )
), codePointAt = hasNativeCodePointAt ? (
  // Native
  function(e, i) {
    return e.codePointAt(i);
  }
) : (
  // IE 11
  function(e, i) {
    var n = e.length;
    if (!(i < 0 || i >= n)) {
      var s = e.charCodeAt(i), l;
      return s < 55296 || s > 56319 || i + 1 === n || (l = e.charCodeAt(i + 1)) < 56320 || l > 57343 ? s : (s - 55296 << 10) + (l - 56320) + 65536;
    }
  }
), trimStart = hasTrimStart ? (
  // Native
  function(e) {
    return e.trimStart();
  }
) : (
  // Ponyfill
  function(e) {
    return e.replace(SPACE_SEPARATOR_START_REGEX, "");
  }
), trimEnd = hasTrimEnd ? (
  // Native
  function(e) {
    return e.trimEnd();
  }
) : (
  // Ponyfill
  function(e) {
    return e.replace(SPACE_SEPARATOR_END_REGEX, "");
  }
);
function RE(t, e) {
  return new RegExp(t, e);
}
var matchIdentifierAtIndex;
if (REGEX_SUPPORTS_U_AND_Y) {
  var IDENTIFIER_PREFIX_RE_1 = RE("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
  matchIdentifierAtIndex = function(e, i) {
    var n;
    IDENTIFIER_PREFIX_RE_1.lastIndex = i;
    var s = IDENTIFIER_PREFIX_RE_1.exec(e);
    return (n = s[1]) !== null && n !== void 0 ? n : "";
  };
} else
  matchIdentifierAtIndex = function(e, i) {
    for (var n = []; ; ) {
      var s = codePointAt(e, i);
      if (s === void 0 || _isWhiteSpace(s) || _isPatternSyntax(s))
        break;
      n.push(s), i += s >= 65536 ? 2 : 1;
    }
    return fromCodePoint.apply(void 0, n);
  };
var Parser = (
  /** @class */
  function() {
    function t(e, i) {
      i === void 0 && (i = {}), this.message = e, this.position = { offset: 0, line: 1, column: 1 }, this.ignoreTag = !!i.ignoreTag, this.locale = i.locale, this.requiresOtherClause = !!i.requiresOtherClause, this.shouldParseSkeletons = !!i.shouldParseSkeletons;
    }
    return t.prototype.parse = function() {
      if (this.offset() !== 0)
        throw Error("parser can only be used once");
      return this.parseMessage(0, "", !1);
    }, t.prototype.parseMessage = function(e, i, n) {
      for (var s = []; !this.isEOF(); ) {
        var l = this.char();
        if (l === 123) {
          var h = this.parseArgument(e, n);
          if (h.err)
            return h;
          s.push(h.val);
        } else {
          if (l === 125 && e > 0)
            break;
          if (l === 35 && (i === "plural" || i === "selectordinal")) {
            var _ = this.clonePosition();
            this.bump(), s.push({
              type: TYPE.pound,
              location: createLocation(_, this.clonePosition())
            });
          } else if (l === 60 && !this.ignoreTag && this.peek() === 47) {
            if (n)
              break;
            return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));
          } else if (l === 60 && !this.ignoreTag && _isAlpha(this.peek() || 0)) {
            var h = this.parseTag(e, i);
            if (h.err)
              return h;
            s.push(h.val);
          } else {
            var h = this.parseLiteral(e, i);
            if (h.err)
              return h;
            s.push(h.val);
          }
        }
      }
      return { val: s, err: null };
    }, t.prototype.parseTag = function(e, i) {
      var n = this.clonePosition();
      this.bump();
      var s = this.parseTagName();
      if (this.bumpSpace(), this.bumpIf("/>"))
        return {
          val: {
            type: TYPE.literal,
            value: "<".concat(s, "/>"),
            location: createLocation(n, this.clonePosition())
          },
          err: null
        };
      if (this.bumpIf(">")) {
        var l = this.parseMessage(e + 1, i, !0);
        if (l.err)
          return l;
        var h = l.val, _ = this.clonePosition();
        if (this.bumpIf("</")) {
          if (this.isEOF() || !_isAlpha(this.char()))
            return this.error(ErrorKind.INVALID_TAG, createLocation(_, this.clonePosition()));
          var c = this.clonePosition(), o = this.parseTagName();
          return s !== o ? this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(c, this.clonePosition())) : (this.bumpSpace(), this.bumpIf(">") ? {
            val: {
              type: TYPE.tag,
              value: s,
              children: h,
              location: createLocation(n, this.clonePosition())
            },
            err: null
          } : this.error(ErrorKind.INVALID_TAG, createLocation(_, this.clonePosition())));
        } else
          return this.error(ErrorKind.UNCLOSED_TAG, createLocation(n, this.clonePosition()));
      } else
        return this.error(ErrorKind.INVALID_TAG, createLocation(n, this.clonePosition()));
    }, t.prototype.parseTagName = function() {
      var e = this.offset();
      for (this.bump(); !this.isEOF() && _isPotentialElementNameChar(this.char()); )
        this.bump();
      return this.message.slice(e, this.offset());
    }, t.prototype.parseLiteral = function(e, i) {
      for (var n = this.clonePosition(), s = ""; ; ) {
        var l = this.tryParseQuote(i);
        if (l) {
          s += l;
          continue;
        }
        var h = this.tryParseUnquoted(e, i);
        if (h) {
          s += h;
          continue;
        }
        var _ = this.tryParseLeftAngleBracket();
        if (_) {
          s += _;
          continue;
        }
        break;
      }
      var c = createLocation(n, this.clonePosition());
      return {
        val: { type: TYPE.literal, value: s, location: c },
        err: null
      };
    }, t.prototype.tryParseLeftAngleBracket = function() {
      return !this.isEOF() && this.char() === 60 && (this.ignoreTag || // If at the opening tag or closing tag position, bail.
      !_isAlphaOrSlash(this.peek() || 0)) ? (this.bump(), "<") : null;
    }, t.prototype.tryParseQuote = function(e) {
      if (this.isEOF() || this.char() !== 39)
        return null;
      switch (this.peek()) {
        case 39:
          return this.bump(), this.bump(), "'";
        case 123:
        case 60:
        case 62:
        case 125:
          break;
        case 35:
          if (e === "plural" || e === "selectordinal")
            break;
          return null;
        default:
          return null;
      }
      this.bump();
      var i = [this.char()];
      for (this.bump(); !this.isEOF(); ) {
        var n = this.char();
        if (n === 39)
          if (this.peek() === 39)
            i.push(39), this.bump();
          else {
            this.bump();
            break;
          }
        else
          i.push(n);
        this.bump();
      }
      return fromCodePoint.apply(void 0, i);
    }, t.prototype.tryParseUnquoted = function(e, i) {
      if (this.isEOF())
        return null;
      var n = this.char();
      return n === 60 || n === 123 || n === 35 && (i === "plural" || i === "selectordinal") || n === 125 && e > 0 ? null : (this.bump(), fromCodePoint(n));
    }, t.prototype.parseArgument = function(e, i) {
      var n = this.clonePosition();
      if (this.bump(), this.bumpSpace(), this.isEOF())
        return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(n, this.clonePosition()));
      if (this.char() === 125)
        return this.bump(), this.error(ErrorKind.EMPTY_ARGUMENT, createLocation(n, this.clonePosition()));
      var s = this.parseIdentifierIfPossible().value;
      if (!s)
        return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(n, this.clonePosition()));
      if (this.bumpSpace(), this.isEOF())
        return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(n, this.clonePosition()));
      switch (this.char()) {
        case 125:
          return this.bump(), {
            val: {
              type: TYPE.argument,
              // value does not include the opening and closing braces.
              value: s,
              location: createLocation(n, this.clonePosition())
            },
            err: null
          };
        case 44:
          return this.bump(), this.bumpSpace(), this.isEOF() ? this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(n, this.clonePosition())) : this.parseArgumentOptions(e, i, s, n);
        default:
          return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(n, this.clonePosition()));
      }
    }, t.prototype.parseIdentifierIfPossible = function() {
      var e = this.clonePosition(), i = this.offset(), n = matchIdentifierAtIndex(this.message, i), s = i + n.length;
      this.bumpTo(s);
      var l = this.clonePosition(), h = createLocation(e, l);
      return { value: n, location: h };
    }, t.prototype.parseArgumentOptions = function(e, i, n, s) {
      var l, h = this.clonePosition(), _ = this.parseIdentifierIfPossible().value, c = this.clonePosition();
      switch (_) {
        case "":
          return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(h, c));
        case "number":
        case "date":
        case "time": {
          this.bumpSpace();
          var o = null;
          if (this.bumpIf(",")) {
            this.bumpSpace();
            var r = this.clonePosition(), T = this.parseSimpleArgStyleIfPossible();
            if (T.err)
              return T;
            var S = trimEnd(T.val);
            if (S.length === 0)
              return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));
            var w = createLocation(r, this.clonePosition());
            o = { style: S, styleLocation: w };
          }
          var C = this.tryParseArgumentClose(s);
          if (C.err)
            return C;
          var P = createLocation(s, this.clonePosition());
          if (o && startsWith(o == null ? void 0 : o.style, "::", 0)) {
            var b = trimStart(o.style.slice(2));
            if (_ === "number") {
              var T = this.parseNumberSkeletonFromString(b, o.styleLocation);
              return T.err ? T : {
                val: { type: TYPE.number, value: n, location: P, style: T.val },
                err: null
              };
            } else {
              if (b.length === 0)
                return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, P);
              var k = b;
              this.locale && (k = getBestPattern(b, this.locale));
              var S = {
                type: SKELETON_TYPE.dateTime,
                pattern: k,
                location: o.styleLocation,
                parsedOptions: this.shouldParseSkeletons ? parseDateTimeSkeleton(k) : {}
              }, F = _ === "date" ? TYPE.date : TYPE.time;
              return {
                val: { type: F, value: n, location: P, style: S },
                err: null
              };
            }
          }
          return {
            val: {
              type: _ === "number" ? TYPE.number : _ === "date" ? TYPE.date : TYPE.time,
              value: n,
              location: P,
              style: (l = o == null ? void 0 : o.style) !== null && l !== void 0 ? l : null
            },
            err: null
          };
        }
        case "plural":
        case "selectordinal":
        case "select": {
          var x = this.clonePosition();
          if (this.bumpSpace(), !this.bumpIf(","))
            return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(x, __assign({}, x)));
          this.bumpSpace();
          var y = this.parseIdentifierIfPossible(), p = 0;
          if (_ !== "select" && y.value === "offset") {
            if (!this.bumpIf(":"))
              return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));
            this.bumpSpace();
            var T = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
            if (T.err)
              return T;
            this.bumpSpace(), y = this.parseIdentifierIfPossible(), p = T.val;
          }
          var E = this.tryParsePluralOrSelectOptions(e, _, i, y);
          if (E.err)
            return E;
          var C = this.tryParseArgumentClose(s);
          if (C.err)
            return C;
          var $ = createLocation(s, this.clonePosition());
          return _ === "select" ? {
            val: {
              type: TYPE.select,
              value: n,
              options: fromEntries(E.val),
              location: $
            },
            err: null
          } : {
            val: {
              type: TYPE.plural,
              value: n,
              options: fromEntries(E.val),
              offset: p,
              pluralType: _ === "plural" ? "cardinal" : "ordinal",
              location: $
            },
            err: null
          };
        }
        default:
          return this.error(ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(h, c));
      }
    }, t.prototype.tryParseArgumentClose = function(e) {
      return this.isEOF() || this.char() !== 125 ? this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(e, this.clonePosition())) : (this.bump(), { val: !0, err: null });
    }, t.prototype.parseSimpleArgStyleIfPossible = function() {
      for (var e = 0, i = this.clonePosition(); !this.isEOF(); ) {
        var n = this.char();
        switch (n) {
          case 39: {
            this.bump();
            var s = this.clonePosition();
            if (!this.bumpUntil("'"))
              return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(s, this.clonePosition()));
            this.bump();
            break;
          }
          case 123: {
            e += 1, this.bump();
            break;
          }
          case 125: {
            if (e > 0)
              e -= 1;
            else
              return {
                val: this.message.slice(i.offset, this.offset()),
                err: null
              };
            break;
          }
          default:
            this.bump();
            break;
        }
      }
      return {
        val: this.message.slice(i.offset, this.offset()),
        err: null
      };
    }, t.prototype.parseNumberSkeletonFromString = function(e, i) {
      var n = [];
      try {
        n = parseNumberSkeletonFromString(e);
      } catch {
        return this.error(ErrorKind.INVALID_NUMBER_SKELETON, i);
      }
      return {
        val: {
          type: SKELETON_TYPE.number,
          tokens: n,
          location: i,
          parsedOptions: this.shouldParseSkeletons ? parseNumberSkeleton(n) : {}
        },
        err: null
      };
    }, t.prototype.tryParsePluralOrSelectOptions = function(e, i, n, s) {
      for (var l, h = !1, _ = [], c = /* @__PURE__ */ new Set(), o = s.value, r = s.location; ; ) {
        if (o.length === 0) {
          var T = this.clonePosition();
          if (i !== "select" && this.bumpIf("=")) {
            var S = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);
            if (S.err)
              return S;
            r = createLocation(T, this.clonePosition()), o = this.message.slice(T.offset, this.offset());
          } else
            break;
        }
        if (c.has(o))
          return this.error(i === "select" ? ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR : ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, r);
        o === "other" && (h = !0), this.bumpSpace();
        var w = this.clonePosition();
        if (!this.bumpIf("{"))
          return this.error(i === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition()));
        var C = this.parseMessage(e + 1, i, n);
        if (C.err)
          return C;
        var P = this.tryParseArgumentClose(w);
        if (P.err)
          return P;
        _.push([
          o,
          {
            value: C.val,
            location: createLocation(w, this.clonePosition())
          }
        ]), c.add(o), this.bumpSpace(), l = this.parseIdentifierIfPossible(), o = l.value, r = l.location;
      }
      return _.length === 0 ? this.error(i === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition())) : this.requiresOtherClause && !h ? this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition())) : { val: _, err: null };
    }, t.prototype.tryParseDecimalInteger = function(e, i) {
      var n = 1, s = this.clonePosition();
      this.bumpIf("+") || this.bumpIf("-") && (n = -1);
      for (var l = !1, h = 0; !this.isEOF(); ) {
        var _ = this.char();
        if (_ >= 48 && _ <= 57)
          l = !0, h = h * 10 + (_ - 48), this.bump();
        else
          break;
      }
      var c = createLocation(s, this.clonePosition());
      return l ? (h *= n, isSafeInteger(h) ? { val: h, err: null } : this.error(i, c)) : this.error(e, c);
    }, t.prototype.offset = function() {
      return this.position.offset;
    }, t.prototype.isEOF = function() {
      return this.offset() === this.message.length;
    }, t.prototype.clonePosition = function() {
      return {
        offset: this.position.offset,
        line: this.position.line,
        column: this.position.column
      };
    }, t.prototype.char = function() {
      var e = this.position.offset;
      if (e >= this.message.length)
        throw Error("out of bound");
      var i = codePointAt(this.message, e);
      if (i === void 0)
        throw Error("Offset ".concat(e, " is at invalid UTF-16 code unit boundary"));
      return i;
    }, t.prototype.error = function(e, i) {
      return {
        val: null,
        err: {
          kind: e,
          message: this.message,
          location: i
        }
      };
    }, t.prototype.bump = function() {
      if (!this.isEOF()) {
        var e = this.char();
        e === 10 ? (this.position.line += 1, this.position.column = 1, this.position.offset += 1) : (this.position.column += 1, this.position.offset += e < 65536 ? 1 : 2);
      }
    }, t.prototype.bumpIf = function(e) {
      if (startsWith(this.message, e, this.offset())) {
        for (var i = 0; i < e.length; i++)
          this.bump();
        return !0;
      }
      return !1;
    }, t.prototype.bumpUntil = function(e) {
      var i = this.offset(), n = this.message.indexOf(e, i);
      return n >= 0 ? (this.bumpTo(n), !0) : (this.bumpTo(this.message.length), !1);
    }, t.prototype.bumpTo = function(e) {
      if (this.offset() > e)
        throw Error("targetOffset ".concat(e, " must be greater than or equal to the current offset ").concat(this.offset()));
      for (e = Math.min(e, this.message.length); ; ) {
        var i = this.offset();
        if (i === e)
          break;
        if (i > e)
          throw Error("targetOffset ".concat(e, " is at invalid UTF-16 code unit boundary"));
        if (this.bump(), this.isEOF())
          break;
      }
    }, t.prototype.bumpSpace = function() {
      for (; !this.isEOF() && _isWhiteSpace(this.char()); )
        this.bump();
    }, t.prototype.peek = function() {
      if (this.isEOF())
        return null;
      var e = this.char(), i = this.offset(), n = this.message.charCodeAt(i + (e >= 65536 ? 2 : 1));
      return n ?? null;
    }, t;
  }()
);
function _isAlpha(t) {
  return t >= 97 && t <= 122 || t >= 65 && t <= 90;
}
function _isAlphaOrSlash(t) {
  return _isAlpha(t) || t === 47;
}
function _isPotentialElementNameChar(t) {
  return t === 45 || t === 46 || t >= 48 && t <= 57 || t === 95 || t >= 97 && t <= 122 || t >= 65 && t <= 90 || t == 183 || t >= 192 && t <= 214 || t >= 216 && t <= 246 || t >= 248 && t <= 893 || t >= 895 && t <= 8191 || t >= 8204 && t <= 8205 || t >= 8255 && t <= 8256 || t >= 8304 && t <= 8591 || t >= 11264 && t <= 12271 || t >= 12289 && t <= 55295 || t >= 63744 && t <= 64975 || t >= 65008 && t <= 65533 || t >= 65536 && t <= 983039;
}
function _isWhiteSpace(t) {
  return t >= 9 && t <= 13 || t === 32 || t === 133 || t >= 8206 && t <= 8207 || t === 8232 || t === 8233;
}
function _isPatternSyntax(t) {
  return t >= 33 && t <= 35 || t === 36 || t >= 37 && t <= 39 || t === 40 || t === 41 || t === 42 || t === 43 || t === 44 || t === 45 || t >= 46 && t <= 47 || t >= 58 && t <= 59 || t >= 60 && t <= 62 || t >= 63 && t <= 64 || t === 91 || t === 92 || t === 93 || t === 94 || t === 96 || t === 123 || t === 124 || t === 125 || t === 126 || t === 161 || t >= 162 && t <= 165 || t === 166 || t === 167 || t === 169 || t === 171 || t === 172 || t === 174 || t === 176 || t === 177 || t === 182 || t === 187 || t === 191 || t === 215 || t === 247 || t >= 8208 && t <= 8213 || t >= 8214 && t <= 8215 || t === 8216 || t === 8217 || t === 8218 || t >= 8219 && t <= 8220 || t === 8221 || t === 8222 || t === 8223 || t >= 8224 && t <= 8231 || t >= 8240 && t <= 8248 || t === 8249 || t === 8250 || t >= 8251 && t <= 8254 || t >= 8257 && t <= 8259 || t === 8260 || t === 8261 || t === 8262 || t >= 8263 && t <= 8273 || t === 8274 || t === 8275 || t >= 8277 && t <= 8286 || t >= 8592 && t <= 8596 || t >= 8597 && t <= 8601 || t >= 8602 && t <= 8603 || t >= 8604 && t <= 8607 || t === 8608 || t >= 8609 && t <= 8610 || t === 8611 || t >= 8612 && t <= 8613 || t === 8614 || t >= 8615 && t <= 8621 || t === 8622 || t >= 8623 && t <= 8653 || t >= 8654 && t <= 8655 || t >= 8656 && t <= 8657 || t === 8658 || t === 8659 || t === 8660 || t >= 8661 && t <= 8691 || t >= 8692 && t <= 8959 || t >= 8960 && t <= 8967 || t === 8968 || t === 8969 || t === 8970 || t === 8971 || t >= 8972 && t <= 8991 || t >= 8992 && t <= 8993 || t >= 8994 && t <= 9e3 || t === 9001 || t === 9002 || t >= 9003 && t <= 9083 || t === 9084 || t >= 9085 && t <= 9114 || t >= 9115 && t <= 9139 || t >= 9140 && t <= 9179 || t >= 9180 && t <= 9185 || t >= 9186 && t <= 9254 || t >= 9255 && t <= 9279 || t >= 9280 && t <= 9290 || t >= 9291 && t <= 9311 || t >= 9472 && t <= 9654 || t === 9655 || t >= 9656 && t <= 9664 || t === 9665 || t >= 9666 && t <= 9719 || t >= 9720 && t <= 9727 || t >= 9728 && t <= 9838 || t === 9839 || t >= 9840 && t <= 10087 || t === 10088 || t === 10089 || t === 10090 || t === 10091 || t === 10092 || t === 10093 || t === 10094 || t === 10095 || t === 10096 || t === 10097 || t === 10098 || t === 10099 || t === 10100 || t === 10101 || t >= 10132 && t <= 10175 || t >= 10176 && t <= 10180 || t === 10181 || t === 10182 || t >= 10183 && t <= 10213 || t === 10214 || t === 10215 || t === 10216 || t === 10217 || t === 10218 || t === 10219 || t === 10220 || t === 10221 || t === 10222 || t === 10223 || t >= 10224 && t <= 10239 || t >= 10240 && t <= 10495 || t >= 10496 && t <= 10626 || t === 10627 || t === 10628 || t === 10629 || t === 10630 || t === 10631 || t === 10632 || t === 10633 || t === 10634 || t === 10635 || t === 10636 || t === 10637 || t === 10638 || t === 10639 || t === 10640 || t === 10641 || t === 10642 || t === 10643 || t === 10644 || t === 10645 || t === 10646 || t === 10647 || t === 10648 || t >= 10649 && t <= 10711 || t === 10712 || t === 10713 || t === 10714 || t === 10715 || t >= 10716 && t <= 10747 || t === 10748 || t === 10749 || t >= 10750 && t <= 11007 || t >= 11008 && t <= 11055 || t >= 11056 && t <= 11076 || t >= 11077 && t <= 11078 || t >= 11079 && t <= 11084 || t >= 11085 && t <= 11123 || t >= 11124 && t <= 11125 || t >= 11126 && t <= 11157 || t === 11158 || t >= 11159 && t <= 11263 || t >= 11776 && t <= 11777 || t === 11778 || t === 11779 || t === 11780 || t === 11781 || t >= 11782 && t <= 11784 || t === 11785 || t === 11786 || t === 11787 || t === 11788 || t === 11789 || t >= 11790 && t <= 11798 || t === 11799 || t >= 11800 && t <= 11801 || t === 11802 || t === 11803 || t === 11804 || t === 11805 || t >= 11806 && t <= 11807 || t === 11808 || t === 11809 || t === 11810 || t === 11811 || t === 11812 || t === 11813 || t === 11814 || t === 11815 || t === 11816 || t === 11817 || t >= 11818 && t <= 11822 || t === 11823 || t >= 11824 && t <= 11833 || t >= 11834 && t <= 11835 || t >= 11836 && t <= 11839 || t === 11840 || t === 11841 || t === 11842 || t >= 11843 && t <= 11855 || t >= 11856 && t <= 11857 || t === 11858 || t >= 11859 && t <= 11903 || t >= 12289 && t <= 12291 || t === 12296 || t === 12297 || t === 12298 || t === 12299 || t === 12300 || t === 12301 || t === 12302 || t === 12303 || t === 12304 || t === 12305 || t >= 12306 && t <= 12307 || t === 12308 || t === 12309 || t === 12310 || t === 12311 || t === 12312 || t === 12313 || t === 12314 || t === 12315 || t === 12316 || t === 12317 || t >= 12318 && t <= 12319 || t === 12320 || t === 12336 || t === 64830 || t === 64831 || t >= 65093 && t <= 65094;
}
function pruneLocation(t) {
  t.forEach(function(e) {
    if (delete e.location, isSelectElement(e) || isPluralElement(e))
      for (var i in e.options)
        delete e.options[i].location, pruneLocation(e.options[i].value);
    else
      isNumberElement(e) && isNumberSkeleton(e.style) || (isDateElement(e) || isTimeElement(e)) && isDateTimeSkeleton(e.style) ? delete e.style.location : isTagElement(e) && pruneLocation(e.children);
  });
}
function parse(t, e) {
  e === void 0 && (e = {}), e = __assign({ shouldParseSkeletons: !0, requiresOtherClause: !0 }, e);
  var i = new Parser(t, e).parse();
  if (i.err) {
    var n = SyntaxError(ErrorKind[i.err.kind]);
    throw n.location = i.err.location, n.originalMessage = i.err.message, n;
  }
  return e != null && e.captureLocation || pruneLocation(i.val), i.val;
}
function memoize(t, e) {
  var i = e && e.cache ? e.cache : cacheDefault, n = e && e.serializer ? e.serializer : serializerDefault, s = e && e.strategy ? e.strategy : strategyDefault;
  return s(t, {
    cache: i,
    serializer: n
  });
}
function isPrimitive(t) {
  return t == null || typeof t == "number" || typeof t == "boolean";
}
function monadic(t, e, i, n) {
  var s = isPrimitive(n) ? n : i(n), l = e.get(s);
  return typeof l > "u" && (l = t.call(this, n), e.set(s, l)), l;
}
function variadic(t, e, i) {
  var n = Array.prototype.slice.call(arguments, 3), s = i(n), l = e.get(s);
  return typeof l > "u" && (l = t.apply(this, n), e.set(s, l)), l;
}
function assemble(t, e, i, n, s) {
  return i.bind(e, t, n, s);
}
function strategyDefault(t, e) {
  var i = t.length === 1 ? monadic : variadic;
  return assemble(t, this, i, e.cache.create(), e.serializer);
}
function strategyVariadic(t, e) {
  return assemble(t, this, variadic, e.cache.create(), e.serializer);
}
function strategyMonadic(t, e) {
  return assemble(t, this, monadic, e.cache.create(), e.serializer);
}
var serializerDefault = function() {
  return JSON.stringify(arguments);
};
function ObjectWithoutPrototypeCache() {
  this.cache = /* @__PURE__ */ Object.create(null);
}
ObjectWithoutPrototypeCache.prototype.get = function(t) {
  return this.cache[t];
};
ObjectWithoutPrototypeCache.prototype.set = function(t, e) {
  this.cache[t] = e;
};
var cacheDefault = {
  create: function() {
    return new ObjectWithoutPrototypeCache();
  }
}, strategies = {
  variadic: strategyVariadic,
  monadic: strategyMonadic
}, ErrorCode;
(function(t) {
  t.MISSING_VALUE = "MISSING_VALUE", t.INVALID_VALUE = "INVALID_VALUE", t.MISSING_INTL_API = "MISSING_INTL_API";
})(ErrorCode || (ErrorCode = {}));
var FormatError = (
  /** @class */
  function(t) {
    __extends(e, t);
    function e(i, n, s) {
      var l = t.call(this, i) || this;
      return l.code = n, l.originalMessage = s, l;
    }
    return e.prototype.toString = function() {
      return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
    }, e;
  }(Error)
), InvalidValueError = (
  /** @class */
  function(t) {
    __extends(e, t);
    function e(i, n, s, l) {
      return t.call(this, 'Invalid values for "'.concat(i, '": "').concat(n, '". Options are "').concat(Object.keys(s).join('", "'), '"'), ErrorCode.INVALID_VALUE, l) || this;
    }
    return e;
  }(FormatError)
), InvalidValueTypeError = (
  /** @class */
  function(t) {
    __extends(e, t);
    function e(i, n, s) {
      return t.call(this, 'Value for "'.concat(i, '" must be of type ').concat(n), ErrorCode.INVALID_VALUE, s) || this;
    }
    return e;
  }(FormatError)
), MissingValueError = (
  /** @class */
  function(t) {
    __extends(e, t);
    function e(i, n) {
      return t.call(this, 'The intl string context variable "'.concat(i, '" was not provided to the string "').concat(n, '"'), ErrorCode.MISSING_VALUE, n) || this;
    }
    return e;
  }(FormatError)
), PART_TYPE;
(function(t) {
  t[t.literal = 0] = "literal", t[t.object = 1] = "object";
})(PART_TYPE || (PART_TYPE = {}));
function mergeLiteral(t) {
  return t.length < 2 ? t : t.reduce(function(e, i) {
    var n = e[e.length - 1];
    return !n || n.type !== PART_TYPE.literal || i.type !== PART_TYPE.literal ? e.push(i) : n.value += i.value, e;
  }, []);
}
function isFormatXMLElementFn(t) {
  return typeof t == "function";
}
function formatToParts(t, e, i, n, s, l, h) {
  if (t.length === 1 && isLiteralElement(t[0]))
    return [
      {
        type: PART_TYPE.literal,
        value: t[0].value
      }
    ];
  for (var _ = [], c = 0, o = t; c < o.length; c++) {
    var r = o[c];
    if (isLiteralElement(r)) {
      _.push({
        type: PART_TYPE.literal,
        value: r.value
      });
      continue;
    }
    if (isPoundElement(r)) {
      typeof l == "number" && _.push({
        type: PART_TYPE.literal,
        value: i.getNumberFormat(e).format(l)
      });
      continue;
    }
    var T = r.value;
    if (!(s && T in s))
      throw new MissingValueError(T, h);
    var S = s[T];
    if (isArgumentElement(r)) {
      (!S || typeof S == "string" || typeof S == "number") && (S = typeof S == "string" || typeof S == "number" ? String(S) : ""), _.push({
        type: typeof S == "string" ? PART_TYPE.literal : PART_TYPE.object,
        value: S
      });
      continue;
    }
    if (isDateElement(r)) {
      var w = typeof r.style == "string" ? n.date[r.style] : isDateTimeSkeleton(r.style) ? r.style.parsedOptions : void 0;
      _.push({
        type: PART_TYPE.literal,
        value: i.getDateTimeFormat(e, w).format(S)
      });
      continue;
    }
    if (isTimeElement(r)) {
      var w = typeof r.style == "string" ? n.time[r.style] : isDateTimeSkeleton(r.style) ? r.style.parsedOptions : n.time.medium;
      _.push({
        type: PART_TYPE.literal,
        value: i.getDateTimeFormat(e, w).format(S)
      });
      continue;
    }
    if (isNumberElement(r)) {
      var w = typeof r.style == "string" ? n.number[r.style] : isNumberSkeleton(r.style) ? r.style.parsedOptions : void 0;
      w && w.scale && (S = S * (w.scale || 1)), _.push({
        type: PART_TYPE.literal,
        value: i.getNumberFormat(e, w).format(S)
      });
      continue;
    }
    if (isTagElement(r)) {
      var C = r.children, P = r.value, b = s[P];
      if (!isFormatXMLElementFn(b))
        throw new InvalidValueTypeError(P, "function", h);
      var k = formatToParts(C, e, i, n, s, l), F = b(k.map(function(p) {
        return p.value;
      }));
      Array.isArray(F) || (F = [F]), _.push.apply(_, F.map(function(p) {
        return {
          type: typeof p == "string" ? PART_TYPE.literal : PART_TYPE.object,
          value: p
        };
      }));
    }
    if (isSelectElement(r)) {
      var x = r.options[S] || r.options.other;
      if (!x)
        throw new InvalidValueError(r.value, S, Object.keys(r.options), h);
      _.push.apply(_, formatToParts(x.value, e, i, n, s));
      continue;
    }
    if (isPluralElement(r)) {
      var x = r.options["=".concat(S)];
      if (!x) {
        if (!Intl.PluralRules)
          throw new FormatError(`Intl.PluralRules is not available in this environment.
Try polyfilling it using "@formatjs/intl-pluralrules"
`, ErrorCode.MISSING_INTL_API, h);
        var y = i.getPluralRules(e, { type: r.pluralType }).select(S - (r.offset || 0));
        x = r.options[y] || r.options.other;
      }
      if (!x)
        throw new InvalidValueError(r.value, S, Object.keys(r.options), h);
      _.push.apply(_, formatToParts(x.value, e, i, n, s, S - (r.offset || 0)));
      continue;
    }
  }
  return mergeLiteral(_);
}
function mergeConfig(t, e) {
  return e ? __assign(__assign(__assign({}, t || {}), e || {}), Object.keys(t).reduce(function(i, n) {
    return i[n] = __assign(__assign({}, t[n]), e[n] || {}), i;
  }, {})) : t;
}
function mergeConfigs(t, e) {
  return e ? Object.keys(t).reduce(function(i, n) {
    return i[n] = mergeConfig(t[n], e[n]), i;
  }, __assign({}, t)) : t;
}
function createFastMemoizeCache(t) {
  return {
    create: function() {
      return {
        get: function(e) {
          return t[e];
        },
        set: function(e, i) {
          t[e] = i;
        }
      };
    }
  };
}
function createDefaultFormatters(t) {
  return t === void 0 && (t = {
    number: {},
    dateTime: {},
    pluralRules: {}
  }), {
    getNumberFormat: memoize(function() {
      for (var e, i = [], n = 0; n < arguments.length; n++)
        i[n] = arguments[n];
      return new ((e = Intl.NumberFormat).bind.apply(e, __spreadArray([void 0], i, !1)))();
    }, {
      cache: createFastMemoizeCache(t.number),
      strategy: strategies.variadic
    }),
    getDateTimeFormat: memoize(function() {
      for (var e, i = [], n = 0; n < arguments.length; n++)
        i[n] = arguments[n];
      return new ((e = Intl.DateTimeFormat).bind.apply(e, __spreadArray([void 0], i, !1)))();
    }, {
      cache: createFastMemoizeCache(t.dateTime),
      strategy: strategies.variadic
    }),
    getPluralRules: memoize(function() {
      for (var e, i = [], n = 0; n < arguments.length; n++)
        i[n] = arguments[n];
      return new ((e = Intl.PluralRules).bind.apply(e, __spreadArray([void 0], i, !1)))();
    }, {
      cache: createFastMemoizeCache(t.pluralRules),
      strategy: strategies.variadic
    })
  };
}
var IntlMessageFormat = (
  /** @class */
  function() {
    function t(e, i, n, s) {
      var l = this;
      if (i === void 0 && (i = t.defaultLocale), this.formatterCache = {
        number: {},
        dateTime: {},
        pluralRules: {}
      }, this.format = function(h) {
        var _ = l.formatToParts(h);
        if (_.length === 1)
          return _[0].value;
        var c = _.reduce(function(o, r) {
          return !o.length || r.type !== PART_TYPE.literal || typeof o[o.length - 1] != "string" ? o.push(r.value) : o[o.length - 1] += r.value, o;
        }, []);
        return c.length <= 1 ? c[0] || "" : c;
      }, this.formatToParts = function(h) {
        return formatToParts(l.ast, l.locales, l.formatters, l.formats, h, void 0, l.message);
      }, this.resolvedOptions = function() {
        return {
          locale: l.resolvedLocale.toString()
        };
      }, this.getAst = function() {
        return l.ast;
      }, this.locales = i, this.resolvedLocale = t.resolveLocale(i), typeof e == "string") {
        if (this.message = e, !t.__parse)
          throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");
        this.ast = t.__parse(e, {
          ignoreTag: s == null ? void 0 : s.ignoreTag,
          locale: this.resolvedLocale
        });
      } else
        this.ast = e;
      if (!Array.isArray(this.ast))
        throw new TypeError("A message must be provided as a String or AST.");
      this.formats = mergeConfigs(t.formats, n), this.formatters = s && s.formatters || createDefaultFormatters(this.formatterCache);
    }
    return Object.defineProperty(t, "defaultLocale", {
      get: function() {
        return t.memoizedDefaultLocale || (t.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale), t.memoizedDefaultLocale;
      },
      enumerable: !1,
      configurable: !0
    }), t.memoizedDefaultLocale = null, t.resolveLocale = function(e) {
      var i = Intl.NumberFormat.supportedLocalesOf(e);
      return i.length > 0 ? new Intl.Locale(i[0]) : new Intl.Locale(typeof e == "string" ? e : e[0]);
    }, t.__parse = parse, t.formats = {
      number: {
        integer: {
          maximumFractionDigits: 0
        },
        currency: {
          style: "currency"
        },
        percent: {
          style: "percent"
        }
      },
      date: {
        short: {
          month: "numeric",
          day: "numeric",
          year: "2-digit"
        },
        medium: {
          month: "short",
          day: "numeric",
          year: "numeric"
        },
        long: {
          month: "long",
          day: "numeric",
          year: "numeric"
        },
        full: {
          weekday: "long",
          month: "long",
          day: "numeric",
          year: "numeric"
        }
      },
      time: {
        short: {
          hour: "numeric",
          minute: "numeric"
        },
        medium: {
          hour: "numeric",
          minute: "numeric",
          second: "numeric"
        },
        long: {
          hour: "numeric",
          minute: "numeric",
          second: "numeric",
          timeZoneName: "short"
        },
        full: {
          hour: "numeric",
          minute: "numeric",
          second: "numeric",
          timeZoneName: "short"
        }
      }
    }, t;
  }()
);
function delve(t, e) {
  if (e == null)
    return;
  if (e in t)
    return t[e];
  const i = e.split(".");
  let n = t;
  for (let s = 0; s < i.length; s++)
    if (typeof n == "object") {
      if (s > 0) {
        const l = i.slice(s, i.length).join(".");
        if (l in n) {
          n = n[l];
          break;
        }
      }
      n = n[i[s]];
    } else
      n = void 0;
  return n;
}
const lookupCache = {}, addToCache = (t, e, i) => i && (e in lookupCache || (lookupCache[e] = {}), t in lookupCache[e] || (lookupCache[e][t] = i), i), lookup = (t, e) => {
  if (e == null)
    return;
  if (e in lookupCache && t in lookupCache[e])
    return lookupCache[e][t];
  const i = getPossibleLocales(e);
  for (let n = 0; n < i.length; n++) {
    const s = i[n], l = getMessageFromDictionary(s, t);
    if (l)
      return addToCache(t, e, l);
  }
};
let dictionary;
const $dictionary = writable({});
function getLocaleDictionary(t) {
  return dictionary[t] || null;
}
function hasLocaleDictionary(t) {
  return t in dictionary;
}
function getMessageFromDictionary(t, e) {
  if (!hasLocaleDictionary(t))
    return null;
  const i = getLocaleDictionary(t);
  return delve(i, e);
}
function getClosestAvailableLocale(t) {
  if (t == null)
    return;
  const e = getPossibleLocales(t);
  for (let i = 0; i < e.length; i++) {
    const n = e[i];
    if (hasLocaleDictionary(n))
      return n;
  }
}
function addMessages(t, ...e) {
  delete lookupCache[t], $dictionary.update((i) => (i[t] = deepmerge$1.all([i[t] || {}, ...e]), i));
}
derived(
  [$dictionary],
  ([t]) => Object.keys(t)
);
$dictionary.subscribe((t) => dictionary = t);
const queue = {};
function removeLoaderFromQueue(t, e) {
  queue[t].delete(e), queue[t].size === 0 && delete queue[t];
}
function getLocaleQueue(t) {
  return queue[t];
}
function getLocalesQueues(t) {
  return getPossibleLocales(t).map((e) => {
    const i = getLocaleQueue(e);
    return [e, i ? [...i] : []];
  }).filter(([, e]) => e.length > 0);
}
function hasLocaleQueue(t) {
  return t == null ? !1 : getPossibleLocales(t).some(
    (e) => {
      var i;
      return (i = getLocaleQueue(e)) == null ? void 0 : i.size;
    }
  );
}
function loadLocaleQueue(t, e) {
  return Promise.all(
    e.map((n) => (removeLoaderFromQueue(t, n), n().then((s) => s.default || s)))
  ).then((n) => addMessages(t, ...n));
}
const activeFlushes = {};
function flush(t) {
  if (!hasLocaleQueue(t))
    return t in activeFlushes ? activeFlushes[t] : Promise.resolve();
  const e = getLocalesQueues(t);
  return activeFlushes[t] = Promise.all(
    e.map(
      ([i, n]) => loadLocaleQueue(i, n)
    )
  ).then(() => {
    if (hasLocaleQueue(t))
      return flush(t);
    delete activeFlushes[t];
  }), activeFlushes[t];
}
const defaultFormats = {
  number: {
    scientific: { notation: "scientific" },
    engineering: { notation: "engineering" },
    compactLong: { notation: "compact", compactDisplay: "long" },
    compactShort: { notation: "compact", compactDisplay: "short" }
  },
  date: {
    short: { month: "numeric", day: "numeric", year: "2-digit" },
    medium: { month: "short", day: "numeric", year: "numeric" },
    long: { month: "long", day: "numeric", year: "numeric" },
    full: { weekday: "long", month: "long", day: "numeric", year: "numeric" }
  },
  time: {
    short: { hour: "numeric", minute: "numeric" },
    medium: { hour: "numeric", minute: "numeric", second: "numeric" },
    long: {
      hour: "numeric",
      minute: "numeric",
      second: "numeric",
      timeZoneName: "short"
    },
    full: {
      hour: "numeric",
      minute: "numeric",
      second: "numeric",
      timeZoneName: "short"
    }
  }
}, defaultOptions = {
  fallbackLocale: null,
  loadingDelay: 200,
  formats: defaultFormats,
  warnOnMissingMessages: !0,
  handleMissingMessage: void 0,
  ignoreTag: !0
}, options = defaultOptions;
function getOptions() {
  return options;
}
const $isLoading = writable(!1);
var __defProp$1 = Object.defineProperty, __defProps = Object.defineProperties, __getOwnPropDescs = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1 = Object.getOwnPropertySymbols, __hasOwnProp$1 = Object.prototype.hasOwnProperty, __propIsEnum$1 = Object.prototype.propertyIsEnumerable, __defNormalProp$1 = (t, e, i) => e in t ? __defProp$1(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, __spreadValues$1 = (t, e) => {
  for (var i in e || (e = {}))
    __hasOwnProp$1.call(e, i) && __defNormalProp$1(t, i, e[i]);
  if (__getOwnPropSymbols$1)
    for (var i of __getOwnPropSymbols$1(e))
      __propIsEnum$1.call(e, i) && __defNormalProp$1(t, i, e[i]);
  return t;
}, __spreadProps = (t, e) => __defProps(t, __getOwnPropDescs(e));
let current;
const internalLocale = writable(null);
function getSubLocales(t) {
  return t.split("-").map((e, i, n) => n.slice(0, i + 1).join("-")).reverse();
}
function getPossibleLocales(t, e = getOptions().fallbackLocale) {
  const i = getSubLocales(t);
  return e ? [.../* @__PURE__ */ new Set([...i, ...getSubLocales(e)])] : i;
}
function getCurrentLocale() {
  return current ?? void 0;
}
internalLocale.subscribe((t) => {
  current = t ?? void 0, typeof window < "u" && t != null && document.documentElement.setAttribute("lang", t);
});
const set = (t) => {
  if (t && getClosestAvailableLocale(t) && hasLocaleQueue(t)) {
    const { loadingDelay: e } = getOptions();
    let i;
    return typeof window < "u" && getCurrentLocale() != null && e ? i = window.setTimeout(
      () => $isLoading.set(!0),
      e
    ) : $isLoading.set(!0), flush(t).then(() => {
      internalLocale.set(t);
    }).finally(() => {
      clearTimeout(i), $isLoading.set(!1);
    });
  }
  return internalLocale.set(t);
}, $locale = __spreadProps(__spreadValues$1({}, internalLocale), {
  set
}), monadicMemoize = (t) => {
  const e = /* @__PURE__ */ Object.create(null);
  return (n) => {
    const s = JSON.stringify(n);
    return s in e ? e[s] : e[s] = t(n);
  };
};
var __defProp = Object.defineProperty, __getOwnPropSymbols = Object.getOwnPropertySymbols, __hasOwnProp = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable, __defNormalProp = (t, e, i) => e in t ? __defProp(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, __spreadValues = (t, e) => {
  for (var i in e || (e = {}))
    __hasOwnProp.call(e, i) && __defNormalProp(t, i, e[i]);
  if (__getOwnPropSymbols)
    for (var i of __getOwnPropSymbols(e))
      __propIsEnum.call(e, i) && __defNormalProp(t, i, e[i]);
  return t;
}, __objRest = (t, e) => {
  var i = {};
  for (var n in t)
    __hasOwnProp.call(t, n) && e.indexOf(n) < 0 && (i[n] = t[n]);
  if (t != null && __getOwnPropSymbols)
    for (var n of __getOwnPropSymbols(t))
      e.indexOf(n) < 0 && __propIsEnum.call(t, n) && (i[n] = t[n]);
  return i;
};
const getIntlFormatterOptions = (t, e) => {
  const { formats: i } = getOptions();
  if (t in i && e in i[t])
    return i[t][e];
  throw new Error(`[svelte-i18n] Unknown "${e}" ${t} format.`);
}, createNumberFormatter = monadicMemoize(
  (t) => {
    var e = t, { locale: i, format: n } = e, s = __objRest(e, ["locale", "format"]);
    if (i == null)
      throw new Error('[svelte-i18n] A "locale" must be set to format numbers');
    return n && (s = getIntlFormatterOptions("number", n)), new Intl.NumberFormat(i, s);
  }
), createDateFormatter = monadicMemoize(
  (t) => {
    var e = t, { locale: i, format: n } = e, s = __objRest(e, ["locale", "format"]);
    if (i == null)
      throw new Error('[svelte-i18n] A "locale" must be set to format dates');
    return n ? s = getIntlFormatterOptions("date", n) : Object.keys(s).length === 0 && (s = getIntlFormatterOptions("date", "short")), new Intl.DateTimeFormat(i, s);
  }
), createTimeFormatter = monadicMemoize(
  (t) => {
    var e = t, { locale: i, format: n } = e, s = __objRest(e, ["locale", "format"]);
    if (i == null)
      throw new Error(
        '[svelte-i18n] A "locale" must be set to format time values'
      );
    return n ? s = getIntlFormatterOptions("time", n) : Object.keys(s).length === 0 && (s = getIntlFormatterOptions("time", "short")), new Intl.DateTimeFormat(i, s);
  }
), getNumberFormatter = (t = {}) => {
  var e = t, {
    locale: i = getCurrentLocale()
  } = e, n = __objRest(e, [
    "locale"
  ]);
  return createNumberFormatter(__spreadValues({ locale: i }, n));
}, getDateFormatter = (t = {}) => {
  var e = t, {
    locale: i = getCurrentLocale()
  } = e, n = __objRest(e, [
    "locale"
  ]);
  return createDateFormatter(__spreadValues({ locale: i }, n));
}, getTimeFormatter = (t = {}) => {
  var e = t, {
    locale: i = getCurrentLocale()
  } = e, n = __objRest(e, [
    "locale"
  ]);
  return createTimeFormatter(__spreadValues({ locale: i }, n));
}, getMessageFormatter = monadicMemoize(
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  (t, e = getCurrentLocale()) => new IntlMessageFormat(t, e, getOptions().formats, {
    ignoreTag: getOptions().ignoreTag
  })
), formatMessage = (t, e = {}) => {
  var i, n, s, l;
  let h = e;
  typeof t == "object" && (h = t, t = h.id);
  const {
    values: _,
    locale: c = getCurrentLocale(),
    default: o
  } = h;
  if (c == null)
    throw new Error(
      "[svelte-i18n] Cannot format a message without first setting the initial locale."
    );
  let r = lookup(t, c);
  if (!r)
    r = (l = (s = (n = (i = getOptions()).handleMissingMessage) == null ? void 0 : n.call(i, { locale: c, id: t, defaultValue: o })) != null ? s : o) != null ? l : t;
  else if (typeof r != "string")
    return console.warn(
      `[svelte-i18n] Message with id "${t}" must be of type "string", found: "${typeof r}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`
    ), r;
  if (!_)
    return r;
  let T = r;
  try {
    T = getMessageFormatter(r, c).format(_);
  } catch (S) {
    S instanceof Error && console.warn(
      `[svelte-i18n] Message "${t}" has syntax error:`,
      S.message
    );
  }
  return T;
}, formatTime = (t, e) => getTimeFormatter(e).format(t), formatDate = (t, e) => getDateFormatter(e).format(t), formatNumber = (t, e) => getNumberFormatter(e).format(t), getJSON = (t, e = getCurrentLocale()) => lookup(t, e);
derived([$locale, $dictionary], () => formatMessage);
derived([$locale], () => formatTime);
derived([$locale], () => formatDate);
derived([$locale], () => formatNumber);
derived([$locale, $dictionary], () => getJSON);
const Upload_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$2,
  append: append$2,
  attr: attr$2,
  binding_callbacks: binding_callbacks$1,
  bubble,
  create_slot,
  detach: detach$2,
  element: element$2,
  get_all_dirty_from_scope,
  get_slot_changes,
  init: init$2,
  insert: insert$2,
  listen,
  prevent_default,
  run_all,
  safe_not_equal: safe_not_equal$2,
  space: space$2,
  stop_propagation,
  toggle_class: toggle_class$1,
  transition_in: transition_in$2,
  transition_out: transition_out$2,
  update_slot_base
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$1, tick: tick$1, getContext } = window.__gradio__svelte__internal;
function create_fragment$2(t) {
  let e, i, n, s, l, h, _, c, o;
  const r = (
    /*#slots*/
    t[16].default
  ), T = create_slot(
    r,
    t,
    /*$$scope*/
    t[15],
    null
  );
  return {
    c() {
      e = element$2("button"), T && T.c(), i = space$2(), n = element$2("input"), attr$2(n, "type", "file"), attr$2(
        n,
        "accept",
        /*filetype*/
        t[0]
      ), n.multiple = s = /*file_count*/
      t[4] === "multiple" || void 0, attr$2(n, "webkitdirectory", l = /*file_count*/
      t[4] === "directory" || void 0), attr$2(n, "mozdirectory", h = /*file_count*/
      t[4] === "directory" || void 0), attr$2(n, "class", "svelte-18dlsnh"), attr$2(e, "class", "svelte-18dlsnh"), toggle_class$1(
        e,
        "hidden",
        /*hidden*/
        t[5]
      ), toggle_class$1(
        e,
        "center",
        /*center*/
        t[2]
      ), toggle_class$1(
        e,
        "boundedheight",
        /*boundedheight*/
        t[1]
      ), toggle_class$1(
        e,
        "flex",
        /*flex*/
        t[3]
      );
    },
    m(S, w) {
      insert$2(S, e, w), T && T.m(e, null), append$2(e, i), append$2(e, n), t[24](n), _ = !0, c || (o = [
        listen(
          n,
          "change",
          /*load_files_from_upload*/
          t[9]
        ),
        listen(e, "drag", stop_propagation(prevent_default(
          /*drag_handler*/
          t[17]
        ))),
        listen(e, "dragstart", stop_propagation(prevent_default(
          /*dragstart_handler*/
          t[18]
        ))),
        listen(e, "dragend", stop_propagation(prevent_default(
          /*dragend_handler*/
          t[19]
        ))),
        listen(e, "dragover", stop_propagation(prevent_default(
          /*dragover_handler*/
          t[20]
        ))),
        listen(e, "dragenter", stop_propagation(prevent_default(
          /*dragenter_handler*/
          t[21]
        ))),
        listen(e, "dragleave", stop_propagation(prevent_default(
          /*dragleave_handler*/
          t[22]
        ))),
        listen(e, "drop", stop_propagation(prevent_default(
          /*drop_handler*/
          t[23]
        ))),
        listen(
          e,
          "click",
          /*open_file_upload*/
          t[6]
        ),
        listen(
          e,
          "drop",
          /*loadFilesFromDrop*/
          t[10]
        ),
        listen(
          e,
          "dragenter",
          /*updateDragging*/
          t[8]
        ),
        listen(
          e,
          "dragleave",
          /*updateDragging*/
          t[8]
        )
      ], c = !0);
    },
    p(S, [w]) {
      T && T.p && (!_ || w & /*$$scope*/
      32768) && update_slot_base(
        T,
        r,
        S,
        /*$$scope*/
        S[15],
        _ ? get_slot_changes(
          r,
          /*$$scope*/
          S[15],
          w,
          null
        ) : get_all_dirty_from_scope(
          /*$$scope*/
          S[15]
        ),
        null
      ), (!_ || w & /*filetype*/
      1) && attr$2(
        n,
        "accept",
        /*filetype*/
        S[0]
      ), (!_ || w & /*file_count*/
      16 && s !== (s = /*file_count*/
      S[4] === "multiple" || void 0)) && (n.multiple = s), (!_ || w & /*file_count*/
      16 && l !== (l = /*file_count*/
      S[4] === "directory" || void 0)) && attr$2(n, "webkitdirectory", l), (!_ || w & /*file_count*/
      16 && h !== (h = /*file_count*/
      S[4] === "directory" || void 0)) && attr$2(n, "mozdirectory", h), (!_ || w & /*hidden*/
      32) && toggle_class$1(
        e,
        "hidden",
        /*hidden*/
        S[5]
      ), (!_ || w & /*center*/
      4) && toggle_class$1(
        e,
        "center",
        /*center*/
        S[2]
      ), (!_ || w & /*boundedheight*/
      2) && toggle_class$1(
        e,
        "boundedheight",
        /*boundedheight*/
        S[1]
      ), (!_ || w & /*flex*/
      8) && toggle_class$1(
        e,
        "flex",
        /*flex*/
        S[3]
      );
    },
    i(S) {
      _ || (transition_in$2(T, S), _ = !0);
    },
    o(S) {
      transition_out$2(T, S), _ = !1;
    },
    d(S) {
      S && detach$2(e), T && T.d(S), t[24](null), c = !1, run_all(o);
    }
  };
}
function _optionalChain(t) {
  let e, i = t[0], n = 1;
  for (; n < t.length; ) {
    const s = t[n], l = t[n + 1];
    if (n += 2, (s === "optionalAccess" || s === "optionalCall") && i == null)
      return;
    s === "access" || s === "optionalAccess" ? (e = i, i = l(i)) : (s === "call" || s === "optionalCall") && (i = l((...h) => i.call(e, ...h)), e = void 0);
  }
  return i;
}
function is_valid_mimetype(t, e) {
  return !t || t === "*" ? !0 : t.endsWith("/*") ? e.startsWith(t.slice(0, -1)) : t === e;
}
function instance$2(t, e, i) {
  let { $$slots: n = {}, $$scope: s } = e, { filetype: l = null } = e, { dragging: h = !1 } = e, { boundedheight: _ = !0 } = e, { center: c = !0 } = e, { flex: o = !0 } = e, { file_count: r = "single" } = e, { disable_click: T = !1 } = e, { root: S } = e, { hidden: w = !1 } = e;
  const C = getContext("upload_files");
  let P;
  const b = createEventDispatcher$1();
  function k() {
    i(11, h = !h);
  }
  function F() {
    T || (i(7, P.value = "", P), P.click());
  }
  async function x(B) {
    await tick$1();
    const ee = await upload(B, S, C);
    return b("load", r === "single" ? _optionalChain([ee, "optionalAccess", (Y) => Y[0]]) : ee), ee || [];
  }
  async function y(B) {
    if (!B.length)
      return;
    let ee = B.map((q) => new File([q], q.name)), Y = await prepare_files(ee);
    return await x(Y);
  }
  async function p(B) {
    const ee = B.target;
    ee.files && await y(Array.from(ee.files));
  }
  async function E(B) {
    if (i(11, h = !1), !_optionalChain([B, "access", (Y) => Y.dataTransfer, "optionalAccess", (Y) => Y.files]))
      return;
    const ee = Array.from(B.dataTransfer.files).filter((Y) => _optionalChain([
      l,
      "optionalAccess",
      (q) => q.split,
      "call",
      (q) => q(","),
      "access",
      (q) => q.some,
      "call",
      (q) => q((le) => is_valid_mimetype(le, Y.type))
    ]) ? !0 : (b("error", `Invalid file type only ${l} allowed.`), !1));
    await y(ee);
  }
  function $(B) {
    bubble.call(this, t, B);
  }
  function M(B) {
    bubble.call(this, t, B);
  }
  function m(B) {
    bubble.call(this, t, B);
  }
  function N(B) {
    bubble.call(this, t, B);
  }
  function D(B) {
    bubble.call(this, t, B);
  }
  function X(B) {
    bubble.call(this, t, B);
  }
  function G(B) {
    bubble.call(this, t, B);
  }
  function I(B) {
    binding_callbacks$1[B ? "unshift" : "push"](() => {
      P = B, i(7, P);
    });
  }
  return t.$$set = (B) => {
    "filetype" in B && i(0, l = B.filetype), "dragging" in B && i(11, h = B.dragging), "boundedheight" in B && i(1, _ = B.boundedheight), "center" in B && i(2, c = B.center), "flex" in B && i(3, o = B.flex), "file_count" in B && i(4, r = B.file_count), "disable_click" in B && i(12, T = B.disable_click), "root" in B && i(13, S = B.root), "hidden" in B && i(5, w = B.hidden), "$$scope" in B && i(15, s = B.$$scope);
  }, [
    l,
    _,
    c,
    o,
    r,
    w,
    F,
    P,
    k,
    p,
    E,
    h,
    T,
    S,
    y,
    s,
    n,
    $,
    M,
    m,
    N,
    D,
    X,
    G,
    I
  ];
}
class Upload extends SvelteComponent$2 {
  constructor(e) {
    super(), init$2(this, e, instance$2, create_fragment$2, safe_not_equal$2, {
      filetype: 0,
      dragging: 11,
      boundedheight: 1,
      center: 2,
      flex: 3,
      file_count: 4,
      disable_click: 12,
      root: 13,
      hidden: 5,
      open_file_upload: 6,
      load_files: 14
    });
  }
  get open_file_upload() {
    return this.$$.ctx[6];
  }
  get load_files() {
    return this.$$.ctx[14];
  }
}
const ModifyUpload_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$1,
  append: append$1,
  attr: attr$1,
  check_outros: check_outros$1,
  create_component: create_component$1,
  destroy_component: destroy_component$1,
  detach: detach$1,
  element: element$1,
  group_outros: group_outros$1,
  init: init$1,
  insert: insert$1,
  mount_component: mount_component$1,
  safe_not_equal: safe_not_equal$1,
  set_style: set_style$1,
  space: space$1,
  toggle_class,
  transition_in: transition_in$1,
  transition_out: transition_out$1
} = window.__gradio__svelte__internal, { createEventDispatcher } = window.__gradio__svelte__internal;
function create_if_block_1$1(t) {
  let e, i;
  return e = new IconButton({
    props: {
      Icon: Edit,
      label: (
        /*i18n*/
        t[3]("common.edit")
      )
    }
  }), e.$on(
    "click",
    /*click_handler*/
    t[5]
  ), {
    c() {
      create_component$1(e.$$.fragment);
    },
    m(n, s) {
      mount_component$1(e, n, s), i = !0;
    },
    p(n, s) {
      const l = {};
      s & /*i18n*/
      8 && (l.label = /*i18n*/
      n[3]("common.edit")), e.$set(l);
    },
    i(n) {
      i || (transition_in$1(e.$$.fragment, n), i = !0);
    },
    o(n) {
      transition_out$1(e.$$.fragment, n), i = !1;
    },
    d(n) {
      destroy_component$1(e, n);
    }
  };
}
function create_if_block$1(t) {
  let e, i;
  return e = new IconButton({
    props: {
      Icon: Undo,
      label: (
        /*i18n*/
        t[3]("common.undo")
      )
    }
  }), e.$on(
    "click",
    /*click_handler_1*/
    t[6]
  ), {
    c() {
      create_component$1(e.$$.fragment);
    },
    m(n, s) {
      mount_component$1(e, n, s), i = !0;
    },
    p(n, s) {
      const l = {};
      s & /*i18n*/
      8 && (l.label = /*i18n*/
      n[3]("common.undo")), e.$set(l);
    },
    i(n) {
      i || (transition_in$1(e.$$.fragment, n), i = !0);
    },
    o(n) {
      transition_out$1(e.$$.fragment, n), i = !1;
    },
    d(n) {
      destroy_component$1(e, n);
    }
  };
}
function create_fragment$1(t) {
  let e, i, n, s, l, h = (
    /*editable*/
    t[0] && create_if_block_1$1(t)
  ), _ = (
    /*undoable*/
    t[1] && create_if_block$1(t)
  );
  return s = new IconButton({
    props: {
      Icon: Clear,
      label: (
        /*i18n*/
        t[3]("common.clear")
      )
    }
  }), s.$on(
    "click",
    /*click_handler_2*/
    t[7]
  ), {
    c() {
      e = element$1("div"), h && h.c(), i = space$1(), _ && _.c(), n = space$1(), create_component$1(s.$$.fragment), attr$1(e, "class", "svelte-1wj0ocy"), toggle_class(e, "not-absolute", !/*absolute*/
      t[2]), set_style$1(
        e,
        "position",
        /*absolute*/
        t[2] ? "absolute" : "static"
      );
    },
    m(c, o) {
      insert$1(c, e, o), h && h.m(e, null), append$1(e, i), _ && _.m(e, null), append$1(e, n), mount_component$1(s, e, null), l = !0;
    },
    p(c, [o]) {
      /*editable*/
      c[0] ? h ? (h.p(c, o), o & /*editable*/
      1 && transition_in$1(h, 1)) : (h = create_if_block_1$1(c), h.c(), transition_in$1(h, 1), h.m(e, i)) : h && (group_outros$1(), transition_out$1(h, 1, 1, () => {
        h = null;
      }), check_outros$1()), /*undoable*/
      c[1] ? _ ? (_.p(c, o), o & /*undoable*/
      2 && transition_in$1(_, 1)) : (_ = create_if_block$1(c), _.c(), transition_in$1(_, 1), _.m(e, n)) : _ && (group_outros$1(), transition_out$1(_, 1, 1, () => {
        _ = null;
      }), check_outros$1());
      const r = {};
      o & /*i18n*/
      8 && (r.label = /*i18n*/
      c[3]("common.clear")), s.$set(r), (!l || o & /*absolute*/
      4) && toggle_class(e, "not-absolute", !/*absolute*/
      c[2]), o & /*absolute*/
      4 && set_style$1(
        e,
        "position",
        /*absolute*/
        c[2] ? "absolute" : "static"
      );
    },
    i(c) {
      l || (transition_in$1(h), transition_in$1(_), transition_in$1(s.$$.fragment, c), l = !0);
    },
    o(c) {
      transition_out$1(h), transition_out$1(_), transition_out$1(s.$$.fragment, c), l = !1;
    },
    d(c) {
      c && detach$1(e), h && h.d(), _ && _.d(), destroy_component$1(s);
    }
  };
}
function instance$1(t, e, i) {
  let { editable: n = !1 } = e, { undoable: s = !1 } = e, { absolute: l = !0 } = e, { i18n: h } = e;
  const _ = createEventDispatcher(), c = () => _("edit"), o = () => _("undo"), r = (T) => {
    _("clear"), T.stopPropagation();
  };
  return t.$$set = (T) => {
    "editable" in T && i(0, n = T.editable), "undoable" in T && i(1, s = T.undoable), "absolute" in T && i(2, l = T.absolute), "i18n" in T && i(3, h = T.i18n);
  }, [
    n,
    s,
    l,
    h,
    _,
    c,
    o,
    r
  ];
}
class ModifyUpload extends SvelteComponent$1 {
  constructor(e) {
    super(), init$1(this, e, instance$1, create_fragment$1, safe_not_equal$1, {
      editable: 0,
      undoable: 1,
      absolute: 2,
      i18n: 3
    });
  }
}
function commonjsRequire(t) {
  throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
}
var pdf = { exports: {} };
const require$$5$1 = {}, __viteBrowserExternal = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: require$$5$1
}, Symbol.toStringTag, { value: "Module" })), require$$5 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal);
(function(module, exports) {
  (function(e, i) {
    module.exports = e.pdfjsLib = i();
  })(globalThis, () => (
    /******/
    (() => {
      var __webpack_modules__ = [
        ,
        /* 1 */
        /***/
        (t, e) => {
          var Ye;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.VerbosityLevel = e.Util = e.UnknownErrorException = e.UnexpectedResponseException = e.TextRenderingMode = e.RenderingIntentFlag = e.PromiseCapability = e.PermissionFlag = e.PasswordResponses = e.PasswordException = e.PageActionEventType = e.OPS = e.MissingPDFException = e.MAX_IMAGE_SIZE_TO_CACHE = e.LINE_FACTOR = e.LINE_DESCENT_FACTOR = e.InvalidPDFException = e.ImageKind = e.IDENTITY_MATRIX = e.FormatError = e.FeatureTest = e.FONT_IDENTITY_MATRIX = e.DocumentActionEventType = e.CMapCompressionType = e.BaseException = e.BASELINE_FACTOR = e.AnnotationType = e.AnnotationReplyType = e.AnnotationPrefix = e.AnnotationMode = e.AnnotationFlag = e.AnnotationFieldFlag = e.AnnotationEditorType = e.AnnotationEditorPrefix = e.AnnotationEditorParamsType = e.AnnotationBorderStyleType = e.AnnotationActionEventType = e.AbortException = void 0, e.assert = le, e.bytesToString = z, e.createValidAbsoluteUrl = we, e.getModificationDate = xe, e.getUuid = Xe, e.getVerbosityLevel = B, e.info = ee, e.isArrayBuffer = ge, e.isArrayEqual = Ce, e.isNodeJS = void 0, e.normalizeUnicode = ze, e.objectFromMap = ue, e.objectSize = ce, e.setVerbosityLevel = I, e.shadow = be, e.string32 = Z, e.stringToBytes = ae, e.stringToPDFString = _e, e.stringToUTF8String = ie, e.unreachable = q, e.utf8StringToString = se, e.warn = Y;
          const i = typeof process == "object" && process + "" == "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
          e.isNodeJS = i;
          const n = [1, 0, 0, 1, 0, 0];
          e.IDENTITY_MATRIX = n;
          const s = [1e-3, 0, 0, 1e-3, 0, 0];
          e.FONT_IDENTITY_MATRIX = s;
          const l = 1e7;
          e.MAX_IMAGE_SIZE_TO_CACHE = l;
          const h = 1.35;
          e.LINE_FACTOR = h;
          const _ = 0.35;
          e.LINE_DESCENT_FACTOR = _;
          const c = _ / h;
          e.BASELINE_FACTOR = c;
          const o = {
            ANY: 1,
            DISPLAY: 2,
            PRINT: 4,
            SAVE: 8,
            ANNOTATIONS_FORMS: 16,
            ANNOTATIONS_STORAGE: 32,
            ANNOTATIONS_DISABLE: 64,
            OPLIST: 256
          };
          e.RenderingIntentFlag = o;
          const r = {
            DISABLE: 0,
            ENABLE: 1,
            ENABLE_FORMS: 2,
            ENABLE_STORAGE: 3
          };
          e.AnnotationMode = r;
          const T = "pdfjs_internal_editor_";
          e.AnnotationEditorPrefix = T;
          const S = {
            DISABLE: -1,
            NONE: 0,
            FREETEXT: 3,
            STAMP: 13,
            INK: 15
          };
          e.AnnotationEditorType = S;
          const w = {
            RESIZE: 1,
            CREATE: 2,
            FREETEXT_SIZE: 11,
            FREETEXT_COLOR: 12,
            FREETEXT_OPACITY: 13,
            INK_COLOR: 21,
            INK_THICKNESS: 22,
            INK_OPACITY: 23
          };
          e.AnnotationEditorParamsType = w;
          const C = {
            PRINT: 4,
            MODIFY_CONTENTS: 8,
            COPY: 16,
            MODIFY_ANNOTATIONS: 32,
            FILL_INTERACTIVE_FORMS: 256,
            COPY_FOR_ACCESSIBILITY: 512,
            ASSEMBLE: 1024,
            PRINT_HIGH_QUALITY: 2048
          };
          e.PermissionFlag = C;
          const P = {
            FILL: 0,
            STROKE: 1,
            FILL_STROKE: 2,
            INVISIBLE: 3,
            FILL_ADD_TO_PATH: 4,
            STROKE_ADD_TO_PATH: 5,
            FILL_STROKE_ADD_TO_PATH: 6,
            ADD_TO_PATH: 7,
            FILL_STROKE_MASK: 3,
            ADD_TO_PATH_FLAG: 4
          };
          e.TextRenderingMode = P;
          const b = {
            GRAYSCALE_1BPP: 1,
            RGB_24BPP: 2,
            RGBA_32BPP: 3
          };
          e.ImageKind = b;
          const k = {
            TEXT: 1,
            LINK: 2,
            FREETEXT: 3,
            LINE: 4,
            SQUARE: 5,
            CIRCLE: 6,
            POLYGON: 7,
            POLYLINE: 8,
            HIGHLIGHT: 9,
            UNDERLINE: 10,
            SQUIGGLY: 11,
            STRIKEOUT: 12,
            STAMP: 13,
            CARET: 14,
            INK: 15,
            POPUP: 16,
            FILEATTACHMENT: 17,
            SOUND: 18,
            MOVIE: 19,
            WIDGET: 20,
            SCREEN: 21,
            PRINTERMARK: 22,
            TRAPNET: 23,
            WATERMARK: 24,
            THREED: 25,
            REDACT: 26
          };
          e.AnnotationType = k;
          const F = {
            GROUP: "Group",
            REPLY: "R"
          };
          e.AnnotationReplyType = F;
          const x = {
            INVISIBLE: 1,
            HIDDEN: 2,
            PRINT: 4,
            NOZOOM: 8,
            NOROTATE: 16,
            NOVIEW: 32,
            READONLY: 64,
            LOCKED: 128,
            TOGGLENOVIEW: 256,
            LOCKEDCONTENTS: 512
          };
          e.AnnotationFlag = x;
          const y = {
            READONLY: 1,
            REQUIRED: 2,
            NOEXPORT: 4,
            MULTILINE: 4096,
            PASSWORD: 8192,
            NOTOGGLETOOFF: 16384,
            RADIO: 32768,
            PUSHBUTTON: 65536,
            COMBO: 131072,
            EDIT: 262144,
            SORT: 524288,
            FILESELECT: 1048576,
            MULTISELECT: 2097152,
            DONOTSPELLCHECK: 4194304,
            DONOTSCROLL: 8388608,
            COMB: 16777216,
            RICHTEXT: 33554432,
            RADIOSINUNISON: 33554432,
            COMMITONSELCHANGE: 67108864
          };
          e.AnnotationFieldFlag = y;
          const p = {
            SOLID: 1,
            DASHED: 2,
            BEVELED: 3,
            INSET: 4,
            UNDERLINE: 5
          };
          e.AnnotationBorderStyleType = p;
          const E = {
            E: "Mouse Enter",
            X: "Mouse Exit",
            D: "Mouse Down",
            U: "Mouse Up",
            Fo: "Focus",
            Bl: "Blur",
            PO: "PageOpen",
            PC: "PageClose",
            PV: "PageVisible",
            PI: "PageInvisible",
            K: "Keystroke",
            F: "Format",
            V: "Validate",
            C: "Calculate"
          };
          e.AnnotationActionEventType = E;
          const $ = {
            WC: "WillClose",
            WS: "WillSave",
            DS: "DidSave",
            WP: "WillPrint",
            DP: "DidPrint"
          };
          e.DocumentActionEventType = $;
          const M = {
            O: "PageOpen",
            C: "PageClose"
          };
          e.PageActionEventType = M;
          const m = {
            ERRORS: 0,
            WARNINGS: 1,
            INFOS: 5
          };
          e.VerbosityLevel = m;
          const N = {
            NONE: 0,
            BINARY: 1
          };
          e.CMapCompressionType = N;
          const D = {
            dependency: 1,
            setLineWidth: 2,
            setLineCap: 3,
            setLineJoin: 4,
            setMiterLimit: 5,
            setDash: 6,
            setRenderingIntent: 7,
            setFlatness: 8,
            setGState: 9,
            save: 10,
            restore: 11,
            transform: 12,
            moveTo: 13,
            lineTo: 14,
            curveTo: 15,
            curveTo2: 16,
            curveTo3: 17,
            closePath: 18,
            rectangle: 19,
            stroke: 20,
            closeStroke: 21,
            fill: 22,
            eoFill: 23,
            fillStroke: 24,
            eoFillStroke: 25,
            closeFillStroke: 26,
            closeEOFillStroke: 27,
            endPath: 28,
            clip: 29,
            eoClip: 30,
            beginText: 31,
            endText: 32,
            setCharSpacing: 33,
            setWordSpacing: 34,
            setHScale: 35,
            setLeading: 36,
            setFont: 37,
            setTextRenderingMode: 38,
            setTextRise: 39,
            moveText: 40,
            setLeadingMoveText: 41,
            setTextMatrix: 42,
            nextLine: 43,
            showText: 44,
            showSpacedText: 45,
            nextLineShowText: 46,
            nextLineSetSpacingShowText: 47,
            setCharWidth: 48,
            setCharWidthAndBounds: 49,
            setStrokeColorSpace: 50,
            setFillColorSpace: 51,
            setStrokeColor: 52,
            setStrokeColorN: 53,
            setFillColor: 54,
            setFillColorN: 55,
            setStrokeGray: 56,
            setFillGray: 57,
            setStrokeRGBColor: 58,
            setFillRGBColor: 59,
            setStrokeCMYKColor: 60,
            setFillCMYKColor: 61,
            shadingFill: 62,
            beginInlineImage: 63,
            beginImageData: 64,
            endInlineImage: 65,
            paintXObject: 66,
            markPoint: 67,
            markPointProps: 68,
            beginMarkedContent: 69,
            beginMarkedContentProps: 70,
            endMarkedContent: 71,
            beginCompat: 72,
            endCompat: 73,
            paintFormXObjectBegin: 74,
            paintFormXObjectEnd: 75,
            beginGroup: 76,
            endGroup: 77,
            beginAnnotation: 80,
            endAnnotation: 81,
            paintImageMaskXObject: 83,
            paintImageMaskXObjectGroup: 84,
            paintImageXObject: 85,
            paintInlineImageXObject: 86,
            paintInlineImageXObjectGroup: 87,
            paintImageXObjectRepeat: 88,
            paintImageMaskXObjectRepeat: 89,
            paintSolidColorImageMask: 90,
            constructPath: 91
          };
          e.OPS = D;
          const X = {
            NEED_PASSWORD: 1,
            INCORRECT_PASSWORD: 2
          };
          e.PasswordResponses = X;
          let G = m.WARNINGS;
          function I(de) {
            Number.isInteger(de) && (G = de);
          }
          function B() {
            return G;
          }
          function ee(de) {
            G >= m.INFOS && console.log(`Info: ${de}`);
          }
          function Y(de) {
            G >= m.WARNINGS && console.log(`Warning: ${de}`);
          }
          function q(de) {
            throw new Error(de);
          }
          function le(de, ne) {
            de || q(ne);
          }
          function pe(de) {
            switch (de == null ? void 0 : de.protocol) {
              case "http:":
              case "https:":
              case "ftp:":
              case "mailto:":
              case "tel:":
                return !0;
              default:
                return !1;
            }
          }
          function we(de, ne = null, J = null) {
            if (!de)
              return null;
            try {
              if (J && typeof de == "string") {
                if (J.addDefaultProtocol && de.startsWith("www.")) {
                  const Se = de.match(/\./g);
                  (Se == null ? void 0 : Se.length) >= 2 && (de = `http://${de}`);
                }
                if (J.tryConvertEncoding)
                  try {
                    de = ie(de);
                  } catch {
                  }
              }
              const ve = ne ? new URL(de, ne) : new URL(de);
              if (pe(ve))
                return ve;
            } catch {
            }
            return null;
          }
          function be(de, ne, J, ve = !1) {
            return Object.defineProperty(de, ne, {
              value: J,
              enumerable: !ve,
              configurable: !0,
              writable: !1
            }), J;
          }
          const R = function() {
            function ne(J, ve) {
              this.constructor === ne && q("Cannot initialize BaseException."), this.message = J, this.name = ve;
            }
            return ne.prototype = new Error(), ne.constructor = ne, ne;
          }();
          e.BaseException = R;
          class d extends R {
            constructor(ne, J) {
              super(ne, "PasswordException"), this.code = J;
            }
          }
          e.PasswordException = d;
          class g extends R {
            constructor(ne, J) {
              super(ne, "UnknownErrorException"), this.details = J;
            }
          }
          e.UnknownErrorException = g;
          class f extends R {
            constructor(ne) {
              super(ne, "InvalidPDFException");
            }
          }
          e.InvalidPDFException = f;
          class v extends R {
            constructor(ne) {
              super(ne, "MissingPDFException");
            }
          }
          e.MissingPDFException = v;
          class A extends R {
            constructor(ne, J) {
              super(ne, "UnexpectedResponseException"), this.status = J;
            }
          }
          e.UnexpectedResponseException = A;
          class O extends R {
            constructor(ne) {
              super(ne, "FormatError");
            }
          }
          e.FormatError = O;
          class H extends R {
            constructor(ne) {
              super(ne, "AbortException");
            }
          }
          e.AbortException = H;
          function z(de) {
            (typeof de != "object" || (de == null ? void 0 : de.length) === void 0) && q("Invalid argument for bytesToString");
            const ne = de.length, J = 8192;
            if (ne < J)
              return String.fromCharCode.apply(null, de);
            const ve = [];
            for (let Se = 0; Se < ne; Se += J) {
              const tt = Math.min(Se + J, ne), et = de.subarray(Se, tt);
              ve.push(String.fromCharCode.apply(null, et));
            }
            return ve.join("");
          }
          function ae(de) {
            typeof de != "string" && q("Invalid argument for stringToBytes");
            const ne = de.length, J = new Uint8Array(ne);
            for (let ve = 0; ve < ne; ++ve)
              J[ve] = de.charCodeAt(ve) & 255;
            return J;
          }
          function Z(de) {
            return String.fromCharCode(de >> 24 & 255, de >> 16 & 255, de >> 8 & 255, de & 255);
          }
          function ce(de) {
            return Object.keys(de).length;
          }
          function ue(de) {
            const ne = /* @__PURE__ */ Object.create(null);
            for (const [J, ve] of de)
              ne[J] = ve;
            return ne;
          }
          function me() {
            const de = new Uint8Array(4);
            return de[0] = 1, new Uint32Array(de.buffer, 0, 1)[0] === 1;
          }
          function fe() {
            try {
              return new Function(""), !0;
            } catch {
              return !1;
            }
          }
          class Pe {
            static get isLittleEndian() {
              return be(this, "isLittleEndian", me());
            }
            static get isEvalSupported() {
              return be(this, "isEvalSupported", fe());
            }
            static get isOffscreenCanvasSupported() {
              return be(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas < "u");
            }
            static get platform() {
              return typeof navigator > "u" ? be(this, "platform", {
                isWin: !1,
                isMac: !1
              }) : be(this, "platform", {
                isWin: navigator.platform.includes("Win"),
                isMac: navigator.platform.includes("Mac")
              });
            }
            static get isCSSRoundSupported() {
              var ne, J;
              return be(this, "isCSSRoundSupported", (J = (ne = globalThis.CSS) == null ? void 0 : ne.supports) == null ? void 0 : J.call(ne, "width: round(1.5px, 1px)"));
            }
          }
          e.FeatureTest = Pe;
          const Fe = [...Array(256).keys()].map((de) => de.toString(16).padStart(2, "0"));
          class Ee {
            static makeHexColor(ne, J, ve) {
              return `#${Fe[ne]}${Fe[J]}${Fe[ve]}`;
            }
            static scaleMinMax(ne, J) {
              let ve;
              ne[0] ? (ne[0] < 0 && (ve = J[0], J[0] = J[1], J[1] = ve), J[0] *= ne[0], J[1] *= ne[0], ne[3] < 0 && (ve = J[2], J[2] = J[3], J[3] = ve), J[2] *= ne[3], J[3] *= ne[3]) : (ve = J[0], J[0] = J[2], J[2] = ve, ve = J[1], J[1] = J[3], J[3] = ve, ne[1] < 0 && (ve = J[2], J[2] = J[3], J[3] = ve), J[2] *= ne[1], J[3] *= ne[1], ne[2] < 0 && (ve = J[0], J[0] = J[1], J[1] = ve), J[0] *= ne[2], J[1] *= ne[2]), J[0] += ne[4], J[1] += ne[4], J[2] += ne[5], J[3] += ne[5];
            }
            static transform(ne, J) {
              return [ne[0] * J[0] + ne[2] * J[1], ne[1] * J[0] + ne[3] * J[1], ne[0] * J[2] + ne[2] * J[3], ne[1] * J[2] + ne[3] * J[3], ne[0] * J[4] + ne[2] * J[5] + ne[4], ne[1] * J[4] + ne[3] * J[5] + ne[5]];
            }
            static applyTransform(ne, J) {
              const ve = ne[0] * J[0] + ne[1] * J[2] + J[4], Se = ne[0] * J[1] + ne[1] * J[3] + J[5];
              return [ve, Se];
            }
            static applyInverseTransform(ne, J) {
              const ve = J[0] * J[3] - J[1] * J[2], Se = (ne[0] * J[3] - ne[1] * J[2] + J[2] * J[5] - J[4] * J[3]) / ve, tt = (-ne[0] * J[1] + ne[1] * J[0] + J[4] * J[1] - J[5] * J[0]) / ve;
              return [Se, tt];
            }
            static getAxialAlignedBoundingBox(ne, J) {
              const ve = this.applyTransform(ne, J), Se = this.applyTransform(ne.slice(2, 4), J), tt = this.applyTransform([ne[0], ne[3]], J), et = this.applyTransform([ne[2], ne[1]], J);
              return [Math.min(ve[0], Se[0], tt[0], et[0]), Math.min(ve[1], Se[1], tt[1], et[1]), Math.max(ve[0], Se[0], tt[0], et[0]), Math.max(ve[1], Se[1], tt[1], et[1])];
            }
            static inverseTransform(ne) {
              const J = ne[0] * ne[3] - ne[1] * ne[2];
              return [ne[3] / J, -ne[1] / J, -ne[2] / J, ne[0] / J, (ne[2] * ne[5] - ne[4] * ne[3]) / J, (ne[4] * ne[1] - ne[5] * ne[0]) / J];
            }
            static singularValueDecompose2dScale(ne) {
              const J = [ne[0], ne[2], ne[1], ne[3]], ve = ne[0] * J[0] + ne[1] * J[2], Se = ne[0] * J[1] + ne[1] * J[3], tt = ne[2] * J[0] + ne[3] * J[2], et = ne[2] * J[1] + ne[3] * J[3], te = (ve + et) / 2, Te = Math.sqrt((ve + et) ** 2 - 4 * (ve * et - tt * Se)) / 2, Ne = te + Te || 1, ke = te - Te || 1;
              return [Math.sqrt(Ne), Math.sqrt(ke)];
            }
            static normalizeRect(ne) {
              const J = ne.slice(0);
              return ne[0] > ne[2] && (J[0] = ne[2], J[2] = ne[0]), ne[1] > ne[3] && (J[1] = ne[3], J[3] = ne[1]), J;
            }
            static intersect(ne, J) {
              const ve = Math.max(Math.min(ne[0], ne[2]), Math.min(J[0], J[2])), Se = Math.min(Math.max(ne[0], ne[2]), Math.max(J[0], J[2]));
              if (ve > Se)
                return null;
              const tt = Math.max(Math.min(ne[1], ne[3]), Math.min(J[1], J[3])), et = Math.min(Math.max(ne[1], ne[3]), Math.max(J[1], J[3]));
              return tt > et ? null : [ve, tt, Se, et];
            }
            static bezierBoundingBox(ne, J, ve, Se, tt, et, te, Te) {
              const Ne = [], ke = [[], []];
              let $e, Be, Ze, Ae, Ke, Oe, U, u;
              for (let Q = 0; Q < 2; ++Q) {
                if (Q === 0 ? (Be = 6 * ne - 12 * ve + 6 * tt, $e = -3 * ne + 9 * ve - 9 * tt + 3 * te, Ze = 3 * ve - 3 * ne) : (Be = 6 * J - 12 * Se + 6 * et, $e = -3 * J + 9 * Se - 9 * et + 3 * Te, Ze = 3 * Se - 3 * J), Math.abs($e) < 1e-12) {
                  if (Math.abs(Be) < 1e-12)
                    continue;
                  Ae = -Ze / Be, 0 < Ae && Ae < 1 && Ne.push(Ae);
                  continue;
                }
                U = Be * Be - 4 * Ze * $e, u = Math.sqrt(U), !(U < 0) && (Ke = (-Be + u) / (2 * $e), 0 < Ke && Ke < 1 && Ne.push(Ke), Oe = (-Be - u) / (2 * $e), 0 < Oe && Oe < 1 && Ne.push(Oe));
              }
              let L = Ne.length, j;
              const V = L;
              for (; L--; )
                Ae = Ne[L], j = 1 - Ae, ke[0][L] = j * j * j * ne + 3 * j * j * Ae * ve + 3 * j * Ae * Ae * tt + Ae * Ae * Ae * te, ke[1][L] = j * j * j * J + 3 * j * j * Ae * Se + 3 * j * Ae * Ae * et + Ae * Ae * Ae * Te;
              return ke[0][V] = ne, ke[1][V] = J, ke[0][V + 1] = te, ke[1][V + 1] = Te, ke[0].length = ke[1].length = V + 2, [Math.min(...ke[0]), Math.min(...ke[1]), Math.max(...ke[0]), Math.max(...ke[1])];
            }
          }
          e.Util = Ee;
          const De = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 728, 711, 710, 729, 733, 731, 730, 732, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8226, 8224, 8225, 8230, 8212, 8211, 402, 8260, 8249, 8250, 8722, 8240, 8222, 8220, 8221, 8216, 8217, 8218, 8482, 64257, 64258, 321, 338, 352, 376, 381, 305, 322, 339, 353, 382, 0, 8364];
          function _e(de) {
            if (de[0] >= "ï") {
              let J;
              if (de[0] === "þ" && de[1] === "ÿ" ? J = "utf-16be" : de[0] === "ÿ" && de[1] === "þ" ? J = "utf-16le" : de[0] === "ï" && de[1] === "»" && de[2] === "¿" && (J = "utf-8"), J)
                try {
                  const ve = new TextDecoder(J, {
                    fatal: !0
                  }), Se = ae(de);
                  return ve.decode(Se);
                } catch (ve) {
                  Y(`stringToPDFString: "${ve}".`);
                }
            }
            const ne = [];
            for (let J = 0, ve = de.length; J < ve; J++) {
              const Se = De[de.charCodeAt(J)];
              ne.push(Se ? String.fromCharCode(Se) : de.charAt(J));
            }
            return ne.join("");
          }
          function ie(de) {
            return decodeURIComponent(escape(de));
          }
          function se(de) {
            return unescape(encodeURIComponent(de));
          }
          function ge(de) {
            return typeof de == "object" && (de == null ? void 0 : de.byteLength) !== void 0;
          }
          function Ce(de, ne) {
            if (de.length !== ne.length)
              return !1;
            for (let J = 0, ve = de.length; J < ve; J++)
              if (de[J] !== ne[J])
                return !1;
            return !0;
          }
          function xe(de = /* @__PURE__ */ new Date()) {
            return [de.getUTCFullYear().toString(), (de.getUTCMonth() + 1).toString().padStart(2, "0"), de.getUTCDate().toString().padStart(2, "0"), de.getUTCHours().toString().padStart(2, "0"), de.getUTCMinutes().toString().padStart(2, "0"), de.getUTCSeconds().toString().padStart(2, "0")].join("");
          }
          class He {
            constructor() {
              W(this, Ye, !1);
              this.promise = new Promise((ne, J) => {
                this.resolve = (ve) => {
                  oe(this, Ye, !0), ne(ve);
                }, this.reject = (ve) => {
                  oe(this, Ye, !0), J(ve);
                };
              });
            }
            get settled() {
              return a(this, Ye);
            }
          }
          Ye = new WeakMap(), e.PromiseCapability = He;
          let We = null, je = null;
          function ze(de) {
            return We || (We = /([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu, je = /* @__PURE__ */ new Map([["ﬅ", "ſt"]])), de.replaceAll(We, (ne, J, ve) => J ? J.normalize("NFKC") : je.get(ve));
          }
          function Xe() {
            if (typeof crypto < "u" && typeof (crypto == null ? void 0 : crypto.randomUUID) == "function")
              return crypto.randomUUID();
            const de = new Uint8Array(32);
            if (typeof crypto < "u" && typeof (crypto == null ? void 0 : crypto.getRandomValues) == "function")
              crypto.getRandomValues(de);
            else
              for (let ne = 0; ne < 32; ne++)
                de[ne] = Math.floor(Math.random() * 255);
            return z(de);
          }
          const Ge = "pdfjs_internal_id_";
          e.AnnotationPrefix = Ge;
        },
        /* 2 */
        /***/
        (__unused_webpack_module, exports, __w_pdfjs_require__) => {
          var t, i, n, s, ut, h, wt, c, o, r, T, S, w, C, P, b, Tt, F, x, Bt, p, E;
          Object.defineProperty(exports, "__esModule", {
            value: !0
          }), exports.RenderTask = exports.PDFWorkerUtil = exports.PDFWorker = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFDocumentLoadingTask = exports.PDFDataRangeTransport = exports.LoopbackPort = exports.DefaultStandardFontDataFactory = exports.DefaultFilterFactory = exports.DefaultCanvasFactory = exports.DefaultCMapReaderFactory = void 0, Object.defineProperty(exports, "SVGGraphics", {
            enumerable: !0,
            get: function() {
              return _displaySvg.SVGGraphics;
            }
          }), exports.build = void 0, exports.getDocument = getDocument, exports.version = void 0;
          var _util = __w_pdfjs_require__(1), _annotation_storage = __w_pdfjs_require__(3), _display_utils = __w_pdfjs_require__(6), _font_loader = __w_pdfjs_require__(9), _displayNode_utils = __w_pdfjs_require__(10), _canvas = __w_pdfjs_require__(11), _worker_options = __w_pdfjs_require__(14), _message_handler = __w_pdfjs_require__(15), _metadata = __w_pdfjs_require__(16), _optional_content_config = __w_pdfjs_require__(17), _transport_stream = __w_pdfjs_require__(18), _displayFetch_stream = __w_pdfjs_require__(19), _displayNetwork = __w_pdfjs_require__(22), _displayNode_stream = __w_pdfjs_require__(23), _displaySvg = __w_pdfjs_require__(24), _xfa_text = __w_pdfjs_require__(25);
          const DEFAULT_RANGE_CHUNK_SIZE = 65536, RENDERING_CANCELLED_TIMEOUT = 100, DELAYED_CLEANUP_TIMEOUT = 5e3, DefaultCanvasFactory = _util.isNodeJS ? _displayNode_utils.NodeCanvasFactory : _display_utils.DOMCanvasFactory;
          exports.DefaultCanvasFactory = DefaultCanvasFactory;
          const DefaultCMapReaderFactory = _util.isNodeJS ? _displayNode_utils.NodeCMapReaderFactory : _display_utils.DOMCMapReaderFactory;
          exports.DefaultCMapReaderFactory = DefaultCMapReaderFactory;
          const DefaultFilterFactory = _util.isNodeJS ? _displayNode_utils.NodeFilterFactory : _display_utils.DOMFilterFactory;
          exports.DefaultFilterFactory = DefaultFilterFactory;
          const DefaultStandardFontDataFactory = _util.isNodeJS ? _displayNode_utils.NodeStandardFontDataFactory : _display_utils.DOMStandardFontDataFactory;
          exports.DefaultStandardFontDataFactory = DefaultStandardFontDataFactory;
          function getDocument(M) {
            if (typeof M == "string" || M instanceof URL ? M = {
              url: M
            } : (0, _util.isArrayBuffer)(M) && (M = {
              data: M
            }), typeof M != "object")
              throw new Error("Invalid parameter in getDocument, need parameter object.");
            if (!M.url && !M.data && !M.range)
              throw new Error("Invalid parameter object: need either .data, .range or .url");
            const m = new PDFDocumentLoadingTask(), {
              docId: N
            } = m, D = M.url ? getUrlProp(M.url) : null, X = M.data ? getDataProp(M.data) : null, G = M.httpHeaders || null, I = M.withCredentials === !0, B = M.password ?? null, ee = M.range instanceof PDFDataRangeTransport ? M.range : null, Y = Number.isInteger(M.rangeChunkSize) && M.rangeChunkSize > 0 ? M.rangeChunkSize : DEFAULT_RANGE_CHUNK_SIZE;
            let q = M.worker instanceof PDFWorker ? M.worker : null;
            const le = M.verbosity, pe = typeof M.docBaseUrl == "string" && !(0, _display_utils.isDataScheme)(M.docBaseUrl) ? M.docBaseUrl : null, we = typeof M.cMapUrl == "string" ? M.cMapUrl : null, be = M.cMapPacked !== !1, R = M.CMapReaderFactory || DefaultCMapReaderFactory, d = typeof M.standardFontDataUrl == "string" ? M.standardFontDataUrl : null, g = M.StandardFontDataFactory || DefaultStandardFontDataFactory, f = M.stopAtErrors !== !0, v = Number.isInteger(M.maxImageSize) && M.maxImageSize > -1 ? M.maxImageSize : -1, A = M.isEvalSupported !== !1, O = typeof M.isOffscreenCanvasSupported == "boolean" ? M.isOffscreenCanvasSupported : !_util.isNodeJS, H = Number.isInteger(M.canvasMaxAreaInBytes) ? M.canvasMaxAreaInBytes : -1, z = typeof M.disableFontFace == "boolean" ? M.disableFontFace : _util.isNodeJS, ae = M.fontExtraProperties === !0, Z = M.enableXfa === !0, ce = M.ownerDocument || globalThis.document, ue = M.disableRange === !0, me = M.disableStream === !0, fe = M.disableAutoFetch === !0, Pe = M.pdfBug === !0, Fe = ee ? ee.length : M.length ?? NaN, Ee = typeof M.useSystemFonts == "boolean" ? M.useSystemFonts : !_util.isNodeJS && !z, De = typeof M.useWorkerFetch == "boolean" ? M.useWorkerFetch : R === _display_utils.DOMCMapReaderFactory && g === _display_utils.DOMStandardFontDataFactory && we && d && (0, _display_utils.isValidFetchUrl)(we, document.baseURI) && (0, _display_utils.isValidFetchUrl)(d, document.baseURI), _e = M.canvasFactory || new DefaultCanvasFactory({
              ownerDocument: ce
            }), ie = M.filterFactory || new DefaultFilterFactory({
              docId: N,
              ownerDocument: ce
            }), se = null;
            (0, _util.setVerbosityLevel)(le);
            const ge = {
              canvasFactory: _e,
              filterFactory: ie
            };
            if (De || (ge.cMapReaderFactory = new R({
              baseUrl: we,
              isCompressed: be
            }), ge.standardFontDataFactory = new g({
              baseUrl: d
            })), !q) {
              const He = {
                verbosity: le,
                port: _worker_options.GlobalWorkerOptions.workerPort
              };
              q = He.port ? PDFWorker.fromPort(He) : new PDFWorker(He), m._worker = q;
            }
            const Ce = {
              docId: N,
              apiVersion: "3.11.174",
              data: X,
              password: B,
              disableAutoFetch: fe,
              rangeChunkSize: Y,
              length: Fe,
              docBaseUrl: pe,
              enableXfa: Z,
              evaluatorOptions: {
                maxImageSize: v,
                disableFontFace: z,
                ignoreErrors: f,
                isEvalSupported: A,
                isOffscreenCanvasSupported: O,
                canvasMaxAreaInBytes: H,
                fontExtraProperties: ae,
                useSystemFonts: Ee,
                cMapUrl: De ? we : null,
                standardFontDataUrl: De ? d : null
              }
            }, xe = {
              ignoreErrors: f,
              isEvalSupported: A,
              disableFontFace: z,
              fontExtraProperties: ae,
              enableXfa: Z,
              ownerDocument: ce,
              disableAutoFetch: fe,
              pdfBug: Pe,
              styleElement: se
            };
            return q.promise.then(function() {
              if (m.destroyed)
                throw new Error("Loading aborted");
              const He = _fetchDocument(q, Ce), We = new Promise(function(je) {
                let ze;
                ee ? ze = new _transport_stream.PDFDataTransportStream({
                  length: Fe,
                  initialData: ee.initialData,
                  progressiveDone: ee.progressiveDone,
                  contentDispositionFilename: ee.contentDispositionFilename,
                  disableRange: ue,
                  disableStream: me
                }, ee) : X || (ze = ((Ge) => _util.isNodeJS ? new _displayNode_stream.PDFNodeStream(Ge) : (0, _display_utils.isValidFetchUrl)(Ge.url) ? new _displayFetch_stream.PDFFetchStream(Ge) : new _displayNetwork.PDFNetworkStream(Ge))({
                  url: D,
                  length: Fe,
                  httpHeaders: G,
                  withCredentials: I,
                  rangeChunkSize: Y,
                  disableRange: ue,
                  disableStream: me
                })), je(ze);
              });
              return Promise.all([He, We]).then(function([je, ze]) {
                if (m.destroyed)
                  throw new Error("Loading aborted");
                const Xe = new _message_handler.MessageHandler(N, je, q.port), Ge = new WorkerTransport(Xe, m, ze, xe, ge);
                m._transport = Ge, Xe.send("Ready", null);
              });
            }).catch(m._capability.reject), m;
          }
          async function _fetchDocument(M, m) {
            if (M.destroyed)
              throw new Error("Worker was destroyed");
            const N = await M.messageHandler.sendWithPromise("GetDocRequest", m, m.data ? [m.data.buffer] : null);
            if (M.destroyed)
              throw new Error("Worker was destroyed");
            return N;
          }
          function getUrlProp(M) {
            if (M instanceof URL)
              return M.href;
            try {
              return new URL(M, window.location).href;
            } catch {
              if (_util.isNodeJS && typeof M == "string")
                return M;
            }
            throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");
          }
          function getDataProp(M) {
            if (_util.isNodeJS && typeof Buffer < "u" && M instanceof Buffer)
              throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");
            if (M instanceof Uint8Array && M.byteLength === M.buffer.byteLength)
              return M;
            if (typeof M == "string")
              return (0, _util.stringToBytes)(M);
            if (typeof M == "object" && !isNaN(M == null ? void 0 : M.length) || (0, _util.isArrayBuffer)(M))
              return new Uint8Array(M);
            throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.");
          }
          const e = class e {
            constructor() {
              this._capability = new _util.PromiseCapability(), this._transport = null, this._worker = null, this.docId = `d${_t(e, t)._++}`, this.destroyed = !1, this.onPassword = null, this.onProgress = null;
            }
            get promise() {
              return this._capability.promise;
            }
            async destroy() {
              var m, N, D;
              this.destroyed = !0;
              try {
                (m = this._worker) != null && m.port && (this._worker._pendingDestroy = !0), await ((N = this._transport) == null ? void 0 : N.destroy());
              } catch (X) {
                throw (D = this._worker) != null && D.port && delete this._worker._pendingDestroy, X;
              }
              this._transport = null, this._worker && (this._worker.destroy(), this._worker = null);
            }
          };
          t = new WeakMap(), W(e, t, 0);
          let PDFDocumentLoadingTask = e;
          exports.PDFDocumentLoadingTask = PDFDocumentLoadingTask;
          class PDFDataRangeTransport {
            constructor(m, N, D = !1, X = null) {
              this.length = m, this.initialData = N, this.progressiveDone = D, this.contentDispositionFilename = X, this._rangeListeners = [], this._progressListeners = [], this._progressiveReadListeners = [], this._progressiveDoneListeners = [], this._readyCapability = new _util.PromiseCapability();
            }
            addRangeListener(m) {
              this._rangeListeners.push(m);
            }
            addProgressListener(m) {
              this._progressListeners.push(m);
            }
            addProgressiveReadListener(m) {
              this._progressiveReadListeners.push(m);
            }
            addProgressiveDoneListener(m) {
              this._progressiveDoneListeners.push(m);
            }
            onDataRange(m, N) {
              for (const D of this._rangeListeners)
                D(m, N);
            }
            onDataProgress(m, N) {
              this._readyCapability.promise.then(() => {
                for (const D of this._progressListeners)
                  D(m, N);
              });
            }
            onDataProgressiveRead(m) {
              this._readyCapability.promise.then(() => {
                for (const N of this._progressiveReadListeners)
                  N(m);
              });
            }
            onDataProgressiveDone() {
              this._readyCapability.promise.then(() => {
                for (const m of this._progressiveDoneListeners)
                  m();
              });
            }
            transportReady() {
              this._readyCapability.resolve();
            }
            requestDataRange(m, N) {
              (0, _util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange");
            }
            abort() {
            }
          }
          exports.PDFDataRangeTransport = PDFDataRangeTransport;
          class PDFDocumentProxy {
            constructor(m, N) {
              this._pdfInfo = m, this._transport = N, Object.defineProperty(this, "getJavaScript", {
                value: () => ((0, _display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."), this.getJSActions().then((D) => {
                  if (!D)
                    return D;
                  const X = [];
                  for (const G in D)
                    X.push(...D[G]);
                  return X;
                }))
              });
            }
            get annotationStorage() {
              return this._transport.annotationStorage;
            }
            get filterFactory() {
              return this._transport.filterFactory;
            }
            get numPages() {
              return this._pdfInfo.numPages;
            }
            get fingerprints() {
              return this._pdfInfo.fingerprints;
            }
            get isPureXfa() {
              return (0, _util.shadow)(this, "isPureXfa", !!this._transport._htmlForXfa);
            }
            get allXfaHtml() {
              return this._transport._htmlForXfa;
            }
            getPage(m) {
              return this._transport.getPage(m);
            }
            getPageIndex(m) {
              return this._transport.getPageIndex(m);
            }
            getDestinations() {
              return this._transport.getDestinations();
            }
            getDestination(m) {
              return this._transport.getDestination(m);
            }
            getPageLabels() {
              return this._transport.getPageLabels();
            }
            getPageLayout() {
              return this._transport.getPageLayout();
            }
            getPageMode() {
              return this._transport.getPageMode();
            }
            getViewerPreferences() {
              return this._transport.getViewerPreferences();
            }
            getOpenAction() {
              return this._transport.getOpenAction();
            }
            getAttachments() {
              return this._transport.getAttachments();
            }
            getJSActions() {
              return this._transport.getDocJSActions();
            }
            getOutline() {
              return this._transport.getOutline();
            }
            getOptionalContentConfig() {
              return this._transport.getOptionalContentConfig();
            }
            getPermissions() {
              return this._transport.getPermissions();
            }
            getMetadata() {
              return this._transport.getMetadata();
            }
            getMarkInfo() {
              return this._transport.getMarkInfo();
            }
            getData() {
              return this._transport.getData();
            }
            saveDocument() {
              return this._transport.saveDocument();
            }
            getDownloadInfo() {
              return this._transport.downloadInfoCapability.promise;
            }
            cleanup(m = !1) {
              return this._transport.startCleanup(m || this.isPureXfa);
            }
            destroy() {
              return this.loadingTask.destroy();
            }
            get loadingParams() {
              return this._transport.loadingParams;
            }
            get loadingTask() {
              return this._transport.loadingTask;
            }
            getFieldObjects() {
              return this._transport.getFieldObjects();
            }
            hasJSActions() {
              return this._transport.hasJSActions();
            }
            getCalculationOrderIds() {
              return this._transport.getCalculationOrderIds();
            }
          }
          exports.PDFDocumentProxy = PDFDocumentProxy;
          class PDFPageProxy {
            constructor(m, N, D, X = !1) {
              W(this, s);
              W(this, h);
              W(this, i, null);
              W(this, n, !1);
              this._pageIndex = m, this._pageInfo = N, this._transport = D, this._stats = X ? new _display_utils.StatTimer() : null, this._pdfBug = X, this.commonObjs = D.commonObjs, this.objs = new PDFObjects(), this._maybeCleanupAfterRender = !1, this._intentStates = /* @__PURE__ */ new Map(), this.destroyed = !1;
            }
            get pageNumber() {
              return this._pageIndex + 1;
            }
            get rotate() {
              return this._pageInfo.rotate;
            }
            get ref() {
              return this._pageInfo.ref;
            }
            get userUnit() {
              return this._pageInfo.userUnit;
            }
            get view() {
              return this._pageInfo.view;
            }
            getViewport({
              scale: m,
              rotation: N = this.rotate,
              offsetX: D = 0,
              offsetY: X = 0,
              dontFlip: G = !1
            } = {}) {
              return new _display_utils.PageViewport({
                viewBox: this.view,
                scale: m,
                rotation: N,
                offsetX: D,
                offsetY: X,
                dontFlip: G
              });
            }
            getAnnotations({
              intent: m = "display"
            } = {}) {
              const N = this._transport.getRenderingIntent(m);
              return this._transport.getAnnotations(this._pageIndex, N.renderingIntent);
            }
            getJSActions() {
              return this._transport.getPageJSActions(this._pageIndex);
            }
            get filterFactory() {
              return this._transport.filterFactory;
            }
            get isPureXfa() {
              return (0, _util.shadow)(this, "isPureXfa", !!this._transport._htmlForXfa);
            }
            async getXfa() {
              var m;
              return ((m = this._transport._htmlForXfa) == null ? void 0 : m.children[this._pageIndex]) || null;
            }
            render({
              canvasContext: m,
              viewport: N,
              intent: D = "display",
              annotationMode: X = _util.AnnotationMode.ENABLE,
              transform: G = null,
              background: I = null,
              optionalContentConfigPromise: B = null,
              annotationCanvasMap: ee = null,
              pageColors: Y = null,
              printAnnotationStorage: q = null
            }) {
              var g, f;
              (g = this._stats) == null || g.time("Overall");
              const le = this._transport.getRenderingIntent(D, X, q);
              oe(this, n, !1), K(this, h, wt).call(this), B || (B = this._transport.getOptionalContentConfig());
              let pe = this._intentStates.get(le.cacheKey);
              pe || (pe = /* @__PURE__ */ Object.create(null), this._intentStates.set(le.cacheKey, pe)), pe.streamReaderCancelTimeout && (clearTimeout(pe.streamReaderCancelTimeout), pe.streamReaderCancelTimeout = null);
              const we = !!(le.renderingIntent & _util.RenderingIntentFlag.PRINT);
              pe.displayReadyCapability || (pe.displayReadyCapability = new _util.PromiseCapability(), pe.operatorList = {
                fnArray: [],
                argsArray: [],
                lastChunk: !1,
                separateAnnots: null
              }, (f = this._stats) == null || f.time("Page Request"), this._pumpOperatorList(le));
              const be = (v) => {
                var A, O;
                pe.renderTasks.delete(R), (this._maybeCleanupAfterRender || we) && oe(this, n, !0), K(this, s, ut).call(this, !we), v ? (R.capability.reject(v), this._abortOperatorList({
                  intentState: pe,
                  reason: v instanceof Error ? v : new Error(v)
                })) : R.capability.resolve(), (A = this._stats) == null || A.timeEnd("Rendering"), (O = this._stats) == null || O.timeEnd("Overall");
              }, R = new InternalRenderTask({
                callback: be,
                params: {
                  canvasContext: m,
                  viewport: N,
                  transform: G,
                  background: I
                },
                objs: this.objs,
                commonObjs: this.commonObjs,
                annotationCanvasMap: ee,
                operatorList: pe.operatorList,
                pageIndex: this._pageIndex,
                canvasFactory: this._transport.canvasFactory,
                filterFactory: this._transport.filterFactory,
                useRequestAnimationFrame: !we,
                pdfBug: this._pdfBug,
                pageColors: Y
              });
              (pe.renderTasks || (pe.renderTasks = /* @__PURE__ */ new Set())).add(R);
              const d = R.task;
              return Promise.all([pe.displayReadyCapability.promise, B]).then(([v, A]) => {
                var O;
                if (this.destroyed) {
                  be();
                  return;
                }
                (O = this._stats) == null || O.time("Rendering"), R.initializeGraphics({
                  transparency: v,
                  optionalContentConfig: A
                }), R.operatorListChanged();
              }).catch(be), d;
            }
            getOperatorList({
              intent: m = "display",
              annotationMode: N = _util.AnnotationMode.ENABLE,
              printAnnotationStorage: D = null
            } = {}) {
              var ee;
              function X() {
                I.operatorList.lastChunk && (I.opListReadCapability.resolve(I.operatorList), I.renderTasks.delete(B));
              }
              const G = this._transport.getRenderingIntent(m, N, D, !0);
              let I = this._intentStates.get(G.cacheKey);
              I || (I = /* @__PURE__ */ Object.create(null), this._intentStates.set(G.cacheKey, I));
              let B;
              return I.opListReadCapability || (B = /* @__PURE__ */ Object.create(null), B.operatorListChanged = X, I.opListReadCapability = new _util.PromiseCapability(), (I.renderTasks || (I.renderTasks = /* @__PURE__ */ new Set())).add(B), I.operatorList = {
                fnArray: [],
                argsArray: [],
                lastChunk: !1,
                separateAnnots: null
              }, (ee = this._stats) == null || ee.time("Page Request"), this._pumpOperatorList(G)), I.opListReadCapability.promise;
            }
            streamTextContent({
              includeMarkedContent: m = !1,
              disableNormalization: N = !1
            } = {}) {
              return this._transport.messageHandler.sendWithStream("GetTextContent", {
                pageIndex: this._pageIndex,
                includeMarkedContent: m === !0,
                disableNormalization: N === !0
              }, {
                highWaterMark: 100,
                size(X) {
                  return X.items.length;
                }
              });
            }
            getTextContent(m = {}) {
              if (this._transport._htmlForXfa)
                return this.getXfa().then((D) => _xfa_text.XfaText.textContent(D));
              const N = this.streamTextContent(m);
              return new Promise(function(D, X) {
                function G() {
                  I.read().then(function({
                    value: ee,
                    done: Y
                  }) {
                    if (Y) {
                      D(B);
                      return;
                    }
                    Object.assign(B.styles, ee.styles), B.items.push(...ee.items), G();
                  }, X);
                }
                const I = N.getReader(), B = {
                  items: [],
                  styles: /* @__PURE__ */ Object.create(null)
                };
                G();
              });
            }
            getStructTree() {
              return this._transport.getStructTree(this._pageIndex);
            }
            _destroy() {
              this.destroyed = !0;
              const m = [];
              for (const N of this._intentStates.values())
                if (this._abortOperatorList({
                  intentState: N,
                  reason: new Error("Page was destroyed."),
                  force: !0
                }), !N.opListReadCapability)
                  for (const D of N.renderTasks)
                    m.push(D.completed), D.cancel();
              return this.objs.clear(), oe(this, n, !1), K(this, h, wt).call(this), Promise.all(m);
            }
            cleanup(m = !1) {
              oe(this, n, !0);
              const N = K(this, s, ut).call(this, !1);
              return m && N && this._stats && (this._stats = new _display_utils.StatTimer()), N;
            }
            _startRenderPage(m, N) {
              var X, G;
              const D = this._intentStates.get(N);
              D && ((X = this._stats) == null || X.timeEnd("Page Request"), (G = D.displayReadyCapability) == null || G.resolve(m));
            }
            _renderPageChunk(m, N) {
              for (let D = 0, X = m.length; D < X; D++)
                N.operatorList.fnArray.push(m.fnArray[D]), N.operatorList.argsArray.push(m.argsArray[D]);
              N.operatorList.lastChunk = m.lastChunk, N.operatorList.separateAnnots = m.separateAnnots;
              for (const D of N.renderTasks)
                D.operatorListChanged();
              m.lastChunk && K(this, s, ut).call(this, !0);
            }
            _pumpOperatorList({
              renderingIntent: m,
              cacheKey: N,
              annotationStorageSerializable: D
            }) {
              const {
                map: X,
                transfers: G
              } = D, B = this._transport.messageHandler.sendWithStream("GetOperatorList", {
                pageIndex: this._pageIndex,
                intent: m,
                cacheKey: N,
                annotationStorage: X
              }, G).getReader(), ee = this._intentStates.get(N);
              ee.streamReader = B;
              const Y = () => {
                B.read().then(({
                  value: q,
                  done: le
                }) => {
                  if (le) {
                    ee.streamReader = null;
                    return;
                  }
                  this._transport.destroyed || (this._renderPageChunk(q, ee), Y());
                }, (q) => {
                  if (ee.streamReader = null, !this._transport.destroyed) {
                    if (ee.operatorList) {
                      ee.operatorList.lastChunk = !0;
                      for (const le of ee.renderTasks)
                        le.operatorListChanged();
                      K(this, s, ut).call(this, !0);
                    }
                    if (ee.displayReadyCapability)
                      ee.displayReadyCapability.reject(q);
                    else if (ee.opListReadCapability)
                      ee.opListReadCapability.reject(q);
                    else
                      throw q;
                  }
                });
              };
              Y();
            }
            _abortOperatorList({
              intentState: m,
              reason: N,
              force: D = !1
            }) {
              if (m.streamReader) {
                if (m.streamReaderCancelTimeout && (clearTimeout(m.streamReaderCancelTimeout), m.streamReaderCancelTimeout = null), !D) {
                  if (m.renderTasks.size > 0)
                    return;
                  if (N instanceof _display_utils.RenderingCancelledException) {
                    let X = RENDERING_CANCELLED_TIMEOUT;
                    N.extraDelay > 0 && N.extraDelay < 1e3 && (X += N.extraDelay), m.streamReaderCancelTimeout = setTimeout(() => {
                      m.streamReaderCancelTimeout = null, this._abortOperatorList({
                        intentState: m,
                        reason: N,
                        force: !0
                      });
                    }, X);
                    return;
                  }
                }
                if (m.streamReader.cancel(new _util.AbortException(N.message)).catch(() => {
                }), m.streamReader = null, !this._transport.destroyed) {
                  for (const [X, G] of this._intentStates)
                    if (G === m) {
                      this._intentStates.delete(X);
                      break;
                    }
                  this.cleanup();
                }
              }
            }
            get stats() {
              return this._stats;
            }
          }
          i = new WeakMap(), n = new WeakMap(), s = new WeakSet(), ut = function(m = !1) {
            if (K(this, h, wt).call(this), !a(this, n) || this.destroyed)
              return !1;
            if (m)
              return oe(this, i, setTimeout(() => {
                oe(this, i, null), K(this, s, ut).call(this, !1);
              }, DELAYED_CLEANUP_TIMEOUT)), !1;
            for (const {
              renderTasks: N,
              operatorList: D
            } of this._intentStates.values())
              if (N.size > 0 || !D.lastChunk)
                return !1;
            return this._intentStates.clear(), this.objs.clear(), oe(this, n, !1), !0;
          }, h = new WeakSet(), wt = function() {
            a(this, i) && (clearTimeout(a(this, i)), oe(this, i, null));
          }, exports.PDFPageProxy = PDFPageProxy;
          class LoopbackPort {
            constructor() {
              W(this, c, /* @__PURE__ */ new Set());
              W(this, o, Promise.resolve());
            }
            postMessage(m, N) {
              const D = {
                data: structuredClone(m, N ? {
                  transfer: N
                } : null)
              };
              a(this, o).then(() => {
                for (const X of a(this, c))
                  X.call(this, D);
              });
            }
            addEventListener(m, N) {
              a(this, c).add(N);
            }
            removeEventListener(m, N) {
              a(this, c).delete(N);
            }
            terminate() {
              a(this, c).clear();
            }
          }
          c = new WeakMap(), o = new WeakMap(), exports.LoopbackPort = LoopbackPort;
          const PDFWorkerUtil = {
            isWorkerDisabled: !1,
            fallbackWorkerSrc: null,
            fakeWorkerId: 0
          };
          exports.PDFWorkerUtil = PDFWorkerUtil;
          {
            if (_util.isNodeJS && typeof commonjsRequire == "function")
              PDFWorkerUtil.isWorkerDisabled = !0, PDFWorkerUtil.fallbackWorkerSrc = "./pdf.worker.js";
            else if (typeof document == "object") {
              const M = (r = document == null ? void 0 : document.currentScript) == null ? void 0 : r.src;
              M && (PDFWorkerUtil.fallbackWorkerSrc = M.replace(/(\.(?:min\.)?js)(\?.*)?$/i, ".worker$1$2"));
            }
            PDFWorkerUtil.isSameOrigin = function(M, m) {
              let N;
              try {
                if (N = new URL(M), !N.origin || N.origin === "null")
                  return !1;
              } catch {
                return !1;
              }
              const D = new URL(m, N);
              return N.origin === D.origin;
            }, PDFWorkerUtil.createCDNWrapper = function(M) {
              const m = `importScripts("${M}");`;
              return URL.createObjectURL(new Blob([m]));
            };
          }
          const _PDFWorker = class _PDFWorker {
            constructor({
              name: M = null,
              port: m = null,
              verbosity: N = (0, _util.getVerbosityLevel)()
            } = {}) {
              var D;
              if (this.name = M, this.destroyed = !1, this.verbosity = N, this._readyCapability = new _util.PromiseCapability(), this._port = null, this._webWorker = null, this._messageHandler = null, m) {
                if ((D = a(_PDFWorker, T)) != null && D.has(m))
                  throw new Error("Cannot use more than one PDFWorker per port.");
                (a(_PDFWorker, T) || oe(_PDFWorker, T, /* @__PURE__ */ new WeakMap())).set(m, this), this._initializeFromPort(m);
                return;
              }
              this._initialize();
            }
            get promise() {
              return this._readyCapability.promise;
            }
            get port() {
              return this._port;
            }
            get messageHandler() {
              return this._messageHandler;
            }
            _initializeFromPort(M) {
              this._port = M, this._messageHandler = new _message_handler.MessageHandler("main", "worker", M), this._messageHandler.on("ready", function() {
              }), this._readyCapability.resolve(), this._messageHandler.send("configure", {
                verbosity: this.verbosity
              });
            }
            _initialize() {
              if (!PDFWorkerUtil.isWorkerDisabled && !_PDFWorker._mainThreadWorkerMessageHandler) {
                let {
                  workerSrc: M
                } = _PDFWorker;
                try {
                  PDFWorkerUtil.isSameOrigin(window.location.href, M) || (M = PDFWorkerUtil.createCDNWrapper(new URL(M, window.location).href));
                  const m = new Worker(M), N = new _message_handler.MessageHandler("main", "worker", m), D = () => {
                    m.removeEventListener("error", X), N.destroy(), m.terminate(), this.destroyed ? this._readyCapability.reject(new Error("Worker was destroyed")) : this._setupFakeWorker();
                  }, X = () => {
                    this._webWorker || D();
                  };
                  m.addEventListener("error", X), N.on("test", (I) => {
                    if (m.removeEventListener("error", X), this.destroyed) {
                      D();
                      return;
                    }
                    I ? (this._messageHandler = N, this._port = m, this._webWorker = m, this._readyCapability.resolve(), N.send("configure", {
                      verbosity: this.verbosity
                    })) : (this._setupFakeWorker(), N.destroy(), m.terminate());
                  }), N.on("ready", (I) => {
                    if (m.removeEventListener("error", X), this.destroyed) {
                      D();
                      return;
                    }
                    try {
                      G();
                    } catch {
                      this._setupFakeWorker();
                    }
                  });
                  const G = () => {
                    const I = new Uint8Array();
                    N.send("test", I, [I.buffer]);
                  };
                  G();
                  return;
                } catch {
                  (0, _util.info)("The worker has been disabled.");
                }
              }
              this._setupFakeWorker();
            }
            _setupFakeWorker() {
              PDFWorkerUtil.isWorkerDisabled || ((0, _util.warn)("Setting up fake worker."), PDFWorkerUtil.isWorkerDisabled = !0), _PDFWorker._setupFakeWorkerGlobal.then((M) => {
                if (this.destroyed) {
                  this._readyCapability.reject(new Error("Worker was destroyed"));
                  return;
                }
                const m = new LoopbackPort();
                this._port = m;
                const N = `fake${PDFWorkerUtil.fakeWorkerId++}`, D = new _message_handler.MessageHandler(N + "_worker", N, m);
                M.setup(D, m);
                const X = new _message_handler.MessageHandler(N, N + "_worker", m);
                this._messageHandler = X, this._readyCapability.resolve(), X.send("configure", {
                  verbosity: this.verbosity
                });
              }).catch((M) => {
                this._readyCapability.reject(new Error(`Setting up fake worker failed: "${M.message}".`));
              });
            }
            destroy() {
              var M;
              this.destroyed = !0, this._webWorker && (this._webWorker.terminate(), this._webWorker = null), (M = a(_PDFWorker, T)) == null || M.delete(this._port), this._port = null, this._messageHandler && (this._messageHandler.destroy(), this._messageHandler = null);
            }
            static fromPort(M) {
              var N;
              if (!(M != null && M.port))
                throw new Error("PDFWorker.fromPort - invalid method signature.");
              const m = (N = a(this, T)) == null ? void 0 : N.get(M.port);
              if (m) {
                if (m._pendingDestroy)
                  throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");
                return m;
              }
              return new _PDFWorker(M);
            }
            static get workerSrc() {
              if (_worker_options.GlobalWorkerOptions.workerSrc)
                return _worker_options.GlobalWorkerOptions.workerSrc;
              if (PDFWorkerUtil.fallbackWorkerSrc !== null)
                return _util.isNodeJS || (0, _display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'), PDFWorkerUtil.fallbackWorkerSrc;
              throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
            }
            static get _mainThreadWorkerMessageHandler() {
              var M;
              try {
                return ((M = globalThis.pdfjsWorker) == null ? void 0 : M.WorkerMessageHandler) || null;
              } catch {
                return null;
              }
            }
            static get _setupFakeWorkerGlobal() {
              const loader = async () => {
                const mainWorkerMessageHandler = this._mainThreadWorkerMessageHandler;
                if (mainWorkerMessageHandler)
                  return mainWorkerMessageHandler;
                if (_util.isNodeJS && typeof commonjsRequire == "function") {
                  const worker = eval("require")(this.workerSrc);
                  return worker.WorkerMessageHandler;
                }
                return await (0, _display_utils.loadScript)(this.workerSrc), window.pdfjsWorker.WorkerMessageHandler;
              };
              return (0, _util.shadow)(this, "_setupFakeWorkerGlobal", loader());
            }
          };
          T = new WeakMap(), W(_PDFWorker, T, void 0);
          let PDFWorker = _PDFWorker;
          exports.PDFWorker = PDFWorker;
          class WorkerTransport {
            constructor(m, N, D, X, G) {
              W(this, b);
              W(this, S, /* @__PURE__ */ new Map());
              W(this, w, /* @__PURE__ */ new Map());
              W(this, C, /* @__PURE__ */ new Map());
              W(this, P, null);
              this.messageHandler = m, this.loadingTask = N, this.commonObjs = new PDFObjects(), this.fontLoader = new _font_loader.FontLoader({
                ownerDocument: X.ownerDocument,
                styleElement: X.styleElement
              }), this._params = X, this.canvasFactory = G.canvasFactory, this.filterFactory = G.filterFactory, this.cMapReaderFactory = G.cMapReaderFactory, this.standardFontDataFactory = G.standardFontDataFactory, this.destroyed = !1, this.destroyCapability = null, this._networkStream = D, this._fullReader = null, this._lastProgress = null, this.downloadInfoCapability = new _util.PromiseCapability(), this.setupMessageHandler();
            }
            get annotationStorage() {
              return (0, _util.shadow)(this, "annotationStorage", new _annotation_storage.AnnotationStorage());
            }
            getRenderingIntent(m, N = _util.AnnotationMode.ENABLE, D = null, X = !1) {
              let G = _util.RenderingIntentFlag.DISPLAY, I = _annotation_storage.SerializableEmpty;
              switch (m) {
                case "any":
                  G = _util.RenderingIntentFlag.ANY;
                  break;
                case "display":
                  break;
                case "print":
                  G = _util.RenderingIntentFlag.PRINT;
                  break;
                default:
                  (0, _util.warn)(`getRenderingIntent - invalid intent: ${m}`);
              }
              switch (N) {
                case _util.AnnotationMode.DISABLE:
                  G += _util.RenderingIntentFlag.ANNOTATIONS_DISABLE;
                  break;
                case _util.AnnotationMode.ENABLE:
                  break;
                case _util.AnnotationMode.ENABLE_FORMS:
                  G += _util.RenderingIntentFlag.ANNOTATIONS_FORMS;
                  break;
                case _util.AnnotationMode.ENABLE_STORAGE:
                  G += _util.RenderingIntentFlag.ANNOTATIONS_STORAGE, I = (G & _util.RenderingIntentFlag.PRINT && D instanceof _annotation_storage.PrintAnnotationStorage ? D : this.annotationStorage).serializable;
                  break;
                default:
                  (0, _util.warn)(`getRenderingIntent - invalid annotationMode: ${N}`);
              }
              return X && (G += _util.RenderingIntentFlag.OPLIST), {
                renderingIntent: G,
                cacheKey: `${G}_${I.hash}`,
                annotationStorageSerializable: I
              };
            }
            destroy() {
              var D;
              if (this.destroyCapability)
                return this.destroyCapability.promise;
              this.destroyed = !0, this.destroyCapability = new _util.PromiseCapability(), (D = a(this, P)) == null || D.reject(new Error("Worker was destroyed during onPassword callback"));
              const m = [];
              for (const X of a(this, w).values())
                m.push(X._destroy());
              a(this, w).clear(), a(this, C).clear(), this.hasOwnProperty("annotationStorage") && this.annotationStorage.resetModified();
              const N = this.messageHandler.sendWithPromise("Terminate", null);
              return m.push(N), Promise.all(m).then(() => {
                var X;
                this.commonObjs.clear(), this.fontLoader.clear(), a(this, S).clear(), this.filterFactory.destroy(), (X = this._networkStream) == null || X.cancelAllRequests(new _util.AbortException("Worker was terminated.")), this.messageHandler && (this.messageHandler.destroy(), this.messageHandler = null), this.destroyCapability.resolve();
              }, this.destroyCapability.reject), this.destroyCapability.promise;
            }
            setupMessageHandler() {
              const {
                messageHandler: m,
                loadingTask: N
              } = this;
              m.on("GetReader", (D, X) => {
                (0, _util.assert)(this._networkStream, "GetReader - no `IPDFStream` instance available."), this._fullReader = this._networkStream.getFullReader(), this._fullReader.onProgress = (G) => {
                  this._lastProgress = {
                    loaded: G.loaded,
                    total: G.total
                  };
                }, X.onPull = () => {
                  this._fullReader.read().then(function({
                    value: G,
                    done: I
                  }) {
                    if (I) {
                      X.close();
                      return;
                    }
                    (0, _util.assert)(G instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer."), X.enqueue(new Uint8Array(G), 1, [G]);
                  }).catch((G) => {
                    X.error(G);
                  });
                }, X.onCancel = (G) => {
                  this._fullReader.cancel(G), X.ready.catch((I) => {
                    if (!this.destroyed)
                      throw I;
                  });
                };
              }), m.on("ReaderHeadersReady", (D) => {
                const X = new _util.PromiseCapability(), G = this._fullReader;
                return G.headersReady.then(() => {
                  var I;
                  (!G.isStreamingSupported || !G.isRangeSupported) && (this._lastProgress && ((I = N.onProgress) == null || I.call(N, this._lastProgress)), G.onProgress = (B) => {
                    var ee;
                    (ee = N.onProgress) == null || ee.call(N, {
                      loaded: B.loaded,
                      total: B.total
                    });
                  }), X.resolve({
                    isStreamingSupported: G.isStreamingSupported,
                    isRangeSupported: G.isRangeSupported,
                    contentLength: G.contentLength
                  });
                }, X.reject), X.promise;
              }), m.on("GetRangeReader", (D, X) => {
                (0, _util.assert)(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
                const G = this._networkStream.getRangeReader(D.begin, D.end);
                if (!G) {
                  X.close();
                  return;
                }
                X.onPull = () => {
                  G.read().then(function({
                    value: I,
                    done: B
                  }) {
                    if (B) {
                      X.close();
                      return;
                    }
                    (0, _util.assert)(I instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer."), X.enqueue(new Uint8Array(I), 1, [I]);
                  }).catch((I) => {
                    X.error(I);
                  });
                }, X.onCancel = (I) => {
                  G.cancel(I), X.ready.catch((B) => {
                    if (!this.destroyed)
                      throw B;
                  });
                };
              }), m.on("GetDoc", ({
                pdfInfo: D
              }) => {
                this._numPages = D.numPages, this._htmlForXfa = D.htmlForXfa, delete D.htmlForXfa, N._capability.resolve(new PDFDocumentProxy(D, this));
              }), m.on("DocException", function(D) {
                let X;
                switch (D.name) {
                  case "PasswordException":
                    X = new _util.PasswordException(D.message, D.code);
                    break;
                  case "InvalidPDFException":
                    X = new _util.InvalidPDFException(D.message);
                    break;
                  case "MissingPDFException":
                    X = new _util.MissingPDFException(D.message);
                    break;
                  case "UnexpectedResponseException":
                    X = new _util.UnexpectedResponseException(D.message, D.status);
                    break;
                  case "UnknownErrorException":
                    X = new _util.UnknownErrorException(D.message, D.details);
                    break;
                  default:
                    (0, _util.unreachable)("DocException - expected a valid Error.");
                }
                N._capability.reject(X);
              }), m.on("PasswordRequest", (D) => {
                if (oe(this, P, new _util.PromiseCapability()), N.onPassword) {
                  const X = (G) => {
                    G instanceof Error ? a(this, P).reject(G) : a(this, P).resolve({
                      password: G
                    });
                  };
                  try {
                    N.onPassword(X, D.code);
                  } catch (G) {
                    a(this, P).reject(G);
                  }
                } else
                  a(this, P).reject(new _util.PasswordException(D.message, D.code));
                return a(this, P).promise;
              }), m.on("DataLoaded", (D) => {
                var X;
                (X = N.onProgress) == null || X.call(N, {
                  loaded: D.length,
                  total: D.length
                }), this.downloadInfoCapability.resolve(D);
              }), m.on("StartRenderPage", (D) => {
                if (this.destroyed)
                  return;
                a(this, w).get(D.pageIndex)._startRenderPage(D.transparency, D.cacheKey);
              }), m.on("commonobj", ([D, X, G]) => {
                var I;
                if (!this.destroyed && !this.commonObjs.has(D))
                  switch (X) {
                    case "Font":
                      const B = this._params;
                      if ("error" in G) {
                        const q = G.error;
                        (0, _util.warn)(`Error during font loading: ${q}`), this.commonObjs.resolve(D, q);
                        break;
                      }
                      const ee = B.pdfBug && ((I = globalThis.FontInspector) != null && I.enabled) ? (q, le) => globalThis.FontInspector.fontAdded(q, le) : null, Y = new _font_loader.FontFaceObject(G, {
                        isEvalSupported: B.isEvalSupported,
                        disableFontFace: B.disableFontFace,
                        ignoreErrors: B.ignoreErrors,
                        inspectFont: ee
                      });
                      this.fontLoader.bind(Y).catch((q) => m.sendWithPromise("FontFallback", {
                        id: D
                      })).finally(() => {
                        !B.fontExtraProperties && Y.data && (Y.data = null), this.commonObjs.resolve(D, Y);
                      });
                      break;
                    case "FontPath":
                    case "Image":
                    case "Pattern":
                      this.commonObjs.resolve(D, G);
                      break;
                    default:
                      throw new Error(`Got unknown common object type ${X}`);
                  }
              }), m.on("obj", ([D, X, G, I]) => {
                var ee;
                if (this.destroyed)
                  return;
                const B = a(this, w).get(X);
                if (!B.objs.has(D))
                  switch (G) {
                    case "Image":
                      if (B.objs.resolve(D, I), I) {
                        let Y;
                        if (I.bitmap) {
                          const {
                            width: q,
                            height: le
                          } = I;
                          Y = q * le * 4;
                        } else
                          Y = ((ee = I.data) == null ? void 0 : ee.length) || 0;
                        Y > _util.MAX_IMAGE_SIZE_TO_CACHE && (B._maybeCleanupAfterRender = !0);
                      }
                      break;
                    case "Pattern":
                      B.objs.resolve(D, I);
                      break;
                    default:
                      throw new Error(`Got unknown object type ${G}`);
                  }
              }), m.on("DocProgress", (D) => {
                var X;
                this.destroyed || (X = N.onProgress) == null || X.call(N, {
                  loaded: D.loaded,
                  total: D.total
                });
              }), m.on("FetchBuiltInCMap", (D) => this.destroyed ? Promise.reject(new Error("Worker was destroyed.")) : this.cMapReaderFactory ? this.cMapReaderFactory.fetch(D) : Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))), m.on("FetchStandardFontData", (D) => this.destroyed ? Promise.reject(new Error("Worker was destroyed.")) : this.standardFontDataFactory ? this.standardFontDataFactory.fetch(D) : Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")));
            }
            getData() {
              return this.messageHandler.sendWithPromise("GetData", null);
            }
            saveDocument() {
              var D;
              this.annotationStorage.size <= 0 && (0, _util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");
              const {
                map: m,
                transfers: N
              } = this.annotationStorage.serializable;
              return this.messageHandler.sendWithPromise("SaveDocument", {
                isPureXfa: !!this._htmlForXfa,
                numPages: this._numPages,
                annotationStorage: m,
                filename: ((D = this._fullReader) == null ? void 0 : D.filename) ?? null
              }, N).finally(() => {
                this.annotationStorage.resetModified();
              });
            }
            getPage(m) {
              if (!Number.isInteger(m) || m <= 0 || m > this._numPages)
                return Promise.reject(new Error("Invalid page request."));
              const N = m - 1, D = a(this, C).get(N);
              if (D)
                return D;
              const X = this.messageHandler.sendWithPromise("GetPage", {
                pageIndex: N
              }).then((G) => {
                if (this.destroyed)
                  throw new Error("Transport destroyed");
                const I = new PDFPageProxy(N, G, this, this._params.pdfBug);
                return a(this, w).set(N, I), I;
              });
              return a(this, C).set(N, X), X;
            }
            getPageIndex(m) {
              return typeof m != "object" || m === null || !Number.isInteger(m.num) || m.num < 0 || !Number.isInteger(m.gen) || m.gen < 0 ? Promise.reject(new Error("Invalid pageIndex request.")) : this.messageHandler.sendWithPromise("GetPageIndex", {
                num: m.num,
                gen: m.gen
              });
            }
            getAnnotations(m, N) {
              return this.messageHandler.sendWithPromise("GetAnnotations", {
                pageIndex: m,
                intent: N
              });
            }
            getFieldObjects() {
              return K(this, b, Tt).call(this, "GetFieldObjects");
            }
            hasJSActions() {
              return K(this, b, Tt).call(this, "HasJSActions");
            }
            getCalculationOrderIds() {
              return this.messageHandler.sendWithPromise("GetCalculationOrderIds", null);
            }
            getDestinations() {
              return this.messageHandler.sendWithPromise("GetDestinations", null);
            }
            getDestination(m) {
              return typeof m != "string" ? Promise.reject(new Error("Invalid destination request.")) : this.messageHandler.sendWithPromise("GetDestination", {
                id: m
              });
            }
            getPageLabels() {
              return this.messageHandler.sendWithPromise("GetPageLabels", null);
            }
            getPageLayout() {
              return this.messageHandler.sendWithPromise("GetPageLayout", null);
            }
            getPageMode() {
              return this.messageHandler.sendWithPromise("GetPageMode", null);
            }
            getViewerPreferences() {
              return this.messageHandler.sendWithPromise("GetViewerPreferences", null);
            }
            getOpenAction() {
              return this.messageHandler.sendWithPromise("GetOpenAction", null);
            }
            getAttachments() {
              return this.messageHandler.sendWithPromise("GetAttachments", null);
            }
            getDocJSActions() {
              return K(this, b, Tt).call(this, "GetDocJSActions");
            }
            getPageJSActions(m) {
              return this.messageHandler.sendWithPromise("GetPageJSActions", {
                pageIndex: m
              });
            }
            getStructTree(m) {
              return this.messageHandler.sendWithPromise("GetStructTree", {
                pageIndex: m
              });
            }
            getOutline() {
              return this.messageHandler.sendWithPromise("GetOutline", null);
            }
            getOptionalContentConfig() {
              return this.messageHandler.sendWithPromise("GetOptionalContentConfig", null).then((m) => new _optional_content_config.OptionalContentConfig(m));
            }
            getPermissions() {
              return this.messageHandler.sendWithPromise("GetPermissions", null);
            }
            getMetadata() {
              const m = "GetMetadata", N = a(this, S).get(m);
              if (N)
                return N;
              const D = this.messageHandler.sendWithPromise(m, null).then((X) => {
                var G, I;
                return {
                  info: X[0],
                  metadata: X[1] ? new _metadata.Metadata(X[1]) : null,
                  contentDispositionFilename: ((G = this._fullReader) == null ? void 0 : G.filename) ?? null,
                  contentLength: ((I = this._fullReader) == null ? void 0 : I.contentLength) ?? null
                };
              });
              return a(this, S).set(m, D), D;
            }
            getMarkInfo() {
              return this.messageHandler.sendWithPromise("GetMarkInfo", null);
            }
            async startCleanup(m = !1) {
              if (!this.destroyed) {
                await this.messageHandler.sendWithPromise("Cleanup", null);
                for (const N of a(this, w).values())
                  if (!N.cleanup())
                    throw new Error(`startCleanup: Page ${N.pageNumber} is currently rendering.`);
                this.commonObjs.clear(), m || this.fontLoader.clear(), a(this, S).clear(), this.filterFactory.destroy(!0);
              }
            }
            get loadingParams() {
              const {
                disableAutoFetch: m,
                enableXfa: N
              } = this._params;
              return (0, _util.shadow)(this, "loadingParams", {
                disableAutoFetch: m,
                enableXfa: N
              });
            }
          }
          S = new WeakMap(), w = new WeakMap(), C = new WeakMap(), P = new WeakMap(), b = new WeakSet(), Tt = function(m, N = null) {
            const D = a(this, S).get(m);
            if (D)
              return D;
            const X = this.messageHandler.sendWithPromise(m, N);
            return a(this, S).set(m, X), X;
          };
          class PDFObjects {
            constructor() {
              W(this, x);
              W(this, F, /* @__PURE__ */ Object.create(null));
            }
            get(m, N = null) {
              if (N) {
                const X = K(this, x, Bt).call(this, m);
                return X.capability.promise.then(() => N(X.data)), null;
              }
              const D = a(this, F)[m];
              if (!(D != null && D.capability.settled))
                throw new Error(`Requesting object that isn't resolved yet ${m}.`);
              return D.data;
            }
            has(m) {
              const N = a(this, F)[m];
              return (N == null ? void 0 : N.capability.settled) || !1;
            }
            resolve(m, N = null) {
              const D = K(this, x, Bt).call(this, m);
              D.data = N, D.capability.resolve();
            }
            clear() {
              var m;
              for (const N in a(this, F)) {
                const {
                  data: D
                } = a(this, F)[N];
                (m = D == null ? void 0 : D.bitmap) == null || m.close();
              }
              oe(this, F, /* @__PURE__ */ Object.create(null));
            }
          }
          F = new WeakMap(), x = new WeakSet(), Bt = function(m) {
            var N;
            return (N = a(this, F))[m] || (N[m] = {
              capability: new _util.PromiseCapability(),
              data: null
            });
          };
          class RenderTask {
            constructor(m) {
              W(this, p, null);
              oe(this, p, m), this.onContinue = null;
            }
            get promise() {
              return a(this, p).capability.promise;
            }
            cancel(m = 0) {
              a(this, p).cancel(null, m);
            }
            get separateAnnots() {
              const {
                separateAnnots: m
              } = a(this, p).operatorList;
              if (!m)
                return !1;
              const {
                annotationCanvasMap: N
              } = a(this, p);
              return m.form || m.canvas && (N == null ? void 0 : N.size) > 0;
            }
          }
          p = new WeakMap(), exports.RenderTask = RenderTask;
          const $ = class $ {
            constructor({
              callback: m,
              params: N,
              objs: D,
              commonObjs: X,
              annotationCanvasMap: G,
              operatorList: I,
              pageIndex: B,
              canvasFactory: ee,
              filterFactory: Y,
              useRequestAnimationFrame: q = !1,
              pdfBug: le = !1,
              pageColors: pe = null
            }) {
              this.callback = m, this.params = N, this.objs = D, this.commonObjs = X, this.annotationCanvasMap = G, this.operatorListIdx = null, this.operatorList = I, this._pageIndex = B, this.canvasFactory = ee, this.filterFactory = Y, this._pdfBug = le, this.pageColors = pe, this.running = !1, this.graphicsReadyCallback = null, this.graphicsReady = !1, this._useRequestAnimationFrame = q === !0 && typeof window < "u", this.cancelled = !1, this.capability = new _util.PromiseCapability(), this.task = new RenderTask(this), this._cancelBound = this.cancel.bind(this), this._continueBound = this._continue.bind(this), this._scheduleNextBound = this._scheduleNext.bind(this), this._nextBound = this._next.bind(this), this._canvas = N.canvasContext.canvas;
            }
            get completed() {
              return this.capability.promise.catch(function() {
              });
            }
            initializeGraphics({
              transparency: m = !1,
              optionalContentConfig: N
            }) {
              var B, ee;
              if (this.cancelled)
                return;
              if (this._canvas) {
                if (a($, E).has(this._canvas))
                  throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");
                a($, E).add(this._canvas);
              }
              this._pdfBug && ((B = globalThis.StepperManager) != null && B.enabled) && (this.stepper = globalThis.StepperManager.create(this._pageIndex), this.stepper.init(this.operatorList), this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint());
              const {
                canvasContext: D,
                viewport: X,
                transform: G,
                background: I
              } = this.params;
              this.gfx = new _canvas.CanvasGraphics(D, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
                optionalContentConfig: N
              }, this.annotationCanvasMap, this.pageColors), this.gfx.beginDrawing({
                transform: G,
                viewport: X,
                transparency: m,
                background: I
              }), this.operatorListIdx = 0, this.graphicsReady = !0, (ee = this.graphicsReadyCallback) == null || ee.call(this);
            }
            cancel(m = null, N = 0) {
              var D;
              this.running = !1, this.cancelled = !0, (D = this.gfx) == null || D.endDrawing(), a($, E).delete(this._canvas), this.callback(m || new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex + 1}`, N));
            }
            operatorListChanged() {
              var m;
              if (!this.graphicsReady) {
                this.graphicsReadyCallback || (this.graphicsReadyCallback = this._continueBound);
                return;
              }
              (m = this.stepper) == null || m.updateOperatorList(this.operatorList), !this.running && this._continue();
            }
            _continue() {
              this.running = !0, !this.cancelled && (this.task.onContinue ? this.task.onContinue(this._scheduleNextBound) : this._scheduleNext());
            }
            _scheduleNext() {
              this._useRequestAnimationFrame ? window.requestAnimationFrame(() => {
                this._nextBound().catch(this._cancelBound);
              }) : Promise.resolve().then(this._nextBound).catch(this._cancelBound);
            }
            async _next() {
              this.cancelled || (this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper), this.operatorListIdx === this.operatorList.argsArray.length && (this.running = !1, this.operatorList.lastChunk && (this.gfx.endDrawing(), a($, E).delete(this._canvas), this.callback())));
            }
          };
          E = new WeakMap(), W($, E, /* @__PURE__ */ new WeakSet());
          let InternalRenderTask = $;
          const version = "3.11.174";
          exports.version = version;
          const build = "ce8716743";
          exports.build = build;
        },
        /* 3 */
        /***/
        (t, e, i) => {
          var o, r, T, En, w;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.SerializableEmpty = e.PrintAnnotationStorage = e.AnnotationStorage = void 0;
          var n = i(1), s = i(4), l = i(8);
          const h = Object.freeze({
            map: null,
            hash: "",
            transfers: void 0
          });
          e.SerializableEmpty = h;
          class _ {
            constructor() {
              W(this, T);
              W(this, o, !1);
              W(this, r, /* @__PURE__ */ new Map());
              this.onSetModified = null, this.onResetModified = null, this.onAnnotationEditor = null;
            }
            getValue(P, b) {
              const k = a(this, r).get(P);
              return k === void 0 ? b : Object.assign(b, k);
            }
            getRawValue(P) {
              return a(this, r).get(P);
            }
            remove(P) {
              if (a(this, r).delete(P), a(this, r).size === 0 && this.resetModified(), typeof this.onAnnotationEditor == "function") {
                for (const b of a(this, r).values())
                  if (b instanceof s.AnnotationEditor)
                    return;
                this.onAnnotationEditor(null);
              }
            }
            setValue(P, b) {
              const k = a(this, r).get(P);
              let F = !1;
              if (k !== void 0)
                for (const [x, y] of Object.entries(b))
                  k[x] !== y && (F = !0, k[x] = y);
              else
                F = !0, a(this, r).set(P, b);
              F && K(this, T, En).call(this), b instanceof s.AnnotationEditor && typeof this.onAnnotationEditor == "function" && this.onAnnotationEditor(b.constructor._type);
            }
            has(P) {
              return a(this, r).has(P);
            }
            getAll() {
              return a(this, r).size > 0 ? (0, n.objectFromMap)(a(this, r)) : null;
            }
            setAll(P) {
              for (const [b, k] of Object.entries(P))
                this.setValue(b, k);
            }
            get size() {
              return a(this, r).size;
            }
            resetModified() {
              a(this, o) && (oe(this, o, !1), typeof this.onResetModified == "function" && this.onResetModified());
            }
            get print() {
              return new c(this);
            }
            get serializable() {
              if (a(this, r).size === 0)
                return h;
              const P = /* @__PURE__ */ new Map(), b = new l.MurmurHash3_64(), k = [], F = /* @__PURE__ */ Object.create(null);
              let x = !1;
              for (const [y, p] of a(this, r)) {
                const E = p instanceof s.AnnotationEditor ? p.serialize(!1, F) : p;
                E && (P.set(y, E), b.update(`${y}:${JSON.stringify(E)}`), x || (x = !!E.bitmap));
              }
              if (x)
                for (const y of P.values())
                  y.bitmap && k.push(y.bitmap);
              return P.size > 0 ? {
                map: P,
                hash: b.hexdigest(),
                transfers: k
              } : h;
            }
          }
          o = new WeakMap(), r = new WeakMap(), T = new WeakSet(), En = function() {
            a(this, o) || (oe(this, o, !0), typeof this.onSetModified == "function" && this.onSetModified());
          }, e.AnnotationStorage = _;
          class c extends _ {
            constructor(b) {
              super();
              W(this, w, void 0);
              const {
                map: k,
                hash: F,
                transfers: x
              } = b.serializable, y = structuredClone(k, x ? {
                transfer: x
              } : null);
              oe(this, w, {
                map: y,
                hash: F,
                transfers: x
              });
            }
            get print() {
              (0, n.unreachable)("Should not call PrintAnnotationStorage.print");
            }
            get serializable() {
              return a(this, w);
            }
          }
          w = new WeakMap(), e.PrintAnnotationStorage = c;
        },
        /* 4 */
        /***/
        (t, e, i) => {
          var c, o, r, T, S, w, C, P, b, k, F, x, y, p, E, Ht, M, Ut, N, jt, X, Gt, I, Sn, ee, wn, q, Tn, pe, Wt, be, Cn;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.AnnotationEditor = void 0;
          var n = i(5), s = i(1), l = i(6);
          const d = class d {
            constructor(f) {
              W(this, E);
              W(this, M);
              W(this, X);
              W(this, I);
              W(this, ee);
              W(this, q);
              W(this, pe);
              W(this, be);
              W(this, c, "");
              W(this, o, !1);
              W(this, r, null);
              W(this, T, null);
              W(this, S, null);
              W(this, w, !1);
              W(this, C, null);
              W(this, P, this.focusin.bind(this));
              W(this, b, this.focusout.bind(this));
              W(this, k, !1);
              W(this, F, !1);
              W(this, x, !1);
              nt(this, "_initialOptions", /* @__PURE__ */ Object.create(null));
              nt(this, "_uiManager", null);
              nt(this, "_focusEventsAllowed", !0);
              nt(this, "_l10nPromise", null);
              W(this, y, !1);
              W(this, p, d._zIndex++);
              this.constructor === d && (0, s.unreachable)("Cannot initialize AnnotationEditor."), this.parent = f.parent, this.id = f.id, this.width = this.height = null, this.pageIndex = f.parent.pageIndex, this.name = f.name, this.div = null, this._uiManager = f.uiManager, this.annotationElementId = null, this._willKeepAspectRatio = !1, this._initialOptions.isCentered = f.isCentered, this._structTreeParentId = null;
              const {
                rotation: v,
                rawDims: {
                  pageWidth: A,
                  pageHeight: O,
                  pageX: H,
                  pageY: z
                }
              } = this.parent.viewport;
              this.rotation = v, this.pageRotation = (360 + v - this._uiManager.viewParameters.rotation) % 360, this.pageDimensions = [A, O], this.pageTranslation = [H, z];
              const [ae, Z] = this.parentDimensions;
              this.x = f.x / ae, this.y = f.y / Z, this.isAttachedToDOM = !1, this.deleted = !1;
            }
            get editorType() {
              return Object.getPrototypeOf(this).constructor._type;
            }
            static get _defaultLineColor() {
              return (0, s.shadow)(this, "_defaultLineColor", this._colorManager.getHexCode("CanvasText"));
            }
            static deleteAnnotationElement(f) {
              const v = new _({
                id: f.parent.getNextId(),
                parent: f.parent,
                uiManager: f._uiManager
              });
              v.annotationElementId = f.annotationElementId, v.deleted = !0, v._uiManager.addToAnnotationStorage(v);
            }
            static initialize(f, v = null) {
              if (d._l10nPromise || (d._l10nPromise = new Map(["editor_alt_text_button_label", "editor_alt_text_edit_button_label", "editor_alt_text_decorative_tooltip"].map((O) => [O, f.get(O)]))), v != null && v.strings)
                for (const O of v.strings)
                  d._l10nPromise.set(O, f.get(O));
              if (d._borderLineWidth !== -1)
                return;
              const A = getComputedStyle(document.documentElement);
              d._borderLineWidth = parseFloat(A.getPropertyValue("--outline-width")) || 0;
            }
            static updateDefaultParams(f, v) {
            }
            static get defaultPropertiesToUpdate() {
              return [];
            }
            static isHandlingMimeForPasting(f) {
              return !1;
            }
            static paste(f, v) {
              (0, s.unreachable)("Not implemented");
            }
            get propertiesToUpdate() {
              return [];
            }
            get _isDraggable() {
              return a(this, y);
            }
            set _isDraggable(f) {
              var v;
              oe(this, y, f), (v = this.div) == null || v.classList.toggle("draggable", f);
            }
            center() {
              const [f, v] = this.pageDimensions;
              switch (this.parentRotation) {
                case 90:
                  this.x -= this.height * v / (f * 2), this.y += this.width * f / (v * 2);
                  break;
                case 180:
                  this.x += this.width / 2, this.y += this.height / 2;
                  break;
                case 270:
                  this.x += this.height * v / (f * 2), this.y -= this.width * f / (v * 2);
                  break;
                default:
                  this.x -= this.width / 2, this.y -= this.height / 2;
                  break;
              }
              this.fixAndSetPosition();
            }
            addCommands(f) {
              this._uiManager.addCommands(f);
            }
            get currentLayer() {
              return this._uiManager.currentLayer;
            }
            setInBackground() {
              this.div.style.zIndex = 0;
            }
            setInForeground() {
              this.div.style.zIndex = a(this, p);
            }
            setParent(f) {
              f !== null && (this.pageIndex = f.pageIndex, this.pageDimensions = f.pageDimensions), this.parent = f;
            }
            focusin(f) {
              this._focusEventsAllowed && (a(this, k) ? oe(this, k, !1) : this.parent.setSelected(this));
            }
            focusout(f) {
              var A;
              if (!this._focusEventsAllowed || !this.isAttachedToDOM)
                return;
              const v = f.relatedTarget;
              v != null && v.closest(`#${this.id}`) || (f.preventDefault(), (A = this.parent) != null && A.isMultipleSelection || this.commitOrRemove());
            }
            commitOrRemove() {
              this.isEmpty() ? this.remove() : this.commit();
            }
            commit() {
              this.addToAnnotationStorage();
            }
            addToAnnotationStorage() {
              this._uiManager.addToAnnotationStorage(this);
            }
            setAt(f, v, A, O) {
              const [H, z] = this.parentDimensions;
              [A, O] = this.screenToPageTranslation(A, O), this.x = (f + A) / H, this.y = (v + O) / z, this.fixAndSetPosition();
            }
            translate(f, v) {
              K(this, E, Ht).call(this, this.parentDimensions, f, v);
            }
            translateInPage(f, v) {
              K(this, E, Ht).call(this, this.pageDimensions, f, v), this.div.scrollIntoView({
                block: "nearest"
              });
            }
            drag(f, v) {
              const [A, O] = this.parentDimensions;
              if (this.x += f / A, this.y += v / O, this.parent && (this.x < 0 || this.x > 1 || this.y < 0 || this.y > 1)) {
                const {
                  x: ce,
                  y: ue
                } = this.div.getBoundingClientRect();
                this.parent.findNewParent(this, ce, ue) && (this.x -= Math.floor(this.x), this.y -= Math.floor(this.y));
              }
              let {
                x: H,
                y: z
              } = this;
              const [ae, Z] = K(this, M, Ut).call(this);
              H += ae, z += Z, this.div.style.left = `${(100 * H).toFixed(2)}%`, this.div.style.top = `${(100 * z).toFixed(2)}%`, this.div.scrollIntoView({
                block: "nearest"
              });
            }
            fixAndSetPosition() {
              const [f, v] = this.pageDimensions;
              let {
                x: A,
                y: O,
                width: H,
                height: z
              } = this;
              switch (H *= f, z *= v, A *= f, O *= v, this.rotation) {
                case 0:
                  A = Math.max(0, Math.min(f - H, A)), O = Math.max(0, Math.min(v - z, O));
                  break;
                case 90:
                  A = Math.max(0, Math.min(f - z, A)), O = Math.min(v, Math.max(H, O));
                  break;
                case 180:
                  A = Math.min(f, Math.max(H, A)), O = Math.min(v, Math.max(z, O));
                  break;
                case 270:
                  A = Math.min(f, Math.max(z, A)), O = Math.max(0, Math.min(v - H, O));
                  break;
              }
              this.x = A /= f, this.y = O /= v;
              const [ae, Z] = K(this, M, Ut).call(this);
              A += ae, O += Z;
              const {
                style: ce
              } = this.div;
              ce.left = `${(100 * A).toFixed(2)}%`, ce.top = `${(100 * O).toFixed(2)}%`, this.moveInDOM();
            }
            screenToPageTranslation(f, v) {
              var A;
              return K(A = d, N, jt).call(A, f, v, this.parentRotation);
            }
            pageTranslationToScreen(f, v) {
              var A;
              return K(A = d, N, jt).call(A, f, v, 360 - this.parentRotation);
            }
            get parentScale() {
              return this._uiManager.viewParameters.realScale;
            }
            get parentRotation() {
              return (this._uiManager.viewParameters.rotation + this.pageRotation) % 360;
            }
            get parentDimensions() {
              const {
                parentScale: f,
                pageDimensions: [v, A]
              } = this, O = v * f, H = A * f;
              return s.FeatureTest.isCSSRoundSupported ? [Math.round(O), Math.round(H)] : [O, H];
            }
            setDims(f, v) {
              var H;
              const [A, O] = this.parentDimensions;
              this.div.style.width = `${(100 * f / A).toFixed(2)}%`, a(this, w) || (this.div.style.height = `${(100 * v / O).toFixed(2)}%`), (H = a(this, r)) == null || H.classList.toggle("small", f < d.SMALL_EDITOR_SIZE || v < d.SMALL_EDITOR_SIZE);
            }
            fixDims() {
              const {
                style: f
              } = this.div, {
                height: v,
                width: A
              } = f, O = A.endsWith("%"), H = !a(this, w) && v.endsWith("%");
              if (O && H)
                return;
              const [z, ae] = this.parentDimensions;
              O || (f.width = `${(100 * parseFloat(A) / z).toFixed(2)}%`), !a(this, w) && !H && (f.height = `${(100 * parseFloat(v) / ae).toFixed(2)}%`);
            }
            getInitialTranslation() {
              return [0, 0];
            }
            async addAltTextButton() {
              if (a(this, r))
                return;
              const f = oe(this, r, document.createElement("button"));
              f.className = "altText";
              const v = await d._l10nPromise.get("editor_alt_text_button_label");
              f.textContent = v, f.setAttribute("aria-label", v), f.tabIndex = "0", f.addEventListener("contextmenu", l.noContextMenu), f.addEventListener("pointerdown", (A) => A.stopPropagation()), f.addEventListener("click", (A) => {
                A.preventDefault(), this._uiManager.editAltText(this);
              }, {
                capture: !0
              }), f.addEventListener("keydown", (A) => {
                A.target === f && A.key === "Enter" && (A.preventDefault(), this._uiManager.editAltText(this));
              }), K(this, pe, Wt).call(this), this.div.append(f), d.SMALL_EDITOR_SIZE || (d.SMALL_EDITOR_SIZE = Math.min(128, Math.round(f.getBoundingClientRect().width * 1.4)));
            }
            getClientDimensions() {
              return this.div.getBoundingClientRect();
            }
            get altTextData() {
              return {
                altText: a(this, c),
                decorative: a(this, o)
              };
            }
            set altTextData({
              altText: f,
              decorative: v
            }) {
              a(this, c) === f && a(this, o) === v || (oe(this, c, f), oe(this, o, v), K(this, pe, Wt).call(this));
            }
            render() {
              this.div = document.createElement("div"), this.div.setAttribute("data-editor-rotation", (360 - this.rotation) % 360), this.div.className = this.name, this.div.setAttribute("id", this.id), this.div.setAttribute("tabIndex", 0), this.setInForeground(), this.div.addEventListener("focusin", a(this, P)), this.div.addEventListener("focusout", a(this, b));
              const [f, v] = this.parentDimensions;
              this.parentRotation % 180 !== 0 && (this.div.style.maxWidth = `${(100 * v / f).toFixed(2)}%`, this.div.style.maxHeight = `${(100 * f / v).toFixed(2)}%`);
              const [A, O] = this.getInitialTranslation();
              return this.translate(A, O), (0, n.bindEvents)(this, this.div, ["pointerdown"]), this.div;
            }
            pointerdown(f) {
              const {
                isMac: v
              } = s.FeatureTest.platform;
              if (f.button !== 0 || f.ctrlKey && v) {
                f.preventDefault();
                return;
              }
              oe(this, k, !0), K(this, be, Cn).call(this, f);
            }
            moveInDOM() {
              var f;
              (f = this.parent) == null || f.moveEditorInDOM(this);
            }
            _setParentAndPosition(f, v, A) {
              f.changeParent(this), this.x = v, this.y = A, this.fixAndSetPosition();
            }
            getRect(f, v) {
              const A = this.parentScale, [O, H] = this.pageDimensions, [z, ae] = this.pageTranslation, Z = f / A, ce = v / A, ue = this.x * O, me = this.y * H, fe = this.width * O, Pe = this.height * H;
              switch (this.rotation) {
                case 0:
                  return [ue + Z + z, H - me - ce - Pe + ae, ue + Z + fe + z, H - me - ce + ae];
                case 90:
                  return [ue + ce + z, H - me + Z + ae, ue + ce + Pe + z, H - me + Z + fe + ae];
                case 180:
                  return [ue - Z - fe + z, H - me + ce + ae, ue - Z + z, H - me + ce + Pe + ae];
                case 270:
                  return [ue - ce - Pe + z, H - me - Z - fe + ae, ue - ce + z, H - me - Z + ae];
                default:
                  throw new Error("Invalid rotation");
              }
            }
            getRectInCurrentCoords(f, v) {
              const [A, O, H, z] = f, ae = H - A, Z = z - O;
              switch (this.rotation) {
                case 0:
                  return [A, v - z, ae, Z];
                case 90:
                  return [A, v - O, Z, ae];
                case 180:
                  return [H, v - O, ae, Z];
                case 270:
                  return [H, v - z, Z, ae];
                default:
                  throw new Error("Invalid rotation");
              }
            }
            onceAdded() {
            }
            isEmpty() {
              return !1;
            }
            enableEditMode() {
              oe(this, x, !0);
            }
            disableEditMode() {
              oe(this, x, !1);
            }
            isInEditMode() {
              return a(this, x);
            }
            shouldGetKeyboardEvents() {
              return !1;
            }
            needsToBeRebuilt() {
              return this.div && !this.isAttachedToDOM;
            }
            rebuild() {
              var f, v;
              (f = this.div) == null || f.addEventListener("focusin", a(this, P)), (v = this.div) == null || v.addEventListener("focusout", a(this, b));
            }
            serialize(f = !1, v = null) {
              (0, s.unreachable)("An editor must be serializable");
            }
            static deserialize(f, v, A) {
              const O = new this.prototype.constructor({
                parent: v,
                id: v.getNextId(),
                uiManager: A
              });
              O.rotation = f.rotation;
              const [H, z] = O.pageDimensions, [ae, Z, ce, ue] = O.getRectInCurrentCoords(f.rect, z);
              return O.x = ae / H, O.y = Z / z, O.width = ce / H, O.height = ue / z, O;
            }
            remove() {
              var f;
              this.div.removeEventListener("focusin", a(this, P)), this.div.removeEventListener("focusout", a(this, b)), this.isEmpty() || this.commit(), this.parent ? this.parent.remove(this) : this._uiManager.removeEditor(this), (f = a(this, r)) == null || f.remove(), oe(this, r, null), oe(this, T, null);
            }
            get isResizable() {
              return !1;
            }
            makeResizable() {
              this.isResizable && (K(this, I, Sn).call(this), a(this, C).classList.remove("hidden"));
            }
            select() {
              var f;
              this.makeResizable(), (f = this.div) == null || f.classList.add("selectedEditor");
            }
            unselect() {
              var f, v, A;
              (f = a(this, C)) == null || f.classList.add("hidden"), (v = this.div) == null || v.classList.remove("selectedEditor"), (A = this.div) != null && A.contains(document.activeElement) && this._uiManager.currentLayer.div.focus();
            }
            updateParams(f, v) {
            }
            disableEditing() {
              a(this, r) && (a(this, r).hidden = !0);
            }
            enableEditing() {
              a(this, r) && (a(this, r).hidden = !1);
            }
            enterInEditMode() {
            }
            get contentDiv() {
              return this.div;
            }
            get isEditing() {
              return a(this, F);
            }
            set isEditing(f) {
              oe(this, F, f), this.parent && (f ? (this.parent.setSelected(this), this.parent.setActiveEditor(this)) : this.parent.setActiveEditor(null));
            }
            setAspectRatio(f, v) {
              oe(this, w, !0);
              const A = f / v, {
                style: O
              } = this.div;
              O.aspectRatio = A, O.height = "auto";
            }
            static get MIN_SIZE() {
              return 16;
            }
          };
          c = new WeakMap(), o = new WeakMap(), r = new WeakMap(), T = new WeakMap(), S = new WeakMap(), w = new WeakMap(), C = new WeakMap(), P = new WeakMap(), b = new WeakMap(), k = new WeakMap(), F = new WeakMap(), x = new WeakMap(), y = new WeakMap(), p = new WeakMap(), E = new WeakSet(), Ht = function([f, v], A, O) {
            [A, O] = this.screenToPageTranslation(A, O), this.x += A / f, this.y += O / v, this.fixAndSetPosition();
          }, M = new WeakSet(), Ut = function() {
            const [f, v] = this.parentDimensions, {
              _borderLineWidth: A
            } = d, O = A / f, H = A / v;
            switch (this.rotation) {
              case 90:
                return [-O, H];
              case 180:
                return [O, H];
              case 270:
                return [O, -H];
              default:
                return [-O, -H];
            }
          }, N = new WeakSet(), jt = function(f, v, A) {
            switch (A) {
              case 90:
                return [v, -f];
              case 180:
                return [-f, -v];
              case 270:
                return [-v, f];
              default:
                return [f, v];
            }
          }, X = new WeakSet(), Gt = function(f) {
            switch (f) {
              case 90: {
                const [v, A] = this.pageDimensions;
                return [0, -v / A, A / v, 0];
              }
              case 180:
                return [-1, 0, 0, -1];
              case 270: {
                const [v, A] = this.pageDimensions;
                return [0, v / A, -A / v, 0];
              }
              default:
                return [1, 0, 0, 1];
            }
          }, I = new WeakSet(), Sn = function() {
            if (a(this, C))
              return;
            oe(this, C, document.createElement("div")), a(this, C).classList.add("resizers");
            const f = ["topLeft", "topRight", "bottomRight", "bottomLeft"];
            this._willKeepAspectRatio || f.push("topMiddle", "middleRight", "bottomMiddle", "middleLeft");
            for (const v of f) {
              const A = document.createElement("div");
              a(this, C).append(A), A.classList.add("resizer", v), A.addEventListener("pointerdown", K(this, ee, wn).bind(this, v)), A.addEventListener("contextmenu", l.noContextMenu);
            }
            this.div.prepend(a(this, C));
          }, ee = new WeakSet(), wn = function(f, v) {
            v.preventDefault();
            const {
              isMac: A
            } = s.FeatureTest.platform;
            if (v.button !== 0 || v.ctrlKey && A)
              return;
            const O = K(this, q, Tn).bind(this, f), H = this._isDraggable;
            this._isDraggable = !1;
            const z = {
              passive: !0,
              capture: !0
            };
            window.addEventListener("pointermove", O, z);
            const ae = this.x, Z = this.y, ce = this.width, ue = this.height, me = this.parent.div.style.cursor, fe = this.div.style.cursor;
            this.div.style.cursor = this.parent.div.style.cursor = window.getComputedStyle(v.target).cursor;
            const Pe = () => {
              this._isDraggable = H, window.removeEventListener("pointerup", Pe), window.removeEventListener("blur", Pe), window.removeEventListener("pointermove", O, z), this.parent.div.style.cursor = me, this.div.style.cursor = fe;
              const Fe = this.x, Ee = this.y, De = this.width, _e = this.height;
              Fe === ae && Ee === Z && De === ce && _e === ue || this.addCommands({
                cmd: () => {
                  this.width = De, this.height = _e, this.x = Fe, this.y = Ee;
                  const [ie, se] = this.parentDimensions;
                  this.setDims(ie * De, se * _e), this.fixAndSetPosition();
                },
                undo: () => {
                  this.width = ce, this.height = ue, this.x = ae, this.y = Z;
                  const [ie, se] = this.parentDimensions;
                  this.setDims(ie * ce, se * ue), this.fixAndSetPosition();
                },
                mustExec: !0
              });
            };
            window.addEventListener("pointerup", Pe), window.addEventListener("blur", Pe);
          }, q = new WeakSet(), Tn = function(f, v) {
            const [A, O] = this.parentDimensions, H = this.x, z = this.y, ae = this.width, Z = this.height, ce = d.MIN_SIZE / A, ue = d.MIN_SIZE / O, me = (ve) => Math.round(ve * 1e4) / 1e4, fe = K(this, X, Gt).call(this, this.rotation), Pe = (ve, Se) => [fe[0] * ve + fe[2] * Se, fe[1] * ve + fe[3] * Se], Fe = K(this, X, Gt).call(this, 360 - this.rotation), Ee = (ve, Se) => [Fe[0] * ve + Fe[2] * Se, Fe[1] * ve + Fe[3] * Se];
            let De, _e, ie = !1, se = !1;
            switch (f) {
              case "topLeft":
                ie = !0, De = (ve, Se) => [0, 0], _e = (ve, Se) => [ve, Se];
                break;
              case "topMiddle":
                De = (ve, Se) => [ve / 2, 0], _e = (ve, Se) => [ve / 2, Se];
                break;
              case "topRight":
                ie = !0, De = (ve, Se) => [ve, 0], _e = (ve, Se) => [0, Se];
                break;
              case "middleRight":
                se = !0, De = (ve, Se) => [ve, Se / 2], _e = (ve, Se) => [0, Se / 2];
                break;
              case "bottomRight":
                ie = !0, De = (ve, Se) => [ve, Se], _e = (ve, Se) => [0, 0];
                break;
              case "bottomMiddle":
                De = (ve, Se) => [ve / 2, Se], _e = (ve, Se) => [ve / 2, 0];
                break;
              case "bottomLeft":
                ie = !0, De = (ve, Se) => [0, Se], _e = (ve, Se) => [ve, 0];
                break;
              case "middleLeft":
                se = !0, De = (ve, Se) => [0, Se / 2], _e = (ve, Se) => [ve, Se / 2];
                break;
            }
            const ge = De(ae, Z), Ce = _e(ae, Z);
            let xe = Pe(...Ce);
            const He = me(H + xe[0]), We = me(z + xe[1]);
            let je = 1, ze = 1, [Xe, Ge] = this.screenToPageTranslation(v.movementX, v.movementY);
            if ([Xe, Ge] = Ee(Xe / A, Ge / O), ie) {
              const ve = Math.hypot(ae, Z);
              je = ze = Math.max(Math.min(Math.hypot(Ce[0] - ge[0] - Xe, Ce[1] - ge[1] - Ge) / ve, 1 / ae, 1 / Z), ce / ae, ue / Z);
            } else
              se ? je = Math.max(ce, Math.min(1, Math.abs(Ce[0] - ge[0] - Xe))) / ae : ze = Math.max(ue, Math.min(1, Math.abs(Ce[1] - ge[1] - Ge))) / Z;
            const Ye = me(ae * je), de = me(Z * ze);
            xe = Pe(..._e(Ye, de));
            const ne = He - xe[0], J = We - xe[1];
            this.width = Ye, this.height = de, this.x = ne, this.y = J, this.setDims(A * Ye, O * de), this.fixAndSetPosition();
          }, pe = new WeakSet(), Wt = async function() {
            var A;
            const f = a(this, r);
            if (!f)
              return;
            if (!a(this, c) && !a(this, o)) {
              f.classList.remove("done"), (A = a(this, T)) == null || A.remove();
              return;
            }
            d._l10nPromise.get("editor_alt_text_edit_button_label").then((O) => {
              f.setAttribute("aria-label", O);
            });
            let v = a(this, T);
            if (!v) {
              oe(this, T, v = document.createElement("span")), v.className = "tooltip", v.setAttribute("role", "tooltip");
              const O = v.id = `alt-text-tooltip-${this.id}`;
              f.setAttribute("aria-describedby", O);
              const H = 100;
              f.addEventListener("mouseenter", () => {
                oe(this, S, setTimeout(() => {
                  oe(this, S, null), a(this, T).classList.add("show"), this._uiManager._eventBus.dispatch("reporttelemetry", {
                    source: this,
                    details: {
                      type: "editing",
                      subtype: this.editorType,
                      data: {
                        action: "alt_text_tooltip"
                      }
                    }
                  });
                }, H));
              }), f.addEventListener("mouseleave", () => {
                var z;
                clearTimeout(a(this, S)), oe(this, S, null), (z = a(this, T)) == null || z.classList.remove("show");
              });
            }
            f.classList.add("done"), v.innerText = a(this, o) ? await d._l10nPromise.get("editor_alt_text_decorative_tooltip") : a(this, c), v.parentNode || f.append(v);
          }, be = new WeakSet(), Cn = function(f) {
            if (!this._isDraggable)
              return;
            const v = this._uiManager.isSelected(this);
            this._uiManager.setUpDragSession();
            let A, O;
            v && (A = {
              passive: !0,
              capture: !0
            }, O = (z) => {
              const [ae, Z] = this.screenToPageTranslation(z.movementX, z.movementY);
              this._uiManager.dragSelectedEditors(ae, Z);
            }, window.addEventListener("pointermove", O, A));
            const H = () => {
              if (window.removeEventListener("pointerup", H), window.removeEventListener("blur", H), v && window.removeEventListener("pointermove", O, A), oe(this, k, !1), !this._uiManager.endDragSession()) {
                const {
                  isMac: z
                } = s.FeatureTest.platform;
                f.ctrlKey && !z || f.shiftKey || f.metaKey && z ? this.parent.toggleSelected(this) : this.parent.setSelected(this);
              }
            };
            window.addEventListener("pointerup", H), window.addEventListener("blur", H);
          }, W(d, N), nt(d, "_borderLineWidth", -1), nt(d, "_colorManager", new n.ColorManager()), nt(d, "_zIndex", 1), nt(d, "SMALL_EDITOR_SIZE", 0);
          let h = d;
          e.AnnotationEditor = h;
          class _ extends h {
            constructor(f) {
              super(f), this.annotationElementId = f.annotationElementId, this.deleted = !0;
            }
            serialize() {
              return {
                id: this.annotationElementId,
                deleted: !0,
                pageIndex: this.pageIndex
              };
            }
          }
        },
        /* 5 */
        /***/
        (t, e, i) => {
          var w, C, P, b, k, qt, y, p, E, $, M, Pn, D, X, G, I, B, ee, Y, q, le, pe, we, be, R, d, g, f, v, A, O, H, z, ae, Z, ce, ue, me, fe, Pe, Fe, Ee, De, _e, ie, se, ge, xn, xe, zt, We, Xt, ze, Ct, Ge, Vt, de, Yt, J, at, Se, mt, et, kn, Te, Rn, ke, Kt, Be, bt, Ae, Jt;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.KeyboardManager = e.CommandManager = e.ColorManager = e.AnnotationEditorUIManager = void 0, e.bindEvents = l, e.opacityToHex = h;
          var n = i(1), s = i(6);
          function l(U, u, L) {
            for (const j of L)
              u.addEventListener(j, U[j].bind(U));
          }
          function h(U) {
            return Math.round(Math.min(255, Math.max(1, 255 * U))).toString(16).padStart(2, "0");
          }
          class _ {
            constructor() {
              W(this, w, 0);
            }
            getId() {
              return `${n.AnnotationEditorPrefix}${_t(this, w)._++}`;
            }
          }
          w = new WeakMap();
          const x = class x {
            constructor() {
              W(this, k);
              W(this, C, (0, n.getUuid)());
              W(this, P, 0);
              W(this, b, null);
            }
            static get _isSVGFittingCanvas() {
              const u = 'data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>', j = new OffscreenCanvas(1, 3).getContext("2d"), V = new Image();
              V.src = u;
              const Q = V.decode().then(() => (j.drawImage(V, 0, 0, 1, 1, 0, 0, 1, 3), new Uint32Array(j.getImageData(0, 0, 1, 1).data.buffer)[0] === 0));
              return (0, n.shadow)(this, "_isSVGFittingCanvas", Q);
            }
            async getFromFile(u) {
              const {
                lastModified: L,
                name: j,
                size: V,
                type: Q
              } = u;
              return K(this, k, qt).call(this, `${L}_${j}_${V}_${Q}`, u);
            }
            async getFromUrl(u) {
              return K(this, k, qt).call(this, u, u);
            }
            async getFromId(u) {
              a(this, b) || oe(this, b, /* @__PURE__ */ new Map());
              const L = a(this, b).get(u);
              return L ? L.bitmap ? (L.refCounter += 1, L) : L.file ? this.getFromFile(L.file) : this.getFromUrl(L.url) : null;
            }
            getSvgUrl(u) {
              const L = a(this, b).get(u);
              return L != null && L.isSvg ? L.svgUrl : null;
            }
            deleteId(u) {
              a(this, b) || oe(this, b, /* @__PURE__ */ new Map());
              const L = a(this, b).get(u);
              L && (L.refCounter -= 1, L.refCounter === 0 && (L.bitmap = null));
            }
            isValidId(u) {
              return u.startsWith(`image_${a(this, C)}_`);
            }
          };
          C = new WeakMap(), P = new WeakMap(), b = new WeakMap(), k = new WeakSet(), qt = async function(u, L) {
            a(this, b) || oe(this, b, /* @__PURE__ */ new Map());
            let j = a(this, b).get(u);
            if (j === null)
              return null;
            if (j != null && j.bitmap)
              return j.refCounter += 1, j;
            try {
              j || (j = {
                bitmap: null,
                id: `image_${a(this, C)}_${_t(this, P)._++}`,
                refCounter: 0,
                isSvg: !1
              });
              let V;
              if (typeof L == "string") {
                j.url = L;
                const Q = await fetch(L);
                if (!Q.ok)
                  throw new Error(Q.statusText);
                V = await Q.blob();
              } else
                V = j.file = L;
              if (V.type === "image/svg+xml") {
                const Q = x._isSVGFittingCanvas, he = new FileReader(), ye = new Image(), Me = new Promise((Re, qe) => {
                  ye.onload = () => {
                    j.bitmap = ye, j.isSvg = !0, Re();
                  }, he.onload = async () => {
                    const Ie = j.svgUrl = he.result;
                    ye.src = await Q ? `${Ie}#svgView(preserveAspectRatio(none))` : Ie;
                  }, ye.onerror = he.onerror = qe;
                });
                he.readAsDataURL(V), await Me;
              } else
                j.bitmap = await createImageBitmap(V);
              j.refCounter = 1;
            } catch (V) {
              console.error(V), j = null;
            }
            return a(this, b).set(u, j), j && a(this, b).set(j.id, j), j;
          };
          let c = x;
          class o {
            constructor(u = 128) {
              W(this, y, []);
              W(this, p, !1);
              W(this, E, void 0);
              W(this, $, -1);
              oe(this, E, u);
            }
            add({
              cmd: u,
              undo: L,
              mustExec: j,
              type: V = NaN,
              overwriteIfSameType: Q = !1,
              keepUndo: he = !1
            }) {
              if (j && u(), a(this, p))
                return;
              const ye = {
                cmd: u,
                undo: L,
                type: V
              };
              if (a(this, $) === -1) {
                a(this, y).length > 0 && (a(this, y).length = 0), oe(this, $, 0), a(this, y).push(ye);
                return;
              }
              if (Q && a(this, y)[a(this, $)].type === V) {
                he && (ye.undo = a(this, y)[a(this, $)].undo), a(this, y)[a(this, $)] = ye;
                return;
              }
              const Me = a(this, $) + 1;
              Me === a(this, E) ? a(this, y).splice(0, 1) : (oe(this, $, Me), Me < a(this, y).length && a(this, y).splice(Me)), a(this, y).push(ye);
            }
            undo() {
              a(this, $) !== -1 && (oe(this, p, !0), a(this, y)[a(this, $)].undo(), oe(this, p, !1), oe(this, $, a(this, $) - 1));
            }
            redo() {
              a(this, $) < a(this, y).length - 1 && (oe(this, $, a(this, $) + 1), oe(this, p, !0), a(this, y)[a(this, $)].cmd(), oe(this, p, !1));
            }
            hasSomethingToUndo() {
              return a(this, $) !== -1;
            }
            hasSomethingToRedo() {
              return a(this, $) < a(this, y).length - 1;
            }
            destroy() {
              oe(this, y, null);
            }
          }
          y = new WeakMap(), p = new WeakMap(), E = new WeakMap(), $ = new WeakMap(), e.CommandManager = o;
          class r {
            constructor(u) {
              W(this, M);
              this.buffer = [], this.callbacks = /* @__PURE__ */ new Map(), this.allKeys = /* @__PURE__ */ new Set();
              const {
                isMac: L
              } = n.FeatureTest.platform;
              for (const [j, V, Q = {}] of u)
                for (const he of j) {
                  const ye = he.startsWith("mac+");
                  L && ye ? (this.callbacks.set(he.slice(4), {
                    callback: V,
                    options: Q
                  }), this.allKeys.add(he.split("+").at(-1))) : !L && !ye && (this.callbacks.set(he, {
                    callback: V,
                    options: Q
                  }), this.allKeys.add(he.split("+").at(-1)));
                }
            }
            exec(u, L) {
              if (!this.allKeys.has(L.key))
                return;
              const j = this.callbacks.get(K(this, M, Pn).call(this, L));
              if (!j)
                return;
              const {
                callback: V,
                options: {
                  bubbles: Q = !1,
                  args: he = [],
                  checker: ye = null
                }
              } = j;
              ye && !ye(u, L) || (V.bind(u, ...he)(), Q || (L.stopPropagation(), L.preventDefault()));
            }
          }
          M = new WeakSet(), Pn = function(u) {
            u.altKey && this.buffer.push("alt"), u.ctrlKey && this.buffer.push("ctrl"), u.metaKey && this.buffer.push("meta"), u.shiftKey && this.buffer.push("shift"), this.buffer.push(u.key);
            const L = this.buffer.join("+");
            return this.buffer.length = 0, L;
          }, e.KeyboardManager = r;
          const N = class N {
            get _colors() {
              const u = /* @__PURE__ */ new Map([["CanvasText", null], ["Canvas", null]]);
              return (0, s.getColorValues)(u), (0, n.shadow)(this, "_colors", u);
            }
            convert(u) {
              const L = (0, s.getRGB)(u);
              if (!window.matchMedia("(forced-colors: active)").matches)
                return L;
              for (const [j, V] of this._colors)
                if (V.every((Q, he) => Q === L[he]))
                  return N._colorsMapping.get(j);
              return L;
            }
            getHexCode(u) {
              const L = this._colors.get(u);
              return L ? n.Util.makeHexColor(...L) : u;
            }
          };
          nt(N, "_colorsMapping", /* @__PURE__ */ new Map([["CanvasText", [0, 0, 0]], ["Canvas", [255, 255, 255]]]));
          let T = N;
          e.ColorManager = T;
          const Oe = class Oe {
            constructor(u, L, j, V, Q, he) {
              W(this, ge);
              W(this, xe);
              W(this, We);
              W(this, ze);
              W(this, Ge);
              W(this, de);
              W(this, J);
              W(this, Se);
              W(this, et);
              W(this, Te);
              W(this, ke);
              W(this, Be);
              W(this, Ae);
              W(this, D, null);
              W(this, X, /* @__PURE__ */ new Map());
              W(this, G, /* @__PURE__ */ new Map());
              W(this, I, null);
              W(this, B, null);
              W(this, ee, new o());
              W(this, Y, 0);
              W(this, q, /* @__PURE__ */ new Set());
              W(this, le, null);
              W(this, pe, null);
              W(this, we, /* @__PURE__ */ new Set());
              W(this, be, null);
              W(this, R, new _());
              W(this, d, !1);
              W(this, g, !1);
              W(this, f, null);
              W(this, v, n.AnnotationEditorType.NONE);
              W(this, A, /* @__PURE__ */ new Set());
              W(this, O, null);
              W(this, H, this.blur.bind(this));
              W(this, z, this.focus.bind(this));
              W(this, ae, this.copy.bind(this));
              W(this, Z, this.cut.bind(this));
              W(this, ce, this.paste.bind(this));
              W(this, ue, this.keydown.bind(this));
              W(this, me, this.onEditingAction.bind(this));
              W(this, fe, this.onPageChanging.bind(this));
              W(this, Pe, this.onScaleChanging.bind(this));
              W(this, Fe, this.onRotationChanging.bind(this));
              W(this, Ee, {
                isEditing: !1,
                isEmpty: !0,
                hasSomethingToUndo: !1,
                hasSomethingToRedo: !1,
                hasSelectedEditor: !1
              });
              W(this, De, [0, 0]);
              W(this, _e, null);
              W(this, ie, null);
              W(this, se, null);
              oe(this, ie, u), oe(this, se, L), oe(this, I, j), this._eventBus = V, this._eventBus._on("editingaction", a(this, me)), this._eventBus._on("pagechanging", a(this, fe)), this._eventBus._on("scalechanging", a(this, Pe)), this._eventBus._on("rotationchanging", a(this, Fe)), oe(this, B, Q.annotationStorage), oe(this, be, Q.filterFactory), oe(this, O, he), this.viewParameters = {
                realScale: s.PixelsPerInch.PDF_TO_CSS_UNITS,
                rotation: 0
              };
            }
            static get _keyboardManager() {
              const u = Oe.prototype, L = (Q) => {
                const {
                  activeElement: he
                } = document;
                return he && a(Q, ie).contains(he) && Q.hasSomethingToControl();
              }, j = this.TRANSLATE_SMALL, V = this.TRANSLATE_BIG;
              return (0, n.shadow)(this, "_keyboardManager", new r([[["ctrl+a", "mac+meta+a"], u.selectAll], [["ctrl+z", "mac+meta+z"], u.undo], [["ctrl+y", "ctrl+shift+z", "mac+meta+shift+z", "ctrl+shift+Z", "mac+meta+shift+Z"], u.redo], [["Backspace", "alt+Backspace", "ctrl+Backspace", "shift+Backspace", "mac+Backspace", "mac+alt+Backspace", "mac+ctrl+Backspace", "Delete", "ctrl+Delete", "shift+Delete", "mac+Delete"], u.delete], [["Escape", "mac+Escape"], u.unselectAll], [["ArrowLeft", "mac+ArrowLeft"], u.translateSelectedEditors, {
                args: [-j, 0],
                checker: L
              }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], u.translateSelectedEditors, {
                args: [-V, 0],
                checker: L
              }], [["ArrowRight", "mac+ArrowRight"], u.translateSelectedEditors, {
                args: [j, 0],
                checker: L
              }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], u.translateSelectedEditors, {
                args: [V, 0],
                checker: L
              }], [["ArrowUp", "mac+ArrowUp"], u.translateSelectedEditors, {
                args: [0, -j],
                checker: L
              }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], u.translateSelectedEditors, {
                args: [0, -V],
                checker: L
              }], [["ArrowDown", "mac+ArrowDown"], u.translateSelectedEditors, {
                args: [0, j],
                checker: L
              }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], u.translateSelectedEditors, {
                args: [0, V],
                checker: L
              }]]));
            }
            destroy() {
              K(this, ze, Ct).call(this), K(this, xe, zt).call(this), this._eventBus._off("editingaction", a(this, me)), this._eventBus._off("pagechanging", a(this, fe)), this._eventBus._off("scalechanging", a(this, Pe)), this._eventBus._off("rotationchanging", a(this, Fe));
              for (const u of a(this, G).values())
                u.destroy();
              a(this, G).clear(), a(this, X).clear(), a(this, we).clear(), oe(this, D, null), a(this, A).clear(), a(this, ee).destroy(), a(this, I).destroy();
            }
            get hcmFilter() {
              return (0, n.shadow)(this, "hcmFilter", a(this, O) ? a(this, be).addHCMFilter(a(this, O).foreground, a(this, O).background) : "none");
            }
            get direction() {
              return (0, n.shadow)(this, "direction", getComputedStyle(a(this, ie)).direction);
            }
            editAltText(u) {
              var L;
              (L = a(this, I)) == null || L.editAltText(this, u);
            }
            onPageChanging({
              pageNumber: u
            }) {
              oe(this, Y, u - 1);
            }
            focusMainContainer() {
              a(this, ie).focus();
            }
            findParent(u, L) {
              for (const j of a(this, G).values()) {
                const {
                  x: V,
                  y: Q,
                  width: he,
                  height: ye
                } = j.div.getBoundingClientRect();
                if (u >= V && u <= V + he && L >= Q && L <= Q + ye)
                  return j;
              }
              return null;
            }
            disableUserSelect(u = !1) {
              a(this, se).classList.toggle("noUserSelect", u);
            }
            addShouldRescale(u) {
              a(this, we).add(u);
            }
            removeShouldRescale(u) {
              a(this, we).delete(u);
            }
            onScaleChanging({
              scale: u
            }) {
              this.commitOrRemove(), this.viewParameters.realScale = u * s.PixelsPerInch.PDF_TO_CSS_UNITS;
              for (const L of a(this, we))
                L.onScaleChanging();
            }
            onRotationChanging({
              pagesRotation: u
            }) {
              this.commitOrRemove(), this.viewParameters.rotation = u;
            }
            addToAnnotationStorage(u) {
              !u.isEmpty() && a(this, B) && !a(this, B).has(u.id) && a(this, B).setValue(u.id, u);
            }
            blur() {
              if (!this.hasSelection)
                return;
              const {
                activeElement: u
              } = document;
              for (const L of a(this, A))
                if (L.div.contains(u)) {
                  oe(this, f, [L, u]), L._focusEventsAllowed = !1;
                  break;
                }
            }
            focus() {
              if (!a(this, f))
                return;
              const [u, L] = a(this, f);
              oe(this, f, null), L.addEventListener("focusin", () => {
                u._focusEventsAllowed = !0;
              }, {
                once: !0
              }), L.focus();
            }
            addEditListeners() {
              K(this, We, Xt).call(this), K(this, Ge, Vt).call(this);
            }
            removeEditListeners() {
              K(this, ze, Ct).call(this), K(this, de, Yt).call(this);
            }
            copy(u) {
              var j;
              if (u.preventDefault(), (j = a(this, D)) == null || j.commitOrRemove(), !this.hasSelection)
                return;
              const L = [];
              for (const V of a(this, A)) {
                const Q = V.serialize(!0);
                Q && L.push(Q);
              }
              L.length !== 0 && u.clipboardData.setData("application/pdfjs", JSON.stringify(L));
            }
            cut(u) {
              this.copy(u), this.delete();
            }
            paste(u) {
              u.preventDefault();
              const {
                clipboardData: L
              } = u;
              for (const Q of L.items)
                for (const he of a(this, pe))
                  if (he.isHandlingMimeForPasting(Q.type)) {
                    he.paste(Q, this.currentLayer);
                    return;
                  }
              let j = L.getData("application/pdfjs");
              if (!j)
                return;
              try {
                j = JSON.parse(j);
              } catch (Q) {
                (0, n.warn)(`paste: "${Q.message}".`);
                return;
              }
              if (!Array.isArray(j))
                return;
              this.unselectAll();
              const V = this.currentLayer;
              try {
                const Q = [];
                for (const Me of j) {
                  const Re = V.deserialize(Me);
                  if (!Re)
                    return;
                  Q.push(Re);
                }
                const he = () => {
                  for (const Me of Q)
                    K(this, ke, Kt).call(this, Me);
                  K(this, Ae, Jt).call(this, Q);
                }, ye = () => {
                  for (const Me of Q)
                    Me.remove();
                };
                this.addCommands({
                  cmd: he,
                  undo: ye,
                  mustExec: !0
                });
              } catch (Q) {
                (0, n.warn)(`paste: "${Q.message}".`);
              }
            }
            keydown(u) {
              var L;
              (L = this.getActive()) != null && L.shouldGetKeyboardEvents() || Oe._keyboardManager.exec(this, u);
            }
            onEditingAction(u) {
              ["undo", "redo", "delete", "selectAll"].includes(u.name) && this[u.name]();
            }
            setEditingState(u) {
              u ? (K(this, ge, xn).call(this), K(this, We, Xt).call(this), K(this, Ge, Vt).call(this), K(this, J, at).call(this, {
                isEditing: a(this, v) !== n.AnnotationEditorType.NONE,
                isEmpty: K(this, Be, bt).call(this),
                hasSomethingToUndo: a(this, ee).hasSomethingToUndo(),
                hasSomethingToRedo: a(this, ee).hasSomethingToRedo(),
                hasSelectedEditor: !1
              })) : (K(this, xe, zt).call(this), K(this, ze, Ct).call(this), K(this, de, Yt).call(this), K(this, J, at).call(this, {
                isEditing: !1
              }), this.disableUserSelect(!1));
            }
            registerEditorTypes(u) {
              if (!a(this, pe)) {
                oe(this, pe, u);
                for (const L of a(this, pe))
                  K(this, Se, mt).call(this, L.defaultPropertiesToUpdate);
              }
            }
            getId() {
              return a(this, R).getId();
            }
            get currentLayer() {
              return a(this, G).get(a(this, Y));
            }
            getLayer(u) {
              return a(this, G).get(u);
            }
            get currentPageIndex() {
              return a(this, Y);
            }
            addLayer(u) {
              a(this, G).set(u.pageIndex, u), a(this, d) ? u.enable() : u.disable();
            }
            removeLayer(u) {
              a(this, G).delete(u.pageIndex);
            }
            updateMode(u, L = null) {
              if (a(this, v) !== u) {
                if (oe(this, v, u), u === n.AnnotationEditorType.NONE) {
                  this.setEditingState(!1), K(this, Te, Rn).call(this);
                  return;
                }
                this.setEditingState(!0), K(this, et, kn).call(this), this.unselectAll();
                for (const j of a(this, G).values())
                  j.updateMode(u);
                if (L) {
                  for (const j of a(this, X).values())
                    if (j.annotationElementId === L) {
                      this.setSelected(j), j.enterInEditMode();
                      break;
                    }
                }
              }
            }
            updateToolbar(u) {
              u !== a(this, v) && this._eventBus.dispatch("switchannotationeditormode", {
                source: this,
                mode: u
              });
            }
            updateParams(u, L) {
              if (a(this, pe)) {
                if (u === n.AnnotationEditorParamsType.CREATE) {
                  this.currentLayer.addNewEditor(u);
                  return;
                }
                for (const j of a(this, A))
                  j.updateParams(u, L);
                for (const j of a(this, pe))
                  j.updateDefaultParams(u, L);
              }
            }
            enableWaiting(u = !1) {
              if (a(this, g) !== u) {
                oe(this, g, u);
                for (const L of a(this, G).values())
                  u ? L.disableClick() : L.enableClick(), L.div.classList.toggle("waiting", u);
              }
            }
            getEditors(u) {
              const L = [];
              for (const j of a(this, X).values())
                j.pageIndex === u && L.push(j);
              return L;
            }
            getEditor(u) {
              return a(this, X).get(u);
            }
            addEditor(u) {
              a(this, X).set(u.id, u);
            }
            removeEditor(u) {
              var L;
              a(this, X).delete(u.id), this.unselect(u), (!u.annotationElementId || !a(this, q).has(u.annotationElementId)) && ((L = a(this, B)) == null || L.remove(u.id));
            }
            addDeletedAnnotationElement(u) {
              a(this, q).add(u.annotationElementId), u.deleted = !0;
            }
            isDeletedAnnotationElement(u) {
              return a(this, q).has(u);
            }
            removeDeletedAnnotationElement(u) {
              a(this, q).delete(u.annotationElementId), u.deleted = !1;
            }
            setActiveEditor(u) {
              a(this, D) !== u && (oe(this, D, u), u && K(this, Se, mt).call(this, u.propertiesToUpdate));
            }
            toggleSelected(u) {
              if (a(this, A).has(u)) {
                a(this, A).delete(u), u.unselect(), K(this, J, at).call(this, {
                  hasSelectedEditor: this.hasSelection
                });
                return;
              }
              a(this, A).add(u), u.select(), K(this, Se, mt).call(this, u.propertiesToUpdate), K(this, J, at).call(this, {
                hasSelectedEditor: !0
              });
            }
            setSelected(u) {
              for (const L of a(this, A))
                L !== u && L.unselect();
              a(this, A).clear(), a(this, A).add(u), u.select(), K(this, Se, mt).call(this, u.propertiesToUpdate), K(this, J, at).call(this, {
                hasSelectedEditor: !0
              });
            }
            isSelected(u) {
              return a(this, A).has(u);
            }
            unselect(u) {
              u.unselect(), a(this, A).delete(u), K(this, J, at).call(this, {
                hasSelectedEditor: this.hasSelection
              });
            }
            get hasSelection() {
              return a(this, A).size !== 0;
            }
            undo() {
              a(this, ee).undo(), K(this, J, at).call(this, {
                hasSomethingToUndo: a(this, ee).hasSomethingToUndo(),
                hasSomethingToRedo: !0,
                isEmpty: K(this, Be, bt).call(this)
              });
            }
            redo() {
              a(this, ee).redo(), K(this, J, at).call(this, {
                hasSomethingToUndo: !0,
                hasSomethingToRedo: a(this, ee).hasSomethingToRedo(),
                isEmpty: K(this, Be, bt).call(this)
              });
            }
            addCommands(u) {
              a(this, ee).add(u), K(this, J, at).call(this, {
                hasSomethingToUndo: !0,
                hasSomethingToRedo: !1,
                isEmpty: K(this, Be, bt).call(this)
              });
            }
            delete() {
              if (this.commitOrRemove(), !this.hasSelection)
                return;
              const u = [...a(this, A)], L = () => {
                for (const V of u)
                  V.remove();
              }, j = () => {
                for (const V of u)
                  K(this, ke, Kt).call(this, V);
              };
              this.addCommands({
                cmd: L,
                undo: j,
                mustExec: !0
              });
            }
            commitOrRemove() {
              var u;
              (u = a(this, D)) == null || u.commitOrRemove();
            }
            hasSomethingToControl() {
              return a(this, D) || this.hasSelection;
            }
            selectAll() {
              for (const u of a(this, A))
                u.commit();
              K(this, Ae, Jt).call(this, a(this, X).values());
            }
            unselectAll() {
              if (a(this, D)) {
                a(this, D).commitOrRemove();
                return;
              }
              if (this.hasSelection) {
                for (const u of a(this, A))
                  u.unselect();
                a(this, A).clear(), K(this, J, at).call(this, {
                  hasSelectedEditor: !1
                });
              }
            }
            translateSelectedEditors(u, L, j = !1) {
              if (j || this.commitOrRemove(), !this.hasSelection)
                return;
              a(this, De)[0] += u, a(this, De)[1] += L;
              const [V, Q] = a(this, De), he = [...a(this, A)], ye = 1e3;
              a(this, _e) && clearTimeout(a(this, _e)), oe(this, _e, setTimeout(() => {
                oe(this, _e, null), a(this, De)[0] = a(this, De)[1] = 0, this.addCommands({
                  cmd: () => {
                    for (const Me of he)
                      a(this, X).has(Me.id) && Me.translateInPage(V, Q);
                  },
                  undo: () => {
                    for (const Me of he)
                      a(this, X).has(Me.id) && Me.translateInPage(-V, -Q);
                  },
                  mustExec: !1
                });
              }, ye));
              for (const Me of he)
                Me.translateInPage(u, L);
            }
            setUpDragSession() {
              if (this.hasSelection) {
                this.disableUserSelect(!0), oe(this, le, /* @__PURE__ */ new Map());
                for (const u of a(this, A))
                  a(this, le).set(u, {
                    savedX: u.x,
                    savedY: u.y,
                    savedPageIndex: u.pageIndex,
                    newX: 0,
                    newY: 0,
                    newPageIndex: -1
                  });
              }
            }
            endDragSession() {
              if (!a(this, le))
                return !1;
              this.disableUserSelect(!1);
              const u = a(this, le);
              oe(this, le, null);
              let L = !1;
              for (const [{
                x: V,
                y: Q,
                pageIndex: he
              }, ye] of u)
                ye.newX = V, ye.newY = Q, ye.newPageIndex = he, L || (L = V !== ye.savedX || Q !== ye.savedY || he !== ye.savedPageIndex);
              if (!L)
                return !1;
              const j = (V, Q, he, ye) => {
                if (a(this, X).has(V.id)) {
                  const Me = a(this, G).get(ye);
                  Me ? V._setParentAndPosition(Me, Q, he) : (V.pageIndex = ye, V.x = Q, V.y = he);
                }
              };
              return this.addCommands({
                cmd: () => {
                  for (const [V, {
                    newX: Q,
                    newY: he,
                    newPageIndex: ye
                  }] of u)
                    j(V, Q, he, ye);
                },
                undo: () => {
                  for (const [V, {
                    savedX: Q,
                    savedY: he,
                    savedPageIndex: ye
                  }] of u)
                    j(V, Q, he, ye);
                },
                mustExec: !0
              }), !0;
            }
            dragSelectedEditors(u, L) {
              if (a(this, le))
                for (const j of a(this, le).keys())
                  j.drag(u, L);
            }
            rebuild(u) {
              if (u.parent === null) {
                const L = this.getLayer(u.pageIndex);
                L ? (L.changeParent(u), L.addOrRebuild(u)) : (this.addEditor(u), this.addToAnnotationStorage(u), u.rebuild());
              } else
                u.parent.addOrRebuild(u);
            }
            isActive(u) {
              return a(this, D) === u;
            }
            getActive() {
              return a(this, D);
            }
            getMode() {
              return a(this, v);
            }
            get imageManager() {
              return (0, n.shadow)(this, "imageManager", new c());
            }
          };
          D = new WeakMap(), X = new WeakMap(), G = new WeakMap(), I = new WeakMap(), B = new WeakMap(), ee = new WeakMap(), Y = new WeakMap(), q = new WeakMap(), le = new WeakMap(), pe = new WeakMap(), we = new WeakMap(), be = new WeakMap(), R = new WeakMap(), d = new WeakMap(), g = new WeakMap(), f = new WeakMap(), v = new WeakMap(), A = new WeakMap(), O = new WeakMap(), H = new WeakMap(), z = new WeakMap(), ae = new WeakMap(), Z = new WeakMap(), ce = new WeakMap(), ue = new WeakMap(), me = new WeakMap(), fe = new WeakMap(), Pe = new WeakMap(), Fe = new WeakMap(), Ee = new WeakMap(), De = new WeakMap(), _e = new WeakMap(), ie = new WeakMap(), se = new WeakMap(), ge = new WeakSet(), xn = function() {
            window.addEventListener("focus", a(this, z)), window.addEventListener("blur", a(this, H));
          }, xe = new WeakSet(), zt = function() {
            window.removeEventListener("focus", a(this, z)), window.removeEventListener("blur", a(this, H));
          }, We = new WeakSet(), Xt = function() {
            window.addEventListener("keydown", a(this, ue), {
              capture: !0
            });
          }, ze = new WeakSet(), Ct = function() {
            window.removeEventListener("keydown", a(this, ue), {
              capture: !0
            });
          }, Ge = new WeakSet(), Vt = function() {
            document.addEventListener("copy", a(this, ae)), document.addEventListener("cut", a(this, Z)), document.addEventListener("paste", a(this, ce));
          }, de = new WeakSet(), Yt = function() {
            document.removeEventListener("copy", a(this, ae)), document.removeEventListener("cut", a(this, Z)), document.removeEventListener("paste", a(this, ce));
          }, J = new WeakSet(), at = function(u) {
            Object.entries(u).some(([j, V]) => a(this, Ee)[j] !== V) && this._eventBus.dispatch("annotationeditorstateschanged", {
              source: this,
              details: Object.assign(a(this, Ee), u)
            });
          }, Se = new WeakSet(), mt = function(u) {
            this._eventBus.dispatch("annotationeditorparamschanged", {
              source: this,
              details: u
            });
          }, et = new WeakSet(), kn = function() {
            if (!a(this, d)) {
              oe(this, d, !0);
              for (const u of a(this, G).values())
                u.enable();
            }
          }, Te = new WeakSet(), Rn = function() {
            if (this.unselectAll(), a(this, d)) {
              oe(this, d, !1);
              for (const u of a(this, G).values())
                u.disable();
            }
          }, ke = new WeakSet(), Kt = function(u) {
            const L = a(this, G).get(u.pageIndex);
            L ? L.addOrRebuild(u) : this.addEditor(u);
          }, Be = new WeakSet(), bt = function() {
            if (a(this, X).size === 0)
              return !0;
            if (a(this, X).size === 1)
              for (const u of a(this, X).values())
                return u.isEmpty();
            return !1;
          }, Ae = new WeakSet(), Jt = function(u) {
            a(this, A).clear();
            for (const L of u)
              L.isEmpty() || (a(this, A).add(L), L.select());
            K(this, J, at).call(this, {
              hasSelectedEditor: !0
            });
          }, nt(Oe, "TRANSLATE_SMALL", 1), nt(Oe, "TRANSLATE_BIG", 10);
          let S = Oe;
          e.AnnotationEditorUIManager = S;
        },
        /* 6 */
        /***/
        (t, e, i) => {
          var Y, q, le, pe, we, be, R, d, g, f, v, A, dt, H, ft, ae, Zt, ce, Pt, me, xt, Pe, yt, Ee, vt;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.StatTimer = e.RenderingCancelledException = e.PixelsPerInch = e.PageViewport = e.PDFDateString = e.DOMStandardFontDataFactory = e.DOMSVGFactory = e.DOMFilterFactory = e.DOMCanvasFactory = e.DOMCMapReaderFactory = void 0, e.deprecated = $, e.getColorValues = X, e.getCurrentTransform = G, e.getCurrentTransformInverse = I, e.getFilenameFromUrl = k, e.getPdfFilenameFromUrl = F, e.getRGB = D, e.getXfaPageViewport = N, e.isDataScheme = P, e.isPdfFile = b, e.isValidFetchUrl = y, e.loadScript = E, e.noContextMenu = p, e.setLayerDimensions = B;
          var n = i(7), s = i(1);
          const l = "http://www.w3.org/2000/svg", ee = class ee {
          };
          nt(ee, "CSS", 96), nt(ee, "PDF", 72), nt(ee, "PDF_TO_CSS_UNITS", ee.CSS / ee.PDF);
          let h = ee;
          e.PixelsPerInch = h;
          class _ extends n.BaseFilterFactory {
            constructor({
              docId: se,
              ownerDocument: ge = globalThis.document
            } = {}) {
              super();
              W(this, A);
              W(this, H);
              W(this, ae);
              W(this, ce);
              W(this, me);
              W(this, Pe);
              W(this, Ee);
              W(this, Y, void 0);
              W(this, q, void 0);
              W(this, le, void 0);
              W(this, pe, void 0);
              W(this, we, void 0);
              W(this, be, void 0);
              W(this, R, void 0);
              W(this, d, void 0);
              W(this, g, void 0);
              W(this, f, void 0);
              W(this, v, 0);
              oe(this, le, se), oe(this, pe, ge);
            }
            addFilter(se) {
              if (!se)
                return "none";
              let ge = a(this, A, dt).get(se);
              if (ge)
                return ge;
              let Ce, xe, He, We;
              if (se.length === 1) {
                const Ge = se[0], Ye = new Array(256);
                for (let de = 0; de < 256; de++)
                  Ye[de] = Ge[de] / 255;
                We = Ce = xe = He = Ye.join(",");
              } else {
                const [Ge, Ye, de] = se, ne = new Array(256), J = new Array(256), ve = new Array(256);
                for (let Se = 0; Se < 256; Se++)
                  ne[Se] = Ge[Se] / 255, J[Se] = Ye[Se] / 255, ve[Se] = de[Se] / 255;
                Ce = ne.join(","), xe = J.join(","), He = ve.join(","), We = `${Ce}${xe}${He}`;
              }
              if (ge = a(this, A, dt).get(We), ge)
                return a(this, A, dt).set(se, ge), ge;
              const je = `g_${a(this, le)}_transfer_map_${_t(this, v)._++}`, ze = `url(#${je})`;
              a(this, A, dt).set(se, ze), a(this, A, dt).set(We, ze);
              const Xe = K(this, ce, Pt).call(this, je);
              return K(this, Pe, yt).call(this, Ce, xe, He, Xe), ze;
            }
            addHCMFilter(se, ge) {
              var Ye;
              const Ce = `${se}-${ge}`;
              if (a(this, be) === Ce)
                return a(this, R);
              if (oe(this, be, Ce), oe(this, R, "none"), (Ye = a(this, we)) == null || Ye.remove(), !se || !ge)
                return a(this, R);
              const xe = K(this, Ee, vt).call(this, se);
              se = s.Util.makeHexColor(...xe);
              const He = K(this, Ee, vt).call(this, ge);
              if (ge = s.Util.makeHexColor(...He), a(this, H, ft).style.color = "", se === "#000000" && ge === "#ffffff" || se === ge)
                return a(this, R);
              const We = new Array(256);
              for (let de = 0; de <= 255; de++) {
                const ne = de / 255;
                We[de] = ne <= 0.03928 ? ne / 12.92 : ((ne + 0.055) / 1.055) ** 2.4;
              }
              const je = We.join(","), ze = `g_${a(this, le)}_hcm_filter`, Xe = oe(this, d, K(this, ce, Pt).call(this, ze));
              K(this, Pe, yt).call(this, je, je, je, Xe), K(this, ae, Zt).call(this, Xe);
              const Ge = (de, ne) => {
                const J = xe[de] / 255, ve = He[de] / 255, Se = new Array(ne + 1);
                for (let tt = 0; tt <= ne; tt++)
                  Se[tt] = J + tt / ne * (ve - J);
                return Se.join(",");
              };
              return K(this, Pe, yt).call(this, Ge(0, 5), Ge(1, 5), Ge(2, 5), Xe), oe(this, R, `url(#${ze})`), a(this, R);
            }
            addHighlightHCMFilter(se, ge, Ce, xe) {
              var ve;
              const He = `${se}-${ge}-${Ce}-${xe}`;
              if (a(this, g) === He)
                return a(this, f);
              if (oe(this, g, He), oe(this, f, "none"), (ve = a(this, d)) == null || ve.remove(), !se || !ge)
                return a(this, f);
              const [We, je] = [se, ge].map(K(this, Ee, vt).bind(this));
              let ze = Math.round(0.2126 * We[0] + 0.7152 * We[1] + 0.0722 * We[2]), Xe = Math.round(0.2126 * je[0] + 0.7152 * je[1] + 0.0722 * je[2]), [Ge, Ye] = [Ce, xe].map(K(this, Ee, vt).bind(this));
              Xe < ze && ([ze, Xe, Ge, Ye] = [Xe, ze, Ye, Ge]), a(this, H, ft).style.color = "";
              const de = (Se, tt, et) => {
                const te = new Array(256), Te = (Xe - ze) / et, Ne = Se / 255, ke = (tt - Se) / (255 * et);
                let $e = 0;
                for (let Be = 0; Be <= et; Be++) {
                  const Ze = Math.round(ze + Be * Te), Ae = Ne + Be * ke;
                  for (let Ke = $e; Ke <= Ze; Ke++)
                    te[Ke] = Ae;
                  $e = Ze + 1;
                }
                for (let Be = $e; Be < 256; Be++)
                  te[Be] = te[$e - 1];
                return te.join(",");
              }, ne = `g_${a(this, le)}_hcm_highlight_filter`, J = oe(this, d, K(this, ce, Pt).call(this, ne));
              return K(this, ae, Zt).call(this, J), K(this, Pe, yt).call(this, de(Ge[0], Ye[0], 5), de(Ge[1], Ye[1], 5), de(Ge[2], Ye[2], 5), J), oe(this, f, `url(#${ne})`), a(this, f);
            }
            destroy(se = !1) {
              se && (a(this, R) || a(this, f)) || (a(this, q) && (a(this, q).parentNode.parentNode.remove(), oe(this, q, null)), a(this, Y) && (a(this, Y).clear(), oe(this, Y, null)), oe(this, v, 0));
            }
          }
          Y = new WeakMap(), q = new WeakMap(), le = new WeakMap(), pe = new WeakMap(), we = new WeakMap(), be = new WeakMap(), R = new WeakMap(), d = new WeakMap(), g = new WeakMap(), f = new WeakMap(), v = new WeakMap(), A = new WeakSet(), dt = function() {
            return a(this, Y) || oe(this, Y, /* @__PURE__ */ new Map());
          }, H = new WeakSet(), ft = function() {
            if (!a(this, q)) {
              const se = a(this, pe).createElement("div"), {
                style: ge
              } = se;
              ge.visibility = "hidden", ge.contain = "strict", ge.width = ge.height = 0, ge.position = "absolute", ge.top = ge.left = 0, ge.zIndex = -1;
              const Ce = a(this, pe).createElementNS(l, "svg");
              Ce.setAttribute("width", 0), Ce.setAttribute("height", 0), oe(this, q, a(this, pe).createElementNS(l, "defs")), se.append(Ce), Ce.append(a(this, q)), a(this, pe).body.append(se);
            }
            return a(this, q);
          }, ae = new WeakSet(), Zt = function(se) {
            const ge = a(this, pe).createElementNS(l, "feColorMatrix");
            ge.setAttribute("type", "matrix"), ge.setAttribute("values", "0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"), se.append(ge);
          }, ce = new WeakSet(), Pt = function(se) {
            const ge = a(this, pe).createElementNS(l, "filter");
            return ge.setAttribute("color-interpolation-filters", "sRGB"), ge.setAttribute("id", se), a(this, H, ft).append(ge), ge;
          }, me = new WeakSet(), xt = function(se, ge, Ce) {
            const xe = a(this, pe).createElementNS(l, ge);
            xe.setAttribute("type", "discrete"), xe.setAttribute("tableValues", Ce), se.append(xe);
          }, Pe = new WeakSet(), yt = function(se, ge, Ce, xe) {
            const He = a(this, pe).createElementNS(l, "feComponentTransfer");
            xe.append(He), K(this, me, xt).call(this, He, "feFuncR", se), K(this, me, xt).call(this, He, "feFuncG", ge), K(this, me, xt).call(this, He, "feFuncB", Ce);
          }, Ee = new WeakSet(), vt = function(se) {
            return a(this, H, ft).style.color = se, D(getComputedStyle(a(this, H, ft)).getPropertyValue("color"));
          }, e.DOMFilterFactory = _;
          class c extends n.BaseCanvasFactory {
            constructor({
              ownerDocument: ie = globalThis.document
            } = {}) {
              super(), this._document = ie;
            }
            _createCanvas(ie, se) {
              const ge = this._document.createElement("canvas");
              return ge.width = ie, ge.height = se, ge;
            }
          }
          e.DOMCanvasFactory = c;
          async function o(_e, ie = !1) {
            if (y(_e, document.baseURI)) {
              const se = await fetch(_e);
              if (!se.ok)
                throw new Error(se.statusText);
              return ie ? new Uint8Array(await se.arrayBuffer()) : (0, s.stringToBytes)(await se.text());
            }
            return new Promise((se, ge) => {
              const Ce = new XMLHttpRequest();
              Ce.open("GET", _e, !0), ie && (Ce.responseType = "arraybuffer"), Ce.onreadystatechange = () => {
                if (Ce.readyState === XMLHttpRequest.DONE) {
                  if (Ce.status === 200 || Ce.status === 0) {
                    let xe;
                    if (ie && Ce.response ? xe = new Uint8Array(Ce.response) : !ie && Ce.responseText && (xe = (0, s.stringToBytes)(Ce.responseText)), xe) {
                      se(xe);
                      return;
                    }
                  }
                  ge(new Error(Ce.statusText));
                }
              }, Ce.send(null);
            });
          }
          class r extends n.BaseCMapReaderFactory {
            _fetchData(ie, se) {
              return o(ie, this.isCompressed).then((ge) => ({
                cMapData: ge,
                compressionType: se
              }));
            }
          }
          e.DOMCMapReaderFactory = r;
          class T extends n.BaseStandardFontDataFactory {
            _fetchData(ie) {
              return o(ie, !0);
            }
          }
          e.DOMStandardFontDataFactory = T;
          class S extends n.BaseSVGFactory {
            _createSVG(ie) {
              return document.createElementNS(l, ie);
            }
          }
          e.DOMSVGFactory = S;
          class w {
            constructor({
              viewBox: ie,
              scale: se,
              rotation: ge,
              offsetX: Ce = 0,
              offsetY: xe = 0,
              dontFlip: He = !1
            }) {
              this.viewBox = ie, this.scale = se, this.rotation = ge, this.offsetX = Ce, this.offsetY = xe;
              const We = (ie[2] + ie[0]) / 2, je = (ie[3] + ie[1]) / 2;
              let ze, Xe, Ge, Ye;
              switch (ge %= 360, ge < 0 && (ge += 360), ge) {
                case 180:
                  ze = -1, Xe = 0, Ge = 0, Ye = 1;
                  break;
                case 90:
                  ze = 0, Xe = 1, Ge = 1, Ye = 0;
                  break;
                case 270:
                  ze = 0, Xe = -1, Ge = -1, Ye = 0;
                  break;
                case 0:
                  ze = 1, Xe = 0, Ge = 0, Ye = -1;
                  break;
                default:
                  throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.");
              }
              He && (Ge = -Ge, Ye = -Ye);
              let de, ne, J, ve;
              ze === 0 ? (de = Math.abs(je - ie[1]) * se + Ce, ne = Math.abs(We - ie[0]) * se + xe, J = (ie[3] - ie[1]) * se, ve = (ie[2] - ie[0]) * se) : (de = Math.abs(We - ie[0]) * se + Ce, ne = Math.abs(je - ie[1]) * se + xe, J = (ie[2] - ie[0]) * se, ve = (ie[3] - ie[1]) * se), this.transform = [ze * se, Xe * se, Ge * se, Ye * se, de - ze * se * We - Ge * se * je, ne - Xe * se * We - Ye * se * je], this.width = J, this.height = ve;
            }
            get rawDims() {
              const {
                viewBox: ie
              } = this;
              return (0, s.shadow)(this, "rawDims", {
                pageWidth: ie[2] - ie[0],
                pageHeight: ie[3] - ie[1],
                pageX: ie[0],
                pageY: ie[1]
              });
            }
            clone({
              scale: ie = this.scale,
              rotation: se = this.rotation,
              offsetX: ge = this.offsetX,
              offsetY: Ce = this.offsetY,
              dontFlip: xe = !1
            } = {}) {
              return new w({
                viewBox: this.viewBox.slice(),
                scale: ie,
                rotation: se,
                offsetX: ge,
                offsetY: Ce,
                dontFlip: xe
              });
            }
            convertToViewportPoint(ie, se) {
              return s.Util.applyTransform([ie, se], this.transform);
            }
            convertToViewportRectangle(ie) {
              const se = s.Util.applyTransform([ie[0], ie[1]], this.transform), ge = s.Util.applyTransform([ie[2], ie[3]], this.transform);
              return [se[0], se[1], ge[0], ge[1]];
            }
            convertToPdfPoint(ie, se) {
              return s.Util.applyInverseTransform([ie, se], this.transform);
            }
          }
          e.PageViewport = w;
          class C extends s.BaseException {
            constructor(ie, se = 0) {
              super(ie, "RenderingCancelledException"), this.extraDelay = se;
            }
          }
          e.RenderingCancelledException = C;
          function P(_e) {
            const ie = _e.length;
            let se = 0;
            for (; se < ie && _e[se].trim() === ""; )
              se++;
            return _e.substring(se, se + 5).toLowerCase() === "data:";
          }
          function b(_e) {
            return typeof _e == "string" && /\.pdf$/i.test(_e);
          }
          function k(_e, ie = !1) {
            return ie || ([_e] = _e.split(/[#?]/, 1)), _e.substring(_e.lastIndexOf("/") + 1);
          }
          function F(_e, ie = "document.pdf") {
            if (typeof _e != "string")
              return ie;
            if (P(_e))
              return (0, s.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'), ie;
            const se = /^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/, ge = /[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i, Ce = se.exec(_e);
            let xe = ge.exec(Ce[1]) || ge.exec(Ce[2]) || ge.exec(Ce[3]);
            if (xe && (xe = xe[0], xe.includes("%")))
              try {
                xe = ge.exec(decodeURIComponent(xe))[0];
              } catch {
              }
            return xe || ie;
          }
          class x {
            constructor() {
              nt(this, "started", /* @__PURE__ */ Object.create(null));
              nt(this, "times", []);
            }
            time(ie) {
              ie in this.started && (0, s.warn)(`Timer is already running for ${ie}`), this.started[ie] = Date.now();
            }
            timeEnd(ie) {
              ie in this.started || (0, s.warn)(`Timer has not been started for ${ie}`), this.times.push({
                name: ie,
                start: this.started[ie],
                end: Date.now()
              }), delete this.started[ie];
            }
            toString() {
              const ie = [];
              let se = 0;
              for (const {
                name: ge
              } of this.times)
                se = Math.max(ge.length, se);
              for (const {
                name: ge,
                start: Ce,
                end: xe
              } of this.times)
                ie.push(`${ge.padEnd(se)} ${xe - Ce}ms
`);
              return ie.join("");
            }
          }
          e.StatTimer = x;
          function y(_e, ie) {
            try {
              const {
                protocol: se
              } = ie ? new URL(_e, ie) : new URL(_e);
              return se === "http:" || se === "https:";
            } catch {
              return !1;
            }
          }
          function p(_e) {
            _e.preventDefault();
          }
          function E(_e, ie = !1) {
            return new Promise((se, ge) => {
              const Ce = document.createElement("script");
              Ce.src = _e, Ce.onload = function(xe) {
                ie && Ce.remove(), se(xe);
              }, Ce.onerror = function() {
                ge(new Error(`Cannot load script at: ${Ce.src}`));
              }, (document.head || document.documentElement).append(Ce);
            });
          }
          function $(_e) {
            console.log("Deprecated API usage: " + _e);
          }
          let M;
          class m {
            static toDateObject(ie) {
              if (!ie || typeof ie != "string")
                return null;
              M || (M = new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));
              const se = M.exec(ie);
              if (!se)
                return null;
              const ge = parseInt(se[1], 10);
              let Ce = parseInt(se[2], 10);
              Ce = Ce >= 1 && Ce <= 12 ? Ce - 1 : 0;
              let xe = parseInt(se[3], 10);
              xe = xe >= 1 && xe <= 31 ? xe : 1;
              let He = parseInt(se[4], 10);
              He = He >= 0 && He <= 23 ? He : 0;
              let We = parseInt(se[5], 10);
              We = We >= 0 && We <= 59 ? We : 0;
              let je = parseInt(se[6], 10);
              je = je >= 0 && je <= 59 ? je : 0;
              const ze = se[7] || "Z";
              let Xe = parseInt(se[8], 10);
              Xe = Xe >= 0 && Xe <= 23 ? Xe : 0;
              let Ge = parseInt(se[9], 10) || 0;
              return Ge = Ge >= 0 && Ge <= 59 ? Ge : 0, ze === "-" ? (He += Xe, We += Ge) : ze === "+" && (He -= Xe, We -= Ge), new Date(Date.UTC(ge, Ce, xe, He, We, je));
            }
          }
          e.PDFDateString = m;
          function N(_e, {
            scale: ie = 1,
            rotation: se = 0
          }) {
            const {
              width: ge,
              height: Ce
            } = _e.attributes.style, xe = [0, 0, parseInt(ge), parseInt(Ce)];
            return new w({
              viewBox: xe,
              scale: ie,
              rotation: se
            });
          }
          function D(_e) {
            if (_e.startsWith("#")) {
              const ie = parseInt(_e.slice(1), 16);
              return [(ie & 16711680) >> 16, (ie & 65280) >> 8, ie & 255];
            }
            return _e.startsWith("rgb(") ? _e.slice(4, -1).split(",").map((ie) => parseInt(ie)) : _e.startsWith("rgba(") ? _e.slice(5, -1).split(",").map((ie) => parseInt(ie)).slice(0, 3) : ((0, s.warn)(`Not a valid color format: "${_e}"`), [0, 0, 0]);
          }
          function X(_e) {
            const ie = document.createElement("span");
            ie.style.visibility = "hidden", document.body.append(ie);
            for (const se of _e.keys()) {
              ie.style.color = se;
              const ge = window.getComputedStyle(ie).color;
              _e.set(se, D(ge));
            }
            ie.remove();
          }
          function G(_e) {
            const {
              a: ie,
              b: se,
              c: ge,
              d: Ce,
              e: xe,
              f: He
            } = _e.getTransform();
            return [ie, se, ge, Ce, xe, He];
          }
          function I(_e) {
            const {
              a: ie,
              b: se,
              c: ge,
              d: Ce,
              e: xe,
              f: He
            } = _e.getTransform().invertSelf();
            return [ie, se, ge, Ce, xe, He];
          }
          function B(_e, ie, se = !1, ge = !0) {
            if (ie instanceof w) {
              const {
                pageWidth: Ce,
                pageHeight: xe
              } = ie.rawDims, {
                style: He
              } = _e, We = s.FeatureTest.isCSSRoundSupported, je = `var(--scale-factor) * ${Ce}px`, ze = `var(--scale-factor) * ${xe}px`, Xe = We ? `round(${je}, 1px)` : `calc(${je})`, Ge = We ? `round(${ze}, 1px)` : `calc(${ze})`;
              !se || ie.rotation % 180 === 0 ? (He.width = Xe, He.height = Ge) : (He.width = Ge, He.height = Xe);
            }
            ge && _e.setAttribute("data-main-rotation", ie.rotation);
          }
        },
        /* 7 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.BaseStandardFontDataFactory = e.BaseSVGFactory = e.BaseFilterFactory = e.BaseCanvasFactory = e.BaseCMapReaderFactory = void 0;
          var n = i(1);
          class s {
            constructor() {
              this.constructor === s && (0, n.unreachable)("Cannot initialize BaseFilterFactory.");
            }
            addFilter(r) {
              return "none";
            }
            addHCMFilter(r, T) {
              return "none";
            }
            addHighlightHCMFilter(r, T, S, w) {
              return "none";
            }
            destroy(r = !1) {
            }
          }
          e.BaseFilterFactory = s;
          class l {
            constructor() {
              this.constructor === l && (0, n.unreachable)("Cannot initialize BaseCanvasFactory.");
            }
            create(r, T) {
              if (r <= 0 || T <= 0)
                throw new Error("Invalid canvas size");
              const S = this._createCanvas(r, T);
              return {
                canvas: S,
                context: S.getContext("2d")
              };
            }
            reset(r, T, S) {
              if (!r.canvas)
                throw new Error("Canvas is not specified");
              if (T <= 0 || S <= 0)
                throw new Error("Invalid canvas size");
              r.canvas.width = T, r.canvas.height = S;
            }
            destroy(r) {
              if (!r.canvas)
                throw new Error("Canvas is not specified");
              r.canvas.width = 0, r.canvas.height = 0, r.canvas = null, r.context = null;
            }
            _createCanvas(r, T) {
              (0, n.unreachable)("Abstract method `_createCanvas` called.");
            }
          }
          e.BaseCanvasFactory = l;
          class h {
            constructor({
              baseUrl: r = null,
              isCompressed: T = !0
            }) {
              this.constructor === h && (0, n.unreachable)("Cannot initialize BaseCMapReaderFactory."), this.baseUrl = r, this.isCompressed = T;
            }
            async fetch({
              name: r
            }) {
              if (!this.baseUrl)
                throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');
              if (!r)
                throw new Error("CMap name must be specified.");
              const T = this.baseUrl + r + (this.isCompressed ? ".bcmap" : ""), S = this.isCompressed ? n.CMapCompressionType.BINARY : n.CMapCompressionType.NONE;
              return this._fetchData(T, S).catch((w) => {
                throw new Error(`Unable to load ${this.isCompressed ? "binary " : ""}CMap at: ${T}`);
              });
            }
            _fetchData(r, T) {
              (0, n.unreachable)("Abstract method `_fetchData` called.");
            }
          }
          e.BaseCMapReaderFactory = h;
          class _ {
            constructor({
              baseUrl: r = null
            }) {
              this.constructor === _ && (0, n.unreachable)("Cannot initialize BaseStandardFontDataFactory."), this.baseUrl = r;
            }
            async fetch({
              filename: r
            }) {
              if (!this.baseUrl)
                throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');
              if (!r)
                throw new Error("Font filename must be specified.");
              const T = `${this.baseUrl}${r}`;
              return this._fetchData(T).catch((S) => {
                throw new Error(`Unable to load font data at: ${T}`);
              });
            }
            _fetchData(r) {
              (0, n.unreachable)("Abstract method `_fetchData` called.");
            }
          }
          e.BaseStandardFontDataFactory = _;
          class c {
            constructor() {
              this.constructor === c && (0, n.unreachable)("Cannot initialize BaseSVGFactory.");
            }
            create(r, T, S = !1) {
              if (r <= 0 || T <= 0)
                throw new Error("Invalid SVG dimensions");
              const w = this._createSVG("svg:svg");
              return w.setAttribute("version", "1.1"), S || (w.setAttribute("width", `${r}px`), w.setAttribute("height", `${T}px`)), w.setAttribute("preserveAspectRatio", "none"), w.setAttribute("viewBox", `0 0 ${r} ${T}`), w;
            }
            createElement(r) {
              if (typeof r != "string")
                throw new Error("Invalid SVG element type");
              return this._createSVG(r);
            }
            _createSVG(r) {
              (0, n.unreachable)("Abstract method `_createSVG` called.");
            }
          }
          e.BaseSVGFactory = c;
        },
        /* 8 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.MurmurHash3_64 = void 0;
          var n = i(1);
          const s = 3285377520, l = 4294901760, h = 65535;
          class _ {
            constructor(o) {
              this.h1 = o ? o & 4294967295 : s, this.h2 = o ? o & 4294967295 : s;
            }
            update(o) {
              let r, T;
              if (typeof o == "string") {
                r = new Uint8Array(o.length * 2), T = 0;
                for (let $ = 0, M = o.length; $ < M; $++) {
                  const m = o.charCodeAt($);
                  m <= 255 ? r[T++] = m : (r[T++] = m >>> 8, r[T++] = m & 255);
                }
              } else if ((0, n.isArrayBuffer)(o))
                r = o.slice(), T = r.byteLength;
              else
                throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");
              const S = T >> 2, w = T - S * 4, C = new Uint32Array(r.buffer, 0, S);
              let P = 0, b = 0, k = this.h1, F = this.h2;
              const x = 3432918353, y = 461845907, p = x & h, E = y & h;
              for (let $ = 0; $ < S; $++)
                $ & 1 ? (P = C[$], P = P * x & l | P * p & h, P = P << 15 | P >>> 17, P = P * y & l | P * E & h, k ^= P, k = k << 13 | k >>> 19, k = k * 5 + 3864292196) : (b = C[$], b = b * x & l | b * p & h, b = b << 15 | b >>> 17, b = b * y & l | b * E & h, F ^= b, F = F << 13 | F >>> 19, F = F * 5 + 3864292196);
              switch (P = 0, w) {
                case 3:
                  P ^= r[S * 4 + 2] << 16;
                case 2:
                  P ^= r[S * 4 + 1] << 8;
                case 1:
                  P ^= r[S * 4], P = P * x & l | P * p & h, P = P << 15 | P >>> 17, P = P * y & l | P * E & h, S & 1 ? k ^= P : F ^= P;
              }
              this.h1 = k, this.h2 = F;
            }
            hexdigest() {
              let o = this.h1, r = this.h2;
              return o ^= r >>> 1, o = o * 3981806797 & l | o * 36045 & h, r = r * 4283543511 & l | ((r << 16 | o >>> 16) * 2950163797 & l) >>> 16, o ^= r >>> 1, o = o * 444984403 & l | o * 60499 & h, r = r * 3301882366 & l | ((r << 16 | o >>> 16) * 3120437893 & l) >>> 16, o ^= r >>> 1, (o >>> 0).toString(16).padStart(8, "0") + (r >>> 0).toString(16).padStart(8, "0");
            }
          }
          e.MurmurHash3_64 = _;
        },
        /* 9 */
        /***/
        (t, e, i) => {
          var h;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.FontLoader = e.FontFaceObject = void 0;
          var n = i(1);
          class s {
            constructor({
              ownerDocument: c = globalThis.document,
              styleElement: o = null
            }) {
              W(this, h, /* @__PURE__ */ new Set());
              this._document = c, this.nativeFontFaces = /* @__PURE__ */ new Set(), this.styleElement = null, this.loadingRequests = [], this.loadTestFontId = 0;
            }
            addNativeFontFace(c) {
              this.nativeFontFaces.add(c), this._document.fonts.add(c);
            }
            removeNativeFontFace(c) {
              this.nativeFontFaces.delete(c), this._document.fonts.delete(c);
            }
            insertRule(c) {
              this.styleElement || (this.styleElement = this._document.createElement("style"), this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));
              const o = this.styleElement.sheet;
              o.insertRule(c, o.cssRules.length);
            }
            clear() {
              for (const c of this.nativeFontFaces)
                this._document.fonts.delete(c);
              this.nativeFontFaces.clear(), a(this, h).clear(), this.styleElement && (this.styleElement.remove(), this.styleElement = null);
            }
            async loadSystemFont(c) {
              if (!(!c || a(this, h).has(c.loadedName))) {
                if ((0, n.assert)(!this.disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set."), this.isFontLoadingAPISupported) {
                  const {
                    loadedName: o,
                    src: r,
                    style: T
                  } = c, S = new FontFace(o, r, T);
                  this.addNativeFontFace(S);
                  try {
                    await S.load(), a(this, h).add(o);
                  } catch {
                    (0, n.warn)(`Cannot load system font: ${c.baseFontName}, installing it could help to improve PDF rendering.`), this.removeNativeFontFace(S);
                  }
                  return;
                }
                (0, n.unreachable)("Not implemented: loadSystemFont without the Font Loading API.");
              }
            }
            async bind(c) {
              if (c.attached || c.missingFile && !c.systemFontInfo)
                return;
              if (c.attached = !0, c.systemFontInfo) {
                await this.loadSystemFont(c.systemFontInfo);
                return;
              }
              if (this.isFontLoadingAPISupported) {
                const r = c.createNativeFontFace();
                if (r) {
                  this.addNativeFontFace(r);
                  try {
                    await r.loaded;
                  } catch (T) {
                    throw (0, n.warn)(`Failed to load font '${r.family}': '${T}'.`), c.disableFontFace = !0, T;
                  }
                }
                return;
              }
              const o = c.createFontFaceRule();
              if (o) {
                if (this.insertRule(o), this.isSyncFontLoadingSupported)
                  return;
                await new Promise((r) => {
                  const T = this._queueLoadingCallback(r);
                  this._prepareFontLoadEvent(c, T);
                });
              }
            }
            get isFontLoadingAPISupported() {
              var o;
              const c = !!((o = this._document) != null && o.fonts);
              return (0, n.shadow)(this, "isFontLoadingAPISupported", c);
            }
            get isSyncFontLoadingSupported() {
              let c = !1;
              return (n.isNodeJS || typeof navigator < "u" && /Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)) && (c = !0), (0, n.shadow)(this, "isSyncFontLoadingSupported", c);
            }
            _queueLoadingCallback(c) {
              function o() {
                for ((0, n.assert)(!T.done, "completeRequest() cannot be called twice."), T.done = !0; r.length > 0 && r[0].done; ) {
                  const S = r.shift();
                  setTimeout(S.callback, 0);
                }
              }
              const {
                loadingRequests: r
              } = this, T = {
                done: !1,
                complete: o,
                callback: c
              };
              return r.push(T), T;
            }
            get _loadTestFont() {
              const c = atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");
              return (0, n.shadow)(this, "_loadTestFont", c);
            }
            _prepareFontLoadEvent(c, o) {
              function r(D, X) {
                return D.charCodeAt(X) << 24 | D.charCodeAt(X + 1) << 16 | D.charCodeAt(X + 2) << 8 | D.charCodeAt(X + 3) & 255;
              }
              function T(D, X, G, I) {
                const B = D.substring(0, X), ee = D.substring(X + G);
                return B + I + ee;
              }
              let S, w;
              const C = this._document.createElement("canvas");
              C.width = 1, C.height = 1;
              const P = C.getContext("2d");
              let b = 0;
              function k(D, X) {
                if (++b > 30) {
                  (0, n.warn)("Load test font never loaded."), X();
                  return;
                }
                if (P.font = "30px " + D, P.fillText(".", 0, 20), P.getImageData(0, 0, 1, 1).data[3] > 0) {
                  X();
                  return;
                }
                setTimeout(k.bind(null, D, X));
              }
              const F = `lt${Date.now()}${this.loadTestFontId++}`;
              let x = this._loadTestFont;
              x = T(x, 976, F.length, F);
              const p = 16, E = 1482184792;
              let $ = r(x, p);
              for (S = 0, w = F.length - 3; S < w; S += 4)
                $ = $ - E + r(F, S) | 0;
              S < F.length && ($ = $ - E + r(F + "XXX", S) | 0), x = T(x, p, 4, (0, n.string32)($));
              const M = `url(data:font/opentype;base64,${btoa(x)});`, m = `@font-face {font-family:"${F}";src:${M}}`;
              this.insertRule(m);
              const N = this._document.createElement("div");
              N.style.visibility = "hidden", N.style.width = N.style.height = "10px", N.style.position = "absolute", N.style.top = N.style.left = "0px";
              for (const D of [c.loadedName, F]) {
                const X = this._document.createElement("span");
                X.textContent = "Hi", X.style.fontFamily = D, N.append(X);
              }
              this._document.body.append(N), k(F, () => {
                N.remove(), o.complete();
              });
            }
          }
          h = new WeakMap(), e.FontLoader = s;
          class l {
            constructor(c, {
              isEvalSupported: o = !0,
              disableFontFace: r = !1,
              ignoreErrors: T = !1,
              inspectFont: S = null
            }) {
              this.compiledGlyphs = /* @__PURE__ */ Object.create(null);
              for (const w in c)
                this[w] = c[w];
              this.isEvalSupported = o !== !1, this.disableFontFace = r === !0, this.ignoreErrors = T === !0, this._inspectFont = S;
            }
            createNativeFontFace() {
              var o;
              if (!this.data || this.disableFontFace)
                return null;
              let c;
              if (!this.cssFontInfo)
                c = new FontFace(this.loadedName, this.data, {});
              else {
                const r = {
                  weight: this.cssFontInfo.fontWeight
                };
                this.cssFontInfo.italicAngle && (r.style = `oblique ${this.cssFontInfo.italicAngle}deg`), c = new FontFace(this.cssFontInfo.fontFamily, this.data, r);
              }
              return (o = this._inspectFont) == null || o.call(this, this), c;
            }
            createFontFaceRule() {
              var T;
              if (!this.data || this.disableFontFace)
                return null;
              const c = (0, n.bytesToString)(this.data), o = `url(data:${this.mimetype};base64,${btoa(c)});`;
              let r;
              if (!this.cssFontInfo)
                r = `@font-face {font-family:"${this.loadedName}";src:${o}}`;
              else {
                let S = `font-weight: ${this.cssFontInfo.fontWeight};`;
                this.cssFontInfo.italicAngle && (S += `font-style: oblique ${this.cssFontInfo.italicAngle}deg;`), r = `@font-face {font-family:"${this.cssFontInfo.fontFamily}";${S}src:${o}}`;
              }
              return (T = this._inspectFont) == null || T.call(this, this, o), r;
            }
            getPathGenerator(c, o) {
              if (this.compiledGlyphs[o] !== void 0)
                return this.compiledGlyphs[o];
              let r;
              try {
                r = c.get(this.loadedName + "_path_" + o);
              } catch (T) {
                if (!this.ignoreErrors)
                  throw T;
                return (0, n.warn)(`getPathGenerator - ignoring character: "${T}".`), this.compiledGlyphs[o] = function(S, w) {
                };
              }
              if (this.isEvalSupported && n.FeatureTest.isEvalSupported) {
                const T = [];
                for (const S of r) {
                  const w = S.args !== void 0 ? S.args.join(",") : "";
                  T.push("c.", S.cmd, "(", w, `);
`);
                }
                return this.compiledGlyphs[o] = new Function("c", "size", T.join(""));
              }
              return this.compiledGlyphs[o] = function(T, S) {
                for (const w of r)
                  w.cmd === "scale" && (w.args = [S, -S]), T[w.cmd].apply(T, w.args);
              };
            }
          }
          e.FontFaceObject = l;
        },
        /* 10 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.NodeStandardFontDataFactory = e.NodeFilterFactory = e.NodeCanvasFactory = e.NodeCMapReaderFactory = void 0;
          var n = i(7);
          i(1);
          const s = function(o) {
            return new Promise((r, T) => {
              require$$5.readFile(o, (w, C) => {
                if (w || !C) {
                  T(new Error(w));
                  return;
                }
                r(new Uint8Array(C));
              });
            });
          };
          class l extends n.BaseFilterFactory {
          }
          e.NodeFilterFactory = l;
          class h extends n.BaseCanvasFactory {
            _createCanvas(r, T) {
              return require$$5.createCanvas(r, T);
            }
          }
          e.NodeCanvasFactory = h;
          class _ extends n.BaseCMapReaderFactory {
            _fetchData(r, T) {
              return s(r).then((S) => ({
                cMapData: S,
                compressionType: T
              }));
            }
          }
          e.NodeCMapReaderFactory = _;
          class c extends n.BaseStandardFontDataFactory {
            _fetchData(r) {
              return s(r);
            }
          }
          e.NodeStandardFontDataFactory = c;
        },
        /* 11 */
        /***/
        (t, e, i) => {
          var q, Qt, pe, en;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.CanvasGraphics = void 0;
          var n = i(1), s = i(6), l = i(12), h = i(13);
          const _ = 16, c = 100, o = 4096, r = 15, T = 10, S = 1e3, w = 16;
          function C(R, d) {
            if (R._removeMirroring)
              throw new Error("Context is already forwarding operations.");
            R.__originalSave = R.save, R.__originalRestore = R.restore, R.__originalRotate = R.rotate, R.__originalScale = R.scale, R.__originalTranslate = R.translate, R.__originalTransform = R.transform, R.__originalSetTransform = R.setTransform, R.__originalResetTransform = R.resetTransform, R.__originalClip = R.clip, R.__originalMoveTo = R.moveTo, R.__originalLineTo = R.lineTo, R.__originalBezierCurveTo = R.bezierCurveTo, R.__originalRect = R.rect, R.__originalClosePath = R.closePath, R.__originalBeginPath = R.beginPath, R._removeMirroring = () => {
              R.save = R.__originalSave, R.restore = R.__originalRestore, R.rotate = R.__originalRotate, R.scale = R.__originalScale, R.translate = R.__originalTranslate, R.transform = R.__originalTransform, R.setTransform = R.__originalSetTransform, R.resetTransform = R.__originalResetTransform, R.clip = R.__originalClip, R.moveTo = R.__originalMoveTo, R.lineTo = R.__originalLineTo, R.bezierCurveTo = R.__originalBezierCurveTo, R.rect = R.__originalRect, R.closePath = R.__originalClosePath, R.beginPath = R.__originalBeginPath, delete R._removeMirroring;
            }, R.save = function() {
              d.save(), this.__originalSave();
            }, R.restore = function() {
              d.restore(), this.__originalRestore();
            }, R.translate = function(f, v) {
              d.translate(f, v), this.__originalTranslate(f, v);
            }, R.scale = function(f, v) {
              d.scale(f, v), this.__originalScale(f, v);
            }, R.transform = function(f, v, A, O, H, z) {
              d.transform(f, v, A, O, H, z), this.__originalTransform(f, v, A, O, H, z);
            }, R.setTransform = function(f, v, A, O, H, z) {
              d.setTransform(f, v, A, O, H, z), this.__originalSetTransform(f, v, A, O, H, z);
            }, R.resetTransform = function() {
              d.resetTransform(), this.__originalResetTransform();
            }, R.rotate = function(f) {
              d.rotate(f), this.__originalRotate(f);
            }, R.clip = function(f) {
              d.clip(f), this.__originalClip(f);
            }, R.moveTo = function(g, f) {
              d.moveTo(g, f), this.__originalMoveTo(g, f);
            }, R.lineTo = function(g, f) {
              d.lineTo(g, f), this.__originalLineTo(g, f);
            }, R.bezierCurveTo = function(g, f, v, A, O, H) {
              d.bezierCurveTo(g, f, v, A, O, H), this.__originalBezierCurveTo(g, f, v, A, O, H);
            }, R.rect = function(g, f, v, A) {
              d.rect(g, f, v, A), this.__originalRect(g, f, v, A);
            }, R.closePath = function() {
              d.closePath(), this.__originalClosePath();
            }, R.beginPath = function() {
              d.beginPath(), this.__originalBeginPath();
            };
          }
          class P {
            constructor(d) {
              this.canvasFactory = d, this.cache = /* @__PURE__ */ Object.create(null);
            }
            getCanvas(d, g, f) {
              let v;
              return this.cache[d] !== void 0 ? (v = this.cache[d], this.canvasFactory.reset(v, g, f)) : (v = this.canvasFactory.create(g, f), this.cache[d] = v), v;
            }
            delete(d) {
              delete this.cache[d];
            }
            clear() {
              for (const d in this.cache) {
                const g = this.cache[d];
                this.canvasFactory.destroy(g), delete this.cache[d];
              }
            }
          }
          function b(R, d, g, f, v, A, O, H, z, ae) {
            const [Z, ce, ue, me, fe, Pe] = (0, s.getCurrentTransform)(R);
            if (ce === 0 && ue === 0) {
              const De = O * Z + fe, _e = Math.round(De), ie = H * me + Pe, se = Math.round(ie), ge = (O + z) * Z + fe, Ce = Math.abs(Math.round(ge) - _e) || 1, xe = (H + ae) * me + Pe, He = Math.abs(Math.round(xe) - se) || 1;
              return R.setTransform(Math.sign(Z), 0, 0, Math.sign(me), _e, se), R.drawImage(d, g, f, v, A, 0, 0, Ce, He), R.setTransform(Z, ce, ue, me, fe, Pe), [Ce, He];
            }
            if (Z === 0 && me === 0) {
              const De = H * ue + fe, _e = Math.round(De), ie = O * ce + Pe, se = Math.round(ie), ge = (H + ae) * ue + fe, Ce = Math.abs(Math.round(ge) - _e) || 1, xe = (O + z) * ce + Pe, He = Math.abs(Math.round(xe) - se) || 1;
              return R.setTransform(0, Math.sign(ce), Math.sign(ue), 0, _e, se), R.drawImage(d, g, f, v, A, 0, 0, He, Ce), R.setTransform(Z, ce, ue, me, fe, Pe), [He, Ce];
            }
            R.drawImage(d, g, f, v, A, O, H, z, ae);
            const Fe = Math.hypot(Z, ce), Ee = Math.hypot(ue, me);
            return [Fe * z, Ee * ae];
          }
          function k(R) {
            const {
              width: d,
              height: g
            } = R;
            if (d > S || g > S)
              return null;
            const f = 1e3, v = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]), A = d + 1;
            let O = new Uint8Array(A * (g + 1)), H, z, ae;
            const Z = d + 7 & -8;
            let ce = new Uint8Array(Z * g), ue = 0;
            for (const Ee of R.data) {
              let De = 128;
              for (; De > 0; )
                ce[ue++] = Ee & De ? 0 : 255, De >>= 1;
            }
            let me = 0;
            for (ue = 0, ce[ue] !== 0 && (O[0] = 1, ++me), z = 1; z < d; z++)
              ce[ue] !== ce[ue + 1] && (O[z] = ce[ue] ? 2 : 1, ++me), ue++;
            for (ce[ue] !== 0 && (O[z] = 2, ++me), H = 1; H < g; H++) {
              ue = H * Z, ae = H * A, ce[ue - Z] !== ce[ue] && (O[ae] = ce[ue] ? 1 : 8, ++me);
              let Ee = (ce[ue] ? 4 : 0) + (ce[ue - Z] ? 8 : 0);
              for (z = 1; z < d; z++)
                Ee = (Ee >> 2) + (ce[ue + 1] ? 4 : 0) + (ce[ue - Z + 1] ? 8 : 0), v[Ee] && (O[ae + z] = v[Ee], ++me), ue++;
              if (ce[ue - Z] !== ce[ue] && (O[ae + z] = ce[ue] ? 2 : 4, ++me), me > f)
                return null;
            }
            for (ue = Z * (g - 1), ae = H * A, ce[ue] !== 0 && (O[ae] = 8, ++me), z = 1; z < d; z++)
              ce[ue] !== ce[ue + 1] && (O[ae + z] = ce[ue] ? 4 : 8, ++me), ue++;
            if (ce[ue] !== 0 && (O[ae + z] = 4, ++me), me > f)
              return null;
            const fe = new Int32Array([0, A, -1, 0, -A, 0, 0, 0, 1]), Pe = new Path2D();
            for (H = 0; me && H <= g; H++) {
              let Ee = H * A;
              const De = Ee + d;
              for (; Ee < De && !O[Ee]; )
                Ee++;
              if (Ee === De)
                continue;
              Pe.moveTo(Ee % A, H);
              const _e = Ee;
              let ie = O[Ee];
              do {
                const se = fe[ie];
                do
                  Ee += se;
                while (!O[Ee]);
                const ge = O[Ee];
                ge !== 5 && ge !== 10 ? (ie = ge, O[Ee] = 0) : (ie = ge & 51 * ie >> 4, O[Ee] &= ie >> 2 | ie << 2), Pe.lineTo(Ee % A, Ee / A | 0), O[Ee] || --me;
              } while (_e !== Ee);
              --H;
            }
            return ce = null, O = null, function(Ee) {
              Ee.save(), Ee.scale(1 / d, -1 / g), Ee.translate(0, -g), Ee.fill(Pe), Ee.beginPath(), Ee.restore();
            };
          }
          class F {
            constructor(d, g) {
              this.alphaIsShape = !1, this.fontSize = 0, this.fontSizeScale = 1, this.textMatrix = n.IDENTITY_MATRIX, this.textMatrixScale = 1, this.fontMatrix = n.FONT_IDENTITY_MATRIX, this.leading = 0, this.x = 0, this.y = 0, this.lineX = 0, this.lineY = 0, this.charSpacing = 0, this.wordSpacing = 0, this.textHScale = 1, this.textRenderingMode = n.TextRenderingMode.FILL, this.textRise = 0, this.fillColor = "#000000", this.strokeColor = "#000000", this.patternFill = !1, this.fillAlpha = 1, this.strokeAlpha = 1, this.lineWidth = 1, this.activeSMask = null, this.transferMaps = "none", this.startNewPathAndClipBox([0, 0, d, g]);
            }
            clone() {
              const d = Object.create(this);
              return d.clipBox = this.clipBox.slice(), d;
            }
            setCurrentPoint(d, g) {
              this.x = d, this.y = g;
            }
            updatePathMinMax(d, g, f) {
              [g, f] = n.Util.applyTransform([g, f], d), this.minX = Math.min(this.minX, g), this.minY = Math.min(this.minY, f), this.maxX = Math.max(this.maxX, g), this.maxY = Math.max(this.maxY, f);
            }
            updateRectMinMax(d, g) {
              const f = n.Util.applyTransform(g, d), v = n.Util.applyTransform(g.slice(2), d);
              this.minX = Math.min(this.minX, f[0], v[0]), this.minY = Math.min(this.minY, f[1], v[1]), this.maxX = Math.max(this.maxX, f[0], v[0]), this.maxY = Math.max(this.maxY, f[1], v[1]);
            }
            updateScalingPathMinMax(d, g) {
              n.Util.scaleMinMax(d, g), this.minX = Math.min(this.minX, g[0]), this.maxX = Math.max(this.maxX, g[1]), this.minY = Math.min(this.minY, g[2]), this.maxY = Math.max(this.maxY, g[3]);
            }
            updateCurvePathMinMax(d, g, f, v, A, O, H, z, ae, Z) {
              const ce = n.Util.bezierBoundingBox(g, f, v, A, O, H, z, ae);
              if (Z) {
                Z[0] = Math.min(Z[0], ce[0], ce[2]), Z[1] = Math.max(Z[1], ce[0], ce[2]), Z[2] = Math.min(Z[2], ce[1], ce[3]), Z[3] = Math.max(Z[3], ce[1], ce[3]);
                return;
              }
              this.updateRectMinMax(d, ce);
            }
            getPathBoundingBox(d = l.PathType.FILL, g = null) {
              const f = [this.minX, this.minY, this.maxX, this.maxY];
              if (d === l.PathType.STROKE) {
                g || (0, n.unreachable)("Stroke bounding box must include transform.");
                const v = n.Util.singularValueDecompose2dScale(g), A = v[0] * this.lineWidth / 2, O = v[1] * this.lineWidth / 2;
                f[0] -= A, f[1] -= O, f[2] += A, f[3] += O;
              }
              return f;
            }
            updateClipFromPath() {
              const d = n.Util.intersect(this.clipBox, this.getPathBoundingBox());
              this.startNewPathAndClipBox(d || [0, 0, 0, 0]);
            }
            isEmptyClip() {
              return this.minX === 1 / 0;
            }
            startNewPathAndClipBox(d) {
              this.clipBox = d, this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = 0, this.maxY = 0;
            }
            getClippedPathBoundingBox(d = l.PathType.FILL, g = null) {
              return n.Util.intersect(this.clipBox, this.getPathBoundingBox(d, g));
            }
          }
          function x(R, d) {
            if (typeof ImageData < "u" && d instanceof ImageData) {
              R.putImageData(d, 0, 0);
              return;
            }
            const g = d.height, f = d.width, v = g % w, A = (g - v) / w, O = v === 0 ? A : A + 1, H = R.createImageData(f, w);
            let z = 0, ae;
            const Z = d.data, ce = H.data;
            let ue, me, fe, Pe;
            if (d.kind === n.ImageKind.GRAYSCALE_1BPP) {
              const Fe = Z.byteLength, Ee = new Uint32Array(ce.buffer, 0, ce.byteLength >> 2), De = Ee.length, _e = f + 7 >> 3, ie = 4294967295, se = n.FeatureTest.isLittleEndian ? 4278190080 : 255;
              for (ue = 0; ue < O; ue++) {
                for (fe = ue < A ? w : v, ae = 0, me = 0; me < fe; me++) {
                  const ge = Fe - z;
                  let Ce = 0;
                  const xe = ge > _e ? f : ge * 8 - 7, He = xe & -8;
                  let We = 0, je = 0;
                  for (; Ce < He; Ce += 8)
                    je = Z[z++], Ee[ae++] = je & 128 ? ie : se, Ee[ae++] = je & 64 ? ie : se, Ee[ae++] = je & 32 ? ie : se, Ee[ae++] = je & 16 ? ie : se, Ee[ae++] = je & 8 ? ie : se, Ee[ae++] = je & 4 ? ie : se, Ee[ae++] = je & 2 ? ie : se, Ee[ae++] = je & 1 ? ie : se;
                  for (; Ce < xe; Ce++)
                    We === 0 && (je = Z[z++], We = 128), Ee[ae++] = je & We ? ie : se, We >>= 1;
                }
                for (; ae < De; )
                  Ee[ae++] = 0;
                R.putImageData(H, 0, ue * w);
              }
            } else if (d.kind === n.ImageKind.RGBA_32BPP) {
              for (me = 0, Pe = f * w * 4, ue = 0; ue < A; ue++)
                ce.set(Z.subarray(z, z + Pe)), z += Pe, R.putImageData(H, 0, me), me += w;
              ue < O && (Pe = f * v * 4, ce.set(Z.subarray(z, z + Pe)), R.putImageData(H, 0, me));
            } else if (d.kind === n.ImageKind.RGB_24BPP)
              for (fe = w, Pe = f * fe, ue = 0; ue < O; ue++) {
                for (ue >= A && (fe = v, Pe = f * fe), ae = 0, me = Pe; me--; )
                  ce[ae++] = Z[z++], ce[ae++] = Z[z++], ce[ae++] = Z[z++], ce[ae++] = 255;
                R.putImageData(H, 0, ue * w);
              }
            else
              throw new Error(`bad image kind: ${d.kind}`);
          }
          function y(R, d) {
            if (d.bitmap) {
              R.drawImage(d.bitmap, 0, 0);
              return;
            }
            const g = d.height, f = d.width, v = g % w, A = (g - v) / w, O = v === 0 ? A : A + 1, H = R.createImageData(f, w);
            let z = 0;
            const ae = d.data, Z = H.data;
            for (let ce = 0; ce < O; ce++) {
              const ue = ce < A ? w : v;
              ({
                srcPos: z
              } = (0, h.convertBlackAndWhiteToRGBA)({
                src: ae,
                srcPos: z,
                dest: Z,
                width: f,
                height: ue,
                nonBlackColor: 0
              })), R.putImageData(H, 0, ce * w);
            }
          }
          function p(R, d) {
            const g = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font", "filter"];
            for (const f of g)
              R[f] !== void 0 && (d[f] = R[f]);
            R.setLineDash !== void 0 && (d.setLineDash(R.getLineDash()), d.lineDashOffset = R.lineDashOffset);
          }
          function E(R) {
            if (R.strokeStyle = R.fillStyle = "#000000", R.fillRule = "nonzero", R.globalAlpha = 1, R.lineWidth = 1, R.lineCap = "butt", R.lineJoin = "miter", R.miterLimit = 10, R.globalCompositeOperation = "source-over", R.font = "10px sans-serif", R.setLineDash !== void 0 && (R.setLineDash([]), R.lineDashOffset = 0), !n.isNodeJS) {
              const {
                filter: d
              } = R;
              d !== "none" && d !== "" && (R.filter = "none");
            }
          }
          function $(R, d, g, f) {
            const v = R.length;
            for (let A = 3; A < v; A += 4) {
              const O = R[A];
              if (O === 0)
                R[A - 3] = d, R[A - 2] = g, R[A - 1] = f;
              else if (O < 255) {
                const H = 255 - O;
                R[A - 3] = R[A - 3] * O + d * H >> 8, R[A - 2] = R[A - 2] * O + g * H >> 8, R[A - 1] = R[A - 1] * O + f * H >> 8;
              }
            }
          }
          function M(R, d, g) {
            const f = R.length, v = 1 / 255;
            for (let A = 3; A < f; A += 4) {
              const O = g ? g[R[A]] : R[A];
              d[A] = d[A] * O * v | 0;
            }
          }
          function m(R, d, g) {
            const f = R.length;
            for (let v = 3; v < f; v += 4) {
              const A = R[v - 3] * 77 + R[v - 2] * 152 + R[v - 1] * 28;
              d[v] = g ? d[v] * g[A >> 8] >> 8 : d[v] * A >> 16;
            }
          }
          function N(R, d, g, f, v, A, O, H, z, ae, Z) {
            const ce = !!A, ue = ce ? A[0] : 0, me = ce ? A[1] : 0, fe = ce ? A[2] : 0, Pe = v === "Luminosity" ? m : M, Ee = Math.min(f, Math.ceil(1048576 / g));
            for (let De = 0; De < f; De += Ee) {
              const _e = Math.min(Ee, f - De), ie = R.getImageData(H - ae, De + (z - Z), g, _e), se = d.getImageData(H, De + z, g, _e);
              ce && $(ie.data, ue, me, fe), Pe(ie.data, se.data, O), d.putImageData(se, H, De + z);
            }
          }
          function D(R, d, g, f) {
            const v = f[0], A = f[1], O = f[2] - v, H = f[3] - A;
            O === 0 || H === 0 || (N(d.context, g, O, H, d.subtype, d.backdrop, d.transferMap, v, A, d.offsetX, d.offsetY), R.save(), R.globalAlpha = 1, R.globalCompositeOperation = "source-over", R.setTransform(1, 0, 0, 1, 0, 0), R.drawImage(g.canvas, 0, 0), R.restore());
          }
          function X(R, d) {
            const g = n.Util.singularValueDecompose2dScale(R);
            g[0] = Math.fround(g[0]), g[1] = Math.fround(g[1]);
            const f = Math.fround((globalThis.devicePixelRatio || 1) * s.PixelsPerInch.PDF_TO_CSS_UNITS);
            return d !== void 0 ? d : g[0] <= f || g[1] <= f;
          }
          const G = ["butt", "round", "square"], I = ["miter", "round", "bevel"], B = {}, ee = {}, be = class be {
            constructor(d, g, f, v, A, {
              optionalContentConfig: O,
              markedContentStack: H = null
            }, z, ae) {
              W(this, q);
              W(this, pe);
              this.ctx = d, this.current = new F(this.ctx.canvas.width, this.ctx.canvas.height), this.stateStack = [], this.pendingClip = null, this.pendingEOFill = !1, this.res = null, this.xobjs = null, this.commonObjs = g, this.objs = f, this.canvasFactory = v, this.filterFactory = A, this.groupStack = [], this.processingType3 = null, this.baseTransform = null, this.baseTransformStack = [], this.groupLevel = 0, this.smaskStack = [], this.smaskCounter = 0, this.tempSMask = null, this.suspendedCtx = null, this.contentVisible = !0, this.markedContentStack = H || [], this.optionalContentConfig = O, this.cachedCanvases = new P(this.canvasFactory), this.cachedPatterns = /* @__PURE__ */ new Map(), this.annotationCanvasMap = z, this.viewportScale = 1, this.outputScaleX = 1, this.outputScaleY = 1, this.pageColors = ae, this._cachedScaleForStroking = [-1, 0], this._cachedGetSinglePixelWidth = null, this._cachedBitmapsMap = /* @__PURE__ */ new Map();
            }
            getObject(d, g = null) {
              return typeof d == "string" ? d.startsWith("g_") ? this.commonObjs.get(d) : this.objs.get(d) : g;
            }
            beginDrawing({
              transform: d,
              viewport: g,
              transparency: f = !1,
              background: v = null
            }) {
              const A = this.ctx.canvas.width, O = this.ctx.canvas.height, H = this.ctx.fillStyle;
              if (this.ctx.fillStyle = v || "#ffffff", this.ctx.fillRect(0, 0, A, O), this.ctx.fillStyle = H, f) {
                const z = this.cachedCanvases.getCanvas("transparent", A, O);
                this.compositeCtx = this.ctx, this.transparentCanvas = z.canvas, this.ctx = z.context, this.ctx.save(), this.ctx.transform(...(0, s.getCurrentTransform)(this.compositeCtx));
              }
              this.ctx.save(), E(this.ctx), d && (this.ctx.transform(...d), this.outputScaleX = d[0], this.outputScaleY = d[0]), this.ctx.transform(...g.transform), this.viewportScale = g.scale, this.baseTransform = (0, s.getCurrentTransform)(this.ctx);
            }
            executeOperatorList(d, g, f, v) {
              const A = d.argsArray, O = d.fnArray;
              let H = g || 0;
              const z = A.length;
              if (z === H)
                return H;
              const ae = z - H > T && typeof f == "function", Z = ae ? Date.now() + r : 0;
              let ce = 0;
              const ue = this.commonObjs, me = this.objs;
              let fe;
              for (; ; ) {
                if (v !== void 0 && H === v.nextBreakPoint)
                  return v.breakIt(H, f), H;
                if (fe = O[H], fe !== n.OPS.dependency)
                  this[fe].apply(this, A[H]);
                else
                  for (const Pe of A[H]) {
                    const Fe = Pe.startsWith("g_") ? ue : me;
                    if (!Fe.has(Pe))
                      return Fe.get(Pe, f), H;
                  }
                if (H++, H === z)
                  return H;
                if (ae && ++ce > T) {
                  if (Date.now() > Z)
                    return f(), H;
                  ce = 0;
                }
              }
            }
            endDrawing() {
              K(this, q, Qt).call(this), this.cachedCanvases.clear(), this.cachedPatterns.clear();
              for (const d of this._cachedBitmapsMap.values()) {
                for (const g of d.values())
                  typeof HTMLCanvasElement < "u" && g instanceof HTMLCanvasElement && (g.width = g.height = 0);
                d.clear();
              }
              this._cachedBitmapsMap.clear(), K(this, pe, en).call(this);
            }
            _scaleImage(d, g) {
              const f = d.width, v = d.height;
              let A = Math.max(Math.hypot(g[0], g[1]), 1), O = Math.max(Math.hypot(g[2], g[3]), 1), H = f, z = v, ae = "prescale1", Z, ce;
              for (; A > 2 && H > 1 || O > 2 && z > 1; ) {
                let ue = H, me = z;
                A > 2 && H > 1 && (ue = H >= 16384 ? Math.floor(H / 2) - 1 || 1 : Math.ceil(H / 2), A /= H / ue), O > 2 && z > 1 && (me = z >= 16384 ? Math.floor(z / 2) - 1 || 1 : Math.ceil(z) / 2, O /= z / me), Z = this.cachedCanvases.getCanvas(ae, ue, me), ce = Z.context, ce.clearRect(0, 0, ue, me), ce.drawImage(d, 0, 0, H, z, 0, 0, ue, me), d = Z.canvas, H = ue, z = me, ae = ae === "prescale1" ? "prescale2" : "prescale1";
              }
              return {
                img: d,
                paintWidth: H,
                paintHeight: z
              };
            }
            _createMaskCanvas(d) {
              const g = this.ctx, {
                width: f,
                height: v
              } = d, A = this.current.fillColor, O = this.current.patternFill, H = (0, s.getCurrentTransform)(g);
              let z, ae, Z, ce;
              if ((d.bitmap || d.data) && d.count > 1) {
                const Ce = d.bitmap || d.data.buffer;
                ae = JSON.stringify(O ? H : [H.slice(0, 4), A]), z = this._cachedBitmapsMap.get(Ce), z || (z = /* @__PURE__ */ new Map(), this._cachedBitmapsMap.set(Ce, z));
                const xe = z.get(ae);
                if (xe && !O) {
                  const He = Math.round(Math.min(H[0], H[2]) + H[4]), We = Math.round(Math.min(H[1], H[3]) + H[5]);
                  return {
                    canvas: xe,
                    offsetX: He,
                    offsetY: We
                  };
                }
                Z = xe;
              }
              Z || (ce = this.cachedCanvases.getCanvas("maskCanvas", f, v), y(ce.context, d));
              let ue = n.Util.transform(H, [1 / f, 0, 0, -1 / v, 0, 0]);
              ue = n.Util.transform(ue, [1, 0, 0, 1, 0, -v]);
              const me = n.Util.applyTransform([0, 0], ue), fe = n.Util.applyTransform([f, v], ue), Pe = n.Util.normalizeRect([me[0], me[1], fe[0], fe[1]]), Fe = Math.round(Pe[2] - Pe[0]) || 1, Ee = Math.round(Pe[3] - Pe[1]) || 1, De = this.cachedCanvases.getCanvas("fillCanvas", Fe, Ee), _e = De.context, ie = Math.min(me[0], fe[0]), se = Math.min(me[1], fe[1]);
              _e.translate(-ie, -se), _e.transform(...ue), Z || (Z = this._scaleImage(ce.canvas, (0, s.getCurrentTransformInverse)(_e)), Z = Z.img, z && O && z.set(ae, Z)), _e.imageSmoothingEnabled = X((0, s.getCurrentTransform)(_e), d.interpolate), b(_e, Z, 0, 0, Z.width, Z.height, 0, 0, f, v), _e.globalCompositeOperation = "source-in";
              const ge = n.Util.transform((0, s.getCurrentTransformInverse)(_e), [1, 0, 0, 1, -ie, -se]);
              return _e.fillStyle = O ? A.getPattern(g, this, ge, l.PathType.FILL) : A, _e.fillRect(0, 0, f, v), z && !O && (this.cachedCanvases.delete("fillCanvas"), z.set(ae, De.canvas)), {
                canvas: De.canvas,
                offsetX: Math.round(ie),
                offsetY: Math.round(se)
              };
            }
            setLineWidth(d) {
              d !== this.current.lineWidth && (this._cachedScaleForStroking[0] = -1), this.current.lineWidth = d, this.ctx.lineWidth = d;
            }
            setLineCap(d) {
              this.ctx.lineCap = G[d];
            }
            setLineJoin(d) {
              this.ctx.lineJoin = I[d];
            }
            setMiterLimit(d) {
              this.ctx.miterLimit = d;
            }
            setDash(d, g) {
              const f = this.ctx;
              f.setLineDash !== void 0 && (f.setLineDash(d), f.lineDashOffset = g);
            }
            setRenderingIntent(d) {
            }
            setFlatness(d) {
            }
            setGState(d) {
              for (const [g, f] of d)
                switch (g) {
                  case "LW":
                    this.setLineWidth(f);
                    break;
                  case "LC":
                    this.setLineCap(f);
                    break;
                  case "LJ":
                    this.setLineJoin(f);
                    break;
                  case "ML":
                    this.setMiterLimit(f);
                    break;
                  case "D":
                    this.setDash(f[0], f[1]);
                    break;
                  case "RI":
                    this.setRenderingIntent(f);
                    break;
                  case "FL":
                    this.setFlatness(f);
                    break;
                  case "Font":
                    this.setFont(f[0], f[1]);
                    break;
                  case "CA":
                    this.current.strokeAlpha = f;
                    break;
                  case "ca":
                    this.current.fillAlpha = f, this.ctx.globalAlpha = f;
                    break;
                  case "BM":
                    this.ctx.globalCompositeOperation = f;
                    break;
                  case "SMask":
                    this.current.activeSMask = f ? this.tempSMask : null, this.tempSMask = null, this.checkSMaskState();
                    break;
                  case "TR":
                    this.ctx.filter = this.current.transferMaps = this.filterFactory.addFilter(f);
                    break;
                }
            }
            get inSMaskMode() {
              return !!this.suspendedCtx;
            }
            checkSMaskState() {
              const d = this.inSMaskMode;
              this.current.activeSMask && !d ? this.beginSMaskMode() : !this.current.activeSMask && d && this.endSMaskMode();
            }
            beginSMaskMode() {
              if (this.inSMaskMode)
                throw new Error("beginSMaskMode called while already in smask mode");
              const d = this.ctx.canvas.width, g = this.ctx.canvas.height, f = "smaskGroupAt" + this.groupLevel, v = this.cachedCanvases.getCanvas(f, d, g);
              this.suspendedCtx = this.ctx, this.ctx = v.context;
              const A = this.ctx;
              A.setTransform(...(0, s.getCurrentTransform)(this.suspendedCtx)), p(this.suspendedCtx, A), C(A, this.suspendedCtx), this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
            }
            endSMaskMode() {
              if (!this.inSMaskMode)
                throw new Error("endSMaskMode called while not in smask mode");
              this.ctx._removeMirroring(), p(this.ctx, this.suspendedCtx), this.ctx = this.suspendedCtx, this.suspendedCtx = null;
            }
            compose(d) {
              if (!this.current.activeSMask)
                return;
              d ? (d[0] = Math.floor(d[0]), d[1] = Math.floor(d[1]), d[2] = Math.ceil(d[2]), d[3] = Math.ceil(d[3])) : d = [0, 0, this.ctx.canvas.width, this.ctx.canvas.height];
              const g = this.current.activeSMask, f = this.suspendedCtx;
              D(f, g, this.ctx, d), this.ctx.save(), this.ctx.setTransform(1, 0, 0, 1, 0, 0), this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height), this.ctx.restore();
            }
            save() {
              this.inSMaskMode ? (p(this.ctx, this.suspendedCtx), this.suspendedCtx.save()) : this.ctx.save();
              const d = this.current;
              this.stateStack.push(d), this.current = d.clone();
            }
            restore() {
              this.stateStack.length === 0 && this.inSMaskMode && this.endSMaskMode(), this.stateStack.length !== 0 && (this.current = this.stateStack.pop(), this.inSMaskMode ? (this.suspendedCtx.restore(), p(this.suspendedCtx, this.ctx)) : this.ctx.restore(), this.checkSMaskState(), this.pendingClip = null, this._cachedScaleForStroking[0] = -1, this._cachedGetSinglePixelWidth = null);
            }
            transform(d, g, f, v, A, O) {
              this.ctx.transform(d, g, f, v, A, O), this._cachedScaleForStroking[0] = -1, this._cachedGetSinglePixelWidth = null;
            }
            constructPath(d, g, f) {
              const v = this.ctx, A = this.current;
              let O = A.x, H = A.y, z, ae;
              const Z = (0, s.getCurrentTransform)(v), ce = Z[0] === 0 && Z[3] === 0 || Z[1] === 0 && Z[2] === 0, ue = ce ? f.slice(0) : null;
              for (let me = 0, fe = 0, Pe = d.length; me < Pe; me++)
                switch (d[me] | 0) {
                  case n.OPS.rectangle:
                    O = g[fe++], H = g[fe++];
                    const Fe = g[fe++], Ee = g[fe++], De = O + Fe, _e = H + Ee;
                    v.moveTo(O, H), Fe === 0 || Ee === 0 ? v.lineTo(De, _e) : (v.lineTo(De, H), v.lineTo(De, _e), v.lineTo(O, _e)), ce || A.updateRectMinMax(Z, [O, H, De, _e]), v.closePath();
                    break;
                  case n.OPS.moveTo:
                    O = g[fe++], H = g[fe++], v.moveTo(O, H), ce || A.updatePathMinMax(Z, O, H);
                    break;
                  case n.OPS.lineTo:
                    O = g[fe++], H = g[fe++], v.lineTo(O, H), ce || A.updatePathMinMax(Z, O, H);
                    break;
                  case n.OPS.curveTo:
                    z = O, ae = H, O = g[fe + 4], H = g[fe + 5], v.bezierCurveTo(g[fe], g[fe + 1], g[fe + 2], g[fe + 3], O, H), A.updateCurvePathMinMax(Z, z, ae, g[fe], g[fe + 1], g[fe + 2], g[fe + 3], O, H, ue), fe += 6;
                    break;
                  case n.OPS.curveTo2:
                    z = O, ae = H, v.bezierCurveTo(O, H, g[fe], g[fe + 1], g[fe + 2], g[fe + 3]), A.updateCurvePathMinMax(Z, z, ae, O, H, g[fe], g[fe + 1], g[fe + 2], g[fe + 3], ue), O = g[fe + 2], H = g[fe + 3], fe += 4;
                    break;
                  case n.OPS.curveTo3:
                    z = O, ae = H, O = g[fe + 2], H = g[fe + 3], v.bezierCurveTo(g[fe], g[fe + 1], O, H, O, H), A.updateCurvePathMinMax(Z, z, ae, g[fe], g[fe + 1], O, H, O, H, ue), fe += 4;
                    break;
                  case n.OPS.closePath:
                    v.closePath();
                    break;
                }
              ce && A.updateScalingPathMinMax(Z, ue), A.setCurrentPoint(O, H);
            }
            closePath() {
              this.ctx.closePath();
            }
            stroke(d = !0) {
              const g = this.ctx, f = this.current.strokeColor;
              g.globalAlpha = this.current.strokeAlpha, this.contentVisible && (typeof f == "object" && (f != null && f.getPattern) ? (g.save(), g.strokeStyle = f.getPattern(g, this, (0, s.getCurrentTransformInverse)(g), l.PathType.STROKE), this.rescaleAndStroke(!1), g.restore()) : this.rescaleAndStroke(!0)), d && this.consumePath(this.current.getClippedPathBoundingBox()), g.globalAlpha = this.current.fillAlpha;
            }
            closeStroke() {
              this.closePath(), this.stroke();
            }
            fill(d = !0) {
              const g = this.ctx, f = this.current.fillColor, v = this.current.patternFill;
              let A = !1;
              v && (g.save(), g.fillStyle = f.getPattern(g, this, (0, s.getCurrentTransformInverse)(g), l.PathType.FILL), A = !0);
              const O = this.current.getClippedPathBoundingBox();
              this.contentVisible && O !== null && (this.pendingEOFill ? (g.fill("evenodd"), this.pendingEOFill = !1) : g.fill()), A && g.restore(), d && this.consumePath(O);
            }
            eoFill() {
              this.pendingEOFill = !0, this.fill();
            }
            fillStroke() {
              this.fill(!1), this.stroke(!1), this.consumePath();
            }
            eoFillStroke() {
              this.pendingEOFill = !0, this.fillStroke();
            }
            closeFillStroke() {
              this.closePath(), this.fillStroke();
            }
            closeEOFillStroke() {
              this.pendingEOFill = !0, this.closePath(), this.fillStroke();
            }
            endPath() {
              this.consumePath();
            }
            clip() {
              this.pendingClip = B;
            }
            eoClip() {
              this.pendingClip = ee;
            }
            beginText() {
              this.current.textMatrix = n.IDENTITY_MATRIX, this.current.textMatrixScale = 1, this.current.x = this.current.lineX = 0, this.current.y = this.current.lineY = 0;
            }
            endText() {
              const d = this.pendingTextPaths, g = this.ctx;
              if (d === void 0) {
                g.beginPath();
                return;
              }
              g.save(), g.beginPath();
              for (const f of d)
                g.setTransform(...f.transform), g.translate(f.x, f.y), f.addToPath(g, f.fontSize);
              g.restore(), g.clip(), g.beginPath(), delete this.pendingTextPaths;
            }
            setCharSpacing(d) {
              this.current.charSpacing = d;
            }
            setWordSpacing(d) {
              this.current.wordSpacing = d;
            }
            setHScale(d) {
              this.current.textHScale = d / 100;
            }
            setLeading(d) {
              this.current.leading = -d;
            }
            setFont(d, g) {
              var Z;
              const f = this.commonObjs.get(d), v = this.current;
              if (!f)
                throw new Error(`Can't find font for ${d}`);
              if (v.fontMatrix = f.fontMatrix || n.FONT_IDENTITY_MATRIX, (v.fontMatrix[0] === 0 || v.fontMatrix[3] === 0) && (0, n.warn)("Invalid font matrix for font " + d), g < 0 ? (g = -g, v.fontDirection = -1) : v.fontDirection = 1, this.current.font = f, this.current.fontSize = g, f.isType3Font)
                return;
              const A = f.loadedName || "sans-serif", O = ((Z = f.systemFontInfo) == null ? void 0 : Z.css) || `"${A}", ${f.fallbackName}`;
              let H = "normal";
              f.black ? H = "900" : f.bold && (H = "bold");
              const z = f.italic ? "italic" : "normal";
              let ae = g;
              g < _ ? ae = _ : g > c && (ae = c), this.current.fontSizeScale = g / ae, this.ctx.font = `${z} ${H} ${ae}px ${O}`;
            }
            setTextRenderingMode(d) {
              this.current.textRenderingMode = d;
            }
            setTextRise(d) {
              this.current.textRise = d;
            }
            moveText(d, g) {
              this.current.x = this.current.lineX += d, this.current.y = this.current.lineY += g;
            }
            setLeadingMoveText(d, g) {
              this.setLeading(-g), this.moveText(d, g);
            }
            setTextMatrix(d, g, f, v, A, O) {
              this.current.textMatrix = [d, g, f, v, A, O], this.current.textMatrixScale = Math.hypot(d, g), this.current.x = this.current.lineX = 0, this.current.y = this.current.lineY = 0;
            }
            nextLine() {
              this.moveText(0, this.current.leading);
            }
            paintChar(d, g, f, v) {
              const A = this.ctx, O = this.current, H = O.font, z = O.textRenderingMode, ae = O.fontSize / O.fontSizeScale, Z = z & n.TextRenderingMode.FILL_STROKE_MASK, ce = !!(z & n.TextRenderingMode.ADD_TO_PATH_FLAG), ue = O.patternFill && !H.missingFile;
              let me;
              (H.disableFontFace || ce || ue) && (me = H.getPathGenerator(this.commonObjs, d)), H.disableFontFace || ue ? (A.save(), A.translate(g, f), A.beginPath(), me(A, ae), v && A.setTransform(...v), (Z === n.TextRenderingMode.FILL || Z === n.TextRenderingMode.FILL_STROKE) && A.fill(), (Z === n.TextRenderingMode.STROKE || Z === n.TextRenderingMode.FILL_STROKE) && A.stroke(), A.restore()) : ((Z === n.TextRenderingMode.FILL || Z === n.TextRenderingMode.FILL_STROKE) && A.fillText(d, g, f), (Z === n.TextRenderingMode.STROKE || Z === n.TextRenderingMode.FILL_STROKE) && A.strokeText(d, g, f)), ce && (this.pendingTextPaths || (this.pendingTextPaths = [])).push({
                transform: (0, s.getCurrentTransform)(A),
                x: g,
                y: f,
                fontSize: ae,
                addToPath: me
              });
            }
            get isFontSubpixelAAEnabled() {
              const {
                context: d
              } = this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled", 10, 10);
              d.scale(1.5, 1), d.fillText("I", 0, 10);
              const g = d.getImageData(0, 0, 10, 10).data;
              let f = !1;
              for (let v = 3; v < g.length; v += 4)
                if (g[v] > 0 && g[v] < 255) {
                  f = !0;
                  break;
                }
              return (0, n.shadow)(this, "isFontSubpixelAAEnabled", f);
            }
            showText(d) {
              const g = this.current, f = g.font;
              if (f.isType3Font)
                return this.showType3Text(d);
              const v = g.fontSize;
              if (v === 0)
                return;
              const A = this.ctx, O = g.fontSizeScale, H = g.charSpacing, z = g.wordSpacing, ae = g.fontDirection, Z = g.textHScale * ae, ce = d.length, ue = f.vertical, me = ue ? 1 : -1, fe = f.defaultVMetrics, Pe = v * g.fontMatrix[0], Fe = g.textRenderingMode === n.TextRenderingMode.FILL && !f.disableFontFace && !g.patternFill;
              A.save(), A.transform(...g.textMatrix), A.translate(g.x, g.y + g.textRise), ae > 0 ? A.scale(Z, -1) : A.scale(Z, 1);
              let Ee;
              if (g.patternFill) {
                A.save();
                const ge = g.fillColor.getPattern(A, this, (0, s.getCurrentTransformInverse)(A), l.PathType.FILL);
                Ee = (0, s.getCurrentTransform)(A), A.restore(), A.fillStyle = ge;
              }
              let De = g.lineWidth;
              const _e = g.textMatrixScale;
              if (_e === 0 || De === 0) {
                const ge = g.textRenderingMode & n.TextRenderingMode.FILL_STROKE_MASK;
                (ge === n.TextRenderingMode.STROKE || ge === n.TextRenderingMode.FILL_STROKE) && (De = this.getSinglePixelWidth());
              } else
                De /= _e;
              if (O !== 1 && (A.scale(O, O), De /= O), A.lineWidth = De, f.isInvalidPDFjsFont) {
                const ge = [];
                let Ce = 0;
                for (const xe of d)
                  ge.push(xe.unicode), Ce += xe.width;
                A.fillText(ge.join(""), 0, 0), g.x += Ce * Pe * Z, A.restore(), this.compose();
                return;
              }
              let ie = 0, se;
              for (se = 0; se < ce; ++se) {
                const ge = d[se];
                if (typeof ge == "number") {
                  ie += me * ge * v / 1e3;
                  continue;
                }
                let Ce = !1;
                const xe = (ge.isSpace ? z : 0) + H, He = ge.fontChar, We = ge.accent;
                let je, ze, Xe = ge.width;
                if (ue) {
                  const Ye = ge.vmetric || fe, de = -(ge.vmetric ? Ye[1] : Xe * 0.5) * Pe, ne = Ye[2] * Pe;
                  Xe = Ye ? -Ye[0] : Xe, je = de / O, ze = (ie + ne) / O;
                } else
                  je = ie / O, ze = 0;
                if (f.remeasure && Xe > 0) {
                  const Ye = A.measureText(He).width * 1e3 / v * O;
                  if (Xe < Ye && this.isFontSubpixelAAEnabled) {
                    const de = Xe / Ye;
                    Ce = !0, A.save(), A.scale(de, 1), je /= de;
                  } else
                    Xe !== Ye && (je += (Xe - Ye) / 2e3 * v / O);
                }
                if (this.contentVisible && (ge.isInFont || f.missingFile)) {
                  if (Fe && !We)
                    A.fillText(He, je, ze);
                  else if (this.paintChar(He, je, ze, Ee), We) {
                    const Ye = je + v * We.offset.x / O, de = ze - v * We.offset.y / O;
                    this.paintChar(We.fontChar, Ye, de, Ee);
                  }
                }
                const Ge = ue ? Xe * Pe - xe * ae : Xe * Pe + xe * ae;
                ie += Ge, Ce && A.restore();
              }
              ue ? g.y -= ie : g.x += ie * Z, A.restore(), this.compose();
            }
            showType3Text(d) {
              const g = this.ctx, f = this.current, v = f.font, A = f.fontSize, O = f.fontDirection, H = v.vertical ? 1 : -1, z = f.charSpacing, ae = f.wordSpacing, Z = f.textHScale * O, ce = f.fontMatrix || n.FONT_IDENTITY_MATRIX, ue = d.length, me = f.textRenderingMode === n.TextRenderingMode.INVISIBLE;
              let fe, Pe, Fe, Ee;
              if (!(me || A === 0)) {
                for (this._cachedScaleForStroking[0] = -1, this._cachedGetSinglePixelWidth = null, g.save(), g.transform(...f.textMatrix), g.translate(f.x, f.y), g.scale(Z, O), fe = 0; fe < ue; ++fe) {
                  if (Pe = d[fe], typeof Pe == "number") {
                    Ee = H * Pe * A / 1e3, this.ctx.translate(Ee, 0), f.x += Ee * Z;
                    continue;
                  }
                  const De = (Pe.isSpace ? ae : 0) + z, _e = v.charProcOperatorList[Pe.operatorListId];
                  if (!_e) {
                    (0, n.warn)(`Type3 character "${Pe.operatorListId}" is not available.`);
                    continue;
                  }
                  this.contentVisible && (this.processingType3 = Pe, this.save(), g.scale(A, A), g.transform(...ce), this.executeOperatorList(_e), this.restore()), Fe = n.Util.applyTransform([Pe.width, 0], ce)[0] * A + De, g.translate(Fe, 0), f.x += Fe * Z;
                }
                g.restore(), this.processingType3 = null;
              }
            }
            setCharWidth(d, g) {
            }
            setCharWidthAndBounds(d, g, f, v, A, O) {
              this.ctx.rect(f, v, A - f, O - v), this.ctx.clip(), this.endPath();
            }
            getColorN_Pattern(d) {
              let g;
              if (d[0] === "TilingPattern") {
                const f = d[1], v = this.baseTransform || (0, s.getCurrentTransform)(this.ctx), A = {
                  createCanvasGraphics: (O) => new be(O, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
                    optionalContentConfig: this.optionalContentConfig,
                    markedContentStack: this.markedContentStack
                  })
                };
                g = new l.TilingPattern(d, f, this.ctx, A, v);
              } else
                g = this._getPattern(d[1], d[2]);
              return g;
            }
            setStrokeColorN() {
              this.current.strokeColor = this.getColorN_Pattern(arguments);
            }
            setFillColorN() {
              this.current.fillColor = this.getColorN_Pattern(arguments), this.current.patternFill = !0;
            }
            setStrokeRGBColor(d, g, f) {
              const v = n.Util.makeHexColor(d, g, f);
              this.ctx.strokeStyle = v, this.current.strokeColor = v;
            }
            setFillRGBColor(d, g, f) {
              const v = n.Util.makeHexColor(d, g, f);
              this.ctx.fillStyle = v, this.current.fillColor = v, this.current.patternFill = !1;
            }
            _getPattern(d, g = null) {
              let f;
              return this.cachedPatterns.has(d) ? f = this.cachedPatterns.get(d) : (f = (0, l.getShadingPattern)(this.getObject(d)), this.cachedPatterns.set(d, f)), g && (f.matrix = g), f;
            }
            shadingFill(d) {
              if (!this.contentVisible)
                return;
              const g = this.ctx;
              this.save();
              const f = this._getPattern(d);
              g.fillStyle = f.getPattern(g, this, (0, s.getCurrentTransformInverse)(g), l.PathType.SHADING);
              const v = (0, s.getCurrentTransformInverse)(g);
              if (v) {
                const {
                  width: A,
                  height: O
                } = g.canvas, [H, z, ae, Z] = n.Util.getAxialAlignedBoundingBox([0, 0, A, O], v);
                this.ctx.fillRect(H, z, ae - H, Z - z);
              } else
                this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
              this.compose(this.current.getClippedPathBoundingBox()), this.restore();
            }
            beginInlineImage() {
              (0, n.unreachable)("Should not call beginInlineImage");
            }
            beginImageData() {
              (0, n.unreachable)("Should not call beginImageData");
            }
            paintFormXObjectBegin(d, g) {
              if (this.contentVisible && (this.save(), this.baseTransformStack.push(this.baseTransform), Array.isArray(d) && d.length === 6 && this.transform(...d), this.baseTransform = (0, s.getCurrentTransform)(this.ctx), g)) {
                const f = g[2] - g[0], v = g[3] - g[1];
                this.ctx.rect(g[0], g[1], f, v), this.current.updateRectMinMax((0, s.getCurrentTransform)(this.ctx), g), this.clip(), this.endPath();
              }
            }
            paintFormXObjectEnd() {
              this.contentVisible && (this.restore(), this.baseTransform = this.baseTransformStack.pop());
            }
            beginGroup(d) {
              if (!this.contentVisible)
                return;
              this.save(), this.inSMaskMode && (this.endSMaskMode(), this.current.activeSMask = null);
              const g = this.ctx;
              d.isolated || (0, n.info)("TODO: Support non-isolated groups."), d.knockout && (0, n.warn)("Knockout groups not supported.");
              const f = (0, s.getCurrentTransform)(g);
              if (d.matrix && g.transform(...d.matrix), !d.bbox)
                throw new Error("Bounding box is required.");
              let v = n.Util.getAxialAlignedBoundingBox(d.bbox, (0, s.getCurrentTransform)(g));
              const A = [0, 0, g.canvas.width, g.canvas.height];
              v = n.Util.intersect(v, A) || [0, 0, 0, 0];
              const O = Math.floor(v[0]), H = Math.floor(v[1]);
              let z = Math.max(Math.ceil(v[2]) - O, 1), ae = Math.max(Math.ceil(v[3]) - H, 1), Z = 1, ce = 1;
              z > o && (Z = z / o, z = o), ae > o && (ce = ae / o, ae = o), this.current.startNewPathAndClipBox([0, 0, z, ae]);
              let ue = "groupAt" + this.groupLevel;
              d.smask && (ue += "_smask_" + this.smaskCounter++ % 2);
              const me = this.cachedCanvases.getCanvas(ue, z, ae), fe = me.context;
              fe.scale(1 / Z, 1 / ce), fe.translate(-O, -H), fe.transform(...f), d.smask ? this.smaskStack.push({
                canvas: me.canvas,
                context: fe,
                offsetX: O,
                offsetY: H,
                scaleX: Z,
                scaleY: ce,
                subtype: d.smask.subtype,
                backdrop: d.smask.backdrop,
                transferMap: d.smask.transferMap || null,
                startTransformInverse: null
              }) : (g.setTransform(1, 0, 0, 1, 0, 0), g.translate(O, H), g.scale(Z, ce), g.save()), p(g, fe), this.ctx = fe, this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]), this.groupStack.push(g), this.groupLevel++;
            }
            endGroup(d) {
              if (!this.contentVisible)
                return;
              this.groupLevel--;
              const g = this.ctx, f = this.groupStack.pop();
              if (this.ctx = f, this.ctx.imageSmoothingEnabled = !1, d.smask)
                this.tempSMask = this.smaskStack.pop(), this.restore();
              else {
                this.ctx.restore();
                const v = (0, s.getCurrentTransform)(this.ctx);
                this.restore(), this.ctx.save(), this.ctx.setTransform(...v);
                const A = n.Util.getAxialAlignedBoundingBox([0, 0, g.canvas.width, g.canvas.height], v);
                this.ctx.drawImage(g.canvas, 0, 0), this.ctx.restore(), this.compose(A);
              }
            }
            beginAnnotation(d, g, f, v, A) {
              if (K(this, q, Qt).call(this), E(this.ctx), this.ctx.save(), this.save(), this.baseTransform && this.ctx.setTransform(...this.baseTransform), Array.isArray(g) && g.length === 4) {
                const O = g[2] - g[0], H = g[3] - g[1];
                if (A && this.annotationCanvasMap) {
                  f = f.slice(), f[4] -= g[0], f[5] -= g[1], g = g.slice(), g[0] = g[1] = 0, g[2] = O, g[3] = H;
                  const [z, ae] = n.Util.singularValueDecompose2dScale((0, s.getCurrentTransform)(this.ctx)), {
                    viewportScale: Z
                  } = this, ce = Math.ceil(O * this.outputScaleX * Z), ue = Math.ceil(H * this.outputScaleY * Z);
                  this.annotationCanvas = this.canvasFactory.create(ce, ue);
                  const {
                    canvas: me,
                    context: fe
                  } = this.annotationCanvas;
                  this.annotationCanvasMap.set(d, me), this.annotationCanvas.savedCtx = this.ctx, this.ctx = fe, this.ctx.save(), this.ctx.setTransform(z, 0, 0, -ae, 0, H * ae), E(this.ctx);
                } else
                  E(this.ctx), this.ctx.rect(g[0], g[1], O, H), this.ctx.clip(), this.endPath();
              }
              this.current = new F(this.ctx.canvas.width, this.ctx.canvas.height), this.transform(...f), this.transform(...v);
            }
            endAnnotation() {
              this.annotationCanvas && (this.ctx.restore(), K(this, pe, en).call(this), this.ctx = this.annotationCanvas.savedCtx, delete this.annotationCanvas.savedCtx, delete this.annotationCanvas);
            }
            paintImageMaskXObject(d) {
              if (!this.contentVisible)
                return;
              const g = d.count;
              d = this.getObject(d.data, d), d.count = g;
              const f = this.ctx, v = this.processingType3;
              if (v && (v.compiled === void 0 && (v.compiled = k(d)), v.compiled)) {
                v.compiled(f);
                return;
              }
              const A = this._createMaskCanvas(d), O = A.canvas;
              f.save(), f.setTransform(1, 0, 0, 1, 0, 0), f.drawImage(O, A.offsetX, A.offsetY), f.restore(), this.compose();
            }
            paintImageMaskXObjectRepeat(d, g, f = 0, v = 0, A, O) {
              if (!this.contentVisible)
                return;
              d = this.getObject(d.data, d);
              const H = this.ctx;
              H.save();
              const z = (0, s.getCurrentTransform)(H);
              H.transform(g, f, v, A, 0, 0);
              const ae = this._createMaskCanvas(d);
              H.setTransform(1, 0, 0, 1, ae.offsetX - z[4], ae.offsetY - z[5]);
              for (let Z = 0, ce = O.length; Z < ce; Z += 2) {
                const ue = n.Util.transform(z, [g, f, v, A, O[Z], O[Z + 1]]), [me, fe] = n.Util.applyTransform([0, 0], ue);
                H.drawImage(ae.canvas, me, fe);
              }
              H.restore(), this.compose();
            }
            paintImageMaskXObjectGroup(d) {
              if (!this.contentVisible)
                return;
              const g = this.ctx, f = this.current.fillColor, v = this.current.patternFill;
              for (const A of d) {
                const {
                  data: O,
                  width: H,
                  height: z,
                  transform: ae
                } = A, Z = this.cachedCanvases.getCanvas("maskCanvas", H, z), ce = Z.context;
                ce.save();
                const ue = this.getObject(O, A);
                y(ce, ue), ce.globalCompositeOperation = "source-in", ce.fillStyle = v ? f.getPattern(ce, this, (0, s.getCurrentTransformInverse)(g), l.PathType.FILL) : f, ce.fillRect(0, 0, H, z), ce.restore(), g.save(), g.transform(...ae), g.scale(1, -1), b(g, Z.canvas, 0, 0, H, z, 0, -1, 1, 1), g.restore();
              }
              this.compose();
            }
            paintImageXObject(d) {
              if (!this.contentVisible)
                return;
              const g = this.getObject(d);
              if (!g) {
                (0, n.warn)("Dependent image isn't ready yet");
                return;
              }
              this.paintInlineImageXObject(g);
            }
            paintImageXObjectRepeat(d, g, f, v) {
              if (!this.contentVisible)
                return;
              const A = this.getObject(d);
              if (!A) {
                (0, n.warn)("Dependent image isn't ready yet");
                return;
              }
              const O = A.width, H = A.height, z = [];
              for (let ae = 0, Z = v.length; ae < Z; ae += 2)
                z.push({
                  transform: [g, 0, 0, f, v[ae], v[ae + 1]],
                  x: 0,
                  y: 0,
                  w: O,
                  h: H
                });
              this.paintInlineImageXObjectGroup(A, z);
            }
            applyTransferMapsToCanvas(d) {
              return this.current.transferMaps !== "none" && (d.filter = this.current.transferMaps, d.drawImage(d.canvas, 0, 0), d.filter = "none"), d.canvas;
            }
            applyTransferMapsToBitmap(d) {
              if (this.current.transferMaps === "none")
                return d.bitmap;
              const {
                bitmap: g,
                width: f,
                height: v
              } = d, A = this.cachedCanvases.getCanvas("inlineImage", f, v), O = A.context;
              return O.filter = this.current.transferMaps, O.drawImage(g, 0, 0), O.filter = "none", A.canvas;
            }
            paintInlineImageXObject(d) {
              if (!this.contentVisible)
                return;
              const g = d.width, f = d.height, v = this.ctx;
              if (this.save(), !n.isNodeJS) {
                const {
                  filter: H
                } = v;
                H !== "none" && H !== "" && (v.filter = "none");
              }
              v.scale(1 / g, -1 / f);
              let A;
              if (d.bitmap)
                A = this.applyTransferMapsToBitmap(d);
              else if (typeof HTMLElement == "function" && d instanceof HTMLElement || !d.data)
                A = d;
              else {
                const z = this.cachedCanvases.getCanvas("inlineImage", g, f).context;
                x(z, d), A = this.applyTransferMapsToCanvas(z);
              }
              const O = this._scaleImage(A, (0, s.getCurrentTransformInverse)(v));
              v.imageSmoothingEnabled = X((0, s.getCurrentTransform)(v), d.interpolate), b(v, O.img, 0, 0, O.paintWidth, O.paintHeight, 0, -f, g, f), this.compose(), this.restore();
            }
            paintInlineImageXObjectGroup(d, g) {
              if (!this.contentVisible)
                return;
              const f = this.ctx;
              let v;
              if (d.bitmap)
                v = d.bitmap;
              else {
                const A = d.width, O = d.height, z = this.cachedCanvases.getCanvas("inlineImage", A, O).context;
                x(z, d), v = this.applyTransferMapsToCanvas(z);
              }
              for (const A of g)
                f.save(), f.transform(...A.transform), f.scale(1, -1), b(f, v, A.x, A.y, A.w, A.h, 0, -1, 1, 1), f.restore();
              this.compose();
            }
            paintSolidColorImageMask() {
              this.contentVisible && (this.ctx.fillRect(0, 0, 1, 1), this.compose());
            }
            markPoint(d) {
            }
            markPointProps(d, g) {
            }
            beginMarkedContent(d) {
              this.markedContentStack.push({
                visible: !0
              });
            }
            beginMarkedContentProps(d, g) {
              d === "OC" ? this.markedContentStack.push({
                visible: this.optionalContentConfig.isVisible(g)
              }) : this.markedContentStack.push({
                visible: !0
              }), this.contentVisible = this.isContentVisible();
            }
            endMarkedContent() {
              this.markedContentStack.pop(), this.contentVisible = this.isContentVisible();
            }
            beginCompat() {
            }
            endCompat() {
            }
            consumePath(d) {
              const g = this.current.isEmptyClip();
              this.pendingClip && this.current.updateClipFromPath(), this.pendingClip || this.compose(d);
              const f = this.ctx;
              this.pendingClip && (g || (this.pendingClip === ee ? f.clip("evenodd") : f.clip()), this.pendingClip = null), this.current.startNewPathAndClipBox(this.current.clipBox), f.beginPath();
            }
            getSinglePixelWidth() {
              if (!this._cachedGetSinglePixelWidth) {
                const d = (0, s.getCurrentTransform)(this.ctx);
                if (d[1] === 0 && d[2] === 0)
                  this._cachedGetSinglePixelWidth = 1 / Math.min(Math.abs(d[0]), Math.abs(d[3]));
                else {
                  const g = Math.abs(d[0] * d[3] - d[2] * d[1]), f = Math.hypot(d[0], d[2]), v = Math.hypot(d[1], d[3]);
                  this._cachedGetSinglePixelWidth = Math.max(f, v) / g;
                }
              }
              return this._cachedGetSinglePixelWidth;
            }
            getScaleForStroking() {
              if (this._cachedScaleForStroking[0] === -1) {
                const {
                  lineWidth: d
                } = this.current, {
                  a: g,
                  b: f,
                  c: v,
                  d: A
                } = this.ctx.getTransform();
                let O, H;
                if (f === 0 && v === 0) {
                  const z = Math.abs(g), ae = Math.abs(A);
                  if (z === ae)
                    if (d === 0)
                      O = H = 1 / z;
                    else {
                      const Z = z * d;
                      O = H = Z < 1 ? 1 / Z : 1;
                    }
                  else if (d === 0)
                    O = 1 / z, H = 1 / ae;
                  else {
                    const Z = z * d, ce = ae * d;
                    O = Z < 1 ? 1 / Z : 1, H = ce < 1 ? 1 / ce : 1;
                  }
                } else {
                  const z = Math.abs(g * A - f * v), ae = Math.hypot(g, f), Z = Math.hypot(v, A);
                  if (d === 0)
                    O = Z / z, H = ae / z;
                  else {
                    const ce = d * z;
                    O = Z > ce ? Z / ce : 1, H = ae > ce ? ae / ce : 1;
                  }
                }
                this._cachedScaleForStroking[0] = O, this._cachedScaleForStroking[1] = H;
              }
              return this._cachedScaleForStroking;
            }
            rescaleAndStroke(d) {
              const {
                ctx: g
              } = this, {
                lineWidth: f
              } = this.current, [v, A] = this.getScaleForStroking();
              if (g.lineWidth = f || 1, v === 1 && A === 1) {
                g.stroke();
                return;
              }
              const O = g.getLineDash();
              if (d && g.save(), g.scale(v, A), O.length > 0) {
                const H = Math.max(v, A);
                g.setLineDash(O.map((z) => z / H)), g.lineDashOffset /= H;
              }
              g.stroke(), d && g.restore();
            }
            isContentVisible() {
              for (let d = this.markedContentStack.length - 1; d >= 0; d--)
                if (!this.markedContentStack[d].visible)
                  return !1;
              return !0;
            }
          };
          q = new WeakSet(), Qt = function() {
            for (; this.stateStack.length || this.inSMaskMode; )
              this.restore();
            this.ctx.restore(), this.transparentCanvas && (this.ctx = this.compositeCtx, this.ctx.save(), this.ctx.setTransform(1, 0, 0, 1, 0, 0), this.ctx.drawImage(this.transparentCanvas, 0, 0), this.ctx.restore(), this.transparentCanvas = null);
          }, pe = new WeakSet(), en = function() {
            if (this.pageColors) {
              const d = this.filterFactory.addHCMFilter(this.pageColors.foreground, this.pageColors.background);
              if (d !== "none") {
                const g = this.ctx.filter;
                this.ctx.filter = d, this.ctx.drawImage(this.ctx.canvas, 0, 0), this.ctx.filter = g;
              }
            }
          };
          let Y = be;
          e.CanvasGraphics = Y;
          for (const R in n.OPS)
            Y.prototype[R] !== void 0 && (Y.prototype[n.OPS[R]] = Y.prototype[R]);
        },
        /* 12 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.TilingPattern = e.PathType = void 0, e.getShadingPattern = w;
          var n = i(1), s = i(6);
          const l = {
            FILL: "Fill",
            STROKE: "Stroke",
            SHADING: "Shading"
          };
          e.PathType = l;
          function h(k, F) {
            if (!F)
              return;
            const x = F[2] - F[0], y = F[3] - F[1], p = new Path2D();
            p.rect(F[0], F[1], x, y), k.clip(p);
          }
          class _ {
            constructor() {
              this.constructor === _ && (0, n.unreachable)("Cannot initialize BaseShadingPattern.");
            }
            getPattern() {
              (0, n.unreachable)("Abstract method `getPattern` called.");
            }
          }
          class c extends _ {
            constructor(F) {
              super(), this._type = F[1], this._bbox = F[2], this._colorStops = F[3], this._p0 = F[4], this._p1 = F[5], this._r0 = F[6], this._r1 = F[7], this.matrix = null;
            }
            _createGradient(F) {
              let x;
              this._type === "axial" ? x = F.createLinearGradient(this._p0[0], this._p0[1], this._p1[0], this._p1[1]) : this._type === "radial" && (x = F.createRadialGradient(this._p0[0], this._p0[1], this._r0, this._p1[0], this._p1[1], this._r1));
              for (const y of this._colorStops)
                x.addColorStop(y[0], y[1]);
              return x;
            }
            getPattern(F, x, y, p) {
              let E;
              if (p === l.STROKE || p === l.FILL) {
                const $ = x.current.getClippedPathBoundingBox(p, (0, s.getCurrentTransform)(F)) || [0, 0, 0, 0], M = Math.ceil($[2] - $[0]) || 1, m = Math.ceil($[3] - $[1]) || 1, N = x.cachedCanvases.getCanvas("pattern", M, m, !0), D = N.context;
                D.clearRect(0, 0, D.canvas.width, D.canvas.height), D.beginPath(), D.rect(0, 0, D.canvas.width, D.canvas.height), D.translate(-$[0], -$[1]), y = n.Util.transform(y, [1, 0, 0, 1, $[0], $[1]]), D.transform(...x.baseTransform), this.matrix && D.transform(...this.matrix), h(D, this._bbox), D.fillStyle = this._createGradient(D), D.fill(), E = F.createPattern(N.canvas, "no-repeat");
                const X = new DOMMatrix(y);
                E.setTransform(X);
              } else
                h(F, this._bbox), E = this._createGradient(F);
              return E;
            }
          }
          function o(k, F, x, y, p, E, $, M) {
            const m = F.coords, N = F.colors, D = k.data, X = k.width * 4;
            let G;
            m[x + 1] > m[y + 1] && (G = x, x = y, y = G, G = E, E = $, $ = G), m[y + 1] > m[p + 1] && (G = y, y = p, p = G, G = $, $ = M, M = G), m[x + 1] > m[y + 1] && (G = x, x = y, y = G, G = E, E = $, $ = G);
            const I = (m[x] + F.offsetX) * F.scaleX, B = (m[x + 1] + F.offsetY) * F.scaleY, ee = (m[y] + F.offsetX) * F.scaleX, Y = (m[y + 1] + F.offsetY) * F.scaleY, q = (m[p] + F.offsetX) * F.scaleX, le = (m[p + 1] + F.offsetY) * F.scaleY;
            if (B >= le)
              return;
            const pe = N[E], we = N[E + 1], be = N[E + 2], R = N[$], d = N[$ + 1], g = N[$ + 2], f = N[M], v = N[M + 1], A = N[M + 2], O = Math.round(B), H = Math.round(le);
            let z, ae, Z, ce, ue, me, fe, Pe;
            for (let Fe = O; Fe <= H; Fe++) {
              if (Fe < Y) {
                const se = Fe < B ? 0 : (B - Fe) / (B - Y);
                z = I - (I - ee) * se, ae = pe - (pe - R) * se, Z = we - (we - d) * se, ce = be - (be - g) * se;
              } else {
                let se;
                Fe > le ? se = 1 : Y === le ? se = 0 : se = (Y - Fe) / (Y - le), z = ee - (ee - q) * se, ae = R - (R - f) * se, Z = d - (d - v) * se, ce = g - (g - A) * se;
              }
              let Ee;
              Fe < B ? Ee = 0 : Fe > le ? Ee = 1 : Ee = (B - Fe) / (B - le), ue = I - (I - q) * Ee, me = pe - (pe - f) * Ee, fe = we - (we - v) * Ee, Pe = be - (be - A) * Ee;
              const De = Math.round(Math.min(z, ue)), _e = Math.round(Math.max(z, ue));
              let ie = X * Fe + De * 4;
              for (let se = De; se <= _e; se++)
                Ee = (z - se) / (z - ue), Ee < 0 ? Ee = 0 : Ee > 1 && (Ee = 1), D[ie++] = ae - (ae - me) * Ee | 0, D[ie++] = Z - (Z - fe) * Ee | 0, D[ie++] = ce - (ce - Pe) * Ee | 0, D[ie++] = 255;
            }
          }
          function r(k, F, x) {
            const y = F.coords, p = F.colors;
            let E, $;
            switch (F.type) {
              case "lattice":
                const M = F.verticesPerRow, m = Math.floor(y.length / M) - 1, N = M - 1;
                for (E = 0; E < m; E++) {
                  let D = E * M;
                  for (let X = 0; X < N; X++, D++)
                    o(k, x, y[D], y[D + 1], y[D + M], p[D], p[D + 1], p[D + M]), o(k, x, y[D + M + 1], y[D + 1], y[D + M], p[D + M + 1], p[D + 1], p[D + M]);
                }
                break;
              case "triangles":
                for (E = 0, $ = y.length; E < $; E += 3)
                  o(k, x, y[E], y[E + 1], y[E + 2], p[E], p[E + 1], p[E + 2]);
                break;
              default:
                throw new Error("illegal figure");
            }
          }
          class T extends _ {
            constructor(F) {
              super(), this._coords = F[2], this._colors = F[3], this._figures = F[4], this._bounds = F[5], this._bbox = F[7], this._background = F[8], this.matrix = null;
            }
            _createMeshCanvas(F, x, y) {
              const M = Math.floor(this._bounds[0]), m = Math.floor(this._bounds[1]), N = Math.ceil(this._bounds[2]) - M, D = Math.ceil(this._bounds[3]) - m, X = Math.min(Math.ceil(Math.abs(N * F[0] * 1.1)), 3e3), G = Math.min(Math.ceil(Math.abs(D * F[1] * 1.1)), 3e3), I = N / X, B = D / G, ee = {
                coords: this._coords,
                colors: this._colors,
                offsetX: -M,
                offsetY: -m,
                scaleX: 1 / I,
                scaleY: 1 / B
              }, Y = X + 2 * 2, q = G + 2 * 2, le = y.getCanvas("mesh", Y, q, !1), pe = le.context, we = pe.createImageData(X, G);
              if (x) {
                const R = we.data;
                for (let d = 0, g = R.length; d < g; d += 4)
                  R[d] = x[0], R[d + 1] = x[1], R[d + 2] = x[2], R[d + 3] = 255;
              }
              for (const R of this._figures)
                r(we, R, ee);
              return pe.putImageData(we, 2, 2), {
                canvas: le.canvas,
                offsetX: M - 2 * I,
                offsetY: m - 2 * B,
                scaleX: I,
                scaleY: B
              };
            }
            getPattern(F, x, y, p) {
              h(F, this._bbox);
              let E;
              if (p === l.SHADING)
                E = n.Util.singularValueDecompose2dScale((0, s.getCurrentTransform)(F));
              else if (E = n.Util.singularValueDecompose2dScale(x.baseTransform), this.matrix) {
                const M = n.Util.singularValueDecompose2dScale(this.matrix);
                E = [E[0] * M[0], E[1] * M[1]];
              }
              const $ = this._createMeshCanvas(E, p === l.SHADING ? null : this._background, x.cachedCanvases);
              return p !== l.SHADING && (F.setTransform(...x.baseTransform), this.matrix && F.transform(...this.matrix)), F.translate($.offsetX, $.offsetY), F.scale($.scaleX, $.scaleY), F.createPattern($.canvas, "no-repeat");
            }
          }
          class S extends _ {
            getPattern() {
              return "hotpink";
            }
          }
          function w(k) {
            switch (k[0]) {
              case "RadialAxial":
                return new c(k);
              case "Mesh":
                return new T(k);
              case "Dummy":
                return new S();
            }
            throw new Error(`Unknown IR type: ${k[0]}`);
          }
          const C = {
            COLORED: 1,
            UNCOLORED: 2
          }, b = class b {
            constructor(F, x, y, p, E) {
              this.operatorList = F[2], this.matrix = F[3] || [1, 0, 0, 1, 0, 0], this.bbox = F[4], this.xstep = F[5], this.ystep = F[6], this.paintType = F[7], this.tilingType = F[8], this.color = x, this.ctx = y, this.canvasGraphicsFactory = p, this.baseTransform = E;
            }
            createPatternCanvas(F) {
              const x = this.operatorList, y = this.bbox, p = this.xstep, E = this.ystep, $ = this.paintType, M = this.tilingType, m = this.color, N = this.canvasGraphicsFactory;
              (0, n.info)("TilingType: " + M);
              const D = y[0], X = y[1], G = y[2], I = y[3], B = n.Util.singularValueDecompose2dScale(this.matrix), ee = n.Util.singularValueDecompose2dScale(this.baseTransform), Y = [B[0] * ee[0], B[1] * ee[1]], q = this.getSizeAndScale(p, this.ctx.canvas.width, Y[0]), le = this.getSizeAndScale(E, this.ctx.canvas.height, Y[1]), pe = F.cachedCanvases.getCanvas("pattern", q.size, le.size, !0), we = pe.context, be = N.createCanvasGraphics(we);
              be.groupLevel = F.groupLevel, this.setFillAndStrokeStyleToContext(be, $, m);
              let R = D, d = X, g = G, f = I;
              return D < 0 && (R = 0, g += Math.abs(D)), X < 0 && (d = 0, f += Math.abs(X)), we.translate(-(q.scale * R), -(le.scale * d)), be.transform(q.scale, 0, 0, le.scale, 0, 0), we.save(), this.clipBbox(be, R, d, g, f), be.baseTransform = (0, s.getCurrentTransform)(be.ctx), be.executeOperatorList(x), be.endDrawing(), {
                canvas: pe.canvas,
                scaleX: q.scale,
                scaleY: le.scale,
                offsetX: R,
                offsetY: d
              };
            }
            getSizeAndScale(F, x, y) {
              F = Math.abs(F);
              const p = Math.max(b.MAX_PATTERN_SIZE, x);
              let E = Math.ceil(F * y);
              return E >= p ? E = p : y = E / F, {
                scale: y,
                size: E
              };
            }
            clipBbox(F, x, y, p, E) {
              const $ = p - x, M = E - y;
              F.ctx.rect(x, y, $, M), F.current.updateRectMinMax((0, s.getCurrentTransform)(F.ctx), [x, y, p, E]), F.clip(), F.endPath();
            }
            setFillAndStrokeStyleToContext(F, x, y) {
              const p = F.ctx, E = F.current;
              switch (x) {
                case C.COLORED:
                  const $ = this.ctx;
                  p.fillStyle = $.fillStyle, p.strokeStyle = $.strokeStyle, E.fillColor = $.fillStyle, E.strokeColor = $.strokeStyle;
                  break;
                case C.UNCOLORED:
                  const M = n.Util.makeHexColor(y[0], y[1], y[2]);
                  p.fillStyle = M, p.strokeStyle = M, E.fillColor = M, E.strokeColor = M;
                  break;
                default:
                  throw new n.FormatError(`Unsupported paint type: ${x}`);
              }
            }
            getPattern(F, x, y, p) {
              let E = y;
              p !== l.SHADING && (E = n.Util.transform(E, x.baseTransform), this.matrix && (E = n.Util.transform(E, this.matrix)));
              const $ = this.createPatternCanvas(x);
              let M = new DOMMatrix(E);
              M = M.translate($.offsetX, $.offsetY), M = M.scale(1 / $.scaleX, 1 / $.scaleY);
              const m = F.createPattern($.canvas, "repeat");
              return m.setTransform(M), m;
            }
          };
          nt(b, "MAX_PATTERN_SIZE", 3e3);
          let P = b;
          e.TilingPattern = P;
        },
        /* 13 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.convertBlackAndWhiteToRGBA = l, e.convertToRGBA = s, e.grayToRGBA = _;
          var n = i(1);
          function s(c) {
            switch (c.kind) {
              case n.ImageKind.GRAYSCALE_1BPP:
                return l(c);
              case n.ImageKind.RGB_24BPP:
                return h(c);
            }
            return null;
          }
          function l({
            src: c,
            srcPos: o = 0,
            dest: r,
            width: T,
            height: S,
            nonBlackColor: w = 4294967295,
            inverseDecode: C = !1
          }) {
            const P = n.FeatureTest.isLittleEndian ? 4278190080 : 255, [b, k] = C ? [w, P] : [P, w], F = T >> 3, x = T & 7, y = c.length;
            r = new Uint32Array(r.buffer);
            let p = 0;
            for (let E = 0; E < S; E++) {
              for (const M = o + F; o < M; o++) {
                const m = o < y ? c[o] : 255;
                r[p++] = m & 128 ? k : b, r[p++] = m & 64 ? k : b, r[p++] = m & 32 ? k : b, r[p++] = m & 16 ? k : b, r[p++] = m & 8 ? k : b, r[p++] = m & 4 ? k : b, r[p++] = m & 2 ? k : b, r[p++] = m & 1 ? k : b;
              }
              if (x === 0)
                continue;
              const $ = o < y ? c[o++] : 255;
              for (let M = 0; M < x; M++)
                r[p++] = $ & 1 << 7 - M ? k : b;
            }
            return {
              srcPos: o,
              destPos: p
            };
          }
          function h({
            src: c,
            srcPos: o = 0,
            dest: r,
            destPos: T = 0,
            width: S,
            height: w
          }) {
            let C = 0;
            const P = c.length >> 2, b = new Uint32Array(c.buffer, o, P);
            if (n.FeatureTest.isLittleEndian) {
              for (; C < P - 2; C += 3, T += 4) {
                const k = b[C], F = b[C + 1], x = b[C + 2];
                r[T] = k | 4278190080, r[T + 1] = k >>> 24 | F << 8 | 4278190080, r[T + 2] = F >>> 16 | x << 16 | 4278190080, r[T + 3] = x >>> 8 | 4278190080;
              }
              for (let k = C * 4, F = c.length; k < F; k += 3)
                r[T++] = c[k] | c[k + 1] << 8 | c[k + 2] << 16 | 4278190080;
            } else {
              for (; C < P - 2; C += 3, T += 4) {
                const k = b[C], F = b[C + 1], x = b[C + 2];
                r[T] = k | 255, r[T + 1] = k << 24 | F >>> 8 | 255, r[T + 2] = F << 16 | x >>> 16 | 255, r[T + 3] = x << 8 | 255;
              }
              for (let k = C * 4, F = c.length; k < F; k += 3)
                r[T++] = c[k] << 24 | c[k + 1] << 16 | c[k + 2] << 8 | 255;
            }
            return {
              srcPos: o,
              destPos: T
            };
          }
          function _(c, o) {
            if (n.FeatureTest.isLittleEndian)
              for (let r = 0, T = c.length; r < T; r++)
                o[r] = c[r] * 65793 | 4278190080;
            else
              for (let r = 0, T = c.length; r < T; r++)
                o[r] = c[r] * 16843008 | 255;
          }
        },
        /* 14 */
        /***/
        (t, e) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.GlobalWorkerOptions = void 0;
          const i = /* @__PURE__ */ Object.create(null);
          e.GlobalWorkerOptions = i, i.workerPort = null, i.workerSrc = "";
        },
        /* 15 */
        /***/
        (t, e, i) => {
          var c, Mn, r, Fn, S, kt;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.MessageHandler = void 0;
          var n = i(1);
          const s = {
            UNKNOWN: 0,
            DATA: 1,
            ERROR: 2
          }, l = {
            UNKNOWN: 0,
            CANCEL: 1,
            CANCEL_COMPLETE: 2,
            CLOSE: 3,
            ENQUEUE: 4,
            ERROR: 5,
            PULL: 6,
            PULL_COMPLETE: 7,
            START_COMPLETE: 8
          };
          function h(C) {
            switch (C instanceof Error || typeof C == "object" && C !== null || (0, n.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'), C.name) {
              case "AbortException":
                return new n.AbortException(C.message);
              case "MissingPDFException":
                return new n.MissingPDFException(C.message);
              case "PasswordException":
                return new n.PasswordException(C.message, C.code);
              case "UnexpectedResponseException":
                return new n.UnexpectedResponseException(C.message, C.status);
              case "UnknownErrorException":
                return new n.UnknownErrorException(C.message, C.details);
              default:
                return new n.UnknownErrorException(C.message, C.toString());
            }
          }
          class _ {
            constructor(P, b, k) {
              W(this, c);
              W(this, r);
              W(this, S);
              this.sourceName = P, this.targetName = b, this.comObj = k, this.callbackId = 1, this.streamId = 1, this.streamSinks = /* @__PURE__ */ Object.create(null), this.streamControllers = /* @__PURE__ */ Object.create(null), this.callbackCapabilities = /* @__PURE__ */ Object.create(null), this.actionHandler = /* @__PURE__ */ Object.create(null), this._onComObjOnMessage = (F) => {
                const x = F.data;
                if (x.targetName !== this.sourceName)
                  return;
                if (x.stream) {
                  K(this, r, Fn).call(this, x);
                  return;
                }
                if (x.callback) {
                  const p = x.callbackId, E = this.callbackCapabilities[p];
                  if (!E)
                    throw new Error(`Cannot resolve callback ${p}`);
                  if (delete this.callbackCapabilities[p], x.callback === s.DATA)
                    E.resolve(x.data);
                  else if (x.callback === s.ERROR)
                    E.reject(h(x.reason));
                  else
                    throw new Error("Unexpected callback case");
                  return;
                }
                const y = this.actionHandler[x.action];
                if (!y)
                  throw new Error(`Unknown action from worker: ${x.action}`);
                if (x.callbackId) {
                  const p = this.sourceName, E = x.sourceName;
                  new Promise(function($) {
                    $(y(x.data));
                  }).then(function($) {
                    k.postMessage({
                      sourceName: p,
                      targetName: E,
                      callback: s.DATA,
                      callbackId: x.callbackId,
                      data: $
                    });
                  }, function($) {
                    k.postMessage({
                      sourceName: p,
                      targetName: E,
                      callback: s.ERROR,
                      callbackId: x.callbackId,
                      reason: h($)
                    });
                  });
                  return;
                }
                if (x.streamId) {
                  K(this, c, Mn).call(this, x);
                  return;
                }
                y(x.data);
              }, k.addEventListener("message", this._onComObjOnMessage);
            }
            on(P, b) {
              const k = this.actionHandler;
              if (k[P])
                throw new Error(`There is already an actionName called "${P}"`);
              k[P] = b;
            }
            send(P, b, k) {
              this.comObj.postMessage({
                sourceName: this.sourceName,
                targetName: this.targetName,
                action: P,
                data: b
              }, k);
            }
            sendWithPromise(P, b, k) {
              const F = this.callbackId++, x = new n.PromiseCapability();
              this.callbackCapabilities[F] = x;
              try {
                this.comObj.postMessage({
                  sourceName: this.sourceName,
                  targetName: this.targetName,
                  action: P,
                  callbackId: F,
                  data: b
                }, k);
              } catch (y) {
                x.reject(y);
              }
              return x.promise;
            }
            sendWithStream(P, b, k, F) {
              const x = this.streamId++, y = this.sourceName, p = this.targetName, E = this.comObj;
              return new ReadableStream({
                start: ($) => {
                  const M = new n.PromiseCapability();
                  return this.streamControllers[x] = {
                    controller: $,
                    startCall: M,
                    pullCall: null,
                    cancelCall: null,
                    isClosed: !1
                  }, E.postMessage({
                    sourceName: y,
                    targetName: p,
                    action: P,
                    streamId: x,
                    data: b,
                    desiredSize: $.desiredSize
                  }, F), M.promise;
                },
                pull: ($) => {
                  const M = new n.PromiseCapability();
                  return this.streamControllers[x].pullCall = M, E.postMessage({
                    sourceName: y,
                    targetName: p,
                    stream: l.PULL,
                    streamId: x,
                    desiredSize: $.desiredSize
                  }), M.promise;
                },
                cancel: ($) => {
                  (0, n.assert)($ instanceof Error, "cancel must have a valid reason");
                  const M = new n.PromiseCapability();
                  return this.streamControllers[x].cancelCall = M, this.streamControllers[x].isClosed = !0, E.postMessage({
                    sourceName: y,
                    targetName: p,
                    stream: l.CANCEL,
                    streamId: x,
                    reason: h($)
                  }), M.promise;
                }
              }, k);
            }
            destroy() {
              this.comObj.removeEventListener("message", this._onComObjOnMessage);
            }
          }
          c = new WeakSet(), Mn = function(P) {
            const b = P.streamId, k = this.sourceName, F = P.sourceName, x = this.comObj, y = this, p = this.actionHandler[P.action], E = {
              enqueue($, M = 1, m) {
                if (this.isCancelled)
                  return;
                const N = this.desiredSize;
                this.desiredSize -= M, N > 0 && this.desiredSize <= 0 && (this.sinkCapability = new n.PromiseCapability(), this.ready = this.sinkCapability.promise), x.postMessage({
                  sourceName: k,
                  targetName: F,
                  stream: l.ENQUEUE,
                  streamId: b,
                  chunk: $
                }, m);
              },
              close() {
                this.isCancelled || (this.isCancelled = !0, x.postMessage({
                  sourceName: k,
                  targetName: F,
                  stream: l.CLOSE,
                  streamId: b
                }), delete y.streamSinks[b]);
              },
              error($) {
                (0, n.assert)($ instanceof Error, "error must have a valid reason"), !this.isCancelled && (this.isCancelled = !0, x.postMessage({
                  sourceName: k,
                  targetName: F,
                  stream: l.ERROR,
                  streamId: b,
                  reason: h($)
                }));
              },
              sinkCapability: new n.PromiseCapability(),
              onPull: null,
              onCancel: null,
              isCancelled: !1,
              desiredSize: P.desiredSize,
              ready: null
            };
            E.sinkCapability.resolve(), E.ready = E.sinkCapability.promise, this.streamSinks[b] = E, new Promise(function($) {
              $(p(P.data, E));
            }).then(function() {
              x.postMessage({
                sourceName: k,
                targetName: F,
                stream: l.START_COMPLETE,
                streamId: b,
                success: !0
              });
            }, function($) {
              x.postMessage({
                sourceName: k,
                targetName: F,
                stream: l.START_COMPLETE,
                streamId: b,
                reason: h($)
              });
            });
          }, r = new WeakSet(), Fn = function(P) {
            const b = P.streamId, k = this.sourceName, F = P.sourceName, x = this.comObj, y = this.streamControllers[b], p = this.streamSinks[b];
            switch (P.stream) {
              case l.START_COMPLETE:
                P.success ? y.startCall.resolve() : y.startCall.reject(h(P.reason));
                break;
              case l.PULL_COMPLETE:
                P.success ? y.pullCall.resolve() : y.pullCall.reject(h(P.reason));
                break;
              case l.PULL:
                if (!p) {
                  x.postMessage({
                    sourceName: k,
                    targetName: F,
                    stream: l.PULL_COMPLETE,
                    streamId: b,
                    success: !0
                  });
                  break;
                }
                p.desiredSize <= 0 && P.desiredSize > 0 && p.sinkCapability.resolve(), p.desiredSize = P.desiredSize, new Promise(function(E) {
                  var $;
                  E(($ = p.onPull) == null ? void 0 : $.call(p));
                }).then(function() {
                  x.postMessage({
                    sourceName: k,
                    targetName: F,
                    stream: l.PULL_COMPLETE,
                    streamId: b,
                    success: !0
                  });
                }, function(E) {
                  x.postMessage({
                    sourceName: k,
                    targetName: F,
                    stream: l.PULL_COMPLETE,
                    streamId: b,
                    reason: h(E)
                  });
                });
                break;
              case l.ENQUEUE:
                if ((0, n.assert)(y, "enqueue should have stream controller"), y.isClosed)
                  break;
                y.controller.enqueue(P.chunk);
                break;
              case l.CLOSE:
                if ((0, n.assert)(y, "close should have stream controller"), y.isClosed)
                  break;
                y.isClosed = !0, y.controller.close(), K(this, S, kt).call(this, y, b);
                break;
              case l.ERROR:
                (0, n.assert)(y, "error should have stream controller"), y.controller.error(h(P.reason)), K(this, S, kt).call(this, y, b);
                break;
              case l.CANCEL_COMPLETE:
                P.success ? y.cancelCall.resolve() : y.cancelCall.reject(h(P.reason)), K(this, S, kt).call(this, y, b);
                break;
              case l.CANCEL:
                if (!p)
                  break;
                new Promise(function(E) {
                  var $;
                  E(($ = p.onCancel) == null ? void 0 : $.call(p, h(P.reason)));
                }).then(function() {
                  x.postMessage({
                    sourceName: k,
                    targetName: F,
                    stream: l.CANCEL_COMPLETE,
                    streamId: b,
                    success: !0
                  });
                }, function(E) {
                  x.postMessage({
                    sourceName: k,
                    targetName: F,
                    stream: l.CANCEL_COMPLETE,
                    streamId: b,
                    reason: h(E)
                  });
                }), p.sinkCapability.reject(h(P.reason)), p.isCancelled = !0, delete this.streamSinks[b];
                break;
              default:
                throw new Error("Unexpected stream case");
            }
          }, S = new WeakSet(), kt = async function(P, b) {
            var k, F, x;
            await Promise.allSettled([(k = P.startCall) == null ? void 0 : k.promise, (F = P.pullCall) == null ? void 0 : F.promise, (x = P.cancelCall) == null ? void 0 : x.promise]), delete this.streamControllers[b];
          }, e.MessageHandler = _;
        },
        /* 16 */
        /***/
        (t, e, i) => {
          var l, h;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.Metadata = void 0;
          var n = i(1);
          class s {
            constructor({
              parsedData: c,
              rawData: o
            }) {
              W(this, l, void 0);
              W(this, h, void 0);
              oe(this, l, c), oe(this, h, o);
            }
            getRaw() {
              return a(this, h);
            }
            get(c) {
              return a(this, l).get(c) ?? null;
            }
            getAll() {
              return (0, n.objectFromMap)(a(this, l));
            }
            has(c) {
              return a(this, l).has(c);
            }
          }
          l = new WeakMap(), h = new WeakMap(), e.Metadata = s;
        },
        /* 17 */
        /***/
        (t, e, i) => {
          var c, o, r, T, S, w, tn;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.OptionalContentConfig = void 0;
          var n = i(1), s = i(8);
          const l = Symbol("INTERNAL");
          class h {
            constructor(b, k) {
              W(this, c, !0);
              this.name = b, this.intent = k;
            }
            get visible() {
              return a(this, c);
            }
            _setVisible(b, k) {
              b !== l && (0, n.unreachable)("Internal method `_setVisible` called."), oe(this, c, k);
            }
          }
          c = new WeakMap();
          class _ {
            constructor(b) {
              W(this, w);
              W(this, o, null);
              W(this, r, /* @__PURE__ */ new Map());
              W(this, T, null);
              W(this, S, null);
              if (this.name = null, this.creator = null, b !== null) {
                this.name = b.name, this.creator = b.creator, oe(this, S, b.order);
                for (const k of b.groups)
                  a(this, r).set(k.id, new h(k.name, k.intent));
                if (b.baseState === "OFF")
                  for (const k of a(this, r).values())
                    k._setVisible(l, !1);
                for (const k of b.on)
                  a(this, r).get(k)._setVisible(l, !0);
                for (const k of b.off)
                  a(this, r).get(k)._setVisible(l, !1);
                oe(this, T, this.getHash());
              }
            }
            isVisible(b) {
              if (a(this, r).size === 0)
                return !0;
              if (!b)
                return (0, n.warn)("Optional content group not defined."), !0;
              if (b.type === "OCG")
                return a(this, r).has(b.id) ? a(this, r).get(b.id).visible : ((0, n.warn)(`Optional content group not found: ${b.id}`), !0);
              if (b.type === "OCMD") {
                if (b.expression)
                  return K(this, w, tn).call(this, b.expression);
                if (!b.policy || b.policy === "AnyOn") {
                  for (const k of b.ids) {
                    if (!a(this, r).has(k))
                      return (0, n.warn)(`Optional content group not found: ${k}`), !0;
                    if (a(this, r).get(k).visible)
                      return !0;
                  }
                  return !1;
                } else if (b.policy === "AllOn") {
                  for (const k of b.ids) {
                    if (!a(this, r).has(k))
                      return (0, n.warn)(`Optional content group not found: ${k}`), !0;
                    if (!a(this, r).get(k).visible)
                      return !1;
                  }
                  return !0;
                } else if (b.policy === "AnyOff") {
                  for (const k of b.ids) {
                    if (!a(this, r).has(k))
                      return (0, n.warn)(`Optional content group not found: ${k}`), !0;
                    if (!a(this, r).get(k).visible)
                      return !0;
                  }
                  return !1;
                } else if (b.policy === "AllOff") {
                  for (const k of b.ids) {
                    if (!a(this, r).has(k))
                      return (0, n.warn)(`Optional content group not found: ${k}`), !0;
                    if (a(this, r).get(k).visible)
                      return !1;
                  }
                  return !0;
                }
                return (0, n.warn)(`Unknown optional content policy ${b.policy}.`), !0;
              }
              return (0, n.warn)(`Unknown group type ${b.type}.`), !0;
            }
            setVisibility(b, k = !0) {
              if (!a(this, r).has(b)) {
                (0, n.warn)(`Optional content group not found: ${b}`);
                return;
              }
              a(this, r).get(b)._setVisible(l, !!k), oe(this, o, null);
            }
            get hasInitialVisibility() {
              return a(this, T) === null || this.getHash() === a(this, T);
            }
            getOrder() {
              return a(this, r).size ? a(this, S) ? a(this, S).slice() : [...a(this, r).keys()] : null;
            }
            getGroups() {
              return a(this, r).size > 0 ? (0, n.objectFromMap)(a(this, r)) : null;
            }
            getGroup(b) {
              return a(this, r).get(b) || null;
            }
            getHash() {
              if (a(this, o) !== null)
                return a(this, o);
              const b = new s.MurmurHash3_64();
              for (const [k, F] of a(this, r))
                b.update(`${k}:${F.visible}`);
              return oe(this, o, b.hexdigest());
            }
          }
          o = new WeakMap(), r = new WeakMap(), T = new WeakMap(), S = new WeakMap(), w = new WeakSet(), tn = function(b) {
            const k = b.length;
            if (k < 2)
              return !0;
            const F = b[0];
            for (let x = 1; x < k; x++) {
              const y = b[x];
              let p;
              if (Array.isArray(y))
                p = K(this, w, tn).call(this, y);
              else if (a(this, r).has(y))
                p = a(this, r).get(y).visible;
              else
                return (0, n.warn)(`Optional content group not found: ${y}`), !0;
              switch (F) {
                case "And":
                  if (!p)
                    return !1;
                  break;
                case "Or":
                  if (p)
                    return !0;
                  break;
                case "Not":
                  return !p;
                default:
                  return !0;
              }
            }
            return F === "And";
          }, e.OptionalContentConfig = _;
        },
        /* 18 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.PDFDataTransportStream = void 0;
          var n = i(1), s = i(6);
          class l {
            constructor({
              length: o,
              initialData: r,
              progressiveDone: T = !1,
              contentDispositionFilename: S = null,
              disableRange: w = !1,
              disableStream: C = !1
            }, P) {
              if ((0, n.assert)(P, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'), this._queuedChunks = [], this._progressiveDone = T, this._contentDispositionFilename = S, (r == null ? void 0 : r.length) > 0) {
                const b = r instanceof Uint8Array && r.byteLength === r.buffer.byteLength ? r.buffer : new Uint8Array(r).buffer;
                this._queuedChunks.push(b);
              }
              this._pdfDataRangeTransport = P, this._isStreamingSupported = !C, this._isRangeSupported = !w, this._contentLength = o, this._fullRequestReader = null, this._rangeReaders = [], this._pdfDataRangeTransport.addRangeListener((b, k) => {
                this._onReceiveData({
                  begin: b,
                  chunk: k
                });
              }), this._pdfDataRangeTransport.addProgressListener((b, k) => {
                this._onProgress({
                  loaded: b,
                  total: k
                });
              }), this._pdfDataRangeTransport.addProgressiveReadListener((b) => {
                this._onReceiveData({
                  chunk: b
                });
              }), this._pdfDataRangeTransport.addProgressiveDoneListener(() => {
                this._onProgressiveDone();
              }), this._pdfDataRangeTransport.transportReady();
            }
            _onReceiveData({
              begin: o,
              chunk: r
            }) {
              const T = r instanceof Uint8Array && r.byteLength === r.buffer.byteLength ? r.buffer : new Uint8Array(r).buffer;
              if (o === void 0)
                this._fullRequestReader ? this._fullRequestReader._enqueue(T) : this._queuedChunks.push(T);
              else {
                const S = this._rangeReaders.some(function(w) {
                  return w._begin !== o ? !1 : (w._enqueue(T), !0);
                });
                (0, n.assert)(S, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
              }
            }
            get _progressiveDataLength() {
              var o;
              return ((o = this._fullRequestReader) == null ? void 0 : o._loaded) ?? 0;
            }
            _onProgress(o) {
              var r, T, S, w;
              o.total === void 0 ? (T = (r = this._rangeReaders[0]) == null ? void 0 : r.onProgress) == null || T.call(r, {
                loaded: o.loaded
              }) : (w = (S = this._fullRequestReader) == null ? void 0 : S.onProgress) == null || w.call(S, {
                loaded: o.loaded,
                total: o.total
              });
            }
            _onProgressiveDone() {
              var o;
              (o = this._fullRequestReader) == null || o.progressiveDone(), this._progressiveDone = !0;
            }
            _removeRangeReader(o) {
              const r = this._rangeReaders.indexOf(o);
              r >= 0 && this._rangeReaders.splice(r, 1);
            }
            getFullReader() {
              (0, n.assert)(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
              const o = this._queuedChunks;
              return this._queuedChunks = null, new h(this, o, this._progressiveDone, this._contentDispositionFilename);
            }
            getRangeReader(o, r) {
              if (r <= this._progressiveDataLength)
                return null;
              const T = new _(this, o, r);
              return this._pdfDataRangeTransport.requestDataRange(o, r), this._rangeReaders.push(T), T;
            }
            cancelAllRequests(o) {
              var r;
              (r = this._fullRequestReader) == null || r.cancel(o);
              for (const T of this._rangeReaders.slice(0))
                T.cancel(o);
              this._pdfDataRangeTransport.abort();
            }
          }
          e.PDFDataTransportStream = l;
          class h {
            constructor(o, r, T = !1, S = null) {
              this._stream = o, this._done = T || !1, this._filename = (0, s.isPdfFile)(S) ? S : null, this._queuedChunks = r || [], this._loaded = 0;
              for (const w of this._queuedChunks)
                this._loaded += w.byteLength;
              this._requests = [], this._headersReady = Promise.resolve(), o._fullRequestReader = this, this.onProgress = null;
            }
            _enqueue(o) {
              this._done || (this._requests.length > 0 ? this._requests.shift().resolve({
                value: o,
                done: !1
              }) : this._queuedChunks.push(o), this._loaded += o.byteLength);
            }
            get headersReady() {
              return this._headersReady;
            }
            get filename() {
              return this._filename;
            }
            get isRangeSupported() {
              return this._stream._isRangeSupported;
            }
            get isStreamingSupported() {
              return this._stream._isStreamingSupported;
            }
            get contentLength() {
              return this._stream._contentLength;
            }
            async read() {
              if (this._queuedChunks.length > 0)
                return {
                  value: this._queuedChunks.shift(),
                  done: !1
                };
              if (this._done)
                return {
                  value: void 0,
                  done: !0
                };
              const o = new n.PromiseCapability();
              return this._requests.push(o), o.promise;
            }
            cancel(o) {
              this._done = !0;
              for (const r of this._requests)
                r.resolve({
                  value: void 0,
                  done: !0
                });
              this._requests.length = 0;
            }
            progressiveDone() {
              this._done || (this._done = !0);
            }
          }
          class _ {
            constructor(o, r, T) {
              this._stream = o, this._begin = r, this._end = T, this._queuedChunk = null, this._requests = [], this._done = !1, this.onProgress = null;
            }
            _enqueue(o) {
              if (!this._done) {
                if (this._requests.length === 0)
                  this._queuedChunk = o;
                else {
                  this._requests.shift().resolve({
                    value: o,
                    done: !1
                  });
                  for (const T of this._requests)
                    T.resolve({
                      value: void 0,
                      done: !0
                    });
                  this._requests.length = 0;
                }
                this._done = !0, this._stream._removeRangeReader(this);
              }
            }
            get isStreamingSupported() {
              return !1;
            }
            async read() {
              if (this._queuedChunk) {
                const r = this._queuedChunk;
                return this._queuedChunk = null, {
                  value: r,
                  done: !1
                };
              }
              if (this._done)
                return {
                  value: void 0,
                  done: !0
                };
              const o = new n.PromiseCapability();
              return this._requests.push(o), o.promise;
            }
            cancel(o) {
              this._done = !0;
              for (const r of this._requests)
                r.resolve({
                  value: void 0,
                  done: !0
                });
              this._requests.length = 0, this._stream._removeRangeReader(this);
            }
          }
        },
        /* 19 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.PDFFetchStream = void 0;
          var n = i(1), s = i(20);
          function l(T, S, w) {
            return {
              method: "GET",
              headers: T,
              signal: w.signal,
              mode: "cors",
              credentials: S ? "include" : "same-origin",
              redirect: "follow"
            };
          }
          function h(T) {
            const S = new Headers();
            for (const w in T) {
              const C = T[w];
              C !== void 0 && S.append(w, C);
            }
            return S;
          }
          function _(T) {
            return T instanceof Uint8Array ? T.buffer : T instanceof ArrayBuffer ? T : ((0, n.warn)(`getArrayBuffer - unexpected data format: ${T}`), new Uint8Array(T).buffer);
          }
          class c {
            constructor(S) {
              this.source = S, this.isHttp = /^https?:/i.test(S.url), this.httpHeaders = this.isHttp && S.httpHeaders || {}, this._fullRequestReader = null, this._rangeRequestReaders = [];
            }
            get _progressiveDataLength() {
              var S;
              return ((S = this._fullRequestReader) == null ? void 0 : S._loaded) ?? 0;
            }
            getFullReader() {
              return (0, n.assert)(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once."), this._fullRequestReader = new o(this), this._fullRequestReader;
            }
            getRangeReader(S, w) {
              if (w <= this._progressiveDataLength)
                return null;
              const C = new r(this, S, w);
              return this._rangeRequestReaders.push(C), C;
            }
            cancelAllRequests(S) {
              var w;
              (w = this._fullRequestReader) == null || w.cancel(S);
              for (const C of this._rangeRequestReaders.slice(0))
                C.cancel(S);
            }
          }
          e.PDFFetchStream = c;
          class o {
            constructor(S) {
              this._stream = S, this._reader = null, this._loaded = 0, this._filename = null;
              const w = S.source;
              this._withCredentials = w.withCredentials || !1, this._contentLength = w.length, this._headersCapability = new n.PromiseCapability(), this._disableRange = w.disableRange || !1, this._rangeChunkSize = w.rangeChunkSize, !this._rangeChunkSize && !this._disableRange && (this._disableRange = !0), this._abortController = new AbortController(), this._isStreamingSupported = !w.disableStream, this._isRangeSupported = !w.disableRange, this._headers = h(this._stream.httpHeaders);
              const C = w.url;
              fetch(C, l(this._headers, this._withCredentials, this._abortController)).then((P) => {
                if (!(0, s.validateResponseStatus)(P.status))
                  throw (0, s.createResponseStatusError)(P.status, C);
                this._reader = P.body.getReader(), this._headersCapability.resolve();
                const b = (x) => P.headers.get(x), {
                  allowRangeRequests: k,
                  suggestedLength: F
                } = (0, s.validateRangeRequestCapabilities)({
                  getResponseHeader: b,
                  isHttp: this._stream.isHttp,
                  rangeChunkSize: this._rangeChunkSize,
                  disableRange: this._disableRange
                });
                this._isRangeSupported = k, this._contentLength = F || this._contentLength, this._filename = (0, s.extractFilenameFromHeader)(b), !this._isStreamingSupported && this._isRangeSupported && this.cancel(new n.AbortException("Streaming is disabled."));
              }).catch(this._headersCapability.reject), this.onProgress = null;
            }
            get headersReady() {
              return this._headersCapability.promise;
            }
            get filename() {
              return this._filename;
            }
            get contentLength() {
              return this._contentLength;
            }
            get isRangeSupported() {
              return this._isRangeSupported;
            }
            get isStreamingSupported() {
              return this._isStreamingSupported;
            }
            async read() {
              var C;
              await this._headersCapability.promise;
              const {
                value: S,
                done: w
              } = await this._reader.read();
              return w ? {
                value: S,
                done: w
              } : (this._loaded += S.byteLength, (C = this.onProgress) == null || C.call(this, {
                loaded: this._loaded,
                total: this._contentLength
              }), {
                value: _(S),
                done: !1
              });
            }
            cancel(S) {
              var w;
              (w = this._reader) == null || w.cancel(S), this._abortController.abort();
            }
          }
          class r {
            constructor(S, w, C) {
              this._stream = S, this._reader = null, this._loaded = 0;
              const P = S.source;
              this._withCredentials = P.withCredentials || !1, this._readCapability = new n.PromiseCapability(), this._isStreamingSupported = !P.disableStream, this._abortController = new AbortController(), this._headers = h(this._stream.httpHeaders), this._headers.append("Range", `bytes=${w}-${C - 1}`);
              const b = P.url;
              fetch(b, l(this._headers, this._withCredentials, this._abortController)).then((k) => {
                if (!(0, s.validateResponseStatus)(k.status))
                  throw (0, s.createResponseStatusError)(k.status, b);
                this._readCapability.resolve(), this._reader = k.body.getReader();
              }).catch(this._readCapability.reject), this.onProgress = null;
            }
            get isStreamingSupported() {
              return this._isStreamingSupported;
            }
            async read() {
              var C;
              await this._readCapability.promise;
              const {
                value: S,
                done: w
              } = await this._reader.read();
              return w ? {
                value: S,
                done: w
              } : (this._loaded += S.byteLength, (C = this.onProgress) == null || C.call(this, {
                loaded: this._loaded
              }), {
                value: _(S),
                done: !1
              });
            }
            cancel(S) {
              var w;
              (w = this._reader) == null || w.cancel(S), this._abortController.abort();
            }
          }
        },
        /* 20 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.createResponseStatusError = c, e.extractFilenameFromHeader = _, e.validateRangeRequestCapabilities = h, e.validateResponseStatus = o;
          var n = i(1), s = i(21), l = i(6);
          function h({
            getResponseHeader: r,
            isHttp: T,
            rangeChunkSize: S,
            disableRange: w
          }) {
            const C = {
              allowRangeRequests: !1,
              suggestedLength: void 0
            }, P = parseInt(r("Content-Length"), 10);
            return !Number.isInteger(P) || (C.suggestedLength = P, P <= 2 * S) || w || !T || r("Accept-Ranges") !== "bytes" || (r("Content-Encoding") || "identity") !== "identity" || (C.allowRangeRequests = !0), C;
          }
          function _(r) {
            const T = r("Content-Disposition");
            if (T) {
              let S = (0, s.getFilenameFromContentDispositionHeader)(T);
              if (S.includes("%"))
                try {
                  S = decodeURIComponent(S);
                } catch {
                }
              if ((0, l.isPdfFile)(S))
                return S;
            }
            return null;
          }
          function c(r, T) {
            return r === 404 || r === 0 && T.startsWith("file:") ? new n.MissingPDFException('Missing PDF "' + T + '".') : new n.UnexpectedResponseException(`Unexpected server response (${r}) while retrieving PDF "${T}".`, r);
          }
          function o(r) {
            return r === 200 || r === 206;
          }
        },
        /* 21 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.getFilenameFromContentDispositionHeader = s;
          var n = i(1);
          function s(l) {
            let h = !0, _ = c("filename\\*", "i").exec(l);
            if (_) {
              _ = _[1];
              let P = S(_);
              return P = unescape(P), P = w(P), P = C(P), r(P);
            }
            if (_ = T(l), _) {
              const P = C(_);
              return r(P);
            }
            if (_ = c("filename", "i").exec(l), _) {
              _ = _[1];
              let P = S(_);
              return P = C(P), r(P);
            }
            function c(P, b) {
              return new RegExp("(?:^|;)\\s*" + P + '\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)', b);
            }
            function o(P, b) {
              if (P) {
                if (!/^[\x00-\xFF]+$/.test(b))
                  return b;
                try {
                  const k = new TextDecoder(P, {
                    fatal: !0
                  }), F = (0, n.stringToBytes)(b);
                  b = k.decode(F), h = !1;
                } catch {
                }
              }
              return b;
            }
            function r(P) {
              return h && /[\x80-\xff]/.test(P) && (P = o("utf-8", P), h && (P = o("iso-8859-1", P))), P;
            }
            function T(P) {
              const b = [];
              let k;
              const F = c("filename\\*((?!0\\d)\\d+)(\\*?)", "ig");
              for (; (k = F.exec(P)) !== null; ) {
                let [, y, p, E] = k;
                if (y = parseInt(y, 10), y in b) {
                  if (y === 0)
                    break;
                  continue;
                }
                b[y] = [p, E];
              }
              const x = [];
              for (let y = 0; y < b.length && y in b; ++y) {
                let [p, E] = b[y];
                E = S(E), p && (E = unescape(E), y === 0 && (E = w(E))), x.push(E);
              }
              return x.join("");
            }
            function S(P) {
              if (P.startsWith('"')) {
                const b = P.slice(1).split('\\"');
                for (let k = 0; k < b.length; ++k) {
                  const F = b[k].indexOf('"');
                  F !== -1 && (b[k] = b[k].slice(0, F), b.length = k + 1), b[k] = b[k].replaceAll(/\\(.)/g, "$1");
                }
                P = b.join('"');
              }
              return P;
            }
            function w(P) {
              const b = P.indexOf("'");
              if (b === -1)
                return P;
              const k = P.slice(0, b), x = P.slice(b + 1).replace(/^[^']*'/, "");
              return o(k, x);
            }
            function C(P) {
              return !P.startsWith("=?") || /[\x00-\x19\x80-\xff]/.test(P) ? P : P.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function(b, k, F, x) {
                if (F === "q" || F === "Q")
                  return x = x.replaceAll("_", " "), x = x.replaceAll(/=([0-9a-fA-F]{2})/g, function(y, p) {
                    return String.fromCharCode(parseInt(p, 16));
                  }), o(k, x);
                try {
                  x = atob(x);
                } catch {
                }
                return o(k, x);
              });
            }
            return "";
          }
        },
        /* 22 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.PDFNetworkStream = void 0;
          var n = i(1), s = i(20);
          const l = 200, h = 206;
          function _(S) {
            const w = S.response;
            return typeof w != "string" ? w : (0, n.stringToBytes)(w).buffer;
          }
          class c {
            constructor(w, C = {}) {
              this.url = w, this.isHttp = /^https?:/i.test(w), this.httpHeaders = this.isHttp && C.httpHeaders || /* @__PURE__ */ Object.create(null), this.withCredentials = C.withCredentials || !1, this.currXhrId = 0, this.pendingRequests = /* @__PURE__ */ Object.create(null);
            }
            requestRange(w, C, P) {
              const b = {
                begin: w,
                end: C
              };
              for (const k in P)
                b[k] = P[k];
              return this.request(b);
            }
            requestFull(w) {
              return this.request(w);
            }
            request(w) {
              const C = new XMLHttpRequest(), P = this.currXhrId++, b = this.pendingRequests[P] = {
                xhr: C
              };
              C.open("GET", this.url), C.withCredentials = this.withCredentials;
              for (const k in this.httpHeaders) {
                const F = this.httpHeaders[k];
                F !== void 0 && C.setRequestHeader(k, F);
              }
              return this.isHttp && "begin" in w && "end" in w ? (C.setRequestHeader("Range", `bytes=${w.begin}-${w.end - 1}`), b.expectedStatus = h) : b.expectedStatus = l, C.responseType = "arraybuffer", w.onError && (C.onerror = function(k) {
                w.onError(C.status);
              }), C.onreadystatechange = this.onStateChange.bind(this, P), C.onprogress = this.onProgress.bind(this, P), b.onHeadersReceived = w.onHeadersReceived, b.onDone = w.onDone, b.onError = w.onError, b.onProgress = w.onProgress, C.send(null), P;
            }
            onProgress(w, C) {
              var b;
              const P = this.pendingRequests[w];
              P && ((b = P.onProgress) == null || b.call(P, C));
            }
            onStateChange(w, C) {
              var y, p, E;
              const P = this.pendingRequests[w];
              if (!P)
                return;
              const b = P.xhr;
              if (b.readyState >= 2 && P.onHeadersReceived && (P.onHeadersReceived(), delete P.onHeadersReceived), b.readyState !== 4 || !(w in this.pendingRequests))
                return;
              if (delete this.pendingRequests[w], b.status === 0 && this.isHttp) {
                (y = P.onError) == null || y.call(P, b.status);
                return;
              }
              const k = b.status || l;
              if (!(k === l && P.expectedStatus === h) && k !== P.expectedStatus) {
                (p = P.onError) == null || p.call(P, b.status);
                return;
              }
              const x = _(b);
              if (k === h) {
                const $ = b.getResponseHeader("Content-Range"), M = /bytes (\d+)-(\d+)\/(\d+)/.exec($);
                P.onDone({
                  begin: parseInt(M[1], 10),
                  chunk: x
                });
              } else
                x ? P.onDone({
                  begin: 0,
                  chunk: x
                }) : (E = P.onError) == null || E.call(P, b.status);
            }
            getRequestXhr(w) {
              return this.pendingRequests[w].xhr;
            }
            isPendingRequest(w) {
              return w in this.pendingRequests;
            }
            abortRequest(w) {
              const C = this.pendingRequests[w].xhr;
              delete this.pendingRequests[w], C.abort();
            }
          }
          class o {
            constructor(w) {
              this._source = w, this._manager = new c(w.url, {
                httpHeaders: w.httpHeaders,
                withCredentials: w.withCredentials
              }), this._rangeChunkSize = w.rangeChunkSize, this._fullRequestReader = null, this._rangeRequestReaders = [];
            }
            _onRangeRequestReaderClosed(w) {
              const C = this._rangeRequestReaders.indexOf(w);
              C >= 0 && this._rangeRequestReaders.splice(C, 1);
            }
            getFullReader() {
              return (0, n.assert)(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once."), this._fullRequestReader = new r(this._manager, this._source), this._fullRequestReader;
            }
            getRangeReader(w, C) {
              const P = new T(this._manager, w, C);
              return P.onClosed = this._onRangeRequestReaderClosed.bind(this), this._rangeRequestReaders.push(P), P;
            }
            cancelAllRequests(w) {
              var C;
              (C = this._fullRequestReader) == null || C.cancel(w);
              for (const P of this._rangeRequestReaders.slice(0))
                P.cancel(w);
            }
          }
          e.PDFNetworkStream = o;
          class r {
            constructor(w, C) {
              this._manager = w;
              const P = {
                onHeadersReceived: this._onHeadersReceived.bind(this),
                onDone: this._onDone.bind(this),
                onError: this._onError.bind(this),
                onProgress: this._onProgress.bind(this)
              };
              this._url = C.url, this._fullRequestId = w.requestFull(P), this._headersReceivedCapability = new n.PromiseCapability(), this._disableRange = C.disableRange || !1, this._contentLength = C.length, this._rangeChunkSize = C.rangeChunkSize, !this._rangeChunkSize && !this._disableRange && (this._disableRange = !0), this._isStreamingSupported = !1, this._isRangeSupported = !1, this._cachedChunks = [], this._requests = [], this._done = !1, this._storedError = void 0, this._filename = null, this.onProgress = null;
            }
            _onHeadersReceived() {
              const w = this._fullRequestId, C = this._manager.getRequestXhr(w), P = (F) => C.getResponseHeader(F), {
                allowRangeRequests: b,
                suggestedLength: k
              } = (0, s.validateRangeRequestCapabilities)({
                getResponseHeader: P,
                isHttp: this._manager.isHttp,
                rangeChunkSize: this._rangeChunkSize,
                disableRange: this._disableRange
              });
              b && (this._isRangeSupported = !0), this._contentLength = k || this._contentLength, this._filename = (0, s.extractFilenameFromHeader)(P), this._isRangeSupported && this._manager.abortRequest(w), this._headersReceivedCapability.resolve();
            }
            _onDone(w) {
              if (w && (this._requests.length > 0 ? this._requests.shift().resolve({
                value: w.chunk,
                done: !1
              }) : this._cachedChunks.push(w.chunk)), this._done = !0, !(this._cachedChunks.length > 0)) {
                for (const C of this._requests)
                  C.resolve({
                    value: void 0,
                    done: !0
                  });
                this._requests.length = 0;
              }
            }
            _onError(w) {
              this._storedError = (0, s.createResponseStatusError)(w, this._url), this._headersReceivedCapability.reject(this._storedError);
              for (const C of this._requests)
                C.reject(this._storedError);
              this._requests.length = 0, this._cachedChunks.length = 0;
            }
            _onProgress(w) {
              var C;
              (C = this.onProgress) == null || C.call(this, {
                loaded: w.loaded,
                total: w.lengthComputable ? w.total : this._contentLength
              });
            }
            get filename() {
              return this._filename;
            }
            get isRangeSupported() {
              return this._isRangeSupported;
            }
            get isStreamingSupported() {
              return this._isStreamingSupported;
            }
            get contentLength() {
              return this._contentLength;
            }
            get headersReady() {
              return this._headersReceivedCapability.promise;
            }
            async read() {
              if (this._storedError)
                throw this._storedError;
              if (this._cachedChunks.length > 0)
                return {
                  value: this._cachedChunks.shift(),
                  done: !1
                };
              if (this._done)
                return {
                  value: void 0,
                  done: !0
                };
              const w = new n.PromiseCapability();
              return this._requests.push(w), w.promise;
            }
            cancel(w) {
              this._done = !0, this._headersReceivedCapability.reject(w);
              for (const C of this._requests)
                C.resolve({
                  value: void 0,
                  done: !0
                });
              this._requests.length = 0, this._manager.isPendingRequest(this._fullRequestId) && this._manager.abortRequest(this._fullRequestId), this._fullRequestReader = null;
            }
          }
          class T {
            constructor(w, C, P) {
              this._manager = w;
              const b = {
                onDone: this._onDone.bind(this),
                onError: this._onError.bind(this),
                onProgress: this._onProgress.bind(this)
              };
              this._url = w.url, this._requestId = w.requestRange(C, P, b), this._requests = [], this._queuedChunk = null, this._done = !1, this._storedError = void 0, this.onProgress = null, this.onClosed = null;
            }
            _close() {
              var w;
              (w = this.onClosed) == null || w.call(this, this);
            }
            _onDone(w) {
              const C = w.chunk;
              this._requests.length > 0 ? this._requests.shift().resolve({
                value: C,
                done: !1
              }) : this._queuedChunk = C, this._done = !0;
              for (const P of this._requests)
                P.resolve({
                  value: void 0,
                  done: !0
                });
              this._requests.length = 0, this._close();
            }
            _onError(w) {
              this._storedError = (0, s.createResponseStatusError)(w, this._url);
              for (const C of this._requests)
                C.reject(this._storedError);
              this._requests.length = 0, this._queuedChunk = null;
            }
            _onProgress(w) {
              var C;
              this.isStreamingSupported || (C = this.onProgress) == null || C.call(this, {
                loaded: w.loaded
              });
            }
            get isStreamingSupported() {
              return !1;
            }
            async read() {
              if (this._storedError)
                throw this._storedError;
              if (this._queuedChunk !== null) {
                const C = this._queuedChunk;
                return this._queuedChunk = null, {
                  value: C,
                  done: !1
                };
              }
              if (this._done)
                return {
                  value: void 0,
                  done: !0
                };
              const w = new n.PromiseCapability();
              return this._requests.push(w), w.promise;
            }
            cancel(w) {
              this._done = !0;
              for (const C of this._requests)
                C.resolve({
                  value: void 0,
                  done: !0
                });
              this._requests.length = 0, this._manager.isPendingRequest(this._requestId) && this._manager.abortRequest(this._requestId), this._close();
            }
          }
        },
        /* 23 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.PDFNodeStream = void 0;
          var n = i(1), s = i(20);
          const l = /^file:\/\/\/[a-zA-Z]:\//;
          function h(P) {
            const b = require$$5, k = b.parse(P);
            return k.protocol === "file:" || k.host ? k : /^[a-z]:[/\\]/i.test(P) ? b.parse(`file:///${P}`) : (k.host || (k.protocol = "file:"), k);
          }
          class _ {
            constructor(b) {
              this.source = b, this.url = h(b.url), this.isHttp = this.url.protocol === "http:" || this.url.protocol === "https:", this.isFsUrl = this.url.protocol === "file:", this.httpHeaders = this.isHttp && b.httpHeaders || {}, this._fullRequestReader = null, this._rangeRequestReaders = [];
            }
            get _progressiveDataLength() {
              var b;
              return ((b = this._fullRequestReader) == null ? void 0 : b._loaded) ?? 0;
            }
            getFullReader() {
              return (0, n.assert)(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once."), this._fullRequestReader = this.isFsUrl ? new w(this) : new T(this), this._fullRequestReader;
            }
            getRangeReader(b, k) {
              if (k <= this._progressiveDataLength)
                return null;
              const F = this.isFsUrl ? new C(this, b, k) : new S(this, b, k);
              return this._rangeRequestReaders.push(F), F;
            }
            cancelAllRequests(b) {
              var k;
              (k = this._fullRequestReader) == null || k.cancel(b);
              for (const F of this._rangeRequestReaders.slice(0))
                F.cancel(b);
            }
          }
          e.PDFNodeStream = _;
          class c {
            constructor(b) {
              this._url = b.url, this._done = !1, this._storedError = null, this.onProgress = null;
              const k = b.source;
              this._contentLength = k.length, this._loaded = 0, this._filename = null, this._disableRange = k.disableRange || !1, this._rangeChunkSize = k.rangeChunkSize, !this._rangeChunkSize && !this._disableRange && (this._disableRange = !0), this._isStreamingSupported = !k.disableStream, this._isRangeSupported = !k.disableRange, this._readableStream = null, this._readCapability = new n.PromiseCapability(), this._headersCapability = new n.PromiseCapability();
            }
            get headersReady() {
              return this._headersCapability.promise;
            }
            get filename() {
              return this._filename;
            }
            get contentLength() {
              return this._contentLength;
            }
            get isRangeSupported() {
              return this._isRangeSupported;
            }
            get isStreamingSupported() {
              return this._isStreamingSupported;
            }
            async read() {
              var F;
              if (await this._readCapability.promise, this._done)
                return {
                  value: void 0,
                  done: !0
                };
              if (this._storedError)
                throw this._storedError;
              const b = this._readableStream.read();
              return b === null ? (this._readCapability = new n.PromiseCapability(), this.read()) : (this._loaded += b.length, (F = this.onProgress) == null || F.call(this, {
                loaded: this._loaded,
                total: this._contentLength
              }), {
                value: new Uint8Array(b).buffer,
                done: !1
              });
            }
            cancel(b) {
              if (!this._readableStream) {
                this._error(b);
                return;
              }
              this._readableStream.destroy(b);
            }
            _error(b) {
              this._storedError = b, this._readCapability.resolve();
            }
            _setReadableStream(b) {
              this._readableStream = b, b.on("readable", () => {
                this._readCapability.resolve();
              }), b.on("end", () => {
                b.destroy(), this._done = !0, this._readCapability.resolve();
              }), b.on("error", (k) => {
                this._error(k);
              }), !this._isStreamingSupported && this._isRangeSupported && this._error(new n.AbortException("streaming is disabled")), this._storedError && this._readableStream.destroy(this._storedError);
            }
          }
          class o {
            constructor(b) {
              this._url = b.url, this._done = !1, this._storedError = null, this.onProgress = null, this._loaded = 0, this._readableStream = null, this._readCapability = new n.PromiseCapability();
              const k = b.source;
              this._isStreamingSupported = !k.disableStream;
            }
            get isStreamingSupported() {
              return this._isStreamingSupported;
            }
            async read() {
              var F;
              if (await this._readCapability.promise, this._done)
                return {
                  value: void 0,
                  done: !0
                };
              if (this._storedError)
                throw this._storedError;
              const b = this._readableStream.read();
              return b === null ? (this._readCapability = new n.PromiseCapability(), this.read()) : (this._loaded += b.length, (F = this.onProgress) == null || F.call(this, {
                loaded: this._loaded
              }), {
                value: new Uint8Array(b).buffer,
                done: !1
              });
            }
            cancel(b) {
              if (!this._readableStream) {
                this._error(b);
                return;
              }
              this._readableStream.destroy(b);
            }
            _error(b) {
              this._storedError = b, this._readCapability.resolve();
            }
            _setReadableStream(b) {
              this._readableStream = b, b.on("readable", () => {
                this._readCapability.resolve();
              }), b.on("end", () => {
                b.destroy(), this._done = !0, this._readCapability.resolve();
              }), b.on("error", (k) => {
                this._error(k);
              }), this._storedError && this._readableStream.destroy(this._storedError);
            }
          }
          function r(P, b) {
            return {
              protocol: P.protocol,
              auth: P.auth,
              host: P.hostname,
              port: P.port,
              path: P.path,
              method: "GET",
              headers: b
            };
          }
          class T extends c {
            constructor(b) {
              super(b);
              const k = (F) => {
                if (F.statusCode === 404) {
                  const E = new n.MissingPDFException(`Missing PDF "${this._url}".`);
                  this._storedError = E, this._headersCapability.reject(E);
                  return;
                }
                this._headersCapability.resolve(), this._setReadableStream(F);
                const x = (E) => this._readableStream.headers[E.toLowerCase()], {
                  allowRangeRequests: y,
                  suggestedLength: p
                } = (0, s.validateRangeRequestCapabilities)({
                  getResponseHeader: x,
                  isHttp: b.isHttp,
                  rangeChunkSize: this._rangeChunkSize,
                  disableRange: this._disableRange
                });
                this._isRangeSupported = y, this._contentLength = p || this._contentLength, this._filename = (0, s.extractFilenameFromHeader)(x);
              };
              if (this._request = null, this._url.protocol === "http:") {
                const F = require$$5;
                this._request = F.request(r(this._url, b.httpHeaders), k);
              } else {
                const F = require$$5;
                this._request = F.request(r(this._url, b.httpHeaders), k);
              }
              this._request.on("error", (F) => {
                this._storedError = F, this._headersCapability.reject(F);
              }), this._request.end();
            }
          }
          class S extends o {
            constructor(b, k, F) {
              super(b), this._httpHeaders = {};
              for (const y in b.httpHeaders) {
                const p = b.httpHeaders[y];
                p !== void 0 && (this._httpHeaders[y] = p);
              }
              this._httpHeaders.Range = `bytes=${k}-${F - 1}`;
              const x = (y) => {
                if (y.statusCode === 404) {
                  const p = new n.MissingPDFException(`Missing PDF "${this._url}".`);
                  this._storedError = p;
                  return;
                }
                this._setReadableStream(y);
              };
              if (this._request = null, this._url.protocol === "http:") {
                const y = require$$5;
                this._request = y.request(r(this._url, this._httpHeaders), x);
              } else {
                const y = require$$5;
                this._request = y.request(r(this._url, this._httpHeaders), x);
              }
              this._request.on("error", (y) => {
                this._storedError = y;
              }), this._request.end();
            }
          }
          class w extends c {
            constructor(b) {
              super(b);
              let k = decodeURIComponent(this._url.path);
              l.test(this._url.href) && (k = k.replace(/^\//, ""));
              const F = require$$5;
              F.lstat(k, (x, y) => {
                if (x) {
                  x.code === "ENOENT" && (x = new n.MissingPDFException(`Missing PDF "${k}".`)), this._storedError = x, this._headersCapability.reject(x);
                  return;
                }
                this._contentLength = y.size, this._setReadableStream(F.createReadStream(k)), this._headersCapability.resolve();
              });
            }
          }
          class C extends o {
            constructor(b, k, F) {
              super(b);
              let x = decodeURIComponent(this._url.path);
              l.test(this._url.href) && (x = x.replace(/^\//, ""));
              const y = require$$5;
              this._setReadableStream(y.createReadStream(x, {
                start: k,
                end: F - 1
              }));
            }
          }
        },
        /* 24 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.SVGGraphics = void 0;
          var n = i(6), s = i(1);
          const l = {
            fontStyle: "normal",
            fontWeight: "normal",
            fillColor: "#000000"
          }, h = "http://www.w3.org/XML/1998/namespace", _ = "http://www.w3.org/1999/xlink", c = ["butt", "round", "square"], o = ["miter", "round", "bevel"], r = function(y, p = "", E = !1) {
            if (URL.createObjectURL && typeof Blob < "u" && !E)
              return URL.createObjectURL(new Blob([y], {
                type: p
              }));
            const $ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
            let M = `data:${p};base64,`;
            for (let m = 0, N = y.length; m < N; m += 3) {
              const D = y[m] & 255, X = y[m + 1] & 255, G = y[m + 2] & 255, I = D >> 2, B = (D & 3) << 4 | X >> 4, ee = m + 1 < N ? (X & 15) << 2 | G >> 6 : 64, Y = m + 2 < N ? G & 63 : 64;
              M += $[I] + $[B] + $[ee] + $[Y];
            }
            return M;
          }, T = function() {
            const y = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]), p = 12, E = new Int32Array(256);
            for (let G = 0; G < 256; G++) {
              let I = G;
              for (let B = 0; B < 8; B++)
                I = I & 1 ? 3988292384 ^ I >> 1 & 2147483647 : I >> 1 & 2147483647;
              E[G] = I;
            }
            function $(G, I, B) {
              let ee = -1;
              for (let Y = I; Y < B; Y++) {
                const q = (ee ^ G[Y]) & 255, le = E[q];
                ee = ee >>> 8 ^ le;
              }
              return ee ^ -1;
            }
            function M(G, I, B, ee) {
              let Y = ee;
              const q = I.length;
              B[Y] = q >> 24 & 255, B[Y + 1] = q >> 16 & 255, B[Y + 2] = q >> 8 & 255, B[Y + 3] = q & 255, Y += 4, B[Y] = G.charCodeAt(0) & 255, B[Y + 1] = G.charCodeAt(1) & 255, B[Y + 2] = G.charCodeAt(2) & 255, B[Y + 3] = G.charCodeAt(3) & 255, Y += 4, B.set(I, Y), Y += I.length;
              const le = $(B, ee + 4, Y);
              B[Y] = le >> 24 & 255, B[Y + 1] = le >> 16 & 255, B[Y + 2] = le >> 8 & 255, B[Y + 3] = le & 255;
            }
            function m(G, I, B) {
              let ee = 1, Y = 0;
              for (let q = I; q < B; ++q)
                ee = (ee + (G[q] & 255)) % 65521, Y = (Y + ee) % 65521;
              return Y << 16 | ee;
            }
            function N(G) {
              if (!s.isNodeJS)
                return D(G);
              try {
                const I = parseInt(process.versions.node) >= 8 ? G : Buffer.from(G), B = require$$5.deflateSync(I, {
                  level: 9
                });
                return B instanceof Uint8Array ? B : new Uint8Array(B);
              } catch (I) {
                (0, s.warn)("Not compressing PNG because zlib.deflateSync is unavailable: " + I);
              }
              return D(G);
            }
            function D(G) {
              let I = G.length;
              const B = 65535, ee = Math.ceil(I / B), Y = new Uint8Array(2 + I + ee * 5 + 4);
              let q = 0;
              Y[q++] = 120, Y[q++] = 156;
              let le = 0;
              for (; I > B; )
                Y[q++] = 0, Y[q++] = 255, Y[q++] = 255, Y[q++] = 0, Y[q++] = 0, Y.set(G.subarray(le, le + B), q), q += B, le += B, I -= B;
              Y[q++] = 1, Y[q++] = I & 255, Y[q++] = I >> 8 & 255, Y[q++] = ~I & 65535 & 255, Y[q++] = (~I & 65535) >> 8 & 255, Y.set(G.subarray(le), q), q += G.length - le;
              const pe = m(G, 0, G.length);
              return Y[q++] = pe >> 24 & 255, Y[q++] = pe >> 16 & 255, Y[q++] = pe >> 8 & 255, Y[q++] = pe & 255, Y;
            }
            function X(G, I, B, ee) {
              const Y = G.width, q = G.height;
              let le, pe, we;
              const be = G.data;
              switch (I) {
                case s.ImageKind.GRAYSCALE_1BPP:
                  pe = 0, le = 1, we = Y + 7 >> 3;
                  break;
                case s.ImageKind.RGB_24BPP:
                  pe = 2, le = 8, we = Y * 3;
                  break;
                case s.ImageKind.RGBA_32BPP:
                  pe = 6, le = 8, we = Y * 4;
                  break;
                default:
                  throw new Error("invalid format");
              }
              const R = new Uint8Array((1 + we) * q);
              let d = 0, g = 0;
              for (let z = 0; z < q; ++z)
                R[d++] = 0, R.set(be.subarray(g, g + we), d), g += we, d += we;
              if (I === s.ImageKind.GRAYSCALE_1BPP && ee) {
                d = 0;
                for (let z = 0; z < q; z++) {
                  d++;
                  for (let ae = 0; ae < we; ae++)
                    R[d++] ^= 255;
                }
              }
              const f = new Uint8Array([Y >> 24 & 255, Y >> 16 & 255, Y >> 8 & 255, Y & 255, q >> 24 & 255, q >> 16 & 255, q >> 8 & 255, q & 255, le, pe, 0, 0, 0]), v = N(R), A = y.length + p * 3 + f.length + v.length, O = new Uint8Array(A);
              let H = 0;
              return O.set(y, H), H += y.length, M("IHDR", f, O, H), H += p + f.length, M("IDATA", v, O, H), H += p + v.length, M("IEND", new Uint8Array(0), O, H), r(O, "image/png", B);
            }
            return function(I, B, ee) {
              const Y = I.kind === void 0 ? s.ImageKind.GRAYSCALE_1BPP : I.kind;
              return X(I, Y, B, ee);
            };
          }();
          class S {
            constructor() {
              this.fontSizeScale = 1, this.fontWeight = l.fontWeight, this.fontSize = 0, this.textMatrix = s.IDENTITY_MATRIX, this.fontMatrix = s.FONT_IDENTITY_MATRIX, this.leading = 0, this.textRenderingMode = s.TextRenderingMode.FILL, this.textMatrixScale = 1, this.x = 0, this.y = 0, this.lineX = 0, this.lineY = 0, this.charSpacing = 0, this.wordSpacing = 0, this.textHScale = 1, this.textRise = 0, this.fillColor = l.fillColor, this.strokeColor = "#000000", this.fillAlpha = 1, this.strokeAlpha = 1, this.lineWidth = 1, this.lineJoin = "", this.lineCap = "", this.miterLimit = 0, this.dashArray = [], this.dashPhase = 0, this.dependencies = [], this.activeClipUrl = null, this.clipGroup = null, this.maskId = "";
            }
            clone() {
              return Object.create(this);
            }
            setCurrentPoint(p, E) {
              this.x = p, this.y = E;
            }
          }
          function w(y) {
            let p = [];
            const E = [];
            for (const $ of y) {
              if ($.fn === "save") {
                p.push({
                  fnId: 92,
                  fn: "group",
                  items: []
                }), E.push(p), p = p.at(-1).items;
                continue;
              }
              $.fn === "restore" ? p = E.pop() : p.push($);
            }
            return p;
          }
          function C(y) {
            if (Number.isInteger(y))
              return y.toString();
            const p = y.toFixed(10);
            let E = p.length - 1;
            if (p[E] !== "0")
              return p;
            do
              E--;
            while (p[E] === "0");
            return p.substring(0, p[E] === "." ? E : E + 1);
          }
          function P(y) {
            if (y[4] === 0 && y[5] === 0) {
              if (y[1] === 0 && y[2] === 0)
                return y[0] === 1 && y[3] === 1 ? "" : `scale(${C(y[0])} ${C(y[3])})`;
              if (y[0] === y[3] && y[1] === -y[2]) {
                const p = Math.acos(y[0]) * 180 / Math.PI;
                return `rotate(${C(p)})`;
              }
            } else if (y[0] === 1 && y[1] === 0 && y[2] === 0 && y[3] === 1)
              return `translate(${C(y[4])} ${C(y[5])})`;
            return `matrix(${C(y[0])} ${C(y[1])} ${C(y[2])} ${C(y[3])} ${C(y[4])} ${C(y[5])})`;
          }
          let b = 0, k = 0, F = 0;
          class x {
            constructor(p, E, $ = !1) {
              (0, n.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."), this.svgFactory = new n.DOMSVGFactory(), this.current = new S(), this.transformMatrix = s.IDENTITY_MATRIX, this.transformStack = [], this.extraStack = [], this.commonObjs = p, this.objs = E, this.pendingClip = null, this.pendingEOFill = !1, this.embedFonts = !1, this.embeddedFonts = /* @__PURE__ */ Object.create(null), this.cssStyle = null, this.forceDataSchema = !!$, this._operatorIdMapping = [];
              for (const M in s.OPS)
                this._operatorIdMapping[s.OPS[M]] = M;
            }
            getObject(p, E = null) {
              return typeof p == "string" ? p.startsWith("g_") ? this.commonObjs.get(p) : this.objs.get(p) : E;
            }
            save() {
              this.transformStack.push(this.transformMatrix);
              const p = this.current;
              this.extraStack.push(p), this.current = p.clone();
            }
            restore() {
              this.transformMatrix = this.transformStack.pop(), this.current = this.extraStack.pop(), this.pendingClip = null, this.tgrp = null;
            }
            group(p) {
              this.save(), this.executeOpTree(p), this.restore();
            }
            loadDependencies(p) {
              const E = p.fnArray, $ = p.argsArray;
              for (let M = 0, m = E.length; M < m; M++)
                if (E[M] === s.OPS.dependency)
                  for (const N of $[M]) {
                    const D = N.startsWith("g_") ? this.commonObjs : this.objs, X = new Promise((G) => {
                      D.get(N, G);
                    });
                    this.current.dependencies.push(X);
                  }
              return Promise.all(this.current.dependencies);
            }
            transform(p, E, $, M, m, N) {
              const D = [p, E, $, M, m, N];
              this.transformMatrix = s.Util.transform(this.transformMatrix, D), this.tgrp = null;
            }
            getSVG(p, E) {
              this.viewport = E;
              const $ = this._initialize(E);
              return this.loadDependencies(p).then(() => (this.transformMatrix = s.IDENTITY_MATRIX, this.executeOpTree(this.convertOpList(p)), $));
            }
            convertOpList(p) {
              const E = this._operatorIdMapping, $ = p.argsArray, M = p.fnArray, m = [];
              for (let N = 0, D = M.length; N < D; N++) {
                const X = M[N];
                m.push({
                  fnId: X,
                  fn: E[X],
                  args: $[N]
                });
              }
              return w(m);
            }
            executeOpTree(p) {
              for (const E of p) {
                const $ = E.fn, M = E.fnId, m = E.args;
                switch (M | 0) {
                  case s.OPS.beginText:
                    this.beginText();
                    break;
                  case s.OPS.dependency:
                    break;
                  case s.OPS.setLeading:
                    this.setLeading(m);
                    break;
                  case s.OPS.setLeadingMoveText:
                    this.setLeadingMoveText(m[0], m[1]);
                    break;
                  case s.OPS.setFont:
                    this.setFont(m);
                    break;
                  case s.OPS.showText:
                    this.showText(m[0]);
                    break;
                  case s.OPS.showSpacedText:
                    this.showText(m[0]);
                    break;
                  case s.OPS.endText:
                    this.endText();
                    break;
                  case s.OPS.moveText:
                    this.moveText(m[0], m[1]);
                    break;
                  case s.OPS.setCharSpacing:
                    this.setCharSpacing(m[0]);
                    break;
                  case s.OPS.setWordSpacing:
                    this.setWordSpacing(m[0]);
                    break;
                  case s.OPS.setHScale:
                    this.setHScale(m[0]);
                    break;
                  case s.OPS.setTextMatrix:
                    this.setTextMatrix(m[0], m[1], m[2], m[3], m[4], m[5]);
                    break;
                  case s.OPS.setTextRise:
                    this.setTextRise(m[0]);
                    break;
                  case s.OPS.setTextRenderingMode:
                    this.setTextRenderingMode(m[0]);
                    break;
                  case s.OPS.setLineWidth:
                    this.setLineWidth(m[0]);
                    break;
                  case s.OPS.setLineJoin:
                    this.setLineJoin(m[0]);
                    break;
                  case s.OPS.setLineCap:
                    this.setLineCap(m[0]);
                    break;
                  case s.OPS.setMiterLimit:
                    this.setMiterLimit(m[0]);
                    break;
                  case s.OPS.setFillRGBColor:
                    this.setFillRGBColor(m[0], m[1], m[2]);
                    break;
                  case s.OPS.setStrokeRGBColor:
                    this.setStrokeRGBColor(m[0], m[1], m[2]);
                    break;
                  case s.OPS.setStrokeColorN:
                    this.setStrokeColorN(m);
                    break;
                  case s.OPS.setFillColorN:
                    this.setFillColorN(m);
                    break;
                  case s.OPS.shadingFill:
                    this.shadingFill(m[0]);
                    break;
                  case s.OPS.setDash:
                    this.setDash(m[0], m[1]);
                    break;
                  case s.OPS.setRenderingIntent:
                    this.setRenderingIntent(m[0]);
                    break;
                  case s.OPS.setFlatness:
                    this.setFlatness(m[0]);
                    break;
                  case s.OPS.setGState:
                    this.setGState(m[0]);
                    break;
                  case s.OPS.fill:
                    this.fill();
                    break;
                  case s.OPS.eoFill:
                    this.eoFill();
                    break;
                  case s.OPS.stroke:
                    this.stroke();
                    break;
                  case s.OPS.fillStroke:
                    this.fillStroke();
                    break;
                  case s.OPS.eoFillStroke:
                    this.eoFillStroke();
                    break;
                  case s.OPS.clip:
                    this.clip("nonzero");
                    break;
                  case s.OPS.eoClip:
                    this.clip("evenodd");
                    break;
                  case s.OPS.paintSolidColorImageMask:
                    this.paintSolidColorImageMask();
                    break;
                  case s.OPS.paintImageXObject:
                    this.paintImageXObject(m[0]);
                    break;
                  case s.OPS.paintInlineImageXObject:
                    this.paintInlineImageXObject(m[0]);
                    break;
                  case s.OPS.paintImageMaskXObject:
                    this.paintImageMaskXObject(m[0]);
                    break;
                  case s.OPS.paintFormXObjectBegin:
                    this.paintFormXObjectBegin(m[0], m[1]);
                    break;
                  case s.OPS.paintFormXObjectEnd:
                    this.paintFormXObjectEnd();
                    break;
                  case s.OPS.closePath:
                    this.closePath();
                    break;
                  case s.OPS.closeStroke:
                    this.closeStroke();
                    break;
                  case s.OPS.closeFillStroke:
                    this.closeFillStroke();
                    break;
                  case s.OPS.closeEOFillStroke:
                    this.closeEOFillStroke();
                    break;
                  case s.OPS.nextLine:
                    this.nextLine();
                    break;
                  case s.OPS.transform:
                    this.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
                    break;
                  case s.OPS.constructPath:
                    this.constructPath(m[0], m[1]);
                    break;
                  case s.OPS.endPath:
                    this.endPath();
                    break;
                  case 92:
                    this.group(E.items);
                    break;
                  default:
                    (0, s.warn)(`Unimplemented operator ${$}`);
                    break;
                }
              }
            }
            setWordSpacing(p) {
              this.current.wordSpacing = p;
            }
            setCharSpacing(p) {
              this.current.charSpacing = p;
            }
            nextLine() {
              this.moveText(0, this.current.leading);
            }
            setTextMatrix(p, E, $, M, m, N) {
              const D = this.current;
              D.textMatrix = D.lineMatrix = [p, E, $, M, m, N], D.textMatrixScale = Math.hypot(p, E), D.x = D.lineX = 0, D.y = D.lineY = 0, D.xcoords = [], D.ycoords = [], D.tspan = this.svgFactory.createElement("svg:tspan"), D.tspan.setAttributeNS(null, "font-family", D.fontFamily), D.tspan.setAttributeNS(null, "font-size", `${C(D.fontSize)}px`), D.tspan.setAttributeNS(null, "y", C(-D.y)), D.txtElement = this.svgFactory.createElement("svg:text"), D.txtElement.append(D.tspan);
            }
            beginText() {
              const p = this.current;
              p.x = p.lineX = 0, p.y = p.lineY = 0, p.textMatrix = s.IDENTITY_MATRIX, p.lineMatrix = s.IDENTITY_MATRIX, p.textMatrixScale = 1, p.tspan = this.svgFactory.createElement("svg:tspan"), p.txtElement = this.svgFactory.createElement("svg:text"), p.txtgrp = this.svgFactory.createElement("svg:g"), p.xcoords = [], p.ycoords = [];
            }
            moveText(p, E) {
              const $ = this.current;
              $.x = $.lineX += p, $.y = $.lineY += E, $.xcoords = [], $.ycoords = [], $.tspan = this.svgFactory.createElement("svg:tspan"), $.tspan.setAttributeNS(null, "font-family", $.fontFamily), $.tspan.setAttributeNS(null, "font-size", `${C($.fontSize)}px`), $.tspan.setAttributeNS(null, "y", C(-$.y));
            }
            showText(p) {
              const E = this.current, $ = E.font, M = E.fontSize;
              if (M === 0)
                return;
              const m = E.fontSizeScale, N = E.charSpacing, D = E.wordSpacing, X = E.fontDirection, G = E.textHScale * X, I = $.vertical, B = I ? 1 : -1, ee = $.defaultVMetrics, Y = M * E.fontMatrix[0];
              let q = 0;
              for (const we of p) {
                if (we === null) {
                  q += X * D;
                  continue;
                } else if (typeof we == "number") {
                  q += B * we * M / 1e3;
                  continue;
                }
                const be = (we.isSpace ? D : 0) + N, R = we.fontChar;
                let d, g, f = we.width;
                if (I) {
                  let A;
                  const O = we.vmetric || ee;
                  A = we.vmetric ? O[1] : f * 0.5, A = -A * Y;
                  const H = O[2] * Y;
                  f = O ? -O[0] : f, d = A / m, g = (q + H) / m;
                } else
                  d = q / m, g = 0;
                (we.isInFont || $.missingFile) && (E.xcoords.push(E.x + d), I && E.ycoords.push(-E.y + g), E.tspan.textContent += R);
                const v = I ? f * Y - be * X : f * Y + be * X;
                q += v;
              }
              E.tspan.setAttributeNS(null, "x", E.xcoords.map(C).join(" ")), I ? E.tspan.setAttributeNS(null, "y", E.ycoords.map(C).join(" ")) : E.tspan.setAttributeNS(null, "y", C(-E.y)), I ? E.y -= q : E.x += q * G, E.tspan.setAttributeNS(null, "font-family", E.fontFamily), E.tspan.setAttributeNS(null, "font-size", `${C(E.fontSize)}px`), E.fontStyle !== l.fontStyle && E.tspan.setAttributeNS(null, "font-style", E.fontStyle), E.fontWeight !== l.fontWeight && E.tspan.setAttributeNS(null, "font-weight", E.fontWeight);
              const le = E.textRenderingMode & s.TextRenderingMode.FILL_STROKE_MASK;
              if (le === s.TextRenderingMode.FILL || le === s.TextRenderingMode.FILL_STROKE ? (E.fillColor !== l.fillColor && E.tspan.setAttributeNS(null, "fill", E.fillColor), E.fillAlpha < 1 && E.tspan.setAttributeNS(null, "fill-opacity", E.fillAlpha)) : E.textRenderingMode === s.TextRenderingMode.ADD_TO_PATH ? E.tspan.setAttributeNS(null, "fill", "transparent") : E.tspan.setAttributeNS(null, "fill", "none"), le === s.TextRenderingMode.STROKE || le === s.TextRenderingMode.FILL_STROKE) {
                const we = 1 / (E.textMatrixScale || 1);
                this._setStrokeAttributes(E.tspan, we);
              }
              let pe = E.textMatrix;
              E.textRise !== 0 && (pe = pe.slice(), pe[5] += E.textRise), E.txtElement.setAttributeNS(null, "transform", `${P(pe)} scale(${C(G)}, -1)`), E.txtElement.setAttributeNS(h, "xml:space", "preserve"), E.txtElement.append(E.tspan), E.txtgrp.append(E.txtElement), this._ensureTransformGroup().append(E.txtElement);
            }
            setLeadingMoveText(p, E) {
              this.setLeading(-E), this.moveText(p, E);
            }
            addFontStyle(p) {
              if (!p.data)
                throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');
              this.cssStyle || (this.cssStyle = this.svgFactory.createElement("svg:style"), this.cssStyle.setAttributeNS(null, "type", "text/css"), this.defs.append(this.cssStyle));
              const E = r(p.data, p.mimetype, this.forceDataSchema);
              this.cssStyle.textContent += `@font-face { font-family: "${p.loadedName}"; src: url(${E}); }
`;
            }
            setFont(p) {
              const E = this.current, $ = this.commonObjs.get(p[0]);
              let M = p[1];
              E.font = $, this.embedFonts && !$.missingFile && !this.embeddedFonts[$.loadedName] && (this.addFontStyle($), this.embeddedFonts[$.loadedName] = $), E.fontMatrix = $.fontMatrix || s.FONT_IDENTITY_MATRIX;
              let m = "normal";
              $.black ? m = "900" : $.bold && (m = "bold");
              const N = $.italic ? "italic" : "normal";
              M < 0 ? (M = -M, E.fontDirection = -1) : E.fontDirection = 1, E.fontSize = M, E.fontFamily = $.loadedName, E.fontWeight = m, E.fontStyle = N, E.tspan = this.svgFactory.createElement("svg:tspan"), E.tspan.setAttributeNS(null, "y", C(-E.y)), E.xcoords = [], E.ycoords = [];
            }
            endText() {
              var E;
              const p = this.current;
              p.textRenderingMode & s.TextRenderingMode.ADD_TO_PATH_FLAG && ((E = p.txtElement) != null && E.hasChildNodes()) && (p.element = p.txtElement, this.clip("nonzero"), this.endPath());
            }
            setLineWidth(p) {
              p > 0 && (this.current.lineWidth = p);
            }
            setLineCap(p) {
              this.current.lineCap = c[p];
            }
            setLineJoin(p) {
              this.current.lineJoin = o[p];
            }
            setMiterLimit(p) {
              this.current.miterLimit = p;
            }
            setStrokeAlpha(p) {
              this.current.strokeAlpha = p;
            }
            setStrokeRGBColor(p, E, $) {
              this.current.strokeColor = s.Util.makeHexColor(p, E, $);
            }
            setFillAlpha(p) {
              this.current.fillAlpha = p;
            }
            setFillRGBColor(p, E, $) {
              this.current.fillColor = s.Util.makeHexColor(p, E, $), this.current.tspan = this.svgFactory.createElement("svg:tspan"), this.current.xcoords = [], this.current.ycoords = [];
            }
            setStrokeColorN(p) {
              this.current.strokeColor = this._makeColorN_Pattern(p);
            }
            setFillColorN(p) {
              this.current.fillColor = this._makeColorN_Pattern(p);
            }
            shadingFill(p) {
              const {
                width: E,
                height: $
              } = this.viewport, M = s.Util.inverseTransform(this.transformMatrix), [m, N, D, X] = s.Util.getAxialAlignedBoundingBox([0, 0, E, $], M), G = this.svgFactory.createElement("svg:rect");
              G.setAttributeNS(null, "x", m), G.setAttributeNS(null, "y", N), G.setAttributeNS(null, "width", D - m), G.setAttributeNS(null, "height", X - N), G.setAttributeNS(null, "fill", this._makeShadingPattern(p)), this.current.fillAlpha < 1 && G.setAttributeNS(null, "fill-opacity", this.current.fillAlpha), this._ensureTransformGroup().append(G);
            }
            _makeColorN_Pattern(p) {
              return p[0] === "TilingPattern" ? this._makeTilingPattern(p) : this._makeShadingPattern(p);
            }
            _makeTilingPattern(p) {
              const E = p[1], $ = p[2], M = p[3] || s.IDENTITY_MATRIX, [m, N, D, X] = p[4], G = p[5], I = p[6], B = p[7], ee = `shading${F++}`, [Y, q, le, pe] = s.Util.normalizeRect([...s.Util.applyTransform([m, N], M), ...s.Util.applyTransform([D, X], M)]), [we, be] = s.Util.singularValueDecompose2dScale(M), R = G * we, d = I * be, g = this.svgFactory.createElement("svg:pattern");
              g.setAttributeNS(null, "id", ee), g.setAttributeNS(null, "patternUnits", "userSpaceOnUse"), g.setAttributeNS(null, "width", R), g.setAttributeNS(null, "height", d), g.setAttributeNS(null, "x", `${Y}`), g.setAttributeNS(null, "y", `${q}`);
              const f = this.svg, v = this.transformMatrix, A = this.current.fillColor, O = this.current.strokeColor, H = this.svgFactory.create(le - Y, pe - q);
              if (this.svg = H, this.transformMatrix = M, B === 2) {
                const z = s.Util.makeHexColor(...E);
                this.current.fillColor = z, this.current.strokeColor = z;
              }
              return this.executeOpTree(this.convertOpList($)), this.svg = f, this.transformMatrix = v, this.current.fillColor = A, this.current.strokeColor = O, g.append(H.childNodes[0]), this.defs.append(g), `url(#${ee})`;
            }
            _makeShadingPattern(p) {
              switch (typeof p == "string" && (p = this.objs.get(p)), p[0]) {
                case "RadialAxial":
                  const E = `shading${F++}`, $ = p[3];
                  let M;
                  switch (p[1]) {
                    case "axial":
                      const m = p[4], N = p[5];
                      M = this.svgFactory.createElement("svg:linearGradient"), M.setAttributeNS(null, "id", E), M.setAttributeNS(null, "gradientUnits", "userSpaceOnUse"), M.setAttributeNS(null, "x1", m[0]), M.setAttributeNS(null, "y1", m[1]), M.setAttributeNS(null, "x2", N[0]), M.setAttributeNS(null, "y2", N[1]);
                      break;
                    case "radial":
                      const D = p[4], X = p[5], G = p[6], I = p[7];
                      M = this.svgFactory.createElement("svg:radialGradient"), M.setAttributeNS(null, "id", E), M.setAttributeNS(null, "gradientUnits", "userSpaceOnUse"), M.setAttributeNS(null, "cx", X[0]), M.setAttributeNS(null, "cy", X[1]), M.setAttributeNS(null, "r", I), M.setAttributeNS(null, "fx", D[0]), M.setAttributeNS(null, "fy", D[1]), M.setAttributeNS(null, "fr", G);
                      break;
                    default:
                      throw new Error(`Unknown RadialAxial type: ${p[1]}`);
                  }
                  for (const m of $) {
                    const N = this.svgFactory.createElement("svg:stop");
                    N.setAttributeNS(null, "offset", m[0]), N.setAttributeNS(null, "stop-color", m[1]), M.append(N);
                  }
                  return this.defs.append(M), `url(#${E})`;
                case "Mesh":
                  return (0, s.warn)("Unimplemented pattern Mesh"), null;
                case "Dummy":
                  return "hotpink";
                default:
                  throw new Error(`Unknown IR type: ${p[0]}`);
              }
            }
            setDash(p, E) {
              this.current.dashArray = p, this.current.dashPhase = E;
            }
            constructPath(p, E) {
              const $ = this.current;
              let M = $.x, m = $.y, N = [], D = 0;
              for (const X of p)
                switch (X | 0) {
                  case s.OPS.rectangle:
                    M = E[D++], m = E[D++];
                    const G = E[D++], I = E[D++], B = M + G, ee = m + I;
                    N.push("M", C(M), C(m), "L", C(B), C(m), "L", C(B), C(ee), "L", C(M), C(ee), "Z");
                    break;
                  case s.OPS.moveTo:
                    M = E[D++], m = E[D++], N.push("M", C(M), C(m));
                    break;
                  case s.OPS.lineTo:
                    M = E[D++], m = E[D++], N.push("L", C(M), C(m));
                    break;
                  case s.OPS.curveTo:
                    M = E[D + 4], m = E[D + 5], N.push("C", C(E[D]), C(E[D + 1]), C(E[D + 2]), C(E[D + 3]), C(M), C(m)), D += 6;
                    break;
                  case s.OPS.curveTo2:
                    N.push("C", C(M), C(m), C(E[D]), C(E[D + 1]), C(E[D + 2]), C(E[D + 3])), M = E[D + 2], m = E[D + 3], D += 4;
                    break;
                  case s.OPS.curveTo3:
                    M = E[D + 2], m = E[D + 3], N.push("C", C(E[D]), C(E[D + 1]), C(M), C(m), C(M), C(m)), D += 4;
                    break;
                  case s.OPS.closePath:
                    N.push("Z");
                    break;
                }
              N = N.join(" "), $.path && p.length > 0 && p[0] !== s.OPS.rectangle && p[0] !== s.OPS.moveTo ? N = $.path.getAttributeNS(null, "d") + N : ($.path = this.svgFactory.createElement("svg:path"), this._ensureTransformGroup().append($.path)), $.path.setAttributeNS(null, "d", N), $.path.setAttributeNS(null, "fill", "none"), $.element = $.path, $.setCurrentPoint(M, m);
            }
            endPath() {
              const p = this.current;
              if (p.path = null, !this.pendingClip)
                return;
              if (!p.element) {
                this.pendingClip = null;
                return;
              }
              const E = `clippath${b++}`, $ = this.svgFactory.createElement("svg:clipPath");
              $.setAttributeNS(null, "id", E), $.setAttributeNS(null, "transform", P(this.transformMatrix));
              const M = p.element.cloneNode(!0);
              if (this.pendingClip === "evenodd" ? M.setAttributeNS(null, "clip-rule", "evenodd") : M.setAttributeNS(null, "clip-rule", "nonzero"), this.pendingClip = null, $.append(M), this.defs.append($), p.activeClipUrl) {
                p.clipGroup = null;
                for (const m of this.extraStack)
                  m.clipGroup = null;
                $.setAttributeNS(null, "clip-path", p.activeClipUrl);
              }
              p.activeClipUrl = `url(#${E})`, this.tgrp = null;
            }
            clip(p) {
              this.pendingClip = p;
            }
            closePath() {
              const p = this.current;
              if (p.path) {
                const E = `${p.path.getAttributeNS(null, "d")}Z`;
                p.path.setAttributeNS(null, "d", E);
              }
            }
            setLeading(p) {
              this.current.leading = -p;
            }
            setTextRise(p) {
              this.current.textRise = p;
            }
            setTextRenderingMode(p) {
              this.current.textRenderingMode = p;
            }
            setHScale(p) {
              this.current.textHScale = p / 100;
            }
            setRenderingIntent(p) {
            }
            setFlatness(p) {
            }
            setGState(p) {
              for (const [E, $] of p)
                switch (E) {
                  case "LW":
                    this.setLineWidth($);
                    break;
                  case "LC":
                    this.setLineCap($);
                    break;
                  case "LJ":
                    this.setLineJoin($);
                    break;
                  case "ML":
                    this.setMiterLimit($);
                    break;
                  case "D":
                    this.setDash($[0], $[1]);
                    break;
                  case "RI":
                    this.setRenderingIntent($);
                    break;
                  case "FL":
                    this.setFlatness($);
                    break;
                  case "Font":
                    this.setFont($);
                    break;
                  case "CA":
                    this.setStrokeAlpha($);
                    break;
                  case "ca":
                    this.setFillAlpha($);
                    break;
                  default:
                    (0, s.warn)(`Unimplemented graphic state operator ${E}`);
                    break;
                }
            }
            fill() {
              const p = this.current;
              p.element && (p.element.setAttributeNS(null, "fill", p.fillColor), p.element.setAttributeNS(null, "fill-opacity", p.fillAlpha), this.endPath());
            }
            stroke() {
              const p = this.current;
              p.element && (this._setStrokeAttributes(p.element), p.element.setAttributeNS(null, "fill", "none"), this.endPath());
            }
            _setStrokeAttributes(p, E = 1) {
              const $ = this.current;
              let M = $.dashArray;
              E !== 1 && M.length > 0 && (M = M.map(function(m) {
                return E * m;
              })), p.setAttributeNS(null, "stroke", $.strokeColor), p.setAttributeNS(null, "stroke-opacity", $.strokeAlpha), p.setAttributeNS(null, "stroke-miterlimit", C($.miterLimit)), p.setAttributeNS(null, "stroke-linecap", $.lineCap), p.setAttributeNS(null, "stroke-linejoin", $.lineJoin), p.setAttributeNS(null, "stroke-width", C(E * $.lineWidth) + "px"), p.setAttributeNS(null, "stroke-dasharray", M.map(C).join(" ")), p.setAttributeNS(null, "stroke-dashoffset", C(E * $.dashPhase) + "px");
            }
            eoFill() {
              var p;
              (p = this.current.element) == null || p.setAttributeNS(null, "fill-rule", "evenodd"), this.fill();
            }
            fillStroke() {
              this.stroke(), this.fill();
            }
            eoFillStroke() {
              var p;
              (p = this.current.element) == null || p.setAttributeNS(null, "fill-rule", "evenodd"), this.fillStroke();
            }
            closeStroke() {
              this.closePath(), this.stroke();
            }
            closeFillStroke() {
              this.closePath(), this.fillStroke();
            }
            closeEOFillStroke() {
              this.closePath(), this.eoFillStroke();
            }
            paintSolidColorImageMask() {
              const p = this.svgFactory.createElement("svg:rect");
              p.setAttributeNS(null, "x", "0"), p.setAttributeNS(null, "y", "0"), p.setAttributeNS(null, "width", "1px"), p.setAttributeNS(null, "height", "1px"), p.setAttributeNS(null, "fill", this.current.fillColor), this._ensureTransformGroup().append(p);
            }
            paintImageXObject(p) {
              const E = this.getObject(p);
              if (!E) {
                (0, s.warn)(`Dependent image with object ID ${p} is not ready yet`);
                return;
              }
              this.paintInlineImageXObject(E);
            }
            paintInlineImageXObject(p, E) {
              const $ = p.width, M = p.height, m = T(p, this.forceDataSchema, !!E), N = this.svgFactory.createElement("svg:rect");
              N.setAttributeNS(null, "x", "0"), N.setAttributeNS(null, "y", "0"), N.setAttributeNS(null, "width", C($)), N.setAttributeNS(null, "height", C(M)), this.current.element = N, this.clip("nonzero");
              const D = this.svgFactory.createElement("svg:image");
              D.setAttributeNS(_, "xlink:href", m), D.setAttributeNS(null, "x", "0"), D.setAttributeNS(null, "y", C(-M)), D.setAttributeNS(null, "width", C($) + "px"), D.setAttributeNS(null, "height", C(M) + "px"), D.setAttributeNS(null, "transform", `scale(${C(1 / $)} ${C(-1 / M)})`), E ? E.append(D) : this._ensureTransformGroup().append(D);
            }
            paintImageMaskXObject(p) {
              const E = this.getObject(p.data, p);
              if (E.bitmap) {
                (0, s.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");
                return;
              }
              const $ = this.current, M = E.width, m = E.height, N = $.fillColor;
              $.maskId = `mask${k++}`;
              const D = this.svgFactory.createElement("svg:mask");
              D.setAttributeNS(null, "id", $.maskId);
              const X = this.svgFactory.createElement("svg:rect");
              X.setAttributeNS(null, "x", "0"), X.setAttributeNS(null, "y", "0"), X.setAttributeNS(null, "width", C(M)), X.setAttributeNS(null, "height", C(m)), X.setAttributeNS(null, "fill", N), X.setAttributeNS(null, "mask", `url(#${$.maskId})`), this.defs.append(D), this._ensureTransformGroup().append(X), this.paintInlineImageXObject(E, D);
            }
            paintFormXObjectBegin(p, E) {
              if (Array.isArray(p) && p.length === 6 && this.transform(p[0], p[1], p[2], p[3], p[4], p[5]), E) {
                const $ = E[2] - E[0], M = E[3] - E[1], m = this.svgFactory.createElement("svg:rect");
                m.setAttributeNS(null, "x", E[0]), m.setAttributeNS(null, "y", E[1]), m.setAttributeNS(null, "width", C($)), m.setAttributeNS(null, "height", C(M)), this.current.element = m, this.clip("nonzero"), this.endPath();
              }
            }
            paintFormXObjectEnd() {
            }
            _initialize(p) {
              const E = this.svgFactory.create(p.width, p.height), $ = this.svgFactory.createElement("svg:defs");
              E.append($), this.defs = $;
              const M = this.svgFactory.createElement("svg:g");
              return M.setAttributeNS(null, "transform", P(p.transform)), E.append(M), this.svg = M, E;
            }
            _ensureClipGroup() {
              if (!this.current.clipGroup) {
                const p = this.svgFactory.createElement("svg:g");
                p.setAttributeNS(null, "clip-path", this.current.activeClipUrl), this.svg.append(p), this.current.clipGroup = p;
              }
              return this.current.clipGroup;
            }
            _ensureTransformGroup() {
              return this.tgrp || (this.tgrp = this.svgFactory.createElement("svg:g"), this.tgrp.setAttributeNS(null, "transform", P(this.transformMatrix)), this.current.activeClipUrl ? this._ensureClipGroup().append(this.tgrp) : this.svg.append(this.tgrp)), this.tgrp;
            }
          }
          e.SVGGraphics = x;
        },
        /* 25 */
        /***/
        (t, e) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.XfaText = void 0;
          class i {
            static textContent(s) {
              const l = [], h = {
                items: l,
                styles: /* @__PURE__ */ Object.create(null)
              };
              function _(c) {
                var T;
                if (!c)
                  return;
                let o = null;
                const r = c.name;
                if (r === "#text")
                  o = c.value;
                else if (i.shouldBuildText(r))
                  (T = c == null ? void 0 : c.attributes) != null && T.textContent ? o = c.attributes.textContent : c.value && (o = c.value);
                else
                  return;
                if (o !== null && l.push({
                  str: o
                }), !!c.children)
                  for (const S of c.children)
                    _(S);
              }
              return _(s), h;
            }
            static shouldBuildText(s) {
              return !(s === "textarea" || s === "input" || s === "option" || s === "select");
            }
          }
          e.XfaText = i;
        },
        /* 26 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.TextLayerRenderTask = void 0, e.renderTextLayer = P, e.updateTextLayer = b;
          var n = i(1), s = i(6);
          const l = 1e5, h = 30, _ = 0.8, c = /* @__PURE__ */ new Map();
          function o(k, F) {
            let x;
            if (F && n.FeatureTest.isOffscreenCanvasSupported)
              x = new OffscreenCanvas(k, k).getContext("2d", {
                alpha: !1
              });
            else {
              const y = document.createElement("canvas");
              y.width = y.height = k, x = y.getContext("2d", {
                alpha: !1
              });
            }
            return x;
          }
          function r(k, F) {
            const x = c.get(k);
            if (x)
              return x;
            const y = o(h, F);
            y.font = `${h}px ${k}`;
            const p = y.measureText("");
            let E = p.fontBoundingBoxAscent, $ = Math.abs(p.fontBoundingBoxDescent);
            if (E) {
              const m = E / (E + $);
              return c.set(k, m), y.canvas.width = y.canvas.height = 0, m;
            }
            y.strokeStyle = "red", y.clearRect(0, 0, h, h), y.strokeText("g", 0, 0);
            let M = y.getImageData(0, 0, h, h).data;
            $ = 0;
            for (let m = M.length - 1 - 3; m >= 0; m -= 4)
              if (M[m] > 0) {
                $ = Math.ceil(m / 4 / h);
                break;
              }
            y.clearRect(0, 0, h, h), y.strokeText("A", 0, h), M = y.getImageData(0, 0, h, h).data, E = 0;
            for (let m = 0, N = M.length; m < N; m += 4)
              if (M[m] > 0) {
                E = h - Math.floor(m / 4 / h);
                break;
              }
            if (y.canvas.width = y.canvas.height = 0, E) {
              const m = E / (E + $);
              return c.set(k, m), m;
            }
            return c.set(k, _), _;
          }
          function T(k, F, x) {
            const y = document.createElement("span"), p = {
              angle: 0,
              canvasWidth: 0,
              hasText: F.str !== "",
              hasEOL: F.hasEOL,
              fontSize: 0
            };
            k._textDivs.push(y);
            const E = n.Util.transform(k._transform, F.transform);
            let $ = Math.atan2(E[1], E[0]);
            const M = x[F.fontName];
            M.vertical && ($ += Math.PI / 2);
            const m = Math.hypot(E[2], E[3]), N = m * r(M.fontFamily, k._isOffscreenCanvasSupported);
            let D, X;
            $ === 0 ? (D = E[4], X = E[5] - N) : (D = E[4] + N * Math.sin($), X = E[5] - N * Math.cos($));
            const G = "calc(var(--scale-factor)*", I = y.style;
            k._container === k._rootContainer ? (I.left = `${(100 * D / k._pageWidth).toFixed(2)}%`, I.top = `${(100 * X / k._pageHeight).toFixed(2)}%`) : (I.left = `${G}${D.toFixed(2)}px)`, I.top = `${G}${X.toFixed(2)}px)`), I.fontSize = `${G}${m.toFixed(2)}px)`, I.fontFamily = M.fontFamily, p.fontSize = m, y.setAttribute("role", "presentation"), y.textContent = F.str, y.dir = F.dir, k._fontInspectorEnabled && (y.dataset.fontName = F.fontName), $ !== 0 && (p.angle = $ * (180 / Math.PI));
            let B = !1;
            if (F.str.length > 1)
              B = !0;
            else if (F.str !== " " && F.transform[0] !== F.transform[3]) {
              const ee = Math.abs(F.transform[0]), Y = Math.abs(F.transform[3]);
              ee !== Y && Math.max(ee, Y) / Math.min(ee, Y) > 1.5 && (B = !0);
            }
            B && (p.canvasWidth = M.vertical ? F.height : F.width), k._textDivProperties.set(y, p), k._isReadableStream && k._layoutText(y);
          }
          function S(k) {
            const {
              div: F,
              scale: x,
              properties: y,
              ctx: p,
              prevFontSize: E,
              prevFontFamily: $
            } = k, {
              style: M
            } = F;
            let m = "";
            if (y.canvasWidth !== 0 && y.hasText) {
              const {
                fontFamily: N
              } = M, {
                canvasWidth: D,
                fontSize: X
              } = y;
              (E !== X || $ !== N) && (p.font = `${X * x}px ${N}`, k.prevFontSize = X, k.prevFontFamily = N);
              const {
                width: G
              } = p.measureText(F.textContent);
              G > 0 && (m = `scaleX(${D * x / G})`);
            }
            y.angle !== 0 && (m = `rotate(${y.angle}deg) ${m}`), m.length > 0 && (M.transform = m);
          }
          function w(k) {
            if (k._canceled)
              return;
            const F = k._textDivs, x = k._capability;
            if (F.length > l) {
              x.resolve();
              return;
            }
            if (!k._isReadableStream)
              for (const p of F)
                k._layoutText(p);
            x.resolve();
          }
          class C {
            constructor({
              textContentSource: F,
              container: x,
              viewport: y,
              textDivs: p,
              textDivProperties: E,
              textContentItemsStr: $,
              isOffscreenCanvasSupported: M
            }) {
              var G;
              this._textContentSource = F, this._isReadableStream = F instanceof ReadableStream, this._container = this._rootContainer = x, this._textDivs = p || [], this._textContentItemsStr = $ || [], this._isOffscreenCanvasSupported = M, this._fontInspectorEnabled = !!((G = globalThis.FontInspector) != null && G.enabled), this._reader = null, this._textDivProperties = E || /* @__PURE__ */ new WeakMap(), this._canceled = !1, this._capability = new n.PromiseCapability(), this._layoutTextParams = {
                prevFontSize: null,
                prevFontFamily: null,
                div: null,
                scale: y.scale * (globalThis.devicePixelRatio || 1),
                properties: null,
                ctx: o(0, M)
              };
              const {
                pageWidth: m,
                pageHeight: N,
                pageX: D,
                pageY: X
              } = y.rawDims;
              this._transform = [1, 0, 0, -1, -D, X + N], this._pageWidth = m, this._pageHeight = N, (0, s.setLayerDimensions)(x, y), this._capability.promise.finally(() => {
                this._layoutTextParams = null;
              }).catch(() => {
              });
            }
            get promise() {
              return this._capability.promise;
            }
            cancel() {
              this._canceled = !0, this._reader && (this._reader.cancel(new n.AbortException("TextLayer task cancelled.")).catch(() => {
              }), this._reader = null), this._capability.reject(new n.AbortException("TextLayer task cancelled."));
            }
            _processItems(F, x) {
              for (const y of F) {
                if (y.str === void 0) {
                  if (y.type === "beginMarkedContentProps" || y.type === "beginMarkedContent") {
                    const p = this._container;
                    this._container = document.createElement("span"), this._container.classList.add("markedContent"), y.id !== null && this._container.setAttribute("id", `${y.id}`), p.append(this._container);
                  } else
                    y.type === "endMarkedContent" && (this._container = this._container.parentNode);
                  continue;
                }
                this._textContentItemsStr.push(y.str), T(this, y, x);
              }
            }
            _layoutText(F) {
              const x = this._layoutTextParams.properties = this._textDivProperties.get(F);
              if (this._layoutTextParams.div = F, S(this._layoutTextParams), x.hasText && this._container.append(F), x.hasEOL) {
                const y = document.createElement("br");
                y.setAttribute("role", "presentation"), this._container.append(y);
              }
            }
            _render() {
              const F = new n.PromiseCapability();
              let x = /* @__PURE__ */ Object.create(null);
              if (this._isReadableStream) {
                const y = () => {
                  this._reader.read().then(({
                    value: p,
                    done: E
                  }) => {
                    if (E) {
                      F.resolve();
                      return;
                    }
                    Object.assign(x, p.styles), this._processItems(p.items, x), y();
                  }, F.reject);
                };
                this._reader = this._textContentSource.getReader(), y();
              } else if (this._textContentSource) {
                const {
                  items: y,
                  styles: p
                } = this._textContentSource;
                this._processItems(y, p), F.resolve();
              } else
                throw new Error('No "textContentSource" parameter specified.');
              F.promise.then(() => {
                x = null, w(this);
              }, this._capability.reject);
            }
          }
          e.TextLayerRenderTask = C;
          function P(k) {
            !k.textContentSource && (k.textContent || k.textContentStream) && ((0, s.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."), k.textContentSource = k.textContent || k.textContentStream);
            const {
              container: F,
              viewport: x
            } = k, y = getComputedStyle(F), p = y.getPropertyValue("visibility"), E = parseFloat(y.getPropertyValue("--scale-factor"));
            p === "visible" && (!E || Math.abs(E - x.scale) > 1e-5) && console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM.");
            const $ = new C(k);
            return $._render(), $;
          }
          function b({
            container: k,
            viewport: F,
            textDivs: x,
            textDivProperties: y,
            isOffscreenCanvasSupported: p,
            mustRotate: E = !0,
            mustRescale: $ = !0
          }) {
            if (E && (0, s.setLayerDimensions)(k, {
              rotation: F.rotation
            }), $) {
              const M = o(0, p), N = {
                prevFontSize: null,
                prevFontFamily: null,
                div: null,
                scale: F.scale * (globalThis.devicePixelRatio || 1),
                properties: null,
                ctx: M
              };
              for (const D of x)
                N.properties = y.get(D), N.div = D, S(N);
            }
          }
        },
        /* 27 */
        /***/
        (t, e, i) => {
          var r, T, S, w, C, P, b, k, F, x, y, nn, E, Rt, M, sn, N, rn;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.AnnotationEditorLayer = void 0;
          var n = i(1), s = i(4), l = i(28), h = i(33), _ = i(6), c = i(34);
          const X = class X {
            constructor({
              uiManager: I,
              pageIndex: B,
              div: ee,
              accessibilityManager: Y,
              annotationLayer: q,
              viewport: le,
              l10n: pe
            }) {
              W(this, y);
              W(this, E);
              W(this, M);
              W(this, N);
              W(this, r, void 0);
              W(this, T, !1);
              W(this, S, null);
              W(this, w, this.pointerup.bind(this));
              W(this, C, this.pointerdown.bind(this));
              W(this, P, /* @__PURE__ */ new Map());
              W(this, b, !1);
              W(this, k, !1);
              W(this, F, !1);
              W(this, x, void 0);
              const we = [l.FreeTextEditor, h.InkEditor, c.StampEditor];
              if (!X._initialized) {
                X._initialized = !0;
                for (const be of we)
                  be.initialize(pe);
              }
              I.registerEditorTypes(we), oe(this, x, I), this.pageIndex = B, this.div = ee, oe(this, r, Y), oe(this, S, q), this.viewport = le, a(this, x).addLayer(this);
            }
            get isEmpty() {
              return a(this, P).size === 0;
            }
            updateToolbar(I) {
              a(this, x).updateToolbar(I);
            }
            updateMode(I = a(this, x).getMode()) {
              K(this, N, rn).call(this), I === n.AnnotationEditorType.INK ? (this.addInkEditorIfNeeded(!1), this.disableClick()) : this.enableClick(), I !== n.AnnotationEditorType.NONE && (this.div.classList.toggle("freeTextEditing", I === n.AnnotationEditorType.FREETEXT), this.div.classList.toggle("inkEditing", I === n.AnnotationEditorType.INK), this.div.classList.toggle("stampEditing", I === n.AnnotationEditorType.STAMP), this.div.hidden = !1);
            }
            addInkEditorIfNeeded(I) {
              if (!I && a(this, x).getMode() !== n.AnnotationEditorType.INK)
                return;
              if (!I) {
                for (const ee of a(this, P).values())
                  if (ee.isEmpty()) {
                    ee.setInBackground();
                    return;
                  }
              }
              K(this, E, Rt).call(this, {
                offsetX: 0,
                offsetY: 0
              }, !1).setInBackground();
            }
            setEditingState(I) {
              a(this, x).setEditingState(I);
            }
            addCommands(I) {
              a(this, x).addCommands(I);
            }
            enable() {
              this.div.style.pointerEvents = "auto";
              const I = /* @__PURE__ */ new Set();
              for (const ee of a(this, P).values())
                ee.enableEditing(), ee.annotationElementId && I.add(ee.annotationElementId);
              if (!a(this, S))
                return;
              const B = a(this, S).getEditableAnnotations();
              for (const ee of B) {
                if (ee.hide(), a(this, x).isDeletedAnnotationElement(ee.data.id) || I.has(ee.data.id))
                  continue;
                const Y = this.deserialize(ee);
                Y && (this.addOrRebuild(Y), Y.enableEditing());
              }
            }
            disable() {
              var B;
              oe(this, F, !0), this.div.style.pointerEvents = "none";
              const I = /* @__PURE__ */ new Set();
              for (const ee of a(this, P).values()) {
                if (ee.disableEditing(), !ee.annotationElementId || ee.serialize() !== null) {
                  I.add(ee.annotationElementId);
                  continue;
                }
                (B = this.getEditableAnnotation(ee.annotationElementId)) == null || B.show(), ee.remove();
              }
              if (a(this, S)) {
                const ee = a(this, S).getEditableAnnotations();
                for (const Y of ee) {
                  const {
                    id: q
                  } = Y.data;
                  I.has(q) || a(this, x).isDeletedAnnotationElement(q) || Y.show();
                }
              }
              K(this, N, rn).call(this), this.isEmpty && (this.div.hidden = !0), oe(this, F, !1);
            }
            getEditableAnnotation(I) {
              var B;
              return ((B = a(this, S)) == null ? void 0 : B.getEditableAnnotation(I)) || null;
            }
            setActiveEditor(I) {
              a(this, x).getActive() !== I && a(this, x).setActiveEditor(I);
            }
            enableClick() {
              this.div.addEventListener("pointerdown", a(this, C)), this.div.addEventListener("pointerup", a(this, w));
            }
            disableClick() {
              this.div.removeEventListener("pointerdown", a(this, C)), this.div.removeEventListener("pointerup", a(this, w));
            }
            attach(I) {
              a(this, P).set(I.id, I);
              const {
                annotationElementId: B
              } = I;
              B && a(this, x).isDeletedAnnotationElement(B) && a(this, x).removeDeletedAnnotationElement(I);
            }
            detach(I) {
              var B;
              a(this, P).delete(I.id), (B = a(this, r)) == null || B.removePointerInTextLayer(I.contentDiv), !a(this, F) && I.annotationElementId && a(this, x).addDeletedAnnotationElement(I);
            }
            remove(I) {
              this.detach(I), a(this, x).removeEditor(I), I.div.contains(document.activeElement) && setTimeout(() => {
                a(this, x).focusMainContainer();
              }, 0), I.div.remove(), I.isAttachedToDOM = !1, a(this, k) || this.addInkEditorIfNeeded(!1);
            }
            changeParent(I) {
              var B;
              I.parent !== this && (I.annotationElementId && (a(this, x).addDeletedAnnotationElement(I.annotationElementId), s.AnnotationEditor.deleteAnnotationElement(I), I.annotationElementId = null), this.attach(I), (B = I.parent) == null || B.detach(I), I.setParent(this), I.div && I.isAttachedToDOM && (I.div.remove(), this.div.append(I.div)));
            }
            add(I) {
              if (this.changeParent(I), a(this, x).addEditor(I), this.attach(I), !I.isAttachedToDOM) {
                const B = I.render();
                this.div.append(B), I.isAttachedToDOM = !0;
              }
              I.fixAndSetPosition(), I.onceAdded(), a(this, x).addToAnnotationStorage(I);
            }
            moveEditorInDOM(I) {
              var ee;
              if (!I.isAttachedToDOM)
                return;
              const {
                activeElement: B
              } = document;
              I.div.contains(B) && (I._focusEventsAllowed = !1, setTimeout(() => {
                I.div.contains(document.activeElement) ? I._focusEventsAllowed = !0 : (I.div.addEventListener("focusin", () => {
                  I._focusEventsAllowed = !0;
                }, {
                  once: !0
                }), B.focus());
              }, 0)), I._structTreeParentId = (ee = a(this, r)) == null ? void 0 : ee.moveElementInDOM(this.div, I.div, I.contentDiv, !0);
            }
            addOrRebuild(I) {
              I.needsToBeRebuilt() ? I.rebuild() : this.add(I);
            }
            addUndoableEditor(I) {
              const B = () => I._uiManager.rebuild(I), ee = () => {
                I.remove();
              };
              this.addCommands({
                cmd: B,
                undo: ee,
                mustExec: !1
              });
            }
            getNextId() {
              return a(this, x).getId();
            }
            pasteEditor(I, B) {
              a(this, x).updateToolbar(I), a(this, x).updateMode(I);
              const {
                offsetX: ee,
                offsetY: Y
              } = K(this, M, sn).call(this), q = this.getNextId(), le = K(this, y, nn).call(this, {
                parent: this,
                id: q,
                x: ee,
                y: Y,
                uiManager: a(this, x),
                isCentered: !0,
                ...B
              });
              le && this.add(le);
            }
            deserialize(I) {
              switch (I.annotationType ?? I.annotationEditorType) {
                case n.AnnotationEditorType.FREETEXT:
                  return l.FreeTextEditor.deserialize(I, this, a(this, x));
                case n.AnnotationEditorType.INK:
                  return h.InkEditor.deserialize(I, this, a(this, x));
                case n.AnnotationEditorType.STAMP:
                  return c.StampEditor.deserialize(I, this, a(this, x));
              }
              return null;
            }
            addNewEditor() {
              K(this, E, Rt).call(this, K(this, M, sn).call(this), !0);
            }
            setSelected(I) {
              a(this, x).setSelected(I);
            }
            toggleSelected(I) {
              a(this, x).toggleSelected(I);
            }
            isSelected(I) {
              return a(this, x).isSelected(I);
            }
            unselect(I) {
              a(this, x).unselect(I);
            }
            pointerup(I) {
              const {
                isMac: B
              } = n.FeatureTest.platform;
              if (!(I.button !== 0 || I.ctrlKey && B) && I.target === this.div && a(this, b)) {
                if (oe(this, b, !1), !a(this, T)) {
                  oe(this, T, !0);
                  return;
                }
                if (a(this, x).getMode() === n.AnnotationEditorType.STAMP) {
                  a(this, x).unselectAll();
                  return;
                }
                K(this, E, Rt).call(this, I, !1);
              }
            }
            pointerdown(I) {
              if (a(this, b)) {
                oe(this, b, !1);
                return;
              }
              const {
                isMac: B
              } = n.FeatureTest.platform;
              if (I.button !== 0 || I.ctrlKey && B || I.target !== this.div)
                return;
              oe(this, b, !0);
              const ee = a(this, x).getActive();
              oe(this, T, !ee || ee.isEmpty());
            }
            findNewParent(I, B, ee) {
              const Y = a(this, x).findParent(B, ee);
              return Y === null || Y === this ? !1 : (Y.changeParent(I), !0);
            }
            destroy() {
              var I, B;
              ((I = a(this, x).getActive()) == null ? void 0 : I.parent) === this && (a(this, x).commitOrRemove(), a(this, x).setActiveEditor(null));
              for (const ee of a(this, P).values())
                (B = a(this, r)) == null || B.removePointerInTextLayer(ee.contentDiv), ee.setParent(null), ee.isAttachedToDOM = !1, ee.div.remove();
              this.div = null, a(this, P).clear(), a(this, x).removeLayer(this);
            }
            render({
              viewport: I
            }) {
              this.viewport = I, (0, _.setLayerDimensions)(this.div, I);
              for (const B of a(this, x).getEditors(this.pageIndex))
                this.add(B);
              this.updateMode();
            }
            update({
              viewport: I
            }) {
              a(this, x).commitOrRemove(), this.viewport = I, (0, _.setLayerDimensions)(this.div, {
                rotation: I.rotation
              }), this.updateMode();
            }
            get pageDimensions() {
              const {
                pageWidth: I,
                pageHeight: B
              } = this.viewport.rawDims;
              return [I, B];
            }
          };
          r = new WeakMap(), T = new WeakMap(), S = new WeakMap(), w = new WeakMap(), C = new WeakMap(), P = new WeakMap(), b = new WeakMap(), k = new WeakMap(), F = new WeakMap(), x = new WeakMap(), y = new WeakSet(), nn = function(I) {
            switch (a(this, x).getMode()) {
              case n.AnnotationEditorType.FREETEXT:
                return new l.FreeTextEditor(I);
              case n.AnnotationEditorType.INK:
                return new h.InkEditor(I);
              case n.AnnotationEditorType.STAMP:
                return new c.StampEditor(I);
            }
            return null;
          }, E = new WeakSet(), Rt = function(I, B) {
            const ee = this.getNextId(), Y = K(this, y, nn).call(this, {
              parent: this,
              id: ee,
              x: I.offsetX,
              y: I.offsetY,
              uiManager: a(this, x),
              isCentered: B
            });
            return Y && this.add(Y), Y;
          }, M = new WeakSet(), sn = function() {
            const {
              x: I,
              y: B,
              width: ee,
              height: Y
            } = this.div.getBoundingClientRect(), q = Math.max(0, I), le = Math.max(0, B), pe = Math.min(window.innerWidth, I + ee), we = Math.min(window.innerHeight, B + Y), be = (q + pe) / 2 - I, R = (le + we) / 2 - B, [d, g] = this.viewport.rotation % 180 === 0 ? [be, R] : [R, be];
            return {
              offsetX: d,
              offsetY: g
            };
          }, N = new WeakSet(), rn = function() {
            oe(this, k, !0);
            for (const I of a(this, P).values())
              I.isEmpty() && I.remove();
            oe(this, k, !1);
          }, nt(X, "_initialized", !1);
          let o = X;
          e.AnnotationEditorLayer = o;
        },
        /* 28 */
        /***/
        (t, e, i) => {
          var c, o, r, T, S, w, C, P, b, k, In, x, Ln, p, Dn, $, At, m, an, D, On, G, on;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.FreeTextEditor = void 0;
          var n = i(1), s = i(5), l = i(4), h = i(29);
          const B = class B extends l.AnnotationEditor {
            constructor(q) {
              super({
                ...q,
                name: "freeTextEditor"
              });
              W(this, k);
              W(this, x);
              W(this, p);
              W(this, $);
              W(this, m);
              W(this, D);
              W(this, G);
              W(this, c, this.editorDivBlur.bind(this));
              W(this, o, this.editorDivFocus.bind(this));
              W(this, r, this.editorDivInput.bind(this));
              W(this, T, this.editorDivKeydown.bind(this));
              W(this, S, void 0);
              W(this, w, "");
              W(this, C, `${this.id}-editor`);
              W(this, P, void 0);
              W(this, b, null);
              oe(this, S, q.color || B._defaultColor || l.AnnotationEditor._defaultLineColor), oe(this, P, q.fontSize || B._defaultFontSize);
            }
            static get _keyboardManager() {
              const q = B.prototype, le = (be) => be.isEmpty(), pe = s.AnnotationEditorUIManager.TRANSLATE_SMALL, we = s.AnnotationEditorUIManager.TRANSLATE_BIG;
              return (0, n.shadow)(this, "_keyboardManager", new s.KeyboardManager([[["ctrl+s", "mac+meta+s", "ctrl+p", "mac+meta+p"], q.commitOrRemove, {
                bubbles: !0
              }], [["ctrl+Enter", "mac+meta+Enter", "Escape", "mac+Escape"], q.commitOrRemove], [["ArrowLeft", "mac+ArrowLeft"], q._translateEmpty, {
                args: [-pe, 0],
                checker: le
              }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], q._translateEmpty, {
                args: [-we, 0],
                checker: le
              }], [["ArrowRight", "mac+ArrowRight"], q._translateEmpty, {
                args: [pe, 0],
                checker: le
              }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], q._translateEmpty, {
                args: [we, 0],
                checker: le
              }], [["ArrowUp", "mac+ArrowUp"], q._translateEmpty, {
                args: [0, -pe],
                checker: le
              }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], q._translateEmpty, {
                args: [0, -we],
                checker: le
              }], [["ArrowDown", "mac+ArrowDown"], q._translateEmpty, {
                args: [0, pe],
                checker: le
              }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], q._translateEmpty, {
                args: [0, we],
                checker: le
              }]]));
            }
            static initialize(q) {
              l.AnnotationEditor.initialize(q, {
                strings: ["free_text2_default_content", "editor_free_text2_aria_label"]
              });
              const le = getComputedStyle(document.documentElement);
              this._internalPadding = parseFloat(le.getPropertyValue("--freetext-padding"));
            }
            static updateDefaultParams(q, le) {
              switch (q) {
                case n.AnnotationEditorParamsType.FREETEXT_SIZE:
                  B._defaultFontSize = le;
                  break;
                case n.AnnotationEditorParamsType.FREETEXT_COLOR:
                  B._defaultColor = le;
                  break;
              }
            }
            updateParams(q, le) {
              switch (q) {
                case n.AnnotationEditorParamsType.FREETEXT_SIZE:
                  K(this, k, In).call(this, le);
                  break;
                case n.AnnotationEditorParamsType.FREETEXT_COLOR:
                  K(this, x, Ln).call(this, le);
                  break;
              }
            }
            static get defaultPropertiesToUpdate() {
              return [[n.AnnotationEditorParamsType.FREETEXT_SIZE, B._defaultFontSize], [n.AnnotationEditorParamsType.FREETEXT_COLOR, B._defaultColor || l.AnnotationEditor._defaultLineColor]];
            }
            get propertiesToUpdate() {
              return [[n.AnnotationEditorParamsType.FREETEXT_SIZE, a(this, P)], [n.AnnotationEditorParamsType.FREETEXT_COLOR, a(this, S)]];
            }
            _translateEmpty(q, le) {
              this._uiManager.translateSelectedEditors(q, le, !0);
            }
            getInitialTranslation() {
              const q = this.parentScale;
              return [-B._internalPadding * q, -(B._internalPadding + a(this, P)) * q];
            }
            rebuild() {
              this.parent && (super.rebuild(), this.div !== null && (this.isAttachedToDOM || this.parent.add(this)));
            }
            enableEditMode() {
              this.isInEditMode() || (this.parent.setEditingState(!1), this.parent.updateToolbar(n.AnnotationEditorType.FREETEXT), super.enableEditMode(), this.overlayDiv.classList.remove("enabled"), this.editorDiv.contentEditable = !0, this._isDraggable = !1, this.div.removeAttribute("aria-activedescendant"), this.editorDiv.addEventListener("keydown", a(this, T)), this.editorDiv.addEventListener("focus", a(this, o)), this.editorDiv.addEventListener("blur", a(this, c)), this.editorDiv.addEventListener("input", a(this, r)));
            }
            disableEditMode() {
              this.isInEditMode() && (this.parent.setEditingState(!0), super.disableEditMode(), this.overlayDiv.classList.add("enabled"), this.editorDiv.contentEditable = !1, this.div.setAttribute("aria-activedescendant", a(this, C)), this._isDraggable = !0, this.editorDiv.removeEventListener("keydown", a(this, T)), this.editorDiv.removeEventListener("focus", a(this, o)), this.editorDiv.removeEventListener("blur", a(this, c)), this.editorDiv.removeEventListener("input", a(this, r)), this.div.focus({
                preventScroll: !0
              }), this.isEditing = !1, this.parent.div.classList.add("freeTextEditing"));
            }
            focusin(q) {
              this._focusEventsAllowed && (super.focusin(q), q.target !== this.editorDiv && this.editorDiv.focus());
            }
            onceAdded() {
              var q;
              if (this.width) {
                K(this, G, on).call(this);
                return;
              }
              this.enableEditMode(), this.editorDiv.focus(), (q = this._initialOptions) != null && q.isCentered && this.center(), this._initialOptions = null;
            }
            isEmpty() {
              return !this.editorDiv || this.editorDiv.innerText.trim() === "";
            }
            remove() {
              this.isEditing = !1, this.parent && (this.parent.setEditingState(!0), this.parent.div.classList.add("freeTextEditing")), super.remove();
            }
            commit() {
              if (!this.isInEditMode())
                return;
              super.commit(), this.disableEditMode();
              const q = a(this, w), le = oe(this, w, K(this, p, Dn).call(this).trimEnd());
              if (q === le)
                return;
              const pe = (we) => {
                if (oe(this, w, we), !we) {
                  this.remove();
                  return;
                }
                K(this, m, an).call(this), this._uiManager.rebuild(this), K(this, $, At).call(this);
              };
              this.addCommands({
                cmd: () => {
                  pe(le);
                },
                undo: () => {
                  pe(q);
                },
                mustExec: !1
              }), K(this, $, At).call(this);
            }
            shouldGetKeyboardEvents() {
              return this.isInEditMode();
            }
            enterInEditMode() {
              this.enableEditMode(), this.editorDiv.focus();
            }
            dblclick(q) {
              this.enterInEditMode();
            }
            keydown(q) {
              q.target === this.div && q.key === "Enter" && (this.enterInEditMode(), q.preventDefault());
            }
            editorDivKeydown(q) {
              B._keyboardManager.exec(this, q);
            }
            editorDivFocus(q) {
              this.isEditing = !0;
            }
            editorDivBlur(q) {
              this.isEditing = !1;
            }
            editorDivInput(q) {
              this.parent.div.classList.toggle("freeTextEditing", this.isEmpty());
            }
            disableEditing() {
              this.editorDiv.setAttribute("role", "comment"), this.editorDiv.removeAttribute("aria-multiline");
            }
            enableEditing() {
              this.editorDiv.setAttribute("role", "textbox"), this.editorDiv.setAttribute("aria-multiline", !0);
            }
            render() {
              if (this.div)
                return this.div;
              let q, le;
              this.width && (q = this.x, le = this.y), super.render(), this.editorDiv = document.createElement("div"), this.editorDiv.className = "internal", this.editorDiv.setAttribute("id", a(this, C)), this.enableEditing(), l.AnnotationEditor._l10nPromise.get("editor_free_text2_aria_label").then((we) => {
                var be;
                return (be = this.editorDiv) == null ? void 0 : be.setAttribute("aria-label", we);
              }), l.AnnotationEditor._l10nPromise.get("free_text2_default_content").then((we) => {
                var be;
                return (be = this.editorDiv) == null ? void 0 : be.setAttribute("default-content", we);
              }), this.editorDiv.contentEditable = !0;
              const {
                style: pe
              } = this.editorDiv;
              if (pe.fontSize = `calc(${a(this, P)}px * var(--scale-factor))`, pe.color = a(this, S), this.div.append(this.editorDiv), this.overlayDiv = document.createElement("div"), this.overlayDiv.classList.add("overlay", "enabled"), this.div.append(this.overlayDiv), (0, s.bindEvents)(this, this.div, ["dblclick", "keydown"]), this.width) {
                const [we, be] = this.parentDimensions;
                if (this.annotationElementId) {
                  const {
                    position: R
                  } = a(this, b);
                  let [d, g] = this.getInitialTranslation();
                  [d, g] = this.pageTranslationToScreen(d, g);
                  const [f, v] = this.pageDimensions, [A, O] = this.pageTranslation;
                  let H, z;
                  switch (this.rotation) {
                    case 0:
                      H = q + (R[0] - A) / f, z = le + this.height - (R[1] - O) / v;
                      break;
                    case 90:
                      H = q + (R[0] - A) / f, z = le - (R[1] - O) / v, [d, g] = [g, -d];
                      break;
                    case 180:
                      H = q - this.width + (R[0] - A) / f, z = le - (R[1] - O) / v, [d, g] = [-d, -g];
                      break;
                    case 270:
                      H = q + (R[0] - A - this.height * v) / f, z = le + (R[1] - O - this.width * f) / v, [d, g] = [-g, d];
                      break;
                  }
                  this.setAt(H * we, z * be, d, g);
                } else
                  this.setAt(q * we, le * be, this.width * we, this.height * be);
                K(this, m, an).call(this), this._isDraggable = !0, this.editorDiv.contentEditable = !1;
              } else
                this._isDraggable = !1, this.editorDiv.contentEditable = !0;
              return this.div;
            }
            get contentDiv() {
              return this.editorDiv;
            }
            static deserialize(q, le, pe) {
              let we = null;
              if (q instanceof h.FreeTextAnnotationElement) {
                const {
                  data: {
                    defaultAppearanceData: {
                      fontSize: R,
                      fontColor: d
                    },
                    rect: g,
                    rotation: f,
                    id: v
                  },
                  textContent: A,
                  textPosition: O,
                  parent: {
                    page: {
                      pageNumber: H
                    }
                  }
                } = q;
                if (!A || A.length === 0)
                  return null;
                we = q = {
                  annotationType: n.AnnotationEditorType.FREETEXT,
                  color: Array.from(d),
                  fontSize: R,
                  value: A.join(`
`),
                  position: O,
                  pageIndex: H - 1,
                  rect: g,
                  rotation: f,
                  id: v,
                  deleted: !1
                };
              }
              const be = super.deserialize(q, le, pe);
              return oe(be, P, q.fontSize), oe(be, S, n.Util.makeHexColor(...q.color)), oe(be, w, q.value), be.annotationElementId = q.id || null, oe(be, b, we), be;
            }
            serialize(q = !1) {
              if (this.isEmpty())
                return null;
              if (this.deleted)
                return {
                  pageIndex: this.pageIndex,
                  id: this.annotationElementId,
                  deleted: !0
                };
              const le = B._internalPadding * this.parentScale, pe = this.getRect(le, le), we = l.AnnotationEditor._colorManager.convert(this.isAttachedToDOM ? getComputedStyle(this.editorDiv).color : a(this, S)), be = {
                annotationType: n.AnnotationEditorType.FREETEXT,
                color: we,
                fontSize: a(this, P),
                value: a(this, w),
                pageIndex: this.pageIndex,
                rect: pe,
                rotation: this.rotation,
                structTreeParentId: this._structTreeParentId
              };
              return q ? be : this.annotationElementId && !K(this, D, On).call(this, be) ? null : (be.id = this.annotationElementId, be);
            }
          };
          c = new WeakMap(), o = new WeakMap(), r = new WeakMap(), T = new WeakMap(), S = new WeakMap(), w = new WeakMap(), C = new WeakMap(), P = new WeakMap(), b = new WeakMap(), k = new WeakSet(), In = function(q) {
            const le = (we) => {
              this.editorDiv.style.fontSize = `calc(${we}px * var(--scale-factor))`, this.translate(0, -(we - a(this, P)) * this.parentScale), oe(this, P, we), K(this, $, At).call(this);
            }, pe = a(this, P);
            this.addCommands({
              cmd: () => {
                le(q);
              },
              undo: () => {
                le(pe);
              },
              mustExec: !0,
              type: n.AnnotationEditorParamsType.FREETEXT_SIZE,
              overwriteIfSameType: !0,
              keepUndo: !0
            });
          }, x = new WeakSet(), Ln = function(q) {
            const le = a(this, S);
            this.addCommands({
              cmd: () => {
                oe(this, S, this.editorDiv.style.color = q);
              },
              undo: () => {
                oe(this, S, this.editorDiv.style.color = le);
              },
              mustExec: !0,
              type: n.AnnotationEditorParamsType.FREETEXT_COLOR,
              overwriteIfSameType: !0,
              keepUndo: !0
            });
          }, p = new WeakSet(), Dn = function() {
            const q = this.editorDiv.getElementsByTagName("div");
            if (q.length === 0)
              return this.editorDiv.innerText;
            const le = [];
            for (const pe of q)
              le.push(pe.innerText.replace(/\r\n?|\n/, ""));
            return le.join(`
`);
          }, $ = new WeakSet(), At = function() {
            const [q, le] = this.parentDimensions;
            let pe;
            if (this.isAttachedToDOM)
              pe = this.div.getBoundingClientRect();
            else {
              const {
                currentLayer: we,
                div: be
              } = this, R = be.style.display;
              be.style.display = "hidden", we.div.append(this.div), pe = be.getBoundingClientRect(), be.remove(), be.style.display = R;
            }
            this.rotation % 180 === this.parentRotation % 180 ? (this.width = pe.width / q, this.height = pe.height / le) : (this.width = pe.height / q, this.height = pe.width / le), this.fixAndSetPosition();
          }, m = new WeakSet(), an = function() {
            if (this.editorDiv.replaceChildren(), !!a(this, w))
              for (const q of a(this, w).split(`
`)) {
                const le = document.createElement("div");
                le.append(q ? document.createTextNode(q) : document.createElement("br")), this.editorDiv.append(le);
              }
          }, D = new WeakSet(), On = function(q) {
            const {
              value: le,
              fontSize: pe,
              color: we,
              rect: be,
              pageIndex: R
            } = a(this, b);
            return q.value !== le || q.fontSize !== pe || q.rect.some((d, g) => Math.abs(d - be[g]) >= 1) || q.color.some((d, g) => d !== we[g]) || q.pageIndex !== R;
          }, G = new WeakSet(), on = function(q = !1) {
            if (!this.annotationElementId)
              return;
            if (K(this, $, At).call(this), !q && (this.width === 0 || this.height === 0)) {
              setTimeout(() => K(this, G, on).call(this, !0), 0);
              return;
            }
            const le = B._internalPadding * this.parentScale;
            a(this, b).rect = this.getRect(le, le);
          }, nt(B, "_freeTextDefaultContent", ""), nt(B, "_internalPadding", 0), nt(B, "_defaultColor", null), nt(B, "_defaultFontSize", 10), nt(B, "_type", "freetext");
          let _ = B;
          e.FreeTextEditor = _;
        },
        /* 29 */
        /***/
        (t, e, i) => {
          var g, v, ht, O, Nn, z, ae, Z, ce, ue, me, fe, Pe, Fe, Ee, De, _e, ie, se, ge, Ce, xe, He, $n, je, Mt, Xe, ln, Ye, cn, ne, J, ve, Se, tt, et, te, hn, Ne, ke, $e, Be, Bn, Ae, un;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.StampAnnotationElement = e.InkAnnotationElement = e.FreeTextAnnotationElement = e.AnnotationLayer = void 0;
          var n = i(1), s = i(6), l = i(3), h = i(30), _ = i(31), c = i(32);
          const o = 1e3, r = 9, T = /* @__PURE__ */ new WeakSet();
          function S(Oe) {
            return {
              width: Oe[2] - Oe[0],
              height: Oe[3] - Oe[1]
            };
          }
          class w {
            static create(U) {
              switch (U.data.annotationType) {
                case n.AnnotationType.LINK:
                  return new P(U);
                case n.AnnotationType.TEXT:
                  return new b(U);
                case n.AnnotationType.WIDGET:
                  switch (U.data.fieldType) {
                    case "Tx":
                      return new F(U);
                    case "Btn":
                      return U.data.radioButton ? new p(U) : U.data.checkBox ? new y(U) : new E(U);
                    case "Ch":
                      return new $(U);
                    case "Sig":
                      return new x(U);
                  }
                  return new k(U);
                case n.AnnotationType.POPUP:
                  return new M(U);
                case n.AnnotationType.FREETEXT:
                  return new N(U);
                case n.AnnotationType.LINE:
                  return new D(U);
                case n.AnnotationType.SQUARE:
                  return new X(U);
                case n.AnnotationType.CIRCLE:
                  return new G(U);
                case n.AnnotationType.POLYLINE:
                  return new I(U);
                case n.AnnotationType.CARET:
                  return new ee(U);
                case n.AnnotationType.INK:
                  return new Y(U);
                case n.AnnotationType.POLYGON:
                  return new B(U);
                case n.AnnotationType.HIGHLIGHT:
                  return new q(U);
                case n.AnnotationType.UNDERLINE:
                  return new le(U);
                case n.AnnotationType.SQUIGGLY:
                  return new pe(U);
                case n.AnnotationType.STRIKEOUT:
                  return new we(U);
                case n.AnnotationType.STAMP:
                  return new be(U);
                case n.AnnotationType.FILEATTACHMENT:
                  return new R(U);
                default:
                  return new C(U);
              }
            }
          }
          const f = class f {
            constructor(U, {
              isRenderable: u = !1,
              ignoreBorder: L = !1,
              createQuadrilaterals: j = !1
            } = {}) {
              W(this, g, !1);
              this.isRenderable = u, this.data = U.data, this.layer = U.layer, this.linkService = U.linkService, this.downloadManager = U.downloadManager, this.imageResourcesPath = U.imageResourcesPath, this.renderForms = U.renderForms, this.svgFactory = U.svgFactory, this.annotationStorage = U.annotationStorage, this.enableScripting = U.enableScripting, this.hasJSActions = U.hasJSActions, this._fieldObjects = U.fieldObjects, this.parent = U.parent, u && (this.container = this._createContainer(L)), j && this._createQuadrilaterals();
            }
            static _hasPopupData({
              titleObj: U,
              contentsObj: u,
              richText: L
            }) {
              return !!(U != null && U.str || u != null && u.str || L != null && L.str);
            }
            get hasPopupData() {
              return f._hasPopupData(this.data);
            }
            _createContainer(U) {
              const {
                data: u,
                parent: {
                  page: L,
                  viewport: j
                }
              } = this, V = document.createElement("section");
              V.setAttribute("data-annotation-id", u.id), this instanceof k || (V.tabIndex = o), V.style.zIndex = this.parent.zIndex++, this.data.popupRef && V.setAttribute("aria-haspopup", "dialog"), u.noRotate && V.classList.add("norotate");
              const {
                pageWidth: Q,
                pageHeight: he,
                pageX: ye,
                pageY: Me
              } = j.rawDims;
              if (!u.rect || this instanceof M) {
                const {
                  rotation: Ue
                } = u;
                return !u.hasOwnCanvas && Ue !== 0 && this.setRotation(Ue, V), V;
              }
              const {
                width: Re,
                height: qe
              } = S(u.rect), Ie = n.Util.normalizeRect([u.rect[0], L.view[3] - u.rect[1] + L.view[1], u.rect[2], L.view[3] - u.rect[3] + L.view[1]]);
              if (!U && u.borderStyle.width > 0) {
                V.style.borderWidth = `${u.borderStyle.width}px`;
                const Ue = u.borderStyle.horizontalCornerRadius, Ve = u.borderStyle.verticalCornerRadius;
                if (Ue > 0 || Ve > 0) {
                  const Qe = `calc(${Ue}px * var(--scale-factor)) / calc(${Ve}px * var(--scale-factor))`;
                  V.style.borderRadius = Qe;
                } else if (this instanceof p) {
                  const Qe = `calc(${Re}px * var(--scale-factor)) / calc(${qe}px * var(--scale-factor))`;
                  V.style.borderRadius = Qe;
                }
                switch (u.borderStyle.style) {
                  case n.AnnotationBorderStyleType.SOLID:
                    V.style.borderStyle = "solid";
                    break;
                  case n.AnnotationBorderStyleType.DASHED:
                    V.style.borderStyle = "dashed";
                    break;
                  case n.AnnotationBorderStyleType.BEVELED:
                    (0, n.warn)("Unimplemented border style: beveled");
                    break;
                  case n.AnnotationBorderStyleType.INSET:
                    (0, n.warn)("Unimplemented border style: inset");
                    break;
                  case n.AnnotationBorderStyleType.UNDERLINE:
                    V.style.borderBottomStyle = "solid";
                    break;
                }
                const Je = u.borderColor || null;
                Je ? (oe(this, g, !0), V.style.borderColor = n.Util.makeHexColor(Je[0] | 0, Je[1] | 0, Je[2] | 0)) : V.style.borderWidth = 0;
              }
              V.style.left = `${100 * (Ie[0] - ye) / Q}%`, V.style.top = `${100 * (Ie[1] - Me) / he}%`;
              const {
                rotation: Le
              } = u;
              return u.hasOwnCanvas || Le === 0 ? (V.style.width = `${100 * Re / Q}%`, V.style.height = `${100 * qe / he}%`) : this.setRotation(Le, V), V;
            }
            setRotation(U, u = this.container) {
              if (!this.data.rect)
                return;
              const {
                pageWidth: L,
                pageHeight: j
              } = this.parent.viewport.rawDims, {
                width: V,
                height: Q
              } = S(this.data.rect);
              let he, ye;
              U % 180 === 0 ? (he = 100 * V / L, ye = 100 * Q / j) : (he = 100 * Q / L, ye = 100 * V / j), u.style.width = `${he}%`, u.style.height = `${ye}%`, u.setAttribute("data-main-rotation", (360 - U) % 360);
            }
            get _commonActions() {
              const U = (u, L, j) => {
                const V = j.detail[u], Q = V[0], he = V.slice(1);
                j.target.style[L] = h.ColorConverters[`${Q}_HTML`](he), this.annotationStorage.setValue(this.data.id, {
                  [L]: h.ColorConverters[`${Q}_rgb`](he)
                });
              };
              return (0, n.shadow)(this, "_commonActions", {
                display: (u) => {
                  const {
                    display: L
                  } = u.detail, j = L % 2 === 1;
                  this.container.style.visibility = j ? "hidden" : "visible", this.annotationStorage.setValue(this.data.id, {
                    noView: j,
                    noPrint: L === 1 || L === 2
                  });
                },
                print: (u) => {
                  this.annotationStorage.setValue(this.data.id, {
                    noPrint: !u.detail.print
                  });
                },
                hidden: (u) => {
                  const {
                    hidden: L
                  } = u.detail;
                  this.container.style.visibility = L ? "hidden" : "visible", this.annotationStorage.setValue(this.data.id, {
                    noPrint: L,
                    noView: L
                  });
                },
                focus: (u) => {
                  setTimeout(() => u.target.focus({
                    preventScroll: !1
                  }), 0);
                },
                userName: (u) => {
                  u.target.title = u.detail.userName;
                },
                readonly: (u) => {
                  u.target.disabled = u.detail.readonly;
                },
                required: (u) => {
                  this._setRequired(u.target, u.detail.required);
                },
                bgColor: (u) => {
                  U("bgColor", "backgroundColor", u);
                },
                fillColor: (u) => {
                  U("fillColor", "backgroundColor", u);
                },
                fgColor: (u) => {
                  U("fgColor", "color", u);
                },
                textColor: (u) => {
                  U("textColor", "color", u);
                },
                borderColor: (u) => {
                  U("borderColor", "borderColor", u);
                },
                strokeColor: (u) => {
                  U("strokeColor", "borderColor", u);
                },
                rotation: (u) => {
                  const L = u.detail.rotation;
                  this.setRotation(L), this.annotationStorage.setValue(this.data.id, {
                    rotation: L
                  });
                }
              });
            }
            _dispatchEventFromSandbox(U, u) {
              const L = this._commonActions;
              for (const j of Object.keys(u.detail)) {
                const V = U[j] || L[j];
                V == null || V(u);
              }
            }
            _setDefaultPropertiesFromJS(U) {
              if (!this.enableScripting)
                return;
              const u = this.annotationStorage.getRawValue(this.data.id);
              if (!u)
                return;
              const L = this._commonActions;
              for (const [j, V] of Object.entries(u)) {
                const Q = L[j];
                if (Q) {
                  const he = {
                    detail: {
                      [j]: V
                    },
                    target: U
                  };
                  Q(he), delete u[j];
                }
              }
            }
            _createQuadrilaterals() {
              if (!this.container)
                return;
              const {
                quadPoints: U
              } = this.data;
              if (!U)
                return;
              const [u, L, j, V] = this.data.rect;
              if (U.length === 1) {
                const [, {
                  x: Ve,
                  y: Je
                }, {
                  x: Qe,
                  y: st
                }] = U[0];
                if (j === Ve && V === Je && u === Qe && L === st)
                  return;
              }
              const {
                style: Q
              } = this.container;
              let he;
              if (a(this, g)) {
                const {
                  borderColor: Ve,
                  borderWidth: Je
                } = Q;
                Q.borderWidth = 0, he = ["url('data:image/svg+xml;utf8,", '<svg xmlns="http://www.w3.org/2000/svg"', ' preserveAspectRatio="none" viewBox="0 0 1 1">', `<g fill="transparent" stroke="${Ve}" stroke-width="${Je}">`], this.container.classList.add("hasBorder");
              }
              const ye = j - u, Me = V - L, {
                svgFactory: Re
              } = this, qe = Re.createElement("svg");
              qe.classList.add("quadrilateralsContainer"), qe.setAttribute("width", 0), qe.setAttribute("height", 0);
              const Ie = Re.createElement("defs");
              qe.append(Ie);
              const Le = Re.createElement("clipPath"), Ue = `clippath_${this.data.id}`;
              Le.setAttribute("id", Ue), Le.setAttribute("clipPathUnits", "objectBoundingBox"), Ie.append(Le);
              for (const [, {
                x: Ve,
                y: Je
              }, {
                x: Qe,
                y: st
              }] of U) {
                const it = Re.createElement("rect"), rt = (Qe - u) / ye, lt = (V - Je) / Me, ct = (Ve - Qe) / ye, An = (Je - st) / Me;
                it.setAttribute("x", rt), it.setAttribute("y", lt), it.setAttribute("width", ct), it.setAttribute("height", An), Le.append(it), he == null || he.push(`<rect vector-effect="non-scaling-stroke" x="${rt}" y="${lt}" width="${ct}" height="${An}"/>`);
              }
              a(this, g) && (he.push("</g></svg>')"), Q.backgroundImage = he.join("")), this.container.append(qe), this.container.style.clipPath = `url(#${Ue})`;
            }
            _createPopup() {
              const {
                container: U,
                data: u
              } = this;
              U.setAttribute("aria-haspopup", "dialog");
              const L = new M({
                data: {
                  color: u.color,
                  titleObj: u.titleObj,
                  modificationDate: u.modificationDate,
                  contentsObj: u.contentsObj,
                  richText: u.richText,
                  parentRect: u.rect,
                  borderStyle: 0,
                  id: `popup_${u.id}`,
                  rotation: u.rotation
                },
                parent: this.parent,
                elements: [this]
              });
              this.parent.div.append(L.render());
            }
            render() {
              (0, n.unreachable)("Abstract method `AnnotationElement.render` called");
            }
            _getElementsByName(U, u = null) {
              const L = [];
              if (this._fieldObjects) {
                const j = this._fieldObjects[U];
                if (j)
                  for (const {
                    page: V,
                    id: Q,
                    exportValues: he
                  } of j) {
                    if (V === -1 || Q === u)
                      continue;
                    const ye = typeof he == "string" ? he : null, Me = document.querySelector(`[data-element-id="${Q}"]`);
                    if (Me && !T.has(Me)) {
                      (0, n.warn)(`_getElementsByName - element not allowed: ${Q}`);
                      continue;
                    }
                    L.push({
                      id: Q,
                      exportValue: ye,
                      domElement: Me
                    });
                  }
                return L;
              }
              for (const j of document.getElementsByName(U)) {
                const {
                  exportValue: V
                } = j, Q = j.getAttribute("data-element-id");
                Q !== u && T.has(j) && L.push({
                  id: Q,
                  exportValue: V,
                  domElement: j
                });
              }
              return L;
            }
            show() {
              var U;
              this.container && (this.container.hidden = !1), (U = this.popup) == null || U.maybeShow();
            }
            hide() {
              var U;
              this.container && (this.container.hidden = !0), (U = this.popup) == null || U.forceHide();
            }
            getElementsToTriggerPopup() {
              return this.container;
            }
            addHighlightArea() {
              const U = this.getElementsToTriggerPopup();
              if (Array.isArray(U))
                for (const u of U)
                  u.classList.add("highlightArea");
              else
                U.classList.add("highlightArea");
            }
            _editOnDoubleClick() {
              const {
                annotationEditorType: U,
                data: {
                  id: u
                }
              } = this;
              this.container.addEventListener("dblclick", () => {
                var L;
                (L = this.linkService.eventBus) == null || L.dispatch("switchannotationeditormode", {
                  source: this,
                  mode: U,
                  editId: u
                });
              });
            }
          };
          g = new WeakMap();
          let C = f;
          class P extends C {
            constructor(u, L = null) {
              super(u, {
                isRenderable: !0,
                ignoreBorder: !!(L != null && L.ignoreBorder),
                createQuadrilaterals: !0
              });
              W(this, v);
              W(this, O);
              this.isTooltipOnly = u.data.isTooltipOnly;
            }
            render() {
              const {
                data: u,
                linkService: L
              } = this, j = document.createElement("a");
              j.setAttribute("data-element-id", u.id);
              let V = !1;
              return u.url ? (L.addLinkAttributes(j, u.url, u.newWindow), V = !0) : u.action ? (this._bindNamedAction(j, u.action), V = !0) : u.attachment ? (this._bindAttachment(j, u.attachment), V = !0) : u.setOCGState ? (K(this, O, Nn).call(this, j, u.setOCGState), V = !0) : u.dest ? (this._bindLink(j, u.dest), V = !0) : (u.actions && (u.actions.Action || u.actions["Mouse Up"] || u.actions["Mouse Down"]) && this.enableScripting && this.hasJSActions && (this._bindJSAction(j, u), V = !0), u.resetForm ? (this._bindResetFormAction(j, u.resetForm), V = !0) : this.isTooltipOnly && !V && (this._bindLink(j, ""), V = !0)), this.container.classList.add("linkAnnotation"), V && this.container.append(j), this.container;
            }
            _bindLink(u, L) {
              u.href = this.linkService.getDestinationHash(L), u.onclick = () => (L && this.linkService.goToDestination(L), !1), (L || L === "") && K(this, v, ht).call(this);
            }
            _bindNamedAction(u, L) {
              u.href = this.linkService.getAnchorUrl(""), u.onclick = () => (this.linkService.executeNamedAction(L), !1), K(this, v, ht).call(this);
            }
            _bindAttachment(u, L) {
              u.href = this.linkService.getAnchorUrl(""), u.onclick = () => {
                var j;
                return (j = this.downloadManager) == null || j.openOrDownloadData(this.container, L.content, L.filename), !1;
              }, K(this, v, ht).call(this);
            }
            _bindJSAction(u, L) {
              u.href = this.linkService.getAnchorUrl("");
              const j = /* @__PURE__ */ new Map([["Action", "onclick"], ["Mouse Up", "onmouseup"], ["Mouse Down", "onmousedown"]]);
              for (const V of Object.keys(L.actions)) {
                const Q = j.get(V);
                Q && (u[Q] = () => {
                  var he;
                  return (he = this.linkService.eventBus) == null || he.dispatch("dispatcheventinsandbox", {
                    source: this,
                    detail: {
                      id: L.id,
                      name: V
                    }
                  }), !1;
                });
              }
              u.onclick || (u.onclick = () => !1), K(this, v, ht).call(this);
            }
            _bindResetFormAction(u, L) {
              const j = u.onclick;
              if (j || (u.href = this.linkService.getAnchorUrl("")), K(this, v, ht).call(this), !this._fieldObjects) {
                (0, n.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'), j || (u.onclick = () => !1);
                return;
              }
              u.onclick = () => {
                var qe;
                j == null || j();
                const {
                  fields: V,
                  refs: Q,
                  include: he
                } = L, ye = [];
                if (V.length !== 0 || Q.length !== 0) {
                  const Ie = new Set(Q);
                  for (const Le of V) {
                    const Ue = this._fieldObjects[Le] || [];
                    for (const {
                      id: Ve
                    } of Ue)
                      Ie.add(Ve);
                  }
                  for (const Le of Object.values(this._fieldObjects))
                    for (const Ue of Le)
                      Ie.has(Ue.id) === he && ye.push(Ue);
                } else
                  for (const Ie of Object.values(this._fieldObjects))
                    ye.push(...Ie);
                const Me = this.annotationStorage, Re = [];
                for (const Ie of ye) {
                  const {
                    id: Le
                  } = Ie;
                  switch (Re.push(Le), Ie.type) {
                    case "text": {
                      const Ve = Ie.defaultValue || "";
                      Me.setValue(Le, {
                        value: Ve
                      });
                      break;
                    }
                    case "checkbox":
                    case "radiobutton": {
                      const Ve = Ie.defaultValue === Ie.exportValues;
                      Me.setValue(Le, {
                        value: Ve
                      });
                      break;
                    }
                    case "combobox":
                    case "listbox": {
                      const Ve = Ie.defaultValue || "";
                      Me.setValue(Le, {
                        value: Ve
                      });
                      break;
                    }
                    default:
                      continue;
                  }
                  const Ue = document.querySelector(`[data-element-id="${Le}"]`);
                  if (Ue) {
                    if (!T.has(Ue)) {
                      (0, n.warn)(`_bindResetFormAction - element not allowed: ${Le}`);
                      continue;
                    }
                  } else
                    continue;
                  Ue.dispatchEvent(new Event("resetform"));
                }
                return this.enableScripting && ((qe = this.linkService.eventBus) == null || qe.dispatch("dispatcheventinsandbox", {
                  source: this,
                  detail: {
                    id: "app",
                    ids: Re,
                    name: "ResetForm"
                  }
                })), !1;
              };
            }
          }
          v = new WeakSet(), ht = function() {
            this.container.setAttribute("data-internal-link", "");
          }, O = new WeakSet(), Nn = function(u, L) {
            u.href = this.linkService.getAnchorUrl(""), u.onclick = () => (this.linkService.executeSetOCGState(L), !1), K(this, v, ht).call(this);
          };
          class b extends C {
            constructor(U) {
              super(U, {
                isRenderable: !0
              });
            }
            render() {
              this.container.classList.add("textAnnotation");
              const U = document.createElement("img");
              return U.src = this.imageResourcesPath + "annotation-" + this.data.name.toLowerCase() + ".svg", U.alt = "[{{type}} Annotation]", U.dataset.l10nId = "text_annotation_type", U.dataset.l10nArgs = JSON.stringify({
                type: this.data.name
              }), !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.append(U), this.container;
            }
          }
          class k extends C {
            render() {
              return this.data.alternativeText && (this.container.title = this.data.alternativeText), this.container;
            }
            showElementAndHideCanvas(U) {
              var u;
              this.data.hasOwnCanvas && (((u = U.previousSibling) == null ? void 0 : u.nodeName) === "CANVAS" && (U.previousSibling.hidden = !0), U.hidden = !1);
            }
            _getKeyModifier(U) {
              const {
                isWin: u,
                isMac: L
              } = n.FeatureTest.platform;
              return u && U.ctrlKey || L && U.metaKey;
            }
            _setEventListener(U, u, L, j, V) {
              L.includes("mouse") ? U.addEventListener(L, (Q) => {
                var he;
                (he = this.linkService.eventBus) == null || he.dispatch("dispatcheventinsandbox", {
                  source: this,
                  detail: {
                    id: this.data.id,
                    name: j,
                    value: V(Q),
                    shift: Q.shiftKey,
                    modifier: this._getKeyModifier(Q)
                  }
                });
              }) : U.addEventListener(L, (Q) => {
                var he;
                if (L === "blur") {
                  if (!u.focused || !Q.relatedTarget)
                    return;
                  u.focused = !1;
                } else if (L === "focus") {
                  if (u.focused)
                    return;
                  u.focused = !0;
                }
                V && ((he = this.linkService.eventBus) == null || he.dispatch("dispatcheventinsandbox", {
                  source: this,
                  detail: {
                    id: this.data.id,
                    name: j,
                    value: V(Q)
                  }
                }));
              });
            }
            _setEventListeners(U, u, L, j) {
              var V, Q, he;
              for (const [ye, Me] of L)
                (Me === "Action" || (V = this.data.actions) != null && V[Me]) && ((Me === "Focus" || Me === "Blur") && (u || (u = {
                  focused: !1
                })), this._setEventListener(U, u, ye, Me, j), Me === "Focus" && !((Q = this.data.actions) != null && Q.Blur) ? this._setEventListener(U, u, "blur", "Blur", null) : Me === "Blur" && !((he = this.data.actions) != null && he.Focus) && this._setEventListener(U, u, "focus", "Focus", null));
            }
            _setBackgroundColor(U) {
              const u = this.data.backgroundColor || null;
              U.style.backgroundColor = u === null ? "transparent" : n.Util.makeHexColor(u[0], u[1], u[2]);
            }
            _setTextStyle(U) {
              const u = ["left", "center", "right"], {
                fontColor: L
              } = this.data.defaultAppearanceData, j = this.data.defaultAppearanceData.fontSize || r, V = U.style;
              let Q;
              const he = 2, ye = (Me) => Math.round(10 * Me) / 10;
              if (this.data.multiLine) {
                const Me = Math.abs(this.data.rect[3] - this.data.rect[1] - he), Re = Math.round(Me / (n.LINE_FACTOR * j)) || 1, qe = Me / Re;
                Q = Math.min(j, ye(qe / n.LINE_FACTOR));
              } else {
                const Me = Math.abs(this.data.rect[3] - this.data.rect[1] - he);
                Q = Math.min(j, ye(Me / n.LINE_FACTOR));
              }
              V.fontSize = `calc(${Q}px * var(--scale-factor))`, V.color = n.Util.makeHexColor(L[0], L[1], L[2]), this.data.textAlignment !== null && (V.textAlign = u[this.data.textAlignment]);
            }
            _setRequired(U, u) {
              u ? U.setAttribute("required", !0) : U.removeAttribute("required"), U.setAttribute("aria-required", u);
            }
          }
          class F extends k {
            constructor(U) {
              const u = U.renderForms || !U.data.hasAppearance && !!U.data.fieldValue;
              super(U, {
                isRenderable: u
              });
            }
            setPropertyOnSiblings(U, u, L, j) {
              const V = this.annotationStorage;
              for (const Q of this._getElementsByName(U.name, U.id))
                Q.domElement && (Q.domElement[u] = L), V.setValue(Q.id, {
                  [j]: L
                });
            }
            render() {
              var j, V;
              const U = this.annotationStorage, u = this.data.id;
              this.container.classList.add("textWidgetAnnotation");
              let L = null;
              if (this.renderForms) {
                const Q = U.getValue(u, {
                  value: this.data.fieldValue
                });
                let he = Q.value || "";
                const ye = U.getValue(u, {
                  charLimit: this.data.maxLen
                }).charLimit;
                ye && he.length > ye && (he = he.slice(0, ye));
                let Me = Q.formattedValue || ((j = this.data.textContent) == null ? void 0 : j.join(`
`)) || null;
                Me && this.data.comb && (Me = Me.replaceAll(/\s+/g, ""));
                const Re = {
                  userValue: he,
                  formattedValue: Me,
                  lastCommittedValue: null,
                  commitKey: 1,
                  focused: !1
                };
                this.data.multiLine ? (L = document.createElement("textarea"), L.textContent = Me ?? he, this.data.doNotScroll && (L.style.overflowY = "hidden")) : (L = document.createElement("input"), L.type = "text", L.setAttribute("value", Me ?? he), this.data.doNotScroll && (L.style.overflowX = "hidden")), this.data.hasOwnCanvas && (L.hidden = !0), T.add(L), L.setAttribute("data-element-id", u), L.disabled = this.data.readOnly, L.name = this.data.fieldName, L.tabIndex = o, this._setRequired(L, this.data.required), ye && (L.maxLength = ye), L.addEventListener("input", (Ie) => {
                  U.setValue(u, {
                    value: Ie.target.value
                  }), this.setPropertyOnSiblings(L, "value", Ie.target.value, "value"), Re.formattedValue = null;
                }), L.addEventListener("resetform", (Ie) => {
                  const Le = this.data.defaultFieldValue ?? "";
                  L.value = Re.userValue = Le, Re.formattedValue = null;
                });
                let qe = (Ie) => {
                  const {
                    formattedValue: Le
                  } = Re;
                  Le != null && (Ie.target.value = Le), Ie.target.scrollLeft = 0;
                };
                if (this.enableScripting && this.hasJSActions) {
                  L.addEventListener("focus", (Le) => {
                    if (Re.focused)
                      return;
                    const {
                      target: Ue
                    } = Le;
                    Re.userValue && (Ue.value = Re.userValue), Re.lastCommittedValue = Ue.value, Re.commitKey = 1, Re.focused = !0;
                  }), L.addEventListener("updatefromsandbox", (Le) => {
                    this.showElementAndHideCanvas(Le.target);
                    const Ue = {
                      value(Ve) {
                        Re.userValue = Ve.detail.value ?? "", U.setValue(u, {
                          value: Re.userValue.toString()
                        }), Ve.target.value = Re.userValue;
                      },
                      formattedValue(Ve) {
                        const {
                          formattedValue: Je
                        } = Ve.detail;
                        Re.formattedValue = Je, Je != null && Ve.target !== document.activeElement && (Ve.target.value = Je), U.setValue(u, {
                          formattedValue: Je
                        });
                      },
                      selRange(Ve) {
                        Ve.target.setSelectionRange(...Ve.detail.selRange);
                      },
                      charLimit: (Ve) => {
                        var it;
                        const {
                          charLimit: Je
                        } = Ve.detail, {
                          target: Qe
                        } = Ve;
                        if (Je === 0) {
                          Qe.removeAttribute("maxLength");
                          return;
                        }
                        Qe.setAttribute("maxLength", Je);
                        let st = Re.userValue;
                        !st || st.length <= Je || (st = st.slice(0, Je), Qe.value = Re.userValue = st, U.setValue(u, {
                          value: st
                        }), (it = this.linkService.eventBus) == null || it.dispatch("dispatcheventinsandbox", {
                          source: this,
                          detail: {
                            id: u,
                            name: "Keystroke",
                            value: st,
                            willCommit: !0,
                            commitKey: 1,
                            selStart: Qe.selectionStart,
                            selEnd: Qe.selectionEnd
                          }
                        }));
                      }
                    };
                    this._dispatchEventFromSandbox(Ue, Le);
                  }), L.addEventListener("keydown", (Le) => {
                    var Je;
                    Re.commitKey = 1;
                    let Ue = -1;
                    if (Le.key === "Escape" ? Ue = 0 : Le.key === "Enter" && !this.data.multiLine ? Ue = 2 : Le.key === "Tab" && (Re.commitKey = 3), Ue === -1)
                      return;
                    const {
                      value: Ve
                    } = Le.target;
                    Re.lastCommittedValue !== Ve && (Re.lastCommittedValue = Ve, Re.userValue = Ve, (Je = this.linkService.eventBus) == null || Je.dispatch("dispatcheventinsandbox", {
                      source: this,
                      detail: {
                        id: u,
                        name: "Keystroke",
                        value: Ve,
                        willCommit: !0,
                        commitKey: Ue,
                        selStart: Le.target.selectionStart,
                        selEnd: Le.target.selectionEnd
                      }
                    }));
                  });
                  const Ie = qe;
                  qe = null, L.addEventListener("blur", (Le) => {
                    var Ve;
                    if (!Re.focused || !Le.relatedTarget)
                      return;
                    Re.focused = !1;
                    const {
                      value: Ue
                    } = Le.target;
                    Re.userValue = Ue, Re.lastCommittedValue !== Ue && ((Ve = this.linkService.eventBus) == null || Ve.dispatch("dispatcheventinsandbox", {
                      source: this,
                      detail: {
                        id: u,
                        name: "Keystroke",
                        value: Ue,
                        willCommit: !0,
                        commitKey: Re.commitKey,
                        selStart: Le.target.selectionStart,
                        selEnd: Le.target.selectionEnd
                      }
                    })), Ie(Le);
                  }), (V = this.data.actions) != null && V.Keystroke && L.addEventListener("beforeinput", (Le) => {
                    var lt;
                    Re.lastCommittedValue = null;
                    const {
                      data: Ue,
                      target: Ve
                    } = Le, {
                      value: Je,
                      selectionStart: Qe,
                      selectionEnd: st
                    } = Ve;
                    let it = Qe, rt = st;
                    switch (Le.inputType) {
                      case "deleteWordBackward": {
                        const ct = Je.substring(0, Qe).match(/\w*[^\w]*$/);
                        ct && (it -= ct[0].length);
                        break;
                      }
                      case "deleteWordForward": {
                        const ct = Je.substring(Qe).match(/^[^\w]*\w*/);
                        ct && (rt += ct[0].length);
                        break;
                      }
                      case "deleteContentBackward":
                        Qe === st && (it -= 1);
                        break;
                      case "deleteContentForward":
                        Qe === st && (rt += 1);
                        break;
                    }
                    Le.preventDefault(), (lt = this.linkService.eventBus) == null || lt.dispatch("dispatcheventinsandbox", {
                      source: this,
                      detail: {
                        id: u,
                        name: "Keystroke",
                        value: Je,
                        change: Ue || "",
                        willCommit: !1,
                        selStart: it,
                        selEnd: rt
                      }
                    });
                  }), this._setEventListeners(L, Re, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (Le) => Le.target.value);
                }
                if (qe && L.addEventListener("blur", qe), this.data.comb) {
                  const Le = (this.data.rect[2] - this.data.rect[0]) / ye;
                  L.classList.add("comb"), L.style.letterSpacing = `calc(${Le}px * var(--scale-factor) - 1ch)`;
                }
              } else
                L = document.createElement("div"), L.textContent = this.data.fieldValue, L.style.verticalAlign = "middle", L.style.display = "table-cell";
              return this._setTextStyle(L), this._setBackgroundColor(L), this._setDefaultPropertiesFromJS(L), this.container.append(L), this.container;
            }
          }
          class x extends k {
            constructor(U) {
              super(U, {
                isRenderable: !!U.data.hasOwnCanvas
              });
            }
          }
          class y extends k {
            constructor(U) {
              super(U, {
                isRenderable: U.renderForms
              });
            }
            render() {
              const U = this.annotationStorage, u = this.data, L = u.id;
              let j = U.getValue(L, {
                value: u.exportValue === u.fieldValue
              }).value;
              typeof j == "string" && (j = j !== "Off", U.setValue(L, {
                value: j
              })), this.container.classList.add("buttonWidgetAnnotation", "checkBox");
              const V = document.createElement("input");
              return T.add(V), V.setAttribute("data-element-id", L), V.disabled = u.readOnly, this._setRequired(V, this.data.required), V.type = "checkbox", V.name = u.fieldName, j && V.setAttribute("checked", !0), V.setAttribute("exportValue", u.exportValue), V.tabIndex = o, V.addEventListener("change", (Q) => {
                const {
                  name: he,
                  checked: ye
                } = Q.target;
                for (const Me of this._getElementsByName(he, L)) {
                  const Re = ye && Me.exportValue === u.exportValue;
                  Me.domElement && (Me.domElement.checked = Re), U.setValue(Me.id, {
                    value: Re
                  });
                }
                U.setValue(L, {
                  value: ye
                });
              }), V.addEventListener("resetform", (Q) => {
                const he = u.defaultFieldValue || "Off";
                Q.target.checked = he === u.exportValue;
              }), this.enableScripting && this.hasJSActions && (V.addEventListener("updatefromsandbox", (Q) => {
                const he = {
                  value(ye) {
                    ye.target.checked = ye.detail.value !== "Off", U.setValue(L, {
                      value: ye.target.checked
                    });
                  }
                };
                this._dispatchEventFromSandbox(he, Q);
              }), this._setEventListeners(V, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (Q) => Q.target.checked)), this._setBackgroundColor(V), this._setDefaultPropertiesFromJS(V), this.container.append(V), this.container;
            }
          }
          class p extends k {
            constructor(U) {
              super(U, {
                isRenderable: U.renderForms
              });
            }
            render() {
              this.container.classList.add("buttonWidgetAnnotation", "radioButton");
              const U = this.annotationStorage, u = this.data, L = u.id;
              let j = U.getValue(L, {
                value: u.fieldValue === u.buttonValue
              }).value;
              typeof j == "string" && (j = j !== u.buttonValue, U.setValue(L, {
                value: j
              }));
              const V = document.createElement("input");
              if (T.add(V), V.setAttribute("data-element-id", L), V.disabled = u.readOnly, this._setRequired(V, this.data.required), V.type = "radio", V.name = u.fieldName, j && V.setAttribute("checked", !0), V.tabIndex = o, V.addEventListener("change", (Q) => {
                const {
                  name: he,
                  checked: ye
                } = Q.target;
                for (const Me of this._getElementsByName(he, L))
                  U.setValue(Me.id, {
                    value: !1
                  });
                U.setValue(L, {
                  value: ye
                });
              }), V.addEventListener("resetform", (Q) => {
                const he = u.defaultFieldValue;
                Q.target.checked = he != null && he === u.buttonValue;
              }), this.enableScripting && this.hasJSActions) {
                const Q = u.buttonValue;
                V.addEventListener("updatefromsandbox", (he) => {
                  const ye = {
                    value: (Me) => {
                      const Re = Q === Me.detail.value;
                      for (const qe of this._getElementsByName(Me.target.name)) {
                        const Ie = Re && qe.id === L;
                        qe.domElement && (qe.domElement.checked = Ie), U.setValue(qe.id, {
                          value: Ie
                        });
                      }
                    }
                  };
                  this._dispatchEventFromSandbox(ye, he);
                }), this._setEventListeners(V, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (he) => he.target.checked);
              }
              return this._setBackgroundColor(V), this._setDefaultPropertiesFromJS(V), this.container.append(V), this.container;
            }
          }
          class E extends P {
            constructor(U) {
              super(U, {
                ignoreBorder: U.data.hasAppearance
              });
            }
            render() {
              const U = super.render();
              U.classList.add("buttonWidgetAnnotation", "pushButton"), this.data.alternativeText && (U.title = this.data.alternativeText);
              const u = U.lastChild;
              return this.enableScripting && this.hasJSActions && u && (this._setDefaultPropertiesFromJS(u), u.addEventListener("updatefromsandbox", (L) => {
                this._dispatchEventFromSandbox({}, L);
              })), U;
            }
          }
          class $ extends k {
            constructor(U) {
              super(U, {
                isRenderable: U.renderForms
              });
            }
            render() {
              this.container.classList.add("choiceWidgetAnnotation");
              const U = this.annotationStorage, u = this.data.id, L = U.getValue(u, {
                value: this.data.fieldValue
              }), j = document.createElement("select");
              T.add(j), j.setAttribute("data-element-id", u), j.disabled = this.data.readOnly, this._setRequired(j, this.data.required), j.name = this.data.fieldName, j.tabIndex = o;
              let V = this.data.combo && this.data.options.length > 0;
              this.data.combo || (j.size = this.data.options.length, this.data.multiSelect && (j.multiple = !0)), j.addEventListener("resetform", (Re) => {
                const qe = this.data.defaultFieldValue;
                for (const Ie of j.options)
                  Ie.selected = Ie.value === qe;
              });
              for (const Re of this.data.options) {
                const qe = document.createElement("option");
                qe.textContent = Re.displayValue, qe.value = Re.exportValue, L.value.includes(Re.exportValue) && (qe.setAttribute("selected", !0), V = !1), j.append(qe);
              }
              let Q = null;
              if (V) {
                const Re = document.createElement("option");
                Re.value = " ", Re.setAttribute("hidden", !0), Re.setAttribute("selected", !0), j.prepend(Re), Q = () => {
                  Re.remove(), j.removeEventListener("input", Q), Q = null;
                }, j.addEventListener("input", Q);
              }
              const he = (Re) => {
                const qe = Re ? "value" : "textContent", {
                  options: Ie,
                  multiple: Le
                } = j;
                return Le ? Array.prototype.filter.call(Ie, (Ue) => Ue.selected).map((Ue) => Ue[qe]) : Ie.selectedIndex === -1 ? null : Ie[Ie.selectedIndex][qe];
              };
              let ye = he(!1);
              const Me = (Re) => {
                const qe = Re.target.options;
                return Array.prototype.map.call(qe, (Ie) => ({
                  displayValue: Ie.textContent,
                  exportValue: Ie.value
                }));
              };
              return this.enableScripting && this.hasJSActions ? (j.addEventListener("updatefromsandbox", (Re) => {
                const qe = {
                  value(Ie) {
                    Q == null || Q();
                    const Le = Ie.detail.value, Ue = new Set(Array.isArray(Le) ? Le : [Le]);
                    for (const Ve of j.options)
                      Ve.selected = Ue.has(Ve.value);
                    U.setValue(u, {
                      value: he(!0)
                    }), ye = he(!1);
                  },
                  multipleSelection(Ie) {
                    j.multiple = !0;
                  },
                  remove(Ie) {
                    const Le = j.options, Ue = Ie.detail.remove;
                    Le[Ue].selected = !1, j.remove(Ue), Le.length > 0 && Array.prototype.findIndex.call(Le, (Je) => Je.selected) === -1 && (Le[0].selected = !0), U.setValue(u, {
                      value: he(!0),
                      items: Me(Ie)
                    }), ye = he(!1);
                  },
                  clear(Ie) {
                    for (; j.length !== 0; )
                      j.remove(0);
                    U.setValue(u, {
                      value: null,
                      items: []
                    }), ye = he(!1);
                  },
                  insert(Ie) {
                    const {
                      index: Le,
                      displayValue: Ue,
                      exportValue: Ve
                    } = Ie.detail.insert, Je = j.children[Le], Qe = document.createElement("option");
                    Qe.textContent = Ue, Qe.value = Ve, Je ? Je.before(Qe) : j.append(Qe), U.setValue(u, {
                      value: he(!0),
                      items: Me(Ie)
                    }), ye = he(!1);
                  },
                  items(Ie) {
                    const {
                      items: Le
                    } = Ie.detail;
                    for (; j.length !== 0; )
                      j.remove(0);
                    for (const Ue of Le) {
                      const {
                        displayValue: Ve,
                        exportValue: Je
                      } = Ue, Qe = document.createElement("option");
                      Qe.textContent = Ve, Qe.value = Je, j.append(Qe);
                    }
                    j.options.length > 0 && (j.options[0].selected = !0), U.setValue(u, {
                      value: he(!0),
                      items: Me(Ie)
                    }), ye = he(!1);
                  },
                  indices(Ie) {
                    const Le = new Set(Ie.detail.indices);
                    for (const Ue of Ie.target.options)
                      Ue.selected = Le.has(Ue.index);
                    U.setValue(u, {
                      value: he(!0)
                    }), ye = he(!1);
                  },
                  editable(Ie) {
                    Ie.target.disabled = !Ie.detail.editable;
                  }
                };
                this._dispatchEventFromSandbox(qe, Re);
              }), j.addEventListener("input", (Re) => {
                var Ie;
                const qe = he(!0);
                U.setValue(u, {
                  value: qe
                }), Re.preventDefault(), (Ie = this.linkService.eventBus) == null || Ie.dispatch("dispatcheventinsandbox", {
                  source: this,
                  detail: {
                    id: u,
                    name: "Keystroke",
                    value: ye,
                    changeEx: qe,
                    willCommit: !1,
                    commitKey: 1,
                    keyDown: !1
                  }
                });
              }), this._setEventListeners(j, null, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"], ["input", "Action"], ["input", "Validate"]], (Re) => Re.target.value)) : j.addEventListener("input", function(Re) {
                U.setValue(u, {
                  value: he(!0)
                });
              }), this.data.combo && this._setTextStyle(j), this._setBackgroundColor(j), this._setDefaultPropertiesFromJS(j), this.container.append(j), this.container;
            }
          }
          class M extends C {
            constructor(U) {
              const {
                data: u,
                elements: L
              } = U;
              super(U, {
                isRenderable: C._hasPopupData(u)
              }), this.elements = L;
            }
            render() {
              this.container.classList.add("popupAnnotation");
              const U = new m({
                container: this.container,
                color: this.data.color,
                titleObj: this.data.titleObj,
                modificationDate: this.data.modificationDate,
                contentsObj: this.data.contentsObj,
                richText: this.data.richText,
                rect: this.data.rect,
                parentRect: this.data.parentRect || null,
                parent: this.parent,
                elements: this.elements,
                open: this.data.open
              }), u = [];
              for (const L of this.elements)
                L.popup = U, u.push(L.data.id), L.addHighlightArea();
              return this.container.setAttribute("aria-controls", u.map((L) => `${n.AnnotationPrefix}${L}`).join(",")), this.container;
            }
          }
          class m {
            constructor({
              container: U,
              color: u,
              elements: L,
              titleObj: j,
              modificationDate: V,
              contentsObj: Q,
              richText: he,
              parent: ye,
              rect: Me,
              parentRect: Re,
              open: qe
            }) {
              W(this, He);
              W(this, je);
              W(this, Xe);
              W(this, Ye);
              W(this, z, null);
              W(this, ae, K(this, He, $n).bind(this));
              W(this, Z, K(this, Ye, cn).bind(this));
              W(this, ce, K(this, Xe, ln).bind(this));
              W(this, ue, K(this, je, Mt).bind(this));
              W(this, me, null);
              W(this, fe, null);
              W(this, Pe, null);
              W(this, Fe, null);
              W(this, Ee, null);
              W(this, De, null);
              W(this, _e, !1);
              W(this, ie, null);
              W(this, se, null);
              W(this, ge, null);
              W(this, Ce, null);
              W(this, xe, !1);
              var Le;
              oe(this, fe, U), oe(this, Ce, j), oe(this, Pe, Q), oe(this, ge, he), oe(this, Ee, ye), oe(this, me, u), oe(this, se, Me), oe(this, De, Re), oe(this, Fe, L);
              const Ie = s.PDFDateString.toDateObject(V);
              Ie && oe(this, z, ye.l10n.get("annotation_date_string", {
                date: Ie.toLocaleDateString(),
                time: Ie.toLocaleTimeString()
              })), this.trigger = L.flatMap((Ue) => Ue.getElementsToTriggerPopup());
              for (const Ue of this.trigger)
                Ue.addEventListener("click", a(this, ue)), Ue.addEventListener("mouseenter", a(this, ce)), Ue.addEventListener("mouseleave", a(this, Z)), Ue.classList.add("popupTriggerArea");
              for (const Ue of L)
                (Le = Ue.container) == null || Le.addEventListener("keydown", a(this, ae));
              a(this, fe).hidden = !0, qe && K(this, je, Mt).call(this);
            }
            render() {
              if (a(this, ie))
                return;
              const {
                page: {
                  view: U
                },
                viewport: {
                  rawDims: {
                    pageWidth: u,
                    pageHeight: L,
                    pageX: j,
                    pageY: V
                  }
                }
              } = a(this, Ee), Q = oe(this, ie, document.createElement("div"));
              if (Q.className = "popup", a(this, me)) {
                const it = Q.style.outlineColor = n.Util.makeHexColor(...a(this, me));
                CSS.supports("background-color", "color-mix(in srgb, red 30%, white)") ? Q.style.backgroundColor = `color-mix(in srgb, ${it} 30%, white)` : Q.style.backgroundColor = n.Util.makeHexColor(...a(this, me).map((lt) => Math.floor(0.7 * (255 - lt) + lt)));
              }
              const he = document.createElement("span");
              he.className = "header";
              const ye = document.createElement("h1");
              if (he.append(ye), {
                dir: ye.dir,
                str: ye.textContent
              } = a(this, Ce), Q.append(he), a(this, z)) {
                const it = document.createElement("span");
                it.classList.add("popupDate"), a(this, z).then((rt) => {
                  it.textContent = rt;
                }), he.append(it);
              }
              const Me = a(this, Pe), Re = a(this, ge);
              if (Re != null && Re.str && (!(Me != null && Me.str) || Me.str === Re.str))
                c.XfaLayer.render({
                  xfaHtml: Re.html,
                  intent: "richText",
                  div: Q
                }), Q.lastChild.classList.add("richText", "popupContent");
              else {
                const it = this._formatContents(Me);
                Q.append(it);
              }
              let qe = !!a(this, De), Ie = qe ? a(this, De) : a(this, se);
              for (const it of a(this, Fe))
                if (!Ie || n.Util.intersect(it.data.rect, Ie) !== null) {
                  Ie = it.data.rect, qe = !0;
                  break;
                }
              const Le = n.Util.normalizeRect([Ie[0], U[3] - Ie[1] + U[1], Ie[2], U[3] - Ie[3] + U[1]]), Ve = qe ? Ie[2] - Ie[0] + 5 : 0, Je = Le[0] + Ve, Qe = Le[1], {
                style: st
              } = a(this, fe);
              st.left = `${100 * (Je - j) / u}%`, st.top = `${100 * (Qe - V) / L}%`, a(this, fe).append(Q);
            }
            _formatContents({
              str: U,
              dir: u
            }) {
              const L = document.createElement("p");
              L.classList.add("popupContent"), L.dir = u;
              const j = U.split(/(?:\r\n?|\n)/);
              for (let V = 0, Q = j.length; V < Q; ++V) {
                const he = j[V];
                L.append(document.createTextNode(he)), V < Q - 1 && L.append(document.createElement("br"));
              }
              return L;
            }
            forceHide() {
              oe(this, xe, this.isVisible), a(this, xe) && (a(this, fe).hidden = !0);
            }
            maybeShow() {
              a(this, xe) && (oe(this, xe, !1), a(this, fe).hidden = !1);
            }
            get isVisible() {
              return a(this, fe).hidden === !1;
            }
          }
          z = new WeakMap(), ae = new WeakMap(), Z = new WeakMap(), ce = new WeakMap(), ue = new WeakMap(), me = new WeakMap(), fe = new WeakMap(), Pe = new WeakMap(), Fe = new WeakMap(), Ee = new WeakMap(), De = new WeakMap(), _e = new WeakMap(), ie = new WeakMap(), se = new WeakMap(), ge = new WeakMap(), Ce = new WeakMap(), xe = new WeakMap(), He = new WeakSet(), $n = function(U) {
            U.altKey || U.shiftKey || U.ctrlKey || U.metaKey || (U.key === "Enter" || U.key === "Escape" && a(this, _e)) && K(this, je, Mt).call(this);
          }, je = new WeakSet(), Mt = function() {
            oe(this, _e, !a(this, _e)), a(this, _e) ? (K(this, Xe, ln).call(this), a(this, fe).addEventListener("click", a(this, ue)), a(this, fe).addEventListener("keydown", a(this, ae))) : (K(this, Ye, cn).call(this), a(this, fe).removeEventListener("click", a(this, ue)), a(this, fe).removeEventListener("keydown", a(this, ae)));
          }, Xe = new WeakSet(), ln = function() {
            a(this, ie) || this.render(), this.isVisible ? a(this, _e) && a(this, fe).classList.add("focused") : (a(this, fe).hidden = !1, a(this, fe).style.zIndex = parseInt(a(this, fe).style.zIndex) + 1e3);
          }, Ye = new WeakSet(), cn = function() {
            a(this, fe).classList.remove("focused"), !(a(this, _e) || !this.isVisible) && (a(this, fe).hidden = !0, a(this, fe).style.zIndex = parseInt(a(this, fe).style.zIndex) - 1e3);
          };
          class N extends C {
            constructor(U) {
              super(U, {
                isRenderable: !0,
                ignoreBorder: !0
              }), this.textContent = U.data.textContent, this.textPosition = U.data.textPosition, this.annotationEditorType = n.AnnotationEditorType.FREETEXT;
            }
            render() {
              if (this.container.classList.add("freeTextAnnotation"), this.textContent) {
                const U = document.createElement("div");
                U.classList.add("annotationTextContent"), U.setAttribute("role", "comment");
                for (const u of this.textContent) {
                  const L = document.createElement("span");
                  L.textContent = u, U.append(L);
                }
                this.container.append(U);
              }
              return !this.data.popupRef && this.hasPopupData && this._createPopup(), this._editOnDoubleClick(), this.container;
            }
          }
          e.FreeTextAnnotationElement = N;
          class D extends C {
            constructor(u) {
              super(u, {
                isRenderable: !0,
                ignoreBorder: !0
              });
              W(this, ne, null);
            }
            render() {
              this.container.classList.add("lineAnnotation");
              const u = this.data, {
                width: L,
                height: j
              } = S(u.rect), V = this.svgFactory.create(L, j, !0), Q = oe(this, ne, this.svgFactory.createElement("svg:line"));
              return Q.setAttribute("x1", u.rect[2] - u.lineCoordinates[0]), Q.setAttribute("y1", u.rect[3] - u.lineCoordinates[1]), Q.setAttribute("x2", u.rect[2] - u.lineCoordinates[2]), Q.setAttribute("y2", u.rect[3] - u.lineCoordinates[3]), Q.setAttribute("stroke-width", u.borderStyle.width || 1), Q.setAttribute("stroke", "transparent"), Q.setAttribute("fill", "transparent"), V.append(Q), this.container.append(V), !u.popupRef && this.hasPopupData && this._createPopup(), this.container;
            }
            getElementsToTriggerPopup() {
              return a(this, ne);
            }
            addHighlightArea() {
              this.container.classList.add("highlightArea");
            }
          }
          ne = new WeakMap();
          class X extends C {
            constructor(u) {
              super(u, {
                isRenderable: !0,
                ignoreBorder: !0
              });
              W(this, J, null);
            }
            render() {
              this.container.classList.add("squareAnnotation");
              const u = this.data, {
                width: L,
                height: j
              } = S(u.rect), V = this.svgFactory.create(L, j, !0), Q = u.borderStyle.width, he = oe(this, J, this.svgFactory.createElement("svg:rect"));
              return he.setAttribute("x", Q / 2), he.setAttribute("y", Q / 2), he.setAttribute("width", L - Q), he.setAttribute("height", j - Q), he.setAttribute("stroke-width", Q || 1), he.setAttribute("stroke", "transparent"), he.setAttribute("fill", "transparent"), V.append(he), this.container.append(V), !u.popupRef && this.hasPopupData && this._createPopup(), this.container;
            }
            getElementsToTriggerPopup() {
              return a(this, J);
            }
            addHighlightArea() {
              this.container.classList.add("highlightArea");
            }
          }
          J = new WeakMap();
          class G extends C {
            constructor(u) {
              super(u, {
                isRenderable: !0,
                ignoreBorder: !0
              });
              W(this, ve, null);
            }
            render() {
              this.container.classList.add("circleAnnotation");
              const u = this.data, {
                width: L,
                height: j
              } = S(u.rect), V = this.svgFactory.create(L, j, !0), Q = u.borderStyle.width, he = oe(this, ve, this.svgFactory.createElement("svg:ellipse"));
              return he.setAttribute("cx", L / 2), he.setAttribute("cy", j / 2), he.setAttribute("rx", L / 2 - Q / 2), he.setAttribute("ry", j / 2 - Q / 2), he.setAttribute("stroke-width", Q || 1), he.setAttribute("stroke", "transparent"), he.setAttribute("fill", "transparent"), V.append(he), this.container.append(V), !u.popupRef && this.hasPopupData && this._createPopup(), this.container;
            }
            getElementsToTriggerPopup() {
              return a(this, ve);
            }
            addHighlightArea() {
              this.container.classList.add("highlightArea");
            }
          }
          ve = new WeakMap();
          class I extends C {
            constructor(u) {
              super(u, {
                isRenderable: !0,
                ignoreBorder: !0
              });
              W(this, Se, null);
              this.containerClassName = "polylineAnnotation", this.svgElementName = "svg:polyline";
            }
            render() {
              this.container.classList.add(this.containerClassName);
              const u = this.data, {
                width: L,
                height: j
              } = S(u.rect), V = this.svgFactory.create(L, j, !0);
              let Q = [];
              for (const ye of u.vertices) {
                const Me = ye.x - u.rect[0], Re = u.rect[3] - ye.y;
                Q.push(Me + "," + Re);
              }
              Q = Q.join(" ");
              const he = oe(this, Se, this.svgFactory.createElement(this.svgElementName));
              return he.setAttribute("points", Q), he.setAttribute("stroke-width", u.borderStyle.width || 1), he.setAttribute("stroke", "transparent"), he.setAttribute("fill", "transparent"), V.append(he), this.container.append(V), !u.popupRef && this.hasPopupData && this._createPopup(), this.container;
            }
            getElementsToTriggerPopup() {
              return a(this, Se);
            }
            addHighlightArea() {
              this.container.classList.add("highlightArea");
            }
          }
          Se = new WeakMap();
          class B extends I {
            constructor(U) {
              super(U), this.containerClassName = "polygonAnnotation", this.svgElementName = "svg:polygon";
            }
          }
          class ee extends C {
            constructor(U) {
              super(U, {
                isRenderable: !0,
                ignoreBorder: !0
              });
            }
            render() {
              return this.container.classList.add("caretAnnotation"), !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container;
            }
          }
          class Y extends C {
            constructor(u) {
              super(u, {
                isRenderable: !0,
                ignoreBorder: !0
              });
              W(this, tt, []);
              this.containerClassName = "inkAnnotation", this.svgElementName = "svg:polyline", this.annotationEditorType = n.AnnotationEditorType.INK;
            }
            render() {
              this.container.classList.add(this.containerClassName);
              const u = this.data, {
                width: L,
                height: j
              } = S(u.rect), V = this.svgFactory.create(L, j, !0);
              for (const Q of u.inkLists) {
                let he = [];
                for (const Me of Q) {
                  const Re = Me.x - u.rect[0], qe = u.rect[3] - Me.y;
                  he.push(`${Re},${qe}`);
                }
                he = he.join(" ");
                const ye = this.svgFactory.createElement(this.svgElementName);
                a(this, tt).push(ye), ye.setAttribute("points", he), ye.setAttribute("stroke-width", u.borderStyle.width || 1), ye.setAttribute("stroke", "transparent"), ye.setAttribute("fill", "transparent"), !u.popupRef && this.hasPopupData && this._createPopup(), V.append(ye);
              }
              return this.container.append(V), this.container;
            }
            getElementsToTriggerPopup() {
              return a(this, tt);
            }
            addHighlightArea() {
              this.container.classList.add("highlightArea");
            }
          }
          tt = new WeakMap(), e.InkAnnotationElement = Y;
          class q extends C {
            constructor(U) {
              super(U, {
                isRenderable: !0,
                ignoreBorder: !0,
                createQuadrilaterals: !0
              });
            }
            render() {
              return !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.classList.add("highlightAnnotation"), this.container;
            }
          }
          class le extends C {
            constructor(U) {
              super(U, {
                isRenderable: !0,
                ignoreBorder: !0,
                createQuadrilaterals: !0
              });
            }
            render() {
              return !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.classList.add("underlineAnnotation"), this.container;
            }
          }
          class pe extends C {
            constructor(U) {
              super(U, {
                isRenderable: !0,
                ignoreBorder: !0,
                createQuadrilaterals: !0
              });
            }
            render() {
              return !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.classList.add("squigglyAnnotation"), this.container;
            }
          }
          class we extends C {
            constructor(U) {
              super(U, {
                isRenderable: !0,
                ignoreBorder: !0,
                createQuadrilaterals: !0
              });
            }
            render() {
              return !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.classList.add("strikeoutAnnotation"), this.container;
            }
          }
          class be extends C {
            constructor(U) {
              super(U, {
                isRenderable: !0,
                ignoreBorder: !0
              });
            }
            render() {
              return this.container.classList.add("stampAnnotation"), !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container;
            }
          }
          e.StampAnnotationElement = be;
          class R extends C {
            constructor(u) {
              var V;
              super(u, {
                isRenderable: !0
              });
              W(this, te);
              W(this, et, null);
              const {
                filename: L,
                content: j
              } = this.data.file;
              this.filename = (0, s.getFilenameFromUrl)(L, !0), this.content = j, (V = this.linkService.eventBus) == null || V.dispatch("fileattachmentannotation", {
                source: this,
                filename: L,
                content: j
              });
            }
            render() {
              this.container.classList.add("fileAttachmentAnnotation");
              const {
                container: u,
                data: L
              } = this;
              let j;
              L.hasAppearance || L.fillAlpha === 0 ? j = document.createElement("div") : (j = document.createElement("img"), j.src = `${this.imageResourcesPath}annotation-${/paperclip/i.test(L.name) ? "paperclip" : "pushpin"}.svg`, L.fillAlpha && L.fillAlpha < 1 && (j.style = `filter: opacity(${Math.round(L.fillAlpha * 100)}%);`)), j.addEventListener("dblclick", K(this, te, hn).bind(this)), oe(this, et, j);
              const {
                isMac: V
              } = n.FeatureTest.platform;
              return u.addEventListener("keydown", (Q) => {
                Q.key === "Enter" && (V ? Q.metaKey : Q.ctrlKey) && K(this, te, hn).call(this);
              }), !L.popupRef && this.hasPopupData ? this._createPopup() : j.classList.add("popupTriggerArea"), u.append(j), u;
            }
            getElementsToTriggerPopup() {
              return a(this, et);
            }
            addHighlightArea() {
              this.container.classList.add("highlightArea");
            }
          }
          et = new WeakMap(), te = new WeakSet(), hn = function() {
            var u;
            (u = this.downloadManager) == null || u.openOrDownloadData(this.container, this.content, this.filename);
          };
          class d {
            constructor({
              div: U,
              accessibilityManager: u,
              annotationCanvasMap: L,
              l10n: j,
              page: V,
              viewport: Q
            }) {
              W(this, Be);
              W(this, Ae);
              W(this, Ne, null);
              W(this, ke, null);
              W(this, $e, /* @__PURE__ */ new Map());
              this.div = U, oe(this, Ne, u), oe(this, ke, L), this.l10n = j, this.page = V, this.viewport = Q, this.zIndex = 0, this.l10n || (this.l10n = _.NullL10n);
            }
            async render(U) {
              const {
                annotations: u
              } = U, L = this.div;
              (0, s.setLayerDimensions)(L, this.viewport);
              const j = /* @__PURE__ */ new Map(), V = {
                data: null,
                layer: L,
                linkService: U.linkService,
                downloadManager: U.downloadManager,
                imageResourcesPath: U.imageResourcesPath || "",
                renderForms: U.renderForms !== !1,
                svgFactory: new s.DOMSVGFactory(),
                annotationStorage: U.annotationStorage || new l.AnnotationStorage(),
                enableScripting: U.enableScripting === !0,
                hasJSActions: U.hasJSActions,
                fieldObjects: U.fieldObjects,
                parent: this,
                elements: null
              };
              for (const Q of u) {
                if (Q.noHTML)
                  continue;
                const he = Q.annotationType === n.AnnotationType.POPUP;
                if (he) {
                  const Re = j.get(Q.id);
                  if (!Re)
                    continue;
                  V.elements = Re;
                } else {
                  const {
                    width: Re,
                    height: qe
                  } = S(Q.rect);
                  if (Re <= 0 || qe <= 0)
                    continue;
                }
                V.data = Q;
                const ye = w.create(V);
                if (!ye.isRenderable)
                  continue;
                if (!he && Q.popupRef) {
                  const Re = j.get(Q.popupRef);
                  Re ? Re.push(ye) : j.set(Q.popupRef, [ye]);
                }
                ye.annotationEditorType > 0 && a(this, $e).set(ye.data.id, ye);
                const Me = ye.render();
                Q.hidden && (Me.style.visibility = "hidden"), K(this, Be, Bn).call(this, Me, Q.id);
              }
              K(this, Ae, un).call(this), await this.l10n.translate(L);
            }
            update({
              viewport: U
            }) {
              const u = this.div;
              this.viewport = U, (0, s.setLayerDimensions)(u, {
                rotation: U.rotation
              }), K(this, Ae, un).call(this), u.hidden = !1;
            }
            getEditableAnnotations() {
              return Array.from(a(this, $e).values());
            }
            getEditableAnnotation(U) {
              return a(this, $e).get(U);
            }
          }
          Ne = new WeakMap(), ke = new WeakMap(), $e = new WeakMap(), Be = new WeakSet(), Bn = function(U, u) {
            var j;
            const L = U.firstChild || U;
            L.id = `${n.AnnotationPrefix}${u}`, this.div.append(U), (j = a(this, Ne)) == null || j.moveElementInDOM(this.div, U, L, !1);
          }, Ae = new WeakSet(), un = function() {
            if (!a(this, ke))
              return;
            const U = this.div;
            for (const [u, L] of a(this, ke)) {
              const j = U.querySelector(`[data-annotation-id="${u}"]`);
              if (!j)
                continue;
              const {
                firstChild: V
              } = j;
              V ? V.nodeName === "CANVAS" ? V.replaceWith(L) : V.before(L) : j.append(L);
            }
            a(this, ke).clear();
          }, e.AnnotationLayer = d;
        },
        /* 30 */
        /***/
        (t, e) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.ColorConverters = void 0;
          function i(l) {
            return Math.floor(Math.max(0, Math.min(1, l)) * 255).toString(16).padStart(2, "0");
          }
          function n(l) {
            return Math.max(0, Math.min(255, 255 * l));
          }
          class s {
            static CMYK_G([h, _, c, o]) {
              return ["G", 1 - Math.min(1, 0.3 * h + 0.59 * c + 0.11 * _ + o)];
            }
            static G_CMYK([h]) {
              return ["CMYK", 0, 0, 0, 1 - h];
            }
            static G_RGB([h]) {
              return ["RGB", h, h, h];
            }
            static G_rgb([h]) {
              return h = n(h), [h, h, h];
            }
            static G_HTML([h]) {
              const _ = i(h);
              return `#${_}${_}${_}`;
            }
            static RGB_G([h, _, c]) {
              return ["G", 0.3 * h + 0.59 * _ + 0.11 * c];
            }
            static RGB_rgb(h) {
              return h.map(n);
            }
            static RGB_HTML(h) {
              return `#${h.map(i).join("")}`;
            }
            static T_HTML() {
              return "#00000000";
            }
            static T_rgb() {
              return [null];
            }
            static CMYK_RGB([h, _, c, o]) {
              return ["RGB", 1 - Math.min(1, h + o), 1 - Math.min(1, c + o), 1 - Math.min(1, _ + o)];
            }
            static CMYK_rgb([h, _, c, o]) {
              return [n(1 - Math.min(1, h + o)), n(1 - Math.min(1, c + o)), n(1 - Math.min(1, _ + o))];
            }
            static CMYK_HTML(h) {
              const _ = this.CMYK_RGB(h).slice(1);
              return this.RGB_HTML(_);
            }
            static RGB_CMYK([h, _, c]) {
              const o = 1 - h, r = 1 - _, T = 1 - c, S = Math.min(o, r, T);
              return ["CMYK", o, r, T, S];
            }
          }
          e.ColorConverters = s;
        },
        /* 31 */
        /***/
        (t, e) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.NullL10n = void 0, e.getL10nFallback = n;
          const i = {
            of_pages: "of {{pagesCount}}",
            page_of_pages: "({{pageNumber}} of {{pagesCount}})",
            document_properties_kb: "{{size_kb}} KB ({{size_b}} bytes)",
            document_properties_mb: "{{size_mb}} MB ({{size_b}} bytes)",
            document_properties_date_string: "{{date}}, {{time}}",
            document_properties_page_size_unit_inches: "in",
            document_properties_page_size_unit_millimeters: "mm",
            document_properties_page_size_orientation_portrait: "portrait",
            document_properties_page_size_orientation_landscape: "landscape",
            document_properties_page_size_name_a3: "A3",
            document_properties_page_size_name_a4: "A4",
            document_properties_page_size_name_letter: "Letter",
            document_properties_page_size_name_legal: "Legal",
            document_properties_page_size_dimension_string: "{{width}} × {{height}} {{unit}} ({{orientation}})",
            document_properties_page_size_dimension_name_string: "{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",
            document_properties_linearized_yes: "Yes",
            document_properties_linearized_no: "No",
            additional_layers: "Additional Layers",
            page_landmark: "Page {{page}}",
            thumb_page_title: "Page {{page}}",
            thumb_page_canvas: "Thumbnail of Page {{page}}",
            find_reached_top: "Reached top of document, continued from bottom",
            find_reached_bottom: "Reached end of document, continued from top",
            "find_match_count[one]": "{{current}} of {{total}} match",
            "find_match_count[other]": "{{current}} of {{total}} matches",
            "find_match_count_limit[one]": "More than {{limit}} match",
            "find_match_count_limit[other]": "More than {{limit}} matches",
            find_not_found: "Phrase not found",
            page_scale_width: "Page Width",
            page_scale_fit: "Page Fit",
            page_scale_auto: "Automatic Zoom",
            page_scale_actual: "Actual Size",
            page_scale_percent: "{{scale}}%",
            loading_error: "An error occurred while loading the PDF.",
            invalid_file_error: "Invalid or corrupted PDF file.",
            missing_file_error: "Missing PDF file.",
            unexpected_response_error: "Unexpected server response.",
            rendering_error: "An error occurred while rendering the page.",
            annotation_date_string: "{{date}}, {{time}}",
            printing_not_supported: "Warning: Printing is not fully supported by this browser.",
            printing_not_ready: "Warning: The PDF is not fully loaded for printing.",
            web_fonts_disabled: "Web fonts are disabled: unable to use embedded PDF fonts.",
            free_text2_default_content: "Start typing…",
            editor_free_text2_aria_label: "Text Editor",
            editor_ink2_aria_label: "Draw Editor",
            editor_ink_canvas_aria_label: "User-created image",
            editor_alt_text_button_label: "Alt text",
            editor_alt_text_edit_button_label: "Edit alt text",
            editor_alt_text_decorative_tooltip: "Marked as decorative"
          };
          i.print_progress_percent = "{{progress}}%";
          function n(h, _) {
            switch (h) {
              case "find_match_count":
                h = `find_match_count[${_.total === 1 ? "one" : "other"}]`;
                break;
              case "find_match_count_limit":
                h = `find_match_count_limit[${_.limit === 1 ? "one" : "other"}]`;
                break;
            }
            return i[h] || "";
          }
          function s(h, _) {
            return _ ? h.replaceAll(/\{\{\s*(\w+)\s*\}\}/g, (c, o) => o in _ ? _[o] : "{{" + o + "}}") : h;
          }
          const l = {
            async getLanguage() {
              return "en-us";
            },
            async getDirection() {
              return "ltr";
            },
            async get(h, _ = null, c = n(h, _)) {
              return s(c, _);
            },
            async translate(h) {
            }
          };
          e.NullL10n = l;
        },
        /* 32 */
        /***/
        (t, e, i) => {
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.XfaLayer = void 0;
          var n = i(25);
          class s {
            static setupStorage(h, _, c, o, r) {
              const T = o.getValue(_, {
                value: null
              });
              switch (c.name) {
                case "textarea":
                  if (T.value !== null && (h.textContent = T.value), r === "print")
                    break;
                  h.addEventListener("input", (S) => {
                    o.setValue(_, {
                      value: S.target.value
                    });
                  });
                  break;
                case "input":
                  if (c.attributes.type === "radio" || c.attributes.type === "checkbox") {
                    if (T.value === c.attributes.xfaOn ? h.setAttribute("checked", !0) : T.value === c.attributes.xfaOff && h.removeAttribute("checked"), r === "print")
                      break;
                    h.addEventListener("change", (S) => {
                      o.setValue(_, {
                        value: S.target.checked ? S.target.getAttribute("xfaOn") : S.target.getAttribute("xfaOff")
                      });
                    });
                  } else {
                    if (T.value !== null && h.setAttribute("value", T.value), r === "print")
                      break;
                    h.addEventListener("input", (S) => {
                      o.setValue(_, {
                        value: S.target.value
                      });
                    });
                  }
                  break;
                case "select":
                  if (T.value !== null) {
                    h.setAttribute("value", T.value);
                    for (const S of c.children)
                      S.attributes.value === T.value ? S.attributes.selected = !0 : S.attributes.hasOwnProperty("selected") && delete S.attributes.selected;
                  }
                  h.addEventListener("input", (S) => {
                    const w = S.target.options, C = w.selectedIndex === -1 ? "" : w[w.selectedIndex].value;
                    o.setValue(_, {
                      value: C
                    });
                  });
                  break;
              }
            }
            static setAttributes({
              html: h,
              element: _,
              storage: c = null,
              intent: o,
              linkService: r
            }) {
              const {
                attributes: T
              } = _, S = h instanceof HTMLAnchorElement;
              T.type === "radio" && (T.name = `${T.name}-${o}`);
              for (const [w, C] of Object.entries(T))
                if (C != null)
                  switch (w) {
                    case "class":
                      C.length && h.setAttribute(w, C.join(" "));
                      break;
                    case "dataId":
                      break;
                    case "id":
                      h.setAttribute("data-element-id", C);
                      break;
                    case "style":
                      Object.assign(h.style, C);
                      break;
                    case "textContent":
                      h.textContent = C;
                      break;
                    default:
                      (!S || w !== "href" && w !== "newWindow") && h.setAttribute(w, C);
                  }
              S && r.addLinkAttributes(h, T.href, T.newWindow), c && T.dataId && this.setupStorage(h, T.dataId, _, c);
            }
            static render(h) {
              var P;
              const _ = h.annotationStorage, c = h.linkService, o = h.xfaHtml, r = h.intent || "display", T = document.createElement(o.name);
              o.attributes && this.setAttributes({
                html: T,
                element: o,
                intent: r,
                linkService: c
              });
              const S = [[o, -1, T]], w = h.div;
              if (w.append(T), h.viewport) {
                const b = `matrix(${h.viewport.transform.join(",")})`;
                w.style.transform = b;
              }
              r !== "richText" && w.setAttribute("class", "xfaLayer xfaFont");
              const C = [];
              for (; S.length > 0; ) {
                const [b, k, F] = S.at(-1);
                if (k + 1 === b.children.length) {
                  S.pop();
                  continue;
                }
                const x = b.children[++S.at(-1)[1]];
                if (x === null)
                  continue;
                const {
                  name: y
                } = x;
                if (y === "#text") {
                  const E = document.createTextNode(x.value);
                  C.push(E), F.append(E);
                  continue;
                }
                const p = (P = x == null ? void 0 : x.attributes) != null && P.xmlns ? document.createElementNS(x.attributes.xmlns, y) : document.createElement(y);
                if (F.append(p), x.attributes && this.setAttributes({
                  html: p,
                  element: x,
                  storage: _,
                  intent: r,
                  linkService: c
                }), x.children && x.children.length > 0)
                  S.push([x, -1, p]);
                else if (x.value) {
                  const E = document.createTextNode(x.value);
                  n.XfaText.shouldBuildText(y) && C.push(E), p.append(E);
                }
              }
              for (const b of w.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))
                b.setAttribute("readOnly", !0);
              return {
                textDivs: C
              };
            }
            static update(h) {
              const _ = `matrix(${h.viewport.transform.join(",")})`;
              h.div.style.transform = _, h.div.hidden = !1;
            }
          }
          e.XfaLayer = s;
        },
        /* 33 */
        /***/
        (t, e, i) => {
          var o, r, T, S, w, C, P, b, k, F, x, y, p, E, $, Hn, m, Un, D, jn, G, Gn, B, dn, Y, Wn, le, pn, we, qn, R, zn, g, Xn, v, Vn, O, Yn, z, ot, Z, gn, ue, Ft, fe, It, Fe, pt, De, _n, ie, Lt, ge, Kn, xe, mn, We, Jn, ze, Zn, Ge, bn, de, Dt, J, gt;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.InkEditor = void 0;
          var n = i(1), s = i(4), l = i(29), h = i(6), _ = i(5);
          const Se = class Se extends s.AnnotationEditor {
            constructor(te) {
              super({
                ...te,
                name: "inkEditor"
              });
              W(this, $);
              W(this, m);
              W(this, D);
              W(this, G);
              W(this, B);
              W(this, Y);
              W(this, le);
              W(this, we);
              W(this, R);
              W(this, g);
              W(this, v);
              W(this, O);
              W(this, z);
              W(this, Z);
              W(this, ue);
              W(this, fe);
              W(this, Fe);
              W(this, De);
              W(this, ie);
              W(this, ze);
              W(this, Ge);
              W(this, de);
              W(this, J);
              W(this, o, 0);
              W(this, r, 0);
              W(this, T, this.canvasPointermove.bind(this));
              W(this, S, this.canvasPointerleave.bind(this));
              W(this, w, this.canvasPointerup.bind(this));
              W(this, C, this.canvasPointerdown.bind(this));
              W(this, P, new Path2D());
              W(this, b, !1);
              W(this, k, !1);
              W(this, F, !1);
              W(this, x, null);
              W(this, y, 0);
              W(this, p, 0);
              W(this, E, null);
              this.color = te.color || null, this.thickness = te.thickness || null, this.opacity = te.opacity || null, this.paths = [], this.bezierPath2D = [], this.allRawPaths = [], this.currentPath = [], this.scaleFactor = 1, this.translationX = this.translationY = 0, this.x = 0, this.y = 0, this._willKeepAspectRatio = !0;
            }
            static initialize(te) {
              s.AnnotationEditor.initialize(te, {
                strings: ["editor_ink_canvas_aria_label", "editor_ink2_aria_label"]
              });
            }
            static updateDefaultParams(te, Te) {
              switch (te) {
                case n.AnnotationEditorParamsType.INK_THICKNESS:
                  Se._defaultThickness = Te;
                  break;
                case n.AnnotationEditorParamsType.INK_COLOR:
                  Se._defaultColor = Te;
                  break;
                case n.AnnotationEditorParamsType.INK_OPACITY:
                  Se._defaultOpacity = Te / 100;
                  break;
              }
            }
            updateParams(te, Te) {
              switch (te) {
                case n.AnnotationEditorParamsType.INK_THICKNESS:
                  K(this, $, Hn).call(this, Te);
                  break;
                case n.AnnotationEditorParamsType.INK_COLOR:
                  K(this, m, Un).call(this, Te);
                  break;
                case n.AnnotationEditorParamsType.INK_OPACITY:
                  K(this, D, jn).call(this, Te);
                  break;
              }
            }
            static get defaultPropertiesToUpdate() {
              return [[n.AnnotationEditorParamsType.INK_THICKNESS, Se._defaultThickness], [n.AnnotationEditorParamsType.INK_COLOR, Se._defaultColor || s.AnnotationEditor._defaultLineColor], [n.AnnotationEditorParamsType.INK_OPACITY, Math.round(Se._defaultOpacity * 100)]];
            }
            get propertiesToUpdate() {
              return [[n.AnnotationEditorParamsType.INK_THICKNESS, this.thickness || Se._defaultThickness], [n.AnnotationEditorParamsType.INK_COLOR, this.color || Se._defaultColor || s.AnnotationEditor._defaultLineColor], [n.AnnotationEditorParamsType.INK_OPACITY, Math.round(100 * (this.opacity ?? Se._defaultOpacity))]];
            }
            rebuild() {
              this.parent && (super.rebuild(), this.div !== null && (this.canvas || (K(this, ue, Ft).call(this), K(this, fe, It).call(this)), this.isAttachedToDOM || (this.parent.add(this), K(this, Fe, pt).call(this)), K(this, J, gt).call(this)));
            }
            remove() {
              this.canvas !== null && (this.isEmpty() || this.commit(), this.canvas.width = this.canvas.height = 0, this.canvas.remove(), this.canvas = null, a(this, x).disconnect(), oe(this, x, null), super.remove());
            }
            setParent(te) {
              !this.parent && te ? this._uiManager.removeShouldRescale(this) : this.parent && te === null && this._uiManager.addShouldRescale(this), super.setParent(te);
            }
            onScaleChanging() {
              const [te, Te] = this.parentDimensions, Ne = this.width * te, ke = this.height * Te;
              this.setDimensions(Ne, ke);
            }
            enableEditMode() {
              a(this, b) || this.canvas === null || (super.enableEditMode(), this._isDraggable = !1, this.canvas.addEventListener("pointerdown", a(this, C)));
            }
            disableEditMode() {
              !this.isInEditMode() || this.canvas === null || (super.disableEditMode(), this._isDraggable = !this.isEmpty(), this.div.classList.remove("editing"), this.canvas.removeEventListener("pointerdown", a(this, C)));
            }
            onceAdded() {
              this._isDraggable = !this.isEmpty();
            }
            isEmpty() {
              return this.paths.length === 0 || this.paths.length === 1 && this.paths[0].length === 0;
            }
            commit() {
              a(this, b) || (super.commit(), this.isEditing = !1, this.disableEditMode(), this.setInForeground(), oe(this, b, !0), this.div.classList.add("disabled"), K(this, J, gt).call(this, !0), this.makeResizable(), this.parent.addInkEditorIfNeeded(!0), this.moveInDOM(), this.div.focus({
                preventScroll: !0
              }));
            }
            focusin(te) {
              this._focusEventsAllowed && (super.focusin(te), this.enableEditMode());
            }
            canvasPointerdown(te) {
              te.button !== 0 || !this.isInEditMode() || a(this, b) || (this.setInForeground(), te.preventDefault(), te.type !== "mouse" && this.div.focus(), K(this, Y, Wn).call(this, te.offsetX, te.offsetY));
            }
            canvasPointermove(te) {
              te.preventDefault(), K(this, le, pn).call(this, te.offsetX, te.offsetY);
            }
            canvasPointerup(te) {
              te.preventDefault(), K(this, Z, gn).call(this, te);
            }
            canvasPointerleave(te) {
              K(this, Z, gn).call(this, te);
            }
            get isResizable() {
              return !this.isEmpty() && a(this, b);
            }
            render() {
              if (this.div)
                return this.div;
              let te, Te;
              this.width && (te = this.x, Te = this.y), super.render(), s.AnnotationEditor._l10nPromise.get("editor_ink2_aria_label").then((Ze) => {
                var Ae;
                return (Ae = this.div) == null ? void 0 : Ae.setAttribute("aria-label", Ze);
              });
              const [Ne, ke, $e, Be] = K(this, G, Gn).call(this);
              if (this.setAt(Ne, ke, 0, 0), this.setDims($e, Be), K(this, ue, Ft).call(this), this.width) {
                const [Ze, Ae] = this.parentDimensions;
                this.setAspectRatio(this.width * Ze, this.height * Ae), this.setAt(te * Ze, Te * Ae, this.width * Ze, this.height * Ae), oe(this, F, !0), K(this, Fe, pt).call(this), this.setDims(this.width * Ze, this.height * Ae), K(this, z, ot).call(this), this.div.classList.add("disabled");
              } else
                this.div.classList.add("editing"), this.enableEditMode();
              return K(this, fe, It).call(this), this.div;
            }
            setDimensions(te, Te) {
              const Ne = Math.round(te), ke = Math.round(Te);
              if (a(this, y) === Ne && a(this, p) === ke)
                return;
              oe(this, y, Ne), oe(this, p, ke), this.canvas.style.visibility = "hidden";
              const [$e, Be] = this.parentDimensions;
              this.width = te / $e, this.height = Te / Be, this.fixAndSetPosition(), a(this, b) && K(this, De, _n).call(this, te, Te), K(this, Fe, pt).call(this), K(this, z, ot).call(this), this.canvas.style.visibility = "visible", this.fixDims();
            }
            static deserialize(te, Te, Ne) {
              var V, Q, he;
              if (te instanceof l.InkAnnotationElement)
                return null;
              const ke = super.deserialize(te, Te, Ne);
              ke.thickness = te.thickness, ke.color = n.Util.makeHexColor(...te.color), ke.opacity = te.opacity;
              const [$e, Be] = ke.pageDimensions, Ze = ke.width * $e, Ae = ke.height * Be, Ke = ke.parentScale, Oe = te.thickness / 2;
              oe(ke, b, !0), oe(ke, y, Math.round(Ze)), oe(ke, p, Math.round(Ae));
              const {
                paths: U,
                rect: u,
                rotation: L
              } = te;
              for (let {
                bezier: ye
              } of U) {
                ye = K(V = Se, We, Jn).call(V, ye, u, L);
                const Me = [];
                ke.paths.push(Me);
                let Re = Ke * (ye[0] - Oe), qe = Ke * (ye[1] - Oe);
                for (let Le = 2, Ue = ye.length; Le < Ue; Le += 6) {
                  const Ve = Ke * (ye[Le] - Oe), Je = Ke * (ye[Le + 1] - Oe), Qe = Ke * (ye[Le + 2] - Oe), st = Ke * (ye[Le + 3] - Oe), it = Ke * (ye[Le + 4] - Oe), rt = Ke * (ye[Le + 5] - Oe);
                  Me.push([[Re, qe], [Ve, Je], [Qe, st], [it, rt]]), Re = it, qe = rt;
                }
                const Ie = K(this, ge, Kn).call(this, Me);
                ke.bezierPath2D.push(Ie);
              }
              const j = K(Q = ke, Ge, bn).call(Q);
              return oe(ke, r, Math.max(s.AnnotationEditor.MIN_SIZE, j[2] - j[0])), oe(ke, o, Math.max(s.AnnotationEditor.MIN_SIZE, j[3] - j[1])), K(he = ke, De, _n).call(he, Ze, Ae), ke;
            }
            serialize() {
              if (this.isEmpty())
                return null;
              const te = this.getRect(0, 0), Te = s.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);
              return {
                annotationType: n.AnnotationEditorType.INK,
                color: Te,
                thickness: this.thickness,
                opacity: this.opacity,
                paths: K(this, ze, Zn).call(this, this.scaleFactor / this.parentScale, this.translationX, this.translationY, te),
                pageIndex: this.pageIndex,
                rect: te,
                rotation: this.rotation,
                structTreeParentId: this._structTreeParentId
              };
            }
          };
          o = new WeakMap(), r = new WeakMap(), T = new WeakMap(), S = new WeakMap(), w = new WeakMap(), C = new WeakMap(), P = new WeakMap(), b = new WeakMap(), k = new WeakMap(), F = new WeakMap(), x = new WeakMap(), y = new WeakMap(), p = new WeakMap(), E = new WeakMap(), $ = new WeakSet(), Hn = function(te) {
            const Te = this.thickness;
            this.addCommands({
              cmd: () => {
                this.thickness = te, K(this, J, gt).call(this);
              },
              undo: () => {
                this.thickness = Te, K(this, J, gt).call(this);
              },
              mustExec: !0,
              type: n.AnnotationEditorParamsType.INK_THICKNESS,
              overwriteIfSameType: !0,
              keepUndo: !0
            });
          }, m = new WeakSet(), Un = function(te) {
            const Te = this.color;
            this.addCommands({
              cmd: () => {
                this.color = te, K(this, z, ot).call(this);
              },
              undo: () => {
                this.color = Te, K(this, z, ot).call(this);
              },
              mustExec: !0,
              type: n.AnnotationEditorParamsType.INK_COLOR,
              overwriteIfSameType: !0,
              keepUndo: !0
            });
          }, D = new WeakSet(), jn = function(te) {
            te /= 100;
            const Te = this.opacity;
            this.addCommands({
              cmd: () => {
                this.opacity = te, K(this, z, ot).call(this);
              },
              undo: () => {
                this.opacity = Te, K(this, z, ot).call(this);
              },
              mustExec: !0,
              type: n.AnnotationEditorParamsType.INK_OPACITY,
              overwriteIfSameType: !0,
              keepUndo: !0
            });
          }, G = new WeakSet(), Gn = function() {
            const {
              parentRotation: te,
              parentDimensions: [Te, Ne]
            } = this;
            switch (te) {
              case 90:
                return [0, Ne, Ne, Te];
              case 180:
                return [Te, Ne, Te, Ne];
              case 270:
                return [Te, 0, Ne, Te];
              default:
                return [0, 0, Te, Ne];
            }
          }, B = new WeakSet(), dn = function() {
            const {
              ctx: te,
              color: Te,
              opacity: Ne,
              thickness: ke,
              parentScale: $e,
              scaleFactor: Be
            } = this;
            te.lineWidth = ke * $e / Be, te.lineCap = "round", te.lineJoin = "round", te.miterLimit = 10, te.strokeStyle = `${Te}${(0, _.opacityToHex)(Ne)}`;
          }, Y = new WeakSet(), Wn = function(te, Te) {
            this.canvas.addEventListener("contextmenu", h.noContextMenu), this.canvas.addEventListener("pointerleave", a(this, S)), this.canvas.addEventListener("pointermove", a(this, T)), this.canvas.addEventListener("pointerup", a(this, w)), this.canvas.removeEventListener("pointerdown", a(this, C)), this.isEditing = !0, a(this, F) || (oe(this, F, !0), K(this, Fe, pt).call(this), this.thickness || (this.thickness = Se._defaultThickness), this.color || (this.color = Se._defaultColor || s.AnnotationEditor._defaultLineColor), this.opacity ?? (this.opacity = Se._defaultOpacity)), this.currentPath.push([te, Te]), oe(this, k, !1), K(this, B, dn).call(this), oe(this, E, () => {
              K(this, g, Xn).call(this), a(this, E) && window.requestAnimationFrame(a(this, E));
            }), window.requestAnimationFrame(a(this, E));
          }, le = new WeakSet(), pn = function(te, Te) {
            const [Ne, ke] = this.currentPath.at(-1);
            if (this.currentPath.length > 1 && te === Ne && Te === ke)
              return;
            const $e = this.currentPath;
            let Be = a(this, P);
            if ($e.push([te, Te]), oe(this, k, !0), $e.length <= 2) {
              Be.moveTo(...$e[0]), Be.lineTo(te, Te);
              return;
            }
            $e.length === 3 && (oe(this, P, Be = new Path2D()), Be.moveTo(...$e[0])), K(this, v, Vn).call(this, Be, ...$e.at(-3), ...$e.at(-2), te, Te);
          }, we = new WeakSet(), qn = function() {
            if (this.currentPath.length === 0)
              return;
            const te = this.currentPath.at(-1);
            a(this, P).lineTo(...te);
          }, R = new WeakSet(), zn = function(te, Te) {
            oe(this, E, null), te = Math.min(Math.max(te, 0), this.canvas.width), Te = Math.min(Math.max(Te, 0), this.canvas.height), K(this, le, pn).call(this, te, Te), K(this, we, qn).call(this);
            let Ne;
            if (this.currentPath.length !== 1)
              Ne = K(this, O, Yn).call(this);
            else {
              const Ae = [te, Te];
              Ne = [[Ae, Ae.slice(), Ae.slice(), Ae]];
            }
            const ke = a(this, P), $e = this.currentPath;
            this.currentPath = [], oe(this, P, new Path2D());
            const Be = () => {
              this.allRawPaths.push($e), this.paths.push(Ne), this.bezierPath2D.push(ke), this.rebuild();
            }, Ze = () => {
              this.allRawPaths.pop(), this.paths.pop(), this.bezierPath2D.pop(), this.paths.length === 0 ? this.remove() : (this.canvas || (K(this, ue, Ft).call(this), K(this, fe, It).call(this)), K(this, J, gt).call(this));
            };
            this.addCommands({
              cmd: Be,
              undo: Ze,
              mustExec: !0
            });
          }, g = new WeakSet(), Xn = function() {
            if (!a(this, k))
              return;
            oe(this, k, !1);
            const te = Math.ceil(this.thickness * this.parentScale), Te = this.currentPath.slice(-3), Ne = Te.map((Be) => Be[0]), ke = Te.map((Be) => Be[1]);
            Math.min(...Ne) - te, Math.max(...Ne) + te, Math.min(...ke) - te, Math.max(...ke) + te;
            const {
              ctx: $e
            } = this;
            $e.save(), $e.clearRect(0, 0, this.canvas.width, this.canvas.height);
            for (const Be of this.bezierPath2D)
              $e.stroke(Be);
            $e.stroke(a(this, P)), $e.restore();
          }, v = new WeakSet(), Vn = function(te, Te, Ne, ke, $e, Be, Ze) {
            const Ae = (Te + ke) / 2, Ke = (Ne + $e) / 2, Oe = (ke + Be) / 2, U = ($e + Ze) / 2;
            te.bezierCurveTo(Ae + 2 * (ke - Ae) / 3, Ke + 2 * ($e - Ke) / 3, Oe + 2 * (ke - Oe) / 3, U + 2 * ($e - U) / 3, Oe, U);
          }, O = new WeakSet(), Yn = function() {
            const te = this.currentPath;
            if (te.length <= 2)
              return [[te[0], te[0], te.at(-1), te.at(-1)]];
            const Te = [];
            let Ne, [ke, $e] = te[0];
            for (Ne = 1; Ne < te.length - 2; Ne++) {
              const [u, L] = te[Ne], [j, V] = te[Ne + 1], Q = (u + j) / 2, he = (L + V) / 2, ye = [ke + 2 * (u - ke) / 3, $e + 2 * (L - $e) / 3], Me = [Q + 2 * (u - Q) / 3, he + 2 * (L - he) / 3];
              Te.push([[ke, $e], ye, Me, [Q, he]]), [ke, $e] = [Q, he];
            }
            const [Be, Ze] = te[Ne], [Ae, Ke] = te[Ne + 1], Oe = [ke + 2 * (Be - ke) / 3, $e + 2 * (Ze - $e) / 3], U = [Ae + 2 * (Be - Ae) / 3, Ke + 2 * (Ze - Ke) / 3];
            return Te.push([[ke, $e], Oe, U, [Ae, Ke]]), Te;
          }, z = new WeakSet(), ot = function() {
            if (this.isEmpty()) {
              K(this, ie, Lt).call(this);
              return;
            }
            K(this, B, dn).call(this);
            const {
              canvas: te,
              ctx: Te
            } = this;
            Te.setTransform(1, 0, 0, 1, 0, 0), Te.clearRect(0, 0, te.width, te.height), K(this, ie, Lt).call(this);
            for (const Ne of this.bezierPath2D)
              Te.stroke(Ne);
          }, Z = new WeakSet(), gn = function(te) {
            this.canvas.removeEventListener("pointerleave", a(this, S)), this.canvas.removeEventListener("pointermove", a(this, T)), this.canvas.removeEventListener("pointerup", a(this, w)), this.canvas.addEventListener("pointerdown", a(this, C)), setTimeout(() => {
              this.canvas.removeEventListener("contextmenu", h.noContextMenu);
            }, 10), K(this, R, zn).call(this, te.offsetX, te.offsetY), this.addToAnnotationStorage(), this.setInBackground();
          }, ue = new WeakSet(), Ft = function() {
            this.canvas = document.createElement("canvas"), this.canvas.width = this.canvas.height = 0, this.canvas.className = "inkEditorCanvas", s.AnnotationEditor._l10nPromise.get("editor_ink_canvas_aria_label").then((te) => {
              var Te;
              return (Te = this.canvas) == null ? void 0 : Te.setAttribute("aria-label", te);
            }), this.div.append(this.canvas), this.ctx = this.canvas.getContext("2d");
          }, fe = new WeakSet(), It = function() {
            oe(this, x, new ResizeObserver((te) => {
              const Te = te[0].contentRect;
              Te.width && Te.height && this.setDimensions(Te.width, Te.height);
            })), a(this, x).observe(this.div);
          }, Fe = new WeakSet(), pt = function() {
            if (!a(this, F))
              return;
            const [te, Te] = this.parentDimensions;
            this.canvas.width = Math.ceil(this.width * te), this.canvas.height = Math.ceil(this.height * Te), K(this, ie, Lt).call(this);
          }, De = new WeakSet(), _n = function(te, Te) {
            const Ne = K(this, de, Dt).call(this), ke = (te - Ne) / a(this, r), $e = (Te - Ne) / a(this, o);
            this.scaleFactor = Math.min(ke, $e);
          }, ie = new WeakSet(), Lt = function() {
            const te = K(this, de, Dt).call(this) / 2;
            this.ctx.setTransform(this.scaleFactor, 0, 0, this.scaleFactor, this.translationX * this.scaleFactor + te, this.translationY * this.scaleFactor + te);
          }, ge = new WeakSet(), Kn = function(te) {
            const Te = new Path2D();
            for (let Ne = 0, ke = te.length; Ne < ke; Ne++) {
              const [$e, Be, Ze, Ae] = te[Ne];
              Ne === 0 && Te.moveTo(...$e), Te.bezierCurveTo(Be[0], Be[1], Ze[0], Ze[1], Ae[0], Ae[1]);
            }
            return Te;
          }, xe = new WeakSet(), mn = function(te, Te, Ne) {
            const [ke, $e, Be, Ze] = Te;
            switch (Ne) {
              case 0:
                for (let Ae = 0, Ke = te.length; Ae < Ke; Ae += 2)
                  te[Ae] += ke, te[Ae + 1] = Ze - te[Ae + 1];
                break;
              case 90:
                for (let Ae = 0, Ke = te.length; Ae < Ke; Ae += 2) {
                  const Oe = te[Ae];
                  te[Ae] = te[Ae + 1] + ke, te[Ae + 1] = Oe + $e;
                }
                break;
              case 180:
                for (let Ae = 0, Ke = te.length; Ae < Ke; Ae += 2)
                  te[Ae] = Be - te[Ae], te[Ae + 1] += $e;
                break;
              case 270:
                for (let Ae = 0, Ke = te.length; Ae < Ke; Ae += 2) {
                  const Oe = te[Ae];
                  te[Ae] = Be - te[Ae + 1], te[Ae + 1] = Ze - Oe;
                }
                break;
              default:
                throw new Error("Invalid rotation");
            }
            return te;
          }, We = new WeakSet(), Jn = function(te, Te, Ne) {
            const [ke, $e, Be, Ze] = Te;
            switch (Ne) {
              case 0:
                for (let Ae = 0, Ke = te.length; Ae < Ke; Ae += 2)
                  te[Ae] -= ke, te[Ae + 1] = Ze - te[Ae + 1];
                break;
              case 90:
                for (let Ae = 0, Ke = te.length; Ae < Ke; Ae += 2) {
                  const Oe = te[Ae];
                  te[Ae] = te[Ae + 1] - $e, te[Ae + 1] = Oe - ke;
                }
                break;
              case 180:
                for (let Ae = 0, Ke = te.length; Ae < Ke; Ae += 2)
                  te[Ae] = Be - te[Ae], te[Ae + 1] -= $e;
                break;
              case 270:
                for (let Ae = 0, Ke = te.length; Ae < Ke; Ae += 2) {
                  const Oe = te[Ae];
                  te[Ae] = Ze - te[Ae + 1], te[Ae + 1] = Be - Oe;
                }
                break;
              default:
                throw new Error("Invalid rotation");
            }
            return te;
          }, ze = new WeakSet(), Zn = function(te, Te, Ne, ke) {
            var Ke, Oe;
            const $e = [], Be = this.thickness / 2, Ze = te * Te + Be, Ae = te * Ne + Be;
            for (const U of this.paths) {
              const u = [], L = [];
              for (let j = 0, V = U.length; j < V; j++) {
                const [Q, he, ye, Me] = U[j], Re = te * Q[0] + Ze, qe = te * Q[1] + Ae, Ie = te * he[0] + Ze, Le = te * he[1] + Ae, Ue = te * ye[0] + Ze, Ve = te * ye[1] + Ae, Je = te * Me[0] + Ze, Qe = te * Me[1] + Ae;
                j === 0 && (u.push(Re, qe), L.push(Re, qe)), u.push(Ie, Le, Ue, Ve, Je, Qe), L.push(Ie, Le), j === V - 1 && L.push(Je, Qe);
              }
              $e.push({
                bezier: K(Ke = Se, xe, mn).call(Ke, u, ke, this.rotation),
                points: K(Oe = Se, xe, mn).call(Oe, L, ke, this.rotation)
              });
            }
            return $e;
          }, Ge = new WeakSet(), bn = function() {
            let te = 1 / 0, Te = -1 / 0, Ne = 1 / 0, ke = -1 / 0;
            for (const $e of this.paths)
              for (const [Be, Ze, Ae, Ke] of $e) {
                const Oe = n.Util.bezierBoundingBox(...Be, ...Ze, ...Ae, ...Ke);
                te = Math.min(te, Oe[0]), Ne = Math.min(Ne, Oe[1]), Te = Math.max(Te, Oe[2]), ke = Math.max(ke, Oe[3]);
              }
            return [te, Ne, Te, ke];
          }, de = new WeakSet(), Dt = function() {
            return a(this, b) ? Math.ceil(this.thickness * this.parentScale) : 0;
          }, J = new WeakSet(), gt = function(te = !1) {
            if (this.isEmpty())
              return;
            if (!a(this, b)) {
              K(this, z, ot).call(this);
              return;
            }
            const Te = K(this, Ge, bn).call(this), Ne = K(this, de, Dt).call(this);
            oe(this, r, Math.max(s.AnnotationEditor.MIN_SIZE, Te[2] - Te[0])), oe(this, o, Math.max(s.AnnotationEditor.MIN_SIZE, Te[3] - Te[1]));
            const ke = Math.ceil(Ne + a(this, r) * this.scaleFactor), $e = Math.ceil(Ne + a(this, o) * this.scaleFactor), [Be, Ze] = this.parentDimensions;
            this.width = ke / Be, this.height = $e / Ze, this.setAspectRatio(ke, $e);
            const Ae = this.translationX, Ke = this.translationY;
            this.translationX = -Te[0], this.translationY = -Te[1], K(this, Fe, pt).call(this), K(this, z, ot).call(this), oe(this, y, ke), oe(this, p, $e), this.setDims(ke, $e);
            const Oe = te ? Ne / this.scaleFactor / 2 : 0;
            this.translate(Ae - this.translationX - Oe, Ke - this.translationY - Oe);
          }, W(Se, ge), W(Se, xe), W(Se, We), nt(Se, "_defaultColor", null), nt(Se, "_defaultOpacity", 1), nt(Se, "_defaultThickness", 1), nt(Se, "_type", "ink");
          let c = Se;
          e.InkEditor = c;
        },
        /* 34 */
        /***/
        (t, e, i) => {
          var c, o, r, T, S, w, C, P, b, k, F, Et, y, St, E, Ot, M, yn, N, Qn, X, ei, I, vn, ee, Nt, q, ti;
          Object.defineProperty(e, "__esModule", {
            value: !0
          }), e.StampEditor = void 0;
          var n = i(1), s = i(4), l = i(6), h = i(29);
          const pe = class pe extends s.AnnotationEditor {
            constructor(R) {
              super({
                ...R,
                name: "stampEditor"
              });
              W(this, F);
              W(this, y);
              W(this, E);
              W(this, M);
              W(this, N);
              W(this, X);
              W(this, I);
              W(this, ee);
              W(this, q);
              W(this, c, null);
              W(this, o, null);
              W(this, r, null);
              W(this, T, null);
              W(this, S, null);
              W(this, w, null);
              W(this, C, null);
              W(this, P, null);
              W(this, b, !1);
              W(this, k, !1);
              oe(this, T, R.bitmapUrl), oe(this, S, R.bitmapFile);
            }
            static initialize(R) {
              s.AnnotationEditor.initialize(R);
            }
            static get supportedTypes() {
              const R = ["apng", "avif", "bmp", "gif", "jpeg", "png", "svg+xml", "webp", "x-icon"];
              return (0, n.shadow)(this, "supportedTypes", R.map((d) => `image/${d}`));
            }
            static get supportedTypesStr() {
              return (0, n.shadow)(this, "supportedTypesStr", this.supportedTypes.join(","));
            }
            static isHandlingMimeForPasting(R) {
              return this.supportedTypes.includes(R);
            }
            static paste(R, d) {
              d.pasteEditor(n.AnnotationEditorType.STAMP, {
                bitmapFile: R.getAsFile()
              });
            }
            remove() {
              var R, d;
              a(this, o) && (oe(this, c, null), this._uiManager.imageManager.deleteId(a(this, o)), (R = a(this, w)) == null || R.remove(), oe(this, w, null), (d = a(this, C)) == null || d.disconnect(), oe(this, C, null)), super.remove();
            }
            rebuild() {
              if (!this.parent) {
                a(this, o) && K(this, E, Ot).call(this);
                return;
              }
              super.rebuild(), this.div !== null && (a(this, o) && K(this, E, Ot).call(this), this.isAttachedToDOM || this.parent.add(this));
            }
            onceAdded() {
              this._isDraggable = !0, this.div.focus();
            }
            isEmpty() {
              return !(a(this, r) || a(this, c) || a(this, T) || a(this, S));
            }
            get isResizable() {
              return !0;
            }
            render() {
              if (this.div)
                return this.div;
              let R, d;
              if (this.width && (R = this.x, d = this.y), super.render(), this.div.hidden = !0, a(this, c) ? K(this, M, yn).call(this) : K(this, E, Ot).call(this), this.width) {
                const [g, f] = this.parentDimensions;
                this.setAt(R * g, d * f, this.width * g, this.height * f);
              }
              return this.div;
            }
            static deserialize(R, d, g) {
              if (R instanceof h.StampAnnotationElement)
                return null;
              const f = super.deserialize(R, d, g), {
                rect: v,
                bitmapUrl: A,
                bitmapId: O,
                isSvg: H,
                accessibilityData: z
              } = R;
              O && g.imageManager.isValidId(O) ? oe(f, o, O) : oe(f, T, A), oe(f, b, H);
              const [ae, Z] = f.pageDimensions;
              return f.width = (v[2] - v[0]) / ae, f.height = (v[3] - v[1]) / Z, z && (f.altTextData = z), f;
            }
            serialize(R = !1, d = null) {
              if (this.isEmpty())
                return null;
              const g = {
                annotationType: n.AnnotationEditorType.STAMP,
                bitmapId: a(this, o),
                pageIndex: this.pageIndex,
                rect: this.getRect(0, 0),
                rotation: this.rotation,
                isSvg: a(this, b),
                structTreeParentId: this._structTreeParentId
              };
              if (R)
                return g.bitmapUrl = K(this, ee, Nt).call(this, !0), g.accessibilityData = this.altTextData, g;
              const {
                decorative: f,
                altText: v
              } = this.altTextData;
              if (!f && v && (g.accessibilityData = {
                type: "Figure",
                alt: v
              }), d === null)
                return g;
              d.stamps || (d.stamps = /* @__PURE__ */ new Map());
              const A = a(this, b) ? (g.rect[2] - g.rect[0]) * (g.rect[3] - g.rect[1]) : null;
              if (!d.stamps.has(a(this, o)))
                d.stamps.set(a(this, o), {
                  area: A,
                  serialized: g
                }), g.bitmap = K(this, ee, Nt).call(this, !1);
              else if (a(this, b)) {
                const O = d.stamps.get(a(this, o));
                A > O.area && (O.area = A, O.serialized.bitmap.close(), O.serialized.bitmap = K(this, ee, Nt).call(this, !1));
              }
              return g;
            }
          };
          c = new WeakMap(), o = new WeakMap(), r = new WeakMap(), T = new WeakMap(), S = new WeakMap(), w = new WeakMap(), C = new WeakMap(), P = new WeakMap(), b = new WeakMap(), k = new WeakMap(), F = new WeakSet(), Et = function(R, d = !1) {
            if (!R) {
              this.remove();
              return;
            }
            oe(this, c, R.bitmap), d || (oe(this, o, R.id), oe(this, b, R.isSvg)), K(this, M, yn).call(this);
          }, y = new WeakSet(), St = function() {
            oe(this, r, null), this._uiManager.enableWaiting(!1), a(this, w) && this.div.focus();
          }, E = new WeakSet(), Ot = function() {
            if (a(this, o)) {
              this._uiManager.enableWaiting(!0), this._uiManager.imageManager.getFromId(a(this, o)).then((d) => K(this, F, Et).call(this, d, !0)).finally(() => K(this, y, St).call(this));
              return;
            }
            if (a(this, T)) {
              const d = a(this, T);
              oe(this, T, null), this._uiManager.enableWaiting(!0), oe(this, r, this._uiManager.imageManager.getFromUrl(d).then((g) => K(this, F, Et).call(this, g)).finally(() => K(this, y, St).call(this)));
              return;
            }
            if (a(this, S)) {
              const d = a(this, S);
              oe(this, S, null), this._uiManager.enableWaiting(!0), oe(this, r, this._uiManager.imageManager.getFromFile(d).then((g) => K(this, F, Et).call(this, g)).finally(() => K(this, y, St).call(this)));
              return;
            }
            const R = document.createElement("input");
            R.type = "file", R.accept = pe.supportedTypesStr, oe(this, r, new Promise((d) => {
              R.addEventListener("change", async () => {
                if (!R.files || R.files.length === 0)
                  this.remove();
                else {
                  this._uiManager.enableWaiting(!0);
                  const g = await this._uiManager.imageManager.getFromFile(R.files[0]);
                  K(this, F, Et).call(this, g);
                }
                d();
              }), R.addEventListener("cancel", () => {
                this.remove(), d();
              });
            }).finally(() => K(this, y, St).call(this))), R.click();
          }, M = new WeakSet(), yn = function() {
            const {
              div: R
            } = this;
            let {
              width: d,
              height: g
            } = a(this, c);
            const [f, v] = this.pageDimensions, A = 0.75;
            if (this.width)
              d = this.width * f, g = this.height * v;
            else if (d > A * f || g > A * v) {
              const ae = Math.min(A * f / d, A * v / g);
              d *= ae, g *= ae;
            }
            const [O, H] = this.parentDimensions;
            this.setDims(d * O / f, g * H / v), this._uiManager.enableWaiting(!1);
            const z = oe(this, w, document.createElement("canvas"));
            R.append(z), R.hidden = !1, K(this, I, vn).call(this, d, g), K(this, q, ti).call(this), a(this, k) || (this.parent.addUndoableEditor(this), oe(this, k, !0)), this._uiManager._eventBus.dispatch("reporttelemetry", {
              source: this,
              details: {
                type: "editing",
                subtype: this.editorType,
                data: {
                  action: "inserted_image"
                }
              }
            }), this.addAltTextButton();
          }, N = new WeakSet(), Qn = function(R, d) {
            var A;
            const [g, f] = this.parentDimensions;
            this.width = R / g, this.height = d / f, this.setDims(R, d), (A = this._initialOptions) != null && A.isCentered ? this.center() : this.fixAndSetPosition(), this._initialOptions = null, a(this, P) !== null && clearTimeout(a(this, P)), oe(this, P, setTimeout(() => {
              oe(this, P, null), K(this, I, vn).call(this, R, d);
            }, 200));
          }, X = new WeakSet(), ei = function(R, d) {
            const {
              width: g,
              height: f
            } = a(this, c);
            let v = g, A = f, O = a(this, c);
            for (; v > 2 * R || A > 2 * d; ) {
              const H = v, z = A;
              v > 2 * R && (v = v >= 16384 ? Math.floor(v / 2) - 1 : Math.ceil(v / 2)), A > 2 * d && (A = A >= 16384 ? Math.floor(A / 2) - 1 : Math.ceil(A / 2));
              const ae = new OffscreenCanvas(v, A);
              ae.getContext("2d").drawImage(O, 0, 0, H, z, 0, 0, v, A), O = ae.transferToImageBitmap();
            }
            return O;
          }, I = new WeakSet(), vn = function(R, d) {
            R = Math.ceil(R), d = Math.ceil(d);
            const g = a(this, w);
            if (!g || g.width === R && g.height === d)
              return;
            g.width = R, g.height = d;
            const f = a(this, b) ? a(this, c) : K(this, X, ei).call(this, R, d), v = g.getContext("2d");
            v.filter = this._uiManager.hcmFilter, v.drawImage(f, 0, 0, f.width, f.height, 0, 0, R, d);
          }, ee = new WeakSet(), Nt = function(R) {
            if (R) {
              if (a(this, b)) {
                const f = this._uiManager.imageManager.getSvgUrl(a(this, o));
                if (f)
                  return f;
              }
              const d = document.createElement("canvas");
              return {
                width: d.width,
                height: d.height
              } = a(this, c), d.getContext("2d").drawImage(a(this, c), 0, 0), d.toDataURL();
            }
            if (a(this, b)) {
              const [d, g] = this.pageDimensions, f = Math.round(this.width * d * l.PixelsPerInch.PDF_TO_CSS_UNITS), v = Math.round(this.height * g * l.PixelsPerInch.PDF_TO_CSS_UNITS), A = new OffscreenCanvas(f, v);
              return A.getContext("2d").drawImage(a(this, c), 0, 0, a(this, c).width, a(this, c).height, 0, 0, f, v), A.transferToImageBitmap();
            }
            return structuredClone(a(this, c));
          }, q = new WeakSet(), ti = function() {
            oe(this, C, new ResizeObserver((R) => {
              const d = R[0].contentRect;
              d.width && d.height && K(this, N, Qn).call(this, d.width, d.height);
            })), a(this, C).observe(this.div);
          }, nt(pe, "_type", "stamp");
          let _ = pe;
          e.StampEditor = _;
        }
        /******/
      ], __webpack_module_cache__ = {};
      function __w_pdfjs_require__(t) {
        var e = __webpack_module_cache__[t];
        if (e !== void 0)
          return e.exports;
        var i = __webpack_module_cache__[t] = {
          /******/
          // no module.id needed
          /******/
          // no module.loaded needed
          /******/
          exports: {}
          /******/
        };
        return __webpack_modules__[t](i, i.exports, __w_pdfjs_require__), i.exports;
      }
      var __webpack_exports__ = {};
      return (() => {
        var t = __webpack_exports__;
        Object.defineProperty(t, "__esModule", {
          value: !0
        }), Object.defineProperty(t, "AbortException", {
          enumerable: !0,
          get: function() {
            return e.AbortException;
          }
        }), Object.defineProperty(t, "AnnotationEditorLayer", {
          enumerable: !0,
          get: function() {
            return l.AnnotationEditorLayer;
          }
        }), Object.defineProperty(t, "AnnotationEditorParamsType", {
          enumerable: !0,
          get: function() {
            return e.AnnotationEditorParamsType;
          }
        }), Object.defineProperty(t, "AnnotationEditorType", {
          enumerable: !0,
          get: function() {
            return e.AnnotationEditorType;
          }
        }), Object.defineProperty(t, "AnnotationEditorUIManager", {
          enumerable: !0,
          get: function() {
            return h.AnnotationEditorUIManager;
          }
        }), Object.defineProperty(t, "AnnotationLayer", {
          enumerable: !0,
          get: function() {
            return _.AnnotationLayer;
          }
        }), Object.defineProperty(t, "AnnotationMode", {
          enumerable: !0,
          get: function() {
            return e.AnnotationMode;
          }
        }), Object.defineProperty(t, "CMapCompressionType", {
          enumerable: !0,
          get: function() {
            return e.CMapCompressionType;
          }
        }), Object.defineProperty(t, "DOMSVGFactory", {
          enumerable: !0,
          get: function() {
            return n.DOMSVGFactory;
          }
        }), Object.defineProperty(t, "FeatureTest", {
          enumerable: !0,
          get: function() {
            return e.FeatureTest;
          }
        }), Object.defineProperty(t, "GlobalWorkerOptions", {
          enumerable: !0,
          get: function() {
            return c.GlobalWorkerOptions;
          }
        }), Object.defineProperty(t, "ImageKind", {
          enumerable: !0,
          get: function() {
            return e.ImageKind;
          }
        }), Object.defineProperty(t, "InvalidPDFException", {
          enumerable: !0,
          get: function() {
            return e.InvalidPDFException;
          }
        }), Object.defineProperty(t, "MissingPDFException", {
          enumerable: !0,
          get: function() {
            return e.MissingPDFException;
          }
        }), Object.defineProperty(t, "OPS", {
          enumerable: !0,
          get: function() {
            return e.OPS;
          }
        }), Object.defineProperty(t, "PDFDataRangeTransport", {
          enumerable: !0,
          get: function() {
            return i.PDFDataRangeTransport;
          }
        }), Object.defineProperty(t, "PDFDateString", {
          enumerable: !0,
          get: function() {
            return n.PDFDateString;
          }
        }), Object.defineProperty(t, "PDFWorker", {
          enumerable: !0,
          get: function() {
            return i.PDFWorker;
          }
        }), Object.defineProperty(t, "PasswordResponses", {
          enumerable: !0,
          get: function() {
            return e.PasswordResponses;
          }
        }), Object.defineProperty(t, "PermissionFlag", {
          enumerable: !0,
          get: function() {
            return e.PermissionFlag;
          }
        }), Object.defineProperty(t, "PixelsPerInch", {
          enumerable: !0,
          get: function() {
            return n.PixelsPerInch;
          }
        }), Object.defineProperty(t, "PromiseCapability", {
          enumerable: !0,
          get: function() {
            return e.PromiseCapability;
          }
        }), Object.defineProperty(t, "RenderingCancelledException", {
          enumerable: !0,
          get: function() {
            return n.RenderingCancelledException;
          }
        }), Object.defineProperty(t, "SVGGraphics", {
          enumerable: !0,
          get: function() {
            return i.SVGGraphics;
          }
        }), Object.defineProperty(t, "UnexpectedResponseException", {
          enumerable: !0,
          get: function() {
            return e.UnexpectedResponseException;
          }
        }), Object.defineProperty(t, "Util", {
          enumerable: !0,
          get: function() {
            return e.Util;
          }
        }), Object.defineProperty(t, "VerbosityLevel", {
          enumerable: !0,
          get: function() {
            return e.VerbosityLevel;
          }
        }), Object.defineProperty(t, "XfaLayer", {
          enumerable: !0,
          get: function() {
            return o.XfaLayer;
          }
        }), Object.defineProperty(t, "build", {
          enumerable: !0,
          get: function() {
            return i.build;
          }
        }), Object.defineProperty(t, "createValidAbsoluteUrl", {
          enumerable: !0,
          get: function() {
            return e.createValidAbsoluteUrl;
          }
        }), Object.defineProperty(t, "getDocument", {
          enumerable: !0,
          get: function() {
            return i.getDocument;
          }
        }), Object.defineProperty(t, "getFilenameFromUrl", {
          enumerable: !0,
          get: function() {
            return n.getFilenameFromUrl;
          }
        }), Object.defineProperty(t, "getPdfFilenameFromUrl", {
          enumerable: !0,
          get: function() {
            return n.getPdfFilenameFromUrl;
          }
        }), Object.defineProperty(t, "getXfaPageViewport", {
          enumerable: !0,
          get: function() {
            return n.getXfaPageViewport;
          }
        }), Object.defineProperty(t, "isDataScheme", {
          enumerable: !0,
          get: function() {
            return n.isDataScheme;
          }
        }), Object.defineProperty(t, "isPdfFile", {
          enumerable: !0,
          get: function() {
            return n.isPdfFile;
          }
        }), Object.defineProperty(t, "loadScript", {
          enumerable: !0,
          get: function() {
            return n.loadScript;
          }
        }), Object.defineProperty(t, "noContextMenu", {
          enumerable: !0,
          get: function() {
            return n.noContextMenu;
          }
        }), Object.defineProperty(t, "normalizeUnicode", {
          enumerable: !0,
          get: function() {
            return e.normalizeUnicode;
          }
        }), Object.defineProperty(t, "renderTextLayer", {
          enumerable: !0,
          get: function() {
            return s.renderTextLayer;
          }
        }), Object.defineProperty(t, "setLayerDimensions", {
          enumerable: !0,
          get: function() {
            return n.setLayerDimensions;
          }
        }), Object.defineProperty(t, "shadow", {
          enumerable: !0,
          get: function() {
            return e.shadow;
          }
        }), Object.defineProperty(t, "updateTextLayer", {
          enumerable: !0,
          get: function() {
            return s.updateTextLayer;
          }
        }), Object.defineProperty(t, "version", {
          enumerable: !0,
          get: function() {
            return i.version;
          }
        });
        var e = __w_pdfjs_require__(1), i = __w_pdfjs_require__(2), n = __w_pdfjs_require__(6), s = __w_pdfjs_require__(26), l = __w_pdfjs_require__(27), h = __w_pdfjs_require__(5), _ = __w_pdfjs_require__(29), c = __w_pdfjs_require__(14), o = __w_pdfjs_require__(32);
      })(), __webpack_exports__;
    })()
  ));
})(pdf);
var pdfExports = pdf.exports;
const pdfjsLib = /* @__PURE__ */ getDefaultExportFromCjs(pdfExports), Index_svelte_svelte_type_style_lang = "", {
  SvelteComponent,
  append,
  assign,
  attr,
  binding_callbacks,
  check_outros,
  create_component,
  destroy_component,
  detach,
  element,
  empty,
  get_spread_object,
  get_spread_update,
  group_outros,
  init,
  insert,
  mount_component,
  safe_not_equal,
  set_data,
  set_style,
  space,
  text,
  transition_in,
  transition_out
} = window.__gradio__svelte__internal, { tick } = window.__gradio__svelte__internal;
function create_if_block_1(t) {
  let e, i;
  const n = [
    {
      autoscroll: (
        /*gradio*/
        t[11].autoscroll
      )
    },
    { i18n: (
      /*gradio*/
      t[11].i18n
    ) },
    /*loading_status*/
    t[10]
  ];
  let s = {};
  for (let l = 0; l < n.length; l += 1)
    s = assign(s, n[l]);
  return e = new Static({ props: s }), {
    c() {
      create_component(e.$$.fragment);
    },
    m(l, h) {
      mount_component(e, l, h), i = !0;
    },
    p(l, h) {
      const _ = h & /*gradio, loading_status*/
      3072 ? get_spread_update(n, [
        h & /*gradio*/
        2048 && {
          autoscroll: (
            /*gradio*/
            l[11].autoscroll
          )
        },
        h & /*gradio*/
        2048 && { i18n: (
          /*gradio*/
          l[11].i18n
        ) },
        h & /*loading_status*/
        1024 && get_spread_object(
          /*loading_status*/
          l[10]
        )
      ]) : {};
      e.$set(_);
    },
    i(l) {
      i || (transition_in(e.$$.fragment, l), i = !0);
    },
    o(l) {
      transition_out(e.$$.fragment, l), i = !1;
    },
    d(l) {
      destroy_component(e, l);
    }
  };
}
function create_else_block(t) {
  let e, i;
  return e = new Upload({
    props: {
      filetype: "application/pdf",
      file_count: "single",
      root: (
        /*root*/
        t[7]
      ),
      $$slots: { default: [create_default_slot_3] },
      $$scope: { ctx: t }
    }
  }), e.$on(
    "load",
    /*handle_upload*/
    t[17]
  ), {
    c() {
      create_component(e.$$.fragment);
    },
    m(n, s) {
      mount_component(e, n, s), i = !0;
    },
    p(n, s) {
      const l = {};
      s & /*root*/
      128 && (l.root = /*root*/
      n[7]), s & /*$$scope*/
      134217728 && (l.$$scope = { dirty: s, ctx: n }), e.$set(l);
    },
    i(n) {
      i || (transition_in(e.$$.fragment, n), i = !0);
    },
    o(n) {
      transition_out(e.$$.fragment, n), i = !1;
    },
    d(n) {
      destroy_component(e, n);
    }
  };
}
function create_if_block(t) {
  let e, i, n, s, l, h, _, c, o, r, T, S, w, C, P;
  return e = new ModifyUpload({
    props: {
      i18n: (
        /*gradio*/
        t[11].i18n
      ),
      absolute: !0
    }
  }), e.$on(
    "clear",
    /*handle_clear*/
    t[16]
  ), _ = new Button({
    props: {
      $$slots: { default: [create_default_slot_2] },
      $$scope: { ctx: t }
    }
  }), _.$on(
    "click",
    /*prev_page*/
    t[19]
  ), C = new Button({
    props: {
      $$slots: { default: [create_default_slot_1] },
      $$scope: { ctx: t }
    }
  }), C.$on(
    "click",
    /*next_page*/
    t[18]
  ), {
    c() {
      create_component(e.$$.fragment), i = space(), n = element("div"), s = element("canvas"), l = space(), h = element("div"), create_component(_.$$.fragment), c = space(), o = element("span"), r = text(
        /*currentPage*/
        t[14]
      ), T = text(" / "), S = text(
        /*numPages*/
        t[13]
      ), w = space(), create_component(C.$$.fragment), attr(n, "class", "pdf-canvas svelte-qxsbof"), set_style(
        n,
        "height",
        /*height*/
        t[1] + "px"
      ), attr(o, "class", "page-count svelte-qxsbof"), attr(h, "class", "button-row svelte-qxsbof");
    },
    m(b, k) {
      mount_component(e, b, k), insert(b, i, k), insert(b, n, k), append(n, s), t[22](s), insert(b, l, k), insert(b, h, k), mount_component(_, h, null), append(h, c), append(h, o), append(o, r), append(o, T), append(o, S), append(h, w), mount_component(C, h, null), P = !0;
    },
    p(b, k) {
      const F = {};
      k & /*gradio*/
      2048 && (F.i18n = /*gradio*/
      b[11].i18n), e.$set(F), (!P || k & /*height*/
      2) && set_style(
        n,
        "height",
        /*height*/
        b[1] + "px"
      );
      const x = {};
      k & /*$$scope*/
      134217728 && (x.$$scope = { dirty: k, ctx: b }), _.$set(x), (!P || k & /*currentPage*/
      16384) && set_data(
        r,
        /*currentPage*/
        b[14]
      ), (!P || k & /*numPages*/
      8192) && set_data(
        S,
        /*numPages*/
        b[13]
      );
      const y = {};
      k & /*$$scope*/
      134217728 && (y.$$scope = { dirty: k, ctx: b }), C.$set(y);
    },
    i(b) {
      P || (transition_in(e.$$.fragment, b), transition_in(_.$$.fragment, b), transition_in(C.$$.fragment, b), P = !0);
    },
    o(b) {
      transition_out(e.$$.fragment, b), transition_out(_.$$.fragment, b), transition_out(C.$$.fragment, b), P = !1;
    },
    d(b) {
      b && (detach(i), detach(n), detach(l), detach(h)), destroy_component(e, b), t[22](null), destroy_component(_), destroy_component(C);
    }
  };
}
function create_default_slot_3(t) {
  let e, i;
  return e = new PdfUploadText({}), {
    c() {
      create_component(e.$$.fragment);
    },
    m(n, s) {
      mount_component(e, n, s), i = !0;
    },
    i(n) {
      i || (transition_in(e.$$.fragment, n), i = !0);
    },
    o(n) {
      transition_out(e.$$.fragment, n), i = !1;
    },
    d(n) {
      destroy_component(e, n);
    }
  };
}
function create_default_slot_2(t) {
  let e;
  return {
    c() {
      e = text("⬅️");
    },
    m(i, n) {
      insert(i, e, n);
    },
    d(i) {
      i && detach(e);
    }
  };
}
function create_default_slot_1(t) {
  let e;
  return {
    c() {
      e = text("➡️");
    },
    m(i, n) {
      insert(i, e, n);
    },
    d(i) {
      i && detach(e);
    }
  };
}
function create_default_slot(t) {
  let e, i, n, s, l, h, _, c = (
    /*loading_status*/
    t[10] && create_if_block_1(t)
  );
  i = new BlockLabel({
    props: {
      show_label: (
        /*label*/
        t[8] !== null
      ),
      Icon: File$1,
      float: (
        /*value*/
        t[0] === null
      ),
      label: (
        /*label*/
        t[8] || "File"
      )
    }
  });
  const o = [create_if_block, create_else_block], r = [];
  function T(S, w) {
    return (
      /*_value*/
      S[12] ? 0 : 1
    );
  }
  return s = T(t), l = r[s] = o[s](t), {
    c() {
      c && c.c(), e = space(), create_component(i.$$.fragment), n = space(), l.c(), h = empty();
    },
    m(S, w) {
      c && c.m(S, w), insert(S, e, w), mount_component(i, S, w), insert(S, n, w), r[s].m(S, w), insert(S, h, w), _ = !0;
    },
    p(S, w) {
      /*loading_status*/
      S[10] ? c ? (c.p(S, w), w & /*loading_status*/
      1024 && transition_in(c, 1)) : (c = create_if_block_1(S), c.c(), transition_in(c, 1), c.m(e.parentNode, e)) : c && (group_outros(), transition_out(c, 1, 1, () => {
        c = null;
      }), check_outros());
      const C = {};
      w & /*label*/
      256 && (C.show_label = /*label*/
      S[8] !== null), w & /*value*/
      1 && (C.float = /*value*/
      S[0] === null), w & /*label*/
      256 && (C.label = /*label*/
      S[8] || "File"), i.$set(C);
      let P = s;
      s = T(S), s === P ? r[s].p(S, w) : (group_outros(), transition_out(r[P], 1, 1, () => {
        r[P] = null;
      }), check_outros(), l = r[s], l ? l.p(S, w) : (l = r[s] = o[s](S), l.c()), transition_in(l, 1), l.m(h.parentNode, h));
    },
    i(S) {
      _ || (transition_in(c), transition_in(i.$$.fragment, S), transition_in(l), _ = !0);
    },
    o(S) {
      transition_out(c), transition_out(i.$$.fragment, S), transition_out(l), _ = !1;
    },
    d(S) {
      S && (detach(e), detach(n), detach(h)), c && c.d(S), destroy_component(i, S), r[s].d(S);
    }
  };
}
function create_fragment(t) {
  let e, i;
  return e = new Block({
    props: {
      visible: (
        /*visible*/
        t[4]
      ),
      elem_id: (
        /*elem_id*/
        t[2]
      ),
      elem_classes: (
        /*elem_classes*/
        t[3]
      ),
      container: (
        /*container*/
        t[5]
      ),
      scale: (
        /*scale*/
        t[6]
      ),
      min_width: (
        /*min_width*/
        t[9]
      ),
      $$slots: { default: [create_default_slot] },
      $$scope: { ctx: t }
    }
  }), {
    c() {
      create_component(e.$$.fragment);
    },
    m(n, s) {
      mount_component(e, n, s), i = !0;
    },
    p(n, [s]) {
      const l = {};
      s & /*visible*/
      16 && (l.visible = /*visible*/
      n[4]), s & /*elem_id*/
      4 && (l.elem_id = /*elem_id*/
      n[2]), s & /*elem_classes*/
      8 && (l.elem_classes = /*elem_classes*/
      n[3]), s & /*container*/
      32 && (l.container = /*container*/
      n[5]), s & /*scale*/
      64 && (l.scale = /*scale*/
      n[6]), s & /*min_width*/
      512 && (l.min_width = /*min_width*/
      n[9]), s & /*$$scope, numPages, currentPage, height, canvasRef, gradio, _value, root, label, value, loading_status*/
      134282627 && (l.$$scope = { dirty: s, ctx: n }), e.$set(l);
    },
    i(n) {
      i || (transition_in(e.$$.fragment, n), i = !0);
    },
    o(n) {
      transition_out(e.$$.fragment, n), i = !1;
    },
    d(n) {
      destroy_component(e, n);
    }
  };
}
function instance(t, e, i) {
  let { elem_id: n = "" } = e, { elem_classes: s = [] } = e, { visible: l = !0 } = e, { value: h = null } = e, { container: _ = !0 } = e, { scale: c = null } = e, { root: o } = e, { height: r = 500 } = e, { label: T } = e, { proxy_url: S } = e, { min_width: w = void 0 } = e, { loading_status: C } = e, { gradio: P } = e;
  pdfjsLib.GlobalWorkerOptions.workerSrc = "https://cdn.bootcss.com/pdf.js/3.11.174/pdf.worker.js";
  let b = h, k = b, F, x = 1, y = 1, p;
  async function E() {
    i(12, b = null), await tick(), P.dispatch("change"), i(14, y = 1);
  }
  async function $({ detail: G }) {
    i(0, h = G), await tick(), P.dispatch("change"), P.dispatch("upload"), i(14, y = 1);
  }
  async function M(G) {
    F = await pdfjsLib.getDocument(G.url).promise, i(13, x = F.numPages), m();
  }
  function m() {
    F.getPage(y).then((G) => {
      const I = p.getContext("2d");
      I.clearRect(0, 0, p.width, p.height);
      let B = G.getViewport({ scale: 1 }), ee = r / B.height;
      B = G.getViewport({ scale: ee });
      const Y = { canvasContext: I, viewport: B };
      i(15, p.width = B.width, p), i(15, p.height = B.height, p), G.render(Y);
    });
  }
  function N() {
    y >= x || (i(14, y++, y), m());
  }
  function D() {
    y != 1 && (i(14, y--, y), m());
  }
  function X(G) {
    binding_callbacks[G ? "unshift" : "push"](() => {
      p = G, i(15, p);
    });
  }
  return t.$$set = (G) => {
    "elem_id" in G && i(2, n = G.elem_id), "elem_classes" in G && i(3, s = G.elem_classes), "visible" in G && i(4, l = G.visible), "value" in G && i(0, h = G.value), "container" in G && i(5, _ = G.container), "scale" in G && i(6, c = G.scale), "root" in G && i(7, o = G.root), "height" in G && i(1, r = G.height), "label" in G && i(8, T = G.label), "proxy_url" in G && i(20, S = G.proxy_url), "min_width" in G && i(9, w = G.min_width), "loading_status" in G && i(10, C = G.loading_status), "gradio" in G && i(11, P = G.gradio);
  }, t.$$.update = () => {
    t.$$.dirty & /*height*/
    2 && i(1, r = r || 500), t.$$.dirty & /*value, root, proxy_url*/
    1048705 && i(12, b = normalise_file(h, o, S)), t.$$.dirty & /*old_value, _value, gradio*/
    2103296 && JSON.stringify(k) != JSON.stringify(b) && (b && M(b), i(21, k = b), P.dispatch("change"));
  }, [
    h,
    r,
    n,
    s,
    l,
    _,
    c,
    o,
    T,
    w,
    C,
    P,
    b,
    x,
    y,
    p,
    E,
    $,
    N,
    D,
    S,
    k,
    X
  ];
}
class Index extends SvelteComponent {
  constructor(e) {
    super(), init(this, e, instance, create_fragment, safe_not_equal, {
      elem_id: 2,
      elem_classes: 3,
      visible: 4,
      value: 0,
      container: 5,
      scale: 6,
      root: 7,
      height: 1,
      label: 8,
      proxy_url: 20,
      min_width: 9,
      loading_status: 10,
      gradio: 11
    });
  }
}
export {
  Index as I,
  require$$5$1 as r
};
