var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
import { Q as is_function, R as cubicOut, B as noop, T as subscribe, C as run_all, s as safe_not_equal, S as SvelteComponent, i as init, e as element, a as space, l as text, b as attr, n as null_to_empty, A as set_style, U as toggle_class, d as insert, f as append, z as listen, m as set_data, r as add_render_callback, v as create_bidirectional_transition, V as slide, k as detach, q as createEventDispatcher, y as empty, t as transition_in, o as group_outros, j as transition_out, p as check_outros, K as binding_callbacks, L as bind, M as create_component, N as mount_component, O as add_flush_callback, P as destroy_component, G as destroy_each, W as crossfade, X as init_binding_group, Y as create_in_transition, Z as create_out_transition, _ as update_keyed_each, $ as outro_and_destroy_block, I as onMount, x as src_url_equal, a0 as blur, a1 as fly, a2 as set_input_value, a3 as to_number, J as flush, a4 as action_destroyer, a5 as prevent_default, a6 as fix_and_outro_and_destroy_block, a7 as fix_position, a8 as add_transform, a9 as create_animation, aa as select_option, ab as select_value, w as fade$1, ac as component_subscribe, ad as construct_svelte_component, ae as get_spread_update, af as get_spread_object, E as assign } from "./index-0ba2eb24.mjs";
import { t as tippy, N as NpcFeatureType, R as RangeType, W as WeaponRangeTemplate, h as fade, j as targetsFromTemplate, D as DamageType, H as HitQuality } from "./lancer-a96e7e01.mjs";
function flip(node, { from, to }, params = {}) {
  const style = getComputedStyle(node), transform = style.transform === "none" ? "" : style.transform, [ox, oy] = style.transformOrigin.split(" ").map(parseFloat), dx = from.left + from.width * ox / to.width - (to.left + ox), dy = from.top + from.height * oy / to.height - (to.top + oy), { delay = 0, duration = /* @__PURE__ */ __name((d) => Math.sqrt(d) * 120, "duration"), easing = cubicOut } = params;
  return {
    delay,
    duration: is_function(duration) ? duration(Math.sqrt(dx * dx + dy * dy)) : duration,
    easing,
    css: (t, u) => {
      const x = u * dx, y = u * dy, sx = t + u * from.width / to.width, sy = t + u * from.height / to.height;
      return `transform: ${transform} translate(${x}px, ${y}px) scale(${sx}, ${sy});`;
    }
  };
}
__name(flip, "flip");
const subscriber_queue = [];
function readable(value, start) {
  return {
    subscribe: writable(value, start).subscribe
  };
}
__name(readable, "readable");
function writable(value, start = noop) {
  let stop;
  const subscribers = /* @__PURE__ */ new Set();
  function set(new_value) {
    if (safe_not_equal(value, new_value) && (value = new_value, stop)) {
      const run_queue = !subscriber_queue.length;
      for (const subscriber of subscribers)
        subscriber[1](), subscriber_queue.push(subscriber, value);
      if (run_queue) {
        for (let i = 0; i < subscriber_queue.length; i += 2)
          subscriber_queue[i][0](subscriber_queue[i + 1]);
        subscriber_queue.length = 0;
      }
    }
  }
  __name(set, "set");
  function update(fn) {
    set(fn(value));
  }
  __name(update, "update");
  function subscribe2(run, invalidate = noop) {
    const subscriber = [run, invalidate];
    return subscribers.add(subscriber), subscribers.size === 1 && (stop = start(set) || noop), run(value), () => {
      subscribers.delete(subscriber), subscribers.size === 0 && stop && (stop(), stop = null);
    };
  }
  return __name(subscribe2, "subscribe"), { set, update, subscribe: subscribe2 };
}
__name(writable, "writable");
function derived(stores, fn, initial_value) {
  const single = !Array.isArray(stores), stores_array = single ? [stores] : stores, auto = fn.length < 2;
  return readable(initial_value, (set) => {
    let started = !1;
    const values = [];
    let pending = 0, cleanup = noop;
    const sync = /* @__PURE__ */ __name(() => {
      if (pending)
        return;
      cleanup();
      const result = fn(single ? values[0] : values, set);
      auto ? set(result) : cleanup = is_function(result) ? result : noop;
    }, "sync"), unsubscribers = stores_array.map((store, i) => subscribe(store, (value) => {
      values[i] = value, pending &= ~(1 << i), started && sync();
    }, () => {
      pending |= 1 << i;
    }));
    return started = !0, sync(), /* @__PURE__ */ __name(function() {
      run_all(unsubscribers), cleanup(), started = !1;
    }, "stop");
  });
}
__name(derived, "derived");
const sidebarWidth = readable(0, (update) => {
  const sidebar = $("#sidebar");
  function setWidth() {
    update(sidebar.width() || 0);
  }
  __name(setWidth, "setWidth"), setWidth(), Hooks.on("collapseSidebar", setWidth);
}), dataTransfer = readable(null, (update) => {
  function updateData(e) {
    update(e.defaultPrevented ? null : e.dataTransfer ?? null);
  }
  __name(updateData, "updateData"), document.addEventListener(
    "dragstart",
    (e) => {
      setTimeout(() => updateData(e), 0);
    },
    {
      capture: !0,
      passive: !0
    }
  ), document.addEventListener(
    "dragend",
    (e) => {
      update(null);
    },
    {
      capture: !0,
      passive: !0
    }
  );
}), isDragging = derived(dataTransfer, (dt) => !!dt), userTargets = readable([], (update) => {
  function updateData() {
    update(Array.from(game.user.targets));
  }
  __name(updateData, "updateData"), Hooks.on("targetToken", (user, _token, _isNewTarget) => {
    user.isSelf && updateData();
  }), Hooks.on("createActiveEffect", updateData), Hooks.on("deleteActiveEffect", updateData), Hooks.on("updateToken", (token) => {
    var _a, _b;
    ((_b = CanvasAnimation.getAnimation((_a = token.object) == null ? void 0 : _a.animationName)) == null ? void 0 : _b.promise.then(() => updateData())) ?? updateData();
  });
});
function create_if_block$a(ctx) {
  let i, i_class_value;
  return {
    c() {
      i = element("i"), attr(i, "class", i_class_value = /*icon*/
      ctx[3] + " i--s svelte-wt0sk2");
    },
    m(target, anchor) {
      insert(target, i, anchor);
    },
    p(ctx2, dirty) {
      dirty & /*icon*/
      8 && i_class_value !== (i_class_value = /*icon*/
      ctx2[3] + " i--s svelte-wt0sk2") && attr(i, "class", i_class_value);
    },
    d(detaching) {
      detaching && detach(i);
    }
  };
}
__name(create_if_block$a, "create_if_block$a");
function create_fragment$c(ctx) {
  let label_1, input, input_class_value, t0, t1, span, t2, label_1_transition, current, mounted, dispose, if_block = (
    /*icon*/
    ctx[3] && create_if_block$a(ctx)
  );
  return {
    c() {
      label_1 = element("label"), input = element("input"), t0 = space(), if_block && if_block.c(), t1 = space(), span = element("span"), t2 = text(
        /*label*/
        ctx[2]
      ), attr(input, "type", "checkbox"), input.disabled = /*disabled*/
      ctx[6], attr(input, "class", input_class_value = null_to_empty(
        /*partial*/
        ctx[5] ? "partial" : ""
      ) + " svelte-wt0sk2"), set_style(span, "text-wrap", "nowrap"), attr(label_1, "class", "container svelte-wt0sk2"), attr(
        label_1,
        "style",
        /*style*/
        ctx[1]
      ), attr(
        label_1,
        "data-tooltip",
        /*tooltip*/
        ctx[4]
      ), toggle_class(label_1, "invisible", !/*visible*/
      ctx[7]);
    },
    m(target, anchor) {
      insert(target, label_1, anchor), append(label_1, input), input.checked = /*value*/
      ctx[0], append(label_1, t0), if_block && if_block.m(label_1, null), append(label_1, t1), append(label_1, span), append(span, t2), current = !0, mounted || (dispose = [
        listen(
          input,
          "change",
          /*input_change_handler*/
          ctx[10]
        ),
        listen(
          input,
          "change",
          /*change_handler*/
          ctx[11]
        )
      ], mounted = !0);
    },
    p(ctx2, [dirty]) {
      (!current || dirty & /*disabled*/
      64) && (input.disabled = /*disabled*/
      ctx2[6]), (!current || dirty & /*partial*/
      32 && input_class_value !== (input_class_value = null_to_empty(
        /*partial*/
        ctx2[5] ? "partial" : ""
      ) + " svelte-wt0sk2")) && attr(input, "class", input_class_value), dirty & /*value*/
      1 && (input.checked = /*value*/
      ctx2[0]), /*icon*/
      ctx2[3] ? if_block ? if_block.p(ctx2, dirty) : (if_block = create_if_block$a(ctx2), if_block.c(), if_block.m(label_1, t1)) : if_block && (if_block.d(1), if_block = null), (!current || dirty & /*label*/
      4) && set_data(
        t2,
        /*label*/
        ctx2[2]
      ), (!current || dirty & /*style*/
      2) && attr(
        label_1,
        "style",
        /*style*/
        ctx2[1]
      ), (!current || dirty & /*tooltip*/
      16) && attr(
        label_1,
        "data-tooltip",
        /*tooltip*/
        ctx2[4]
      ), (!current || dirty & /*visible*/
      128) && toggle_class(label_1, "invisible", !/*visible*/
      ctx2[7]);
    },
    i(local) {
      current || (local && add_render_callback(() => {
        current && (label_1_transition || (label_1_transition = create_bidirectional_transition(label_1, slide, {}, !0)), label_1_transition.run(1));
      }), current = !0);
    },
    o(local) {
      local && (label_1_transition || (label_1_transition = create_bidirectional_transition(label_1, slide, {}, !1)), label_1_transition.run(0)), current = !1;
    },
    d(detaching) {
      detaching && detach(label_1), if_block && if_block.d(), detaching && label_1_transition && label_1_transition.end(), mounted = !1, run_all(dispose);
    }
  };
}
__name(create_fragment$c, "create_fragment$c");
function instance$c($$self, $$props, $$invalidate) {
  const dispatch = createEventDispatcher();
  let { style = "" } = $$props, { label = "" } = $$props, { icon = "" } = $$props, { tooltip = null } = $$props, { checked = null } = $$props, { value = !1 } = $$props, { partial = !1 } = $$props, { disabled = !1 } = $$props, { visible = !0 } = $$props;
  checked !== null && (value = checked);
  function input_change_handler() {
    value = this.checked, $$invalidate(0, value);
  }
  __name(input_change_handler, "input_change_handler");
  const change_handler = /* @__PURE__ */ __name(() => dispatch("change", value), "change_handler");
  return $$self.$$set = ($$props2) => {
    "style" in $$props2 && $$invalidate(1, style = $$props2.style), "label" in $$props2 && $$invalidate(2, label = $$props2.label), "icon" in $$props2 && $$invalidate(3, icon = $$props2.icon), "tooltip" in $$props2 && $$invalidate(4, tooltip = $$props2.tooltip), "checked" in $$props2 && $$invalidate(9, checked = $$props2.checked), "value" in $$props2 && $$invalidate(0, value = $$props2.value), "partial" in $$props2 && $$invalidate(5, partial = $$props2.partial), "disabled" in $$props2 && $$invalidate(6, disabled = $$props2.disabled), "visible" in $$props2 && $$invalidate(7, visible = $$props2.visible);
  }, [
    value,
    style,
    label,
    icon,
    tooltip,
    partial,
    disabled,
    visible,
    dispatch,
    checked,
    input_change_handler,
    change_handler
  ];
}
__name(instance$c, "instance$c");
const _HudCheckbox = class _HudCheckbox extends SvelteComponent {
  constructor(options) {
    super(), init(this, options, instance$c, create_fragment$c, safe_not_equal, {
      style: 1,
      label: 2,
      icon: 3,
      tooltip: 4,
      checked: 9,
      value: 0,
      partial: 5,
      disabled: 6,
      visible: 7
    });
  }
};
__name(_HudCheckbox, "HudCheckbox");
let HudCheckbox = _HudCheckbox;
const HudCheckbox$1 = HudCheckbox;
function create_if_block$9(ctx) {
  let hudcheckbox, updating_value, current;
  function hudcheckbox_value_binding(value) {
    ctx[1](value);
  }
  __name(hudcheckbox_value_binding, "hudcheckbox_value_binding");
  let hudcheckbox_props = {
    label: (
      /*data*/
      ctx[0].humanLabel
    ),
    disabled: (
      /*data*/
      ctx[0].disabled
    )
  };
  return (
    /*data*/
    ctx[0].uiState !== void 0 && (hudcheckbox_props.value = /*data*/
    ctx[0].uiState), hudcheckbox = new HudCheckbox$1({ props: hudcheckbox_props }), binding_callbacks.push(() => bind(hudcheckbox, "value", hudcheckbox_value_binding)), {
      c() {
        create_component(hudcheckbox.$$.fragment);
      },
      m(target, anchor) {
        mount_component(hudcheckbox, target, anchor), current = !0;
      },
      p(ctx2, dirty) {
        const hudcheckbox_changes = {};
        dirty & /*data*/
        1 && (hudcheckbox_changes.label = /*data*/
        ctx2[0].humanLabel), dirty & /*data*/
        1 && (hudcheckbox_changes.disabled = /*data*/
        ctx2[0].disabled), !updating_value && dirty & /*data*/
        1 && (updating_value = !0, hudcheckbox_changes.value = /*data*/
        ctx2[0].uiState, add_flush_callback(() => updating_value = !1)), hudcheckbox.$set(hudcheckbox_changes);
      },
      i(local) {
        current || (transition_in(hudcheckbox.$$.fragment, local), current = !0);
      },
      o(local) {
        transition_out(hudcheckbox.$$.fragment, local), current = !1;
      },
      d(detaching) {
        destroy_component(hudcheckbox, detaching);
      }
    }
  );
}
__name(create_if_block$9, "create_if_block$9");
function create_fragment$b(ctx) {
  let if_block_anchor, current, if_block = (
    /*data*/
    ctx[0].uiElement == "checkbox" && /*data*/
    ctx[0].visible && create_if_block$9(ctx)
  );
  return {
    c() {
      if_block && if_block.c(), if_block_anchor = empty();
    },
    m(target, anchor) {
      if_block && if_block.m(target, anchor), insert(target, if_block_anchor, anchor), current = !0;
    },
    p(ctx2, [dirty]) {
      /*data*/
      ctx2[0].uiElement == "checkbox" && /*data*/
      ctx2[0].visible ? if_block ? (if_block.p(ctx2, dirty), dirty & /*data*/
      1 && transition_in(if_block, 1)) : (if_block = create_if_block$9(ctx2), if_block.c(), transition_in(if_block, 1), if_block.m(if_block_anchor.parentNode, if_block_anchor)) : if_block && (group_outros(), transition_out(if_block, 1, 1, () => {
        if_block = null;
      }), check_outros());
    },
    i(local) {
      current || (transition_in(if_block), current = !0);
    },
    o(local) {
      transition_out(if_block), current = !1;
    },
    d(detaching) {
      if_block && if_block.d(detaching), detaching && detach(if_block_anchor);
    }
  };
}
__name(create_fragment$b, "create_fragment$b");
function instance$b($$self, $$props, $$invalidate) {
  let { data } = $$props;
  function hudcheckbox_value_binding(value) {
    $$self.$$.not_equal(data.uiState, value) && (data.uiState = value, $$invalidate(0, data));
  }
  return __name(hudcheckbox_value_binding, "hudcheckbox_value_binding"), $$self.$$set = ($$props2) => {
    "data" in $$props2 && $$invalidate(0, data = $$props2.data);
  }, [data, hudcheckbox_value_binding];
}
__name(instance$b, "instance$b");
const _Plugin = class _Plugin extends SvelteComponent {
  constructor(options) {
    super(), init(this, options, instance$b, create_fragment$b, safe_not_equal, { data: 0 });
  }
};
__name(_Plugin, "Plugin");
let Plugin = _Plugin;
const Plugin$1 = Plugin;
function get_each_context$9(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[10] = list[i], child_ctx;
}
__name(get_each_context$9, "get_each_context$9");
function create_if_block$8(ctx) {
  let div, div_intro, div_outro, current;
  return {
    c() {
      div = element("div"), attr(div, "class", "cover-arrow svelte-15m72ur");
    },
    m(target, anchor) {
      insert(target, div, anchor), current = !0;
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
    },
    i(local) {
      current || (local && add_render_callback(() => {
        current && (div_outro && div_outro.end(1), div_intro = create_in_transition(
          div,
          /*send*/
          ctx[6],
          { key: (
            /*id*/
            ctx[4]
          ) }
        ), div_intro.start());
      }), current = !0);
    },
    o(local) {
      div_intro && div_intro.invalidate(), local && (div_outro = create_out_transition(
        div,
        /*recv*/
        ctx[7],
        { key: (
          /*id*/
          ctx[4]
        ) }
      )), current = !1;
    },
    d(detaching) {
      detaching && detach(div), detaching && div_outro && div_outro.end();
    }
  };
}
__name(create_if_block$8, "create_if_block$8");
function create_each_block$9(ctx) {
  let input, t0, label, i, t1, span, t2_value = (
    /*input*/
    ctx[10].human + ""
  ), t2, t3, t4, label_class_value, binding_group, mounted, dispose, if_block = (
    /*input*/
    ctx[10].value == /*cover*/
    ctx[0] && create_if_block$8(ctx)
  );
  return binding_group = init_binding_group(
    /*$$binding_groups*/
    ctx[9][0]
  ), {
    c() {
      input = element("input"), t0 = space(), label = element("label"), i = element("i"), t1 = space(), span = element("span"), t2 = text(t2_value), t3 = space(), if_block && if_block.c(), t4 = space(), attr(input, "type", "radio"), attr(
        input,
        "id",
        /*id*/
        ctx[4] + "-" + /*input*/
        ctx[10].slug
      ), attr(input, "class", "no-grow " + /*input*/
      ctx[10].slug + "-cover svelte-15m72ur"), input.__value = /*input*/
      ctx[10].value, input.value = input.__value, input.disabled = /*disabled*/
      ctx[1], attr(i, "class", "mdi mdi-" + /*input*/
      ctx[10].icon + " i--s svelte-15m72ur"), attr(
        i,
        "title",
        /*input*/
        ctx[10].human
      ), attr(span, "class", "no-grow"), attr(
        label,
        "for",
        /*id*/
        ctx[4] + "-" + /*input*/
        ctx[10].slug
      ), attr(label, "class", label_class_value = "lancer-cover-radio-label " + /*labelClass*/
      ctx[2] + " svelte-15m72ur"), binding_group.p(input);
    },
    m(target, anchor) {
      insert(target, input, anchor), input.checked = input.__value === /*cover*/
      ctx[0], insert(target, t0, anchor), insert(target, label, anchor), append(label, i), append(label, t1), append(label, span), append(span, t2), append(label, t3), if_block && if_block.m(label, null), append(label, t4), mounted || (dispose = listen(
        input,
        "change",
        /*input_change_handler*/
        ctx[8]
      ), mounted = !0);
    },
    p(ctx2, dirty) {
      dirty & /*disabled*/
      2 && (input.disabled = /*disabled*/
      ctx2[1]), dirty & /*cover*/
      1 && (input.checked = input.__value === /*cover*/
      ctx2[0]), /*input*/
      ctx2[10].value == /*cover*/
      ctx2[0] ? if_block ? (if_block.p(ctx2, dirty), dirty & /*cover*/
      1 && transition_in(if_block, 1)) : (if_block = create_if_block$8(ctx2), if_block.c(), transition_in(if_block, 1), if_block.m(label, t4)) : if_block && (group_outros(), transition_out(if_block, 1, 1, () => {
        if_block = null;
      }), check_outros()), dirty & /*labelClass*/
      4 && label_class_value !== (label_class_value = "lancer-cover-radio-label " + /*labelClass*/
      ctx2[2] + " svelte-15m72ur") && attr(label, "class", label_class_value);
    },
    d(detaching) {
      detaching && detach(input), detaching && detach(t0), detaching && detach(label), if_block && if_block.d(), binding_group.r(), mounted = !1, dispose();
    }
  };
}
__name(create_each_block$9, "create_each_block$9");
function create_fragment$a(ctx) {
  let div, div_class_value, each_value = (
    /*inputs*/
    ctx[5]
  ), each_blocks = [];
  for (let i = 0; i < each_value.length; i += 1)
    each_blocks[i] = create_each_block$9(get_each_context$9(ctx, each_value, i));
  return {
    c() {
      div = element("div");
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      attr(div, "class", div_class_value = "lancer-cover-radio " + /*klass*/
      ctx[3] + " svelte-15m72ur"), toggle_class(
        div,
        "disabled",
        /*disabled*/
        ctx[1]
      );
    },
    m(target, anchor) {
      insert(target, div, anchor);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(div, null);
    },
    p(ctx2, [dirty]) {
      if (dirty & /*id, inputs, labelClass, cover, disabled*/
      55) {
        each_value = /*inputs*/
        ctx2[5];
        let i;
        for (i = 0; i < each_value.length; i += 1) {
          const child_ctx = get_each_context$9(ctx2, each_value, i);
          each_blocks[i] ? each_blocks[i].p(child_ctx, dirty) : (each_blocks[i] = create_each_block$9(child_ctx), each_blocks[i].c(), each_blocks[i].m(div, null));
        }
        for (; i < each_blocks.length; i += 1)
          each_blocks[i].d(1);
        each_blocks.length = each_value.length;
      }
      dirty & /*klass*/
      8 && div_class_value !== (div_class_value = "lancer-cover-radio " + /*klass*/
      ctx2[3] + " svelte-15m72ur") && attr(div, "class", div_class_value), dirty & /*klass, disabled*/
      10 && toggle_class(
        div,
        "disabled",
        /*disabled*/
        ctx2[1]
      );
    },
    i: noop,
    o: noop,
    d(detaching) {
      detaching && detach(div), destroy_each(each_blocks, detaching);
    }
  };
}
__name(create_fragment$a, "create_fragment$a");
let counter$2 = 0;
function instance$a($$self, $$props, $$invalidate) {
  let { cover } = $$props, { disabled = !1 } = $$props, { labelClass = "" } = $$props, { class: klass = "" } = $$props, id = `accdiff-cover-input-${counter$2++}`, inputs = [
    {
      slug: "no",
      human: "No Cover",
      value: 0,
      icon: "shield-outline"
    },
    {
      slug: "soft",
      human: "Soft Cover (-1)",
      value: 1,
      icon: "shield-half-full"
    },
    {
      slug: "hard",
      human: "Hard Cover (-2)",
      value: 2,
      icon: "shield"
    }
  ], [send2, recv2] = crossfade({});
  const $$binding_groups = [[]];
  function input_change_handler() {
    cover = this.__value, $$invalidate(0, cover);
  }
  return __name(input_change_handler, "input_change_handler"), $$self.$$set = ($$props2) => {
    "cover" in $$props2 && $$invalidate(0, cover = $$props2.cover), "disabled" in $$props2 && $$invalidate(1, disabled = $$props2.disabled), "labelClass" in $$props2 && $$invalidate(2, labelClass = $$props2.labelClass), "class" in $$props2 && $$invalidate(3, klass = $$props2.class);
  }, [
    cover,
    disabled,
    labelClass,
    klass,
    id,
    inputs,
    send2,
    recv2,
    input_change_handler,
    $$binding_groups
  ];
}
__name(instance$a, "instance$a");
const _Cover = class _Cover extends SvelteComponent {
  constructor(options) {
    super(), init(this, options, instance$a, create_fragment$a, safe_not_equal, {
      cover: 0,
      disabled: 1,
      labelClass: 2,
      class: 3
    });
  }
};
__name(_Cover, "Cover");
let Cover = _Cover;
const Cover$1 = Cover;
function get_each_context$8(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[13] = list[i], child_ctx;
}
__name(get_each_context$8, "get_each_context$8");
function get_each_context_1$4(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[16] = list[i], child_ctx[17] = list, child_ctx[18] = i, child_ctx;
}
__name(get_each_context_1$4, "get_each_context_1$4");
function create_if_block$7(ctx) {
  let div, img, img_alt_value, img_src_value, t0, t1, label, i, t2, hudcheckbox, updating_value, div_intro, div_outro, t3, if_block1_anchor, current, mounted, dispose, if_block0 = (
    /*target*/
    ctx[0].stunned && create_if_block_2$3(ctx)
  );
  function hudcheckbox_value_binding(value) {
    ctx[10](value);
  }
  __name(hudcheckbox_value_binding, "hudcheckbox_value_binding");
  let hudcheckbox_props = {
    label: "Consume Lock On (+1)",
    checked: !!/*target*/
    ctx[0].usingLockOn,
    disabled: !/*target*/
    ctx[0].lockOnAvailable,
    visible: !1
  };
  /*target*/
  ctx[0].consumeLockOn !== void 0 && (hudcheckbox_props.value = /*target*/
  ctx[0].consumeLockOn), hudcheckbox = new HudCheckbox$1({ props: hudcheckbox_props }), binding_callbacks.push(() => bind(hudcheckbox, "value", hudcheckbox_value_binding));
  let if_block1 = !/*onlyTarget*/
  ctx[1] && create_if_block_1$4(ctx);
  return {
    c() {
      var _a;
      div = element("div"), img = element("img"), t0 = space(), if_block0 && if_block0.c(), t1 = space(), label = element("label"), i = element("i"), t2 = space(), create_component(hudcheckbox.$$.fragment), t3 = space(), if_block1 && if_block1.c(), if_block1_anchor = empty(), attr(img, "alt", img_alt_value = /*target*/
      ctx[0].target.name ?? void 0), src_url_equal(img.src, img_src_value = /*target*/
      (_a = ctx[0].target.actor) == null ? void 0 : _a.img) || attr(img, "src", img_src_value), attr(img, "class", "svelte-1odyucf"), toggle_class(
        img,
        "accdiff-target-prone",
        /*target*/
        ctx[0].prone
      ), attr(i, "class", "cci cci-condition-lock-on svelte-1odyucf"), toggle_class(
        i,
        "i--click",
        /*target*/
        ctx[0].lockOnAvailable
      ), toggle_class(i, "i--sm", !/*target*/
      ctx[0].usingLockOn), toggle_class(
        i,
        "i--l",
        /*target*/
        ctx[0].usingLockOn
      ), attr(
        label,
        "for",
        /*lockonId*/
        ctx[5]
      ), attr(label, "class", "lockon-label svelte-1odyucf"), attr(label, "title", "Consume Lock On (+1)"), toggle_class(
        label,
        "checked",
        /*target*/
        ctx[0].usingLockOn
      ), toggle_class(label, "disabled", !/*target*/
      ctx[0].lockOnAvailable), attr(div, "class", "accdiff-grid lancer-hit-thumb accdiff-target-has-dropdown " + /*pluginClasses*/
      ctx[8] + " svelte-1odyucf");
    },
    m(target, anchor) {
      insert(target, div, anchor), append(div, img), ctx[9](img), append(div, t0), if_block0 && if_block0.m(div, null), append(div, t1), append(div, label), append(label, i), append(label, t2), mount_component(hudcheckbox, label, null), insert(target, t3, anchor), if_block1 && if_block1.m(target, anchor), insert(target, if_block1_anchor, anchor), current = !0, mounted || (dispose = [
        listen(
          i,
          "click",
          /*toggleLockOn*/
          ctx[7]
        ),
        listen(
          i,
          "keypress",
          /*toggleLockOn*/
          ctx[7]
        )
      ], mounted = !0);
    },
    p(new_ctx, dirty) {
      var _a;
      ctx = new_ctx, (!current || dirty & /*target*/
      1 && img_alt_value !== (img_alt_value = /*target*/
      ctx[0].target.name ?? void 0)) && attr(img, "alt", img_alt_value), (!current || dirty & /*target*/
      1 && !src_url_equal(img.src, img_src_value = /*target*/
      (_a = ctx[0].target.actor) == null ? void 0 : _a.img)) && attr(img, "src", img_src_value), (!current || dirty & /*target*/
      1) && toggle_class(
        img,
        "accdiff-target-prone",
        /*target*/
        ctx[0].prone
      ), /*target*/
      ctx[0].stunned ? if_block0 ? (if_block0.p(ctx, dirty), dirty & /*target*/
      1 && transition_in(if_block0, 1)) : (if_block0 = create_if_block_2$3(ctx), if_block0.c(), transition_in(if_block0, 1), if_block0.m(div, t1)) : if_block0 && (group_outros(), transition_out(if_block0, 1, 1, () => {
        if_block0 = null;
      }), check_outros()), (!current || dirty & /*target*/
      1) && toggle_class(
        i,
        "i--click",
        /*target*/
        ctx[0].lockOnAvailable
      ), (!current || dirty & /*target*/
      1) && toggle_class(i, "i--sm", !/*target*/
      ctx[0].usingLockOn), (!current || dirty & /*target*/
      1) && toggle_class(
        i,
        "i--l",
        /*target*/
        ctx[0].usingLockOn
      );
      const hudcheckbox_changes = {};
      dirty & /*target*/
      1 && (hudcheckbox_changes.checked = !!/*target*/
      ctx[0].usingLockOn), dirty & /*target*/
      1 && (hudcheckbox_changes.disabled = !/*target*/
      ctx[0].lockOnAvailable), !updating_value && dirty & /*target*/
      1 && (updating_value = !0, hudcheckbox_changes.value = /*target*/
      ctx[0].consumeLockOn, add_flush_callback(() => updating_value = !1)), hudcheckbox.$set(hudcheckbox_changes), (!current || dirty & /*target*/
      1) && toggle_class(
        label,
        "checked",
        /*target*/
        ctx[0].usingLockOn
      ), (!current || dirty & /*target*/
      1) && toggle_class(label, "disabled", !/*target*/
      ctx[0].lockOnAvailable), /*onlyTarget*/
      ctx[1] ? if_block1 && (group_outros(), transition_out(if_block1, 1, 1, () => {
        if_block1 = null;
      }), check_outros()) : if_block1 ? (if_block1.p(ctx, dirty), dirty & /*onlyTarget*/
      2 && transition_in(if_block1, 1)) : (if_block1 = create_if_block_1$4(ctx), if_block1.c(), transition_in(if_block1, 1), if_block1.m(if_block1_anchor.parentNode, if_block1_anchor));
    },
    i(local) {
      current || (transition_in(if_block0), transition_in(hudcheckbox.$$.fragment, local), add_render_callback(() => {
        current && (div_outro && div_outro.end(1), div_intro = create_in_transition(div, send, {
          key: `${/*id*/
          ctx[2]}-img`,
          delay: 100,
          duration: 200
        }), div_intro.start());
      }), transition_in(if_block1), current = !0);
    },
    o(local) {
      transition_out(if_block0), transition_out(hudcheckbox.$$.fragment, local), div_intro && div_intro.invalidate(), div_outro = create_out_transition(div, recv, {
        key: `${/*id*/
        ctx[2]}-img`,
        duration: 200
      }), transition_out(if_block1), current = !1;
    },
    d(detaching) {
      detaching && detach(div), ctx[9](null), if_block0 && if_block0.d(), destroy_component(hudcheckbox), detaching && div_outro && div_outro.end(), detaching && detach(t3), if_block1 && if_block1.d(detaching), detaching && detach(if_block1_anchor), mounted = !1, run_all(dispose);
    }
  };
}
__name(create_if_block$7, "create_if_block$7");
function create_if_block_2$3(ctx) {
  let label, i, label_transition, current;
  return {
    c() {
      label = element("label"), i = element("i"), attr(i, "class", "cci cci-condition-stunned i--sm svelte-1odyucf"), attr(
        label,
        "for",
        /*stunnedId*/
        ctx[6]
      ), attr(label, "class", "stunned-label svelte-1odyucf"), attr(label, "title", "Stunned");
    },
    m(target, anchor) {
      insert(target, label, anchor), append(label, i), current = !0;
    },
    p: noop,
    i(local) {
      current || (add_render_callback(() => {
        current && (label_transition || (label_transition = create_bidirectional_transition(label, blur, {}, !0)), label_transition.run(1));
      }), current = !0);
    },
    o(local) {
      label_transition || (label_transition = create_bidirectional_transition(label, blur, {}, !1)), label_transition.run(0), current = !1;
    },
    d(detaching) {
      detaching && detach(label), detaching && label_transition && label_transition.end();
    }
  };
}
__name(create_if_block_2$3, "create_if_block_2$3");
function create_if_block_1$4(ctx) {
  let div, current, each_value_1 = Object.keys(
    /*target*/
    ctx[0].plugins
  ), each_blocks = [];
  for (let i = 0; i < each_value_1.length; i += 1)
    each_blocks[i] = create_each_block_1$4(get_each_context_1$4(ctx, each_value_1, i));
  const out = /* @__PURE__ */ __name((i) => transition_out(each_blocks[i], 1, 1, () => {
    each_blocks[i] = null;
  }), "out");
  return {
    c() {
      div = element("div");
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      attr(div, "class", "accdiff-target-dropdown svelte-1odyucf");
    },
    m(target, anchor) {
      insert(target, div, anchor);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(div, null);
      ctx[12](div), current = !0;
    },
    p(ctx2, dirty) {
      if (dirty & /*target, Object*/
      1) {
        each_value_1 = Object.keys(
          /*target*/
          ctx2[0].plugins
        );
        let i;
        for (i = 0; i < each_value_1.length; i += 1) {
          const child_ctx = get_each_context_1$4(ctx2, each_value_1, i);
          each_blocks[i] ? (each_blocks[i].p(child_ctx, dirty), transition_in(each_blocks[i], 1)) : (each_blocks[i] = create_each_block_1$4(child_ctx), each_blocks[i].c(), transition_in(each_blocks[i], 1), each_blocks[i].m(div, null));
        }
        for (group_outros(), i = each_value_1.length; i < each_blocks.length; i += 1)
          out(i);
        check_outros();
      }
    },
    i(local) {
      if (!current) {
        for (let i = 0; i < each_value_1.length; i += 1)
          transition_in(each_blocks[i]);
        current = !0;
      }
    },
    o(local) {
      each_blocks = each_blocks.filter(Boolean);
      for (let i = 0; i < each_blocks.length; i += 1)
        transition_out(each_blocks[i]);
      current = !1;
    },
    d(detaching) {
      detaching && detach(div), destroy_each(each_blocks, detaching), ctx[12](null);
    }
  };
}
__name(create_if_block_1$4, "create_if_block_1$4");
function create_each_block_1$4(ctx) {
  let plugin, updating_data, current;
  function plugin_data_binding(value) {
    ctx[11](
      value,
      /*key*/
      ctx[16]
    );
  }
  __name(plugin_data_binding, "plugin_data_binding");
  let plugin_props = {};
  return (
    /*target*/
    ctx[0].plugins[
      /*key*/
      ctx[16]
    ] !== void 0 && (plugin_props.data = /*target*/
    ctx[0].plugins[
      /*key*/
      ctx[16]
    ]), plugin = new Plugin$1({ props: plugin_props }), binding_callbacks.push(() => bind(plugin, "data", plugin_data_binding)), {
      c() {
        create_component(plugin.$$.fragment);
      },
      m(target, anchor) {
        mount_component(plugin, target, anchor), current = !0;
      },
      p(new_ctx, dirty) {
        ctx = new_ctx;
        const plugin_changes = {};
        !updating_data && dirty & /*target, Object*/
        1 && (updating_data = !0, plugin_changes.data = /*target*/
        ctx[0].plugins[
          /*key*/
          ctx[16]
        ], add_flush_callback(() => updating_data = !1)), plugin.$set(plugin_changes);
      },
      i(local) {
        current || (transition_in(plugin.$$.fragment, local), current = !0);
      },
      o(local) {
        transition_out(plugin.$$.fragment, local), current = !1;
      },
      d(detaching) {
        destroy_component(plugin, detaching);
      }
    }
  );
}
__name(create_each_block_1$4, "create_each_block_1$4");
function create_each_block$8(key_1, ctx) {
  let div, span, t0_value = Math.abs(
    /*total*/
    ctx[13]
  ) + "", t0, span_intro, span_outro, t1, i, i_intro, i_outro, t2, div_transition, current;
  return {
    key: key_1,
    first: null,
    c() {
      div = element("div"), span = element("span"), t0 = text(t0_value), t1 = space(), i = element("i"), t2 = space(), attr(i, "class", "cci i--m i--dark white--text middle svelte-1odyucf"), toggle_class(
        i,
        "cci-accuracy",
        /*total*/
        ctx[13] >= 0
      ), toggle_class(
        i,
        "cci-difficulty",
        /*total*/
        ctx[13] < 0
      ), attr(
        div,
        "id",
        /*id*/
        ctx[2]
      ), attr(div, "class", "card clipped total svelte-1odyucf"), this.first = div;
    },
    m(target, anchor) {
      insert(target, div, anchor), append(div, span), append(span, t0), append(div, t1), append(div, i), append(div, t2), current = !0;
    },
    p(new_ctx, dirty) {
      ctx = new_ctx, (!current || dirty & /*target*/
      1) && t0_value !== (t0_value = Math.abs(
        /*total*/
        ctx[13]
      ) + "") && set_data(t0, t0_value), (!current || dirty & /*target*/
      1) && toggle_class(
        i,
        "cci-accuracy",
        /*total*/
        ctx[13] >= 0
      ), (!current || dirty & /*target*/
      1) && toggle_class(
        i,
        "cci-difficulty",
        /*total*/
        ctx[13] < 0
      ), (!current || dirty & /*id*/
      4) && attr(
        div,
        "id",
        /*id*/
        ctx[2]
      );
    },
    i(local) {
      current || (local && add_render_callback(() => {
        current && (span_outro && span_outro.end(1), span_intro = create_in_transition(span, fly, { y: -50, duration: 400 }), span_intro.start());
      }), local && add_render_callback(() => {
        current && (i_outro && i_outro.end(1), i_intro = create_in_transition(i, fly, { y: -50, duration: 200 }), i_intro.start());
      }), add_render_callback(() => {
        current && (div_transition || (div_transition = create_bidirectional_transition(div, blur, {}, !0)), div_transition.run(1));
      }), current = !0);
    },
    o(local) {
      span_intro && span_intro.invalidate(), local && (span_outro = create_out_transition(span, fly, { y: 50, duration: 200 })), i_intro && i_intro.invalidate(), local && (i_outro = create_out_transition(i, fly, { y: 50, duration: 200 })), div_transition || (div_transition = create_bidirectional_transition(div, blur, {}, !1)), div_transition.run(0), current = !1;
    },
    d(detaching) {
      detaching && detach(div), detaching && span_outro && span_outro.end(), detaching && i_outro && i_outro.end(), detaching && div_transition && div_transition.end();
    }
  };
}
__name(create_each_block$8, "create_each_block$8");
function create_fragment$9(ctx) {
  let show_if = isTarget(
    /*target*/
    ctx[0]
  ), t, div1, div0, each_blocks = [], each_1_lookup = /* @__PURE__ */ new Map(), div1_intro, div1_outro, current, if_block = show_if && create_if_block$7(ctx), each_value = [
    /*target*/
    ctx[0].total
  ];
  const get_key = /* @__PURE__ */ __name((ctx2) => (
    /*target*/
    ctx2[0].total
  ), "get_key");
  for (let i = 0; i < 1; i += 1) {
    let child_ctx = get_each_context$8(ctx, each_value, i), key = get_key(child_ctx);
    each_1_lookup.set(key, each_blocks[i] = create_each_block$8(key, child_ctx));
  }
  return {
    c() {
      if_block && if_block.c(), t = space(), div1 = element("div"), div0 = element("div");
      for (let i = 0; i < 1; i += 1)
        each_blocks[i].c();
      attr(div0, "class", "grid-enforcement total-container " + /*pluginClasses*/
      ctx[8] + " svelte-1odyucf"), toggle_class(
        div0,
        "accurate",
        /*target*/
        ctx[0].total > 0
      ), toggle_class(
        div0,
        "inaccurate",
        /*target*/
        ctx[0].total < 0
      ), attr(div1, "class", "accdiff-grid accdiff-weight svelte-1odyucf");
    },
    m(target, anchor) {
      if_block && if_block.m(target, anchor), insert(target, t, anchor), insert(target, div1, anchor), append(div1, div0);
      for (let i = 0; i < 1; i += 1)
        each_blocks[i] && each_blocks[i].m(div0, null);
      current = !0;
    },
    p(new_ctx, [dirty]) {
      ctx = new_ctx, dirty & /*target*/
      1 && (show_if = isTarget(
        /*target*/
        ctx[0]
      )), show_if ? if_block ? (if_block.p(ctx, dirty), dirty & /*target*/
      1 && transition_in(if_block, 1)) : (if_block = create_if_block$7(ctx), if_block.c(), transition_in(if_block, 1), if_block.m(t.parentNode, t)) : if_block && (group_outros(), transition_out(if_block, 1, 1, () => {
        if_block = null;
      }), check_outros()), dirty & /*id, target, Math*/
      5 && (each_value = [
        /*target*/
        ctx[0].total
      ], group_outros(), each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div0, outro_and_destroy_block, create_each_block$8, null, get_each_context$8), check_outros()), (!current || dirty & /*target*/
      1) && toggle_class(
        div0,
        "accurate",
        /*target*/
        ctx[0].total > 0
      ), (!current || dirty & /*target*/
      1) && toggle_class(
        div0,
        "inaccurate",
        /*target*/
        ctx[0].total < 0
      );
    },
    i(local) {
      if (!current) {
        transition_in(if_block);
        for (let i = 0; i < 1; i += 1)
          transition_in(each_blocks[i]);
        add_render_callback(() => {
          current && (div1_outro && div1_outro.end(1), div1_intro = create_in_transition(div1, send, { key: (
            /*id*/
            ctx[2]
          ) }), div1_intro.start());
        }), current = !0;
      }
    },
    o(local) {
      transition_out(if_block);
      for (let i = 0; i < 1; i += 1)
        transition_out(each_blocks[i]);
      div1_intro && div1_intro.invalidate(), div1_outro = create_out_transition(div1, recv, { key: (
        /*id*/
        ctx[2]
      ) }), current = !1;
    },
    d(detaching) {
      if_block && if_block.d(detaching), detaching && detach(t), detaching && detach(div1);
      for (let i = 0; i < 1; i += 1)
        each_blocks[i].d();
      detaching && div1_outro && div1_outro.end();
    }
  };
}
__name(create_fragment$9, "create_fragment$9");
let lockonCounter = 0, stunnedCounter = 0, counter$1 = 0, [send, recv] = crossfade({ fallback: blur });
function isTarget(v) {
  return v == null ? void 0 : v.target;
}
__name(isTarget, "isTarget");
function instance$9($$self, $$props, $$invalidate) {
  let { target } = $$props, { onlyTarget = !1 } = $$props, { id = `accdiff-total-display-${counter$1++}` } = $$props, lockonId = isTarget(target) ? `accdiff-total-display-consume-lockon-${lockonCounter++}` : "", stunnedId = isTarget(target) ? `accdiff-total-display-stunned-${stunnedCounter++}` : "";
  function toggleLockOn() {
    isTarget(target) && target.lockOnAvailable && $$invalidate(0, target.consumeLockOn = !target.consumeLockOn, target);
  }
  __name(toggleLockOn, "toggleLockOn");
  let pluginClasses = Object.values(target.plugins).filter((plugin) => plugin.uiElement == "checkbox" && plugin.uiState).map((plugin) => `accdiff-total-${plugin.slug}`).join(" "), imgElement, dropdownElement;
  onMount(() => {
    imgElement && dropdownElement && tippy(imgElement, {
      content: dropdownElement,
      interactive: !0,
      allowHTML: !0,
      trigger: "click mouseenter",
      placement: "right"
    });
  });
  function img_binding($$value) {
    binding_callbacks[$$value ? "unshift" : "push"](() => {
      imgElement = $$value, $$invalidate(3, imgElement);
    });
  }
  __name(img_binding, "img_binding");
  function hudcheckbox_value_binding(value) {
    $$self.$$.not_equal(target.consumeLockOn, value) && (target.consumeLockOn = value, $$invalidate(0, target));
  }
  __name(hudcheckbox_value_binding, "hudcheckbox_value_binding");
  function plugin_data_binding(value, key) {
    $$self.$$.not_equal(target.plugins[key], value) && (target.plugins[key] = value, $$invalidate(0, target));
  }
  __name(plugin_data_binding, "plugin_data_binding");
  function div_binding($$value) {
    binding_callbacks[$$value ? "unshift" : "push"](() => {
      dropdownElement = $$value, $$invalidate(4, dropdownElement);
    });
  }
  return __name(div_binding, "div_binding"), $$self.$$set = ($$props2) => {
    "target" in $$props2 && $$invalidate(0, target = $$props2.target), "onlyTarget" in $$props2 && $$invalidate(1, onlyTarget = $$props2.onlyTarget), "id" in $$props2 && $$invalidate(2, id = $$props2.id);
  }, [
    target,
    onlyTarget,
    id,
    imgElement,
    dropdownElement,
    lockonId,
    stunnedId,
    toggleLockOn,
    pluginClasses,
    img_binding,
    hudcheckbox_value_binding,
    plugin_data_binding,
    div_binding
  ];
}
__name(instance$9, "instance$9");
const _TotalAccuracy = class _TotalAccuracy extends SvelteComponent {
  constructor(options) {
    super(), init(this, options, instance$9, create_fragment$9, safe_not_equal, { target: 0, onlyTarget: 1, id: 2 });
  }
};
__name(_TotalAccuracy, "TotalAccuracy");
let TotalAccuracy = _TotalAccuracy;
const Total = TotalAccuracy;
function get_each_context$7(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[1] = list[i], child_ctx;
}
__name(get_each_context$7, "get_each_context$7");
function get_each_context_1$3(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[4] = list[i], child_ctx;
}
__name(get_each_context_1$3, "get_each_context_1$3");
function create_if_block_1$3(ctx) {
  let div, t0, t1, span, if_block0 = (
    /*profile*/
    ctx[0].attack && create_if_block_3$2(ctx)
  ), if_block1 = (
    /*profile*/
    ctx[0].accuracy && create_if_block_2$2(ctx)
  );
  return {
    c() {
      div = element("div"), if_block0 && if_block0.c(), t0 = space(), if_block1 && if_block1.c(), t1 = space(), span = element("span"), span.textContent = "//", attr(div, "class", "mini-weapon-profile-accuracy flexrow"), attr(span, "class", "mini-weapon-profile-separator");
    },
    m(target, anchor) {
      insert(target, div, anchor), if_block0 && if_block0.m(div, null), append(div, t0), if_block1 && if_block1.m(div, null), insert(target, t1, anchor), insert(target, span, anchor);
    },
    p(ctx2, dirty) {
      /*profile*/
      ctx2[0].attack ? if_block0 ? if_block0.p(ctx2, dirty) : (if_block0 = create_if_block_3$2(ctx2), if_block0.c(), if_block0.m(div, t0)) : if_block0 && (if_block0.d(1), if_block0 = null), /*profile*/
      ctx2[0].accuracy ? if_block1 ? if_block1.p(ctx2, dirty) : (if_block1 = create_if_block_2$2(ctx2), if_block1.c(), if_block1.m(div, null)) : if_block1 && (if_block1.d(1), if_block1 = null);
    },
    d(detaching) {
      detaching && detach(div), if_block0 && if_block0.d(), if_block1 && if_block1.d(), detaching && detach(t1), detaching && detach(span);
    }
  };
}
__name(create_if_block_1$3, "create_if_block_1$3");
function create_if_block_3$2(ctx) {
  let span, i, t0_value = (
    /*profile*/
    ctx[0].attack < 0 ? "-" : "+"
  ), t0, t1_value = (
    /*profile*/
    ctx[0].attack + ""
  ), t1;
  return {
    c() {
      span = element("span"), i = element("i"), t0 = text(t0_value), t1 = text(t1_value), attr(i, "class", "cci cci-reticule"), attr(span, "data-tooltip", "Attack bonus");
    },
    m(target, anchor) {
      insert(target, span, anchor), append(span, i), append(span, t0), append(span, t1);
    },
    p(ctx2, dirty) {
      dirty & /*profile*/
      1 && t0_value !== (t0_value = /*profile*/
      ctx2[0].attack < 0 ? "-" : "+") && set_data(t0, t0_value), dirty & /*profile*/
      1 && t1_value !== (t1_value = /*profile*/
      ctx2[0].attack + "") && set_data(t1, t1_value);
    },
    d(detaching) {
      detaching && detach(span);
    }
  };
}
__name(create_if_block_3$2, "create_if_block_3$2");
function create_if_block_2$2(ctx) {
  let span, i, i_class_value, t_value = Math.abs(
    /*profile*/
    ctx[0].accuracy
  ) + "", t, span_data_tooltip_value;
  return {
    c() {
      span = element("span"), i = element("i"), t = text(t_value), attr(i, "class", i_class_value = "cci cci-" + /*profile*/
      ((ctx[0].accuracy ?? 0) > 0 ? "accuracy" : "difficulty")), attr(span, "data-tooltip", span_data_tooltip_value = /*profile*/
      (ctx[0].accuracy ?? 0) > 0 ? "Accuracy" : "Difficulty");
    },
    m(target, anchor) {
      insert(target, span, anchor), append(span, i), append(span, t);
    },
    p(ctx2, dirty) {
      dirty & /*profile*/
      1 && i_class_value !== (i_class_value = "cci cci-" + /*profile*/
      ((ctx2[0].accuracy ?? 0) > 0 ? "accuracy" : "difficulty")) && attr(i, "class", i_class_value), dirty & /*profile*/
      1 && t_value !== (t_value = Math.abs(
        /*profile*/
        ctx2[0].accuracy
      ) + "") && set_data(t, t_value), dirty & /*profile*/
      1 && span_data_tooltip_value !== (span_data_tooltip_value = /*profile*/
      (ctx2[0].accuracy ?? 0) > 0 ? "Accuracy" : "Difficulty") && attr(span, "data-tooltip", span_data_tooltip_value);
    },
    d(detaching) {
      detaching && detach(span);
    }
  };
}
__name(create_if_block_2$2, "create_if_block_2$2");
function create_each_block_1$3(ctx) {
  let span, i, i_class_value, t_value = (
    /*range*/
    ctx[4].val + ""
  ), t, span_data_tooltip_value;
  return {
    c() {
      span = element("span"), i = element("i"), t = text(t_value), attr(i, "class", i_class_value = "cci cci-" + /*range*/
      ctx[4].type.toLowerCase()), attr(span, "data-tooltip", span_data_tooltip_value = /*range*/
      ctx[4].type);
    },
    m(target, anchor) {
      insert(target, span, anchor), append(span, i), append(span, t);
    },
    p(ctx2, dirty) {
      dirty & /*profile*/
      1 && i_class_value !== (i_class_value = "cci cci-" + /*range*/
      ctx2[4].type.toLowerCase()) && attr(i, "class", i_class_value), dirty & /*profile*/
      1 && t_value !== (t_value = /*range*/
      ctx2[4].val + "") && set_data(t, t_value), dirty & /*profile*/
      1 && span_data_tooltip_value !== (span_data_tooltip_value = /*range*/
      ctx2[4].type) && attr(span, "data-tooltip", span_data_tooltip_value);
    },
    d(detaching) {
      detaching && detach(span);
    }
  };
}
__name(create_each_block_1$3, "create_each_block_1$3");
function create_if_block$6(ctx) {
  let span, t1, div, each_value = (
    /*profile*/
    ctx[0].damage
  ), each_blocks = [];
  for (let i = 0; i < each_value.length; i += 1)
    each_blocks[i] = create_each_block$7(get_each_context$7(ctx, each_value, i));
  return {
    c() {
      span = element("span"), span.textContent = "//", t1 = space(), div = element("div");
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      attr(span, "class", "mini-weapon-profile-separator"), attr(div, "class", "mini-weapon-profile-damage flexrow");
    },
    m(target, anchor) {
      insert(target, span, anchor), insert(target, t1, anchor), insert(target, div, anchor);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(div, null);
    },
    p(ctx2, dirty) {
      if (dirty & /*profile*/
      1) {
        each_value = /*profile*/
        ctx2[0].damage;
        let i;
        for (i = 0; i < each_value.length; i += 1) {
          const child_ctx = get_each_context$7(ctx2, each_value, i);
          each_blocks[i] ? each_blocks[i].p(child_ctx, dirty) : (each_blocks[i] = create_each_block$7(child_ctx), each_blocks[i].c(), each_blocks[i].m(div, null));
        }
        for (; i < each_blocks.length; i += 1)
          each_blocks[i].d(1);
        each_blocks.length = each_value.length;
      }
    },
    d(detaching) {
      detaching && detach(span), detaching && detach(t1), detaching && detach(div), destroy_each(each_blocks, detaching);
    }
  };
}
__name(create_if_block$6, "create_if_block$6");
function create_each_block$7(ctx) {
  let span, i, i_class_value, t_value = (
    /*damage*/
    ctx[1].val + ""
  ), t, span_data_tooltip_value;
  return {
    c() {
      span = element("span"), i = element("i"), t = text(t_value), attr(i, "class", i_class_value = "cci cci-" + /*damage*/
      ctx[1].type.toLowerCase() + " damage--" + /*damage*/
      ctx[1].type.toLowerCase()), attr(span, "data-tooltip", span_data_tooltip_value = /*damage*/
      ctx[1].type);
    },
    m(target, anchor) {
      insert(target, span, anchor), append(span, i), append(span, t);
    },
    p(ctx2, dirty) {
      dirty & /*profile*/
      1 && i_class_value !== (i_class_value = "cci cci-" + /*damage*/
      ctx2[1].type.toLowerCase() + " damage--" + /*damage*/
      ctx2[1].type.toLowerCase()) && attr(i, "class", i_class_value), dirty & /*profile*/
      1 && t_value !== (t_value = /*damage*/
      ctx2[1].val + "") && set_data(t, t_value), dirty & /*profile*/
      1 && span_data_tooltip_value !== (span_data_tooltip_value = /*damage*/
      ctx2[1].type) && attr(span, "data-tooltip", span_data_tooltip_value);
    },
    d(detaching) {
      detaching && detach(span);
    }
  };
}
__name(create_each_block$7, "create_each_block$7");
function create_fragment$8(ctx) {
  let div1, t0, div0, t1, if_block0 = (
    /*profile*/
    (ctx[0].attack || /*profile*/
    ctx[0].accuracy) && create_if_block_1$3(ctx)
  ), each_value_1 = (
    /*profile*/
    ctx[0].range
  ), each_blocks = [];
  for (let i = 0; i < each_value_1.length; i += 1)
    each_blocks[i] = create_each_block_1$3(get_each_context_1$3(ctx, each_value_1, i));
  let if_block1 = (
    /*profile*/
    ctx[0].damage && create_if_block$6(ctx)
  );
  return {
    c() {
      div1 = element("div"), if_block0 && if_block0.c(), t0 = space(), div0 = element("div");
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      t1 = space(), if_block1 && if_block1.c(), attr(div0, "class", "mini-weapon-profile-range flexrow"), attr(div1, "class", "mini-weapon-profile flexrow");
    },
    m(target, anchor) {
      insert(target, div1, anchor), if_block0 && if_block0.m(div1, null), append(div1, t0), append(div1, div0);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(div0, null);
      append(div1, t1), if_block1 && if_block1.m(div1, null);
    },
    p(ctx2, [dirty]) {
      if (/*profile*/
      ctx2[0].attack || /*profile*/
      ctx2[0].accuracy ? if_block0 ? if_block0.p(ctx2, dirty) : (if_block0 = create_if_block_1$3(ctx2), if_block0.c(), if_block0.m(div1, t0)) : if_block0 && (if_block0.d(1), if_block0 = null), dirty & /*profile*/
      1) {
        each_value_1 = /*profile*/
        ctx2[0].range;
        let i;
        for (i = 0; i < each_value_1.length; i += 1) {
          const child_ctx = get_each_context_1$3(ctx2, each_value_1, i);
          each_blocks[i] ? each_blocks[i].p(child_ctx, dirty) : (each_blocks[i] = create_each_block_1$3(child_ctx), each_blocks[i].c(), each_blocks[i].m(div0, null));
        }
        for (; i < each_blocks.length; i += 1)
          each_blocks[i].d(1);
        each_blocks.length = each_value_1.length;
      }
      /*profile*/
      ctx2[0].damage ? if_block1 ? if_block1.p(ctx2, dirty) : (if_block1 = create_if_block$6(ctx2), if_block1.c(), if_block1.m(div1, null)) : if_block1 && (if_block1.d(1), if_block1 = null);
    },
    i: noop,
    o: noop,
    d(detaching) {
      detaching && detach(div1), if_block0 && if_block0.d(), destroy_each(each_blocks, detaching), if_block1 && if_block1.d();
    }
  };
}
__name(create_fragment$8, "create_fragment$8");
function instance$8($$self, $$props, $$invalidate) {
  let { profile } = $$props;
  return $$self.$$set = ($$props2) => {
    "profile" in $$props2 && $$invalidate(0, profile = $$props2.profile);
  }, [profile];
}
__name(instance$8, "instance$8");
const _MiniProfile = class _MiniProfile extends SvelteComponent {
  constructor(options) {
    super(), init(this, options, instance$8, create_fragment$8, safe_not_equal, { profile: 0 });
  }
};
__name(_MiniProfile, "MiniProfile");
let MiniProfile = _MiniProfile;
const MiniProfile$1 = MiniProfile;
function create_fragment$7(ctx) {
  let button0, t0, label, strong0, t2, strong1, span, t3_value = Math.abs(
    /*value*/
    ctx[0]
  ) + "", t3, t4, i1, t5, input, t6, button1, mounted, dispose;
  return {
    c() {
      button0 = element("button"), button0.innerHTML = '<i class="cci cci-accuracy i--sm"></i>', t0 = space(), label = element("label"), strong0 = element("strong"), strong0.textContent = "Manual Adjust", t2 = space(), strong1 = element("strong"), span = element("span"), t3 = text(t3_value), t4 = space(), i1 = element("i"), t5 = space(), input = element("input"), t6 = space(), button1 = element("button"), button1.innerHTML = '<i class="cci cci-difficulty i--sm"></i>', attr(button0, "class", "lancer-button dec-set svelte-190rr8v"), attr(button0, "type", "button"), attr(button0, "data-tooltip", "Add global accuracy"), set_style(strong0, "text-wrap", "nowrap"), attr(i1, "class", "i--sm cci"), toggle_class(
        i1,
        "cci-accuracy",
        /*value*/
        ctx[0] >= 0
      ), toggle_class(
        i1,
        "cci-difficulty",
        /*value*/
        ctx[0] < 0
      ), attr(strong1, "class", "accdiff-value svelte-190rr8v"), attr(
        label,
        "for",
        /*id*/
        ctx[1]
      ), attr(label, "class", "flexcol svelte-190rr8v"), attr(label, "data-tooltip", "Global Accuracy/Difficulty Adjustment"), attr(
        input,
        "id",
        /*id*/
        ctx[1]
      ), attr(input, "class", "difficulty lancer-invisible-input dec-set"), set_style(input, "display", "none"), attr(input, "type", "number"), attr(button1, "class", "lancer-button dec-set svelte-190rr8v"), attr(button1, "type", "button"), attr(button1, "data-tooltip", "Add global difficulty");
    },
    m(target, anchor) {
      insert(target, button0, anchor), insert(target, t0, anchor), insert(target, label, anchor), append(label, strong0), append(label, t2), append(label, strong1), append(strong1, span), append(span, t3), append(strong1, t4), append(strong1, i1), insert(target, t5, anchor), insert(target, input, anchor), set_input_value(
        input,
        /*value*/
        ctx[0]
      ), insert(target, t6, anchor), insert(target, button1, anchor), mounted || (dispose = [
        listen(
          button0,
          "click",
          /*click_handler*/
          ctx[2]
        ),
        listen(
          input,
          "input",
          /*input_input_handler*/
          ctx[3]
        ),
        listen(
          button1,
          "click",
          /*click_handler_1*/
          ctx[4]
        )
      ], mounted = !0);
    },
    p(ctx2, [dirty]) {
      dirty & /*value*/
      1 && t3_value !== (t3_value = Math.abs(
        /*value*/
        ctx2[0]
      ) + "") && set_data(t3, t3_value), dirty & /*value*/
      1 && toggle_class(
        i1,
        "cci-accuracy",
        /*value*/
        ctx2[0] >= 0
      ), dirty & /*value*/
      1 && toggle_class(
        i1,
        "cci-difficulty",
        /*value*/
        ctx2[0] < 0
      ), dirty & /*id*/
      2 && attr(
        label,
        "for",
        /*id*/
        ctx2[1]
      ), dirty & /*id*/
      2 && attr(
        input,
        "id",
        /*id*/
        ctx2[1]
      ), dirty & /*value*/
      1 && to_number(input.value) !== /*value*/
      ctx2[0] && set_input_value(
        input,
        /*value*/
        ctx2[0]
      );
    },
    i: noop,
    o: noop,
    d(detaching) {
      detaching && detach(button0), detaching && detach(t0), detaching && detach(label), detaching && detach(t5), detaching && detach(input), detaching && detach(t6), detaching && detach(button1), mounted = !1, run_all(dispose);
    }
  };
}
__name(create_fragment$7, "create_fragment$7");
function instance$7($$self, $$props, $$invalidate) {
  let { value = 0 } = $$props, { id } = $$props;
  const click_handler = /* @__PURE__ */ __name(() => $$invalidate(0, value = value + 1), "click_handler");
  function input_input_handler() {
    value = to_number(this.value), $$invalidate(0, value);
  }
  __name(input_input_handler, "input_input_handler");
  const click_handler_1 = /* @__PURE__ */ __name(() => $$invalidate(0, value = value - 1), "click_handler_1");
  return $$self.$$set = ($$props2) => {
    "value" in $$props2 && $$invalidate(0, value = $$props2.value), "id" in $$props2 && $$invalidate(1, id = $$props2.id);
  }, [value, id, click_handler, input_input_handler, click_handler_1];
}
__name(instance$7, "instance$7");
const _AccDiffInput = class _AccDiffInput extends SvelteComponent {
  constructor(options) {
    super(), init(this, options, instance$7, create_fragment$7, safe_not_equal, { value: 0, id: 1 });
  }
};
__name(_AccDiffInput, "AccDiffInput");
let AccDiffInput = _AccDiffInput;
const AccDiffInput$1 = AccDiffInput;
function get_each_context$6(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[55] = list[i], child_ctx[56] = list, child_ctx[57] = i, child_ctx;
}
__name(get_each_context$6, "get_each_context$6");
function get_each_context_1$2(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[58] = list[i], child_ctx;
}
__name(get_each_context_1$2, "get_each_context_1$2");
function get_each_context_2$1(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[61] = list[i], child_ctx;
}
__name(get_each_context_2$1, "get_each_context_2$1");
function get_each_context_3$1(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[61] = list[i], child_ctx;
}
__name(get_each_context_3$1, "get_each_context_3$1");
function get_each_context_4$1(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[61] = list[i], child_ctx;
}
__name(get_each_context_4$1, "get_each_context_4$1");
function get_each_context_5(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[61] = list[i], child_ctx;
}
__name(get_each_context_5, "get_each_context_5");
function create_if_block_15(ctx) {
  let div, t0, span, t1, t2;
  function select_block_type(ctx2, dirty) {
    if (
      /*kind*/
      ctx2[4] == "attack"
    )
      return create_if_block_16;
    if (
      /*kind*/
      ctx2[4] == "hase"
    )
      return create_if_block_18;
  }
  __name(select_block_type, "select_block_type");
  let current_block_type = select_block_type(ctx), if_block = current_block_type && current_block_type(ctx);
  return {
    c() {
      div = element("div"), if_block && if_block.c(), t0 = space(), span = element("span"), t1 = text(
        /*title*/
        ctx[3]
      ), t2 = text(
        /*rollerName*/
        ctx[14]
      ), attr(span, "class", "svelte-k5ear2"), attr(div, "class", "lancer-header " + /*isTech*/
      (ctx[18]() ? "lancer-tech" : "lancer-weapon") + " medium");
    },
    m(target, anchor) {
      insert(target, div, anchor), if_block && if_block.m(div, null), append(div, t0), append(div, span), append(span, t1), append(span, t2);
    },
    p(ctx2, dirty) {
      current_block_type === (current_block_type = select_block_type(ctx2)) && if_block ? if_block.p(ctx2, dirty) : (if_block && if_block.d(1), if_block = current_block_type && current_block_type(ctx2), if_block && (if_block.c(), if_block.m(div, t0))), dirty[0] & /*title*/
      8 && set_data(
        t1,
        /*title*/
        ctx2[3]
      );
    },
    d(detaching) {
      detaching && detach(div), if_block && if_block.d();
    }
  };
}
__name(create_if_block_15, "create_if_block_15");
function create_if_block_18(ctx) {
  let i;
  return {
    c() {
      i = element("i"), attr(i, "class", "fas fa-dice-d20 i--m i--light");
    },
    m(target, anchor) {
      insert(target, i, anchor);
    },
    p: noop,
    d(detaching) {
      detaching && detach(i);
    }
  };
}
__name(create_if_block_18, "create_if_block_18");
function create_if_block_16(ctx) {
  let if_block_anchor;
  function select_block_type_1(ctx2, dirty) {
    return (
      /*isTech*/
      ctx2[18]() ? create_if_block_17 : create_else_block_2
    );
  }
  __name(select_block_type_1, "select_block_type_1");
  let if_block = select_block_type_1(ctx)(ctx);
  return {
    c() {
      if_block.c(), if_block_anchor = empty();
    },
    m(target, anchor) {
      if_block.m(target, anchor), insert(target, if_block_anchor, anchor);
    },
    p: noop,
    d(detaching) {
      if_block.d(detaching), detaching && detach(if_block_anchor);
    }
  };
}
__name(create_if_block_16, "create_if_block_16");
function create_else_block_2(ctx) {
  let i;
  return {
    c() {
      i = element("i"), attr(i, "class", "cci cci-weapon i--m i--light");
    },
    m(target, anchor) {
      insert(target, i, anchor);
    },
    d(detaching) {
      detaching && detach(i);
    }
  };
}
__name(create_else_block_2, "create_else_block_2");
function create_if_block_17(ctx) {
  let i;
  return {
    c() {
      i = element("i"), attr(i, "class", "cci cci-tech-quick i--m i--light");
    },
    m(target, anchor) {
      insert(target, i, anchor);
    },
    d(detaching) {
      detaching && detach(i);
    }
  };
}
__name(create_if_block_17, "create_if_block_17");
function create_if_block_14(ctx) {
  let miniprofile, current;
  return miniprofile = new MiniProfile$1({ props: { profile: (
    /*profile*/
    ctx[12]
  ) } }), {
    c() {
      create_component(miniprofile.$$.fragment);
    },
    m(target, anchor) {
      mount_component(miniprofile, target, anchor), current = !0;
    },
    p(ctx2, dirty) {
      const miniprofile_changes = {};
      dirty[0] & /*profile*/
      4096 && (miniprofile_changes.profile = /*profile*/
      ctx2[12]), miniprofile.$set(miniprofile_changes);
    },
    i(local) {
      current || (transition_in(miniprofile.$$.fragment, local), current = !0);
    },
    o(local) {
      transition_out(miniprofile.$$.fragment, local), current = !1;
    },
    d(detaching) {
      destroy_component(miniprofile, detaching);
    }
  };
}
__name(create_if_block_14, "create_if_block_14");
function create_if_block_13(ctx) {
  let label, t1, div3, div0, span0, b0, t4, t5_value = flatSign(
    /*base*/
    ctx[1].grit
  ) + "", t5, t6_value = (
    /*base*/
    ctx[1].grit + ""
  ), t6, t7, div1, input, t8, button0, t9, button1, t10, div2, span1, b1, t12, t13_value = flatSign(
    /*flatTotal*/
    ctx[10]
  ) + "", t13, t14, mounted, dispose;
  return {
    c() {
      label = element("label"), label.textContent = "Flat Modifier", t1 = space(), div3 = element("div"), div0 = element("div"), span0 = element("span"), b0 = element("b"), b0.textContent = `${/*gritLabel*/
      ctx[19]()}:`, t4 = space(), t5 = text(t5_value), t6 = text(t6_value), t7 = space(), div1 = element("div"), input = element("input"), t8 = space(), button0 = element("button"), button0.innerHTML = '<i class="fas fa-plus svelte-k5ear2"></i>', t9 = space(), button1 = element("button"), button1.innerHTML = '<i class="fas fa-minus svelte-k5ear2"></i>', t10 = space(), div2 = element("div"), span1 = element("span"), b1 = element("b"), b1.textContent = "Total:", t12 = space(), t13 = text(t13_value), t14 = text(
        /*flatTotal*/
        ctx[10]
      ), attr(label, "class", "flexrow accdiff-weight lancer-border-primary"), attr(label, "for", "accdiff-flat-bonus"), attr(span0, "class", "svelte-k5ear2"), attr(div0, "class", "accdiff-other-grid svelte-k5ear2"), attr(input, "class", "accdiff-flat-mod__input svelte-k5ear2"), attr(input, "type", "number"), attr(button0, "class", "accdiff-flat-mod__plus svelte-k5ear2"), attr(button0, "type", "button"), attr(button1, "class", "accdiff-flat-mod__minus svelte-k5ear2"), attr(button1, "type", "button"), attr(div1, "class", "accdiff-other-grid accdiff-flat-mod svelte-k5ear2"), set_style(div1, "position", "relative"), attr(span1, "class", "svelte-k5ear2"), attr(div2, "class", "accdiff-other-grid svelte-k5ear2"), attr(div3, "class", "accdiff-grid accdiff-flat-bonus svelte-k5ear2");
    },
    m(target, anchor) {
      insert(target, label, anchor), insert(target, t1, anchor), insert(target, div3, anchor), append(div3, div0), append(div0, span0), append(span0, b0), append(span0, t4), append(span0, t5), append(span0, t6), append(div3, t7), append(div3, div1), append(div1, input), set_input_value(
        input,
        /*base*/
        ctx[1].flatBonus
      ), append(div1, t8), append(div1, button0), append(div1, t9), append(div1, button1), append(div3, t10), append(div3, div2), append(div2, span1), append(span1, b1), append(span1, t12), append(span1, t13), append(span1, t14), mounted || (dispose = [
        listen(
          input,
          "input",
          /*input_input_handler*/
          ctx[23]
        ),
        listen(
          button0,
          "click",
          /*click_handler*/
          ctx[24]
        ),
        listen(
          button1,
          "click",
          /*click_handler_1*/
          ctx[25]
        )
      ], mounted = !0);
    },
    p(ctx2, dirty) {
      dirty[0] & /*base*/
      2 && t5_value !== (t5_value = flatSign(
        /*base*/
        ctx2[1].grit
      ) + "") && set_data(t5, t5_value), dirty[0] & /*base*/
      2 && t6_value !== (t6_value = /*base*/
      ctx2[1].grit + "") && set_data(t6, t6_value), dirty[0] & /*base*/
      2 && to_number(input.value) !== /*base*/
      ctx2[1].flatBonus && set_input_value(
        input,
        /*base*/
        ctx2[1].flatBonus
      ), dirty[0] & /*flatTotal*/
      1024 && t13_value !== (t13_value = flatSign(
        /*flatTotal*/
        ctx2[10]
      ) + "") && set_data(t13, t13_value), dirty[0] & /*flatTotal*/
      1024 && set_data(
        t14,
        /*flatTotal*/
        ctx2[10]
      );
    },
    d(detaching) {
      detaching && detach(label), detaching && detach(t1), detaching && detach(div3), mounted = !1, run_all(dispose);
    }
  };
}
__name(create_if_block_13, "create_if_block_13");
function create_if_block_12(ctx) {
  let hudcheckbox, updating_value, t, each_1_anchor, current;
  function hudcheckbox_value_binding(value) {
    ctx[27](value);
  }
  __name(hudcheckbox_value_binding, "hudcheckbox_value_binding");
  let hudcheckbox_props = { label: "Seeking (*)" };
  /*weapon*/
  ctx[0].seeking !== void 0 && (hudcheckbox_props.value = /*weapon*/
  ctx[0].seeking), hudcheckbox = new HudCheckbox$1({ props: hudcheckbox_props }), binding_callbacks.push(() => bind(hudcheckbox, "value", hudcheckbox_value_binding));
  let each_value_5 = (
    /*accWeaponPlugins*/
    ctx[9]
  ), each_blocks = [];
  for (let i = 0; i < each_value_5.length; i += 1)
    each_blocks[i] = create_each_block_5(get_each_context_5(ctx, each_value_5, i));
  const out = /* @__PURE__ */ __name((i) => transition_out(each_blocks[i], 1, 1, () => {
    each_blocks[i] = null;
  }), "out");
  return {
    c() {
      create_component(hudcheckbox.$$.fragment), t = space();
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      each_1_anchor = empty();
    },
    m(target, anchor) {
      mount_component(hudcheckbox, target, anchor), insert(target, t, anchor);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(target, anchor);
      insert(target, each_1_anchor, anchor), current = !0;
    },
    p(ctx2, dirty) {
      const hudcheckbox_changes = {};
      if (!updating_value && dirty[0] & /*weapon*/
      1 && (updating_value = !0, hudcheckbox_changes.value = /*weapon*/
      ctx2[0].seeking, add_flush_callback(() => updating_value = !1)), hudcheckbox.$set(hudcheckbox_changes), dirty[0] & /*accWeaponPlugins*/
      512) {
        each_value_5 = /*accWeaponPlugins*/
        ctx2[9];
        let i;
        for (i = 0; i < each_value_5.length; i += 1) {
          const child_ctx = get_each_context_5(ctx2, each_value_5, i);
          each_blocks[i] ? (each_blocks[i].p(child_ctx, dirty), transition_in(each_blocks[i], 1)) : (each_blocks[i] = create_each_block_5(child_ctx), each_blocks[i].c(), transition_in(each_blocks[i], 1), each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor));
        }
        for (group_outros(), i = each_value_5.length; i < each_blocks.length; i += 1)
          out(i);
        check_outros();
      }
    },
    i(local) {
      if (!current) {
        transition_in(hudcheckbox.$$.fragment, local);
        for (let i = 0; i < each_value_5.length; i += 1)
          transition_in(each_blocks[i]);
        current = !0;
      }
    },
    o(local) {
      transition_out(hudcheckbox.$$.fragment, local), each_blocks = each_blocks.filter(Boolean);
      for (let i = 0; i < each_blocks.length; i += 1)
        transition_out(each_blocks[i]);
      current = !1;
    },
    d(detaching) {
      destroy_component(hudcheckbox, detaching), detaching && detach(t), destroy_each(each_blocks, detaching), detaching && detach(each_1_anchor);
    }
  };
}
__name(create_if_block_12, "create_if_block_12");
function create_each_block_5(ctx) {
  let plugin, current;
  return plugin = new Plugin$1({ props: { data: (
    /*plugin*/
    ctx[61]
  ) } }), {
    c() {
      create_component(plugin.$$.fragment);
    },
    m(target, anchor) {
      mount_component(plugin, target, anchor), current = !0;
    },
    p(ctx2, dirty) {
      const plugin_changes = {};
      dirty[0] & /*accWeaponPlugins*/
      512 && (plugin_changes.data = /*plugin*/
      ctx2[61]), plugin.$set(plugin_changes);
    },
    i(local) {
      current || (transition_in(plugin.$$.fragment, local), current = !0);
    },
    o(local) {
      transition_out(plugin.$$.fragment, local), current = !1;
    },
    d(detaching) {
      destroy_component(plugin, detaching);
    }
  };
}
__name(create_each_block_5, "create_each_block_5");
function create_if_block_11(ctx) {
  let hudcheckbox, updating_value, t, each_1_anchor, current;
  function hudcheckbox_value_binding_1(value) {
    ctx[29](value);
  }
  __name(hudcheckbox_value_binding_1, "hudcheckbox_value_binding_1");
  let hudcheckbox_props = { label: "Engaged (-1)" };
  /*weapon*/
  ctx[0].engaged !== void 0 && (hudcheckbox_props.value = /*weapon*/
  ctx[0].engaged), hudcheckbox = new HudCheckbox$1({ props: hudcheckbox_props }), binding_callbacks.push(() => bind(hudcheckbox, "value", hudcheckbox_value_binding_1));
  let each_value_4 = (
    /*diffWeaponPlugins*/
    ctx[8]
  ), each_blocks = [];
  for (let i = 0; i < each_value_4.length; i += 1)
    each_blocks[i] = create_each_block_4$1(get_each_context_4$1(ctx, each_value_4, i));
  const out = /* @__PURE__ */ __name((i) => transition_out(each_blocks[i], 1, 1, () => {
    each_blocks[i] = null;
  }), "out");
  return {
    c() {
      create_component(hudcheckbox.$$.fragment), t = space();
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      each_1_anchor = empty();
    },
    m(target, anchor) {
      mount_component(hudcheckbox, target, anchor), insert(target, t, anchor);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(target, anchor);
      insert(target, each_1_anchor, anchor), current = !0;
    },
    p(ctx2, dirty) {
      const hudcheckbox_changes = {};
      if (!updating_value && dirty[0] & /*weapon*/
      1 && (updating_value = !0, hudcheckbox_changes.value = /*weapon*/
      ctx2[0].engaged, add_flush_callback(() => updating_value = !1)), hudcheckbox.$set(hudcheckbox_changes), dirty[0] & /*diffWeaponPlugins*/
      256) {
        each_value_4 = /*diffWeaponPlugins*/
        ctx2[8];
        let i;
        for (i = 0; i < each_value_4.length; i += 1) {
          const child_ctx = get_each_context_4$1(ctx2, each_value_4, i);
          each_blocks[i] ? (each_blocks[i].p(child_ctx, dirty), transition_in(each_blocks[i], 1)) : (each_blocks[i] = create_each_block_4$1(child_ctx), each_blocks[i].c(), transition_in(each_blocks[i], 1), each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor));
        }
        for (group_outros(), i = each_value_4.length; i < each_blocks.length; i += 1)
          out(i);
        check_outros();
      }
    },
    i(local) {
      if (!current) {
        transition_in(hudcheckbox.$$.fragment, local);
        for (let i = 0; i < each_value_4.length; i += 1)
          transition_in(each_blocks[i]);
        current = !0;
      }
    },
    o(local) {
      transition_out(hudcheckbox.$$.fragment, local), each_blocks = each_blocks.filter(Boolean);
      for (let i = 0; i < each_blocks.length; i += 1)
        transition_out(each_blocks[i]);
      current = !1;
    },
    d(detaching) {
      destroy_component(hudcheckbox, detaching), detaching && detach(t), destroy_each(each_blocks, detaching), detaching && detach(each_1_anchor);
    }
  };
}
__name(create_if_block_11, "create_if_block_11");
function create_each_block_4$1(ctx) {
  let plugin, current;
  return plugin = new Plugin$1({ props: { data: (
    /*plugin*/
    ctx[61]
  ) } }), {
    c() {
      create_component(plugin.$$.fragment);
    },
    m(target, anchor) {
      mount_component(plugin, target, anchor), current = !0;
    },
    p(ctx2, dirty) {
      const plugin_changes = {};
      dirty[0] & /*diffWeaponPlugins*/
      256 && (plugin_changes.data = /*plugin*/
      ctx2[61]), plugin.$set(plugin_changes);
    },
    i(local) {
      current || (transition_in(plugin.$$.fragment, local), current = !0);
    },
    o(local) {
      transition_out(plugin.$$.fragment, local), current = !1;
    },
    d(detaching) {
      destroy_component(plugin, detaching);
    }
  };
}
__name(create_each_block_4$1, "create_each_block_4$1");
function create_if_block_6(ctx) {
  let div2, div0, t0, div1, t1, show_if = !/*isTech*/
  ctx[18](), div2_transition, current, if_block0 = (
    /*targets*/
    ctx[2].length == 1 && create_if_block_10(ctx)
  ), each_value_2 = (
    /*diffTargetPlugins*/
    ctx[6]
  ), each_blocks = [];
  for (let i = 0; i < each_value_2.length; i += 1)
    each_blocks[i] = create_each_block_2$1(get_each_context_2$1(ctx, each_value_2, i));
  const out = /* @__PURE__ */ __name((i) => transition_out(each_blocks[i], 1, 1, () => {
    each_blocks[i] = null;
  }), "out");
  let if_block1 = show_if && create_if_block_7(ctx);
  return {
    c() {
      div2 = element("div"), div0 = element("div"), if_block0 && if_block0.c(), t0 = space(), div1 = element("div");
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      t1 = space(), if_block1 && if_block1.c(), attr(div0, "class", "accdiff-grid__column svelte-k5ear2"), attr(div1, "class", "accdiff-grid__column svelte-k5ear2"), attr(div2, "class", "accdiff-grid accdiff-grid__section svelte-k5ear2"), set_style(div2, "width", "100%");
    },
    m(target, anchor) {
      insert(target, div2, anchor), append(div2, div0), if_block0 && if_block0.m(div0, null), append(div2, t0), append(div2, div1);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(div1, null);
      append(div1, t1), if_block1 && if_block1.m(div1, null), current = !0;
    },
    p(ctx2, dirty) {
      if (/*targets*/
      ctx2[2].length == 1 ? if_block0 ? (if_block0.p(ctx2, dirty), dirty[0] & /*targets*/
      4 && transition_in(if_block0, 1)) : (if_block0 = create_if_block_10(ctx2), if_block0.c(), transition_in(if_block0, 1), if_block0.m(div0, null)) : if_block0 && (group_outros(), transition_out(if_block0, 1, 1, () => {
        if_block0 = null;
      }), check_outros()), dirty[0] & /*diffTargetPlugins*/
      64) {
        each_value_2 = /*diffTargetPlugins*/
        ctx2[6];
        let i;
        for (i = 0; i < each_value_2.length; i += 1) {
          const child_ctx = get_each_context_2$1(ctx2, each_value_2, i);
          each_blocks[i] ? (each_blocks[i].p(child_ctx, dirty), transition_in(each_blocks[i], 1)) : (each_blocks[i] = create_each_block_2$1(child_ctx), each_blocks[i].c(), transition_in(each_blocks[i], 1), each_blocks[i].m(div1, t1));
        }
        for (group_outros(), i = each_value_2.length; i < each_blocks.length; i += 1)
          out(i);
        check_outros();
      }
      show_if && if_block1.p(ctx2, dirty);
    },
    i(local) {
      if (!current) {
        transition_in(if_block0);
        for (let i = 0; i < each_value_2.length; i += 1)
          transition_in(each_blocks[i]);
        transition_in(if_block1), add_render_callback(() => {
          current && (div2_transition || (div2_transition = create_bidirectional_transition(div2, slide, {}, !0)), div2_transition.run(1));
        }), current = !0;
      }
    },
    o(local) {
      transition_out(if_block0), each_blocks = each_blocks.filter(Boolean);
      for (let i = 0; i < each_blocks.length; i += 1)
        transition_out(each_blocks[i]);
      transition_out(if_block1), div2_transition || (div2_transition = create_bidirectional_transition(div2, slide, {}, !1)), div2_transition.run(0), current = !1;
    },
    d(detaching) {
      detaching && detach(div2), if_block0 && if_block0.d(), destroy_each(each_blocks, detaching), if_block1 && if_block1.d(), detaching && div2_transition && div2_transition.end();
    }
  };
}
__name(create_if_block_6, "create_if_block_6");
function create_if_block_10(ctx) {
  let hudcheckbox0, updating_value, t0, hudcheckbox1, updating_value_1, t1, hudcheckbox2, updating_value_2, t2, each_1_anchor, current;
  function hudcheckbox0_value_binding_1(value) {
    ctx[30](value);
  }
  __name(hudcheckbox0_value_binding_1, "hudcheckbox0_value_binding_1");
  let hudcheckbox0_props = {
    style: "grid-area: prone;",
    label: "Prone (+1)",
    disabled: !0
  };
  /*targets*/
  ctx[2][0].prone !== void 0 && (hudcheckbox0_props.value = /*targets*/
  ctx[2][0].prone), hudcheckbox0 = new HudCheckbox$1({ props: hudcheckbox0_props }), binding_callbacks.push(() => bind(hudcheckbox0, "value", hudcheckbox0_value_binding_1));
  function hudcheckbox1_value_binding_1(value) {
    ctx[31](value);
  }
  __name(hudcheckbox1_value_binding_1, "hudcheckbox1_value_binding_1");
  let hudcheckbox1_props = { label: "Stunned (EVA=5)", disabled: !0 };
  /*targets*/
  ctx[2][0].stunned !== void 0 && (hudcheckbox1_props.value = /*targets*/
  ctx[2][0].stunned), hudcheckbox1 = new HudCheckbox$1({ props: hudcheckbox1_props }), binding_callbacks.push(() => bind(hudcheckbox1, "value", hudcheckbox1_value_binding_1));
  function hudcheckbox2_value_binding(value) {
    ctx[32](value);
  }
  __name(hudcheckbox2_value_binding, "hudcheckbox2_value_binding");
  let hudcheckbox2_props = {
    style: "grid-area: lock-on;",
    label: "Lock On (+1)",
    checked: !!/*targets*/
    ctx[2][0].usingLockOn,
    disabled: !/*targets*/
    ctx[2][0].lockOnAvailable
  };
  /*targets*/
  ctx[2][0].consumeLockOn !== void 0 && (hudcheckbox2_props.value = /*targets*/
  ctx[2][0].consumeLockOn), hudcheckbox2 = new HudCheckbox$1({ props: hudcheckbox2_props }), binding_callbacks.push(() => bind(hudcheckbox2, "value", hudcheckbox2_value_binding));
  let each_value_3 = (
    /*accTargetPlugins*/
    ctx[7]
  ), each_blocks = [];
  for (let i = 0; i < each_value_3.length; i += 1)
    each_blocks[i] = create_each_block_3$1(get_each_context_3$1(ctx, each_value_3, i));
  const out = /* @__PURE__ */ __name((i) => transition_out(each_blocks[i], 1, 1, () => {
    each_blocks[i] = null;
  }), "out");
  return {
    c() {
      create_component(hudcheckbox0.$$.fragment), t0 = space(), create_component(hudcheckbox1.$$.fragment), t1 = space(), create_component(hudcheckbox2.$$.fragment), t2 = space();
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      each_1_anchor = empty();
    },
    m(target, anchor) {
      mount_component(hudcheckbox0, target, anchor), insert(target, t0, anchor), mount_component(hudcheckbox1, target, anchor), insert(target, t1, anchor), mount_component(hudcheckbox2, target, anchor), insert(target, t2, anchor);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(target, anchor);
      insert(target, each_1_anchor, anchor), current = !0;
    },
    p(ctx2, dirty) {
      const hudcheckbox0_changes = {};
      !updating_value && dirty[0] & /*targets*/
      4 && (updating_value = !0, hudcheckbox0_changes.value = /*targets*/
      ctx2[2][0].prone, add_flush_callback(() => updating_value = !1)), hudcheckbox0.$set(hudcheckbox0_changes);
      const hudcheckbox1_changes = {};
      !updating_value_1 && dirty[0] & /*targets*/
      4 && (updating_value_1 = !0, hudcheckbox1_changes.value = /*targets*/
      ctx2[2][0].stunned, add_flush_callback(() => updating_value_1 = !1)), hudcheckbox1.$set(hudcheckbox1_changes);
      const hudcheckbox2_changes = {};
      if (dirty[0] & /*targets*/
      4 && (hudcheckbox2_changes.checked = !!/*targets*/
      ctx2[2][0].usingLockOn), dirty[0] & /*targets*/
      4 && (hudcheckbox2_changes.disabled = !/*targets*/
      ctx2[2][0].lockOnAvailable), !updating_value_2 && dirty[0] & /*targets*/
      4 && (updating_value_2 = !0, hudcheckbox2_changes.value = /*targets*/
      ctx2[2][0].consumeLockOn, add_flush_callback(() => updating_value_2 = !1)), hudcheckbox2.$set(hudcheckbox2_changes), dirty[0] & /*accTargetPlugins*/
      128) {
        each_value_3 = /*accTargetPlugins*/
        ctx2[7];
        let i;
        for (i = 0; i < each_value_3.length; i += 1) {
          const child_ctx = get_each_context_3$1(ctx2, each_value_3, i);
          each_blocks[i] ? (each_blocks[i].p(child_ctx, dirty), transition_in(each_blocks[i], 1)) : (each_blocks[i] = create_each_block_3$1(child_ctx), each_blocks[i].c(), transition_in(each_blocks[i], 1), each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor));
        }
        for (group_outros(), i = each_value_3.length; i < each_blocks.length; i += 1)
          out(i);
        check_outros();
      }
    },
    i(local) {
      if (!current) {
        transition_in(hudcheckbox0.$$.fragment, local), transition_in(hudcheckbox1.$$.fragment, local), transition_in(hudcheckbox2.$$.fragment, local);
        for (let i = 0; i < each_value_3.length; i += 1)
          transition_in(each_blocks[i]);
        current = !0;
      }
    },
    o(local) {
      transition_out(hudcheckbox0.$$.fragment, local), transition_out(hudcheckbox1.$$.fragment, local), transition_out(hudcheckbox2.$$.fragment, local), each_blocks = each_blocks.filter(Boolean);
      for (let i = 0; i < each_blocks.length; i += 1)
        transition_out(each_blocks[i]);
      current = !1;
    },
    d(detaching) {
      destroy_component(hudcheckbox0, detaching), detaching && detach(t0), destroy_component(hudcheckbox1, detaching), detaching && detach(t1), destroy_component(hudcheckbox2, detaching), detaching && detach(t2), destroy_each(each_blocks, detaching), detaching && detach(each_1_anchor);
    }
  };
}
__name(create_if_block_10, "create_if_block_10");
function create_each_block_3$1(ctx) {
  let plugin, current;
  return plugin = new Plugin$1({ props: { data: (
    /*plugin*/
    ctx[61]
  ) } }), {
    c() {
      create_component(plugin.$$.fragment);
    },
    m(target, anchor) {
      mount_component(plugin, target, anchor), current = !0;
    },
    p(ctx2, dirty) {
      const plugin_changes = {};
      dirty[0] & /*accTargetPlugins*/
      128 && (plugin_changes.data = /*plugin*/
      ctx2[61]), plugin.$set(plugin_changes);
    },
    i(local) {
      current || (transition_in(plugin.$$.fragment, local), current = !0);
    },
    o(local) {
      transition_out(plugin.$$.fragment, local), current = !1;
    },
    d(detaching) {
      destroy_component(plugin, detaching);
    }
  };
}
__name(create_each_block_3$1, "create_each_block_3$1");
function create_each_block_2$1(ctx) {
  let plugin, current;
  return plugin = new Plugin$1({ props: { data: (
    /*plugin*/
    ctx[61]
  ) } }), {
    c() {
      create_component(plugin.$$.fragment);
    },
    m(target, anchor) {
      mount_component(plugin, target, anchor), current = !0;
    },
    p(ctx2, dirty) {
      const plugin_changes = {};
      dirty[0] & /*diffTargetPlugins*/
      64 && (plugin_changes.data = /*plugin*/
      ctx2[61]), plugin.$set(plugin_changes);
    },
    i(local) {
      current || (transition_in(plugin.$$.fragment, local), current = !0);
    },
    o(local) {
      transition_out(plugin.$$.fragment, local), current = !1;
    },
    d(detaching) {
      destroy_component(plugin, detaching);
    }
  };
}
__name(create_each_block_2$1, "create_each_block_2$1");
function create_if_block_7(ctx) {
  let div, current_block_type_index, if_block, current;
  const if_block_creators = [create_if_block_8, create_if_block_9], if_blocks = [];
  function select_block_type_2(ctx2, dirty) {
    return (
      /*targets*/
      ctx2[2].length == 0 ? 0 : (
        /*targets*/
        ctx2[2].length == 1 ? 1 : -1
      )
    );
  }
  return __name(select_block_type_2, "select_block_type_2"), ~(current_block_type_index = select_block_type_2(ctx)) && (if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx)), {
    c() {
      div = element("div"), if_block && if_block.c(), attr(div, "class", "grid-enforcement");
    },
    m(target, anchor) {
      insert(target, div, anchor), ~current_block_type_index && if_blocks[current_block_type_index].m(div, null), current = !0;
    },
    p(ctx2, dirty) {
      let previous_block_index = current_block_type_index;
      current_block_type_index = select_block_type_2(ctx2), current_block_type_index === previous_block_index ? ~current_block_type_index && if_blocks[current_block_type_index].p(ctx2, dirty) : (if_block && (group_outros(), transition_out(if_blocks[previous_block_index], 1, 1, () => {
        if_blocks[previous_block_index] = null;
      }), check_outros()), ~current_block_type_index ? (if_block = if_blocks[current_block_type_index], if_block ? if_block.p(ctx2, dirty) : (if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2), if_block.c()), transition_in(if_block, 1), if_block.m(div, null)) : if_block = null);
    },
    i(local) {
      current || (transition_in(if_block), current = !0);
    },
    o(local) {
      transition_out(if_block), current = !1;
    },
    d(detaching) {
      detaching && detach(div), ~current_block_type_index && if_blocks[current_block_type_index].d();
    }
  };
}
__name(create_if_block_7, "create_if_block_7");
function create_if_block_9(ctx) {
  let div, cover, updating_cover, div_transition, current, mounted, dispose;
  function cover_cover_binding_1(value) {
    ctx[34](value);
  }
  __name(cover_cover_binding_1, "cover_cover_binding_1");
  let cover_props = {
    class: "accdiff-base-cover flexcol",
    disabled: (
      /*weapon*/
      ctx[0].seeking
    )
  };
  return (
    /*targets*/
    ctx[2][0].cover !== void 0 && (cover_props.cover = /*targets*/
    ctx[2][0].cover), cover = new Cover$1({ props: cover_props }), binding_callbacks.push(() => bind(cover, "cover", cover_cover_binding_1)), {
      c() {
        div = element("div"), create_component(cover.$$.fragment);
      },
      m(target, anchor) {
        insert(target, div, anchor), mount_component(cover, div, null), current = !0, mounted || (dispose = [
          listen(
            div,
            "mouseenter",
            /*mouseenter_handler*/
            ctx[35]
          ),
          listen(
            div,
            "mouseleave",
            /*mouseleave_handler*/
            ctx[36]
          )
        ], mounted = !0);
      },
      p(ctx2, dirty) {
        const cover_changes = {};
        dirty[0] & /*weapon*/
        1 && (cover_changes.disabled = /*weapon*/
        ctx2[0].seeking), !updating_cover && dirty[0] & /*targets*/
        4 && (updating_cover = !0, cover_changes.cover = /*targets*/
        ctx2[2][0].cover, add_flush_callback(() => updating_cover = !1)), cover.$set(cover_changes);
      },
      i(local) {
        current || (transition_in(cover.$$.fragment, local), local && add_render_callback(() => {
          current && (div_transition || (div_transition = create_bidirectional_transition(div, slide, {}, !0)), div_transition.run(1));
        }), current = !0);
      },
      o(local) {
        transition_out(cover.$$.fragment, local), local && (div_transition || (div_transition = create_bidirectional_transition(div, slide, {}, !1)), div_transition.run(0)), current = !1;
      },
      d(detaching) {
        detaching && detach(div), destroy_component(cover), detaching && div_transition && div_transition.end(), mounted = !1, run_all(dispose);
      }
    }
  );
}
__name(create_if_block_9, "create_if_block_9");
function create_if_block_8(ctx) {
  let div, cover, updating_cover, div_transition, current;
  function cover_cover_binding(value) {
    ctx[33](value);
  }
  __name(cover_cover_binding, "cover_cover_binding");
  let cover_props = {
    class: "accdiff-base-cover flexcol",
    disabled: (
      /*weapon*/
      ctx[0].seeking
    )
  };
  return (
    /*base*/
    ctx[1].cover !== void 0 && (cover_props.cover = /*base*/
    ctx[1].cover), cover = new Cover$1({ props: cover_props }), binding_callbacks.push(() => bind(cover, "cover", cover_cover_binding)), {
      c() {
        div = element("div"), create_component(cover.$$.fragment);
      },
      m(target, anchor) {
        insert(target, div, anchor), mount_component(cover, div, null), current = !0;
      },
      p(ctx2, dirty) {
        const cover_changes = {};
        dirty[0] & /*weapon*/
        1 && (cover_changes.disabled = /*weapon*/
        ctx2[0].seeking), !updating_cover && dirty[0] & /*base*/
        2 && (updating_cover = !0, cover_changes.cover = /*base*/
        ctx2[1].cover, add_flush_callback(() => updating_cover = !1)), cover.$set(cover_changes);
      },
      i(local) {
        current || (transition_in(cover.$$.fragment, local), local && add_render_callback(() => {
          current && (div_transition || (div_transition = create_bidirectional_transition(div, slide, {}, !0)), div_transition.run(1));
        }), current = !0);
      },
      o(local) {
        transition_out(cover.$$.fragment, local), local && (div_transition || (div_transition = create_bidirectional_transition(div, slide, {}, !1)), div_transition.run(0)), current = !1;
      },
      d(detaching) {
        detaching && detach(div), destroy_component(cover), detaching && div_transition && div_transition.end();
      }
    }
  );
}
__name(create_if_block_8, "create_if_block_8");
function create_if_block_5(ctx) {
  let div1, span, t1, div0, each_value_1 = (
    /*ranges*/
    ctx[11]
  ), each_blocks = [];
  for (let i = 0; i < each_value_1.length; i += 1)
    each_blocks[i] = create_each_block_1$2(get_each_context_1$2(ctx, each_value_1, i));
  return {
    c() {
      div1 = element("div"), span = element("span"), span.textContent = "Targeting", t1 = space(), div0 = element("div");
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      attr(span, "class", "accdiff-weight flex-center flexrow svelte-k5ear2"), attr(div0, "class", "accdiff-ranges flexrow svelte-k5ear2"), attr(div1, "class", "accdiff-grid__section svelte-k5ear2");
    },
    m(target, anchor) {
      insert(target, div1, anchor), append(div1, span), append(div1, t1), append(div1, div0);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(div0, null);
    },
    p(ctx2, dirty) {
      if (dirty[0] & /*deployTemplate, ranges*/
      1050624) {
        each_value_1 = /*ranges*/
        ctx2[11];
        let i;
        for (i = 0; i < each_value_1.length; i += 1) {
          const child_ctx = get_each_context_1$2(ctx2, each_value_1, i);
          each_blocks[i] ? each_blocks[i].p(child_ctx, dirty) : (each_blocks[i] = create_each_block_1$2(child_ctx), each_blocks[i].c(), each_blocks[i].m(div0, null));
        }
        for (; i < each_blocks.length; i += 1)
          each_blocks[i].d(1);
        each_blocks.length = each_value_1.length;
      }
    },
    d(detaching) {
      detaching && detach(div1), destroy_each(each_blocks, detaching);
    }
  };
}
__name(create_if_block_5, "create_if_block_5");
function create_each_block_1$2(ctx) {
  let button, i, i_class_value, t0, t1_value = (
    /*ranges*/
    (ctx[11].length && /*ranges*/
    ctx[11].length < 3 ? (
      /*range*/
      ctx[58].type.toUpperCase()
    ) : "") + ""
  ), t1, t2, t3_value = (
    /*range*/
    ctx[58].val + ""
  ), t3, t4, mounted, dispose;
  function click_handler_2() {
    return (
      /*click_handler_2*/
      ctx[38](
        /*range*/
        ctx[58]
      )
    );
  }
  return __name(click_handler_2, "click_handler_2"), {
    c() {
      button = element("button"), i = element("i"), t0 = space(), t1 = text(t1_value), t2 = space(), t3 = text(t3_value), t4 = space(), attr(i, "class", i_class_value = "cci cci-" + /*range*/
      ctx[58].type.toLowerCase() + " i--m i--light svelte-k5ear2"), attr(button, "class", "range-button svelte-k5ear2"), attr(button, "type", "button");
    },
    m(target, anchor) {
      insert(target, button, anchor), append(button, i), append(button, t0), append(button, t1), append(button, t2), append(button, t3), append(button, t4), mounted || (dispose = listen(button, "click", click_handler_2), mounted = !0);
    },
    p(new_ctx, dirty) {
      ctx = new_ctx, dirty[0] & /*ranges*/
      2048 && i_class_value !== (i_class_value = "cci cci-" + /*range*/
      ctx[58].type.toLowerCase() + " i--m i--light svelte-k5ear2") && attr(i, "class", i_class_value), dirty[0] & /*ranges*/
      2048 && t1_value !== (t1_value = /*ranges*/
      (ctx[11].length && /*ranges*/
      ctx[11].length < 3 ? (
        /*range*/
        ctx[58].type.toUpperCase()
      ) : "") + "") && set_data(t1, t1_value), dirty[0] & /*ranges*/
      2048 && t3_value !== (t3_value = /*range*/
      ctx[58].val + "") && set_data(t3, t3_value);
    },
    d(detaching) {
      detaching && detach(button), mounted = !1, dispose();
    }
  };
}
__name(create_each_block_1$2, "create_each_block_1$2");
function create_if_block_3$1(ctx) {
  let previous_key = (
    /*targets*/
    ctx[2].length
  ), key_block_anchor, current, key_block = create_key_block(ctx);
  return {
    c() {
      key_block.c(), key_block_anchor = empty();
    },
    m(target, anchor) {
      key_block.m(target, anchor), insert(target, key_block_anchor, anchor), current = !0;
    },
    p(ctx2, dirty) {
      dirty[0] & /*targets*/
      4 && safe_not_equal(previous_key, previous_key = /*targets*/
      ctx2[2].length) ? (group_outros(), transition_out(key_block, 1, 1, noop), check_outros(), key_block = create_key_block(ctx2), key_block.c(), transition_in(key_block, 1), key_block.m(key_block_anchor.parentNode, key_block_anchor)) : key_block.p(ctx2, dirty);
    },
    i(local) {
      current || (transition_in(key_block), current = !0);
    },
    o(local) {
      transition_out(key_block), current = !1;
    },
    d(detaching) {
      detaching && detach(key_block_anchor), key_block.d(detaching);
    }
  };
}
__name(create_if_block_3$1, "create_if_block_3$1");
function create_if_block_4$1(ctx) {
  let t0, t1_value = (
    /*targets*/
    ctx[2][0].target.name + ""
  ), t1;
  return {
    c() {
      t0 = text("vs "), t1 = text(t1_value);
    },
    m(target, anchor) {
      insert(target, t0, anchor), insert(target, t1, anchor);
    },
    p(ctx2, dirty) {
      dirty[0] & /*targets*/
      4 && t1_value !== (t1_value = /*targets*/
      ctx2[2][0].target.name + "") && set_data(t1, t1_value);
    },
    d(detaching) {
      detaching && detach(t0), detaching && detach(t1);
    }
  };
}
__name(create_if_block_4$1, "create_if_block_4$1");
function create_key_block(ctx) {
  let div, label, t0, span, t1, t2, label_transition, current, if_block = (
    /*targets*/
    ctx[2].length > 0 && create_if_block_4$1(ctx)
  );
  return {
    c() {
      div = element("div"), label = element("label"), t0 = text("🞂 "), span = element("span"), t1 = text(`Total
                  `), if_block && if_block.c(), t2 = text(" 🞀"), attr(span, "class", "svelte-k5ear2"), attr(label, "class", "accdiff-weight total-label lancer-mini-header svelte-k5ear2"), attr(label, "for", "total-display-0"), attr(div, "class", "flexrow flex-center");
    },
    m(target, anchor) {
      insert(target, div, anchor), append(div, label), append(label, t0), append(label, span), append(span, t1), if_block && if_block.m(span, null), append(label, t2), current = !0;
    },
    p(ctx2, dirty) {
      /*targets*/
      ctx2[2].length > 0 ? if_block ? if_block.p(ctx2, dirty) : (if_block = create_if_block_4$1(ctx2), if_block.c(), if_block.m(span, null)) : if_block && (if_block.d(1), if_block = null);
    },
    i(local) {
      current || (add_render_callback(() => {
        current && (label_transition || (label_transition = create_bidirectional_transition(label, slide, {}, !0)), label_transition.run(1));
      }), current = !0);
    },
    o(local) {
      label_transition || (label_transition = create_bidirectional_transition(label, slide, {}, !1)), label_transition.run(0), current = !1;
    },
    d(detaching) {
      detaching && detach(div), if_block && if_block.d(), detaching && label_transition && label_transition.end();
    }
  };
}
__name(create_key_block, "create_key_block");
function create_else_block(ctx) {
  let div, each_blocks = [], each_1_lookup = /* @__PURE__ */ new Map(), current, each_value = (
    /*targets*/
    ctx[2]
  );
  const get_key = /* @__PURE__ */ __name((ctx2) => (
    /*data*/
    ctx2[55].target.id
  ), "get_key");
  for (let i = 0; i < each_value.length; i += 1) {
    let child_ctx = get_each_context$6(ctx, each_value, i), key = get_key(child_ctx);
    each_1_lookup.set(key, each_blocks[i] = create_each_block$6(key, child_ctx));
  }
  return {
    c() {
      div = element("div");
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      attr(div, "class", "accdiff-weight accdiff-target-row svelte-k5ear2");
    },
    m(target, anchor) {
      insert(target, div, anchor);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(div, null);
      current = !0;
    },
    p(ctx2, dirty) {
      if (dirty[0] & /*targetHoverIn, targets, weapon, isTech*/
      294917) {
        each_value = /*targets*/
        ctx2[2], group_outros();
        for (let i = 0; i < each_blocks.length; i += 1)
          each_blocks[i].r();
        each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, div, fix_and_outro_and_destroy_block, create_each_block$6, null, get_each_context$6);
        for (let i = 0; i < each_blocks.length; i += 1)
          each_blocks[i].a();
        check_outros();
      }
    },
    i(local) {
      if (!current) {
        for (let i = 0; i < each_value.length; i += 1)
          transition_in(each_blocks[i]);
        current = !0;
      }
    },
    o(local) {
      for (let i = 0; i < each_blocks.length; i += 1)
        transition_out(each_blocks[i]);
      current = !1;
    },
    d(detaching) {
      detaching && detach(div);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].d();
    }
  };
}
__name(create_else_block, "create_else_block");
function create_if_block_1$2(ctx) {
  let div, total, updating_target, current, mounted, dispose;
  function total_target_binding(value) {
    ctx[39](value);
  }
  __name(total_target_binding, "total_target_binding");
  let total_props = { id: "total-display-0", onlyTarget: !0 };
  return (
    /*targets*/
    ctx[2][0] !== void 0 && (total_props.target = /*targets*/
    ctx[2][0]), total = new Total({ props: total_props }), binding_callbacks.push(() => bind(total, "target", total_target_binding)), {
      c() {
        div = element("div"), create_component(total.$$.fragment), attr(div, "class", "flexrow flex-center accdiff-total svelte-k5ear2");
      },
      m(target, anchor) {
        insert(target, div, anchor), mount_component(total, div, null), current = !0, mounted || (dispose = [
          listen(
            div,
            "mouseenter",
            /*mouseenter_handler_1*/
            ctx[40]
          ),
          listen(
            div,
            "mouseleave",
            /*mouseleave_handler_1*/
            ctx[41]
          )
        ], mounted = !0);
      },
      p(ctx2, dirty) {
        const total_changes = {};
        !updating_target && dirty[0] & /*targets*/
        4 && (updating_target = !0, total_changes.target = /*targets*/
        ctx2[2][0], add_flush_callback(() => updating_target = !1)), total.$set(total_changes);
      },
      i(local) {
        current || (transition_in(total.$$.fragment, local), current = !0);
      },
      o(local) {
        transition_out(total.$$.fragment, local), current = !1;
      },
      d(detaching) {
        detaching && detach(div), destroy_component(total), mounted = !1, run_all(dispose);
      }
    }
  );
}
__name(create_if_block_1$2, "create_if_block_1$2");
function create_if_block$5(ctx) {
  let div, total, current;
  return total = new Total({
    props: {
      target: (
        /*base*/
        ctx[1]
      ),
      id: "total-display-0"
    }
  }), {
    c() {
      div = element("div"), create_component(total.$$.fragment), attr(div, "class", "flexrow flex-center accdiff-total svelte-k5ear2");
    },
    m(target, anchor) {
      insert(target, div, anchor), mount_component(total, div, null), current = !0;
    },
    p(ctx2, dirty) {
      const total_changes = {};
      dirty[0] & /*base*/
      2 && (total_changes.target = /*base*/
      ctx2[1]), total.$set(total_changes);
    },
    i(local) {
      current || (transition_in(total.$$.fragment, local), current = !0);
    },
    o(local) {
      transition_out(total.$$.fragment, local), current = !1;
    },
    d(detaching) {
      detaching && detach(div), destroy_component(total);
    }
  };
}
__name(create_if_block$5, "create_if_block$5");
function create_else_block_1(ctx) {
  let div;
  return {
    c() {
      div = element("div");
    },
    m(target, anchor) {
      insert(target, div, anchor);
    },
    p: noop,
    i: noop,
    o: noop,
    d(detaching) {
      detaching && detach(div);
    }
  };
}
__name(create_else_block_1, "create_else_block_1");
function create_if_block_2$1(ctx) {
  let cover, updating_cover, current;
  function cover_cover_binding_2(value) {
    ctx[45](
      value,
      /*data*/
      ctx[55]
    );
  }
  __name(cover_cover_binding_2, "cover_cover_binding_2");
  let cover_props = {
    disabled: (
      /*weapon*/
      ctx[0].seeking
    ),
    class: "accdiff-targeted-cover flexrow flex-center",
    labelClass: "i--s"
  };
  return (
    /*data*/
    ctx[55].cover !== void 0 && (cover_props.cover = /*data*/
    ctx[55].cover), cover = new Cover$1({ props: cover_props }), binding_callbacks.push(() => bind(cover, "cover", cover_cover_binding_2)), {
      c() {
        create_component(cover.$$.fragment);
      },
      m(target, anchor) {
        mount_component(cover, target, anchor), current = !0;
      },
      p(new_ctx, dirty) {
        ctx = new_ctx;
        const cover_changes = {};
        dirty[0] & /*weapon*/
        1 && (cover_changes.disabled = /*weapon*/
        ctx[0].seeking), !updating_cover && dirty[0] & /*targets*/
        4 && (updating_cover = !0, cover_changes.cover = /*data*/
        ctx[55].cover, add_flush_callback(() => updating_cover = !1)), cover.$set(cover_changes);
      },
      i(local) {
        current || (transition_in(cover.$$.fragment, local), current = !0);
      },
      o(local) {
        transition_out(cover.$$.fragment, local), current = !1;
      },
      d(detaching) {
        destroy_component(cover, detaching);
      }
    }
  );
}
__name(create_if_block_2$1, "create_if_block_2$1");
function create_each_block$6(key_1, ctx) {
  let div3, label, t0, span, t1_value = (
    /*data*/
    ctx[55].target.document.name + ""
  ), t1, t2, label_for_value, t3, div2, div0, total, updating_target, t4, div1, button0, t5, input0, t6, current_block_type_index, if_block, t7, input1, t8, button1, t9, div3_intro, div3_outro, rect, stop_animation = noop, current, mounted, dispose;
  function total_target_binding_1(value) {
    ctx[42](
      value,
      /*data*/
      ctx[55],
      /*each_value*/
      ctx[56],
      /*i*/
      ctx[57]
    );
  }
  __name(total_target_binding_1, "total_target_binding_1");
  let total_props = { id: `total-display-${/*i*/
  ctx[57]}` };
  /*data*/
  ctx[55] !== void 0 && (total_props.target = /*data*/
  ctx[55]), total = new Total({ props: total_props }), binding_callbacks.push(() => bind(total, "target", total_target_binding_1));
  function click_handler_3() {
    return (
      /*click_handler_3*/
      ctx[43](
        /*data*/
        ctx[55],
        /*each_value*/
        ctx[56],
        /*i*/
        ctx[57]
      )
    );
  }
  __name(click_handler_3, "click_handler_3");
  function input0_input_handler() {
    ctx[44].call(
      input0,
      /*each_value*/
      ctx[56],
      /*i*/
      ctx[57]
    );
  }
  __name(input0_input_handler, "input0_input_handler");
  const if_block_creators = [create_if_block_2$1, create_else_block_1], if_blocks = [];
  function select_block_type_4(ctx2, dirty) {
    return (
      /*isTech*/
      ctx2[18]() ? 1 : 0
    );
  }
  __name(select_block_type_4, "select_block_type_4"), current_block_type_index = select_block_type_4(ctx), if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
  function input1_input_handler() {
    ctx[46].call(
      input1,
      /*each_value*/
      ctx[56],
      /*i*/
      ctx[57]
    );
  }
  __name(input1_input_handler, "input1_input_handler");
  function click_handler_4() {
    return (
      /*click_handler_4*/
      ctx[47](
        /*data*/
        ctx[55],
        /*each_value*/
        ctx[56],
        /*i*/
        ctx[57]
      )
    );
  }
  __name(click_handler_4, "click_handler_4");
  function mouseenter_handler_2(...args) {
    return (
      /*mouseenter_handler_2*/
      ctx[48](
        /*data*/
        ctx[55],
        ...args
      )
    );
  }
  __name(mouseenter_handler_2, "mouseenter_handler_2");
  function mouseleave_handler_2(...args) {
    return (
      /*mouseleave_handler_2*/
      ctx[49](
        /*data*/
        ctx[55],
        ...args
      )
    );
  }
  return __name(mouseleave_handler_2, "mouseleave_handler_2"), {
    key: key_1,
    first: null,
    c() {
      div3 = element("div"), label = element("label"), t0 = text("🞂"), span = element("span"), t1 = text(t1_value), t2 = text("🞀"), t3 = space(), div2 = element("div"), div0 = element("div"), create_component(total.$$.fragment), t4 = space(), div1 = element("div"), button0 = element("button"), button0.innerHTML = '<i class="cci cci-accuracy i--m svelte-k5ear2" style="border:none"></i>', t5 = space(), input0 = element("input"), t6 = space(), if_block.c(), t7 = space(), input1 = element("input"), t8 = space(), button1 = element("button"), button1.innerHTML = '<i class="cci cci-difficulty i--m svelte-k5ear2" style="border:none"></i>', t9 = space(), attr(span, "class", "svelte-k5ear2"), attr(label, "class", "target-name flexrow lancer-mini-header svelte-k5ear2"), attr(label, "for", label_for_value = /*data*/
      ctx[55].target.id), attr(div0, "class", "flexrow accdiff-total svelte-k5ear2"), attr(button0, "class", "i--m no-grow accdiff-button svelte-k5ear2"), attr(button0, "type", "button"), set_style(input0, "display", "none"), attr(input0, "type", "number"), attr(input0, "min", "0"), set_style(input1, "display", "none"), attr(input1, "type", "number"), attr(input1, "min", "0"), attr(button1, "class", "i--m no-grow accdiff-button svelte-k5ear2"), attr(button1, "type", "button"), attr(div1, "class", "flexrow"), attr(div2, "class", "accdiff-target-body svelte-k5ear2"), attr(div3, "class", "flexcol card accdiff-target svelte-k5ear2"), this.first = div3;
    },
    m(target, anchor) {
      insert(target, div3, anchor), append(div3, label), append(label, t0), append(label, span), append(span, t1), append(label, t2), append(div3, t3), append(div3, div2), append(div2, div0), mount_component(total, div0, null), append(div2, t4), append(div2, div1), append(div1, button0), append(div1, t5), append(div1, input0), set_input_value(
        input0,
        /*data*/
        ctx[55].accuracy
      ), append(div1, t6), if_blocks[current_block_type_index].m(div1, null), append(div1, t7), append(div1, input1), set_input_value(
        input1,
        /*data*/
        ctx[55].difficulty
      ), append(div1, t8), append(div1, button1), append(div3, t9), current = !0, mounted || (dispose = [
        listen(button0, "click", click_handler_3),
        listen(input0, "input", input0_input_handler),
        listen(input1, "input", input1_input_handler),
        listen(button1, "click", click_handler_4),
        listen(div3, "mouseenter", mouseenter_handler_2),
        listen(div3, "mouseleave", mouseleave_handler_2)
      ], mounted = !0);
    },
    p(new_ctx, dirty) {
      ctx = new_ctx, (!current || dirty[0] & /*targets*/
      4) && t1_value !== (t1_value = /*data*/
      ctx[55].target.document.name + "") && set_data(t1, t1_value), (!current || dirty[0] & /*targets*/
      4 && label_for_value !== (label_for_value = /*data*/
      ctx[55].target.id)) && attr(label, "for", label_for_value);
      const total_changes = {};
      dirty[0] & /*targets*/
      4 && (total_changes.id = `total-display-${/*i*/
      ctx[57]}`), !updating_target && dirty[0] & /*targets*/
      4 && (updating_target = !0, total_changes.target = /*data*/
      ctx[55], add_flush_callback(() => updating_target = !1)), total.$set(total_changes), dirty[0] & /*targets*/
      4 && to_number(input0.value) !== /*data*/
      ctx[55].accuracy && set_input_value(
        input0,
        /*data*/
        ctx[55].accuracy
      ), if_block.p(ctx, dirty), dirty[0] & /*targets*/
      4 && to_number(input1.value) !== /*data*/
      ctx[55].difficulty && set_input_value(
        input1,
        /*data*/
        ctx[55].difficulty
      );
    },
    r() {
      rect = div3.getBoundingClientRect();
    },
    f() {
      fix_position(div3), stop_animation(), add_transform(div3, rect);
    },
    a() {
      stop_animation(), stop_animation = create_animation(div3, rect, flip, { duration: 200 });
    },
    i(local) {
      current || (transition_in(total.$$.fragment, local), transition_in(if_block), add_render_callback(() => {
        current && (div3_outro && div3_outro.end(1), div3_intro = create_in_transition(div3, slide, { delay: 100, duration: 300 }), div3_intro.start());
      }), current = !0);
    },
    o(local) {
      transition_out(total.$$.fragment, local), transition_out(if_block), div3_intro && div3_intro.invalidate(), div3_outro = create_out_transition(div3, slide, { duration: 100 }), current = !1;
    },
    d(detaching) {
      detaching && detach(div3), destroy_component(total), if_blocks[current_block_type_index].d(), detaching && div3_outro && div3_outro.end(), mounted = !1, run_all(dispose);
    }
  };
}
__name(create_each_block$6, "create_each_block$6");
function create_fragment$6(ctx) {
  let form, t0, t1, div11, show_if_2 = (
    /*isAttack*/
    ctx[17]()
  ), t2, div2, t8, div5, div3, hudcheckbox0, updating_value, t9, t10, div4, hudcheckbox1, updating_value_1, t11, hudcheckbox2, t12, show_if_1 = (
    /*kind*/
    ctx[4] == "attack" && !/*isTech*/
    ctx[18]()
  ), t13, show_if = (
    /*kind*/
    ctx[4] == "attack" && (Object.values(
      /*weapon*/
      ctx[0].plugins
    ).length > 0 || /*targets*/
    ctx[2].length == 1)
  ), t14, div7, div6, accdiffinput, updating_value_2, t15, t16, div10, div9, t17, div8, current_block_type_index, if_block8, div11_id_value, t18, div12, button0, t20, button1, current, mounted, dispose, if_block0 = (
    /*title*/
    ctx[3] != "" && create_if_block_15(ctx)
  ), if_block1 = (
    /*profile*/
    ctx[12] && create_if_block_14(ctx)
  ), if_block2 = show_if_2 && create_if_block_13(ctx);
  function hudcheckbox0_value_binding(value) {
    ctx[26](value);
  }
  __name(hudcheckbox0_value_binding, "hudcheckbox0_value_binding");
  let hudcheckbox0_props = { label: "Accurate (+1)" };
  /*weapon*/
  ctx[0].accurate !== void 0 && (hudcheckbox0_props.value = /*weapon*/
  ctx[0].accurate), hudcheckbox0 = new HudCheckbox$1({ props: hudcheckbox0_props }), binding_callbacks.push(() => bind(hudcheckbox0, "value", hudcheckbox0_value_binding));
  let if_block3 = (
    /*kind*/
    ctx[4] == "attack" && create_if_block_12(ctx)
  );
  function hudcheckbox1_value_binding(value) {
    ctx[28](value);
  }
  __name(hudcheckbox1_value_binding, "hudcheckbox1_value_binding");
  let hudcheckbox1_props = { label: "Inaccurate (-1)" };
  /*weapon*/
  ctx[0].inaccurate !== void 0 && (hudcheckbox1_props.value = /*weapon*/
  ctx[0].inaccurate), hudcheckbox1 = new HudCheckbox$1({ props: hudcheckbox1_props }), binding_callbacks.push(() => bind(hudcheckbox1, "value", hudcheckbox1_value_binding)), hudcheckbox2 = new HudCheckbox$1({
    props: {
      label: "Impaired (-1)",
      value: !!/*weapon*/
      ctx[0].impaired,
      disabled: !0
    }
  });
  let if_block4 = show_if_1 && create_if_block_11(ctx), if_block5 = show_if && create_if_block_6(ctx);
  function accdiffinput_value_binding(value) {
    ctx[37](value);
  }
  __name(accdiffinput_value_binding, "accdiffinput_value_binding");
  let accdiffinput_props = { id: "accdiff-manual-adjust" };
  /*base*/
  ctx[1].accuracy !== void 0 && (accdiffinput_props.value = /*base*/
  ctx[1].accuracy), accdiffinput = new AccDiffInput$1({ props: accdiffinput_props }), binding_callbacks.push(() => bind(accdiffinput, "value", accdiffinput_value_binding));
  let if_block6 = (
    /*ranges*/
    ctx[11] && /*ranges*/
    ctx[11].length > 0 && create_if_block_5(ctx)
  ), if_block7 = (
    /*targets*/
    ctx[2].length < 2 && create_if_block_3$1(ctx)
  );
  const if_block_creators = [create_if_block$5, create_if_block_1$2, create_else_block], if_blocks = [];
  function select_block_type_3(ctx2, dirty) {
    return (
      /*targets*/
      ctx2[2].length == 0 ? 0 : (
        /*targets*/
        ctx2[2].length == 1 ? 1 : 2
      )
    );
  }
  return __name(select_block_type_3, "select_block_type_3"), current_block_type_index = select_block_type_3(ctx), if_block8 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx), {
    c() {
      form = element("form"), if_block0 && if_block0.c(), t0 = space(), if_block1 && if_block1.c(), t1 = space(), div11 = element("div"), if_block2 && if_block2.c(), t2 = space(), div2 = element("div"), div2.innerHTML = `<div class="accdiff-grid__column svelte-k5ear2"><h4 class="lancer-border-primary svelte-k5ear2"><i class="cci cci-accuracy i--m" style="vertical-align:middle;border:none"></i> 
          <strong>Accuracy</strong></h4></div> 
      <div class="accdiff-grid__column svelte-k5ear2"><h4 class="lancer-border-primary svelte-k5ear2"><i class="cci cci-difficulty i--m" style="vertical-align:middle;border:none"></i> 
          <strong>Difficulty</strong></h4></div>`, t8 = space(), div5 = element("div"), div3 = element("div"), create_component(hudcheckbox0.$$.fragment), t9 = space(), if_block3 && if_block3.c(), t10 = space(), div4 = element("div"), create_component(hudcheckbox1.$$.fragment), t11 = space(), create_component(hudcheckbox2.$$.fragment), t12 = space(), if_block4 && if_block4.c(), t13 = space(), if_block5 && if_block5.c(), t14 = space(), div7 = element("div"), div6 = element("div"), create_component(accdiffinput.$$.fragment), t15 = space(), if_block6 && if_block6.c(), t16 = space(), div10 = element("div"), div9 = element("div"), if_block7 && if_block7.c(), t17 = space(), div8 = element("div"), if_block8.c(), t18 = space(), div12 = element("div"), button0 = element("button"), button0.innerHTML = `<i class="fas fa-check svelte-k5ear2"></i>
      Roll`, t20 = space(), button1 = element("button"), button1.innerHTML = `<i class="fas fa-times svelte-k5ear2"></i>
      Cancel`, attr(div2, "class", "accdiff-grid accdiff-grid__section svelte-k5ear2"), attr(div3, "class", "accdiff-grid__column svelte-k5ear2"), attr(div4, "class", "accdiff-grid__column svelte-k5ear2"), attr(div5, "class", "accdiff-grid accdiff-grid__section svelte-k5ear2"), attr(div6, "class", "flexrow accdiff-grid__section svelte-k5ear2"), set_style(div6, "justify-content", "space-evenly"), attr(div7, "class", "flexcol accdiff-grid svelte-k5ear2"), attr(div8, "class", "grid-enforcement"), attr(div9, "class", "accdiff-total svelte-k5ear2"), attr(div10, "class", "flexcol accdiff-footer lancer-border-primary svelte-k5ear2"), attr(div11, "id", div11_id_value = /*kind*/
      ctx[4] + "-accdiff-dialog"), set_style(div11, "padding", "0.3em"), attr(div11, "class", "svelte-k5ear2"), attr(button0, "class", "lancer-button lancer-secondary dialog-button submit default svelte-k5ear2"), attr(button0, "data-button", "submit"), attr(button0, "type", "submit"), attr(button1, "class", "dialog-button cancel svelte-k5ear2"), attr(button1, "data-button", "cancel"), attr(button1, "type", "button"), attr(div12, "class", "dialog-buttons flexrow"), attr(form, "id", "accdiff"), attr(form, "class", "lancer lancer-hud accdiff window-content svelte-k5ear2");
    },
    m(target, anchor) {
      insert(target, form, anchor), if_block0 && if_block0.m(form, null), append(form, t0), if_block1 && if_block1.m(form, null), append(form, t1), append(form, div11), if_block2 && if_block2.m(div11, null), append(div11, t2), append(div11, div2), append(div11, t8), append(div11, div5), append(div5, div3), mount_component(hudcheckbox0, div3, null), append(div3, t9), if_block3 && if_block3.m(div3, null), append(div5, t10), append(div5, div4), mount_component(hudcheckbox1, div4, null), append(div4, t11), mount_component(hudcheckbox2, div4, null), append(div4, t12), if_block4 && if_block4.m(div4, null), append(div11, t13), if_block5 && if_block5.m(div11, null), append(div11, t14), append(div11, div7), append(div7, div6), mount_component(accdiffinput, div6, null), append(div7, t15), if_block6 && if_block6.m(div7, null), append(div11, t16), append(div11, div10), append(div10, div9), if_block7 && if_block7.m(div9, null), append(div9, t17), append(div9, div8), if_blocks[current_block_type_index].m(div8, null), append(form, t18), append(form, div12), append(div12, button0), append(div12, t20), append(div12, button1), current = !0, mounted || (dispose = [
        action_destroyer(focus$2.call(null, button0)),
        listen(
          button1,
          "click",
          /*click_handler_5*/
          ctx[50]
        ),
        action_destroyer(
          /*escToCancel*/
          ctx[16].call(null, form)
        ),
        listen(form, "submit", prevent_default(
          /*submit_handler*/
          ctx[51]
        ))
      ], mounted = !0);
    },
    p(ctx2, dirty) {
      /*title*/
      ctx2[3] != "" ? if_block0 ? if_block0.p(ctx2, dirty) : (if_block0 = create_if_block_15(ctx2), if_block0.c(), if_block0.m(form, t0)) : if_block0 && (if_block0.d(1), if_block0 = null), /*profile*/
      ctx2[12] ? if_block1 ? (if_block1.p(ctx2, dirty), dirty[0] & /*profile*/
      4096 && transition_in(if_block1, 1)) : (if_block1 = create_if_block_14(ctx2), if_block1.c(), transition_in(if_block1, 1), if_block1.m(form, t1)) : if_block1 && (group_outros(), transition_out(if_block1, 1, 1, () => {
        if_block1 = null;
      }), check_outros()), show_if_2 && if_block2.p(ctx2, dirty);
      const hudcheckbox0_changes = {};
      !updating_value && dirty[0] & /*weapon*/
      1 && (updating_value = !0, hudcheckbox0_changes.value = /*weapon*/
      ctx2[0].accurate, add_flush_callback(() => updating_value = !1)), hudcheckbox0.$set(hudcheckbox0_changes), /*kind*/
      ctx2[4] == "attack" ? if_block3 ? (if_block3.p(ctx2, dirty), dirty[0] & /*kind*/
      16 && transition_in(if_block3, 1)) : (if_block3 = create_if_block_12(ctx2), if_block3.c(), transition_in(if_block3, 1), if_block3.m(div3, null)) : if_block3 && (group_outros(), transition_out(if_block3, 1, 1, () => {
        if_block3 = null;
      }), check_outros());
      const hudcheckbox1_changes = {};
      !updating_value_1 && dirty[0] & /*weapon*/
      1 && (updating_value_1 = !0, hudcheckbox1_changes.value = /*weapon*/
      ctx2[0].inaccurate, add_flush_callback(() => updating_value_1 = !1)), hudcheckbox1.$set(hudcheckbox1_changes);
      const hudcheckbox2_changes = {};
      dirty[0] & /*weapon*/
      1 && (hudcheckbox2_changes.value = !!/*weapon*/
      ctx2[0].impaired), hudcheckbox2.$set(hudcheckbox2_changes), dirty[0] & /*kind*/
      16 && (show_if_1 = /*kind*/
      ctx2[4] == "attack" && !/*isTech*/
      ctx2[18]()), show_if_1 ? if_block4 ? (if_block4.p(ctx2, dirty), dirty[0] & /*kind*/
      16 && transition_in(if_block4, 1)) : (if_block4 = create_if_block_11(ctx2), if_block4.c(), transition_in(if_block4, 1), if_block4.m(div4, null)) : if_block4 && (group_outros(), transition_out(if_block4, 1, 1, () => {
        if_block4 = null;
      }), check_outros()), dirty[0] & /*kind, weapon, targets*/
      21 && (show_if = /*kind*/
      ctx2[4] == "attack" && (Object.values(
        /*weapon*/
        ctx2[0].plugins
      ).length > 0 || /*targets*/
      ctx2[2].length == 1)), show_if ? if_block5 ? (if_block5.p(ctx2, dirty), dirty[0] & /*kind, weapon, targets*/
      21 && transition_in(if_block5, 1)) : (if_block5 = create_if_block_6(ctx2), if_block5.c(), transition_in(if_block5, 1), if_block5.m(div11, t14)) : if_block5 && (group_outros(), transition_out(if_block5, 1, 1, () => {
        if_block5 = null;
      }), check_outros());
      const accdiffinput_changes = {};
      !updating_value_2 && dirty[0] & /*base*/
      2 && (updating_value_2 = !0, accdiffinput_changes.value = /*base*/
      ctx2[1].accuracy, add_flush_callback(() => updating_value_2 = !1)), accdiffinput.$set(accdiffinput_changes), /*ranges*/
      ctx2[11] && /*ranges*/
      ctx2[11].length > 0 ? if_block6 ? if_block6.p(ctx2, dirty) : (if_block6 = create_if_block_5(ctx2), if_block6.c(), if_block6.m(div7, null)) : if_block6 && (if_block6.d(1), if_block6 = null), /*targets*/
      ctx2[2].length < 2 ? if_block7 ? (if_block7.p(ctx2, dirty), dirty[0] & /*targets*/
      4 && transition_in(if_block7, 1)) : (if_block7 = create_if_block_3$1(ctx2), if_block7.c(), transition_in(if_block7, 1), if_block7.m(div9, t17)) : if_block7 && (group_outros(), transition_out(if_block7, 1, 1, () => {
        if_block7 = null;
      }), check_outros());
      let previous_block_index = current_block_type_index;
      current_block_type_index = select_block_type_3(ctx2), current_block_type_index === previous_block_index ? if_blocks[current_block_type_index].p(ctx2, dirty) : (group_outros(), transition_out(if_blocks[previous_block_index], 1, 1, () => {
        if_blocks[previous_block_index] = null;
      }), check_outros(), if_block8 = if_blocks[current_block_type_index], if_block8 ? if_block8.p(ctx2, dirty) : (if_block8 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2), if_block8.c()), transition_in(if_block8, 1), if_block8.m(div8, null)), (!current || dirty[0] & /*kind*/
      16 && div11_id_value !== (div11_id_value = /*kind*/
      ctx2[4] + "-accdiff-dialog")) && attr(div11, "id", div11_id_value);
    },
    i(local) {
      current || (transition_in(if_block1), transition_in(hudcheckbox0.$$.fragment, local), transition_in(if_block3), transition_in(hudcheckbox1.$$.fragment, local), transition_in(hudcheckbox2.$$.fragment, local), transition_in(if_block4), transition_in(if_block5), transition_in(accdiffinput.$$.fragment, local), transition_in(if_block7), transition_in(if_block8), current = !0);
    },
    o(local) {
      transition_out(if_block1), transition_out(hudcheckbox0.$$.fragment, local), transition_out(if_block3), transition_out(hudcheckbox1.$$.fragment, local), transition_out(hudcheckbox2.$$.fragment, local), transition_out(if_block4), transition_out(if_block5), transition_out(accdiffinput.$$.fragment, local), transition_out(if_block7), transition_out(if_block8), current = !1;
    },
    d(detaching) {
      detaching && detach(form), if_block0 && if_block0.d(), if_block1 && if_block1.d(), if_block2 && if_block2.d(), destroy_component(hudcheckbox0), if_block3 && if_block3.d(), destroy_component(hudcheckbox1), destroy_component(hudcheckbox2), if_block4 && if_block4.d(), if_block5 && if_block5.d(), destroy_component(accdiffinput), if_block6 && if_block6.d(), if_block7 && if_block7.d(), if_blocks[current_block_type_index].d(), mounted = !1, run_all(dispose);
    }
  };
}
__name(create_fragment$6, "create_fragment$6");
function focus$2(el) {
  el.focus();
}
__name(focus$2, "focus$2");
function targetHoverOut$1(event, target) {
  const thtModule = game.modules.get("terrain-height-tools");
  !(thtModule != null && thtModule.active) || foundry.utils.isNewerVersion("0.3.3", thtModule.version) ? target._onHoverOut(event) : clearLos();
}
__name(targetHoverOut$1, "targetHoverOut$1");
function clearLos() {
  const thtModule = game.modules.get("terrain-height-tools");
  !(thtModule != null && thtModule.active) || foundry.utils.isNewerVersion("0.3.3", thtModule.version) || terrainHeightTools.clearLineOfSightRays();
}
__name(clearLos, "clearLos");
function flatSign(val) {
  return val > 0 ? "+" : "";
}
__name(flatSign, "flatSign");
function instance$6($$self, $$props, $$invalidate) {
  var _a, _b;
  let profile, ranges, flatTotal, accWeaponPlugins, diffWeaponPlugins, accTargetPlugins, diffTargetPlugins, { weapon } = $$props, { base } = $$props, { targets } = $$props, { title } = $$props, { lancerItem } = $$props, { lancerActor } = $$props, { kind } = $$props;
  const dispatch = createEventDispatcher();
  let submitted = !1, rollerName = lancerActor ? ` -- ${((_a = lancerActor.token) == null ? void 0 : _a.name) || lancerActor.name}` : "";
  if (kind === "attack" && lancerItem && !isTech()) {
    let ranges2 = [];
    lancerItem.is_pilot_weapon() || lancerItem.is_npc_feature() && lancerItem.system.type === NpcFeatureType.Weapon ? ranges2 = lancerItem.system.range.map((r) => r.type) : lancerItem.is_mech_weapon() && (ranges2 = (((_b = lancerItem.system.active_profile) == null ? void 0 : _b.range) || []).map((r) => r.type)), ranges2.some((r) => ![RangeType.Threat, RangeType.Thrown].includes(r)) && (weapon.engaged = !!weapon.engagedStatus);
  }
  function targetHoverIn2(event, target) {
    if (submitted)
      return;
    const thtModule = game.modules.get("terrain-height-tools");
    !(thtModule != null && thtModule.active) || foundry.utils.isNewerVersion("0.3.3", thtModule.version) ? target._onHoverIn(event) : drawLos(target);
  }
  __name(targetHoverIn2, "targetHoverIn");
  function drawLos(target) {
    var _a2;
    const tokens = (lancerActor == null ? void 0 : lancerActor.getActiveTokens(!0)) ?? ((_a2 = lancerItem == null ? void 0 : lancerItem.actor) == null ? void 0 : _a2.getActiveTokens(!0)), attacker = tokens == null ? void 0 : tokens.shift();
    !attacker || attacker === target || terrainHeightTools.drawLineOfSightRaysBetweenTokens(attacker, target);
  }
  __name(drawLos, "drawLos");
  function escToCancel(_el) {
    function escHandler(ev) {
      ev.key === "Escape" && (ev.preventDefault(), dispatch("cancel"));
    }
    return __name(escHandler, "escHandler"), window.addEventListener("keydown", escHandler), {
      destroy() {
        window.removeEventListener("keydown", escHandler);
      }
    };
  }
  __name(escToCancel, "escToCancel");
  function isAttack() {
    return kind === "attack";
  }
  __name(isAttack, "isAttack");
  function isTech() {
    return lancerItem ? !(lancerItem.is_mech_weapon() || lancerItem.is_pilot_weapon() || lancerItem.is_npc_feature() && lancerItem.system.type === NpcFeatureType.Weapon) : title.toLowerCase() === "tech attack";
  }
  __name(isTech, "isTech");
  function gritLabel() {
    if (isTech())
      return lancerItem != null && lancerItem.is_npc_feature() && lancerItem.system.type === NpcFeatureType.Tech ? "Tech Item Base" : "Tech Attack";
    if (lancerItem) {
      if (lancerItem.is_mech_weapon() || lancerItem.is_pilot_weapon())
        return "Grit";
      if (lancerItem.is_npc_feature() && lancerItem.system.type === NpcFeatureType.Weapon)
        return "Weapon Base";
    }
    if (lancerActor) {
      if (lancerActor.is_npc())
        return "Tier";
      if (lancerActor.is_mech() || lancerActor.is_pilot() || lancerActor.is_deployable())
        return "Grit";
    }
    return "Grit";
  }
  __name(gritLabel, "gritLabel");
  function findProfile() {
    return (lancerItem == null ? void 0 : lancerItem.currentProfile()) ?? { range: [], damage: [] };
  }
  __name(findProfile, "findProfile");
  function findRanges() {
    return (lancerItem == null ? void 0 : lancerItem.rangesFor([RangeType.Blast, RangeType.Burst, RangeType.Cone, RangeType.Line])) ?? [];
  }
  __name(findRanges, "findRanges");
  function deployTemplate(range) {
    var _a2;
    const creator = lancerItem == null ? void 0 : lancerItem.parent, token = ((_a2 = creator == null ? void 0 : creator.token) == null ? void 0 : _a2.object) ?? (creator == null ? void 0 : creator.getActiveTokens().shift()) ?? void 0, t = WeaponRangeTemplate.fromRange(range, token);
    t && (fade("out"), t.document.updateSource({
      [`flags.${game.system.id}.isAttack`]: !0
    }), t.placeTemplate().catch((e) => {
      console.warn(e);
    }).then((t2) => {
      t2 && targetsFromTemplate(t2.id), fade("in");
    }));
  }
  __name(deployTemplate, "deployTemplate");
  function input_input_handler() {
    base.flatBonus = to_number(this.value), $$invalidate(1, base), $$invalidate(0, weapon);
  }
  __name(input_input_handler, "input_input_handler");
  const click_handler = /* @__PURE__ */ __name(() => $$invalidate(1, base.flatBonus = base.flatBonus + 1, base), "click_handler"), click_handler_1 = /* @__PURE__ */ __name(() => $$invalidate(1, base.flatBonus = base.flatBonus - 1, base), "click_handler_1");
  function hudcheckbox0_value_binding(value) {
    $$self.$$.not_equal(weapon.accurate, value) && (weapon.accurate = value, $$invalidate(0, weapon));
  }
  __name(hudcheckbox0_value_binding, "hudcheckbox0_value_binding");
  function hudcheckbox_value_binding(value) {
    $$self.$$.not_equal(weapon.seeking, value) && (weapon.seeking = value, $$invalidate(0, weapon));
  }
  __name(hudcheckbox_value_binding, "hudcheckbox_value_binding");
  function hudcheckbox1_value_binding(value) {
    $$self.$$.not_equal(weapon.inaccurate, value) && (weapon.inaccurate = value, $$invalidate(0, weapon));
  }
  __name(hudcheckbox1_value_binding, "hudcheckbox1_value_binding");
  function hudcheckbox_value_binding_1(value) {
    $$self.$$.not_equal(weapon.engaged, value) && (weapon.engaged = value, $$invalidate(0, weapon));
  }
  __name(hudcheckbox_value_binding_1, "hudcheckbox_value_binding_1");
  function hudcheckbox0_value_binding_1(value) {
    $$self.$$.not_equal(targets[0].prone, value) && (targets[0].prone = value, $$invalidate(2, targets), $$invalidate(0, weapon), $$invalidate(1, base));
  }
  __name(hudcheckbox0_value_binding_1, "hudcheckbox0_value_binding_1");
  function hudcheckbox1_value_binding_1(value) {
    $$self.$$.not_equal(targets[0].stunned, value) && (targets[0].stunned = value, $$invalidate(2, targets), $$invalidate(0, weapon), $$invalidate(1, base));
  }
  __name(hudcheckbox1_value_binding_1, "hudcheckbox1_value_binding_1");
  function hudcheckbox2_value_binding(value) {
    $$self.$$.not_equal(targets[0].consumeLockOn, value) && (targets[0].consumeLockOn = value, $$invalidate(2, targets), $$invalidate(0, weapon), $$invalidate(1, base));
  }
  __name(hudcheckbox2_value_binding, "hudcheckbox2_value_binding");
  function cover_cover_binding(value) {
    $$self.$$.not_equal(base.cover, value) && (base.cover = value, $$invalidate(1, base), $$invalidate(0, weapon));
  }
  __name(cover_cover_binding, "cover_cover_binding");
  function cover_cover_binding_1(value) {
    $$self.$$.not_equal(targets[0].cover, value) && (targets[0].cover = value, $$invalidate(2, targets), $$invalidate(0, weapon), $$invalidate(1, base));
  }
  __name(cover_cover_binding_1, "cover_cover_binding_1");
  const mouseenter_handler = /* @__PURE__ */ __name((ev) => targetHoverIn2(ev, targets[0].target), "mouseenter_handler"), mouseleave_handler = /* @__PURE__ */ __name((ev) => targetHoverOut$1(ev, targets[0].target), "mouseleave_handler");
  function accdiffinput_value_binding(value) {
    $$self.$$.not_equal(base.accuracy, value) && (base.accuracy = value, $$invalidate(1, base), $$invalidate(0, weapon));
  }
  __name(accdiffinput_value_binding, "accdiffinput_value_binding");
  const click_handler_2 = /* @__PURE__ */ __name((range) => deployTemplate(range), "click_handler_2");
  function total_target_binding(value) {
    $$self.$$.not_equal(targets[0], value) && (targets[0] = value, $$invalidate(2, targets), $$invalidate(0, weapon), $$invalidate(1, base));
  }
  __name(total_target_binding, "total_target_binding");
  const mouseenter_handler_1 = /* @__PURE__ */ __name((ev) => targetHoverIn2(ev, targets[0].target), "mouseenter_handler_1"), mouseleave_handler_1 = /* @__PURE__ */ __name((ev) => targetHoverOut$1(ev, targets[0].target), "mouseleave_handler_1");
  function total_target_binding_1(value, data, each_value, i) {
    each_value[i] = value, $$invalidate(2, targets), $$invalidate(0, weapon), $$invalidate(1, base);
  }
  __name(total_target_binding_1, "total_target_binding_1");
  const click_handler_3 = /* @__PURE__ */ __name((data, each_value, i) => $$invalidate(2, each_value[i].accuracy = data.accuracy + 1, targets), "click_handler_3");
  function input0_input_handler(each_value, i) {
    each_value[i].accuracy = to_number(this.value), $$invalidate(2, targets), $$invalidate(0, weapon), $$invalidate(1, base);
  }
  __name(input0_input_handler, "input0_input_handler");
  function cover_cover_binding_2(value, data) {
    $$self.$$.not_equal(data.cover, value) && (data.cover = value, $$invalidate(2, targets), $$invalidate(0, weapon), $$invalidate(1, base));
  }
  __name(cover_cover_binding_2, "cover_cover_binding_2");
  function input1_input_handler(each_value, i) {
    each_value[i].difficulty = to_number(this.value), $$invalidate(2, targets), $$invalidate(0, weapon), $$invalidate(1, base);
  }
  __name(input1_input_handler, "input1_input_handler");
  const click_handler_4 = /* @__PURE__ */ __name((data, each_value, i) => $$invalidate(2, each_value[i].difficulty = data.difficulty + 1, targets), "click_handler_4"), mouseenter_handler_2 = /* @__PURE__ */ __name((data, ev) => targetHoverIn2(ev, data.target), "mouseenter_handler_2"), mouseleave_handler_2 = /* @__PURE__ */ __name((data, ev) => targetHoverOut$1(ev, data.target), "mouseleave_handler_2"), click_handler_5 = /* @__PURE__ */ __name(() => {
    $$invalidate(5, submitted = !0), dispatch("cancel");
  }, "click_handler_5"), submit_handler = /* @__PURE__ */ __name(() => {
    $$invalidate(5, submitted = !0), dispatch("submit");
  }, "submit_handler");
  return $$self.$$set = ($$props2) => {
    "weapon" in $$props2 && $$invalidate(0, weapon = $$props2.weapon), "base" in $$props2 && $$invalidate(1, base = $$props2.base), "targets" in $$props2 && $$invalidate(2, targets = $$props2.targets), "title" in $$props2 && $$invalidate(3, title = $$props2.title), "lancerItem" in $$props2 && $$invalidate(21, lancerItem = $$props2.lancerItem), "lancerActor" in $$props2 && $$invalidate(22, lancerActor = $$props2.lancerActor), "kind" in $$props2 && $$invalidate(4, kind = $$props2.kind);
  }, $$self.$$.update = () => {
    $$self.$$.dirty[0] & /*weapon, base*/
    3 && $$invalidate(1, base = base), $$self.$$.dirty[0] & /*weapon, base, targets*/
    7 && $$invalidate(2, targets = targets), $$self.$$.dirty[0] & /*lancerItem*/
    2097152 && $$invalidate(12, profile = lancerItem ? findProfile() : null), $$self.$$.dirty[0] & /*lancerItem*/
    2097152 && $$invalidate(11, ranges = lancerItem ? findRanges() : null), $$self.$$.dirty[0] & /*kind, base*/
    18 && $$invalidate(10, flatTotal = kind === "attack" ? base.grit + base.flatBonus : 0), $$self.$$.dirty[0] & /*weapon*/
    1 && $$invalidate(9, accWeaponPlugins = Object.values(weapon.plugins).filter((plugin) => plugin.category === "acc")), $$self.$$.dirty[0] & /*weapon*/
    1 && $$invalidate(8, diffWeaponPlugins = Object.values(weapon.plugins).filter((plugin) => plugin.category === "diff")), $$self.$$.dirty[0] & /*targets*/
    4 && $$invalidate(7, accTargetPlugins = targets.length === 1 ? Object.values(targets[0].plugins).filter((plugin) => plugin.category === "acc") : []), $$self.$$.dirty[0] & /*targets*/
    4 && $$invalidate(6, diffTargetPlugins = targets.length === 1 ? Object.values(targets[0].plugins).filter((plugin) => plugin.category === "diff") : []);
  }, [
    weapon,
    base,
    targets,
    title,
    kind,
    submitted,
    diffTargetPlugins,
    accTargetPlugins,
    diffWeaponPlugins,
    accWeaponPlugins,
    flatTotal,
    ranges,
    profile,
    dispatch,
    rollerName,
    targetHoverIn2,
    escToCancel,
    isAttack,
    isTech,
    gritLabel,
    deployTemplate,
    lancerItem,
    lancerActor,
    input_input_handler,
    click_handler,
    click_handler_1,
    hudcheckbox0_value_binding,
    hudcheckbox_value_binding,
    hudcheckbox1_value_binding,
    hudcheckbox_value_binding_1,
    hudcheckbox0_value_binding_1,
    hudcheckbox1_value_binding_1,
    hudcheckbox2_value_binding,
    cover_cover_binding,
    cover_cover_binding_1,
    mouseenter_handler,
    mouseleave_handler,
    accdiffinput_value_binding,
    click_handler_2,
    total_target_binding,
    mouseenter_handler_1,
    mouseleave_handler_1,
    total_target_binding_1,
    click_handler_3,
    input0_input_handler,
    cover_cover_binding_2,
    input1_input_handler,
    click_handler_4,
    mouseenter_handler_2,
    mouseleave_handler_2,
    click_handler_5,
    submit_handler
  ];
}
__name(instance$6, "instance$6");
const _AccDiffHUD = class _AccDiffHUD extends SvelteComponent {
  constructor(options) {
    super(), init(
      this,
      options,
      instance$6,
      create_fragment$6,
      safe_not_equal,
      {
        weapon: 0,
        base: 1,
        targets: 2,
        title: 3,
        lancerItem: 21,
        lancerActor: 22,
        kind: 4
      },
      null,
      [-1, -1, -1]
    );
  }
  get weapon() {
    return this.$$.ctx[0];
  }
  set weapon(weapon) {
    this.$$set({ weapon }), flush();
  }
  get base() {
    return this.$$.ctx[1];
  }
  set base(base) {
    this.$$set({ base }), flush();
  }
  get targets() {
    return this.$$.ctx[2];
  }
  set targets(targets) {
    this.$$set({ targets }), flush();
  }
  get title() {
    return this.$$.ctx[3];
  }
  set title(title) {
    this.$$set({ title }), flush();
  }
  get lancerItem() {
    return this.$$.ctx[21];
  }
  set lancerItem(lancerItem) {
    this.$$set({ lancerItem }), flush();
  }
  get lancerActor() {
    return this.$$.ctx[22];
  }
  set lancerActor(lancerActor) {
    this.$$set({ lancerActor }), flush();
  }
  get kind() {
    return this.$$.ctx[4];
  }
  set kind(kind) {
    this.$$set({ kind }), flush();
  }
};
__name(_AccDiffHUD, "AccDiffHUD");
let AccDiffHUD = _AccDiffHUD;
const AccDiffHud = AccDiffHUD;
function get_each_context$5(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[8] = list[i], child_ctx;
}
__name(get_each_context$5, "get_each_context$5");
function create_each_block$5(ctx) {
  let option, t0_value = (
    /*damageOption*/
    ctx[8][0] + ""
  ), t0, t1;
  return {
    c() {
      option = element("option"), t0 = text(t0_value), t1 = space(), option.__value = /*damageOption*/
      ctx[8][1], option.value = option.__value, option.selected = /*selected*/
      ctx[3](
        /*damageOption*/
        ctx[8][1]
      ), attr(option, "class", "svelte-ymaoz6");
    },
    m(target, anchor) {
      insert(target, option, anchor), append(option, t0), append(option, t1);
    },
    p: noop,
    d(detaching) {
      detaching && detach(option);
    }
  };
}
__name(create_each_block$5, "create_each_block$5");
function create_if_block$4(ctx) {
  let button, mounted, dispose;
  return {
    c() {
      button = element("button"), button.innerHTML = '<i class="fas fa-trash svelte-ymaoz6"></i>', attr(button, "class", "lancer-button damage-delete svelte-ymaoz6"), attr(button, "type", "button"), attr(button, "data-tooltip", "Remove this damage type");
    },
    m(target, anchor) {
      insert(target, button, anchor), mounted || (dispose = listen(
        button,
        "click",
        /*dispatchDelete*/
        ctx[4]
      ), mounted = !0);
    },
    p: noop,
    d(detaching) {
      detaching && detach(button), mounted = !1, dispose();
    }
  };
}
__name(create_if_block$4, "create_if_block$4");
function create_fragment$5(ctx) {
  let div, i, i_class_value, i_data_tooltip_value, t0, select, t1, input, t2, div_intro, div_outro, current, mounted, dispose, each_value = (
    /*damageSelectOptions*/
    ctx[2]
  ), each_blocks = [];
  for (let i2 = 0; i2 < each_value.length; i2 += 1)
    each_blocks[i2] = create_each_block$5(get_each_context$5(ctx, each_value, i2));
  let if_block = (
    /*deletable*/
    ctx[1] && create_if_block$4(ctx)
  );
  return {
    c() {
      div = element("div"), i = element("i"), t0 = space(), select = element("select");
      for (let i2 = 0; i2 < each_blocks.length; i2 += 1)
        each_blocks[i2].c();
      t1 = space(), input = element("input"), t2 = space(), if_block && if_block.c(), attr(i, "class", i_class_value = "i--sm cci cci-" + /*damage*/
      ctx[0].type.toLowerCase() + " damage--" + /*damage*/
      ctx[0].type.toLowerCase() + " svelte-ymaoz6"), attr(i, "data-tooltip", i_data_tooltip_value = /*damage*/
      ctx[0].type), attr(select, "class", "damage-input-type svelte-ymaoz6"), /*damage*/
      ctx[0].type === void 0 && add_render_callback(() => (
        /*select_change_handler*/
        ctx[5].call(select)
      )), attr(input, "class", "lancer-input damage-input-val svelte-ymaoz6"), attr(input, "type", "text"), attr(input, "data-dtype", "string"), attr(input, "placeholder", "0"), attr(div, "class", "damage-input-container svelte-ymaoz6");
    },
    m(target, anchor) {
      insert(target, div, anchor), append(div, i), append(div, t0), append(div, select);
      for (let i2 = 0; i2 < each_blocks.length; i2 += 1)
        each_blocks[i2] && each_blocks[i2].m(select, null);
      select_option(
        select,
        /*damage*/
        ctx[0].type,
        !0
      ), append(div, t1), append(div, input), set_input_value(
        input,
        /*damage*/
        ctx[0].val
      ), append(div, t2), if_block && if_block.m(div, null), current = !0, mounted || (dispose = [
        listen(
          select,
          "change",
          /*select_change_handler*/
          ctx[5]
        ),
        listen(
          input,
          "input",
          /*input_input_handler*/
          ctx[6]
        )
      ], mounted = !0);
    },
    p(ctx2, [dirty]) {
      if ((!current || dirty & /*damage, damageSelectOptions*/
      5 && i_class_value !== (i_class_value = "i--sm cci cci-" + /*damage*/
      ctx2[0].type.toLowerCase() + " damage--" + /*damage*/
      ctx2[0].type.toLowerCase() + " svelte-ymaoz6")) && attr(i, "class", i_class_value), (!current || dirty & /*damage, damageSelectOptions*/
      5 && i_data_tooltip_value !== (i_data_tooltip_value = /*damage*/
      ctx2[0].type)) && attr(i, "data-tooltip", i_data_tooltip_value), dirty & /*damageSelectOptions, selected*/
      12) {
        each_value = /*damageSelectOptions*/
        ctx2[2];
        let i2;
        for (i2 = 0; i2 < each_value.length; i2 += 1) {
          const child_ctx = get_each_context$5(ctx2, each_value, i2);
          each_blocks[i2] ? each_blocks[i2].p(child_ctx, dirty) : (each_blocks[i2] = create_each_block$5(child_ctx), each_blocks[i2].c(), each_blocks[i2].m(select, null));
        }
        for (; i2 < each_blocks.length; i2 += 1)
          each_blocks[i2].d(1);
        each_blocks.length = each_value.length;
      }
      dirty & /*damage, damageSelectOptions*/
      5 && select_option(
        select,
        /*damage*/
        ctx2[0].type
      ), dirty & /*damage, damageSelectOptions*/
      5 && input.value !== /*damage*/
      ctx2[0].val && set_input_value(
        input,
        /*damage*/
        ctx2[0].val
      ), /*deletable*/
      ctx2[1] ? if_block ? if_block.p(ctx2, dirty) : (if_block = create_if_block$4(ctx2), if_block.c(), if_block.m(div, null)) : if_block && (if_block.d(1), if_block = null);
    },
    i(local) {
      current || (add_render_callback(() => {
        current && (div_outro && div_outro.end(1), div_intro = create_in_transition(div, slide, { delay: 100, duration: 300 }), div_intro.start());
      }), current = !0);
    },
    o(local) {
      div_intro && div_intro.invalidate(), div_outro = create_out_transition(div, slide, { duration: 100 }), current = !1;
    },
    d(detaching) {
      detaching && detach(div), destroy_each(each_blocks, detaching), if_block && if_block.d(), detaching && div_outro && div_outro.end(), mounted = !1, run_all(dispose);
    }
  };
}
__name(create_fragment$5, "create_fragment$5");
function instance$5($$self, $$props, $$invalidate) {
  const dispatch = createEventDispatcher(), damageSelectOptions = Object.entries(DamageType);
  let { damage } = $$props, { deletable = !0 } = $$props;
  function selected(type) {
    return damage.type === type;
  }
  __name(selected, "selected");
  function dispatchDelete() {
    dispatch("delete");
  }
  __name(dispatchDelete, "dispatchDelete");
  function select_change_handler() {
    damage.type = select_value(this), $$invalidate(0, damage), $$invalidate(2, damageSelectOptions);
  }
  __name(select_change_handler, "select_change_handler");
  function input_input_handler() {
    damage.val = this.value, $$invalidate(0, damage), $$invalidate(2, damageSelectOptions);
  }
  return __name(input_input_handler, "input_input_handler"), $$self.$$set = ($$props2) => {
    "damage" in $$props2 && $$invalidate(0, damage = $$props2.damage), "deletable" in $$props2 && $$invalidate(1, deletable = $$props2.deletable);
  }, [
    damage,
    deletable,
    damageSelectOptions,
    selected,
    dispatchDelete,
    select_change_handler,
    input_input_handler
  ];
}
__name(instance$5, "instance$5");
const _DamageInput = class _DamageInput extends SvelteComponent {
  constructor(options) {
    super(), init(this, options, instance$5, create_fragment$5, safe_not_equal, { damage: 0, deletable: 1 });
  }
};
__name(_DamageInput, "DamageInput");
let DamageInput = _DamageInput;
const DamageInput$1 = DamageInput;
function get_each_context$4(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[10] = list[i], child_ctx;
}
__name(get_each_context$4, "get_each_context$4");
function create_if_block$3(ctx) {
  let div, div_intro, div_outro, current;
  return {
    c() {
      div = element("div"), attr(div, "class", "hit-quality-arrow svelte-iqa8g");
    },
    m(target, anchor) {
      insert(target, div, anchor), current = !0;
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
    },
    i(local) {
      current || (local && add_render_callback(() => {
        current && (div_outro && div_outro.end(1), div_intro = create_in_transition(
          div,
          /*send*/
          ctx[6],
          { key: (
            /*id*/
            ctx[4]
          ) }
        ), div_intro.start());
      }), current = !0);
    },
    o(local) {
      div_intro && div_intro.invalidate(), local && (div_outro = create_out_transition(
        div,
        /*recv*/
        ctx[7],
        { key: (
          /*id*/
          ctx[4]
        ) }
      )), current = !1;
    },
    d(detaching) {
      detaching && detach(div), detaching && div_outro && div_outro.end();
    }
  };
}
__name(create_if_block$3, "create_if_block$3");
function create_each_block$4(ctx) {
  let input, t0, label, i, span, t1_value = (
    /*input*/
    ctx[10].human + ""
  ), t1, t2, t3, label_class_value, binding_group, mounted, dispose, if_block = (
    /*input*/
    ctx[10].value == /*quality*/
    ctx[0] && create_if_block$3(ctx)
  );
  return binding_group = init_binding_group(
    /*$$binding_groups*/
    ctx[9][0]
  ), {
    c() {
      input = element("input"), t0 = space(), label = element("label"), i = element("i"), span = element("span"), t1 = text(t1_value), t2 = space(), if_block && if_block.c(), t3 = space(), attr(input, "type", "radio"), attr(
        input,
        "id",
        /*id*/
        ctx[4] + "-" + /*input*/
        ctx[10].slug
      ), attr(input, "class", "no-grow " + /*input*/
      ctx[10].slug + "-cover svelte-iqa8g"), input.__value = /*input*/
      ctx[10].value, input.value = input.__value, input.disabled = /*disabled*/
      ctx[1], attr(
        i,
        "class",
        /*input*/
        ctx[10].icon + " i--s svelte-iqa8g"
      ), attr(span, "class", "no-grow"), attr(
        label,
        "for",
        /*id*/
        ctx[4] + "-" + /*input*/
        ctx[10].slug
      ), attr(label, "class", label_class_value = "lancer-hit-quality-radio-label " + /*labelClass*/
      ctx[2] + " svelte-iqa8g"), attr(
        label,
        "data-tooltip",
        /*input*/
        ctx[10].human
      ), binding_group.p(input);
    },
    m(target, anchor) {
      insert(target, input, anchor), input.checked = input.__value === /*quality*/
      ctx[0], insert(target, t0, anchor), insert(target, label, anchor), append(label, i), append(label, span), append(span, t1), append(label, t2), if_block && if_block.m(label, null), append(label, t3), mounted || (dispose = listen(
        input,
        "change",
        /*input_change_handler*/
        ctx[8]
      ), mounted = !0);
    },
    p(ctx2, dirty) {
      dirty & /*disabled*/
      2 && (input.disabled = /*disabled*/
      ctx2[1]), dirty & /*quality*/
      1 && (input.checked = input.__value === /*quality*/
      ctx2[0]), /*input*/
      ctx2[10].value == /*quality*/
      ctx2[0] ? if_block ? (if_block.p(ctx2, dirty), dirty & /*quality*/
      1 && transition_in(if_block, 1)) : (if_block = create_if_block$3(ctx2), if_block.c(), transition_in(if_block, 1), if_block.m(label, t3)) : if_block && (group_outros(), transition_out(if_block, 1, 1, () => {
        if_block = null;
      }), check_outros()), dirty & /*labelClass*/
      4 && label_class_value !== (label_class_value = "lancer-hit-quality-radio-label " + /*labelClass*/
      ctx2[2] + " svelte-iqa8g") && attr(label, "class", label_class_value);
    },
    d(detaching) {
      detaching && detach(input), detaching && detach(t0), detaching && detach(label), if_block && if_block.d(), binding_group.r(), mounted = !1, dispose();
    }
  };
}
__name(create_each_block$4, "create_each_block$4");
function create_fragment$4(ctx) {
  let div, div_class_value, each_value = (
    /*inputs*/
    ctx[5]
  ), each_blocks = [];
  for (let i = 0; i < each_value.length; i += 1)
    each_blocks[i] = create_each_block$4(get_each_context$4(ctx, each_value, i));
  return {
    c() {
      div = element("div");
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      attr(div, "class", div_class_value = "lancer-hit-quality-radio " + /*klass*/
      ctx[3] + " svelte-iqa8g"), toggle_class(
        div,
        "disabled",
        /*disabled*/
        ctx[1]
      );
    },
    m(target, anchor) {
      insert(target, div, anchor);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(div, null);
    },
    p(ctx2, [dirty]) {
      if (dirty & /*id, inputs, labelClass, quality, disabled*/
      55) {
        each_value = /*inputs*/
        ctx2[5];
        let i;
        for (i = 0; i < each_value.length; i += 1) {
          const child_ctx = get_each_context$4(ctx2, each_value, i);
          each_blocks[i] ? each_blocks[i].p(child_ctx, dirty) : (each_blocks[i] = create_each_block$4(child_ctx), each_blocks[i].c(), each_blocks[i].m(div, null));
        }
        for (; i < each_blocks.length; i += 1)
          each_blocks[i].d(1);
        each_blocks.length = each_value.length;
      }
      dirty & /*klass*/
      8 && div_class_value !== (div_class_value = "lancer-hit-quality-radio " + /*klass*/
      ctx2[3] + " svelte-iqa8g") && attr(div, "class", div_class_value), dirty & /*klass, disabled*/
      10 && toggle_class(
        div,
        "disabled",
        /*disabled*/
        ctx2[1]
      );
    },
    i: noop,
    o: noop,
    d(detaching) {
      detaching && detach(div), destroy_each(each_blocks, detaching);
    }
  };
}
__name(create_fragment$4, "create_fragment$4");
let counter = 0;
function instance$4($$self, $$props, $$invalidate) {
  let { quality } = $$props, { disabled = !1 } = $$props, { labelClass = "" } = $$props, { class: klass = "" } = $$props, id = `damage-quality-input-${counter++}`, inputs = [
    {
      slug: "crit",
      human: "Crit",
      value: 2,
      icon: "fas fa-explosion"
    },
    {
      slug: "hit",
      human: "Hit",
      value: 1,
      icon: "fas fa-crosshairs"
    },
    {
      slug: "miss",
      human: "Miss",
      value: 0,
      icon: "mdi mdi-call-missed"
    }
  ], [send2, recv2] = crossfade({});
  const $$binding_groups = [[]];
  function input_change_handler() {
    quality = this.__value, $$invalidate(0, quality);
  }
  return __name(input_change_handler, "input_change_handler"), $$self.$$set = ($$props2) => {
    "quality" in $$props2 && $$invalidate(0, quality = $$props2.quality), "disabled" in $$props2 && $$invalidate(1, disabled = $$props2.disabled), "labelClass" in $$props2 && $$invalidate(2, labelClass = $$props2.labelClass), "class" in $$props2 && $$invalidate(3, klass = $$props2.class);
  }, [
    quality,
    disabled,
    labelClass,
    klass,
    id,
    inputs,
    send2,
    recv2,
    input_change_handler,
    $$binding_groups
  ];
}
__name(instance$4, "instance$4");
const _HitRadio = class _HitRadio extends SvelteComponent {
  constructor(options) {
    super(), init(this, options, instance$4, create_fragment$4, safe_not_equal, {
      quality: 0,
      disabled: 1,
      labelClass: 2,
      class: 3
    });
  }
};
__name(_HitRadio, "HitRadio");
let HitRadio = _HitRadio;
const HitRadio$1 = HitRadio;
function get_each_context$3(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[16] = list[i], child_ctx[17] = list, child_ctx[18] = i, child_ctx;
}
__name(get_each_context$3, "get_each_context$3");
function create_if_block_1$1(ctx) {
  let button, mounted, dispose;
  return {
    c() {
      button = element("button"), button.innerHTML = '<i class="mdi mdi-plus-thick svelte-ia8qga"></i>', attr(button, "class", "lancer-button add-damage-type small svelte-ia8qga"), attr(button, "type", "button"), attr(button, "data-tooltip", "Add a bonus damage type for only this target");
    },
    m(target, anchor) {
      insert(target, button, anchor), mounted || (dispose = listen(
        button,
        "click",
        /*addBonusDamage*/
        ctx[3]
      ), mounted = !0);
    },
    p: noop,
    d(detaching) {
      detaching && detach(button), mounted = !1, dispose();
    }
  };
}
__name(create_if_block_1$1, "create_if_block_1$1");
function create_each_block$3(key_1, ctx) {
  let div, damageinput, updating_damage, current;
  function damageinput_damage_binding(value) {
    ctx[9](
      value,
      /*damage*/
      ctx[16],
      /*each_value*/
      ctx[17],
      /*i*/
      ctx[18]
    );
  }
  __name(damageinput_damage_binding, "damageinput_damage_binding");
  function delete_handler() {
    return (
      /*delete_handler*/
      ctx[10](
        /*i*/
        ctx[18]
      )
    );
  }
  __name(delete_handler, "delete_handler");
  let damageinput_props = {};
  return (
    /*damage*/
    ctx[16] !== void 0 && (damageinput_props.damage = /*damage*/
    ctx[16]), damageinput = new DamageInput$1({ props: damageinput_props }), binding_callbacks.push(() => bind(damageinput, "damage", damageinput_damage_binding)), damageinput.$on("delete", delete_handler), {
      key: key_1,
      first: null,
      c() {
        div = element("div"), create_component(damageinput.$$.fragment), attr(div, "class", "target-bonus-damage-wrapper"), this.first = div;
      },
      m(target, anchor) {
        insert(target, div, anchor), mount_component(damageinput, div, null), current = !0;
      },
      p(new_ctx, dirty) {
        ctx = new_ctx;
        const damageinput_changes = {};
        !updating_damage && dirty & /*target*/
        1 && (updating_damage = !0, damageinput_changes.damage = /*damage*/
        ctx[16], add_flush_callback(() => updating_damage = !1)), damageinput.$set(damageinput_changes);
      },
      i(local) {
        current || (transition_in(damageinput.$$.fragment, local), current = !0);
      },
      o(local) {
        transition_out(damageinput.$$.fragment, local), current = !1;
      },
      d(detaching) {
        detaching && detach(div), destroy_component(damageinput);
      }
    }
  );
}
__name(create_each_block$3, "create_each_block$3");
function create_if_block$2(ctx) {
  let button, mounted, dispose;
  return {
    c() {
      button = element("button"), button.innerHTML = '<i class="mdi mdi-plus-thick svelte-ia8qga"></i>', attr(button, "class", "lancer-button add-damage-type svelte-ia8qga"), attr(button, "type", "button"), attr(button, "data-tooltip", "Add a bonus damage type for only this target");
    },
    m(target, anchor) {
      insert(target, button, anchor), mounted || (dispose = listen(
        button,
        "click",
        /*addBonusDamage*/
        ctx[3]
      ), mounted = !0);
    },
    p: noop,
    d(detaching) {
      detaching && detach(button), mounted = !1, dispose();
    }
  };
}
__name(create_if_block$2, "create_if_block$2");
function create_fragment$3(ctx) {
  let div4, span0, t0, b0, t1_value = (
    /*target*/
    ctx[0].target.name + ""
  ), t1, t2, t3, div1, img, img_alt_value, img_src_value, t4, div0, span1, b1, t6, t7, each_blocks = [], each_1_lookup = /* @__PURE__ */ new Map(), t8, t9, div2, hitradio, updating_quality, t10, div3, hudcheckbox0, updating_value, t11, hudcheckbox1, updating_value_1, t12, hudcheckbox2, updating_value_2, div4_class_value, div4_intro, div4_outro, current, if_block0 = (
    /*target*/
    ctx[0].bonusDamage.length && create_if_block_1$1(ctx)
  ), each_value = (
    /*target*/
    ctx[0].bonusDamage
  );
  const get_key = /* @__PURE__ */ __name((ctx2) => (
    /*i*/
    ctx2[18]
  ), "get_key");
  for (let i = 0; i < each_value.length; i += 1) {
    let child_ctx = get_each_context$3(ctx, each_value, i), key = get_key(child_ctx);
    each_1_lookup.set(key, each_blocks[i] = create_each_block$3(key, child_ctx));
  }
  let if_block1 = !/*target*/
  ctx[0].bonusDamage.length && create_if_block$2(ctx);
  function hitradio_quality_binding(value) {
    ctx[11](value);
  }
  __name(hitradio_quality_binding, "hitradio_quality_binding");
  let hitradio_props = { class: "damage-target-quality flexrow" };
  /*target*/
  ctx[0].quality !== void 0 && (hitradio_props.quality = /*target*/
  ctx[0].quality), hitradio = new HitRadio$1({ props: hitradio_props }), binding_callbacks.push(() => bind(hitradio, "quality", hitradio_quality_binding));
  function hudcheckbox0_value_binding(value) {
    ctx[12](value);
  }
  __name(hudcheckbox0_value_binding, "hudcheckbox0_value_binding");
  let hudcheckbox0_props = {
    icon: "mdi mdi-shield-off-outline",
    tooltip: "Armor Piercing (AP)",
    disabled: (
      /*target*/
      ctx[0].paracausal
    )
  };
  /*target*/
  ctx[0].ap !== void 0 && (hudcheckbox0_props.value = /*target*/
  ctx[0].ap), hudcheckbox0 = new HudCheckbox$1({ props: hudcheckbox0_props }), binding_callbacks.push(() => bind(hudcheckbox0, "value", hudcheckbox0_value_binding)), hudcheckbox0.$on(
    "change",
    /*toggleAP*/
    ctx[5]
  );
  function hudcheckbox1_value_binding(value) {
    ctx[13](value);
  }
  __name(hudcheckbox1_value_binding, "hudcheckbox1_value_binding");
  let hudcheckbox1_props = {
    icon: "cci cci-large-beam",
    tooltip: "For 'cannot be reduced' effects like the Paracausal mod",
    style: "margin: 0 0.3em;"
  };
  /*target*/
  ctx[0].paracausal !== void 0 && (hudcheckbox1_props.value = /*target*/
  ctx[0].paracausal), hudcheckbox1 = new HudCheckbox$1({ props: hudcheckbox1_props }), binding_callbacks.push(() => bind(hudcheckbox1, "value", hudcheckbox1_value_binding)), hudcheckbox1.$on(
    "change",
    /*toggleParacausal*/
    ctx[6]
  );
  function hudcheckbox2_value_binding(value) {
    ctx[14](value);
  }
  __name(hudcheckbox2_value_binding, "hudcheckbox2_value_binding");
  let hudcheckbox2_props = {
    icon: "mdi mdi-fraction-one-half",
    tooltip: "For effects which cause the attacker to deal half damage in addition to resistance, like Heavy Gunner"
  };
  return (
    /*target*/
    ctx[0].halfDamage !== void 0 && (hudcheckbox2_props.value = /*target*/
    ctx[0].halfDamage), hudcheckbox2 = new HudCheckbox$1({ props: hudcheckbox2_props }), binding_callbacks.push(() => bind(hudcheckbox2, "value", hudcheckbox2_value_binding)), hudcheckbox2.$on(
      "change",
      /*toggleHalfDamage*/
      ctx[7]
    ), {
      c() {
        var _a;
        div4 = element("div"), span0 = element("span"), t0 = text("🞂"), b0 = element("b"), t1 = text(t1_value), t2 = text("🞀"), t3 = space(), div1 = element("div"), img = element("img"), t4 = space(), div0 = element("div"), span1 = element("span"), b1 = element("b"), b1.textContent = "Bonus", t6 = space(), if_block0 && if_block0.c(), t7 = space();
        for (let i = 0; i < each_blocks.length; i += 1)
          each_blocks[i].c();
        t8 = space(), if_block1 && if_block1.c(), t9 = space(), div2 = element("div"), create_component(hitradio.$$.fragment), t10 = space(), div3 = element("div"), create_component(hudcheckbox0.$$.fragment), t11 = space(), create_component(hudcheckbox1.$$.fragment), t12 = space(), create_component(hudcheckbox2.$$.fragment), attr(span0, "class", "target-name flexrow lancer-mini-header svelte-ia8qga"), attr(img, "class", "lancer-hit-thumb accdiff-target-has-dropdown svelte-ia8qga"), attr(img, "alt", img_alt_value = /*target*/
        ctx[0].target.name ?? void 0), src_url_equal(img.src, img_src_value = /*target*/
        (_a = ctx[0].target.actor) == null ? void 0 : _a.img) || attr(img, "src", img_src_value), attr(b1, "class", "target-bonus-damage-title svelte-ia8qga"), attr(span1, "class", "flexrow"), set_style(span1, "width", "100%"), attr(div0, "class", "card clipped target-bonus-damage svelte-ia8qga"), attr(div1, "class", "flexrow"), attr(div2, "class", "hit-quality svelte-ia8qga"), attr(div3, "class", "flexrow damage-target-config svelte-ia8qga"), attr(div4, "class", div4_class_value = null_to_empty(`damage-hud-target-card card ${/*hitQualityClass*/
        ctx[2]}`) + " svelte-ia8qga");
      },
      m(target, anchor) {
        insert(target, div4, anchor), append(div4, span0), append(span0, t0), append(span0, b0), append(b0, t1), append(span0, t2), append(div4, t3), append(div4, div1), append(div1, img), ctx[8](img), append(div1, t4), append(div1, div0), append(div0, span1), append(span1, b1), append(span1, t6), if_block0 && if_block0.m(span1, null), append(div0, t7);
        for (let i = 0; i < each_blocks.length; i += 1)
          each_blocks[i] && each_blocks[i].m(div0, null);
        append(div0, t8), if_block1 && if_block1.m(div0, null), append(div4, t9), append(div4, div2), mount_component(hitradio, div2, null), append(div4, t10), append(div4, div3), mount_component(hudcheckbox0, div3, null), append(div3, t11), mount_component(hudcheckbox1, div3, null), append(div3, t12), mount_component(hudcheckbox2, div3, null), current = !0;
      },
      p(ctx2, [dirty]) {
        var _a;
        (!current || dirty & /*target*/
        1) && t1_value !== (t1_value = /*target*/
        ctx2[0].target.name + "") && set_data(t1, t1_value), (!current || dirty & /*target*/
        1 && img_alt_value !== (img_alt_value = /*target*/
        ctx2[0].target.name ?? void 0)) && attr(img, "alt", img_alt_value), (!current || dirty & /*target*/
        1 && !src_url_equal(img.src, img_src_value = /*target*/
        (_a = ctx2[0].target.actor) == null ? void 0 : _a.img)) && attr(img, "src", img_src_value), /*target*/
        ctx2[0].bonusDamage.length ? if_block0 ? if_block0.p(ctx2, dirty) : (if_block0 = create_if_block_1$1(ctx2), if_block0.c(), if_block0.m(span1, null)) : if_block0 && (if_block0.d(1), if_block0 = null), dirty & /*target, removeBonusDamage*/
        17 && (each_value = /*target*/
        ctx2[0].bonusDamage, group_outros(), each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, div0, outro_and_destroy_block, create_each_block$3, t8, get_each_context$3), check_outros()), /*target*/
        ctx2[0].bonusDamage.length ? if_block1 && (if_block1.d(1), if_block1 = null) : if_block1 ? if_block1.p(ctx2, dirty) : (if_block1 = create_if_block$2(ctx2), if_block1.c(), if_block1.m(div0, null));
        const hitradio_changes = {};
        !updating_quality && dirty & /*target*/
        1 && (updating_quality = !0, hitradio_changes.quality = /*target*/
        ctx2[0].quality, add_flush_callback(() => updating_quality = !1)), hitradio.$set(hitradio_changes);
        const hudcheckbox0_changes = {};
        dirty & /*target*/
        1 && (hudcheckbox0_changes.disabled = /*target*/
        ctx2[0].paracausal), !updating_value && dirty & /*target*/
        1 && (updating_value = !0, hudcheckbox0_changes.value = /*target*/
        ctx2[0].ap, add_flush_callback(() => updating_value = !1)), hudcheckbox0.$set(hudcheckbox0_changes);
        const hudcheckbox1_changes = {};
        !updating_value_1 && dirty & /*target*/
        1 && (updating_value_1 = !0, hudcheckbox1_changes.value = /*target*/
        ctx2[0].paracausal, add_flush_callback(() => updating_value_1 = !1)), hudcheckbox1.$set(hudcheckbox1_changes);
        const hudcheckbox2_changes = {};
        !updating_value_2 && dirty & /*target*/
        1 && (updating_value_2 = !0, hudcheckbox2_changes.value = /*target*/
        ctx2[0].halfDamage, add_flush_callback(() => updating_value_2 = !1)), hudcheckbox2.$set(hudcheckbox2_changes), (!current || dirty & /*hitQualityClass*/
        4 && div4_class_value !== (div4_class_value = null_to_empty(`damage-hud-target-card card ${/*hitQualityClass*/
        ctx2[2]}`) + " svelte-ia8qga")) && attr(div4, "class", div4_class_value);
      },
      i(local) {
        if (!current) {
          for (let i = 0; i < each_value.length; i += 1)
            transition_in(each_blocks[i]);
          transition_in(hitradio.$$.fragment, local), transition_in(hudcheckbox0.$$.fragment, local), transition_in(hudcheckbox1.$$.fragment, local), transition_in(hudcheckbox2.$$.fragment, local), add_render_callback(() => {
            current && (div4_outro && div4_outro.end(1), div4_intro = create_in_transition(div4, slide, { delay: 100, duration: 300 }), div4_intro.start());
          }), current = !0;
        }
      },
      o(local) {
        for (let i = 0; i < each_blocks.length; i += 1)
          transition_out(each_blocks[i]);
        transition_out(hitradio.$$.fragment, local), transition_out(hudcheckbox0.$$.fragment, local), transition_out(hudcheckbox1.$$.fragment, local), transition_out(hudcheckbox2.$$.fragment, local), div4_intro && div4_intro.invalidate(), div4_outro = create_out_transition(div4, slide, { duration: 100 }), current = !1;
      },
      d(detaching) {
        detaching && detach(div4), ctx[8](null), if_block0 && if_block0.d();
        for (let i = 0; i < each_blocks.length; i += 1)
          each_blocks[i].d();
        if_block1 && if_block1.d(), destroy_component(hitradio), destroy_component(hudcheckbox0), destroy_component(hudcheckbox1), destroy_component(hudcheckbox2), detaching && div4_outro && div4_outro.end();
      }
    }
  );
}
__name(create_fragment$3, "create_fragment$3");
function instance$3($$self, $$props, $$invalidate) {
  let hitQualityClass;
  const dispatch = createEventDispatcher();
  let { target } = $$props, imgElement;
  function addBonusDamage() {
    $$invalidate(0, target.bonusDamage = [...target.bonusDamage, { type: DamageType.Kinetic, val: "1d6" }], target);
  }
  __name(addBonusDamage, "addBonusDamage");
  function removeBonusDamage(idx) {
    $$invalidate(0, target.bonusDamage = target.bonusDamage.filter((_, i) => i !== idx), target);
  }
  __name(removeBonusDamage, "removeBonusDamage");
  function toggleAP(event) {
    dispatch("ap", event.detail);
  }
  __name(toggleAP, "toggleAP");
  function toggleParacausal(event) {
    dispatch("paracausal", event.detail), event.detail && $$invalidate(0, target.ap = !0, target);
  }
  __name(toggleParacausal, "toggleParacausal");
  function toggleHalfDamage(event) {
    dispatch("halfDmg", event.detail);
  }
  __name(toggleHalfDamage, "toggleHalfDamage");
  function img_binding($$value) {
    binding_callbacks[$$value ? "unshift" : "push"](() => {
      imgElement = $$value, $$invalidate(1, imgElement);
    });
  }
  __name(img_binding, "img_binding");
  function damageinput_damage_binding(value, damage, each_value, i) {
    each_value[i] = value, $$invalidate(0, target);
  }
  __name(damageinput_damage_binding, "damageinput_damage_binding");
  const delete_handler = /* @__PURE__ */ __name((i) => removeBonusDamage(i), "delete_handler");
  function hitradio_quality_binding(value) {
    $$self.$$.not_equal(target.quality, value) && (target.quality = value, $$invalidate(0, target));
  }
  __name(hitradio_quality_binding, "hitradio_quality_binding");
  function hudcheckbox0_value_binding(value) {
    $$self.$$.not_equal(target.ap, value) && (target.ap = value, $$invalidate(0, target));
  }
  __name(hudcheckbox0_value_binding, "hudcheckbox0_value_binding");
  function hudcheckbox1_value_binding(value) {
    $$self.$$.not_equal(target.paracausal, value) && (target.paracausal = value, $$invalidate(0, target));
  }
  __name(hudcheckbox1_value_binding, "hudcheckbox1_value_binding");
  function hudcheckbox2_value_binding(value) {
    $$self.$$.not_equal(target.halfDamage, value) && (target.halfDamage = value, $$invalidate(0, target));
  }
  return __name(hudcheckbox2_value_binding, "hudcheckbox2_value_binding"), $$self.$$set = ($$props2) => {
    "target" in $$props2 && $$invalidate(0, target = $$props2.target);
  }, $$self.$$.update = () => {
    $$self.$$.dirty & /*target*/
    1 && $$invalidate(2, hitQualityClass = target.quality === HitQuality.Hit ? "target-hit" : target.quality === HitQuality.Crit ? "target-crit" : "target-miss");
  }, [
    target,
    imgElement,
    hitQualityClass,
    addBonusDamage,
    removeBonusDamage,
    toggleAP,
    toggleParacausal,
    toggleHalfDamage,
    img_binding,
    damageinput_damage_binding,
    delete_handler,
    hitradio_quality_binding,
    hudcheckbox0_value_binding,
    hudcheckbox1_value_binding,
    hudcheckbox2_value_binding
  ];
}
__name(instance$3, "instance$3");
const _DamageTarget = class _DamageTarget extends SvelteComponent {
  constructor(options) {
    super(), init(this, options, instance$3, create_fragment$3, safe_not_equal, { target: 0 });
  }
};
__name(_DamageTarget, "DamageTarget");
let DamageTarget = _DamageTarget;
const DamageTarget$1 = DamageTarget;
function get_each_context$2(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[54] = list[i], child_ctx;
}
__name(get_each_context$2, "get_each_context$2");
function get_each_context_1$1(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[57] = list[i], child_ctx[58] = list, child_ctx[59] = i, child_ctx;
}
__name(get_each_context_1$1, "get_each_context_1$1");
function get_each_context_2(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[57] = list[i], child_ctx[60] = list, child_ctx[59] = i, child_ctx;
}
__name(get_each_context_2, "get_each_context_2");
function get_each_context_3(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[57] = list[i], child_ctx[61] = list, child_ctx[59] = i, child_ctx;
}
__name(get_each_context_3, "get_each_context_3");
function get_each_context_4(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[57] = list[i], child_ctx[62] = list, child_ctx[59] = i, child_ctx;
}
__name(get_each_context_4, "get_each_context_4");
function create_if_block_4(ctx) {
  let div, i, t0, span, t1, t2;
  return {
    c() {
      div = element("div"), i = element("i"), t0 = space(), span = element("span"), t1 = text(
        /*title*/
        ctx[3]
      ), t2 = text(
        /*rollerName*/
        ctx[13]
      ), attr(i, "class", "cci cci-large-beam i--m i--light svelte-1tnd08e"), attr(div, "class", "lancer-header lancer-weapon medium");
    },
    m(target, anchor) {
      insert(target, div, anchor), append(div, i), append(div, t0), append(div, span), append(span, t1), append(span, t2);
    },
    p(ctx2, dirty) {
      dirty[0] & /*title*/
      8 && set_data(
        t1,
        /*title*/
        ctx2[3]
      );
    },
    d(detaching) {
      detaching && detach(div);
    }
  };
}
__name(create_if_block_4, "create_if_block_4");
function create_if_block_3(ctx) {
  let miniprofile, current;
  return miniprofile = new MiniProfile$1({ props: { profile: (
    /*profile*/
    ctx[8]
  ) } }), {
    c() {
      create_component(miniprofile.$$.fragment);
    },
    m(target, anchor) {
      mount_component(miniprofile, target, anchor), current = !0;
    },
    p(ctx2, dirty) {
      const miniprofile_changes = {};
      dirty[0] & /*profile*/
      256 && (miniprofile_changes.profile = /*profile*/
      ctx2[8]), miniprofile.$set(miniprofile_changes);
    },
    i(local) {
      current || (transition_in(miniprofile.$$.fragment, local), current = !0);
    },
    o(local) {
      transition_out(miniprofile.$$.fragment, local), current = !1;
    },
    d(detaching) {
      destroy_component(miniprofile, detaching);
    }
  };
}
__name(create_if_block_3, "create_if_block_3");
function create_each_block_4(key_1, ctx) {
  let div, damageinput, updating_damage, current;
  function damageinput_damage_binding(value) {
    ctx[29](
      value,
      /*damage*/
      ctx[57],
      /*each_value_4*/
      ctx[62],
      /*i*/
      ctx[59]
    );
  }
  __name(damageinput_damage_binding, "damageinput_damage_binding");
  function delete_handler() {
    return (
      /*delete_handler*/
      ctx[30](
        /*i*/
        ctx[59]
      )
    );
  }
  __name(delete_handler, "delete_handler");
  let damageinput_props = {};
  return (
    /*damage*/
    ctx[57] !== void 0 && (damageinput_props.damage = /*damage*/
    ctx[57]), damageinput = new DamageInput$1({ props: damageinput_props }), binding_callbacks.push(() => bind(damageinput, "damage", damageinput_damage_binding)), damageinput.$on("delete", delete_handler), {
      key: key_1,
      first: null,
      c() {
        div = element("div"), create_component(damageinput.$$.fragment), this.first = div;
      },
      m(target, anchor) {
        insert(target, div, anchor), mount_component(damageinput, div, null), current = !0;
      },
      p(new_ctx, dirty) {
        ctx = new_ctx;
        const damageinput_changes = {};
        !updating_damage && dirty[0] & /*weaponDamage*/
        1024 && (updating_damage = !0, damageinput_changes.damage = /*damage*/
        ctx[57], add_flush_callback(() => updating_damage = !1)), damageinput.$set(damageinput_changes);
      },
      i(local) {
        current || (transition_in(damageinput.$$.fragment, local), current = !0);
      },
      o(local) {
        transition_out(damageinput.$$.fragment, local), current = !1;
      },
      d(detaching) {
        detaching && detach(div), destroy_component(damageinput);
      }
    }
  );
}
__name(create_each_block_4, "create_each_block_4");
function create_each_block_3(key_1, ctx) {
  let div, damageinput, updating_damage, t, current;
  function damageinput_damage_binding_1(value) {
    ctx[31](
      value,
      /*damage*/
      ctx[57],
      /*each_value_3*/
      ctx[61],
      /*i*/
      ctx[59]
    );
  }
  __name(damageinput_damage_binding_1, "damageinput_damage_binding_1");
  function delete_handler_1() {
    return (
      /*delete_handler_1*/
      ctx[32](
        /*i*/
        ctx[59]
      )
    );
  }
  __name(delete_handler_1, "delete_handler_1");
  let damageinput_props = {};
  return (
    /*damage*/
    ctx[57] !== void 0 && (damageinput_props.damage = /*damage*/
    ctx[57]), damageinput = new DamageInput$1({ props: damageinput_props }), binding_callbacks.push(() => bind(damageinput, "damage", damageinput_damage_binding_1)), damageinput.$on("delete", delete_handler_1), {
      key: key_1,
      first: null,
      c() {
        div = element("div"), create_component(damageinput.$$.fragment), t = space(), this.first = div;
      },
      m(target, anchor) {
        insert(target, div, anchor), mount_component(damageinput, div, null), append(div, t), current = !0;
      },
      p(new_ctx, dirty) {
        ctx = new_ctx;
        const damageinput_changes = {};
        !updating_damage && dirty[0] & /*baseDamage*/
        4096 && (updating_damage = !0, damageinput_changes.damage = /*damage*/
        ctx[57], add_flush_callback(() => updating_damage = !1)), damageinput.$set(damageinput_changes);
      },
      i(local) {
        current || (transition_in(damageinput.$$.fragment, local), current = !0);
      },
      o(local) {
        transition_out(damageinput.$$.fragment, local), current = !1;
      },
      d(detaching) {
        detaching && detach(div), destroy_component(damageinput);
      }
    }
  );
}
__name(create_each_block_3, "create_each_block_3");
function create_each_block_2(key_1, ctx) {
  let div, damageinput, updating_damage, current;
  function damageinput_damage_binding_2(value) {
    ctx[33](
      value,
      /*damage*/
      ctx[57],
      /*each_value_2*/
      ctx[60],
      /*i*/
      ctx[59]
    );
  }
  __name(damageinput_damage_binding_2, "damageinput_damage_binding_2");
  function delete_handler_2() {
    return (
      /*delete_handler_2*/
      ctx[34](
        /*i*/
        ctx[59]
      )
    );
  }
  __name(delete_handler_2, "delete_handler_2");
  let damageinput_props = {};
  return (
    /*damage*/
    ctx[57] !== void 0 && (damageinput_props.damage = /*damage*/
    ctx[57]), damageinput = new DamageInput$1({ props: damageinput_props }), binding_callbacks.push(() => bind(damageinput, "damage", damageinput_damage_binding_2)), damageinput.$on("delete", delete_handler_2), {
      key: key_1,
      first: null,
      c() {
        div = element("div"), create_component(damageinput.$$.fragment), this.first = div;
      },
      m(target, anchor) {
        insert(target, div, anchor), mount_component(damageinput, div, null), current = !0;
      },
      p(new_ctx, dirty) {
        ctx = new_ctx;
        const damageinput_changes = {};
        !updating_damage && dirty[0] & /*weaponBonusDamage*/
        512 && (updating_damage = !0, damageinput_changes.damage = /*damage*/
        ctx[57], add_flush_callback(() => updating_damage = !1)), damageinput.$set(damageinput_changes);
      },
      i(local) {
        current || (transition_in(damageinput.$$.fragment, local), current = !0);
      },
      o(local) {
        transition_out(damageinput.$$.fragment, local), current = !1;
      },
      d(detaching) {
        detaching && detach(div), destroy_component(damageinput);
      }
    }
  );
}
__name(create_each_block_2, "create_each_block_2");
function create_each_block_1$1(key_1, ctx) {
  let div, damageinput, updating_damage, t, current;
  function damageinput_damage_binding_3(value) {
    ctx[35](
      value,
      /*damage*/
      ctx[57],
      /*each_value_1*/
      ctx[58],
      /*i*/
      ctx[59]
    );
  }
  __name(damageinput_damage_binding_3, "damageinput_damage_binding_3");
  function delete_handler_3() {
    return (
      /*delete_handler_3*/
      ctx[36](
        /*i*/
        ctx[59]
      )
    );
  }
  __name(delete_handler_3, "delete_handler_3");
  let damageinput_props = {};
  return (
    /*damage*/
    ctx[57] !== void 0 && (damageinput_props.damage = /*damage*/
    ctx[57]), damageinput = new DamageInput$1({ props: damageinput_props }), binding_callbacks.push(() => bind(damageinput, "damage", damageinput_damage_binding_3)), damageinput.$on("delete", delete_handler_3), {
      key: key_1,
      first: null,
      c() {
        div = element("div"), create_component(damageinput.$$.fragment), t = space(), this.first = div;
      },
      m(target, anchor) {
        insert(target, div, anchor), mount_component(damageinput, div, null), append(div, t), current = !0;
      },
      p(new_ctx, dirty) {
        ctx = new_ctx;
        const damageinput_changes = {};
        !updating_damage && dirty[0] & /*baseBonusDamage*/
        2048 && (updating_damage = !0, damageinput_changes.damage = /*damage*/
        ctx[57], add_flush_callback(() => updating_damage = !1)), damageinput.$set(damageinput_changes);
      },
      i(local) {
        current || (transition_in(damageinput.$$.fragment, local), current = !0);
      },
      o(local) {
        transition_out(damageinput.$$.fragment, local), current = !1;
      },
      d(detaching) {
        detaching && detach(div), destroy_component(damageinput);
      }
    }
  );
}
__name(create_each_block_1$1, "create_each_block_1$1");
function create_if_block_2(ctx) {
  let i, i_transition, t, input, input_transition, current, mounted, dispose;
  return {
    c() {
      i = element("i"), t = space(), input = element("input"), attr(i, "class", "cci i--sm cci-" + /*reliableType*/
      ctx[16]().toLowerCase() + " damage--" + /*reliableType*/
      ctx[16]().toLowerCase() + " svelte-1tnd08e"), attr(
        i,
        "data-tooltip",
        /*reliableType*/
        ctx[16]()
      ), attr(input, "class", "reliable-value svelte-1tnd08e"), attr(input, "type", "number");
    },
    m(target, anchor) {
      insert(target, i, anchor), insert(target, t, anchor), insert(target, input, anchor), set_input_value(
        input,
        /*weapon*/
        ctx[0].reliableValue
      ), current = !0, mounted || (dispose = listen(
        input,
        "input",
        /*input_input_handler*/
        ctx[45]
      ), mounted = !0);
    },
    p(ctx2, dirty) {
      dirty[0] & /*weapon*/
      1 && to_number(input.value) !== /*weapon*/
      ctx2[0].reliableValue && set_input_value(
        input,
        /*weapon*/
        ctx2[0].reliableValue
      );
    },
    i(local) {
      current || (add_render_callback(() => {
        current && (i_transition || (i_transition = create_bidirectional_transition(i, fade$1, {}, !0)), i_transition.run(1));
      }), add_render_callback(() => {
        current && (input_transition || (input_transition = create_bidirectional_transition(input, fade$1, {}, !0)), input_transition.run(1));
      }), current = !0);
    },
    o(local) {
      i_transition || (i_transition = create_bidirectional_transition(i, fade$1, {}, !1)), i_transition.run(0), input_transition || (input_transition = create_bidirectional_transition(input, fade$1, {}, !1)), input_transition.run(0), current = !1;
    },
    d(detaching) {
      detaching && detach(i), detaching && i_transition && i_transition.end(), detaching && detach(t), detaching && detach(input), detaching && input_transition && input_transition.end(), mounted = !1, dispose();
    }
  };
}
__name(create_if_block_2, "create_if_block_2");
function create_if_block_1(ctx) {
  let each_blocks = [], each_1_lookup = /* @__PURE__ */ new Map(), each_1_anchor, current, each_value = (
    /*targets*/
    ctx[2]
  );
  const get_key = /* @__PURE__ */ __name((ctx2) => (
    /*target*/
    ctx2[54].target.id
  ), "get_key");
  for (let i = 0; i < each_value.length; i += 1) {
    let child_ctx = get_each_context$2(ctx, each_value, i), key = get_key(child_ctx);
    each_1_lookup.set(key, each_blocks[i] = create_each_block$2(key, child_ctx));
  }
  return {
    c() {
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      each_1_anchor = empty();
    },
    m(target, anchor) {
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(target, anchor);
      insert(target, each_1_anchor, anchor), current = !0;
    },
    p(ctx2, dirty) {
      if (dirty[0] & /*targets, updateTargets*/
      16777220) {
        each_value = /*targets*/
        ctx2[2], group_outros();
        for (let i = 0; i < each_blocks.length; i += 1)
          each_blocks[i].r();
        each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, each_1_anchor.parentNode, fix_and_outro_and_destroy_block, create_each_block$2, each_1_anchor, get_each_context$2);
        for (let i = 0; i < each_blocks.length; i += 1)
          each_blocks[i].a();
        check_outros();
      }
    },
    i(local) {
      if (!current) {
        for (let i = 0; i < each_value.length; i += 1)
          transition_in(each_blocks[i]);
        current = !0;
      }
    },
    o(local) {
      for (let i = 0; i < each_blocks.length; i += 1)
        transition_out(each_blocks[i]);
      current = !1;
    },
    d(detaching) {
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].d(detaching);
      detaching && detach(each_1_anchor);
    }
  };
}
__name(create_if_block_1, "create_if_block_1");
function create_if_block$1(ctx) {
  let div1, span, t0, b, t1_value = (
    /*targets*/
    ctx[2][0].target.name + ""
  ), t1, t2, t3, div0, img, img_alt_value, img_src_value, t4, hitradio, updating_quality, div1_class_value, current, mounted, dispose;
  function hitradio_quality_binding(value) {
    ctx[46](value);
  }
  __name(hitradio_quality_binding, "hitradio_quality_binding");
  let hitradio_props = { class: "damage-target-quality flexcol" };
  return (
    /*targets*/
    ctx[2][0].quality !== void 0 && (hitradio_props.quality = /*targets*/
    ctx[2][0].quality), hitradio = new HitRadio$1({ props: hitradio_props }), binding_callbacks.push(() => bind(hitradio, "quality", hitradio_quality_binding)), {
      c() {
        var _a;
        div1 = element("div"), span = element("span"), t0 = text("🞂"), b = element("b"), t1 = text(t1_value), t2 = text("🞀"), t3 = space(), div0 = element("div"), img = element("img"), t4 = space(), create_component(hitradio.$$.fragment), attr(b, "class", "svelte-1tnd08e"), attr(span, "class", "target-name flexrow lancer-mini-header svelte-1tnd08e"), attr(img, "class", "lancer-hit-thumb accdiff-target-has-dropdown svelte-1tnd08e"), attr(img, "alt", img_alt_value = /*targets*/
        ctx[2][0].target.name ?? void 0), src_url_equal(img.src, img_src_value = /*targets*/
        (_a = ctx[2][0].target.actor) == null ? void 0 : _a.img) || attr(img, "src", img_src_value), attr(div0, "class", "target-body flexrow svelte-1tnd08e"), attr(div1, "class", div1_class_value = null_to_empty(`single-target-container ${/*targetHitQualityClass*/
        ctx[7]}`) + " svelte-1tnd08e");
      },
      m(target, anchor) {
        insert(target, div1, anchor), append(div1, span), append(span, t0), append(span, b), append(b, t1), append(span, t2), append(div1, t3), append(div1, div0), append(div0, img), append(div0, t4), mount_component(hitradio, div0, null), current = !0, mounted || (dispose = [
          listen(
            div1,
            "mouseenter",
            /*mouseenter_handler*/
            ctx[47]
          ),
          listen(
            div1,
            "mouseleave",
            /*mouseleave_handler*/
            ctx[48]
          )
        ], mounted = !0);
      },
      p(ctx2, dirty) {
        var _a;
        (!current || dirty[0] & /*targets*/
        4) && t1_value !== (t1_value = /*targets*/
        ctx2[2][0].target.name + "") && set_data(t1, t1_value), (!current || dirty[0] & /*targets*/
        4 && img_alt_value !== (img_alt_value = /*targets*/
        ctx2[2][0].target.name ?? void 0)) && attr(img, "alt", img_alt_value), (!current || dirty[0] & /*targets*/
        4 && !src_url_equal(img.src, img_src_value = /*targets*/
        (_a = ctx2[2][0].target.actor) == null ? void 0 : _a.img)) && attr(img, "src", img_src_value);
        const hitradio_changes = {};
        !updating_quality && dirty[0] & /*targets*/
        4 && (updating_quality = !0, hitradio_changes.quality = /*targets*/
        ctx2[2][0].quality, add_flush_callback(() => updating_quality = !1)), hitradio.$set(hitradio_changes), (!current || dirty[0] & /*targetHitQualityClass*/
        128 && div1_class_value !== (div1_class_value = null_to_empty(`single-target-container ${/*targetHitQualityClass*/
        ctx2[7]}`) + " svelte-1tnd08e")) && attr(div1, "class", div1_class_value);
      },
      i(local) {
        current || (transition_in(hitradio.$$.fragment, local), current = !0);
      },
      o(local) {
        transition_out(hitradio.$$.fragment, local), current = !1;
      },
      d(detaching) {
        detaching && detach(div1), destroy_component(hitradio), mounted = !1, run_all(dispose);
      }
    }
  );
}
__name(create_if_block$1, "create_if_block$1");
function create_each_block$2(key_1, ctx) {
  let div, damagetarget, t, div_class_value, rect, stop_animation = noop, current, mounted, dispose;
  damagetarget = new DamageTarget$1({ props: { target: (
    /*target*/
    ctx[54]
  ) } }), damagetarget.$on(
    "ap",
    /*updateTargets*/
    ctx[24]
  ), damagetarget.$on(
    "paracausal",
    /*updateTargets*/
    ctx[24]
  ), damagetarget.$on(
    "halfDmg",
    /*updateTargets*/
    ctx[24]
  );
  function mouseenter_handler_1(...args) {
    return (
      /*mouseenter_handler_1*/
      ctx[49](
        /*target*/
        ctx[54],
        ...args
      )
    );
  }
  __name(mouseenter_handler_1, "mouseenter_handler_1");
  function mouseleave_handler_1(...args) {
    return (
      /*mouseleave_handler_1*/
      ctx[50](
        /*target*/
        ctx[54],
        ...args
      )
    );
  }
  return __name(mouseleave_handler_1, "mouseleave_handler_1"), {
    key: key_1,
    first: null,
    c() {
      div = element("div"), create_component(damagetarget.$$.fragment), t = space(), attr(div, "class", div_class_value = "target-container " + /*targets*/
      (ctx[2].length <= 1 ? "solo" : "") + " svelte-1tnd08e"), this.first = div;
    },
    m(target, anchor) {
      insert(target, div, anchor), mount_component(damagetarget, div, null), append(div, t), current = !0, mounted || (dispose = [
        listen(div, "mouseenter", mouseenter_handler_1),
        listen(div, "mouseleave", mouseleave_handler_1)
      ], mounted = !0);
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
      const damagetarget_changes = {};
      dirty[0] & /*targets*/
      4 && (damagetarget_changes.target = /*target*/
      ctx[54]), damagetarget.$set(damagetarget_changes), (!current || dirty[0] & /*targets*/
      4 && div_class_value !== (div_class_value = "target-container " + /*targets*/
      (ctx[2].length <= 1 ? "solo" : "") + " svelte-1tnd08e")) && attr(div, "class", div_class_value);
    },
    r() {
      rect = div.getBoundingClientRect();
    },
    f() {
      fix_position(div), stop_animation();
    },
    a() {
      stop_animation(), stop_animation = create_animation(div, rect, flip, { duration: 200 });
    },
    i(local) {
      current || (transition_in(damagetarget.$$.fragment, local), current = !0);
    },
    o(local) {
      transition_out(damagetarget.$$.fragment, local), current = !1;
    },
    d(detaching) {
      detaching && detach(div), destroy_component(damagetarget), mounted = !1, run_all(dispose);
    }
  };
}
__name(create_each_block$2, "create_each_block$2");
function create_fragment$2(ctx) {
  let form, t0, t1, div2, div0, h30, t2, button0, t3, each_blocks_3 = [], each0_lookup = /* @__PURE__ */ new Map(), t4, each_blocks_2 = [], each1_lookup = /* @__PURE__ */ new Map(), t5, div1, h31, t6, button1, t7, each_blocks_1 = [], each2_lookup = /* @__PURE__ */ new Map(), t8, each_blocks = [], each3_lookup = /* @__PURE__ */ new Map(), t9, div4, h32, t11, hudcheckbox0, updating_value, updating_partial, t12, hudcheckbox1, updating_value_1, t13, hudcheckbox2, updating_value_2, updating_partial_1, t14, hudcheckbox3, updating_value_3, updating_partial_2, t15, div3, hudcheckbox4, updating_value_4, t16, t17, div5, current_block_type_index, if_block3, t18, div6, button2, t20, button3, current, mounted, dispose, if_block0 = (
    /*title*/
    ctx[3] != "" && create_if_block_4(ctx)
  ), if_block1 = (
    /*profile*/
    ctx[8] && create_if_block_3(ctx)
  ), each_value_4 = (
    /*weaponDamage*/
    ctx[10]
  );
  const get_key = /* @__PURE__ */ __name((ctx2) => (
    /*i*/
    ctx2[59]
  ), "get_key");
  for (let i = 0; i < each_value_4.length; i += 1) {
    let child_ctx = get_each_context_4(ctx, each_value_4, i), key = get_key(child_ctx);
    each0_lookup.set(key, each_blocks_3[i] = create_each_block_4(key, child_ctx));
  }
  let each_value_3 = (
    /*baseDamage*/
    ctx[12]
  );
  const get_key_1 = /* @__PURE__ */ __name((ctx2) => (
    /*i*/
    ctx2[59]
  ), "get_key_1");
  for (let i = 0; i < each_value_3.length; i += 1) {
    let child_ctx = get_each_context_3(ctx, each_value_3, i), key = get_key_1(child_ctx);
    each1_lookup.set(key, each_blocks_2[i] = create_each_block_3(key, child_ctx));
  }
  let each_value_2 = (
    /*weaponBonusDamage*/
    ctx[9]
  );
  const get_key_2 = /* @__PURE__ */ __name((ctx2) => (
    /*i*/
    ctx2[59]
  ), "get_key_2");
  for (let i = 0; i < each_value_2.length; i += 1) {
    let child_ctx = get_each_context_2(ctx, each_value_2, i), key = get_key_2(child_ctx);
    each2_lookup.set(key, each_blocks_1[i] = create_each_block_2(key, child_ctx));
  }
  let each_value_1 = (
    /*baseBonusDamage*/
    ctx[11]
  );
  const get_key_3 = /* @__PURE__ */ __name((ctx2) => (
    /*i*/
    ctx2[59]
  ), "get_key_3");
  for (let i = 0; i < each_value_1.length; i += 1) {
    let child_ctx = get_each_context_1$1(ctx, each_value_1, i), key = get_key_3(child_ctx);
    each3_lookup.set(key, each_blocks[i] = create_each_block_1$1(key, child_ctx));
  }
  function hudcheckbox0_value_binding(value) {
    ctx[37](value);
  }
  __name(hudcheckbox0_value_binding, "hudcheckbox0_value_binding");
  function hudcheckbox0_partial_binding(value) {
    ctx[38](value);
  }
  __name(hudcheckbox0_partial_binding, "hudcheckbox0_partial_binding");
  let hudcheckbox0_props = {
    icon: "mdi mdi-shield-off-outline",
    label: "Armor Piercing (AP)",
    disabled: (
      /*base*/
      ctx[1].paracausal
    ),
    style: "grid-area: ap"
  };
  /*base*/
  ctx[1].ap !== void 0 && (hudcheckbox0_props.value = /*base*/
  ctx[1].ap), /*partialAP*/
  ctx[4] !== void 0 && (hudcheckbox0_props.partial = /*partialAP*/
  ctx[4]), hudcheckbox0 = new HudCheckbox$1({ props: hudcheckbox0_props }), binding_callbacks.push(() => bind(hudcheckbox0, "value", hudcheckbox0_value_binding)), binding_callbacks.push(() => bind(hudcheckbox0, "partial", hudcheckbox0_partial_binding)), hudcheckbox0.$on(
    "change",
    /*toggleAP*/
    ctx[21]
  );
  function hudcheckbox1_value_binding(value) {
    ctx[39](value);
  }
  __name(hudcheckbox1_value_binding, "hudcheckbox1_value_binding");
  let hudcheckbox1_props = {
    label: "Overkill",
    style: "grid-area: overkill"
  };
  /*weapon*/
  ctx[0].overkill !== void 0 && (hudcheckbox1_props.value = /*weapon*/
  ctx[0].overkill), hudcheckbox1 = new HudCheckbox$1({ props: hudcheckbox1_props }), binding_callbacks.push(() => bind(hudcheckbox1, "value", hudcheckbox1_value_binding));
  function hudcheckbox2_value_binding(value) {
    ctx[40](value);
  }
  __name(hudcheckbox2_value_binding, "hudcheckbox2_value_binding");
  function hudcheckbox2_partial_binding(value) {
    ctx[41](value);
  }
  __name(hudcheckbox2_partial_binding, "hudcheckbox2_partial_binding");
  let hudcheckbox2_props = {
    icon: "cci cci-large-beam",
    label: "Cannot be Reduced",
    tooltip: "For 'cannot be reduced' effects like the Paracausal mod",
    style: "grid-area: paracausal"
  };
  /*base*/
  ctx[1].paracausal !== void 0 && (hudcheckbox2_props.value = /*base*/
  ctx[1].paracausal), /*partialParacausal*/
  ctx[5] !== void 0 && (hudcheckbox2_props.partial = /*partialParacausal*/
  ctx[5]), hudcheckbox2 = new HudCheckbox$1({ props: hudcheckbox2_props }), binding_callbacks.push(() => bind(hudcheckbox2, "value", hudcheckbox2_value_binding)), binding_callbacks.push(() => bind(hudcheckbox2, "partial", hudcheckbox2_partial_binding)), hudcheckbox2.$on(
    "change",
    /*toggleParacausal*/
    ctx[22]
  );
  function hudcheckbox3_value_binding(value) {
    ctx[42](value);
  }
  __name(hudcheckbox3_value_binding, "hudcheckbox3_value_binding");
  function hudcheckbox3_partial_binding(value) {
    ctx[43](value);
  }
  __name(hudcheckbox3_partial_binding, "hudcheckbox3_partial_binding");
  let hudcheckbox3_props = {
    icon: "mdi mdi-fraction-one-half",
    label: "Half Damage",
    tooltip: "For effects which cause the attacker to deal half damage in addition to resistance, like Heavy Gunner",
    style: "grid-area: halfdamage"
  };
  /*base*/
  ctx[1].halfDamage !== void 0 && (hudcheckbox3_props.value = /*base*/
  ctx[1].halfDamage), /*partialHalfDamage*/
  ctx[6] !== void 0 && (hudcheckbox3_props.partial = /*partialHalfDamage*/
  ctx[6]), hudcheckbox3 = new HudCheckbox$1({ props: hudcheckbox3_props }), binding_callbacks.push(() => bind(hudcheckbox3, "value", hudcheckbox3_value_binding)), binding_callbacks.push(() => bind(hudcheckbox3, "partial", hudcheckbox3_partial_binding)), hudcheckbox3.$on(
    "change",
    /*toggleHalfDamage*/
    ctx[23]
  );
  function hudcheckbox4_value_binding(value) {
    ctx[44](value);
  }
  __name(hudcheckbox4_value_binding, "hudcheckbox4_value_binding");
  let hudcheckbox4_props = {
    label: "Reliable",
    style: "grid-area: reliable; max-width: fit-content; padding-right: 0.5em;"
  };
  /*weapon*/
  ctx[0].reliable !== void 0 && (hudcheckbox4_props.value = /*weapon*/
  ctx[0].reliable), hudcheckbox4 = new HudCheckbox$1({ props: hudcheckbox4_props }), binding_callbacks.push(() => bind(hudcheckbox4, "value", hudcheckbox4_value_binding));
  let if_block2 = (
    /*weapon*/
    ctx[0].reliable && create_if_block_2(ctx)
  );
  const if_block_creators = [create_if_block$1, create_if_block_1], if_blocks = [];
  function select_block_type(ctx2, dirty) {
    return (
      /*targets*/
      ctx2[2].length === 1 ? 0 : (
        /*targets*/
        ctx2[2].length > 1 ? 1 : -1
      )
    );
  }
  return __name(select_block_type, "select_block_type"), ~(current_block_type_index = select_block_type(ctx)) && (if_block3 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx)), {
    c() {
      form = element("form"), if_block0 && if_block0.c(), t0 = space(), if_block1 && if_block1.c(), t1 = space(), div2 = element("div"), div0 = element("div"), h30 = element("h3"), t2 = text(`Base Damage
        `), button0 = element("button"), button0.innerHTML = '<i class="mdi mdi-plus-thick svelte-1tnd08e" data-tooltip="Add a base damage type"></i>', t3 = space();
      for (let i = 0; i < each_blocks_3.length; i += 1)
        each_blocks_3[i].c();
      t4 = space();
      for (let i = 0; i < each_blocks_2.length; i += 1)
        each_blocks_2[i].c();
      t5 = space(), div1 = element("div"), h31 = element("h3"), t6 = text(`Bonus Damage
        `), button1 = element("button"), button1.innerHTML = '<i class="mdi mdi-plus-thick svelte-1tnd08e" data-tooltip="Add a bonus damage type"></i>', t7 = space();
      for (let i = 0; i < each_blocks_1.length; i += 1)
        each_blocks_1[i].c();
      t8 = space();
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      t9 = space(), div4 = element("div"), h32 = element("h3"), h32.textContent = "Configuration", t11 = space(), create_component(hudcheckbox0.$$.fragment), t12 = space(), create_component(hudcheckbox1.$$.fragment), t13 = space(), create_component(hudcheckbox2.$$.fragment), t14 = space(), create_component(hudcheckbox3.$$.fragment), t15 = space(), div3 = element("div"), create_component(hudcheckbox4.$$.fragment), t16 = space(), if_block2 && if_block2.c(), t17 = space(), div5 = element("div"), if_block3 && if_block3.c(), t18 = space(), div6 = element("div"), button2 = element("button"), button2.innerHTML = `<i class="fas fa-check svelte-1tnd08e"></i>
      Roll`, t20 = space(), button3 = element("button"), button3.innerHTML = `<i class="fas fa-times svelte-1tnd08e"></i>
      Cancel`, attr(button0, "class", "add-damage-type svelte-1tnd08e"), attr(button0, "type", "button"), attr(h30, "class", "damage-hud-section lancer-border-primary flexrow svelte-1tnd08e"), attr(div0, "class", "base-damage lancer-border-primary svelte-1tnd08e"), attr(button1, "class", "add-damage-type svelte-1tnd08e"), attr(button1, "type", "button"), attr(h31, "class", "damage-hud-section lancer-border-primary flexrow svelte-1tnd08e"), attr(div1, "class", "bonus-damage svelte-1tnd08e"), attr(div2, "class", "damage-grid svelte-1tnd08e"), attr(h32, "class", "damage-hud-section lancer-border-primary svelte-1tnd08e"), set_style(h32, "justify-content", "center"), set_style(h32, "grid-area", "title"), attr(div3, "class", "flexrow"), set_style(div3, "grid-area", "reliable"), set_style(div3, "align-items", "center"), attr(div4, "class", "damage-hud-options-grid svelte-1tnd08e"), attr(div5, "class", "damage-hud-targets svelte-1tnd08e"), attr(button2, "class", "dialog-button submit default"), attr(button2, "data-button", "submit"), attr(button2, "type", "submit"), attr(button3, "class", "dialog-button cancel"), attr(button3, "data-button", "cancel"), attr(button3, "type", "button"), attr(div6, "class", "dialog-buttons flexrow"), attr(form, "id", "damage-hud"), attr(form, "class", "lancer lancer-hud damage-hud window-content svelte-1tnd08e");
    },
    m(target, anchor) {
      insert(target, form, anchor), if_block0 && if_block0.m(form, null), append(form, t0), if_block1 && if_block1.m(form, null), append(form, t1), append(form, div2), append(div2, div0), append(div0, h30), append(h30, t2), append(h30, button0), append(div0, t3);
      for (let i = 0; i < each_blocks_3.length; i += 1)
        each_blocks_3[i] && each_blocks_3[i].m(div0, null);
      append(div0, t4);
      for (let i = 0; i < each_blocks_2.length; i += 1)
        each_blocks_2[i] && each_blocks_2[i].m(div0, null);
      append(div2, t5), append(div2, div1), append(div1, h31), append(h31, t6), append(h31, button1), append(div1, t7);
      for (let i = 0; i < each_blocks_1.length; i += 1)
        each_blocks_1[i] && each_blocks_1[i].m(div1, null);
      append(div1, t8);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(div1, null);
      append(form, t9), append(form, div4), append(div4, h32), append(div4, t11), mount_component(hudcheckbox0, div4, null), append(div4, t12), mount_component(hudcheckbox1, div4, null), append(div4, t13), mount_component(hudcheckbox2, div4, null), append(div4, t14), mount_component(hudcheckbox3, div4, null), append(div4, t15), append(div4, div3), mount_component(hudcheckbox4, div3, null), append(div3, t16), if_block2 && if_block2.m(div3, null), append(form, t17), append(form, div5), ~current_block_type_index && if_blocks[current_block_type_index].m(div5, null), append(form, t18), append(form, div6), append(div6, button2), append(div6, t20), append(div6, button3), current = !0, mounted || (dispose = [
        listen(
          button0,
          "click",
          /*addBaseDamage*/
          ctx[17]
        ),
        listen(
          button1,
          "click",
          /*addBonusDamage*/
          ctx[18]
        ),
        action_destroyer(focus$1.call(null, button2)),
        listen(
          button3,
          "click",
          /*click_handler*/
          ctx[51]
        ),
        action_destroyer(
          /*escToCancel*/
          ctx[15].call(null, form)
        ),
        listen(form, "submit", prevent_default(
          /*submit_handler*/
          ctx[52]
        ))
      ], mounted = !0);
    },
    p(ctx2, dirty) {
      /*title*/
      ctx2[3] != "" ? if_block0 ? if_block0.p(ctx2, dirty) : (if_block0 = create_if_block_4(ctx2), if_block0.c(), if_block0.m(form, t0)) : if_block0 && (if_block0.d(1), if_block0 = null), /*profile*/
      ctx2[8] ? if_block1 ? (if_block1.p(ctx2, dirty), dirty[0] & /*profile*/
      256 && transition_in(if_block1, 1)) : (if_block1 = create_if_block_3(ctx2), if_block1.c(), transition_in(if_block1, 1), if_block1.m(form, t1)) : if_block1 && (group_outros(), transition_out(if_block1, 1, 1, () => {
        if_block1 = null;
      }), check_outros()), dirty[0] & /*weaponDamage, removeBaseDamage*/
      525312 && (each_value_4 = /*weaponDamage*/
      ctx2[10], group_outros(), each_blocks_3 = update_keyed_each(each_blocks_3, dirty, get_key, 1, ctx2, each_value_4, each0_lookup, div0, outro_and_destroy_block, create_each_block_4, t4, get_each_context_4), check_outros()), dirty[0] & /*baseDamage, removeBaseDamage*/
      528384 && (each_value_3 = /*baseDamage*/
      ctx2[12], group_outros(), each_blocks_2 = update_keyed_each(each_blocks_2, dirty, get_key_1, 1, ctx2, each_value_3, each1_lookup, div0, outro_and_destroy_block, create_each_block_3, null, get_each_context_3), check_outros()), dirty[0] & /*weaponBonusDamage, removeBonusDamage*/
      1049088 && (each_value_2 = /*weaponBonusDamage*/
      ctx2[9], group_outros(), each_blocks_1 = update_keyed_each(each_blocks_1, dirty, get_key_2, 1, ctx2, each_value_2, each2_lookup, div1, outro_and_destroy_block, create_each_block_2, t8, get_each_context_2), check_outros()), dirty[0] & /*baseBonusDamage, removeBonusDamage*/
      1050624 && (each_value_1 = /*baseBonusDamage*/
      ctx2[11], group_outros(), each_blocks = update_keyed_each(each_blocks, dirty, get_key_3, 1, ctx2, each_value_1, each3_lookup, div1, outro_and_destroy_block, create_each_block_1$1, null, get_each_context_1$1), check_outros());
      const hudcheckbox0_changes = {};
      dirty[0] & /*base*/
      2 && (hudcheckbox0_changes.disabled = /*base*/
      ctx2[1].paracausal), !updating_value && dirty[0] & /*base*/
      2 && (updating_value = !0, hudcheckbox0_changes.value = /*base*/
      ctx2[1].ap, add_flush_callback(() => updating_value = !1)), !updating_partial && dirty[0] & /*partialAP*/
      16 && (updating_partial = !0, hudcheckbox0_changes.partial = /*partialAP*/
      ctx2[4], add_flush_callback(() => updating_partial = !1)), hudcheckbox0.$set(hudcheckbox0_changes);
      const hudcheckbox1_changes = {};
      !updating_value_1 && dirty[0] & /*weapon*/
      1 && (updating_value_1 = !0, hudcheckbox1_changes.value = /*weapon*/
      ctx2[0].overkill, add_flush_callback(() => updating_value_1 = !1)), hudcheckbox1.$set(hudcheckbox1_changes);
      const hudcheckbox2_changes = {};
      !updating_value_2 && dirty[0] & /*base*/
      2 && (updating_value_2 = !0, hudcheckbox2_changes.value = /*base*/
      ctx2[1].paracausal, add_flush_callback(() => updating_value_2 = !1)), !updating_partial_1 && dirty[0] & /*partialParacausal*/
      32 && (updating_partial_1 = !0, hudcheckbox2_changes.partial = /*partialParacausal*/
      ctx2[5], add_flush_callback(() => updating_partial_1 = !1)), hudcheckbox2.$set(hudcheckbox2_changes);
      const hudcheckbox3_changes = {};
      !updating_value_3 && dirty[0] & /*base*/
      2 && (updating_value_3 = !0, hudcheckbox3_changes.value = /*base*/
      ctx2[1].halfDamage, add_flush_callback(() => updating_value_3 = !1)), !updating_partial_2 && dirty[0] & /*partialHalfDamage*/
      64 && (updating_partial_2 = !0, hudcheckbox3_changes.partial = /*partialHalfDamage*/
      ctx2[6], add_flush_callback(() => updating_partial_2 = !1)), hudcheckbox3.$set(hudcheckbox3_changes);
      const hudcheckbox4_changes = {};
      !updating_value_4 && dirty[0] & /*weapon*/
      1 && (updating_value_4 = !0, hudcheckbox4_changes.value = /*weapon*/
      ctx2[0].reliable, add_flush_callback(() => updating_value_4 = !1)), hudcheckbox4.$set(hudcheckbox4_changes), /*weapon*/
      ctx2[0].reliable ? if_block2 ? (if_block2.p(ctx2, dirty), dirty[0] & /*weapon*/
      1 && transition_in(if_block2, 1)) : (if_block2 = create_if_block_2(ctx2), if_block2.c(), transition_in(if_block2, 1), if_block2.m(div3, null)) : if_block2 && (group_outros(), transition_out(if_block2, 1, 1, () => {
        if_block2 = null;
      }), check_outros());
      let previous_block_index = current_block_type_index;
      current_block_type_index = select_block_type(ctx2), current_block_type_index === previous_block_index ? ~current_block_type_index && if_blocks[current_block_type_index].p(ctx2, dirty) : (if_block3 && (group_outros(), transition_out(if_blocks[previous_block_index], 1, 1, () => {
        if_blocks[previous_block_index] = null;
      }), check_outros()), ~current_block_type_index ? (if_block3 = if_blocks[current_block_type_index], if_block3 ? if_block3.p(ctx2, dirty) : (if_block3 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2), if_block3.c()), transition_in(if_block3, 1), if_block3.m(div5, null)) : if_block3 = null);
    },
    i(local) {
      if (!current) {
        transition_in(if_block1);
        for (let i = 0; i < each_value_4.length; i += 1)
          transition_in(each_blocks_3[i]);
        for (let i = 0; i < each_value_3.length; i += 1)
          transition_in(each_blocks_2[i]);
        for (let i = 0; i < each_value_2.length; i += 1)
          transition_in(each_blocks_1[i]);
        for (let i = 0; i < each_value_1.length; i += 1)
          transition_in(each_blocks[i]);
        transition_in(hudcheckbox0.$$.fragment, local), transition_in(hudcheckbox1.$$.fragment, local), transition_in(hudcheckbox2.$$.fragment, local), transition_in(hudcheckbox3.$$.fragment, local), transition_in(hudcheckbox4.$$.fragment, local), transition_in(if_block2), transition_in(if_block3), current = !0;
      }
    },
    o(local) {
      transition_out(if_block1);
      for (let i = 0; i < each_blocks_3.length; i += 1)
        transition_out(each_blocks_3[i]);
      for (let i = 0; i < each_blocks_2.length; i += 1)
        transition_out(each_blocks_2[i]);
      for (let i = 0; i < each_blocks_1.length; i += 1)
        transition_out(each_blocks_1[i]);
      for (let i = 0; i < each_blocks.length; i += 1)
        transition_out(each_blocks[i]);
      transition_out(hudcheckbox0.$$.fragment, local), transition_out(hudcheckbox1.$$.fragment, local), transition_out(hudcheckbox2.$$.fragment, local), transition_out(hudcheckbox3.$$.fragment, local), transition_out(hudcheckbox4.$$.fragment, local), transition_out(if_block2), transition_out(if_block3), current = !1;
    },
    d(detaching) {
      detaching && detach(form), if_block0 && if_block0.d(), if_block1 && if_block1.d();
      for (let i = 0; i < each_blocks_3.length; i += 1)
        each_blocks_3[i].d();
      for (let i = 0; i < each_blocks_2.length; i += 1)
        each_blocks_2[i].d();
      for (let i = 0; i < each_blocks_1.length; i += 1)
        each_blocks_1[i].d();
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].d();
      destroy_component(hudcheckbox0), destroy_component(hudcheckbox1), destroy_component(hudcheckbox2), destroy_component(hudcheckbox3), destroy_component(hudcheckbox4), if_block2 && if_block2.d(), ~current_block_type_index && if_blocks[current_block_type_index].d(), mounted = !1, run_all(dispose);
    }
  };
}
__name(create_fragment$2, "create_fragment$2");
function focus$1(el) {
  el.focus();
}
__name(focus$1, "focus$1");
function targetHoverIn(event, target) {
  target._onHoverIn(event);
}
__name(targetHoverIn, "targetHoverIn");
function targetHoverOut(event, target) {
  target._onHoverOut(event);
}
__name(targetHoverOut, "targetHoverOut");
function instance$2($$self, $$props, $$invalidate) {
  var _a;
  let baseDamage, baseBonusDamage, weaponDamage, weaponBonusDamage, profile, targetHitQualityClass, { title } = $$props, { kind } = $$props, { hitResults } = $$props, { weapon } = $$props, { base } = $$props, { targets } = $$props, { lancerActor } = $$props, { lancerItem } = $$props, rollerName = lancerActor ? ` -- ${((_a = lancerActor.token) == null ? void 0 : _a.name) || lancerActor.name}` : "", partialAP = !1, partialParacausal = !1, partialHalfDamage = !1;
  const dispatch = createEventDispatcher();
  function escToCancel(_el) {
    function escHandler(ev) {
      ev.key === "Escape" && (ev.preventDefault(), dispatch("cancel"));
    }
    return __name(escHandler, "escHandler"), window.addEventListener("keydown", escHandler), {
      destroy() {
        window.removeEventListener("keydown", escHandler);
      }
    };
  }
  __name(escToCancel, "escToCancel");
  function findProfile() {
    return (lancerItem == null ? void 0 : lancerItem.currentProfile()) ?? { range: [], damage: [] };
  }
  __name(findProfile, "findProfile");
  function reliableType() {
    const allowedTypes = [DamageType.Kinetic, DamageType.Energy, DamageType.Explosive], preferred = weapon.damage.find((d) => allowedTypes.includes(d.type));
    return preferred ? preferred.type : weapon.damage.length ? weapon.damage[0].type : DamageType.Kinetic;
  }
  __name(reliableType, "reliableType");
  function addBaseDamage() {
    $$invalidate(1, base.damage = [...base.damage, { type: DamageType.Kinetic, val: "1d6" }], base);
  }
  __name(addBaseDamage, "addBaseDamage");
  function addBonusDamage() {
    $$invalidate(1, base.bonusDamage = [...base.bonusDamage, { type: DamageType.Kinetic, val: "1d6" }], base);
  }
  __name(addBonusDamage, "addBonusDamage");
  function removeBaseDamage(idx, isBase = !0) {
    isBase ? $$invalidate(1, base.damage = base.damage.filter((_, i) => i !== idx), base) : $$invalidate(0, weapon.damage = weapon.damage.filter((_, i) => i !== idx), weapon);
  }
  __name(removeBaseDamage, "removeBaseDamage");
  function removeBonusDamage(idx, isBase = !0) {
    isBase ? $$invalidate(1, base.bonusDamage = base.bonusDamage.filter((_, i) => i !== idx), base) : $$invalidate(0, weapon.bonusDamage = weapon.bonusDamage.filter((_, i) => i !== idx), weapon);
  }
  __name(removeBonusDamage, "removeBonusDamage");
  function toggleAP(event) {
    for (const [idx, t] of targets.entries())
      t.ap = event.detail, $$invalidate(2, targets[idx] = t, targets);
  }
  __name(toggleAP, "toggleAP");
  function toggleParacausal(event) {
    for (const [idx, t] of targets.entries())
      t.paracausal = event.detail, $$invalidate(2, targets[idx] = t, targets);
    event.detail && ($$invalidate(1, base.ap = !0, base), toggleAP(event));
  }
  __name(toggleParacausal, "toggleParacausal");
  function toggleHalfDamage(event) {
    for (const [idx, t] of targets.entries())
      t.halfDamage = event.detail, $$invalidate(2, targets[idx] = t, targets);
  }
  __name(toggleHalfDamage, "toggleHalfDamage");
  function updateTargets() {
    $$invalidate(2, targets), targets.every((t) => t.ap) ? ($$invalidate(1, base.ap = !0, base), $$invalidate(4, partialAP = !1)) : targets.some((t) => t.ap) ? ($$invalidate(1, base.ap = !1, base), $$invalidate(4, partialAP = !0)) : ($$invalidate(1, base.ap = !1, base), $$invalidate(4, partialAP = !1)), targets.every((t) => t.paracausal) ? ($$invalidate(1, base.paracausal = !0, base), $$invalidate(5, partialParacausal = !1)) : targets.some((t) => t.paracausal) ? ($$invalidate(1, base.paracausal = !1, base), $$invalidate(5, partialParacausal = !0)) : ($$invalidate(1, base.paracausal = !1, base), $$invalidate(5, partialParacausal = !1)), targets.every((t) => t.halfDamage) ? ($$invalidate(1, base.halfDamage = !0, base), $$invalidate(6, partialHalfDamage = !1)) : targets.some((t) => t.halfDamage) ? ($$invalidate(1, base.halfDamage = !1, base), $$invalidate(6, partialHalfDamage = !0)) : ($$invalidate(1, base.halfDamage = !1, base), $$invalidate(6, partialHalfDamage = !1)), $$invalidate(1, base);
  }
  __name(updateTargets, "updateTargets");
  function damageinput_damage_binding(value, damage, each_value_4, i) {
    each_value_4[i] = value, $$invalidate(10, weaponDamage), $$invalidate(0, weapon);
  }
  __name(damageinput_damage_binding, "damageinput_damage_binding");
  const delete_handler = /* @__PURE__ */ __name((i) => removeBaseDamage(i, !1), "delete_handler");
  function damageinput_damage_binding_1(value, damage, each_value_3, i) {
    each_value_3[i] = value, $$invalidate(12, baseDamage), $$invalidate(1, base);
  }
  __name(damageinput_damage_binding_1, "damageinput_damage_binding_1");
  const delete_handler_1 = /* @__PURE__ */ __name((i) => removeBaseDamage(i), "delete_handler_1");
  function damageinput_damage_binding_2(value, damage, each_value_2, i) {
    each_value_2[i] = value, $$invalidate(9, weaponBonusDamage), $$invalidate(0, weapon);
  }
  __name(damageinput_damage_binding_2, "damageinput_damage_binding_2");
  const delete_handler_2 = /* @__PURE__ */ __name((i) => removeBonusDamage(i, !1), "delete_handler_2");
  function damageinput_damage_binding_3(value, damage, each_value_1, i) {
    each_value_1[i] = value, $$invalidate(11, baseBonusDamage), $$invalidate(1, base);
  }
  __name(damageinput_damage_binding_3, "damageinput_damage_binding_3");
  const delete_handler_3 = /* @__PURE__ */ __name((i) => removeBonusDamage(i), "delete_handler_3");
  function hudcheckbox0_value_binding(value) {
    $$self.$$.not_equal(base.ap, value) && (base.ap = value, $$invalidate(1, base));
  }
  __name(hudcheckbox0_value_binding, "hudcheckbox0_value_binding");
  function hudcheckbox0_partial_binding(value) {
    partialAP = value, $$invalidate(4, partialAP);
  }
  __name(hudcheckbox0_partial_binding, "hudcheckbox0_partial_binding");
  function hudcheckbox1_value_binding(value) {
    $$self.$$.not_equal(weapon.overkill, value) && (weapon.overkill = value, $$invalidate(0, weapon));
  }
  __name(hudcheckbox1_value_binding, "hudcheckbox1_value_binding");
  function hudcheckbox2_value_binding(value) {
    $$self.$$.not_equal(base.paracausal, value) && (base.paracausal = value, $$invalidate(1, base));
  }
  __name(hudcheckbox2_value_binding, "hudcheckbox2_value_binding");
  function hudcheckbox2_partial_binding(value) {
    partialParacausal = value, $$invalidate(5, partialParacausal);
  }
  __name(hudcheckbox2_partial_binding, "hudcheckbox2_partial_binding");
  function hudcheckbox3_value_binding(value) {
    $$self.$$.not_equal(base.halfDamage, value) && (base.halfDamage = value, $$invalidate(1, base));
  }
  __name(hudcheckbox3_value_binding, "hudcheckbox3_value_binding");
  function hudcheckbox3_partial_binding(value) {
    partialHalfDamage = value, $$invalidate(6, partialHalfDamage);
  }
  __name(hudcheckbox3_partial_binding, "hudcheckbox3_partial_binding");
  function hudcheckbox4_value_binding(value) {
    $$self.$$.not_equal(weapon.reliable, value) && (weapon.reliable = value, $$invalidate(0, weapon));
  }
  __name(hudcheckbox4_value_binding, "hudcheckbox4_value_binding");
  function input_input_handler() {
    weapon.reliableValue = to_number(this.value), $$invalidate(0, weapon);
  }
  __name(input_input_handler, "input_input_handler");
  function hitradio_quality_binding(value) {
    $$self.$$.not_equal(targets[0].quality, value) && (targets[0].quality = value, $$invalidate(2, targets));
  }
  __name(hitradio_quality_binding, "hitradio_quality_binding");
  const mouseenter_handler = /* @__PURE__ */ __name((ev) => targetHoverIn(ev, targets[0].target), "mouseenter_handler"), mouseleave_handler = /* @__PURE__ */ __name((ev) => targetHoverOut(ev, targets[0].target), "mouseleave_handler"), mouseenter_handler_1 = /* @__PURE__ */ __name((target, ev) => targetHoverIn(ev, target.target), "mouseenter_handler_1"), mouseleave_handler_1 = /* @__PURE__ */ __name((target, ev) => targetHoverOut(ev, target.target), "mouseleave_handler_1"), click_handler = /* @__PURE__ */ __name(() => dispatch("cancel"), "click_handler"), submit_handler = /* @__PURE__ */ __name(() => dispatch("submit"), "submit_handler");
  return $$self.$$set = ($$props2) => {
    "title" in $$props2 && $$invalidate(3, title = $$props2.title), "kind" in $$props2 && $$invalidate(25, kind = $$props2.kind), "hitResults" in $$props2 && $$invalidate(26, hitResults = $$props2.hitResults), "weapon" in $$props2 && $$invalidate(0, weapon = $$props2.weapon), "base" in $$props2 && $$invalidate(1, base = $$props2.base), "targets" in $$props2 && $$invalidate(2, targets = $$props2.targets), "lancerActor" in $$props2 && $$invalidate(27, lancerActor = $$props2.lancerActor), "lancerItem" in $$props2 && $$invalidate(28, lancerItem = $$props2.lancerItem);
  }, $$self.$$.update = () => {
    var _a2, _b;
    $$self.$$.dirty[0] & /*base*/
    2 && $$invalidate(12, baseDamage = base.damage), $$self.$$.dirty[0] & /*base*/
    2 && $$invalidate(11, baseBonusDamage = base.bonusDamage), $$self.$$.dirty[0] & /*weapon*/
    1 && $$invalidate(10, weaponDamage = weapon.damage), $$self.$$.dirty[0] & /*weapon*/
    1 && $$invalidate(9, weaponBonusDamage = weapon.bonusDamage), $$self.$$.dirty[0] & /*lancerItem*/
    268435456 && $$invalidate(8, profile = lancerItem ? findProfile() : null), $$self.$$.dirty[0] & /*targets*/
    4 && $$invalidate(7, targetHitQualityClass = !targets.length || ((_a2 = targets[0]) == null ? void 0 : _a2.quality) === HitQuality.Hit ? "target-hit" : ((_b = targets[0]) == null ? void 0 : _b.quality) === HitQuality.Crit ? "target-crit" : "target-miss");
  }, [
    weapon,
    base,
    targets,
    title,
    partialAP,
    partialParacausal,
    partialHalfDamage,
    targetHitQualityClass,
    profile,
    weaponBonusDamage,
    weaponDamage,
    baseBonusDamage,
    baseDamage,
    rollerName,
    dispatch,
    escToCancel,
    reliableType,
    addBaseDamage,
    addBonusDamage,
    removeBaseDamage,
    removeBonusDamage,
    toggleAP,
    toggleParacausal,
    toggleHalfDamage,
    updateTargets,
    kind,
    hitResults,
    lancerActor,
    lancerItem,
    damageinput_damage_binding,
    delete_handler,
    damageinput_damage_binding_1,
    delete_handler_1,
    damageinput_damage_binding_2,
    delete_handler_2,
    damageinput_damage_binding_3,
    delete_handler_3,
    hudcheckbox0_value_binding,
    hudcheckbox0_partial_binding,
    hudcheckbox1_value_binding,
    hudcheckbox2_value_binding,
    hudcheckbox2_partial_binding,
    hudcheckbox3_value_binding,
    hudcheckbox3_partial_binding,
    hudcheckbox4_value_binding,
    input_input_handler,
    hitradio_quality_binding,
    mouseenter_handler,
    mouseleave_handler,
    mouseenter_handler_1,
    mouseleave_handler_1,
    click_handler,
    submit_handler
  ];
}
__name(instance$2, "instance$2");
const _DamageHUD = class _DamageHUD extends SvelteComponent {
  constructor(options) {
    super(), init(
      this,
      options,
      instance$2,
      create_fragment$2,
      safe_not_equal,
      {
        title: 3,
        kind: 25,
        hitResults: 26,
        weapon: 0,
        base: 1,
        targets: 2,
        lancerActor: 27,
        lancerItem: 28
      },
      null,
      [-1, -1, -1]
    );
  }
  get title() {
    return this.$$.ctx[3];
  }
  set title(title) {
    this.$$set({ title }), flush();
  }
  get kind() {
    return this.$$.ctx[25];
  }
  set kind(kind) {
    this.$$set({ kind }), flush();
  }
  get hitResults() {
    return this.$$.ctx[26];
  }
  set hitResults(hitResults) {
    this.$$set({ hitResults }), flush();
  }
  get weapon() {
    return this.$$.ctx[0];
  }
  set weapon(weapon) {
    this.$$set({ weapon }), flush();
  }
  get base() {
    return this.$$.ctx[1];
  }
  set base(base) {
    this.$$set({ base }), flush();
  }
  get targets() {
    return this.$$.ctx[2];
  }
  set targets(targets) {
    this.$$set({ targets }), flush();
  }
  get lancerActor() {
    return this.$$.ctx[27];
  }
  set lancerActor(lancerActor) {
    this.$$set({ lancerActor }), flush();
  }
  get lancerItem() {
    return this.$$.ctx[28];
  }
  set lancerItem(lancerItem) {
    this.$$set({ lancerItem }), flush();
  }
};
__name(_DamageHUD, "DamageHUD");
let DamageHUD = _DamageHUD;
const DamageHud = DamageHUD;
function get_each_context$1(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[12] = list[i], child_ctx;
}
__name(get_each_context$1, "get_each_context$1");
function get_each_context_1(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[12] = list[i], child_ctx;
}
__name(get_each_context_1, "get_each_context_1");
function create_if_block(ctx) {
  var _a;
  let div1, h3, t0_value = (
    /*lancerActor*/
    (((_a = ctx[1]) == null ? void 0 : _a.name) ?? "UNKNOWN MECH") + ""
  ), t0, t1, t2, t3, t4, div0, t5, t6, p, t7, t8, t9, each_value_1 = { length: (
    /*current*/
    ctx[3]
  ) }, each_blocks_1 = [];
  for (let i = 0; i < each_value_1.length; i += 1)
    each_blocks_1[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
  let each_value = { length: (
    /*damage*/
    ctx[2]
  ) }, each_blocks = [];
  for (let i = 0; i < each_value.length; i += 1)
    each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i));
  return {
    c() {
      div1 = element("div"), h3 = element("h3"), t0 = text(t0_value), t1 = text(" has taken "), t2 = text(
        /*icon*/
        ctx[4]
      ), t3 = text(" damage!"), t4 = space(), div0 = element("div");
      for (let i = 0; i < each_blocks_1.length; i += 1)
        each_blocks_1[i].c();
      t5 = space();
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      t6 = space(), p = element("p"), t7 = text("Roll "), t8 = text(
        /*damage*/
        ctx[2]
      ), t9 = text("d6 to determine what happens."), attr(div0, "class", "damage-preview svelte-v75hxi"), attr(p, "class", "message"), attr(div1, "class", "message-body svelte-v75hxi");
    },
    m(target, anchor) {
      insert(target, div1, anchor), append(div1, h3), append(h3, t0), append(h3, t1), append(h3, t2), append(h3, t3), append(div1, t4), append(div1, div0);
      for (let i = 0; i < each_blocks_1.length; i += 1)
        each_blocks_1[i] && each_blocks_1[i].m(div0, null);
      append(div0, t5);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(div0, null);
      append(div1, t6), append(div1, p), append(p, t7), append(p, t8), append(p, t9);
    },
    p(ctx2, dirty) {
      var _a2;
      if (dirty & /*lancerActor*/
      2 && t0_value !== (t0_value = /*lancerActor*/
      (((_a2 = ctx2[1]) == null ? void 0 : _a2.name) ?? "UNKNOWN MECH") + "") && set_data(t0, t0_value), dirty & /*icon*/
      16 && set_data(
        t2,
        /*icon*/
        ctx2[4]
      ), dirty & /*icon, current*/
      24) {
        each_value_1 = { length: (
          /*current*/
          ctx2[3]
        ) };
        let i;
        for (i = 0; i < each_value_1.length; i += 1) {
          const child_ctx = get_each_context_1(ctx2, each_value_1, i);
          each_blocks_1[i] ? each_blocks_1[i].p(child_ctx, dirty) : (each_blocks_1[i] = create_each_block_1(child_ctx), each_blocks_1[i].c(), each_blocks_1[i].m(div0, t5));
        }
        for (; i < each_blocks_1.length; i += 1)
          each_blocks_1[i].d(1);
        each_blocks_1.length = each_value_1.length;
      }
      if (dirty & /*damage*/
      4) {
        each_value = { length: (
          /*damage*/
          ctx2[2]
        ) };
        let i;
        for (i = 0; i < each_value.length; i += 1) {
          const child_ctx = get_each_context$1(ctx2, each_value, i);
          each_blocks[i] ? each_blocks[i].p(child_ctx, dirty) : (each_blocks[i] = create_each_block$1(), each_blocks[i].c(), each_blocks[i].m(div0, null));
        }
        for (; i < each_blocks.length; i += 1)
          each_blocks[i].d(1);
        each_blocks.length = each_value.length;
      }
      dirty & /*damage*/
      4 && set_data(
        t8,
        /*damage*/
        ctx2[2]
      );
    },
    d(detaching) {
      detaching && detach(div1), destroy_each(each_blocks_1, detaching), destroy_each(each_blocks, detaching);
    }
  };
}
__name(create_if_block, "create_if_block");
function create_each_block_1(ctx) {
  let i, i_class_value;
  return {
    c() {
      i = element("i"), attr(i, "class", i_class_value = "cci cci-" + /*icon*/
      ctx[4] + " i--m damage-pip svelte-v75hxi");
    },
    m(target, anchor) {
      insert(target, i, anchor);
    },
    p(ctx2, dirty) {
      dirty & /*icon*/
      16 && i_class_value !== (i_class_value = "cci cci-" + /*icon*/
      ctx2[4] + " i--m damage-pip svelte-v75hxi") && attr(i, "class", i_class_value);
    },
    d(detaching) {
      detaching && detach(i);
    }
  };
}
__name(create_each_block_1, "create_each_block_1");
function create_each_block$1(ctx) {
  let i;
  return {
    c() {
      i = element("i"), attr(i, "class", "mdi mdi-hexagon-outline i--m damage-pip damaged svelte-v75hxi");
    },
    m(target, anchor) {
      insert(target, i, anchor);
    },
    p: noop,
    d(detaching) {
      detaching && detach(i);
    }
  };
}
__name(create_each_block$1, "create_each_block$1");
function create_fragment$1(ctx) {
  let form, div0, i0, i0_class_value, t0, span, t1, t2, t3, show_if = (
    /*lancerActor*/
    ctx[1] && /*lancerActor*/
    (ctx[1].is_mech() || /*lancerActor*/
    ctx[1].is_npc())
  ), t4, div1, button0, t6, button1, mounted, dispose, if_block = show_if && create_if_block(ctx);
  return {
    c() {
      form = element("form"), div0 = element("div"), i0 = element("i"), t0 = space(), span = element("span"), t1 = text(
        /*title*/
        ctx[0]
      ), t2 = text(
        /*rollerName*/
        ctx[5]
      ), t3 = space(), if_block && if_block.c(), t4 = space(), div1 = element("div"), button0 = element("button"), button0.innerHTML = `<i class="fas fa-check"></i>
      Roll`, t6 = space(), button1 = element("button"), button1.innerHTML = `<i class="fas fa-times"></i>
      Cancel`, attr(i0, "class", i0_class_value = "cci cci-" + /*icon*/
      ctx[4] + " i--m i--light svelte-v75hxi"), attr(div0, "class", "lancer-header lancer-primary medium"), attr(button0, "class", "dialog-button submit default"), attr(button0, "data-button", "submit"), attr(button0, "type", "submit"), attr(button1, "class", "dialog-button cancel"), attr(button1, "data-button", "cancel"), attr(button1, "type", "button"), attr(div1, "class", "dialog-buttons flexrow"), attr(form, "id", "structstress"), attr(form, "class", "lancer-hud structstress window-content");
    },
    m(target, anchor) {
      insert(target, form, anchor), append(form, div0), append(div0, i0), append(div0, t0), append(div0, span), append(span, t1), append(span, t2), append(form, t3), if_block && if_block.m(form, null), append(form, t4), append(form, div1), append(div1, button0), append(div1, t6), append(div1, button1), mounted || (dispose = [
        action_destroyer(focus.call(null, button0)),
        listen(
          button1,
          "click",
          /*click_handler*/
          ctx[8]
        ),
        listen(form, "submit", prevent_default(
          /*submit_handler*/
          ctx[9]
        ))
      ], mounted = !0);
    },
    p(ctx2, [dirty]) {
      dirty & /*icon*/
      16 && i0_class_value !== (i0_class_value = "cci cci-" + /*icon*/
      ctx2[4] + " i--m i--light svelte-v75hxi") && attr(i0, "class", i0_class_value), dirty & /*title*/
      1 && set_data(
        t1,
        /*title*/
        ctx2[0]
      ), dirty & /*lancerActor*/
      2 && (show_if = /*lancerActor*/
      ctx2[1] && /*lancerActor*/
      (ctx2[1].is_mech() || /*lancerActor*/
      ctx2[1].is_npc())), show_if ? if_block ? if_block.p(ctx2, dirty) : (if_block = create_if_block(ctx2), if_block.c(), if_block.m(form, t4)) : if_block && (if_block.d(1), if_block = null);
    },
    i: noop,
    o: noop,
    d(detaching) {
      detaching && detach(form), if_block && if_block.d(), mounted = !1, run_all(dispose);
    }
  };
}
__name(create_fragment$1, "create_fragment$1");
function focus(el) {
  el.focus();
}
__name(focus, "focus");
function instance$1($$self, $$props, $$invalidate) {
  var _a;
  let icon, current, damage, { title } = $$props, { stat } = $$props, { lancerActor } = $$props, rollerName = lancerActor ? ` -- ${((_a = lancerActor.token) == null ? void 0 : _a.name) || lancerActor.name}` : "";
  const dispatch = createEventDispatcher();
  function getCurrent(a) {
    return !a || !a.is_mech() && !a.is_npc() ? 0 : Math.max(a.system[stat].value - 1, 0);
  }
  __name(getCurrent, "getCurrent");
  function getDamage(a) {
    return !a || !a.is_mech() && !a.is_npc() ? 0 : a.system[stat].max - getCurrent(a);
  }
  __name(getDamage, "getDamage");
  const click_handler = /* @__PURE__ */ __name(() => dispatch("cancel"), "click_handler"), submit_handler = /* @__PURE__ */ __name(() => {
    dispatch("submit");
  }, "submit_handler");
  return $$self.$$set = ($$props2) => {
    "title" in $$props2 && $$invalidate(0, title = $$props2.title), "stat" in $$props2 && $$invalidate(7, stat = $$props2.stat), "lancerActor" in $$props2 && $$invalidate(1, lancerActor = $$props2.lancerActor);
  }, $$self.$$.update = () => {
    $$self.$$.dirty & /*stat*/
    128 && $$invalidate(4, icon = stat === "stress" ? "reactor" : stat), $$self.$$.dirty & /*lancerActor*/
    2 && $$invalidate(3, current = getCurrent(lancerActor)), $$self.$$.dirty & /*lancerActor*/
    2 && $$invalidate(2, damage = getDamage(lancerActor));
  }, [
    title,
    lancerActor,
    damage,
    current,
    icon,
    rollerName,
    dispatch,
    stat,
    click_handler,
    submit_handler
  ];
}
__name(instance$1, "instance$1");
const _Form = class _Form extends SvelteComponent {
  constructor(options) {
    super(), init(this, options, instance$1, create_fragment$1, safe_not_equal, { title: 0, stat: 7, lancerActor: 1 });
  }
  get title() {
    return this.$$.ctx[0];
  }
  set title(title) {
    this.$$set({ title }), flush();
  }
  get stat() {
    return this.$$.ctx[7];
  }
  set stat(stat) {
    this.$$set({ stat }), flush();
  }
  get lancerActor() {
    return this.$$.ctx[1];
  }
  set lancerActor(lancerActor) {
    this.$$set({ lancerActor }), flush();
  }
};
__name(_Form, "Form");
let Form = _Form;
const StructStressHud = Form;
function get_each_context(ctx, list, i) {
  const child_ctx = ctx.slice();
  return child_ctx[21] = list[i], child_ctx[22] = list, child_ctx[23] = i, child_ctx;
}
__name(get_each_context, "get_each_context");
function create_each_block(key_1, ctx) {
  let div, switch_instance, key = (
    /*key*/
    ctx[21]
  ), t, div_transition, rect, stop_animation = noop, current;
  const switch_instance_spread_levels = [
    { kind: (
      /*key*/
      ctx[21]
    ) },
    /*huds*/
    ctx[2][
      /*key*/
      ctx[21]
    ].data
  ], assign_switch_instance = /* @__PURE__ */ __name(() => (
    /*switch_instance_binding*/
    ctx[17](switch_instance, key)
  ), "assign_switch_instance"), unassign_switch_instance = /* @__PURE__ */ __name(() => (
    /*switch_instance_binding*/
    ctx[17](null, key)
  ), "unassign_switch_instance");
  function submit_handler() {
    return (
      /*submit_handler*/
      ctx[18](
        /*key*/
        ctx[21]
      )
    );
  }
  __name(submit_handler, "submit_handler");
  function cancel_handler() {
    return (
      /*cancel_handler*/
      ctx[19](
        /*key*/
        ctx[21]
      )
    );
  }
  __name(cancel_handler, "cancel_handler");
  var switch_value = (
    /*dialogs*/
    ctx[6][
      /*key*/
      ctx[21]
    ]
  );
  function switch_props(ctx2) {
    let switch_instance_props = {};
    for (let i = 0; i < switch_instance_spread_levels.length; i += 1)
      switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]);
    return { props: switch_instance_props };
  }
  return __name(switch_props, "switch_props"), switch_value && (switch_instance = construct_svelte_component(switch_value, switch_props()), assign_switch_instance(), switch_instance.$on("submit", submit_handler), switch_instance.$on("cancel", cancel_handler)), {
    key: key_1,
    first: null,
    c() {
      div = element("div"), switch_instance && create_component(switch_instance.$$.fragment), t = space(), attr(div, "class", "component grid-enforcement svelte-1q2cs06"), this.first = div;
    },
    m(target, anchor) {
      insert(target, div, anchor), switch_instance && mount_component(switch_instance, div, null), append(div, t), current = !0;
    },
    p(new_ctx, dirty) {
      ctx = new_ctx, key !== /*key*/
      ctx[21] && (unassign_switch_instance(), key = /*key*/
      ctx[21], assign_switch_instance());
      const switch_instance_changes = dirty & /*visibleHudsKeys, huds*/
      12 ? get_spread_update(switch_instance_spread_levels, [
        dirty & /*visibleHudsKeys*/
        8 && { kind: (
          /*key*/
          ctx[21]
        ) },
        get_spread_object(
          /*huds*/
          ctx[2][
            /*key*/
            ctx[21]
          ].data
        )
      ]) : {};
      if (dirty & /*visibleHudsKeys*/
      8 && switch_value !== (switch_value = /*dialogs*/
      ctx[6][
        /*key*/
        ctx[21]
      ])) {
        if (switch_instance) {
          group_outros();
          const old_component = switch_instance;
          transition_out(old_component.$$.fragment, 1, 0, () => {
            destroy_component(old_component, 1);
          }), check_outros();
        }
        switch_value ? (switch_instance = construct_svelte_component(switch_value, switch_props()), assign_switch_instance(), switch_instance.$on("submit", submit_handler), switch_instance.$on("cancel", cancel_handler), create_component(switch_instance.$$.fragment), transition_in(switch_instance.$$.fragment, 1), mount_component(switch_instance, div, t)) : switch_instance = null;
      } else
        switch_value && switch_instance.$set(switch_instance_changes);
    },
    r() {
      rect = div.getBoundingClientRect();
    },
    f() {
      fix_position(div), stop_animation(), add_transform(div, rect);
    },
    a() {
      stop_animation(), stop_animation = create_animation(div, rect, flip, {});
    },
    i(local) {
      current || (switch_instance && transition_in(switch_instance.$$.fragment, local), add_render_callback(() => {
        current && (div_transition || (div_transition = create_bidirectional_transition(div, slide, {}, !0)), div_transition.run(1));
      }), current = !0);
    },
    o(local) {
      switch_instance && transition_out(switch_instance.$$.fragment, local), div_transition || (div_transition = create_bidirectional_transition(div, slide, {}, !1)), div_transition.run(0), current = !1;
    },
    d(detaching) {
      detaching && detach(div), unassign_switch_instance(), switch_instance && destroy_component(switch_instance), detaching && div_transition && div_transition.end();
    }
  };
}
__name(create_each_block, "create_each_block");
function create_fragment(ctx) {
  let div, each_blocks = [], each_1_lookup = /* @__PURE__ */ new Map(), current, each_value = (
    /*visibleHudsKeys*/
    ctx[3]
  );
  const get_key = /* @__PURE__ */ __name((ctx2) => (
    /*key*/
    ctx2[21] + /*huds*/
    ctx2[2][
      /*key*/
      ctx2[21]
    ].data.title
  ), "get_key");
  for (let i = 0; i < each_value.length; i += 1) {
    let child_ctx = get_each_context(ctx, each_value, i), key = get_key(child_ctx);
    each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx));
  }
  return {
    c() {
      div = element("div");
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].c();
      attr(div, "id", "hudzone"), attr(div, "class", "window-app svelte-1q2cs06"), set_style(div, "bottom", "0"), set_style(
        div,
        "right",
        /*$sidebarWidth*/
        ctx[5] + "px"
      ), toggle_class(
        div,
        "faded",
        /*faded*/
        ctx[0] || /*$isDragging*/
        ctx[4]
      );
    },
    m(target, anchor) {
      insert(target, div, anchor);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i] && each_blocks[i].m(div, null);
      current = !0;
    },
    p(ctx2, [dirty]) {
      if (dirty & /*dialogs, visibleHudsKeys, huds, components, forward*/
      206) {
        each_value = /*visibleHudsKeys*/
        ctx2[3], group_outros();
        for (let i = 0; i < each_blocks.length; i += 1)
          each_blocks[i].r();
        each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, div, fix_and_outro_and_destroy_block, create_each_block, null, get_each_context);
        for (let i = 0; i < each_blocks.length; i += 1)
          each_blocks[i].a();
        check_outros();
      }
      (!current || dirty & /*$sidebarWidth*/
      32) && set_style(
        div,
        "right",
        /*$sidebarWidth*/
        ctx2[5] + "px"
      ), (!current || dirty & /*faded, $isDragging*/
      17) && toggle_class(
        div,
        "faded",
        /*faded*/
        ctx2[0] || /*$isDragging*/
        ctx2[4]
      );
    },
    i(local) {
      if (!current) {
        for (let i = 0; i < each_value.length; i += 1)
          transition_in(each_blocks[i]);
        current = !0;
      }
    },
    o(local) {
      for (let i = 0; i < each_blocks.length; i += 1)
        transition_out(each_blocks[i]);
      current = !1;
    },
    d(detaching) {
      detaching && detach(div);
      for (let i = 0; i < each_blocks.length; i += 1)
        each_blocks[i].d();
    }
  };
}
__name(create_fragment, "create_fragment");
function instance($$self, $$props, $$invalidate) {
  let attackData, damageData, visibleHudsKeys, $userTargets, $isDragging, $sidebarWidth;
  component_subscribe($$self, userTargets, ($$value) => $$invalidate(16, $userTargets = $$value)), component_subscribe($$self, isDragging, ($$value) => $$invalidate(4, $isDragging = $$value)), component_subscribe($$self, sidebarWidth, ($$value) => $$invalidate(5, $sidebarWidth = $$value));
  let dispatch = createEventDispatcher(), dialogs = {
    hase: AccDiffHud,
    attack: AccDiffHud,
    damage: DamageHud,
    struct: StructStressHud,
    stress: StructStressHud
  }, huds = {
    hase: { open: null },
    attack: { open: null },
    damage: { open: null },
    struct: { open: null },
    stress: { open: null }
  };
  function open(key, data2) {
    dispatch(`${key}.cancel`), $$invalidate(2, huds[key].open = (/* @__PURE__ */ new Date()).getTime(), huds), $$invalidate(2, huds[key].data = data2, huds);
  }
  __name(open, "open");
  function close(key) {
    dispatch(`${key}.cancel`), $$invalidate(2, huds[key].open = null, huds), $$invalidate(2, huds[key].data = null, huds);
  }
  __name(close, "close");
  function refresh(key, data2) {
    $$invalidate(2, huds[key].data = data2, huds);
  }
  __name(refresh, "refresh");
  function data(key) {
    if (huds[key] && huds[key].data)
      return huds[key].data;
  }
  __name(data, "data");
  function isOpen(key) {
    return (huds[key] && huds[key].open) !== null;
  }
  __name(isOpen, "isOpen");
  let { faded = !1 } = $$props;
  function fade2(dir) {
    $$invalidate(0, faded = dir == "out");
  }
  __name(fade2, "fade");
  let { components = {} } = $$props;
  function forward(key, event, data2) {
    dispatch(`${key}.${event}`, data2 || void 0), $$invalidate(2, huds[key].open = null, huds), $$invalidate(2, huds[key].data = null, huds);
  }
  __name(forward, "forward");
  function switch_instance_binding($$value, key) {
    binding_callbacks[$$value ? "unshift" : "push"](() => {
      components[key] = $$value, $$invalidate(1, components);
    });
  }
  __name(switch_instance_binding, "switch_instance_binding");
  const submit_handler = /* @__PURE__ */ __name((key) => forward(key, "submit", huds[key].data), "submit_handler"), cancel_handler = /* @__PURE__ */ __name((key) => forward(key, "cancel"), "cancel_handler");
  return $$self.$$set = ($$props2) => {
    "faded" in $$props2 && $$invalidate(0, faded = $$props2.faded), "components" in $$props2 && $$invalidate(1, components = $$props2.components);
  }, $$self.$$.update = () => {
    $$self.$$.dirty & /*huds*/
    4 && $$invalidate(15, attackData = huds.attack.data), $$self.$$.dirty & /*attackData, $userTargets*/
    98304 && attackData && (attackData.replaceTargets($userTargets), $$invalidate(15, attackData), $$invalidate(2, huds), $$invalidate(16, $userTargets)), $$self.$$.dirty & /*huds*/
    4 && $$invalidate(14, damageData = huds.damage.data), $$self.$$.dirty & /*damageData, $userTargets*/
    81920 && damageData && (damageData.replaceTargets($userTargets), $$invalidate(14, damageData), $$invalidate(2, huds), $$invalidate(16, $userTargets)), $$self.$$.dirty & /*huds*/
    4 && $$invalidate(3, visibleHudsKeys = Object.keys(huds).filter((key) => huds[key].open).sort((a, b) => huds[b].open - huds[a].open));
  }, [
    faded,
    components,
    huds,
    visibleHudsKeys,
    $isDragging,
    $sidebarWidth,
    dialogs,
    forward,
    open,
    close,
    refresh,
    data,
    isOpen,
    fade2,
    damageData,
    attackData,
    $userTargets,
    switch_instance_binding,
    submit_handler,
    cancel_handler
  ];
}
__name(instance, "instance");
const _SlidingHUDZone = class _SlidingHUDZone extends SvelteComponent {
  constructor(options) {
    super(), init(this, options, instance, create_fragment, safe_not_equal, {
      open: 8,
      close: 9,
      refresh: 10,
      data: 11,
      isOpen: 12,
      faded: 0,
      fade: 13,
      components: 1
    });
  }
  get open() {
    return this.$$.ctx[8];
  }
  get close() {
    return this.$$.ctx[9];
  }
  get refresh() {
    return this.$$.ctx[10];
  }
  get data() {
    return this.$$.ctx[11];
  }
  get isOpen() {
    return this.$$.ctx[12];
  }
  get faded() {
    return this.$$.ctx[0];
  }
  set faded(faded) {
    this.$$set({ faded }), flush();
  }
  get fade() {
    return this.$$.ctx[13];
  }
  get components() {
    return this.$$.ctx[1];
  }
  set components(components) {
    this.$$set({ components }), flush();
  }
};
__name(_SlidingHUDZone, "SlidingHUDZone");
let SlidingHUDZone = _SlidingHUDZone;
export {
  SlidingHUDZone as default
};
//# sourceMappingURL=SlidingHUDZone-bea5c98f.mjs.map
