var __defProp = Object.defineProperty;
var __typeError = (msg) => {
  throw TypeError(msg);
};
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value), __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
const id = "lancer-alternative-sheets", TEMPLATE_PATHS = {
  mechSheetSvelte: `modules/${id}/templates/la-mech-svelte.hbs`,
  npcSheetSvelte: `modules/${id}/templates/la-npc-svelte.hbs`,
  pilotSheetSvelte: `modules/${id}/templates/la-pilot-svelte.hbs`,
  deployableSheetSvelte: `modules/${id}/templates/la-deployable-svelte.hbs`,
  featureCard: `modules/${id}/templates/chat/feature-card.hbs`,
  pilotSettingsSubmenu: `modules/${id}/templates/settings/la-pilot-settings-submenu.hbs`,
  mechSettingsSubmenu: `modules/${id}/templates/settings/la-mech-settings-submenu.hbs`,
  npcSettingsSubmenu: `modules/${id}/templates/settings/la-npc-settings-submenu.hbs`,
  deployableSettingsSubmenu: `modules/${id}/templates/settings/la-deployable-settings-submenu.hbs`
}, preloadTemplates = /* @__PURE__ */ __name(async function() {
  return foundry.applications.handlebars.loadTemplates(Object.values(TEMPLATE_PATHS));
}, "preloadTemplates");
var LancerAlternative = /* @__PURE__ */ ((LancerAlternative2) => (LancerAlternative2.Name = "lancer-alternative-sheets", LancerAlternative2.EnricherTag = "AltSheetCustom", LancerAlternative2))(LancerAlternative || {});
function utf8Count(str) {
  const strLength = str.length;
  let byteLength = 0, pos = 0;
  for (; pos < strLength; ) {
    let value = str.charCodeAt(pos++);
    if (value & 4294967168)
      if (!(value & 4294965248))
        byteLength += 2;
      else {
        if (value >= 55296 && value <= 56319 && pos < strLength) {
          const extra = str.charCodeAt(pos);
          (extra & 64512) === 56320 && (++pos, value = ((value & 1023) << 10) + (extra & 1023) + 65536);
        }
        value & 4294901760 ? byteLength += 4 : byteLength += 3;
      }
    else {
      byteLength++;
      continue;
    }
  }
  return byteLength;
}
__name(utf8Count, "utf8Count");
function utf8EncodeJs(str, output, outputOffset) {
  const strLength = str.length;
  let offset = outputOffset, pos = 0;
  for (; pos < strLength; ) {
    let value = str.charCodeAt(pos++);
    if (value & 4294967168)
      if (!(value & 4294965248))
        output[offset++] = value >> 6 & 31 | 192;
      else {
        if (value >= 55296 && value <= 56319 && pos < strLength) {
          const extra = str.charCodeAt(pos);
          (extra & 64512) === 56320 && (++pos, value = ((value & 1023) << 10) + (extra & 1023) + 65536);
        }
        value & 4294901760 ? (output[offset++] = value >> 18 & 7 | 240, output[offset++] = value >> 12 & 63 | 128, output[offset++] = value >> 6 & 63 | 128) : (output[offset++] = value >> 12 & 15 | 224, output[offset++] = value >> 6 & 63 | 128);
      }
    else {
      output[offset++] = value;
      continue;
    }
    output[offset++] = value & 63 | 128;
  }
}
__name(utf8EncodeJs, "utf8EncodeJs");
const sharedTextEncoder = new TextEncoder(), TEXT_ENCODER_THRESHOLD = 50;
function utf8EncodeTE(str, output, outputOffset) {
  sharedTextEncoder.encodeInto(str, output.subarray(outputOffset));
}
__name(utf8EncodeTE, "utf8EncodeTE");
function utf8Encode(str, output, outputOffset) {
  str.length > TEXT_ENCODER_THRESHOLD ? utf8EncodeTE(str, output, outputOffset) : utf8EncodeJs(str, output, outputOffset);
}
__name(utf8Encode, "utf8Encode");
const CHUNK_SIZE = 4096;
function utf8DecodeJs(bytes, inputOffset, byteLength) {
  let offset = inputOffset;
  const end = offset + byteLength, units = [];
  let result = "";
  for (; offset < end; ) {
    const byte1 = bytes[offset++];
    if (!(byte1 & 128))
      units.push(byte1);
    else if ((byte1 & 224) === 192) {
      const byte2 = bytes[offset++] & 63;
      units.push((byte1 & 31) << 6 | byte2);
    } else if ((byte1 & 240) === 224) {
      const byte2 = bytes[offset++] & 63, byte3 = bytes[offset++] & 63;
      units.push((byte1 & 31) << 12 | byte2 << 6 | byte3);
    } else if ((byte1 & 248) === 240) {
      const byte2 = bytes[offset++] & 63, byte3 = bytes[offset++] & 63, byte4 = bytes[offset++] & 63;
      let unit = (byte1 & 7) << 18 | byte2 << 12 | byte3 << 6 | byte4;
      unit > 65535 && (unit -= 65536, units.push(unit >>> 10 & 1023 | 55296), unit = 56320 | unit & 1023), units.push(unit);
    } else
      units.push(byte1);
    units.length >= CHUNK_SIZE && (result += String.fromCharCode(...units), units.length = 0);
  }
  return units.length > 0 && (result += String.fromCharCode(...units)), result;
}
__name(utf8DecodeJs, "utf8DecodeJs");
const sharedTextDecoder = new TextDecoder(), TEXT_DECODER_THRESHOLD = 200;
function utf8DecodeTD(bytes, inputOffset, byteLength) {
  const stringBytes = bytes.subarray(inputOffset, inputOffset + byteLength);
  return sharedTextDecoder.decode(stringBytes);
}
__name(utf8DecodeTD, "utf8DecodeTD");
function utf8Decode(bytes, inputOffset, byteLength) {
  return byteLength > TEXT_DECODER_THRESHOLD ? utf8DecodeTD(bytes, inputOffset, byteLength) : utf8DecodeJs(bytes, inputOffset, byteLength);
}
__name(utf8Decode, "utf8Decode");
const _ExtData = class _ExtData {
  constructor(type, data) {
    this.type = type, this.data = data;
  }
};
__name(_ExtData, "ExtData");
let ExtData = _ExtData;
const _DecodeError = class _DecodeError extends Error {
  constructor(message) {
    super(message);
    const proto = Object.create(_DecodeError.prototype);
    Object.setPrototypeOf(this, proto), Object.defineProperty(this, "name", {
      configurable: !0,
      enumerable: !1,
      value: _DecodeError.name
    });
  }
};
__name(_DecodeError, "DecodeError");
let DecodeError = _DecodeError;
const UINT32_MAX = 4294967295;
function setUint64(view, offset, value) {
  const high = value / 4294967296, low = value;
  view.setUint32(offset, high), view.setUint32(offset + 4, low);
}
__name(setUint64, "setUint64");
function setInt64(view, offset, value) {
  const high = Math.floor(value / 4294967296), low = value;
  view.setUint32(offset, high), view.setUint32(offset + 4, low);
}
__name(setInt64, "setInt64");
function getInt64(view, offset) {
  const high = view.getInt32(offset), low = view.getUint32(offset + 4);
  return high * 4294967296 + low;
}
__name(getInt64, "getInt64");
function getUint64(view, offset) {
  const high = view.getUint32(offset), low = view.getUint32(offset + 4);
  return high * 4294967296 + low;
}
__name(getUint64, "getUint64");
const EXT_TIMESTAMP = -1, TIMESTAMP32_MAX_SEC = 4294967296 - 1, TIMESTAMP64_MAX_SEC = 17179869184 - 1;
function encodeTimeSpecToTimestamp({ sec, nsec }) {
  if (sec >= 0 && nsec >= 0 && sec <= TIMESTAMP64_MAX_SEC)
    if (nsec === 0 && sec <= TIMESTAMP32_MAX_SEC) {
      const rv = new Uint8Array(4);
      return new DataView(rv.buffer).setUint32(0, sec), rv;
    } else {
      const secHigh = sec / 4294967296, secLow = sec & 4294967295, rv = new Uint8Array(8), view = new DataView(rv.buffer);
      return view.setUint32(0, nsec << 2 | secHigh & 3), view.setUint32(4, secLow), rv;
    }
  else {
    const rv = new Uint8Array(12), view = new DataView(rv.buffer);
    return view.setUint32(0, nsec), setInt64(view, 4, sec), rv;
  }
}
__name(encodeTimeSpecToTimestamp, "encodeTimeSpecToTimestamp");
function encodeDateToTimeSpec(date) {
  const msec = date.getTime(), sec = Math.floor(msec / 1e3), nsec = (msec - sec * 1e3) * 1e6, nsecInSec = Math.floor(nsec / 1e9);
  return {
    sec: sec + nsecInSec,
    nsec: nsec - nsecInSec * 1e9
  };
}
__name(encodeDateToTimeSpec, "encodeDateToTimeSpec");
function encodeTimestampExtension(object) {
  if (object instanceof Date) {
    const timeSpec = encodeDateToTimeSpec(object);
    return encodeTimeSpecToTimestamp(timeSpec);
  } else
    return null;
}
__name(encodeTimestampExtension, "encodeTimestampExtension");
function decodeTimestampToTimeSpec(data) {
  const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
  switch (data.byteLength) {
    case 4:
      return { sec: view.getUint32(0), nsec: 0 };
    case 8: {
      const nsec30AndSecHigh2 = view.getUint32(0), secLow32 = view.getUint32(4), sec = (nsec30AndSecHigh2 & 3) * 4294967296 + secLow32, nsec = nsec30AndSecHigh2 >>> 2;
      return { sec, nsec };
    }
    case 12: {
      const sec = getInt64(view, 4), nsec = view.getUint32(0);
      return { sec, nsec };
    }
    default:
      throw new DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${data.length}`);
  }
}
__name(decodeTimestampToTimeSpec, "decodeTimestampToTimeSpec");
function decodeTimestampExtension(data) {
  const timeSpec = decodeTimestampToTimeSpec(data);
  return new Date(timeSpec.sec * 1e3 + timeSpec.nsec / 1e6);
}
__name(decodeTimestampExtension, "decodeTimestampExtension");
const timestampExtension = {
  type: EXT_TIMESTAMP,
  encode: encodeTimestampExtension,
  decode: decodeTimestampExtension
}, _ExtensionCodec = class _ExtensionCodec {
  constructor() {
    this.builtInEncoders = [], this.builtInDecoders = [], this.encoders = [], this.decoders = [], this.register(timestampExtension);
  }
  register({ type, encode, decode }) {
    if (type >= 0)
      this.encoders[type] = encode, this.decoders[type] = decode;
    else {
      const index2 = -1 - type;
      this.builtInEncoders[index2] = encode, this.builtInDecoders[index2] = decode;
    }
  }
  tryToEncode(object, context) {
    for (let i = 0; i < this.builtInEncoders.length; i++) {
      const encodeExt = this.builtInEncoders[i];
      if (encodeExt != null) {
        const data = encodeExt(object, context);
        if (data != null) {
          const type = -1 - i;
          return new ExtData(type, data);
        }
      }
    }
    for (let i = 0; i < this.encoders.length; i++) {
      const encodeExt = this.encoders[i];
      if (encodeExt != null) {
        const data = encodeExt(object, context);
        if (data != null) {
          const type = i;
          return new ExtData(type, data);
        }
      }
    }
    return object instanceof ExtData ? object : null;
  }
  decode(data, type, context) {
    const decodeExt = type < 0 ? this.builtInDecoders[-1 - type] : this.decoders[type];
    return decodeExt ? decodeExt(data, type, context) : new ExtData(type, data);
  }
};
__name(_ExtensionCodec, "ExtensionCodec");
let ExtensionCodec = _ExtensionCodec;
ExtensionCodec.defaultCodec = new ExtensionCodec();
function isArrayBufferLike(buffer) {
  return buffer instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && buffer instanceof SharedArrayBuffer;
}
__name(isArrayBufferLike, "isArrayBufferLike");
function ensureUint8Array(buffer) {
  return buffer instanceof Uint8Array ? buffer : ArrayBuffer.isView(buffer) ? new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength) : isArrayBufferLike(buffer) ? new Uint8Array(buffer) : Uint8Array.from(buffer);
}
__name(ensureUint8Array, "ensureUint8Array");
const DEFAULT_MAX_DEPTH = 100, DEFAULT_INITIAL_BUFFER_SIZE = 2048, _Encoder = class _Encoder {
  constructor(options) {
    this.entered = !1, this.extensionCodec = (options == null ? void 0 : options.extensionCodec) ?? ExtensionCodec.defaultCodec, this.context = options == null ? void 0 : options.context, this.useBigInt64 = (options == null ? void 0 : options.useBigInt64) ?? !1, this.maxDepth = (options == null ? void 0 : options.maxDepth) ?? DEFAULT_MAX_DEPTH, this.initialBufferSize = (options == null ? void 0 : options.initialBufferSize) ?? DEFAULT_INITIAL_BUFFER_SIZE, this.sortKeys = (options == null ? void 0 : options.sortKeys) ?? !1, this.forceFloat32 = (options == null ? void 0 : options.forceFloat32) ?? !1, this.ignoreUndefined = (options == null ? void 0 : options.ignoreUndefined) ?? !1, this.forceIntegerToFloat = (options == null ? void 0 : options.forceIntegerToFloat) ?? !1, this.pos = 0, this.view = new DataView(new ArrayBuffer(this.initialBufferSize)), this.bytes = new Uint8Array(this.view.buffer);
  }
  clone() {
    return new _Encoder({
      extensionCodec: this.extensionCodec,
      context: this.context,
      useBigInt64: this.useBigInt64,
      maxDepth: this.maxDepth,
      initialBufferSize: this.initialBufferSize,
      sortKeys: this.sortKeys,
      forceFloat32: this.forceFloat32,
      ignoreUndefined: this.ignoreUndefined,
      forceIntegerToFloat: this.forceIntegerToFloat
    });
  }
  reinitializeState() {
    this.pos = 0;
  }
  /**
   * This is almost equivalent to {@link Encoder#encode}, but it returns an reference of the encoder's internal buffer and thus much faster than {@link Encoder#encode}.
   *
   * @returns Encodes the object and returns a shared reference the encoder's internal buffer.
   */
  encodeSharedRef(object) {
    if (this.entered)
      return this.clone().encodeSharedRef(object);
    try {
      return this.entered = !0, this.reinitializeState(), this.doEncode(object, 1), this.bytes.subarray(0, this.pos);
    } finally {
      this.entered = !1;
    }
  }
  /**
   * @returns Encodes the object and returns a copy of the encoder's internal buffer.
   */
  encode(object) {
    if (this.entered)
      return this.clone().encode(object);
    try {
      return this.entered = !0, this.reinitializeState(), this.doEncode(object, 1), this.bytes.slice(0, this.pos);
    } finally {
      this.entered = !1;
    }
  }
  doEncode(object, depth) {
    if (depth > this.maxDepth)
      throw new Error(`Too deep objects in depth ${depth}`);
    object == null ? this.encodeNil() : typeof object == "boolean" ? this.encodeBoolean(object) : typeof object == "number" ? this.forceIntegerToFloat ? this.encodeNumberAsFloat(object) : this.encodeNumber(object) : typeof object == "string" ? this.encodeString(object) : this.useBigInt64 && typeof object == "bigint" ? this.encodeBigInt64(object) : this.encodeObject(object, depth);
  }
  ensureBufferSizeToWrite(sizeToWrite) {
    const requiredSize = this.pos + sizeToWrite;
    this.view.byteLength < requiredSize && this.resizeBuffer(requiredSize * 2);
  }
  resizeBuffer(newSize) {
    const newBuffer = new ArrayBuffer(newSize), newBytes = new Uint8Array(newBuffer), newView = new DataView(newBuffer);
    newBytes.set(this.bytes), this.view = newView, this.bytes = newBytes;
  }
  encodeNil() {
    this.writeU8(192);
  }
  encodeBoolean(object) {
    object === !1 ? this.writeU8(194) : this.writeU8(195);
  }
  encodeNumber(object) {
    !this.forceIntegerToFloat && Number.isSafeInteger(object) ? object >= 0 ? object < 128 ? this.writeU8(object) : object < 256 ? (this.writeU8(204), this.writeU8(object)) : object < 65536 ? (this.writeU8(205), this.writeU16(object)) : object < 4294967296 ? (this.writeU8(206), this.writeU32(object)) : this.useBigInt64 ? this.encodeNumberAsFloat(object) : (this.writeU8(207), this.writeU64(object)) : object >= -32 ? this.writeU8(224 | object + 32) : object >= -128 ? (this.writeU8(208), this.writeI8(object)) : object >= -32768 ? (this.writeU8(209), this.writeI16(object)) : object >= -2147483648 ? (this.writeU8(210), this.writeI32(object)) : this.useBigInt64 ? this.encodeNumberAsFloat(object) : (this.writeU8(211), this.writeI64(object)) : this.encodeNumberAsFloat(object);
  }
  encodeNumberAsFloat(object) {
    this.forceFloat32 ? (this.writeU8(202), this.writeF32(object)) : (this.writeU8(203), this.writeF64(object));
  }
  encodeBigInt64(object) {
    object >= BigInt(0) ? (this.writeU8(207), this.writeBigUint64(object)) : (this.writeU8(211), this.writeBigInt64(object));
  }
  writeStringHeader(byteLength) {
    if (byteLength < 32)
      this.writeU8(160 + byteLength);
    else if (byteLength < 256)
      this.writeU8(217), this.writeU8(byteLength);
    else if (byteLength < 65536)
      this.writeU8(218), this.writeU16(byteLength);
    else if (byteLength < 4294967296)
      this.writeU8(219), this.writeU32(byteLength);
    else
      throw new Error(`Too long string: ${byteLength} bytes in UTF-8`);
  }
  encodeString(object) {
    const byteLength = utf8Count(object);
    this.ensureBufferSizeToWrite(5 + byteLength), this.writeStringHeader(byteLength), utf8Encode(object, this.bytes, this.pos), this.pos += byteLength;
  }
  encodeObject(object, depth) {
    const ext = this.extensionCodec.tryToEncode(object, this.context);
    if (ext != null)
      this.encodeExtension(ext);
    else if (Array.isArray(object))
      this.encodeArray(object, depth);
    else if (ArrayBuffer.isView(object))
      this.encodeBinary(object);
    else if (typeof object == "object")
      this.encodeMap(object, depth);
    else
      throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(object)}`);
  }
  encodeBinary(object) {
    const size = object.byteLength;
    if (size < 256)
      this.writeU8(196), this.writeU8(size);
    else if (size < 65536)
      this.writeU8(197), this.writeU16(size);
    else if (size < 4294967296)
      this.writeU8(198), this.writeU32(size);
    else
      throw new Error(`Too large binary: ${size}`);
    const bytes = ensureUint8Array(object);
    this.writeU8a(bytes);
  }
  encodeArray(object, depth) {
    const size = object.length;
    if (size < 16)
      this.writeU8(144 + size);
    else if (size < 65536)
      this.writeU8(220), this.writeU16(size);
    else if (size < 4294967296)
      this.writeU8(221), this.writeU32(size);
    else
      throw new Error(`Too large array: ${size}`);
    for (const item of object)
      this.doEncode(item, depth + 1);
  }
  countWithoutUndefined(object, keys) {
    let count = 0;
    for (const key of keys)
      object[key] !== void 0 && count++;
    return count;
  }
  encodeMap(object, depth) {
    const keys = Object.keys(object);
    this.sortKeys && keys.sort();
    const size = this.ignoreUndefined ? this.countWithoutUndefined(object, keys) : keys.length;
    if (size < 16)
      this.writeU8(128 + size);
    else if (size < 65536)
      this.writeU8(222), this.writeU16(size);
    else if (size < 4294967296)
      this.writeU8(223), this.writeU32(size);
    else
      throw new Error(`Too large map object: ${size}`);
    for (const key of keys) {
      const value = object[key];
      this.ignoreUndefined && value === void 0 || (this.encodeString(key), this.doEncode(value, depth + 1));
    }
  }
  encodeExtension(ext) {
    if (typeof ext.data == "function") {
      const data = ext.data(this.pos + 6), size2 = data.length;
      if (size2 >= 4294967296)
        throw new Error(`Too large extension object: ${size2}`);
      this.writeU8(201), this.writeU32(size2), this.writeI8(ext.type), this.writeU8a(data);
      return;
    }
    const size = ext.data.length;
    if (size === 1)
      this.writeU8(212);
    else if (size === 2)
      this.writeU8(213);
    else if (size === 4)
      this.writeU8(214);
    else if (size === 8)
      this.writeU8(215);
    else if (size === 16)
      this.writeU8(216);
    else if (size < 256)
      this.writeU8(199), this.writeU8(size);
    else if (size < 65536)
      this.writeU8(200), this.writeU16(size);
    else if (size < 4294967296)
      this.writeU8(201), this.writeU32(size);
    else
      throw new Error(`Too large extension object: ${size}`);
    this.writeI8(ext.type), this.writeU8a(ext.data);
  }
  writeU8(value) {
    this.ensureBufferSizeToWrite(1), this.view.setUint8(this.pos, value), this.pos++;
  }
  writeU8a(values) {
    const size = values.length;
    this.ensureBufferSizeToWrite(size), this.bytes.set(values, this.pos), this.pos += size;
  }
  writeI8(value) {
    this.ensureBufferSizeToWrite(1), this.view.setInt8(this.pos, value), this.pos++;
  }
  writeU16(value) {
    this.ensureBufferSizeToWrite(2), this.view.setUint16(this.pos, value), this.pos += 2;
  }
  writeI16(value) {
    this.ensureBufferSizeToWrite(2), this.view.setInt16(this.pos, value), this.pos += 2;
  }
  writeU32(value) {
    this.ensureBufferSizeToWrite(4), this.view.setUint32(this.pos, value), this.pos += 4;
  }
  writeI32(value) {
    this.ensureBufferSizeToWrite(4), this.view.setInt32(this.pos, value), this.pos += 4;
  }
  writeF32(value) {
    this.ensureBufferSizeToWrite(4), this.view.setFloat32(this.pos, value), this.pos += 4;
  }
  writeF64(value) {
    this.ensureBufferSizeToWrite(8), this.view.setFloat64(this.pos, value), this.pos += 8;
  }
  writeU64(value) {
    this.ensureBufferSizeToWrite(8), setUint64(this.view, this.pos, value), this.pos += 8;
  }
  writeI64(value) {
    this.ensureBufferSizeToWrite(8), setInt64(this.view, this.pos, value), this.pos += 8;
  }
  writeBigUint64(value) {
    this.ensureBufferSizeToWrite(8), this.view.setBigUint64(this.pos, value), this.pos += 8;
  }
  writeBigInt64(value) {
    this.ensureBufferSizeToWrite(8), this.view.setBigInt64(this.pos, value), this.pos += 8;
  }
};
__name(_Encoder, "Encoder");
let Encoder = _Encoder;
function prettyByte(byte) {
  return `${byte < 0 ? "-" : ""}0x${Math.abs(byte).toString(16).padStart(2, "0")}`;
}
__name(prettyByte, "prettyByte");
const DEFAULT_MAX_KEY_LENGTH = 16, DEFAULT_MAX_LENGTH_PER_KEY = 16, _CachedKeyDecoder = class _CachedKeyDecoder {
  constructor(maxKeyLength = DEFAULT_MAX_KEY_LENGTH, maxLengthPerKey = DEFAULT_MAX_LENGTH_PER_KEY) {
    this.hit = 0, this.miss = 0, this.maxKeyLength = maxKeyLength, this.maxLengthPerKey = maxLengthPerKey, this.caches = [];
    for (let i = 0; i < this.maxKeyLength; i++)
      this.caches.push([]);
  }
  canBeCached(byteLength) {
    return byteLength > 0 && byteLength <= this.maxKeyLength;
  }
  find(bytes, inputOffset, byteLength) {
    const records = this.caches[byteLength - 1];
    FIND_CHUNK: for (const record of records) {
      const recordBytes = record.bytes;
      for (let j = 0; j < byteLength; j++)
        if (recordBytes[j] !== bytes[inputOffset + j])
          continue FIND_CHUNK;
      return record.str;
    }
    return null;
  }
  store(bytes, value) {
    const records = this.caches[bytes.length - 1], record = { bytes, str: value };
    records.length >= this.maxLengthPerKey ? records[Math.random() * records.length | 0] = record : records.push(record);
  }
  decode(bytes, inputOffset, byteLength) {
    const cachedValue = this.find(bytes, inputOffset, byteLength);
    if (cachedValue != null)
      return this.hit++, cachedValue;
    this.miss++;
    const str = utf8DecodeJs(bytes, inputOffset, byteLength), slicedCopyOfBytes = Uint8Array.prototype.slice.call(bytes, inputOffset, inputOffset + byteLength);
    return this.store(slicedCopyOfBytes, str), str;
  }
};
__name(_CachedKeyDecoder, "CachedKeyDecoder");
let CachedKeyDecoder = _CachedKeyDecoder;
const STATE_ARRAY = "array", STATE_MAP_KEY = "map_key", STATE_MAP_VALUE = "map_value", mapKeyConverter = /* @__PURE__ */ __name((key) => {
  if (typeof key == "string" || typeof key == "number")
    return key;
  throw new DecodeError("The type of key must be string or number but " + typeof key);
}, "mapKeyConverter"), _StackPool = class _StackPool {
  constructor() {
    this.stack = [], this.stackHeadPosition = -1;
  }
  get length() {
    return this.stackHeadPosition + 1;
  }
  top() {
    return this.stack[this.stackHeadPosition];
  }
  pushArrayState(size) {
    const state2 = this.getUninitializedStateFromPool();
    state2.type = STATE_ARRAY, state2.position = 0, state2.size = size, state2.array = new Array(size);
  }
  pushMapState(size) {
    const state2 = this.getUninitializedStateFromPool();
    state2.type = STATE_MAP_KEY, state2.readCount = 0, state2.size = size, state2.map = {};
  }
  getUninitializedStateFromPool() {
    if (this.stackHeadPosition++, this.stackHeadPosition === this.stack.length) {
      const partialState = {
        type: void 0,
        size: 0,
        array: void 0,
        position: 0,
        readCount: 0,
        map: void 0,
        key: null
      };
      this.stack.push(partialState);
    }
    return this.stack[this.stackHeadPosition];
  }
  release(state2) {
    if (this.stack[this.stackHeadPosition] !== state2)
      throw new Error("Invalid stack state. Released state is not on top of the stack.");
    if (state2.type === STATE_ARRAY) {
      const partialState = state2;
      partialState.size = 0, partialState.array = void 0, partialState.position = 0, partialState.type = void 0;
    }
    if (state2.type === STATE_MAP_KEY || state2.type === STATE_MAP_VALUE) {
      const partialState = state2;
      partialState.size = 0, partialState.map = void 0, partialState.readCount = 0, partialState.type = void 0;
    }
    this.stackHeadPosition--;
  }
  reset() {
    this.stack.length = 0, this.stackHeadPosition = -1;
  }
};
__name(_StackPool, "StackPool");
let StackPool = _StackPool;
const HEAD_BYTE_REQUIRED = -1, EMPTY_VIEW = new DataView(new ArrayBuffer(0)), EMPTY_BYTES = new Uint8Array(EMPTY_VIEW.buffer);
try {
  EMPTY_VIEW.getInt8(0);
} catch (e) {
  if (!(e instanceof RangeError))
    throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access");
}
const MORE_DATA = new RangeError("Insufficient data"), sharedCachedKeyDecoder = new CachedKeyDecoder(), _Decoder = class _Decoder {
  constructor(options) {
    this.totalPos = 0, this.pos = 0, this.view = EMPTY_VIEW, this.bytes = EMPTY_BYTES, this.headByte = HEAD_BYTE_REQUIRED, this.stack = new StackPool(), this.entered = !1, this.extensionCodec = (options == null ? void 0 : options.extensionCodec) ?? ExtensionCodec.defaultCodec, this.context = options == null ? void 0 : options.context, this.useBigInt64 = (options == null ? void 0 : options.useBigInt64) ?? !1, this.rawStrings = (options == null ? void 0 : options.rawStrings) ?? !1, this.maxStrLength = (options == null ? void 0 : options.maxStrLength) ?? UINT32_MAX, this.maxBinLength = (options == null ? void 0 : options.maxBinLength) ?? UINT32_MAX, this.maxArrayLength = (options == null ? void 0 : options.maxArrayLength) ?? UINT32_MAX, this.maxMapLength = (options == null ? void 0 : options.maxMapLength) ?? UINT32_MAX, this.maxExtLength = (options == null ? void 0 : options.maxExtLength) ?? UINT32_MAX, this.keyDecoder = (options == null ? void 0 : options.keyDecoder) !== void 0 ? options.keyDecoder : sharedCachedKeyDecoder, this.mapKeyConverter = (options == null ? void 0 : options.mapKeyConverter) ?? mapKeyConverter;
  }
  clone() {
    return new _Decoder({
      extensionCodec: this.extensionCodec,
      context: this.context,
      useBigInt64: this.useBigInt64,
      rawStrings: this.rawStrings,
      maxStrLength: this.maxStrLength,
      maxBinLength: this.maxBinLength,
      maxArrayLength: this.maxArrayLength,
      maxMapLength: this.maxMapLength,
      maxExtLength: this.maxExtLength,
      keyDecoder: this.keyDecoder
    });
  }
  reinitializeState() {
    this.totalPos = 0, this.headByte = HEAD_BYTE_REQUIRED, this.stack.reset();
  }
  setBuffer(buffer) {
    const bytes = ensureUint8Array(buffer);
    this.bytes = bytes, this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength), this.pos = 0;
  }
  appendBuffer(buffer) {
    if (this.headByte === HEAD_BYTE_REQUIRED && !this.hasRemaining(1))
      this.setBuffer(buffer);
    else {
      const remainingData = this.bytes.subarray(this.pos), newData = ensureUint8Array(buffer), newBuffer = new Uint8Array(remainingData.length + newData.length);
      newBuffer.set(remainingData), newBuffer.set(newData, remainingData.length), this.setBuffer(newBuffer);
    }
  }
  hasRemaining(size) {
    return this.view.byteLength - this.pos >= size;
  }
  createExtraByteError(posToShow) {
    const { view, pos } = this;
    return new RangeError(`Extra ${view.byteLength - pos} of ${view.byteLength} byte(s) found at buffer[${posToShow}]`);
  }
  /**
   * @throws {@link DecodeError}
   * @throws {@link RangeError}
   */
  decode(buffer) {
    if (this.entered)
      return this.clone().decode(buffer);
    try {
      this.entered = !0, this.reinitializeState(), this.setBuffer(buffer);
      const object = this.doDecodeSync();
      if (this.hasRemaining(1))
        throw this.createExtraByteError(this.pos);
      return object;
    } finally {
      this.entered = !1;
    }
  }
  *decodeMulti(buffer) {
    if (this.entered) {
      yield* this.clone().decodeMulti(buffer);
      return;
    }
    try {
      for (this.entered = !0, this.reinitializeState(), this.setBuffer(buffer); this.hasRemaining(1); )
        yield this.doDecodeSync();
    } finally {
      this.entered = !1;
    }
  }
  async decodeAsync(stream) {
    if (this.entered)
      return this.clone().decodeAsync(stream);
    try {
      this.entered = !0;
      let decoded = !1, object;
      for await (const buffer of stream) {
        if (decoded)
          throw this.entered = !1, this.createExtraByteError(this.totalPos);
        this.appendBuffer(buffer);
        try {
          object = this.doDecodeSync(), decoded = !0;
        } catch (e) {
          if (!(e instanceof RangeError))
            throw e;
        }
        this.totalPos += this.pos;
      }
      if (decoded) {
        if (this.hasRemaining(1))
          throw this.createExtraByteError(this.totalPos);
        return object;
      }
      const { headByte, pos, totalPos } = this;
      throw new RangeError(`Insufficient data in parsing ${prettyByte(headByte)} at ${totalPos} (${pos} in the current buffer)`);
    } finally {
      this.entered = !1;
    }
  }
  decodeArrayStream(stream) {
    return this.decodeMultiAsync(stream, !0);
  }
  decodeStream(stream) {
    return this.decodeMultiAsync(stream, !1);
  }
  async *decodeMultiAsync(stream, isArray) {
    if (this.entered) {
      yield* this.clone().decodeMultiAsync(stream, isArray);
      return;
    }
    try {
      this.entered = !0;
      let isArrayHeaderRequired = isArray, arrayItemsLeft = -1;
      for await (const buffer of stream) {
        if (isArray && arrayItemsLeft === 0)
          throw this.createExtraByteError(this.totalPos);
        this.appendBuffer(buffer), isArrayHeaderRequired && (arrayItemsLeft = this.readArraySize(), isArrayHeaderRequired = !1, this.complete());
        try {
          for (; yield this.doDecodeSync(), --arrayItemsLeft !== 0; )
            ;
        } catch (e) {
          if (!(e instanceof RangeError))
            throw e;
        }
        this.totalPos += this.pos;
      }
    } finally {
      this.entered = !1;
    }
  }
  doDecodeSync() {
    DECODE: for (; ; ) {
      const headByte = this.readHeadByte();
      let object;
      if (headByte >= 224)
        object = headByte - 256;
      else if (headByte < 192)
        if (headByte < 128)
          object = headByte;
        else if (headByte < 144) {
          const size = headByte - 128;
          if (size !== 0) {
            this.pushMapState(size), this.complete();
            continue DECODE;
          } else
            object = {};
        } else if (headByte < 160) {
          const size = headByte - 144;
          if (size !== 0) {
            this.pushArrayState(size), this.complete();
            continue DECODE;
          } else
            object = [];
        } else {
          const byteLength = headByte - 160;
          object = this.decodeString(byteLength, 0);
        }
      else if (headByte === 192)
        object = null;
      else if (headByte === 194)
        object = !1;
      else if (headByte === 195)
        object = !0;
      else if (headByte === 202)
        object = this.readF32();
      else if (headByte === 203)
        object = this.readF64();
      else if (headByte === 204)
        object = this.readU8();
      else if (headByte === 205)
        object = this.readU16();
      else if (headByte === 206)
        object = this.readU32();
      else if (headByte === 207)
        this.useBigInt64 ? object = this.readU64AsBigInt() : object = this.readU64();
      else if (headByte === 208)
        object = this.readI8();
      else if (headByte === 209)
        object = this.readI16();
      else if (headByte === 210)
        object = this.readI32();
      else if (headByte === 211)
        this.useBigInt64 ? object = this.readI64AsBigInt() : object = this.readI64();
      else if (headByte === 217) {
        const byteLength = this.lookU8();
        object = this.decodeString(byteLength, 1);
      } else if (headByte === 218) {
        const byteLength = this.lookU16();
        object = this.decodeString(byteLength, 2);
      } else if (headByte === 219) {
        const byteLength = this.lookU32();
        object = this.decodeString(byteLength, 4);
      } else if (headByte === 220) {
        const size = this.readU16();
        if (size !== 0) {
          this.pushArrayState(size), this.complete();
          continue DECODE;
        } else
          object = [];
      } else if (headByte === 221) {
        const size = this.readU32();
        if (size !== 0) {
          this.pushArrayState(size), this.complete();
          continue DECODE;
        } else
          object = [];
      } else if (headByte === 222) {
        const size = this.readU16();
        if (size !== 0) {
          this.pushMapState(size), this.complete();
          continue DECODE;
        } else
          object = {};
      } else if (headByte === 223) {
        const size = this.readU32();
        if (size !== 0) {
          this.pushMapState(size), this.complete();
          continue DECODE;
        } else
          object = {};
      } else if (headByte === 196) {
        const size = this.lookU8();
        object = this.decodeBinary(size, 1);
      } else if (headByte === 197) {
        const size = this.lookU16();
        object = this.decodeBinary(size, 2);
      } else if (headByte === 198) {
        const size = this.lookU32();
        object = this.decodeBinary(size, 4);
      } else if (headByte === 212)
        object = this.decodeExtension(1, 0);
      else if (headByte === 213)
        object = this.decodeExtension(2, 0);
      else if (headByte === 214)
        object = this.decodeExtension(4, 0);
      else if (headByte === 215)
        object = this.decodeExtension(8, 0);
      else if (headByte === 216)
        object = this.decodeExtension(16, 0);
      else if (headByte === 199) {
        const size = this.lookU8();
        object = this.decodeExtension(size, 1);
      } else if (headByte === 200) {
        const size = this.lookU16();
        object = this.decodeExtension(size, 2);
      } else if (headByte === 201) {
        const size = this.lookU32();
        object = this.decodeExtension(size, 4);
      } else
        throw new DecodeError(`Unrecognized type byte: ${prettyByte(headByte)}`);
      this.complete();
      const stack = this.stack;
      for (; stack.length > 0; ) {
        const state2 = stack.top();
        if (state2.type === STATE_ARRAY)
          if (state2.array[state2.position] = object, state2.position++, state2.position === state2.size)
            object = state2.array, stack.release(state2);
          else
            continue DECODE;
        else if (state2.type === STATE_MAP_KEY) {
          if (object === "__proto__")
            throw new DecodeError("The key __proto__ is not allowed");
          state2.key = this.mapKeyConverter(object), state2.type = STATE_MAP_VALUE;
          continue DECODE;
        } else if (state2.map[state2.key] = object, state2.readCount++, state2.readCount === state2.size)
          object = state2.map, stack.release(state2);
        else {
          state2.key = null, state2.type = STATE_MAP_KEY;
          continue DECODE;
        }
      }
      return object;
    }
  }
  readHeadByte() {
    return this.headByte === HEAD_BYTE_REQUIRED && (this.headByte = this.readU8()), this.headByte;
  }
  complete() {
    this.headByte = HEAD_BYTE_REQUIRED;
  }
  readArraySize() {
    const headByte = this.readHeadByte();
    switch (headByte) {
      case 220:
        return this.readU16();
      case 221:
        return this.readU32();
      default: {
        if (headByte < 160)
          return headByte - 144;
        throw new DecodeError(`Unrecognized array type byte: ${prettyByte(headByte)}`);
      }
    }
  }
  pushMapState(size) {
    if (size > this.maxMapLength)
      throw new DecodeError(`Max length exceeded: map length (${size}) > maxMapLengthLength (${this.maxMapLength})`);
    this.stack.pushMapState(size);
  }
  pushArrayState(size) {
    if (size > this.maxArrayLength)
      throw new DecodeError(`Max length exceeded: array length (${size}) > maxArrayLength (${this.maxArrayLength})`);
    this.stack.pushArrayState(size);
  }
  decodeString(byteLength, headerOffset) {
    return !this.rawStrings || this.stateIsMapKey() ? this.decodeUtf8String(byteLength, headerOffset) : this.decodeBinary(byteLength, headerOffset);
  }
  /**
   * @throws {@link RangeError}
   */
  decodeUtf8String(byteLength, headerOffset) {
    var _a;
    if (byteLength > this.maxStrLength)
      throw new DecodeError(`Max length exceeded: UTF-8 byte length (${byteLength}) > maxStrLength (${this.maxStrLength})`);
    if (this.bytes.byteLength < this.pos + headerOffset + byteLength)
      throw MORE_DATA;
    const offset = this.pos + headerOffset;
    let object;
    return this.stateIsMapKey() && ((_a = this.keyDecoder) != null && _a.canBeCached(byteLength)) ? object = this.keyDecoder.decode(this.bytes, offset, byteLength) : object = utf8Decode(this.bytes, offset, byteLength), this.pos += headerOffset + byteLength, object;
  }
  stateIsMapKey() {
    return this.stack.length > 0 ? this.stack.top().type === STATE_MAP_KEY : !1;
  }
  /**
   * @throws {@link RangeError}
   */
  decodeBinary(byteLength, headOffset) {
    if (byteLength > this.maxBinLength)
      throw new DecodeError(`Max length exceeded: bin length (${byteLength}) > maxBinLength (${this.maxBinLength})`);
    if (!this.hasRemaining(byteLength + headOffset))
      throw MORE_DATA;
    const offset = this.pos + headOffset, object = this.bytes.subarray(offset, offset + byteLength);
    return this.pos += headOffset + byteLength, object;
  }
  decodeExtension(size, headOffset) {
    if (size > this.maxExtLength)
      throw new DecodeError(`Max length exceeded: ext length (${size}) > maxExtLength (${this.maxExtLength})`);
    const extType = this.view.getInt8(this.pos + headOffset), data = this.decodeBinary(
      size,
      headOffset + 1
      /* extType */
    );
    return this.extensionCodec.decode(data, extType, this.context);
  }
  lookU8() {
    return this.view.getUint8(this.pos);
  }
  lookU16() {
    return this.view.getUint16(this.pos);
  }
  lookU32() {
    return this.view.getUint32(this.pos);
  }
  readU8() {
    const value = this.view.getUint8(this.pos);
    return this.pos++, value;
  }
  readI8() {
    const value = this.view.getInt8(this.pos);
    return this.pos++, value;
  }
  readU16() {
    const value = this.view.getUint16(this.pos);
    return this.pos += 2, value;
  }
  readI16() {
    const value = this.view.getInt16(this.pos);
    return this.pos += 2, value;
  }
  readU32() {
    const value = this.view.getUint32(this.pos);
    return this.pos += 4, value;
  }
  readI32() {
    const value = this.view.getInt32(this.pos);
    return this.pos += 4, value;
  }
  readU64() {
    const value = getUint64(this.view, this.pos);
    return this.pos += 8, value;
  }
  readI64() {
    const value = getInt64(this.view, this.pos);
    return this.pos += 8, value;
  }
  readU64AsBigInt() {
    const value = this.view.getBigUint64(this.pos);
    return this.pos += 8, value;
  }
  readI64AsBigInt() {
    const value = this.view.getBigInt64(this.pos);
    return this.pos += 8, value;
  }
  readF32() {
    const value = this.view.getFloat32(this.pos);
    return this.pos += 4, value;
  }
  readF64() {
    const value = this.view.getFloat64(this.pos);
    return this.pos += 8, value;
  }
};
__name(_Decoder, "Decoder");
let Decoder = _Decoder;
const _PilotSheetLocalSettings = class _PilotSheetLocalSettings {
  static emptyContent() {
    return {
      sidebarRatio: 1
    };
  }
};
__name(_PilotSheetLocalSettings, "PilotSheetLocalSettings");
let PilotSheetLocalSettings = _PilotSheetLocalSettings;
var SystemButton = /* @__PURE__ */ ((SystemButton2) => (SystemButton2.Stabilize = "Stabilize", SystemButton2.Overcharge = "Overcharge", SystemButton2.BasicAttack = "BasicAttack", SystemButton2.Damage = "Damage", SystemButton2.TechAttack = "TechAttack", SystemButton2.SkillTriggerOther = "SkillTriggerOther", SystemButton2))(SystemButton || {});
const _PilotSheetSettings = class _PilotSheetSettings {
  static emptyContent() {
    return {
      headerImgOffsetY: 0,
      headerImgOffsetX: 0,
      headerImgWidth: 0,
      themeOverride: "",
      sidebarExes: [
        SystemButton.SkillTriggerOther,
        SystemButton.BasicAttack,
        SystemButton.Damage
      ],
      bondImageSrc: "modules/lancer-alternative-sheets/assets/nobond.webp",
      syncActorTokenImages: !0
    };
  }
};
__name(_PilotSheetSettings, "PilotSheetSettings");
let PilotSheetSettings = _PilotSheetSettings;
const _SocketManager = class _SocketManager {
  constructor() {
    __publicField(this, "socketName", `module.${LancerAlternative.Name}`);
    __publicField(this, "socket");
    __publicField(this, "registeredFunctions", /* @__PURE__ */ new Map());
    __publicField(this, "awaitingResponse", /* @__PURE__ */ new Map());
    if (!game.socket)
      throw new Error("Lancer Alternative Sheets: SocketManager initialized before Foundry socket is available.");
    this.socket = game.socket, this.socket.on(
      this.socketName,
      (data, caller) => {
        var _a;
        if (data.type === "GM" && game.user.isGM) {
          Logger.log(`GM proxy for ${data.func} requested by ${(_a = game.users) == null ? void 0 : _a.get(caller).name}`, data);
          const func = this.registeredFunctions.get(data.func);
          if (!func) {
            Logger.error(`Function ${data.func} is not registered.`);
            return;
          }
          const response = func(...data.args);
          data.responseID && this.handleResponse(response, data);
        } else if (data.type === "response") {
          const callback = this.awaitingResponse.get(data.responseID);
          if (!callback)
            return;
          Logger.log(`Response for ${data.func} received`, data.args), callback(data.args), this.awaitingResponse.delete(data.func);
        }
      }
    );
  }
  static getInstance() {
    return _SocketManager.instance || (_SocketManager.instance = new _SocketManager()), _SocketManager.instance;
  }
  handleResponse(response, data) {
    response instanceof Promise ? (Logger.log(`GM proxy for ${data.func} is a promise, waiting for resolution...`), response.then((resolvedResponse) => {
      data.responseID && this.socket.emit(
        this.socketName,
        {
          type: "response",
          func: data.func,
          args: resolvedResponse,
          responseID: data.responseID
        }
      ), Logger.log(`GM proxy for ${data.func} resolved`, resolvedResponse);
    }).catch((error) => {
      Logger.error(`Error in GM proxy function ${data.func}:`, error);
    })) : this.socket.emit(
      this.socketName,
      {
        type: "response",
        func: data.func,
        args: response,
        responseID: data.responseID
      }
    );
  }
  register(func) {
    if (this.registeredFunctions.has(func.name)) {
      Logger.error(`Function ${func.name} is already registered.`);
      return;
    }
    const wrappedCallback = /* @__PURE__ */ __name((...args) => func(...args), "wrappedCallback");
    this.registeredFunctions.set(func.name, wrappedCallback), Logger.log(`Registered socket function ${func.name}`);
  }
  unregister(func) {
    if (!this.registeredFunctions.get(func.name)) {
      Logger.error(`Function ${func.name} is not registered.`);
      return;
    }
    this.registeredFunctions.delete(func.name);
  }
  runAsGM(func, callback, ...args) {
    if (game.user.isGM) {
      const response = func(...args);
      callback && (response instanceof Promise ? response.then((resolvedResponse) => {
        callback(resolvedResponse);
      }).catch((error) => {
        Logger.error(`Error in ${func.name}:`, error);
      }) : callback(response));
      return;
    }
    if (!game.users.activeGM) {
      Logger.error("An active GM must be online to run GM-proxied functions");
      return;
    }
    Logger.log(`Requested GM proxy for ${func.name}`, args);
    let responseID;
    callback && (responseID = foundry.utils.randomID(16), this.awaitingResponse.set(responseID, callback)), this.socket.emit(
      this.socketName,
      {
        type: "GM",
        func: func.name,
        args,
        responseID
      }
    );
  }
};
__name(_SocketManager, "SocketManager"), __publicField(_SocketManager, "instance");
let SocketManager = _SocketManager;
var _PilotSheetSettingsSubmenu_static, onResetLocalData_fn, onResetServerData_fn, onSubmit_fn;
const _PilotSheetSettingsSubmenu = class _PilotSheetSettingsSubmenu extends foundry.applications.api.HandlebarsApplicationMixin(
  foundry.applications.api.ApplicationV2
) {
  // Return type is `any` to work around the opaque generic RenderContext in the mixin
  async _prepareContext(_options) {
    return {
      tip: game.settings.get(LancerAlternative.Name, "pilot-settings-tip"),
      logHeader: game.settings.get(LancerAlternative.Name, "pilot-settings-log-header"),
      logActionSidebar: game.settings.get(LancerAlternative.Name, "pilot-settings-log-action-sidebar"),
      saveCollapse: game.settings.get(LancerAlternative.Name, "pilot-settings-log-action-save-collapse"),
      startCollapsed: game.settings.get(LancerAlternative.Name, "pilot-settings-log-action-start-collapsed"),
      enableSensors: game.settings.get(LancerAlternative.Name, "pilot-settings-enable-sensors"),
      enableTechAttack: game.settings.get(LancerAlternative.Name, "pilot-settings-enable-tech-attack"),
      isGM: game.user.isGM,
      buttons: [
        { type: "submit", icon: "fa-solid fa-floppy-disk", label: "SETTINGS.Save" }
      ]
    };
  }
};
_PilotSheetSettingsSubmenu_static = new WeakSet(), onResetLocalData_fn = /* @__PURE__ */ __name(function(_event, _target) {
  resetPilotSheetLocalData();
}, "#onResetLocalData"), onResetServerData_fn = /* @__PURE__ */ __name(function(_event, _target) {
  resetPilotSheetData();
}, "#onResetServerData"), onSubmit_fn = /* @__PURE__ */ __name(async function(_event, _form, formData) {
  const data = formData.object, promises = [
    game.settings.set(LancerAlternative.Name, "pilot-settings-tip", data.tip === !0),
    game.settings.set(LancerAlternative.Name, "pilot-settings-log-header", data.logHeader === !0),
    game.settings.set(LancerAlternative.Name, "pilot-settings-log-action-sidebar", data.logActionSidebar === !0),
    game.settings.set(LancerAlternative.Name, "pilot-settings-log-action-save-collapse", data.saveCollapse === !0),
    game.settings.set(LancerAlternative.Name, "pilot-settings-log-action-start-collapsed", data.startCollapsed === !0)
  ];
  game.user.isGM && promises.push(
    game.settings.set(LancerAlternative.Name, "pilot-settings-enable-sensors", data.enableSensors === !0),
    game.settings.set(LancerAlternative.Name, "pilot-settings-enable-tech-attack", data.enableTechAttack === !0)
  ), await Promise.all(promises);
}, "#onSubmit"), __privateAdd(_PilotSheetSettingsSubmenu, _PilotSheetSettingsSubmenu_static), __name(_PilotSheetSettingsSubmenu, "PilotSheetSettingsSubmenu"), __publicField(_PilotSheetSettingsSubmenu, "DEFAULT_OPTIONS", {
  id: "la-pilot-settings-submenu",
  tag: "form",
  window: {
    title: "LA.SETTINGS.pilot.label",
    icon: "fas fa-gear",
    contentClasses: ["standard-form"]
  },
  position: {
    width: 600
  },
  form: {
    handler: __privateMethod(_PilotSheetSettingsSubmenu, _PilotSheetSettingsSubmenu_static, onSubmit_fn),
    closeOnSubmit: !0,
    submitOnChange: !1
  },
  actions: {
    resetLocalData: __privateMethod(_PilotSheetSettingsSubmenu, _PilotSheetSettingsSubmenu_static, onResetLocalData_fn),
    resetServerData: __privateMethod(_PilotSheetSettingsSubmenu, _PilotSheetSettingsSubmenu_static, onResetServerData_fn)
  }
}), __publicField(_PilotSheetSettingsSubmenu, "PARTS", {
  body: {
    template: TEMPLATE_PATHS.pilotSettingsSubmenu
  },
  footer: {
    template: "templates/generic/form-footer.hbs"
  }
});
let PilotSheetSettingsSubmenu = _PilotSheetSettingsSubmenu;
function registerPilotSheetSettings() {
  game.settings.register(LancerAlternative.Name, "pilot-settings-tip", {
    name: "LA.SETTINGS.pilot.enableTooltip.label",
    hint: "LA.SETTINGS.pilot.enableTooltip.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !0
  }), game.settings.register(LancerAlternative.Name, "pilot-settings-log-header", {
    name: "LA.SETTINGS.pilot.enableHeaderLog.label",
    hint: "LA.SETTINGS.pilot.enableHeaderLog.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !0
  }), game.settings.register(LancerAlternative.Name, "pilot-settings-log-action-sidebar", {
    name: "LA.SETTINGS.pilot.enableSidebarActionLog.label",
    hint: "LA.SETTINGS.pilot.enableSidebarActionLog.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !0
  }), game.settings.register(LancerAlternative.Name, "pilot-settings-log-action-save-collapse", {
    name: "LA.SETTINGS.pilot.saveCollapse.label",
    hint: "LA.SETTINGS.pilot.saveCollapse.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !1
  }), game.settings.register(LancerAlternative.Name, "pilot-settings-log-action-start-collapsed", {
    name: "LA.SETTINGS.pilot.startCollapsed.label",
    hint: "LA.SETTINGS.pilot.startCollapsed.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !0
  }), game.settings.register(LancerAlternative.Name, "pilot-settings-enable-sensors", {
    name: "LA.SETTINGS.pilot.enableSensors.label",
    hint: "LA.SETTINGS.pilot.enableSensors.subLabel",
    scope: "world",
    config: !1,
    type: Boolean,
    default: !1
  }), game.settings.register(LancerAlternative.Name, "pilot-settings-enable-tech-attack", {
    name: "LA.SETTINGS.pilot.enableTechAttack.label",
    hint: "LA.SETTINGS.pilot.enableTechAttack.subLabel",
    scope: "world",
    config: !1,
    type: Boolean,
    default: !1
  }), game.settings.register(LancerAlternative.Name, "_pilot-settings-local", {
    scope: "client",
    config: !1,
    type: String,
    default: ""
  }), game.settings.register(LancerAlternative.Name, "_pilot-settings-local-version", {
    scope: "client",
    config: !1,
    type: String,
    // JSON object
    default: ""
  }), game.settings.register(LancerAlternative.Name, "_pilot-settings", {
    scope: "world",
    config: !1,
    type: Array,
    // MessagePack encoded object
    default: []
  }), game.settings.register(LancerAlternative.Name, "_pilot-settings-version", {
    scope: "world",
    config: !1,
    type: String,
    default: ""
  }), SocketManager.getInstance().register(setPilotSheetData);
}
__name(registerPilotSheetSettings, "registerPilotSheetSettings");
function getPilotSheetTooltipEnabled() {
  return game.settings.get(LancerAlternative.Name, "pilot-settings-tip");
}
__name(getPilotSheetTooltipEnabled, "getPilotSheetTooltipEnabled");
function getPilotSheetLogActionDontSaveCollapse() {
  return !game.settings.get(LancerAlternative.Name, "pilot-settings-log-action-save-collapse");
}
__name(getPilotSheetLogActionDontSaveCollapse, "getPilotSheetLogActionDontSaveCollapse");
function getPilotSheetLogActionStartCollapsed() {
  return game.settings.get(LancerAlternative.Name, "pilot-settings-log-action-start-collapsed");
}
__name(getPilotSheetLogActionStartCollapsed, "getPilotSheetLogActionStartCollapsed");
function getPilotSheetSensorsEnabled() {
  return game.settings.get(LancerAlternative.Name, "pilot-settings-enable-sensors");
}
__name(getPilotSheetSensorsEnabled, "getPilotSheetSensorsEnabled");
function getPilotSheetTechAttackEnabled() {
  return game.settings.get(LancerAlternative.Name, "pilot-settings-enable-tech-attack");
}
__name(getPilotSheetTechAttackEnabled, "getPilotSheetTechAttackEnabled");
function resetPilotSheetLocalData(uuid) {
  if (uuid) {
    const data = getPilotSheetLocalData();
    data[uuid] && delete data[uuid], setPilotSheetLocalData(data);
  } else {
    const data = new PilotSheetLocalSettings();
    setPilotSheetLocalData(data);
  }
}
__name(resetPilotSheetLocalData, "resetPilotSheetLocalData");
function getPilotSheetLocalData() {
  try {
    const settings = game.settings.get(LancerAlternative.Name, "_pilot-settings-local");
    return JSON.parse(settings);
  } catch {
    return new PilotSheetLocalSettings();
  }
}
__name(getPilotSheetLocalData, "getPilotSheetLocalData");
function setPilotSheetLocalData(data) {
  const encoded = JSON.stringify(data);
  return Promise.all([
    game.settings.set(LancerAlternative.Name, "_pilot-settings-local", encoded),
    game.settings.set(LancerAlternative.Name, "_pilot-settings-local-version", getModuleVersion())
  ]);
}
__name(setPilotSheetLocalData, "setPilotSheetLocalData");
function getSidebarRatio$1(uuid) {
  var _a;
  return ((_a = getPilotSheetLocalData()[uuid]) == null ? void 0 : _a.sidebarRatio) ?? 1;
}
__name(getSidebarRatio$1, "getSidebarRatio$1");
function setSidebarRatio$1(uuid, value) {
  const data = getPilotSheetLocalData();
  data[uuid] || (data[uuid] = PilotSheetLocalSettings.emptyContent()), data[uuid].sidebarRatio = value, setPilotSheetLocalData(data);
}
__name(setSidebarRatio$1, "setSidebarRatio$1");
function resetPilotSheetData(uuid) {
  var _a, _b;
  if (uuid) {
    const data = getPilotSheetData();
    data[uuid] && delete data[uuid], setPilotSheetData(encodePilotSheetData(data));
  } else
    game.settings.set(LancerAlternative.Name, "_pilot-settings", (_a = game.settings.settings.get(`${LancerAlternative.Name}._pilot-settings`)) == null ? void 0 : _a.default), game.settings.set(LancerAlternative.Name, "_pilot-settings-version", (_b = game.settings.settings.get(`${LancerAlternative.Name}._pilot-settings-version`)) == null ? void 0 : _b.default);
}
__name(resetPilotSheetData, "resetPilotSheetData");
function getPilotSheetData() {
  const settings = game.settings.get(LancerAlternative.Name, "_pilot-settings");
  if (!game.settings.get(LancerAlternative.Name, "_pilot-settings-version") || !settings.length)
    return new PilotSheetSettings();
  try {
    let encoded = new Uint8Array(Object.values(settings));
    return encoded.length === 1 && (Logger.log("PilotSheetSettings: Decoding failed, trying legacy decode."), encoded = new Uint8Array(Object.values(settings[0]))), msgPackDecoder.decode(encoded);
  } catch {
    return Logger.error("PilotSheetSettings: Decoding failed, returning empty settings."), new PilotSheetSettings();
  }
}
__name(getPilotSheetData, "getPilotSheetData");
function migratedDefaults$3(uuid, data) {
  const defaultSettings = PilotSheetSettings.emptyContent();
  return defaultSettings.syncActorTokenImages = determineActorTokenSync$3(uuid, data), defaultSettings;
}
__name(migratedDefaults$3, "migratedDefaults$3");
function encodePilotSheetData(data) {
  const encoded = msgPackEncoder.encode(data);
  return Array.from(encoded);
}
__name(encodePilotSheetData, "encodePilotSheetData");
function setPilotSheetData(encoded) {
  return Promise.all([
    game.settings.set(LancerAlternative.Name, "_pilot-settings", encoded),
    game.settings.set(LancerAlternative.Name, "_pilot-settings-version", getModuleVersion())
  ]);
}
__name(setPilotSheetData, "setPilotSheetData");
function setImageOffsetXY$1(uuid, x, y) {
  const data = getPilotSheetData();
  data[uuid] || (data[uuid] = migratedDefaults$3(uuid, data)), data[uuid].headerImgOffsetX = x, data[uuid].headerImgOffsetY = y, SocketManager.getInstance().runAsGM(
    setPilotSheetData,
    () => {
      Logger.log(`Image offset (X, Y) set to (${x}, ${y}) for ${uuid}`);
    },
    encodePilotSheetData(data)
  );
}
__name(setImageOffsetXY$1, "setImageOffsetXY$1");
function getImageOffsetY$1(uuid) {
  var _a;
  return ((_a = getPilotSheetData()[uuid]) == null ? void 0 : _a.headerImgOffsetY) ?? 0;
}
__name(getImageOffsetY$1, "getImageOffsetY$1");
function getImageOffsetX$1(uuid) {
  var _a;
  return ((_a = getPilotSheetData()[uuid]) == null ? void 0 : _a.headerImgOffsetX) ?? 0;
}
__name(getImageOffsetX$1, "getImageOffsetX$1");
function getImageWidth$1(uuid) {
  var _a;
  return ((_a = getPilotSheetData()[uuid]) == null ? void 0 : _a.headerImgWidth) ?? 0;
}
__name(getImageWidth$1, "getImageWidth$1");
function setImageWidth$1(uuid, value) {
  const data = getPilotSheetData();
  data[uuid] || (data[uuid] = migratedDefaults$3(uuid, data)), data[uuid].headerImgWidth = value, SocketManager.getInstance().runAsGM(
    setPilotSheetData,
    () => {
      Logger.log(`Image width set to ${value} for ${uuid}`);
    },
    encodePilotSheetData(data)
  );
}
__name(setImageWidth$1, "setImageWidth$1");
function setImageBatched$1(uuid, x, y, width) {
  const data = getPilotSheetData();
  data[uuid] || (data[uuid] = migratedDefaults$3(uuid, data)), data[uuid].headerImgOffsetX = x, data[uuid].headerImgOffsetY = y, data[uuid].headerImgWidth = width, SocketManager.getInstance().runAsGM(
    setPilotSheetData,
    () => {
      Logger.log(`Image offset (X, Y) set to (${x}, ${y}) and width set to ${width} for ${uuid}`);
    },
    encodePilotSheetData(data)
  );
}
__name(setImageBatched$1, "setImageBatched$1");
function getThemeOverride$3(uuid) {
  var _a;
  return ((_a = getPilotSheetData()[uuid]) == null ? void 0 : _a.themeOverride) ?? "";
}
__name(getThemeOverride$3, "getThemeOverride$3");
function setThemeOverride$3(uuid, value) {
  const data = getPilotSheetData();
  data[uuid] || (data[uuid] = migratedDefaults$3(uuid, data)), data[uuid].themeOverride = value, SocketManager.getInstance().runAsGM(
    setPilotSheetData,
    () => {
      Logger.log(`Theme override set to ${value} for ${uuid}`);
    },
    encodePilotSheetData(data)
  ), Hooks.call("laOverrideTheme", uuid, value);
}
__name(setThemeOverride$3, "setThemeOverride$3");
function getSidebarExecutables$2(uuid) {
  var _a;
  const data = getPilotSheetData();
  return ((_a = data[uuid]) == null ? void 0 : _a.sidebarExes) ?? migratedDefaults$3(uuid, data).sidebarExes;
}
__name(getSidebarExecutables$2, "getSidebarExecutables$2");
function setSidebarExecutables$2(uuid, macros) {
  const data = getPilotSheetData();
  data[uuid] || (data[uuid] = migratedDefaults$3(uuid, data)), data[uuid].sidebarExes = macros, SocketManager.getInstance().runAsGM(
    setPilotSheetData,
    () => {
      Logger.log(`Sidebar executables set to ${macros.join(", ")} for ${uuid}`);
    },
    encodePilotSheetData(data)
  );
}
__name(setSidebarExecutables$2, "setSidebarExecutables$2");
function getBondImageSrc(uuid) {
  var _a;
  const data = getPilotSheetData();
  return ((_a = data[uuid]) == null ? void 0 : _a.bondImageSrc) ?? migratedDefaults$3(uuid, data).bondImageSrc;
}
__name(getBondImageSrc, "getBondImageSrc");
function setBondImageSrc(uuid, src) {
  const data = getPilotSheetData();
  data[uuid] || (data[uuid] = migratedDefaults$3(uuid, data)), data[uuid].bondImageSrc = src, SocketManager.getInstance().runAsGM(
    setPilotSheetData,
    () => {
      Logger.log(`Bond image src set to ${src} for ${uuid}`);
    },
    encodePilotSheetData(data)
  );
}
__name(setBondImageSrc, "setBondImageSrc");
function getActorTokenSync$3(uuid) {
  const data = getPilotSheetData();
  return determineActorTokenSync$3(uuid, data);
}
__name(getActorTokenSync$3, "getActorTokenSync$3");
function determineActorTokenSync$3(uuid, data) {
  var _a, _b, _c, _d;
  if (((_a = data[uuid]) == null ? void 0 : _a.syncActorTokenImages) === void 0 || ((_b = data[uuid]) == null ? void 0 : _b.syncActorTokenImages) === null) {
    Logger.log("Determining default syncActorTokenImages setting for a new or unsaved pilot/old module version");
    const actor = fromUuidSync(uuid);
    return (_d = (_c = actor.prototypeToken) == null ? void 0 : _c.texture) != null && _d.src && actor.img ? actor.img === actor.prototypeToken.texture.src : !0;
  } else
    return data[uuid].syncActorTokenImages;
}
__name(determineActorTokenSync$3, "determineActorTokenSync$3");
function setActorTokenSync$3(uuid, value) {
  const data = getPilotSheetData();
  data[uuid] || (data[uuid] = migratedDefaults$3(uuid, data)), data[uuid].syncActorTokenImages = value, SocketManager.getInstance().runAsGM(
    setPilotSheetData,
    () => {
      Logger.log(`Sync actor-token images set to ${value} for ${uuid}`);
    },
    encodePilotSheetData(data)
  );
}
__name(setActorTokenSync$3, "setActorTokenSync$3");
const _MechSheetLocalSettings = class _MechSheetLocalSettings {
  static emptyContent() {
    return {
      sidebarRatio: 1
    };
  }
};
__name(_MechSheetLocalSettings, "MechSheetLocalSettings");
let MechSheetLocalSettings = _MechSheetLocalSettings;
const _MechSheetSettings = class _MechSheetSettings {
  static emptyContent() {
    return {
      headerImgOffsetY: 0,
      headerImgOffsetX: 0,
      headerImgWidth: 0,
      themeOverride: "",
      sidebarExes: [
        SystemButton.Stabilize,
        SystemButton.Overcharge,
        SystemButton.BasicAttack,
        SystemButton.Damage,
        SystemButton.TechAttack
      ],
      syncActorTokenImages: !0
    };
  }
};
__name(_MechSheetSettings, "MechSheetSettings");
let MechSheetSettings = _MechSheetSettings;
var _MechSheetSettingsSubmenu_static, onResetLocalData_fn2, onResetServerData_fn2, onSubmit_fn2;
const _MechSheetSettingsSubmenu = class _MechSheetSettingsSubmenu extends foundry.applications.api.HandlebarsApplicationMixin(
  foundry.applications.api.ApplicationV2
) {
  // Return type is `any` to work around the opaque generic RenderContext in the mixin
  async _prepareContext(_options) {
    return {
      tip: game.settings.get(LancerAlternative.Name, "mech-settings-tip"),
      logHeader: game.settings.get(LancerAlternative.Name, "mech-settings-log-header"),
      logActionSidebar: game.settings.get(LancerAlternative.Name, "mech-settings-log-action-sidebar"),
      logActionMain: game.settings.get(LancerAlternative.Name, "mech-settings-log-action-main"),
      logActionMainMaxHeight: game.settings.get(LancerAlternative.Name, "mech-settings-log-action-main-max-height"),
      saveCollapse: game.settings.get(LancerAlternative.Name, "mech-settings-log-action-save-collapse"),
      startCollapsed: game.settings.get(LancerAlternative.Name, "mech-settings-log-action-start-collapsed"),
      isGM: game.user.isGM,
      buttons: [
        { type: "submit", icon: "fa-solid fa-floppy-disk", label: "SETTINGS.Save" }
      ]
    };
  }
};
_MechSheetSettingsSubmenu_static = new WeakSet(), onResetLocalData_fn2 = /* @__PURE__ */ __name(function(_event, _target) {
  resetMechSheetLocalData();
}, "#onResetLocalData"), onResetServerData_fn2 = /* @__PURE__ */ __name(function(_event, _target) {
  game.user.isGM && resetMechSheetData();
}, "#onResetServerData"), onSubmit_fn2 = /* @__PURE__ */ __name(async function(_event, _form, formData) {
  const data = formData.object;
  await Promise.all([
    game.settings.set(LancerAlternative.Name, "mech-settings-tip", data.tip === !0),
    game.settings.set(LancerAlternative.Name, "mech-settings-log-header", data.logHeader === !0),
    game.settings.set(LancerAlternative.Name, "mech-settings-log-action-sidebar", data.logActionSidebar === !0),
    game.settings.set(LancerAlternative.Name, "mech-settings-log-action-main", data.logActionMain === !0),
    game.settings.set(LancerAlternative.Name, "mech-settings-log-action-main-max-height", Number(data.logActionMainMaxHeight)),
    game.settings.set(LancerAlternative.Name, "mech-settings-log-action-save-collapse", data.saveCollapse === !0),
    game.settings.set(LancerAlternative.Name, "mech-settings-log-action-start-collapsed", data.startCollapsed === !0)
  ]);
}, "#onSubmit"), __privateAdd(_MechSheetSettingsSubmenu, _MechSheetSettingsSubmenu_static), __name(_MechSheetSettingsSubmenu, "MechSheetSettingsSubmenu"), __publicField(_MechSheetSettingsSubmenu, "DEFAULT_OPTIONS", {
  id: "la-mech-settings-submenu",
  tag: "form",
  window: {
    title: "LA.SETTINGS.mech.label",
    icon: "fas fa-gear",
    contentClasses: ["standard-form"]
  },
  position: {
    width: 600
  },
  form: {
    handler: __privateMethod(_MechSheetSettingsSubmenu, _MechSheetSettingsSubmenu_static, onSubmit_fn2),
    closeOnSubmit: !0,
    submitOnChange: !1
  },
  actions: {
    resetLocalData: __privateMethod(_MechSheetSettingsSubmenu, _MechSheetSettingsSubmenu_static, onResetLocalData_fn2),
    resetServerData: __privateMethod(_MechSheetSettingsSubmenu, _MechSheetSettingsSubmenu_static, onResetServerData_fn2)
  }
}), __publicField(_MechSheetSettingsSubmenu, "PARTS", {
  body: {
    template: TEMPLATE_PATHS.mechSettingsSubmenu
  },
  footer: {
    template: "templates/generic/form-footer.hbs"
  }
});
let MechSheetSettingsSubmenu = _MechSheetSettingsSubmenu;
function registerMechSheetSettings() {
  game.settings.register(LancerAlternative.Name, "mech-settings-tip", {
    name: "LA.SETTINGS.mech.enableTooltip.label",
    hint: "LA.SETTINGS.mech.enableTooltip.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !0
  }), game.settings.register(LancerAlternative.Name, "mech-settings-log-header", {
    name: "LA.SETTINGS.mech.enableHeaderLog.label",
    hint: "LA.SETTINGS.mech.enableHeaderLog.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !0
  }), game.settings.register(LancerAlternative.Name, "mech-settings-log-action-sidebar", {
    name: "LA.SETTINGS.mech.enableSidebarActionLog.label",
    hint: "LA.SETTINGS.mech.enableSidebarActionLog.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !0
  }), game.settings.register(LancerAlternative.Name, "mech-settings-log-action-main", {
    name: "LA.SETTINGS.mech.enableMainActionLog.label",
    hint: "LA.SETTINGS.mech.enableMainActionLog.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !1
  }), game.settings.register(LancerAlternative.Name, "mech-settings-log-action-main-max-height", {
    name: "LA.SETTINGS.mech.sizeMainActionLog.label",
    hint: "LA.SETTINGS.mech.sizeMainActionLog.subLabel",
    scope: "client",
    config: !1,
    type: Number,
    range: {
      min: 10,
      max: 30,
      step: 1
    },
    default: 12
  }), game.settings.register(LancerAlternative.Name, "mech-settings-log-action-save-collapse", {
    name: "LA.SETTINGS.mech.saveCollapse.label",
    hint: "LA.SETTINGS.mech.saveCollapse.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !1
  }), game.settings.register(LancerAlternative.Name, "mech-settings-log-action-start-collapsed", {
    name: "LA.SETTINGS.mech.startCollapsed.label",
    hint: "LA.SETTINGS.mech.startCollapsed.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !0
  }), game.settings.register(LancerAlternative.Name, "_mech-settings-local", {
    scope: "client",
    config: !1,
    type: String,
    default: ""
  }), game.settings.register(LancerAlternative.Name, "_mech-settings-local-version", {
    scope: "client",
    config: !1,
    type: String,
    // JSON object
    default: ""
  }), game.settings.register(LancerAlternative.Name, "_mech-settings", {
    scope: "world",
    config: !1,
    type: Array,
    // MessagePack encoded object
    default: []
  }), game.settings.register(LancerAlternative.Name, "_mech-settings-version", {
    scope: "world",
    config: !1,
    type: String,
    default: ""
  }), SocketManager.getInstance().register(setMechSheetData);
}
__name(registerMechSheetSettings, "registerMechSheetSettings");
function getMechSheetTooltipEnabled() {
  return game.settings.get(LancerAlternative.Name, "mech-settings-tip");
}
__name(getMechSheetTooltipEnabled, "getMechSheetTooltipEnabled");
function getMechSheetLogHeaderEnabled() {
  return game.settings.get(LancerAlternative.Name, "mech-settings-log-header");
}
__name(getMechSheetLogHeaderEnabled, "getMechSheetLogHeaderEnabled");
function getMechSheetLogActionMainEnabled() {
  return game.settings.get(LancerAlternative.Name, "mech-settings-log-action-main");
}
__name(getMechSheetLogActionMainEnabled, "getMechSheetLogActionMainEnabled");
function getMechSheetLogActionMainMaxHeight() {
  return game.settings.get(LancerAlternative.Name, "mech-settings-log-action-main-max-height");
}
__name(getMechSheetLogActionMainMaxHeight, "getMechSheetLogActionMainMaxHeight");
function getMechSheetLogActionDontSaveCollapse() {
  return !game.settings.get(LancerAlternative.Name, "mech-settings-log-action-save-collapse");
}
__name(getMechSheetLogActionDontSaveCollapse, "getMechSheetLogActionDontSaveCollapse");
function getMechSheetLogActionStartCollapsed() {
  return game.settings.get(LancerAlternative.Name, "mech-settings-log-action-start-collapsed");
}
__name(getMechSheetLogActionStartCollapsed, "getMechSheetLogActionStartCollapsed");
function resetMechSheetLocalData(uuid) {
  if (uuid) {
    const data = getMechSheetLocalData();
    data[uuid] && delete data[uuid], setMechSheetLocalData(data);
  } else {
    const data = new MechSheetLocalSettings();
    setMechSheetLocalData(data);
  }
}
__name(resetMechSheetLocalData, "resetMechSheetLocalData");
function getMechSheetLocalData() {
  try {
    const settings = game.settings.get(LancerAlternative.Name, "_mech-settings-local");
    return JSON.parse(settings);
  } catch {
    return new MechSheetLocalSettings();
  }
}
__name(getMechSheetLocalData, "getMechSheetLocalData");
function setMechSheetLocalData(data) {
  const encoded = JSON.stringify(data);
  return Promise.all([
    game.settings.set(LancerAlternative.Name, "_mech-settings-local", encoded),
    game.settings.set(LancerAlternative.Name, "_mech-settings-local-version", getModuleVersion())
  ]);
}
__name(setMechSheetLocalData, "setMechSheetLocalData");
function getSidebarRatio(uuid) {
  var _a;
  return ((_a = getMechSheetLocalData()[uuid]) == null ? void 0 : _a.sidebarRatio) ?? 1;
}
__name(getSidebarRatio, "getSidebarRatio");
function setSidebarRatio(uuid, value) {
  const data = getMechSheetLocalData();
  data[uuid] || (data[uuid] = MechSheetLocalSettings.emptyContent()), data[uuid].sidebarRatio = value, setMechSheetLocalData(data);
}
__name(setSidebarRatio, "setSidebarRatio");
function resetMechSheetData(uuid) {
  var _a, _b;
  if (uuid) {
    const data = getMechSheetData();
    data[uuid] && delete data[uuid], setMechSheetData(encodeMechSheetData(data));
  } else
    game.settings.set(LancerAlternative.Name, "_mech-settings", (_a = game.settings.settings.get(`${LancerAlternative.Name}._mech-settings`)) == null ? void 0 : _a.default), game.settings.set(LancerAlternative.Name, "_mech-settings-version", (_b = game.settings.settings.get(`${LancerAlternative.Name}._mech-settings-version`)) == null ? void 0 : _b.default);
}
__name(resetMechSheetData, "resetMechSheetData");
function getMechSheetData() {
  const settings = game.settings.get(LancerAlternative.Name, "_mech-settings");
  if (!settings.length)
    return new MechSheetSettings();
  try {
    let encoded = new Uint8Array(Object.values(settings));
    return encoded.length === 1 && (Logger.log("MechSheetSettings: Decoding failed, trying legacy decode."), encoded = new Uint8Array(Object.values(settings[0]))), msgPackDecoder.decode(encoded);
  } catch {
    return Logger.error("MechSheetSettings: Decoding failed, returning empty settings."), new MechSheetSettings();
  }
}
__name(getMechSheetData, "getMechSheetData");
function migratedDefaults$2(uuid, data) {
  const defaultSettings = MechSheetSettings.emptyContent();
  return defaultSettings.syncActorTokenImages = determineActorTokenSync$2(uuid, data), defaultSettings;
}
__name(migratedDefaults$2, "migratedDefaults$2");
function encodeMechSheetData(data) {
  const encoded = msgPackEncoder.encode(data);
  return Array.from(encoded);
}
__name(encodeMechSheetData, "encodeMechSheetData");
function setMechSheetData(encoded) {
  return Promise.all([
    game.settings.set(LancerAlternative.Name, "_mech-settings", encoded),
    game.settings.set(LancerAlternative.Name, "_mech-settings-version", getModuleVersion())
  ]);
}
__name(setMechSheetData, "setMechSheetData");
function setImageOffsetXY(uuid, x, y) {
  const data = getMechSheetData();
  data[uuid] || (data[uuid] = migratedDefaults$2(uuid, data)), data[uuid].headerImgOffsetX = x, data[uuid].headerImgOffsetY = y, SocketManager.getInstance().runAsGM(
    setMechSheetData,
    () => {
      Logger.log(`Image offset (X, Y) set to (${x}, ${y}) for ${uuid}`);
    },
    encodeMechSheetData(data)
  );
}
__name(setImageOffsetXY, "setImageOffsetXY");
function getImageOffsetY(uuid) {
  var _a;
  return ((_a = getMechSheetData()[uuid]) == null ? void 0 : _a.headerImgOffsetY) ?? 0;
}
__name(getImageOffsetY, "getImageOffsetY");
function getImageOffsetX(uuid) {
  var _a;
  return ((_a = getMechSheetData()[uuid]) == null ? void 0 : _a.headerImgOffsetX) ?? 0;
}
__name(getImageOffsetX, "getImageOffsetX");
function getImageWidth(uuid) {
  var _a;
  return ((_a = getMechSheetData()[uuid]) == null ? void 0 : _a.headerImgWidth) ?? 0;
}
__name(getImageWidth, "getImageWidth");
function setImageWidth(uuid, value) {
  const data = getMechSheetData();
  data[uuid] || (data[uuid] = migratedDefaults$2(uuid, data)), data[uuid].headerImgWidth = value, SocketManager.getInstance().runAsGM(
    setMechSheetData,
    () => {
      Logger.log(`Image width set to ${value} for ${uuid}`);
    },
    encodeMechSheetData(data)
  );
}
__name(setImageWidth, "setImageWidth");
function setImageBatched(uuid, x, y, width) {
  const data = getMechSheetData();
  data[uuid] || (data[uuid] = migratedDefaults$2(uuid, data)), data[uuid].headerImgOffsetX = x, data[uuid].headerImgOffsetY = y, data[uuid].headerImgWidth = width, SocketManager.getInstance().runAsGM(
    setMechSheetData,
    () => {
      Logger.log(`Image offset (X, Y) set to (${x}, ${y}) and width set to ${width} for ${uuid}`);
    },
    encodeMechSheetData(data)
  );
}
__name(setImageBatched, "setImageBatched");
function getThemeOverride$2(uuid) {
  var _a;
  return ((_a = getMechSheetData()[uuid]) == null ? void 0 : _a.themeOverride) ?? "";
}
__name(getThemeOverride$2, "getThemeOverride$2");
function setThemeOverride$2(uuid, value) {
  const data = getMechSheetData();
  data[uuid] || (data[uuid] = migratedDefaults$2(uuid, data)), data[uuid].themeOverride = value, SocketManager.getInstance().runAsGM(
    setMechSheetData,
    () => {
      Logger.log(`Theme override set to ${value} for ${uuid}`);
    },
    encodeMechSheetData(data)
  ), Hooks.call("laOverrideTheme", uuid, value);
}
__name(setThemeOverride$2, "setThemeOverride$2");
function getSidebarExecutables$1(uuid) {
  var _a;
  const data = getMechSheetData();
  return ((_a = data[uuid]) == null ? void 0 : _a.sidebarExes) ?? migratedDefaults$2(uuid, data).sidebarExes;
}
__name(getSidebarExecutables$1, "getSidebarExecutables$1");
function setSidebarExecutables$1(uuid, macros) {
  const data = getMechSheetData();
  data[uuid] || (data[uuid] = migratedDefaults$2(uuid, data)), data[uuid].sidebarExes = macros, SocketManager.getInstance().runAsGM(
    setMechSheetData,
    () => {
      Logger.log(`Sidebar executables set to ${macros.join(", ")} for ${uuid}`);
    },
    encodeMechSheetData(data)
  );
}
__name(setSidebarExecutables$1, "setSidebarExecutables$1");
function getActorTokenSync$2(uuid) {
  const data = getMechSheetData();
  return determineActorTokenSync$2(uuid, data);
}
__name(getActorTokenSync$2, "getActorTokenSync$2");
function determineActorTokenSync$2(uuid, data) {
  var _a, _b, _c, _d;
  if (((_a = data[uuid]) == null ? void 0 : _a.syncActorTokenImages) === void 0 || ((_b = data[uuid]) == null ? void 0 : _b.syncActorTokenImages) === null) {
    Logger.log("Determining default syncActorTokenImages setting for a new or unsaved mech/old module version");
    const actor = fromUuidSync(uuid);
    return (_d = (_c = actor.prototypeToken) == null ? void 0 : _c.texture) != null && _d.src && actor.img ? actor.img === actor.prototypeToken.texture.src : !0;
  } else
    return data[uuid].syncActorTokenImages;
}
__name(determineActorTokenSync$2, "determineActorTokenSync$2");
function setActorTokenSync$2(uuid, value) {
  const data = getMechSheetData();
  data[uuid] || (data[uuid] = migratedDefaults$2(uuid, data)), data[uuid].syncActorTokenImages = value, SocketManager.getInstance().runAsGM(
    setMechSheetData,
    () => {
      Logger.log(`Sync actor-token images set to ${value} for ${uuid}`);
    },
    encodeMechSheetData(data)
  );
}
__name(setActorTokenSync$2, "setActorTokenSync$2");
const _NPCSheetSettings = class _NPCSheetSettings {
  static emptyContent() {
    return {
      themeOverride: "",
      sidebarExes: [],
      syncActorTokenImages: !0,
      pinnedTraits: [],
      pinnedSystems: [],
      pinnedTechs: [],
      pinnedReactions: []
    };
  }
};
__name(_NPCSheetSettings, "NPCSheetSettings");
let NPCSheetSettings = _NPCSheetSettings;
var _NPCSheetSettingsSubmenu_static, onResetServerData_fn3, onSubmit_fn3;
const _NPCSheetSettingsSubmenu = class _NPCSheetSettingsSubmenu extends foundry.applications.api.HandlebarsApplicationMixin(
  foundry.applications.api.ApplicationV2
) {
  // Return type is `any` to work around the opaque generic RenderContext in the mixin
  async _prepareContext(_options) {
    return {
      tip: game.settings.get(LancerAlternative.Name, "npc-settings-tip"),
      sheetWidth: game.settings.get(LancerAlternative.Name, "npc-settings-sheet-width"),
      sheetHeight: game.settings.get(LancerAlternative.Name, "npc-settings-sheet-height"),
      saveCollapse: game.settings.get(LancerAlternative.Name, "npc-settings-log-action-save-collapse"),
      startCollapsed: game.settings.get(LancerAlternative.Name, "npc-settings-log-action-start-collapsed"),
      isGM: game.user.isGM,
      buttons: [
        { type: "submit", icon: "fa-solid fa-floppy-disk", label: "SETTINGS.Save" }
      ]
    };
  }
};
_NPCSheetSettingsSubmenu_static = new WeakSet(), onResetServerData_fn3 = /* @__PURE__ */ __name(function(_event, _target) {
  game.user.isGM && resetNPCSheetData();
}, "#onResetServerData"), onSubmit_fn3 = /* @__PURE__ */ __name(async function(_event, _form, formData) {
  const data = formData.object;
  await Promise.all([
    game.settings.set(LancerAlternative.Name, "npc-settings-tip", data.tip === !0),
    game.settings.set(LancerAlternative.Name, "npc-settings-sheet-width", Number(data.sheetWidth)),
    game.settings.set(LancerAlternative.Name, "npc-settings-sheet-height", Number(data.sheetHeight)),
    game.settings.set(LancerAlternative.Name, "npc-settings-log-action-save-collapse", data.saveCollapse === !0),
    game.settings.set(LancerAlternative.Name, "npc-settings-log-action-start-collapsed", data.startCollapsed === !0)
  ]);
}, "#onSubmit"), __privateAdd(_NPCSheetSettingsSubmenu, _NPCSheetSettingsSubmenu_static), __name(_NPCSheetSettingsSubmenu, "NPCSheetSettingsSubmenu"), __publicField(_NPCSheetSettingsSubmenu, "DEFAULT_OPTIONS", {
  id: "la-npc-settings-submenu",
  tag: "form",
  window: {
    title: "LA.SETTINGS.npc.label",
    icon: "fas fa-gear",
    contentClasses: ["standard-form"]
  },
  position: {
    width: 600
  },
  form: {
    handler: __privateMethod(_NPCSheetSettingsSubmenu, _NPCSheetSettingsSubmenu_static, onSubmit_fn3),
    closeOnSubmit: !0,
    submitOnChange: !1
  },
  actions: {
    resetServerData: __privateMethod(_NPCSheetSettingsSubmenu, _NPCSheetSettingsSubmenu_static, onResetServerData_fn3)
  }
}), __publicField(_NPCSheetSettingsSubmenu, "PARTS", {
  body: {
    template: TEMPLATE_PATHS.npcSettingsSubmenu
  },
  footer: {
    template: "templates/generic/form-footer.hbs"
  }
});
let NPCSheetSettingsSubmenu = _NPCSheetSettingsSubmenu;
function registerNPCSheetSettings() {
  game.settings.register(LancerAlternative.Name, "npc-settings-tip", {
    name: "LA.SETTINGS.npc.enableTooltip.label",
    hint: "LA.SETTINGS.npc.enableTooltip.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !0
  }), game.settings.register(LancerAlternative.Name, "npc-settings-sheet-width", {
    name: "LA.SETTINGS.npc.sheetWidth.label",
    hint: "LA.SETTINGS.npc.sheetWidth.subLabel",
    scope: "client",
    config: !1,
    requiresReload: !0,
    // @ts-ignore
    type: Number,
    default: 500
  }), game.settings.register(LancerAlternative.Name, "npc-settings-sheet-height", {
    name: "LA.SETTINGS.npc.sheetHeight.label",
    hint: "LA.SETTINGS.npc.sheetHeight.subLabel",
    scope: "client",
    config: !1,
    requiresReload: !0,
    // @ts-ignore
    type: Number,
    default: 800
  }), game.settings.register(LancerAlternative.Name, "npc-settings-log-action-save-collapse", {
    name: "LA.SETTINGS.npc.saveCollapse.label",
    hint: "LA.SETTINGS.npc.saveCollapse.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !1
  }), game.settings.register(LancerAlternative.Name, "npc-settings-log-action-start-collapsed", {
    name: "LA.SETTINGS.npc.startCollapsed.label",
    hint: "LA.SETTINGS.npc.startCollapsed.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !0
  }), game.settings.register(LancerAlternative.Name, "_npc-settings", {
    scope: "world",
    config: !1,
    type: Array,
    // MessagePack encoded object
    default: []
  }), game.settings.register(LancerAlternative.Name, "_npc-settings-version", {
    scope: "world",
    config: !1,
    type: String,
    default: ""
  }), SocketManager.getInstance().register(setNPCSheetData);
}
__name(registerNPCSheetSettings, "registerNPCSheetSettings");
function getNPCSheetTooltipEnabled() {
  return game.settings.get(LancerAlternative.Name, "npc-settings-tip");
}
__name(getNPCSheetTooltipEnabled, "getNPCSheetTooltipEnabled");
function getNPCSheetWidth() {
  const width = game.settings.get(LancerAlternative.Name, "npc-settings-sheet-width");
  return Math.max(0, width);
}
__name(getNPCSheetWidth, "getNPCSheetWidth");
function getNPCSheetHeight() {
  const height = game.settings.get(LancerAlternative.Name, "npc-settings-sheet-height");
  return Math.max(0, height);
}
__name(getNPCSheetHeight, "getNPCSheetHeight");
function getNPCSheetLogActionDontSaveCollapse() {
  return !game.settings.get(LancerAlternative.Name, "npc-settings-log-action-save-collapse");
}
__name(getNPCSheetLogActionDontSaveCollapse, "getNPCSheetLogActionDontSaveCollapse");
function getNPCSheetLogActionStartCollapsed() {
  return game.settings.get(LancerAlternative.Name, "npc-settings-log-action-start-collapsed");
}
__name(getNPCSheetLogActionStartCollapsed, "getNPCSheetLogActionStartCollapsed");
function resetNPCSheetData(uuid) {
  var _a, _b;
  if (uuid) {
    const data = getNPCSheetData();
    data[uuid] && delete data[uuid], setNPCSheetData(encodeNPCSheetData(data));
  } else
    game.settings.set(LancerAlternative.Name, "_npc-settings", (_a = game.settings.settings.get(`${LancerAlternative.Name}._npc-settings`)) == null ? void 0 : _a.default), game.settings.set(LancerAlternative.Name, "_npc-settings-version", (_b = game.settings.settings.get(`${LancerAlternative.Name}._npc-settings-version`)) == null ? void 0 : _b.default);
}
__name(resetNPCSheetData, "resetNPCSheetData");
function getNPCSheetData() {
  const settings = game.settings.get(LancerAlternative.Name, "_npc-settings");
  if (!settings.length)
    return new NPCSheetSettings();
  try {
    let encoded = new Uint8Array(Object.values(settings));
    return encoded.length === 1 && (Logger.log("NPCSheetSettings: Decoding failed, trying legacy decode."), encoded = new Uint8Array(Object.values(settings[0]))), msgPackDecoder.decode(encoded);
  } catch {
    return Logger.error("NPCSheetSettings: Decoding failed, returning empty settings."), new NPCSheetSettings();
  }
}
__name(getNPCSheetData, "getNPCSheetData");
function getRoot$1(uuid) {
  return uuid.includes("Actor.") ? uuid.split(".").slice(-2).join(".") : null;
}
__name(getRoot$1, "getRoot$1");
function migratedDefaults$1(uuid, data) {
  const defaultSettings = NPCSheetSettings.emptyContent();
  return defaultSettings.syncActorTokenImages = determineActorTokenSync$1(uuid, data), defaultSettings;
}
__name(migratedDefaults$1, "migratedDefaults$1");
function encodeNPCSheetData(data) {
  const encoded = msgPackEncoder.encode(data);
  return Array.from(encoded);
}
__name(encodeNPCSheetData, "encodeNPCSheetData");
function setNPCSheetData(encoded) {
  return Promise.all([
    game.settings.set(LancerAlternative.Name, "_npc-settings", encoded),
    game.settings.set(LancerAlternative.Name, "_npc-settings-version", getModuleVersion())
  ]);
}
__name(setNPCSheetData, "setNPCSheetData");
function getThemeOverride$1(uuid) {
  var _a;
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  return ((_a = data[workingUUID]) == null ? void 0 : _a.themeOverride) ?? "";
}
__name(getThemeOverride$1, "getThemeOverride$1");
function setThemeOverride$1(uuid, value) {
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  data[workingUUID] || (data[workingUUID] = migratedDefaults$1(workingUUID, data)), data[workingUUID].themeOverride = value, SocketManager.getInstance().runAsGM(
    setNPCSheetData,
    () => {
      Logger.log(`Theme override set to ${value} for ${uuid}`);
    },
    encodeNPCSheetData(data)
  ), Hooks.call("laOverrideTheme", uuid, value);
}
__name(setThemeOverride$1, "setThemeOverride$1");
function getSidebarExecutables(uuid) {
  var _a;
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  return ((_a = data[workingUUID]) == null ? void 0 : _a.sidebarExes) ?? [];
}
__name(getSidebarExecutables, "getSidebarExecutables");
function setSidebarExecutables(uuid, macros) {
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  data[workingUUID] || (data[workingUUID] = migratedDefaults$1(workingUUID, data)), data[workingUUID].sidebarExes = macros, SocketManager.getInstance().runAsGM(
    setNPCSheetData,
    () => {
      Logger.log(`Sidebar executables set to ${macros.join(", ")} for ${uuid}`);
    },
    encodeNPCSheetData(data)
  );
}
__name(setSidebarExecutables, "setSidebarExecutables");
function getActorTokenSync$1(uuid) {
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  return determineActorTokenSync$1(workingUUID, data);
}
__name(getActorTokenSync$1, "getActorTokenSync$1");
function determineActorTokenSync$1(uuid, data) {
  var _a, _b, _c, _d;
  if (((_a = data[uuid]) == null ? void 0 : _a.syncActorTokenImages) === void 0 || ((_b = data[uuid]) == null ? void 0 : _b.syncActorTokenImages) === null) {
    Logger.log("Determining default syncActorTokenImages setting for a new or unsaved NPC/old module version");
    const actor = fromUuidSync(uuid);
    return (_d = (_c = actor.prototypeToken) == null ? void 0 : _c.texture) != null && _d.src && actor.img ? actor.img === actor.prototypeToken.texture.src : !0;
  } else
    return data[uuid].syncActorTokenImages;
}
__name(determineActorTokenSync$1, "determineActorTokenSync$1");
function setActorTokenSync$1(uuid, value) {
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  data[workingUUID] || (data[workingUUID] = migratedDefaults$1(workingUUID, data)), data[workingUUID].syncActorTokenImages = value, SocketManager.getInstance().runAsGM(
    setNPCSheetData,
    () => {
      Logger.log(`Sync actor-token images set to ${value} for ${uuid}`);
    },
    encodeNPCSheetData(data)
  );
}
__name(setActorTokenSync$1, "setActorTokenSync$1");
function getPinnedTraits(uuid) {
  var _a;
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  return ((_a = data[workingUUID]) == null ? void 0 : _a.pinnedTraits) ?? [];
}
__name(getPinnedTraits, "getPinnedTraits");
function setPinnedTraits(uuid, lids) {
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  data[workingUUID] || (data[workingUUID] = migratedDefaults$1(workingUUID, data)), data[workingUUID].pinnedTraits = lids, SocketManager.getInstance().runAsGM(
    setNPCSheetData,
    () => {
      Logger.log(`Pinned traits set to ${lids.join(", ")} for ${uuid}`);
    },
    encodeNPCSheetData(data)
  );
}
__name(setPinnedTraits, "setPinnedTraits");
function getPinnedSystems(uuid) {
  var _a;
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  return ((_a = data[workingUUID]) == null ? void 0 : _a.pinnedSystems) ?? [];
}
__name(getPinnedSystems, "getPinnedSystems");
function setPinnedSystems(uuid, lids) {
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  data[workingUUID] || (data[workingUUID] = migratedDefaults$1(workingUUID, data)), data[workingUUID].pinnedSystems = lids, SocketManager.getInstance().runAsGM(
    setNPCSheetData,
    () => {
      Logger.log(`Pinned systems set to ${lids.join(", ")} for ${uuid}`);
    },
    encodeNPCSheetData(data)
  );
}
__name(setPinnedSystems, "setPinnedSystems");
function getPinnedTechs(uuid) {
  var _a;
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  return ((_a = data[workingUUID]) == null ? void 0 : _a.pinnedTechs) ?? [];
}
__name(getPinnedTechs, "getPinnedTechs");
function setPinnedTechs(uuid, lids) {
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  data[workingUUID] || (data[workingUUID] = migratedDefaults$1(workingUUID, data)), data[workingUUID].pinnedTechs = lids, SocketManager.getInstance().runAsGM(
    setNPCSheetData,
    () => {
      Logger.log(`Pinned tech attacks set to ${lids.join(", ")} for ${uuid}`);
    },
    encodeNPCSheetData(data)
  );
}
__name(setPinnedTechs, "setPinnedTechs");
function getPinnedReactions(uuid) {
  var _a;
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  return ((_a = data[workingUUID]) == null ? void 0 : _a.pinnedReactions) ?? [];
}
__name(getPinnedReactions, "getPinnedReactions");
function setPinnedReactions(uuid, lids) {
  const data = getNPCSheetData(), workingUUID = getRoot$1(uuid) ?? uuid;
  data[workingUUID] || (data[workingUUID] = migratedDefaults$1(workingUUID, data)), data[workingUUID].pinnedReactions = lids, SocketManager.getInstance().runAsGM(
    setNPCSheetData,
    () => {
      Logger.log(`Pinned reactions set to ${lids.join(", ")} for ${uuid}`);
    },
    encodeNPCSheetData(data)
  );
}
__name(setPinnedReactions, "setPinnedReactions");
const _DeployableSheetSettings = class _DeployableSheetSettings {
  static emptyContent() {
    return {
      themeOverride: "",
      sidebarExes: [],
      syncActorTokenImages: !0
    };
  }
};
__name(_DeployableSheetSettings, "DeployableSheetSettings");
let DeployableSheetSettings = _DeployableSheetSettings;
var _DeployableSheetSettingsSubmenu_static, onResetServerData_fn4, onSubmit_fn4;
const _DeployableSheetSettingsSubmenu = class _DeployableSheetSettingsSubmenu extends foundry.applications.api.HandlebarsApplicationMixin(
  foundry.applications.api.ApplicationV2
) {
  // Return type is `any` to work around the opaque generic RenderContext in the mixin
  async _prepareContext(_options) {
    return {
      tip: game.settings.get(LancerAlternative.Name, "deployable-settings-tip"),
      sheetWidth: game.settings.get(LancerAlternative.Name, "deployable-settings-sheet-width"),
      sheetHeight: game.settings.get(LancerAlternative.Name, "deployable-settings-sheet-height"),
      saveCollapse: game.settings.get(LancerAlternative.Name, "deployable-settings-log-action-save-collapse"),
      startCollapsed: game.settings.get(LancerAlternative.Name, "deployable-settings-log-action-start-collapsed"),
      isGM: game.user.isGM,
      buttons: [
        { type: "submit", icon: "fa-solid fa-floppy-disk", label: "SETTINGS.Save" }
      ]
    };
  }
};
_DeployableSheetSettingsSubmenu_static = new WeakSet(), onResetServerData_fn4 = /* @__PURE__ */ __name(function(_event, _target) {
  game.user.isGM && resetDeployableSheetData();
}, "#onResetServerData"), onSubmit_fn4 = /* @__PURE__ */ __name(async function(_event, _form, formData) {
  const data = formData.object;
  await Promise.all([
    game.settings.set(LancerAlternative.Name, "deployable-settings-tip", data.tip === !0),
    game.settings.set(LancerAlternative.Name, "deployable-settings-sheet-width", Number(data.sheetWidth)),
    game.settings.set(LancerAlternative.Name, "deployable-settings-sheet-height", Number(data.sheetHeight)),
    game.settings.set(LancerAlternative.Name, "deployable-settings-log-action-save-collapse", data.saveCollapse === !0),
    game.settings.set(LancerAlternative.Name, "deployable-settings-log-action-start-collapsed", data.startCollapsed === !0)
  ]);
}, "#onSubmit"), __privateAdd(_DeployableSheetSettingsSubmenu, _DeployableSheetSettingsSubmenu_static), __name(_DeployableSheetSettingsSubmenu, "DeployableSheetSettingsSubmenu"), __publicField(_DeployableSheetSettingsSubmenu, "DEFAULT_OPTIONS", {
  id: "la-deployable-settings-submenu",
  tag: "form",
  window: {
    title: "LA.SETTINGS.deployable.label",
    icon: "fas fa-gear",
    contentClasses: ["standard-form"]
  },
  position: {
    width: 600
  },
  form: {
    handler: __privateMethod(_DeployableSheetSettingsSubmenu, _DeployableSheetSettingsSubmenu_static, onSubmit_fn4),
    closeOnSubmit: !0,
    submitOnChange: !1
  },
  actions: {
    resetServerData: __privateMethod(_DeployableSheetSettingsSubmenu, _DeployableSheetSettingsSubmenu_static, onResetServerData_fn4)
  }
}), __publicField(_DeployableSheetSettingsSubmenu, "PARTS", {
  body: {
    template: TEMPLATE_PATHS.deployableSettingsSubmenu
  },
  footer: {
    template: "templates/generic/form-footer.hbs"
  }
});
let DeployableSheetSettingsSubmenu = _DeployableSheetSettingsSubmenu;
function registerDeployableSheetSettings() {
  game.settings.register(LancerAlternative.Name, "deployable-settings-tip", {
    name: "LA.SETTINGS.deployable.enableTooltip.label",
    hint: "LA.SETTINGS.deployable.enableTooltip.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !0
  }), game.settings.register(LancerAlternative.Name, "deployable-settings-sheet-width", {
    name: "LA.SETTINGS.deployable.sheetWidth.label",
    hint: "LA.SETTINGS.deployable.sheetWidth.subLabel",
    scope: "client",
    config: !1,
    requiresReload: !0,
    // @ts-ignore
    type: Number,
    default: 500
  }), game.settings.register(LancerAlternative.Name, "deployable-settings-sheet-height", {
    name: "LA.SETTINGS.deployable.sheetHeight.label",
    hint: "LA.SETTINGS.deployable.sheetHeight.subLabel",
    scope: "client",
    config: !1,
    requiresReload: !0,
    // @ts-ignore
    type: Number,
    default: 800
  }), game.settings.register(LancerAlternative.Name, "deployable-settings-log-action-save-collapse", {
    name: "LA.SETTINGS.deployable.saveCollapse.label",
    hint: "LA.SETTINGS.deployable.saveCollapse.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !1
  }), game.settings.register(LancerAlternative.Name, "deployable-settings-log-action-start-collapsed", {
    name: "LA.SETTINGS.deployable.startCollapsed.label",
    hint: "LA.SETTINGS.deployable.startCollapsed.subLabel",
    scope: "client",
    config: !1,
    type: Boolean,
    default: !0
  }), game.settings.register(LancerAlternative.Name, "_deployable-settings", {
    scope: "world",
    config: !1,
    type: Array,
    // MessagePack encoded object
    default: []
  }), game.settings.register(LancerAlternative.Name, "_deployable-settings-version", {
    scope: "world",
    config: !1,
    type: String,
    default: ""
  }), SocketManager.getInstance().register(setDeployableSheetData);
}
__name(registerDeployableSheetSettings, "registerDeployableSheetSettings");
function getDeployableSheetTooltipEnabled() {
  return game.settings.get(LancerAlternative.Name, "deployable-settings-tip");
}
__name(getDeployableSheetTooltipEnabled, "getDeployableSheetTooltipEnabled");
function getDeployableSheetWidth() {
  const width = game.settings.get(LancerAlternative.Name, "deployable-settings-sheet-width");
  return Math.max(0, width);
}
__name(getDeployableSheetWidth, "getDeployableSheetWidth");
function getDeployableSheetHeight() {
  const height = game.settings.get(LancerAlternative.Name, "deployable-settings-sheet-height");
  return Math.max(0, height);
}
__name(getDeployableSheetHeight, "getDeployableSheetHeight");
function getDeployableSheetLogActionDontSaveCollapse() {
  return !game.settings.get(LancerAlternative.Name, "deployable-settings-log-action-save-collapse");
}
__name(getDeployableSheetLogActionDontSaveCollapse, "getDeployableSheetLogActionDontSaveCollapse");
function getDeployableSheetLogActionStartCollapsed() {
  return game.settings.get(LancerAlternative.Name, "deployable-settings-log-action-start-collapsed");
}
__name(getDeployableSheetLogActionStartCollapsed, "getDeployableSheetLogActionStartCollapsed");
function resetDeployableSheetData(uuid) {
  var _a, _b;
  if (uuid) {
    const data = getDeployableSheetData();
    data[uuid] && delete data[uuid], setDeployableSheetData(encodeDeployableSheetData(data));
  } else
    game.settings.set(LancerAlternative.Name, "_deployable-settings", (_a = game.settings.settings.get(`${LancerAlternative.Name}._deployable-settings`)) == null ? void 0 : _a.default), game.settings.set(LancerAlternative.Name, "_deployable-settings-version", (_b = game.settings.settings.get(`${LancerAlternative.Name}._deployable-settings-version`)) == null ? void 0 : _b.default);
}
__name(resetDeployableSheetData, "resetDeployableSheetData");
function getDeployableSheetData() {
  const settings = game.settings.get(LancerAlternative.Name, "_deployable-settings");
  if (!settings.length)
    return new DeployableSheetSettings();
  try {
    let encoded = new Uint8Array(Object.values(settings));
    return encoded.length === 1 && (Logger.log("DeployableSheetSettings: Decoding failed, trying legacy decode."), encoded = new Uint8Array(Object.values(settings[0]))), msgPackDecoder.decode(encoded);
  } catch {
    return Logger.error("DeployableSheetSettings: Decoding failed, returning empty settings."), new DeployableSheetSettings();
  }
}
__name(getDeployableSheetData, "getDeployableSheetData");
function getRoot(uuid) {
  return uuid.includes("Actor.") ? uuid.split(".").slice(-2).join(".") : null;
}
__name(getRoot, "getRoot");
function migratedDefaults(uuid, data) {
  const defaultSettings = DeployableSheetSettings.emptyContent();
  return defaultSettings.syncActorTokenImages = determineActorTokenSync(uuid, data), defaultSettings;
}
__name(migratedDefaults, "migratedDefaults");
function encodeDeployableSheetData(data) {
  const encoded = msgPackEncoder.encode(data);
  return Array.from(encoded);
}
__name(encodeDeployableSheetData, "encodeDeployableSheetData");
function setDeployableSheetData(encoded) {
  return Promise.all([
    game.settings.set(LancerAlternative.Name, "_deployable-settings", encoded),
    game.settings.set(LancerAlternative.Name, "_deployable-settings-version", getModuleVersion())
  ]);
}
__name(setDeployableSheetData, "setDeployableSheetData");
function getThemeOverride(uuid) {
  var _a;
  const data = getDeployableSheetData(), workingUUID = getRoot(uuid) ?? uuid;
  return ((_a = data[workingUUID]) == null ? void 0 : _a.themeOverride) ?? "";
}
__name(getThemeOverride, "getThemeOverride");
function setThemeOverride(uuid, value) {
  const data = getDeployableSheetData(), workingUUID = getRoot(uuid) ?? uuid;
  data[workingUUID] || (data[workingUUID] = migratedDefaults(workingUUID, data)), data[workingUUID].themeOverride = value, SocketManager.getInstance().runAsGM(
    setDeployableSheetData,
    () => {
      Logger.log(`Theme override set to ${value} for ${uuid}`);
    },
    encodeDeployableSheetData(data)
  ), Hooks.call("laOverrideTheme", uuid, value);
}
__name(setThemeOverride, "setThemeOverride");
function getActorTokenSync(uuid) {
  const data = getDeployableSheetData(), workingUUID = getRoot(uuid) ?? uuid;
  return determineActorTokenSync(workingUUID, data);
}
__name(getActorTokenSync, "getActorTokenSync");
function determineActorTokenSync(uuid, data) {
  var _a, _b, _c, _d;
  if (((_a = data[uuid]) == null ? void 0 : _a.syncActorTokenImages) === void 0 || ((_b = data[uuid]) == null ? void 0 : _b.syncActorTokenImages) === null) {
    Logger.log("Determining default syncActorTokenImages setting for a new or unsaved deployable/old module version");
    const actor = fromUuidSync(uuid);
    return (_d = (_c = actor.prototypeToken) == null ? void 0 : _c.texture) != null && _d.src && actor.img ? actor.img === actor.prototypeToken.texture.src : !0;
  } else
    return data[uuid].syncActorTokenImages;
}
__name(determineActorTokenSync, "determineActorTokenSync");
function setActorTokenSync(uuid, value) {
  const data = getDeployableSheetData(), workingUUID = getRoot(uuid) ?? uuid;
  data[workingUUID] || (data[workingUUID] = migratedDefaults(workingUUID, data)), data[workingUUID].syncActorTokenImages = value, SocketManager.getInstance().runAsGM(
    setDeployableSheetData,
    () => {
      Logger.log(`Sync actor-token images set to ${value} for ${uuid}`);
    },
    encodeDeployableSheetData(data)
  );
}
__name(setActorTokenSync, "setActorTokenSync");
const msgPackEncoder = new Encoder(), msgPackDecoder = new Decoder();
function registerModuleSettings() {
  game.settings.registerMenu(LancerAlternative.Name, "settings-submenu-pilot", {
    name: "LA.SETTINGS.pilot.label",
    label: "",
    hint: "",
    icon: "mdi mdi-account",
    type: PilotSheetSettingsSubmenu,
    restricted: !1
  }), game.settings.registerMenu(LancerAlternative.Name, "settings-submenu-mech", {
    name: "LA.SETTINGS.mech.label",
    label: "",
    hint: "",
    icon: "mdi mdi-robot",
    type: MechSheetSettingsSubmenu,
    restricted: !1
  }), game.settings.registerMenu(LancerAlternative.Name, "settings-submenu-npc", {
    name: "LA.SETTINGS.npc.label",
    label: "",
    hint: "",
    icon: "mdi mdi-skull",
    type: NPCSheetSettingsSubmenu,
    restricted: !1
  }), game.settings.registerMenu(LancerAlternative.Name, "settings-submenu-deployable", {
    name: "LA.SETTINGS.deployable.label",
    label: "",
    hint: "",
    icon: "mdi mdi-quadcopter",
    type: DeployableSheetSettingsSubmenu,
    restricted: !1
  }), game.settings.register(LancerAlternative.Name, "settings-verbose-logging", {
    name: "LA.SETTINGS.debug.label",
    hint: "LA.SETTINGS.debug.subLabel",
    scope: "client",
    config: !0,
    type: Boolean,
    default: !1
  }), game.settings.register(LancerAlternative.Name, "settings-enable-effects", {
    name: "LA.SETTINGS.enableEffects.label",
    hint: "LA.SETTINGS.enableEffects.subLabel",
    scope: "client",
    config: !0,
    type: Boolean,
    default: !0
  });
}
__name(registerModuleSettings, "registerModuleSettings");
function getVerboseLoggingEnabled() {
  return game.settings.get(LancerAlternative.Name, "settings-verbose-logging");
}
__name(getVerboseLoggingEnabled, "getVerboseLoggingEnabled");
function getExtraEffectsEnabled() {
  var _a;
  return (_a = game.settings) == null ? void 0 : _a.get(LancerAlternative.Name, "settings-enable-effects");
}
__name(getExtraEffectsEnabled, "getExtraEffectsEnabled");
const _Logger = class _Logger {
  static getVersion() {
    return this.version ?? (this.version = getModuleVersion());
  }
  static log(message, ...args) {
    var _a;
    getVerboseLoggingEnabled() && ((_a = ui.notifications) == null || _a.info(message)), console.log(
      `%c[${this.moduleName} ${this.getVersion()}] ${message}`,
      "color: #00FF00; font-weight: bold;",
      ...args
    );
  }
  static error(message, ...args) {
    var _a;
    getVerboseLoggingEnabled() && ((_a = ui.notifications) == null || _a.error(message)), console.error(
      `%c[${this.moduleName} ${this.getVersion()}] ${message}`,
      "color: #FF0000; font-weight: bold;",
      ...args,
      new Error("Trace")
    );
  }
  static warn(message, ...args) {
    var _a;
    getVerboseLoggingEnabled() && ((_a = ui.notifications) == null || _a.warn(message)), console.warn(
      `%c[${this.moduleName} ${this.getVersion()}] ${message}`,
      "color: #FFA500; font-weight: bold;",
      ...args,
      new Error("Trace")
    );
  }
};
__name(_Logger, "Logger"), __publicField(_Logger, "moduleName", "LAS"), __publicField(_Logger, "version");
let Logger = _Logger;
function formatDotpath(path) {
  return path.replace(/\[/g, ".").replace(/]/g, "");
}
__name(formatDotpath, "formatDotpath");
function stepwiseResolveDotpath(obj, dotpath) {
  let pathlets = formatDotpath(dotpath).split("."), result = [
    {
      pathlet: null,
      val: obj
    }
  ];
  for (let pathlet of pathlets)
    obj = obj == null ? void 0 : obj[pathlet], result.push({
      pathlet,
      val: obj
    });
  return result;
}
__name(stepwiseResolveDotpath, "stepwiseResolveDotpath");
function resolveDotpath(obj, dotpath, default_ = null, opts) {
  let path = stepwiseResolveDotpath(obj, dotpath), item;
  return item = path[path.length - 1], item.val === void 0 ? default_ : item.val;
}
__name(resolveDotpath, "resolveDotpath");
const RESOLVE_FAIL = Symbol("Fail");
function resolveHelperDotpath(options, path, default_ = null, try_parent = !1) {
  var _a;
  if (try_parent) {
    let data = options.data;
    for (; data; ) {
      let resolved = resolveDotpath(data == null ? void 0 : data.root, path, RESOLVE_FAIL);
      if (resolved != RESOLVE_FAIL)
        return resolved;
      data = data._parent;
    }
    return default_;
  } else
    return resolveDotpath((_a = options.data) == null ? void 0 : _a.root, path, default_);
}
__name(resolveHelperDotpath, "resolveHelperDotpath");
function array_path_edit_changes(target, flat_path, value, mode) {
  flat_path = formatDotpath(flat_path);
  let split = flat_path.split("."), tail = split.splice(split.length - 1)[0], lead = split.join("."), index2 = parseInt(tail), array = resolveDotpath(target, lead);
  if (Array.isArray(array) && !Number.isNaN(index2))
    return index2 > array.length && (index2 = array.length), index2 < 0 && (index2 = array.length + index2 + 1, index2 < 0 && (index2 = 0)), {
      path: lead,
      new_val: [...array.slice(0, index2), ...array.slice(index2 + 1)]
      // Drop element at index
    };
  throw new Error(`Unable to insert array item "${lead}[${tail}]": not an array (or not a valid index)`);
}
__name(array_path_edit_changes, "array_path_edit_changes");
function drilldownDocument(rootDoc, path) {
  let steps = stepwiseResolveDotpath(rootDoc, path);
  for (let i = steps.length - 1; i >= 0; i--) {
    let step = steps[i];
    if (step.val instanceof foundry.abstract.Document) {
      let sub_path = steps.slice(i + 1).map((v) => v.pathlet).join(".");
      return { sub_doc: step.val, sub_path, terminus: steps[steps.length - 1].val };
    }
  }
  throw new Error("Drilldown document must have at least one document in its path");
}
__name(drilldownDocument, "drilldownDocument");
async function parse_control_val(raw_val) {
  let match = raw_val.match(/\((.*?)\)(.*)/);
  if (match) {
    let type = match[1], val = match[2];
    switch (type) {
      case "string":
        return { success: !0, val };
      case "int":
        let parsed_int = parseInt(val);
        if (!Number.isNaN(parsed_int))
          return { success: !0, val: parsed_int };
        break;
      case "float":
        let parsed_float = parseFloat(val);
        if (!Number.isNaN(parsed_float))
          return { success: !0, val: parsed_float };
        break;
      case "bool":
        if (val == "true")
          return { success: !0, val: !0 };
        if (val == "false")
          return { success: !0, val: !1 };
      case "struct":
        return { success: !1, val: "I HAVE NO MOUTH, AND I MUST SCREAM" };
    }
  }
  return { success: !1, val: null };
}
__name(parse_control_val, "parse_control_val");
const DEV = !1;
var is_array = Array.isArray, index_of = Array.prototype.indexOf, array_from = Array.from, define_property = Object.defineProperty, get_descriptor = Object.getOwnPropertyDescriptor, get_descriptors = Object.getOwnPropertyDescriptors, object_prototype = Object.prototype, array_prototype = Array.prototype, get_prototype_of = Object.getPrototypeOf;
function is_function(thing) {
  return typeof thing == "function";
}
__name(is_function, "is_function");
const noop = /* @__PURE__ */ __name(() => {
}, "noop");
function run_all(arr) {
  for (var i = 0; i < arr.length; i++)
    arr[i]();
}
__name(run_all, "run_all");
const DERIVED = 2, EFFECT = 4, RENDER_EFFECT = 8, BLOCK_EFFECT = 16, BRANCH_EFFECT = 32, ROOT_EFFECT = 64, BOUNDARY_EFFECT = 128, UNOWNED = 256, DISCONNECTED = 512, CLEAN = 1024, DIRTY = 2048, MAYBE_DIRTY = 4096, INERT = 8192, DESTROYED = 16384, EFFECT_RAN = 32768, EFFECT_TRANSPARENT = 65536, HEAD_EFFECT = 1 << 19, EFFECT_HAS_DERIVED = 1 << 20, STATE_SYMBOL = Symbol("$state"), LEGACY_PROPS = Symbol("legacy props"), LOADING_ATTR_SYMBOL = Symbol("");
function equals(value) {
  return value === this.v;
}
__name(equals, "equals");
function safe_not_equal(a, b) {
  return a != a ? b == b : a !== b || a !== null && typeof a == "object" || typeof a == "function";
}
__name(safe_not_equal, "safe_not_equal");
function safe_equals(value) {
  return !safe_not_equal(value, this.v);
}
__name(safe_equals, "safe_equals");
function effect_in_teardown(rune) {
  throw new Error("https://svelte.dev/e/effect_in_teardown");
}
__name(effect_in_teardown, "effect_in_teardown");
function effect_in_unowned_derived() {
  throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
}
__name(effect_in_unowned_derived, "effect_in_unowned_derived");
function effect_orphan(rune) {
  throw new Error("https://svelte.dev/e/effect_orphan");
}
__name(effect_orphan, "effect_orphan");
function effect_update_depth_exceeded() {
  throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
}
__name(effect_update_depth_exceeded, "effect_update_depth_exceeded");
function state_descriptors_fixed() {
  throw new Error("https://svelte.dev/e/state_descriptors_fixed");
}
__name(state_descriptors_fixed, "state_descriptors_fixed");
function state_prototype_fixed() {
  throw new Error("https://svelte.dev/e/state_prototype_fixed");
}
__name(state_prototype_fixed, "state_prototype_fixed");
function state_unsafe_local_read() {
  throw new Error("https://svelte.dev/e/state_unsafe_local_read");
}
__name(state_unsafe_local_read, "state_unsafe_local_read");
function state_unsafe_mutation() {
  throw new Error("https://svelte.dev/e/state_unsafe_mutation");
}
__name(state_unsafe_mutation, "state_unsafe_mutation");
let legacy_mode_flag = !1, tracing_mode_flag = !1;
function enable_legacy_mode_flag() {
  legacy_mode_flag = !0;
}
__name(enable_legacy_mode_flag, "enable_legacy_mode_flag");
const EACH_ITEM_REACTIVE = 1, EACH_INDEX_REACTIVE = 2, EACH_IS_CONTROLLED = 4, EACH_IS_ANIMATED = 8, EACH_ITEM_IMMUTABLE = 16, TEMPLATE_FRAGMENT = 1, TEMPLATE_USE_IMPORT_NODE = 2, UNINITIALIZED = Symbol();
function lifecycle_outside_component(name) {
  throw new Error("https://svelte.dev/e/lifecycle_outside_component");
}
__name(lifecycle_outside_component, "lifecycle_outside_component");
let component_context = null;
function set_component_context(context) {
  component_context = context;
}
__name(set_component_context, "set_component_context");
function getContext(key) {
  return (
    /** @type {T} */
    get_or_init_context_map().get(key)
  );
}
__name(getContext, "getContext");
function setContext(key, context) {
  return get_or_init_context_map().set(key, context), context;
}
__name(setContext, "setContext");
function push(props, runes = !1, fn) {
  component_context = {
    p: component_context,
    c: null,
    e: null,
    m: !1,
    s: props,
    x: null,
    l: null
  }, legacy_mode_flag && !runes && (component_context.l = {
    s: null,
    u: null,
    r1: [],
    r2: source(!1)
  });
}
__name(push, "push");
function pop(component) {
  const context_stack_item = component_context;
  if (context_stack_item !== null) {
    component !== void 0 && (context_stack_item.x = component);
    const component_effects = context_stack_item.e;
    if (component_effects !== null) {
      var previous_effect = active_effect, previous_reaction = active_reaction;
      context_stack_item.e = null;
      try {
        for (var i = 0; i < component_effects.length; i++) {
          var component_effect = component_effects[i];
          set_active_effect(component_effect.effect), set_active_reaction(component_effect.reaction), effect(component_effect.fn);
        }
      } finally {
        set_active_effect(previous_effect), set_active_reaction(previous_reaction);
      }
    }
    component_context = context_stack_item.p, context_stack_item.m = !0;
  }
  return component || /** @type {T} */
  {};
}
__name(pop, "pop");
function is_runes() {
  return !legacy_mode_flag || component_context !== null && component_context.l === null;
}
__name(is_runes, "is_runes");
function get_or_init_context_map(name) {
  return component_context === null && lifecycle_outside_component(), component_context.c ?? (component_context.c = new Map(get_parent_context(component_context) || void 0));
}
__name(get_or_init_context_map, "get_or_init_context_map");
function get_parent_context(component_context2) {
  let parent = component_context2.p;
  for (; parent !== null; ) {
    const context_map = parent.c;
    if (context_map !== null)
      return context_map;
    parent = parent.p;
  }
  return null;
}
__name(get_parent_context, "get_parent_context");
function source(v, stack) {
  var signal = {
    f: 0,
    // TODO ideally we could skip this altogether, but it causes type errors
    v,
    reactions: null,
    equals,
    rv: 0,
    wv: 0
  };
  return signal;
}
__name(source, "source");
function state(v) {
  return /* @__PURE__ */ push_derived_source(source(v));
}
__name(state, "state");
// @__NO_SIDE_EFFECTS__
function mutable_source(initial_value, immutable = !1) {
  var _a;
  const s = source(initial_value);
  return immutable || (s.equals = safe_equals), legacy_mode_flag && component_context !== null && component_context.l !== null && ((_a = component_context.l).s ?? (_a.s = [])).push(s), s;
}
__name(mutable_source, "mutable_source");
// @__NO_SIDE_EFFECTS__
function push_derived_source(source2) {
  return active_reaction !== null && !untracking && active_reaction.f & DERIVED && (derived_sources === null ? set_derived_sources([source2]) : derived_sources.push(source2)), source2;
}
__name(push_derived_source, "push_derived_source");
function set(source2, value) {
  return active_reaction !== null && !untracking && is_runes() && active_reaction.f & (DERIVED | BLOCK_EFFECT) && // If the source was created locally within the current derived, then
  // we allow the mutation.
  (derived_sources === null || !derived_sources.includes(source2)) && state_unsafe_mutation(), internal_set(source2, value);
}
__name(set, "set");
function internal_set(source2, value) {
  return source2.equals(value) || (source2.v, source2.v = value, source2.wv = increment_write_version(), mark_reactions(source2, DIRTY), is_runes() && active_effect !== null && active_effect.f & CLEAN && !(active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) && (untracked_writes === null ? set_untracked_writes([source2]) : untracked_writes.push(source2))), value;
}
__name(internal_set, "internal_set");
function mark_reactions(signal, status) {
  var reactions = signal.reactions;
  if (reactions !== null)
    for (var runes = is_runes(), length = reactions.length, i = 0; i < length; i++) {
      var reaction = reactions[i], flags = reaction.f;
      flags & DIRTY || !runes && reaction === active_effect || (set_signal_status(reaction, status), flags & (CLEAN | UNOWNED) && (flags & DERIVED ? mark_reactions(
        /** @type {Derived} */
        reaction,
        MAYBE_DIRTY
      ) : schedule_effect(
        /** @type {Effect} */
        reaction
      )));
    }
}
__name(mark_reactions, "mark_reactions");
let hydrating = !1;
function proxy(value, parent = null, prev) {
  if (typeof value != "object" || value === null || STATE_SYMBOL in value)
    return value;
  const prototype = get_prototype_of(value);
  if (prototype !== object_prototype && prototype !== array_prototype)
    return value;
  var sources = /* @__PURE__ */ new Map(), is_proxied_array = is_array(value), version = source(0);
  is_proxied_array && sources.set("length", source(
    /** @type {any[]} */
    value.length
  ));
  var metadata;
  return new Proxy(
    /** @type {any} */
    value,
    {
      defineProperty(_, prop2, descriptor) {
        (!("value" in descriptor) || descriptor.configurable === !1 || descriptor.enumerable === !1 || descriptor.writable === !1) && state_descriptors_fixed();
        var s = sources.get(prop2);
        return s === void 0 ? (s = source(descriptor.value), sources.set(prop2, s)) : set(s, proxy(descriptor.value, metadata)), !0;
      },
      deleteProperty(target, prop2) {
        var s = sources.get(prop2);
        if (s === void 0)
          prop2 in target && sources.set(prop2, source(UNINITIALIZED));
        else {
          if (is_proxied_array && typeof prop2 == "string") {
            var ls = (
              /** @type {Source<number>} */
              sources.get("length")
            ), n = Number(prop2);
            Number.isInteger(n) && n < ls.v && set(ls, n);
          }
          set(s, UNINITIALIZED), update_version(version);
        }
        return !0;
      },
      get(target, prop2, receiver) {
        var _a;
        if (prop2 === STATE_SYMBOL)
          return value;
        var s = sources.get(prop2), exists = prop2 in target;
        if (s === void 0 && (!exists || (_a = get_descriptor(target, prop2)) != null && _a.writable) && (s = source(proxy(exists ? target[prop2] : UNINITIALIZED, metadata)), sources.set(prop2, s)), s !== void 0) {
          var v = get$1(s);
          return v === UNINITIALIZED ? void 0 : v;
        }
        return Reflect.get(target, prop2, receiver);
      },
      getOwnPropertyDescriptor(target, prop2) {
        var descriptor = Reflect.getOwnPropertyDescriptor(target, prop2);
        if (descriptor && "value" in descriptor) {
          var s = sources.get(prop2);
          s && (descriptor.value = get$1(s));
        } else if (descriptor === void 0) {
          var source2 = sources.get(prop2), value2 = source2 == null ? void 0 : source2.v;
          if (source2 !== void 0 && value2 !== UNINITIALIZED)
            return {
              enumerable: !0,
              configurable: !0,
              value: value2,
              writable: !0
            };
        }
        return descriptor;
      },
      has(target, prop2) {
        var _a;
        if (prop2 === STATE_SYMBOL)
          return !0;
        var s = sources.get(prop2), has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop2);
        if (s !== void 0 || active_effect !== null && (!has || (_a = get_descriptor(target, prop2)) != null && _a.writable)) {
          s === void 0 && (s = source(has ? proxy(target[prop2], metadata) : UNINITIALIZED), sources.set(prop2, s));
          var value2 = get$1(s);
          if (value2 === UNINITIALIZED)
            return !1;
        }
        return has;
      },
      set(target, prop2, value2, receiver) {
        var _a;
        var s = sources.get(prop2), has = prop2 in target;
        if (is_proxied_array && prop2 === "length")
          for (var i = value2; i < /** @type {Source<number>} */
          s.v; i += 1) {
            var other_s = sources.get(i + "");
            other_s !== void 0 ? set(other_s, UNINITIALIZED) : i in target && (other_s = source(UNINITIALIZED), sources.set(i + "", other_s));
          }
        s === void 0 ? (!has || (_a = get_descriptor(target, prop2)) != null && _a.writable) && (s = source(void 0), set(s, proxy(value2, metadata)), sources.set(prop2, s)) : (has = s.v !== UNINITIALIZED, set(s, proxy(value2, metadata)));
        var descriptor = Reflect.getOwnPropertyDescriptor(target, prop2);
        if (descriptor != null && descriptor.set && descriptor.set.call(receiver, value2), !has) {
          if (is_proxied_array && typeof prop2 == "string") {
            var ls = (
              /** @type {Source<number>} */
              sources.get("length")
            ), n = Number(prop2);
            Number.isInteger(n) && n >= ls.v && set(ls, n + 1);
          }
          update_version(version);
        }
        return !0;
      },
      ownKeys(target) {
        get$1(version);
        var own_keys = Reflect.ownKeys(target).filter((key2) => {
          var source3 = sources.get(key2);
          return source3 === void 0 || source3.v !== UNINITIALIZED;
        });
        for (var [key, source2] of sources)
          source2.v !== UNINITIALIZED && !(key in target) && own_keys.push(key);
        return own_keys;
      },
      setPrototypeOf() {
        state_prototype_fixed();
      }
    }
  );
}
__name(proxy, "proxy");
function update_version(signal, d = 1) {
  set(signal, signal.v + d);
}
__name(update_version, "update_version");
var $window, is_firefox, first_child_getter, next_sibling_getter;
function init_operations() {
  if ($window === void 0) {
    $window = window, is_firefox = /Firefox/.test(navigator.userAgent);
    var element_prototype = Element.prototype, node_prototype = Node.prototype;
    first_child_getter = get_descriptor(node_prototype, "firstChild").get, next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get, element_prototype.__click = void 0, element_prototype.__className = "", element_prototype.__attributes = null, element_prototype.__styles = null, element_prototype.__e = void 0, Text.prototype.__t = void 0;
  }
}
__name(init_operations, "init_operations");
function create_text(value = "") {
  return document.createTextNode(value);
}
__name(create_text, "create_text");
// @__NO_SIDE_EFFECTS__
function get_first_child(node) {
  return first_child_getter.call(node);
}
__name(get_first_child, "get_first_child");
// @__NO_SIDE_EFFECTS__
function get_next_sibling(node) {
  return next_sibling_getter.call(node);
}
__name(get_next_sibling, "get_next_sibling");
function child(node, is_text) {
  return /* @__PURE__ */ get_first_child(node);
}
__name(child, "child");
function first_child(fragment, is_text) {
  {
    var first = (
      /** @type {DocumentFragment} */
      /* @__PURE__ */ get_first_child(
        /** @type {Node} */
        fragment
      )
    );
    return first instanceof Comment && first.data === "" ? /* @__PURE__ */ get_next_sibling(first) : first;
  }
}
__name(first_child, "first_child");
function sibling(node, count = 1, is_text = !1) {
  let next_sibling = node;
  for (; count--; )
    next_sibling = /** @type {TemplateNode} */
    /* @__PURE__ */ get_next_sibling(next_sibling);
  return next_sibling;
}
__name(sibling, "sibling");
function clear_text_content(node) {
  node.textContent = "";
}
__name(clear_text_content, "clear_text_content");
// @__NO_SIDE_EFFECTS__
function derived(fn) {
  var flags = DERIVED | DIRTY, parent_derived = active_reaction !== null && active_reaction.f & DERIVED ? (
    /** @type {Derived} */
    active_reaction
  ) : null;
  return active_effect === null || parent_derived !== null && parent_derived.f & UNOWNED ? flags |= UNOWNED : active_effect.f |= EFFECT_HAS_DERIVED, {
    ctx: component_context,
    deps: null,
    effects: null,
    equals,
    f: flags,
    fn,
    reactions: null,
    rv: 0,
    v: (
      /** @type {V} */
      null
    ),
    wv: 0,
    parent: parent_derived ?? active_effect
  };
}
__name(derived, "derived");
// @__NO_SIDE_EFFECTS__
function derived_safe_equal(fn) {
  const signal = /* @__PURE__ */ derived(fn);
  return signal.equals = safe_equals, signal;
}
__name(derived_safe_equal, "derived_safe_equal");
function destroy_derived_effects(derived2) {
  var effects = derived2.effects;
  if (effects !== null) {
    derived2.effects = null;
    for (var i = 0; i < effects.length; i += 1)
      destroy_effect(
        /** @type {Effect} */
        effects[i]
      );
  }
}
__name(destroy_derived_effects, "destroy_derived_effects");
function get_derived_parent_effect(derived2) {
  for (var parent = derived2.parent; parent !== null; ) {
    if (!(parent.f & DERIVED))
      return (
        /** @type {Effect} */
        parent
      );
    parent = parent.parent;
  }
  return null;
}
__name(get_derived_parent_effect, "get_derived_parent_effect");
function execute_derived(derived2) {
  var value, prev_active_effect = active_effect;
  set_active_effect(get_derived_parent_effect(derived2));
  try {
    destroy_derived_effects(derived2), value = update_reaction(derived2);
  } finally {
    set_active_effect(prev_active_effect);
  }
  return value;
}
__name(execute_derived, "execute_derived");
function update_derived(derived2) {
  var value = execute_derived(derived2), status = (skip_reaction || derived2.f & UNOWNED) && derived2.deps !== null ? MAYBE_DIRTY : CLEAN;
  set_signal_status(derived2, status), derived2.equals(value) || (derived2.v = value, derived2.wv = increment_write_version());
}
__name(update_derived, "update_derived");
function validate_effect(rune) {
  active_effect === null && active_reaction === null && effect_orphan(), active_reaction !== null && active_reaction.f & UNOWNED && active_effect === null && effect_in_unowned_derived(), is_destroying_effect && effect_in_teardown();
}
__name(validate_effect, "validate_effect");
function push_effect(effect2, parent_effect) {
  var parent_last = parent_effect.last;
  parent_last === null ? parent_effect.last = parent_effect.first = effect2 : (parent_last.next = effect2, effect2.prev = parent_last, parent_effect.last = effect2);
}
__name(push_effect, "push_effect");
function create_effect(type, fn, sync, push2 = !0) {
  var is_root = (type & ROOT_EFFECT) !== 0, parent_effect = active_effect, effect2 = {
    ctx: component_context,
    deps: null,
    nodes_start: null,
    nodes_end: null,
    f: type | DIRTY,
    first: null,
    fn,
    last: null,
    next: null,
    parent: is_root ? null : parent_effect,
    prev: null,
    teardown: null,
    transitions: null,
    wv: 0
  };
  if (sync) {
    var previously_flushing_effect = is_flushing_effect;
    try {
      set_is_flushing_effect(!0), update_effect(effect2), effect2.f |= EFFECT_RAN;
    } catch (e) {
      throw destroy_effect(effect2), e;
    } finally {
      set_is_flushing_effect(previously_flushing_effect);
    }
  } else fn !== null && schedule_effect(effect2);
  var inert = sync && effect2.deps === null && effect2.first === null && effect2.nodes_start === null && effect2.teardown === null && (effect2.f & (EFFECT_HAS_DERIVED | BOUNDARY_EFFECT)) === 0;
  if (!inert && !is_root && push2 && (parent_effect !== null && push_effect(effect2, parent_effect), active_reaction !== null && active_reaction.f & DERIVED)) {
    var derived2 = (
      /** @type {Derived} */
      active_reaction
    );
    (derived2.effects ?? (derived2.effects = [])).push(effect2);
  }
  return effect2;
}
__name(create_effect, "create_effect");
function effect_tracking() {
  return active_reaction !== null && !untracking;
}
__name(effect_tracking, "effect_tracking");
function teardown(fn) {
  const effect2 = create_effect(RENDER_EFFECT, null, !1);
  return set_signal_status(effect2, CLEAN), effect2.teardown = fn, effect2;
}
__name(teardown, "teardown");
function user_effect(fn) {
  validate_effect();
  var defer = active_effect !== null && (active_effect.f & BRANCH_EFFECT) !== 0 && component_context !== null && !component_context.m;
  if (defer) {
    var context = (
      /** @type {ComponentContext} */
      component_context
    );
    (context.e ?? (context.e = [])).push({
      fn,
      effect: active_effect,
      reaction: active_reaction
    });
  } else {
    var signal = effect(fn);
    return signal;
  }
}
__name(user_effect, "user_effect");
function component_root(fn) {
  const effect2 = create_effect(ROOT_EFFECT, fn, !0);
  return (options = {}) => new Promise((fulfil) => {
    options.outro ? pause_effect(effect2, () => {
      destroy_effect(effect2), fulfil(void 0);
    }) : (destroy_effect(effect2), fulfil(void 0));
  });
}
__name(component_root, "component_root");
function effect(fn) {
  return create_effect(EFFECT, fn, !1);
}
__name(effect, "effect");
function render_effect(fn) {
  return create_effect(RENDER_EFFECT, fn, !0);
}
__name(render_effect, "render_effect");
function template_effect(fn, thunks = [], d = derived) {
  const deriveds = thunks.map(d);
  return block(/* @__PURE__ */ __name(() => fn(...deriveds.map(get$1)), "effect"));
}
__name(template_effect, "template_effect");
function block(fn, flags = 0) {
  return create_effect(RENDER_EFFECT | BLOCK_EFFECT | flags, fn, !0);
}
__name(block, "block");
function branch(fn, push2 = !0) {
  return create_effect(RENDER_EFFECT | BRANCH_EFFECT, fn, !0, push2);
}
__name(branch, "branch");
function execute_effect_teardown(effect2) {
  var teardown2 = effect2.teardown;
  if (teardown2 !== null) {
    const previously_destroying_effect = is_destroying_effect, previous_reaction = active_reaction;
    set_is_destroying_effect(!0), set_active_reaction(null);
    try {
      teardown2.call(null);
    } finally {
      set_is_destroying_effect(previously_destroying_effect), set_active_reaction(previous_reaction);
    }
  }
}
__name(execute_effect_teardown, "execute_effect_teardown");
function destroy_effect_children(signal, remove_dom = !1) {
  var effect2 = signal.first;
  for (signal.first = signal.last = null; effect2 !== null; ) {
    var next = effect2.next;
    destroy_effect(effect2, remove_dom), effect2 = next;
  }
}
__name(destroy_effect_children, "destroy_effect_children");
function destroy_block_effect_children(signal) {
  for (var effect2 = signal.first; effect2 !== null; ) {
    var next = effect2.next;
    effect2.f & BRANCH_EFFECT || destroy_effect(effect2), effect2 = next;
  }
}
__name(destroy_block_effect_children, "destroy_block_effect_children");
function destroy_effect(effect2, remove_dom = !0) {
  var removed = !1;
  if ((remove_dom || effect2.f & HEAD_EFFECT) && effect2.nodes_start !== null) {
    for (var node = effect2.nodes_start, end = effect2.nodes_end; node !== null; ) {
      var next = node === end ? null : (
        /** @type {TemplateNode} */
        /* @__PURE__ */ get_next_sibling(node)
      );
      node.remove(), node = next;
    }
    removed = !0;
  }
  destroy_effect_children(effect2, remove_dom && !removed), remove_reactions(effect2, 0), set_signal_status(effect2, DESTROYED);
  var transitions = effect2.transitions;
  if (transitions !== null)
    for (const transition of transitions)
      transition.stop();
  execute_effect_teardown(effect2);
  var parent = effect2.parent;
  parent !== null && parent.first !== null && unlink_effect(effect2), effect2.next = effect2.prev = effect2.teardown = effect2.ctx = effect2.deps = effect2.fn = effect2.nodes_start = effect2.nodes_end = null;
}
__name(destroy_effect, "destroy_effect");
function unlink_effect(effect2) {
  var parent = effect2.parent, prev = effect2.prev, next = effect2.next;
  prev !== null && (prev.next = next), next !== null && (next.prev = prev), parent !== null && (parent.first === effect2 && (parent.first = next), parent.last === effect2 && (parent.last = prev));
}
__name(unlink_effect, "unlink_effect");
function pause_effect(effect2, callback) {
  var transitions = [];
  pause_children(effect2, transitions, !0), run_out_transitions(transitions, () => {
    destroy_effect(effect2), callback && callback();
  });
}
__name(pause_effect, "pause_effect");
function run_out_transitions(transitions, fn) {
  var remaining = transitions.length;
  if (remaining > 0) {
    var check = /* @__PURE__ */ __name(() => --remaining || fn(), "check");
    for (var transition of transitions)
      transition.out(check);
  } else
    fn();
}
__name(run_out_transitions, "run_out_transitions");
function pause_children(effect2, transitions, local) {
  if (!(effect2.f & INERT)) {
    if (effect2.f ^= INERT, effect2.transitions !== null)
      for (const transition of effect2.transitions)
        (transition.is_global || local) && transitions.push(transition);
    for (var child2 = effect2.first; child2 !== null; ) {
      var sibling2 = child2.next, transparent = (child2.f & EFFECT_TRANSPARENT) !== 0 || (child2.f & BRANCH_EFFECT) !== 0;
      pause_children(child2, transitions, transparent ? local : !1), child2 = sibling2;
    }
  }
}
__name(pause_children, "pause_children");
function resume_effect(effect2) {
  resume_children(effect2, !0);
}
__name(resume_effect, "resume_effect");
function resume_children(effect2, local) {
  if (effect2.f & INERT) {
    effect2.f ^= INERT, effect2.f & CLEAN || (effect2.f ^= CLEAN), check_dirtiness(effect2) && (set_signal_status(effect2, DIRTY), schedule_effect(effect2));
    for (var child2 = effect2.first; child2 !== null; ) {
      var sibling2 = child2.next, transparent = (child2.f & EFFECT_TRANSPARENT) !== 0 || (child2.f & BRANCH_EFFECT) !== 0;
      resume_children(child2, transparent ? local : !1), child2 = sibling2;
    }
    if (effect2.transitions !== null)
      for (const transition of effect2.transitions)
        (transition.is_global || local) && transition.in();
  }
}
__name(resume_children, "resume_children");
let is_micro_task_queued$1 = !1, current_queued_micro_tasks = [];
function process_micro_tasks() {
  is_micro_task_queued$1 = !1;
  const tasks = current_queued_micro_tasks.slice();
  current_queued_micro_tasks = [], run_all(tasks);
}
__name(process_micro_tasks, "process_micro_tasks");
function queue_micro_task(fn) {
  is_micro_task_queued$1 || (is_micro_task_queued$1 = !0, queueMicrotask(process_micro_tasks)), current_queued_micro_tasks.push(fn);
}
__name(queue_micro_task, "queue_micro_task");
function flush_tasks() {
  is_micro_task_queued$1 && process_micro_tasks();
}
__name(flush_tasks, "flush_tasks");
const FLUSH_MICROTASK = 0, FLUSH_SYNC = 1;
let is_throwing_error = !1, scheduler_mode = FLUSH_MICROTASK, is_micro_task_queued = !1, last_scheduled_effect = null, is_flushing_effect = !1, is_destroying_effect = !1;
function set_is_flushing_effect(value) {
  is_flushing_effect = value;
}
__name(set_is_flushing_effect, "set_is_flushing_effect");
function set_is_destroying_effect(value) {
  is_destroying_effect = value;
}
__name(set_is_destroying_effect, "set_is_destroying_effect");
let queued_root_effects = [], flush_count = 0;
let active_reaction = null, untracking = !1;
function set_active_reaction(reaction) {
  active_reaction = reaction;
}
__name(set_active_reaction, "set_active_reaction");
let active_effect = null;
function set_active_effect(effect2) {
  active_effect = effect2;
}
__name(set_active_effect, "set_active_effect");
let derived_sources = null;
function set_derived_sources(sources) {
  derived_sources = sources;
}
__name(set_derived_sources, "set_derived_sources");
let new_deps = null, skipped_deps = 0, untracked_writes = null;
function set_untracked_writes(value) {
  untracked_writes = value;
}
__name(set_untracked_writes, "set_untracked_writes");
let write_version = 1, read_version = 0, skip_reaction = !1;
function increment_write_version() {
  return ++write_version;
}
__name(increment_write_version, "increment_write_version");
function check_dirtiness(reaction) {
  var _a;
  var flags = reaction.f;
  if (flags & DIRTY)
    return !0;
  if (flags & MAYBE_DIRTY) {
    var dependencies = reaction.deps, is_unowned = (flags & UNOWNED) !== 0;
    if (dependencies !== null) {
      var i, dependency, is_disconnected = (flags & DISCONNECTED) !== 0, is_unowned_connected = is_unowned && active_effect !== null && !skip_reaction, length = dependencies.length;
      if (is_disconnected || is_unowned_connected) {
        var derived2 = (
          /** @type {Derived} */
          reaction
        ), parent = derived2.parent;
        for (i = 0; i < length; i++)
          dependency = dependencies[i], (is_disconnected || !((_a = dependency == null ? void 0 : dependency.reactions) != null && _a.includes(derived2))) && (dependency.reactions ?? (dependency.reactions = [])).push(derived2);
        is_disconnected && (derived2.f ^= DISCONNECTED), is_unowned_connected && parent !== null && !(parent.f & UNOWNED) && (derived2.f ^= UNOWNED);
      }
      for (i = 0; i < length; i++)
        if (dependency = dependencies[i], check_dirtiness(
          /** @type {Derived} */
          dependency
        ) && update_derived(
          /** @type {Derived} */
          dependency
        ), dependency.wv > reaction.wv)
          return !0;
    }
    (!is_unowned || active_effect !== null && !skip_reaction) && set_signal_status(reaction, CLEAN);
  }
  return !1;
}
__name(check_dirtiness, "check_dirtiness");
function propagate_error(error, effect2) {
  for (var current = effect2; current !== null; ) {
    if (current.f & BOUNDARY_EFFECT)
      try {
        current.fn(error);
        return;
      } catch {
        current.f ^= BOUNDARY_EFFECT;
      }
    current = current.parent;
  }
  throw is_throwing_error = !1, error;
}
__name(propagate_error, "propagate_error");
function should_rethrow_error(effect2) {
  return (effect2.f & DESTROYED) === 0 && (effect2.parent === null || (effect2.parent.f & BOUNDARY_EFFECT) === 0);
}
__name(should_rethrow_error, "should_rethrow_error");
function handle_error(error, effect2, previous_effect, component_context2) {
  if (is_throwing_error) {
    if (previous_effect === null && (is_throwing_error = !1), should_rethrow_error(effect2))
      throw error;
    return;
  }
  previous_effect !== null && (is_throwing_error = !0);
  {
    propagate_error(error, effect2);
    return;
  }
}
__name(handle_error, "handle_error");
function schedule_possible_effect_self_invalidation(signal, effect2, root2 = !0) {
  var reactions = signal.reactions;
  if (reactions !== null)
    for (var i = 0; i < reactions.length; i++) {
      var reaction = reactions[i];
      reaction.f & DERIVED ? schedule_possible_effect_self_invalidation(
        /** @type {Derived} */
        reaction,
        effect2,
        !1
      ) : effect2 === reaction && (root2 ? set_signal_status(reaction, DIRTY) : reaction.f & CLEAN && set_signal_status(reaction, MAYBE_DIRTY), schedule_effect(
        /** @type {Effect} */
        reaction
      ));
    }
}
__name(schedule_possible_effect_self_invalidation, "schedule_possible_effect_self_invalidation");
function update_reaction(reaction) {
  var _a;
  var previous_deps = new_deps, previous_skipped_deps = skipped_deps, previous_untracked_writes = untracked_writes, previous_reaction = active_reaction, previous_skip_reaction = skip_reaction, prev_derived_sources = derived_sources, previous_component_context = component_context, previous_untracking = untracking, flags = reaction.f;
  new_deps = /** @type {null | Value[]} */
  null, skipped_deps = 0, untracked_writes = null, active_reaction = flags & (BRANCH_EFFECT | ROOT_EFFECT) ? null : reaction, skip_reaction = (flags & UNOWNED) !== 0 && (!is_flushing_effect || previous_reaction === null || previous_untracking), derived_sources = null, set_component_context(reaction.ctx), untracking = !1, read_version++;
  try {
    var result = (
      /** @type {Function} */
      (0, reaction.fn)()
    ), deps = reaction.deps;
    if (new_deps !== null) {
      var i;
      if (remove_reactions(reaction, skipped_deps), deps !== null && skipped_deps > 0)
        for (deps.length = skipped_deps + new_deps.length, i = 0; i < new_deps.length; i++)
          deps[skipped_deps + i] = new_deps[i];
      else
        reaction.deps = deps = new_deps;
      if (!skip_reaction)
        for (i = skipped_deps; i < deps.length; i++)
          ((_a = deps[i]).reactions ?? (_a.reactions = [])).push(reaction);
    } else deps !== null && skipped_deps < deps.length && (remove_reactions(reaction, skipped_deps), deps.length = skipped_deps);
    if (is_runes() && untracked_writes !== null && !untracking && deps !== null && !(reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)))
      for (i = 0; i < /** @type {Source[]} */
      untracked_writes.length; i++)
        schedule_possible_effect_self_invalidation(
          untracked_writes[i],
          /** @type {Effect} */
          reaction
        );
    return previous_reaction !== null && read_version++, result;
  } finally {
    new_deps = previous_deps, skipped_deps = previous_skipped_deps, untracked_writes = previous_untracked_writes, active_reaction = previous_reaction, skip_reaction = previous_skip_reaction, derived_sources = prev_derived_sources, set_component_context(previous_component_context), untracking = previous_untracking;
  }
}
__name(update_reaction, "update_reaction");
function remove_reaction(signal, dependency) {
  let reactions = dependency.reactions;
  if (reactions !== null) {
    var index2 = index_of.call(reactions, signal);
    if (index2 !== -1) {
      var new_length = reactions.length - 1;
      new_length === 0 ? reactions = dependency.reactions = null : (reactions[index2] = reactions[new_length], reactions.pop());
    }
  }
  reactions === null && dependency.f & DERIVED && // Destroying a child effect while updating a parent effect can cause a dependency to appear
  // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
  // allows us to skip the expensive work of disconnecting and immediately reconnecting it
  (new_deps === null || !new_deps.includes(dependency)) && (set_signal_status(dependency, MAYBE_DIRTY), dependency.f & (UNOWNED | DISCONNECTED) || (dependency.f ^= DISCONNECTED), destroy_derived_effects(
    /** @type {Derived} **/
    dependency
  ), remove_reactions(
    /** @type {Derived} **/
    dependency,
    0
  ));
}
__name(remove_reaction, "remove_reaction");
function remove_reactions(signal, start_index) {
  var dependencies = signal.deps;
  if (dependencies !== null)
    for (var i = start_index; i < dependencies.length; i++)
      remove_reaction(signal, dependencies[i]);
}
__name(remove_reactions, "remove_reactions");
function update_effect(effect2) {
  var flags = effect2.f;
  if (!(flags & DESTROYED)) {
    set_signal_status(effect2, CLEAN);
    var previous_effect = active_effect, previous_component_context = component_context;
    active_effect = effect2;
    try {
      flags & BLOCK_EFFECT ? destroy_block_effect_children(effect2) : destroy_effect_children(effect2), execute_effect_teardown(effect2);
      var teardown2 = update_reaction(effect2);
      effect2.teardown = typeof teardown2 == "function" ? teardown2 : null, effect2.wv = write_version;
      var deps = effect2.deps, dep;
      DEV && tracing_mode_flag && effect2.f & DIRTY;
    } catch (error) {
      handle_error(error, effect2, previous_effect, previous_component_context || effect2.ctx);
    } finally {
      active_effect = previous_effect;
    }
  }
}
__name(update_effect, "update_effect");
function infinite_loop_guard() {
  if (flush_count > 1e3) {
    flush_count = 0;
    try {
      effect_update_depth_exceeded();
    } catch (error) {
      if (last_scheduled_effect !== null)
        handle_error(error, last_scheduled_effect, null);
      else
        throw error;
    }
  }
  flush_count++;
}
__name(infinite_loop_guard, "infinite_loop_guard");
function flush_queued_root_effects(root_effects) {
  var length = root_effects.length;
  if (length !== 0) {
    infinite_loop_guard();
    var previously_flushing_effect = is_flushing_effect;
    is_flushing_effect = !0;
    try {
      for (var i = 0; i < length; i++) {
        var effect2 = root_effects[i];
        effect2.f & CLEAN || (effect2.f ^= CLEAN);
        var collected_effects = process_effects(effect2);
        flush_queued_effects(collected_effects);
      }
    } finally {
      is_flushing_effect = previously_flushing_effect;
    }
  }
}
__name(flush_queued_root_effects, "flush_queued_root_effects");
function flush_queued_effects(effects) {
  var length = effects.length;
  if (length !== 0)
    for (var i = 0; i < length; i++) {
      var effect2 = effects[i];
      if (!(effect2.f & (DESTROYED | INERT)))
        try {
          check_dirtiness(effect2) && (update_effect(effect2), effect2.deps === null && effect2.first === null && effect2.nodes_start === null && (effect2.teardown === null ? unlink_effect(effect2) : effect2.fn = null));
        } catch (error) {
          handle_error(error, effect2, null, effect2.ctx);
        }
    }
}
__name(flush_queued_effects, "flush_queued_effects");
function process_deferred() {
  if (is_micro_task_queued = !1, flush_count > 1001)
    return;
  const previous_queued_root_effects = queued_root_effects;
  queued_root_effects = [], flush_queued_root_effects(previous_queued_root_effects), is_micro_task_queued || (flush_count = 0, last_scheduled_effect = null);
}
__name(process_deferred, "process_deferred");
function schedule_effect(signal) {
  scheduler_mode === FLUSH_MICROTASK && (is_micro_task_queued || (is_micro_task_queued = !0, queueMicrotask(process_deferred))), last_scheduled_effect = signal;
  for (var effect2 = signal; effect2.parent !== null; ) {
    effect2 = effect2.parent;
    var flags = effect2.f;
    if (flags & (ROOT_EFFECT | BRANCH_EFFECT)) {
      if (!(flags & CLEAN)) return;
      effect2.f ^= CLEAN;
    }
  }
  queued_root_effects.push(effect2);
}
__name(schedule_effect, "schedule_effect");
function process_effects(effect2) {
  var effects = [], current_effect = effect2.first;
  main_loop: for (; current_effect !== null; ) {
    var flags = current_effect.f, is_branch = (flags & BRANCH_EFFECT) !== 0, is_skippable_branch = is_branch && (flags & CLEAN) !== 0, sibling2 = current_effect.next;
    if (!is_skippable_branch && !(flags & INERT)) {
      if (flags & EFFECT)
        effects.push(current_effect);
      else if (is_branch)
        current_effect.f ^= CLEAN;
      else {
        var previous_active_reaction = active_reaction;
        try {
          active_reaction = current_effect, check_dirtiness(current_effect) && update_effect(current_effect);
        } catch (error) {
          handle_error(error, current_effect, null, current_effect.ctx);
        } finally {
          active_reaction = previous_active_reaction;
        }
      }
      var child2 = current_effect.first;
      if (child2 !== null) {
        current_effect = child2;
        continue;
      }
    }
    if (sibling2 === null) {
      let parent = current_effect.parent;
      for (; parent !== null; ) {
        if (effect2 === parent)
          break main_loop;
        var parent_sibling = parent.next;
        if (parent_sibling !== null) {
          current_effect = parent_sibling;
          continue main_loop;
        }
        parent = parent.parent;
      }
    }
    current_effect = sibling2;
  }
  return effects;
}
__name(process_effects, "process_effects");
function flush_sync(fn) {
  var previous_scheduler_mode = scheduler_mode, previous_queued_root_effects = queued_root_effects;
  try {
    infinite_loop_guard();
    const root_effects = [];
    scheduler_mode = FLUSH_SYNC, queued_root_effects = root_effects, is_micro_task_queued = !1, flush_queued_root_effects(previous_queued_root_effects);
    var result = fn == null ? void 0 : fn();
    return flush_tasks(), (queued_root_effects.length > 0 || root_effects.length > 0) && flush_sync(), flush_count = 0, last_scheduled_effect = null, result;
  } finally {
    scheduler_mode = previous_scheduler_mode, queued_root_effects = previous_queued_root_effects;
  }
}
__name(flush_sync, "flush_sync");
async function tick() {
  await Promise.resolve(), flush_sync();
}
__name(tick, "tick");
function get$1(signal) {
  var flags = signal.f, is_derived = (flags & DERIVED) !== 0;
  if (active_reaction !== null && !untracking) {
    derived_sources !== null && derived_sources.includes(signal) && state_unsafe_local_read();
    var deps = active_reaction.deps;
    signal.rv < read_version && (signal.rv = read_version, new_deps === null && deps !== null && deps[skipped_deps] === signal ? skipped_deps++ : new_deps === null ? new_deps = [signal] : (!skip_reaction || !new_deps.includes(signal)) && new_deps.push(signal));
  } else if (is_derived && /** @type {Derived} */
  signal.deps === null && /** @type {Derived} */
  signal.effects === null) {
    var derived2 = (
      /** @type {Derived} */
      signal
    ), parent = derived2.parent;
    parent !== null && !(parent.f & UNOWNED) && (derived2.f ^= UNOWNED);
  }
  return is_derived && (derived2 = /** @type {Derived} */
  signal, check_dirtiness(derived2) && update_derived(derived2)), signal.v;
}
__name(get$1, "get$1");
function untrack(fn) {
  var previous_untracking = untracking;
  try {
    return untracking = !0, fn();
  } finally {
    untracking = previous_untracking;
  }
}
__name(untrack, "untrack");
const STATUS_MASK = -7169;
function set_signal_status(signal, status) {
  signal.f = signal.f & STATUS_MASK | status;
}
__name(set_signal_status, "set_signal_status");
function deep_read_state(value) {
  if (!(typeof value != "object" || !value || value instanceof EventTarget)) {
    if (STATE_SYMBOL in value)
      deep_read(value);
    else if (!Array.isArray(value))
      for (let key in value) {
        const prop2 = value[key];
        typeof prop2 == "object" && prop2 && STATE_SYMBOL in prop2 && deep_read(prop2);
      }
  }
}
__name(deep_read_state, "deep_read_state");
function deep_read(value, visited = /* @__PURE__ */ new Set()) {
  if (typeof value == "object" && value !== null && // We don't want to traverse DOM elements
  !(value instanceof EventTarget) && !visited.has(value)) {
    visited.add(value), value instanceof Date && value.getTime();
    for (let key in value)
      try {
        deep_read(value[key], visited);
      } catch {
      }
    const proto = get_prototype_of(value);
    if (proto !== Object.prototype && proto !== Array.prototype && proto !== Map.prototype && proto !== Set.prototype && proto !== Date.prototype) {
      const descriptors = get_descriptors(proto);
      for (let key in descriptors) {
        const get2 = descriptors[key].get;
        if (get2)
          try {
            get2.call(value);
          } catch {
          }
      }
    }
  }
}
__name(deep_read, "deep_read");
const PASSIVE_EVENTS = ["touchstart", "touchmove"];
function is_passive_event(name) {
  return PASSIVE_EVENTS.includes(name);
}
__name(is_passive_event, "is_passive_event");
let listening_to_form_reset = !1;
function add_form_reset_listener() {
  listening_to_form_reset || (listening_to_form_reset = !0, document.addEventListener(
    "reset",
    (evt) => {
      Promise.resolve().then(() => {
        var _a;
        if (!evt.defaultPrevented)
          for (
            const e of
            /**@type {HTMLFormElement} */
            evt.target.elements
          )
            (_a = e.__on_r) == null || _a.call(e);
      });
    },
    // In the capture phase to guarantee we get noticed of it (no possiblity of stopPropagation)
    { capture: !0 }
  ));
}
__name(add_form_reset_listener, "add_form_reset_listener");
function without_reactive_context(fn) {
  var previous_reaction = active_reaction, previous_effect = active_effect;
  set_active_reaction(null), set_active_effect(null);
  try {
    return fn();
  } finally {
    set_active_reaction(previous_reaction), set_active_effect(previous_effect);
  }
}
__name(without_reactive_context, "without_reactive_context");
function listen_to_event_and_reset_event(element, event2, handler, on_reset = handler) {
  element.addEventListener(event2, () => without_reactive_context(handler));
  const prev = element.__on_r;
  prev ? element.__on_r = () => {
    prev(), on_reset(!0);
  } : element.__on_r = () => on_reset(!0), add_form_reset_listener();
}
__name(listen_to_event_and_reset_event, "listen_to_event_and_reset_event");
const all_registered_events = /* @__PURE__ */ new Set(), root_event_handles = /* @__PURE__ */ new Set();
function create_event(event_name, dom, handler, options = {}) {
  function target_handler(event2) {
    if (options.capture || handle_event_propagation.call(dom, event2), !event2.cancelBubble)
      return without_reactive_context(() => handler == null ? void 0 : handler.call(this, event2));
  }
  return __name(target_handler, "target_handler"), event_name.startsWith("pointer") || event_name.startsWith("touch") || event_name === "wheel" ? queue_micro_task(() => {
    dom.addEventListener(event_name, target_handler, options);
  }) : dom.addEventListener(event_name, target_handler, options), target_handler;
}
__name(create_event, "create_event");
function event(event_name, dom, handler, capture, passive) {
  var options = { capture, passive }, target_handler = create_event(event_name, dom, handler, options);
  (dom === document.body || dom === window || dom === document) && teardown(() => {
    dom.removeEventListener(event_name, target_handler, options);
  });
}
__name(event, "event");
function delegate(events) {
  for (var i = 0; i < events.length; i++)
    all_registered_events.add(events[i]);
  for (var fn of root_event_handles)
    fn(events);
}
__name(delegate, "delegate");
function handle_event_propagation(event2) {
  var _a;
  var handler_element = this, owner_document = (
    /** @type {Node} */
    handler_element.ownerDocument
  ), event_name = event2.type, path = ((_a = event2.composedPath) == null ? void 0 : _a.call(event2)) || [], current_target = (
    /** @type {null | Element} */
    path[0] || event2.target
  ), path_idx = 0, handled_at = event2.__root;
  if (handled_at) {
    var at_idx = path.indexOf(handled_at);
    if (at_idx !== -1 && (handler_element === document || handler_element === /** @type {any} */
    window)) {
      event2.__root = handler_element;
      return;
    }
    var handler_idx = path.indexOf(handler_element);
    if (handler_idx === -1)
      return;
    at_idx <= handler_idx && (path_idx = at_idx);
  }
  if (current_target = /** @type {Element} */
  path[path_idx] || event2.target, current_target !== handler_element) {
    define_property(event2, "currentTarget", {
      configurable: !0,
      get() {
        return current_target || owner_document;
      }
    });
    var previous_reaction = active_reaction, previous_effect = active_effect;
    set_active_reaction(null), set_active_effect(null);
    try {
      for (var throw_error, other_errors = []; current_target !== null; ) {
        var parent_element = current_target.assignedSlot || current_target.parentNode || /** @type {any} */
        current_target.host || null;
        try {
          var delegated = current_target["__" + event_name];
          if (delegated !== void 0 && !/** @type {any} */
          current_target.disabled)
            if (is_array(delegated)) {
              var [fn, ...data] = delegated;
              fn.apply(current_target, [event2, ...data]);
            } else
              delegated.call(current_target, event2);
        } catch (error) {
          throw_error ? other_errors.push(error) : throw_error = error;
        }
        if (event2.cancelBubble || parent_element === handler_element || parent_element === null)
          break;
        current_target = parent_element;
      }
      if (throw_error) {
        for (let error of other_errors)
          queueMicrotask(() => {
            throw error;
          });
        throw throw_error;
      }
    } finally {
      event2.__root = handler_element, delete event2.currentTarget, set_active_reaction(previous_reaction), set_active_effect(previous_effect);
    }
  }
}
__name(handle_event_propagation, "handle_event_propagation");
function create_fragment_from_html(html2) {
  var elem = document.createElement("template");
  return elem.innerHTML = html2, elem.content;
}
__name(create_fragment_from_html, "create_fragment_from_html");
function assign_nodes(start, end) {
  var effect2 = (
    /** @type {Effect} */
    active_effect
  );
  effect2.nodes_start === null && (effect2.nodes_start = start, effect2.nodes_end = end);
}
__name(assign_nodes, "assign_nodes");
// @__NO_SIDE_EFFECTS__
function template(content, flags) {
  var is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0, use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0, node, has_start = !content.startsWith("<!>");
  return () => {
    node === void 0 && (node = create_fragment_from_html(has_start ? content : "<!>" + content), is_fragment || (node = /** @type {Node} */
    /* @__PURE__ */ get_first_child(node)));
    var clone = (
      /** @type {TemplateNode} */
      use_import_node || is_firefox ? document.importNode(node, !0) : node.cloneNode(!0)
    );
    if (is_fragment) {
      var start = (
        /** @type {TemplateNode} */
        /* @__PURE__ */ get_first_child(clone)
      ), end = (
        /** @type {TemplateNode} */
        clone.lastChild
      );
      assign_nodes(start, end);
    } else
      assign_nodes(clone, clone);
    return clone;
  };
}
__name(template, "template");
function text(value = "") {
  {
    var t = create_text(value + "");
    return assign_nodes(t, t), t;
  }
}
__name(text, "text");
function comment() {
  var frag = document.createDocumentFragment(), start = document.createComment(""), anchor = create_text();
  return frag.append(start, anchor), assign_nodes(start, anchor), frag;
}
__name(comment, "comment");
function append(anchor, dom) {
  anchor !== null && anchor.before(
    /** @type {Node} */
    dom
  );
}
__name(append, "append");
function set_text(text2, value) {
  var str = value == null ? "" : typeof value == "object" ? value + "" : value;
  str !== (text2.__t ?? (text2.__t = text2.nodeValue)) && (text2.__t = str, text2.nodeValue = str + "");
}
__name(set_text, "set_text");
function mount(component, options) {
  return _mount(component, options);
}
__name(mount, "mount");
const document_listeners = /* @__PURE__ */ new Map();
function _mount(Component, { target, anchor, props = {}, events, context, intro = !0 }) {
  init_operations();
  var registered_events = /* @__PURE__ */ new Set(), event_handle = /* @__PURE__ */ __name((events2) => {
    for (var i = 0; i < events2.length; i++) {
      var event_name = events2[i];
      if (!registered_events.has(event_name)) {
        registered_events.add(event_name);
        var passive = is_passive_event(event_name);
        target.addEventListener(event_name, handle_event_propagation, { passive });
        var n = document_listeners.get(event_name);
        n === void 0 ? (document.addEventListener(event_name, handle_event_propagation, { passive }), document_listeners.set(event_name, 1)) : document_listeners.set(event_name, n + 1);
      }
    }
  }, "event_handle");
  event_handle(array_from(all_registered_events)), root_event_handles.add(event_handle);
  var component = void 0, unmount = component_root(() => {
    var anchor_node = anchor ?? target.appendChild(create_text());
    return branch(() => {
      if (context) {
        push({});
        var ctx = (
          /** @type {ComponentContext} */
          component_context
        );
        ctx.c = context;
      }
      events && (props.$$events = events), component = Component(anchor_node, props) || {}, context && pop();
    }), () => {
      var _a;
      for (var event_name of registered_events) {
        target.removeEventListener(event_name, handle_event_propagation);
        var n = (
          /** @type {number} */
          document_listeners.get(event_name)
        );
        --n === 0 ? (document.removeEventListener(event_name, handle_event_propagation), document_listeners.delete(event_name)) : document_listeners.set(event_name, n);
      }
      root_event_handles.delete(event_handle), anchor_node !== anchor && ((_a = anchor_node.parentNode) == null || _a.removeChild(anchor_node));
    };
  });
  return mounted_components.set(component, unmount), component;
}
__name(_mount, "_mount");
let mounted_components = /* @__PURE__ */ new WeakMap();
function if_block(node, fn, elseif = !1) {
  var anchor = node, consequent_effect = null, alternate_effect = null, condition = UNINITIALIZED, flags = elseif ? EFFECT_TRANSPARENT : 0, has_branch = !1;
  const set_branch = /* @__PURE__ */ __name((fn2, flag = !0) => {
    has_branch = !0, update_branch(flag, fn2);
  }, "set_branch"), update_branch = /* @__PURE__ */ __name((new_condition, fn2) => {
    condition !== (condition = new_condition) && (condition ? (consequent_effect ? resume_effect(consequent_effect) : fn2 && (consequent_effect = branch(() => fn2(anchor))), alternate_effect && pause_effect(alternate_effect, () => {
      alternate_effect = null;
    })) : (alternate_effect ? resume_effect(alternate_effect) : fn2 && (alternate_effect = branch(() => fn2(anchor))), consequent_effect && pause_effect(consequent_effect, () => {
      consequent_effect = null;
    })));
  }, "update_branch");
  block(() => {
    has_branch = !1, fn(set_branch), has_branch || update_branch(null, null);
  }, flags);
}
__name(if_block, "if_block");
function index(_, i) {
  return i;
}
__name(index, "index");
function pause_effects(state2, items, controlled_anchor, items_map) {
  for (var transitions = [], length = items.length, i = 0; i < length; i++)
    pause_children(items[i].e, transitions, !0);
  var is_controlled = length > 0 && transitions.length === 0 && controlled_anchor !== null;
  if (is_controlled) {
    var parent_node = (
      /** @type {Element} */
      /** @type {Element} */
      controlled_anchor.parentNode
    );
    clear_text_content(parent_node), parent_node.append(
      /** @type {Element} */
      controlled_anchor
    ), items_map.clear(), link(state2, items[0].prev, items[length - 1].next);
  }
  run_out_transitions(transitions, () => {
    for (var i2 = 0; i2 < length; i2++) {
      var item = items[i2];
      is_controlled || (items_map.delete(item.k), link(state2, item.prev, item.next)), destroy_effect(item.e, !is_controlled);
    }
  });
}
__name(pause_effects, "pause_effects");
function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) {
  var anchor = node, state2 = { items: /* @__PURE__ */ new Map(), first: null }, is_controlled = (flags & EACH_IS_CONTROLLED) !== 0;
  if (is_controlled) {
    var parent_node = (
      /** @type {Element} */
      node
    );
    anchor = parent_node.appendChild(create_text());
  }
  var fallback = null, was_empty = !1, each_array = /* @__PURE__ */ derived_safe_equal(() => {
    var collection = get_collection();
    return is_array(collection) ? collection : collection == null ? [] : array_from(collection);
  });
  block(() => {
    var array = get$1(each_array), length = array.length;
    was_empty && length === 0 || (was_empty = length === 0, reconcile(array, state2, anchor, render_fn, flags, get_key, get_collection), fallback_fn !== null && (length === 0 ? fallback ? resume_effect(fallback) : fallback = branch(() => fallback_fn(anchor)) : fallback !== null && pause_effect(fallback, () => {
      fallback = null;
    })), get$1(each_array));
  });
}
__name(each, "each");
function reconcile(array, state2, anchor, render_fn, flags, get_key, get_collection) {
  var _a, _b, _c, _d;
  var is_animated = (flags & EACH_IS_ANIMATED) !== 0, should_update = (flags & (EACH_ITEM_REACTIVE | EACH_INDEX_REACTIVE)) !== 0, length = array.length, items = state2.items, first = state2.first, current = first, seen, prev = null, to_animate, matched = [], stashed = [], value, key, item, i;
  if (is_animated)
    for (i = 0; i < length; i += 1)
      value = array[i], key = get_key(value, i), item = items.get(key), item !== void 0 && ((_a = item.a) == null || _a.measure(), (to_animate ?? (to_animate = /* @__PURE__ */ new Set())).add(item));
  for (i = 0; i < length; i += 1) {
    if (value = array[i], key = get_key(value, i), item = items.get(key), item === void 0) {
      var child_anchor = current ? (
        /** @type {TemplateNode} */
        current.e.nodes_start
      ) : anchor;
      prev = create_item(
        child_anchor,
        state2,
        prev,
        prev === null ? state2.first : prev.next,
        value,
        key,
        i,
        render_fn,
        flags,
        get_collection
      ), items.set(key, prev), matched = [], stashed = [], current = prev.next;
      continue;
    }
    if (should_update && update_item(item, value, i, flags), item.e.f & INERT && (resume_effect(item.e), is_animated && ((_b = item.a) == null || _b.unfix(), (to_animate ?? (to_animate = /* @__PURE__ */ new Set())).delete(item))), item !== current) {
      if (seen !== void 0 && seen.has(item)) {
        if (matched.length < stashed.length) {
          var start = stashed[0], j;
          prev = start.prev;
          var a = matched[0], b = matched[matched.length - 1];
          for (j = 0; j < matched.length; j += 1)
            move(matched[j], start, anchor);
          for (j = 0; j < stashed.length; j += 1)
            seen.delete(stashed[j]);
          link(state2, a.prev, b.next), link(state2, prev, a), link(state2, b, start), current = start, prev = b, i -= 1, matched = [], stashed = [];
        } else
          seen.delete(item), move(item, current, anchor), link(state2, item.prev, item.next), link(state2, item, prev === null ? state2.first : prev.next), link(state2, prev, item), prev = item;
        continue;
      }
      for (matched = [], stashed = []; current !== null && current.k !== key; )
        current.e.f & INERT || (seen ?? (seen = /* @__PURE__ */ new Set())).add(current), stashed.push(current), current = current.next;
      if (current === null)
        continue;
      item = current;
    }
    matched.push(item), prev = item, current = item.next;
  }
  if (current !== null || seen !== void 0) {
    for (var to_destroy = seen === void 0 ? [] : array_from(seen); current !== null; )
      current.e.f & INERT || to_destroy.push(current), current = current.next;
    var destroy_length = to_destroy.length;
    if (destroy_length > 0) {
      var controlled_anchor = flags & EACH_IS_CONTROLLED && length === 0 ? anchor : null;
      if (is_animated) {
        for (i = 0; i < destroy_length; i += 1)
          (_c = to_destroy[i].a) == null || _c.measure();
        for (i = 0; i < destroy_length; i += 1)
          (_d = to_destroy[i].a) == null || _d.fix();
      }
      pause_effects(state2, to_destroy, controlled_anchor, items);
    }
  }
  is_animated && queue_micro_task(() => {
    var _a2;
    if (to_animate !== void 0)
      for (item of to_animate)
        (_a2 = item.a) == null || _a2.apply();
  }), active_effect.first = state2.first && state2.first.e, active_effect.last = prev && prev.e;
}
__name(reconcile, "reconcile");
function update_item(item, value, index2, type) {
  type & EACH_ITEM_REACTIVE && internal_set(item.v, value), type & EACH_INDEX_REACTIVE ? internal_set(
    /** @type {Value<number>} */
    item.i,
    index2
  ) : item.i = index2;
}
__name(update_item, "update_item");
function create_item(anchor, state2, prev, next, value, key, index2, render_fn, flags, get_collection) {
  var reactive = (flags & EACH_ITEM_REACTIVE) !== 0, mutable = (flags & EACH_ITEM_IMMUTABLE) === 0, v = reactive ? mutable ? /* @__PURE__ */ mutable_source(value) : source(value) : value, i = flags & EACH_INDEX_REACTIVE ? source(index2) : index2, item = {
    i,
    v,
    k: key,
    a: null,
    // @ts-expect-error
    e: null,
    prev,
    next
  };
  try {
    return item.e = branch(() => render_fn(anchor, v, i, get_collection), hydrating), item.e.prev = prev && prev.e, item.e.next = next && next.e, prev === null ? state2.first = item : (prev.next = item, prev.e.next = item.e), next !== null && (next.prev = item, next.e.prev = item.e), item;
  } finally {
  }
}
__name(create_item, "create_item");
function move(item, next, anchor) {
  for (var end = item.next ? (
    /** @type {TemplateNode} */
    item.next.e.nodes_start
  ) : anchor, dest = next ? (
    /** @type {TemplateNode} */
    next.e.nodes_start
  ) : anchor, node = (
    /** @type {TemplateNode} */
    item.e.nodes_start
  ); node !== end; ) {
    var next_node = (
      /** @type {TemplateNode} */
      /* @__PURE__ */ get_next_sibling(node)
    );
    dest.before(node), node = next_node;
  }
}
__name(move, "move");
function link(state2, prev, next) {
  prev === null ? state2.first = next : (prev.next = next, prev.e.next = next && next.e), next !== null && (next.prev = prev, next.e.prev = prev && prev.e);
}
__name(link, "link");
function html(node, get_value, svg, mathml, skip_warning) {
  var anchor = node, value = "", effect2;
  block(() => {
    value !== (value = get_value() ?? "") && (effect2 !== void 0 && (destroy_effect(effect2), effect2 = void 0), value !== "" && (effect2 = branch(() => {
      var html2 = value + "", node2 = create_fragment_from_html(html2);
      assign_nodes(
        /** @type {TemplateNode} */
        /* @__PURE__ */ get_first_child(node2),
        /** @type {TemplateNode} */
        node2.lastChild
      ), anchor.before(node2);
    })));
  });
}
__name(html, "html");
function snippet(node, get_snippet, ...args) {
  var anchor = node, snippet2 = noop, snippet_effect;
  block(() => {
    snippet2 !== (snippet2 = get_snippet()) && (snippet_effect && (destroy_effect(snippet_effect), snippet_effect = null), snippet_effect = branch(() => (
      /** @type {SnippetFn} */
      snippet2(anchor, ...args)
    )));
  }, EFFECT_TRANSPARENT);
}
__name(snippet, "snippet");
function action(dom, action2, get_value) {
  effect(() => {
    var payload = untrack(() => action2(dom, get_value == null ? void 0 : get_value()) || {});
    if (get_value && (payload != null && payload.update)) {
      var inited = !1, prev = (
        /** @type {any} */
        {}
      );
      render_effect(() => {
        var value = get_value();
        deep_read_state(value), inited && safe_not_equal(prev, value) && (prev = value, payload.update(value));
      }), inited = !0;
    }
    if (payload != null && payload.destroy)
      return () => (
        /** @type {Function} */
        payload.destroy()
      );
  });
}
__name(action, "action");
function r(e) {
  var t, f, n = "";
  if (typeof e == "string" || typeof e == "number") n += e;
  else if (typeof e == "object") if (Array.isArray(e)) {
    var o = e.length;
    for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
  } else for (f in e) e[f] && (n && (n += " "), n += f);
  return n;
}
__name(r, "r");
function clsx$1() {
  for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
  return n;
}
__name(clsx$1, "clsx$1");
function clsx(value) {
  return typeof value == "object" ? clsx$1(value) : value ?? "";
}
__name(clsx, "clsx");
function set_value(element, value) {
  var attributes = element.__attributes ?? (element.__attributes = {});
  attributes.value === (attributes.value = // treat null and undefined the same for the initial value
  value ?? void 0) || // @ts-expect-error
  // `progress` elements always need their value set when it's `0`
  element.value === value && (value !== 0 || element.nodeName !== "PROGRESS") || (element.value = value ?? "");
}
__name(set_value, "set_value");
function set_checked(element, checked) {
  var attributes = element.__attributes ?? (element.__attributes = {});
  attributes.checked !== (attributes.checked = // treat null and undefined the same for the initial value
  checked ?? void 0) && (element.checked = checked);
}
__name(set_checked, "set_checked");
function set_selected(element, selected) {
  selected ? element.hasAttribute("selected") || element.setAttribute("selected", "") : element.removeAttribute("selected");
}
__name(set_selected, "set_selected");
function set_attribute(element, attribute, value, skip_warning) {
  var attributes = element.__attributes ?? (element.__attributes = {});
  attributes[attribute] !== (attributes[attribute] = value) && (attribute === "style" && "__styles" in element && (element.__styles = {}), attribute === "loading" && (element[LOADING_ATTR_SYMBOL] = value), value == null ? element.removeAttribute(attribute) : typeof value != "string" && get_setters(element).includes(attribute) ? element[attribute] = value : element.setAttribute(attribute, value));
}
__name(set_attribute, "set_attribute");
var setters_cache = /* @__PURE__ */ new Map();
function get_setters(element) {
  var setters = setters_cache.get(element.nodeName);
  if (setters) return setters;
  setters_cache.set(element.nodeName, setters = []);
  for (var descriptors, proto = element, element_proto = Element.prototype; element_proto !== proto; ) {
    descriptors = get_descriptors(proto);
    for (var key in descriptors)
      descriptors[key].set && setters.push(key);
    proto = get_prototype_of(proto);
  }
  return setters;
}
__name(get_setters, "get_setters");
function set_class(dom, value, hash) {
  var prev_class_name = dom.__className, next_class_name = to_class(value);
  (prev_class_name !== next_class_name || hydrating) && (value == null ? dom.removeAttribute("class") : dom.className = next_class_name, dom.__className = next_class_name);
}
__name(set_class, "set_class");
function to_class(value, hash) {
  return (value ?? "") + "";
}
__name(to_class, "to_class");
function bind_checked(input, get2, set2 = get2) {
  listen_to_event_and_reset_event(input, "change", (is_reset) => {
    var value = is_reset ? input.defaultChecked : input.checked;
    set2(value);
  }), // If we are hydrating and the value has since changed,
  // then use the update value from the input instead.
  // If defaultChecked is set, then checked == defaultChecked
  untrack(get2) == null && set2(input.checked), render_effect(() => {
    var value = get2();
    input.checked = !!value;
  });
}
__name(bind_checked, "bind_checked");
function is_bound_this(bound_value, element_or_component) {
  return bound_value === element_or_component || (bound_value == null ? void 0 : bound_value[STATE_SYMBOL]) === element_or_component;
}
__name(is_bound_this, "is_bound_this");
function bind_this(element_or_component = {}, update, get_value, get_parts) {
  return effect(() => {
    var old_parts, parts;
    return render_effect(() => {
      old_parts = parts, parts = [], untrack(() => {
        element_or_component !== get_value(...parts) && (update(element_or_component, ...parts), old_parts && is_bound_this(get_value(...old_parts), element_or_component) && update(null, ...old_parts));
      });
    }), () => {
      queue_micro_task(() => {
        parts && is_bound_this(get_value(...parts), element_or_component) && update(null, ...parts);
      });
    };
  }), element_or_component;
}
__name(bind_this, "bind_this");
function subscribe_to_store(store, run, invalidate) {
  if (store == null)
    return run(void 0), noop;
  const unsub = untrack(
    () => store.subscribe(
      run,
      // @ts-expect-error
      invalidate
    )
  );
  return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
}
__name(subscribe_to_store, "subscribe_to_store");
const subscriber_queue = [];
function writable(value, start = noop) {
  let stop = null;
  const subscribers = /* @__PURE__ */ new Set();
  function set2(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(set2, "set");
  function update(fn) {
    set2(fn(
      /** @type {T} */
      value
    ));
  }
  __name(update, "update");
  function subscribe(run, invalidate = noop) {
    const subscriber = [run, invalidate];
    return subscribers.add(subscriber), subscribers.size === 1 && (stop = start(set2, update) || noop), run(
      /** @type {T} */
      value
    ), () => {
      subscribers.delete(subscriber), subscribers.size === 0 && stop && (stop(), stop = null);
    };
  }
  return __name(subscribe, "subscribe"), { set: set2, update, subscribe };
}
__name(writable, "writable");
function get(store) {
  let value;
  return subscribe_to_store(store, (_) => value = _)(), value;
}
__name(get, "get");
const rest_props_handler = {
  get(target, key) {
    if (!target.exclude.includes(key))
      return target.props[key];
  },
  set(target, key) {
    return !1;
  },
  getOwnPropertyDescriptor(target, key) {
    if (!target.exclude.includes(key) && key in target.props)
      return {
        enumerable: !0,
        configurable: !0,
        value: target.props[key]
      };
  },
  has(target, key) {
    return target.exclude.includes(key) ? !1 : key in target.props;
  },
  ownKeys(target) {
    return Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));
  }
};
// @__NO_SIDE_EFFECTS__
function rest_props(props, exclude, name) {
  return new Proxy(
    { props, exclude },
    rest_props_handler
  );
}
__name(rest_props, "rest_props");
const spread_props_handler = {
  get(target, key) {
    let i = target.props.length;
    for (; i--; ) {
      let p = target.props[i];
      if (is_function(p) && (p = p()), typeof p == "object" && p !== null && key in p) return p[key];
    }
  },
  set(target, key, value) {
    let i = target.props.length;
    for (; i--; ) {
      let p = target.props[i];
      is_function(p) && (p = p());
      const desc = get_descriptor(p, key);
      if (desc && desc.set)
        return desc.set(value), !0;
    }
    return !1;
  },
  getOwnPropertyDescriptor(target, key) {
    let i = target.props.length;
    for (; i--; ) {
      let p = target.props[i];
      if (is_function(p) && (p = p()), typeof p == "object" && p !== null && key in p) {
        const descriptor = get_descriptor(p, key);
        return descriptor && !descriptor.configurable && (descriptor.configurable = !0), descriptor;
      }
    }
  },
  has(target, key) {
    if (key === STATE_SYMBOL || key === LEGACY_PROPS) return !1;
    for (let p of target.props)
      if (is_function(p) && (p = p()), p != null && key in p) return !0;
    return !1;
  },
  ownKeys(target) {
    const keys = [];
    for (let p of target.props) {
      is_function(p) && (p = p());
      for (const key in p)
        keys.includes(key) || keys.push(key);
    }
    return keys;
  }
};
function spread_props(...props) {
  return new Proxy({ props }, spread_props_handler);
}
__name(spread_props, "spread_props");
function prop(props, key, flags, fallback) {
  var prop_value;
  prop_value = /** @type {V} */
  props[key];
  var fallback_value = (
    /** @type {V} */
    fallback
  ), fallback_dirty = !0, fallback_used = !1, get_fallback = /* @__PURE__ */ __name(() => (fallback_used = !0, fallback_dirty && (fallback_dirty = !1, fallback_value = /** @type {V} */
  fallback), fallback_value), "get_fallback"), getter;
  getter = /* @__PURE__ */ __name(() => {
    var value = (
      /** @type {V} */
      props[key]
    );
    return value === void 0 ? get_fallback() : (fallback_dirty = !0, fallback_used = !1, value);
  }, "getter");
  var from_child = !1, inner_current_value = /* @__PURE__ */ mutable_source(prop_value), current_value = /* @__PURE__ */ derived(() => {
    var parent_value = getter(), child_value = get$1(inner_current_value);
    return from_child ? (from_child = !1, child_value) : inner_current_value.v = parent_value;
  });
  return function(value, mutation) {
    if (arguments.length > 0) {
      const new_value = mutation ? get$1(current_value) : value;
      return current_value.equals(new_value) || (from_child = !0, set(inner_current_value, new_value), fallback_used && fallback_value !== void 0 && (fallback_value = new_value), untrack(() => get$1(current_value))), value;
    }
    return get$1(current_value);
  };
}
__name(prop, "prop");
function onMount(fn) {
  component_context === null && lifecycle_outside_component(), legacy_mode_flag && component_context.l !== null ? init_update_callbacks(component_context).m.push(fn) : user_effect(() => {
    const cleanup = untrack(fn);
    if (typeof cleanup == "function") return (
      /** @type {() => void} */
      cleanup
    );
  });
}
__name(onMount, "onMount");
function onDestroy(fn) {
  component_context === null && lifecycle_outside_component(), onMount(() => () => untrack(fn));
}
__name(onDestroy, "onDestroy");
function init_update_callbacks(context) {
  var l = (
    /** @type {ComponentContextLegacy} */
    context.l
  );
  return l.u ?? (l.u = { a: [], b: [], m: [] });
}
__name(init_update_callbacks, "init_update_callbacks");
function flushSync(fn) {
  flush_sync(fn);
}
__name(flushSync, "flushSync");
function increment(source2) {
  set(source2, source2.v + 1);
}
__name(increment, "increment");
function createSubscriber(start) {
  let subscribers = 0, version = source(0), stop;
  return () => {
    effect_tracking() && (get$1(version), render_effect(() => (subscribers === 0 && (stop = untrack(() => start(() => increment(version)))), subscribers += 1, () => {
      tick().then(() => {
        subscribers -= 1, subscribers === 0 && (stop == null || stop(), stop = void 0);
      });
    })));
  };
}
__name(createSubscriber, "createSubscriber");
function fromStore(store) {
  let value;
  const subscribe = createSubscriber((update) => {
    let ran = !1;
    const unsubscribe = store.subscribe((v) => {
      value = v, ran && update();
    });
    return ran = !0, unsubscribe;
  });
  function current() {
    return effect_tracking() ? (subscribe(), value) : get(store);
  }
  return __name(current, "current"), "set" in store ? {
    get current() {
      return current();
    },
    set current(v) {
      store.set(v);
    }
  } : {
    get current() {
      return current();
    }
  };
}
__name(fromStore, "fromStore");
const _SheetStore = class _SheetStore {
  static createDefaultData() {
    return {
      advancedState: !1,
      introPlayed: !1,
      headerOffsetY: 0,
      currentTheme: "",
      activeTabs: {},
      trackedHooks: {},
      tokenImageLock: !0,
      selectedTokenImage: "",
      // (#12)
      textLogEntries: [],
      customFlagsSortable: !1
    };
  }
  static init(key) {
    const store = get(_SheetStore.store);
    key in store || _SheetStore.store.update((s) => (s[key] || (s[key] = _SheetStore.createDefaultData()), s));
  }
  static get(key) {
    const store = get(_SheetStore.store);
    return key in store || untrack(() => _SheetStore.init(key)), fromStore(_SheetStore.store).current[key];
  }
  static set(key, value) {
    _SheetStore.store.update((store) => (store[key] || (store[key] = _SheetStore.createDefaultData()), store[key] = { ...store[key], ...value }, store));
  }
};
__name(_SheetStore, "SheetStore"), __publicField(_SheetStore, "store", writable({}));
let SheetStore = _SheetStore;
const _PilotStore = class _PilotStore {
  static createDefaultData() {
    return {
      bondQNAMode: !1,
      selectedMech: 0
    };
  }
  static init(key) {
    const store = get(_PilotStore.store);
    key in store || _PilotStore.store.update((s) => (s[key] || (s[key] = _PilotStore.createDefaultData()), s));
  }
  static get(key) {
    const store = get(_PilotStore.store);
    return key in store || untrack(() => _PilotStore.init(key)), fromStore(_PilotStore.store).current[key];
  }
  static set(key, value) {
    _PilotStore.store.update((store) => (store[key] || (store[key] = _PilotStore.createDefaultData()), store[key] = { ...store[key], ...value }, store));
  }
};
__name(_PilotStore, "PilotStore"), __publicField(_PilotStore, "store", writable({}));
let PilotStore = _PilotStore;
const _NPCStore = class _NPCStore {
  static createDefaultData() {
    return {
      pinnedTraits: [],
      pinnedSystems: [],
      pinnedTechs: [],
      pinnedReactions: []
    };
  }
  static init(key) {
    const store = get(_NPCStore.store);
    key in store || _NPCStore.store.update((s) => (s[key] || (s[key] = {
      ..._NPCStore.createDefaultData(),
      pinnedTraits: getPinnedTraits(key),
      pinnedSystems: getPinnedSystems(key),
      pinnedTechs: getPinnedTechs(key),
      pinnedReactions: getPinnedReactions(key)
    }), s));
  }
  static get(key) {
    const store = get(_NPCStore.store);
    return key in store || untrack(() => _NPCStore.init(key)), fromStore(_NPCStore.store).current[key];
  }
  static set(key, value) {
    _NPCStore.store.update((store) => (store[key] || (store[key] = _NPCStore.createDefaultData()), store[key] = { ...store[key], ...value }, value.pinnedTraits !== void 0 && setPinnedTraits(key, store[key].pinnedTraits), value.pinnedSystems !== void 0 && setPinnedSystems(key, store[key].pinnedSystems), value.pinnedTechs !== void 0 && setPinnedTechs(key, store[key].pinnedTechs), value.pinnedReactions !== void 0 && setPinnedReactions(key, store[key].pinnedReactions), store));
  }
};
__name(_NPCStore, "NPCStore"), __publicField(_NPCStore, "store", writable({}));
let NPCStore = _NPCStore;
function getActiveTab(uuid, tab) {
  return SheetStore.get(uuid).activeTabs[tab] ?? "";
}
__name(getActiveTab, "getActiveTab");
function setActiveTab(uuid, tab, value) {
  const tabs = SheetStore.get(uuid).activeTabs;
  tabs[tab] = value, SheetStore.set(uuid, { activeTabs: tabs });
}
__name(setActiveTab, "setActiveTab");
function getAdvancedState(uuid) {
  return SheetStore.get(uuid).advancedState;
}
__name(getAdvancedState, "getAdvancedState");
function setAdvancedState(uuid, enabled) {
  SheetStore.set(uuid, { advancedState: enabled });
}
__name(setAdvancedState, "setAdvancedState");
function getSelectedTokenImage(uuid) {
  return SheetStore.get(uuid).selectedTokenImage ?? "";
}
__name(getSelectedTokenImage, "getSelectedTokenImage");
function setSelectedTokenImage(uuid, value) {
  SheetStore.set(uuid, { selectedTokenImage: value });
}
__name(setSelectedTokenImage, "setSelectedTokenImage");
function getTokenImageLock(uuid) {
  return SheetStore.get(uuid).tokenImageLock ?? !0;
}
__name(getTokenImageLock, "getTokenImageLock");
function setTokenImageLock(uuid, value) {
  SheetStore.set(uuid, { tokenImageLock: value });
}
__name(setTokenImageLock, "setTokenImageLock");
function getCustomFlagsSortable(uuid) {
  return SheetStore.get(uuid).customFlagsSortable;
}
__name(getCustomFlagsSortable, "getCustomFlagsSortable");
function setCustomFlagsSortable(uuid, enabled) {
  SheetStore.set(uuid, { customFlagsSortable: enabled });
}
__name(setCustomFlagsSortable, "setCustomFlagsSortable");
function getLocalized(keys, separator) {
  return Array.isArray(keys) ? keys.map((k) => foundry.applications.handlebars.localize(k, {})).join("<br><br>") : foundry.applications.handlebars.localize(keys, {});
}
__name(getLocalized, "getLocalized");
function photosensitiveStyling(text2) {
  return game.settings.get("core", "photosensitiveMode") ? "" : text2;
}
__name(photosensitiveStyling, "photosensitiveStyling");
function logographicLanguage() {
  return ["zh-TW", "zh-CN", "ja-JP"].includes(game.settings.get("core", "language"));
}
__name(logographicLanguage, "logographicLanguage");
function randomExtension() {
  const extensions = [".exe", ".bat", ".cmd", ".sh", ".bash", ".zsh", ".ksh", ".csh"], randomIndex = Math.floor(Math.random() * extensions.length);
  return extensions[randomIndex];
}
__name(randomExtension, "randomExtension");
function logData(path, options) {
  const data = resolveHelperDotpath(options, path);
  Logger.log("Data received", data);
}
__name(logData, "logData");
function logConsole(data, _options) {
  console.log(data);
}
__name(logConsole, "logConsole");
function isLoading(item) {
  var _a, _b;
  return ((_a = item.system.all_tags) == null ? void 0 : _a.some((t) => t.is_loading)) || ((_b = item.system.tags) == null ? void 0 : _b.some((t) => t.is_loading));
}
__name(isLoading, "isLoading");
function isRecharge(item) {
  var _a, _b;
  return ((_a = item.system.all_tags) == null ? void 0 : _a.some((t) => t.is_recharge)) || ((_b = item.system.tags) == null ? void 0 : _b.some((t) => t.is_recharge));
}
__name(isRecharge, "isRecharge");
function formatString(template2, ...values) {
  return template2.replace(/{(\d+)}/g, (match, number) => typeof values[number] < "u" ? values[number] : match);
}
__name(formatString, "formatString");
function getFoundryVersion(split = !1) {
  return split ? game.release.version.split(".") : game.release.version;
}
__name(getFoundryVersion, "getFoundryVersion");
function getLancerVersion(split = !1) {
  return split ? game.system.version.split(".") : game.system.version;
}
__name(getLancerVersion, "getLancerVersion");
function getModuleVersion(split = !1) {
  return split ? game.modules.get(LancerAlternative.Name).version.split(".") : game.modules.get(LancerAlternative.Name).version;
}
__name(getModuleVersion, "getModuleVersion");
const dataMap = {};
function forwardData(data, _options) {
  dataMap[data.actor.uuid] = data;
}
__name(forwardData, "forwardData");
function handleRelativeDataInput(event2, previous) {
  var _a;
  event2.preventDefault();
  const inputValue = (_a = event2.target) == null ? void 0 : _a.value;
  let newValue = previous;
  inputValue && (inputValue.startsWith("+") ? newValue = previous + Number(inputValue.slice(1)) : inputValue.startsWith("-") ? newValue = previous - Number(inputValue.slice(1)) : newValue = Number(inputValue), Number.isNaN(newValue) && (newValue = previous)), event2.currentTarget.value = newValue.toString(), event2.currentTarget.blur();
}
__name(handleRelativeDataInput, "handleRelativeDataInput");
function isValidVideoContainer(path) {
  var _a;
  const validTypes = ["webm", "mp4", "m4v"], extension = (_a = path.split(".").pop()) == null ? void 0 : _a.toLowerCase();
  return validTypes.includes(extension ?? "");
}
__name(isValidVideoContainer, "isValidVideoContainer");
function getVideoMimeType(path) {
  var _a;
  const validTypes = ["webm", "mp4", "m4v"], extension = (_a = path.split(".").pop()) == null ? void 0 : _a.toLowerCase();
  return extension && validTypes.includes(extension) ? `video/${extension === "m4v" ? "mp4" : extension}` : null;
}
__name(getVideoMimeType, "getVideoMimeType");
function isValidImageContainer(path) {
  var _a;
  const validTypes = ["avif", "jpg", "jpeg", "png", "svg", "webp", "gif"], extension = (_a = path.split(".").pop()) == null ? void 0 : _a.toLowerCase();
  return validTypes.includes(extension ?? "");
}
__name(isValidImageContainer, "isValidImageContainer");
function browseTokenImage(event2, actor) {
  event2.stopPropagation(), new FilePicker({
    current: actor.prototypeToken.texture.src,
    type: "imagevideo",
    callback: /* @__PURE__ */ __name((path) => {
      SheetStore.get(actor.uuid).selectedTokenImage = path, actor.update({
        "prototypeToken.texture.src": path
      });
    }, "callback")
  }).render(!0);
}
__name(browseTokenImage, "browseTokenImage");
function browseActorImage(event2, actor) {
  event2.stopPropagation(), new FilePicker({
    current: actor.img,
    type: "image",
    callback: /* @__PURE__ */ __name((path) => {
      actor.update({
        img: path
      });
    }, "callback")
  }).render(!0);
}
__name(browseActorImage, "browseActorImage");
function browseActorImageSync(event2, actor) {
  event2.stopPropagation(), new FilePicker({
    current: actor.img,
    type: "image",
    callback: /* @__PURE__ */ __name((path) => {
      SheetStore.get(actor.uuid).selectedTokenImage = path, actor.update({
        img: path,
        "prototypeToken.texture.src": path
      });
    }, "callback")
  }).render(!0);
}
__name(browseActorImageSync, "browseActorImageSync");
function getCurrentOvercharge(actor) {
  const overchargeSequence = actor.system.overcharge_sequence.split(","), overchargeStage = actor.system.overcharge;
  return overchargeSequence[overchargeStage];
}
__name(getCurrentOvercharge, "getCurrentOvercharge");
function handleOverchargeIncrease(event2, actor) {
  event2.stopPropagation();
  const overchargeStage = actor.system.overcharge, overchargeSequence = actor.system.overcharge_sequence.split(",");
  actor.update({
    "system.overcharge": Math.min(overchargeStage + 1, overchargeSequence.length - 1)
  });
}
__name(handleOverchargeIncrease, "handleOverchargeIncrease");
function handleOverchargeDecrease(event2, actor) {
  event2.stopPropagation();
  const overchargeStage = actor.system.overcharge;
  actor.update({
    "system.overcharge": Math.max(overchargeStage - 1, 0)
  });
}
__name(handleOverchargeDecrease, "handleOverchargeDecrease");
async function handleToggleImageSync(event2, actor, setState) {
  const lockState = getTokenImageLock(actor.uuid);
  event2.stopPropagation(), lockState ? (setTokenImageLock(actor.uuid, !lockState), setState(actor.uuid, !lockState)) : await foundry.applications.api.DialogV2.confirm({
    window: { title: getLocalized("LA.confirm") },
    content: getLocalized("LA.advanced.link.subLabel")
  }) && (setTokenImageLock(actor.uuid, !lockState), setState(actor.uuid, !lockState), isValidImageContainer(actor.prototypeToken.texture.src) && actor.update({
    img: actor.prototypeToken.texture.src
  }));
}
__name(handleToggleImageSync, "handleToggleImageSync");
function handleEditToken(event2, actor) {
  event2.stopPropagation(), getTokenImageLock(actor.uuid) ? browseActorImageSync(event2, actor) : browseTokenImage(event2, actor);
}
__name(handleEditToken, "handleEditToken");
var TextConsoleHook = /* @__PURE__ */ ((TextConsoleHook2) => (TextConsoleHook2.MechHeader = "laMechHeaderLog", TextConsoleHook2.MechHeaderReset = "laMechHeaderLogReset", TextConsoleHook2.PilotHeader = "laPilotHeaderLog", TextConsoleHook2.PilotHeaderReset = "laPilotHeaderLogReset", TextConsoleHook2))(TextConsoleHook || {}), TextLogHook = /* @__PURE__ */ ((TextLogHook2) => (TextLogHook2.MechLog = "laMechLog", TextLogHook2.MechLogReset = "laMechLogReset", TextLogHook2.PilotLog = "laPilotLog", TextLogHook2.PilotLogReset = "laPilotLogReset", TextLogHook2))(TextLogHook || {});
function setIntroRun(uuid, enabled) {
  SheetStore.set(uuid, { introPlayed: enabled });
}
__name(setIntroRun, "setIntroRun");
function getIntroRun(uuid) {
  var _a;
  return (_a = SheetStore.get(uuid)) == null ? void 0 : _a.introPlayed;
}
__name(getIntroRun, "getIntroRun");
function getTextLogEntries(uuid) {
  var _a;
  return ((_a = SheetStore.get(uuid)) == null ? void 0 : _a.textLogEntries) ?? [];
}
__name(getTextLogEntries, "getTextLogEntries");
function sendToTextConsole(event2, text2, uuid) {
  event2.stopPropagation(), Hooks.call(TextConsoleHook.MechHeader, text2, uuid), Hooks.call(TextConsoleHook.PilotHeader, text2, uuid);
}
__name(sendToTextConsole, "sendToTextConsole");
function resetTextConsole(event2, uuid) {
  event2.stopPropagation(), Hooks.call(TextConsoleHook.MechHeaderReset, uuid), Hooks.call(TextConsoleHook.PilotHeaderReset, uuid);
}
__name(resetTextConsole, "resetTextConsole");
function sendToTextLog(text2, uuid, glitchy) {
  SheetStore.set(uuid, { textLogEntries: [...SheetStore.get(uuid).textLogEntries, { text: text2, glitchy }] }), Hooks.call(TextLogHook.MechLog, text2, uuid, glitchy), Hooks.call(TextLogHook.PilotLog, text2, uuid, glitchy);
}
__name(sendToTextLog, "sendToTextLog");
function resetTextLog(uuid, all = !1) {
  SheetStore.set(uuid, { textLogEntries: [] }), Hooks.call(TextLogHook.MechLogReset, uuid, all), Hooks.call(TextLogHook.PilotLogReset, uuid, all);
}
__name(resetTextLog, "resetTextLog");
var ThemeKey = /* @__PURE__ */ ((ThemeKey2) => (ThemeKey2.GMS = "gms", ThemeKey2.GMSDark = "gmsDark", ThemeKey2.MSMC = "msmc", ThemeKey2.GALSIM = "gal", ThemeKey2.HORUS = "horus", ThemeKey2.HA = "ha", ThemeKey2.SSC = "ssc", ThemeKey2.IPSN = "ipsn", ThemeKey2))(ThemeKey || {}), ThemeValue = /* @__PURE__ */ ((ThemeValue2) => (ThemeValue2.GMS = "la-gms", ThemeValue2.GMSDark = "la-gmsdark", ThemeValue2.MSMC = "la-msmc", ThemeValue2.GALSIM = "la-galsim", ThemeValue2.HORUS = "la-horus", ThemeValue2.HA = "la-ha", ThemeValue2.SSC = "la-ssc", ThemeValue2.IPSN = "la-ipsn", ThemeValue2))(ThemeValue || {});
function slugify(name, dash = "_") {
  return name.trim().replace(/[:\\\/-\s]+/g, dash).toLowerCase();
}
__name(slugify, "slugify");
const THEME_MAP = {
  [ThemeKey.GMS]: ThemeValue.GMS,
  [ThemeKey.GMSDark]: ThemeValue.GMSDark,
  [ThemeKey.MSMC]: ThemeValue.MSMC,
  [ThemeKey.GALSIM]: ThemeValue.GALSIM,
  [ThemeKey.HORUS]: ThemeValue.HORUS,
  [ThemeKey.HA]: ThemeValue.HA,
  [ThemeKey.SSC]: ThemeValue.SSC,
  [ThemeKey.IPSN]: ThemeValue.IPSN
}, LIGHT_MAP = {
  [ThemeKey.GMS]: "light",
  [ThemeKey.GMSDark]: "dark",
  [ThemeKey.MSMC]: "dark",
  [ThemeKey.GALSIM]: "dark",
  [ThemeKey.HORUS]: "dark",
  [ThemeKey.HA]: "dark",
  [ThemeKey.SSC]: "light",
  [ThemeKey.IPSN]: "light"
}, THEME_LOCALIZE_MAP = {
  [ThemeKey.GMS]: "LA.advanced.theme.gms.label",
  [ThemeKey.GMSDark]: "LA.advanced.theme.gmsDark.label",
  [ThemeKey.MSMC]: "LA.advanced.theme.msmc.label",
  [ThemeKey.GALSIM]: "LA.advanced.theme.galsim.label",
  [ThemeKey.HORUS]: "LA.advanced.theme.horus.label",
  [ThemeKey.HA]: "LA.advanced.theme.ha.label",
  [ThemeKey.SSC]: "LA.advanced.theme.ssc.label",
  [ThemeKey.IPSN]: "LA.advanced.theme.ipsn.label"
}, THEME_LOCALIZE_HISTORY_MAP = {
  [ThemeKey.GMS]: "LA.pilot.history.gms",
  [ThemeKey.GMSDark]: "LA.pilot.history.gms",
  [ThemeKey.MSMC]: "LA.pilot.history.msmc",
  [ThemeKey.GALSIM]: "LA.pilot.history.gms",
  [ThemeKey.HORUS]: "LA.pilot.history.horus",
  [ThemeKey.HA]: "LA.pilot.history.ha",
  [ThemeKey.SSC]: "LA.pilot.history.ssc",
  [ThemeKey.IPSN]: "LA.pilot.history.ipsn"
};
function convertToCSSTheme(key) {
  return THEME_MAP[key];
}
__name(convertToCSSTheme, "convertToCSSTheme");
function getCSSDocumentTheme(uuid) {
  const { currentTheme } = SheetStore.get(uuid);
  return currentTheme ? THEME_MAP[currentTheme] : getCSSSystemTheme();
}
__name(getCSSDocumentTheme, "getCSSDocumentTheme");
function getCSSSystemTheme() {
  const currentTheme = game.settings.get("lancer", "uiTheme");
  return THEME_MAP[currentTheme];
}
__name(getCSSSystemTheme, "getCSSSystemTheme");
function getBrightness(theme) {
  const selectedTheme = theme || game.settings.get("lancer", "uiTheme");
  return LIGHT_MAP[selectedTheme];
}
__name(getBrightness, "getBrightness");
function getThemeName(theme) {
  const selectedTheme = theme || game.settings.get("lancer", "uiTheme");
  return getLocalized(THEME_LOCALIZE_MAP[selectedTheme]);
}
__name(getThemeName, "getThemeName");
function getThemeHistoryLabel(theme) {
  const selectedTheme = theme || game.settings.get("lancer", "uiTheme");
  return getLocalized(THEME_LOCALIZE_HISTORY_MAP[selectedTheme]);
}
__name(getThemeHistoryLabel, "getThemeHistoryLabel");
function getManufacturerColor(key, type) {
  let manufacturer = slugify(key, "-");
  return ["gms", "ips-n", "ipsn", "ssc", "horus", "ha", "msmc", "galsim"].includes(manufacturer) || (manufacturer = "primary"), manufacturer === "ips-n" && (manufacturer = "ipsn"), manufacturer === "gmsdark" && (manufacturer = "gms"), `la-${type}-${manufacturer}`;
}
__name(getManufacturerColor, "getManufacturerColor");
function applyThemeTo(html2, theme) {
  const selectedTheme = theme || game.settings.get("lancer", "uiTheme"), themeClasses = Object.values(THEME_MAP);
  html2.removeClass(themeClasses.join(" ")).addClass(THEME_MAP[selectedTheme]);
}
__name(applyThemeTo, "applyThemeTo");
function trackHook(uuid, key, value) {
  const hooks = SheetStore.get(uuid).trackedHooks;
  hooks[key] = value, SheetStore.set(uuid, { trackedHooks: hooks });
}
__name(trackHook, "trackHook");
function unregisterTrackedHooks(uuid) {
  const hooks = SheetStore.get(uuid).trackedHooks;
  for (const [key, value] of Object.entries(hooks))
    Hooks.off(value, Number(key));
  SheetStore.set(uuid, { trackedHooks: {} });
}
__name(unregisterTrackedHooks, "unregisterTrackedHooks");
function getThemeKey(uuid) {
  return SheetStore.get(uuid).currentTheme;
}
__name(getThemeKey, "getThemeKey");
function setThemeKey(uuid, theme) {
  SheetStore.set(uuid, { currentTheme: theme });
}
__name(setThemeKey, "setThemeKey");
var ActiveTab = /* @__PURE__ */ ((ActiveTab2) => (ActiveTab2.Primary = "primary", ActiveTab2.Secondary = "secondary", ActiveTab2.Tertiary = "tertiary", ActiveTab2.Quaternary = "quaternary", ActiveTab2))(ActiveTab || {});
const PUBLIC_VERSION = "5";
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION);
function Tooltip($$anchor, $$props) {
  var fragment = comment(), node = first_child(fragment);
  snippet(node, () => $$props.content), append($$anchor, fragment);
}
__name(Tooltip, "Tooltip");
const _TooltipFactory = class _TooltipFactory {
  // CSS classes need to be applied via the `data-tooltip-class` attribute
  static buildTooltip(text2, header) {
    return `
            ${header ? `<div class="la-bckg-primary -fontface-stylized -fontsize4 -upper -padding0">${header}</div>` : ""}
            <div class="la-tooltip__content -fontface-neutral">
                ${text2}
            </div>
        `;
  }
  // (#5) Locked tooltips (and potentially all tooltips created through the manager) do not 
  // work with modules such as PopOut! A custom solution would have to be rolled out
  static renderTooltip(event2, tooltipSettings) {
    const manager = game.tooltip, options = {};
    tooltipSettings.direction && (options.direction = tooltipSettings.direction), tooltipSettings.text && (options.text = tooltipSettings.text), tooltipSettings.html && (options.html = tooltipSettings.html), tooltipSettings.locked && (options.locked = tooltipSettings.locked), tooltipSettings.cssClass && (options.cssClass = tooltipSettings.cssClass), manager.activate(event2.currentTarget, options);
  }
  // (#5)
  static renderTooltipSvelte(event2, props, tooltipSettings) {
    const manager = game.tooltip, mountDiv = document.createElement("div");
    mountDiv.className = "la-tooltip-mount -widthfull", mount(
      Tooltip,
      {
        target: mountDiv,
        props
      }
    );
    const options = {
      content: mountDiv
    };
    tooltipSettings.direction && (options.direction = tooltipSettings.direction), tooltipSettings.locked && (options.locked = tooltipSettings.locked), tooltipSettings.cssClass && (options.cssClass = tooltipSettings.cssClass), manager.activate(event2.currentTarget, options);
    const root2 = mountDiv.parentElement, observer = new MutationObserver((mutations) => {
      mutations.forEach((mutation) => {
        var _a;
        root2 && Array.from(mutation.removedNodes).includes(root2) && (observer.disconnect(), (_a = props.unrenderCallback) == null || _a.call(props));
      });
    });
    return root2 && root2.parentNode && observer.observe(root2.parentNode, { childList: !0 }), root2;
  }
  static unrenderTooltip(element) {
    if (!element)
      return;
    game.tooltip.dismissLockedTooltip(element);
  }
  static unrenderTooltips() {
    game.tooltip.dismissLockedTooltips();
  }
};
__name(_TooltipFactory, "TooltipFactory");
let TooltipFactory = _TooltipFactory;
var TooltipDirection = /* @__PURE__ */ ((TooltipDirection2) => (TooltipDirection2.UP = "UP", TooltipDirection2.DOWN = "DOWN", TooltipDirection2.LEFT = "LEFT", TooltipDirection2.RIGHT = "RIGHT", TooltipDirection2.CENTER = "CENTER", TooltipDirection2.TOP = "TOP", TooltipDirection2))(TooltipDirection || {}), FlowClass = /* @__PURE__ */ ((FlowClass2) => (FlowClass2.Standard = "lancer-flow-button", FlowClass2.RollAttack = "roll-attack", FlowClass2.RollDamage = "roll-damage", FlowClass2.RollStat = "roll-stat", FlowClass2.RollHASE = "roll-stat hase", FlowClass2.RollTech = "roll-tech", FlowClass2.SendToChat = "chat-flow-button", FlowClass2.SendEffectToChat = "effect-flow", FlowClass2.ResetOvercharge = "overcharge-reset", FlowClass2.CoreActivation = "activation-flow", FlowClass2.RechargeFeatures = "charge-macro", FlowClass2.ContextMenu = "lancer-context-menu", FlowClass2.ContextItem = "lancer-context-item", FlowClass2.Skill = "skill-flow", FlowClass2.GeneralControl = "gen-control", FlowClass2.BondPower = "bond-power-flow", FlowClass2.BondTallyXP = "bond-xp-button", FlowClass2.BondPowerRefresh = "refresh-powers-button", FlowClass2.DownloadFromCloud = "cloud-control", FlowClass2.EditText = "popout-text-edit-button", FlowClass2.DeleteActiveEffect = "", FlowClass2.Inventory = "", FlowClass2.None = "NO_FLOW_CLASS", FlowClass2))(FlowClass || {}), CustomFlowClass = /* @__PURE__ */ ((CustomFlowClass2) => (CustomFlowClass2.SendUnknownToChat = "SendUnknownToChat", CustomFlowClass2.RunMacro = "RunMacro", CustomFlowClass2.SkillTriggerOther = "SkillTriggerOther", CustomFlowClass2))(CustomFlowClass || {}), TextLogIntro = /* @__PURE__ */ ((TextLogIntro2) => (TextLogIntro2[TextLogIntro2.Version = 0] = "Version", TextLogIntro2[TextLogIntro2.Header = 1] = "Header", TextLogIntro2[TextLogIntro2.Log = 2] = "Log", TextLogIntro2))(TextLogIntro || {});
const ACTOR_CONTEXT = Symbol("actor");
function setActorContext(actor) {
  setContext(ACTOR_CONTEXT, actor);
}
__name(setActorContext, "setActorContext");
function getActorContext() {
  return getContext(ACTOR_CONTEXT);
}
__name(getActorContext, "getActorContext");
function buildActorContext(actor) {
  return /* @__PURE__ */ new Map([[ACTOR_CONTEXT, actor]]);
}
__name(buildActorContext, "buildActorContext");
const FLOW_BUTTON_STYLE = " -padding1-r -padding0-tb -height5 -letterspacing0 la-text-header la-prmy-header ";
var root_1$I = /* @__PURE__ */ template('<span class="la-cmdline -bold -fadein">>//:</span>'), root_3$H = /* @__PURE__ */ template('<span class="la-extension -fontface-stylized -lower -fadein"> </span>'), root_4$i = /* @__PURE__ */ template('<span class="la-cursor -fontface-stylized -fadein"></span>'), root$$ = /* @__PURE__ */ template("<div><!><span><!> </span><!><!></div>");
function TerminalText($$anchor, $$props) {
  push($$props, !0);
  var div = root$$(), node = child(div);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var span = root_1$I();
      append($$anchor2, span);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.disableCmdline || $$render(consequent);
    });
  }
  var span_1 = sibling(node), node_1 = child(span_1);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment = comment(), node_2 = first_child(fragment);
      snippet(node_2, () => $$props.children), append($$anchor2, fragment);
    }, "consequent_1");
    if_block(node_1, ($$render) => {
      $$props.children && $$render(consequent_1);
    });
  }
  var text_1 = sibling(node_1, 1, !0), node_3 = sibling(span_1);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      var span_2 = root_3$H(), text_2 = child(span_2);
      template_effect(($0) => set_text(text_2, $0), [
        () => $$props.extensionText || `--${getLocalized("LA.scan.label")}`
      ]), append($$anchor2, span_2);
    }, "consequent_2");
    if_block(node_3, ($$render) => {
      $$props.disableExtension || $$render(consequent_2);
    });
  }
  var node_4 = sibling(node_3);
  {
    var consequent_3 = /* @__PURE__ */ __name(($$anchor2) => {
      var span_3 = root_4$i();
      append($$anchor2, span_3);
    }, "consequent_3");
    if_block(node_4, ($$render) => {
      $$props.disableCursor || $$render(consequent_3);
    });
  }
  template_effect(
    ($0) => {
      set_class(div, `la-terminaltext -whitespacenowrap -textoverflowellipsis -textalignleft
        ${$0 ?? ""}`), set_text(text_1, $$props.text);
    },
    [() => {
      var _a;
      return (_a = $$props.textStyle) == null ? void 0 : _a.join(" ");
    }]
  ), append($$anchor, div), pop();
}
__name(TerminalText, "TerminalText");
const _DEFAULT_BUTTON$1 = "-fontsize5", _DEFAULT_I = "-fontsize7 la-text-header";
var on_click$7 = /* @__PURE__ */ __name((event2, toggleAdvancedOptions) => toggleAdvancedOptions(event2), "on_click$7"), root_1$H = /* @__PURE__ */ template('<button type="button"><i></i></button>');
function AdvancedButton($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid;
  let advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState($$props.uuid));
  const tip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip($$props.tooltip || getLocalized("LA.advanced.tooltip"), $$props.tooltipHeader)), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.advanced.tooltip"));
  function toggleAdvancedOptions(event2) {
    event2.stopPropagation(), setAdvancedState($$props.uuid, !get$1(advancedOptions));
  }
  __name(toggleAdvancedOptions, "toggleAdvancedOptions");
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var button = root_1$H();
      button.__click = [on_click$7, toggleAdvancedOptions];
      var i = child(button);
      template_effect(
        ($0, $1, $2) => {
          set_class(button, $0), set_attribute(button, "aria-label", $1), set_attribute(button, "data-tooltip", $$props.tooltipEnabled ? get$1(tip) : void 0), set_attribute(button, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(button, "data-tooltip-direction", $$props.tooltipDirection || TooltipDirection.LEFT), set_class(i, `mdi ${$2 ?? ""}
        ${(get$1(advancedOptions) ? "mdi-toggle-switch" : "mdi-toggle-switch-off") ?? ""}`);
        },
        [
          () => {
            var _a2;
            return ((_a2 = $$props.style) == null ? void 0 : _a2.join(" ")) || _DEFAULT_BUTTON$1;
          },
          () => getLocalized("LA.advanced.tooltip"),
          () => {
            var _a2;
            return ((_a2 = $$props.iconStyle) == null ? void 0 : _a2.join(" ")) || _DEFAULT_I;
          }
        ]
      ), event("pointerenter", button, function(...$$args) {
        var _a2;
        (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), event("pointerleave", button, function(...$$args) {
        var _a2;
        (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), append($$anchor2, button);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.uuid && $$render(consequent);
    });
  }
  append($$anchor, fragment), pop();
}
__name(AdvancedButton, "AdvancedButton");
delegate(["click"]);
var on_pointerdown = /* @__PURE__ */ __name((event2, handlePointerDown) => handlePointerDown(event2), "on_pointerdown"), on_pointermove = /* @__PURE__ */ __name((event2, handlePointerMove) => handlePointerMove(event2), "on_pointermove"), root$_ = /* @__PURE__ */ template('<div class="la-boundimage -flex1 -heightfull"><!> <img></div>');
function BoundImage($$anchor, $$props) {
  push($$props, !0);
  let advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState($$props.uuid));
  function resetLocalState() {
    get$1(position).x = 0, get$1(position).y = 0, set(width, 0);
  }
  __name(resetLocalState, "resetLocalState");
  let dragging = !1, offset = { x: 0, y: 0 }, position = state(proxy({
    x: $$props.xGetter ? $$props.xGetter($$props.uuid) : 0,
    y: $$props.yGetter ? $$props.yGetter($$props.uuid) : 0
  }));
  function handlePointerDown(event2) {
    get$1(advancedOptions) && (dragging = !0, offset = {
      x: event2.clientX - get$1(position).x,
      y: event2.clientY - get$1(position).y
    });
  }
  __name(handlePointerDown, "handlePointerDown");
  function handlePointerMove(event2) {
    dragging && set(position, proxy({
      x: event2.clientX - offset.x,
      y: event2.clientY - offset.y
    }));
  }
  __name(handlePointerMove, "handlePointerMove");
  function handlePointerUp(_event, callback) {
    dragging && callback && callback(), dragging = !1;
  }
  __name(handlePointerUp, "handlePointerUp");
  function handleAssignment(event2) {
    handlePointerUp(event2, () => {
      $$props.xySetter && $$props.xySetter($$props.uuid, get$1(position).x, get$1(position).y), $$props.ySetter && $$props.ySetter($$props.uuid, get$1(position).y), $$props.xSetter && $$props.xSetter($$props.uuid, get$1(position).x);
    });
  }
  __name(handleAssignment, "handleAssignment");
  let containerElement = state(void 0), width = state(proxy($$props.widthGetter ? $$props.widthGetter($$props.uuid) : 0)), saveTimeout;
  function debouncedSave() {
    saveTimeout && clearTimeout(saveTimeout), saveTimeout = setTimeout(
      () => {
        $$props.widthSetter && $$props.widthSetter($$props.uuid, get$1(width)), saveTimeout = void 0;
      },
      400
    );
  }
  __name(debouncedSave, "debouncedSave");
  let pinchStartDist = 0, pinchStartWidth = 0;
  function getTouchDist(touches) {
    const dx = touches[1].clientX - touches[0].clientX, dy = touches[1].clientY - touches[0].clientY;
    return Math.sqrt(dx * dx + dy * dy);
  }
  __name(getTouchDist, "getTouchDist"), onMount(() => {
    if (!get$1(containerElement)) return;
    $$props.widthGetter && get$1(width) === 0 && set(width, proxy(get$1(containerElement).offsetWidth));
    const onWheel = /* @__PURE__ */ __name((event2) => {
      !get$1(advancedOptions) || !$$props.widthSetter || (event2.preventDefault(), set(width, proxy(Math.max(50, get$1(width) - event2.deltaY * 0.5))), debouncedSave());
    }, "onWheel"), onTouchStart = /* @__PURE__ */ __name((event2) => {
      !get$1(advancedOptions) || !$$props.widthSetter || event2.touches.length !== 2 || (event2.preventDefault(), pinchStartDist = getTouchDist(event2.touches), pinchStartWidth = get$1(width));
    }, "onTouchStart"), onTouchMove = /* @__PURE__ */ __name((event2) => {
      if (!get$1(advancedOptions) || !$$props.widthSetter || event2.touches.length !== 2) return;
      event2.preventDefault();
      const scale = getTouchDist(event2.touches) / pinchStartDist;
      set(width, proxy(Math.max(50, Math.round(pinchStartWidth * scale))));
    }, "onTouchMove"), onTouchEnd = /* @__PURE__ */ __name(() => {
      !get$1(advancedOptions) || !$$props.widthSetter || (saveTimeout && clearTimeout(saveTimeout), $$props.widthSetter($$props.uuid, get$1(width)));
    }, "onTouchEnd");
    return get$1(containerElement).addEventListener("wheel", onWheel, { passive: !1 }), get$1(containerElement).addEventListener("touchstart", onTouchStart, { passive: !1 }), get$1(containerElement).addEventListener("touchmove", onTouchMove, { passive: !1 }), get$1(containerElement).addEventListener("touchend", onTouchEnd), () => {
      var _a, _b, _c, _d;
      saveTimeout && clearTimeout(saveTimeout), (_a = get$1(containerElement)) == null || _a.removeEventListener("wheel", onWheel), (_b = get$1(containerElement)) == null || _b.removeEventListener("touchstart", onTouchStart), (_c = get$1(containerElement)) == null || _c.removeEventListener("touchmove", onTouchMove), (_d = get$1(containerElement)) == null || _d.removeEventListener("touchend", onTouchEnd);
    };
  });
  var div = root$_(), node = child(div);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment = comment(), node_1 = first_child(fragment);
      snippet(node_1, () => $$props.children), append($$anchor2, fragment);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.children && $$render(consequent);
    });
  }
  var img = sibling(node, 2);
  return set_attribute(img, "alt", `modules/${id}/assets/nodata.png`), img.__pointerdown = [on_pointerdown, handlePointerDown], img.__pointermove = [on_pointermove, handlePointerMove], img.__pointerup = handleAssignment, set_attribute(img, "draggable", !1), bind_this(div, ($$value) => set(containerElement, $$value), () => get$1(containerElement)), template_effect(() => {
    set_attribute(div, "style", get$1(width) > 0 ? `width: ${get$1(width)}px;` : "width: 100%;"), set_class(img, `la-boundimage__image -heightfull -overflowhidden -float-r
            ${(get$1(advancedOptions) ? "-pointermove" : "") ?? ""}`), set_attribute(img, "src", $$props.image), set_attribute(img, "style", `
            margin-top: ${($$props.xySetter || $$props.ySetter ? get$1(position).y : 0) ?? ""}px;
            margin-right: ${($$props.xySetter || $$props.xSetter ? -get$1(position).x : 0) ?? ""}px;
            mask-image: linear-gradient(to bottom, black calc(6.6rem - ${get$1(position).y ?? ""}px), transparent calc(10rem - ${get$1(position).y ?? ""}px));
            -webkit-mask-image: linear-gradient(to bottom, black calc(6.6rem - ${get$1(position).y ?? ""}px), transparent calc(10rem - ${get$1(position).y ?? ""}px));
            -moz-mask-image: linear-gradient(to bottom, black calc(6.6rem - ${get$1(position).y ?? ""}px), transparent calc(10rem - ${get$1(position).y ?? ""}px));`);
  }), event("pointerleave", img, handleAssignment), append($$anchor, div), pop({ resetLocalState });
}
__name(BoundImage, "BoundImage");
delegate(["pointerdown", "pointermove", "pointerup"]);
const GLITCHY_CLASS = "horus--subtle";
function escapeHtml(text2) {
  return text2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
}
__name(escapeHtml, "escapeHtml");
const _TextWriter = class _TextWriter {
  constructor(el, options = {}) {
    __publicField(this, "element");
    __publicField(this, "queue", []);
    __publicField(this, "running", !1);
    __publicField(this, "timer", null);
    __publicField(this, "committedHTML", "");
    __publicField(this, "currentSegment", "");
    __publicField(this, "currentSegmentClass");
    __publicField(this, "showCursor");
    __publicField(this, "cursorChar");
    __publicField(this, "defaultSpeed");
    this.element = el, this.showCursor = options.cursor ?? !1, this.cursorChar = options.cursorChar ?? "_", this.defaultSpeed = options.speed ?? 25;
  }
  type(text2, options = {}) {
    return options.delay && this.queue.push({ kind: "pause", ms: options.delay }), this.queue.push({ kind: "type", text: text2, charDelay: this.defaultSpeed, pos: 0, className: options.className }), this;
  }
  break() {
    return this.queue.push({ kind: "break" }), this;
  }
  pause(ms) {
    return this.queue.push({ kind: "pause", ms }), this;
  }
  start() {
    this.running || (this.running = !0, this.processNext());
  }
  resetAll() {
    this.reset("");
  }
  reset(html2) {
    this.timer !== null && (clearTimeout(this.timer), this.timer = null), this.running = !1, this.queue = [], this.committedHTML = html2, this.currentSegment = "", this.currentSegmentClass = void 0, this.render();
  }
  setHTML(html2) {
    this.committedHTML = html2, this.currentSegment = "", this.currentSegmentClass = void 0, this.render();
  }
  // Queued rather than applied immediately, so it can't race with an in-progress typewriter
  // animation (a direct/synchronous commit here would stomp on whatever the queue is mid-typing).
  appendHTML(html2) {
    return this.queue.push({ kind: "append", html: html2 }), this;
  }
  render() {
    const content = this.committedHTML + (this.currentSegment ? `<span${this.classAttr(this.currentSegmentClass)}>${escapeHtml(this.currentSegment)}</span>` : ""), cursor = this.showCursor ? `<span class="la-textlog__cursor">${this.cursorChar}</span>` : "";
    this.element.innerHTML = content + cursor;
  }
  classAttr(className) {
    return className ? ` class="${className}"` : "";
  }
  processNext() {
    if (!this.running || this.queue.length === 0) {
      this.running = !1;
      return;
    }
    const item = this.queue[0];
    switch (item.kind) {
      case "type": {
        if (item.text.length === 0) {
          this.queue.shift(), this.processNext();
          break;
        }
        this.currentSegment += item.text[item.pos++], this.currentSegmentClass = item.className, this.render(), item.pos >= item.text.length && this.queue.shift(), this.timer = setTimeout(() => this.processNext(), item.charDelay);
        break;
      }
      case "pause": {
        this.queue.shift(), this.timer = setTimeout(() => this.processNext(), item.ms);
        break;
      }
      case "break": {
        this.queue.shift(), this.currentSegment ? (this.committedHTML += `<span${this.classAttr(this.currentSegmentClass)}>${escapeHtml(this.currentSegment)}</span><br>`, this.currentSegment = "", this.currentSegmentClass = void 0, this.render()) : this.committedHTML && !this.committedHTML.endsWith("<br>") && (this.committedHTML += "<br>", this.render()), this.processNext();
        break;
      }
      case "append": {
        this.queue.shift(), this.currentSegment && (this.committedHTML += `<span${this.classAttr(this.currentSegmentClass)}>${escapeHtml(this.currentSegment)}</span><br>`, this.currentSegment = "", this.currentSegmentClass = void 0), this.committedHTML && !this.committedHTML.endsWith("<br>") && (this.committedHTML += "<br>"), this.committedHTML += item.html, this.render(), this.processNext();
        break;
      }
    }
  }
};
__name(_TextWriter, "TextWriter");
let TextWriter = _TextWriter;
const _TextConsoleWriter = class _TextConsoleWriter {
  constructor(component, hookID, hookResetID) {
    __publicField(this, "writer");
    __publicField(this, "hookID");
    __publicField(this, "hookResetID");
    this.writer = new TextWriter(component, { cursor: !0, cursorChar: "_", speed: 15 }), this.hookID = hookID, this.hookResetID = hookResetID;
  }
  registerHooks(uuid) {
    trackHook(uuid, Hooks.on(this.hookID, (text2, sourceUuid) => {
      if (sourceUuid !== uuid)
        return;
      this.writer.resetAll();
      const lines = text2.split(/<br\s*\/?>/i);
      lines.forEach((line, index2) => {
        this.writer.type(line), index2 < lines.length - 1 && this.writer.break();
      }), this.writer.start();
    }), this.hookID), trackHook(uuid, Hooks.on(this.hookResetID, (sourceUuid) => {
      sourceUuid === uuid && this.writer.resetAll();
    }), this.hookResetID);
  }
};
__name(_TextConsoleWriter, "TextConsoleWriter");
let TextConsoleWriter = _TextConsoleWriter;
const _TextLogWriter = class _TextLogWriter {
  constructor(component, hookID, hookResetID) {
    __publicField(this, "writer");
    __publicField(this, "hookID");
    __publicField(this, "hookResetID");
    __publicField(this, "introType");
    this.writer = new TextWriter(component, { cursor: !1, speed: 25 }), this.hookID = hookID, this.hookResetID = hookResetID;
  }
  registerHooks(uuid) {
    trackHook(uuid, Hooks.on(this.hookID, (text2, sourceUuid, glitchy) => {
      sourceUuid === uuid && this.writer.break().type(text2, { className: glitchy ? photosensitiveStyling(GLITCHY_CLASS) : void 0 }).break().start();
    }), this.hookID), trackHook(uuid, Hooks.on(this.hookResetID, (sourceUuid, all = !1) => {
      sourceUuid === uuid && (all ? this.writer.resetAll() : this.writer.reset(this.buildFinishedHTML(this.introType)));
    }), this.hookResetID);
  }
  /**
   * Instantly renders entries previously sent via sendToTextLog, so a remounted sheet picks back up where it
   * left off instead of losing everything sent before.
   *
   * Queued via appendHTML rather than committed directly, so it plays after (not on top of) an
   * in-progress runIntro animation instead of corrupting it.
   * @param entries
   */
  showPersistedEntries(entries) {
    if (!entries.length)
      return;
    const html2 = entries.map((entry) => {
      const className = entry.glitchy ? photosensitiveStyling(GLITCHY_CLASS) : void 0;
      return `<span${className ? ` class="${className}"` : ""}>${escapeHtml(entry.text)}</span><br>`;
    }).join("");
    this.writer.appendHTML(html2).start();
  }
  getRandomDelay() {
    return Math.floor(Math.random() * 201);
  }
  getFormattedText(introType) {
    switch (introType) {
      case TextLogIntro.Version:
        const template2 = getLocalized("LA.mech.log.version");
        return formatString(template2, getFoundryVersion(), getLancerVersion(), getModuleVersion());
      case TextLogIntro.Header:
        return getLocalized("LA.mech.log.cc.welcome");
    }
    return "";
  }
  runIntro(introType) {
    switch (this.introType = introType, introType) {
      case TextLogIntro.Header:
        this.writer.type(formatString("COMPANION/CONCIERGE UNIT v{0}", getModuleVersion())).break().type("> INITIALIZING / INICIALIZANDO / 初期化中").type(" . ", { delay: 200 }).type(". ", { delay: 200 }).type(". ", { delay: 200 }).pause(500).break().type(">> OMNINET", { delay: this.getRandomDelay() }).pause(this.getRandomDelay()).type(" . ", { delay: this.getRandomDelay() }).type(". ", { delay: this.getRandomDelay() }).type(". ", { delay: this.getRandomDelay() }).type("CONNECTED").break().type(">> SYSTEMS", { delay: this.getRandomDelay() }).pause(this.getRandomDelay()).type(" . ", { delay: this.getRandomDelay() }).type(". ", { delay: this.getRandomDelay() }).type(". ", { delay: this.getRandomDelay() }).type("ONLINE").break().type(">> WEAPONS", { delay: this.getRandomDelay() }).pause(this.getRandomDelay()).type(" . ", { delay: this.getRandomDelay() }).type(". ", { delay: this.getRandomDelay() }).type(". ", { delay: this.getRandomDelay() }).type("ARMED").break().pause(500).type("INITIALIZATION COMPLETE / INICIALIZAÇÃO CONCLUÍDA / 初期化完了", { delay: 0 }).break().type(this.getFormattedText(TextLogIntro.Version)).break().pause(500).type(this.getFormattedText(introType)).start();
        break;
    }
  }
  setFinished(introType) {
    this.introType = introType, this.writer.setHTML(this.buildFinishedHTML(introType));
  }
  buildFinishedHTML(introType) {
    switch (introType) {
      case TextLogIntro.Header:
        return [
          formatString("COMPANION/CONCIERGE UNIT v{0}", getModuleVersion()),
          "> INITIALIZING / INICIALIZANDO / 初期化中",
          ">> OMNINET . . . CONNECTED",
          ">> SYSTEMS . . . ONLINE",
          ">> WEAPONS . . . ARMED",
          "INITIALIZATION COMPLETE / INICIALIZAÇÃO CONCLUÍDA / 初期化完了",
          this.getFormattedText(TextLogIntro.Version),
          this.getFormattedText(introType)
        ].map((line) => `<span>${escapeHtml(line)}</span>`).join("<br>");
    }
    return "";
  }
};
__name(_TextLogWriter, "TextLogWriter");
let TextLogWriter = _TextLogWriter;
var root_1$G = /* @__PURE__ */ template('<div><div class="la-flexcol -gap1 la-textlog-left -aligncontentend -overflowhidden -width4"><div></div> <div class="la-textlog-left__current -widthfull"></div></div> <div class="la-flexcol la-textlog-left -justifyend -overflowhidden"><div class="la-textlog__log -flex1 -justifystart -aligncontentend -widthfull"></div> <div class="la-textlog__console la-flexrow -flex0 -justifystart -widthfull">>//:&nbsp; <div>&nbsp;</div></div></div> <div class="la-flexcol -gap1 la-textlog-right -aligncontentend -overflowhidden -width4"><div></div> <div class="la-textlog-right__current -widthfull"></div></div></div>');
function TextLog($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), style = /* @__PURE__ */ derived(() => props.style), runIntro = /* @__PURE__ */ derived(() => props.runIntro), introType = /* @__PURE__ */ derived(() => props.introType), uuid = /* @__PURE__ */ derived(() => props.uuid), hookID = /* @__PURE__ */ derived(() => props.hookID), hookResetID = /* @__PURE__ */ derived(() => props.hookResetID), logHookID = /* @__PURE__ */ derived(() => props.logHookID), logHookResetID = /* @__PURE__ */ derived(() => props.logHookResetID);
  let consoleComponent = state(null), logComponent = state(null), consoleWriter = null, logWriter = null;
  const enabled = getMechSheetLogHeaderEnabled();
  onMount(() => {
    enabled && (consoleWriter = new TextConsoleWriter(get$1(consoleComponent), get$1(hookID), get$1(hookResetID)), consoleWriter.registerHooks(get$1(uuid)), logWriter = new TextLogWriter(get$1(logComponent), get$1(logHookID), get$1(logHookResetID)), logWriter.registerHooks(get$1(uuid)), get$1(runIntro) ? (logWriter.runIntro(get$1(introType)), setIntroRun(get$1(uuid), !0)) : logWriter.setFinished(get$1(introType)), logWriter.showPersistedEntries(getTextLogEntries(get$1(uuid))));
  });
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var div = root_1$G(), div_1 = child(div), div_2 = child(div_1), div_3 = sibling(div_1, 2), div_4 = child(div_3);
      bind_this(div_4, ($$value) => set(logComponent, $$value), () => get$1(logComponent));
      var div_5 = sibling(div_4, 2), div_6 = sibling(child(div_5));
      bind_this(div_6, ($$value) => set(consoleComponent, $$value), () => get$1(consoleComponent));
      var div_7 = sibling(div_3, 2), div_8 = child(div_7);
      template_effect(
        ($0) => {
          set_class(div, `la-textlog la-flexrow -justifystart ${$0 ?? ""}`), set_class(div_2, `la-textlog__ruler -flex1 -widthfull ${(get$1(introType) ? "" : "-visibilityhidden") ?? ""}`), set_class(div_8, `la-textlog__ruler -flex1 -widthfull ${(get$1(introType) ? "" : "-visibilityhidden") ?? ""}`);
        },
        [() => {
          var _a;
          return (_a = get$1(style)) == null ? void 0 : _a.join(" ");
        }]
      ), append($$anchor2, div);
    }, "consequent");
    if_block(node, ($$render) => {
      enabled && $$render(consequent);
    });
  }
  append($$anchor, fragment), pop();
}
__name(TextLog, "TextLog");
var root$Z = /* @__PURE__ */ template('<button type="button"><!></button>');
function GlyphButton($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, tip = /* @__PURE__ */ derived(() => $$props.tooltip ? TooltipFactory.buildTooltip($$props.tooltip, $$props.tooltipHeader) : void 0), logging = /* @__PURE__ */ derived(() => $$props.logging && $$props.logText);
  function handleOnPointerEnter(event2) {
    if ($$props.onPointerEnter && $$props.onPointerEnter(), get$1(logging)) sendToTextConsole(event2, $$props.logText, actorUuid);
    else return;
  }
  __name(handleOnPointerEnter, "handleOnPointerEnter");
  function handleOnPointerLeave(event2) {
    if ($$props.onPointerLeave && $$props.onPointerLeave(), get$1(logging)) resetTextConsole(event2, actorUuid);
    else return;
  }
  __name(handleOnPointerLeave, "handleOnPointerLeave");
  var button = root$Z();
  button.__click = function(...$$args) {
    var _a2;
    (_a2 = $$props.onClick) == null || _a2.apply(this, $$args);
  };
  var node = child(button);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment = comment(), node_1 = first_child(fragment);
      snippet(node_1, () => $$props.children), append($$anchor2, fragment);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.children && $$render(consequent);
    });
  }
  template_effect(
    ($0) => {
      set_class(button, `
        ${$0 ?? ""}
        ${$$props.flowClass ?? ""}`), set_attribute(button, "data-uuid", $$props.uuid), set_attribute(button, "data-type", $$props.type), set_attribute(button, "data-index", $$props.index), set_attribute(button, "data-rank", $$props.rank), set_attribute(button, "data-path", $$props.path), set_attribute(button, "data-action", $$props.action), set_attribute(button, "data-action-value", $$props.actionValue), set_attribute(button, "data-tooltip", $$props.tooltipEnabled && !$$props.disabled ? get$1(tip) : void 0), set_attribute(button, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(button, "data-tooltip-direction", $$props.tooltipDirection), set_attribute(button, "aria-label", $$props.tooltip), button.disabled = $$props.disabled;
    },
    [() => {
      var _a2;
      return (_a2 = $$props.style) == null ? void 0 : _a2.join(" ");
    }]
  ), event("pointerenter", button, handleOnPointerEnter), event("pointerleave", button, handleOnPointerLeave), append($$anchor, button), pop();
}
__name(GlyphButton, "GlyphButton");
delegate(["click"]);
function LockImageButton($$anchor, $$props) {
  push($$props, !0);
  const isVideo = /* @__PURE__ */ derived(() => {
    var _a;
    return isValidVideoContainer((_a = $$props.actor.prototypeToken) == null ? void 0 : _a.texture.src);
  }), tokenImageLocked = /* @__PURE__ */ derived(() => getTokenImageLock($$props.actor.uuid)), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_1 = comment(), node_1 = first_child(fragment_1);
      {
        var consequent = /* @__PURE__ */ __name(($$anchor3) => {
          const expression = /* @__PURE__ */ derived(() => ["mdi mdi-link-variant-remove", $$props.style]), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.advanced.link.error")), expression_2 = /* @__PURE__ */ derived(() => $$props.tooltipDirection || TooltipDirection.UP), expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.advanced.link.error"));
          GlyphButton($$anchor3, {
            get flowClass() {
              return FlowClass.None;
            },
            get style() {
              return get$1(expression);
            },
            onClick: /* @__PURE__ */ __name((event2) => handleToggleImageSync(event2, $$props.actor, $$props.setState), "onClick"),
            get tooltipEnabled() {
              return $$props.tooltipEnabled;
            },
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltip() {
              return get$1(expression_1);
            },
            get tooltipDirection() {
              return get$1(expression_2);
            },
            get logText() {
              return get$1(expression_3);
            },
            get logging() {
              return $$props.logging;
            }
          });
        }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor3) => {
          const expression_4 = /* @__PURE__ */ derived(() => ["mdi mdi-link-variant", $$props.style]), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.advanced.link.tooltip")), expression_6 = /* @__PURE__ */ derived(() => $$props.tooltipDirection || TooltipDirection.UP), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.advanced.link.tooltip"));
          GlyphButton($$anchor3, {
            get flowClass() {
              return FlowClass.None;
            },
            get style() {
              return get$1(expression_4);
            },
            onClick: /* @__PURE__ */ __name((event2) => handleToggleImageSync(event2, $$props.actor, $$props.setState), "onClick"),
            get tooltipEnabled() {
              return $$props.tooltipEnabled;
            },
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltip() {
              return get$1(expression_5);
            },
            get tooltipDirection() {
              return get$1(expression_6);
            },
            get logText() {
              return get$1(expression_7);
            },
            get logging() {
              return $$props.logging;
            }
          });
        }, "alternate");
        if_block(node_1, ($$render) => {
          get$1(isVideo) ? $$render(consequent) : $$render(alternate, !1);
        });
      }
      append($$anchor2, fragment_1);
    }, "consequent_1"), alternate_1 = /* @__PURE__ */ __name(($$anchor2) => {
      const expression_8 = /* @__PURE__ */ derived(() => ["mdi mdi-link-variant-off", $$props.style]), expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.advanced.unlink.tooltip")), expression_10 = /* @__PURE__ */ derived(() => $$props.tooltipDirection || TooltipDirection.UP), expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.advanced.unlink.tooltip"));
      GlyphButton($$anchor2, {
        get flowClass() {
          return FlowClass.None;
        },
        get style() {
          return get$1(expression_8);
        },
        onClick: /* @__PURE__ */ __name((event2) => handleToggleImageSync(event2, $$props.actor, $$props.setState), "onClick"),
        get tooltipEnabled() {
          return $$props.tooltipEnabled;
        },
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_9);
        },
        get tooltipDirection() {
          return get$1(expression_10);
        },
        get logText() {
          return get$1(expression_11);
        },
        get logging() {
          return $$props.logging;
        }
      });
    }, "alternate_1");
    if_block(node, ($$render) => {
      get$1(tokenImageLocked) ? $$render(consequent_1) : $$render(alternate_1, !1);
    });
  }
  append($$anchor, fragment), pop();
}
__name(LockImageButton, "LockImageButton");
var root_2$v = /* @__PURE__ */ template("<i></i> <!>", 1), root_3$G = /* @__PURE__ */ template("<!> <!>", 1), root_1$F = /* @__PURE__ */ template('<div class="la-settings__island la-flexcol -alignend -padding1-r -positionabsolute -right0 -top0" style="z-index: 2;"><div class="la-flexrow -alignend"><!> <!></div> <!></div>'), root_5$v = /* @__PURE__ */ template(`<div class="la-actorname la-flexcol -padding3-l -padding3-t -widthfull"><div class="la-flexrow -widthfull"><input type="text" class="la-actorname__input la-text-header -fontsize6 -upper -letterspacing1 -textalignleft -textoverflowellipsis
                charname"> <span class="-fontsizesmall la-text-darken-4 -fontface-stylized"> </span></div></div>`), root_7$m = /* @__PURE__ */ template('<span class="-fontsize4"> </span>'), root_8$j = /* @__PURE__ */ template("<div> </div>"), root_6$x = /* @__PURE__ */ template(`<div class="la-actorname la-flexcol -padding3-l -widthfull -"><div class="la-flexrow -widthfull"><span role="none" class="la-actorname__span la-callsign -widthfull la-text-header -upper -letterspacing0 -fontface-stylized
                ref set pilot click-open"><!></span> <span class="-fontsizesmall la-text-darken-4 -fontface-stylized"> </span></div> <!></div>`), root_11$j = /* @__PURE__ */ template(`<span class="la-textlog__wrapper -left0 -positionabsolute -padding1
        -pointerdisable"><!></span>`), root$Y = /* @__PURE__ */ template('<div class="la-header-content -positionrelative -heightfull -overflowhidden -aligncontentstart" style="display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto;"><!> <div class="-positionrelative -alignstart -overflowhidden" style="grid-area: 1 / 1; z-index: 0;"><!></div> <hr class="la-divider-h -spacemedium -padding0-b la-bckg-header" style="grid-area: 2 / 1 / 2 / -1; z-index: 1;"> <div class="-positionrelative -overflowhidden" style="grid-area: 3 / 1; z-index: 0;"><!></div> <div class="-positionabsolute -widthhalf -right0 -top0" style="z-index: 1;"><!></div> <!></div>');
function Header$3($$anchor, $$props) {
  push($$props, !0);
  const advancedOptionsToggle = /* @__PURE__ */ __name(($$anchor2) => {
    var div = root_1$F(), div_1 = child(div), node = child(div_1);
    {
      var consequent = /* @__PURE__ */ __name(($$anchor3) => {
        var fragment = root_2$v(), i = first_child(fragment);
        set_class(i, `mdi mdi-mouse-move-vertical -fontsize6 la-text-header la-prmy-primary
                ${(qualityMode ? "-glow-prmy" : "") ?? ""}`);
        var node_1 = sibling(i, 2);
        const expression = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.reset.tooltip")), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.reset.tooltip"));
        GlyphButton(node_1, {
          get flowClass() {
            return FlowClass.None;
          },
          style: [
            "mdi mdi-image-sync -fontsize6 la-text-header -width7 la-prmy-primary la-scdy-header",
            qualityMode ? "-glow-prmy -glow-scdy-hover" : ""
          ],
          onClick: /* @__PURE__ */ __name(() => resetImageSettings(get$1(actor).uuid, imageComponent), "onClick"),
          tooltipEnabled,
          get tooltipTheme() {
            return get$1(theme);
          },
          get tooltip() {
            return get$1(expression);
          },
          get tooltipDirection() {
            return TooltipDirection.LEFT;
          },
          get logText() {
            return get$1(expression_1);
          },
          logging: !0
        }), template_effect(
          ($0) => {
            set_attribute(i, "data-tooltip", $0), set_attribute(i, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i, "data-tooltip-direction", TooltipDirection.LEFT);
          },
          [
            () => TooltipFactory.buildTooltip(getLocalized([
              "LA.advanced.imageOffset.tooltip",
              "LA.advanced.imageSize.tooltip"
            ]))
          ]
        ), append($$anchor3, fragment);
      }, "consequent");
      if_block(node, ($$render) => {
        get$1(advancedOptions) && $$render(consequent);
      });
    }
    var node_2 = sibling(node, 2);
    AdvancedButton(node_2, {
      style: [
        "-fontsize5 la-prmy-primary la-scdy-header",
        qualityMode ? "-glow-prmy -glow-scdy-hover" : ""
      ],
      get uuid() {
        return get$1(actor).uuid;
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      logging: !0
    });
    var node_3 = sibling(div_1, 2);
    {
      var consequent_2 = /* @__PURE__ */ __name(($$anchor3) => {
        var fragment_1 = root_3$G(), node_4 = first_child(fragment_1);
        LockImageButton(node_4, {
          style: `-fontsize7 la-text-header la-prmy-primary la-scdy-header
        ${(qualityMode ? "-glow-prmy -glow-scdy-hover" : "") ?? ""}`,
          get actor() {
            return get$1(actor);
          },
          setState: setActorTokenSync$2,
          tooltipEnabled,
          get tooltipDirection() {
            return TooltipDirection.LEFT;
          },
          logging: !0
        });
        var node_5 = sibling(node_4, 2);
        {
          var consequent_1 = /* @__PURE__ */ __name(($$anchor4) => {
            const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.actor.tooltip")), expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.actor.tooltip"));
            GlyphButton($$anchor4, {
              get flowClass() {
                return FlowClass.None;
              },
              style: [
                "mdi mdi-image-edit -fontsize6 la-text-header -width7 la-prmy-primary la-scdy-header",
                qualityMode ? "-glow-prmy -glow-scdy-hover" : ""
              ],
              onClick: /* @__PURE__ */ __name((event2) => browseActorImage(event2, get$1(actor)), "onClick"),
              tooltipEnabled,
              get tooltipTheme() {
                return get$1(theme);
              },
              get tooltip() {
                return get$1(expression_2);
              },
              get tooltipDirection() {
                return TooltipDirection.LEFT;
              },
              get logText() {
                return get$1(expression_3);
              },
              logging: !0
            });
          }, "consequent_1");
          if_block(node_5, ($$render) => {
            get$1(tokenImageLocked) || $$render(consequent_1);
          });
        }
        append($$anchor3, fragment_1);
      }, "consequent_2");
      if_block(node_3, ($$render) => {
        get$1(advancedOptions) && $$render(consequent_2);
      });
    }
    append($$anchor2, div);
  }, "advancedOptionsToggle"), identificationMain = /* @__PURE__ */ __name(($$anchor2) => {
    var div_2 = root_5$v(), div_3 = child(div_2), input = child(div_3);
    set_attribute(input, "name", "name");
    var span = sibling(input, 2), text2 = child(span);
    template_effect(
      ($0, $1) => {
        set_value(input, get$1(actor).name), set_attribute(input, "placeholder", $0), set_text(text2, $1);
      },
      [
        () => getLocalized("LA.namePlaceholder"),
        () => getLocalized("LA.name.label")
      ]
    ), event("pointerenter", input, (event2) => sendToTextConsole(event2, getLocalized("LA.mech.name.tooltip"), get$1(actor).uuid)), event("pointerleave", input, (event2) => resetTextConsole(event2, get$1(actor).uuid)), append($$anchor2, div_2);
  }, "identificationMain"), identificationSecondary = /* @__PURE__ */ __name(($$anchor2) => {
    var div_4 = root_6$x(), div_5 = child(div_4), span_1 = child(div_5);
    set_attribute(span_1, "data-path", "system.pilot"), set_attribute(span_1, "data-accept-types", "pilot");
    var node_6 = child(span_1);
    const expression_4 = /* @__PURE__ */ derived(() => {
      var _a;
      return ((_a = get$1(pilot)) == null ? void 0 : _a.system.level) || "?";
    }), expression_5 = /* @__PURE__ */ derived(() => `--${getLocalized("LA.search.label")}`);
    TerminalText(node_6, {
      get text() {
        return `LL${get$1(expression_4) ?? ""}`;
      },
      get extensionText() {
        return get$1(expression_5);
      },
      textStyle: ["-fontsizemedium la-prmy-header"],
      disableCmdline: !0,
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var span_2 = root_7$m(), text_1 = child(span_2);
        template_effect(($0) => set_text(text_1, $0), [
          () => {
            var _a;
            return ((_a = get$1(pilot)) == null ? void 0 : _a.system.callsign) || getLocalized("LA.pilotPlaceholder");
          }
        ]), append($$anchor3, span_2);
      }, "children"),
      $$slots: { default: !0 }
    });
    var span_3 = sibling(span_1, 2), text_2 = child(span_3), node_7 = sibling(div_5, 2);
    {
      var consequent_3 = /* @__PURE__ */ __name(($$anchor3) => {
        var div_6 = root_8$j(), text_3 = child(div_6);
        template_effect(
          ($0, $1) => {
            set_class(div_6, `la-flexrow -widthfull -fontface-stylized -fontsizesmall
            ${$0 ?? ""}`), set_text(text_3, $1);
          },
          [
            () => photosensitiveStyling("horus--very--subtle"),
            () => getLocalized("LA.mech.noPilot.label")
          ]
        ), append($$anchor3, div_6);
      }, "consequent_3");
      if_block(node_7, ($$render) => {
        var _a, _b, _c;
        ((_c = (_b = (_a = get$1(pilot)) == null ? void 0 : _a.system.active_mech) == null ? void 0 : _b.value) == null ? void 0 : _c.uuid) !== get$1(actor).uuid && $$render(consequent_3);
      });
    }
    template_effect(
      ($0) => {
        var _a;
        set_attribute(span_1, "data-uuid", (_a = get$1(pilot)) == null ? void 0 : _a.uuid), set_text(text_2, $0);
      },
      [() => getLocalized("LA.pilot.label")]
    ), event("pointerenter", span_1, (event2) => sendToTextConsole(event2, getLocalized("LA.pilot.open.tooltip"), get$1(actor).uuid)), event("pointerleave", span_1, (event2) => resetTextConsole(event2, get$1(actor).uuid)), append($$anchor2, div_4);
  }, "identificationSecondary"), actorImage = /* @__PURE__ */ __name(($$anchor2) => {
    bind_this(
      BoundImage($$anchor2, {
        get image() {
          return get$1(actor).img;
        },
        get uuid() {
          return get$1(actor).uuid;
        },
        yGetter: getImageOffsetY,
        xGetter: getImageOffsetX,
        xySetter: setImageOffsetXY,
        widthGetter: getImageWidth,
        widthSetter: setImageWidth
      }),
      ($$value) => imageComponent = $$value,
      () => imageComponent
    );
  }, "actorImage"), textLog = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment_4 = comment(), node_8 = first_child(fragment_4);
    {
      var consequent_4 = /* @__PURE__ */ __name(($$anchor3) => {
        var span_4 = root_11$j(), node_9 = child(span_4);
        const expression_6 = /* @__PURE__ */ derived(() => !get$1(introPlayed));
        TextLog(node_9, {
          style: [
            "-widthfull -heightfull -fontface-stylized",
            logographic ? "-fontsize3" : "-fontsizemediumer"
          ],
          get uuid() {
            return get$1(actor).uuid;
          },
          get hookID() {
            return TextConsoleHook.MechHeader;
          },
          get hookResetID() {
            return TextConsoleHook.MechHeaderReset;
          },
          get logHookID() {
            return TextLogHook.MechLog;
          },
          get logHookResetID() {
            return TextLogHook.MechLogReset;
          },
          get introType() {
            return TextLogIntro.Header;
          },
          get runIntro() {
            return get$1(expression_6);
          }
        }), append($$anchor3, span_4);
      }, "consequent_4");
      if_block(node_8, ($$render) => {
        var _a, _b, _c;
        ((_c = (_b = (_a = get$1(pilot)) == null ? void 0 : _a.system.active_mech) == null ? void 0 : _b.value) == null ? void 0 : _c.uuid) === get$1(actor).uuid && $$render(consequent_4);
      });
    }
    append($$anchor2, fragment_4);
  }, "textLog"), props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), pilot = /* @__PURE__ */ derived(() => props.pilot);
  setActorContext(get$1(actor));
  const logographic = logographicLanguage(), tooltipEnabled = getMechSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), introPlayed = /* @__PURE__ */ derived(() => getIntroRun(get$1(actor).uuid)), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), tokenImageLocked = /* @__PURE__ */ derived(() => getTokenImageLock(get$1(actor).uuid)), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  let imageComponent;
  function resetImageSettings(uuid, imageComponent2) {
    imageComponent2.resetLocalState(), setImageBatched(uuid, 0, 0, 0);
  }
  __name(resetImageSettings, "resetImageSettings"), onMount(() => {
    setTokenImageLock(get$1(actor).uuid, getActorTokenSync$2(get$1(actor).uuid));
  });
  var div_7 = root$Y(), node_10 = child(div_7);
  advancedOptionsToggle(node_10);
  var div_8 = sibling(node_10, 2), node_11 = child(div_8);
  identificationMain(node_11);
  var div_9 = sibling(div_8, 4), node_12 = child(div_9);
  identificationSecondary(node_12);
  var div_10 = sibling(div_9, 2), node_13 = child(div_10);
  actorImage(node_13);
  var node_14 = sibling(div_10, 2);
  textLog(node_14), append($$anchor, div_7), pop();
}
__name(Header$3, "Header$3");
var root_1$E = /* @__PURE__ */ template("<span> </span>"), on_change$c = /* @__PURE__ */ __name((event2, $$props) => handleRelativeDataInput(event2, $$props.currentValue), "on_change$c"), root_2$u = /* @__PURE__ */ template("<div></div>"), root_3$F = /* @__PURE__ */ template("<div></div>"), root$X = /* @__PURE__ */ template('<div><!> <div><div class="la-bar-h-progress la-flexrow -widthfull -heightfull"><input type="text" data-dtype="Number"> <span> </span></div> <div></div> <!> <!></div></div>');
function StatusBar($$anchor, $$props) {
  push($$props, !0);
  let editing = state(!1);
  const tip = /* @__PURE__ */ derived(() => $$props.tooltip ? TooltipFactory.buildTooltip($$props.tooltip, $$props.tooltipHeader) : void 0);
  var div = root$X(), node = child(div);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var span = root_1$E(), text2 = child(span);
      template_effect(
        ($0) => {
          set_class(span, `la-damage__span -fontsizesmall -flexbasis13 -textalignright
            ${$0 ?? ""}`), set_attribute(span, "data-tooltip", $$props.tooltipEnabled ? get$1(tip) : void 0), set_attribute(span, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(span, "data-tooltip-direction", $$props.tooltipDirection ? $$props.tooltipDirection : "RIGHT"), set_text(text2, $$props.name);
        },
        [() => {
          var _a;
          return (_a = $$props.nameStyle) == null ? void 0 : _a.join(" ");
        }]
      ), append($$anchor2, span);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.name && $$render(consequent);
    });
  }
  var div_1 = sibling(node, 2), div_2 = child(div_1), input = child(div_2);
  input.__change = [on_change$c, $$props];
  var span_1 = sibling(input, 2), text_1 = child(span_1), div_3 = sibling(div_2, 2), node_1 = sibling(div_3, 2);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var div_4 = root_2$u();
      template_effect(
        ($0) => {
          set_class(div_4, `la-bar-h-progress -secondary la-bar-h-current -positionabsolute -top0 -heightfull 
                ${$0 ?? ""}`), set_attribute(div_4, "style", `--la-percent:${$$props.currentValueSecondary / $$props.maxValueSecondary * 100}%`);
        },
        [
          () => {
            var _a, _b;
            return $$props.editSecondary && $$props.barEditStyleSecondary ? `${(_a = $$props.barEditStyleSecondary) == null ? void 0 : _a.join(" ")} -pulse-bckg-prmy -fast` : (_b = $$props.barStyleSecondary) == null ? void 0 : _b.join(" ");
          }
        ]
      ), append($$anchor2, div_4);
    }, "consequent_1");
    if_block(node_1, ($$render) => {
      $$props.currentValueSecondary && $$props.maxValueSecondary && $$render(consequent_1);
    });
  }
  var node_2 = sibling(node_1, 2);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      var div_5 = root_3$F();
      template_effect(
        ($0) => {
          set_class(div_5, `la-bar-h-progress -tertiary la-bar-h-current -positionabsolute -top0 -heightfull 
                ${$0 ?? ""}`), set_attribute(div_5, "style", `--la-percent:${$$props.currentValueTertiary / $$props.maxValueTertiary * 100}%`);
        },
        [
          () => {
            var _a, _b;
            return $$props.editTertiary && $$props.barEditStyleTertiary ? `${(_a = $$props.barEditStyleTertiary) == null ? void 0 : _a.join(" ")} -pulse-bckg-prmy -fast` : (_b = $$props.barStyleTertiary) == null ? void 0 : _b.join(" ");
          }
        ]
      ), append($$anchor2, div_5);
    }, "consequent_2");
    if_block(node_2, ($$render) => {
      $$props.currentValueTertiary && $$props.maxValueTertiary && $$render(consequent_2);
    });
  }
  template_effect(
    ($0, $1, $2) => {
      set_class(div, `la-statusbar la-flexrow -fontsizemedium -gap2 ${$0 ?? ""}`), set_class(div_1, `la-bar-h la-bckg-darken-3 -flex1 -positionrelative -widthfull -height3 -overflowhidden ${$$props.clipPath ?? ""}`), set_class(input, `la-bar-h-progress__input -widthfull -heightfull -positionrelative -textaligncenter
                    ${$1 ?? ""}`), set_attribute(input, "name", $$props.dataName), set_value(input, $$props.currentValue), set_class(span_1, `la-bar-h-progress__span -lineheight3 -positionabsolute -pointerdisable
                    ${(get$1(editing) ? "-visibilityhidden" : "") ?? ""}`), set_text(text_1, `${$$props.currentValue ?? ""}/${$$props.maxValue ?? ""}`), set_class(div_3, `la-bar-h-progress la-bar-h-current -positionabsolute -top0 -heightfull 
                ${$2 ?? ""}`), set_attribute(div_3, "style", `--la-percent:${$$props.currentValue / $$props.maxValue * 100}%`);
    },
    [
      () => {
        var _a;
        return (_a = $$props.textStyle) == null ? void 0 : _a.join(" ");
      },
      () => {
        var _a;
        return get$1(editing) ? (_a = $$props.textStyle) == null ? void 0 : _a.join(" ") : "la-text-transparent";
      },
      () => {
        var _a, _b;
        return get$1(editing) && $$props.barEditStyle ? `${(_a = $$props.barEditStyle) == null ? void 0 : _a.join(" ")} -pulse-bckg-prmy -fast` : (_b = $$props.barStyle) == null ? void 0 : _b.join(" ");
      }
    ]
  ), event("focus", input, (event2) => {
    event2.currentTarget.select(), set(editing, !0);
  }), event("blur", input, () => {
    set(editing, !1);
  }), append($$anchor, div), pop();
}
__name(StatusBar, "StatusBar");
delegate(["change"]);
var EditMode = /* @__PURE__ */ ((EditMode2) => (EditMode2[EditMode2.Subtract = 0] = "Subtract", EditMode2[EditMode2.Add = 1] = "Add", EditMode2[EditMode2.Set = 2] = "Set", EditMode2))(EditMode || {}), root_1$D = /* @__PURE__ */ template('<div class="-widthfull -positionrelative"><div><!> <input type="number" class="la-text-text -width3ch -height3"> <!></div> <span> </span></div>'), root_6$w = /* @__PURE__ */ template("<span> </span>"), root$W = /* @__PURE__ */ template("<div><i></i> <!> <div><!> <span> </span></div> <!></div>");
function StatComboShort($$anchor, $$props) {
  push($$props, !0);
  const renderEditable = /* @__PURE__ */ __name(($$anchor2) => {
    var div = root_1$D(), div_1 = child(div), node = child(div_1);
    GlyphButton(node, {
      style: [
        "la-bckg-secondary -width3 clicker-minus-button input-update"
      ],
      get flowClass() {
        return FlowClass.None;
      },
      tooltipEnabled: !1,
      onClick: handleSubtract,
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var text$1 = text("-");
        append($$anchor3, text$1);
      }, "children"),
      $$slots: { default: !0 }
    });
    var input = sibling(node, 2);
    set_attribute(input, "data-dtype", "Number");
    var node_1 = sibling(input, 2);
    GlyphButton(node_1, {
      style: [
        "la-bckg-secondary -width3 clicker-plus-button input-update"
      ],
      get flowClass() {
        return FlowClass.None;
      },
      tooltipEnabled: !1,
      onClick: handleAddition,
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var text_1 = text("+");
        append($$anchor3, text_1);
      }, "children"),
      $$slots: { default: !0 }
    });
    var span = sibling(div_1, 2), text_2 = child(span);
    template_effect(
      ($0) => {
        set_class(div_1, `la-flexrow ${($$props.editable ? "" : "-displaynone") ?? ""}
            ${$0 ?? ""}`), set_attribute(input, "name", $$props.valuePath), set_value(input, $$props.value), set_class(span, `-widthfull
            ${($$props.editable ? "-displaynone" : "") ?? ""}
            ${$0 ?? ""}`), set_text(text_2, $$props.value);
      },
      [
        () => {
          var _a;
          return ((_a = $$props.topStyle) == null ? void 0 : _a.join(" ")) || "-fontface-neutral";
        }
      ]
    ), event("focus", input, (event2) => event2.currentTarget.select()), append($$anchor2, div);
  }, "renderEditable"), tip = /* @__PURE__ */ derived(() => $$props.tooltip ? TooltipFactory.buildTooltip($$props.tooltip, $$props.tooltipHeader) : void 0);
  function handleSubtract(event2) {
    $$props.onPointerClick && $$props.valuePath && event2.currentTarget instanceof HTMLElement && $$props.onPointerClick(event2, $$props.value, $$props.valuePath, EditMode.Subtract);
  }
  __name(handleSubtract, "handleSubtract");
  function handleAddition(event2) {
    $$props.onPointerClick && $$props.valuePath && event2.currentTarget instanceof HTMLElement && $$props.onPointerClick(event2, $$props.value, $$props.valuePath, EditMode.Add);
  }
  __name(handleAddition, "handleAddition");
  var div_2 = root$W(), i = child(div_2), node_2 = sibling(i, 2);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment = comment(), node_3 = first_child(fragment);
      snippet(node_3, () => $$props.contentLeft), append($$anchor2, fragment);
    }, "consequent");
    if_block(node_2, ($$render) => {
      $$props.contentLeft && $$render(consequent);
    });
  }
  var div_3 = sibling(node_2, 2), node_4 = child(div_3);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      renderEditable($$anchor2);
    }, "consequent_1"), alternate = /* @__PURE__ */ __name(($$anchor2) => {
      var span_1 = root_6$w(), text_3 = child(span_1);
      template_effect(
        ($0) => {
          set_class(span_1, `-widthfull
                ${$0 ?? ""}`), set_text(text_3, $$props.value);
        },
        [
          () => {
            var _a;
            return ((_a = $$props.topStyle) == null ? void 0 : _a.join(" ")) || "-fontface-neutral";
          }
        ]
      ), append($$anchor2, span_1);
    }, "alternate");
    if_block(node_4, ($$render) => {
      $$props.valuePath != null && $$props.value != null && $$props.editable != null ? $$render(consequent_1) : $$render(alternate, !1);
    });
  }
  var span_2 = sibling(node_4, 2), text_4 = child(span_2), node_5 = sibling(div_3, 2);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_2 = comment(), node_6 = first_child(fragment_2);
      snippet(node_6, () => $$props.contentRight), append($$anchor2, fragment_2);
    }, "consequent_2");
    if_block(node_5, ($$render) => {
      $$props.contentRight && $$render(consequent_2);
    });
  }
  template_effect(
    ($0, $1, $2) => {
      set_class(div_2, `la-shortstat la-flexrow ${$0 ?? ""}`), set_class(i, $$props.icon), set_class(div_3, `la-flexcol ${$1 ?? ""}`), set_attribute(div_3, "data-tooltip", $$props.tooltipEnabled && !$$props.editable ? get$1(tip) : void 0), set_attribute(div_3, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(div_3, "data-tooltip-direction", $$props.tooltipDirection ? $$props.tooltipDirection : "RIGHT"), set_class(span_2, `
                ${$2 ?? ""}`), set_text(text_4, $$props.label);
    },
    [
      () => {
        var _a;
        return (_a = $$props.outerStyle) == null ? void 0 : _a.join(" ");
      },
      () => {
        var _a;
        return (_a = $$props.innerStyle) == null ? void 0 : _a.join(" ");
      },
      () => {
        var _a;
        return (_a = $$props.bottomStyle) == null ? void 0 : _a.join(" ");
      }
    ]
  ), append($$anchor, div_2), pop();
}
__name(StatComboShort, "StatComboShort");
var root$V = /* @__PURE__ */ template('<label><input name="system.core_energy" type="checkbox" data-dtype="Boolean" style="display: none"></label>');
function CoreAvailability($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const system = prop($$props, "system"), actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, tip = TooltipFactory.buildTooltip(getLocalized("LA.mech.core.available.tooltip")), qualityMode = getExtraEffectsEnabled();
  var label = root$V(), input = child(label);
  template_effect(() => {
    set_class(label, `mdi -fontsize8 -pointercursor
             ${(system().core_energy ? "mdi-battery-high la-text-system" + (qualityMode ? " -pulse-glow-prmy la-prmy-warning" : "") : "mdi-battery-off-outline la-text-repcap") ?? ""}`), set_attribute(label, "data-tooltip", $$props.tooltipEnabled ? tip : void 0), set_attribute(label, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(label, "data-tooltip-direction", TooltipDirection.RIGHT);
  }), event("pointerenter", label, (event2) => sendToTextConsole(event2, getLocalized("LA.mech.core.available.tooltip"), actorUuid)), event("pointerleave", label, (event2) => resetTextConsole(event2, actorUuid)), bind_checked(input, () => system().core_energy, ($$value) => system().core_energy = $$value), append($$anchor, label), pop();
}
__name(CoreAvailability, "CoreAvailability");
const _FlowBase = class _FlowBase {
  constructor() {
    const constructor = this.constructor;
    if (_FlowBase.instances.has(constructor))
      throw new Error("Lancer Alternative Sheets: Use getInstance() to access the instance.");
    _FlowBase.instances.set(constructor, this);
  }
  static getInstance() {
    return _FlowBase.instances.has(this) || _FlowBase.instances.set(this, new this()), _FlowBase.instances.get(this);
  }
};
__name(_FlowBase, "FlowBase"), __publicField(_FlowBase, "instances", /* @__PURE__ */ new Map());
let FlowBase = _FlowBase;
const _RunMacroBase = class _RunMacroBase extends FlowBase {
  constructor() {
    super();
  }
  setupFlow() {
    var _a;
    return _a = class extends game.lancer.Flow {
      constructor(uuid, data) {
        super(uuid, data);
      }
    }, __name(_a, "RunMacro"), __publicField(_a, "steps", ["runMacroStep"]), _a;
  }
  setupFlowSteps() {
    return [
      this.runMacroStep
    ];
  }
  /**
   * Starts the flow by creating an instance of the `SendUnknownToChat` class and beginning the flow.
   *
   * @param {string} uuid - All flows require a UUID, though not all will make use of it. The matching item will be included in the data when sent.
   * @param {any} data - The data to pass to the flow
   */
  startFlow(uuid, data) {
    const flows = game.lancer.flows;
    new (flows.get(CustomFlowClass.RunMacro))(
      uuid,
      data
    ).begin();
  }
  async runMacroStep(state2) {
    var _a;
    return (_a = state2.data) != null && _a.uuid ? (fromUuid(state2.data.uuid).then((item) => {
      item.execute();
    }), !0) : (Logger.error(`Missing UUID passed to ${this.runMacroStep.name}.`), !1);
  }
};
__name(_RunMacroBase, "RunMacroBase");
let RunMacroBase = _RunMacroBase;
const FLOW_BUTTON_DEFAULT = /* @__PURE__ */ __name(() => " clipped-bot-alt la-bckg-secondary -widthfull -overflowhidden -lineheight3 -padding0-lr ", "FLOW_BUTTON_DEFAULT");
var on_click$6 = /* @__PURE__ */ __name((event2, $$props) => $$props.onClick && $$props.onClick(event2), "on_click$6"), root$U = /* @__PURE__ */ template('<button type="button"><!></button>');
function FlowButton($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, tip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip($$props.tooltip || getLocalized("LA.flow.tooltip"), $$props.tooltipHeader)), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.flow.tooltip"));
  var button = root$U();
  button.__click = [on_click$6, $$props];
  var node = child(button);
  const expression = /* @__PURE__ */ derived(randomExtension), expression_1 = /* @__PURE__ */ derived(() => $$props.textStyle || [FLOW_BUTTON_STYLE]);
  TerminalText(node, {
    get text() {
      return $$props.text;
    },
    get extensionText() {
      return get$1(expression);
    },
    get textStyle() {
      return get$1(expression_1);
    },
    get disableCmdline() {
      return $$props.disableCmdline;
    },
    get disableExtension() {
      return $$props.disableExtension;
    },
    get disableCursor() {
      return $$props.disableCursor;
    }
  }), template_effect(
    ($0) => {
      set_class(button, `-upper
        ${$$props.disableSlide || "la-flow"} 
        ${$0 ?? ""}
        ${$$props.flowClass || ""}`), set_attribute(button, "data-uuid", $$props.uuid), set_attribute(button, "data-flow-type", $$props.flowType), set_attribute(button, "data-flow-args", $$props.flowArgs), set_attribute(button, "data-path", $$props.path), set_attribute(button, "data-tooltip", $$props.tooltipEnabled ? get$1(tip) : void 0), set_attribute(button, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(button, "data-tooltip-direction", $$props.tooltipDirection || "RIGHT"), set_attribute(button, "aria-label", $$props.text);
    },
    [
      () => {
        var _a2;
        return ((_a2 = $$props.style) == null ? void 0 : _a2.join(" ")) || FLOW_BUTTON_DEFAULT();
      }
    ]
  ), event("pointerenter", button, function(...$$args) {
    var _a2;
    (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
  }), event("pointerleave", button, function(...$$args) {
    var _a2;
    (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
  }), append($$anchor, button), pop();
}
__name(FlowButton, "FlowButton");
delegate(["click"]);
const _ButtonFactory = class _ButtonFactory {
  /**
   * Builds and mounts a button onto the specified target element.
   *
   * @param target - The HTML element where the button will be mounted.
   * @param ownerUUID - The UUID of the actor that owns the button.
   * @param build - An optional parameter that determines the type of button to build.
   *                If provided as a `SystemButton` enum, it configures the button accordingly.
   *                If provided as a string that does not match a `SystemButton` enum, it is assumed to be a macro's UUID.
   */
  static buildFlowButton(target, ownerUUID, build) {
    if (Object.values(SystemButton).includes(build)) {
      const data = this.getSystemButtonData(build);
      this.buildSystemButton(target, ownerUUID, build, data.label, data.tip, data.tipHeader);
    } else
      this.buildMacroButton(target, ownerUUID, build);
  }
  static getSystemButtonData(build) {
    return {
      label: this.getSystemButtonLabel(build),
      tip: this.getSystemButtonTip(build),
      tipHeader: this.getSystemButtonTipHeader(build)
    };
  }
  static getSystemButtonLabel(build) {
    const labels = {
      [SystemButton.Stabilize]: "LA.flow.stabilize.label",
      [SystemButton.Overcharge]: "LA.flow.overcharge.label",
      [SystemButton.BasicAttack]: "LA.flow.rollAttack.label",
      [SystemButton.Damage]: "LA.flow.rollDamage.label",
      [SystemButton.TechAttack]: "LA.flow.rollTechAttack.label",
      [SystemButton.SkillTriggerOther]: "LA.flow.skillOther.label"
    };
    return getLocalized(labels[build] || "LA.placeholder");
  }
  static getSystemButtonTip(build, ownerUUID) {
    if (build === SystemButton.Overcharge && ownerUUID) {
      const actor = fromUuidSync(ownerUUID);
      if (actor && actor.type === "mech")
        return formatString(getLocalized("LA.flow.overcharge.tooltip"), getCurrentOvercharge(actor));
      Logger.error("Actor required to get overcharge sequence for tooltip.");
    }
    const tips = {
      [SystemButton.Stabilize]: "LA.flow.stabilize.tooltip",
      [SystemButton.Overcharge]: "LA.flow.overcharge.tooltip",
      [SystemButton.BasicAttack]: "LA.flow.rollAttack.tooltip",
      [SystemButton.Damage]: "LA.flow.rollDamage.tooltip",
      [SystemButton.TechAttack]: "LA.flow.rollTechAttack.tooltip",
      [SystemButton.SkillTriggerOther]: "LA.flow.skillOther.tooltip"
    };
    return getLocalized(tips[build] || "LA.flow.tooltip");
  }
  static getSystemButtonTipHeader(build) {
    const headers = {
      [SystemButton.Stabilize]: "LA.action.full.label",
      [SystemButton.Overcharge]: "LA.action.overcharge.label",
      [SystemButton.SkillTriggerOther]: "LA.pilot.skillTrigger.label"
    };
    return headers[build] ? getLocalized(headers[build]) : void 0;
  }
  static buildSystemButton(target, ownerUUID, type, label, tip, tipHeader) {
    const actor = fromUuidSync(ownerUUID);
    mount(FlowButton, {
      target,
      context: buildActorContext(actor),
      props: {
        text: label,
        flowClass: FlowClass.Standard,
        uuid: ownerUUID,
        flowType: type,
        tooltip: tip,
        tooltipHeader: tipHeader,
        logText: tip,
        logging: !0
      }
    });
  }
  static buildMacroButton(target, ownerUUID, macroUUID) {
    function onClickHandler(ownerUUID2, macroUUID2) {
      let macroData = {
        uuid: macroUUID2
      };
      RunMacroBase.getInstance().startFlow(ownerUUID2, macroData);
    }
    __name(onClickHandler, "onClickHandler");
    const actor = fromUuidSync(ownerUUID);
    fromUuid(macroUUID).then((item) => {
      mount(FlowButton, {
        target,
        context: buildActorContext(actor),
        props: {
          text: (item == null ? void 0 : item.name) || getLocalized("LA.placeholder"),
          flowClass: CustomFlowClass.RunMacro,
          onClick: /* @__PURE__ */ __name(() => onClickHandler(ownerUUID, macroUUID), "onClick"),
          logging: !0
        }
      });
    });
  }
};
__name(_ButtonFactory, "ButtonFactory");
let ButtonFactory = _ButtonFactory;
const _SkillTriggerOtherBase = class _SkillTriggerOtherBase extends FlowBase {
  constructor() {
    super();
  }
  setupFlow() {
    var _a;
    return _a = class extends game.lancer.Flow {
      constructor(uuid, _data) {
        super(uuid, {
          title: getLocalized("LA.pilot.skillTrigger.label"),
          path: "system.__generic_skill_trigger",
          // This should never resolve to anything
          roll_str: "1d20"
        });
      }
    }, __name(_a, "SkillTriggerOther"), __publicField(_a, "steps", ["initStatRollData", "showStatRollHUD", "rollCheck", "printStatRollCard"]), _a;
  }
  setupFlowSteps() {
    return [];
  }
  /**
   * Starts the flow by creating an instance of the `SkillTriggerOther` class and beginning the flow.
   *
   * @param {string} uuid - All flows require a UUID, though not all will make use of it. The matching item will be included in the data when sent.
   * @param {any} data - The data to pass to the flow
   */
  startFlow(uuid, data) {
    const flows = game.lancer.flows;
    new (flows.get(CustomFlowClass.SkillTriggerOther))(
      uuid,
      data
    ).begin();
  }
};
__name(_SkillTriggerOtherBase, "SkillTriggerOtherBase");
let SkillTriggerOtherBase = _SkillTriggerOtherBase;
var LADataType = /* @__PURE__ */ ((LADataType2) => (LADataType2.Sorting = "LASort", LADataType2))(LADataType || {});
function handleOnDelete(event2, $$props) {
  var _a;
  event2.stopPropagation(), (_a = $$props.onDelete) == null || _a.call($$props, event2);
}
__name(handleOnDelete, "handleOnDelete");
var root_2$t = /* @__PURE__ */ template('<i role="none" style="z-index: 1;"></i>'), root_4$h = /* @__PURE__ */ template('<button type="button"></button>'), root_1$C = /* @__PURE__ */ template('<div role="none"><!> <!> <!></div>');
function DragDropHandle($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid;
  let component = state(null);
  const deleteTip = TooltipFactory.buildTooltip(getLocalized("LA.delete.tooltip"));
  function handleDragStart(event2) {
    var _a2, _b;
    try {
      const jsonData = JSON.stringify($$props.data);
      (_a2 = event2.dataTransfer) == null || _a2.setData("text/plain", jsonData), (_b = $$props.onDragStart) == null || _b.call($$props, event2, $$props.data);
    } catch (error) {
      Logger.error("Failed to handle drag start", error);
    }
  }
  __name(handleDragStart, "handleDragStart");
  function handleDrop(event2) {
    var _a2, _b, _c;
    event2.preventDefault();
    const dropData = (_a2 = event2.dataTransfer) == null ? void 0 : _a2.getData("text/plain");
    if (dropData)
      try {
        const obj = JSON.parse(dropData);
        if (obj.index !== $$props.index) {
          const eventTarget = event2.target;
          get$1(component) && eventTarget && $$props.root && $$props.root.contains(get$1(component)) && $$props.root.contains(eventTarget) ? (_b = $$props.onDrop) == null || _b.call($$props, event2, obj, $$props.data) : (_c = $$props.onDropError) == null || _c.call($$props, event2, obj);
        }
      } catch (error) {
        Logger.error("Failed to parse drop data", error);
      }
  }
  __name(handleDrop, "handleDrop");
  var div = root_1$C(), node = child(div);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var i = root_2$t();
      template_effect(($0) => set_class(i, `fas fa-grip-lines -positionabsolute -left0 -pointergrab la-prmy-primary -glow-prmy-hover ${$0 ?? ""}`), [() => {
        var _a2;
        return (_a2 = $$props.iconStyle) == null ? void 0 : _a2.join(" ");
      }]), event("pointerenter", i, function(...$$args) {
        var _a2;
        (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, getLocalized("LA.advanced.reorderMacro.tooltip"), actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), event("pointerleave", i, function(...$$args) {
        var _a2;
        (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), append($$anchor2, i);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.disabled || $$render(consequent);
    });
  }
  var node_1 = sibling(node, 2);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment = comment(), node_2 = first_child(fragment);
      snippet(node_2, () => $$props.children), append($$anchor2, fragment);
    }, "consequent_1");
    if_block(node_1, ($$render) => {
      $$props.children && $$render(consequent_1);
    });
  }
  var node_3 = sibling(node_1, 2);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      var button = root_4$h();
      button.__click = [handleOnDelete, $$props], set_attribute(button, "data-tooltip", deleteTip), template_effect(
        ($0, $1) => {
          set_class(button, `mdi mdi-close-thick -positionabsolute -right0 la-prmy-error -glow-prmy-hover ${$0 ?? ""}`), set_attribute(button, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(button, "data-tooltip-direction", $$props.tooltipDirection || TooltipDirection.RIGHT), set_attribute(button, "aria-label", $1);
        },
        [
          () => {
            var _a2;
            return (_a2 = $$props.iconStyle) == null ? void 0 : _a2.join(" ");
          },
          () => getLocalized("LA.delete.tooltip")
        ]
      ), event("pointerenter", button, function(...$$args) {
        var _a2;
        (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, getLocalized("LA.delete.tooltip"), actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), event("pointerleave", button, function(...$$args) {
        var _a2;
        (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), append($$anchor2, button);
    }, "consequent_2");
    if_block(node_3, ($$render) => {
      !$$props.disabled && !$$props.deleteDisabled && $$render(consequent_2);
    });
  }
  bind_this(div, ($$value) => set(component, $$value), () => get$1(component)), template_effect(
    ($0) => {
      set_class(div, `la-flexrow -widthfull -aligncenter -positionrelative
        ${$0 ?? ""}`), set_attribute(div, "draggable", !$$props.disabled);
    },
    [() => {
      var _a2;
      return (_a2 = $$props.style) == null ? void 0 : _a2.join(" ");
    }]
  ), event("dragstart", div, handleDragStart), event("drop", div, handleDrop), append($$anchor, div), pop();
}
__name(DragDropHandle, "DragDropHandle");
delegate(["click"]);
var root$T = /* @__PURE__ */ template('<div class="la-skilltrigger la-flexrow -justifyend -widthfull"><!> <span class="la-skilltrigger__span -bordersround-rtb -small la-brdr-secondary la-bckg-darken-2"><span class="la-skilltrigger__inner -bordersround-rtb -small la-brdr-darken-2 la-text-text -fontsize4 -fontface-stylized -textaligncenter -overflowhidden -padding0-lr"><!></span></span></div>');
function SkillTriggerButton($$anchor, $$props) {
  push($$props, !0);
  var div = root$T(), node = child(div);
  const expression = /* @__PURE__ */ derived(() => [...$$props.buttonStyle || []]), expression_1 = /* @__PURE__ */ derived(() => [...$$props.buttonTextStyle || []]), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.skillTrigger.label"));
  FlowButton(node, {
    get style() {
      return get$1(expression);
    },
    get textStyle() {
      return get$1(expression_1);
    },
    get text() {
      return $$props.item.name;
    },
    get flowClass() {
      return FlowClass.Skill;
    },
    get uuid() {
      return $$props.item.uuid;
    },
    get tooltipEnabled() {
      return $$props.tooltipEnabled;
    },
    get tooltipTheme() {
      return $$props.tooltipTheme;
    },
    get tooltipHeader() {
      return get$1(expression_2);
    },
    get tooltip() {
      return $$props.item.system.description;
    },
    get logText() {
      return $$props.item.system.description;
    },
    get logging() {
      return $$props.logging;
    }
  });
  var span = sibling(node, 2), span_1 = child(span), node_1 = child(span_1);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var text$1 = text();
      template_effect(() => set_text(text$1, $$props.item.system.curr_rank > 0 ? `+${$$props.item.system.curr_rank * 2}` : `-${$$props.item.system.curr_rank * 2}`)), append($$anchor2, text$1);
    }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor2) => {
      var text_1 = text(" 0");
      append($$anchor2, text_1);
    }, "alternate");
    if_block(node_1, ($$render) => {
      $$props.item.system.curr_rank !== 0 ? $$render(consequent) : $$render(alternate, !1);
    });
  }
  append($$anchor, div), pop();
}
__name(SkillTriggerButton, "SkillTriggerButton");
var root_2$s = /* @__PURE__ */ template('<div role="none" class="la-flexrow -justifybetween -widthfull -upper -fontsizesmall -letterspacing0 -padding0-lr"><i class="mdi mdi-arrow-down-left"></i> <span> </span> <i class="mdi mdi-arrow-down-right"></i></div>'), root_3$E = /* @__PURE__ */ template('<span class="la-prmy-transparent -fontsizesmall">&nbsp;</span>'), root_10$h = /* @__PURE__ */ template('<div class="la-skilltrigger la-flexrow -justifyend -widthfull"><!> <span class="la-skilltrigger__span -bordersround-rtb -small la-brdr-secondary la-bckg-darken-2"><span class="la-skilltrigger__inner -bordersround-rtb -small la-brdr-darken-2 la-text-text -fontsize4 -fontface-stylized -textaligncenter -overflowhidden -padding0-lr">&nbsp;0</span></span></div>'), root_14$a = /* @__PURE__ */ template('<span class="la-name__span -fontsize4"> </span>'), root_15$9 = /* @__PURE__ */ template('<i class="la-icon mdi mdi-card-off-outline -fontsize4 -margin1-lr"></i> <span class="la-name__span -fontsize4"> </span>', 1), root_13$a = /* @__PURE__ */ template('<details class="la-details -widthfull la-flexcol"><summary class="la-details__summary la-flexrow clipped-bot-alt la-bckg-repcap la-text-header -padding1-l -widthfull"><span class="la-left la-flexrow"><!></span></summary></details>'), root$S = /* @__PURE__ */ template("<div><!> <div><!></div></div>");
function MacroDropBox($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid;
  let component = state(null), executables = proxy($$props.getExes);
  const systemTypes = Object.values(SystemButton), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.uuid)), tipMain = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.advanced.addMacro.tooltip.0"), $$props.tooltipHeader)), tipAlt = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.advanced.addMacro.tooltip.1"), $$props.tooltipHeader)), logMain = getLocalized("LA.advanced.addMacro.tooltip.0"), logAlt = getLocalized("LA.advanced.addMacro.tooltip.1"), log = /* @__PURE__ */ derived(() => $$props.allowDrop ? logAlt : logMain);
  onMount(() => {
    get$1(component) && macroDropHandler.bind(get$1(component));
  });
  function isSystemFlow(item) {
    return systemTypes.includes(item);
  }
  __name(isSystemFlow, "isSystemFlow");
  function isSkillTrigger(item) {
    var _a2;
    return ((_a2 = fromUuidSync(item)) == null ? void 0 : _a2.type) === "skill";
  }
  __name(isSkillTrigger, "isSkillTrigger");
  function handleFlowDrop(_event, dropData, thisData) {
    if (dropData.type === LADataType.Sorting) {
      const [movedItem] = executables.splice(dropData.index, 1);
      executables.splice(thisData.index, 0, movedItem), $$props.setExes($$props.uuid, executables);
    }
  }
  __name(handleFlowDrop, "handleFlowDrop");
  function handleDelete(event2, index2) {
    event2.stopPropagation(), executables.splice(index2, 1), $$props.setExes($$props.uuid, executables);
  }
  __name(handleDelete, "handleDelete");
  const macroDropHandler = new foundry.applications.ux.DragDrop.implementation({
    dropSelector: ".macro-droppable",
    callbacks: {
      drop: /* @__PURE__ */ __name((event2) => handleMacroDocumentDrop(event2), "drop")
    }
  });
  function handleMacroDocumentDrop(event2) {
    var _a2;
    if (!$$props.allowDrop) return;
    const data = (_a2 = event2.dataTransfer) == null ? void 0 : _a2.getData("text/plain");
    if (!data) return;
    const obj = JSON.parse(data);
    switch (obj.type) {
      case "Macro":
        executables.push(obj.uuid), $$props.setExes($$props.uuid, executables);
        break;
      case LADataType.Sorting:
        break;
      default:
        Logger.log("Unsupported drop type", obj);
    }
  }
  __name(handleMacroDocumentDrop, "handleMacroDocumentDrop");
  var div = root$S(), node = child(div);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment = comment(), node_1 = first_child(fragment);
      {
        var consequent = /* @__PURE__ */ __name(($$anchor3) => {
          var div_1 = root_2$s(), span = sibling(child(div_1), 2), text2 = child(span);
          template_effect(($0) => set_text(text2, $0), [
            () => getLocalized("LA.advanced.addMacro.hint")
          ]), event("pointerenter", div_1, function(...$$args) {
            var _a2;
            (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
          }), event("pointerleave", div_1, function(...$$args) {
            var _a2;
            (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
          }), append($$anchor3, div_1);
        }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor3) => {
          var span_1 = root_3$E();
          append($$anchor3, span_1);
        }, "alternate");
        if_block(node_1, ($$render) => {
          $$props.allowDrop ? $$render(consequent) : $$render(alternate, !1);
        });
      }
      append($$anchor2, fragment);
    }, "consequent_1");
    if_block(node, ($$render) => {
      $$props.hintDropArea && $$render(consequent_1);
    });
  }
  var div_2 = sibling(node, 2), node_2 = child(div_2);
  {
    var consequent_5 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_1 = comment(), node_3 = first_child(fragment_1);
      each(node_3, 17, () => executables, index, ($$anchor3, type, index2) => {
        const expression = /* @__PURE__ */ derived(() => ({ type: LADataType.Sorting, index: index2 })), expression_1 = /* @__PURE__ */ derived(() => [
          "-fontsize4 -padding1-lr",
          ...$$props.iconStyle || []
        ]), expression_2 = /* @__PURE__ */ derived(() => !$$props.allowDrop), expression_3 = /* @__PURE__ */ derived(() => isSystemFlow(get$1(type)) || isSkillTrigger(get$1(type)));
        DragDropHandle($$anchor3, {
          index: index2,
          get root() {
            return get$1(component);
          },
          get data() {
            return get$1(expression);
          },
          style: ["-justifyend"],
          get iconStyle() {
            return get$1(expression_1);
          },
          onDrop: handleFlowDrop,
          onDelete: /* @__PURE__ */ __name((event2) => handleDelete(event2, index2), "onDelete"),
          get disabled() {
            return get$1(expression_2);
          },
          get deleteDisabled() {
            return get$1(expression_3);
          },
          get logging() {
            return $$props.logging;
          },
          children: /* @__PURE__ */ __name(($$anchor4, $$slotProps) => {
            var fragment_3 = comment(), node_4 = first_child(fragment_3);
            {
              var consequent_2 = /* @__PURE__ */ __name(($$anchor5) => {
                const expression_4 = /* @__PURE__ */ derived(() => [...$$props.buttonStyle || []]), expression_5 = /* @__PURE__ */ derived(() => [
                  FLOW_BUTTON_STYLE,
                  ...$$props.buttonTextStyle || []
                ]), expression_6 = /* @__PURE__ */ derived(() => fromUuidSync(get$1(type)));
                SkillTriggerButton($$anchor5, {
                  get buttonStyle() {
                    return get$1(expression_4);
                  },
                  get buttonTextStyle() {
                    return get$1(expression_5);
                  },
                  get item() {
                    return get$1(expression_6);
                  },
                  get tooltipEnabled() {
                    return $$props.tooltipEnabled;
                  },
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  get tooltipHeader() {
                    return $$props.tooltipHeader;
                  },
                  get logging() {
                    return $$props.logging;
                  }
                });
              }, "consequent_2"), alternate_3 = /* @__PURE__ */ __name(($$anchor5) => {
                var fragment_5 = comment(), node_5 = first_child(fragment_5);
                {
                  var consequent_4 = /* @__PURE__ */ __name(($$anchor6) => {
                    var fragment_6 = comment(), node_6 = first_child(fragment_6);
                    {
                      var consequent_3 = /* @__PURE__ */ __name(($$anchor7) => {
                        var div_3 = root_10$h(), node_7 = child(div_3);
                        const expression_7 = /* @__PURE__ */ derived(() => [...$$props.buttonStyle || []]), expression_8 = /* @__PURE__ */ derived(() => [
                          FLOW_BUTTON_STYLE,
                          ...$$props.buttonTextStyle || []
                        ]), expression_9 = /* @__PURE__ */ derived(() => ButtonFactory.getSystemButtonLabel(get$1(type))), expression_10 = /* @__PURE__ */ derived(() => ButtonFactory.getSystemButtonTipHeader(get$1(type))), expression_11 = /* @__PURE__ */ derived(() => ButtonFactory.getSystemButtonTip(get$1(type), $$props.uuid)), expression_12 = /* @__PURE__ */ derived(() => ButtonFactory.getSystemButtonTip(get$1(type), $$props.uuid));
                        FlowButton(node_7, {
                          get style() {
                            return get$1(expression_7);
                          },
                          get textStyle() {
                            return get$1(expression_8);
                          },
                          get text() {
                            return get$1(expression_9);
                          },
                          get flowClass() {
                            return FlowClass.None;
                          },
                          get uuid() {
                            return $$props.uuid;
                          },
                          get tooltipEnabled() {
                            return $$props.tooltipEnabled;
                          },
                          get tooltipTheme() {
                            return get$1(theme);
                          },
                          get tooltipHeader() {
                            return get$1(expression_10);
                          },
                          get tooltip() {
                            return get$1(expression_11);
                          },
                          get logText() {
                            return get$1(expression_12);
                          },
                          get logging() {
                            return $$props.logging;
                          },
                          onClick: /* @__PURE__ */ __name((event2) => {
                            event2.stopPropagation(), SkillTriggerOtherBase.getInstance().startFlow($$props.uuid, {});
                          }, "onClick")
                        }), append($$anchor7, div_3);
                      }, "consequent_3"), alternate_1 = /* @__PURE__ */ __name(($$anchor7) => {
                        const expression_13 = /* @__PURE__ */ derived(() => [...$$props.buttonStyle || []]), expression_14 = /* @__PURE__ */ derived(() => [
                          FLOW_BUTTON_STYLE,
                          ...$$props.buttonTextStyle || []
                        ]), expression_15 = /* @__PURE__ */ derived(() => ButtonFactory.getSystemButtonLabel(get$1(type))), expression_16 = /* @__PURE__ */ derived(() => ButtonFactory.getSystemButtonTipHeader(get$1(type))), expression_17 = /* @__PURE__ */ derived(() => ButtonFactory.getSystemButtonTip(get$1(type), $$props.uuid)), expression_18 = /* @__PURE__ */ derived(() => ButtonFactory.getSystemButtonTip(get$1(type), $$props.uuid));
                        FlowButton($$anchor7, {
                          get style() {
                            return get$1(expression_13);
                          },
                          get textStyle() {
                            return get$1(expression_14);
                          },
                          get text() {
                            return get$1(expression_15);
                          },
                          get flowClass() {
                            return FlowClass.Standard;
                          },
                          get uuid() {
                            return $$props.uuid;
                          },
                          get flowType() {
                            return get$1(type);
                          },
                          get tooltipEnabled() {
                            return $$props.tooltipEnabled;
                          },
                          get tooltipTheme() {
                            return get$1(theme);
                          },
                          get tooltipHeader() {
                            return get$1(expression_16);
                          },
                          get tooltip() {
                            return get$1(expression_17);
                          },
                          get logText() {
                            return get$1(expression_18);
                          },
                          get logging() {
                            return $$props.logging;
                          }
                        });
                      }, "alternate_1");
                      if_block(node_6, ($$render) => {
                        get$1(type) === SystemButton.SkillTriggerOther ? $$render(consequent_3) : $$render(alternate_1, !1);
                      });
                    }
                    append($$anchor6, fragment_6);
                  }, "consequent_4"), alternate_2 = /* @__PURE__ */ __name(($$anchor6) => {
                    const expression_19 = /* @__PURE__ */ derived(() => [...$$props.buttonStyle || []]), expression_20 = /* @__PURE__ */ derived(() => [
                      FLOW_BUTTON_STYLE,
                      ...$$props.buttonTextStyle || []
                    ]), expression_21 = /* @__PURE__ */ derived(() => {
                      var _a2;
                      return ((_a2 = fromUuidSync(get$1(type))) == null ? void 0 : _a2.name) || getLocalized("LA.placeholder");
                    });
                    FlowButton($$anchor6, {
                      get style() {
                        return get$1(expression_19);
                      },
                      get textStyle() {
                        return get$1(expression_20);
                      },
                      get text() {
                        return get$1(expression_21);
                      },
                      get flowClass() {
                        return CustomFlowClass.RunMacro;
                      },
                      onClick: /* @__PURE__ */ __name((event2) => {
                        event2.stopPropagation(), RunMacroBase.getInstance().startFlow($$props.uuid, { uuid: get$1(type) });
                      }, "onClick"),
                      get tooltipEnabled() {
                        return $$props.tooltipEnabled;
                      },
                      get tooltipTheme() {
                        return get$1(theme);
                      },
                      get logging() {
                        return $$props.logging;
                      }
                    });
                  }, "alternate_2");
                  if_block(
                    node_5,
                    ($$render) => {
                      isSystemFlow(get$1(type)) ? $$render(consequent_4) : $$render(alternate_2, !1);
                    },
                    !0
                  );
                }
                append($$anchor5, fragment_5);
              }, "alternate_3");
              if_block(node_4, ($$render) => {
                isSkillTrigger(get$1(type)) ? $$render(consequent_2) : $$render(alternate_3, !1);
              });
            }
            append($$anchor4, fragment_3);
          }, "children"),
          $$slots: { default: !0 }
        });
      }), append($$anchor2, fragment_1);
    }, "consequent_5"), alternate_5 = /* @__PURE__ */ __name(($$anchor2) => {
      var details = root_13$a(), summary = child(details), span_2 = child(summary), node_8 = child(span_2);
      {
        var consequent_6 = /* @__PURE__ */ __name(($$anchor3) => {
          var span_3 = root_14$a(), text_1 = child(span_3);
          template_effect(($0) => set_text(text_1, $0), [
            () => getLocalized("LA.advanced.addMacro.subLabel")
          ]), append($$anchor3, span_3);
        }, "consequent_6"), alternate_4 = /* @__PURE__ */ __name(($$anchor3) => {
          var fragment_9 = root_15$9(), span_4 = sibling(first_child(fragment_9), 2), text_2 = child(span_4);
          template_effect(($0) => set_text(text_2, $0), [
            () => getLocalized("LA.advanced.addMacro.label")
          ]), append($$anchor3, fragment_9);
        }, "alternate_4");
        if_block(node_8, ($$render) => {
          $$props.allowDrop ? $$render(consequent_6) : $$render(alternate_4, !1);
        });
      }
      template_effect(() => {
        set_attribute(summary, "data-tooltip", $$props.tooltipEnabled ? $$props.allowDrop ? get$1(tipAlt) : get$1(tipMain) : void 0), set_attribute(summary, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${get$1(theme)}`), set_attribute(summary, "data-tooltip-direction", $$props.tooltipDirection || TooltipDirection.UP);
      }), event("pointerenter", summary, function(...$$args) {
        var _a2;
        (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), event("pointerleave", summary, function(...$$args) {
        var _a2;
        (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), append($$anchor2, details);
    }, "alternate_5");
    if_block(node_2, ($$render) => {
      executables.length ? $$render(consequent_5) : $$render(alternate_5, !1);
    });
  }
  bind_this(div, ($$value) => set(component, $$value), () => get$1(component)), template_effect(
    ($0) => {
      set_class(div, `la-flexcol -widthfull
    ${($$props.hintDropArea ? "-divider la-prmy-accent" : "") ?? ""}`), set_class(div_2, `la-macroflows la-dropshadow la-flexcol -widthfull
        ${$0 ?? ""}
        macro-droppable`);
    },
    [() => {
      var _a2;
      return (_a2 = $$props.innerStyle) == null ? void 0 : _a2.join(" ");
    }]
  ), append($$anchor, div), pop();
}
__name(MacroDropBox, "MacroDropBox");
var root_1$B = /* @__PURE__ */ template("<video autoplay loop><source></video>", 2), root_2$r = /* @__PURE__ */ template('<button type="button"><img class="la-actor__img"></button>'), root$R = /* @__PURE__ */ template('<div class="la-flexrow"><!></div>');
function ImageVideo($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, actorImgVid = /* @__PURE__ */ derived(() => {
    var _a2;
    return ((_a2 = $$props.actor.prototypeToken) == null ? void 0 : _a2.texture.src) ?? $$props.actor.img;
  }), srcImage = /* @__PURE__ */ derived(() => get$1(actorImgVid) === "icons/svg/mystery-man.svg" ? `modules/${id}/assets/nodata.png` : get$1(actorImgVid)), tokenVideoMimeType = /* @__PURE__ */ derived(() => getVideoMimeType(get$1(actorImgVid))), tip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip($$props.tooltip || getLocalized("LA.edit.image.token.tooltip"), $$props.tooltipHeader)), tokenErrorTip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.edit.image.token.error"))), logging = /* @__PURE__ */ derived(() => $$props.logging && !$$props.editDisabled), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.edit.image.token.tooltip"));
  var div = root$R(), node = child(div);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var video = root_1$B();
      video.muted = !0, video.__click = function(...$$args) {
        var _a2;
        (_a2 = $$props.editDisabled ? void 0 : $$props.onPointerClick) == null || _a2.apply(this, $$args);
      };
      var source2 = child(video);
      template_effect(() => {
        set_class(video, `la-actor__img ${($$props.editDisabled ? "-pointerdisable" : "-pointercursor") ?? ""}`), set_attribute(video, "data-tooltip", $$props.tooltipEnabled ? $$props.editDisabled ? get$1(tokenErrorTip) : get$1(tip) : void 0), set_attribute(video, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(video, "data-tooltip-direction", $$props.tooltipDirection || TooltipDirection.UP), set_attribute(source2, "src", get$1(actorImgVid)), set_attribute(source2, "type", get$1(tokenVideoMimeType));
      }), event("pointerenter", video, function(...$$args) {
        var _a2;
        (_a2 = get$1(logging) ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), event("pointerleave", video, function(...$$args) {
        var _a2;
        (_a2 = get$1(logging) ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), append($$anchor2, video);
    }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor2) => {
      var button = root_2$r();
      button.__click = function(...$$args) {
        var _a2;
        (_a2 = $$props.editDisabled ? void 0 : $$props.onPointerClick) == null || _a2.apply(this, $$args);
      };
      var img = child(button);
      template_effect(
        ($0) => {
          set_class(button, $$props.editDisabled ? "-pointerblock" : ""), set_attribute(button, "data-tooltip", $$props.tooltipEnabled ? $$props.editDisabled ? get$1(tokenErrorTip) : get$1(tip) : void 0), set_attribute(button, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(button, "data-tooltip-direction", $$props.tooltipDirection || TooltipDirection.UP), set_attribute(img, "src", get$1(srcImage)), set_attribute(img, "alt", $0);
        },
        [() => getLocalized("LA.placeholder")]
      ), event("pointerenter", button, function(...$$args) {
        var _a2;
        (_a2 = get$1(logging) ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), event("pointerleave", button, function(...$$args) {
        var _a2;
        (_a2 = get$1(logging) ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), append($$anchor2, button);
    }, "alternate");
    if_block(node, ($$render) => {
      get$1(tokenVideoMimeType) ? $$render(consequent) : $$render(alternate, !1);
    });
  }
  append($$anchor, div), pop();
}
__name(ImageVideo, "ImageVideo");
delegate(["click"]);
var CustomFlagContentType = /* @__PURE__ */ ((CustomFlagContentType2) => (CustomFlagContentType2.Value = "value", CustomFlagContentType2.Fraction = "fraction", CustomFlagContentType2))(CustomFlagContentType || {});
const _CustomFlags = class _CustomFlags {
  static emptyContent(id2) {
    return {
      id: id2,
      name: "",
      contentType: CustomFlagContentType.Value,
      content: {
        min: 0,
        max: 0,
        value: 0
      },
      showInSidebar: !1,
      color: "#ffffff",
      icon: "mdi mdi-abacus",
      tooltip: ""
    };
  }
};
__name(_CustomFlags, "CustomFlags");
let CustomFlags = _CustomFlags;
function getCustomFlags(actor, flagKey) {
  return actor.getFlag(LancerAlternative.Name, flagKey) ?? new CustomFlags();
}
__name(getCustomFlags, "getCustomFlags");
function setCustomFlags(actor, flagKey, data) {
  return actor.setFlag(LancerAlternative.Name, flagKey, data);
}
__name(setCustomFlags, "setCustomFlags");
function addCustomFlag(actor, flagKey) {
  const data = getCustomFlags(actor, flagKey), id2 = foundry.utils.randomID(4);
  return data[id2] = CustomFlags.emptyContent(id2), setCustomFlags(actor, flagKey, data);
}
__name(addCustomFlag, "addCustomFlag");
function updateCustomFlag(actor, flagKey, id2, changes) {
  const data = getCustomFlags(actor, flagKey);
  return data[id2] ? (data[id2] = {
    ...data[id2],
    ...changes,
    content: changes.content ? { ...data[id2].content, ...changes.content } : data[id2].content
  }, setCustomFlags(actor, flagKey, data)) : Promise.resolve();
}
__name(updateCustomFlag, "updateCustomFlag");
function handleCustomFlagValueInput(event2, actor, flagKey, flag) {
  event2.preventDefault();
  const inputValue = event2.currentTarget.value;
  let newValue = flag.content.value;
  return inputValue && (inputValue.startsWith("+") ? newValue = flag.content.value + Number(inputValue.slice(1)) : inputValue.startsWith("-") ? newValue = flag.content.value - Number(inputValue.slice(1)) : newValue = Number(inputValue), Number.isNaN(newValue) && (newValue = flag.content.value)), event2.currentTarget.value = newValue.toString(), updateCustomFlag(actor, flagKey, flag.id, { content: { ...flag.content, value: newValue } });
}
__name(handleCustomFlagValueInput, "handleCustomFlagValueInput");
function deleteCustomFlag(actor, flagKey, id2) {
  return actor.update({
    [`flags.${LancerAlternative.Name}.${flagKey}.-=${id2}`]: null
  });
}
__name(deleteCustomFlag, "deleteCustomFlag");
function reorderCustomFlags(actor, flagKey, fromIndex, toIndex) {
  const entries = Object.entries(getCustomFlags(actor, flagKey)), [moved] = entries.splice(fromIndex, 1);
  entries.splice(toIndex, 0, moved);
  const reordered = {};
  for (const [id2, flag] of entries)
    reordered[id2] = flag;
  return actor.update(
    { [`flags.${LancerAlternative.Name}.${flagKey}`]: reordered },
    { recursive: !1 }
  );
}
__name(reorderCustomFlags, "reorderCustomFlags");
function getCustomFlagPath(flagKey, id2, field = "value") {
  return `flags.${LancerAlternative.Name}.${flagKey}.${id2}.content.${field}`;
}
__name(getCustomFlagPath, "getCustomFlagPath");
var CustomFlagKey = /* @__PURE__ */ ((CustomFlagKey2) => (CustomFlagKey2.Mech = "mech", CustomFlagKey2.Pilot = "pilot", CustomFlagKey2.NPC = "npc", CustomFlagKey2.Deployable = "deployable", CustomFlagKey2))(CustomFlagKey || {}), root_1$A = /* @__PURE__ */ template("<i></i>"), root_2$q = /* @__PURE__ */ template("<i></i>"), on_change$b = /* @__PURE__ */ __name((event2, system) => handleRelativeDataInput(event2, get$1(system).overshield.value), "on_change$b"), on_change_1$8 = /* @__PURE__ */ __name((event2, system) => handleRelativeDataInput(event2, get$1(system).burn), "on_change_1$8"), root_7$l = /* @__PURE__ */ template('<div class="la-flexcol -widthfull -fontface-stylized"><div class="la-flexrow -widthfull"><div class="-width14"></div> <div class="-flex5"><!></div> <div class="-width10"></div></div> <span> </span></div>'), on_change_2$6 = /* @__PURE__ */ __name((event2, actor, data) => handleCustomFlagValueInput(event2, get$1(actor), CustomFlagKey.Mech, data()), "on_change_2$6"), root_8$i = /* @__PURE__ */ template('<div class="-widthfull"><div class="la-shortstat la-flexrow la-text-text -fontsize6"><i></i> <div><input class="la-top__input -widthfull -medium -inset la-text-text -fontface-neutral -height4" type="text"> <span class="la-bottom__span"> </span></div></div></div>'), root_5$u = /* @__PURE__ */ template('<hr class="-widthfull"> <div class="la-flags la-flexcol -gap1 la-dropshadow -margin0-lr -widthfull"></div> <hr class="-widthfull">', 1), root$Q = /* @__PURE__ */ template('<div class="la-framename la-dropshadow -overflowhidden"><div class="la-flow -textalignleft -letterspacing0 la-bckg-primary la-text-header clipped-bot-alt -padding0-tb -margin7-t -margin1-l -fontface-stylized"><span class="la-cmdline la-text-header -fadein -fontface-neutral">>//:</span> <span class="la-extension la-text-header -lower -fadein"> </span><span class="la-cursor la-prmy-header -fadein"></span></div></div> <div class="la-actor la-dropshadow -aligncontentcenter -positionrelative"><div class="la-flexcol -positionabsolute -left0 -top0 -fontsize19"><!> <div class="la-flexrow -fontsize9"><i></i> <span> </span></div> <!></div> <!></div> <div class="la-stats la-dropshadow la-flexrow -justifyevenly -fontface-stylized"><!> <!> <!></div> <div class="la-spacer -medium"></div> <div class="la-damage la-dropshadow -margin0-lr"><div class="la-flexrow -gap2 -fontface-stylized"><div class="la-visuals -flex5"><!> <div class="la-spacer -tiny"></div> <!></div> <div><input class="la-damage__input la-shadow -medium -inset la-text-text -width7 -heightfull -bordersround-lrt -small -bordersoff"> <span> </span></div></div> <div class="la-spacer -large"></div> <div class="la-flexrow -gap2 -fontface-stylized"><div class="la-visuals -flex5"><!> <div class="la-spacer -tiny"></div> <!></div> <div><input class="la-damage__input la-shadow -medium -inset la-text-text -width7 -heightfull -bordersround-lrt -small -bordersoff"> <span> </span></div></div></div> <div class="la-spacer -small"></div> <div class="la-stats la-dropshadow la-flexrow -justifyevenly -fontface-stylized"><!> <!> <!></div> <div class="la-spacer -small"></div> <div class="la-stats la-dropshadow la-flexrow -justifyevenly -fontface-stylized"><div class="la-flexrow -alignselfcenter -positionrelative"><!></div> <!></div> <!> <!>', 1);
function Sidebar$1($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), system = /* @__PURE__ */ derived(() => props.system), actor = /* @__PURE__ */ derived(() => props.actor);
  setActorContext(get$1(actor));
  let component = state(null), editingBurn = state(!1), editingShield = state(!1);
  const logographic = logographicLanguage(), tooltipEnabled = getMechSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), themeOverride = /* @__PURE__ */ derived(() => getBrightness(getThemeKey(get$1(actor).uuid)) === "light" ? "la-text-primary" : "la-text-text"), sidebarExes = /* @__PURE__ */ derived(() => getSidebarExecutables$1(get$1(actor).uuid)), frame = /* @__PURE__ */ derived(() => {
    var _a;
    return (_a = get$1(system).loadout.frame) == null ? void 0 : _a.value;
  }), frameName = /* @__PURE__ */ derived(() => get$1(frame) ? `${get$1(frame).system.manufacturer} ${get$1(frame).name}` : getLocalized("LA.placeholder")), frameUUID = /* @__PURE__ */ derived(() => get$1(frame) ? get$1(frame).uuid : ""), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid)), customFlags = /* @__PURE__ */ derived(() => getCustomFlags(get$1(actor), CustomFlagKey.Mech)), visibleCustomFlags = /* @__PURE__ */ derived(() => Object.values(get$1(customFlags)).filter((flag) => flag.showInSidebar)), sizeTip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.size.tooltip"), `${getLocalized("LA.size.label")} ${get$1(system).size}`)), speedTip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.speed.tooltip"), `${getLocalized("LA.speed.label")} ${get$1(system).speed}`)), shieldTip = TooltipFactory.buildTooltip(getLocalized("LA.overshield.tooltip")), burnTip = TooltipFactory.buildTooltip(getLocalized("LA.burn.tooltip")), overchargePlusTip = TooltipFactory.buildTooltip(getLocalized("LA.overcharge.increase.tooltip")), overchargeMinusTip = TooltipFactory.buildTooltip(getLocalized("LA.overcharge.decrease.tooltip"));
  onMount(() => {
    if (get$1(component)) {
      const ratio = getSidebarRatio(get$1(actor).uuid), sidebar = jQuery(get$1(component)).closest(".la-root").find(".la-sidebar");
      sidebar && sidebar.css("flex", ratio.toString());
    }
  });
  var fragment = root$Q(), div = first_child(fragment), div_1 = child(div), text2 = sibling(child(div_1), 1, !0), span = sibling(text2), text_1 = child(span);
  bind_this(div, ($$value) => set(component, $$value), () => get$1(component));
  var div_2 = sibling(div, 2), div_3 = child(div_2), node = child(div_3);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var i = root_1$A();
      template_effect(() => {
        set_class(i, `cci cci-size-half ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_attribute(i, "data-tooltip", tooltipEnabled ? get$1(sizeTip) : void 0), set_attribute(i, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i, "data-tooltip-direction", TooltipDirection.RIGHT);
      }), append($$anchor2, i);
    }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor2) => {
      var i_1 = root_2$q();
      template_effect(() => {
        set_class(i_1, `cci cci-size-${get$1(system).size ?? ""} ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_attribute(i_1, "data-tooltip", tooltipEnabled ? get$1(sizeTip) : void 0), set_attribute(i_1, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i_1, "data-tooltip-direction", TooltipDirection.RIGHT);
      }), append($$anchor2, i_1);
    }, "alternate");
    if_block(node, ($$render) => {
      get$1(system).size < 1 ? $$render(consequent) : $$render(alternate, !1);
    });
  }
  var div_4 = sibling(node, 2), i_2 = child(div_4), span_1 = sibling(i_2, 2), text_2 = child(span_1), node_1 = sibling(div_4, 2);
  CoreAvailability(node_1, {
    get system() {
      return get$1(system);
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    }
  });
  var node_2 = sibling(div_3, 2);
  const expression = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.token.tooltip")), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.token.tooltip"));
  ImageVideo(node_2, {
    get actor() {
      return get$1(actor);
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    },
    get logText() {
      return get$1(expression_1);
    },
    logging: !0,
    onPointerClick: /* @__PURE__ */ __name((event2) => handleEditToken(event2, get$1(actor)), "onPointerClick")
  });
  var div_5 = sibling(div_2, 2), node_3 = child(div_5);
  const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.armor.short")), expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.armor.tooltip"));
  StatComboShort(node_3, {
    icon: "cci cci-role-defender -alignselfcenter",
    get label() {
      return get$1(expression_2);
    },
    get value() {
      return get$1(system).armor;
    },
    outerStyle: ["la-text-text -fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_3);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var node_4 = sibling(node_3, 2);
  const expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.evasion.short")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.evasion.tooltip"));
  StatComboShort(node_4, {
    icon: "cci cci-evasion -alignselfcenter",
    get label() {
      return get$1(expression_4);
    },
    get value() {
      return get$1(system).evasion;
    },
    outerStyle: ["la-text-text -fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_5);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var node_5 = sibling(node_4, 2);
  const expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.edefense.short")), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.edefense.tooltip"));
  StatComboShort(node_5, {
    icon: "cci cci-edef -alignselfcenter",
    get label() {
      return get$1(expression_6);
    },
    get value() {
      return get$1(system).edef;
    },
    outerStyle: ["la-text-text -fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_7);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var div_6 = sibling(div_5, 4), div_7 = child(div_6), div_8 = child(div_7), node_6 = child(div_8);
  const expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.hitpoint.short")), expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.hitpoint.tooltip"));
  StatusBar(node_6, {
    get name() {
      return get$1(expression_8);
    },
    nameStyle: [logographic ? "-fontsizemedium" : ""],
    dataName: "system.hp.value",
    get currentValue() {
      return get$1(system).hp.value;
    },
    get maxValue() {
      return get$1(system).hp.max;
    },
    barStyle: ["la-bckg-bar-health"],
    barEditStyle: ["la-prmy-bar-health"],
    get currentValueSecondary() {
      return get$1(system).overshield.value;
    },
    get maxValueSecondary() {
      return get$1(system).hp.max;
    },
    barStyleSecondary: ["la-bckg-bar-shield -shield"],
    barEditStyleSecondary: ["la-prmy-bar-shield"],
    textStyle: ["la-text-text"],
    clipPath: "clipped",
    get editSecondary() {
      return get$1(editingShield);
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_9);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var node_7 = sibling(node_6, 4);
  const expression_10 = /* @__PURE__ */ derived(() => getLocalized("LA.structure.label")), expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.structure.tooltip"));
  StatusBar(node_7, {
    get name() {
      return get$1(expression_10);
    },
    nameStyle: [logographic ? "-fontsizemedium" : ""],
    dataName: "system.structure.value",
    get currentValue() {
      return get$1(system).structure.value;
    },
    get maxValue() {
      return get$1(system).structure.max;
    },
    barStyle: ["la-bckg-bar-structure"],
    barEditStyle: ["la-prmy-bar-structure"],
    textStyle: ["la-text-text"],
    clipPath: "clipped-alt",
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_11);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var div_9 = sibling(div_8, 2);
  set_class(div_9, `la-flexcol -divider la-prmy-bar-shield -flex0 -textaligncenter la-prmy-bar-shield -margin0-r
                ${(qualityMode ? "-glow-prmy" : "") ?? ""}
                ${(logographic ? "-width4ch" : "-width3ch") ?? ""}`);
  var input = child(div_9);
  set_attribute(input, "type", "text"), set_attribute(input, "name", "system.overshield.value"), set_attribute(input, "data-dtype", "Number"), input.__change = [on_change$b, system];
  var span_2 = sibling(input, 2);
  set_class(span_2, `la-damage__span -heightfull -lineheight3
                    ${(logographic ? "-fontsizemedium" : "-fontsizesmall") ?? ""}`), set_attribute(span_2, "data-tooltip", tooltipEnabled ? shieldTip : void 0);
  var text_3 = child(span_2), div_10 = sibling(div_7, 4), div_11 = child(div_10), node_8 = child(div_11);
  const expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.heat.label")), expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.heat.tooltip"));
  StatusBar(node_8, {
    get name() {
      return get$1(expression_12);
    },
    nameStyle: [logographic ? "-fontsizemedium" : ""],
    dataName: "system.heat.value",
    get currentValue() {
      return get$1(system).heat.value;
    },
    get maxValue() {
      return get$1(system).heat.max;
    },
    barStyle: ["la-bckg-bar-heat"],
    barEditStyle: ["la-prmy-bar-heat"],
    get currentValueSecondary() {
      return get$1(system).burn;
    },
    get maxValueSecondary() {
      return get$1(system).heat.max;
    },
    barStyleSecondary: ["la-bckg-bar-burn -burn"],
    barEditStyleSecondary: ["la-prmy-bar-burn"],
    textStyle: ["la-text-text"],
    clipPath: "clipped",
    get editSecondary() {
      return get$1(editingBurn);
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_13);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var node_9 = sibling(node_8, 4);
  const expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.stress.label")), expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.stress.tooltip"));
  StatusBar(node_9, {
    get name() {
      return get$1(expression_14);
    },
    nameStyle: [logographic ? "-fontsizemedium" : ""],
    dataName: "system.stress.value",
    get currentValue() {
      return get$1(system).stress.value;
    },
    get maxValue() {
      return get$1(system).stress.max;
    },
    barStyle: ["la-bckg-bar-stress"],
    barEditStyle: ["la-prmy-bar-stress"],
    textStyle: ["la-text-text"],
    clipPath: "clipped-alt",
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_15);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var div_12 = sibling(div_11, 2);
  set_class(div_12, `la-flexcol -divider la-prmy-bar-burn -flex0 -textaligncenter la-prmy-bar-burn -margin0-r
                ${(qualityMode ? "-glow-prmy" : "") ?? ""}
                ${(logographic ? "-width4ch" : "-width3ch") ?? ""}`);
  var input_1 = child(div_12);
  set_attribute(input_1, "type", "text"), set_attribute(input_1, "name", "system.burn"), set_attribute(input_1, "data-dtype", "Number"), input_1.__change = [on_change_1$8, system];
  var span_3 = sibling(input_1, 2);
  set_class(span_3, `la-damage__span -heightfull -lineheight3
                    ${(logographic ? "-fontsizemedium" : "-fontsizesmall") ?? ""}`), set_attribute(span_3, "data-tooltip", tooltipEnabled ? burnTip : void 0);
  var text_4 = child(span_3), div_13 = sibling(div_6, 4), node_10 = child(div_13);
  const expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.tattack.short")), expression_17 = /* @__PURE__ */ derived(() => getLocalized("LA.tattack.tooltip"));
  StatComboShort(node_10, {
    icon: "cci cci-tech-full -alignselfcenter",
    get label() {
      return get$1(expression_16);
    },
    get value() {
      return get$1(system).tech_attack;
    },
    outerStyle: ["la-text-text -fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_17);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var node_11 = sibling(node_10, 2);
  const expression_18 = /* @__PURE__ */ derived(() => getLocalized("LA.save.short")), expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.save.tooltip"));
  StatComboShort(node_11, {
    icon: "cci cci-save -alignselfcenter",
    get label() {
      return get$1(expression_18);
    },
    get value() {
      return get$1(system).save;
    },
    outerStyle: ["la-text-text -fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_19);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var node_12 = sibling(node_11, 2);
  const expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.sensor.short")), expression_21 = /* @__PURE__ */ derived(() => getLocalized("LA.sensor.tooltip"));
  StatComboShort(node_12, {
    icon: "cci cci-sensor -alignselfcenter",
    get label() {
      return get$1(expression_20);
    },
    get value() {
      return get$1(system).sensor_range;
    },
    outerStyle: ["la-text-text -fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_21);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var div_14 = sibling(div_13, 4), div_15 = child(div_14);
  {
    const overchargeContentLeft = /* @__PURE__ */ __name(($$anchor2) => {
      GlyphButton($$anchor2, {
        type: "button",
        get flowClass() {
          return FlowClass.None;
        },
        style: [
          "mdi mdi-chevron-left la-text-secondary la-prmy-primary -fontsize5 -alignselfcenter",
          qualityMode ? "-glow-prmy-hover" : ""
        ],
        tooltipEnabled,
        tooltip: overchargeMinusTip,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipDirection() {
          return TooltipDirection.UP;
        },
        onClick: /* @__PURE__ */ __name((event2) => handleOverchargeDecrease(event2, get$1(actor)), "onClick")
      });
    }, "overchargeContentLeft"), overchargeContentRight = /* @__PURE__ */ __name(($$anchor2) => {
      GlyphButton($$anchor2, {
        type: "button",
        get flowClass() {
          return FlowClass.None;
        },
        style: [
          "mdi mdi-chevron-right la-text-secondary la-prmy-primary -fontsize5 -alignselfcenter",
          qualityMode ? "-glow-prmy-hover" : ""
        ],
        tooltipEnabled,
        tooltip: overchargePlusTip,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipDirection() {
          return TooltipDirection.UP;
        },
        onClick: /* @__PURE__ */ __name((event2) => handleOverchargeIncrease(event2, get$1(actor)), "onClick")
      });
    }, "overchargeContentRight");
    var node_13 = child(div_15);
    const expression_22 = /* @__PURE__ */ derived(() => getLocalized("LA.overcharge.short")), expression_23 = /* @__PURE__ */ derived(() => getCurrentOvercharge(get$1(actor))), expression_24 = /* @__PURE__ */ derived(() => getLocalized("LA.overcharge.tooltip"));
    StatComboShort(node_13, {
      icon: "cci cci-overcharge -alignselfcenter -width5",
      get label() {
        return get$1(expression_22);
      },
      get value() {
        return get$1(expression_23);
      },
      outerStyle: ["la-text-text -fontsize7"],
      innerStyle: [
        "-divider -fontsizemedium la-prmy-accent -textaligncenter",
        logographic ? "" : "-bold"
      ],
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_24);
      },
      get tooltipDirection() {
        return TooltipDirection.RIGHT;
      },
      contentLeft: overchargeContentLeft,
      contentRight: overchargeContentRight
    });
  }
  var node_14 = sibling(div_15, 2);
  const expression_25 = /* @__PURE__ */ derived(() => getLocalized("LA.repair.short")), expression_26 = /* @__PURE__ */ derived(() => getLocalized("LA.repair.tooltip"));
  StatComboShort(node_14, {
    icon: "cci cci-repair -alignselfcenter",
    get label() {
      return get$1(expression_25);
    },
    get value() {
      return get$1(system).repairs.value;
    },
    outerStyle: ["la-text-text -fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_26);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var node_15 = sibling(div_14, 2);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_3 = root_5$u(), div_16 = sibling(first_child(fragment_3), 2);
      each(div_16, 21, () => get$1(visibleCustomFlags), (flag) => flag.id, ($$anchor3, flag) => {
        var fragment_4 = comment();
        const createFractionBar = /* @__PURE__ */ __name(($$anchor4, data = noop) => {
          var div_17 = root_7$l(), div_18 = child(div_17), div_19 = sibling(child(div_18), 2), node_16 = child(div_19);
          const expression_27 = /* @__PURE__ */ derived(() => getCustomFlagPath(CustomFlagKey.Mech, data().id, "value"));
          StatusBar(node_16, {
            name: "",
            nameStyle: [logographic ? "-fontsizemedium" : ""],
            get dataName() {
              return get$1(expression_27);
            },
            get currentValue() {
              return data().content.value;
            },
            get maxValue() {
              return data().content.max;
            },
            barStyle: ["la-bckg-custom"],
            barEditStyle: ["la-bckg-custom"],
            textStyle: ["la-text-text"],
            clipPath: "clipped-alt"
          });
          var span_4 = sibling(div_18, 2);
          set_class(span_4, `-fontsizemedium -upper -padding4-l
                ${(logographic ? "" : "-bold") ?? ""}`);
          var text_5 = child(span_4);
          template_effect(
            ($0) => {
              set_attribute(div_19, "style", `--la-flag-custom: ${data().color ?? ""};`), set_attribute(span_4, "data-tooltip", $0), set_attribute(span_4, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span_4, "data-tooltip-direction", TooltipDirection.RIGHT), set_text(text_5, data().name);
            },
            [
              () => tooltipEnabled && data().tooltip ? TooltipFactory.buildTooltip(data().tooltip) : void 0
            ]
          ), append($$anchor4, div_17);
        }, "createFractionBar"), createValueGlyph = /* @__PURE__ */ __name(($$anchor4, data = noop) => {
          var div_20 = root_8$i(), div_21 = child(div_20), i_3 = child(div_21), div_22 = sibling(i_3, 2);
          set_class(div_22, `la-flexcol -divider -upper -fontface-stylized -fontsizemedium la-prmy-accent -textaligncenter
                    ${(logographic ? "" : "-bold") ?? ""}`);
          var input_2 = child(div_22);
          input_2.__change = [on_change_2$6, actor, data];
          var span_5 = sibling(input_2, 2), text_6 = child(span_5);
          template_effect(
            ($0) => {
              set_class(i_3, `${(data().icon ? data().icon : "mdi mdi-abacus") ?? ""} -alignselfcenter`), set_attribute(div_22, "data-tooltip", $0), set_attribute(div_22, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(div_22, "data-tooltip-direction", TooltipDirection.RIGHT), set_value(input_2, data().content.value), set_text(text_6, data().name);
            },
            [
              () => tooltipEnabled && data().tooltip ? TooltipFactory.buildTooltip(data().tooltip) : void 0
            ]
          ), event("focus", input_2, (event2) => event2.currentTarget.select()), append($$anchor4, div_20);
        }, "createValueGlyph");
        var node_17 = first_child(fragment_4);
        {
          var consequent_1 = /* @__PURE__ */ __name(($$anchor4) => {
            createFractionBar($$anchor4, () => get$1(flag));
          }, "consequent_1"), alternate_1 = /* @__PURE__ */ __name(($$anchor4) => {
            createValueGlyph($$anchor4, () => get$1(flag));
          }, "alternate_1");
          if_block(node_17, ($$render) => {
            get$1(flag).contentType === CustomFlagContentType.Fraction ? $$render(consequent_1) : $$render(alternate_1, !1);
          });
        }
        append($$anchor3, fragment_4);
      }), append($$anchor2, fragment_3);
    }, "consequent_2");
    if_block(node_15, ($$render) => {
      get$1(visibleCustomFlags).length && $$render(consequent_2);
    });
  }
  var node_18 = sibling(node_15, 2);
  const expression_28 = /* @__PURE__ */ derived(() => [
    FLOW_BUTTON_DEFAULT(),
    get$1(advancedOptions) ? "-margin7-l" : "-margin2-l"
  ]);
  MacroDropBox(node_18, {
    get uuid() {
      return get$1(actor).uuid;
    },
    get getExes() {
      return get$1(sidebarExes);
    },
    setExes: setSidebarExecutables$1,
    hintDropArea: !0,
    get allowDrop() {
      return get$1(advancedOptions);
    },
    get buttonStyle() {
      return get$1(expression_28);
    },
    tooltipEnabled,
    logging: !0
  }), template_effect(
    ($0, $1, $2) => {
      set_attribute(div_1, "data-uuid", get$1(frameUUID)), set_text(text2, get$1(frameName)), set_text(text_1, `--${$0 ?? ""}`), set_attribute(div_4, "data-tooltip", tooltipEnabled ? get$1(speedTip) : void 0), set_attribute(div_4, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(div_4, "data-tooltip-direction", TooltipDirection.RIGHT), set_class(i_2, `mdi mdi-arrow-right-bold-hexagon-outline ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_class(span_1, `${get$1(themeOverride) ?? ""} la-outl-shadow -bold`), set_text(text_2, get$1(system).speed), set_value(input, get$1(system).overshield.value), set_attribute(span_2, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span_2, "data-tooltip-direction", TooltipDirection.RIGHT), set_text(text_3, $1), set_value(input_1, get$1(system).burn), set_attribute(span_3, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span_3, "data-tooltip-direction", TooltipDirection.RIGHT), set_text(text_4, $2);
    },
    [
      () => getLocalized("LA.scan.label"),
      () => getLocalized("LA.overshield.short"),
      () => getLocalized("LA.burn.short")
    ]
  ), event("focus", input, (event2) => {
    event2.currentTarget.select(), set(editingShield, !0);
  }), event("blur", input, () => {
    set(editingShield, !1);
  }), event("focus", input_1, (event2) => {
    event2.currentTarget.select(), set(editingBurn, !0);
  }), event("blur", input_1, () => {
    set(editingBurn, !1);
  }), append($$anchor, fragment), pop();
}
__name(Sidebar$1, "Sidebar$1");
delegate(["change"]);
var ActionLogCollapsePrefix = /* @__PURE__ */ ((ActionLogCollapsePrefix2) => (ActionLogCollapsePrefix2.MechSheet = "mech", ActionLogCollapsePrefix2.NPCSheet = "npc", ActionLogCollapsePrefix2.PilotSheet = "pilot", ActionLogCollapsePrefix2.DeployableSheet = "deployable", ActionLogCollapsePrefix2))(ActionLogCollapsePrefix || {});
const collapseStates = writable({}), _collapseStatesRune = fromStore(collapseStates);
function getCollapseState(id2) {
  return id2 ? _collapseStatesRune.current[id2] : !1;
}
__name(getCollapseState, "getCollapseState");
function setCollapseState(id2, state2) {
  collapseStates.update((states) => (states[id2] = state2, states));
}
__name(setCollapseState, "setCollapseState");
const MAIN_HEADER_STYLE = "la-text-header la-prmy-header clipped-top -padding0-tb -padding3-lr";
var root_1$z = /* @__PURE__ */ template('<div class="la-flexrow -gap2 -aligncenter"><!></div>'), root$P = /* @__PURE__ */ template('<div><span role="none"><!> <!></span> <div><div><!></div></div></div>');
function HeaderMain($$anchor, $$props) {
  push($$props, !0);
  let isCollapsed = /* @__PURE__ */ derived(() => getCollapseState($$props.collapseID) ?? $$props.startCollapsed ?? !1);
  onMount(() => {
    $$props.collapseID && ($$props.dontSaveCollapse ?? getCollapseState($$props.collapseID) === void 0) && setCollapseState($$props.collapseID, $$props.startCollapsed ?? !1);
  });
  function toggleCollapse(event2) {
    event2.stopPropagation(), $$props.collapseID && setCollapseState($$props.collapseID, !get$1(isCollapsed));
  }
  __name(toggleCollapse, "toggleCollapse");
  function getExtensionText() {
    if ($$props.extensionTextFunction && $$props.extensionTextFunction()) return $$props.extensionTextFunction();
    if ($$props.extensionText) return $$props.extensionText;
    if ($$props.collapseID) return get$1(isCollapsed) ? `--${getLocalized("LA.expand.label")}` : `--${getLocalized("LA.collapse.label")}`;
  }
  __name(getExtensionText, "getExtensionText");
  var div = root$P(), span = child(div), node = child(span);
  const expression = /* @__PURE__ */ derived(() => $$props.collapseID || !$$props.extensionText ? `${$$props.text} ` : $$props.text), expression_1 = /* @__PURE__ */ derived(getExtensionText);
  TerminalText(node, {
    get text() {
      return get$1(expression);
    },
    get textStyle() {
      return $$props.textStyle;
    },
    get extensionText() {
      return get$1(expression_1);
    }
  });
  var node_1 = sibling(node, 2);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var div_1 = root_1$z(), node_2 = child(div_1);
      snippet(node_2, () => $$props.headerContent), append($$anchor2, div_1);
    }, "consequent");
    if_block(node_1, ($$render) => {
      $$props.headerContent && $$render(consequent);
    });
  }
  var div_2 = sibling(span, 2), div_3 = child(div_2), node_3 = child(div_3);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment = comment(), node_4 = first_child(fragment);
      snippet(node_4, () => $$props.children), append($$anchor2, fragment);
    }, "consequent_1");
    if_block(node_3, ($$render) => {
      $$props.children && $$render(consequent_1);
    });
  }
  template_effect(
    ($0, $1, $2) => {
      set_class(div, `la-collapsegroup -widthfull ${$0 ?? ""}
        ${($$props.acceptTypes ? `ref set drop-settable ${$$props.acceptTypes}` : "") ?? ""}
        collapse-group`), set_attribute(div, "data-item-id", $$props.itemID), set_attribute(div, "data-uuid", $$props.uuid), set_attribute(div, "data-path", $$props.path), set_attribute(div, "data-accept-types", $$props.acceptTypes), set_class(span, `la-summary la-flexrow la-dropshadow
            -justifybetween -widthfull -whitespacenowrap 
            ${$1 ?? ""}
            ${($$props.collapseID ? "collapse-trigger" : "") ?? ""}`), set_class(div_2, `la-collapsegroup__wrapper
            ${($$props.collapseID ? "collapse-wrapper" : "") ?? ""} ${(get$1(isCollapsed) ? "collapsed" : "") ?? ""}`), set_attribute(div_2, "data-la-collapse-id", $$props.collapseID), set_class(div_3, `la-collapsecontent 
                -padding0-l -padding0-tb -bordersround-lb -widthfull -heightfull
                ${$2 ?? ""}`);
    },
    [
      () => {
        var _a;
        return (_a = $$props.rootStyle) == null ? void 0 : _a.join(" ");
      },
      () => {
        var _a;
        return ((_a = $$props.headerStyle) == null ? void 0 : _a.join(" ")) || MAIN_HEADER_STYLE;
      },
      () => $$props.borderStyle ? $$props.borderStyle.join(" ") : "la-brdr-primary"
    ]
  ), event("click", span, (event2) => toggleCollapse(event2)), append($$anchor, div), pop();
}
__name(HeaderMain, "HeaderMain");
var root$O = /* @__PURE__ */ template('<details><summary class="la-empty__summary la-flexrow clipped-bot-alt la-bckg-repcap la-text-header -padding1 -pointercursor -widthfull"><span class="la-left la-flexrow"><i class="la-icon mdi mdi-card-off-outline -fontsize4 -margin1-lr"></i> <span class="la-name__span -fontsize4"> </span></span></summary> <div class="la-empty__wrapper -bordersround -bordersoff -textaligncenter -padding2"><span class="la-details__span la-text-repcap -fontsize6 -upper">[<span class="-fontsize4 -padding0-l -letterspacing0 -bold"> </span>]</span></div></details>');
function EmptyBox($$anchor, $$props) {
  var details = root$O(), summary = child(details), span = child(summary), span_1 = sibling(child(span), 2), text2 = child(span_1), div = sibling(summary, 2), span_2 = child(div), span_3 = sibling(child(span_2)), text_1 = child(span_3);
  template_effect(() => {
    set_class(details, `la-empty -widthfull la-flexcol
        ref set drop-settable ${$$props.type ?? ""}`), set_attribute(details, "data-accept-types", $$props.type), set_attribute(details, "data-path", $$props.path), set_text(text2, $$props.label), set_text(text_1, $$props.subLabel);
  }), append($$anchor, details);
}
__name(EmptyBox, "EmptyBox");
var root_4$g = /* @__PURE__ */ template('<i class="mdi mdi-close-circle la-text-header-anti"></i>'), root_5$t = /* @__PURE__ */ template('<span class="la-activeeffect"><img class="la-activeeffect__img la-dropshadow -float-l -height15 -padding0-r" alt="Effect Icon"> <span class="la-active-effect__span -fontsizemedium"><!></span></span>'), root$N = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"><!></div>');
function ActiveEffects($$anchor, $$props) {
  push($$props, !0);
  const qualityMode = getExtraEffectsEnabled(), themeOverride = /* @__PURE__ */ derived(() => getThemeKey($$props.actor.uuid)), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function getThemedIcon(effect2) {
    let theme2 = getBrightness(get$1(themeOverride));
    return effect2.icon ? theme2 === "dark" ? effect2.icon : effect2.icon.replace("/white/", "/") : theme2 === "dark" ? "systems/lancer/assets/icons/white/difficulty.svg" : "systems/lancer/assets/icons/difficulty.svg";
  }
  __name(getThemedIcon, "getThemedIcon");
  function deleteActiveEffect(event2) {
    if (event2.stopPropagation(), !$$props.owner) {
      Logger.error("User is not the owner of this actor.");
      return;
    }
    let id2 = event2.currentTarget.getAttribute("data-uuid");
    try {
      $$props.actor.deleteEmbeddedDocuments("ActiveEffect", [id2], {
        diff: !0,
        render: !0,
        type: "ActiveEffect"
      });
    } catch (error) {
      Logger.error("Error deleting active effect.", error);
    }
  }
  __name(deleteActiveEffect, "deleteActiveEffect");
  var div = root$N(), node = child(div);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment = comment(), node_1 = first_child(fragment);
      each(node_1, 17, () => $$props.effects, index, ($$anchor3, effect2, index2) => {
        const headerOptions = /* @__PURE__ */ __name(($$anchor4) => {
          const expression = /* @__PURE__ */ derived(() => getLocalized("LA.delete.tooltip"));
          GlyphButton($$anchor4, {
            style: [
              "la-prmy-error -fontsize4 -height4 -lineheight4",
              qualityMode ? "-glow-prmy-hover" : ""
            ],
            get uuid() {
              return get$1(effect2)._id;
            },
            get flowClass() {
              return FlowClass.DeleteActiveEffect;
            },
            onClick: deleteActiveEffect,
            get tooltipEnabled() {
              return $$props.tooltipEnabled;
            },
            get tooltipTheme() {
              return get$1(theme);
            },
            get logText() {
              return get$1(expression);
            },
            get logging() {
              return $$props.logging;
            },
            children: /* @__PURE__ */ __name(($$anchor5, $$slotProps) => {
              var i = root_4$g();
              append($$anchor5, i);
            }, "children"),
            $$slots: { default: !0 }
          });
        }, "headerOptions"), expression_1 = /* @__PURE__ */ derived(() => `--${getLocalized("LA.info.label")}`), expression_2 = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.status.activeEffects.${index2}`);
        HeaderMain($$anchor3, {
          get text() {
            return get$1(effect2).name;
          },
          headerStyle: [
            MAIN_HEADER_STYLE,
            "la-bckg-warning clipped-bot-alt"
          ],
          textStyle: [
            "la-text-header-anti la-prmy-header-anti -fontsizemedium -bold"
          ],
          borderStyle: [
            "la-bckg-card la-brdr-warning -overflowhidden -padding1-lr"
          ],
          get extensionText() {
            return get$1(expression_1);
          },
          get collapseID() {
            return get$1(expression_2);
          },
          startCollapsed: !0,
          headerContent: headerOptions,
          children: /* @__PURE__ */ __name(($$anchor4, $$slotProps) => {
            var span = root_5$t(), img = child(span), span_1 = sibling(img, 2), node_2 = child(span_1);
            html(node_2, () => get$1(effect2).description), template_effect(($0) => set_attribute(img, "src", $0), [
              () => encodeURI(getThemedIcon(get$1(effect2)))
            ]), append($$anchor4, span);
          }, "children"),
          $$slots: { default: !0 }
        });
      }), append($$anchor2, fragment);
    }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor2) => {
      const expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.status.effects.none.label")), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.status.effects.none.subLabel"));
      EmptyBox($$anchor2, {
        get label() {
          return get$1(expression_3);
        },
        get subLabel() {
          return get$1(expression_4);
        }
      });
    }, "alternate");
    if_block(node, ($$render) => {
      $$props.effects.length ? $$render(consequent) : $$render(alternate, !1);
    });
  }
  append($$anchor, div), pop();
}
__name(ActiveEffects, "ActiveEffects");
const _DEFAULT_BUTTON = /* @__PURE__ */ __name(() => " la-prmy-header la-scdy-primary la-text-header -fontsize5 -lineheight4 " + (getExtraEffectsEnabled() ? "-glow-scdy-hover -glow-prmy " : " "), "_DEFAULT_BUTTON");
var on_click$5 = /* @__PURE__ */ __name((event2, toggleCollapseAll) => toggleCollapseAll(event2), "on_click$5"), root$M = /* @__PURE__ */ template('<button type="button"><i></i></button>');
function CollapseAllButton($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid;
  let isExpanding = /* @__PURE__ */ derived(() => !getCollapseState($$props.collapseID));
  const tip = TooltipFactory.buildTooltip(getLocalized("LA.collapseAll.tooltip")), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.collapseAll.tooltip"));
  function handleOnPointerEnter(event2) {
    if ($$props.onPointerEnter && $$props.onPointerEnter(), $$props.logging) sendToTextConsole(event2, get$1(log), actorUuid);
    else return;
  }
  __name(handleOnPointerEnter, "handleOnPointerEnter");
  function handleOnPointerLeave(event2) {
    if ($$props.onPointerLeave && $$props.onPointerLeave(), $$props.logging) resetTextConsole(event2, actorUuid);
    else return;
  }
  __name(handleOnPointerLeave, "handleOnPointerLeave");
  function toggleCollapseAll(event2) {
    if (event2.stopPropagation(), !$$props.collapseID || event2.currentTarget === null) return;
    const collapseGroup = jQuery(event2.currentTarget).closest(".collapse-group");
    collapseGroup && (collapseGroup.find("[data-la-collapse-id]").each((_, trigger) => {
      const childId = jQuery(trigger).data("la-collapse-id");
      childId !== $$props.collapseID && childId && setCollapseState(childId, get$1(isExpanding));
    }), setCollapseState($$props.collapseID, get$1(isExpanding)));
  }
  __name(toggleCollapseAll, "toggleCollapseAll");
  var button = root$M();
  button.__click = [on_click$5, toggleCollapseAll];
  var i = child(button);
  template_effect(
    ($0, $1, $2) => {
      set_class(button, $0), set_attribute(button, "data-tooltip", $$props.tooltipEnabled ? tip : void 0), set_attribute(button, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(button, "data-tooltip-direction", $$props.tooltipDirection || TooltipDirection.UP), set_attribute(button, "aria-label", $1), set_class(i, `mdi ${(get$1(isExpanding) ? "mdi-arrow-collapse-all" : "mdi-arrow-expand-all") ?? ""}
        ${$2 ?? ""}`);
    },
    [
      () => {
        var _a2;
        return ((_a2 = $$props.style) == null ? void 0 : _a2.join(" ")) || _DEFAULT_BUTTON();
      },
      () => getLocalized("LA.collapseAll.tooltip"),
      () => {
        var _a2;
        return (_a2 = $$props.iconStyle) == null ? void 0 : _a2.join(" ");
      }
    ]
  ), event("pointerenter", button, handleOnPointerEnter), event("pointerleave", button, handleOnPointerLeave), append($$anchor, button), pop();
}
__name(CollapseAllButton, "CollapseAllButton");
delegate(["click"]);
const H2_HEADER_STYLE = " clipped-bot-alt -padding0-l -padding3-r la-text-header la-prmy-header ", H2_ICON_SIZE = " -fontsize7 ", H2_TEXT_SIZE = " -fontsize3 ";
var root_2$p = /* @__PURE__ */ template('<div class="la-right la-flexrow -aligncenter"><!></div>'), root_4$f = /* @__PURE__ */ template("<div><div><!></div></div>"), root$L = /* @__PURE__ */ template('<div><div><div class="la-left la-flexrow -justifystart -aligncenter -gap1 -widthfull -overflowhidden"><!> <!></div> <!></div> <!> <!></div>');
function HeaderSecondary($$anchor, $$props) {
  push($$props, !0);
  const isCollapsed = /* @__PURE__ */ derived(() => getCollapseState($$props.collapseID) ?? $$props.startCollapsed ?? !1);
  onMount(() => {
    $$props.collapseID && ($$props.dontSaveCollapse || getCollapseState($$props.collapseID) === void 0) && setCollapseState($$props.collapseID, $$props.startCollapsed ?? !1);
  });
  function toggleCollapse(event2) {
    event2.stopPropagation(), $$props.collapseID && setCollapseState($$props.collapseID, !get$1(isCollapsed));
  }
  __name(toggleCollapse, "toggleCollapse");
  function getExtensionText() {
    if ($$props.extensionTextFunction && $$props.extensionTextFunction()) return $$props.extensionTextFunction();
    if ($$props.extensionText) return $$props.extensionText;
    if ($$props.collapseID) return get$1(isCollapsed) ? `--${getLocalized("LA.expand.label")}` : `--${getLocalized("LA.collapse.label")}`;
  }
  __name(getExtensionText, "getExtensionText");
  var div = root$L(), div_1 = child(div), div_2 = child(div_1), node = child(div_2);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment = comment(), node_1 = first_child(fragment);
      snippet(node_1, () => $$props.contentLeft), append($$anchor2, fragment);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.contentLeft && $$render(consequent);
    });
  }
  var node_2 = sibling(node, 2);
  const expression = /* @__PURE__ */ derived(() => $$props.collapseID || !$$props.extensionText ? `${$$props.text} ` : $$props.text), expression_1 = /* @__PURE__ */ derived(getExtensionText), expression_2 = /* @__PURE__ */ derived(() => $$props.disableCmdline || !0), expression_3 = /* @__PURE__ */ derived(() => $$props.disableCursor || !1), expression_4 = /* @__PURE__ */ derived(() => $$props.disableExtension || !1);
  TerminalText(node_2, {
    get text() {
      return get$1(expression);
    },
    get textStyle() {
      return $$props.textStyle;
    },
    get extensionText() {
      return get$1(expression_1);
    },
    get disableCmdline() {
      return get$1(expression_2);
    },
    get disableCursor() {
      return get$1(expression_3);
    },
    get disableExtension() {
      return get$1(expression_4);
    }
  });
  var node_3 = sibling(div_2, 2);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var div_3 = root_2$p(), node_4 = child(div_3);
      snippet(node_4, () => $$props.contentRight), append($$anchor2, div_3);
    }, "consequent_1");
    if_block(node_3, ($$render) => {
      $$props.contentRight && $$render(consequent_1);
    });
  }
  var node_5 = sibling(div_1, 2);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_1 = comment(), node_6 = first_child(fragment_1);
      snippet(node_6, () => $$props.renderOutsideCollapse), append($$anchor2, fragment_1);
    }, "consequent_2");
    if_block(node_5, ($$render) => {
      $$props.renderOutsideCollapse && $$render(consequent_2);
    });
  }
  var node_7 = sibling(node_5, 2);
  {
    var consequent_4 = /* @__PURE__ */ __name(($$anchor2) => {
      var div_4 = root_4$f(), div_5 = child(div_4), node_8 = child(div_5);
      {
        var consequent_3 = /* @__PURE__ */ __name(($$anchor3) => {
          var fragment_2 = comment(), node_9 = first_child(fragment_2);
          snippet(node_9, () => $$props.children), append($$anchor3, fragment_2);
        }, "consequent_3");
        if_block(node_8, ($$render) => {
          $$props.children && $$render(consequent_3);
        });
      }
      template_effect(
        ($0) => {
          set_class(div_4, `la-collapsegroup__wrapper
            ${($$props.collapseID ? "collapse-wrapper" : "") ?? ""} ${(get$1(isCollapsed) ? "collapsed" : "") ?? ""}`), set_attribute(div_4, "data-la-collapse-id", $$props.collapseID), set_class(div_5, `la-collapsecontent 
                -padding0-l -padding0-tb -bordersround-lb -widthfull -heightfull
                ${$0 ?? ""}`);
        },
        [
          () => $$props.borderStyle ? $$props.borderStyle.join(" ") : "la-brdr-primary"
        ]
      ), append($$anchor2, div_4);
    }, "consequent_4");
    if_block(node_7, ($$render) => {
      ($$props.collapseID || $$props.children) && $$render(consequent_4);
    });
  }
  template_effect(
    ($0, $1) => {
      set_class(div, `la-collapsegroup -widthfull ${$0 ?? ""}
        ${($$props.acceptTypes ? `ref set drop-settable ${$$props.acceptTypes}` : "") ?? ""}
        collapse-group`), set_attribute(div, "data-item-id", $$props.itemID), set_attribute(div, "data-uuid", $$props.uuid), set_attribute(div, "data-path", $$props.path), set_attribute(div, "data-accept-types", $$props.acceptTypes), set_attribute(div, "draggable", $$props.acceptTypes ? "true" : "false"), set_class(div_1, `la-summary la-flexrow la-dropshadow 
            -justifybetween -widthfull -whitespacenowrap 
            ${$1 ?? ""}
            ${($$props.collapseID ? "collapse-trigger" : "") ?? ""}`);
    },
    [
      () => $$props.rootStyle ? $$props.rootStyle.join(" ") : "",
      () => {
        var _a;
        return ((_a = $$props.headerStyle) == null ? void 0 : _a.join(" ")) || H2_HEADER_STYLE;
      }
    ]
  ), event("click", div_1, (event2) => toggleCollapse(event2)), append($$anchor, div), pop();
}
__name(HeaderSecondary, "HeaderSecondary");
const _AppliedDamage = class _AppliedDamage {
  constructor(damageData) {
    __publicField(this, "Kinetic");
    __publicField(this, "Energy");
    __publicField(this, "Explosive");
    __publicField(this, "Burn");
    __publicField(this, "Heat");
    __publicField(this, "Variable");
    this.Kinetic = this.sum_damage(damageData, "Kinetic"), this.Energy = this.sum_damage(damageData, "Energy"), this.Explosive = this.sum_damage(damageData, "Explosive"), this.Burn = this.sum_damage(damageData, "Burn"), this.Heat = this.sum_damage(damageData, "Heat"), this.Variable = this.sum_damage(damageData, "Variable");
  }
  sum_damage(damageData, damageType) {
    return damageData.reduce((sum, d) => sum + (d.type === damageType ? parseInt(d.val) : 0), 0);
  }
};
__name(_AppliedDamage, "AppliedDamage");
let AppliedDamage = _AppliedDamage;
const _Damage = class _Damage {
  constructor(data) {
    __publicField(this, "type");
    __publicField(this, "val");
    this.type = data.type, this.val = data.val;
  }
  save() {
    return {
      type: this.type,
      val: this.val
    };
  }
  copy() {
    return new _Damage(this.save());
  }
  // Methods / getters / Various formatting options
  get icon() {
    return _Damage.IconFor(this.type);
  }
  get text() {
    return `${this.val} ${this.type} Damage`;
  }
  get discord_emoji() {
    return _Damage.DiscordEmojiFor(this.type);
  }
  get color() {
    return _Damage.ColorFor(this.type);
  }
  // Returns the css font icon corresponding to the provided damage type
  static IconFor(dt) {
    return `cci-${dt.toLowerCase()}`;
  }
  static DiscordEmojiFor(dt) {
    return `:cc_damage_${dt.toLowerCase()}:`;
  }
  // Returns the css color name corresponding to the provided damage type
  static ColorFor(dt) {
    return `damage--${dt.toLowerCase()}`;
  }
  // Convert a damage type array to a checklist. If no damage types provided, assume all
  static MakeChecklist(damages) {
    let override = damages.length == 0;
    return {
      Burn: override || damages.includes("Burn"),
      Energy: override || damages.includes("Energy"),
      Explosive: override || damages.includes("Explosive"),
      Heat: override || damages.includes("Heat"),
      Kinetic: override || damages.includes("Kinetic"),
      Variable: override || damages.includes("Variable")
    };
  }
  // Undo the above conversion
  static FlattenChecklist(damages) {
    return Object.keys(damages).filter((d) => damages[d]);
  }
  // Combine two arrays of damage. Does not edit originals
  static CombineLists(base, addition) {
    let result = base.map((d) => d.copy());
    for (let add of addition) {
      let to_be_modified = result.find((result_d) => result_d.type == add.type);
      if (to_be_modified)
        try {
          let base_formula = new Roll(to_be_modified.val), add_formula = new Roll(add.val);
          for (let add_term of add_formula.terms) {
            let added = !1;
            for (let base_term of base_formula.terms)
              if (add_term.number && base_term.number && add_term.faces === base_term.faces) {
                base_term.number += add_term.number, added = !0;
                break;
              }
            !added && !add_term.operator && (base_formula = new Roll(base_formula.formula + " + " + add_term.formula));
          }
          to_be_modified.val = base_formula.formula;
        } catch {
          to_be_modified.val += ` + ${add.val}`;
        }
      else
        result.push(add.copy());
    }
    return result;
  }
};
__name(_Damage, "Damage");
let Damage = _Damage;
function rebindButtons(messageData, messageContainer) {
  $(messageContainer).find(".lancer-button").toArray().forEach((buttonElement) => {
    const button = $(buttonElement);
    if (button.hasClass("lancer-damage-flow"))
      handleDamageFlow(messageData, button);
    else if (button.hasClass("lancer-damage-apply"))
      handleDamageApply(messageData, button);
    else if (button.hasClass("lancer-damage-undo"))
      handleDamageUndo(messageData, button);
    else if (button.hasClass("flow-button")) {
      const flowType = button.data("flow-type");
      flowType ? flowType === "cascade" ? handleCascadeFlow(messageData, button) : flowType === "secondaryStructure" ? handleSecondaryStructureFlow(messageData, button) : flowType === "check" ? handleCheckFlow(messageData, button) : Logger.warn(`Unknown flow button class: ${flowType}. Please report this to Lancer Alternative Sheets author with the action in the chat that caused it. Like for realsies.`, button) : Logger.warn("Flow button missing [data-flow-type] attribute");
    } else
      Logger.warn(`Unknown lancer button class: ${button.attr("class")}. Please report this to Lancer Alternative Sheets author with the action in the chat that caused it. No, really.`, button);
  });
}
__name(rebindButtons, "rebindButtons");
function handleDamageFlow(messageData, button) {
  async function runDamageFlow() {
    var _a;
    const attackData = (_a = messageData == null ? void 0 : messageData.flags.lancer) == null ? void 0 : _a.attackData, actor = await fromUuid(attackData == null ? void 0 : attackData.attackerUuid), item = await fromUuid(attackData == null ? void 0 : attackData.attackerItemUuid);
    if (!item && !attackData)
      return;
    const hitResults = attackData == null ? void 0 : attackData.targets.map(async (target) => {
      if (!(!target || target.documentName !== "Token"))
        return {
          target: await fromUuid(target.id),
          total: target.total,
          usedLockOn: target.setConditions.lockOn === !1,
          hit: target.hit,
          crit: target.crit
        };
    }), damage = [], bonusDamage = [];
    attackData != null && attackData.invade && damage.push({ type: "Heat", val: "2" });
    const DamageRollFlow = game.lancer.flows.get("DamageRollFlow");
    new DamageRollFlow(
      (item == null ? void 0 : item.uuid) || (attackData == null ? void 0 : attackData.attackerUuid),
      {
        title: `${(item == null ? void 0 : item.name) || (actor == null ? void 0 : actor.name)}  ${getLocalized("LA.damage.label").toUpperCase()}`,
        configurable: !0,
        invade: attackData == null ? void 0 : attackData.invade,
        hit_results: hitResults,
        has_normal_hit: hitResults == null ? void 0 : hitResults.some((hr) => hr.hit && !hr.crit),
        has_crit_hit: hitResults == null ? void 0 : hitResults.some((hr) => hr.crit),
        damage,
        bonus_damage: bonusDamage
      }
    ).begin();
  }
  __name(runDamageFlow, "runDamageFlow"), button.on("click", async () => {
    runDamageFlow();
  });
}
__name(handleDamageFlow, "handleDamageFlow");
function handleDamageApply(messageData, button) {
  async function runApplyDamageFlow(event2) {
    var _a, _b;
    const buttonGroup = event2.currentTarget.closest(".lancer-damage-button-group"), data = buttonGroup == null ? void 0 : buttonGroup.dataset, target = await fromUuid(data.target), actor = target == null ? void 0 : target.actor;
    if (!data || !actor)
      return;
    const targetDamage = ((_a = messageData == null ? void 0 : messageData.flags.lancer) == null ? void 0 : _a.damageData).targetDamageResults.map((dmgTarget) => {
      const target2 = fromUuidSync(dmgTarget.target);
      return target2 ? {
        ...dmgTarget,
        target: target2
      } : null;
    }).filter((t) => t !== null).find((dmgTarget) => {
      var _a2;
      return ((_a2 = dmgTarget == null ? void 0 : dmgTarget.target) == null ? void 0 : _a2.uuid) === data.target;
    }), multiple = parseFloat((_b = buttonGroup.querySelector("select")) == null ? void 0 : _b.value) || 1;
    await actor.damageCalc(
      new AppliedDamage(targetDamage.damage.map((damage) => new Damage({
        type: damage.type,
        val: damage.amount.toString()
      }))),
      {
        multiple,
        addBurn: data.addBurn === "true",
        isCrit: data.isCrit === "true",
        isHit: data.isHit === "true",
        ap: targetDamage.ap,
        paracausal: targetDamage.paracausal
      }
    );
  }
  __name(runApplyDamageFlow, "runApplyDamageFlow"), button.on("click", async (event2) => {
    runApplyDamageFlow(event2);
  });
}
__name(handleDamageApply, "handleDamageApply");
function handleDamageUndo(_messageData, button) {
  async function runDamageUndo(event2) {
    var _a, _b;
    const overshieldDelta = parseInt(event2.currentTarget.dataset.overshieldDelta), hpDelta = parseInt(event2.currentTarget.dataset.hpDelta), heatDelta = parseInt(event2.currentTarget.dataset.heatDelta), burnDelta = event2.currentTarget.dataset.addBurn === "true" ? parseInt(event2.currentTarget.dataset.burnDelta) : 0;
    if (!overshieldDelta && !hpDelta && !burnDelta && !heatDelta) {
      (_a = ui.notifications) == null || _a.error("Damage undo button has no damage to undo!");
      return;
    }
    const target = await fromUuid(event2.currentTarget.dataset.uuid);
    if (!target) {
      (_b = ui.notifications) == null || _b.error("Damage undo button has no target");
      return;
    }
    const updateData = {
      system: {
        "overshield.value": target.system.overshield.value + overshieldDelta,
        "hp.value": target.system.hp.value + hpDelta,
        burn: target.system.burn - burnDelta
      }
    };
    (target.is_mech() || target.is_npc() || target.is_deployable()) && (updateData.system["heat.value"] = target.system.heat.value - heatDelta), await target.update(updateData);
  }
  __name(runDamageUndo, "runDamageUndo"), button.on("click", async (event2) => {
    runDamageUndo(event2);
  });
}
__name(handleDamageUndo, "handleDamageUndo");
function handleCascadeFlow(messageData, button) {
  async function runCascadeFlow() {
    const CascadeFlow = game.lancer.flows.get("CascadeFlow");
    new CascadeFlow(`Actor.${messageData.speaker.actor}`).begin();
  }
  __name(runCascadeFlow, "runCascadeFlow"), button.on("click", async () => {
    runCascadeFlow();
  });
}
__name(handleCascadeFlow, "handleCascadeFlow");
function handleSecondaryStructureFlow(messageData, button) {
  async function runSecondaryStructureFlow() {
    const SecondaryStructureFlow = game.lancer.flows.get("SecondaryStructureFlow");
    new SecondaryStructureFlow(`Actor.${messageData.speaker.actor}`).begin();
  }
  __name(runSecondaryStructureFlow, "runSecondaryStructureFlow"), button.on("click", async () => {
    runSecondaryStructureFlow();
  });
}
__name(handleSecondaryStructureFlow, "handleSecondaryStructureFlow");
function handleCheckFlow(messageData, button) {
  async function runCheckFlow() {
    const checkType = button.data("check-type"), StatRollFlow = game.lancer.flows.get("StatRollFlow");
    new StatRollFlow(`Actor.${messageData.speaker.actor}`, `system.${checkType}`).begin();
  }
  __name(runCheckFlow, "runCheckFlow"), button.on("click", async () => {
    runCheckFlow();
  });
}
__name(handleCheckFlow, "handleCheckFlow");
var root$K = /* @__PURE__ */ template('<div class="-fontsizemedium"><!></div>');
function ActionLogMessage($$anchor, $$props) {
  push($$props, !0);
  let component = null;
  onMount(() => {
    component && rebindButtons($$props.messageData, component);
  });
  var div = root$K(), node = child(div);
  html(node, () => $$props.messageData.content), bind_this(div, ($$value) => component = $$value, () => component), append($$anchor, div), pop();
}
__name(ActionLogMessage, "ActionLogMessage");
const headerSecondaryLeftOptions$1 = /* @__PURE__ */ __name(($$anchor) => {
  var i = root_1$y();
  append($$anchor, i);
}, "headerSecondaryLeftOptions$1");
var root_1$y = /* @__PURE__ */ template('<i class="mdi mdi-message-text -fontsizemedium -padding0"></i>'), root_3$D = /* @__PURE__ */ template('<span class="-fontsizesmall"> </span>'), root$J = /* @__PURE__ */ template('<div class="la-actionlog -main la-flexcol -gap0 -widthfull -displayflex -directioncolumnreverse"></div>');
function ActionLog($$anchor, $$props) {
  push($$props, !0);
  const messages = game.messages, idParts = /* @__PURE__ */ derived(() => $$props.uuid.split("."));
  let filteredMessages = proxy((messages == null ? void 0 : messages.filter((m) => {
    var _a;
    const msgActorID = m.speaker.token || m.speaker.actor;
    return get$1(idParts).includes(msgActorID) && ((_a = m.content) == null ? void 0 : _a.trim().startsWith("<div c"));
  })) || []), component = state(null), extractedTimes = state(proxy([])), extractedNames = proxy([]), animationFrame;
  onMount(() => {
    filteredMessages.forEach((message) => {
      get$1(extractedTimes).push(extractTime(message.timestamp)), extractedNames.push(extractName(message.content));
    }), trackHook(
      $$props.uuid,
      Hooks.on("createChatMessage", (message) => {
        var _a;
        const msgActorID = message.speaker.token || message.speaker.actor;
        get$1(idParts).includes(msgActorID) && ((_a = message.content) != null && _a.trim().startsWith("<div c")) && (filteredMessages.push(message), get$1(extractedTimes).push(extractTime(message.timestamp)), extractedNames.push(extractName(message.content)));
      }),
      "createChatMessage"
    ), trackHook(
      $$props.uuid,
      Hooks.on("deleteChatMessage", (message) => {
        const index2 = filteredMessages.findIndex((msg) => msg.id === message.id);
        index2 !== -1 && (filteredMessages.splice(index2, 1), get$1(extractedTimes).splice(index2, 1), extractedNames.splice(index2, 1));
      }),
      "deleteChatMessage"
    );
    function refreshTimes() {
      set(extractedTimes, proxy(filteredMessages.map((message) => extractTime(message.timestamp)))), animationFrame = requestAnimationFrame(() => {
        setTimeout(refreshTimes, 15e3);
      });
    }
    __name(refreshTimes, "refreshTimes"), refreshTimes();
  }), onDestroy(() => {
    cancelAnimationFrame(animationFrame);
  }), user_effect(() => {
    var _a;
    (_a = get$1(component)) == null || _a.scrollTo(0, get$1(component).scrollHeight);
  });
  function extractTime(messageTime) {
    const diff = Math.floor(Date.now()) - messageTime;
    return diff < 6e4 ? `${Math.round(diff / 1e3)}s ago` : diff < 36e5 ? `${Math.round(diff / 6e4)}m ago` : diff < 864e5 ? `${Math.round(diff / 36e5)}h ago` : `${Math.round(diff / 864e5)}d ago`;
  }
  __name(extractTime, "extractTime");
  function extractName(content) {
    var _a, _b, _c;
    const element = document.createElement("div");
    element.innerHTML = content;
    const headerElement = jQuery(element).find(".lancer-header, .lancer-stat-header").get(0);
    if (!headerElement) return getLocalized("LA.placeholder");
    const headerText = (_b = (_a = headerElement.firstChild) == null ? void 0 : _a.textContent) == null ? void 0 : _b.trim();
    if (headerText) return headerText;
    const spanElement = jQuery(headerElement).find("span").get(0);
    return ((_c = spanElement == null ? void 0 : spanElement.textContent) == null ? void 0 : _c.trim()) || getLocalized("LA.placeholder");
  }
  __name(extractName, "extractName");
  var div = root$J();
  each(div, 21, () => filteredMessages, index, ($$anchor2, message, index2) => {
    const headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor3) => {
      var span = root_3$D(), text2 = child(span);
      template_effect(() => set_text(text2, get$1(extractedTimes)[index2])), append($$anchor3, span);
    }, "headerSecondaryRightOptions"), expression = /* @__PURE__ */ derived(() => `chat.${$$props.collapsePrefix ? $$props.collapsePrefix + "." : ""}${get$1(message).id}`);
    HeaderSecondary($$anchor2, {
      get text() {
        return extractedNames[index2];
      },
      headerStyle: [H2_HEADER_STYLE, "la-bckg-header-anti"],
      textStyle: [
        "la-text-header la-prmy-header -fontsizemedium -upper"
      ],
      borderStyle: ["la-brdr-header-anti"],
      get itemID() {
        return get$1(message).id;
      },
      get collapseID() {
        return get$1(expression);
      },
      get startCollapsed() {
        return $$props.startCollapsed;
      },
      get dontSaveCollapse() {
        return $$props.dontSaveCollapse;
      },
      contentLeft: headerSecondaryLeftOptions$1,
      contentRight: headerSecondaryRightOptions,
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        ActionLogMessage($$anchor3, {
          get messageData() {
            return get$1(message);
          }
        });
      }, "children"),
      $$slots: { default: !0 }
    });
  }), bind_this(div, ($$value) => set(component, $$value), () => get$1(component)), template_effect(() => set_attribute(div, "style", $$props.maxHeight ? `max-height: ${$$props.maxHeight}rem;` : "")), append($$anchor, div), pop();
}
__name(ActionLog, "ActionLog");
var on_change$a = /* @__PURE__ */ __name((event2, updateDocument) => updateDocument(event2, "system.structure.value"), "on_change$a"), on_change_1$7 = /* @__PURE__ */ __name((event2, updateDocument) => updateDocument(event2, "system.stress.value"), "on_change_1$7"), on_change_2$5 = /* @__PURE__ */ __name((event2, updateDocument) => updateDocument(event2, "system.burn"), "on_change_2$5"), root_5$s = /* @__PURE__ */ template('<div class="la-flexcol -widthfull -heightfull -padding0-r -padding1-t -fontface-stylized"><div class="la-flexrow -justifyevenly -wrapwrap -widthfull -heightfull -flex1"><div class="la-flexrow -aligncenter"><i class="cci cci-structure la-dropshadow -fontsize11 -displayinline"></i> <span> </span> <div class="la-flexcol -divider la-prmy-accent -fontsize6 -textaligncenter"><input class="la-top__input -width2ch la-shadow -medium -inset la-text-text" type="number"><span class="la-bottom__span"> </span></div></div> <div class="la-flexrow -aligncenter"><i class="cci cci-repair la-dropshadow -fontsize11"></i> <span> </span> <div class="la-flexcol -divider la-prmy-accent -fontsize6 -textaligncenter"><input class="la-top__input -width2ch la-shadow -medium -inset la-text-text" type="number" name="system.repairs.value" data-dtype="Number"> <span class="la-bottom__span"> </span></div></div> <div class="la-flexrow -aligncenter"><i class="cci cci-reactor la-dropshadow -fontsize11"></i> <span> </span> <div class="la-flexcol -divider la-prmy-accent -fontsize6 -textaligncenter"><input class="la-top__input -width2ch la-shadow -medium -inset la-text-text" type="number"> <span class="la-bottom__span"> </span></div></div> <div class="la-flexrow -aligncenter"><i class="cci cci-burn la-dropshadow -fontsize11"></i> <span> </span> <input class="la-top__input -width2ch la-shadow -fontsize6 -medium -inset la-text-text" type="number"></div> <div class="la-flexrow -aligncenter"><div class="la-flexrow -alignselfcenter -positionrelative"><i class="cci cci-overcharge la-dropshadow -fontsize11"></i> <div class="la-flexcol -divider la-prmy-accent -fontsize6 -textaligncenter"><span class="la-top__span -widthfull"><!> <!></span> <span class="la-bottom__span -fontsizemedium"> </span></div></div></div></div> <hr class="-widthfull"> <div class="la-flexrow -gap0 -wrapwrap -justifybetween -widthfull -heightfull -flex0"><div class="la-flexcol -gap0 la-dropshadow -flex1 -widthfull"><!> <!> <!></div> <div class="la-flexcol -gap0 la-dropshadow -flex1"><!> <!> <!> <!></div></div></div>'), root$I = /* @__PURE__ */ template('<div class="la-status__list la-flexcol -widthfull"><!> <!> <!></div>');
function Status$1($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      logging: !0,
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions"), props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), system = /* @__PURE__ */ derived(() => props.system), document2 = /* @__PURE__ */ derived(() => props.document);
  setActorContext(get$1(actor));
  let collapseAllButtonHover = state(!1);
  const logographic = logographicLanguage(), tooltipEnabled = getMechSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), actionLogEnabled = getMechSheetLogActionMainEnabled(), actionLogMaxHeight = getMechSheetLogActionMainMaxHeight(), actionLogSaveCollapse = getMechSheetLogActionDontSaveCollapse(), actionLogStartCollapsed = getMechSheetLogActionStartCollapsed(), overchargePlusTip = TooltipFactory.buildTooltip(getLocalized("LA.overcharge.increase.tooltip")), overchargeMinusTip = TooltipFactory.buildTooltip(getLocalized("LA.overcharge.decrease.tooltip")), overchargeText = /* @__PURE__ */ derived(() => formatString(getLocalized("LA.flow.overcharge.tooltip"), getCurrentOvercharge(get$1(actor)))), collID = /* @__PURE__ */ derived(() => `${get$1(actor).uuid}.status.activeEffects`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  function updateDocument(event2, path) {
    get$1(document2).update({ [path]: event2.currentTarget.valueAsNumber });
  }
  __name(updateDocument, "updateDocument");
  var div = root$I(), node = child(div);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.tab.status.actionLog.label")), expression_1 = /* @__PURE__ */ derived(() => `${get$1(actor).uuid}.status.actionLog`);
      HeaderMain($$anchor2, {
        get text() {
          return get$1(expression);
        },
        headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
        textStyle: ["la-text-header -fontsize4 -overflowhidden"],
        borderStyle: [
          "la-bckg-card la-brdr-transparent clipped-bot-alt"
        ],
        extensionTextFunction: /* @__PURE__ */ __name(() => {
          if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
        }, "extensionTextFunction"),
        get collapseID() {
          return get$1(expression_1);
        },
        startCollapsed: !1,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          ActionLog($$anchor3, {
            get uuid() {
              return get$1(actor).uuid;
            },
            maxHeight: actionLogMaxHeight,
            dontSaveCollapse: actionLogSaveCollapse,
            startCollapsed: actionLogStartCollapsed,
            get collapsePrefix() {
              return ActionLogCollapsePrefix.MechSheet;
            }
          });
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent");
    if_block(node, ($$render) => {
      actionLogEnabled && $$render(consequent);
    });
  }
  var node_1 = sibling(node, 2);
  const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.status.effects.label"));
  HeaderMain(node_1, {
    get text() {
      return get$1(expression_2);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: [
      "la-bckg-card la-brdr-transparent clipped-bot-alt"
    ],
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !1,
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      ActiveEffects($$anchor2, spread_props(() => props, { tooltipEnabled, logging: !0 }));
    }, "children"),
    $$slots: { default: !0 }
  });
  var node_2 = sibling(node_1, 2);
  const expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.status.integrity.label")), expression_4 = /* @__PURE__ */ derived(() => `${get$1(actor).uuid}.status.integrity`);
  HeaderMain(node_2, {
    get text() {
      return get$1(expression_3);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: [
      "la-bckg-card la-brdr-transparent clipped-bot-alt"
    ],
    get collapseID() {
      return get$1(expression_4);
    },
    startCollapsed: !1,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div_1 = root_5$s(), div_2 = child(div_1), div_3 = child(div_2), span = sibling(child(div_3), 2);
      set_class(span, `la-label__span -fontsizemedium
                            ${(logographic ? "-width2ch" : "-writingmode-v") ?? ""}`);
      var text2 = child(span), div_4 = sibling(span, 2), input = child(div_4);
      input.__change = [on_change$a, updateDocument];
      var span_1 = sibling(input), text_1 = child(span_1), div_5 = sibling(div_3, 2), span_2 = sibling(child(div_5), 2);
      set_class(span_2, `la-label__span -fontsizemedium
                            ${(logographic ? "-width2ch" : "-writingmode-v") ?? ""}`);
      var text_2 = child(span_2), div_6 = sibling(span_2, 2), input_1 = child(div_6), span_3 = sibling(input_1, 2), text_3 = child(span_3), div_7 = sibling(div_5, 2), span_4 = sibling(child(div_7), 2);
      set_class(span_4, `la-label__span -fontsizemedium
                            ${(logographic ? "-width2ch" : "-writingmode-v") ?? ""}`);
      var text_4 = child(span_4), div_8 = sibling(span_4, 2), input_2 = child(div_8);
      input_2.__change = [on_change_1$7, updateDocument];
      var span_5 = sibling(input_2, 2), text_5 = child(span_5), div_9 = sibling(div_7, 2), span_6 = sibling(child(div_9), 2);
      set_class(span_6, `la-label__span -fontsizemedium
                            ${(logographic ? "-width2ch" : "-writingmode-v") ?? ""}`);
      var text_6 = child(span_6), input_3 = sibling(span_6, 2);
      input_3.__change = [on_change_2$5, updateDocument];
      var div_10 = sibling(div_9, 2), div_11 = child(div_10), div_12 = sibling(child(div_11), 2), span_7 = child(div_12), node_3 = child(span_7);
      GlyphButton(node_3, {
        type: "button",
        get flowClass() {
          return FlowClass.None;
        },
        style: [
          "mdi mdi-chevron-left la-text-secondary la-prmy-primary -fontsize5 -alignselfcenter",
          qualityMode ? "-glow-prmy-hover" : ""
        ],
        tooltipEnabled,
        tooltip: overchargeMinusTip,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipDirection() {
          return TooltipDirection.UP;
        },
        onClick: /* @__PURE__ */ __name((event2) => handleOverchargeDecrease(event2, get$1(actor)), "onClick")
      });
      var text_7 = sibling(node_3), node_4 = sibling(text_7);
      GlyphButton(node_4, {
        type: "button",
        get flowClass() {
          return FlowClass.None;
        },
        style: [
          "mdi mdi-chevron-right la-text-secondary la-prmy-primary -fontsize5 -alignselfcenter",
          qualityMode ? "-glow-prmy-hover" : ""
        ],
        tooltipEnabled,
        tooltip: overchargePlusTip,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipDirection() {
          return TooltipDirection.UP;
        },
        onClick: /* @__PURE__ */ __name((event2) => handleOverchargeIncrease(event2, get$1(actor)), "onClick")
      });
      var span_8 = sibling(span_7, 2), text_8 = child(span_8), div_13 = sibling(div_2, 4), div_14 = child(div_13), node_5 = child(div_14);
      const expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.structureDamage.label")), expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.structureDamage.tooltip")), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.structureDamage.tooltip"));
      FlowButton(node_5, {
        style: [
          "clipped-alt -widthfull la-bckg-tabs -padding0 -lineheight4"
        ],
        get text() {
          return get$1(expression_5);
        },
        get uuid() {
          return get$1(actor).uuid;
        },
        get flowClass() {
          return FlowClass.Standard;
        },
        flowType: "Structure",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        },
        get tooltip() {
          return get$1(expression_6);
        },
        get logText() {
          return get$1(expression_7);
        },
        logging: !0
      });
      var node_6 = sibling(node_5, 2);
      const expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.reactorStress.label")), expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.reactorStress.tooltip")), expression_10 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.reactorStress.tooltip"));
      FlowButton(node_6, {
        style: [
          "clipped-alt -widthfull la-bckg-tabs -padding0 -lineheight4"
        ],
        get text() {
          return get$1(expression_8);
        },
        get uuid() {
          return get$1(actor).uuid;
        },
        get flowClass() {
          return FlowClass.Standard;
        },
        flowType: "Overheat",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_9);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        },
        get logText() {
          return get$1(expression_10);
        },
        logging: !0
      });
      var node_7 = sibling(node_6, 2);
      const expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.fullRepair.label")), expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.fullRepair.tooltip")), expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.fullRepair.tooltip"));
      FlowButton(node_7, {
        style: [
          "clipped-alt -widthfull la-bckg-tabs -padding0 -lineheight4"
        ],
        get text() {
          return get$1(expression_11);
        },
        get uuid() {
          return get$1(actor).uuid;
        },
        get flowClass() {
          return FlowClass.Standard;
        },
        flowType: "FullRepair",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_12);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        },
        get logText() {
          return get$1(expression_13);
        },
        logging: !0
      });
      var div_15 = sibling(div_14, 2), node_8 = child(div_15);
      const expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.overcharge.label")), expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.action.overcharge.label"));
      FlowButton(node_8, {
        style: [
          "clipped la-bckg-secondary -widthfull -overflowhidden -lineheight3"
        ],
        get text() {
          return get$1(expression_14);
        },
        get uuid() {
          return get$1(actor).uuid;
        },
        get flowClass() {
          return FlowClass.Standard;
        },
        flowType: "Overcharge",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipHeader() {
          return get$1(expression_15);
        },
        get tooltip() {
          return get$1(overchargeText);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        },
        get logText() {
          return get$1(overchargeText);
        },
        logging: !0
      });
      var node_9 = sibling(node_8, 2);
      const expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.overchargeReset.label")), expression_17 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.overchargeReset.tooltip")), expression_18 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.overchargeReset.tooltip"));
      FlowButton(node_9, {
        style: [
          "clipped la-bckg-secondary -widthfull -overflowhidden -lineheight3"
        ],
        get text() {
          return get$1(expression_16);
        },
        get uuid() {
          return get$1(actor).uuid;
        },
        get flowClass() {
          return FlowClass.ResetOvercharge;
        },
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_17);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        },
        get logText() {
          return get$1(expression_18);
        },
        logging: !0
      });
      var node_10 = sibling(node_9, 2);
      const expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.stabilize.label")), expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.action.full.label")), expression_21 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.stabilize.tooltip")), expression_22 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.stabilize.tooltip"));
      FlowButton(node_10, {
        style: [
          "clipped la-bckg-secondary -widthfull -overflowhidden -lineheight3"
        ],
        get text() {
          return get$1(expression_19);
        },
        get uuid() {
          return get$1(actor).uuid;
        },
        get flowClass() {
          return FlowClass.Standard;
        },
        flowType: "Stabilize",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipHeader() {
          return get$1(expression_20);
        },
        get tooltip() {
          return get$1(expression_21);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        },
        get logText() {
          return get$1(expression_22);
        },
        logging: !0
      });
      var node_11 = sibling(node_10, 2);
      const expression_23 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.extinguish.label")), expression_24 = /* @__PURE__ */ derived(() => getLocalized("LA.action.endofturn.label")), expression_25 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.extinguish.tooltip")), expression_26 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.extinguish.tooltip"));
      FlowButton(node_11, {
        style: [
          "clipped la-bckg-secondary -widthfull -overflowhidden -lineheight3"
        ],
        get text() {
          return get$1(expression_23);
        },
        get uuid() {
          return get$1(actor).uuid;
        },
        get flowClass() {
          return FlowClass.Standard;
        },
        flowType: "Burn",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipHeader() {
          return get$1(expression_24);
        },
        get tooltip() {
          return get$1(expression_25);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        },
        get logText() {
          return get$1(expression_26);
        },
        logging: !0
      }), template_effect(
        ($0, $1, $2, $3, $4, $5) => {
          set_text(text2, $0), set_value(input, get$1(system).structure.value), set_text(text_1, get$1(system).structure.max), set_text(text_2, $1), set_value(input_1, get$1(system).repairs.value), set_text(text_3, get$1(system).repairs.max), set_text(text_4, $2), set_value(input_2, get$1(system).stress.value), set_text(text_5, get$1(system).stress.max), set_text(text_6, $3), set_value(input_3, get$1(system).burn), set_text(text_7, ` ${$4 ?? ""} `), set_text(text_8, $5);
        },
        [
          () => getLocalized("LA.structure.label"),
          () => getLocalized("LA.flow.repair.label"),
          () => getLocalized("LA.stress.label"),
          () => getLocalized("LA.burn.label"),
          () => getCurrentOvercharge(get$1(actor)),
          () => getLocalized("LA.flow.overcharge.label")
        ]
      ), event("focus", input, (event2) => event2.currentTarget.select()), event("focus", input_1, (event2) => event2.currentTarget.select()), event("focus", input_2, (event2) => event2.currentTarget.select()), event("focus", input_3, (event2) => event2.currentTarget.select()), append($$anchor2, div_1);
    }, "children"),
    $$slots: { default: !0 }
  }), append($$anchor, div), pop();
}
__name(Status$1, "Status$1");
delegate(["change"]);
var CounterBoxType = /* @__PURE__ */ ((CounterBoxType2) => (CounterBoxType2.Counter = "counter-hex", CounterBoxType2.Limited = "uses-hex", CounterBoxType2.Loaded = "la-loaded-hex", CounterBoxType2.Charged = "charged-hex", CounterBoxType2))(CounterBoxType || {}), ChatCardType = /* @__PURE__ */ ((ChatCardType2) => (ChatCardType2[ChatCardType2.Weapon = 0] = "Weapon", ChatCardType2[ChatCardType2.Gear = 1] = "Gear", ChatCardType2[ChatCardType2.Armor = 2] = "Armor", ChatCardType2[ChatCardType2.System = 3] = "System", ChatCardType2[ChatCardType2.Tech = 4] = "Tech", ChatCardType2[ChatCardType2.Trait = 5] = "Trait", ChatCardType2[ChatCardType2.Reaction = 6] = "Reaction", ChatCardType2[ChatCardType2.Quick = 7] = "Quick", ChatCardType2[ChatCardType2.Full = 8] = "Full", ChatCardType2[ChatCardType2.Protocol = 9] = "Protocol", ChatCardType2[ChatCardType2.Free = 10] = "Free", ChatCardType2[ChatCardType2.Primary = 11] = "Primary", ChatCardType2[ChatCardType2.Secondary = 12] = "Secondary", ChatCardType2))(ChatCardType || {});
const ACTIVATION_LOCALIZE_MAP = {
  Full: "LA.action.full.label",
  Quick: "LA.action.quick.label",
  Reaction: "LA.action.reaction.label",
  Protocol: "LA.action.protocol.label",
  Free: "LA.action.free.label",
  "Full Tech": "LA.action.fullTech.label",
  "Quick Tech": "LA.action.quickTech.label",
  Invade: "LA.action.invade.label"
}, ACTIVATION_TOOLTIP_LOCALIZE_MAP = {
  Full: "LA.action.full.tooltip",
  Quick: "LA.action.quick.tooltip",
  Reaction: "LA.action.reaction.tooltip",
  Protocol: "LA.action.protocol.tooltip",
  Free: "LA.action.free.tooltip",
  "Full Tech": "LA.action.fullTech.tooltip",
  "Quick Tech": "LA.action.quickTech.tooltip",
  Invade: "LA.action.invade.tooltip"
}, ACTIVATION_ICON_MAP = {
  Full: "cci-activation-full",
  Quick: "cci-activation-quick",
  Reaction: "cci-reaction",
  Protocol: "cci-protocol",
  Free: "cci-free-action",
  "Full Tech": "cci-tech-full",
  "Quick Tech": "cci-tech-quick",
  Invade: "cci-tech-quick"
}, ACTIVATION_COLOR_MAP = {
  Full: "la-bckg-action--full",
  Quick: "la-bckg-action--quick",
  Reaction: "la-bckg-npc--reaction",
  Protocol: "la-bckg-action--protocol",
  Free: "la-bckg-action--free",
  "Full Tech": "la-bckg-action--tech",
  "Quick Tech": "la-bckg-action--tech",
  Invade: "la-bckg-action--tech",
  Passive: "la-bckg-repcap"
}, SYSTEM_ICON_MAP = {
  Deployable: "cci-deployable",
  Drone: "cci-drone",
  Mod: "cci-mod",
  System: "cci-system",
  Tech: "cci-tech-quick"
}, MOUNT_LOCALIZE_MAP = {
  Main: "LA.mech.mount.main.label",
  Heavy: "LA.mech.mount.heavy.label",
  "Aux/Aux": "LA.mech.mount.auxAux.label",
  Aux: "LA.mech.mount.aux.label",
  "Main/Aux": "LA.mech.mount.mainAux.label",
  Flex: "LA.mech.mount.flex.label",
  Integrated: "LA.mech.mount.integrated.label",
  Superheavy: "LA.mech.mount.superheavy.label",
  Unknown: "LA.mech.mount.unknown.label"
}, MOUNT_FITTINGS = {
  Main: ["Main"],
  Heavy: ["Heavy"],
  "Aux/Aux": ["Auxiliary", "Auxiliary"],
  Aux: ["Auxiliary"],
  "Main/Aux": ["Main", "Auxiliary"],
  Flex: ["Flex"],
  Integrated: ["Integrated"],
  Superheavy: ["Superheavy"],
  Unknown: ["Integrated"]
}, SLOT_LOCALIZE_MAP = {
  Auxiliary: "LA.mech.slot.aux.label",
  Main: "LA.mech.slot.main.label",
  Flex: "LA.mech.slot.flex.label",
  Heavy: "LA.mech.slot.heavy.label",
  Superheavy: "LA.mech.slot.superheavy.label",
  Integrated: "LA.mech.slot.integrated.label"
}, SYSTEM_LOCALIZE_MAP = {
  Deployable: "LA.mech.system.deployable.label",
  Drone: "LA.mech.system.drone.label",
  Mod: "LA.mech.system.mod.label",
  System: "LA.mech.system.system.label",
  Tech: "LA.mech.system.tech.label"
}, RESERVE_ICON_MAP = {
  Resources: "cci-orbit",
  Tactical: "cci-reserve-tac",
  Mech: "cci-reserve-mech",
  Project: "cci-ship",
  Organization: "cci-orbital",
  Bonus: "cci-npc-feature"
}, CHAT_CARD_COLOR_MAP = {
  [ChatCardType.Weapon]: "lancer-weapon",
  [ChatCardType.Gear]: "lancer-weapon",
  [ChatCardType.Armor]: "lancer-weapon",
  [ChatCardType.System]: "lancer-system",
  [ChatCardType.Tech]: "lancer-tech",
  [ChatCardType.Trait]: "lancer-trait",
  [ChatCardType.Reaction]: "lancer-reaction",
  [ChatCardType.Quick]: "lancer-quick",
  [ChatCardType.Full]: "lancer-full",
  [ChatCardType.Protocol]: "lancer-protocol",
  [ChatCardType.Free]: "lancer-free",
  [ChatCardType.Primary]: "lancer-primary",
  [ChatCardType.Secondary]: "lancer-secondary"
}, CHAT_CARD_ACTIVATION_COLOR_MAP = {
  Full: CHAT_CARD_COLOR_MAP[ChatCardType.Full],
  Quick: CHAT_CARD_COLOR_MAP[ChatCardType.Quick],
  Reaction: CHAT_CARD_COLOR_MAP[ChatCardType.Reaction],
  Protocol: CHAT_CARD_COLOR_MAP[ChatCardType.Protocol],
  Free: CHAT_CARD_COLOR_MAP[ChatCardType.Free],
  "Full Tech": CHAT_CARD_COLOR_MAP[ChatCardType.Tech],
  "Quick Tech": CHAT_CARD_COLOR_MAP[ChatCardType.Tech],
  Invade: CHAT_CARD_COLOR_MAP[ChatCardType.Tech]
};
let nanoid = /* @__PURE__ */ __name((size = 21) => crypto.getRandomValues(new Uint8Array(size)).reduce((id2, byte) => (byte &= 63, byte < 36 ? id2 += byte.toString(36) : byte < 62 ? id2 += (byte - 26).toString(36).toUpperCase() : byte > 62 ? id2 += "-" : id2 += "_", id2), ""), "nanoid");
async function renderTemplateStep(actor, template2, templateData, flags) {
  var _a, _b, _c;
  templateData._uuid = nanoid();
  const html2 = await renderTemplate(template2, templateData), aggregate = [];
  return templateData.roll && aggregate.push(templateData.roll), templateData.result && aggregate.push(templateData.result.roll), (((_a = templateData.attack_results) == null ? void 0 : _a.length) ?? 0) > 0 && aggregate.push(...templateData.attack_results.map((a) => a.roll)), (((_b = templateData.crit_damage_results) == null ? void 0 : _b.length) ?? 0) > 0 ? aggregate.push(...templateData.crit_damage_results.map((d) => d.roll)) : (((_c = templateData.damage_results) == null ? void 0 : _c.length) ?? 0) > 0 && aggregate.push(...templateData.damage_results.map((d) => d.roll)), templateData.self_heat_result && aggregate.push(templateData.self_heat_result.roll), createChatMessageStep(actor, html2, aggregate);
}
__name(renderTemplateStep, "renderTemplateStep");
async function createChatMessageStep(actor, html2, rolls, flags) {
  rolls && !Array.isArray(rolls) && (rolls = [rolls]);
  let chat_data = {
    type: 2,
    rolls,
    speaker: {
      actor,
      token: actor == null ? void 0 : actor.token,
      alias: actor != null && actor.token ? actor.token.name : null
    },
    content: html2,
    flags: void 0
  };
  rolls || delete chat_data.rolls;
  const cm = await ChatMessage.implementation.create(chat_data);
  cm == null || cm.render();
}
__name(createChatMessageStep, "createChatMessageStep");
const _SendUnknownToChatBase = class _SendUnknownToChatBase extends FlowBase {
  constructor() {
    super();
  }
  setupFlow() {
    var _a;
    return _a = class extends game.lancer.Flow {
      constructor(uuid, data) {
        super(uuid, {
          title: data.title,
          description: data.description,
          trigger: data.trigger,
          effect: data.effect,
          onHit: data.onHit,
          onCrit: data.onCrit,
          attackBonus: data == null ? void 0 : data.attackBonus,
          // NPCs only
          accuracyBonus: data == null ? void 0 : data.accuracyBonus,
          // NPCs only
          tags: data.tags,
          color: data.color
        });
      }
    }, __name(_a, "SendUnknownToChat"), __publicField(_a, "steps", ["printFeatureCard"]), _a;
  }
  setupFlowSteps() {
    return [
      this.printFeatureCard
    ];
  }
  /**
   * Starts the flow by creating an instance of the `SendUnknownToChat` class and beginning the flow.
   *
   * @param {string} uuid - All flows require a UUID, though not all will make use of it. The matching item will be included in the data when sent.
   * @param {any} data - The data to pass to the flow
   */
  startFlow(uuid, data) {
    const flows = game.lancer.flows;
    new (flows.get(CustomFlowClass.SendUnknownToChat))(
      uuid,
      data
    ).begin();
  }
  async printFeatureCard(state2, options) {
    if (!state2.data) throw new TypeError("Flow state missing!");
    return renderTemplateStep(
      state2.actor,
      (options == null ? void 0 : options.template) || TEMPLATE_PATHS.featureCard,
      state2.data
    ), !0;
  }
};
__name(_SendUnknownToChatBase, "SendUnknownToChatBase");
let SendUnknownToChatBase = _SendUnknownToChatBase;
enable_legacy_mode_flag();
const CLICKABLE_HOVER = /* @__PURE__ */ __name(() => " la-scdy-header " + (getExtraEffectsEnabled() ? "-glow-scdy-hover " : " "), "CLICKABLE_HOVER"), H2_BUTTON_ICON_STYLE = /* @__PURE__ */ __name(() => " la-prmy-header -fontsize4 la-scdy-primary " + (getExtraEffectsEnabled() ? "-glow-prmy -glow-scdy-hover " : " "), "H2_BUTTON_ICON_STYLE"), EFFECT_BOX_STYLE = " la-bckg-card la-brdr-repcap -bordersround-ltb ";
var root_1$x = /* @__PURE__ */ template('<div><span> <button type="button"></button></span> <!> <span><!> <!></span></div>');
function EffectBox($$anchor, $$props) {
  push($$props, !0);
  const qualityMode = getExtraEffectsEnabled(), logographic = logographicLanguage();
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      var div = root_1$x(), span = child(div);
      set_class(span, `la-effectbox__span clipped-bot la-bckg-primary la-text-header -fontface-stylized
            ${(logographic ? "-fontsizemediumer" : "-fontsizesmall") ?? ""}`);
      var text2 = child(span), button = sibling(text2), node_1 = sibling(span, 2);
      {
        var consequent = /* @__PURE__ */ __name(($$anchor3) => {
          const expression = /* @__PURE__ */ derived(() => getLocalized("LA.use.label"));
          FlowButton($$anchor3, {
            get text() {
              return get$1(expression);
            },
            get flowClass() {
              return FlowClass.SendEffectToChat;
            },
            get tooltipEnabled() {
              return $$props.tooltipEnabled;
            },
            get tooltipTheme() {
              return $$props.tooltipTheme;
            },
            get logging() {
              return $$props.logging;
            }
          });
        }, "consequent");
        if_block(node_1, ($$render) => {
          $$props.hasFlow && $$render(consequent);
        });
      }
      var span_1 = sibling(node_1, 2), node_2 = child(span_1);
      html(node_2, () => $$props.effect);
      var node_3 = sibling(node_2, 2);
      {
        var consequent_1 = /* @__PURE__ */ __name(($$anchor3) => {
          var fragment_2 = comment(), node_4 = first_child(fragment_2);
          snippet(node_4, () => $$props.children), append($$anchor3, fragment_2);
        }, "consequent_1");
        if_block(node_3, ($$render) => {
          $$props.children && $$render(consequent_1);
        });
      }
      template_effect(
        ($0, $1, $2, $3) => {
          set_class(div, `la-effectbox -widthfull
        ${(logographic ? "-fontsizemedium" : "-fontsizemediumer") ?? ""}
        ${$0 ?? ""}`), set_text(text2, $$props.name), set_class(button, `mdi mdi-pencil popout-text-edit-button -padding0-l
            ${$1 ?? ""}
            ${($$props.editOption ? "" : "-displaynone") ?? ""}`), set_attribute(button, "data-path", $$props.editPath), set_attribute(button, "aria-label", $2), set_class(span_1, $3);
        },
        [
          () => {
            var _a;
            return $$props.outerStyle ? (_a = $$props.outerStyle) == null ? void 0 : _a.join(" ") : EFFECT_BOX_STYLE;
          },
          () => qualityMode ? CLICKABLE_HOVER() : "",
          () => getLocalized("LA.edit.label"),
          () => {
            var _a;
            return (_a = $$props.innerStyle) == null ? void 0 : _a.join(" ");
          }
        ]
      ), append($$anchor2, div);
    }, "consequent_2");
    if_block(node, ($$render) => {
      ($$props.effect || $$props.children) && $$render(consequent_2);
    });
  }
  append($$anchor, fragment), pop();
}
__name(EffectBox, "EffectBox");
const H4_ROOT_STYLE = " la-bckg-card ", H4_BORDER_STYLE = " la-brdr-repcap -bordersround-ltb -bordersround ";
var root$H = /* @__PURE__ */ template('<div><div><div class="-flexthird -justifystart"><!></div> <div class="-flexthird -justifycenter"><!></div> <div class="la-flexrow -flexthird -justifyend -height5"><!></div></div> <!> <div><!></div></div>');
function HeaderQuinary($$anchor, $$props) {
  push($$props, !0);
  const isCollapsed = /* @__PURE__ */ derived(() => getCollapseState($$props.collapseID) ?? $$props.startCollapsed ?? !1);
  onMount(() => {
    $$props.collapseID && ($$props.dontSaveCollapse ?? getCollapseState($$props.collapseID) === void 0) && setCollapseState($$props.collapseID, $$props.startCollapsed ?? !1);
  });
  function toggleCollapse(event2) {
    event2.stopPropagation(), $$props.collapseID && setCollapseState($$props.collapseID, !get$1(isCollapsed));
  }
  __name(toggleCollapse, "toggleCollapse");
  function getExtensionText() {
    if ($$props.extensionTextFunction && $$props.extensionTextFunction()) return $$props.extensionTextFunction();
    if ($$props.extensionText) return $$props.extensionText;
    if ($$props.collapseID) return get$1(isCollapsed) ? `--${getLocalized("LA.expand.label")}` : `--${getLocalized("LA.collapse.label")}`;
  }
  __name(getExtensionText, "getExtensionText");
  var div = root$H(), div_1 = child(div), div_2 = child(div_1), node = child(div_2);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment = comment(), node_1 = first_child(fragment);
      snippet(node_1, () => $$props.contentLeft), append($$anchor2, fragment);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.contentLeft && $$render(consequent);
    });
  }
  var div_3 = sibling(div_2, 2), node_2 = child(div_3);
  const expression = /* @__PURE__ */ derived(() => $$props.text || getLocalized("LA.placeholder")), expression_1 = /* @__PURE__ */ derived(getExtensionText);
  TerminalText(node_2, {
    get text() {
      return get$1(expression);
    },
    get textStyle() {
      return $$props.textStyle;
    },
    get extensionText() {
      return get$1(expression_1);
    }
  });
  var div_4 = sibling(div_3, 2), node_3 = child(div_4);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_1 = comment(), node_4 = first_child(fragment_1);
      snippet(node_4, () => $$props.contentRight), append($$anchor2, fragment_1);
    }, "consequent_1");
    if_block(node_3, ($$render) => {
      $$props.contentRight && $$render(consequent_1);
    });
  }
  var node_5 = sibling(div_1, 2);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_2 = comment(), node_6 = first_child(fragment_2);
      snippet(node_6, () => $$props.renderOutsideCollapse), append($$anchor2, fragment_2);
    }, "consequent_2");
    if_block(node_5, ($$render) => {
      $$props.renderOutsideCollapse && $$render(consequent_2);
    });
  }
  var div_5 = sibling(node_5, 2), node_7 = child(div_5);
  {
    var consequent_3 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_3 = comment(), node_8 = first_child(fragment_3);
      snippet(node_8, () => $$props.children), append($$anchor2, fragment_3);
    }, "consequent_3");
    if_block(node_7, ($$render) => {
      $$props.children && $$render(consequent_3);
    });
  }
  template_effect(
    ($0, $1, $2) => {
      set_class(div, `la-effectbox -largeheader la-collapsegroup la-flexcol -widthfull 
        ${$0 ?? ""}
        ${$1 ?? ""}
        ${($$props.acceptTypes ? `ref set drop-settable ${$$props.acceptTypes}` : "") ?? ""}
        collapse-group`), set_attribute(div, "data-item-id", $$props.itemID), set_attribute(div, "data-uuid", $$props.uuid), set_attribute(div, "data-path", $$props.path), set_attribute(div, "data-accept-types", $$props.acceptTypes), set_attribute(div, "draggable", $$props.acceptTypes ? "true" : "false"), set_class(div_1, `la-actionheader la-summary la-flexrow la-text-header clipped -aligncenter
            ${$2 ?? ""}
            ${($$props.collapseID ? "collapse-trigger" : "") ?? ""}`), set_attribute(div_1, "data-la-collapse-id", $$props.collapseID), set_class(div_5, `la-collapsegroup__wrapper -widthfull
            ${($$props.collapseID ? "collapse-wrapper" : "") ?? ""} ${(get$1(isCollapsed) ? "collapsed" : "") ?? ""}`), set_attribute(div_5, "data-la-collapse-id", $$props.collapseID);
    },
    [
      () => {
        var _a;
        return ((_a = $$props.rootStyle) == null ? void 0 : _a.join(" ")) || H4_ROOT_STYLE;
      },
      () => {
        var _a;
        return ((_a = $$props.borderStyle) == null ? void 0 : _a.join(" ")) || H4_BORDER_STYLE;
      },
      () => {
        var _a;
        return (_a = $$props.headerStyle) == null ? void 0 : _a.join(" ");
      }
    ]
  ), event("click", div_1, (event2) => toggleCollapse(event2)), append($$anchor, div), pop();
}
__name(HeaderQuinary, "HeaderQuinary");
const _DEFAULT_BACKGROUND = `${H2_ICON_SIZE} la-text-scrollbar-secondary -padding0-l`, _DEFAULT_FOREGROUND = `${H2_ICON_SIZE}`;
var root_1$w = /* @__PURE__ */ template('<i style="z-index: -1;"></i>'), root$G = /* @__PURE__ */ template('<button type="button" style="z-index: 1;"><i></i> <!></button>');
function EffectButton($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, tip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip($$props.tooltip || getLocalized("LA.flow.effect.tooltip"), $$props.tooltipHeader)), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.flow.effect.tooltip"));
  function handleOnPointerEnter(event2) {
    if ($$props.onPointerEnter && $$props.onPointerEnter(), $$props.logging) sendToTextConsole(event2, get$1(log), actorUuid);
    else return;
  }
  __name(handleOnPointerEnter, "handleOnPointerEnter");
  function handleOnPointerLeave(event2) {
    if ($$props.onPointerLeave && $$props.onPointerLeave(), $$props.logging) resetTextConsole(event2, actorUuid);
    else return;
  }
  __name(handleOnPointerLeave, "handleOnPointerLeave");
  var button = root$G();
  button.__click = function(...$$args) {
    var _a2;
    (_a2 = $$props.onClick ? (event2) => $$props.onClick(event2) : void 0) == null || _a2.apply(this, $$args);
  };
  var i = child(button), node = sibling(i, 2);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var i_1 = root_1$w();
      template_effect(
        ($0) => set_class(i_1, `fal fa-dice-d20 -positionabsolute -left0 
            ${$0 ?? ""}`),
        [
          () => {
            var _a2;
            return ((_a2 = $$props.iconBackgroundStyle) == null ? void 0 : _a2.join(" ")) || _DEFAULT_BACKGROUND;
          }
        ]
      ), append($$anchor2, i_1);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.disabled || $$render(consequent);
    });
  }
  template_effect(
    ($0, $1, $2, $3) => {
      set_class(button, `-positionrelative
        ${$0 ?? ""}
        ${($$props.flowClass || FlowClass.SendEffectToChat) ?? ""}
        ${$1 ?? ""}`), set_attribute(button, "data-uuid", $$props.uuid), set_attribute(button, "data-path", $$props.path), set_attribute(button, "data-power-index", $$props.powerIndex), set_attribute(button, "data-tooltip", $$props.tooltipEnabled && !$$props.disabled ? get$1(tip) : void 0), set_attribute(button, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(button, "data-tooltip-direction", $$props.tooltipDirection || TooltipDirection.UP), set_attribute(button, "aria-label", $2), button.disabled = $$props.disabled || !1, set_class(i, `
            ${$3 ?? ""}`);
    },
    [
      () => {
        var _a2;
        return (_a2 = $$props.style) == null ? void 0 : _a2.join(" ");
      },
      () => $$props.disabled ? "" : CLICKABLE_HOVER(),
      () => $$props.tooltip || getLocalized("LA.flow.effect.tooltip"),
      () => {
        var _a2;
        return ((_a2 = $$props.iconStyle) == null ? void 0 : _a2.join(" ")) || _DEFAULT_FOREGROUND;
      }
    ]
  ), event("pointerenter", button, handleOnPointerEnter), event("pointerleave", button, handleOnPointerLeave), append($$anchor, button), pop();
}
__name(EffectButton, "EffectButton");
delegate(["click"]);
var root_7$k = /* @__PURE__ */ template('<button type="button" class="la-actionheader__button mdi mdi-pencil -fontsize5"></button> <button class="la-actionheader__button mdi mdi-delete -fontsize5" data-action="splice"></button>', 1), root_9$k = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_6$v = /* @__PURE__ */ template("<!> <!>", 1), root_14$9 = /* @__PURE__ */ template('<!> <hr class="-widthfull">', 1), root_13$9 = /* @__PURE__ */ template("<!> <!>", 1), root_12$d = /* @__PURE__ */ template('<div class="-fontsizemedium"><div class="la-divider-h la-bckg-primary -margin0-tb"></div> <div class="la-generated -widthfull -gap1 la-flexcol"><!> <!></div> <!></div>'), root_18$6 = /* @__PURE__ */ template('<!> <hr class="-widthfull">', 1), root_17$8 = /* @__PURE__ */ template('<div class="-fontsizemedium"><div class="la-divider-h la-bckg-primary -margin0-tb -margin2-b"></div> <!> <!> <!></div>');
function ActionBox($$anchor, $$props) {
  push($$props, !0);
  let effectButtonHover = state(!1), messageButtonHover = state(!1);
  const qualityMode = getExtraEffectsEnabled(), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), defaultPlaceholder = getLocalized("LA.placeholder");
  function getActivationClass(activation) {
    return `activation-${slugify(activation, "-")}`;
  }
  __name(getActivationClass, "getActivationClass");
  function getActivationName(activation) {
    return `${getLocalized("LA.use.label")} ${getLocalized(ACTIVATION_LOCALIZE_MAP[activation])}`;
  }
  __name(getActivationName, "getActivationName");
  function getReactionTooltip(action2) {
    return action2.trigger ? `
                ${getLocalized("LA.trigger.label")}: ${action2.trigger}
                <br><br>
                ${getLocalized("LA.mech.system.effect.label")}: ${action2.detail}
                <br><br>
                ${getLocalized(ACTIVATION_TOOLTIP_LOCALIZE_MAP[action2.activation])}` : `${action2.detail}<br><br>${getLocalized(ACTIVATION_TOOLTIP_LOCALIZE_MAP[action2.activation])}`;
  }
  __name(getReactionTooltip, "getReactionTooltip");
  function sendToChat(event2, item) {
    var _a;
    if (event2.stopPropagation(), (_a = $$props.actor) != null && _a.uuid && item) {
      let chatData = null;
      item.trigger ? chatData = {
        title: item.name,
        trigger: item.trigger,
        effect: item.detail,
        color: CHAT_CARD_ACTIVATION_COLOR_MAP[item.activation] || ""
      } : chatData = {
        title: item.name,
        description: item.detail,
        color: CHAT_CARD_ACTIVATION_COLOR_MAP[item.activation] || ""
      }, SendUnknownToChatBase.getInstance().startFlow($$props.actor.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendToChat, "sendToChat");
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_8 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_1 = comment(), node_1 = first_child(fragment_1);
      each(node_1, 17, () => $$props.actions, index, ($$anchor3, action2, index2) => {
        const defaultFlowButton = /* @__PURE__ */ __name(($$anchor4) => {
          const expression = /* @__PURE__ */ derived(() => getActivationName(get$1(action2).activation)), expression_1 = /* @__PURE__ */ derived(() => [
            "clipped-bot",
            ACTIVATION_COLOR_MAP[get$1(action2).activation]
          ]), expression_2 = /* @__PURE__ */ derived(() => `${$$props.path}.${index2}`), expression_3 = /* @__PURE__ */ derived(() => get$1(action2) && $$props.uuid && $$props.path ? `${FlowClass.CoreActivation} ${getActivationClass(get$1(action2).activation)}` : getActivationClass(get$1(action2).activation)), expression_4 = /* @__PURE__ */ derived(() => getLocalized(ACTIVATION_LOCALIZE_MAP[get$1(action2).activation])), expression_5 = /* @__PURE__ */ derived(() => getLocalized(ACTIVATION_TOOLTIP_LOCALIZE_MAP[get$1(action2).activation]));
          FlowButton($$anchor4, {
            get text() {
              return get$1(expression);
            },
            get style() {
              return get$1(expression_1);
            },
            get uuid() {
              return $$props.uuid;
            },
            get path() {
              return get$1(expression_2);
            },
            get flowClass() {
              return get$1(expression_3);
            },
            get tooltipEnabled() {
              return $$props.tooltipEnabled;
            },
            get tooltipTheme() {
              return $$props.tooltipTheme;
            },
            tooltipDirection: void 0,
            get tooltipHeader() {
              return get$1(expression_4);
            },
            get tooltip() {
              return get$1(expression_5);
            },
            get logging() {
              return $$props.logging;
            }
          });
        }, "defaultFlowButton"), outerContent = /* @__PURE__ */ __name(($$anchor4) => {
          var fragment_3 = comment(), node_2 = first_child(fragment_3);
          {
            var consequent = /* @__PURE__ */ __name(($$anchor5) => {
              var fragment_4 = comment(), node_3 = first_child(fragment_4);
              snippet(node_3, () => $$props.flowButton), append($$anchor5, fragment_4);
            }, "consequent");
            if_block(node_2, ($$render) => {
              $$props.flowButton && $$render(consequent);
            });
          }
          append($$anchor4, fragment_3);
        }, "outerContent"), headerQuinaryRightOptions = /* @__PURE__ */ __name(($$anchor4) => {
          var fragment_5 = root_6$v(), node_4 = first_child(fragment_5);
          {
            var consequent_1 = /* @__PURE__ */ __name(($$anchor5) => {
              var fragment_6 = root_7$k(), button = first_child(fragment_6), button_1 = sibling(button, 2);
              template_effect(
                ($0, $1) => {
                  set_attribute(button, "aria-label", $0), set_attribute(button_1, "data-uuid", $$props.uuid), set_attribute(button_1, "data-path", $$props.path), set_attribute(button_1, "aria-label", $1);
                },
                [
                  () => getLocalized("LA.edit.label"),
                  () => getLocalized("LA.delete.label")
                ]
              ), append($$anchor5, fragment_6);
            }, "consequent_1");
            if_block(node_4, ($$render) => {
              $$props.editable && $$render(consequent_1);
            });
          }
          var node_5 = sibling(node_4, 2);
          {
            var consequent_2 = /* @__PURE__ */ __name(($$anchor5) => {
              const expression_6 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-margin2-r"]), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip")), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
              GlyphButton($$anchor5, {
                get style() {
                  return get$1(expression_6);
                },
                get flowClass() {
                  return FlowClass.None;
                },
                get uuid() {
                  return $$props.uuid;
                },
                get path() {
                  return $$props.path;
                },
                get tooltipEnabled() {
                  return $$props.tooltipEnabled;
                },
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_7);
                },
                get logText() {
                  return get$1(expression_8);
                },
                logging: !0,
                onClick: /* @__PURE__ */ __name((event2) => sendToChat(event2, get$1(action2)), "onClick"),
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps) => {
                  var i = root_9$k();
                  append($$anchor6, i);
                }, "children"),
                $$slots: { default: !0 }
              });
            }, "consequent_2");
            if_block(node_5, ($$render) => {
              $$props.actor && $$render(consequent_2);
            });
          }
          append($$anchor4, fragment_5);
        }, "headerQuinaryRightOptions"), headerQuinaryLeftOptions = /* @__PURE__ */ __name(($$anchor4) => {
          const expression_9 = /* @__PURE__ */ derived(() => [
            H2_ICON_SIZE,
            ACTIVATION_ICON_MAP[get$1(action2).activation]
          ]), expression_10 = /* @__PURE__ */ derived(() => $$props.onClick ? FlowClass.None : get$1(action2) && $$props.uuid && $$props.path ? `${FlowClass.CoreActivation} ${getActivationClass(get$1(action2).activation)}` : getActivationClass(get$1(action2).activation)), expression_11 = /* @__PURE__ */ derived(() => `${$$props.path}.${index2}`), expression_12 = /* @__PURE__ */ derived(() => $$props.onClick ? (event2) => $$props.onClick(event2, get$1(action2)) : void 0), expression_13 = /* @__PURE__ */ derived(() => getLocalized(ACTIVATION_LOCALIZE_MAP[get$1(action2).activation])), expression_14 = /* @__PURE__ */ derived(() => getReactionTooltip(get$1(action2)));
          EffectButton($$anchor4, {
            style: ["-positionabsolute -left0 -top0 -padding0-l"],
            get iconStyle() {
              return get$1(expression_9);
            },
            iconBackgroundStyle: [
              H2_ICON_SIZE,
              "-padding0-l la-prmy-secondary",
              qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
            ],
            get flowClass() {
              return get$1(expression_10);
            },
            get uuid() {
              return $$props.uuid;
            },
            get path() {
              return get$1(expression_11);
            },
            get onClick() {
              return get$1(expression_12);
            },
            get tooltipEnabled() {
              return $$props.tooltipEnabled;
            },
            get tooltipTheme() {
              return $$props.tooltipTheme;
            },
            get tooltipHeader() {
              return get$1(expression_13);
            },
            get tooltip() {
              return get$1(expression_14);
            },
            get tooltipDirection() {
              return TooltipDirection.LEFT;
            },
            get logging() {
              return $$props.logging;
            },
            get disabled() {
              return $$props.disableLeftButton;
            },
            onPointerEnter: /* @__PURE__ */ __name(() => {
              set(effectButtonHover, !0);
            }, "onPointerEnter"),
            onPointerLeave: /* @__PURE__ */ __name(() => {
              set(effectButtonHover, !1);
            }, "onPointerLeave")
          });
        }, "headerQuinaryLeftOptions"), expression_15 = /* @__PURE__ */ derived(() => [
          ACTIVATION_COLOR_MAP[get$1(action2).activation],
          "la-text-header la-prmy-header -padding0-l"
        ]), expression_16 = /* @__PURE__ */ derived(() => `${$$props.path}.${index2}`), expression_17 = /* @__PURE__ */ derived(() => `${$$props.collapseID}.${index2}`);
        HeaderQuinary($$anchor3, {
          get text() {
            return get$1(action2).name;
          },
          get headerStyle() {
            return get$1(expression_15);
          },
          textStyle: ["-fontface-stylized"],
          extensionTextFunction: /* @__PURE__ */ __name(() => {
            if (get$1(effectButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
            if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
          }, "extensionTextFunction"),
          get uuid() {
            return $$props.uuid;
          },
          get path() {
            return get$1(expression_16);
          },
          get collapseID() {
            return get$1(expression_17);
          },
          get startCollapsed() {
            return $$props.startCollapsed;
          },
          contentLeft: headerQuinaryLeftOptions,
          contentRight: headerQuinaryRightOptions,
          renderOutsideCollapse: outerContent,
          children: /* @__PURE__ */ __name(($$anchor4, $$slotProps) => {
            var fragment_10 = comment(), node_6 = first_child(fragment_10);
            {
              var consequent_5 = /* @__PURE__ */ __name(($$anchor5) => {
                var div = root_12$d(), div_1 = sibling(child(div), 2), node_7 = child(div_1);
                const expression_18 = /* @__PURE__ */ derived(() => getLocalized("LA.trigger.label"));
                EffectBox(node_7, {
                  get name() {
                    return get$1(expression_18);
                  },
                  outerStyle: ["-bordersround"],
                  get tooltipEnabled() {
                    return $$props.tooltipEnabled;
                  },
                  get logging() {
                    return $$props.logging;
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                    var fragment_11 = root_13$9(), node_8 = first_child(fragment_11);
                    {
                      var consequent_3 = /* @__PURE__ */ __name(($$anchor7) => {
                        var fragment_12 = root_14$9(), node_9 = first_child(fragment_12);
                        defaultFlowButton(node_9), append($$anchor7, fragment_12);
                      }, "consequent_3");
                      if_block(node_8, ($$render) => {
                        $$props.collapseID || $$render(consequent_3);
                      });
                    }
                    var node_10 = sibling(node_8, 2);
                    html(node_10, () => get$1(action2).trigger || defaultPlaceholder), append($$anchor6, fragment_11);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_11 = sibling(node_7, 2);
                const expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.effect.label")), expression_20 = /* @__PURE__ */ derived(() => `${$$props.path}.detail`);
                EffectBox(node_11, {
                  get name() {
                    return get$1(expression_19);
                  },
                  outerStyle: ["-bordersround"],
                  get editOption() {
                    return $$props.editDetails;
                  },
                  get editPath() {
                    return get$1(expression_20);
                  },
                  get tooltipEnabled() {
                    return $$props.tooltipEnabled;
                  },
                  get logging() {
                    return $$props.logging;
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                    var fragment_13 = comment(), node_12 = first_child(fragment_13);
                    html(node_12, () => get$1(action2).detail || defaultPlaceholder), append($$anchor6, fragment_13);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_13 = sibling(div_1, 2);
                {
                  var consequent_4 = /* @__PURE__ */ __name(($$anchor6) => {
                    var fragment_14 = comment(), node_14 = first_child(fragment_14);
                    snippet(node_14, () => $$props.children), append($$anchor6, fragment_14);
                  }, "consequent_4");
                  if_block(node_13, ($$render) => {
                    $$props.children && $$render(consequent_4);
                  });
                }
                append($$anchor5, div);
              }, "consequent_5"), alternate = /* @__PURE__ */ __name(($$anchor5) => {
                var div_2 = root_17$8(), node_15 = sibling(child(div_2), 2);
                {
                  var consequent_6 = /* @__PURE__ */ __name(($$anchor6) => {
                    var fragment_15 = root_18$6(), node_16 = first_child(fragment_15);
                    defaultFlowButton(node_16), append($$anchor6, fragment_15);
                  }, "consequent_6");
                  if_block(node_15, ($$render) => {
                    $$props.collapseID || $$render(consequent_6);
                  });
                }
                var node_17 = sibling(node_15, 2);
                const expression_21 = /* @__PURE__ */ derived(() => getLocalized(ACTIVATION_LOCALIZE_MAP[get$1(action2).activation]));
                EffectBox(node_17, {
                  get name() {
                    return get$1(expression_21);
                  },
                  outerStyle: ["-bordersround"],
                  get tooltipEnabled() {
                    return $$props.tooltipEnabled;
                  },
                  get logging() {
                    return $$props.logging;
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                    var fragment_16 = comment(), node_18 = first_child(fragment_16);
                    html(node_18, () => get$1(action2).detail || defaultPlaceholder), append($$anchor6, fragment_16);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_19 = sibling(node_17, 2);
                {
                  var consequent_7 = /* @__PURE__ */ __name(($$anchor6) => {
                    var fragment_17 = comment(), node_20 = first_child(fragment_17);
                    snippet(node_20, () => $$props.children), append($$anchor6, fragment_17);
                  }, "consequent_7");
                  if_block(node_19, ($$render) => {
                    $$props.children && $$render(consequent_7);
                  });
                }
                append($$anchor5, div_2);
              }, "alternate");
              if_block(node_6, ($$render) => {
                get$1(action2).trigger ? $$render(consequent_5) : $$render(alternate, !1);
              });
            }
            append($$anchor4, fragment_10);
          }, "children"),
          $$slots: { default: !0 }
        });
      }), append($$anchor2, fragment_1);
    }, "consequent_8");
    if_block(node, ($$render) => {
      $$props.actions.length > 0 && $$render(consequent_8);
    });
  }
  append($$anchor, fragment), pop();
}
__name(ActionBox, "ActionBox");
var root_3$C = /* @__PURE__ */ template(`<div class="la-effectbox la-bckg-card la-brdr-repcap -widthfull -bordersround-ltb
            ref set"><span class="la-effectbox__span clipped-bot la-bckg-primary la-text-header -fontsizesmall
                click-open -upper"> </span> <div class="la-generated -widthfull -gap1 la-flexcol"><div class="-fontsizemedium -widthfull"><div class="la-effectbox-buttons la-flexrow -justifybetween"><div class="la-flexcol -alignstart"></div> <img></div> <hr> <!></div>  <!></div></div>`);
function DeployableBox($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, qualityMode = getExtraEffectsEnabled(), themeOverride = /* @__PURE__ */ derived(() => getThemeKey($$props.sheetUUID)), globallyOwnedDeployables = game.actors.filter((a) => {
    var _a2;
    return !!(a.is_deployable() && ((_a2 = a.system.owner) == null ? void 0 : _a2.value) == $$props.source);
  }), tip = TooltipFactory.buildTooltip(getLocalized("LA.mech.system.deployable.tooltip"));
  function lidSourceHasDeployable(deployable) {
    var _a2;
    return ((_a2 = $$props.lidSource.deployables) == null ? void 0 : _a2.includes(deployable.system.lid)) ?? !1;
  }
  __name(lidSourceHasDeployable, "lidSourceHasDeployable");
  const defaultImages = [
    "systems/lancer/assets/icons/deployable.svg",
    "systems/lancer/assets/icons/white/deployable.svg"
  ];
  function getThemeImg(deployable) {
    let theme = getBrightness(get$1(themeOverride));
    return deployable.img ? defaultImages.includes(deployable.img) && theme === "dark" ? deployable.img.replace("/icons/", "/icons/white/") : deployable.img : theme === "dark" ? "systems/lancer/assets/icons/white/generic_item.svg" : "systems/lancer/assets/icons/generic_item.svg";
  }
  __name(getThemeImg, "getThemeImg");
  function getDeployableActions(deployable) {
    return [
      {
        label: "LA.mech.system.deployable.activate.label",
        tooltip: "LA.mech.system.deployable.activate.tooltip",
        deployableAction: deployable.system.activation
      },
      {
        label: "LA.mech.system.deployable.deactivate.label",
        tooltip: "LA.mech.system.deployable.deactivate.tooltip",
        deployableAction: deployable.system.deactivation
      },
      {
        label: "LA.mech.system.deployable.recall.label",
        tooltip: "LA.mech.system.deployable.recall.tooltip",
        deployableAction: deployable.system.recall
      },
      {
        label: "LA.mech.system.deployable.redeploy.label",
        tooltip: "LA.mech.system.deployable.redeploy.tooltip",
        deployableAction: deployable.system.redeploy
      }
    ].filter((a) => !!a.deployableAction);
  }
  __name(getDeployableActions, "getDeployableActions");
  function sendActionToChat(event2, action2) {
    if (event2.stopPropagation(), $$props.uuid && action2) {
      let chatData = {
        title: action2.name,
        trigger: action2.trigger,
        effect: action2.detail,
        color: CHAT_CARD_ACTIVATION_COLOR_MAP[action2.activation]
      };
      SendUnknownToChatBase.getInstance().startFlow($$props.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendActionToChat, "sendActionToChat");
  function sendDeployableActionToChat(event2, action2, deployable) {
    if (event2.stopPropagation(), $$props.uuid && action2) {
      const effect2 = `
                <details>
                    <summary>
                    ${getLocalized("LA.mech.system.effect.label")}
                    </summary>
                    ${deployable.system.detail}
                </details>
            `, description = `
                <hr>
                <div 
                    class="clipped lancer-header ${CHAT_CARD_ACTIVATION_COLOR_MAP[action2.deployableAction]}"
                    style="
                        padding: 0.25rem;
                    "
                >
                    ${getLocalized(ACTIVATION_LOCALIZE_MAP[action2.deployableAction])}
                </div>
                <div
                    style="
                        padding-top: 0.25rem;
                    "
                >
                ${getLocalized(action2.tooltip)}
                </div>
            `;
      let chatData = {
        title: deployable.name,
        description: deployable.system.detail ? effect2 + description : description
      };
      SendUnknownToChatBase.getInstance().startFlow($$props.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendDeployableActionToChat, "sendDeployableActionToChat");
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_1 = comment(), node_1 = first_child(fragment_1);
      each(node_1, 17, () => globallyOwnedDeployables, index, ($$anchor3, deployable) => {
        var fragment_2 = comment(), node_2 = first_child(fragment_2);
        {
          var consequent_1 = /* @__PURE__ */ __name(($$anchor4) => {
            var div = root_3$C(), span = child(div), text2 = child(span), div_1 = sibling(span, 2), div_2 = child(div_1), div_3 = child(div_2), div_4 = child(div_3);
            each(div_4, 21, () => getDeployableActions(get$1(deployable)), index, ($$anchor5, action2) => {
              const expression = /* @__PURE__ */ derived(() => getLocalized(get$1(action2).label)), expression_1 = /* @__PURE__ */ derived(() => [
                "clipped-bot -widthfull -overflowhidden -lineheight3 ",
                ACTIVATION_COLOR_MAP[get$1(action2).deployableAction]
              ]), expression_2 = /* @__PURE__ */ derived(() => `deployables.${get$1(deployable).system.lid}`), expression_3 = /* @__PURE__ */ derived(() => getLocalized(ACTIVATION_LOCALIZE_MAP[get$1(action2).deployableAction])), expression_4 = /* @__PURE__ */ derived(() => `${getLocalized(get$1(action2).tooltip)}<br><br>${getLocalized(ACTIVATION_TOOLTIP_LOCALIZE_MAP[get$1(action2).deployableAction])}`);
              FlowButton($$anchor5, {
                get text() {
                  return get$1(expression);
                },
                get style() {
                  return get$1(expression_1);
                },
                get uuid() {
                  return get$1(deployable).uuid;
                },
                get path() {
                  return get$1(expression_2);
                },
                get flowClass() {
                  return FlowClass.None;
                },
                onClick: /* @__PURE__ */ __name((event2) => sendDeployableActionToChat(event2, get$1(action2), get$1(deployable)), "onClick"),
                get tooltipEnabled() {
                  return $$props.tooltipEnabled;
                },
                get tooltipTheme() {
                  return $$props.tooltipTheme;
                },
                get tooltipDirection() {
                  return TooltipDirection.LEFT;
                },
                get tooltipHeader() {
                  return get$1(expression_3);
                },
                get tooltip() {
                  return get$1(expression_4);
                },
                get logging() {
                  return $$props.logging;
                }
              });
            });
            var img = sibling(div_4, 2);
            set_class(img, `-height15 click-open la-prmy-secondary la-scdy-primary
                            ${(qualityMode ? "-glow-prmy -glow-scdy-hover" : "") ?? ""}`);
            var node_3 = sibling(div_3, 4);
            html(node_3, () => get$1(deployable).system.detail);
            var node_4 = sibling(div_2, 2);
            {
              var consequent = /* @__PURE__ */ __name(($$anchor5) => {
                const expression_5 = /* @__PURE__ */ derived(() => `${get$1(deployable).uuid}.actions`), expression_6 = /* @__PURE__ */ derived(() => $$props.uuid || get$1(deployable).uuid), expression_7 = /* @__PURE__ */ derived(() => !$$props.uuid), expression_8 = /* @__PURE__ */ derived(() => $$props.uuid ? sendActionToChat : void 0);
                ActionBox($$anchor5, {
                  get actions() {
                    return get$1(deployable).system.actions;
                  },
                  get collapseID() {
                    return get$1(expression_5);
                  },
                  startCollapsed: !1,
                  path: "system.actions",
                  get uuid() {
                    return get$1(expression_6);
                  },
                  get actor() {
                    return $$props.source;
                  },
                  get disableLeftButton() {
                    return get$1(expression_7);
                  },
                  get onClick() {
                    return get$1(expression_8);
                  },
                  get tooltipEnabled() {
                    return $$props.tooltipEnabled;
                  },
                  get tooltipTheme() {
                    return $$props.tooltipTheme;
                  },
                  get logging() {
                    return $$props.logging;
                  }
                });
              }, "consequent");
              if_block(node_4, ($$render) => {
                get$1(deployable).system.actions.length && $$render(consequent);
              });
            }
            template_effect(
              ($0, $1) => {
                set_attribute(div, "data-uuid", get$1(deployable).uuid), set_text(text2, get$1(deployable).name ? get$1(deployable).name : ""), set_attribute(img, "src", $0), set_attribute(img, "alt", $1), set_attribute(img, "data-tooltip", $$props.tooltipEnabled ? tip : void 0), set_attribute(img, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(img, "data-tooltip-direction", TooltipDirection.LEFT);
              },
              [
                () => getThemeImg(get$1(deployable)),
                () => getLocalized("LA.placeholder")
              ]
            ), event("pointerenter", img, function(...$$args) {
              var _a2;
              (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, getLocalized("LA.mech.system.deployable.tooltip"), actorUuid) : void 0) == null || _a2.apply(this, $$args);
            }), event("pointerleave", img, function(...$$args) {
              var _a2;
              (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
            }), append($$anchor4, div);
          }, "consequent_1");
          if_block(node_2, ($$render) => {
            lidSourceHasDeployable(get$1(deployable)) && $$render(consequent_1);
          });
        }
        append($$anchor3, fragment_2);
      }), append($$anchor2, fragment_1);
    }, "consequent_2");
    if_block(node, ($$render) => {
      $$props.source && !$$props.source.is_deployable() && !$$props.source.isToken && $$render(consequent_2);
    });
  }
  append($$anchor, fragment), pop();
}
__name(DeployableBox, "DeployableBox");
var root_3$B = /* @__PURE__ */ template('<div class="la-spacer -medium"></div> <div><button type="button"><i class="la-corepower__i cci cci-activate la-dropshadow -flexthird -textalignleft -height7 -lineheight7 -fontsize19"></i> <span> </span> <span class="-flexthird"></span></button></div>', 1), root_4$e = /* @__PURE__ */ template('<div class="la-divider-h la-bckg-primary -margin0-tb -margin2-b"></div> <div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!></div>', 1);
function FrameActivePower($$anchor, $$props) {
  push($$props, !0);
  const tooltipEnabled = getMechSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), frame = /* @__PURE__ */ derived(() => $$props.system.loadout.frame.value), core = /* @__PURE__ */ derived(() => get$1(frame).system.core_system), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.${get$1(frame).id}.activePower`), actionCollID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.${get$1(frame).id}.activePower.action`), name = /* @__PURE__ */ derived(() => get$1(core).active_actions.length ? get$1(core).active_actions[0].name : getLocalized("LA.activate.label")), activationClass = /* @__PURE__ */ derived(() => `activation-${slugify(get$1(core).activation, "-")}`), activationTheme = /* @__PURE__ */ derived(() => $$props.system.core_energy ? `${ACTIVATION_COLOR_MAP[get$1(core).activation]}` : "la-bckg-repcap"), frameColorBckg = /* @__PURE__ */ derived(() => getManufacturerColor(get$1(frame).system.manufacturer, "bckg")), frameColorBrdr = /* @__PURE__ */ derived(() => $$props.system.core_energy ? getManufacturerColor(get$1(frame).system.manufacturer, "brdr") : "la-brdr-repcap"), tip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(
    getLocalized([
      get$1(core).active_effect,
      ACTIVATION_TOOLTIP_LOCALIZE_MAP[get$1(core).activation]
    ]),
    getLocalized(ACTIVATION_LOCALIZE_MAP[get$1(core).activation])
  )), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      const headerQuinaryLeftOptions = /* @__PURE__ */ __name(($$anchor3) => {
        const expression = /* @__PURE__ */ derived(() => [
          H2_ICON_SIZE,
          "cci",
          ACTIVATION_ICON_MAP[get$1(core).activation]
        ]), expression_1 = /* @__PURE__ */ derived(() => getLocalized(ACTIVATION_LOCALIZE_MAP[get$1(core).activation])), expression_2 = /* @__PURE__ */ derived(() => $$props.system.core_energy === 0);
        EffectButton($$anchor3, {
          get iconStyle() {
            return get$1(expression);
          },
          iconBackgroundStyle: [
            H2_ICON_SIZE,
            "la-prmy-secondary",
            qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
          ],
          get flowClass() {
            return FlowClass.None;
          },
          tooltipEnabled,
          get tooltipTheme() {
            return get$1(theme);
          },
          get tooltipDirection() {
            return TooltipDirection.LEFT;
          },
          get tooltipHeader() {
            return get$1(expression_1);
          },
          logging: !0,
          get disabled() {
            return get$1(expression_2);
          }
        });
      }, "headerQuinaryLeftOptions"), outerContent = /* @__PURE__ */ __name(($$anchor3) => {
        var fragment_2 = root_3$B(), div = sibling(first_child(fragment_2), 2), button = child(div);
        set_attribute(button, "data-path", "system.core_system");
        var span = sibling(child(button), 2), text2 = child(span);
        template_effect(() => {
          set_class(div, `la-flexrow -widthfull
        ${($$props.system.core_energy && qualityMode ? "la-prmy-primary -glow-prmy-hover" : "") ?? ""}`), set_class(button, `la-corepower clipped la-text-header la-flexrow -padding0-tb -fontsize5 -lineheight7 -widthfull
            ${get$1(activationTheme) ?? ""} ${($$props.system.core_energy ? "" : "la-dropshadow -disabled") ?? ""}
            activation-flow ${get$1(activationClass) ?? ""}`), set_attribute(button, "data-uuid", get$1(frame).uuid), set_attribute(button, "data-tooltip", get$1(tip)), set_attribute(button, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(button, "data-tooltip-direction", TooltipDirection.LEFT), set_attribute(button, "aria-label", get$1(name)), button.disabled = !$$props.system.core_energy, set_class(span, `la-corepower__span -upper -flexthird -textwrapnowrap
            ${($$props.system.core_energy ? "la-prmy-header la-scdy-primary" : "la-dropshadow") ?? ""}
            ${(qualityMode ? "-glow-prmy -glow-scdy-hover" : "") ?? ""}`), set_text(text2, get$1(name));
        }), append($$anchor3, fragment_2);
      }, "outerContent"), expression_3 = /* @__PURE__ */ derived(() => [
        get$1(frameColorBckg),
        "la-text-header la-prmy-header -padding0-l"
      ]), expression_4 = /* @__PURE__ */ derived(() => [H4_BORDER_STYLE, get$1(frameColorBrdr)]);
      HeaderQuinary($$anchor2, {
        get text() {
          return get$1(core).name;
        },
        get headerStyle() {
          return get$1(expression_3);
        },
        get borderStyle() {
          return get$1(expression_4);
        },
        textStyle: ["-fontface-stylized"],
        get collapseID() {
          return get$1(collID);
        },
        renderOutsideCollapse: outerContent,
        contentLeft: headerQuinaryLeftOptions,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var fragment_4 = root_4$e(), div_1 = sibling(first_child(fragment_4), 2), node_1 = child(div_1);
          const expression_5 = /* @__PURE__ */ derived(() => getLocalized(ACTIVATION_LOCALIZE_MAP[get$1(core).activation]));
          EffectBox(node_1, {
            get name() {
              return get$1(expression_5);
            },
            get effect() {
              return get$1(core).active_effect;
            },
            tooltipEnabled,
            logging: !0
          });
          var node_2 = sibling(node_1, 2);
          ActionBox(node_2, {
            get uuid() {
              return get$1(frame).uuid;
            },
            get actions() {
              return get$1(core).active_actions;
            },
            get actor() {
              return $$props.actor;
            },
            path: "system.core_system.active_actions",
            get collapseID() {
              return get$1(actionCollID);
            },
            startCollapsed: !1,
            tooltipEnabled,
            get tooltipTheme() {
              return get$1(theme);
            },
            logging: !0
          });
          var node_3 = sibling(node_2, 2);
          DeployableBox(node_3, {
            get source() {
              return $$props.actor;
            },
            get lidSource() {
              return get$1(core);
            },
            get uuid() {
              return get$1(frame).uuid;
            },
            get sheetUUID() {
              return $$props.actor.uuid;
            },
            tooltipEnabled,
            get tooltipTheme() {
              return get$1(theme);
            },
            logging: !0
          }), append($$anchor3, fragment_4);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent");
    if_block(node, ($$render) => {
      (get$1(core).active_effect || get$1(core).active_actions.length || get$1(core).active_bonuses.length) && $$render(consequent);
    });
  }
  append($$anchor, fragment), pop();
}
__name(FrameActivePower, "FrameActivePower");
var root_3$A = /* @__PURE__ */ template('<div class="la-divider-h la-bckg-primary -margin0-tb -margin2-b"></div> <!> <!>', 1);
function FramePassivePower($$anchor, $$props) {
  push($$props, !0);
  let effectButtonHover = state(!1);
  const tooltipEnabled = getMechSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), frame = /* @__PURE__ */ derived(() => $$props.system.loadout.frame.value), core = /* @__PURE__ */ derived(() => get$1(frame).system.core_system), frameColorBckg = /* @__PURE__ */ derived(() => getManufacturerColor(get$1(frame).system.manufacturer, "bckg")), frameColorBrdr = /* @__PURE__ */ derived(() => getManufacturerColor(get$1(frame).system.manufacturer, "brdr")), tip = /* @__PURE__ */ derived(() => get$1(core).passive_effect || getLocalized("LA.chat.tooltip")), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.${get$1(frame).id}.passive`), actionCollID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.${get$1(frame).id}.passive.action`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function sendToChat(event2) {
    var _a;
    if (event2.stopPropagation(), (_a = $$props.actor) != null && _a.uuid && get$1(core)) {
      let chatData = {
        title: get$1(core).passive_name,
        effect: get$1(core).passive_effect
      };
      SendUnknownToChatBase.getInstance().startFlow(get$1(frame).uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendToChat, "sendToChat");
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      const headerQuinaryLeftOptions = /* @__PURE__ */ __name(($$anchor3) => {
        EffectButton($$anchor3, {
          iconStyle: [H2_ICON_SIZE, "cci cci-corebonus"],
          iconBackgroundStyle: [
            H2_ICON_SIZE,
            "la-prmy-secondary",
            qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
          ],
          get flowClass() {
            return FlowClass.None;
          },
          onClick: sendToChat,
          tooltipEnabled,
          get tooltipTheme() {
            return get$1(theme);
          },
          get tooltipDirection() {
            return TooltipDirection.LEFT;
          },
          get tooltip() {
            return get$1(tip);
          },
          logging: !0,
          onPointerEnter: /* @__PURE__ */ __name(() => {
            set(effectButtonHover, !0);
          }, "onPointerEnter"),
          onPointerLeave: /* @__PURE__ */ __name(() => {
            set(effectButtonHover, !1);
          }, "onPointerLeave")
        });
      }, "headerQuinaryLeftOptions"), expression = /* @__PURE__ */ derived(() => [
        get$1(frameColorBckg),
        "la-text-header la-prmy-header -padding0-l"
      ]), expression_1 = /* @__PURE__ */ derived(() => [H4_BORDER_STYLE, get$1(frameColorBrdr)]);
      HeaderQuinary($$anchor2, {
        get text() {
          return get$1(core).passive_name;
        },
        get headerStyle() {
          return get$1(expression);
        },
        get borderStyle() {
          return get$1(expression_1);
        },
        textStyle: ["-fontface-stylized"],
        extensionTextFunction: /* @__PURE__ */ __name(() => {
          if (get$1(effectButtonHover)) return `--${getLocalized("LA.use.label")}`;
        }, "extensionTextFunction"),
        get collapseID() {
          return get$1(collID);
        },
        contentLeft: headerQuinaryLeftOptions,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var fragment_3 = root_3$A(), node_1 = sibling(first_child(fragment_3), 2);
          {
            var consequent = /* @__PURE__ */ __name(($$anchor4) => {
              const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.core.passive.label"));
              EffectBox($$anchor4, {
                get name() {
                  return get$1(expression_2);
                },
                get effect() {
                  return get$1(core).passive_effect;
                },
                tooltipEnabled,
                logging: !0
              });
            }, "consequent");
            if_block(node_1, ($$render) => {
              get$1(core).passive_effect && $$render(consequent);
            });
          }
          var node_2 = sibling(node_1, 2);
          ActionBox(node_2, {
            get uuid() {
              return get$1(frame).uuid;
            },
            get actions() {
              return get$1(core).passive_actions;
            },
            get actor() {
              return $$props.actor;
            },
            path: "system.core_system.passive_actions",
            get collapseID() {
              return get$1(actionCollID);
            },
            startCollapsed: !1,
            tooltipEnabled,
            get tooltipTheme() {
              return get$1(theme);
            },
            logging: !0
          }), append($$anchor3, fragment_3);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent_1");
    if_block(node, ($$render) => {
      (get$1(core).passive_effect || get$1(core).passive_actions.length || get$1(core).passive_bonuses.length) && $$render(consequent_1);
    });
  }
  append($$anchor, fragment), pop();
}
__name(FramePassivePower, "FramePassivePower");
const _COUNTER_STYLE = "clipped-alt -widthfull la-bckg-header-anti";
var root_2$o = /* @__PURE__ */ template("<span> </span>"), root_3$z = /* @__PURE__ */ template('<button type="button"></button>'), root_1$v = /* @__PURE__ */ template("<div><!> <!></div>");
function CounterBox($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, qualityMode = getExtraEffectsEnabled(), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.counter.tooltip"));
  function handleOnClick(event2, index2) {
    event2.stopPropagation(), $$props.onPointerClick && $$props.onPointerClick(event2, index2);
  }
  __name(handleOnClick, "handleOnClick");
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var div = root_1$v(), node_1 = child(div);
      {
        var consequent = /* @__PURE__ */ __name(($$anchor3) => {
          var span = root_2$o(), text_1 = child(span);
          template_effect(
            ($0) => {
              set_class(span, `la-counterbox__span ${$0 ?? ""}`), set_text(text_1, $$props.text);
            },
            [
              () => logographicLanguage() ? "-fontsize3" : "-fontsizemedium"
            ]
          ), append($$anchor3, span);
        }, "consequent");
        if_block(node_1, ($$render) => {
          $$props.text && $$render(consequent);
        });
      }
      var node_2 = sibling(node_1, 2);
      each(node_2, 17, () => ({ length: $$props.usesMax }), index, ($$anchor3, _, index2) => {
        var button = root_3$z();
        button.__click = (event2) => handleOnClick(event2, index2), template_effect(
          ($0) => {
            set_class(button, `la-counterbox__button
            mdi ${(index2 < $$props.usesValue ? "mdi-hexagon-slice-6" : "mdi-hexagon-outline") ?? ""}
            la-prmy-header la-scdy-primary -fontsize7
            ${(qualityMode ? "-glow-prmy -glow-scdy-hover" : "") ?? ""}
            ${$$props.type ?? ""}`), set_attribute(button, "data-available", index2 < $$props.usesValue), set_attribute(button, "data-path", $$props.path), set_attribute(button, "aria-label", `${$0 ?? ""} ${$$props.text ?? ""}`);
          },
          [() => getLocalized("LA.use.label")]
        ), event("pointerenter", button, function(...$$args) {
          var _a2;
          (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
        }), event("pointerleave", button, function(...$$args) {
          var _a2;
          (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
        }), append($$anchor3, button);
      }), template_effect(
        ($0) => set_class(div, `la-counterbox la-flexrow -aligncenter la-text-header -padding1-lr
        ${$0 ?? ""}`),
        [
          () => {
            var _a2;
            return (_a2 = $$props.style) != null && _a2.join(" ") || $$props.type === CounterBoxType.Counter ? _COUNTER_STYLE : "";
          }
        ]
      ), append($$anchor2, div);
    }, "consequent_1");
    if_block(node, ($$render) => {
      $$props.usesMax && $$render(consequent_1);
    });
  }
  append($$anchor, fragment), pop();
}
__name(CounterBox, "CounterBox");
delegate(["click"]);
var root_2$n = /* @__PURE__ */ template('<div><span> </span> <div class="la-flexrow -fontsize5"> </div></div>'), root_1$u = /* @__PURE__ */ template('<div class="la-flexrow -widthfull -gap0"></div>');
function BonusBox($$anchor, $$props) {
  push($$props, !0);
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var div = root_1$u();
      each(div, 21, () => $$props.bonuses, index, ($$anchor3, bonus, index2) => {
        var div_1 = root_2$n(), span = child(div_1), text2 = child(span), div_2 = sibling(span, 2), text_1 = child(div_2);
        template_effect(() => {
          set_class(div_1, `la-effectbox la-brdr-repcap la-bckg-card la-flexrow -widthfull ${(index2 === $$props.bonuses.length - 1 ? "-bordersround-ltb" : "-bordersround") ?? ""}`), set_class(span, `la-effectbox__span clipped-bot la-bckg-primary la-text-header -upper -fontsizesmall -fontface-stylized
                ${($$props.editable ? "editable" : "") ?? ""}`), set_attribute(span, "data-path", `$${$$props.bonusPath ?? ""}.$${index2 ?? ""}`), set_text(text2, get$1(bonus).lid), set_text(text_1, get$1(bonus).val);
        }), append($$anchor3, div_1);
      }), append($$anchor2, div);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.bonuses.length && $$render(consequent);
    });
  }
  append($$anchor, fragment), pop();
}
__name(BonusBox, "BonusBox");
var root_3$y = /* @__PURE__ */ template("<i></i>"), root_5$r = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_6$u = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!> <!></div>');
function FrameTrait($$anchor, $$props) {
  push($$props, !0);
  let messageButtonHover = state(!1);
  const tooltipEnabled = getMechSheetTooltipEnabled(), frame = /* @__PURE__ */ derived(() => $$props.system.loadout.frame.value), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function getCollapseID(index2) {
    return `${$$props.actor.uuid}_${get$1(frame).id}_trait_${index2}`;
  }
  __name(getCollapseID, "getCollapseID");
  function getActionCollapseID(index2) {
    return `${$$props.actor.uuid}_${get$1(frame).id}_trait_${index2}_action`;
  }
  __name(getActionCollapseID, "getActionCollapseID");
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_1 = comment(), node_1 = first_child(fragment_1);
      each(node_1, 17, () => get$1(frame).system.traits, index, ($$anchor3, trait, index$1) => {
        const headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor4) => {
          var i = root_3$y();
          set_class(i, `${H2_ICON_SIZE} cci cci-frame`), append($$anchor4, i);
        }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor4) => {
          const expression = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE()]), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
          GlyphButton($$anchor4, {
            get style() {
              return get$1(expression);
            },
            get flowClass() {
              return FlowClass.SendToChat;
            },
            get uuid() {
              return get$1(frame).uuid;
            },
            type: "trait",
            index: index$1,
            tooltipEnabled,
            get tooltipDirection() {
              return TooltipDirection.UP;
            },
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltip() {
              return get$1(expression_1);
            },
            get logText() {
              return get$1(expression_2);
            },
            logging: !0,
            onPointerEnter: /* @__PURE__ */ __name(() => {
              set(messageButtonHover, !0);
            }, "onPointerEnter"),
            onPointerLeave: /* @__PURE__ */ __name(() => {
              set(messageButtonHover, !1);
            }, "onPointerLeave"),
            children: /* @__PURE__ */ __name(($$anchor5, $$slotProps) => {
              var i_1 = root_5$r();
              append($$anchor5, i_1);
            }, "children"),
            $$slots: { default: !0 }
          });
        }, "headerSecondaryRightOptions"), expression_3 = /* @__PURE__ */ derived(() => getCollapseID(index$1));
        HeaderSecondary($$anchor3, {
          get text() {
            return get$1(trait).name;
          },
          headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
          textStyle: [H2_TEXT_SIZE, "-fontface-stylized"],
          borderStyle: ["-bordersoff"],
          extensionTextFunction: /* @__PURE__ */ __name(() => {
            if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
          }, "extensionTextFunction"),
          get collapseID() {
            return get$1(expression_3);
          },
          startCollapsed: !0,
          contentLeft: headerSecondaryLeftOptions2,
          contentRight: headerSecondaryRightOptions,
          children: /* @__PURE__ */ __name(($$anchor4, $$slotProps) => {
            var div = root_6$u(), node_2 = child(div);
            const expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.frame.trait.label"));
            EffectBox(node_2, {
              get name() {
                return get$1(expression_4);
              },
              get effect() {
                return get$1(trait).description;
              },
              tooltipEnabled,
              logging: !0
            });
            var node_3 = sibling(node_2, 2);
            {
              var consequent = /* @__PURE__ */ __name(($$anchor5) => {
                var fragment_4 = comment(), node_4 = first_child(fragment_4);
                each(node_4, 17, () => get$1(trait).counters, index, ($$anchor6, counter, jndex) => {
                  CounterBox($$anchor6, {
                    get text() {
                      return get$1(counter).name;
                    },
                    get type() {
                      return CounterBoxType.Counter;
                    },
                    get usesValue() {
                      return get$1(counter).value;
                    },
                    get usesMax() {
                      return get$1(counter).max;
                    },
                    path: `system.loadout.frame.value.system.traits.${index$1 ?? ""}.counters.${jndex ?? ""}`,
                    logging: !0
                  });
                }), append($$anchor5, fragment_4);
              }, "consequent");
              if_block(node_3, ($$render) => {
                var _a;
                (_a = get$1(trait).counters) != null && _a.length && $$render(consequent);
              });
            }
            var node_5 = sibling(node_3, 2);
            BonusBox(node_5, {
              get bonuses() {
                return get$1(trait).bonuses;
              },
              bonusPath: `system.traits.${index$1}.bonuses`
            });
            var node_6 = sibling(node_5, 2);
            const expression_5 = /* @__PURE__ */ derived(() => getActionCollapseID(index$1));
            ActionBox(node_6, {
              get uuid() {
                return get$1(frame).uuid;
              },
              get actions() {
                return get$1(trait).actions;
              },
              get actor() {
                return $$props.actor;
              },
              path: `system.traits.${index$1}.actions`,
              get collapseID() {
                return get$1(expression_5);
              },
              startCollapsed: !1,
              tooltipEnabled,
              get tooltipTheme() {
                return get$1(theme);
              },
              logging: !0
            });
            var node_7 = sibling(node_6, 2);
            DeployableBox(node_7, {
              get source() {
                return $$props.actor;
              },
              get lidSource() {
                return get$1(trait);
              },
              get uuid() {
                return get$1(frame).uuid;
              },
              get sheetUUID() {
                return $$props.actor.uuid;
              },
              tooltipEnabled,
              get tooltipTheme() {
                return get$1(theme);
              },
              logging: !0
            }), append($$anchor4, div);
          }, "children"),
          $$slots: { default: !0 }
        });
      }), append($$anchor2, fragment_1);
    }, "consequent_1");
    if_block(node, ($$render) => {
      get$1(frame).system.traits.length && $$render(consequent_1);
    });
  }
  append($$anchor, fragment), pop();
}
__name(FrameTrait, "FrameTrait");
var root_1$t = /* @__PURE__ */ template('<div class="la-flexrow la-bckg-primary la-text-header -bordersround -small -bordersoff -padding0-l -padding1-r -aligncenter -gap0"><i class="mdi mdi-label -fontsize2"></i> <span class="-fontsizesmall"> </span></div>'), root_2$m = /* @__PURE__ */ template("<div></div>");
function TagArray($$anchor, $$props) {
  push($$props, !0);
  const renderTags = /* @__PURE__ */ __name(($$anchor2, tag = noop) => {
    var div = root_1$t(), span = sibling(child(div), 2), text2 = child(span);
    template_effect(
      ($0, $1) => {
        set_attribute(div, "data-tooltip", $0), set_attribute(div, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(div, "data-tooltip-direction", $$props.tooltipDirection || TooltipDirection.DOWN), set_text(text2, $1);
      },
      [
        () => $$props.tooltipEnabled ? getTooltip(tag()) : "",
        () => getTagName(tag())
      ]
    ), append($$anchor2, div);
  }, "renderTags");
  function getTooltip(tag) {
    return TooltipFactory.buildTooltip(getTagDescription(tag), getTagName(tag));
  }
  __name(getTooltip, "getTooltip");
  function getTagDescription(tag) {
    return tag.description.replace("{VAL}", tag.val ?? "?") ?? "";
  }
  __name(getTagDescription, "getTagDescription");
  function getTagName(tag) {
    return tag.name.replace("{VAL}", tag.val ?? "?");
  }
  __name(getTagName, "getTagName");
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var div_1 = root_2$m();
      each(div_1, 21, () => $$props.tags, index, ($$anchor3, tag) => {
        var fragment_1 = comment(), node_1 = first_child(fragment_1);
        {
          var consequent = /* @__PURE__ */ __name(($$anchor4) => {
            renderTags($$anchor4, () => get$1(tag));
          }, "consequent");
          if_block(node_1, ($$render) => {
            get$1(tag).hidden || $$render(consequent);
          });
        }
        append($$anchor3, fragment_1);
      }), template_effect(() => set_class(div_1, `la-flexrow -wrapwrap -widthfull -gap0
        -justify${$$props.justify || "center"}`)), append($$anchor2, div_1);
    }, "consequent_1");
    if_block(node, ($$render) => {
      $$props.tags.length > 0 && $$render(consequent_1);
    });
  }
  append($$anchor, fragment), pop();
}
__name(TagArray, "TagArray");
const headerSecondaryLeftOptions = /* @__PURE__ */ __name(($$anchor) => {
  var i = root_2$l();
  set_class(i, `${H2_ICON_SIZE} cci cci-corebonus`), append($$anchor, i);
}, "headerSecondaryLeftOptions");
var root_2$l = /* @__PURE__ */ template("<i></i>"), root_6$t = /* @__PURE__ */ template('<div class="la-flexcol -widthfull -padding2-l"></div>'), root_8$h = /* @__PURE__ */ template('<div class="la-flexcol -widthfull -gap0"><!> <!> <!></div>'), root_4$d = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!></div>');
function Frame($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      logging: !0,
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions"), props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), system = /* @__PURE__ */ derived(() => props.system);
  let collapseAllButtonHover = state(!1);
  const tooltipEnabled = getMechSheetTooltipEnabled(), frame = /* @__PURE__ */ derived(() => {
    var _a;
    return (_a = get$1(system).loadout.frame) == null ? void 0 : _a.value;
  }), core = /* @__PURE__ */ derived(() => {
    var _a;
    return (_a = get$1(frame)) == null ? void 0 : _a.system.core_system;
  }), frameName = /* @__PURE__ */ derived(() => get$1(frame) ? `${get$1(frame).system.manufacturer} ${get$1(frame).name}` : getLocalized("LA.placeholder")), frameColorBckg = /* @__PURE__ */ derived(() => get$1(frame) ? getManufacturerColor(get$1(frame).system.manufacturer, "bckg") : "la-bckg-frame"), frameColorBrdr = /* @__PURE__ */ derived(() => get$1(frame) ? getManufacturerColor(get$1(frame).system.manufacturer, "brdr") : "la-brdr-frame"), collID = /* @__PURE__ */ derived(() => get$1(frame) ? `${get$1(actor).uuid}.frame.${get$1(frame).id}` : `${get$1(actor).uuid}.frame.empty`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid)), expression = /* @__PURE__ */ derived(() => get$1(frame) ? get$1(frameName) : getLocalized("LA.placeholder")), expression_1 = /* @__PURE__ */ derived(() => [
    MAIN_HEADER_STYLE,
    get$1(frameColorBckg),
    "-upper"
  ]), expression_2 = /* @__PURE__ */ derived(() => [get$1(frameColorBrdr)]);
  HeaderMain($$anchor, {
    get text() {
      return get$1(expression);
    },
    get headerStyle() {
      return get$1(expression_1);
    },
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    get borderStyle() {
      return get$1(expression_2);
    },
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
    }, "extensionTextFunction"),
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !0,
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var fragment_2 = comment(), node = first_child(fragment_2);
      {
        var consequent_2 = /* @__PURE__ */ __name(($$anchor3) => {
          var div = root_4$d();
          {
            const outerContent = /* @__PURE__ */ __name(($$anchor4) => {
              var fragment_3 = comment(), node_1 = first_child(fragment_3);
              {
                var consequent = /* @__PURE__ */ __name(($$anchor5) => {
                  var div_1 = root_6$t();
                  each(div_1, 21, () => get$1(core).counters, index, ($$anchor6, counter, index2) => {
                    CounterBox($$anchor6, {
                      get text() {
                        return get$1(counter).name;
                      },
                      get type() {
                        return CounterBoxType.Counter;
                      },
                      get usesValue() {
                        return get$1(counter).value;
                      },
                      get usesMax() {
                        return get$1(counter).max;
                      },
                      path: `system.loadout.frame.value.system.core_system.counters.${index2 ?? ""}`,
                      style: [
                        "clipped-bot-alt -widthfull la-bckg-header-anti"
                      ],
                      logging: !0
                    });
                  }), append($$anchor5, div_1);
                }, "consequent");
                if_block(node_1, ($$render) => {
                  var _a;
                  (_a = get$1(core).counters) != null && _a.length && $$render(consequent);
                });
              }
              append($$anchor4, fragment_3);
            }, "outerContent");
            var node_2 = child(div);
            const expression_3 = /* @__PURE__ */ derived(() => [H2_HEADER_STYLE, get$1(frameColorBckg)]), expression_4 = /* @__PURE__ */ derived(() => `${get$1(collID)}.core`);
            HeaderSecondary(node_2, {
              get text() {
                return get$1(core).name;
              },
              get headerStyle() {
                return get$1(expression_3);
              },
              textStyle: [H2_TEXT_SIZE, "-fontface-stylized"],
              borderStyle: ["-bordersoff"],
              get collapseID() {
                return get$1(expression_4);
              },
              startCollapsed: !0,
              renderOutsideCollapse: outerContent,
              contentLeft: headerSecondaryLeftOptions,
              children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
                var div_2 = root_8$h(), node_3 = child(div_2);
                FrameActivePower(node_3, spread_props(() => props));
                var node_4 = sibling(node_3, 2);
                FramePassivePower(node_4, spread_props(() => props));
                var node_5 = sibling(node_4, 2);
                {
                  var consequent_1 = /* @__PURE__ */ __name(($$anchor5) => {
                    TagArray($$anchor5, {
                      get tags() {
                        return get$1(core).tags;
                      },
                      tooltipEnabled,
                      get tooltipTheme() {
                        return get$1(theme);
                      }
                    });
                  }, "consequent_1");
                  if_block(node_5, ($$render) => {
                    var _a;
                    (_a = get$1(core).tags) != null && _a.length && $$render(consequent_1);
                  });
                }
                append($$anchor4, div_2);
              }, "children"),
              $$slots: { default: !0 }
            });
            var node_6 = sibling(node_2, 2);
            FrameTrait(node_6, spread_props(() => props));
          }
          append($$anchor3, div);
        }, "consequent_2"), alternate = /* @__PURE__ */ __name(($$anchor3) => {
          const expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.frame.empty.label")), expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.frame.empty.subLabel"));
          EmptyBox($$anchor3, {
            get label() {
              return get$1(expression_5);
            },
            get subLabel() {
              return get$1(expression_6);
            }
          });
        }, "alternate");
        if_block(node, ($$render) => {
          get$1(frame) ? $$render(consequent_2) : $$render(alternate, !1);
        });
      }
      append($$anchor2, fragment_2);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(Frame, "Frame");
var AcceptType = /* @__PURE__ */ ((AcceptType2) => (AcceptType2.MechWeaponMod = "weapon_mod", AcceptType2.MechWeapon = "mech_weapon", AcceptType2.MechSystem = "mech_system", AcceptType2.PilotArmor = "pilot_armor", AcceptType2.PilotGear = "pilot_gear", AcceptType2.PilotWeapon = "pilot_weapon", AcceptType2.Skill = "skill", AcceptType2.License = "license", AcceptType2.Reserve = "reserve", AcceptType2))(AcceptType || {});
const H3_ICON_SIZE = "-fontsize9", H3_HEADER_STYLE = "clipped-bot-alt -padding0-tb la-text-header la-prmy-accent";
var root_2$k = /* @__PURE__ */ template('<div class="la-right la-flexrow -aligncenter"><!></div>'), root$F = /* @__PURE__ */ template('<div><div><div class="la-left la-flexrow -aligncenter"><!> <div class="la-flexcol -alignstart -justifycenter -divider"><span> </span> <!></div></div> <!></div> <!> <div><div><!></div></div></div>');
function HeaderTertiary($$anchor, $$props) {
  push($$props, !0);
  let isCollapsed = /* @__PURE__ */ derived(() => getCollapseState($$props.collapseID) ?? $$props.startCollapsed ?? !1);
  onMount(() => {
    $$props.collapseID && ($$props.dontSaveCollapse ?? getCollapseState($$props.collapseID) === void 0) && setCollapseState($$props.collapseID, $$props.startCollapsed ?? !1);
  });
  function toggleCollapse(event2) {
    event2.stopPropagation(), $$props.collapseID && setCollapseState($$props.collapseID, !get$1(isCollapsed));
  }
  __name(toggleCollapse, "toggleCollapse");
  function getExtensionText() {
    if ($$props.extensionTextFunction && $$props.extensionTextFunction()) return $$props.extensionTextFunction();
    if ($$props.extensionText) return $$props.extensionText;
    if ($$props.collapseID) return get$1(isCollapsed) ? `--${getLocalized("LA.expand.label")}` : `--${getLocalized("LA.collapse.label")}`;
  }
  __name(getExtensionText, "getExtensionText");
  var div = root$F(), div_1 = child(div), div_2 = child(div_1), node = child(div_2);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment = comment(), node_1 = first_child(fragment);
      snippet(node_1, () => $$props.contentLeft), append($$anchor2, fragment);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.contentLeft && $$render(consequent);
    });
  }
  var div_3 = sibling(node, 2), span = child(div_3), text_1 = child(span), node_2 = sibling(span, 2);
  const expression = /* @__PURE__ */ derived(() => $$props.collapseID || !$$props.extensionText ? `${$$props.subText} ` : $$props.subText), expression_1 = /* @__PURE__ */ derived(() => $$props.subHeaderFontStyle || ["-fontsizesmall"]), expression_2 = /* @__PURE__ */ derived(getExtensionText);
  TerminalText(node_2, {
    get text() {
      return get$1(expression);
    },
    get textStyle() {
      return get$1(expression_1);
    },
    get extensionText() {
      return get$1(expression_2);
    },
    disableCmdline: !0
  });
  var node_3 = sibling(div_2, 2);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var div_4 = root_2$k(), node_4 = child(div_4);
      snippet(node_4, () => $$props.contentRight), append($$anchor2, div_4);
    }, "consequent_1");
    if_block(node_3, ($$render) => {
      $$props.contentRight && $$render(consequent_1);
    });
  }
  var node_5 = sibling(div_1, 2);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_1 = comment(), node_6 = first_child(fragment_1);
      snippet(node_6, () => $$props.renderOutsideCollapse), append($$anchor2, fragment_1);
    }, "consequent_2");
    if_block(node_5, ($$render) => {
      $$props.renderOutsideCollapse && $$render(consequent_2);
    });
  }
  var div_5 = sibling(node_5, 2), div_6 = child(div_5), node_7 = child(div_6);
  {
    var consequent_3 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_2 = comment(), node_8 = first_child(fragment_2);
      snippet(node_8, () => $$props.children), append($$anchor2, fragment_2);
    }, "consequent_3");
    if_block(node_7, ($$render) => {
      $$props.children && $$render(consequent_3);
    });
  }
  template_effect(
    ($0, $1, $2, $3) => {
      set_class(div, `la-collapsegroup -widthfull ${$0 ?? ""}
        ${($$props.acceptTypes ? `ref set drop-settable ${$$props.acceptTypes}` : "") ?? ""}
        collapse-group`), set_attribute(div, "data-item-id", $$props.itemID), set_attribute(div, "data-uuid", $$props.uuid), set_attribute(div, "data-path", $$props.path), set_attribute(div, "data-accept-types", $$props.acceptTypes), set_attribute(div, "draggable", $$props.acceptTypes ? "true" : "false"), set_class(div_1, `la-summary la-flexrow la-dropshadow 
            -justifybetween -widthfull
            ${$1 ?? ""}
            ${($$props.collapseID ? "collapse-trigger" : "") ?? ""}`), set_class(span, `la-top__span ${$2 ?? ""}`), set_text(text_1, $$props.text), set_class(div_5, `la-collapsegroup__wrapper
            ${($$props.collapseID ? "collapse-wrapper" : "") ?? ""} ${(get$1(isCollapsed) ? "collapsed" : "") ?? ""}`), set_attribute(div_5, "data-la-collapse-id", $$props.collapseID), set_class(div_6, `la-collapsecontent 
                -padding0-l -padding0-tb -bordersround-lb -widthfull -heightfull
                ${$3 ?? ""}`);
    },
    [
      () => $$props.rootStyle ? $$props.rootStyle.join(" ") : "",
      () => {
        var _a;
        return ((_a = $$props.headerStyle) == null ? void 0 : _a.join(" ")) || H3_HEADER_STYLE;
      },
      () => {
        var _a;
        return ((_a = $$props.headerFontStyle) == null ? void 0 : _a.join(" ")) || "-fontsize5";
      },
      () => $$props.borderStyle ? $$props.borderStyle.join(" ") : "la-brdr-primary"
    ]
  ), event("click", div_1, (event2) => toggleCollapse(event2)), append($$anchor, div), pop();
}
__name(HeaderTertiary, "HeaderTertiary");
function LimitedBox($$anchor, $$props) {
  push($$props, !0);
  const log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.limited.tooltip")), expression = /* @__PURE__ */ derived(() => getLocalized("LA.limited.label"));
  CounterBox($$anchor, {
    get text() {
      return get$1(expression);
    },
    get type() {
      return CounterBoxType.Limited;
    },
    get usesValue() {
      return $$props.usesValue;
    },
    get usesMax() {
      return $$props.usesMax;
    },
    get path() {
      return $$props.path;
    },
    get logText() {
      return get$1(log);
    },
    get logging() {
      return $$props.logging;
    },
    get onPointerClick() {
      return $$props.onPointerClick;
    }
  }), pop();
}
__name(LimitedBox, "LimitedBox");
var root$E = /* @__PURE__ */ template('<div role="none"><span><!></span> <i></i></div>');
function TotalSP($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.mech.system.points.total.tooltip"));
  var div = root$E(), span = child(div), node = child(span);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var text$1 = text();
      template_effect(() => set_text(text$1, `${$$props.value ?? ""} / ${$$props.max ?? ""}`)), append($$anchor2, text$1);
    }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor2) => {
      var text_1 = text();
      template_effect(() => set_text(text_1, $$props.value)), append($$anchor2, text_1);
    }, "alternate");
    if_block(node, ($$render) => {
      $$props.max ? $$render(consequent) : $$render(alternate, !1);
    });
  }
  var i = sibling(span, 2);
  template_effect(
    ($0, $1, $2) => {
      set_class(div, `la-flexrow -aligncenter -height4 ${$0 ?? ""}`), set_class(span, $1), set_class(i, `cci cci-system-point ${$2 ?? ""}`);
    },
    [
      () => {
        var _a2;
        return ((_a2 = $$props.style) == null ? void 0 : _a2.join(" ")) || H2_TEXT_SIZE;
      },
      () => {
        var _a2;
        return (_a2 = $$props.textStyle) == null ? void 0 : _a2.join(" ");
      },
      () => {
        var _a2;
        return ((_a2 = $$props.iconStyle) == null ? void 0 : _a2.join(" ")) || H2_ICON_SIZE;
      }
    ]
  ), event("pointerenter", div, function(...$$args) {
    var _a2;
    (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
  }), event("pointerleave", div, function(...$$args) {
    var _a2;
    (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
  }), append($$anchor, div), pop();
}
__name(TotalSP, "TotalSP");
var root_2$j = /* @__PURE__ */ template("<!> <!>", 1), root_7$j = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull -padding2-l -fontface-stylized"><div class="la-flexrow clipped-bot-alt la-bckg-header-anti -widthfull"><!></div></div>'), root_10$g = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_11$i = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_9$j = /* @__PURE__ */ template('<!> <div class="la-flexcol -margin3-lr"><!> <!></div>', 1), root_15$8 = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull -padding1-l"></div>'), root_14$8 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!> <!> <!></div>'), root_5$q = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"><!> <!></div>');
function Systems$1($$anchor, $$props) {
  push($$props, !0);
  const emptySystems = /* @__PURE__ */ __name(($$anchor2) => {
    const expression = /* @__PURE__ */ derived(() => get$1(system).loadout.sp.value ? getLocalized("LA.mech.system.undermounted.label") : getLocalized("LA.mech.system.empty.label")), expression_1 = /* @__PURE__ */ derived(() => get$1(system).loadout.sp.value ? formatString(getLocalized("LA.mech.system.undermounted.subLabel"), (get$1(system).loadout.sp.max - get$1(system).loadout.sp.value).toString()) : getLocalized("LA.mech.system.empty.subLabel"));
    EmptyBox($$anchor2, {
      get label() {
        return get$1(expression);
      },
      get subLabel() {
        return get$1(expression_1);
      },
      get type() {
        return AcceptType.MechSystem;
      },
      get path() {
        return `system.loadout.systems.${get$1(systemComponents).length ?? ""}.value`;
      }
    });
  }, "emptySystems"), headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment_1 = root_2$j(), node = first_child(fragment_1);
    TotalSP(node, {
      get value() {
        return get$1(system).loadout.sp.value;
      },
      get max() {
        return get$1(system).loadout.sp.max;
      },
      logging: !0
    });
    var node_1 = sibling(node, 2);
    CollapseAllButton(node_1, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      logging: !0,
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    }), append($$anchor2, fragment_1);
  }, "headerOptions"), props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), system = /* @__PURE__ */ derived(() => props.system);
  let collapseAllButtonHover = state(!1), effectButtonHover = state(!1), editButtonHover = state(!1), messageButtonHover = state(!1);
  const tooltipEnabled = getMechSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), systemComponents = /* @__PURE__ */ derived(() => {
    var _a, _b;
    return (_b = (_a = get$1(system)) == null ? void 0 : _a.loadout.systems) == null ? void 0 : _b.filter((item) => item !== null);
  }), collID = /* @__PURE__ */ derived(() => get$1(systemComponents).length ? `${get$1(actor).uuid}.systems` : `${get$1(actor).uuid}.systems.empty`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  function renderOuter(component) {
    return !isDestroyed(component) && component.value.system.uses.max;
  }
  __name(renderOuter, "renderOuter");
  function getActionCollID(index2) {
    return `${get$1(actor).uuid}.systems.${index2}.action`;
  }
  __name(getActionCollID, "getActionCollID");
  function isDestroyed(component) {
    var _a;
    return (_a = component.value) == null ? void 0 : _a.system.destroyed;
  }
  __name(isDestroyed, "isDestroyed");
  function getTitleStyle(component) {
    return isDestroyed(component) ? "la-text-repcap la-prmy-accent -strikethrough" : "la-text-header la-prmy-accent";
  }
  __name(getTitleStyle, "getTitleStyle");
  function getSubtitleStyle(component) {
    return isDestroyed(component) ? `la-text-error la-prmy-error ${photosensitiveStyling("horus--very--subtle")}` : "la-text-header la-prmy-header";
  }
  __name(getSubtitleStyle, "getSubtitleStyle");
  function getIconStyle(component) {
    let icon = SYSTEM_ICON_MAP[component.value.system.type] || "cci-system";
    return isDestroyed(component) ? `cci ${icon} la-text-repcap` : `cci ${icon} la-prmy-header la-scdy-primary ` + (qualityMode ? "-glow-prmy -glow-scdy-hover " : " ");
  }
  __name(getIconStyle, "getIconStyle");
  function getSPStyle(component) {
    return isDestroyed(component) ? "la-text-repcap" : "la-text-header";
  }
  __name(getSPStyle, "getSPStyle");
  function getSubtitle(component) {
    return isDestroyed(component) ? getLocalized("LA.mech.system.destroyed.label") : getLocalized(SYSTEM_LOCALIZE_MAP[component.value.system.type]) || getLocalized("LA.mech.system.system.label");
  }
  __name(getSubtitle, "getSubtitle");
  function getComponentPath(index2) {
    return `system.loadout.systems.${index2}.value`;
  }
  __name(getComponentPath, "getComponentPath");
  var fragment_2 = comment(), node_2 = first_child(fragment_2);
  {
    var consequent_5 = /* @__PURE__ */ __name(($$anchor2) => {
      const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.label"));
      HeaderMain($$anchor2, {
        get text() {
          return get$1(expression_2);
        },
        headerStyle: [MAIN_HEADER_STYLE, "la-bckg-system"],
        textStyle: ["la-text-header -fontsize4 -overflowhidden"],
        borderStyle: ["la-brdr-system"],
        extensionTextFunction: /* @__PURE__ */ __name(() => {
          if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
        }, "extensionTextFunction"),
        get collapseID() {
          return get$1(collID);
        },
        startCollapsed: !0,
        headerContent: headerOptions,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var fragment_4 = comment(), node_3 = first_child(fragment_4);
          {
            var consequent_4 = /* @__PURE__ */ __name(($$anchor4) => {
              var div = root_5$q(), node_4 = child(div);
              each(node_4, 17, () => get$1(systemComponents), index, ($$anchor5, component, index$1) => {
                var fragment_7 = comment();
                const outerContent = /* @__PURE__ */ __name(($$anchor6) => {
                  var div_1 = root_7$j(), div_2 = child(div_1), node_5 = child(div_2);
                  const expression_3 = /* @__PURE__ */ derived(() => {
                    var _a;
                    return (_a = get$1(component).value) == null ? void 0 : _a.system.uses.value;
                  }), expression_4 = /* @__PURE__ */ derived(() => {
                    var _a;
                    return (_a = get$1(component).value) == null ? void 0 : _a.system.uses.max;
                  }), expression_5 = /* @__PURE__ */ derived(() => getComponentPath(index$1));
                  LimitedBox(node_5, {
                    get usesValue() {
                      return get$1(expression_3);
                    },
                    get usesMax() {
                      return get$1(expression_4);
                    },
                    get path() {
                      return get$1(expression_5);
                    },
                    logging: !0
                  }), append($$anchor6, div_1);
                }, "outerContent"), headerTertiaryLeftOptions = /* @__PURE__ */ __name(($$anchor6) => {
                  const expression_6 = /* @__PURE__ */ derived(() => [
                    H3_ICON_SIZE,
                    getIconStyle(get$1(component))
                  ]), expression_7 = /* @__PURE__ */ derived(() => get$1(component).value.system.effect ? FlowClass.SendEffectToChat : FlowClass.SendToChat), expression_8 = /* @__PURE__ */ derived(() => getComponentPath(index$1)), expression_9 = /* @__PURE__ */ derived(() => isDestroyed(get$1(component)));
                  EffectButton($$anchor6, {
                    get iconStyle() {
                      return get$1(expression_6);
                    },
                    iconBackgroundStyle: [
                      "la-prmy-secondary",
                      H3_ICON_SIZE,
                      qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
                    ],
                    get flowClass() {
                      return get$1(expression_7);
                    },
                    get path() {
                      return get$1(expression_8);
                    },
                    tooltipEnabled,
                    get tooltipTheme() {
                      return get$1(theme);
                    },
                    get tooltipDirection() {
                      return TooltipDirection.LEFT;
                    },
                    get tooltip() {
                      return get$1(component).value.system.effect;
                    },
                    logging: !0,
                    get disabled() {
                      return get$1(expression_9);
                    },
                    onPointerEnter: /* @__PURE__ */ __name(() => {
                      set(effectButtonHover, !0);
                    }, "onPointerEnter"),
                    onPointerLeave: /* @__PURE__ */ __name(() => {
                      set(effectButtonHover, !1);
                    }, "onPointerLeave")
                  });
                }, "headerTertiaryLeftOptions"), headerTertiaryRightOptions = /* @__PURE__ */ __name(($$anchor6) => {
                  var fragment_6 = root_9$j(), node_6 = first_child(fragment_6);
                  const expression_10 = /* @__PURE__ */ derived(() => [
                    getSPStyle(get$1(component)),
                    "-fontface-stylized"
                  ]), expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.points.tooltip"));
                  TotalSP(node_6, {
                    get value() {
                      return get$1(component).value.system.sp;
                    },
                    get style() {
                      return get$1(expression_10);
                    },
                    get logText() {
                      return get$1(expression_11);
                    },
                    logging: !0
                  });
                  var div_3 = sibling(node_6, 2), node_7 = child(div_3);
                  const expression_12 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE()]), expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip")), expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
                  GlyphButton(node_7, {
                    get style() {
                      return get$1(expression_12);
                    },
                    get flowClass() {
                      return FlowClass.SendToChat;
                    },
                    type: "system",
                    index: index$1,
                    tooltipEnabled,
                    get tooltipDirection() {
                      return TooltipDirection.UP;
                    },
                    get tooltipTheme() {
                      return get$1(theme);
                    },
                    get tooltip() {
                      return get$1(expression_13);
                    },
                    get logText() {
                      return get$1(expression_14);
                    },
                    logging: !0,
                    onPointerEnter: /* @__PURE__ */ __name(() => {
                      set(messageButtonHover, !0);
                    }, "onPointerEnter"),
                    onPointerLeave: /* @__PURE__ */ __name(() => {
                      set(messageButtonHover, !1);
                    }, "onPointerLeave"),
                    children: /* @__PURE__ */ __name(($$anchor7, $$slotProps2) => {
                      var i = root_10$g();
                      append($$anchor7, i);
                    }, "children"),
                    $$slots: { default: !0 }
                  });
                  var node_8 = sibling(node_7, 2);
                  const expression_15 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE()]), expression_16 = /* @__PURE__ */ derived(() => getComponentPath(index$1)), expression_17 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_18 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
                  GlyphButton(node_8, {
                    get style() {
                      return get$1(expression_15);
                    },
                    get flowClass() {
                      return FlowClass.ContextMenu;
                    },
                    get path() {
                      return get$1(expression_16);
                    },
                    tooltipEnabled,
                    get tooltipDirection() {
                      return TooltipDirection.UP;
                    },
                    get tooltipTheme() {
                      return get$1(theme);
                    },
                    get tooltip() {
                      return get$1(expression_17);
                    },
                    get logText() {
                      return get$1(expression_18);
                    },
                    logging: !0,
                    onPointerEnter: /* @__PURE__ */ __name(() => {
                      set(editButtonHover, !0);
                    }, "onPointerEnter"),
                    onPointerLeave: /* @__PURE__ */ __name(() => {
                      set(editButtonHover, !1);
                    }, "onPointerLeave"),
                    children: /* @__PURE__ */ __name(($$anchor7, $$slotProps2) => {
                      var i_1 = root_11$i();
                      append($$anchor7, i_1);
                    }, "children"),
                    $$slots: { default: !0 }
                  }), append($$anchor6, fragment_6);
                }, "headerTertiaryRightOptions");
                var node_9 = first_child(fragment_7);
                {
                  var consequent_2 = /* @__PURE__ */ __name(($$anchor6) => {
                    const expression_19 = /* @__PURE__ */ derived(() => getComponentPath(index$1)), expression_20 = /* @__PURE__ */ derived(() => [
                      getTitleStyle(get$1(component)),
                      H2_TEXT_SIZE,
                      "-fontface-stylized"
                    ]), expression_21 = /* @__PURE__ */ derived(() => getSubtitle(get$1(component))), expression_22 = /* @__PURE__ */ derived(() => [
                      getSubtitleStyle(get$1(component)),
                      "-fontsizesmall -fontface-stylized"
                    ]), expression_23 = /* @__PURE__ */ derived(() => renderOuter(get$1(component)) ? outerContent : void 0);
                    HeaderTertiary($$anchor6, {
                      get itemID() {
                        return get$1(component).value.id;
                      },
                      get uuid() {
                        return get$1(component).value.uuid;
                      },
                      get path() {
                        return get$1(expression_19);
                      },
                      acceptTypes: "mech_system",
                      get collapseID() {
                        return get$1(component).value.uuid;
                      },
                      startCollapsed: !0,
                      get text() {
                        return get$1(component).value.name;
                      },
                      headerStyle: [H3_HEADER_STYLE, "la-bckg-pilot"],
                      get headerFontStyle() {
                        return get$1(expression_20);
                      },
                      get subText() {
                        return get$1(expression_21);
                      },
                      get subHeaderFontStyle() {
                        return get$1(expression_22);
                      },
                      borderStyle: ["-bordersoff"],
                      extensionTextFunction: /* @__PURE__ */ __name(() => {
                        if (get$1(effectButtonHover)) return `--${getLocalized("LA.use.label")}`;
                        if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
                        if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
                      }, "extensionTextFunction"),
                      get renderOutsideCollapse() {
                        return get$1(expression_23);
                      },
                      contentLeft: headerTertiaryLeftOptions,
                      contentRight: headerTertiaryRightOptions,
                      children: /* @__PURE__ */ __name(($$anchor7, $$slotProps2) => {
                        var fragment_9 = comment(), node_10 = first_child(fragment_9);
                        {
                          var consequent_1 = /* @__PURE__ */ __name(($$anchor8) => {
                            var div_4 = root_14$8(), node_11 = child(div_4);
                            {
                              var consequent = /* @__PURE__ */ __name(($$anchor9) => {
                                var div_5 = root_15$8();
                                each(div_5, 21, () => get$1(component).value.system.counters, index, ($$anchor10, counter, jndex) => {
                                  const expression_24 = /* @__PURE__ */ derived(() => getComponentPath(index$1));
                                  CounterBox($$anchor10, {
                                    get text() {
                                      return get$1(counter).name;
                                    },
                                    get type() {
                                      return CounterBoxType.Counter;
                                    },
                                    get usesValue() {
                                      return get$1(counter).value;
                                    },
                                    get usesMax() {
                                      return get$1(counter).max;
                                    },
                                    get path() {
                                      return `${get$1(expression_24) ?? ""}.system.counters.${jndex ?? ""}`;
                                    },
                                    logging: !0
                                  });
                                }), append($$anchor9, div_5);
                              }, "consequent");
                              if_block(node_11, ($$render) => {
                                var _a;
                                (_a = get$1(component).value.system.counters) != null && _a.length && $$render(consequent);
                              });
                            }
                            var node_12 = sibling(node_11, 2);
                            const expression_25 = /* @__PURE__ */ derived(() => `${getComponentPath(index$1)}.system.bonuses`);
                            BonusBox(node_12, {
                              get bonuses() {
                                return get$1(component).value.system.bonuses;
                              },
                              get bonusPath() {
                                return get$1(expression_25);
                              }
                            });
                            var node_13 = sibling(node_12, 2);
                            const expression_26 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.effect.label"));
                            EffectBox(node_13, {
                              get name() {
                                return get$1(expression_26);
                              },
                              get effect() {
                                return get$1(component).value.system.effect;
                              },
                              tooltipEnabled,
                              logging: !0
                            });
                            var node_14 = sibling(node_13, 2);
                            const expression_27 = /* @__PURE__ */ derived(() => getActionCollID(index$1));
                            ActionBox(node_14, {
                              get uuid() {
                                return get$1(component).value.uuid;
                              },
                              get actions() {
                                return get$1(component).value.system.actions;
                              },
                              get actor() {
                                return get$1(actor);
                              },
                              path: "system.actions",
                              get collapseID() {
                                return get$1(expression_27);
                              },
                              startCollapsed: !1,
                              tooltipEnabled,
                              get tooltipTheme() {
                                return get$1(theme);
                              },
                              logging: !0
                            });
                            var node_15 = sibling(node_14, 2);
                            DeployableBox(node_15, {
                              get source() {
                                return get$1(actor);
                              },
                              get lidSource() {
                                return get$1(component).value.system;
                              },
                              get uuid() {
                                return get$1(component).value.uuid;
                              },
                              get sheetUUID() {
                                return get$1(actor).uuid;
                              },
                              tooltipEnabled,
                              get tooltipTheme() {
                                return get$1(theme);
                              },
                              logging: !0
                            });
                            var node_16 = sibling(node_15, 2);
                            TagArray(node_16, {
                              get tags() {
                                return get$1(component).value.system.tags;
                              },
                              justify: "start",
                              tooltipEnabled,
                              get tooltipTheme() {
                                return get$1(theme);
                              }
                            }), append($$anchor8, div_4);
                          }, "consequent_1");
                          if_block(node_10, ($$render) => {
                            isDestroyed(get$1(component)) || $$render(consequent_1);
                          });
                        }
                        append($$anchor7, fragment_9);
                      }, "children"),
                      $$slots: { default: !0 }
                    });
                  }, "consequent_2");
                  if_block(node_9, ($$render) => {
                    get$1(component).value && $$render(consequent_2);
                  });
                }
                append($$anchor5, fragment_7);
              });
              var node_17 = sibling(node_4, 2);
              {
                var consequent_3 = /* @__PURE__ */ __name(($$anchor5) => {
                  emptySystems($$anchor5);
                }, "consequent_3");
                if_block(node_17, ($$render) => {
                  get$1(system).loadout.sp.value < get$1(system).loadout.sp.max && $$render(consequent_3);
                });
              }
              append($$anchor4, div);
            }, "consequent_4"), alternate = /* @__PURE__ */ __name(($$anchor4) => {
              emptySystems($$anchor4);
            }, "alternate");
            if_block(node_3, ($$render) => {
              var _a;
              (_a = get$1(systemComponents)) != null && _a.length ? $$render(consequent_4) : $$render(alternate, !1);
            });
          }
          append($$anchor3, fragment_4);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent_5");
    if_block(node_2, ($$render) => {
      get$1(system).loadout.frame && $$render(consequent_5);
    });
  }
  append($$anchor, fragment_2), pop();
}
__name(Systems$1, "Systems$1");
function LoadedBox($$anchor, $$props) {
  push($$props, !0);
  const loaded = /* @__PURE__ */ derived(() => $$props.item.system.loaded), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.loaded.tooltip"));
  function handleLoadedInteraction(event2, index2) {
    $$props.item.update({ "system.loaded": !get$1(loaded) }), $$props.onPointerClick && event2.currentTarget instanceof HTMLElement && $$props.onPointerClick(event2, index2);
  }
  __name(handleLoadedInteraction, "handleLoadedInteraction");
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.loaded.label")), expression_1 = /* @__PURE__ */ derived(() => get$1(loaded) ? 1 : 0);
      CounterBox($$anchor2, {
        get text() {
          return get$1(expression);
        },
        get type() {
          return CounterBoxType.Loaded;
        },
        get usesValue() {
          return get$1(expression_1);
        },
        usesMax: 1,
        get path() {
          return $$props.path;
        },
        get style() {
          return $$props.style;
        },
        get logText() {
          return get$1(log);
        },
        get logging() {
          return $$props.logging;
        },
        onPointerClick: handleLoadedInteraction
      });
    }, "consequent");
    if_block(node, ($$render) => {
      isLoading($$props.item) && ($$props.item.type === "mech_weapon" || $$props.item.type === "pilot_weapon" || $$props.item.type === "npc_feature") && $$render(consequent);
    });
  }
  return append($$anchor, fragment), pop({ handleLoadedInteraction });
}
__name(LoadedBox, "LoadedBox");
var root_2$i = /* @__PURE__ */ template("<span> </span><i></i>", 1), root_1$s = /* @__PURE__ */ template("<span></span>");
function DamageArray($$anchor, $$props) {
  push($$props, !0);
  const qualityMode = getExtraEffectsEnabled();
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var span = root_1$s();
      each(span, 21, () => $$props.damages, index, ($$anchor3, damage) => {
        var fragment_1 = root_2$i(), span_1 = first_child(fragment_1), text2 = child(span_1), i = sibling(span_1);
        template_effect(
          ($0, $1) => {
            set_class(span_1, `la-number-weapon__span
                ${$0 ?? ""}`), set_text(text2, $1), set_class(i, `cci ${get$1(damage).icon ?? ""}
                ${$0 ?? ""}`);
          },
          [
            () => qualityMode ? "-glow-" + get$1(damage).type.toLowerCase() : "",
            () => get$1(damage).val.replace(/\s/g, "")
          ]
        ), append($$anchor3, fragment_1);
      }), template_effect(
        ($0) => set_class(span, `la-damage la-flexrow -justifycenter -aligncenter -lineheight3 -widthfull -flex1 -fontface-stylized
    ${$0 ?? ""}`),
        [() => {
          var _a;
          return (_a = $$props.style) == null ? void 0 : _a.join(" ");
        }]
      ), append($$anchor2, span);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.damages.length && $$render(consequent);
    });
  }
  append($$anchor, fragment), pop();
}
__name(DamageArray, "DamageArray");
var root_2$h = /* @__PURE__ */ template('<span class="la-number-weapon__span"> </span> <i></i>', 1), root_1$r = /* @__PURE__ */ template("<span></span>");
function RangeArray($$anchor, $$props) {
  push($$props, !0);
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var span = root_1$r();
      each(span, 21, () => $$props.ranges, index, ($$anchor3, range) => {
        var fragment_1 = root_2$h(), span_1 = first_child(fragment_1), text2 = child(span_1), i = sibling(span_1, 2);
        template_effect(() => {
          set_text(text2, get$1(range).val), set_class(i, `cci ${get$1(range).icon ?? ""}`);
        }), append($$anchor3, fragment_1);
      }), template_effect(
        ($0) => set_class(span, `la-range la-flexrow -justifycenter -aligncenter -lineheight3 -widthfull -flex1 -fontface-stylized
        ${$0 ?? ""}`),
        [() => {
          var _a;
          return (_a = $$props.style) == null ? void 0 : _a.join(" ");
        }]
      ), append($$anchor2, span);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.ranges.length && $$render(consequent);
    });
  }
  append($$anchor, fragment), pop();
}
__name(RangeArray, "RangeArray");
const _DEFAULT_I_BACKGROUND$1 = "-fontsize11 la-text-scrollbar-secondary";
var root_3$x = /* @__PURE__ */ template('<i style="z-index: -1;"></i>'), root$D = /* @__PURE__ */ template('<button type="button"><!> <!> <!></button>');
function DamageButton($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, tip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip($$props.tooltip || getLocalized("LA.flow.rollDamage.tooltip"), $$props.tooltipHeader)), hasAllWeaponProperties = /* @__PURE__ */ derived(() => {
    var _a2, _b;
    return ((_a2 = $$props.damage) == null ? void 0 : _a2.length) && ((_b = $$props.range) == null ? void 0 : _b.length);
  }), rollable = /* @__PURE__ */ derived(() => {
    var _a2;
    return !$$props.disabled && ((_a2 = $$props.damage) == null ? void 0 : _a2.length) > 0;
  }), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.flow.rollDamage.tooltip"));
  function handleOnPointerEnter(event2) {
    if ($$props.onPointerEnter && $$props.onPointerEnter(), $$props.logging) sendToTextConsole(event2, get$1(log), actorUuid);
    else return;
  }
  __name(handleOnPointerEnter, "handleOnPointerEnter");
  function handleOnPointerLeave(event2) {
    if ($$props.onPointerLeave && $$props.onPointerLeave(), $$props.logging) resetTextConsole(event2, actorUuid);
    else return;
  }
  __name(handleOnPointerLeave, "handleOnPointerLeave");
  var button = root$D(), node = child(button);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      RangeArray($$anchor2, {
        get ranges() {
          return $$props.range;
        },
        get style() {
          return $$props.iconStyle;
        }
      });
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.range && $$render(consequent);
    });
  }
  var node_1 = sibling(node, 2);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      const expression = /* @__PURE__ */ derived(() => $$props.iconStyle || []);
      DamageArray($$anchor2, {
        get damages() {
          return $$props.damage;
        },
        get style() {
          return get$1(expression);
        }
      });
    }, "consequent_1");
    if_block(node_1, ($$render) => {
      $$props.damage && $$render(consequent_1);
    });
  }
  var node_2 = sibling(node_1, 2);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      var i = root_3$x();
      template_effect(
        ($0) => set_class(i, `fal fa-dice-d20 -positionabsolute 
            ${$0 ?? ""}`),
        [
          () => {
            var _a2;
            return ((_a2 = $$props.iconBackgroundStyle) == null ? void 0 : _a2.join(" ")) || _DEFAULT_I_BACKGROUND$1;
          }
        ]
      ), append($$anchor2, i);
    }, "consequent_2");
    if_block(node_2, ($$render) => {
      var _a2;
      !$$props.disabled && ((_a2 = $$props.damage) != null && _a2.length) && $$render(consequent_2);
    });
  }
  template_effect(
    ($0, $1, $2) => {
      set_class(button, `
        la-properties la-flexcol -fontsize5 la-prmy-accent -justifycenter -positionrelative
        ${(get$1(hasAllWeaponProperties) ? "-divider" : "") ?? ""}
        ${$0 ?? ""}
        ${($$props.flowClass || FlowClass.RollDamage) ?? ""}
        ${$1 ?? ""}`), set_attribute(button, "data-tooltip", $$props.tooltipEnabled && get$1(rollable) ? get$1(tip) : void 0), set_attribute(button, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(button, "data-tooltip-direction", $$props.tooltipDirection || TooltipDirection.UP), set_attribute(button, "aria-label", $2), button.disabled = !get$1(rollable);
    },
    [
      () => {
        var _a2;
        return (_a2 = $$props.style) == null ? void 0 : _a2.join(" ");
      },
      () => $$props.disabled ? "" : CLICKABLE_HOVER(),
      () => $$props.tooltip || getLocalized("LA.flow.rollDamage.tooltip")
    ]
  ), event("pointerenter", button, handleOnPointerEnter), event("pointerleave", button, handleOnPointerLeave), append($$anchor, button), pop();
}
__name(DamageButton, "DamageButton");
const _DEFAULT_I_BACKGROUND = `${H3_ICON_SIZE} la-text-scrollbar-secondary`, _DEFAULT_I_FOREGROUND = `${H3_ICON_SIZE}`;
var root_1$q = /* @__PURE__ */ template('<i style="z-index: -1;"></i>'), root$C = /* @__PURE__ */ template('<button type="button"><i></i> <!></button>');
function AttackButton($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, tip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip($$props.tooltip || getLocalized("LA.flow.rollAttack.tooltip"), $$props.tooltipHeader)), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.flow.rollAttack.tooltip"));
  function handleOnPointerEnter(event2) {
    if ($$props.onPointerEnter && $$props.onPointerEnter(), $$props.logging) sendToTextConsole(event2, get$1(log), actorUuid);
    else return;
  }
  __name(handleOnPointerEnter, "handleOnPointerEnter");
  function handleOnPointerLeave(event2) {
    if ($$props.onPointerLeave && $$props.onPointerLeave(), $$props.logging) resetTextConsole(event2, actorUuid);
    else return;
  }
  __name(handleOnPointerLeave, "handleOnPointerLeave");
  var button = root$C(), i = child(button), node = sibling(i, 2);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var i_1 = root_1$q();
      template_effect(
        ($0) => set_class(i_1, `fal fa-dice-d20 -positionabsolute -left0 
            ${$0 ?? ""}`),
        [
          () => {
            var _a2;
            return ((_a2 = $$props.iconBackgroundStyle) == null ? void 0 : _a2.join(" ")) || _DEFAULT_I_BACKGROUND;
          }
        ]
      ), append($$anchor2, i_1);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.disabled || $$render(consequent);
    });
  }
  template_effect(
    ($0, $1, $2, $3) => {
      set_class(button, `-positionrelative
        ${$0 ?? ""}
        ${$1 ?? ""}
        ${($$props.flowClass || FlowClass.RollAttack) ?? ""}`), set_attribute(button, "data-tooltip", $$props.tooltipEnabled && !$$props.disabled ? get$1(tip) : void 0), set_attribute(button, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(button, "data-tooltip-direction", $$props.tooltipDirection || TooltipDirection.LEFT), set_attribute(button, "aria-label", $2), button.disabled = $$props.disabled || !1, set_class(i, `
            ${$3 ?? ""}`);
    },
    [
      () => $$props.disabled ? "" : CLICKABLE_HOVER(),
      () => {
        var _a2;
        return (_a2 = $$props.style) == null ? void 0 : _a2.join(" ");
      },
      () => $$props.tooltip || getLocalized("LA.flow.rollAttack.tooltip"),
      () => {
        var _a2;
        return ((_a2 = $$props.iconStyle) == null ? void 0 : _a2.join(" ")) || _DEFAULT_I_FOREGROUND;
      }
    ]
  ), event("pointerenter", button, handleOnPointerEnter), event("pointerleave", button, handleOnPointerLeave), append($$anchor, button), pop();
}
__name(AttackButton, "AttackButton");
var root_4$c = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_3$w = /* @__PURE__ */ template("<!> <!>", 1), root_7$i = /* @__PURE__ */ template('<div class="la-flexrow clipped-alt la-bckg-header-anti -widthfull -margin2-l"><!></div>'), root_6$s = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"><!> <!></div>'), root_11$h = /* @__PURE__ */ template('<div class="la-flexrow -widthfull"><!> <!></div>'), root_17$7 = /* @__PURE__ */ template("<!> <!>", 1), root_18$5 = /* @__PURE__ */ template("<!> <hr> <!>", 1), root_10$f = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!> <!></div>');
function WeaponMod($$anchor, $$props) {
  push($$props, !0);
  let effectButtonHover = state(!1), editButtonHover = state(!1);
  const tooltipEnabled = getMechSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), collID = /* @__PURE__ */ derived(() => $$props.mod ? `${$$props.mod.uuid}.action` : "empty"), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_7 = /* @__PURE__ */ __name(($$anchor2) => {
      HeaderSecondary($$anchor2, {
        get uuid() {
          return $$props.mod.uuid;
        },
        get path() {
          return $$props.path;
        },
        acceptTypes: "weapon_mod",
        get text() {
          return $$props.mod.name;
        },
        headerStyle: [H2_HEADER_STYLE, "la-bckg-header-anti"],
        textStyle: [H2_TEXT_SIZE, "-fontface-stylized"],
        borderStyle: ["la-brdr-weapon-mod"],
        extensionTextFunction: /* @__PURE__ */ __name(() => {
          if (get$1(effectButtonHover)) return `--${getLocalized("LA.use.label")}`;
          if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
        }, "extensionTextFunction"),
        get collapseID() {
          return $$props.mod.uuid;
        },
        startCollapsed: !0,
        renderOutsideCollapse: /* @__PURE__ */ __name(($$anchor3) => {
          var fragment_3 = comment(), node_3 = first_child(fragment_3);
          {
            var consequent_2 = /* @__PURE__ */ __name(($$anchor4) => {
              var div = root_6$s(), node_4 = child(div);
              {
                var consequent = /* @__PURE__ */ __name(($$anchor5) => {
                  var div_1 = root_7$i(), node_5 = child(div_1);
                  LimitedBox(node_5, {
                    get usesValue() {
                      return $$props.mod.system.uses.value;
                    },
                    get usesMax() {
                      return $$props.mod.system.uses.max;
                    },
                    get path() {
                      return $$props.path;
                    },
                    logging: !0
                  }), append($$anchor5, div_1);
                }, "consequent");
                if_block(node_4, ($$render) => {
                  $$props.mod.system.uses.max && $$render(consequent);
                });
              }
              var node_6 = sibling(node_4, 2);
              {
                var consequent_1 = /* @__PURE__ */ __name(($$anchor5) => {
                  var fragment_4 = comment(), node_7 = first_child(fragment_4);
                  each(node_7, 17, () => $$props.mod.system.counters, index, ($$anchor6, counter, index2) => {
                    CounterBox($$anchor6, {
                      get text() {
                        return get$1(counter).name;
                      },
                      get type() {
                        return CounterBoxType.Counter;
                      },
                      get usesValue() {
                        return get$1(counter).value;
                      },
                      get usesMax() {
                        return get$1(counter).max;
                      },
                      get path() {
                        return `${$$props.path ?? ""}.system.counters.${index2 ?? ""}`;
                      },
                      logging: !0
                    });
                  }), append($$anchor5, fragment_4);
                }, "consequent_1");
                if_block(node_6, ($$render) => {
                  $$props.mod.system.counters.length && $$render(consequent_1);
                });
              }
              append($$anchor4, div);
            }, "consequent_2");
            if_block(node_3, ($$render) => {
              ($$props.mod.system.uses.max || $$props.mod.system.counters.length) && $$render(consequent_2);
            });
          }
          append($$anchor3, fragment_3);
        }, "outerContent"),
        contentLeft: /* @__PURE__ */ __name(($$anchor3) => {
          const expression = /* @__PURE__ */ derived(() => $$props.mod.system.effect || getLocalized("LA.mech.mod.effect.tooltip")), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.mod.effect.tooltip"));
          EffectButton($$anchor3, {
            iconStyle: ["cci cci-weaponmod -fontsize7"],
            iconBackgroundStyle: [
              "-fontsize7 la-prmy-secondary",
              qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
            ],
            get flowClass() {
              return FlowClass.SendEffectToChat;
            },
            get path() {
              return $$props.path;
            },
            tooltipEnabled,
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltipDirection() {
              return TooltipDirection.LEFT;
            },
            get tooltip() {
              return get$1(expression);
            },
            get logText() {
              return get$1(expression_1);
            },
            logging: !0,
            onPointerEnter: /* @__PURE__ */ __name(() => {
              set(effectButtonHover, !0);
            }, "onPointerEnter"),
            onPointerLeave: /* @__PURE__ */ __name(() => {
              set(effectButtonHover, !1);
            }, "onPointerLeave")
          });
        }, "headerSecondaryLeftOptions"),
        contentRight: /* @__PURE__ */ __name(($$anchor3) => {
          var fragment_2 = root_3$w(), node_1 = first_child(fragment_2);
          const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.points.tooltip"));
          TotalSP(node_1, {
            get value() {
              return $$props.mod.system.sp;
            },
            style: ["-fontsize4", "-margin1-r -fontface-stylized"],
            get logText() {
              return get$1(expression_2);
            },
            logging: !0
          });
          var node_2 = sibling(node_1, 2);
          const expression_3 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE()]), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
          GlyphButton(node_2, {
            get style() {
              return get$1(expression_3);
            },
            get flowClass() {
              return FlowClass.ContextMenu;
            },
            get path() {
              return $$props.path;
            },
            tooltipEnabled,
            get tooltipDirection() {
              return TooltipDirection.UP;
            },
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltip() {
              return get$1(expression_4);
            },
            get logText() {
              return get$1(expression_5);
            },
            logging: !0,
            onPointerEnter: /* @__PURE__ */ __name(() => {
              set(editButtonHover, !0);
            }, "onPointerEnter"),
            onPointerLeave: /* @__PURE__ */ __name(() => {
              set(editButtonHover, !1);
            }, "onPointerLeave"),
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps) => {
              var i = root_4$c();
              append($$anchor4, i);
            }, "children"),
            $$slots: { default: !0 }
          }), append($$anchor3, fragment_2);
        }, "headerSecondaryRightOptions"),
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var div_2 = root_10$f(), node_8 = child(div_2);
          {
            var consequent_5 = /* @__PURE__ */ __name(($$anchor4) => {
              var div_3 = root_11$h(), node_9 = child(div_3);
              {
                var consequent_3 = /* @__PURE__ */ __name(($$anchor5) => {
                  const expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.mod.range.label")), expression_7 = /* @__PURE__ */ derived(() => $$props.mod.system.added_range.length && $$props.mod.system.added_damage.length ? ["-bordersround"] : []);
                  EffectBox($$anchor5, {
                    get name() {
                      return get$1(expression_6);
                    },
                    innerStyle: ["-fontsize5"],
                    get outerStyle() {
                      return get$1(expression_7);
                    },
                    tooltipEnabled,
                    logging: !0,
                    children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                      RangeArray($$anchor6, {
                        get ranges() {
                          return $$props.mod.system.added_range;
                        }
                      });
                    }, "children"),
                    $$slots: { default: !0 }
                  });
                }, "consequent_3");
                if_block(node_9, ($$render) => {
                  $$props.mod.system.added_range.length && $$render(consequent_3);
                });
              }
              var node_10 = sibling(node_9, 2);
              {
                var consequent_4 = /* @__PURE__ */ __name(($$anchor5) => {
                  const expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.mod.damage.label"));
                  EffectBox($$anchor5, {
                    get name() {
                      return get$1(expression_8);
                    },
                    innerStyle: ["-fontsize5"],
                    tooltipEnabled,
                    logging: !0,
                    children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                      DamageArray($$anchor6, {
                        get damages() {
                          return $$props.mod.system.added_damage;
                        }
                      });
                    }, "children"),
                    $$slots: { default: !0 }
                  });
                }, "consequent_4");
                if_block(node_10, ($$render) => {
                  $$props.mod.system.added_damage.length && $$render(consequent_4);
                });
              }
              append($$anchor4, div_3);
            }, "consequent_5");
            if_block(node_8, ($$render) => {
              ($$props.mod.system.added_range.length || $$props.mod.system.added_damage.length) && $$render(consequent_5);
            });
          }
          var node_11 = sibling(node_8, 2);
          const expression_9 = /* @__PURE__ */ derived(() => `${$$props.path}.system.bonuses`);
          BonusBox(node_11, {
            get bonuses() {
              return $$props.mod.system.bonuses;
            },
            get bonusPath() {
              return get$1(expression_9);
            }
          });
          var node_12 = sibling(node_11, 2);
          {
            var consequent_6 = /* @__PURE__ */ __name(($$anchor4) => {
              const expression_10 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.mod.tags.label"));
              EffectBox($$anchor4, {
                get name() {
                  return get$1(expression_10);
                },
                tooltipEnabled,
                logging: !0,
                children: /* @__PURE__ */ __name(($$anchor5, $$slotProps2) => {
                  var fragment_12 = root_17$7(), node_13 = first_child(fragment_12);
                  TagArray(node_13, {
                    get tags() {
                      return $$props.mod.system.added_tags;
                    },
                    tooltipEnabled,
                    get tooltipTheme() {
                      return get$1(theme);
                    }
                  });
                  var node_14 = sibling(node_13, 2);
                  TagArray(node_14, {
                    get tags() {
                      return $$props.mod.system.tags;
                    },
                    tooltipEnabled,
                    get tooltipTheme() {
                      return get$1(theme);
                    }
                  }), append($$anchor5, fragment_12);
                }, "children"),
                $$slots: { default: !0 }
              });
            }, "consequent_6");
            if_block(node_12, ($$render) => {
              ($$props.mod.system.added_tags.length || $$props.mod.system.tags.length) && $$render(consequent_6);
            });
          }
          var node_15 = sibling(node_12, 2);
          const expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.mod.effect.label"));
          EffectBox(node_15, {
            get name() {
              return get$1(expression_11);
            },
            tooltipEnabled,
            logging: !0,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var fragment_13 = root_18$5(), node_16 = first_child(fragment_13);
              const expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.use.label"));
              FlowButton(node_16, {
                style: ["clipped-bot la-bckg-secondary"],
                get text() {
                  return get$1(expression_12);
                },
                get flowClass() {
                  return FlowClass.SendEffectToChat;
                },
                tooltipEnabled,
                get tooltipTheme() {
                  return get$1(theme);
                },
                logging: !0
              });
              var node_17 = sibling(node_16, 4);
              html(node_17, () => $$props.mod.system.effect), append($$anchor4, fragment_13);
            }, "children"),
            $$slots: { default: !0 }
          });
          var node_18 = sibling(node_15, 2);
          ActionBox(node_18, {
            get actions() {
              return $$props.mod.system.actions;
            },
            get actor() {
              return $$props.actor;
            },
            get uuid() {
              return $$props.mod.uuid;
            },
            path: "system.actions",
            get collapseID() {
              return get$1(collID);
            },
            startCollapsed: !1,
            tooltipEnabled,
            get tooltipTheme() {
              return get$1(theme);
            },
            logging: !0
          }), append($$anchor3, div_2);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent_7"), alternate = /* @__PURE__ */ __name(($$anchor2) => {
      const expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.mod.empty.label")), expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.mod.empty.subLabel"));
      EmptyBox($$anchor2, {
        get label() {
          return get$1(expression_13);
        },
        get subLabel() {
          return get$1(expression_14);
        },
        get type() {
          return AcceptType.MechWeaponMod;
        },
        get path() {
          return $$props.path;
        }
      });
    }, "alternate");
    if_block(node, ($$render) => {
      $$props.mod ? $$render(consequent_7) : $$render(alternate, !1);
    });
  }
  append($$anchor, fragment), pop();
}
__name(WeaponMod, "WeaponMod");
const _STYLE = " la-text-header la-bckg-pilot clipped -flex1 ";
var root_2$g = /* @__PURE__ */ template('<button type="button" data-action="set"><span> </span></button>'), root_1$p = /* @__PURE__ */ template("<div></div>");
function ProfileBox($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, qualityMode = getExtraEffectsEnabled(), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.profile.tooltip"));
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var div = root_1$p();
      each(div, 21, () => $$props.profiles, index, ($$anchor3, profile, index2) => {
        var button = root_2$g();
        set_attribute(button, "data-action-value", `(int)${index2 ?? ""}`);
        var span = child(button), text2 = child(span);
        template_effect(
          ($0) => {
            set_class(button, `la-prmy-primary -height7
            ${(qualityMode ? "-glow-prmy-hover -pulse-glow-prmy" : "") ?? ""}
            gen-control ${(index2 === $$props.weapon.system.selected_profile_index ? "la-prmy-header la-bckg-secondary selected-profile -pointerdisable" : "") ?? ""}`), set_attribute(button, "data-path", $$props.path), set_attribute(button, "aria-label", $0), set_class(span, `-padding1-lr -fontsizemedium -upper
            ${(qualityMode ? "-pulse-glow-prmy" : "") ?? ""}
            ${(index2 === $$props.weapon.system.selected_profile_index ? "la-prmy-header -bold" : "") ?? ""}`), set_text(text2, get$1(profile).name);
          },
          [() => getLocalized("LA.use.label")]
        ), event("pointerenter", button, function(...$$args) {
          var _a2;
          (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
        }), event("pointerleave", button, function(...$$args) {
          var _a2;
          (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
        }), append($$anchor3, button);
      }), template_effect(($0) => set_class(div, `la-limited la-flexrow ${$0 ?? ""}`), [() => {
        var _a2;
        return ((_a2 = $$props.style) == null ? void 0 : _a2.join(" ")) || _STYLE;
      }]), append($$anchor2, div);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.profiles.length > 1 && $$render(consequent);
    });
  }
  append($$anchor, fragment), pop();
}
__name(ProfileBox, "ProfileBox");
var root_1$o = /* @__PURE__ */ template('<div class="la-loading la-hexarray la-flexrow -aligncenter la-text-header -fontsize7"><span class="la-hexarray__span -fontsize4"> </span> <i class="cci cci-system-point"></i></div>');
function SPCostArray($$anchor, $$props) {
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var div = root_1$o(), span = child(div), text2 = child(span);
      template_effect(() => set_text(text2, $$props.cost)), append($$anchor2, div);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.cost && $$render(consequent);
    });
  }
  append($$anchor, fragment);
}
__name(SPCostArray, "SPCostArray");
var root_5$p = /* @__PURE__ */ template('<div class="la-flexrow clipped-alt la-bckg-header-anti -widthfull"><!> <!> <!></div>'), root_3$v = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull -padding2-l -fontface-stylized"><!> <!> <!></div>'), root_8$g = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_9$i = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_7$h = /* @__PURE__ */ template('<!> <div class="la-flexcol -margin3-lr"><!> <!></div>', 1), root_11$g = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!> <!> <!> <!> <!></div>');
function Weapon$1($$anchor, $$props) {
  push($$props, !0);
  let attackButtonHover = state(!1), damageButtonHover = state(!1), messageButtonHover = state(!1), editButtonHover = state(!1);
  const tooltipEnabled = getMechSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function getSlotSize(size) {
    return size === "Flex" ? `${getLocalized(SLOT_LOCALIZE_MAP.Main)} || 2x ${getLocalized(SLOT_LOCALIZE_MAP.Auxiliary)}` : getLocalized(SLOT_LOCALIZE_MAP[size]) || "any";
  }
  __name(getSlotSize, "getSlotSize");
  function isDestroyed(weapon) {
    return weapon.system.destroyed;
  }
  __name(isDestroyed, "isDestroyed");
  function getHeaderStyle(weapon) {
    return isDestroyed(weapon) ? "la-text-repcap -strikethrough" : "la-text-header";
  }
  __name(getHeaderStyle, "getHeaderStyle");
  function getSubtitle(weapon) {
    return isDestroyed(weapon) ? getLocalized("LA.mech.slot.destroyed.label") : weapon.system.size && weapon.system.active_profile.type ? `${weapon.system.size} ${weapon.system.active_profile.type}` : getLocalized("LA.placeholder");
  }
  __name(getSubtitle, "getSubtitle");
  function getSubtitleStyle(weapon) {
    return isDestroyed(weapon) ? `la-text-error la-prmy-error -upper ${photosensitiveStyling("horus--very--subtle")}` : "la-text-header la-prmy-header -upper";
  }
  __name(getSubtitleStyle, "getSubtitleStyle");
  function getIconStyle(weapon) {
    return isDestroyed(weapon) ? "la-text-repcap" : "la-prmy-header la-scdy-primary " + (qualityMode ? "-glow-prmy -glow-scdy-hover " : " ");
  }
  __name(getIconStyle, "getIconStyle");
  function getWeaponPath(index2) {
    return `system.loadout.weapon_mounts.${$$props.mountIndex}.slots.${index2}.weapon.value`;
  }
  __name(getWeaponPath, "getWeaponPath");
  function getModPath(index2) {
    return `system.loadout.weapon_mounts.${$$props.mountIndex}.slots.${index2}.mod.value`;
  }
  __name(getModPath, "getModPath");
  function getActionCollapseID(index2, profileIndex) {
    return profileIndex !== void 0 ? `${$$props.mount.uuid}.action.${index2}.profile.${profileIndex}` : `${$$props.mount.uuid}.action.${index2}`;
  }
  __name(getActionCollapseID, "getActionCollapseID");
  function renderOuter(weapon) {
    return weapon.system.sp || isLoading(weapon) || weapon.isLimited() || weapon.system.mod || weapon.system.profiles.length > 1;
  }
  __name(renderOuter, "renderOuter");
  function getRollWeaponTip(weapon) {
    return formatString(getLocalized("LA.flow.rollAttack.template.tooltip"), weapon.name);
  }
  __name(getRollWeaponTip, "getRollWeaponTip");
  function sendToChat(event2, weapon) {
    var _a;
    if (event2.stopPropagation(), (_a = $$props.actor) != null && _a.uuid && weapon) {
      let range = "";
      weapon.system.active_profile.all_range.map((rng) => {
        range += `<div class="la-flexrow">${rng.val}<i class="cci cci-${rng.type.toLowerCase()} -fontsize6"></i></div>`;
      });
      let damage = "";
      weapon.system.active_profile.all_damage.map((dmg) => {
        damage += `<div class="la-flexrow">${dmg.val}<i class="cci cci-${dmg.type.toLowerCase()} -fontsize6"></i></div>`;
      });
      const description = `
                <div>
                    ${weapon.system.active_profile.description}
                </div>
                <hr>
                <div 
                    class="la-flexrow -justifyevenly clipped-alt -fontsize5 -padding0-tb -padding1-lr"
                    style="
                        background-color: var(--weapon-color);
                        color: var(--light-text);
                        align-items: baseline;
                    "
                >
                    ${range}
                    ${damage}
                </div>
            `;
      let chatData = {
        title: weapon.name,
        description,
        effect: weapon.system.active_profile.effect,
        onAttack: weapon.system.active_profile.on_attack,
        onHit: weapon.system.active_profile.on_hit,
        onCrit: weapon.system.active_profile.on_crit,
        tags: weapon.system.active_profile.tags,
        color: CHAT_CARD_COLOR_MAP[ChatCardType.Weapon]
      };
      SendUnknownToChatBase.getInstance().startFlow($$props.actor.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendToChat, "sendToChat");
  var fragment = comment(), node = first_child(fragment);
  each(node, 17, () => $$props.mount.slots, index, ($$anchor2, slot, index2) => {
    var fragment_1 = comment(), node_1 = first_child(fragment_1);
    {
      var consequent_4 = /* @__PURE__ */ __name(($$anchor3) => {
        const weapon = /* @__PURE__ */ derived(() => get$1(slot).weapon.value), outerContent = /* @__PURE__ */ __name(($$anchor4) => {
          var div = root_3$v(), node_2 = child(div);
          {
            var consequent = /* @__PURE__ */ __name(($$anchor5) => {
              const expression = /* @__PURE__ */ derived(() => `${getModPath(index2)}`);
              WeaponMod($$anchor5, {
                get actor() {
                  return $$props.actor;
                },
                get mod() {
                  return get$1(weapon).system.mod;
                },
                get path() {
                  return get$1(expression);
                }
              });
            }, "consequent");
            if_block(node_2, ($$render) => {
              get$1(slot).size !== "Integrated" && get$1(weapon).system.mod && $$render(consequent);
            });
          }
          var node_3 = sibling(node_2, 2);
          {
            var consequent_1 = /* @__PURE__ */ __name(($$anchor5) => {
              var div_1 = root_5$p(), node_4 = child(div_1);
              const expression_1 = /* @__PURE__ */ derived(() => getWeaponPath(index2));
              LoadedBox(node_4, {
                get item() {
                  return get$1(weapon);
                },
                get path() {
                  return get$1(expression_1);
                },
                logging: !0
              });
              var node_5 = sibling(node_4, 2);
              const expression_2 = /* @__PURE__ */ derived(() => getWeaponPath(index2));
              LimitedBox(node_5, {
                get usesValue() {
                  return get$1(weapon).system.uses.value;
                },
                get usesMax() {
                  return get$1(weapon).system.uses.max;
                },
                get path() {
                  return get$1(expression_2);
                },
                logging: !0
              });
              var node_6 = sibling(node_5, 2);
              SPCostArray(node_6, {
                get cost() {
                  return get$1(weapon).system.sp;
                }
              }), append($$anchor5, div_1);
            }, "consequent_1");
            if_block(node_3, ($$render) => {
              (isLoading(get$1(weapon)) || get$1(weapon).isLimited() || get$1(weapon).system.sp) && $$render(consequent_1);
            });
          }
          var node_7 = sibling(node_3, 2);
          const expression_3 = /* @__PURE__ */ derived(() => `${getWeaponPath(index2)}.system.selected_profile_index`);
          ProfileBox(node_7, {
            get profiles() {
              return get$1(weapon).system.profiles;
            },
            get weapon() {
              return get$1(weapon);
            },
            get path() {
              return get$1(expression_3);
            },
            style: [
              "-widthfull la-bckg-header-anti la-text-header clipped-alt"
            ],
            logging: !0
          }), append($$anchor4, div);
        }, "outerContent"), headerTertiaryLeftOptions = /* @__PURE__ */ __name(($$anchor4) => {
          const expression_4 = /* @__PURE__ */ derived(() => [
            H3_ICON_SIZE,
            getIconStyle(get$1(weapon)),
            "cci cci-weapon"
          ]), expression_5 = /* @__PURE__ */ derived(() => getRollWeaponTip(get$1(weapon))), expression_6 = /* @__PURE__ */ derived(() => getRollWeaponTip(get$1(weapon))), expression_7 = /* @__PURE__ */ derived(() => isDestroyed(get$1(weapon)));
          AttackButton($$anchor4, {
            get iconStyle() {
              return get$1(expression_4);
            },
            iconBackgroundStyle: [
              "la-prmy-secondary",
              H3_ICON_SIZE,
              qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
            ],
            get flowClass() {
              return FlowClass.RollAttack;
            },
            path: `system.loadout.weapon_mounts.${index2}`,
            tooltipEnabled,
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltipDirection() {
              return TooltipDirection.LEFT;
            },
            get tooltip() {
              return get$1(expression_5);
            },
            get logText() {
              return get$1(expression_6);
            },
            logging: !0,
            get disabled() {
              return get$1(expression_7);
            },
            onPointerEnter: /* @__PURE__ */ __name(() => {
              set(attackButtonHover, !0);
            }, "onPointerEnter"),
            onPointerLeave: /* @__PURE__ */ __name(() => {
              set(attackButtonHover, !1);
            }, "onPointerLeave")
          });
        }, "headerTertiaryLeftOptions"), headerTertiaryRightOptions = /* @__PURE__ */ __name(($$anchor4) => {
          var fragment_4 = root_7$h(), node_8 = first_child(fragment_4);
          const expression_8 = /* @__PURE__ */ derived(() => isDestroyed(get$1(weapon)) ? ["la-text-repcap"] : void 0), expression_9 = /* @__PURE__ */ derived(() => isDestroyed(get$1(weapon)));
          DamageButton(node_8, {
            get iconStyle() {
              return get$1(expression_8);
            },
            iconBackgroundStyle: [
              "-fontsize9 la-prmy-secondary",
              qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
            ],
            get flowClass() {
              return FlowClass.RollDamage;
            },
            get range() {
              return get$1(weapon).system.active_profile.all_range;
            },
            get damage() {
              return get$1(weapon).system.active_profile.all_damage;
            },
            tooltipEnabled,
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltipDirection() {
              return TooltipDirection.UP;
            },
            logging: !0,
            get disabled() {
              return get$1(expression_9);
            },
            onPointerEnter: /* @__PURE__ */ __name(() => {
              set(damageButtonHover, !0);
            }, "onPointerEnter"),
            onPointerLeave: /* @__PURE__ */ __name(() => {
              set(damageButtonHover, !1);
            }, "onPointerLeave")
          });
          var div_2 = sibling(node_8, 2), node_9 = child(div_2);
          const expression_10 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE()]), expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip")), expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
          GlyphButton(node_9, {
            get style() {
              return get$1(expression_10);
            },
            get flowClass() {
              return FlowClass.None;
            },
            index: index2,
            get uuid() {
              return get$1(weapon).uuid;
            },
            tooltipEnabled,
            get tooltipDirection() {
              return TooltipDirection.UP;
            },
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltip() {
              return get$1(expression_11);
            },
            get logText() {
              return get$1(expression_12);
            },
            logging: !0,
            onClick: /* @__PURE__ */ __name((event2) => sendToChat(event2, get$1(weapon)), "onClick"),
            onPointerEnter: /* @__PURE__ */ __name(() => {
              set(messageButtonHover, !0);
            }, "onPointerEnter"),
            onPointerLeave: /* @__PURE__ */ __name(() => {
              set(messageButtonHover, !1);
            }, "onPointerLeave"),
            children: /* @__PURE__ */ __name(($$anchor5, $$slotProps) => {
              var i = root_8$g();
              append($$anchor5, i);
            }, "children"),
            $$slots: { default: !0 }
          });
          var node_10 = sibling(node_9, 2);
          const expression_13 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE()]), expression_14 = /* @__PURE__ */ derived(() => getWeaponPath(index2)), expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
          GlyphButton(node_10, {
            get style() {
              return get$1(expression_13);
            },
            get flowClass() {
              return FlowClass.ContextMenu;
            },
            get path() {
              return get$1(expression_14);
            },
            tooltipEnabled,
            get tooltipDirection() {
              return TooltipDirection.UP;
            },
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltip() {
              return get$1(expression_15);
            },
            get logText() {
              return get$1(expression_16);
            },
            logging: !0,
            onPointerEnter: /* @__PURE__ */ __name(() => {
              set(editButtonHover, !0);
            }, "onPointerEnter"),
            onPointerLeave: /* @__PURE__ */ __name(() => {
              set(editButtonHover, !1);
            }, "onPointerLeave"),
            children: /* @__PURE__ */ __name(($$anchor5, $$slotProps) => {
              var i_1 = root_9$i();
              append($$anchor5, i_1);
            }, "children"),
            $$slots: { default: !0 }
          }), append($$anchor4, fragment_4);
        }, "headerTertiaryRightOptions"), expression_17 = /* @__PURE__ */ derived(() => getWeaponPath(index2)), expression_18 = /* @__PURE__ */ derived(() => [
          getHeaderStyle(get$1(weapon)),
          H2_TEXT_SIZE,
          "-fontface-stylized"
        ]), expression_19 = /* @__PURE__ */ derived(() => getSubtitle(get$1(weapon))), expression_20 = /* @__PURE__ */ derived(() => [
          getSubtitleStyle(get$1(weapon)),
          "-fontsizesmall -fontface-stylized"
        ]), expression_21 = /* @__PURE__ */ derived(() => renderOuter(get$1(weapon)) ? outerContent : void 0);
        HeaderTertiary($$anchor3, {
          get itemID() {
            return get$1(weapon).id;
          },
          get uuid() {
            return get$1(weapon).uuid;
          },
          get path() {
            return get$1(expression_17);
          },
          acceptTypes: "mech_weapon",
          get collapseID() {
            return get$1(weapon).uuid;
          },
          startCollapsed: !0,
          get text() {
            return get$1(weapon).name;
          },
          headerStyle: [H3_HEADER_STYLE, "la-bckg-pilot"],
          get headerFontStyle() {
            return get$1(expression_18);
          },
          get subText() {
            return get$1(expression_19);
          },
          get subHeaderFontStyle() {
            return get$1(expression_20);
          },
          borderStyle: ["-bordersoff"],
          extensionTextFunction: /* @__PURE__ */ __name(() => {
            if (get$1(attackButtonHover)) return `--${getLocalized("LA.flow.rollAttack.extension")}`;
            if (get$1(damageButtonHover)) return `--${getLocalized("LA.flow.rollDamage.extension")}`;
            if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
            if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
          }, "extensionTextFunction"),
          get renderOutsideCollapse() {
            return get$1(expression_21);
          },
          contentLeft: headerTertiaryLeftOptions,
          contentRight: headerTertiaryRightOptions,
          children: /* @__PURE__ */ __name(($$anchor4, $$slotProps) => {
            var fragment_6 = comment(), node_11 = first_child(fragment_6);
            {
              var consequent_3 = /* @__PURE__ */ __name(($$anchor5) => {
                var div_3 = root_11$g();
                const profile = /* @__PURE__ */ derived(() => get$1(weapon).system.active_profile);
                var node_12 = child(div_3);
                const expression_22 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.effect.label"));
                EffectBox(node_12, {
                  get name() {
                    return get$1(expression_22);
                  },
                  get effect() {
                    return get$1(profile).effect;
                  },
                  tooltipEnabled,
                  logging: !0
                });
                var node_13 = sibling(node_12, 2);
                const expression_23 = /* @__PURE__ */ derived(() => getLocalized("LA.effect.attack.label"));
                EffectBox(node_13, {
                  get name() {
                    return get$1(expression_23);
                  },
                  get effect() {
                    return get$1(profile).on_attack;
                  },
                  tooltipEnabled,
                  logging: !0
                });
                var node_14 = sibling(node_13, 2);
                const expression_24 = /* @__PURE__ */ derived(() => getLocalized("LA.effect.hit.label"));
                EffectBox(node_14, {
                  get name() {
                    return get$1(expression_24);
                  },
                  get effect() {
                    return get$1(profile).on_hit;
                  },
                  tooltipEnabled,
                  logging: !0
                });
                var node_15 = sibling(node_14, 2);
                const expression_25 = /* @__PURE__ */ derived(() => getLocalized("LA.effect.crit.label"));
                EffectBox(node_15, {
                  get name() {
                    return get$1(expression_25);
                  },
                  get effect() {
                    return get$1(profile).on_crit;
                  },
                  tooltipEnabled,
                  logging: !0
                });
                var node_16 = sibling(node_15, 2);
                const expression_26 = /* @__PURE__ */ derived(() => getActionCollapseID(index2));
                ActionBox(node_16, {
                  get actions() {
                    return get$1(weapon).system.actions;
                  },
                  get actor() {
                    return $$props.actor;
                  },
                  get uuid() {
                    return get$1(weapon).uuid;
                  },
                  path: "system.actions",
                  get collapseID() {
                    return get$1(expression_26);
                  },
                  startCollapsed: !1,
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  logging: !0
                });
                var node_17 = sibling(node_16, 2);
                const expression_27 = /* @__PURE__ */ derived(() => getActionCollapseID(index2, get$1(weapon).system.selected_profile_index));
                ActionBox(node_17, {
                  get actions() {
                    return get$1(profile).actions;
                  },
                  get actor() {
                    return $$props.actor;
                  },
                  get uuid() {
                    return get$1(weapon).uuid;
                  },
                  path: "system.active_profile.actions",
                  get collapseID() {
                    return get$1(expression_27);
                  },
                  startCollapsed: !1,
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  logging: !0
                });
                var node_18 = sibling(node_17, 2);
                {
                  var consequent_2 = /* @__PURE__ */ __name(($$anchor6) => {
                    const expression_28 = /* @__PURE__ */ derived(() => `${getModPath(index2)}`);
                    WeaponMod($$anchor6, {
                      get actor() {
                        return $$props.actor;
                      },
                      get mod() {
                        return get$1(weapon).system.mod;
                      },
                      get path() {
                        return get$1(expression_28);
                      }
                    });
                  }, "consequent_2");
                  if_block(node_18, ($$render) => {
                    get$1(slot).size !== "Integrated" && !get$1(weapon).system.mod && $$render(consequent_2);
                  });
                }
                var node_19 = sibling(node_18, 2);
                TagArray(node_19, {
                  get tags() {
                    return get$1(profile).all_tags;
                  },
                  justify: "start",
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  }
                }), append($$anchor5, div_3);
              }, "consequent_3");
              if_block(node_11, ($$render) => {
                get$1(weapon).system.destroyed || $$render(consequent_3);
              });
            }
            append($$anchor4, fragment_6);
          }, "children"),
          $$slots: { default: !0 }
        });
      }, "consequent_4"), alternate_1 = /* @__PURE__ */ __name(($$anchor3) => {
        var fragment_8 = comment(), node_20 = first_child(fragment_8);
        {
          var consequent_5 = /* @__PURE__ */ __name(($$anchor4) => {
          }, "consequent_5"), alternate = /* @__PURE__ */ __name(($$anchor4) => {
            const expression_29 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.mount.empty.label")), expression_30 = /* @__PURE__ */ derived(() => getSlotSize($$props.mount.slots[0].size)), expression_31 = /* @__PURE__ */ derived(() => getWeaponPath(index2));
            EmptyBox($$anchor4, {
              get label() {
                return get$1(expression_29);
              },
              get subLabel() {
                return get$1(expression_30);
              },
              get type() {
                return AcceptType.MechWeapon;
              },
              get path() {
                return get$1(expression_31);
              }
            });
          }, "alternate");
          if_block(node_20, ($$render) => {
            var _a;
            index2 === 1 && $$props.mount.slots[0].size === "Flex" && ((_a = $$props.mount.slots[0].weapon) == null ? void 0 : _a.value.system.size) !== "Auxiliary" ? $$render(consequent_5) : $$render(alternate, !1);
          });
        }
        append($$anchor3, fragment_8);
      }, "alternate_1");
      if_block(node_1, ($$render) => {
        var _a;
        (_a = get$1(slot).weapon) != null && _a.value ? $$render(consequent_4) : $$render(alternate_1, !1);
      });
    }
    append($$anchor2, fragment_1);
  }), append($$anchor, fragment), pop();
}
__name(Weapon$1, "Weapon$1");
var root_2$f = /* @__PURE__ */ template("<span> </span>"), root_1$n = /* @__PURE__ */ template('<div role="none"></div>');
function MountNames($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.flow.rollAttack.tooltip"));
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var div = root_1$n();
      each(div, 21, () => $$props.mountNames, index, ($$anchor3, mountName) => {
        var span = root_2$f(), text2 = child(span);
        template_effect(
          ($0) => {
            set_class(span, `-widthfull -textalignright ${$0 ?? ""}`), set_text(text2, get$1(mountName));
          },
          [() => {
            var _a2;
            return (_a2 = $$props.textStyle) == null ? void 0 : _a2.join(" ");
          }]
        ), append($$anchor3, span);
      }), template_effect(($0) => set_class(div, `la-flexcol la-text-header -gap0 -aligncenter -fontsizesmall -height5 -lineheight2 ${$0 ?? ""}`), [() => {
        var _a2;
        return (_a2 = $$props.style) == null ? void 0 : _a2.join(" ");
      }]), event("pointerenter", div, function(...$$args) {
        var _a2;
        (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), event("pointerleave", div, function(...$$args) {
        var _a2;
        (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), append($$anchor2, div);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.mountNames.length && $$render(consequent);
    });
  }
  append($$anchor, fragment), pop();
}
__name(MountNames, "MountNames");
var root_3$u = /* @__PURE__ */ template("<!> <!>", 1), root_6$r = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"><!></div>');
function Mounts($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), system = /* @__PURE__ */ derived(() => props.system);
  let collapseAllButtonHover = state(!1);
  const tooltipEnabled = getMechSheetTooltipEnabled(), weaponMounts = /* @__PURE__ */ derived(() => get$1(system).loadout.weapon_mounts), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  function getCollapseID(index2) {
    return `${get$1(actor).uuid}.mount.${index2}`;
  }
  __name(getCollapseID, "getCollapseID");
  function aggregateMountWeaponNames(mount2) {
    return mount2.slots.map((slot) => {
      var _a, _b;
      return (_b = (_a = slot.weapon) == null ? void 0 : _a.value) == null ? void 0 : _b.name;
    }).filter((name) => name !== void 0);
  }
  __name(aggregateMountWeaponNames, "aggregateMountWeaponNames");
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_1 = comment(), node_1 = first_child(fragment_1);
      each(node_1, 17, () => get$1(weaponMounts), index, ($$anchor3, mount2, index2) => {
        const headerOptions = /* @__PURE__ */ __name(($$anchor4) => {
          var fragment_2 = root_3$u(), node_2 = first_child(fragment_2);
          const expression = /* @__PURE__ */ derived(() => aggregateMountWeaponNames(get$1(mount2))), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.mount.preview.tooltip"));
          MountNames(node_2, {
            get mountNames() {
              return get$1(expression);
            },
            get logText() {
              return get$1(expression_1);
            },
            logging: !0
          });
          var node_3 = sibling(node_2, 2);
          const expression_2 = /* @__PURE__ */ derived(() => getCollapseID(index2));
          CollapseAllButton(node_3, {
            get collapseID() {
              return get$1(expression_2);
            },
            tooltipEnabled,
            get tooltipTheme() {
              return get$1(theme);
            },
            logging: !0,
            onPointerEnter: /* @__PURE__ */ __name(() => {
              set(collapseAllButtonHover, !0);
            }, "onPointerEnter"),
            onPointerLeave: /* @__PURE__ */ __name(() => {
              set(collapseAllButtonHover, !1);
            }, "onPointerLeave")
          }), append($$anchor4, fragment_2);
        }, "headerOptions"), expression_3 = /* @__PURE__ */ derived(() => getLocalized(MOUNT_LOCALIZE_MAP[get$1(mount2).type])), expression_4 = /* @__PURE__ */ derived(() => getCollapseID(index2));
        HeaderMain($$anchor3, {
          get text() {
            return get$1(expression_3);
          },
          headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
          textStyle: ["la-text-header -fontsize4 -overflowhidden"],
          borderStyle: ["la-brdr-primary"],
          extensionTextFunction: /* @__PURE__ */ __name(() => {
            if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
          }, "extensionTextFunction"),
          get collapseID() {
            return get$1(expression_4);
          },
          startCollapsed: !0,
          headerContent: headerOptions,
          children: /* @__PURE__ */ __name(($$anchor4, $$slotProps) => {
            var fragment_4 = comment(), node_4 = first_child(fragment_4);
            {
              var consequent = /* @__PURE__ */ __name(($$anchor5) => {
                const expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.mount.locked.label")), expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.mount.locked.subLabel"));
                EmptyBox($$anchor5, {
                  get label() {
                    return get$1(expression_5);
                  },
                  get subLabel() {
                    return get$1(expression_6);
                  }
                });
              }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor5) => {
                var div = root_6$r(), node_5 = child(div);
                Weapon$1(node_5, {
                  get actor() {
                    return get$1(actor);
                  },
                  get mount() {
                    return get$1(mount2);
                  },
                  mountIndex: index2
                }), append($$anchor5, div);
              }, "alternate");
              if_block(node_4, ($$render) => {
                get$1(mount2).bracing ? $$render(consequent) : $$render(alternate, !1);
              });
            }
            append($$anchor4, fragment_4);
          }, "children"),
          $$slots: { default: !0 }
        });
      }), append($$anchor2, fragment_1);
    }, "consequent_1");
    if_block(node, ($$render) => {
      get$1(system).loadout.frame && get$1(weaponMounts).length && $$render(consequent_1);
    });
  }
  append($$anchor, fragment), pop();
}
__name(Mounts, "Mounts");
var root_6$q = /* @__PURE__ */ template('<div class="la-flexrow clipped-bot-alt la-text-header la-bckg-header-anti -widthfull -padding2-l -fontface-stylized"></div>'), root_8$f = /* @__PURE__ */ template("<i></i>"), root_10$e = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_11$f = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_9$h = /* @__PURE__ */ template("<!> <!>", 1), root_12$c = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!></div>'), root_3$t = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>');
function CoreBonus($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      get tooltipEnabled() {
        return get$1(tooltipEnabled);
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get logging() {
        return get$1(isMechSheet);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let collapseAllButtonHover = state(!1), messageButtonHover = state(!1), editButtonHover = state(!1);
  const isMechSheet = /* @__PURE__ */ derived(() => {
    var _a;
    return ((_a = $$props.sheetActor) == null ? void 0 : _a.type) === "mech" || !1;
  }), tooltipEnabled = /* @__PURE__ */ derived(() => get$1(isMechSheet) ? getMechSheetTooltipEnabled() : getPilotSheetTooltipEnabled()), coreBonuses = /* @__PURE__ */ derived(() => $$props.actor.itemTypes.core_bonus), collID = /* @__PURE__ */ derived(() => `${$$props.sheetActor.uuid}.coreBonus`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.sheetActor.uuid));
  onMount(() => {
    get$1(isMechSheet) && trackHook(
      $$props.sheetActor.uuid,
      Hooks.on("updateItem", (item, _caller, _options) => {
        item.type !== "core_bonus" || item.parent.uuid !== $$props.actor.uuid || Hooks.call("laForceRerender", $$props.sheetActor.uuid);
      }),
      "updateItem"
    );
  });
  function getActionCollID(index2) {
    return `${get$1(collID)}.${index2}.action`;
  }
  __name(getActionCollID, "getActionCollID");
  function sendToChat(event2, action2) {
    var _a;
    if (event2.stopPropagation(), (_a = $$props.actor) != null && _a.uuid && action2) {
      let chatData = {
        title: action2.name,
        trigger: action2.trigger,
        effect: action2.detail
      };
      SendUnknownToChatBase.getInstance().startFlow($$props.actor.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendToChat, "sendToChat");
  function getCoreBonusPath(index2) {
    return get$1(isMechSheet) ? `system.pilot.value.itemTypes.core_bonus.${index2}` : `itemTypes.core_bonus.${index2}`;
  }
  __name(getCoreBonusPath, "getCoreBonusPath");
  var fragment_1 = comment(), node = first_child(fragment_1);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.coreBonus.label"));
      HeaderMain($$anchor2, {
        get text() {
          return get$1(expression);
        },
        headerStyle: [MAIN_HEADER_STYLE, "la-bckg-action--downtime"],
        textStyle: ["la-text-header -fontsize4 -overflowhidden"],
        borderStyle: ["la-brdr-action--downtime"],
        extensionTextFunction: /* @__PURE__ */ __name(() => {
          if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
        }, "extensionTextFunction"),
        get collapseID() {
          return get$1(collID);
        },
        startCollapsed: !0,
        headerContent: headerOptions,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var div = root_3$t();
          each(div, 21, () => get$1(coreBonuses), index, ($$anchor4, coreBonus, index$1) => {
            const outerContent = /* @__PURE__ */ __name(($$anchor5) => {
              var fragment_3 = comment(), node_1 = first_child(fragment_3);
              {
                var consequent = /* @__PURE__ */ __name(($$anchor6) => {
                  var div_1 = root_6$q();
                  each(div_1, 21, () => get$1(coreBonus).system.counters, index, ($$anchor7, counter, jndex) => {
                    const expression_1 = /* @__PURE__ */ derived(() => get$1(isMechSheet) ? `system.pilot.value.itemTypes.core_bonus.${index$1}.system.counters.${jndex}` : `itemTypes.core_bonus.${index$1}.system.counters.${jndex}`);
                    CounterBox($$anchor7, {
                      get text() {
                        return get$1(counter).name;
                      },
                      get type() {
                        return CounterBoxType.Counter;
                      },
                      get usesValue() {
                        return get$1(counter).value;
                      },
                      get usesMax() {
                        return get$1(counter).max;
                      },
                      get path() {
                        return get$1(expression_1);
                      },
                      style: [
                        "clipped-bot-alt -widthfull la-bckg-header-anti"
                      ],
                      logging: !0
                    });
                  }), append($$anchor6, div_1);
                }, "consequent");
                if_block(node_1, ($$render) => {
                  get$1(coreBonus).system.counters.length && $$render(consequent);
                });
              }
              append($$anchor5, fragment_3);
            }, "outerContent"), headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor5) => {
              var i = root_8$f();
              set_class(i, `${H2_ICON_SIZE} cci cci-corebonus`), append($$anchor5, i);
            }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor5) => {
              var fragment_5 = root_9$h(), node_2 = first_child(fragment_5);
              const expression_2 = /* @__PURE__ */ derived(() => [
                H2_BUTTON_ICON_STYLE(),
                "-padding0-lr la-flexcol"
              ]), expression_3 = /* @__PURE__ */ derived(() => getCoreBonusPath(index$1)), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
              GlyphButton(node_2, {
                get style() {
                  return get$1(expression_2);
                },
                get flowClass() {
                  return FlowClass.ContextMenu;
                },
                get path() {
                  return get$1(expression_3);
                },
                get tooltipEnabled() {
                  return get$1(tooltipEnabled);
                },
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_4);
                },
                get logText() {
                  return get$1(expression_5);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i_1 = root_10$e();
                  append($$anchor6, i_1);
                }, "children"),
                $$slots: { default: !0 }
              });
              var node_3 = sibling(node_2, 2);
              const expression_6 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip")), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
              GlyphButton(node_3, {
                get style() {
                  return get$1(expression_6);
                },
                get flowClass() {
                  return FlowClass.SendToChat;
                },
                index: index$1,
                get uuid() {
                  return get$1(coreBonus).uuid;
                },
                get tooltipEnabled() {
                  return get$1(tooltipEnabled);
                },
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_7);
                },
                get logText() {
                  return get$1(expression_8);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i_2 = root_11$f();
                  append($$anchor6, i_2);
                }, "children"),
                $$slots: { default: !0 }
              }), append($$anchor5, fragment_5);
            }, "headerSecondaryRightOptions"), expression_9 = /* @__PURE__ */ derived(() => get$1(isMechSheet) ? `system.pilot.value.itemTypes.core_bonus.${index$1}` : `itemTypes.core_bonus.${index$1}`), expression_10 = /* @__PURE__ */ derived(() => `${get$1(collID)}.${index$1}`);
            HeaderSecondary($$anchor4, {
              get text() {
                return get$1(coreBonus).name;
              },
              headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
              textStyle: [
                H2_TEXT_SIZE,
                "-overflowhidden -fontface-stylized"
              ],
              borderStyle: ["-bordersoff"],
              extensionTextFunction: /* @__PURE__ */ __name(() => {
                if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
                if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
              }, "extensionTextFunction"),
              rootStyle: ["ref set"],
              get uuid() {
                return get$1(coreBonus).uuid;
              },
              get path() {
                return get$1(expression_9);
              },
              get collapseID() {
                return get$1(expression_10);
              },
              startCollapsed: !0,
              renderOutsideCollapse: outerContent,
              contentLeft: headerSecondaryLeftOptions2,
              contentRight: headerSecondaryRightOptions,
              children: /* @__PURE__ */ __name(($$anchor5, $$slotProps2) => {
                var div_2 = root_12$c(), node_4 = child(div_2);
                BonusBox(node_4, {
                  get bonuses() {
                    return get$1(coreBonus).system.bonuses;
                  },
                  bonusPath: `itemTypes.core_bonus.${index$1}.system.bonuses`
                });
                var node_5 = sibling(node_4, 2);
                const expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.effect.label"));
                EffectBox(node_5, {
                  get name() {
                    return get$1(expression_11);
                  },
                  get effect() {
                    return get$1(coreBonus).system.effect;
                  },
                  get tooltipEnabled() {
                    return get$1(tooltipEnabled);
                  },
                  logging: !0
                });
                var node_6 = sibling(node_5, 2);
                const expression_12 = /* @__PURE__ */ derived(() => get$1(isMechSheet) ? `system.pilot.value.itemTypes.core_bonus.${index$1}.system.actions` : `itemTypes.core_bonus.${index$1}.system.actions`), expression_13 = /* @__PURE__ */ derived(() => getActionCollID(index$1));
                ActionBox(node_6, {
                  get actions() {
                    return get$1(coreBonus).system.actions;
                  },
                  get actor() {
                    return $$props.actor;
                  },
                  get uuid() {
                    return get$1(coreBonus).uuid;
                  },
                  get path() {
                    return get$1(expression_12);
                  },
                  get collapseID() {
                    return get$1(expression_13);
                  },
                  startCollapsed: !1,
                  onClick: sendToChat,
                  get tooltipEnabled() {
                    return get$1(tooltipEnabled);
                  },
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  logging: !0
                });
                var node_7 = sibling(node_6, 2);
                const expression_14 = /* @__PURE__ */ derived(() => {
                  var _a;
                  return (_a = $$props.sheetActor) == null ? void 0 : _a.uuid;
                });
                DeployableBox(node_7, {
                  get source() {
                    return $$props.actor;
                  },
                  get lidSource() {
                    return get$1(coreBonus).system;
                  },
                  get uuid() {
                    return $$props.actor.uuid;
                  },
                  get sheetUUID() {
                    return get$1(expression_14);
                  },
                  get tooltipEnabled() {
                    return get$1(tooltipEnabled);
                  },
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  logging: !0
                }), append($$anchor5, div_2);
              }, "children"),
              $$slots: { default: !0 }
            });
          }), append($$anchor3, div);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent_1");
    if_block(node, ($$render) => {
      get$1(coreBonuses).length && $$render(consequent_1);
    });
  }
  append($$anchor, fragment_1), pop();
}
__name(CoreBonus, "CoreBonus");
var root_5$o = /* @__PURE__ */ template("<i></i>"), root_7$g = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_6$p = /* @__PURE__ */ template("<!> <!>", 1), root_12$b = /* @__PURE__ */ template("<div></div>"), root_14$7 = /* @__PURE__ */ template("<i></i>"), root_16$6 = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_17$6 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!></div>'), root_8$e = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>'), root_3$s = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>');
function Talents($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      get tooltipEnabled() {
        return get$1(tooltipEnabled);
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get logging() {
        return get$1(isMechSheet);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHoverTalent, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHoverTalent, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let collapseAllButtonHoverTalent = state(!1), collapseAllButtonHoverRank = state(!1), messageButtonHover = state(!1), editButtonHover = state(!1);
  const isMechSheet = /* @__PURE__ */ derived(() => {
    var _a;
    return ((_a = $$props.sheetActor) == null ? void 0 : _a.type) === "mech" || !1;
  }), tooltipEnabled = /* @__PURE__ */ derived(() => get$1(isMechSheet) ? getMechSheetTooltipEnabled() : getPilotSheetTooltipEnabled()), talents = /* @__PURE__ */ derived(() => $$props.actor.itemTypes.talent), collID = /* @__PURE__ */ derived(() => `${$$props.sheetActor.uuid}.talents`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.sheetActor.uuid));
  onMount(() => {
    get$1(isMechSheet) && trackHook(
      $$props.sheetActor.uuid,
      Hooks.on("updateItem", (item, _caller, _options) => {
        item.type !== "talent" || item.parent.uuid !== $$props.actor.uuid || Hooks.call("laForceRerender", $$props.sheetActor.uuid);
      }),
      "updateItem"
    );
  });
  function getTalentCollID(talentIndex) {
    return `${get$1(collID)}.${talentIndex}`;
  }
  __name(getTalentCollID, "getTalentCollID");
  function getRankCollID(talentIndex, rankIndex) {
    return `${get$1(collID)}.${talentIndex}.ranks.${rankIndex}`;
  }
  __name(getRankCollID, "getRankCollID");
  function getActionCollID(talentIndex, rankIndex) {
    return `${get$1(collID)}.${talentIndex}.ranks.${rankIndex}.action`;
  }
  __name(getActionCollID, "getActionCollID");
  function getTalentPath(index2) {
    return get$1(isMechSheet) ? `system.pilot.value.itemTypes.talent.${index2}` : `itemTypes.talent.${index2}`;
  }
  __name(getTalentPath, "getTalentPath");
  var fragment_1 = comment(), node = first_child(fragment_1);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.talent.label"));
      HeaderMain($$anchor2, {
        get text() {
          return get$1(expression);
        },
        headerStyle: [MAIN_HEADER_STYLE, "la-bckg-action--downtime"],
        textStyle: ["la-text-header -fontsize4 -overflowhidden"],
        borderStyle: ["la-brdr-action--downtime"],
        extensionTextFunction: /* @__PURE__ */ __name(() => {
          if (get$1(collapseAllButtonHoverTalent)) return `--${getLocalized("LA.collapseAll.extension")}`;
        }, "extensionTextFunction"),
        get collapseID() {
          return get$1(collID);
        },
        startCollapsed: !0,
        headerContent: headerOptions,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var div = root_3$s();
          each(div, 21, () => get$1(talents), index, ($$anchor4, talent, index$1) => {
            const headerSecondaryTalentLeftOptions = /* @__PURE__ */ __name(($$anchor5) => {
              var i = root_5$o();
              set_class(i, `${H2_ICON_SIZE} cci cci-compendium`), append($$anchor5, i);
            }, "headerSecondaryTalentLeftOptions"), headerSecondaryTalentRightOptions = /* @__PURE__ */ __name(($$anchor5) => {
              var fragment_3 = root_6$p(), node_1 = first_child(fragment_3);
              const expression_1 = /* @__PURE__ */ derived(() => [
                H2_BUTTON_ICON_STYLE(),
                "-padding0-lr la-flexrow -margin0-lr"
              ]), expression_2 = /* @__PURE__ */ derived(() => getTalentPath(index$1)), expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
              GlyphButton(node_1, {
                get style() {
                  return get$1(expression_1);
                },
                get flowClass() {
                  return FlowClass.ContextMenu;
                },
                get path() {
                  return get$1(expression_2);
                },
                get tooltipEnabled() {
                  return get$1(tooltipEnabled);
                },
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_3);
                },
                get logText() {
                  return get$1(expression_4);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i_1 = root_7$g();
                  append($$anchor6, i_1);
                }, "children"),
                $$slots: { default: !0 }
              });
              var node_2 = sibling(node_1, 2);
              const expression_5 = /* @__PURE__ */ derived(() => getTalentCollID(index$1));
              CollapseAllButton(node_2, {
                get collapseID() {
                  return get$1(expression_5);
                },
                get tooltipEnabled() {
                  return get$1(tooltipEnabled);
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(collapseAllButtonHoverRank, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(collapseAllButtonHoverRank, !1);
                }, "onPointerLeave")
              }), append($$anchor5, fragment_3);
            }, "headerSecondaryTalentRightOptions"), expression_6 = /* @__PURE__ */ derived(() => `${get$1(talent).name} ${get$1(talent).system.curr_rank}`), expression_7 = /* @__PURE__ */ derived(() => get$1(isMechSheet) ? `system.pilot.value.itemTypes.talent.${index$1}` : `itemTypes.talent.${index$1}`), expression_8 = /* @__PURE__ */ derived(() => getTalentCollID(index$1));
            HeaderSecondary($$anchor4, {
              get text() {
                return get$1(expression_6);
              },
              headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
              textStyle: [
                H2_TEXT_SIZE,
                "-overflowhidden -fontface-stylized"
              ],
              borderStyle: ["-bordersoff"],
              extensionTextFunction: /* @__PURE__ */ __name(() => {
                if (get$1(collapseAllButtonHoverRank)) return `--${getLocalized("LA.collapseAll.extension")}`;
                if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
              }, "extensionTextFunction"),
              rootStyle: ["ref set lancer-talent submajor"],
              get uuid() {
                return get$1(talent).uuid;
              },
              get path() {
                return get$1(expression_7);
              },
              get collapseID() {
                return get$1(expression_8);
              },
              startCollapsed: !0,
              contentLeft: headerSecondaryTalentLeftOptions,
              contentRight: headerSecondaryTalentRightOptions,
              children: /* @__PURE__ */ __name(($$anchor5, $$slotProps2) => {
                var div_1 = root_8$e();
                each(div_1, 21, () => get$1(talent).system.ranks, index, ($$anchor6, rank, jndex) => {
                  var fragment_5 = comment(), node_3 = first_child(fragment_5);
                  {
                    var consequent_1 = /* @__PURE__ */ __name(($$anchor7) => {
                      const outerContent = /* @__PURE__ */ __name(($$anchor8) => {
                        var fragment_6 = comment(), node_4 = first_child(fragment_6);
                        {
                          var consequent = /* @__PURE__ */ __name(($$anchor9) => {
                            var div_2 = root_12$b();
                            each(div_2, 21, () => get$1(rank).counters, index, ($$anchor10, counter, kndex) => {
                              const expression_9 = /* @__PURE__ */ derived(() => get$1(isMechSheet) ? `system.pilot.value.itemTypes.talent.${index$1}.system.ranks.${jndex}.counters.${kndex}` : `itemTypes.talent.${index$1}.system.ranks.${jndex}.counters.${kndex}`);
                              CounterBox($$anchor10, {
                                get text() {
                                  return get$1(counter).name;
                                },
                                get type() {
                                  return CounterBoxType.Counter;
                                },
                                get usesValue() {
                                  return get$1(counter).value;
                                },
                                get usesMax() {
                                  return get$1(counter).max;
                                },
                                get path() {
                                  return get$1(expression_9);
                                },
                                style: [
                                  "clipped-bot-alt -widthfull la-bckg-header-anti"
                                ],
                                logging: !0
                              });
                            }), template_effect(
                              ($0) => set_class(div_2, `la-flexcol -widthfull -padding2-l -fontface-stylized
                        ${$0 ?? ""}`),
                              [
                                () => getCollapseState(getRankCollID(index$1, jndex)) ? "la-brdr-transparent -borders-l" : "la-brdr-trait -borders-l -collapse-fade-out"
                              ]
                            ), append($$anchor9, div_2);
                          }, "consequent");
                          if_block(node_4, ($$render) => {
                            get$1(rank).counters.length && $$render(consequent);
                          });
                        }
                        append($$anchor8, fragment_6);
                      }, "outerContent"), headerSecondaryRankLeftOptions = /* @__PURE__ */ __name(($$anchor8) => {
                        var i_2 = root_14$7();
                        set_class(i_2, `${H2_ICON_SIZE} cci cci-talent`), append($$anchor8, i_2);
                      }, "headerSecondaryRankLeftOptions"), headerSecondaryRankRightOptions = /* @__PURE__ */ __name(($$anchor8) => {
                        const expression_10 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip")), expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
                        GlyphButton($$anchor8, {
                          get style() {
                            return get$1(expression_10);
                          },
                          get flowClass() {
                            return FlowClass.SendToChat;
                          },
                          rank: jndex,
                          get uuid() {
                            return get$1(talent).uuid;
                          },
                          get tooltipEnabled() {
                            return get$1(tooltipEnabled);
                          },
                          get tooltipDirection() {
                            return TooltipDirection.UP;
                          },
                          get tooltipTheme() {
                            return get$1(theme);
                          },
                          get tooltip() {
                            return get$1(expression_11);
                          },
                          get logText() {
                            return get$1(expression_12);
                          },
                          logging: !0,
                          onPointerEnter: /* @__PURE__ */ __name(() => {
                            set(messageButtonHover, !0);
                          }, "onPointerEnter"),
                          onPointerLeave: /* @__PURE__ */ __name(() => {
                            set(messageButtonHover, !1);
                          }, "onPointerLeave"),
                          children: /* @__PURE__ */ __name(($$anchor9, $$slotProps3) => {
                            var i_3 = root_16$6();
                            append($$anchor9, i_3);
                          }, "children"),
                          $$slots: { default: !0 }
                        });
                      }, "headerSecondaryRankRightOptions"), expression_13 = /* @__PURE__ */ derived(() => getRankCollID(index$1, jndex));
                      HeaderSecondary($$anchor7, {
                        get text() {
                          return get$1(rank).name;
                        },
                        headerStyle: [H2_HEADER_STYLE, "la-bckg-header-anti"],
                        textStyle: [
                          H2_TEXT_SIZE,
                          "-overflowhidden -fontface-stylized"
                        ],
                        borderStyle: ["la-brdr-trait"],
                        extensionTextFunction: /* @__PURE__ */ __name(() => {
                          if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
                        }, "extensionTextFunction"),
                        rootStyle: ["ref set"],
                        get uuid() {
                          return get$1(talent).uuid;
                        },
                        get collapseID() {
                          return get$1(expression_13);
                        },
                        startCollapsed: !1,
                        renderOutsideCollapse: outerContent,
                        contentLeft: headerSecondaryRankLeftOptions,
                        contentRight: headerSecondaryRankRightOptions,
                        children: /* @__PURE__ */ __name(($$anchor8, $$slotProps3) => {
                          var div_3 = root_17$6(), node_5 = child(div_3);
                          const expression_14 = /* @__PURE__ */ derived(() => get$1(isMechSheet) ? `system.pilot.value.itemTypes.talent.${index$1}.system.ranks.${jndex}.bonuses` : `itemTypes.talent.${index$1}.system.ranks.${jndex}.bonuses`);
                          BonusBox(node_5, {
                            get bonuses() {
                              return get$1(rank).bonuses;
                            },
                            get bonusPath() {
                              return get$1(expression_14);
                            }
                          });
                          var node_6 = sibling(node_5, 2);
                          const expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.trait.label"));
                          EffectBox(node_6, {
                            get name() {
                              return get$1(expression_15);
                            },
                            get effect() {
                              return get$1(rank).description;
                            },
                            get tooltipEnabled() {
                              return get$1(tooltipEnabled);
                            },
                            logging: !0
                          });
                          var node_7 = sibling(node_6, 2);
                          const expression_16 = /* @__PURE__ */ derived(() => getActionCollID(index$1, jndex));
                          ActionBox(node_7, {
                            get actions() {
                              return get$1(rank).actions;
                            },
                            get actor() {
                              return $$props.sheetActor;
                            },
                            get uuid() {
                              return get$1(talent).uuid;
                            },
                            path: `system.ranks.${jndex}.actions`,
                            get collapseID() {
                              return get$1(expression_16);
                            },
                            startCollapsed: !1,
                            get tooltipEnabled() {
                              return get$1(tooltipEnabled);
                            },
                            get tooltipTheme() {
                              return get$1(theme);
                            },
                            logging: !0
                          }), append($$anchor8, div_3);
                        }, "children"),
                        $$slots: { default: !0 }
                      });
                    }, "consequent_1");
                    if_block(node_3, ($$render) => {
                      jndex < get$1(talent).system.curr_rank && $$render(consequent_1);
                    });
                  }
                  append($$anchor6, fragment_5);
                }), append($$anchor5, div_1);
              }, "children"),
              $$slots: { default: !0 }
            });
          }), append($$anchor3, div);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent_2");
    if_block(node, ($$render) => {
      get$1(talents).length && $$render(consequent_2);
    });
  }
  append($$anchor, fragment_1), pop();
}
__name(Talents, "Talents");
var root_1$m = /* @__PURE__ */ template("<!> <!>", 1), root$B = /* @__PURE__ */ template('<div class="la-mount__list la-flexcol -widthfull"><!> <!> <!> <!></div>');
function Loadout$1($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]);
  setActorContext($$props.actor);
  var div = root$B(), node = child(div);
  Frame(node, spread_props(() => props));
  var node_1 = sibling(node, 2);
  Mounts(node_1, spread_props(() => props));
  var node_2 = sibling(node_1, 2);
  Systems$1(node_2, spread_props(() => props));
  var node_3 = sibling(node_2, 2);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment = root_1$m(), node_4 = first_child(fragment);
      CoreBonus(node_4, {
        get actor() {
          return $$props.pilot;
        },
        get sheetActor() {
          return $$props.actor;
        }
      });
      var node_5 = sibling(node_4, 2);
      Talents(node_5, {
        get actor() {
          return $$props.pilot;
        },
        get sheetActor() {
          return $$props.actor;
        }
      }), append($$anchor2, fragment);
    }, "consequent");
    if_block(node_3, ($$render) => {
      var _a;
      $$props.pilot && ((_a = $$props.pilot.system.active_mech) == null ? void 0 : _a.value.uuid) === $$props.actor.uuid && $$render(consequent);
    });
  }
  append($$anchor, div), pop();
}
__name(Loadout$1, "Loadout$1");
const CUSTOM_FLAG_PATTERN = new RegExp(`@${LancerAlternative.EnricherTag}\\[([^\\]]+)\\]{([^}]+)}`, "g");
async function enrichCustomFlag(match) {
  const [, uuid, path] = match, actor = await fromUuid(uuid);
  if (!actor)
    return Logger.warn(`${LancerAlternative.EnricherTag} enricher could not resolve actor UUID`, uuid), null;
  const value = foundry.utils.getProperty(actor, path), anchor = document.createElement("a");
  return anchor.classList.add("content-link", "la-custom-flag-link"), anchor.dataset.tooltip = path, anchor.append(document.createTextNode(`${value}`)), anchor;
}
__name(enrichCustomFlag, "enrichCustomFlag");
function registerCustomFlagEnricher() {
  CONFIG.TextEditor.enrichers.push({
    pattern: CUSTOM_FLAG_PATTERN,
    enricher: enrichCustomFlag
  });
}
__name(registerCustomFlagEnricher, "registerCustomFlagEnricher");
function getEnricher(actorUuid, flagKey, id2, field = "value") {
  return `@${LancerAlternative.EnricherTag}[${actorUuid}]{${getCustomFlagPath(flagKey, id2, field)}}`;
}
__name(getEnricher, "getEnricher");
const headerSecondaryInnerLeftOptions$3 = /* @__PURE__ */ __name(($$anchor) => {
  var i = root_2$e();
  append($$anchor, i);
}, "headerSecondaryInnerLeftOptions$3");
var root_1$l = /* @__PURE__ */ template("<!> <!>", 1), root_2$e = /* @__PURE__ */ template('<i class="mdi mdi-code-json -padding0-lr"></i>'), root_5$n = /* @__PURE__ */ template("<i></i>"), on_change$9 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { name: event2.target.value }), "on_change$9"), root_9$g = /* @__PURE__ */ template('<input type="text" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr">'), on_change_1$6 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { contentType: event2.target.value }), "on_change_1$6"), root_10$d = /* @__PURE__ */ template('<select class="la-customvalue__select la-text-text -bordersround -small la-brdr-repcap -padding0-lr -widthfull"><option> </option><option> </option></select>'), on_change_2$4 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2, flag) => handleUpdateCustomFlag($$props.actor, id2(), {
  content: {
    ...flag().content,
    value: Number(event2.target.value)
  }
}), "on_change_2$4"), on_change_3$4 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2, flag) => handleUpdateCustomFlag($$props.actor, id2(), {
  content: {
    ...flag().content,
    max: Number(event2.target.value)
  }
}), "on_change_3$4"), on_change_4$4 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2, flag) => handleUpdateCustomFlag($$props.actor, id2(), {
  content: {
    ...flag().content,
    min: Number(event2.target.value)
  }
}), "on_change_4$4"), root_12$a = /* @__PURE__ */ template('<div class="la-flexcol -gap0"><span class="-fontsizesmall -upper"> </span> <input type="number" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr"></div> <div class="la-flexcol -gap0"><span class="-fontsizesmall -upper"> </span> <input type="number" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr"></div>', 1), root_11$e = /* @__PURE__ */ template('<div class="la-flexrow -gap1"><div class="la-flexcol -gap0"><span class="-fontsizesmall -upper"> </span> <input type="number" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr"></div> <!></div>'), on_change_5$3 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { showInSidebar: event2.target.checked }), "on_change_5$3"), root_13$8 = /* @__PURE__ */ template('<input type="checkbox" class="-widthfull">'), on_change_6$3 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { color: event2.target.value }), "on_change_6$3"), root_14$6 = /* @__PURE__ */ template('<input type="color" class="la-customvalue__input -widthfull">'), on_change_7$3 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { icon: event2.target.value }), "on_change_7$3"), root_15$7 = /* @__PURE__ */ template('<input type="text" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr">'), on_change_8$3 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { tooltip: event2.target.value }), "on_change_8$3"), root_16$5 = /* @__PURE__ */ template('<input type="text" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr">'), root_19$4 = /* @__PURE__ */ template('<span class=" -upper"> </span> <input type="text" readonly=""> <span class=" -upper"> </span> <input type="text" readonly="">', 1), root_18$4 = /* @__PURE__ */ template('<div class="la-combine-grid -horizontal2-auto -aligncenter -gap1 -widthfull"><span class=" -upper"> </span> <input type="text" readonly=""> <!></div>'), root_21$4 = /* @__PURE__ */ template('<span class=" -upper"> </span> <input type="text" readonly=""> <span class=" -upper"> </span> <input type="text" readonly="">', 1), root_20$5 = /* @__PURE__ */ template('<div class="la-combine-grid -horizontal2-auto -aligncenter -gap1 -widthfull"><span class=" -upper"> </span> <input type="text" readonly=""> <!></div>'), root_17$5 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!></div>'), root_8$d = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!> <!> <!> <!> <!></div>'), root_3$r = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"></div>'), root$A = /* @__PURE__ */ template('<div class="la-custom__list la-flexcol -widthfull"><!></div>');
function Custom$3($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment = root_1$l(), node = first_child(fragment);
    const expression = /* @__PURE__ */ derived(() => [
      "la-text-header la-prmy-header la-scdy-primary -fontsize5 -alignselfcenter",
      qualityMode ? " -glow-prmy -glow-scdy-hover " : "",
      get$1(sortable) ? " mdi mdi-sort-variant-lock-open " : " mdi mdi-sort-variant-lock "
    ]), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.sort.tooltip")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.sort.tooltip"));
    GlyphButton(node, {
      type: "button",
      get flowClass() {
        return FlowClass.None;
      },
      get style() {
        return get$1(expression);
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_1);
      },
      get logText() {
        return get$1(expression_2);
      },
      logging: !0,
      onClick: /* @__PURE__ */ __name(() => setCustomFlagsSortable($$props.actor.uuid, !get$1(sortable)), "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(sortButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(sortButtonHover, !1);
      }, "onPointerLeave")
    });
    var node_1 = sibling(node, 2);
    const expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.add.tooltip")), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.add.tooltip"));
    GlyphButton(node_1, {
      type: "button",
      get flowClass() {
        return FlowClass.None;
      },
      style: [
        "mdi mdi-plus-thick la-text-header la-prmy-header la-scdy-primary -fontsize5 -alignselfcenter",
        qualityMode ? " -glow-prmy -glow-scdy-hover " : ""
      ],
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_3);
      },
      get logText() {
        return get$1(expression_4);
      },
      logging: !0,
      onClick: /* @__PURE__ */ __name((event2) => handleAddCustomFlag(event2, $$props.actor), "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(addButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(addButtonHover, !1);
      }, "onPointerLeave")
    }), append($$anchor2, fragment);
  }, "headerOptions");
  setActorContext($$props.actor);
  let component = state(null), deleteButtonHover = state(!1), addButtonHover = state(!1), sortButtonHover = state(!1);
  const theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), customFlags = /* @__PURE__ */ derived(() => getCustomFlags($$props.actor, CustomFlagKey.Mech)), flagEntries = /* @__PURE__ */ derived(() => Object.entries(get$1(customFlags))), sortable = /* @__PURE__ */ derived(() => getCustomFlagsSortable($$props.actor.uuid)), tooltipEnabled = getMechSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), refCopyTip = TooltipFactory.buildTooltip(getLocalized("LA.tab.custom.flag.ref.tooltip")), enrichCopyTip = TooltipFactory.buildTooltip(getLocalized("LA.tab.custom.flag.enricher.tooltip"));
  function handleAddCustomFlag(_event, actor) {
    addCustomFlag(actor, CustomFlagKey.Mech);
  }
  __name(handleAddCustomFlag, "handleAddCustomFlag");
  function handleDeleteCustomFlag(event2, actor, id2) {
    event2.stopPropagation(), deleteCustomFlag(actor, CustomFlagKey.Mech, id2);
  }
  __name(handleDeleteCustomFlag, "handleDeleteCustomFlag");
  function handleUpdateCustomFlag(actor, id2, changes) {
    updateCustomFlag(actor, CustomFlagKey.Mech, id2, changes);
  }
  __name(handleUpdateCustomFlag, "handleUpdateCustomFlag");
  function handleReorderCustomFlag(_event, dropData, thisData) {
    dropData.type === LADataType.Sorting && reorderCustomFlags($$props.actor, CustomFlagKey.Mech, dropData.index, thisData.index);
  }
  __name(handleReorderCustomFlag, "handleReorderCustomFlag");
  function getTypeIcon(type) {
    return type == CustomFlagContentType.Fraction ? "mdi-fraction-one-half" : "mdi-numeric";
  }
  __name(getTypeIcon, "getTypeIcon");
  var div = root$A(), node_2 = child(div);
  const expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.subLabel"));
  HeaderMain(node_2, {
    get text() {
      return get$1(expression_5);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-transparent clipped-bot-alt"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(addButtonHover)) return `--${getLocalized("LA.tab.custom.add.extension")}`;
      if (get$1(sortButtonHover)) return `--${getLocalized("LA.tab.custom.sort.extension")}`;
    }, "extensionTextFunction"),
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div_1 = root_3$r();
      each(div_1, 23, () => get$1(flagEntries), ([id2, flag]) => id2, ($$anchor3, $$item, index2) => {
        let id2 = /* @__PURE__ */ __name(() => get$1($$item)[0], "id"), flag = /* @__PURE__ */ __name(() => get$1($$item)[1], "flag");
        const headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor4) => {
          var i_1 = root_5$n();
          template_effect(
            ($0) => set_class(i_1, `mdi -padding0-lr
                ${$0 ?? ""}`),
            [() => getTypeIcon(flag().contentType)]
          ), append($$anchor4, i_1);
        }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor4) => {
          const expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.delete.tooltip")), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.delete.tooltip"));
          GlyphButton($$anchor4, {
            type: "button",
            get flowClass() {
              return FlowClass.None;
            },
            style: [
              "mdi mdi-close-thick la-prmy-header la-scdy-primary -fontsize5 -alignselfcenter",
              qualityMode ? " -glow-prmy -glow-scdy-hover " : ""
            ],
            tooltipEnabled,
            get tooltipDirection() {
              return TooltipDirection.UP;
            },
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltip() {
              return get$1(expression_6);
            },
            get logText() {
              return get$1(expression_7);
            },
            logging: !0,
            onClick: /* @__PURE__ */ __name((event2) => handleDeleteCustomFlag(event2, $$props.actor, id2()), "onClick"),
            onPointerEnter: /* @__PURE__ */ __name(() => {
              set(deleteButtonHover, !0);
            }, "onPointerEnter"),
            onPointerLeave: /* @__PURE__ */ __name(() => {
              set(deleteButtonHover, !1);
            }, "onPointerLeave")
          });
        }, "headerSecondaryRightOptions"), expression_8 = /* @__PURE__ */ derived(() => [get$1(sortable) ? "-padding5-l" : ""]), expression_9 = /* @__PURE__ */ derived(() => [get$1(sortable) ? "" : "-displaynone"]), expression_10 = /* @__PURE__ */ derived(() => ({
          type: LADataType.Sorting,
          index: get$1(index2)
        })), expression_11 = /* @__PURE__ */ derived(() => !get$1(sortable));
        DragDropHandle($$anchor3, {
          get style() {
            return get$1(expression_8);
          },
          get iconStyle() {
            return get$1(expression_9);
          },
          get index() {
            return get$1(index2);
          },
          get root() {
            return get$1(component);
          },
          get data() {
            return get$1(expression_10);
          },
          onDrop: handleReorderCustomFlag,
          deleteDisabled: !0,
          logging: !1,
          get disabled() {
            return get$1(expression_11);
          },
          children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
            const expression_12 = /* @__PURE__ */ derived(() => flag().name || getLocalized("LA.tab.custom.flag.name.label")), expression_13 = /* @__PURE__ */ derived(() => `custom.${id2()}`);
            HeaderSecondary($$anchor4, {
              get text() {
                return get$1(expression_12);
              },
              headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
              textStyle: [H2_TEXT_SIZE, "-fontface-stylized"],
              borderStyle: ["la-brdr-pilot"],
              extensionTextFunction: /* @__PURE__ */ __name(() => {
                if (get$1(deleteButtonHover)) return `--${getLocalized("LA.tab.custom.delete.extension")}`;
              }, "extensionTextFunction"),
              get collapseID() {
                return get$1(expression_13);
              },
              startCollapsed: !1,
              contentLeft: headerSecondaryLeftOptions2,
              contentRight: headerSecondaryRightOptions,
              children: /* @__PURE__ */ __name(($$anchor5, $$slotProps3) => {
                var div_2 = root_8$d(), node_3 = child(div_2);
                const expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.name.label"));
                EffectBox(node_3, {
                  get name() {
                    return get$1(expression_14);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input = root_9$g();
                    input.__change = [
                      on_change$9,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(
                      ($0) => {
                        set_value(input, flag().name), set_attribute(input, "placeholder", $0);
                      },
                      [() => getLocalized("LA.namePlaceholder")]
                    ), event("focus", input, (event2) => event2.currentTarget.select()), append($$anchor6, input);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_4 = sibling(node_3, 2);
                const expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.contentType.label"));
                EffectBox(node_4, {
                  get name() {
                    return get$1(expression_15);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var select = root_10$d();
                    select.__change = [
                      on_change_1$6,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ];
                    var option = child(select), option_value = {}, text2 = child(option), option_1 = sibling(option), option_1_value = {}, text_1 = child(option_1);
                    template_effect(
                      ($0, $1) => {
                        option_value !== (option_value = CustomFlagContentType.Value) && (option.value = (option.__value = CustomFlagContentType.Value) == null ? "" : CustomFlagContentType.Value), set_selected(option, flag().contentType === CustomFlagContentType.Value), set_text(text2, $0), option_1_value !== (option_1_value = CustomFlagContentType.Fraction) && (option_1.value = (option_1.__value = CustomFlagContentType.Fraction) == null ? "" : CustomFlagContentType.Fraction), set_selected(option_1, flag().contentType === CustomFlagContentType.Fraction), set_text(text_1, $1);
                      },
                      [
                        () => getLocalized("LA.tab.custom.flag.contentType.value.label"),
                        () => getLocalized("LA.tab.custom.flag.contentType.fraction.label")
                      ]
                    ), append($$anchor6, select);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_5 = sibling(node_4, 2);
                const expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.content.label"));
                EffectBox(node_5, {
                  get name() {
                    return get$1(expression_16);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var div_3 = root_11$e(), div_4 = child(div_3), span = child(div_4), text_2 = child(span), input_1 = sibling(span, 2);
                    input_1.__change = [
                      on_change_2$4,
                      handleUpdateCustomFlag,
                      $$props,
                      id2,
                      flag
                    ];
                    var node_6 = sibling(div_4, 2);
                    {
                      var consequent = /* @__PURE__ */ __name(($$anchor7) => {
                        var fragment_4 = root_12$a(), div_5 = first_child(fragment_4), span_1 = child(div_5), text_3 = child(span_1), input_2 = sibling(span_1, 2);
                        input_2.__change = [
                          on_change_3$4,
                          handleUpdateCustomFlag,
                          $$props,
                          id2,
                          flag
                        ];
                        var div_6 = sibling(div_5, 2), span_2 = child(div_6), text_4 = child(span_2), input_3 = sibling(span_2, 2);
                        input_3.__change = [
                          on_change_4$4,
                          handleUpdateCustomFlag,
                          $$props,
                          id2,
                          flag
                        ], template_effect(
                          ($0, $1) => {
                            set_text(text_3, $0), set_value(input_2, flag().content.max), set_text(text_4, $1), set_value(input_3, flag().content.min);
                          },
                          [
                            () => getLocalized("LA.tab.custom.flag.content.max.label"),
                            () => getLocalized("LA.tab.custom.flag.content.min.label")
                          ]
                        ), event("focus", input_2, (event2) => event2.currentTarget.select()), event("focus", input_3, (event2) => event2.currentTarget.select()), append($$anchor7, fragment_4);
                      }, "consequent");
                      if_block(node_6, ($$render) => {
                        flag().contentType === CustomFlagContentType.Fraction && $$render(consequent);
                      });
                    }
                    template_effect(
                      ($0) => {
                        set_text(text_2, $0), set_value(input_1, flag().content.value);
                      },
                      [
                        () => getLocalized("LA.tab.custom.flag.content.value.label")
                      ]
                    ), event("focus", input_1, (event2) => event2.currentTarget.select()), append($$anchor6, div_3);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_7 = sibling(node_5, 2);
                const expression_17 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.sidebarToggle.label"));
                EffectBox(node_7, {
                  get name() {
                    return get$1(expression_17);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_4 = root_13$8();
                    input_4.__change = [
                      on_change_5$3,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_checked(input_4, flag().showInSidebar)), append($$anchor6, input_4);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_8 = sibling(node_7, 2);
                const expression_18 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.color.label"));
                EffectBox(node_8, {
                  get name() {
                    return get$1(expression_18);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_5 = root_14$6();
                    input_5.__change = [
                      on_change_6$3,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_value(input_5, flag().color)), append($$anchor6, input_5);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_9 = sibling(node_8, 2);
                const expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.icon.label"));
                EffectBox(node_9, {
                  get name() {
                    return get$1(expression_19);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_6 = root_15$7();
                    set_attribute(input_6, "placeholder", "mdi mdi-abacus"), input_6.__change = [
                      on_change_7$3,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_value(input_6, flag().icon)), event("focus", input_6, (event2) => event2.currentTarget.select()), append($$anchor6, input_6);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_10 = sibling(node_9, 2);
                const expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.tooltip.label"));
                EffectBox(node_10, {
                  get name() {
                    return get$1(expression_20);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_7 = root_16$5();
                    input_7.__change = [
                      on_change_8$3,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_value(input_7, flag().tooltip)), event("focus", input_7, (event2) => event2.currentTarget.select()), append($$anchor6, input_7);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_11 = sibling(node_10, 2);
                const expression_21 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.assist.label")), expression_22 = /* @__PURE__ */ derived(() => `custom.${id2()}.assist`);
                HeaderSecondary(node_11, {
                  get text() {
                    return get$1(expression_21);
                  },
                  headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
                  textStyle: [H2_TEXT_SIZE, "-fontface-stylized"],
                  borderStyle: ["la-brdr-pilot"],
                  get collapseID() {
                    return get$1(expression_22);
                  },
                  startCollapsed: !1,
                  contentLeft: headerSecondaryInnerLeftOptions$3,
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var div_7 = root_17$5(), node_12 = child(div_7);
                    const expression_23 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.ref.label"));
                    EffectBox(node_12, {
                      get name() {
                        return get$1(expression_23);
                      },
                      children: /* @__PURE__ */ __name(($$anchor7, $$slotProps5) => {
                        var div_8 = root_18$4(), span_3 = child(div_8), text_5 = child(span_3), input_8 = sibling(span_3, 2);
                        set_attribute(input_8, "data-tooltip", tooltipEnabled ? refCopyTip : void 0);
                        var node_13 = sibling(input_8, 2);
                        {
                          var consequent_1 = /* @__PURE__ */ __name(($$anchor8) => {
                            var fragment_5 = root_19$4(), span_4 = first_child(fragment_5), text_6 = child(span_4), input_9 = sibling(span_4, 2);
                            set_attribute(input_9, "data-tooltip", tooltipEnabled ? refCopyTip : void 0);
                            var span_5 = sibling(input_9, 2), text_7 = child(span_5), input_10 = sibling(span_5, 2);
                            set_attribute(input_10, "data-tooltip", tooltipEnabled ? refCopyTip : void 0), template_effect(
                              ($0, $1, $2, $3, $4) => {
                                set_text(text_6, $0), set_class(input_9, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_9, $2), set_attribute(input_9, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_9, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text_7, $3), set_class(input_10, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_10, $4), set_attribute(input_10, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_10, "data-tooltip-direction", TooltipDirection.DOWN);
                              },
                              [
                                () => getLocalized("LA.tab.custom.flag.content.max.label"),
                                () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                                () => getCustomFlagPath(CustomFlagKey.Mech, id2(), "max"),
                                () => getLocalized("LA.tab.custom.flag.content.min.label"),
                                () => getCustomFlagPath(CustomFlagKey.Mech, id2(), "min")
                              ]
                            ), event("pointerenter", input_9, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.ref.tooltip"), $$props.actor.uuid)), event("pointerleave", input_9, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_9, (event2) => event2.currentTarget.select()), event("pointerenter", input_10, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.ref.tooltip"), $$props.actor.uuid)), event("pointerleave", input_10, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_10, (event2) => event2.currentTarget.select()), append($$anchor8, fragment_5);
                          }, "consequent_1");
                          if_block(node_13, ($$render) => {
                            flag().contentType === CustomFlagContentType.Fraction && $$render(consequent_1);
                          });
                        }
                        template_effect(
                          ($0, $1, $2) => {
                            set_text(text_5, $0), set_class(input_8, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                        ${$1 ?? ""}`), set_value(input_8, $2), set_attribute(input_8, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_8, "data-tooltip-direction", TooltipDirection.DOWN);
                          },
                          [
                            () => getLocalized("LA.tab.custom.flag.content.value.label"),
                            () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                            () => getCustomFlagPath(CustomFlagKey.Mech, id2(), "value")
                          ]
                        ), event("pointerenter", input_8, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.ref.tooltip"), $$props.actor.uuid)), event("pointerleave", input_8, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_8, (event2) => event2.currentTarget.select()), append($$anchor7, div_8);
                      }, "children"),
                      $$slots: { default: !0 }
                    });
                    var node_14 = sibling(node_12, 2);
                    const expression_24 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.enricher.label"));
                    EffectBox(node_14, {
                      get name() {
                        return get$1(expression_24);
                      },
                      children: /* @__PURE__ */ __name(($$anchor7, $$slotProps5) => {
                        var div_9 = root_20$5(), span_6 = child(div_9), text_8 = child(span_6), input_11 = sibling(span_6, 2);
                        set_attribute(input_11, "data-tooltip", tooltipEnabled ? enrichCopyTip : void 0);
                        var node_15 = sibling(input_11, 2);
                        {
                          var consequent_2 = /* @__PURE__ */ __name(($$anchor8) => {
                            var fragment_6 = root_21$4(), span_7 = first_child(fragment_6), text_9 = child(span_7), input_12 = sibling(span_7, 2);
                            set_attribute(input_12, "data-tooltip", tooltipEnabled ? enrichCopyTip : void 0);
                            var span_8 = sibling(input_12, 2), text_10 = child(span_8), input_13 = sibling(span_8, 2);
                            set_attribute(input_13, "data-tooltip", tooltipEnabled ? enrichCopyTip : void 0), template_effect(
                              ($0, $1, $2, $3, $4) => {
                                set_text(text_9, $0), set_class(input_12, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_12, $2), set_attribute(input_12, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_12, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text_10, $3), set_class(input_13, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_13, $4), set_attribute(input_13, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_13, "data-tooltip-direction", TooltipDirection.DOWN);
                              },
                              [
                                () => getLocalized("LA.tab.custom.flag.content.max.label"),
                                () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                                () => getEnricher($$props.actor.uuid, CustomFlagKey.Mech, id2(), "max"),
                                () => getLocalized("LA.tab.custom.flag.content.min.label"),
                                () => getEnricher($$props.actor.uuid, CustomFlagKey.Mech, id2(), "min")
                              ]
                            ), event("pointerenter", input_12, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.enricher.tooltip"), $$props.actor.uuid)), event("pointerleave", input_12, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_12, (event2) => event2.currentTarget.select()), event("pointerenter", input_13, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.enricher.tooltip"), $$props.actor.uuid)), event("pointerleave", input_13, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_13, (event2) => event2.currentTarget.select()), append($$anchor8, fragment_6);
                          }, "consequent_2");
                          if_block(node_15, ($$render) => {
                            flag().contentType === CustomFlagContentType.Fraction && $$render(consequent_2);
                          });
                        }
                        template_effect(
                          ($0, $1, $2) => {
                            set_text(text_8, $0), set_class(input_11, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                        ${$1 ?? ""}`), set_value(input_11, $2), set_attribute(input_11, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_11, "data-tooltip-direction", TooltipDirection.DOWN);
                          },
                          [
                            () => getLocalized("LA.tab.custom.flag.content.value.label"),
                            () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                            () => getEnricher($$props.actor.uuid, CustomFlagKey.Mech, id2(), "value")
                          ]
                        ), event("pointerenter", input_11, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.enricher.tooltip"), $$props.actor.uuid)), event("pointerleave", input_11, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_11, (event2) => event2.currentTarget.select()), append($$anchor7, div_9);
                      }, "children"),
                      $$slots: { default: !0 }
                    }), append($$anchor6, div_7);
                  }, "children"),
                  $$slots: { default: !0 }
                }), append($$anchor5, div_2);
              }, "children"),
              $$slots: { default: !0 }
            });
          }, "children"),
          $$slots: { default: !0 }
        });
      }), bind_this(div_1, ($$value) => set(component, $$value), () => get$1(component)), append($$anchor2, div_1);
    }, "children"),
    $$slots: { default: !0 }
  }), append($$anchor, div), pop();
}
__name(Custom$3, "Custom$3");
delegate(["change"]);
function CustomToggle$3($$anchor, $$props) {
  push($$props, !0);
  const advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState($$props.actor.uuid));
  user_effect(() => {
    var _a;
    (_a = $$props.button) == null || _a.classList.toggle("-displaynone", !get$1(advancedOptions));
  }), pop();
}
__name(CustomToggle$3, "CustomToggle$3");
var root$z = /* @__PURE__ */ template('<div><div><span> </span> <button type="button"><span> </span></button></div></div>');
function HexButton($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, tip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip($$props.tooltip || getLocalized("LA.flow.tooltip"), $$props.tooltipHeader)), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.flow.tooltip")), parsedValue = /* @__PURE__ */ derived(() => $$props.value && $$props.sign && $$props.value > 0 ? `+${$$props.value}` : $$props.value);
  var div = root$z(), div_1 = child(div), span = child(div_1), text_1 = child(span), button = sibling(span, 2), span_1 = child(button), text_2 = child(span_1);
  template_effect(
    ($0, $1, $2, $3, $4) => {
      set_class(div, `la-attribute la-text-secondary mdi mdi-hexagon ${$0 ?? ""}`), set_class(div_1, `la-flexcol ${$1 ?? ""}`), set_class(span, `la-label__span ${$2 ?? ""}`), set_text(text_1, $$props.text), set_class(button, `la-value__button ${$3 ?? ""}
                ${$$props.flowClass || ""}`), set_attribute(button, "data-uuid", $$props.uuid), set_attribute(button, "data-flow-type", $$props.flowType), set_attribute(button, "data-flow-args", $$props.flowArgs), set_attribute(button, "data-path", $$props.path), set_attribute(button, "data-tooltip", $$props.tooltipEnabled ? get$1(tip) : void 0), set_attribute(button, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(button, "data-tooltip-direction", $$props.tooltipDirection), set_attribute(button, "aria-label", $$props.text), set_class(span_1, `la-value__span ${$4 ?? ""}`), set_text(text_2, get$1(parsedValue));
    },
    [
      () => {
        var _a2;
        return (_a2 = $$props.outerStyle) == null ? void 0 : _a2.join(" ");
      },
      () => {
        var _a2;
        return (_a2 = $$props.innerStyle) == null ? void 0 : _a2.join(" ");
      },
      () => {
        var _a2;
        return (_a2 = $$props.outerTextStyle) == null ? void 0 : _a2.join(" ");
      },
      () => {
        var _a2;
        return (_a2 = $$props.buttonStyle) == null ? void 0 : _a2.join(" ");
      },
      () => {
        var _a2;
        return (_a2 = $$props.innerTextStyle) == null ? void 0 : _a2.join(" ");
      }
    ]
  ), event("pointerenter", button, function(...$$args) {
    var _a2;
    (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
  }), event("pointerleave", button, function(...$$args) {
    var _a2;
    (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
  }), append($$anchor, div), pop();
}
__name(HexButton, "HexButton");
var root_1$k = /* @__PURE__ */ template('<div><div class="la-hase la-flexcol -justifybetween -heightnone"><div class="la-flexrow -aligncenter"><!></div> <div class="la-flexrow -aligncenter"><!> <!></div> <div class="la-flexrow -aligncenter"><!></div> <div class="la-flexrow -aligncenter"><div class="-eng -pointerdisable">&nbsp;</div> <!></div></div></div>');
function HaseArray($$anchor, $$props) {
  push($$props, !0), setActorContext($$props.actor);
  const logographic = logographicLanguage(), qualityMode = getExtraEffectsEnabled(), activeTab = /* @__PURE__ */ derived(() => getActiveTab($$props.actor.uuid, ActiveTab.Secondary) || "statistics"), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var div = root_1$k(), div_1 = child(div), div_2 = child(div_1), node_1 = child(div_2);
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.grit.short")), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.grit.tooltip")), expression_2 = /* @__PURE__ */ derived(() => $$props.tooltipDirection || TooltipDirection.LEFT), expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.grit.tooltip"));
      HexButton(node_1, {
        get text() {
          return get$1(expression);
        },
        get value() {
          return $$props.system.grit;
        },
        get tooltipEnabled() {
          return $$props.tooltipEnabled;
        },
        get tooltip() {
          return get$1(expression_1);
        },
        get tooltipDirection() {
          return get$1(expression_2);
        },
        get tooltipTheme() {
          return get$1(theme);
        },
        get logText() {
          return get$1(expression_3);
        },
        get logging() {
          return $$props.logging;
        },
        get uuid() {
          return $$props.actor.uuid;
        },
        get flowClass() {
          return FlowClass.RollStat;
        },
        path: "system.grit",
        sign: !0,
        outerStyle: ["-grit"],
        innerStyle: [
          "la-text-header -positionabsolute -divider -thickness1 la-prmy-header"
        ],
        buttonStyle: [
          "-widthfull -heightfull -positionabsolute",
          qualityMode ? "la-prmy-primary -glow-prmy-hover" : ""
        ],
        outerTextStyle: [
          "-widthfull -textaligncenter -fontface-stylized",
          logographic ? "-fontsizemedium" : "-fontsizesmall"
        ],
        innerTextStyle: [
          "-fontsize6 -lineheight15",
          qualityMode ? "-pulse-glow-prmy la-prmy-header" : ""
        ]
      });
      var div_3 = sibling(div_2, 2), node_2 = child(div_3);
      const expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.hull.short")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.hull.tooltip")), expression_6 = /* @__PURE__ */ derived(() => $$props.tooltipDirection || TooltipDirection.LEFT), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.hull.tooltip"));
      HexButton(node_2, {
        get text() {
          return get$1(expression_4);
        },
        get value() {
          return $$props.system.hull;
        },
        get tooltipEnabled() {
          return $$props.tooltipEnabled;
        },
        get tooltip() {
          return get$1(expression_5);
        },
        get tooltipDirection() {
          return get$1(expression_6);
        },
        get tooltipTheme() {
          return get$1(theme);
        },
        get logText() {
          return get$1(expression_7);
        },
        get logging() {
          return $$props.logging;
        },
        get uuid() {
          return $$props.actor.uuid;
        },
        get flowClass() {
          return FlowClass.RollHASE;
        },
        path: "system.hull",
        outerStyle: ["-hull"],
        innerStyle: [
          "la-text-header -positionabsolute -divider -thickness1 la-prmy-header"
        ],
        buttonStyle: [
          "-widthfull -heightfull -positionabsolute",
          qualityMode ? "la-prmy-primary -glow-prmy-hover" : ""
        ],
        outerTextStyle: [
          "-widthfull -textaligncenter -fontface-stylized",
          logographic ? "-fontsizemediumer" : "-fontsizesmaller"
        ],
        innerTextStyle: [
          "-fontsize5 -lineheight13",
          qualityMode ? "-pulse-glow-prmy la-prmy-header" : ""
        ]
      });
      var node_3 = sibling(node_2, 2);
      const expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.agility.short")), expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.agility.tooltip")), expression_10 = /* @__PURE__ */ derived(() => $$props.tooltipDirection || TooltipDirection.LEFT), expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.agility.tooltip"));
      HexButton(node_3, {
        get text() {
          return get$1(expression_8);
        },
        get value() {
          return $$props.system.agi;
        },
        get tooltipEnabled() {
          return $$props.tooltipEnabled;
        },
        get tooltip() {
          return get$1(expression_9);
        },
        get tooltipDirection() {
          return get$1(expression_10);
        },
        get tooltipTheme() {
          return get$1(theme);
        },
        get logText() {
          return get$1(expression_11);
        },
        get logging() {
          return $$props.logging;
        },
        get uuid() {
          return $$props.actor.uuid;
        },
        get flowClass() {
          return FlowClass.RollHASE;
        },
        path: "system.agi",
        outerStyle: ["-agi"],
        innerStyle: [
          "la-text-header -positionabsolute -divider -thickness1 la-prmy-header"
        ],
        buttonStyle: [
          "-widthfull -heightfull -positionabsolute",
          qualityMode ? "la-prmy-primary -glow-prmy-hover" : ""
        ],
        outerTextStyle: [
          "-widthfull -textaligncenter -fontface-stylized",
          logographic ? "-fontsizemediumer" : "-fontsizesmaller"
        ],
        innerTextStyle: [
          "-fontsize5 -lineheight13",
          qualityMode ? "-pulse-glow-prmy la-prmy-header" : ""
        ]
      });
      var div_4 = sibling(div_3, 2), node_4 = child(div_4);
      const expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.systems.short")), expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.systems.tooltip")), expression_14 = /* @__PURE__ */ derived(() => $$props.tooltipDirection || TooltipDirection.LEFT), expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.systems.tooltip"));
      HexButton(node_4, {
        get text() {
          return get$1(expression_12);
        },
        get value() {
          return $$props.system.sys;
        },
        get tooltipEnabled() {
          return $$props.tooltipEnabled;
        },
        get tooltip() {
          return get$1(expression_13);
        },
        get tooltipDirection() {
          return get$1(expression_14);
        },
        get tooltipTheme() {
          return get$1(theme);
        },
        get logText() {
          return get$1(expression_15);
        },
        get logging() {
          return $$props.logging;
        },
        get uuid() {
          return $$props.actor.uuid;
        },
        get flowClass() {
          return FlowClass.RollHASE;
        },
        path: "system.sys",
        outerStyle: ["-sys"],
        innerStyle: [
          "la-text-header -positionabsolute -divider -thickness1 la-prmy-header"
        ],
        buttonStyle: [
          "-widthfull -heightfull -positionabsolute",
          qualityMode ? "la-prmy-primary -glow-prmy-hover" : ""
        ],
        outerTextStyle: [
          "-widthfull -textaligncenter -fontface-stylized",
          logographic ? "-fontsizemediumer" : "-fontsizesmaller"
        ],
        innerTextStyle: [
          "-fontsize5 -lineheight13",
          qualityMode ? "-pulse-glow-prmy la-prmy-header" : ""
        ]
      });
      var div_5 = sibling(div_4, 2), node_5 = sibling(child(div_5), 2);
      const expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.engineering.short")), expression_17 = /* @__PURE__ */ derived(() => getLocalized("LA.engineering.tooltip")), expression_18 = /* @__PURE__ */ derived(() => $$props.tooltipDirection || TooltipDirection.LEFT), expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.engineering.tooltip"));
      HexButton(node_5, {
        get text() {
          return get$1(expression_16);
        },
        get value() {
          return $$props.system.eng;
        },
        get tooltipEnabled() {
          return $$props.tooltipEnabled;
        },
        get tooltip() {
          return get$1(expression_17);
        },
        get tooltipDirection() {
          return get$1(expression_18);
        },
        get tooltipTheme() {
          return get$1(theme);
        },
        get logText() {
          return get$1(expression_19);
        },
        get logging() {
          return $$props.logging;
        },
        get uuid() {
          return $$props.actor.uuid;
        },
        get flowClass() {
          return FlowClass.RollHASE;
        },
        path: "system.eng",
        outerStyle: ["-eng"],
        innerStyle: [
          "la-text-header -positionabsolute -divider -thickness1 la-prmy-header"
        ],
        buttonStyle: [
          "-widthfull -heightfull -positionabsolute",
          qualityMode ? "la-prmy-primary -glow-prmy-hover" : ""
        ],
        outerTextStyle: [
          "-widthfull -textaligncenter -fontface-stylized",
          logographic ? "-fontsizemediumer" : "-fontsizesmaller"
        ],
        innerTextStyle: [
          "-fontsize5 -lineheight13",
          qualityMode ? "-pulse-glow-prmy la-prmy-header" : ""
        ]
      }), template_effect(() => set_class(div, `la-hasegroup -positionabsolute -widthnone
        ${(get$1(activeTab) === "statistics" ? "" : "-displaynone") ?? ""}`)), append($$anchor2, div);
    }, "consequent");
    if_block(node, ($$render) => {
      var _a, _b;
      ($$props.actor.type === "pilot" || $$props.actor.type === "mech" && ((_b = (_a = $$props.pilot) == null ? void 0 : _a.system.active_mech) == null ? void 0 : _b.value.uuid) === $$props.actor.uuid) && $$render(consequent);
    });
  }
  append($$anchor, fragment), pop();
}
__name(HaseArray, "HaseArray");
function handleMountChange(currentMount, mountPath, selectionIndex, bracing, document2, callback) {
  var _a, _b, _c, _d, _e, _f;
  const mountTypes = Object.keys(MOUNT_FITTINGS);
  let newSlots = {
    loadout: {
      weapon_mounts: [{
        slots: [{
          weapon: null,
          mod: null,
          size: MOUNT_FITTINGS.Unknown[0]
        }],
        type: "Unknown",
        bracing: !1
      }]
    }
  }, newSlotFittings = MOUNT_FITTINGS[mountTypes[selectionIndex]];
  for (let i = 0; i < newSlotFittings.length; i++)
    (_b = (_a = currentMount.slots[i]) == null ? void 0 : _a.weapon) != null && _b.value ? newSlots.loadout.weapon_mounts[0].slots[i] = {
      weapon: ((_d = (_c = currentMount.slots[i].weapon) == null ? void 0 : _c.value) == null ? void 0 : _d.id) ?? null,
      mod: ((_f = (_e = currentMount.slots[i].mod) == null ? void 0 : _e.value) == null ? void 0 : _f.id) ?? null,
      size: newSlotFittings[i]
    } : newSlots.loadout.weapon_mounts[0].slots[i] = {
      weapon: null,
      mod: null,
      size: newSlotFittings[i]
    };
  document2.update({
    [`${mountPath}.type`]: mountTypes[selectionIndex],
    [`${mountPath}.bracing`]: bracing,
    [`${mountPath}.slots`]: newSlots.loadout.weapon_mounts[0].slots
  }), callback == null || callback(MOUNT_LOCALIZE_MAP[mountTypes[selectionIndex]]);
}
__name(handleMountChange, "handleMountChange");
async function handleMountDelete(button, doc, callback) {
  var _a;
  let raw_val = button.dataset.actionValue;
  if (raw_val) {
    let result = await parse_control_val(raw_val);
    if (result.success)
      result.val;
    else {
      Logger.error(`bad data-action-value from gen control ${raw_val}`);
      return;
    }
  }
  let path = button.dataset.path, docOverride = null, dd;
  if (button.dataset.uuid) {
    if (docOverride = await fromUuid(button.dataset.uuid), !docOverride) {
      (_a = ui.notifications) == null || _a.error("Bad uuid: " + button.dataset.uuid);
      return;
    }
    dd = drilldownDocument(docOverride, path);
  } else
    dd = drilldownDocument(doc, path);
  let changes = array_path_edit_changes(dd.sub_doc, dd.sub_path);
  await dd.sub_doc.update({ [changes.path]: changes.new_val }), callback == null || callback($(button));
}
__name(handleMountDelete, "handleMountDelete");
var root_1$j = /* @__PURE__ */ template('<button type="button"> </button>'), root$y = /* @__PURE__ */ template('<div class="la-bckg-primary -fontsize4 -upper -padding0"> <i class="mdi mdi-arrow-down-right"></i></div> <div class="la-flexcol -widthfull -gap0 -padding0"><!> <div class="la-flexrow"><input type="checkbox"> <span class="-lineheight6"> </span></div></div>', 1);
function MountOptions($$anchor, $$props) {
  push($$props, !0);
  const mountNames = prop($$props, "mountNames");
  let bracing = state(!1);
  const qualityMode = getExtraEffectsEnabled();
  function swapMount(event2, mountIndex, morphIndex) {
    event2.stopPropagation();
    let mountPath = `system.loadout.weapon_mounts.${mountIndex}`;
    handleMountChange($$props.mount, mountPath, morphIndex, get$1(bracing), $$props.actorSheet, callback);
  }
  __name(swapMount, "swapMount");
  function callback(localizationString) {
    mountNames()[$$props.mountIndex] = localizationString;
  }
  __name(callback, "callback");
  var fragment = root$y(), div = first_child(fragment), text2 = child(div), div_1 = sibling(div, 2), node = child(div_1);
  each(node, 17, () => Object.keys(MOUNT_LOCALIZE_MAP), index, ($$anchor2, mountType, morphIndex) => {
    var button = root_1$j();
    set_class(button, `la-bckg-scrollbar-secondary la-text-header -fontsizemedium -letterspacing0 la-prmy-secondary la-scdy-accent -widthfull
            ${(qualityMode ? "-glow-prmy-hover -glow-scdy-focus" : "") ?? ""}`), button.__click = (event2) => swapMount(event2, $$props.mountIndex, morphIndex);
    var text_1 = child(button);
    template_effect(($0) => set_text(text_1, $0), [
      () => getLocalized(MOUNT_LOCALIZE_MAP[get$1(mountType)])
    ]), append($$anchor2, button);
  });
  var div_2 = sibling(node, 2), input = child(div_2), span = sibling(input, 2), text_2 = child(span);
  template_effect(
    ($0, $1) => {
      set_text(text2, $0), set_text(text_2, $1);
    },
    [
      () => getLocalized(MOUNT_LOCALIZE_MAP[$$props.mount.type]),
      () => getLocalized("LA.mech.mount.locked.subLabel")
    ]
  ), bind_checked(input, () => get$1(bracing), ($$value) => set(bracing, $$value)), append($$anchor, fragment), pop();
}
__name(MountOptions, "MountOptions");
delegate(["click"]);
var on_click$4 = /* @__PURE__ */ __name((event2, deleteMount) => deleteMount(event2), "on_click$4"), root$x = /* @__PURE__ */ template('<button type="button"> <i class="mdi mdi-close-circle-outline -positionabsolute -left2 -fontsize4"></i></button>');
function MountDelete($$anchor, $$props) {
  push($$props, !0);
  const mountIndices = prop($$props, "mountIndices"), qualityMode = getExtraEffectsEnabled();
  function deleteMount(event2) {
    event2.stopPropagation(), handleMountDelete(event2.currentTarget, $$props.actorSheet, callback);
  }
  __name(deleteMount, "deleteMount");
  function callback(button) {
    const parent = button.parent();
    if (parent.length) {
      const buttons = parent.find("button"), index2 = buttons.index(button);
      for (let i = index2; i < buttons.length; i++)
        mountIndices()[i] = mountIndices()[i] - 1;
      button.css("display", "none");
    }
  }
  __name(callback, "callback");
  var button_1 = root$x();
  set_class(button_1, `la-bckg-scrollbar-secondary la-text-header -fontsizemedium -letterspacing0 la-prmy-secondary la-scdy-accent -widthfull
        ${(qualityMode ? "-glow-prmy-hover -glow-scdy-focus" : "") ?? ""}
        gen-control`), set_attribute(button_1, "data-action", "splice"), button_1.__click = [on_click$4, deleteMount];
  var text2 = child(button_1);
  template_effect(
    ($0) => {
      set_attribute(button_1, "data-path", `system.loadout.weapon_mounts.${$$props.mountIndex}`), set_text(text2, `${$0 ?? ""} `);
    },
    [
      () => getLocalized(MOUNT_LOCALIZE_MAP[$$props.mount.type])
    ]
  ), append($$anchor, button_1), pop();
}
__name(MountDelete, "MountDelete");
delegate(["click"]);
var on_click$3 = /* @__PURE__ */ __name((event2, addMount) => addMount(event2), "on_click$3"), root$w = /* @__PURE__ */ template('<button type="button" data-action-value="(struct)wep_mount"><i class="mdi mdi-plus-box -verticalaligntop"></i></button>');
function MountAdd($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, tip = TooltipFactory.buildTooltip(getLocalized("LA.advanced.mount.add.tooltip"));
  function addMount(event2) {
    event2.stopPropagation(), TooltipFactory.unrenderTooltips();
  }
  __name(addMount, "addMount");
  var button = root$w();
  set_attribute(button, "data-path", "system.loadout.weapon_mounts"), set_attribute(button, "data-action", "append"), button.__click = [on_click$3, addMount], template_effect(
    ($0, $1) => {
      set_class(button, `${$0 ?? ""}
        gen-control`), set_attribute(button, "data-tooltip", $$props.tooltipEnabled ? tip : void 0), set_attribute(button, "data-tooltip-direction", TooltipDirection.RIGHT), set_attribute(button, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(button, "aria-label", $1);
    },
    [
      SETTINGS_BUTTON_STYLE$1,
      () => getLocalized("LA.advanced.mount.add.tooltip")
    ]
  ), event("pointerenter", button, (event2) => sendToTextConsole(event2, getLocalized("LA.advanced.mount.add.tooltip"), actorUuid)), event("pointerleave", button, (event2) => resetTextConsole(event2, actorUuid)), append($$anchor, button), pop();
}
__name(MountAdd, "MountAdd");
delegate(["click"]);
var root_1$i = /* @__PURE__ */ template('<div class="la-bckg-primary -fontsize4 -upper -padding0"> <i class="mdi mdi-arrow-down-right"></i></div> <div class="la-flexcol -widthfull -heightfull -gap0 -padding0"></div>', 1), root_6$o = /* @__PURE__ */ template('<i class="mdi mdi-arrow-up-drop-circle-outline -positionabsolute -left2 -fontsize4"></i>'), root_7$f = /* @__PURE__ */ template('<i class="mdi mdi-arrow-right-drop-circle-outline -positionabsolute -left2 -fontsize4"></i>'), root_4$b = /* @__PURE__ */ template('<button type="button"> <!></button>'), root_3$q = /* @__PURE__ */ template('<div class="la-bckg-primary -fontsize4 -upper -padding0"> <i class="mdi mdi-arrow-down-right"></i></div> <div class="la-flexcol -widthfull -heightfull -gap0 -padding0"></div>', 1), on_click$2 = /* @__PURE__ */ __name((event2, handleRemove, removeMount) => handleRemove(event2, removeMount), "on_click$2"), on_click_1$1 = /* @__PURE__ */ __name((event2, handleEdit, editMount) => handleEdit(event2, editMount), "on_click_1$1"), root$v = /* @__PURE__ */ template('<div><span> </span> <div class="la-flexcol -alignstart -padding0-b -heightfull"><!> <button type="button"><i class="mdi mdi-minus-box -verticalaligntop"></i></button>  <button type="button"><i class="mdi mdi-list-box -verticalaligntop"></i></button></div></div>');
function MountSettings($$anchor, $$props) {
  push($$props, !0);
  const removeMount = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment = root_1$i(), div = first_child(fragment), text2 = child(div), div_1 = sibling(div, 2);
    each(div_1, 21, () => get$1(weaponMounts), index, ($$anchor3, mount2, index2) => {
      MountDelete($$anchor3, {
        get actorSheet() {
          return get$1(document2)._sheet.actor;
        },
        get mount() {
          return get$1(mount2);
        },
        get mountIndex() {
          return mountIndices[index2];
        },
        get mountIndices() {
          return mountIndices;
        }
      });
    }), template_effect(($0) => set_text(text2, $0), [
      () => getLocalized("LA.advanced.mount.remove.label")
    ]), append($$anchor2, fragment);
  }, "removeMount"), editMount = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment_2 = root_3$q(), div_2 = first_child(fragment_2), text_1 = child(div_2), div_3 = sibling(div_2, 2);
    each(div_3, 21, () => get$1(weaponMounts), index, ($$anchor3, mount2, index2) => {
      var button = root_4$b();
      const dropdownContent = /* @__PURE__ */ __name(($$anchor4) => {
        MountOptions($$anchor4, {
          get actorSheet() {
            return get$1(document2)._sheet.actor;
          },
          get mount() {
            return get$1(mount2);
          },
          mountIndex: index2,
          get mountNames() {
            return mountNames;
          }
        });
      }, "dropdownContent");
      set_class(button, `la-bckg-scrollbar-secondary la-text-header -fontsizemedium -letterspacing0 la-prmy-secondary la-scdy-accent -widthfull
                ${(qualityMode ? "-glow-prmy-hover -glow-scdy-focus" : "") ?? ""}`), button.__click = (event2) => handleSelection(event2, dropdownContent, index2);
      var text_2 = child(button), node = sibling(text_2);
      {
        var consequent = /* @__PURE__ */ __name(($$anchor4) => {
          var i = root_6$o();
          append($$anchor4, i);
        }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor4) => {
          var i_1 = root_7$f();
          append($$anchor4, i_1);
        }, "alternate");
        if_block(node, ($$render) => {
          toggles[index2] ? $$render(consequent) : $$render(alternate, !1);
        });
      }
      template_effect(($0) => set_text(text_2, `${$0 ?? ""} `), [() => getLocalized(mountNames[index2])]), append($$anchor3, button);
    }), template_effect(($0) => set_text(text_1, $0), [
      () => getLocalized("LA.advanced.mount.edit.label")
    ]), append($$anchor2, fragment_2);
  }, "editMount"), props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), document2 = /* @__PURE__ */ derived(() => props.document), system = /* @__PURE__ */ derived(() => props.system);
  let advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), active = /* @__PURE__ */ derived(() => getActiveTab(get$1(actor).uuid, ActiveTab.Primary) || "loadout"), toggles = proxy(new Array(get$1(system).loadout.weapon_mounts.length).fill(!1)), tooltipElements = new Array(get$1(system).loadout.weapon_mounts.length).fill(null), removeToggle = state(!1), editToggle = state(!1), removeElement = null, editElement = null, mountNames = proxy(get$1(system).loadout.weapon_mounts.map((mount2) => MOUNT_LOCALIZE_MAP[mount2.type] || "")), mountIndices = proxy(get$1(system).loadout.weapon_mounts.map((_mount2, index2) => index2));
  const weaponMounts = /* @__PURE__ */ derived(() => get$1(system).loadout.weapon_mounts), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid)), tooltipEnabled = getMechSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), removeTip = TooltipFactory.buildTooltip(getLocalized("LA.advanced.mount.remove.tooltip")), editTip = TooltipFactory.buildTooltip(getLocalized("LA.advanced.mount.edit.tooltip"));
  function handleSelection(event2, snippet2, index2) {
    event2.stopPropagation();
    function clearOtherToggles() {
      toggles.forEach((toggle, jndex) => {
        toggle && jndex !== index2 && (TooltipFactory.unrenderTooltip(tooltipElements[jndex]), tooltipElements[jndex] = null, toggles[jndex] = !1);
      });
    }
    __name(clearOtherToggles, "clearOtherToggles");
    function clearToggles() {
      TooltipFactory.unrenderTooltip(tooltipElements[index2]), tooltipElements[index2] = null;
    }
    __name(clearToggles, "clearToggles"), clearOtherToggles(), toggles[index2] ? clearToggles() : tooltipElements[index2] = TooltipFactory.renderTooltipSvelte(event2, { content: snippet2 }, {
      direction: TooltipDirection.UP,
      cssClass: `la-tooltip -widthfull ${get$1(theme)}`,
      locked: !0
    }), toggles[index2] = !toggles[index2];
  }
  __name(handleSelection, "handleSelection");
  function handleRemove(event2, snippet2) {
    handleToggle(event2, snippet2, "remove");
  }
  __name(handleRemove, "handleRemove");
  function handleEdit(event2, snippet2) {
    handleToggle(event2, snippet2, "edit");
  }
  __name(handleEdit, "handleEdit");
  function handleToggle(event2, snippet2, type) {
    event2.stopPropagation();
    function clearOtherToggles() {
      toggles.forEach((toggle, index2) => {
        toggle && (TooltipFactory.unrenderTooltip(tooltipElements[index2]), tooltipElements[index2] = null, toggles[index2] = !1);
      }), TooltipFactory.unrenderTooltip(removeElement), removeElement = null, set(removeToggle, !1), TooltipFactory.unrenderTooltip(editElement), editElement = null, set(editToggle, !1);
    }
    __name(clearOtherToggles, "clearOtherToggles");
    function clearToggles() {
      type === "remove" ? (TooltipFactory.unrenderTooltip(removeElement), removeElement = null) : (toggles.forEach((toggle, index2) => {
        toggle && (TooltipFactory.unrenderTooltip(tooltipElements[index2]), tooltipElements[index2] = null, toggles[index2] = !1);
      }), TooltipFactory.unrenderTooltip(editElement), editElement = null);
    }
    if (__name(clearToggles, "clearToggles"), clearOtherToggles(), type === "remove" && get$1(removeToggle) || type === "edit" && get$1(editToggle))
      clearToggles();
    else {
      const element = TooltipFactory.renderTooltipSvelte(
        event2,
        {
          content: snippet2,
          unrenderCallback: clearToggles
        },
        {
          direction: TooltipDirection.RIGHT,
          cssClass: `la-tooltip -widthfull ${get$1(theme)}`,
          locked: !0
        }
      );
      type === "remove" ? removeElement = element : editElement = element;
    }
    type === "remove" ? set(removeToggle, !get$1(removeToggle)) : set(editToggle, !get$1(editToggle));
  }
  __name(handleToggle, "handleToggle");
  var div_4 = root$v(), span = child(div_4), text_3 = child(span), div_5 = sibling(span, 2), node_1 = child(div_5);
  const expression = /* @__PURE__ */ derived(getMechSheetTooltipEnabled);
  MountAdd(node_1, {
    get tooltipEnabled() {
      return get$1(expression);
    },
    get tooltipTheme() {
      return get$1(theme);
    }
  });
  var button_1 = sibling(node_1, 2);
  set_attribute(button_1, "data-tooltip", tooltipEnabled ? removeTip : void 0), button_1.__click = [on_click$2, handleRemove, removeMount];
  var button_2 = sibling(button_1, 2);
  set_attribute(button_2, "data-tooltip", tooltipEnabled ? editTip : void 0), button_2.__click = [on_click_1$1, handleEdit, editMount], template_effect(
    ($0, $1, $2, $3, $4) => {
      set_class(div_4, `-heightfull
    ${(get$1(advancedOptions) && get$1(active) === "loadout" ? "la-flexrow" : "-displaynone") ?? ""}`), set_class(span, `${$0 ?? ""} -alignend`), set_text(text_3, $1), set_class(button_1, $2), set_attribute(button_1, "data-tooltip-direction", TooltipDirection.RIGHT), set_attribute(button_1, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(button_1, "aria-label", $3), set_class(button_2, clsx($2)), set_attribute(button_2, "data-tooltip-direction", TooltipDirection.RIGHT), set_attribute(button_2, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(button_2, "aria-label", $4);
    },
    [
      SETTINGS_HEADER_STYLE$1,
      () => getLocalized("LA.advanced.mount.label"),
      SETTINGS_BUTTON_STYLE$1,
      () => getLocalized("LA.advanced.mount.remove.tooltip"),
      () => getLocalized("LA.advanced.mount.edit.tooltip")
    ]
  ), event("pointerenter", button_1, (event2) => sendToTextConsole(event2, getLocalized("LA.advanced.mount.remove.tooltip"), get$1(actor).uuid)), event("pointerleave", button_1, (event2) => resetTextConsole(event2, get$1(actor).uuid)), event("pointerenter", button_2, (event2) => sendToTextConsole(event2, getLocalized("LA.advanced.mount.edit.tooltip"), get$1(actor).uuid)), event("pointerleave", button_2, (event2) => resetTextConsole(event2, get$1(actor).uuid)), append($$anchor, div_4), pop();
}
__name(MountSettings, "MountSettings");
delegate(["click"]);
var root$u = /* @__PURE__ */ template('<div><span> </span> <div class="la-flexcol -alignstart -padding0-b -heightfull"><div class="inventory"><!></div></div></div>');
function InventorySettings($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), tooltipEnabled = getMechSheetTooltipEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), active = /* @__PURE__ */ derived(() => getActiveTab(get$1(actor).uuid, ActiveTab.Primary) || "loadout"), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  var div = root$u(), span = child(div), text2 = child(span), div_1 = sibling(span, 2), div_2 = child(div_1), node = child(div_2);
  const expression = /* @__PURE__ */ derived(() => [
    SETTINGS_BUTTON_STYLE$1(),
    "mdi mdi-archive -widthfull -heightfull"
  ]), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.advanced.inventory.open.tooltip"));
  GlyphButton(node, {
    get style() {
      return get$1(expression);
    },
    get flowClass() {
      return FlowClass.Inventory;
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_1);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    },
    logging: !0
  }), template_effect(
    ($0, $1) => {
      set_class(div, `-heightfull
    ${(get$1(advancedOptions) && get$1(active) === "loadout" ? "la-flexrow" : "-displaynone") ?? ""}`), set_class(span, `${$0 ?? ""} -alignend`), set_text(text2, $1);
    },
    [
      SETTINGS_HEADER_STYLE$1,
      () => getLocalized("LA.advanced.inventory.label")
    ]
  ), append($$anchor, div), pop();
}
__name(InventorySettings, "InventorySettings");
const SETTINGS_BUTTON_STYLE$1 = /* @__PURE__ */ __name(() => " la-text-secondary la-prmy-primary -fontsize5 -height4 " + (getExtraEffectsEnabled() ? "-glow-prmy-hover " : " "), "SETTINGS_BUTTON_STYLE$1"), SETTINGS_HEADER_STYLE$1 = /* @__PURE__ */ __name(() => " la-bckg-primary la-text-header clipped-top -width7 -padding0-b -padding1-t -fontface-stylized " + (logographicLanguage() ? "-fontsizemedium -padding0-lr" : "-fontsizemediumer -writingmode-v"), "SETTINGS_HEADER_STYLE$1");
var root$t = /* @__PURE__ */ template("<!> <!>", 1);
function AdvancedSettings$1($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]);
  setActorContext($$props.actor);
  var fragment = root$t(), node = first_child(fragment);
  InventorySettings(node, spread_props(() => props));
  var node_1 = sibling(node, 2);
  MountSettings(node_1, spread_props(() => props)), append($$anchor, fragment), pop();
}
__name(AdvancedSettings$1, "AdvancedSettings$1");
var on_input = /* @__PURE__ */ __name((event2, handleOnInput) => handleOnInput(event2), "on_input"), on_pointerup = /* @__PURE__ */ __name((event2, handleOnRelease) => handleOnRelease(event2), "on_pointerup"), root$s = /* @__PURE__ */ template('<div><input type="range"></div>');
function SidebarRatioSlider($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), uuid = /* @__PURE__ */ derived(() => props.uuid), ratioGetter = /* @__PURE__ */ derived(() => props.ratioGetter), ratioSetter = /* @__PURE__ */ derived(() => props.ratioSetter), style = /* @__PURE__ */ derived(() => props.style), tooltipEnabled = /* @__PURE__ */ derived(() => props.tooltipEnabled), tooltipClass = /* @__PURE__ */ derived(() => props.tooltipClass), tooltipTheme = /* @__PURE__ */ derived(() => props.tooltipTheme), logText = /* @__PURE__ */ derived(() => props.logText), logging = /* @__PURE__ */ derived(() => props.logging), actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid;
  let ratio = state(proxy(get$1(ratioGetter)(get$1(uuid)))), component = state(null), sidebar = null;
  const qualityMode = getExtraEffectsEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(uuid))), log = /* @__PURE__ */ derived(() => get$1(logText) || getLocalized("LA.advanced.sidebarRatio.tooltip")), tip = TooltipFactory.buildTooltip(getLocalized("LA.advanced.sidebarRatio.tooltip"));
  onMount(() => {
    get$1(component) && (sidebar = jQuery(get$1(component)).closest(".la-root").find(".la-sidebar"));
  });
  function handleOnInput(event2) {
    const target = event2.target, value = parseFloat(target.value);
    set(ratio, proxy(value)), sidebar && sidebar.css("flex", value.toString());
  }
  __name(handleOnInput, "handleOnInput");
  function handleOnRelease(event2) {
    const target = event2.target, value = parseFloat(target.value);
    set(ratio, proxy(value)), get$1(ratioSetter)(get$1(uuid), value);
  }
  __name(handleOnRelease, "handleOnRelease");
  var div = root$s(), input = child(div);
  set_class(input, `la-prmy-primary
            ${(qualityMode ? "-glow-prmy-hover" : "") ?? ""}`), set_attribute(input, "min", 0.5), set_attribute(input, "max", 2), set_attribute(input, "step", 0.1), input.__input = [on_input, handleOnInput], input.__pointerup = [on_pointerup, handleOnRelease], bind_this(div, ($$value) => set(component, $$value), () => get$1(component)), template_effect(
    ($0, $1) => {
      set_class(div, `la-range ${$0 ?? ""}
        ${(get$1(advancedOptions) ? "-displayblock" : "-displaynone") ?? ""}`), set_value(input, get$1(ratio)), set_attribute(input, "data-tooltip", get$1(tooltipEnabled) ? tip : void 0), set_attribute(input, "data-tooltip-class", `${get$1(tooltipClass) || "clipped-bot la-tooltip"} ${get$1(tooltipTheme)}`), set_attribute(input, "data-tooltip-direction", TooltipDirection.UP), set_attribute(input, "aria-label", $1);
    },
    [
      () => {
        var _a2;
        return (_a2 = get$1(style)) == null ? void 0 : _a2.join(" ");
      },
      () => getLocalized("LA.advanced.sidebarRatio.tooltip")
    ]
  ), event("pointerenter", input, function(...$$args) {
    var _a2;
    (_a2 = get$1(logging) ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
  }), event("pointerleave", input, function(...$$args) {
    var _a2;
    (_a2 = get$1(logging) ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
  }), append($$anchor, div), pop();
}
__name(SidebarRatioSlider, "SidebarRatioSlider");
delegate(["input", "pointerup"]);
var on_click$1 = /* @__PURE__ */ __name((event2, handleThemeOverride, theme) => handleThemeOverride(event2, get$1(theme)), "on_click$1"), root_2$d = /* @__PURE__ */ template('<button type="button" class="la-bckg-scrollbar-secondary la-text-header -fontsizemedium -letterspacing0 la-prmy-secondary -glow-prmy-hover -widthfull"> </button>'), on_click_1 = /* @__PURE__ */ __name((event2, handleThemeOverride) => handleThemeOverride(event2, "default"), "on_click_1"), root_1$h = /* @__PURE__ */ template('<div class="la-bckg-primary -fontsize4 -upper -padding0"> <i class="mdi mdi-arrow-down-right"></i></div> <div class="la-flexcol -widthfull -gap0 -padding0"><!> <button type="button" class="la-bckg-scrollbar-secondary la-text-header -fontsizemedium -letterspacing0 la-prmy-secondary -glow-prmy-hover la-scdy-accent -glow-scdy-focus -widthfull"> </button></div>', 1), on_click_2 = /* @__PURE__ */ __name((event2, handleOnClick) => handleOnClick(event2), "on_click_2"), root_3$p = /* @__PURE__ */ template('<button type="button"><i></i></button>');
function ThemeOverrideButton($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const themeOverride = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment = root_1$h(), div = first_child(fragment), text2 = child(div), div_1 = sibling(div, 2), node = child(div_1);
    each(node, 17, () => Object.values(ThemeKey), index, ($$anchor3, theme2, $$index, $$array) => {
      var button = root_2$d();
      button.__click = [on_click$1, handleThemeOverride, theme2];
      var text_1 = child(button);
      template_effect(($0) => set_text(text_1, $0), [() => getThemeName(get$1(theme2))]), append($$anchor3, button);
    });
    var button_1 = sibling(node, 2);
    button_1.__click = [on_click_1, handleThemeOverride];
    var text_2 = child(button_1);
    template_effect(
      ($0, $1) => {
        set_text(text2, $0), set_text(text_2, $1);
      },
      [
        () => getLocalized("LA.advanced.themeOverride.tooltip"),
        () => getLocalized("LA.advanced.theme.default.label")
      ]
    ), append($$anchor2, fragment);
  }, "themeOverride"), actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid;
  let toggle = state(!1), optionElement = null;
  const tip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip($$props.tooltip || getLocalized("LA.advanced.themeOverride.tooltip"), $$props.tooltipHeader)), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.advanced.themeOverride.tooltip")), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.uuid));
  function handleOnClick(event2) {
    event2.stopPropagation(), get$1(toggle) ? (TooltipFactory.unrenderTooltip(optionElement), optionElement = null) : optionElement = TooltipFactory.renderTooltipSvelte(
      event2,
      {
        content: themeOverride,
        unrenderCallback: /* @__PURE__ */ __name(() => {
          set(toggle, !1);
        }, "unrenderCallback")
      },
      {
        direction: TooltipDirection.DOWN,
        cssClass: `la-tooltip -widthfull ${get$1(theme)}`,
        locked: !0
      }
    ), set(toggle, !get$1(toggle));
  }
  __name(handleOnClick, "handleOnClick");
  function handleThemeOverride(event2, theme2) {
    event2.stopPropagation();
    const selectedTheme = theme2 === "default" ? "" : theme2;
    optionElement && (optionElement.classList.remove(getCSSDocumentTheme($$props.uuid)), selectedTheme ? optionElement.classList.add(convertToCSSTheme(selectedTheme)) : optionElement.classList.add(getCSSSystemTheme())), $$props.setOverride($$props.uuid, selectedTheme);
  }
  __name(handleThemeOverride, "handleThemeOverride");
  var fragment_1 = comment(), node_1 = first_child(fragment_1);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var button_2 = root_3$p();
      button_2.__click = [on_click_2, handleOnClick];
      var i = child(button_2);
      template_effect(
        ($0, $1, $2) => {
          set_class(button_2, `${$0 ?? ""} la-prmy-primary -glow-prmy-hover`), set_attribute(button_2, "data-tooltip", $$props.tooltipEnabled ? get$1(tip) : void 0), set_attribute(button_2, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${get$1(theme)}`), set_attribute(button_2, "data-tooltip-direction", $$props.tooltipDirection || TooltipDirection.UP), set_attribute(button_2, "aria-label", $1), set_class(i, `mdi mdi-notebook-edit ${$2 ?? ""}`);
        },
        [
          () => {
            var _a2;
            return (_a2 = $$props.style) == null ? void 0 : _a2.join(" ");
          },
          () => getLocalized("LA.advanced.themeOverride.tooltip"),
          () => {
            var _a2;
            return ((_a2 = $$props.iconStyle) == null ? void 0 : _a2.join(" ")) || "la-text-header -fontsize5";
          }
        ]
      ), event("pointerenter", button_2, function(...$$args) {
        var _a2;
        (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), event("pointerleave", button_2, function(...$$args) {
        var _a2;
        (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
      }), append($$anchor2, button_2);
    }, "consequent");
    if_block(node_1, ($$render) => {
      $$props.disabled || $$render(consequent);
    });
  }
  append($$anchor, fragment_1), pop();
}
__name(ThemeOverrideButton, "ThemeOverrideButton");
delegate(["click"]);
var root$r = /* @__PURE__ */ template("<!> <!>", 1);
function AdvancedSettingsNav$1($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor);
  setActorContext(get$1(actor));
  const tooltipEnabled = getMechSheetTooltipEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  var fragment = root$r(), node = first_child(fragment);
  SidebarRatioSlider(node, {
    get uuid() {
      return get$1(actor).uuid;
    },
    ratioGetter: getSidebarRatio,
    ratioSetter: setSidebarRatio,
    style: ["-aligncontentcenter"],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    logging: !0
  });
  var node_1 = sibling(node, 2);
  const expression = /* @__PURE__ */ derived(() => !get$1(advancedOptions));
  ThemeOverrideButton(node_1, {
    get disabled() {
      return get$1(expression);
    },
    get uuid() {
      return get$1(actor).uuid;
    },
    style: ["-alignselfstart"],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    setOverride: setThemeOverride$2,
    logging: !0
  }), append($$anchor, fragment), pop();
}
__name(AdvancedSettingsNav$1, "AdvancedSettingsNav$1");
var root$q = /* @__PURE__ */ template('<div class="-margin7-t"><!></div>');
function Activity$3($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor);
  setActorContext(get$1(actor));
  const actionLogSaveCollapse = getMechSheetLogActionDontSaveCollapse(), actionLogStartCollapsed = getMechSheetLogActionStartCollapsed();
  var div = root$q(), node = child(div);
  ActionLog(node, {
    get uuid() {
      return get$1(actor).uuid;
    },
    dontSaveCollapse: actionLogSaveCollapse,
    startCollapsed: actionLogStartCollapsed,
    get collapsePrefix() {
      return ActionLogCollapsePrefix.MechSheet;
    }
  }), append($$anchor, div), pop();
}
__name(Activity$3, "Activity$3");
const _MechSheetBase = class _MechSheetBase {
  static get mergeOptions() {
    return {
      classes: [
        "la-common la-override__header clipped-alt",
        "lancer sheet actor mech",
        getCSSSystemTheme()
      ],
      template: TEMPLATE_PATHS.mechSheetSvelte,
      width: 900,
      height: 800,
      tabs: [
        {
          navSelector: ".la-tabs",
          contentSelector: ".la-content",
          initial: "loadout"
        },
        {
          navSelector: ".la-tabs-secondary",
          contentSelector: ".la-content-secondary",
          initial: "statistics"
        }
      ],
      scrollY: [".la-status", ".la-loadout", ".la-custom", ".la-sidebar__statistics", ".la-sidebar__activity"]
    };
  }
  static setupSheet() {
    var _a;
    const LAMechSheet = (_a = class extends game.lancer.applications.LancerMechSheet {
      constructor(...args) {
        super(...args), Hooks.on("laOverrideTheme", (uuid, theme) => {
          uuid === this.actor.uuid && (setThemeKey(this.actor.uuid, theme), this.render());
        }), Hooks.on("laForceRerender", (uuid, callback) => {
          uuid === this.actor.uuid && (this.render(), callback && callback());
        }), Hooks.on("updateActor", (document2, changes) => {
          var _a2, _b;
          document2.uuid === this.actor.uuid && ((_b = (_a2 = changes.prototypeToken) == null ? void 0 : _a2.texture) != null && _b.src) && getActorTokenSync$2(this.actor.uuid) && (setSelectedTokenImage(this.actor.uuid, changes.prototypeToken.texture.src), isValidImageContainer(changes.prototypeToken.texture.src) && this.actor.update({ img: changes.prototypeToken.texture.src }));
        }), Hooks.on("closeSettingsConfig", () => {
          this.render(), setIntroRun(this.actor.uuid, !1);
        });
      }
      static get defaultOptions() {
        return foundry.utils.mergeObject(super.defaultOptions, _MechSheetBase.mergeOptions);
      }
      activateListeners(html2) {
        super.activateListeners(html2), this.applyTabListener(html2);
      }
      async getData() {
        return await super.getData();
      }
      /** (#10) - As of V12, there's a section of code in the Lancer system that bugs out actor/token image assignment in the AppV1 LancerActorSheet
       * ...
       * // Update token image if it matches the old actor image - keep in sync
       * if (this.actor.img === token.texture.src && this.actor.img !== formData["img"]) {
       *   formData["prototypeToken.texture.src"] = formData["img"];
       * }
       * ...
       * 
       * We need to ensure prototypeToken.texture.src exists to be set by Foundry
       */
      // @ts-expect-error We're overriding a function in LancerActorSheet
      _propagateData(formData) {
        super._propagateData(formData), delete formData["prototypeToken.texture.src"];
        const updateToken = getSelectedTokenImage(this.actor.uuid);
        updateToken && (formData["prototypeToken.texture.src"] = updateToken);
      }
      async _injectHTML(html2) {
        super._injectHTML(html2), setThemeKey(this.actor.uuid, getThemeOverride$2(this.actor.uuid)), applyThemeTo(this.element, getThemeKey(this.actor.uuid)), this.mountComponents(html2, dataMap[this.actor.uuid]);
      }
      async _replaceHTML(element, html2) {
        super._replaceHTML(element, html2), applyThemeTo(element, getThemeKey(this.actor.uuid)), this.mountComponents(html2, dataMap[this.actor.uuid]), this._restoreScrollPositions(html2);
      }
      mountComponents(html2, data) {
        unregisterTrackedHooks(this.actor.uuid), mount(Header$3, {
          target: html2.find(".la-SVELTE-HEADER")[0],
          props: data
        }), mount(AdvancedSettingsNav$1, {
          target: html2.find(".la-SVELTE-ADVANCEDNAV")[0],
          props: data
        }), mount(Sidebar$1, {
          target: html2.find(".la-SVELTE-SIDEBARSTATISTICS")[0],
          props: data
        }), mount(Activity$3, {
          target: html2.find(".la-SVELTE-SIDEBARACTIVITY")[0],
          props: data
        }), mount(Status$1, {
          target: html2.find(".la-SVELTE-STATUS")[0],
          props: data
        }), mount(AdvancedSettings$1, {
          target: html2.find(".la-SVELTE-ADVANCED")[0],
          props: data
        }), mount(Loadout$1, {
          target: html2.find(".la-SVELTE-LOADOUT")[0],
          props: data
        }), mount(Custom$3, {
          target: html2.find(".la-SVELTE-CUSTOM")[0],
          props: data
        }), mount(CustomToggle$3, {
          // (#14)
          target: html2.find(".la-tabs")[0],
          props: {
            actor: data.actor,
            button: html2.find('.la-tabs>[data-tab="custom"]')[0]
          }
        }), mount(HaseArray, {
          target: html2.find(".la-SVELTE-HASE")[0],
          props: {
            pilot: data.pilot,
            actor: data.actor,
            system: data.system,
            tooltipEnabled: getMechSheetTooltipEnabled(),
            logging: !0
          }
        });
      }
      applyTabListener(html2) {
        html2.find(".la-nav__island>.la-tabs>.la-tab").each((_, button) => {
          $(button).on("click", (event2) => {
            const tab = $(event2.currentTarget).data("tab");
            setActiveTab(this.actor.uuid, ActiveTab.Primary, tab);
          });
        }), html2.find(".la-nav-secondary__island>.la-tabs-secondary>.la-tab").each((_, button) => {
          $(button).on("click", (event2) => {
            const tab = $(event2.currentTarget).data("tab");
            setActiveTab(this.actor.uuid, ActiveTab.Secondary, tab);
          });
        });
      }
    }, __name(_a, "LAMechSheet"), _a);
    foundry.documents.collections.Actors.registerSheet(LancerAlternative.Name, LAMechSheet, {
      types: ["mech"],
      // Lancer system actor subtype (registered by the system at runtime)
      label: getLocalized("LA.SHEET.mech.label"),
      makeDefault: !1
    });
  }
};
__name(_MechSheetBase, "MechSheetBase");
let MechSheetBase = _MechSheetBase;
function ChargedBox($$anchor, $$props) {
  push($$props, !0);
  const charged = /* @__PURE__ */ derived(() => $$props.item.system.charged), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.npc.charged.tooltip"));
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.npc.charged.label")), expression_1 = /* @__PURE__ */ derived(() => get$1(charged) ? 1 : 0);
      CounterBox($$anchor2, {
        get text() {
          return get$1(expression);
        },
        get type() {
          return CounterBoxType.Charged;
        },
        get usesValue() {
          return get$1(expression_1);
        },
        usesMax: 1,
        get path() {
          return $$props.path;
        },
        get style() {
          return $$props.style;
        },
        get logText() {
          return get$1(log);
        },
        get logging() {
          return $$props.logging;
        },
        get onPointerClick() {
          return $$props.onPointerClick;
        }
      });
    }, "consequent");
    if_block(node, ($$render) => {
      isRecharge($$props.item) && $$render(consequent);
    });
  }
  append($$anchor, fragment), pop();
}
__name(ChargedBox, "ChargedBox");
var root_2$c = /* @__PURE__ */ template('<span class="la-flexrow -justifycenter -aligncenter -fontsize5 -padding0-lr"> <i class="cci cci-accuracy -fontsize6"></i></span>'), root_3$o = /* @__PURE__ */ template('<span class="la-flexrow -justifycenter -aligncenter -fontsize5 -padding0-lr"> <i class="cci cci-reticule -fontsize4"></i></span>'), root_1$g = /* @__PURE__ */ template('<div class="-widthfull -padding2-l"><div class="la-flexrow clipped-bot-alt la-text-header la-bckg-header-anti -widthfull -fontface-stylized"><!> <!> <!> <!> <!></div></div>'), root_6$n = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_7$e = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_5$m = /* @__PURE__ */ template('<!> <div class="la-flexcol -margin3-lr"><!> <!></div>', 1), root_8$c = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!></div>');
function WeaponItem($$anchor, $$props) {
  push($$props, !0);
  const outerContent = /* @__PURE__ */ __name(($$anchor2) => {
    var div = root_1$g(), div_1 = child(div), node = child(div_1);
    {
      var consequent = /* @__PURE__ */ __name(($$anchor3) => {
        var span = root_2$c();
        set_attribute(span, "data-tooltip", tooltipEnabled ? accuracyTip : void 0);
        var text2 = child(span);
        template_effect(() => {
          set_attribute(span, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text2, `${$$props.weapon.system.accuracy[$$props.tier - 1] ?? ""} `);
        }), append($$anchor3, span);
      }, "consequent");
      if_block(node, ($$render) => {
        hasAccuracyBonus($$props.weapon) && $$render(consequent);
      });
    }
    var node_1 = sibling(node, 2);
    {
      var consequent_1 = /* @__PURE__ */ __name(($$anchor3) => {
        var span_1 = root_3$o();
        set_attribute(span_1, "data-tooltip", tooltipEnabled ? attackTip : void 0);
        var text_1 = child(span_1);
        template_effect(() => {
          set_attribute(span_1, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span_1, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text_1, `${$$props.weapon.system.attack_bonus[$$props.tier - 1] ?? ""} `);
        }), append($$anchor3, span_1);
      }, "consequent_1");
      if_block(node_1, ($$render) => {
        hasAttackBonus($$props.weapon) && $$render(consequent_1);
      });
    }
    var node_2 = sibling(node_1, 2);
    const expression = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.weapon.index}.system.charged`);
    ChargedBox(node_2, {
      get item() {
        return $$props.weapon;
      },
      get path() {
        return get$1(expression);
      }
    });
    var node_3 = sibling(node_2, 2);
    const expression_1 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.weapon.index}.system.loaded`);
    LoadedBox(node_3, {
      get item() {
        return $$props.weapon;
      },
      get path() {
        return get$1(expression_1);
      }
    });
    var node_4 = sibling(node_3, 2);
    const expression_2 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.weapon.index}.system.uses`);
    LimitedBox(node_4, {
      get usesValue() {
        return $$props.weapon.system.uses.value;
      },
      get usesMax() {
        return $$props.weapon.system.uses.max;
      },
      get path() {
        return get$1(expression_2);
      }
    }), append($$anchor2, div);
  }, "outerContent"), headerTertiaryLeftOptions = /* @__PURE__ */ __name(($$anchor2) => {
    const expression_3 = /* @__PURE__ */ derived(() => [
      H3_ICON_SIZE,
      getIconStyle($$props.weapon),
      "cci cci-weapon"
    ]), expression_4 = /* @__PURE__ */ derived(() => `system.loadout.weapon_mounts.${$$props.index}`), expression_5 = /* @__PURE__ */ derived(() => $$props.weapon.system.effect ? `${getRollWeaponTip($$props.weapon)}<br><br>${$$props.weapon.system.effect}` : getRollWeaponTip($$props.weapon)), expression_6 = /* @__PURE__ */ derived(() => isDestroyed($$props.weapon));
    AttackButton($$anchor2, {
      get iconStyle() {
        return get$1(expression_3);
      },
      iconBackgroundStyle: [
        "la-prmy-secondary",
        H3_ICON_SIZE,
        qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
      ],
      get flowClass() {
        return FlowClass.RollAttack;
      },
      get path() {
        return get$1(expression_4);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltip() {
        return get$1(expression_5);
      },
      get disabled() {
        return get$1(expression_6);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(attackButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(attackButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerTertiaryLeftOptions"), headerTertiaryRightOptions = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment_1 = root_5$m(), node_5 = first_child(fragment_1);
    const expression_7 = /* @__PURE__ */ derived(() => isDestroyed($$props.weapon) ? ["la-text-repcap"] : void 0), expression_8 = /* @__PURE__ */ derived(() => isDestroyed($$props.weapon));
    DamageButton(node_5, {
      get iconStyle() {
        return get$1(expression_7);
      },
      iconBackgroundStyle: [
        "-fontsize9 la-prmy-secondary",
        qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
      ],
      get flowClass() {
        return FlowClass.RollDamage;
      },
      get range() {
        return $$props.weapon.system.range;
      },
      get damage() {
        return $$props.weapon.system.damage[$$props.tier - 1];
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get disabled() {
        return get$1(expression_8);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(damageButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(damageButtonHover, !1);
      }, "onPointerLeave")
    });
    var div_2 = sibling(node_5, 2), node_6 = child(div_2);
    const expression_9 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE()]), expression_10 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
    GlyphButton(node_6, {
      get style() {
        return get$1(expression_9);
      },
      get flowClass() {
        return FlowClass.None;
      },
      get uuid() {
        return $$props.weapon.uuid;
      },
      get index() {
        return $$props.weapon.index;
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_10);
      },
      onClick: /* @__PURE__ */ __name((event2) => sendToChat(event2, $$props.weapon), "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(messageButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(messageButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var i = root_6$n();
        append($$anchor3, i);
      }, "children"),
      $$slots: { default: !0 }
    });
    var node_7 = sibling(node_6, 2);
    const expression_11 = /* @__PURE__ */ derived(() => [
      H2_BUTTON_ICON_STYLE(),
      "la-flexcol -padding0-lr"
    ]), expression_12 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.weapon.index}`), expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
    GlyphButton(node_7, {
      get style() {
        return get$1(expression_11);
      },
      get flowClass() {
        return FlowClass.ContextMenu;
      },
      get path() {
        return get$1(expression_12);
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_13);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var i_1 = root_7$e();
        append($$anchor3, i_1);
      }, "children"),
      $$slots: { default: !0 }
    }), append($$anchor2, fragment_1);
  }, "headerTertiaryRightOptions");
  let attackButtonHover = state(!1), damageButtonHover = state(!1), messageButtonHover = state(!1), editButtonHover = state(!1);
  const qualityMode = getExtraEffectsEnabled(), tooltipEnabled = getNPCSheetTooltipEnabled(), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), accuracyTip = TooltipFactory.buildTooltip(getLocalized("LA.npc.accuracy.tooltip")), attackTip = TooltipFactory.buildTooltip(getLocalized("LA.npc.attackBonus.tooltip"));
  function renderOuter(item) {
    return !isDestroyed(item) && (isRecharge(item) || item.system.uses.max || isLoading(item) || hasAccuracyBonus(item) || hasAttackBonus(item));
  }
  __name(renderOuter, "renderOuter");
  function hasAccuracyBonus(item) {
    return item.system.accuracy.some((accuracy) => accuracy !== 0);
  }
  __name(hasAccuracyBonus, "hasAccuracyBonus");
  function hasAttackBonus(item) {
    return item.system.attack_bonus.some((bonus) => bonus !== 0);
  }
  __name(hasAttackBonus, "hasAttackBonus");
  function isDestroyed(item) {
    return item.system.destroyed;
  }
  __name(isDestroyed, "isDestroyed");
  function getTitleStyle(item) {
    return isDestroyed(item) ? "la-text-repcap -strikethrough" : "la-text-header";
  }
  __name(getTitleStyle, "getTitleStyle");
  function getSubtitleStyle(item) {
    return isDestroyed(item) ? `la-text-error la-prmy-error ${photosensitiveStyling("horus--very--subtle")}` : "la-text-header la-prmy-header";
  }
  __name(getSubtitleStyle, "getSubtitleStyle");
  function getIconStyle(item) {
    return isDestroyed(item) ? "la-text-repcap" : "la-text-header la-prmy-header la-scdy-primary " + (qualityMode ? "-glow-prmy -glow-scdy-hover " : " ");
  }
  __name(getIconStyle, "getIconStyle");
  function getRollWeaponTip(item) {
    return formatString(getLocalized("LA.flow.rollAttack.template.tooltip"), item.name);
  }
  __name(getRollWeaponTip, "getRollWeaponTip");
  function sendToChat(event2, item) {
    var _a;
    if (event2.stopPropagation(), (_a = $$props.actor) != null && _a.uuid && item) {
      let accuracy = "";
      item.system.accuracy[$$props.tier - 1] > 0 && (accuracy = `<div class="la-flexrow">${item.system.accuracy[$$props.tier - 1]}<i class="cci cci-accuracy -fontsize6"></i></div>`);
      let attackBonus = "";
      item.system.attack_bonus[$$props.tier - 1] > 0 && (attackBonus = `<div class="la-flexrow" style="align-items: anchor-center;">${item.system.attack_bonus[$$props.tier - 1]}<i class="cci cci-reticule -fontsize4 -padding0"></i></div>`);
      let range = "";
      item.system.range.map((rng) => {
        range += `<div class="la-flexrow">${rng.val}<i class="cci cci-${rng.type.toLowerCase()} -fontsize6"></i></div>`;
      });
      let damage = "";
      item.system.damage[$$props.tier - 1].map((dmg) => {
        damage += `<div class="la-flexrow">${dmg.val}<i class="cci cci-${dmg.type.toLowerCase()} -fontsize6"></i></div>`;
      });
      const description = `
                <div 
                    class="la-flexrow -justifyevenly clipped-alt -fontsize5 -padding0-tb -padding1-lr"
                    style="
                        background-color: var(--weapon-color);
                        color: var(--light-text);
                        align-items: baseline;
                    "
                >
                    ${accuracy}
                    ${attackBonus}
                    ${range}
                    ${damage}
                </div>
            `;
      let chatData = {
        title: item.name,
        description: accuracy || attackBonus || range || damage ? description : "",
        trigger: item.system.trigger,
        effect: item.system.effect,
        onHit: item.system.on_hit,
        tags: item.system.tags,
        color: CHAT_CARD_COLOR_MAP[ChatCardType.Weapon]
      };
      SendUnknownToChatBase.getInstance().startFlow($$props.actor.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendToChat, "sendToChat");
  const expression_14 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.weapon.index}`), expression_15 = /* @__PURE__ */ derived(() => [
    H2_TEXT_SIZE,
    getTitleStyle($$props.weapon),
    "-fontface-stylized"
  ]), expression_16 = /* @__PURE__ */ derived(() => isDestroyed($$props.weapon) ? getLocalized("LA.mech.slot.destroyed.label") : $$props.weapon.system.weapon_type), expression_17 = /* @__PURE__ */ derived(() => [
    getSubtitleStyle($$props.weapon),
    "-fontsizesmall -fontface-stylized"
  ]), expression_18 = /* @__PURE__ */ derived(() => renderOuter($$props.weapon) ? outerContent : void 0);
  HeaderTertiary($$anchor, {
    get itemID() {
      return $$props.weapon.id;
    },
    get uuid() {
      return $$props.weapon.uuid;
    },
    get path() {
      return get$1(expression_14);
    },
    acceptTypes: "npc_feature",
    get collapseID() {
      return $$props.weapon.uuid;
    },
    startCollapsed: !0,
    get text() {
      return $$props.weapon.name;
    },
    headerStyle: [H3_HEADER_STYLE, "la-bckg-pilot"],
    get headerFontStyle() {
      return get$1(expression_15);
    },
    get subText() {
      return get$1(expression_16);
    },
    get subHeaderFontStyle() {
      return get$1(expression_17);
    },
    borderStyle: ["-bordersoff"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(attackButtonHover)) return `--${getLocalized("LA.flow.rollAttack.extension")}`;
      if (get$1(damageButtonHover)) return `--${getLocalized("LA.flow.rollDamage.extension")}`;
      if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
      if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
    }, "extensionTextFunction"),
    get renderOutsideCollapse() {
      return get$1(expression_18);
    },
    contentLeft: headerTertiaryLeftOptions,
    contentRight: headerTertiaryRightOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div_3 = root_8$c(), node_8 = child(div_3);
      const expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.effect.label"));
      EffectBox(node_8, {
        get name() {
          return get$1(expression_19);
        },
        get effect() {
          return $$props.weapon.system.effect;
        },
        tooltipEnabled
      });
      var node_9 = sibling(node_8, 2);
      const expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.effect.hit.label"));
      EffectBox(node_9, {
        get name() {
          return get$1(expression_20);
        },
        get effect() {
          return $$props.weapon.system.on_hit;
        },
        tooltipEnabled
      });
      var node_10 = sibling(node_9, 2);
      TagArray(node_10, {
        get tags() {
          return $$props.weapon.system.tags;
        },
        justify: "end",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        }
      }), append($$anchor2, div_3);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(WeaponItem, "WeaponItem");
var root_3$n = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>');
function Weapons($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let collapseAllButtonHover = state(!1);
  const tooltipEnabled = getNPCSheetTooltipEnabled(), tier = /* @__PURE__ */ derived(() => $$props.system.tier), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.weapons`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  var fragment_1 = comment(), node = first_child(fragment_1);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.weapons.label"));
      HeaderMain($$anchor2, {
        get text() {
          return get$1(expression);
        },
        headerStyle: [MAIN_HEADER_STYLE, "la-bckg-weapon"],
        textStyle: ["la-text-header -fontsize4 -overflowhidden"],
        borderStyle: ["la-brdr-weapon -gap0"],
        extensionTextFunction: /* @__PURE__ */ __name(() => {
          if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
        }, "extensionTextFunction"),
        get collapseID() {
          return get$1(collID);
        },
        startCollapsed: !0,
        headerContent: headerOptions,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var div = root_3$n();
          each(div, 21, () => $$props.weapons, index, ($$anchor4, weapon, index2) => {
            WeaponItem($$anchor4, {
              get actor() {
                return $$props.actor;
              },
              get tier() {
                return get$1(tier);
              },
              get weapon() {
                return get$1(weapon);
              },
              index: index2
            });
          }), append($$anchor3, div);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.weapons.length && $$render(consequent);
    });
  }
  append($$anchor, fragment_1), pop();
}
__name(Weapons, "Weapons");
var root_1$f = /* @__PURE__ */ template('<div class="-widthfull -padding2-l"><div class="la-flexrow clipped-bot-alt la-text-header la-bckg-header-anti -widthfull -fontface-stylized"><!> <!> <!></div></div>'), root_5$l = /* @__PURE__ */ template('<i class="mdi mdi-star la-text-warning"></i>'), root_6$m = /* @__PURE__ */ template('<i class="mdi mdi-star"></i>'), root_7$d = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_8$b = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_3$m = /* @__PURE__ */ template("<!> <!> <!>", 1), root_11$d = /* @__PURE__ */ template('<span class="la-flexrow -justifycenter -aligncenter -fontsize5 -height3"> <i class="cci cci-reticule -fontsize4"></i></span>'), root_12$9 = /* @__PURE__ */ template('<span class="la-flexrow -justifycenter -aligncenter -fontsize5 -height3"> <i class="cci cci-accuracy -fontsize6"></i></span>'), root_10$c = /* @__PURE__ */ template('<div class="la-flexrow -gap0 -widthfull"><!> <!></div>'), root_9$f = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!></div>');
function SystemItem($$anchor, $$props) {
  push($$props, !0);
  const outerContent = /* @__PURE__ */ __name(($$anchor2) => {
    var div = root_1$f(), div_1 = child(div), node = child(div_1);
    const expression = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.component.index}.system.charged`);
    ChargedBox(node, {
      get item() {
        return $$props.component;
      },
      get path() {
        return get$1(expression);
      }
    });
    var node_1 = sibling(node, 2);
    const expression_1 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.component.index}.system.loaded`);
    LoadedBox(node_1, {
      get item() {
        return $$props.component;
      },
      get path() {
        return get$1(expression_1);
      }
    });
    var node_2 = sibling(node_1, 2);
    const expression_2 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.component.index}.system.uses`);
    LimitedBox(node_2, {
      get usesValue() {
        return $$props.component.system.uses.value;
      },
      get usesMax() {
        return $$props.component.system.uses.max;
      },
      get path() {
        return get$1(expression_2);
      }
    }), append($$anchor2, div);
  }, "outerContent"), headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor2) => {
    const expression_3 = /* @__PURE__ */ derived(() => [
      getIconStyle($$props.component),
      "cci cci-system -fontsize7"
    ]), expression_4 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.component.index}`), expression_5 = /* @__PURE__ */ derived(() => $$props.component.system.effect || getLocalized("LA.mech.mod.effect.tooltip")), expression_6 = /* @__PURE__ */ derived(() => isDestroyed($$props.component));
    EffectButton($$anchor2, {
      get iconStyle() {
        return get$1(expression_3);
      },
      iconBackgroundStyle: [
        "-fontsize7 la-prmy-secondary",
        qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
      ],
      get flowClass() {
        return FlowClass.SendEffectToChat;
      },
      get path() {
        return get$1(expression_4);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltip() {
        return get$1(expression_5);
      },
      get disabled() {
        return get$1(expression_6);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(effectButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(effectButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment_1 = root_3$m(), node_3 = first_child(fragment_1);
    const expression_7 = /* @__PURE__ */ derived(() => [
      H2_BUTTON_ICON_STYLE(),
      "la-flexcol -padding0-lr"
    ]), expression_8 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.component.index}`), expression_9 = /* @__PURE__ */ derived(() => getLocalized($$props.pinned ? "LA.pin.unpinned.tooltip" : "LA.pin.pinned.tooltip"));
    GlyphButton(node_3, {
      get style() {
        return get$1(expression_7);
      },
      get flowClass() {
        return FlowClass.None;
      },
      get path() {
        return get$1(expression_8);
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_9);
      },
      onClick: /* @__PURE__ */ __name((event2) => {
        $$props.pinned ? unpinItem(event2, $$props.component) : pinItem(event2, $$props.component);
      }, "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(pinButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(pinButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var fragment_2 = comment(), node_4 = first_child(fragment_2);
        {
          var consequent = /* @__PURE__ */ __name(($$anchor4) => {
            var i = root_5$l();
            append($$anchor4, i);
          }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor4) => {
            var i_1 = root_6$m();
            append($$anchor4, i_1);
          }, "alternate");
          if_block(node_4, ($$render) => {
            $$props.pinned ? $$render(consequent) : $$render(alternate, !1);
          });
        }
        append($$anchor3, fragment_2);
      }, "children"),
      $$slots: { default: !0 }
    });
    var node_5 = sibling(node_3, 2);
    const expression_10 = /* @__PURE__ */ derived(() => [
      H2_BUTTON_ICON_STYLE(),
      "la-flexcol -padding0-lr"
    ]), expression_11 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.component.index}`), expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
    GlyphButton(node_5, {
      get style() {
        return get$1(expression_10);
      },
      get flowClass() {
        return FlowClass.ContextMenu;
      },
      get path() {
        return get$1(expression_11);
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_12);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var i_2 = root_7$d();
        append($$anchor3, i_2);
      }, "children"),
      $$slots: { default: !0 }
    });
    var node_6 = sibling(node_5, 2);
    const expression_13 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
    GlyphButton(node_6, {
      get style() {
        return get$1(expression_13);
      },
      get flowClass() {
        return FlowClass.SendEffectToChat;
      },
      type: "system",
      get index() {
        return $$props.component.index;
      },
      get uuid() {
        return $$props.component.uuid;
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_14);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(messageButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(messageButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var i_3 = root_8$b();
        append($$anchor3, i_3);
      }, "children"),
      $$slots: { default: !0 }
    }), append($$anchor2, fragment_1);
  }, "headerSecondaryRightOptions");
  let effectButtonHover = state(!1), editButtonHover = state(!1), messageButtonHover = state(!1), pinButtonHover = state(!1);
  const qualityMode = getExtraEffectsEnabled(), tooltipEnabled = getNPCSheetTooltipEnabled(), tier = /* @__PURE__ */ derived(() => $$props.system.tier), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function renderOuter(item) {
    return !isDestroyed(item) && (isLoading(item) || isRecharge(item) || item.system.uses.max);
  }
  __name(renderOuter, "renderOuter");
  function hasAccuracyBonus(item) {
    return item.system.accuracy.some((accuracy) => accuracy !== 0);
  }
  __name(hasAccuracyBonus, "hasAccuracyBonus");
  function hasAttackBonus(item) {
    return item.system.attack_bonus.some((bonus) => bonus !== 0);
  }
  __name(hasAttackBonus, "hasAttackBonus");
  function isDestroyed(item) {
    return item.system.destroyed;
  }
  __name(isDestroyed, "isDestroyed");
  function getHeaderStyle(item) {
    return isDestroyed(item) ? `la-text-error la-prmy-error -strikethrough ${photosensitiveStyling("horus--very--subtle")}` : "la-text-header la-prmy-header";
  }
  __name(getHeaderStyle, "getHeaderStyle");
  function getIconStyle(item) {
    return isDestroyed(item) ? "la-text-repcap" : "la-text-header";
  }
  __name(getIconStyle, "getIconStyle");
  async function pinItem(event2, item) {
    if (event2.stopPropagation(), !item.system.lid) {
      Logger.error("Tried pinning an NPC system that had no LID");
      return;
    }
    const currentPinned = NPCStore.get($$props.actor.uuid).pinnedTraits || [], newPinned = Array.from(/* @__PURE__ */ new Set([...currentPinned, item.system.lid]));
    NPCStore.set($$props.actor.uuid, { pinnedSystems: newPinned });
  }
  __name(pinItem, "pinItem");
  async function unpinItem(event2, item) {
    if (event2.stopPropagation(), !item.system.lid) {
      Logger.error("Tried unpinning an NPC system that had no LID");
      return;
    }
    const newPinned = (NPCStore.get($$props.actor.uuid).pinnedTraits || []).filter((lid) => lid !== item.system.lid);
    NPCStore.set($$props.actor.uuid, { pinnedSystems: newPinned });
  }
  __name(unpinItem, "unpinItem");
  const expression_15 = /* @__PURE__ */ derived(() => [
    getHeaderStyle($$props.component),
    "-fontsizemedium -overflowhidden -fontface-stylized"
  ]), expression_16 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.component.index}`), expression_17 = /* @__PURE__ */ derived(() => renderOuter($$props.component) ? outerContent : void 0);
  HeaderSecondary($$anchor, {
    get text() {
      return $$props.component.name;
    },
    headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
    get textStyle() {
      return get$1(expression_15);
    },
    borderStyle: ["-bordersoff"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(effectButtonHover)) return `--${getLocalized("LA.use.label")}`;
      if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
      if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
      if (get$1(pinButtonHover)) return `--${getLocalized($$props.pinned ? "LA.pin.unpinned.extension" : "LA.pin.pinned.extension")}`;
    }, "extensionTextFunction"),
    get itemID() {
      return $$props.component.id;
    },
    get uuid() {
      return $$props.component.uuid;
    },
    get path() {
      return get$1(expression_16);
    },
    acceptTypes: "npc_feature",
    get collapseID() {
      return $$props.component.uuid;
    },
    startCollapsed: !0,
    get renderOutsideCollapse() {
      return get$1(expression_17);
    },
    contentLeft: headerSecondaryLeftOptions2,
    contentRight: headerSecondaryRightOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div_2 = root_9$f(), node_7 = child(div_2);
      {
        var consequent_1 = /* @__PURE__ */ __name(($$anchor3) => {
          var div_3 = root_10$c(), node_8 = child(div_3);
          const expression_18 = /* @__PURE__ */ derived(() => getLocalized("LA.npc.attackBonus.label")), expression_19 = /* @__PURE__ */ derived(() => [
            hasAccuracyBonus($$props.component) ? "-bordersround" : "-bordersround-ltb"
          ]);
          EffectBox(node_8, {
            get name() {
              return get$1(expression_18);
            },
            get outerStyle() {
              return get$1(expression_19);
            },
            tooltipEnabled,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var span = root_11$d(), text2 = child(span);
              template_effect(() => set_text(text2, `${$$props.component.system.attack_bonus[get$1(tier) - 1] ?? ""} `)), append($$anchor4, span);
            }, "children"),
            $$slots: { default: !0 }
          });
          var node_9 = sibling(node_8, 2);
          const expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.npc.accuracy.label"));
          EffectBox(node_9, {
            get name() {
              return get$1(expression_20);
            },
            tooltipEnabled,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var span_1 = root_12$9(), text_1 = child(span_1);
              template_effect(() => set_text(text_1, `${$$props.component.system.accuracy[get$1(tier) - 1] ?? ""} `)), append($$anchor4, span_1);
            }, "children"),
            $$slots: { default: !0 }
          }), append($$anchor3, div_3);
        }, "consequent_1");
        if_block(node_7, ($$render) => {
          (hasAttackBonus($$props.component) || hasAccuracyBonus($$props.component)) && $$render(consequent_1);
        });
      }
      var node_10 = sibling(node_7, 2);
      const expression_21 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.effect.label"));
      EffectBox(node_10, {
        get name() {
          return get$1(expression_21);
        },
        tooltipEnabled,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps2) => {
          var fragment_4 = comment(), node_11 = first_child(fragment_4);
          html(node_11, () => $$props.component.system.effect), append($$anchor3, fragment_4);
        }, "children"),
        $$slots: { default: !0 }
      });
      var node_12 = sibling(node_10, 2);
      const expression_22 = /* @__PURE__ */ derived(() => getLocalized("LA.effect.hit.label"));
      EffectBox(node_12, {
        get name() {
          return get$1(expression_22);
        },
        get effect() {
          return $$props.component.system.on_hit;
        },
        tooltipEnabled
      });
      var node_13 = sibling(node_12, 2);
      TagArray(node_13, {
        get tags() {
          return $$props.component.system.tags;
        },
        justify: "end",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        }
      }), append($$anchor2, div_2);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(SystemItem, "SystemItem");
var root_4$a = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>'), root_5$k = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>'), root_6$l = /* @__PURE__ */ template('<div class="-widthfull"><!></div>'), root_3$l = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"><div></div> <div><!> <div></div> <!></div> <div class="-displaynone" aria-hidden="true"></div></div>');
function Systems($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let collapseAllButtonHover = state(!1);
  const tooltipEnabled = getNPCSheetTooltipEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.systems`), pinCollID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.systems.pins`), nonpinCollID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.systems.nonpins`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), pinnedSet = /* @__PURE__ */ derived(() => new Set(NPCStore.get($$props.actor.uuid).pinnedSystems ?? [])), pinnedSystems = /* @__PURE__ */ derived(() => $$props.systems.filter((s) => get$1(pinnedSet).has(s.system.lid))), hasPinned = /* @__PURE__ */ derived(() => get$1(pinnedSystems).length > 0);
  let pinnedContainer = state(void 0), unpinnedContainer = state(void 0), noSectionsContainer = state(void 0);
  function placeItem(node, container) {
    return container == null || container.appendChild(node), {
      update(newContainer) {
        newContainer == null || newContainer.appendChild(node);
      },
      destroy() {
        node.remove();
      }
    };
  }
  __name(placeItem, "placeItem");
  var fragment_1 = comment(), node_1 = first_child(fragment_1);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.systems.label"));
      HeaderMain($$anchor2, {
        get text() {
          return get$1(expression);
        },
        headerStyle: [MAIN_HEADER_STYLE, "la-bckg-system"],
        textStyle: [
          "la-text-header -fontsize4 -overflowhidden -upper"
        ],
        borderStyle: ["la-brdr-system -gap0"],
        extensionTextFunction: /* @__PURE__ */ __name(() => {
          if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
        }, "extensionTextFunction"),
        get collapseID() {
          return get$1(collID);
        },
        startCollapsed: !0,
        headerContent: headerOptions,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var div = root_3$l(), div_1 = child(div);
          bind_this(div_1, ($$value) => set(noSectionsContainer, $$value), () => get$1(noSectionsContainer));
          var div_2 = sibling(div_1, 2), node_2 = child(div_2);
          const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pin.pinned.label"));
          HeaderSecondary(node_2, {
            get text() {
              return get$1(expression_1);
            },
            headerStyle: [
              "clipped-bot-alt la-bckg-primary -letterspacing0 la-text-header la-prmy-header -padding2-l -padding0-tb -fontsizemedium -fontface-stylized"
            ],
            get collapseID() {
              return get$1(pinCollID);
            },
            startCollapsed: !1,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var div_3 = root_4$a();
              bind_this(div_3, ($$value) => set(pinnedContainer, $$value), () => get$1(pinnedContainer)), append($$anchor4, div_3);
            }, "children"),
            $$slots: { default: !0 }
          });
          var node_3 = sibling(node_2, 4);
          const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pin.unpinned.label"));
          HeaderSecondary(node_3, {
            get text() {
              return get$1(expression_2);
            },
            headerStyle: [
              "clipped-bot-alt la-bckg-weapon -letterspacing0 la-text-header la-prmy-header -padding2-l -padding0-tb -fontsizemedium"
            ],
            get collapseID() {
              return get$1(nonpinCollID);
            },
            startCollapsed: !1,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var div_4 = root_5$k();
              bind_this(div_4, ($$value) => set(unpinnedContainer, $$value), () => get$1(unpinnedContainer)), append($$anchor4, div_4);
            }, "children"),
            $$slots: { default: !0 }
          });
          var div_5 = sibling(div_2, 2);
          each(div_5, 21, () => $$props.systems, (component) => component.uuid, ($$anchor4, component) => {
            var div_6 = root_6$l();
            const container = /* @__PURE__ */ derived(() => get$1(hasPinned) ? get$1(pinnedSet).has(get$1(component).system.lid) ? get$1(pinnedContainer) : get$1(unpinnedContainer) : get$1(noSectionsContainer));
            var node_4 = child(div_6);
            const expression_3 = /* @__PURE__ */ derived(() => get$1(pinnedSet).has(get$1(component).system.lid));
            SystemItem(node_4, {
              get actor() {
                return $$props.actor;
              },
              get system() {
                return $$props.system;
              },
              get component() {
                return get$1(component);
              },
              get pinned() {
                return get$1(expression_3);
              }
            }), action(div_6, ($$node, $$action_arg) => placeItem == null ? void 0 : placeItem($$node, $$action_arg), () => get$1(container)), append($$anchor4, div_6);
          }), template_effect(() => {
            set_class(div_1, `la-flexcol -gap0 -widthfull
                ${(get$1(hasPinned) ? "-displaynone" : "") ?? ""}`), set_class(div_2, `-widthfull
                ${(get$1(hasPinned) ? "" : "-displaynone") ?? ""}`);
          }), append($$anchor3, div);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent");
    if_block(node_1, ($$render) => {
      $$props.systems.length && $$render(consequent);
    });
  }
  append($$anchor, fragment_1), pop();
}
__name(Systems, "Systems");
var root_1$e = /* @__PURE__ */ template('<div class="-widthfull -padding2-l"><div class="la-flexrow clipped-bot-alt la-text-header la-bckg-header-anti -widthfull -fontface-stylized"><!> <!> <!></div></div>'), root_5$j = /* @__PURE__ */ template('<i class="mdi mdi-star la-text-warning"></i>'), root_6$k = /* @__PURE__ */ template('<i class="mdi mdi-star"></i>'), root_7$c = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_8$a = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_3$k = /* @__PURE__ */ template("<!> <!> <!>", 1), root_9$e = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!></div>');
function TraitItem($$anchor, $$props) {
  push($$props, !0);
  const outerContent = /* @__PURE__ */ __name(($$anchor2) => {
    var div = root_1$e(), div_1 = child(div), node = child(div_1);
    const expression = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.trait.index}.system.charged`);
    ChargedBox(node, {
      get item() {
        return $$props.trait;
      },
      get path() {
        return get$1(expression);
      }
    });
    var node_1 = sibling(node, 2);
    const expression_1 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.trait.index}.system.loaded`);
    LoadedBox(node_1, {
      get item() {
        return $$props.trait;
      },
      get path() {
        return get$1(expression_1);
      }
    });
    var node_2 = sibling(node_1, 2);
    const expression_2 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.trait.index}.system.uses`);
    LimitedBox(node_2, {
      get usesValue() {
        return $$props.trait.system.uses.value;
      },
      get usesMax() {
        return $$props.trait.system.uses.max;
      },
      get path() {
        return get$1(expression_2);
      }
    }), append($$anchor2, div);
  }, "outerContent"), headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor2) => {
    const expression_3 = /* @__PURE__ */ derived(() => [
      getIconStyle($$props.trait),
      "cci cci-trait -fontsize7"
    ]), expression_4 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.trait.index}`), expression_5 = /* @__PURE__ */ derived(() => $$props.trait.system.effect || getLocalized("LA.mech.mod.effect.tooltip")), expression_6 = /* @__PURE__ */ derived(() => isDestroyed($$props.trait));
    EffectButton($$anchor2, {
      get iconStyle() {
        return get$1(expression_3);
      },
      iconBackgroundStyle: [
        "-fontsize7 la-prmy-secondary",
        qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
      ],
      get flowClass() {
        return FlowClass.SendEffectToChat;
      },
      get path() {
        return get$1(expression_4);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltip() {
        return get$1(expression_5);
      },
      get disabled() {
        return get$1(expression_6);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(effectButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(effectButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment_1 = root_3$k(), node_3 = first_child(fragment_1);
    const expression_7 = /* @__PURE__ */ derived(() => [
      H2_BUTTON_ICON_STYLE(),
      "la-flexcol -padding0-lr"
    ]), expression_8 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.trait.index}`), expression_9 = /* @__PURE__ */ derived(() => getLocalized($$props.pinned ? "LA.pin.unpinned.tooltip" : "LA.pin.pinned.tooltip"));
    GlyphButton(node_3, {
      get style() {
        return get$1(expression_7);
      },
      get flowClass() {
        return FlowClass.None;
      },
      get path() {
        return get$1(expression_8);
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_9);
      },
      onClick: /* @__PURE__ */ __name((event2) => {
        $$props.pinned ? unpinItem(event2, $$props.trait) : pinItem(event2, $$props.trait);
      }, "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(pinButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(pinButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var fragment_2 = comment(), node_4 = first_child(fragment_2);
        {
          var consequent = /* @__PURE__ */ __name(($$anchor4) => {
            var i = root_5$j();
            append($$anchor4, i);
          }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor4) => {
            var i_1 = root_6$k();
            append($$anchor4, i_1);
          }, "alternate");
          if_block(node_4, ($$render) => {
            $$props.pinned ? $$render(consequent) : $$render(alternate, !1);
          });
        }
        append($$anchor3, fragment_2);
      }, "children"),
      $$slots: { default: !0 }
    });
    var node_5 = sibling(node_3, 2);
    const expression_10 = /* @__PURE__ */ derived(() => [
      H2_BUTTON_ICON_STYLE(),
      "la-flexcol -padding0-lr"
    ]), expression_11 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.trait.index}`), expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
    GlyphButton(node_5, {
      get style() {
        return get$1(expression_10);
      },
      get flowClass() {
        return FlowClass.ContextMenu;
      },
      get path() {
        return get$1(expression_11);
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_12);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var i_2 = root_7$c();
        append($$anchor3, i_2);
      }, "children"),
      $$slots: { default: !0 }
    });
    var node_6 = sibling(node_5, 2);
    const expression_13 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
    GlyphButton(node_6, {
      get style() {
        return get$1(expression_13);
      },
      get flowClass() {
        return FlowClass.SendEffectToChat;
      },
      type: "trait",
      get index() {
        return $$props.trait.index;
      },
      get uuid() {
        return $$props.trait.uuid;
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_14);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(messageButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(messageButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var i_3 = root_8$a();
        append($$anchor3, i_3);
      }, "children"),
      $$slots: { default: !0 }
    }), append($$anchor2, fragment_1);
  }, "headerSecondaryRightOptions");
  let effectButtonHover = state(!1), editButtonHover = state(!1), messageButtonHover = state(!1), pinButtonHover = state(!1);
  const qualityMode = getExtraEffectsEnabled(), tooltipEnabled = getNPCSheetTooltipEnabled(), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function renderOuter(item) {
    return !isDestroyed(item) && (item.system.uses.max || isLoading(item) || isRecharge(item));
  }
  __name(renderOuter, "renderOuter");
  function getHeaderStyle(item) {
    return isDestroyed(item) ? `la-text-error la-prmy-error -strikethrough ${photosensitiveStyling("horus--very--subtle")}` : "la-text-header la-prmy-header";
  }
  __name(getHeaderStyle, "getHeaderStyle");
  function getIconStyle(item) {
    return isDestroyed(item) ? "la-text-repcap" : "la-text-header";
  }
  __name(getIconStyle, "getIconStyle");
  function isDestroyed(item) {
    return item.system.destroyed;
  }
  __name(isDestroyed, "isDestroyed");
  async function pinItem(event2, item) {
    if (event2.stopPropagation(), !item.system.lid) {
      Logger.error("Tried pinning an NPC trait that had no LID");
      return;
    }
    const currentPinned = NPCStore.get($$props.actor.uuid).pinnedTraits || [], newPinned = Array.from(/* @__PURE__ */ new Set([...currentPinned, item.system.lid]));
    NPCStore.set($$props.actor.uuid, { pinnedTraits: newPinned });
  }
  __name(pinItem, "pinItem");
  async function unpinItem(event2, item) {
    if (event2.stopPropagation(), !item.system.lid) {
      Logger.error("Tried unpinning an NPC trait that had no LID");
      return;
    }
    const newPinned = (NPCStore.get($$props.actor.uuid).pinnedTraits || []).filter((lid) => lid !== item.system.lid);
    NPCStore.set($$props.actor.uuid, { pinnedTraits: newPinned });
  }
  __name(unpinItem, "unpinItem");
  const expression_15 = /* @__PURE__ */ derived(() => [
    getHeaderStyle($$props.trait),
    "-fontsizemedium -overflowhidden -fontface-stylized"
  ]), expression_16 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.trait.index}`), expression_17 = /* @__PURE__ */ derived(() => renderOuter($$props.trait) ? outerContent : void 0);
  HeaderSecondary($$anchor, {
    get text() {
      return $$props.trait.name;
    },
    headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
    get textStyle() {
      return get$1(expression_15);
    },
    borderStyle: ["-bordersoff"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(effectButtonHover)) return `--${getLocalized("LA.use.label")}`;
      if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
      if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
      if (get$1(pinButtonHover)) return `--${getLocalized($$props.pinned ? "LA.pin.unpinned.extension" : "LA.pin.pinned.extension")}`;
    }, "extensionTextFunction"),
    get itemID() {
      return $$props.trait.system.lid;
    },
    get uuid() {
      return $$props.trait.uuid;
    },
    get path() {
      return get$1(expression_16);
    },
    acceptTypes: "npc_feature",
    get collapseID() {
      return $$props.trait.uuid;
    },
    startCollapsed: !0,
    get renderOutsideCollapse() {
      return get$1(expression_17);
    },
    contentLeft: headerSecondaryLeftOptions2,
    contentRight: headerSecondaryRightOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div_2 = root_9$e(), node_7 = child(div_2);
      const expression_18 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.effect.label"));
      EffectBox(node_7, {
        get name() {
          return get$1(expression_18);
        },
        tooltipEnabled,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps2) => {
          var fragment_4 = comment(), node_8 = first_child(fragment_4);
          html(node_8, () => $$props.trait.system.effect), append($$anchor3, fragment_4);
        }, "children"),
        $$slots: { default: !0 }
      });
      var node_9 = sibling(node_7, 2);
      const expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.effect.hit.label"));
      EffectBox(node_9, {
        get name() {
          return get$1(expression_19);
        },
        get effect() {
          return $$props.trait.system.on_hit;
        },
        tooltipEnabled
      });
      var node_10 = sibling(node_9, 2);
      TagArray(node_10, {
        get tags() {
          return $$props.trait.system.tags;
        },
        justify: "end",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        }
      }), append($$anchor2, div_2);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(TraitItem, "TraitItem");
var root_4$9 = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>'), root_5$i = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>'), root_6$j = /* @__PURE__ */ template('<div class="-widthfull"><!></div>'), root_3$j = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"><div></div> <div><!> <div></div> <!></div> <div class="-displaynone" aria-hidden="true"></div></div>');
function Traits($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let collapseAllButtonHover = state(!1);
  const tooltipEnabled = getNPCSheetTooltipEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.traits`), pinCollID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.traits.pins`), nonpinCollID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.traits.nonpins`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), pinnedSet = /* @__PURE__ */ derived(() => new Set(NPCStore.get($$props.actor.uuid).pinnedTraits ?? [])), pinnedTraits = /* @__PURE__ */ derived(() => $$props.traits.filter((t) => get$1(pinnedSet).has(t.system.lid))), hasPinned = /* @__PURE__ */ derived(() => get$1(pinnedTraits).length > 0);
  let pinnedContainer = state(void 0), unpinnedContainer = state(void 0), noSectionsContainer = state(void 0);
  function placeItem(node, container) {
    return container == null || container.appendChild(node), {
      update(newContainer) {
        newContainer == null || newContainer.appendChild(node);
      },
      destroy() {
        node.remove();
      }
    };
  }
  __name(placeItem, "placeItem");
  var fragment_1 = comment(), node_1 = first_child(fragment_1);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.npc.traits.label"));
      HeaderMain($$anchor2, {
        get text() {
          return get$1(expression);
        },
        headerStyle: [MAIN_HEADER_STYLE, "la-bckg-action--downtime"],
        textStyle: ["la-text-header -fontsize4 -overflowhidden"],
        borderStyle: ["la-brdr-action--downtime"],
        extensionTextFunction: /* @__PURE__ */ __name(() => {
          if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
        }, "extensionTextFunction"),
        get collapseID() {
          return get$1(collID);
        },
        startCollapsed: !0,
        headerContent: headerOptions,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var div = root_3$j(), div_1 = child(div);
          bind_this(div_1, ($$value) => set(noSectionsContainer, $$value), () => get$1(noSectionsContainer));
          var div_2 = sibling(div_1, 2), node_2 = child(div_2);
          const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pin.pinned.label"));
          HeaderSecondary(node_2, {
            get text() {
              return get$1(expression_1);
            },
            headerStyle: [
              "clipped-bot-alt la-bckg-primary -letterspacing0 la-text-header la-prmy-header -padding2-l -padding0-tb -fontsizemedium"
            ],
            get collapseID() {
              return get$1(pinCollID);
            },
            startCollapsed: !1,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var div_3 = root_4$9();
              bind_this(div_3, ($$value) => set(pinnedContainer, $$value), () => get$1(pinnedContainer)), append($$anchor4, div_3);
            }, "children"),
            $$slots: { default: !0 }
          });
          var node_3 = sibling(node_2, 4);
          const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pin.unpinned.label"));
          HeaderSecondary(node_3, {
            get text() {
              return get$1(expression_2);
            },
            headerStyle: [
              "clipped-bot-alt la-bckg-weapon -letterspacing0 la-text-header la-prmy-header -padding2-l -padding0-tb -fontsizemedium"
            ],
            get collapseID() {
              return get$1(nonpinCollID);
            },
            startCollapsed: !1,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var div_4 = root_5$i();
              bind_this(div_4, ($$value) => set(unpinnedContainer, $$value), () => get$1(unpinnedContainer)), append($$anchor4, div_4);
            }, "children"),
            $$slots: { default: !0 }
          });
          var div_5 = sibling(div_2, 2);
          each(div_5, 21, () => $$props.traits, (trait) => trait.uuid, ($$anchor4, trait) => {
            var div_6 = root_6$j();
            const container = /* @__PURE__ */ derived(() => get$1(hasPinned) ? get$1(pinnedSet).has(get$1(trait).system.lid) ? get$1(pinnedContainer) : get$1(unpinnedContainer) : get$1(noSectionsContainer));
            var node_4 = child(div_6);
            const expression_3 = /* @__PURE__ */ derived(() => get$1(pinnedSet).has(get$1(trait).system.lid));
            TraitItem(node_4, {
              get actor() {
                return $$props.actor;
              },
              get trait() {
                return get$1(trait);
              },
              get pinned() {
                return get$1(expression_3);
              }
            }), action(div_6, ($$node, $$action_arg) => placeItem == null ? void 0 : placeItem($$node, $$action_arg), () => get$1(container)), append($$anchor4, div_6);
          }), template_effect(() => {
            set_class(div_1, `la-flexcol -gap0 -widthfull
                ${(get$1(hasPinned) ? "-displaynone" : "") ?? ""}`), set_class(div_2, `-widthfull 
                ${(get$1(hasPinned) ? "" : "-displaynone") ?? ""}`);
          }), append($$anchor3, div);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent");
    if_block(node_1, ($$render) => {
      $$props.traits.length && $$render(consequent);
    });
  }
  append($$anchor, fragment_1), pop();
}
__name(Traits, "Traits");
var root_1$d = /* @__PURE__ */ template('<div class="-widthfull -padding2-l"><div class="la-flexrow clipped-bot-alt la-text-header la-bckg-header-anti -widthfull -padding2-l -fontface-stylized"><!> <!> <!></div></div>'), root_5$h = /* @__PURE__ */ template('<i class="mdi mdi-star la-text-warning"></i>'), root_6$i = /* @__PURE__ */ template('<i class="mdi mdi-star"></i>'), root_7$b = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_8$9 = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_3$i = /* @__PURE__ */ template("<!> <!> <!>", 1), root_11$c = /* @__PURE__ */ template('<span class="la-flexrow -justifycenter -aligncenter -fontsize5 -height3"> <i class="cci cci-reticule -fontsize4"></i></span>'), root_12$8 = /* @__PURE__ */ template('<span class="la-flexrow -justifycenter -aligncenter -fontsize5 -height3"> <i class="cci cci-accuracy -fontsize6"></i></span>'), root_10$b = /* @__PURE__ */ template('<div class="la-flexrow -gap0 -widthfull"><!> <!></div>'), root_9$d = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!> <!></div>');
function ReactionItem($$anchor, $$props) {
  push($$props, !0);
  const outerContent = /* @__PURE__ */ __name(($$anchor2) => {
    var div = root_1$d(), div_1 = child(div), node = child(div_1);
    const expression = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.reaction.index}.system.charged`);
    ChargedBox(node, {
      get item() {
        return $$props.reaction;
      },
      get path() {
        return get$1(expression);
      }
    });
    var node_1 = sibling(node, 2);
    const expression_1 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.reaction.index}.system.loaded`);
    LoadedBox(node_1, {
      get item() {
        return $$props.reaction;
      },
      get path() {
        return get$1(expression_1);
      }
    });
    var node_2 = sibling(node_1, 2);
    const expression_2 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.reaction.index}.system.uses`);
    LimitedBox(node_2, {
      get usesValue() {
        return $$props.reaction.system.uses.value;
      },
      get usesMax() {
        return $$props.reaction.system.uses.max;
      },
      get path() {
        return get$1(expression_2);
      }
    }), append($$anchor2, div);
  }, "outerContent"), headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor2) => {
    const expression_3 = /* @__PURE__ */ derived(() => [
      getIconStyle($$props.reaction),
      "cci cci-reaction -fontsize7"
    ]), expression_4 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.reaction.index}`), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.action.reaction.label")), expression_6 = /* @__PURE__ */ derived(() => getReactionTooltip($$props.reaction)), expression_7 = /* @__PURE__ */ derived(() => isDestroyed($$props.reaction));
    EffectButton($$anchor2, {
      get iconStyle() {
        return get$1(expression_3);
      },
      iconBackgroundStyle: [
        "-fontsize7 la-prmy-secondary",
        qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
      ],
      get flowClass() {
        return FlowClass.SendEffectToChat;
      },
      get path() {
        return get$1(expression_4);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipHeader() {
        return get$1(expression_5);
      },
      get tooltip() {
        return get$1(expression_6);
      },
      get disabled() {
        return get$1(expression_7);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(effectButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(effectButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment_1 = root_3$i(), node_3 = first_child(fragment_1);
    const expression_8 = /* @__PURE__ */ derived(() => [
      H2_BUTTON_ICON_STYLE(),
      "la-flexcol -padding0-lr"
    ]), expression_9 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.reaction.index}`), expression_10 = /* @__PURE__ */ derived(() => getLocalized($$props.pinned ? "LA.pin.unpinned.tooltip" : "LA.pin.pinned.tooltip"));
    GlyphButton(node_3, {
      get style() {
        return get$1(expression_8);
      },
      get flowClass() {
        return FlowClass.None;
      },
      get path() {
        return get$1(expression_9);
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_10);
      },
      onClick: /* @__PURE__ */ __name((event2) => {
        $$props.pinned ? unpinItem(event2, $$props.reaction) : pinItem(event2, $$props.reaction);
      }, "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(pinButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(pinButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var fragment_2 = comment(), node_4 = first_child(fragment_2);
        {
          var consequent = /* @__PURE__ */ __name(($$anchor4) => {
            var i = root_5$h();
            append($$anchor4, i);
          }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor4) => {
            var i_1 = root_6$i();
            append($$anchor4, i_1);
          }, "alternate");
          if_block(node_4, ($$render) => {
            $$props.pinned ? $$render(consequent) : $$render(alternate, !1);
          });
        }
        append($$anchor3, fragment_2);
      }, "children"),
      $$slots: { default: !0 }
    });
    var node_5 = sibling(node_3, 2);
    const expression_11 = /* @__PURE__ */ derived(() => [
      H2_BUTTON_ICON_STYLE(),
      "la-flexcol -padding0-lr"
    ]), expression_12 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.reaction.index}`), expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
    GlyphButton(node_5, {
      get style() {
        return get$1(expression_11);
      },
      get flowClass() {
        return FlowClass.ContextMenu;
      },
      get path() {
        return get$1(expression_12);
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_13);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var i_2 = root_7$b();
        append($$anchor3, i_2);
      }, "children"),
      $$slots: { default: !0 }
    });
    var node_6 = sibling(node_5, 2);
    const expression_14 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
    GlyphButton(node_6, {
      get style() {
        return get$1(expression_14);
      },
      get flowClass() {
        return FlowClass.None;
      },
      get uuid() {
        return $$props.reaction.uuid;
      },
      get index() {
        return $$props.reaction.index;
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_15);
      },
      onClick: /* @__PURE__ */ __name((event2) => sendToChat(event2, $$props.reaction), "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(messageButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(messageButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var i_3 = root_8$9();
        append($$anchor3, i_3);
      }, "children"),
      $$slots: { default: !0 }
    }), append($$anchor2, fragment_1);
  }, "headerSecondaryRightOptions");
  let effectButtonHover = state(!1), editButtonHover = state(!1), messageButtonHover = state(!1), pinButtonHover = state(!1);
  const qualityMode = getExtraEffectsEnabled(), tooltipEnabled = getNPCSheetTooltipEnabled(), tier = /* @__PURE__ */ derived(() => $$props.system.tier), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function getReactionTooltip(item) {
    return item.system.effect ? `
                ${getLocalized("LA.trigger.label")}: ${item.system.trigger}
                <br><br>
                ${getLocalized("LA.mech.system.effect.label")}: ${item.system.effect}
                <br><br>
                ${getLocalized("LA.action.reaction.tooltip")}` : getLocalized("LA.action.reaction.tooltip");
  }
  __name(getReactionTooltip, "getReactionTooltip");
  function renderOuter(item) {
    return !isDestroyed(item) && (isLoading(item) || isRecharge(item) || item.system.uses.max);
  }
  __name(renderOuter, "renderOuter");
  function hasAccuracyBonus(item) {
    return item.system.accuracy.some((accuracy) => accuracy !== 0);
  }
  __name(hasAccuracyBonus, "hasAccuracyBonus");
  function hasAttackBonus(item) {
    return item.system.attack_bonus.some((bonus) => bonus !== 0);
  }
  __name(hasAttackBonus, "hasAttackBonus");
  function isDestroyed(item) {
    return item.system.destroyed;
  }
  __name(isDestroyed, "isDestroyed");
  function getHeaderStyle(item) {
    return isDestroyed(item) ? `la-text-error la-prmy-error -strikethrough ${photosensitiveStyling("horus--very--subtle")}` : "la-text-header la-prmy-header";
  }
  __name(getHeaderStyle, "getHeaderStyle");
  function getIconStyle(item) {
    return isDestroyed(item) ? "la-text-repcap" : "la-text-header";
  }
  __name(getIconStyle, "getIconStyle");
  function sendToChat(event2, item) {
    var _a;
    if (event2.stopPropagation(), (_a = $$props.actor) != null && _a.uuid && item) {
      let chatData = {
        title: item.name,
        trigger: item.system.trigger,
        effect: item.system.effect,
        tags: item.system.tags,
        color: CHAT_CARD_COLOR_MAP[ChatCardType.Reaction]
      };
      SendUnknownToChatBase.getInstance().startFlow($$props.actor.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendToChat, "sendToChat");
  async function pinItem(event2, item) {
    if (event2.stopPropagation(), !item.system.lid) {
      Logger.error("Tried pinning an NPC system that had no LID");
      return;
    }
    const currentPinned = NPCStore.get($$props.actor.uuid).pinnedReactions || [], newPinned = Array.from(/* @__PURE__ */ new Set([...currentPinned, item.system.lid]));
    NPCStore.set($$props.actor.uuid, { pinnedReactions: newPinned });
  }
  __name(pinItem, "pinItem");
  async function unpinItem(event2, item) {
    if (event2.stopPropagation(), !item.system.lid) {
      Logger.error("Tried unpinning an NPC system that had no LID");
      return;
    }
    const newPinned = (NPCStore.get($$props.actor.uuid).pinnedReactions || []).filter((lid) => lid !== item.system.lid);
    NPCStore.set($$props.actor.uuid, { pinnedReactions: newPinned });
  }
  __name(unpinItem, "unpinItem");
  const expression_16 = /* @__PURE__ */ derived(() => [
    getHeaderStyle($$props.reaction),
    "-fontsizemedium -overflowhidden -fontface-stylized"
  ]), expression_17 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.reaction.index}`), expression_18 = /* @__PURE__ */ derived(() => renderOuter($$props.reaction) ? outerContent : void 0);
  HeaderSecondary($$anchor, {
    get text() {
      return $$props.reaction.name;
    },
    headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
    get textStyle() {
      return get$1(expression_16);
    },
    borderStyle: ["-bordersoff"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(effectButtonHover)) return `--${getLocalized("LA.use.label")}`;
      if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
      if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
      if (get$1(pinButtonHover)) return `--${getLocalized($$props.pinned ? "LA.pin.unpinned.extension" : "LA.pin.pinned.extension")}`;
    }, "extensionTextFunction"),
    get itemID() {
      return $$props.reaction.id;
    },
    get uuid() {
      return $$props.reaction.uuid;
    },
    get path() {
      return get$1(expression_17);
    },
    acceptTypes: "npc_feature",
    get collapseID() {
      return $$props.reaction.uuid;
    },
    startCollapsed: !0,
    get renderOutsideCollapse() {
      return get$1(expression_18);
    },
    contentLeft: headerSecondaryLeftOptions2,
    contentRight: headerSecondaryRightOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div_2 = root_9$d(), node_7 = child(div_2);
      {
        var consequent_1 = /* @__PURE__ */ __name(($$anchor3) => {
          var div_3 = root_10$b(), node_8 = child(div_3);
          const expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.npc.attackBonus.label")), expression_20 = /* @__PURE__ */ derived(() => [
            hasAccuracyBonus($$props.reaction) ? "-bordersround" : "-bordersround-ltb"
          ]);
          EffectBox(node_8, {
            get name() {
              return get$1(expression_19);
            },
            get outerStyle() {
              return get$1(expression_20);
            },
            tooltipEnabled,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var span = root_11$c(), text2 = child(span);
              template_effect(() => set_text(text2, `${$$props.reaction.system.attack_bonus[get$1(tier) - 1] ?? ""} `)), append($$anchor4, span);
            }, "children"),
            $$slots: { default: !0 }
          });
          var node_9 = sibling(node_8, 2);
          const expression_21 = /* @__PURE__ */ derived(() => getLocalized("LA.npc.accuracy.label"));
          EffectBox(node_9, {
            get name() {
              return get$1(expression_21);
            },
            tooltipEnabled,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var span_1 = root_12$8(), text_1 = child(span_1);
              template_effect(() => set_text(text_1, `${$$props.reaction.system.accuracy[get$1(tier) - 1] ?? ""} `)), append($$anchor4, span_1);
            }, "children"),
            $$slots: { default: !0 }
          }), append($$anchor3, div_3);
        }, "consequent_1");
        if_block(node_7, ($$render) => {
          (hasAttackBonus($$props.reaction) || hasAccuracyBonus($$props.reaction)) && $$render(consequent_1);
        });
      }
      var node_10 = sibling(node_7, 2);
      const expression_22 = /* @__PURE__ */ derived(() => getLocalized("LA.trigger.label"));
      EffectBox(node_10, {
        get name() {
          return get$1(expression_22);
        },
        tooltipEnabled,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps2) => {
          var fragment_4 = comment(), node_11 = first_child(fragment_4);
          html(node_11, () => $$props.reaction.system.trigger), append($$anchor3, fragment_4);
        }, "children"),
        $$slots: { default: !0 }
      });
      var node_12 = sibling(node_10, 2);
      const expression_23 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.effect.label"));
      EffectBox(node_12, {
        get name() {
          return get$1(expression_23);
        },
        get effect() {
          return $$props.reaction.system.effect;
        },
        tooltipEnabled
      });
      var node_13 = sibling(node_12, 2);
      const expression_24 = /* @__PURE__ */ derived(() => getLocalized("LA.effect.hit.label"));
      EffectBox(node_13, {
        get name() {
          return get$1(expression_24);
        },
        get effect() {
          return $$props.reaction.system.on_hit;
        },
        tooltipEnabled
      });
      var node_14 = sibling(node_13, 2);
      TagArray(node_14, {
        get tags() {
          return $$props.reaction.system.tags;
        },
        justify: "end",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        }
      }), append($$anchor2, div_2);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(ReactionItem, "ReactionItem");
var root_4$8 = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>'), root_5$g = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>'), root_6$h = /* @__PURE__ */ template('<div class="-widthfull"><!></div>'), root_3$h = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"><div></div> <div><!> <div></div> <!></div> <div class="-displaynone" aria-hidden="true"></div></div>');
function Reactions($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let collapseAllButtonHover = state(!1);
  const tooltipEnabled = getNPCSheetTooltipEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.reactions`), pinCollID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.reactions.pins`), nonpinCollID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.reactions.nonpins`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), pinnedSet = /* @__PURE__ */ derived(() => new Set(NPCStore.get($$props.actor.uuid).pinnedReactions ?? [])), pinnedReactions = /* @__PURE__ */ derived(() => $$props.reactions.filter((r2) => get$1(pinnedSet).has(r2.system.lid))), hasPinned = /* @__PURE__ */ derived(() => get$1(pinnedReactions).length > 0);
  let pinnedContainer = state(void 0), unpinnedContainer = state(void 0), noSectionsContainer = state(void 0);
  function placeItem(node, container) {
    return container == null || container.appendChild(node), {
      update(newContainer) {
        newContainer == null || newContainer.appendChild(node);
      },
      destroy() {
        node.remove();
      }
    };
  }
  __name(placeItem, "placeItem");
  var fragment_1 = comment(), node_1 = first_child(fragment_1);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.npc.reactions.label"));
      HeaderMain($$anchor2, {
        get text() {
          return get$1(expression);
        },
        headerStyle: [MAIN_HEADER_STYLE, "la-bckg-action--reaction"],
        textStyle: ["la-text-header -fontsize4 -overflowhidden"],
        borderStyle: ["la-brdr-action--reaction -gap0"],
        extensionTextFunction: /* @__PURE__ */ __name(() => {
          if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
        }, "extensionTextFunction"),
        get collapseID() {
          return get$1(collID);
        },
        startCollapsed: !0,
        headerContent: headerOptions,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var div = root_3$h(), div_1 = child(div);
          bind_this(div_1, ($$value) => set(noSectionsContainer, $$value), () => get$1(noSectionsContainer));
          var div_2 = sibling(div_1, 2), node_2 = child(div_2);
          const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pin.pinned.label"));
          HeaderSecondary(node_2, {
            get text() {
              return get$1(expression_1);
            },
            headerStyle: [
              "clipped-bot-alt la-bckg-primary -letterspacing0 la-text-header la-prmy-header -padding2-l -padding0-tb -fontsizemedium"
            ],
            get collapseID() {
              return get$1(pinCollID);
            },
            startCollapsed: !1,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var div_3 = root_4$8();
              bind_this(div_3, ($$value) => set(pinnedContainer, $$value), () => get$1(pinnedContainer)), append($$anchor4, div_3);
            }, "children"),
            $$slots: { default: !0 }
          });
          var node_3 = sibling(node_2, 4);
          const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pin.unpinned.label"));
          HeaderSecondary(node_3, {
            get text() {
              return get$1(expression_2);
            },
            headerStyle: [
              "clipped-bot-alt la-bckg-weapon -letterspacing0 la-text-header la-prmy-header -padding2-l -padding0-tb -fontsizemedium"
            ],
            get collapseID() {
              return get$1(nonpinCollID);
            },
            startCollapsed: !1,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var div_4 = root_5$g();
              bind_this(div_4, ($$value) => set(unpinnedContainer, $$value), () => get$1(unpinnedContainer)), append($$anchor4, div_4);
            }, "children"),
            $$slots: { default: !0 }
          });
          var div_5 = sibling(div_2, 2);
          each(div_5, 21, () => $$props.reactions, (reaction) => reaction.uuid, ($$anchor4, reaction) => {
            var div_6 = root_6$h();
            const container = /* @__PURE__ */ derived(() => get$1(hasPinned) ? get$1(pinnedSet).has(get$1(reaction).system.lid) ? get$1(pinnedContainer) : get$1(unpinnedContainer) : get$1(noSectionsContainer));
            var node_4 = child(div_6);
            const expression_3 = /* @__PURE__ */ derived(() => get$1(pinnedSet).has(get$1(reaction).system.lid));
            ReactionItem(node_4, {
              get actor() {
                return $$props.actor;
              },
              get system() {
                return $$props.system;
              },
              get reaction() {
                return get$1(reaction);
              },
              get pinned() {
                return get$1(expression_3);
              }
            }), action(div_6, ($$node, $$action_arg) => placeItem == null ? void 0 : placeItem($$node, $$action_arg), () => get$1(container)), append($$anchor4, div_6);
          }), template_effect(() => {
            set_class(div_1, `la-flexcol -gap0 -widthfull
                ${(get$1(hasPinned) ? "-displaynone" : "") ?? ""}`), set_class(div_2, `-widthfull
                ${(get$1(hasPinned) ? "" : "-displaynone") ?? ""}`);
          }), append($$anchor3, div);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent");
    if_block(node_1, ($$render) => {
      $$props.reactions.length && $$render(consequent);
    });
  }
  append($$anchor, fragment_1), pop();
}
__name(Reactions, "Reactions");
var root_2$b = /* @__PURE__ */ template('<span class="la-flexrow -justifycenter -aligncenter -fontsize5 -padding0-lr"> <i class="cci cci-accuracy -fontsize6"></i></span>'), root_3$g = /* @__PURE__ */ template('<span class="la-flexrow -justifycenter -aligncenter -fontsize5 -padding0-lr"> <i class="cci cci-reticule -fontsize4"></i></span>'), root_1$c = /* @__PURE__ */ template('<div class="-widthfull -padding2-l"><div class="la-flexrow clipped-bot-alt la-text-header la-bckg-header-anti -widthfull -fontface-stylized"><!> <!> <!> <!> <!></div></div>'), root_7$a = /* @__PURE__ */ template('<i class="mdi mdi-star la-text-warning"></i>'), root_8$8 = /* @__PURE__ */ template('<i class="mdi mdi-star"></i>'), root_9$c = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_10$a = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_5$f = /* @__PURE__ */ template("<!> <!> <!>", 1), root_11$b = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!></div>');
function TechAttackItem($$anchor, $$props) {
  push($$props, !0);
  const outerContent = /* @__PURE__ */ __name(($$anchor2) => {
    var div = root_1$c(), div_1 = child(div), node = child(div_1);
    {
      var consequent = /* @__PURE__ */ __name(($$anchor3) => {
        var span = root_2$b();
        set_attribute(span, "data-tooltip", accuracyTip), set_attribute(span, "data-tooltip-direction", "DOWN");
        var text2 = child(span);
        template_effect(() => {
          set_attribute(span, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_text(text2, `${$$props.tech.system.accuracy[get$1(tier) - 1] ?? ""} `);
        }), append($$anchor3, span);
      }, "consequent");
      if_block(node, ($$render) => {
        hasAccuracyBonus($$props.tech) && $$render(consequent);
      });
    }
    var node_1 = sibling(node, 2);
    {
      var consequent_1 = /* @__PURE__ */ __name(($$anchor3) => {
        var span_1 = root_3$g();
        set_attribute(span_1, "data-tooltip", attackTip), set_attribute(span_1, "data-tooltip-direction", "DOWN");
        var text_1 = child(span_1);
        template_effect(() => {
          set_attribute(span_1, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_text(text_1, `${$$props.tech.system.attack_bonus[get$1(tier) - 1] ?? ""} `);
        }), append($$anchor3, span_1);
      }, "consequent_1");
      if_block(node_1, ($$render) => {
        hasAttackBonus($$props.tech) && $$render(consequent_1);
      });
    }
    var node_2 = sibling(node_1, 2);
    const expression = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.tech.index}.system.charged`);
    ChargedBox(node_2, {
      get item() {
        return $$props.tech;
      },
      get path() {
        return get$1(expression);
      }
    });
    var node_3 = sibling(node_2, 2);
    const expression_1 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.tech.index}.system.loaded`);
    LoadedBox(node_3, {
      get item() {
        return $$props.tech;
      },
      get path() {
        return get$1(expression_1);
      }
    });
    var node_4 = sibling(node_3, 2);
    const expression_2 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.tech.index}.system.uses`);
    LimitedBox(node_4, {
      get usesValue() {
        return $$props.tech.system.uses.value;
      },
      get usesMax() {
        return $$props.tech.system.uses.max;
      },
      get path() {
        return get$1(expression_2);
      }
    }), append($$anchor2, div);
  }, "outerContent"), headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor2) => {
    const expression_3 = /* @__PURE__ */ derived(() => [
      "cci -fontsize7",
      getIconStyle($$props.tech),
      getTechIcon($$props.tech)
    ]), expression_4 = /* @__PURE__ */ derived(() => $$props.tech.system.attack_bonus.every((bonus) => bonus === 0) ? FlowClass.SendEffectToChat : FlowClass.RollTech), expression_5 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.tech.index}`), expression_6 = /* @__PURE__ */ derived(() => getTechTipHeader($$props.tech)), expression_7 = /* @__PURE__ */ derived(() => $$props.tech.system.effect || getLocalized("LA.mech.mod.effect.tooltip")), expression_8 = /* @__PURE__ */ derived(() => isDestroyed($$props.tech));
    EffectButton($$anchor2, {
      get iconStyle() {
        return get$1(expression_3);
      },
      iconBackgroundStyle: [
        "-fontsize7 la-prmy-secondary",
        qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
      ],
      get flowClass() {
        return get$1(expression_4);
      },
      get path() {
        return get$1(expression_5);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipHeader() {
        return get$1(expression_6);
      },
      get tooltip() {
        return get$1(expression_7);
      },
      get disabled() {
        return get$1(expression_8);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(effectButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(effectButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment_1 = root_5$f(), node_5 = first_child(fragment_1);
    const expression_9 = /* @__PURE__ */ derived(() => [
      H2_BUTTON_ICON_STYLE(),
      "la-flexcol -padding0-lr"
    ]), expression_10 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.tech.index}`), expression_11 = /* @__PURE__ */ derived(() => getLocalized($$props.pinned ? "LA.pin.unpinned.tooltip" : "LA.pin.pinned.tooltip"));
    GlyphButton(node_5, {
      get style() {
        return get$1(expression_9);
      },
      get flowClass() {
        return FlowClass.None;
      },
      get path() {
        return get$1(expression_10);
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_11);
      },
      onClick: /* @__PURE__ */ __name((event2) => {
        $$props.pinned ? unpinItem(event2, $$props.tech) : pinItem(event2, $$props.tech);
      }, "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(pinButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(pinButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var fragment_2 = comment(), node_6 = first_child(fragment_2);
        {
          var consequent_2 = /* @__PURE__ */ __name(($$anchor4) => {
            var i = root_7$a();
            append($$anchor4, i);
          }, "consequent_2"), alternate = /* @__PURE__ */ __name(($$anchor4) => {
            var i_1 = root_8$8();
            append($$anchor4, i_1);
          }, "alternate");
          if_block(node_6, ($$render) => {
            $$props.pinned ? $$render(consequent_2) : $$render(alternate, !1);
          });
        }
        append($$anchor3, fragment_2);
      }, "children"),
      $$slots: { default: !0 }
    });
    var node_7 = sibling(node_5, 2);
    const expression_12 = /* @__PURE__ */ derived(() => [
      H2_BUTTON_ICON_STYLE(),
      "la-flexcol -padding0-lr"
    ]), expression_13 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.tech.index}`), expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
    GlyphButton(node_7, {
      get style() {
        return get$1(expression_12);
      },
      get flowClass() {
        return FlowClass.ContextMenu;
      },
      get path() {
        return get$1(expression_13);
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_14);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var i_2 = root_9$c();
        append($$anchor3, i_2);
      }, "children"),
      $$slots: { default: !0 }
    });
    var node_8 = sibling(node_7, 2);
    const expression_15 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
    GlyphButton(node_8, {
      get style() {
        return get$1(expression_15);
      },
      get flowClass() {
        return FlowClass.None;
      },
      get index() {
        return $$props.tech.index;
      },
      get uuid() {
        return $$props.tech.uuid;
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_16);
      },
      onClick: /* @__PURE__ */ __name((event2) => sendToChat(event2, $$props.tech), "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(messageButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(messageButtonHover, !1);
      }, "onPointerLeave"),
      children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
        var i_3 = root_10$a();
        append($$anchor3, i_3);
      }, "children"),
      $$slots: { default: !0 }
    }), append($$anchor2, fragment_1);
  }, "headerSecondaryRightOptions");
  let effectButtonHover = state(!1), editButtonHover = state(!1), messageButtonHover = state(!1), pinButtonHover = state(!1);
  const qualityMode = getExtraEffectsEnabled(), tooltipEnabled = getNPCSheetTooltipEnabled(), tier = /* @__PURE__ */ derived(() => $$props.system.tier), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), accuracyTip = TooltipFactory.buildTooltip(getLocalized("LA.npc.accuracy.tooltip")), attackTip = TooltipFactory.buildTooltip(getLocalized("LA.npc.attackBonus.tooltip"));
  function getTechIcon(tech) {
    return tech.system.tech_type === "Full" ? "cci-tech-full" : "cci-tech-quick";
  }
  __name(getTechIcon, "getTechIcon");
  function getTechTipHeader(tech) {
    return tech.system.tech_type === "Full" ? getLocalized("LA.action.fullTech.label") : getLocalized("LA.action.quickTech.label");
  }
  __name(getTechTipHeader, "getTechTipHeader");
  function renderOuter(tech) {
    return !isDestroyed(tech) && (hasAccuracyBonus(tech) || hasAttackBonus(tech) || isLoading(tech) || isRecharge(tech) || tech.system.uses.max);
  }
  __name(renderOuter, "renderOuter");
  function hasAccuracyBonus(tech) {
    return tech.system.accuracy.some((accuracy) => accuracy !== 0);
  }
  __name(hasAccuracyBonus, "hasAccuracyBonus");
  function hasAttackBonus(tech) {
    return tech.system.attack_bonus.some((bonus) => bonus !== 0);
  }
  __name(hasAttackBonus, "hasAttackBonus");
  function isDestroyed(tech) {
    return tech.system.destroyed;
  }
  __name(isDestroyed, "isDestroyed");
  function getHeaderStyle(tech) {
    return isDestroyed(tech) ? `la-text-error la-prmy-error ${photosensitiveStyling("horus--very--subtle")}` : "la-text-header la-prmy-header";
  }
  __name(getHeaderStyle, "getHeaderStyle");
  function getIconStyle(tech) {
    return isDestroyed(tech) ? "la-text-repcap" : "la-text-header";
  }
  __name(getIconStyle, "getIconStyle");
  function sendToChat(event2, item) {
    var _a;
    if (event2.stopPropagation(), (_a = $$props.actor) != null && _a.uuid && item) {
      let accuracy = "";
      item.system.accuracy[get$1(tier) - 1] > 0 && (accuracy = `<div class="la-flexrow">${item.system.accuracy[get$1(tier) - 1]}<i class="cci cci-accuracy -fontsize6"></i></div>`);
      let attackBonus = "";
      item.system.attack_bonus[get$1(tier) - 1] > 0 && (attackBonus = `<div class="la-flexrow" style="align-items: anchor-center;">${item.system.attack_bonus[get$1(tier) - 1]}<i class="cci cci-reticule -fontsize4 -padding0"></i></div>`);
      const description = `
                <div 
                    class="la-flexrow -justifyevenly clipped-alt -fontsize5 -padding0-tb -padding1-lr"
                    style="
                        background-color: var(--weapon-color);
                        color: var(--light-text);
                        align-items: baseline;
                    "
                >
                    ${accuracy}
                    ${attackBonus}
                </div>
            `;
      let chatData = {
        title: item.name,
        description: accuracy || attackBonus ? description : "",
        trigger: item.system.trigger,
        effect: item.system.effect,
        onHit: item.system.on_hit,
        tags: item.system.tags,
        color: CHAT_CARD_COLOR_MAP[ChatCardType.Tech]
      };
      SendUnknownToChatBase.getInstance().startFlow($$props.actor.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendToChat, "sendToChat");
  async function pinItem(event2, item) {
    if (event2.stopPropagation(), !item.system.lid) {
      Logger.error("Tried pinning an NPC tech attack that had no LID");
      return;
    }
    const currentPinned = NPCStore.get($$props.actor.uuid).pinnedTechs || [], newPinned = Array.from(/* @__PURE__ */ new Set([...currentPinned, item.system.lid]));
    NPCStore.set($$props.actor.uuid, { pinnedTechs: newPinned });
  }
  __name(pinItem, "pinItem");
  async function unpinItem(event2, item) {
    if (event2.stopPropagation(), !item.system.lid) {
      Logger.error("Tried unpinning an NPC tech attack that had no LID");
      return;
    }
    const newPinned = (NPCStore.get($$props.actor.uuid).pinnedTechs || []).filter((lid) => lid !== item.system.lid);
    NPCStore.set($$props.actor.uuid, { pinnedTechs: newPinned });
  }
  __name(unpinItem, "unpinItem");
  const expression_17 = /* @__PURE__ */ derived(() => [
    getHeaderStyle($$props.tech),
    "-fontsizemedium -overflowhidden -fontface-stylized"
  ]), expression_18 = /* @__PURE__ */ derived(() => `itemTypes.npc_feature.${$$props.tech.index}`), expression_19 = /* @__PURE__ */ derived(() => renderOuter($$props.tech) ? outerContent : void 0);
  HeaderSecondary($$anchor, {
    get text() {
      return $$props.tech.name;
    },
    headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
    get textStyle() {
      return get$1(expression_17);
    },
    borderStyle: ["-bordersoff"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(effectButtonHover)) return `--${getLocalized("LA.use.label")}`;
      if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
      if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
      if (get$1(pinButtonHover)) return `--${getLocalized($$props.pinned ? "LA.pin.unpinned.extension" : "LA.pin.pinned.extension")}`;
    }, "extensionTextFunction"),
    get itemID() {
      return $$props.tech.id;
    },
    get uuid() {
      return $$props.tech.uuid;
    },
    get path() {
      return get$1(expression_18);
    },
    acceptTypes: "npc_feature",
    get collapseID() {
      return $$props.tech.uuid;
    },
    startCollapsed: !0,
    get renderOutsideCollapse() {
      return get$1(expression_19);
    },
    contentLeft: headerSecondaryLeftOptions2,
    contentRight: headerSecondaryRightOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div_2 = root_11$b(), node_9 = child(div_2);
      const expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.effect.label"));
      EffectBox(node_9, {
        get name() {
          return get$1(expression_20);
        },
        tooltipEnabled,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps2) => {
          var fragment_4 = comment(), node_10 = first_child(fragment_4);
          html(node_10, () => $$props.tech.system.effect), append($$anchor3, fragment_4);
        }, "children"),
        $$slots: { default: !0 }
      });
      var node_11 = sibling(node_9, 2);
      const expression_21 = /* @__PURE__ */ derived(() => getLocalized("LA.effect.hit.label"));
      EffectBox(node_11, {
        get name() {
          return get$1(expression_21);
        },
        get effect() {
          return $$props.tech.system.on_hit;
        },
        tooltipEnabled
      });
      var node_12 = sibling(node_11, 2);
      TagArray(node_12, {
        get tags() {
          return $$props.tech.system.tags;
        },
        justify: "end",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        }
      }), append($$anchor2, div_2);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(TechAttackItem, "TechAttackItem");
var root_4$7 = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>'), root_5$e = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>'), root_6$g = /* @__PURE__ */ template('<div class="-widthfull"><!></div>'), root_3$f = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"><div></div> <div><!> <div></div> <!></div> <div class="-displaynone" aria-hidden="true"></div></div>');
function TechAttack($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let collapseAllButtonHover = state(!1);
  const tooltipEnabled = getNPCSheetTooltipEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.techs`), pinCollID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.techs.pins`), nonpinCollID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.techs.nonpins`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), pinnedSet = /* @__PURE__ */ derived(() => new Set(NPCStore.get($$props.actor.uuid).pinnedTechs ?? [])), pinnedTechs = /* @__PURE__ */ derived(() => $$props.techs.filter((t) => get$1(pinnedSet).has(t.system.lid))), hasPinned = /* @__PURE__ */ derived(() => get$1(pinnedTechs).length > 0);
  let pinnedContainer = state(void 0), unpinnedContainer = state(void 0), noSectionsContainer = state(void 0);
  function placeItem(node, container) {
    return container == null || container.appendChild(node), {
      update(newContainer) {
        newContainer == null || newContainer.appendChild(node);
      },
      destroy() {
        node.remove();
      }
    };
  }
  __name(placeItem, "placeItem");
  var fragment_1 = comment(), node_1 = first_child(fragment_1);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.npc.techAttacks.label"));
      HeaderMain($$anchor2, {
        get text() {
          return get$1(expression);
        },
        headerStyle: [MAIN_HEADER_STYLE, "la-bckg-action--tech"],
        textStyle: ["la-text-header -fontsize4 -overflowhidden"],
        borderStyle: ["la-brdr-action--tech -gap0"],
        extensionTextFunction: /* @__PURE__ */ __name(() => {
          if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
        }, "extensionTextFunction"),
        get collapseID() {
          return get$1(collID);
        },
        startCollapsed: !0,
        headerContent: headerOptions,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var div = root_3$f(), div_1 = child(div);
          bind_this(div_1, ($$value) => set(noSectionsContainer, $$value), () => get$1(noSectionsContainer));
          var div_2 = sibling(div_1, 2), node_2 = child(div_2);
          const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pin.pinned.label"));
          HeaderSecondary(node_2, {
            get text() {
              return get$1(expression_1);
            },
            headerStyle: [
              "clipped-bot-alt la-bckg-primary -letterspacing0 la-text-header la-prmy-header -padding2-l -padding0-tb -fontsizemedium"
            ],
            get collapseID() {
              return get$1(pinCollID);
            },
            startCollapsed: !1,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var div_3 = root_4$7();
              bind_this(div_3, ($$value) => set(pinnedContainer, $$value), () => get$1(pinnedContainer)), append($$anchor4, div_3);
            }, "children"),
            $$slots: { default: !0 }
          });
          var node_3 = sibling(node_2, 4);
          const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pin.unpinned.label"));
          HeaderSecondary(node_3, {
            get text() {
              return get$1(expression_2);
            },
            headerStyle: [
              "clipped-bot-alt la-bckg-weapon -letterspacing0 la-text-header la-prmy-header -padding2-l -padding0-tb -fontsizemedium"
            ],
            get collapseID() {
              return get$1(nonpinCollID);
            },
            startCollapsed: !1,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var div_4 = root_5$e();
              bind_this(div_4, ($$value) => set(unpinnedContainer, $$value), () => get$1(unpinnedContainer)), append($$anchor4, div_4);
            }, "children"),
            $$slots: { default: !0 }
          });
          var div_5 = sibling(div_2, 2);
          each(div_5, 21, () => $$props.techs, (tech) => tech.uuid, ($$anchor4, tech) => {
            var div_6 = root_6$g();
            const container = /* @__PURE__ */ derived(() => get$1(hasPinned) ? get$1(pinnedSet).has(get$1(tech).system.lid) ? get$1(pinnedContainer) : get$1(unpinnedContainer) : get$1(noSectionsContainer));
            var node_4 = child(div_6);
            const expression_3 = /* @__PURE__ */ derived(() => get$1(pinnedSet).has(get$1(tech).system.lid));
            TechAttackItem(node_4, {
              get actor() {
                return $$props.actor;
              },
              get system() {
                return $$props.system;
              },
              get tech() {
                return get$1(tech);
              },
              get pinned() {
                return get$1(expression_3);
              }
            }), action(div_6, ($$node, $$action_arg) => placeItem == null ? void 0 : placeItem($$node, $$action_arg), () => get$1(container)), append($$anchor4, div_6);
          }), template_effect(() => {
            set_class(div_1, `la-flexcol -gap0 -widthfull
                ${(get$1(hasPinned) ? "-displaynone" : "") ?? ""}`), set_class(div_2, `-widthfull
                ${(get$1(hasPinned) ? "" : "-displaynone") ?? ""}`);
          }), append($$anchor3, div);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent");
    if_block(node_1, ($$render) => {
      $$props.techs.length && $$render(consequent);
    });
  }
  append($$anchor, fragment_1), pop();
}
__name(TechAttack, "TechAttack");
var root_2$a = /* @__PURE__ */ template('<div class="la-flexcol -widthfull"><!> <!> <!> <!> <!></div>'), root$p = /* @__PURE__ */ template("<!> <!>", 1);
function Loadout($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), system = /* @__PURE__ */ derived(() => props.system), itemTypes = /* @__PURE__ */ derived(() => props.itemTypes);
  setActorContext($$props.actor);
  const traits = [], systems = [], reactions = [], weapons = [], techs = [];
  get$1(itemTypes).npc_feature.forEach((feature, index2) => {
    switch (feature.index = index2, feature.system.type) {
      case "Trait":
        traits.push(feature);
        break;
      case "System":
        systems.push(feature);
        break;
      case "Reaction":
        reactions.push(feature);
        break;
      case "Weapon":
        weapons.push(feature);
        break;
      case "Tech":
        techs.push(feature);
        break;
    }
  });
  var fragment = root$p(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.npc.empty.label")), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.npc.empty.subLabel"));
      EmptyBox($$anchor2, {
        get label() {
          return get$1(expression);
        },
        get subLabel() {
          return get$1(expression_1);
        }
      });
    }, "consequent");
    if_block(node, ($$render) => {
      get$1(system).class || $$render(consequent);
    });
  }
  var node_1 = sibling(node, 2);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var div = root_2$a(), node_2 = child(div);
      Weapons(node_2, spread_props({ weapons }, () => props));
      var node_3 = sibling(node_2, 2);
      TechAttack(node_3, spread_props({ techs }, () => props));
      var node_4 = sibling(node_3, 2);
      Reactions(node_4, spread_props({ reactions }, () => props));
      var node_5 = sibling(node_4, 2);
      Systems(node_5, spread_props({ systems }, () => props));
      var node_6 = sibling(node_5, 2);
      Traits(node_6, spread_props({ traits }, () => props)), append($$anchor2, div);
    }, "consequent_1");
    if_block(node_1, ($$render) => {
      get$1(itemTypes).npc_feature.length && $$render(consequent_1);
    });
  }
  append($$anchor, fragment), pop();
}
__name(Loadout, "Loadout");
var root$o = /* @__PURE__ */ template(`<div class="
        click-open ref set"><span class="-upper -fontsize4"> </span> <button type="button"></button></div>`);
function Template($$anchor, $$props) {
  push($$props, !0);
  const qualityMode = getExtraEffectsEnabled(), tip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip($$props.tooltip || getLocalized("LA.flow.tooltip"), $$props.tooltipHeader));
  var div = root$o(), span = child(div), text2 = child(span), button = sibling(span, 2);
  template_effect(
    ($0, $1) => {
      set_attribute(div, "data-uuid", $$props.uuid), set_text(text2, $$props.name), set_class(button, `mdi mdi-pencil -fontsize3 -positionabsolute
            ${($$props.editOption ? "" : "-displaynone") ?? ""}
            ${$0 ?? ""}
            lancer-context-menu`), set_attribute(button, "data-path", $$props.path), set_attribute(button, "data-tooltip", $$props.tooltipEnabled ? get$1(tip) : void 0), set_attribute(button, "data-tooltip-class", `${$$props.tooltipClass || "clipped-bot la-tooltip"} ${$$props.tooltipTheme}`), set_attribute(button, "data-tooltip-direction", $$props.tooltipDirection || "DOWN"), set_attribute(button, "aria-label", $1);
    },
    [
      () => qualityMode ? CLICKABLE_HOVER() : "",
      () => getLocalized("LA.edit.label")
    ]
  ), append($$anchor, div), pop();
}
__name(Template, "Template");
var root$n = /* @__PURE__ */ template('<div class="la-haseposition -positionrelative"><div class="la-hasegroup -positionabsolute -widthnone"><div class="la-hase la-flexcol -justifybetween -heightnone"><div class="la-flexrow -aligncenter"><!></div> <div class="la-flexrow -aligncenter -pointerdisable"><div class="-agi">&nbsp;</div> <!></div> <div class="la-flexrow -aligncenter"><!></div> <div class="la-flexrow -aligncenter -pointerdisable"><div class="-eng">&nbsp;</div> <!></div></div></div></div>');
function HaseDisplay($$anchor, $$props) {
  push($$props, !0);
  const logographic = logographicLanguage(), tooltipEnabled = getNPCSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  var div = root$n(), div_1 = child(div), div_2 = child(div_1), div_3 = child(div_2), node = child(div_3);
  const expression = /* @__PURE__ */ derived(() => getLocalized("LA.hull.short")), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.hull.tooltip")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.hull.tooltip"));
  HexButton(node, {
    get text() {
      return get$1(expression);
    },
    get value() {
      return $$props.system.hull;
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_1);
    },
    get logText() {
      return get$1(expression_2);
    },
    logging: !0,
    get uuid() {
      return $$props.actor.uuid;
    },
    get flowClass() {
      return FlowClass.RollStat;
    },
    path: "system.hull",
    outerStyle: ["-hull"],
    innerStyle: [
      "la-text-header -positionabsolute -divider -thickness1 la-prmy-header"
    ],
    buttonStyle: [
      "-widthfull -heightfull -positionabsolute la-prmy-primary",
      qualityMode ? "-glow-prmy-hover" : ""
    ],
    outerTextStyle: [
      "-widthfull -textaligncenter -fontface-stylized",
      logographic ? "-fontsizemediumer" : "-fontsizesmall"
    ],
    innerTextStyle: [
      "-fontsize5 -lineheight13 la-prmy-header",
      qualityMode ? "-glow-prmy" : ""
    ]
  });
  var div_4 = sibling(div_3, 2), node_1 = sibling(child(div_4), 2);
  const expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.agility.short")), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.agility.tooltip")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.agility.tooltip"));
  HexButton(node_1, {
    get text() {
      return get$1(expression_3);
    },
    get value() {
      return $$props.system.agi;
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_4);
    },
    get logText() {
      return get$1(expression_5);
    },
    logging: !0,
    get uuid() {
      return $$props.actor.uuid;
    },
    get flowClass() {
      return FlowClass.RollStat;
    },
    path: "system.agi",
    outerStyle: ["-agi"],
    innerStyle: [
      "la-text-header -positionabsolute -divider -thickness1 la-prmy-header"
    ],
    buttonStyle: [
      "-widthfull -heightfull -positionabsolute la-prmy-primary",
      qualityMode ? "-glow-prmy-hover" : ""
    ],
    outerTextStyle: [
      "-widthfull -textaligncenter -fontface-stylized",
      logographic ? "-fontsizemediumer" : "-fontsizesmall"
    ],
    innerTextStyle: [
      "-fontsize5 -lineheight13 la-prmy-header",
      qualityMode ? "-glow-prmy" : ""
    ]
  });
  var div_5 = sibling(div_4, 2), node_2 = child(div_5);
  const expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.systems.short")), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.systems.tooltip")), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.systems.tooltip"));
  HexButton(node_2, {
    get text() {
      return get$1(expression_6);
    },
    get value() {
      return $$props.system.sys;
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_7);
    },
    get logText() {
      return get$1(expression_8);
    },
    logging: !0,
    get uuid() {
      return $$props.actor.uuid;
    },
    get flowClass() {
      return FlowClass.RollStat;
    },
    path: "system.sys",
    outerStyle: ["-sys"],
    innerStyle: [
      "la-text-header -positionabsolute -divider -thickness1 la-prmy-header"
    ],
    buttonStyle: [
      "-widthfull -heightfull -positionabsolute la-prmy-primary",
      qualityMode ? "-glow-prmy-hover" : ""
    ],
    outerTextStyle: [
      "-widthfull -textaligncenter -fontface-stylized",
      logographic ? "-fontsizemediumer" : "-fontsizesmall"
    ],
    innerTextStyle: [
      "-fontsize5 -lineheight13 la-prmy-header",
      qualityMode ? "-glow-prmy" : ""
    ]
  });
  var div_6 = sibling(div_5, 2), node_3 = sibling(child(div_6), 2);
  const expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.engineering.short")), expression_10 = /* @__PURE__ */ derived(() => getLocalized("LA.engineering.tooltip")), expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.engineering.tooltip"));
  HexButton(node_3, {
    get text() {
      return get$1(expression_9);
    },
    get value() {
      return $$props.system.eng;
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_10);
    },
    get logText() {
      return get$1(expression_11);
    },
    logging: !0,
    get uuid() {
      return $$props.actor.uuid;
    },
    get flowClass() {
      return FlowClass.RollStat;
    },
    path: "system.eng",
    outerStyle: ["-eng"],
    innerStyle: [
      "la-text-header -positionabsolute -divider -thickness1 la-prmy-header"
    ],
    buttonStyle: [
      "-widthfull -heightfull -positionabsolute la-prmy-primary",
      qualityMode ? "-glow-prmy-hover" : ""
    ],
    outerTextStyle: [
      "-widthfull -textaligncenter -fontface-stylized",
      logographic ? "-fontsizemediumer" : "-fontsizesmall"
    ],
    innerTextStyle: [
      "-fontsize5 -lineheight13 la-prmy-header",
      qualityMode ? "-glow-prmy" : ""
    ]
  }), append($$anchor, div), pop();
}
__name(HaseDisplay, "HaseDisplay");
var root_1$b = /* @__PURE__ */ template("<i></i>"), root_2$9 = /* @__PURE__ */ template("<i></i>"), root_6$f = /* @__PURE__ */ template("<i></i>"), on_click = /* @__PURE__ */ __name((event2, handleShowNotes) => handleShowNotes(event2), "on_click"), on_change$8 = /* @__PURE__ */ __name((event2, system) => handleRelativeDataInput(event2, get$1(system).overshield.value), "on_change$8"), on_change_1$5 = /* @__PURE__ */ __name((event2, system) => handleRelativeDataInput(event2, get$1(system).burn), "on_change_1$5"), root$m = /* @__PURE__ */ template(`<div><div class="la-flexrow la-dropshadow -justifyevenly"><div class="la-flexcol -gap1"><div class="la-flexrow -height4 "><div><button type="button" class="la-bckg-secondary -width4
                            clicker-minus-button input-update">-</button><input class="-height4 la-shadow -medium -inset la-text-text
                            lancer-stat minor"><button type="button" class="la-bckg-secondary -width4
                            clicker-plus-button input-update">+</button></div></div> <div class="la-flexrow -widthfull -heightfull"><div class="la-stat__island -positionrelative la-dropshadow"><div class="la-flexcol -positionabsolute -top0 -left0 -fontsize11"><i></i> <!> <div class="la-flexrow"><i></i> <span> </span></div> <div class="la-flexrow -aligncenter"><i></i> <span> </span></div> <div><button type="button" class="mdi mdi-refresh-circle la-text-secondary -fontsize8
                                    charge-macro"></button></div></div></div> <div class="la-npc__img -aligncontentcenter
                        ref set"><!></div> <!></div></div> <div class="la-flexrow -padding1-r -fontface-stylized"><div class="la-flexcol -gap1"><div class="la-flexrow -height4 -justifybetween -widthfull"><div class="la-flexrow -gap1"><!> <!> <!> <!></div> <div class="la-flexrow -gap1"><button type="button"></button> <button type="button"></button></div></div> <div class="-flex1"><div class="la-stats la-flexrow -justifyevenly"><!> <!> <!></div> <div class="la-damage -margin0-lr -margin2-tb"><div class="la-flexrow -gap2"><div class="la-visuals -flex5"><!> <div class="la-spacer -tiny"></div> <!></div> <div><input type="text" class="la-damage__input la-shadow -medium -inset la-text-text -width7 -heightfull -bordersround-lrt -small -bordersoff" name="system.overshield.value" data-dtype="Number"> <span data-tooltip-direction="LEFT"> </span></div></div> <div class="la-spacer -large"></div> <div class="la-flexrow -gap2"><div class="la-visuals -flex5"><!> <div class="la-spacer -tiny"></div> <!></div> <div><input type="text" class="la-damage__input la-shadow -medium -inset la-text-text -width7 -heightfull -bordersround-lrt -small -bordersoff" name="system.burn" data-dtype="Number"> <span data-tooltip-direction="LEFT"> </span></div></div></div> <div class="la-stats la-flexrow -justifyevenly"><!> <!> <!></div> <div class="la-spacer -large"></div></div></div></div></div></div>`);
function Stats$1($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), system = /* @__PURE__ */ derived(() => props.system);
  let editingBurn = state(!1), editingShield = state(!1);
  const logographic = logographicLanguage(), tooltipEnabled = getNPCSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), isInstanced = /* @__PURE__ */ derived(() => get$1(actor).parent && get$1(actor).type === "npc"), themeOverride = /* @__PURE__ */ derived(() => getBrightness(getThemeKey(get$1(actor).uuid)) === "light" ? "la-text-primary" : "la-text-text"), tokenImageLocked = /* @__PURE__ */ derived(() => getTokenImageLock(get$1(actor).uuid)), sizeTip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.size.tooltip"), `${getLocalized("LA.size.label")} ${get$1(system).size}`)), speedTip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.speed.tooltip"), `${getLocalized("LA.speed.label")} ${get$1(system).speed}`)), activateTip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.activate.tooltip"), `Activations ${get$1(system).activations}`)), tierTip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.npc.tier.tooltip"), `Tier ${get$1(system).tier}`)), setTierTip = TooltipFactory.buildTooltip(getLocalized("LA.npc.tier.set.tooltip")), rechargeTip = TooltipFactory.buildTooltip(getLocalized("LA.npc.recharge.tooltip"), getLocalized("LA.action.startofturn.label")), notesEditTip = TooltipFactory.buildTooltip(getLocalized("LA.npc.notes.edit.tooltip")), notesTip = TooltipFactory.buildTooltip(getLocalized("LA.npc.notes.tooltip")), notesContent = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(get$1(system).notes, getLocalized("LA.npc.notes.label"))), shieldTip = TooltipFactory.buildTooltip(getLocalized("LA.overshield.tooltip")), burnTip = TooltipFactory.buildTooltip(getLocalized("LA.burn.tooltip")), tokenErrorTip = TooltipFactory.buildTooltip(getLocalized("LA.edit.image.token.error")), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  onMount(() => {
    setTokenImageLock(get$1(actor).uuid, getActorTokenSync$1(get$1(actor).uuid));
  });
  function handleShowNotes(event2) {
    event2.stopPropagation(), TooltipFactory.renderTooltip(event2, {
      html: get$1(notesContent),
      direction: TooltipDirection.RIGHT,
      locked: !0
    });
  }
  __name(handleShowNotes, "handleShowNotes");
  function handleEditToken2(event2) {
    event2.stopPropagation(), get$1(tokenImageLocked) ? browseActorImageSync(event2, get$1(actor)) : browseTokenImage(event2, get$1(actor));
  }
  __name(handleEditToken2, "handleEditToken");
  var div = root$m();
  set_class(div, `la-bckg-background la-shadow -medium -inset -widthfull -heightfull
        ${(qualityMode ? "la-bg-scroll" : "la-bg") ?? ""}`);
  var div_1 = child(div), div_2 = child(div_1), div_3 = child(div_2), div_4 = child(div_3), button = child(div_4);
  set_attribute(button, "data-tooltip", tooltipEnabled ? setTierTip : void 0), set_attribute(button, "data-tooltip-direction", "UP");
  var input = sibling(button);
  set_attribute(input, "type", "number"), set_attribute(input, "data-dtype", "Number"), set_attribute(input, "name", "system.tier"), set_attribute(input, "data-tooltip", tooltipEnabled ? setTierTip : void 0), set_attribute(input, "data-tooltip-direction", "UP");
  var button_1 = sibling(input);
  set_attribute(button_1, "data-tooltip", tooltipEnabled ? setTierTip : void 0), set_attribute(button_1, "data-tooltip-direction", "UP");
  var div_5 = sibling(div_3, 2), div_6 = child(div_5), div_7 = child(div_6), i = child(div_7), node = sibling(i, 2);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var i_1 = root_1$b();
      template_effect(() => {
        set_class(i_1, `cci cci-size-half ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_attribute(i_1, "data-tooltip", tooltipEnabled ? get$1(sizeTip) : void 0), set_attribute(i_1, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i_1, "data-tooltip-direction", TooltipDirection.RIGHT);
      }), append($$anchor2, i_1);
    }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor2) => {
      var i_2 = root_2$9();
      template_effect(() => {
        set_class(i_2, `cci cci-size-${get$1(system).size ?? ""} ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_attribute(i_2, "data-tooltip", tooltipEnabled ? get$1(sizeTip) : void 0), set_attribute(i_2, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i_2, "data-tooltip-direction", TooltipDirection.RIGHT);
      }), append($$anchor2, i_2);
    }, "alternate");
    if_block(node, ($$render) => {
      get$1(system).size < 1 ? $$render(consequent) : $$render(alternate, !1);
    });
  }
  var div_8 = sibling(node, 2), i_3 = child(div_8), span = sibling(i_3, 2), text2 = child(span), div_9 = sibling(div_8, 2), i_4 = child(div_9), span_1 = sibling(i_4, 2), text_1 = child(span_1), div_10 = sibling(div_9, 2);
  set_class(div_10, `la-recharge -lineheight5 -width8 -height8 la-prmy-primary
                                ${(qualityMode ? "-glow-prmy-hover" : "") ?? ""}`);
  var button_2 = child(div_10);
  set_attribute(button_2, "data-tooltip", tooltipEnabled ? rechargeTip : void 0);
  var div_11 = sibling(div_6, 2), node_1 = child(div_11);
  ImageVideo(node_1, {
    get actor() {
      return get$1(actor);
    },
    get editDisabled() {
      return get$1(isInstanced);
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    onPointerClick: handleEditToken2
  });
  var node_2 = sibling(div_11, 2);
  HaseDisplay(node_2, spread_props(() => props));
  var div_12 = sibling(div_2, 2), div_13 = child(div_12), div_14 = child(div_13), div_15 = child(div_14), node_3 = child(div_15);
  AdvancedButton(node_3, {
    get uuid() {
      return get$1(actor).uuid;
    },
    style: [
      "-lineheight5 la-prmy-primary",
      qualityMode ? "-glow-prmy-hover" : ""
    ],
    iconStyle: ["-fontsize7"],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltipDirection() {
      return TooltipDirection.UP;
    }
  });
  var node_4 = sibling(node_3, 2);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      LockImageButton($$anchor2, {
        style: `-fontsize4 la-text-text la-prmy-primary
                                ${(qualityMode ? "-glow-prmy-hover" : "") ?? ""}`,
        get actor() {
          return get$1(actor);
        },
        setState: setActorTokenSync$1,
        tooltipEnabled
      });
    }, "consequent_1");
    if_block(node_4, ($$render) => {
      get$1(advancedOptions) && !get$1(isInstanced) && $$render(consequent_1);
    });
  }
  var node_5 = sibling(node_4, 2);
  {
    var consequent_3 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_1 = comment(), node_6 = first_child(fragment_1);
      {
        var consequent_2 = /* @__PURE__ */ __name(($$anchor3) => {
          const expression = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.actor.tooltip"));
          GlyphButton($$anchor3, {
            get flowClass() {
              return FlowClass.None;
            },
            style: [
              "mdi mdi-image-edit -fontsize4 la-text-text la-prmy-primary",
              qualityMode ? "-glow-prmy-hover" : ""
            ],
            onClick: /* @__PURE__ */ __name((event2) => browseActorImage(event2, get$1(actor)), "onClick"),
            tooltipEnabled,
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltip() {
              return get$1(expression);
            },
            get tooltipDirection() {
              return TooltipDirection.UP;
            }
          });
        }, "consequent_2");
        if_block(node_6, ($$render) => {
          get$1(tokenImageLocked) || $$render(consequent_2);
        });
      }
      append($$anchor2, fragment_1);
    }, "consequent_3"), alternate_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var i_5 = root_6$f();
      set_class(i_5, `mdi mdi-creation la-text-text -fontsize4 la-prmy-warning
                                ${(qualityMode ? "-glow-prmy" : "") ?? ""}`), set_attribute(i_5, "data-tooltip", tooltipEnabled ? tokenErrorTip : void 0), template_effect(() => {
        set_attribute(i_5, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i_5, "data-tooltip-direction", TooltipDirection.DOWN);
      }), append($$anchor2, i_5);
    }, "alternate_1");
    if_block(node_5, ($$render) => {
      get$1(isInstanced) ? $$render(alternate_1, !1) : $$render(consequent_3);
    });
  }
  var node_7 = sibling(node_5, 2);
  {
    var consequent_4 = /* @__PURE__ */ __name(($$anchor2) => {
      ThemeOverrideButton($$anchor2, {
        get uuid() {
          return get$1(actor).uuid;
        },
        style: ["-lineheight5"],
        iconStyle: ["-fontsize4"],
        setOverride: setThemeOverride$1,
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipDirection() {
          return TooltipDirection.UP;
        }
      });
    }, "consequent_4");
    if_block(node_7, ($$render) => {
      get$1(advancedOptions) && $$render(consequent_4);
    });
  }
  var div_16 = sibling(div_15, 2), button_3 = child(div_16);
  set_attribute(button_3, "data-tooltip", notesEditTip), set_attribute(button_3, "data-path", "system.notes");
  var button_4 = sibling(button_3, 2);
  set_class(button_4, `mdi mdi-information -fontsize4 la-prmy-primary
                                ${(qualityMode ? "-glow-prmy-hover" : "") ?? ""}`), set_attribute(button_4, "data-tooltip", notesTip), button_4.__click = [on_click, handleShowNotes];
  var div_17 = sibling(div_14, 2), div_18 = child(div_17), node_8 = child(div_18);
  const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.armor.short")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.armor.tooltip"));
  StatComboShort(node_8, {
    icon: "cci cci-role-defender",
    get label() {
      return get$1(expression_1);
    },
    get value() {
      return get$1(system).armor;
    },
    outerStyle: ["-fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_2);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    }
  });
  var node_9 = sibling(node_8, 2);
  const expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.evasion.short")), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.evasion.tooltip"));
  StatComboShort(node_9, {
    icon: "cci cci-evasion",
    get label() {
      return get$1(expression_3);
    },
    get value() {
      return get$1(system).evasion;
    },
    outerStyle: ["-fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_4);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    }
  });
  var node_10 = sibling(node_9, 2);
  const expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.edefense.short")), expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.edefense.tooltip"));
  StatComboShort(node_10, {
    icon: "cci cci-edef",
    get label() {
      return get$1(expression_5);
    },
    get value() {
      return get$1(system).edef;
    },
    outerStyle: ["-fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_6);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    }
  });
  var div_19 = sibling(div_18, 2), div_20 = child(div_19), div_21 = child(div_20), node_11 = child(div_21);
  const expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.hitpoint.short")), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.hitpoint.tooltip"));
  StatusBar(node_11, {
    get name() {
      return get$1(expression_7);
    },
    nameStyle: [logographic ? "-fontsizemedium" : ""],
    dataName: "system.hp.value",
    get currentValue() {
      return get$1(system).hp.value;
    },
    get maxValue() {
      return get$1(system).hp.max;
    },
    barStyle: ["la-bckg-bar-health"],
    barEditStyle: ["la-prmy-bar-health"],
    get currentValueSecondary() {
      return get$1(system).overshield.value;
    },
    get maxValueSecondary() {
      return get$1(system).hp.max;
    },
    barStyleSecondary: ["la-bckg-bar-shield -shield"],
    barEditStyleSecondary: ["la-prmy-bar-shield"],
    textStyle: ["la-text-text"],
    clipPath: "clipped",
    get editSecondary() {
      return get$1(editingShield);
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get tooltip() {
      return get$1(expression_8);
    }
  });
  var node_12 = sibling(node_11, 4);
  const expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.structure.label")), expression_10 = /* @__PURE__ */ derived(() => getLocalized("LA.structure.tooltip"));
  StatusBar(node_12, {
    get name() {
      return get$1(expression_9);
    },
    nameStyle: [logographic ? "-fontsizemedium" : ""],
    dataName: "system.structure.value",
    get currentValue() {
      return get$1(system).structure.value;
    },
    get maxValue() {
      return get$1(system).structure.max;
    },
    textStyle: ["la-text-text"],
    barStyle: ["la-bckg-bar-structure"],
    barEditStyle: ["la-prmy-bar-structure"],
    clipPath: "clipped-alt",
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get tooltip() {
      return get$1(expression_10);
    }
  });
  var div_22 = sibling(div_21, 2);
  set_class(div_22, `la-flexcol -divider la-prmy-bar-shield -flex0 -textaligncenter la-prmy-bar-shield
                                ${(qualityMode ? "-glow-prmy" : "") ?? ""}
                                ${(logographic ? "-width4ch" : "-width3ch") ?? ""}`);
  var input_1 = child(div_22);
  input_1.__change = [on_change$8, system];
  var span_2 = sibling(input_1, 2);
  set_class(span_2, `la-damage__span -fontsizesmall -heightfull -lineheight3
                                        ${(logographic ? "-fontsizemedium" : "") ?? ""}`), set_attribute(span_2, "data-tooltip", tooltipEnabled ? shieldTip : void 0);
  var text_2 = child(span_2), div_23 = sibling(div_20, 4), div_24 = child(div_23), node_13 = child(div_24);
  const expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.heat.label")), expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.heat.tooltip"));
  StatusBar(node_13, {
    get name() {
      return get$1(expression_11);
    },
    nameStyle: [logographic ? "-fontsizemedium" : ""],
    dataName: "system.heat.value",
    get currentValue() {
      return get$1(system).heat.value;
    },
    get maxValue() {
      return get$1(system).heat.max;
    },
    barStyle: ["la-bckg-bar-heat"],
    barEditStyle: ["la-prmy-bar-heat"],
    get currentValueSecondary() {
      return get$1(system).burn;
    },
    get maxValueSecondary() {
      return get$1(system).heat.max;
    },
    barStyleSecondary: ["la-bckg-bar-burn -burn"],
    barEditStyleSecondary: ["la-prmy-bar-burn"],
    textStyle: ["la-text-text"],
    clipPath: "clipped",
    get editSecondary() {
      return get$1(editingBurn);
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get tooltip() {
      return get$1(expression_12);
    }
  });
  var node_14 = sibling(node_13, 4);
  const expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.stress.label")), expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.stress.tooltip"));
  StatusBar(node_14, {
    get name() {
      return get$1(expression_13);
    },
    nameStyle: [logographic ? "-fontsizemedium" : ""],
    dataName: "system.stress.value",
    get currentValue() {
      return get$1(system).stress.value;
    },
    get maxValue() {
      return get$1(system).stress.max;
    },
    textStyle: ["la-text-text"],
    barStyle: ["la-bckg-bar-stress"],
    barEditStyle: ["la-prmy-bar-stress"],
    clipPath: "clipped-alt",
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get tooltip() {
      return get$1(expression_14);
    }
  });
  var div_25 = sibling(div_24, 2);
  set_class(div_25, `la-flexcol -divider la-prmy-bar-burn -flex0 -textaligncenter la-prmy-bar-burn
                                    ${(qualityMode ? "-glow-prmy" : "") ?? ""}
                                    ${(logographic ? "-width4ch" : "-width3ch") ?? ""}`);
  var input_2 = child(div_25);
  input_2.__change = [on_change_1$5, system];
  var span_3 = sibling(input_2, 2);
  set_class(span_3, `la-damage__span -heightfull -lineheight3
                                        ${(logographic ? "-fontsizemedium" : "-fontsizesmall") ?? ""}`), set_attribute(span_3, "data-tooltip", tooltipEnabled ? burnTip : void 0);
  var text_3 = child(span_3), div_26 = sibling(div_19, 2), node_15 = child(div_26);
  const expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.tattack.short")), expression_16 = /* @__PURE__ */ derived(() => getLocalized([
    "LA.tattack.tooltip",
    "LA.tattack.append.tooltip.npc"
  ]));
  StatComboShort(node_15, {
    icon: "cci cci-tech-full",
    get label() {
      return get$1(expression_15);
    },
    get value() {
      return get$1(system).sys;
    },
    outerStyle: ["-fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_16);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    }
  });
  var node_16 = sibling(node_15, 2);
  const expression_17 = /* @__PURE__ */ derived(() => getLocalized("LA.save.short")), expression_18 = /* @__PURE__ */ derived(() => getLocalized("LA.save.tooltip"));
  StatComboShort(node_16, {
    icon: "cci cci-save",
    get label() {
      return get$1(expression_17);
    },
    get value() {
      return get$1(system).save;
    },
    outerStyle: ["-fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_18);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    }
  });
  var node_17 = sibling(node_16, 2);
  const expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.sensor.short")), expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.sensor.tooltip"));
  StatComboShort(node_17, {
    icon: "cci cci-sensor",
    get label() {
      return get$1(expression_19);
    },
    get value() {
      return get$1(system).sensor_range;
    },
    outerStyle: ["-fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_20);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    }
  }), template_effect(
    ($0, $1, $2, $3, $4, $5, $6) => {
      set_attribute(button, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(button, "aria-label", $0), set_value(input, `${get$1(system).tier}`), set_attribute(input, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(button_1, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(button_1, "aria-label", $1), set_class(i, `cci cci-npc-tier-${get$1(system).tier ?? ""} ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_attribute(i, "data-tooltip", tooltipEnabled ? get$1(tierTip) : void 0), set_attribute(i, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i, "data-tooltip-direction", TooltipDirection.RIGHT), set_attribute(div_8, "data-tooltip", tooltipEnabled ? get$1(speedTip) : void 0), set_attribute(div_8, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(div_8, "data-tooltip-direction", TooltipDirection.RIGHT), set_class(i_3, `mdi mdi-arrow-right-bold-hexagon-outline ${get$1(themeOverride) ?? ""} la-outl-shadow -fontsize8`), set_class(span, `${get$1(themeOverride) ?? ""} la-outl-shadow -fontsize7 -bold`), set_text(text2, get$1(system).speed), set_attribute(div_9, "data-tooltip", tooltipEnabled ? get$1(activateTip) : void 0), set_attribute(div_9, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(div_9, "data-tooltip-direction", TooltipDirection.RIGHT), set_class(i_4, `cci cci-activate ${get$1(themeOverride) ?? ""} la-outl-shadow -fontsize8`), set_class(span_1, `${get$1(themeOverride) ?? ""} la-outl-shadow -fontsize7 -bold`), set_text(text_1, get$1(system).activations), set_attribute(button_2, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(button_2, "data-tooltip-direction", TooltipDirection.RIGHT), set_attribute(button_2, "aria-label", $2), set_attribute(div_11, "data-uuid", get$1(actor).uuid), set_class(button_3, `mdi mdi-note-edit -fontsize4 la-prmy-primary
                                ${(qualityMode ? "-glow-prmy-hover" : "") ?? ""}
                                ${(get$1(advancedOptions) ? "" : "-visibilityhidden") ?? ""}
                                popout-text-edit-button`), set_attribute(button_3, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(button_3, "data-tooltip-direction", TooltipDirection.UP), set_attribute(button_3, "aria-label", $3), set_attribute(button_4, "data-tooltip-class", `clipped-bot la-tooltip -scrollbar ${get$1(theme) ?? ""}`), set_attribute(button_4, "data-tooltip-direction", TooltipDirection.UP), set_attribute(button_4, "aria-label", $4), set_value(input_1, get$1(system).overshield.value), set_attribute(span_2, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_text(text_2, $5), set_value(input_2, get$1(system).burn), set_attribute(span_3, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_text(text_3, $6);
    },
    [
      () => getLocalized("LA.subtract.label"),
      () => getLocalized("LA.add.label"),
      () => getLocalized("LA.npc.recharge.tooltip"),
      () => getLocalized("LA.npc.notes.tooltip"),
      () => getLocalized("LA.npc.notes.label"),
      () => getLocalized("LA.overshield.short"),
      () => getLocalized("LA.burn.short")
    ]
  ), event("focus", input_1, (event2) => {
    event2.currentTarget.select(), set(editingShield, !0);
  }), event("blur", input_1, () => {
    set(editingShield, !1);
  }), event("focus", input_2, (event2) => {
    event2.currentTarget.select(), set(editingBurn, !0);
  }), event("blur", input_2, () => {
    set(editingBurn, !1);
  }), append($$anchor, div), pop();
}
__name(Stats$1, "Stats$1");
delegate(["click", "change"]);
var root$l = /* @__PURE__ */ template('<div class="la-flexcol -widthfull -heightfull"><div><div class="la-flexcol -widthfull -heightfull -padding1-lr"><input type="text" class="la-actorname__input la-text-header -upper -fontsize6 -textaligncenter -heightfull" name="name"> <div class="la-flexrow -gap5 la-text-header -widthfull -textaligncenter -padding0-tb -fontface-stylized"><!> <!></div></div></div> <!></div>');
function Header$2($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), system = /* @__PURE__ */ derived(() => props.system), itemTypes = /* @__PURE__ */ derived(() => props.itemTypes);
  setActorContext(get$1(actor));
  const qualityMode = getExtraEffectsEnabled(), tooltipEnabled = getNPCSheetTooltipEnabled(), templates = /* @__PURE__ */ derived(() => get$1(itemTypes).npc_template), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  var div = root$l(), div_1 = child(div);
  set_class(div_1, `la-bckg-primary -widthfull -height15
            ${(qualityMode ? "la-bg-scroll-alt" : "la-bg-alt") ?? ""}`);
  var div_2 = child(div_1), input = child(div_2), div_3 = sibling(input, 2), node = child(div_3);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment = comment(), node_1 = first_child(fragment);
      each(node_1, 17, () => get$1(templates), index, ($$anchor3, template2, index2) => {
        const expression = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
        Template($$anchor3, {
          get name() {
            return get$1(template2).name;
          },
          get uuid() {
            return get$1(template2).uuid;
          },
          path: `itemTypes.npc_template.${index2}`,
          get editOption() {
            return get$1(advancedOptions);
          },
          tooltipEnabled,
          get tooltipTheme() {
            return get$1(theme);
          },
          get tooltip() {
            return get$1(expression);
          }
        });
      }), append($$anchor2, fragment);
    }, "consequent");
    if_block(node, ($$render) => {
      get$1(templates).length && $$render(consequent);
    });
  }
  var node_2 = sibling(node, 2);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
      Template($$anchor2, {
        get name() {
          return get$1(system).class.name;
        },
        get uuid() {
          return get$1(system).class.uuid;
        },
        path: "system.class",
        get editOption() {
          return get$1(advancedOptions);
        },
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_1);
        }
      });
    }, "consequent_1");
    if_block(node_2, ($$render) => {
      get$1(system).class && $$render(consequent_1);
    });
  }
  var node_3 = sibling(div_1, 2);
  Stats$1(node_3, spread_props(() => props)), template_effect(
    ($0) => {
      set_value(input, get$1(actor).name), set_attribute(input, "placeholder", $0);
    },
    [() => getLocalized("LA.namePlaceholder")]
  ), append($$anchor, div), pop();
}
__name(Header$2, "Header$2");
function Activity$2($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor);
  setActorContext(get$1(actor));
  const actionLogSaveCollapse = getNPCSheetLogActionDontSaveCollapse(), actionLogStartCollapsed = getNPCSheetLogActionStartCollapsed();
  ActionLog($$anchor, {
    get uuid() {
      return get$1(actor).uuid;
    },
    dontSaveCollapse: actionLogSaveCollapse,
    startCollapsed: actionLogStartCollapsed,
    get collapsePrefix() {
      return ActionLogCollapsePrefix.NPCSheet;
    }
  }), pop();
}
__name(Activity$2, "Activity$2");
var root_3$e = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"><!> <div class="la-flexrow -wrapwrap -widthfull -gap0"><div class="la-flexcol -gap0 -flex1 -widthfull"><!> <!></div> <div class="la-flexcol -gap0 -flex1 -widthfull"><!> <!></div></div></div>'), root_6$e = /* @__PURE__ */ template('<div class="la-flexcol -widthfull -fontface-stylized"><div class="la-flexrow -widthfull"><div class="-width10"></div> <div class="-flex5"><!></div> <div class="-width10"></div></div> <span> </span></div>'), on_change$7 = /* @__PURE__ */ __name((event2, actor, data) => handleCustomFlagValueInput(event2, get$1(actor), CustomFlagKey.NPC, data()), "on_change$7"), root_7$9 = /* @__PURE__ */ template('<div class="-widthfull"><div class="la-shortstat la-flexrow la-text-text -fontsize6"><i></i> <div><input class="la-top__input -widthfull -medium -inset la-text-text -fontface-neutral -height4" type="text"> <span class="la-bottom__span"> </span></div></div></div>'), root_5$d = /* @__PURE__ */ template('<div class="la-flags la-flexcol -gap1 -widthfull"></div>'), root_11$a = /* @__PURE__ */ template('<details class="la-details -widthfull la-flexcol"><summary class="la-details__summary la-flexrow clipped-bot-alt la-bckg-repcap la-text-header -padding1-l -widthfull"><span class="la-left la-flexrow"><i class="la-icon mdi mdi-card-off-outline -fontsize4 -margin1-lr"></i> <span class="la-name__span -fontsize4"> </span></span></summary></details>'), root$k = /* @__PURE__ */ template("<!> <!> <!> <!>", 1);
function Status($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(activeEffectsCollID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions"), props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor);
  setActorContext(get$1(actor));
  let collapseAllButtonHover = state(!1);
  const logographic = logographicLanguage(), tooltipEnabled = getNPCSheetTooltipEnabled(), sidebarExes = /* @__PURE__ */ derived(() => getSidebarExecutables(get$1(actor).uuid)), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), activeEffectsCollID = /* @__PURE__ */ derived(() => `${get$1(actor).uuid}.status.activeEffects`), utilitiesCollID = /* @__PURE__ */ derived(() => `${get$1(actor).uuid}.status.utilities`), macrosCollID = /* @__PURE__ */ derived(() => `${get$1(actor).uuid}.status.macros`), customFlagsCollID = /* @__PURE__ */ derived(() => `${get$1(actor).uuid}.status.customFlags`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid)), customFlagsEmptyTipMain = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.tab.custom.empty.tooltip.0"))), customFlagsEmptyTipAlt = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(formatString(getLocalized("LA.tab.custom.empty.tooltip.1"), getLocalized("LA.tab.custom.flag.sidebarToggle.npc.label")))), customFlags = /* @__PURE__ */ derived(() => getCustomFlags(get$1(actor), CustomFlagKey.NPC)), visibleCustomFlags = /* @__PURE__ */ derived(() => Object.values(get$1(customFlags)).filter((flag) => flag.showInSidebar));
  var fragment_1 = root$k(), node = first_child(fragment_1);
  const expression = /* @__PURE__ */ derived(() => getLocalized("LA.tab.status.effects.label"));
  HeaderMain(node, {
    get text() {
      return get$1(expression);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-pilot"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-pilot"],
    get collapseID() {
      return get$1(activeEffectsCollID);
    },
    startCollapsed: !1,
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      ActiveEffects($$anchor2, spread_props(() => props, { tooltipEnabled, logging: !0 }));
    }, "children"),
    $$slots: { default: !0 }
  });
  var node_1 = sibling(node, 2);
  const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.npc.utilities.label"));
  HeaderMain(node_1, {
    get text() {
      return get$1(expression_1);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-pilot"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-pilot"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
    }, "extensionTextFunction"),
    get collapseID() {
      return get$1(utilitiesCollID);
    },
    startCollapsed: !1,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div = root_3$e(), node_2 = child(div);
      const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.npc.recharge.label")), expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.npc.recharge.tooltip")), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.action.startofturn.label"));
      FlowButton(node_2, {
        style: [
          "clipped-alt la-bckg-header-anti -padding0 -widthfull -overflowhidden -lineheight3"
        ],
        get text() {
          return get$1(expression_2);
        },
        get flowClass() {
          return FlowClass.RechargeFeatures;
        },
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipDirection() {
          return TooltipDirection.UP;
        },
        get tooltip() {
          return get$1(expression_3);
        },
        get tooltipHeader() {
          return get$1(expression_4);
        }
      });
      var div_1 = sibling(node_2, 2), div_2 = child(div_1), node_3 = child(div_2);
      const expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.rollAttack.label")), expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.rollAttack.tooltip"));
      FlowButton(node_3, {
        style: [
          "clipped-alt la-bckg-secondary -widthfull -overflowhidden -lineheight3"
        ],
        get text() {
          return get$1(expression_5);
        },
        get uuid() {
          return get$1(actor).uuid;
        },
        get flowClass() {
          return FlowClass.Standard;
        },
        flowType: "BasicAttack",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipDirection() {
          return TooltipDirection.UP;
        },
        get tooltip() {
          return get$1(expression_6);
        }
      });
      var node_4 = sibling(node_3, 2);
      const expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.rollDamage.label")), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.rollDamage.tooltip"));
      FlowButton(node_4, {
        style: [
          "clipped-alt la-bckg-secondary -widthfull -overflowhidden -lineheight3"
        ],
        get text() {
          return get$1(expression_7);
        },
        get uuid() {
          return get$1(actor).uuid;
        },
        get flowClass() {
          return FlowClass.Standard;
        },
        flowType: "Damage",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipDirection() {
          return TooltipDirection.UP;
        },
        get tooltip() {
          return get$1(expression_8);
        }
      });
      var div_3 = sibling(div_2, 2), node_5 = child(div_3);
      const expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.rollTechAttack.label")), expression_10 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.rollTechAttack.tooltip"));
      FlowButton(node_5, {
        style: [
          "clipped la-bckg-secondary -widthfull -overflowhidden -lineheight3"
        ],
        get text() {
          return get$1(expression_9);
        },
        get uuid() {
          return get$1(actor).uuid;
        },
        get flowClass() {
          return FlowClass.Standard;
        },
        flowType: "TechAttack",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipDirection() {
          return TooltipDirection.UP;
        },
        get tooltip() {
          return get$1(expression_10);
        }
      });
      var node_6 = sibling(node_5, 2);
      const expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.extinguish.label")), expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.action.endofturn.label")), expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.extinguish.tooltip"));
      FlowButton(node_6, {
        style: [
          "clipped la-bckg-secondary -widthfull -overflowhidden -lineheight3"
        ],
        get text() {
          return get$1(expression_11);
        },
        get uuid() {
          return get$1(actor).uuid;
        },
        get flowClass() {
          return FlowClass.Standard;
        },
        flowType: "Burn",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipDirection() {
          return TooltipDirection.UP;
        },
        get tooltipHeader() {
          return get$1(expression_12);
        },
        get tooltip() {
          return get$1(expression_13);
        }
      }), append($$anchor2, div);
    }, "children"),
    $$slots: { default: !0 }
  });
  var node_7 = sibling(node_1, 2);
  const expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.subLabel"));
  HeaderMain(node_7, {
    get text() {
      return get$1(expression_14);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-pilot"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-pilot"],
    get collapseID() {
      return get$1(customFlagsCollID);
    },
    startCollapsed: !1,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var fragment_3 = comment(), node_8 = first_child(fragment_3);
      {
        var consequent_1 = /* @__PURE__ */ __name(($$anchor3) => {
          var div_4 = root_5$d();
          {
            const createFractionBar = /* @__PURE__ */ __name(($$anchor4, data = noop) => {
              var div_5 = root_6$e(), div_6 = child(div_5), div_7 = sibling(child(div_6), 2), node_9 = child(div_7);
              const expression_15 = /* @__PURE__ */ derived(() => getCustomFlagPath(CustomFlagKey.NPC, data().id, "value"));
              StatusBar(node_9, {
                name: "",
                nameStyle: [logographic ? "-fontsizemedium" : ""],
                get dataName() {
                  return get$1(expression_15);
                },
                get currentValue() {
                  return data().content.value;
                },
                get maxValue() {
                  return data().content.max;
                },
                barStyle: ["la-bckg-custom"],
                barEditStyle: ["la-bckg-custom"],
                textStyle: ["la-text-text"],
                clipPath: "clipped-alt"
              });
              var span = sibling(div_6, 2);
              set_class(span, `-fontsizemedium -upper
                ${(logographic ? "" : "-bold") ?? ""}`);
              var text2 = child(span);
              template_effect(
                ($0) => {
                  set_attribute(div_7, "style", `--la-flag-custom: ${data().color ?? ""};`), set_attribute(span, "data-tooltip", $0), set_attribute(span, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span, "data-tooltip-direction", TooltipDirection.UP), set_text(text2, data().name);
                },
                [
                  () => tooltipEnabled && data().tooltip ? TooltipFactory.buildTooltip(data().tooltip) : void 0
                ]
              ), append($$anchor4, div_5);
            }, "createFractionBar"), createValueGlyph = /* @__PURE__ */ __name(($$anchor4, data = noop) => {
              var div_8 = root_7$9(), div_9 = child(div_8), i = child(div_9), div_10 = sibling(i, 2);
              set_class(div_10, `la-flexcol -divider -upper -fontface-stylized -fontsizemedium la-prmy-accent -textaligncenter
                    ${(logographic ? "" : "-bold") ?? ""}`);
              var input = child(div_10);
              input.__change = [on_change$7, actor, data];
              var span_1 = sibling(input, 2), text_1 = child(span_1);
              template_effect(
                ($0) => {
                  set_class(i, `${(data().icon ? data().icon : "mdi mdi-abacus") ?? ""} -alignselfcenter`), set_attribute(div_10, "data-tooltip", $0), set_attribute(div_10, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(div_10, "data-tooltip-direction", TooltipDirection.UP), set_value(input, data().content.value), set_text(text_1, data().name);
                },
                [
                  () => tooltipEnabled && data().tooltip ? TooltipFactory.buildTooltip(data().tooltip) : void 0
                ]
              ), event("focus", input, (event2) => event2.currentTarget.select()), append($$anchor4, div_8);
            }, "createValueGlyph");
            each(div_4, 21, () => get$1(visibleCustomFlags), (flag) => flag.id, ($$anchor4, flag) => {
              var fragment_4 = comment(), node_10 = first_child(fragment_4);
              {
                var consequent = /* @__PURE__ */ __name(($$anchor5) => {
                  createFractionBar($$anchor5, () => get$1(flag));
                }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor5) => {
                  createValueGlyph($$anchor5, () => get$1(flag));
                }, "alternate");
                if_block(node_10, ($$render) => {
                  get$1(flag).contentType === CustomFlagContentType.Fraction ? $$render(consequent) : $$render(alternate, !1);
                });
              }
              append($$anchor4, fragment_4);
            });
          }
          append($$anchor3, div_4);
        }, "consequent_1"), alternate_1 = /* @__PURE__ */ __name(($$anchor3) => {
          var details = root_11$a(), summary = child(details), span_2 = child(summary), span_3 = sibling(child(span_2), 2), text_2 = child(span_3);
          template_effect(
            ($0) => {
              set_attribute(summary, "data-tooltip", tooltipEnabled ? get$1(advancedOptions) ? get$1(customFlagsEmptyTipAlt) : get$1(customFlagsEmptyTipMain) : void 0), set_attribute(summary, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(summary, "data-tooltip-direction", TooltipDirection.UP), set_text(text_2, $0);
            },
            [
              () => getLocalized("LA.tab.custom.empty.label")
            ]
          ), append($$anchor3, details);
        }, "alternate_1");
        if_block(node_8, ($$render) => {
          get$1(visibleCustomFlags).length ? $$render(consequent_1) : $$render(alternate_1, !1);
        });
      }
      append($$anchor2, fragment_3);
    }, "children"),
    $$slots: { default: !0 }
  });
  var node_11 = sibling(node_7, 2);
  const expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.npc.macros.label"));
  HeaderMain(node_11, {
    get text() {
      return get$1(expression_16);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-pilot"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-pilot"],
    get collapseID() {
      return get$1(macrosCollID);
    },
    startCollapsed: !1,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      const expression_17 = /* @__PURE__ */ derived(() => [
        FLOW_BUTTON_DEFAULT(),
        get$1(advancedOptions) ? "-margin8-l" : ""
      ]);
      MacroDropBox($$anchor2, {
        get uuid() {
          return get$1(actor).uuid;
        },
        get getExes() {
          return get$1(sidebarExes);
        },
        setExes: setSidebarExecutables,
        hintDropArea: !1,
        get allowDrop() {
          return get$1(advancedOptions);
        },
        get buttonStyle() {
          return get$1(expression_17);
        },
        innerStyle: ["-gap0"],
        tooltipEnabled
      });
    }, "children"),
    $$slots: { default: !0 }
  }), append($$anchor, fragment_1), pop();
}
__name(Status, "Status");
delegate(["change"]);
const headerSecondaryInnerLeftOptions$2 = /* @__PURE__ */ __name(($$anchor) => {
  var i = root_2$8();
  append($$anchor, i);
}, "headerSecondaryInnerLeftOptions$2");
var root_1$a = /* @__PURE__ */ template("<!> <!>", 1), root_2$8 = /* @__PURE__ */ template('<i class="mdi mdi-code-json -padding0-lr"></i>'), root_5$c = /* @__PURE__ */ template("<i></i>"), on_change$6 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { name: event2.target.value }), "on_change$6"), root_9$b = /* @__PURE__ */ template('<input type="text" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr">'), on_change_1$4 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { contentType: event2.target.value }), "on_change_1$4"), root_10$9 = /* @__PURE__ */ template('<select class="la-customvalue__select la-text-text -bordersround -small la-brdr-repcap -padding0-lr -widthfull"><option> </option><option> </option></select>'), on_change_2$3 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2, flag) => handleUpdateCustomFlag($$props.actor, id2(), {
  content: {
    ...flag().content,
    value: Number(event2.target.value)
  }
}), "on_change_2$3"), on_change_3$3 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2, flag) => handleUpdateCustomFlag($$props.actor, id2(), {
  content: {
    ...flag().content,
    max: Number(event2.target.value)
  }
}), "on_change_3$3"), on_change_4$3 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2, flag) => handleUpdateCustomFlag($$props.actor, id2(), {
  content: {
    ...flag().content,
    min: Number(event2.target.value)
  }
}), "on_change_4$3"), root_12$7 = /* @__PURE__ */ template('<div class="la-flexcol -gap0"><span class="-fontsizesmall -upper"> </span> <input type="number" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr"></div> <div class="la-flexcol -gap0"><span class="-fontsizesmall -upper"> </span> <input type="number" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr"></div>', 1), root_11$9 = /* @__PURE__ */ template('<div class="la-flexrow -gap1"><div class="la-flexcol -gap0"><span class="-fontsizesmall -upper"> </span> <input type="number" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr"></div> <!></div>'), on_change_5$2 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { showInSidebar: event2.target.checked }), "on_change_5$2"), root_13$7 = /* @__PURE__ */ template('<input type="checkbox" class="-widthfull">'), on_change_6$2 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { color: event2.target.value }), "on_change_6$2"), root_14$5 = /* @__PURE__ */ template('<input type="color" class="la-customvalue__input -widthfull">'), on_change_7$2 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { icon: event2.target.value }), "on_change_7$2"), root_15$6 = /* @__PURE__ */ template('<input type="text" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr">'), on_change_8$2 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { tooltip: event2.target.value }), "on_change_8$2"), root_16$4 = /* @__PURE__ */ template('<input type="text" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr">'), root_19$3 = /* @__PURE__ */ template('<span class=" -upper"> </span> <input type="text" readonly=""> <span class=" -upper"> </span> <input type="text" readonly="">', 1), root_18$3 = /* @__PURE__ */ template('<div class="la-combine-grid -horizontal2-auto -aligncenter -gap1 -widthfull"><span class=" -upper"> </span> <input type="text" readonly=""> <!></div>'), root_21$3 = /* @__PURE__ */ template('<span class=" -upper"> </span> <input type="text" readonly=""> <span class=" -upper"> </span> <input type="text" readonly="">', 1), root_20$4 = /* @__PURE__ */ template('<div class="la-combine-grid -horizontal2-auto -aligncenter -gap1 -widthfull"><span class=" -upper"> </span> <input type="text" readonly=""> <!></div>'), root_17$4 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!></div>'), root_8$7 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!> <!> <!> <!> <!></div>'), root_3$d = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"></div>'), root$j = /* @__PURE__ */ template('<div class="la-custom__list la-flexcol -widthfull"><!></div>');
function Custom$2($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment = root_1$a(), node = first_child(fragment);
    const expression = /* @__PURE__ */ derived(() => [
      "la-text-header la-prmy-header la-scdy-primary -fontsize5 -alignselfcenter",
      qualityMode ? " -glow-prmy -glow-scdy-hover " : "",
      get$1(sortable) ? " mdi mdi-sort-variant-lock-open " : " mdi mdi-sort-variant-lock "
    ]), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.sort.tooltip")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.sort.tooltip"));
    GlyphButton(node, {
      type: "button",
      get flowClass() {
        return FlowClass.None;
      },
      get style() {
        return get$1(expression);
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_1);
      },
      get logText() {
        return get$1(expression_2);
      },
      logging: !0,
      onClick: /* @__PURE__ */ __name(() => setCustomFlagsSortable($$props.actor.uuid, !get$1(sortable)), "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(sortButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(sortButtonHover, !1);
      }, "onPointerLeave")
    });
    var node_1 = sibling(node, 2);
    const expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.add.tooltip")), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.add.tooltip"));
    GlyphButton(node_1, {
      type: "button",
      get flowClass() {
        return FlowClass.None;
      },
      style: [
        "mdi mdi-plus-thick la-text-header la-prmy-header la-scdy-primary -fontsize5 -alignselfcenter",
        qualityMode ? " -glow-prmy -glow-scdy-hover " : ""
      ],
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_3);
      },
      get logText() {
        return get$1(expression_4);
      },
      logging: !0,
      onClick: /* @__PURE__ */ __name((event2) => handleAddCustomFlag(event2, $$props.actor), "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(addButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(addButtonHover, !1);
      }, "onPointerLeave")
    }), append($$anchor2, fragment);
  }, "headerOptions");
  setActorContext($$props.actor);
  let component = state(null), deleteButtonHover = state(!1), addButtonHover = state(!1), sortButtonHover = state(!1);
  const theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), customFlags = /* @__PURE__ */ derived(() => getCustomFlags($$props.actor, CustomFlagKey.NPC)), flagEntries = /* @__PURE__ */ derived(() => Object.entries(get$1(customFlags))), sortable = /* @__PURE__ */ derived(() => getCustomFlagsSortable($$props.actor.uuid)), tooltipEnabled = getNPCSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), refCopyTip = TooltipFactory.buildTooltip(getLocalized("LA.tab.custom.flag.ref.tooltip")), enrichCopyTip = TooltipFactory.buildTooltip(getLocalized("LA.tab.custom.flag.enricher.tooltip"));
  function handleAddCustomFlag(_event, actor) {
    addCustomFlag(actor, CustomFlagKey.NPC);
  }
  __name(handleAddCustomFlag, "handleAddCustomFlag");
  function handleDeleteCustomFlag(event2, actor, id2) {
    event2.stopPropagation(), deleteCustomFlag(actor, CustomFlagKey.NPC, id2);
  }
  __name(handleDeleteCustomFlag, "handleDeleteCustomFlag");
  function handleUpdateCustomFlag(actor, id2, changes) {
    updateCustomFlag(actor, CustomFlagKey.NPC, id2, changes);
  }
  __name(handleUpdateCustomFlag, "handleUpdateCustomFlag");
  function handleReorderCustomFlag(_event, dropData, thisData) {
    dropData.type === LADataType.Sorting && reorderCustomFlags($$props.actor, CustomFlagKey.NPC, dropData.index, thisData.index);
  }
  __name(handleReorderCustomFlag, "handleReorderCustomFlag");
  function getTypeIcon(type) {
    return type == CustomFlagContentType.Fraction ? "mdi-fraction-one-half" : "mdi-numeric";
  }
  __name(getTypeIcon, "getTypeIcon");
  var div = root$j(), node_2 = child(div);
  const expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.subLabel"));
  HeaderMain(node_2, {
    get text() {
      return get$1(expression_5);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-transparent clipped-bot-alt"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(addButtonHover)) return `--${getLocalized("LA.tab.custom.add.extension")}`;
      if (get$1(sortButtonHover)) return `--${getLocalized("LA.tab.custom.sort.extension")}`;
    }, "extensionTextFunction"),
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div_1 = root_3$d();
      each(div_1, 23, () => get$1(flagEntries), ([id2, flag]) => id2, ($$anchor3, $$item, index2) => {
        let id2 = /* @__PURE__ */ __name(() => get$1($$item)[0], "id"), flag = /* @__PURE__ */ __name(() => get$1($$item)[1], "flag");
        const headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor4) => {
          var i_1 = root_5$c();
          template_effect(
            ($0) => set_class(i_1, `mdi -padding0-lr
                ${$0 ?? ""}`),
            [() => getTypeIcon(flag().contentType)]
          ), append($$anchor4, i_1);
        }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor4) => {
          const expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.delete.tooltip")), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.delete.tooltip"));
          GlyphButton($$anchor4, {
            type: "button",
            get flowClass() {
              return FlowClass.None;
            },
            style: [
              "mdi mdi-close-thick la-prmy-header la-scdy-primary -fontsize5 -alignselfcenter",
              qualityMode ? " -glow-prmy -glow-scdy-hover " : ""
            ],
            tooltipEnabled,
            get tooltipDirection() {
              return TooltipDirection.UP;
            },
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltip() {
              return get$1(expression_6);
            },
            get logText() {
              return get$1(expression_7);
            },
            logging: !0,
            onClick: /* @__PURE__ */ __name((event2) => handleDeleteCustomFlag(event2, $$props.actor, id2()), "onClick"),
            onPointerEnter: /* @__PURE__ */ __name(() => {
              set(deleteButtonHover, !0);
            }, "onPointerEnter"),
            onPointerLeave: /* @__PURE__ */ __name(() => {
              set(deleteButtonHover, !1);
            }, "onPointerLeave")
          });
        }, "headerSecondaryRightOptions"), expression_8 = /* @__PURE__ */ derived(() => [get$1(sortable) ? "-padding5-l" : ""]), expression_9 = /* @__PURE__ */ derived(() => [get$1(sortable) ? "" : "-displaynone"]), expression_10 = /* @__PURE__ */ derived(() => ({
          type: LADataType.Sorting,
          index: get$1(index2)
        })), expression_11 = /* @__PURE__ */ derived(() => !get$1(sortable));
        DragDropHandle($$anchor3, {
          get style() {
            return get$1(expression_8);
          },
          get iconStyle() {
            return get$1(expression_9);
          },
          get index() {
            return get$1(index2);
          },
          get root() {
            return get$1(component);
          },
          get data() {
            return get$1(expression_10);
          },
          onDrop: handleReorderCustomFlag,
          deleteDisabled: !0,
          logging: !1,
          get disabled() {
            return get$1(expression_11);
          },
          children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
            const expression_12 = /* @__PURE__ */ derived(() => flag().name || getLocalized("LA.tab.custom.flag.name.label")), expression_13 = /* @__PURE__ */ derived(() => `custom.${id2()}`);
            HeaderSecondary($$anchor4, {
              get text() {
                return get$1(expression_12);
              },
              headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
              textStyle: [H2_TEXT_SIZE, "-fontface-stylized"],
              borderStyle: ["la-brdr-pilot"],
              extensionTextFunction: /* @__PURE__ */ __name(() => {
                if (get$1(deleteButtonHover)) return `--${getLocalized("LA.tab.custom.delete.extension")}`;
              }, "extensionTextFunction"),
              get collapseID() {
                return get$1(expression_13);
              },
              startCollapsed: !1,
              contentLeft: headerSecondaryLeftOptions2,
              contentRight: headerSecondaryRightOptions,
              children: /* @__PURE__ */ __name(($$anchor5, $$slotProps3) => {
                var div_2 = root_8$7(), node_3 = child(div_2);
                const expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.name.label"));
                EffectBox(node_3, {
                  get name() {
                    return get$1(expression_14);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input = root_9$b();
                    input.__change = [
                      on_change$6,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(
                      ($0) => {
                        set_value(input, flag().name), set_attribute(input, "placeholder", $0);
                      },
                      [() => getLocalized("LA.namePlaceholder")]
                    ), event("focus", input, (event2) => event2.currentTarget.select()), append($$anchor6, input);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_4 = sibling(node_3, 2);
                const expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.contentType.label"));
                EffectBox(node_4, {
                  get name() {
                    return get$1(expression_15);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var select = root_10$9();
                    select.__change = [
                      on_change_1$4,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ];
                    var option = child(select), option_value = {}, text2 = child(option), option_1 = sibling(option), option_1_value = {}, text_1 = child(option_1);
                    template_effect(
                      ($0, $1) => {
                        option_value !== (option_value = CustomFlagContentType.Value) && (option.value = (option.__value = CustomFlagContentType.Value) == null ? "" : CustomFlagContentType.Value), set_selected(option, flag().contentType === CustomFlagContentType.Value), set_text(text2, $0), option_1_value !== (option_1_value = CustomFlagContentType.Fraction) && (option_1.value = (option_1.__value = CustomFlagContentType.Fraction) == null ? "" : CustomFlagContentType.Fraction), set_selected(option_1, flag().contentType === CustomFlagContentType.Fraction), set_text(text_1, $1);
                      },
                      [
                        () => getLocalized("LA.tab.custom.flag.contentType.value.label"),
                        () => getLocalized("LA.tab.custom.flag.contentType.fraction.label")
                      ]
                    ), append($$anchor6, select);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_5 = sibling(node_4, 2);
                const expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.content.label"));
                EffectBox(node_5, {
                  get name() {
                    return get$1(expression_16);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var div_3 = root_11$9(), div_4 = child(div_3), span = child(div_4), text_2 = child(span), input_1 = sibling(span, 2);
                    input_1.__change = [
                      on_change_2$3,
                      handleUpdateCustomFlag,
                      $$props,
                      id2,
                      flag
                    ];
                    var node_6 = sibling(div_4, 2);
                    {
                      var consequent = /* @__PURE__ */ __name(($$anchor7) => {
                        var fragment_4 = root_12$7(), div_5 = first_child(fragment_4), span_1 = child(div_5), text_3 = child(span_1), input_2 = sibling(span_1, 2);
                        input_2.__change = [
                          on_change_3$3,
                          handleUpdateCustomFlag,
                          $$props,
                          id2,
                          flag
                        ];
                        var div_6 = sibling(div_5, 2), span_2 = child(div_6), text_4 = child(span_2), input_3 = sibling(span_2, 2);
                        input_3.__change = [
                          on_change_4$3,
                          handleUpdateCustomFlag,
                          $$props,
                          id2,
                          flag
                        ], template_effect(
                          ($0, $1) => {
                            set_text(text_3, $0), set_value(input_2, flag().content.max), set_text(text_4, $1), set_value(input_3, flag().content.min);
                          },
                          [
                            () => getLocalized("LA.tab.custom.flag.content.max.label"),
                            () => getLocalized("LA.tab.custom.flag.content.min.label")
                          ]
                        ), event("focus", input_2, (event2) => event2.currentTarget.select()), event("focus", input_3, (event2) => event2.currentTarget.select()), append($$anchor7, fragment_4);
                      }, "consequent");
                      if_block(node_6, ($$render) => {
                        flag().contentType === CustomFlagContentType.Fraction && $$render(consequent);
                      });
                    }
                    template_effect(
                      ($0) => {
                        set_text(text_2, $0), set_value(input_1, flag().content.value);
                      },
                      [
                        () => getLocalized("LA.tab.custom.flag.content.value.label")
                      ]
                    ), event("focus", input_1, (event2) => event2.currentTarget.select()), append($$anchor6, div_3);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_7 = sibling(node_5, 2);
                const expression_17 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.sidebarToggle.npc.label"));
                EffectBox(node_7, {
                  get name() {
                    return get$1(expression_17);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_4 = root_13$7();
                    input_4.__change = [
                      on_change_5$2,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_checked(input_4, flag().showInSidebar)), append($$anchor6, input_4);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_8 = sibling(node_7, 2);
                const expression_18 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.color.label"));
                EffectBox(node_8, {
                  get name() {
                    return get$1(expression_18);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_5 = root_14$5();
                    input_5.__change = [
                      on_change_6$2,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_value(input_5, flag().color)), append($$anchor6, input_5);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_9 = sibling(node_8, 2);
                const expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.icon.label"));
                EffectBox(node_9, {
                  get name() {
                    return get$1(expression_19);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_6 = root_15$6();
                    set_attribute(input_6, "placeholder", "mdi mdi-abacus"), input_6.__change = [
                      on_change_7$2,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_value(input_6, flag().icon)), event("focus", input_6, (event2) => event2.currentTarget.select()), append($$anchor6, input_6);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_10 = sibling(node_9, 2);
                const expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.tooltip.label"));
                EffectBox(node_10, {
                  get name() {
                    return get$1(expression_20);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_7 = root_16$4();
                    input_7.__change = [
                      on_change_8$2,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_value(input_7, flag().tooltip)), event("focus", input_7, (event2) => event2.currentTarget.select()), append($$anchor6, input_7);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_11 = sibling(node_10, 2);
                const expression_21 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.assist.label")), expression_22 = /* @__PURE__ */ derived(() => `custom.${id2()}.assist`);
                HeaderSecondary(node_11, {
                  get text() {
                    return get$1(expression_21);
                  },
                  headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
                  textStyle: [H2_TEXT_SIZE, "-fontface-stylized"],
                  borderStyle: ["la-brdr-pilot"],
                  get collapseID() {
                    return get$1(expression_22);
                  },
                  startCollapsed: !1,
                  contentLeft: headerSecondaryInnerLeftOptions$2,
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var div_7 = root_17$4(), node_12 = child(div_7);
                    const expression_23 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.ref.label"));
                    EffectBox(node_12, {
                      get name() {
                        return get$1(expression_23);
                      },
                      children: /* @__PURE__ */ __name(($$anchor7, $$slotProps5) => {
                        var div_8 = root_18$3(), span_3 = child(div_8), text_5 = child(span_3), input_8 = sibling(span_3, 2);
                        set_attribute(input_8, "data-tooltip", tooltipEnabled ? refCopyTip : void 0);
                        var node_13 = sibling(input_8, 2);
                        {
                          var consequent_1 = /* @__PURE__ */ __name(($$anchor8) => {
                            var fragment_5 = root_19$3(), span_4 = first_child(fragment_5), text_6 = child(span_4), input_9 = sibling(span_4, 2);
                            set_attribute(input_9, "data-tooltip", tooltipEnabled ? refCopyTip : void 0);
                            var span_5 = sibling(input_9, 2), text_7 = child(span_5), input_10 = sibling(span_5, 2);
                            set_attribute(input_10, "data-tooltip", tooltipEnabled ? refCopyTip : void 0), template_effect(
                              ($0, $1, $2, $3, $4) => {
                                set_text(text_6, $0), set_class(input_9, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_9, $2), set_attribute(input_9, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_9, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text_7, $3), set_class(input_10, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_10, $4), set_attribute(input_10, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_10, "data-tooltip-direction", TooltipDirection.DOWN);
                              },
                              [
                                () => getLocalized("LA.tab.custom.flag.content.max.label"),
                                () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                                () => getCustomFlagPath(CustomFlagKey.NPC, id2(), "max"),
                                () => getLocalized("LA.tab.custom.flag.content.min.label"),
                                () => getCustomFlagPath(CustomFlagKey.NPC, id2(), "min")
                              ]
                            ), event("pointerenter", input_9, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.ref.tooltip"), $$props.actor.uuid)), event("pointerleave", input_9, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_9, (event2) => event2.currentTarget.select()), event("pointerenter", input_10, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.ref.tooltip"), $$props.actor.uuid)), event("pointerleave", input_10, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_10, (event2) => event2.currentTarget.select()), append($$anchor8, fragment_5);
                          }, "consequent_1");
                          if_block(node_13, ($$render) => {
                            flag().contentType === CustomFlagContentType.Fraction && $$render(consequent_1);
                          });
                        }
                        template_effect(
                          ($0, $1, $2) => {
                            set_text(text_5, $0), set_class(input_8, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                        ${$1 ?? ""}`), set_value(input_8, $2), set_attribute(input_8, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_8, "data-tooltip-direction", TooltipDirection.DOWN);
                          },
                          [
                            () => getLocalized("LA.tab.custom.flag.content.value.label"),
                            () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                            () => getCustomFlagPath(CustomFlagKey.NPC, id2(), "value")
                          ]
                        ), event("pointerenter", input_8, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.ref.tooltip"), $$props.actor.uuid)), event("pointerleave", input_8, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_8, (event2) => event2.currentTarget.select()), append($$anchor7, div_8);
                      }, "children"),
                      $$slots: { default: !0 }
                    });
                    var node_14 = sibling(node_12, 2);
                    const expression_24 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.enricher.label"));
                    EffectBox(node_14, {
                      get name() {
                        return get$1(expression_24);
                      },
                      children: /* @__PURE__ */ __name(($$anchor7, $$slotProps5) => {
                        var div_9 = root_20$4(), span_6 = child(div_9), text_8 = child(span_6), input_11 = sibling(span_6, 2);
                        set_attribute(input_11, "data-tooltip", tooltipEnabled ? enrichCopyTip : void 0);
                        var node_15 = sibling(input_11, 2);
                        {
                          var consequent_2 = /* @__PURE__ */ __name(($$anchor8) => {
                            var fragment_6 = root_21$3(), span_7 = first_child(fragment_6), text_9 = child(span_7), input_12 = sibling(span_7, 2);
                            set_attribute(input_12, "data-tooltip", tooltipEnabled ? enrichCopyTip : void 0);
                            var span_8 = sibling(input_12, 2), text_10 = child(span_8), input_13 = sibling(span_8, 2);
                            set_attribute(input_13, "data-tooltip", tooltipEnabled ? enrichCopyTip : void 0), template_effect(
                              ($0, $1, $2, $3, $4) => {
                                set_text(text_9, $0), set_class(input_12, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_12, $2), set_attribute(input_12, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_12, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text_10, $3), set_class(input_13, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_13, $4), set_attribute(input_13, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_13, "data-tooltip-direction", TooltipDirection.DOWN);
                              },
                              [
                                () => getLocalized("LA.tab.custom.flag.content.max.label"),
                                () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                                () => getEnricher($$props.actor.uuid, CustomFlagKey.NPC, id2(), "max"),
                                () => getLocalized("LA.tab.custom.flag.content.min.label"),
                                () => getEnricher($$props.actor.uuid, CustomFlagKey.NPC, id2(), "min")
                              ]
                            ), event("pointerenter", input_12, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.enricher.tooltip"), $$props.actor.uuid)), event("pointerleave", input_12, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_12, (event2) => event2.currentTarget.select()), event("pointerenter", input_13, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.enricher.tooltip"), $$props.actor.uuid)), event("pointerleave", input_13, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_13, (event2) => event2.currentTarget.select()), append($$anchor8, fragment_6);
                          }, "consequent_2");
                          if_block(node_15, ($$render) => {
                            flag().contentType === CustomFlagContentType.Fraction && $$render(consequent_2);
                          });
                        }
                        template_effect(
                          ($0, $1, $2) => {
                            set_text(text_8, $0), set_class(input_11, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                        ${$1 ?? ""}`), set_value(input_11, $2), set_attribute(input_11, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_11, "data-tooltip-direction", TooltipDirection.DOWN);
                          },
                          [
                            () => getLocalized("LA.tab.custom.flag.content.value.label"),
                            () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                            () => getEnricher($$props.actor.uuid, CustomFlagKey.NPC, id2(), "value")
                          ]
                        ), event("pointerenter", input_11, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.enricher.tooltip"), $$props.actor.uuid)), event("pointerleave", input_11, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_11, (event2) => event2.currentTarget.select()), append($$anchor7, div_9);
                      }, "children"),
                      $$slots: { default: !0 }
                    }), append($$anchor6, div_7);
                  }, "children"),
                  $$slots: { default: !0 }
                }), append($$anchor5, div_2);
              }, "children"),
              $$slots: { default: !0 }
            });
          }, "children"),
          $$slots: { default: !0 }
        });
      }), bind_this(div_1, ($$value) => set(component, $$value), () => get$1(component)), append($$anchor2, div_1);
    }, "children"),
    $$slots: { default: !0 }
  }), append($$anchor, div), pop();
}
__name(Custom$2, "Custom$2");
delegate(["change"]);
function CustomToggle$2($$anchor, $$props) {
  push($$props, !0);
  const advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState($$props.actor.uuid));
  user_effect(() => {
    var _a;
    (_a = $$props.button) == null || _a.classList.toggle("-displaynone", !get$1(advancedOptions));
  }), pop();
}
__name(CustomToggle$2, "CustomToggle$2");
const _NPCSheetBase = class _NPCSheetBase {
  static get mergeOptions() {
    return {
      classes: [
        "la-common la-override__header clipped-alt",
        "lancer sheet actor npc",
        getCSSSystemTheme()
      ],
      template: TEMPLATE_PATHS.npcSheetSvelte,
      width: getNPCSheetWidth() || 500,
      height: getNPCSheetHeight() || 800,
      tabs: [
        {
          navSelector: ".la-tabs",
          contentSelector: ".la-content",
          initial: "loadout"
        }
      ],
      scrollY: [".la-SVELTE-LOADOUT", ".la-SVELTE-STATUS", ".la-SVELTE-CUSTOM", ".la-SVELTE-ACTIVITY"]
    };
  }
  static setupSheet() {
    var _a;
    const LANPCSheet = (_a = class extends game.lancer.applications.LancerNPCSheet {
      constructor(...args) {
        super(...args), Hooks.on("laOverrideTheme", (uuid, theme) => {
          uuid === this.actor.uuid && (setThemeKey(this.actor.uuid, theme), this.render());
        }), Hooks.on("updateActor", (document2, changes) => {
          var _a2, _b;
          document2.uuid === this.actor.uuid && ((_b = (_a2 = changes.prototypeToken) == null ? void 0 : _a2.texture) != null && _b.src) && getActorTokenSync$1(this.actor.uuid) && (setSelectedTokenImage(this.actor.uuid, changes.prototypeToken.texture.src), isValidImageContainer(changes.prototypeToken.texture.src) && this.actor.update({ img: changes.prototypeToken.texture.src }));
        }), Hooks.on("closeSettingsConfig", () => {
          this.render();
        });
      }
      static get defaultOptions() {
        return foundry.utils.mergeObject(super.defaultOptions, _NPCSheetBase.mergeOptions);
      }
      async getData() {
        return await super.getData();
      }
      // (#10)
      // @ts-expect-error We're overriding a function in LancerActorSheet
      _propagateData(formData) {
        super._propagateData(formData), delete formData["prototypeToken.texture.src"];
        const updateToken = getSelectedTokenImage(this.actor.uuid);
        updateToken && (formData["prototypeToken.texture.src"] = updateToken);
      }
      async _injectHTML(html2) {
        super._injectHTML(html2), setThemeKey(this.actor.uuid, getThemeOverride$1(this.actor.uuid)), applyThemeTo(this.element, getThemeKey(this.actor.uuid)), this.mountComponents(html2, dataMap[this.actor.uuid]);
      }
      async _replaceHTML(element, html2) {
        super._replaceHTML(element, html2), applyThemeTo(element, getThemeKey(this.actor.uuid)), flushSync(() => this.mountComponents(html2, dataMap[this.actor.uuid]));
      }
      mountComponents(html2, data) {
        unregisterTrackedHooks(this.actor.uuid), mount(
          Header$2,
          {
            target: html2.find(".la-SVELTE-HEADER")[0],
            props: data
          }
        ), mount(
          Loadout,
          {
            target: html2.find(".la-SVELTE-LOADOUT")[0],
            props: data
          }
        ), mount(
          Status,
          {
            target: html2.find(".la-SVELTE-STATUS")[0],
            props: data
          }
        ), mount(
          Activity$2,
          {
            target: html2.find(".la-SVELTE-ACTIVITY")[0],
            props: data
          }
        ), mount(Custom$2, {
          target: html2.find(".la-SVELTE-CUSTOM")[0],
          props: data
        }), mount(CustomToggle$2, {
          // (#14)
          target: html2.find(".la-tabs")[0],
          props: {
            actor: data.actor,
            button: html2.find('.la-tabs>[data-tab="custom"]')[0]
          }
        });
      }
    }, __name(_a, "LANPCSheet"), _a);
    foundry.documents.collections.Actors.registerSheet(LancerAlternative.Name, LANPCSheet, {
      types: ["npc"],
      // Lancer system actor subtype (registered by the system at runtime)
      label: getLocalized("LA.SHEET.npc.label"),
      makeDefault: !1
    });
  }
};
__name(_NPCSheetBase, "NPCSheetBase");
let NPCSheetBase = _NPCSheetBase;
var root_2$7 = /* @__PURE__ */ template("<i></i> <!>", 1), root_3$c = /* @__PURE__ */ template("<!> <!>", 1), root_1$9 = /* @__PURE__ */ template('<div class="la-settings__island la-flexcol -alignend -padding1-r -positionabsolute -right0 -top0" style="z-index: 2;"><div class="la-flexrow -alignend"><!> <!></div> <!></div>'), root_5$b = /* @__PURE__ */ template(`<div class="la-actorname la-flexcol -padding3-l -padding3-t -widthfull"><div class="la-flexrow -widthfull"><input type="text" class="la-actorname__input la-pilotname la-text-header -fontsize6 -upper -letterspacing1 -textalignleft -textoverflowellipsis
                charname"> <span class="-fontsizesmall la-text-darken-4 -fontface-stylized"> </span></div></div>`), root_6$d = /* @__PURE__ */ template(`<div class="la-actorname la-flexcol -padding3-l -widthfull"><div class="la-flexrow -widthfull"><input type="text" class="la-actorname__input la-callsign la-text-header -upper -fontsize4 -letterspacing0 -textalignleft -fontface-stylized
                charname"> <span class="-fontsizesmall la-text-darken-4 -fontface-stylized"> </span></div> <div class="la-flexrow -widthfull"><input type="text" class="la-actorname__input la-pilotbackground la-text-header -upper -fontsizemedium -letterspacing0 -textalignleft -fontface-stylized
            charname"> <span class="-fontsizesmall la-text-darken-4 -fontface-stylized"> </span></div></div>`), root_9$a = /* @__PURE__ */ template('<i class="mdi mdi-cable-data -fontsize6"></i> <span> </span>', 1), root_10$8 = /* @__PURE__ */ template("<i></i> <span> </span>", 1), root_11$8 = /* @__PURE__ */ template('<i class="mdi mdi-heart-pulse -fontsize6"></i> <span> </span>', 1), root_13$6 = /* @__PURE__ */ template('<i class="mdi mdi-heart-pulse -fontsize6"></i> <span> </span>', 1), root_15$5 = /* @__PURE__ */ template("<i></i> <span> </span>", 1), root_17$3 = /* @__PURE__ */ template("<i></i> <span> </span>", 1), root_19$2 = /* @__PURE__ */ template("<i></i> <span> </span>", 1), root_20$3 = /* @__PURE__ */ template("<i></i> <span> </span>", 1), root_8$6 = /* @__PURE__ */ template('<div class="la-pilotfluff la-flexrow -positionabsolute la-flexcol -padding0-lr -pointerdisable"><span class="la-text-darken-2 -textalignjustify -flex1"> </span></div> <div class="-positionrelative"><div class="la-flexcol -positionabsolute -padding3-t -padding1-lr la-text-lighten-7"><div class="la-flexrow -justifystart -widthfull"><i class="mdi mdi-fingerprint -fontsize6"></i> <span> </span></div> <div class="la-flexrow -justifystart -widthfull"><!></div> <div class="la-flexrow -justifystart -widthfull"><!></div></div></div>', 1), root_21$2 = /* @__PURE__ */ template(`<span class="la-textlog__wrapper -left0 -positionabsolute -padding1
        -pointerdisable"><!></span>`), root$i = /* @__PURE__ */ template('<div class="la-header-content -positionrelative -heightfull -overflowhidden -aligncontentstart" style="display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto;"><!> <div class="-positionrelative -alignstart -overflowhidden" style="grid-area: 1 / 1; z-index: 0;"><!></div> <hr class="la-divider-h -spacemedium -padding0-b la-bckg-header" style="grid-area: 2 / 1 / 2 / -1; z-index: 1;"> <div class="-positionrelative -overflowhidden" style="grid-area: 3 / 1; z-index: 0;"><!></div> <div class="-positionabsolute -widthhalf -right0 -top0" style="z-index: 0;"><!></div> <div class="-positionabsolute -widthhalf -right0 -top0" style="z-index: 1;"><!></div> <!></div>');
function Header$1($$anchor, $$props) {
  push($$props, !0);
  const advancedOptionsToggle = /* @__PURE__ */ __name(($$anchor2) => {
    var div = root_1$9(), div_1 = child(div), node = child(div_1);
    {
      var consequent = /* @__PURE__ */ __name(($$anchor3) => {
        var fragment = root_2$7(), i = first_child(fragment);
        set_class(i, `mdi mdi-mouse-move-vertical -fontsize6 la-text-header la-prmy-primary
                ${(qualityMode ? "-glow-prmy" : "") ?? ""}`);
        var node_1 = sibling(i, 2);
        const expression = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.reset.tooltip")), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.reset.tooltip"));
        GlyphButton(node_1, {
          get flowClass() {
            return FlowClass.None;
          },
          style: [
            "mdi mdi-image-sync -fontsize6 la-text-header -width7 la-prmy-primary la-scdy-header",
            qualityMode ? "-glow-prmy -glow-scdy-hover" : ""
          ],
          onClick: /* @__PURE__ */ __name(() => resetImageSettings(get$1(actor).uuid, imageComponent), "onClick"),
          tooltipEnabled,
          get tooltipTheme() {
            return get$1(theme);
          },
          get tooltip() {
            return get$1(expression);
          },
          get tooltipDirection() {
            return TooltipDirection.LEFT;
          },
          get logText() {
            return get$1(expression_1);
          },
          logging: !0
        }), template_effect(
          ($0) => {
            set_attribute(i, "data-tooltip", $0), set_attribute(i, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i, "data-tooltip-direction", TooltipDirection.LEFT);
          },
          [
            () => TooltipFactory.buildTooltip(getLocalized([
              "LA.advanced.imageOffset.tooltip",
              "LA.advanced.imageSize.tooltip"
            ]))
          ]
        ), append($$anchor3, fragment);
      }, "consequent");
      if_block(node, ($$render) => {
        get$1(advancedOptions) && $$render(consequent);
      });
    }
    var node_2 = sibling(node, 2);
    AdvancedButton(node_2, {
      style: [
        "-fontsize5 la-prmy-primary la-scdy-header",
        qualityMode ? "-glow-prmy -glow-scdy-hover" : ""
      ],
      get uuid() {
        return get$1(actor).uuid;
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      logging: !0
    });
    var node_3 = sibling(div_1, 2);
    {
      var consequent_2 = /* @__PURE__ */ __name(($$anchor3) => {
        var fragment_1 = root_3$c(), node_4 = first_child(fragment_1);
        LockImageButton(node_4, {
          style: `-fontsize7 la-text-header la-prmy-primary la-scdy-header
            ${(qualityMode ? "-glow-prmy -glow-scdy-hover" : "") ?? ""}`,
          get actor() {
            return get$1(actor);
          },
          setState: setActorTokenSync$3,
          tooltipEnabled,
          get tooltipDirection() {
            return TooltipDirection.LEFT;
          },
          logging: !0
        });
        var node_5 = sibling(node_4, 2);
        {
          var consequent_1 = /* @__PURE__ */ __name(($$anchor4) => {
            const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.actor.tooltip")), expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.actor.tooltip"));
            GlyphButton($$anchor4, {
              get flowClass() {
                return FlowClass.None;
              },
              style: [
                "mdi mdi-image-edit -fontsize6 la-text-header -width7 la-prmy-primary la-scdy-header",
                qualityMode ? "-glow-prmy -glow-scdy-hover" : ""
              ],
              onClick: /* @__PURE__ */ __name((event2) => browseActorImage(event2, get$1(actor)), "onClick"),
              tooltipEnabled,
              get tooltipTheme() {
                return get$1(theme);
              },
              get tooltip() {
                return get$1(expression_2);
              },
              get tooltipDirection() {
                return TooltipDirection.LEFT;
              },
              get logText() {
                return get$1(expression_3);
              },
              logging: !0
            });
          }, "consequent_1");
          if_block(node_5, ($$render) => {
            get$1(tokenImageLocked) || $$render(consequent_1);
          });
        }
        append($$anchor3, fragment_1);
      }, "consequent_2");
      if_block(node_3, ($$render) => {
        get$1(advancedOptions) && $$render(consequent_2);
      });
    }
    append($$anchor2, div);
  }, "advancedOptionsToggle"), identificationMain = /* @__PURE__ */ __name(($$anchor2) => {
    var div_2 = root_5$b(), div_3 = child(div_2), input = child(div_3);
    set_attribute(input, "name", "name");
    var span = sibling(input, 2), text2 = child(span);
    template_effect(
      ($0, $1) => {
        set_value(input, get$1(actor).name), set_attribute(input, "placeholder", $0), set_text(text2, $1);
      },
      [
        () => getLocalized("LA.namePlaceholder"),
        () => getLocalized("LA.pilot.alias.label")
      ]
    ), event("pointerenter", input, (event2) => sendToTextConsole(event2, getLocalized("LA.pilot.alias.tooltip"), get$1(actor).uuid)), event("pointerleave", input, (event2) => resetTextConsole(event2, get$1(actor).uuid)), append($$anchor2, div_2);
  }, "identificationMain"), identificationSecondary = /* @__PURE__ */ __name(($$anchor2) => {
    var div_4 = root_6$d(), div_5 = child(div_4), input_1 = child(div_5);
    set_attribute(input_1, "name", "system.callsign");
    var span_1 = sibling(input_1, 2), text_1 = child(span_1), div_6 = sibling(div_5, 2), input_2 = child(div_6);
    set_attribute(input_2, "name", "system.background");
    var span_2 = sibling(input_2, 2), text_2 = child(span_2);
    template_effect(
      ($0, $1, $2) => {
        set_value(input_1, get$1(system).callsign), set_attribute(input_1, "placeholder", $0), set_text(text_1, $1), set_value(input_2, get$1(system).background), set_attribute(input_2, "placeholder", $0), set_text(text_2, $2);
      },
      [
        () => getLocalized("LA.placeholder"),
        () => getLocalized("LA.pilot.callsign.label"),
        () => getLocalized("LA.pilot.background.label")
      ]
    ), event("pointerenter", input_1, (event2) => sendToTextConsole(event2, getLocalized("LA.pilot.callsign.tooltip"), get$1(actor).uuid)), event("pointerleave", input_1, (event2) => resetTextConsole(event2, get$1(actor).uuid)), event("pointerenter", input_2, (event2) => sendToTextConsole(event2, getLocalized("LA.pilot.background.tooltip"), get$1(actor).uuid)), event("pointerleave", input_2, (event2) => resetTextConsole(event2, get$1(actor).uuid)), append($$anchor2, div_4);
  }, "identificationSecondary"), actorImage = /* @__PURE__ */ __name(($$anchor2) => {
    bind_this(
      BoundImage($$anchor2, {
        get image() {
          return get$1(actor).img;
        },
        get uuid() {
          return get$1(actor).uuid;
        },
        yGetter: getImageOffsetY$1,
        xGetter: getImageOffsetX$1,
        xySetter: setImageOffsetXY$1,
        widthGetter: getImageWidth$1,
        widthSetter: setImageWidth$1
      }),
      ($$value) => imageComponent = $$value,
      () => imageComponent
    );
  }, "actorImage"), actorImageFluff = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment_4 = root_8$6(), div_7 = first_child(fragment_4), span_3 = child(div_7), text_3 = child(span_3), div_8 = sibling(div_7, 2), div_9 = child(div_8), div_10 = child(div_9), span_4 = sibling(child(div_10), 2);
    set_class(span_4, `-aligncontentcenter -fontface-stylized
                    ${(logographic ? "-fontsize3" : "-fontsizesmall") ?? ""}`);
    var text_4 = child(span_4), div_11 = sibling(div_10, 2), node_6 = child(div_11);
    {
      var consequent_3 = /* @__PURE__ */ __name(($$anchor3) => {
        var fragment_5 = root_9$a(), span_5 = sibling(first_child(fragment_5), 2);
        set_class(span_5, `-aligncontentcenter -fontface-stylized
                        ${(logographic ? "-fontsize3" : "-fontsizesmall") ?? ""}`);
        var text_5 = child(span_5);
        template_effect(($0) => set_text(text_5, $0), [
          () => getLocalized("LA.pilot.isOwner.label")
        ]), append($$anchor3, fragment_5);
      }, "consequent_3"), alternate = /* @__PURE__ */ __name(($$anchor3) => {
        var fragment_6 = root_10$8(), i_1 = first_child(fragment_6), span_6 = sibling(i_1, 2), text_6 = child(span_6);
        template_effect(
          ($0, $1) => {
            set_class(i_1, `mdi mdi-cable-data -fontsize6 ${$0 ?? ""}`), set_class(span_6, `-aligncontentcenter -fontface-stylized ${$0 ?? ""}
                        ${(logographic ? "-fontsize3" : "-fontsizesmall") ?? ""}`), set_text(text_6, $1);
          },
          [
            () => photosensitiveStyling("horus--subtle"),
            () => getLocalized("LA.pilot.isLimited.label")
          ]
        ), append($$anchor3, fragment_6);
      }, "alternate");
      if_block(node_6, ($$render) => {
        get$1(owner) ? $$render(consequent_3) : $$render(alternate, !1);
      });
    }
    var div_12 = sibling(div_11, 2), node_7 = child(div_12);
    {
      var consequent_4 = /* @__PURE__ */ __name(($$anchor3) => {
        var fragment_7 = root_11$8(), span_7 = sibling(first_child(fragment_7), 2);
        set_class(span_7, `-aligncontentcenter -fontface-stylized
                        ${(logographic ? "-fontsize3" : "-fontsizesmall") ?? ""}`);
        var text_7 = child(span_7);
        template_effect(($0) => set_text(text_7, $0), [
          () => getLocalized("LA.pilot.activity.1.label")
        ]), append($$anchor3, fragment_7);
      }, "consequent_4"), alternate_5 = /* @__PURE__ */ __name(($$anchor3) => {
        var fragment_8 = comment(), node_8 = first_child(fragment_8);
        {
          var consequent_5 = /* @__PURE__ */ __name(($$anchor4) => {
            var fragment_9 = root_13$6(), span_8 = sibling(first_child(fragment_9), 2);
            set_class(span_8, `-aligncontentcenter -fontface-stylized
                        ${(logographic ? "-fontsize3" : "-fontsizesmall") ?? ""}`);
            var text_8 = child(span_8);
            template_effect(($0) => set_text(text_8, $0), [
              () => getLocalized("LA.pilot.activity.2.label")
            ]), append($$anchor4, fragment_9);
          }, "consequent_5"), alternate_4 = /* @__PURE__ */ __name(($$anchor4) => {
            var fragment_10 = comment(), node_9 = first_child(fragment_10);
            {
              var consequent_6 = /* @__PURE__ */ __name(($$anchor5) => {
                var fragment_11 = root_15$5(), i_2 = first_child(fragment_11), span_9 = sibling(i_2, 2), text_9 = child(span_9);
                template_effect(
                  ($0, $1) => {
                    set_class(i_2, `mdi mdi-heart-pulse -fontsize6 ${$0 ?? ""}`), set_class(span_9, `-aligncontentcenter -fontface-stylized
                        ${$0 ?? ""}
                        ${(logographic ? "-fontsize3" : "-fontsizesmall") ?? ""}`), set_text(text_9, $1);
                  },
                  [
                    () => photosensitiveStyling("horus--very--subtle"),
                    () => getLocalized("LA.pilot.activity.3.label")
                  ]
                ), append($$anchor5, fragment_11);
              }, "consequent_6"), alternate_3 = /* @__PURE__ */ __name(($$anchor5) => {
                var fragment_12 = comment(), node_10 = first_child(fragment_12);
                {
                  var consequent_7 = /* @__PURE__ */ __name(($$anchor6) => {
                    var fragment_13 = root_17$3(), i_3 = first_child(fragment_13), span_10 = sibling(i_3, 2), text_10 = child(span_10);
                    template_effect(
                      ($0, $1) => {
                        set_class(i_3, `mdi mdi-heart-pulse -fontsize6 ${$0 ?? ""}`), set_class(span_10, `-aligncontentcenter -fontface-stylized
                        ${$0 ?? ""}
                        ${(logographic ? "-fontsize3" : "-fontsizesmall") ?? ""}`), set_text(text_10, $1);
                      },
                      [
                        () => photosensitiveStyling("horus--very--subtle"),
                        () => getLocalized("LA.pilot.activity.4.label")
                      ]
                    ), append($$anchor6, fragment_13);
                  }, "consequent_7"), alternate_2 = /* @__PURE__ */ __name(($$anchor6) => {
                    var fragment_14 = comment(), node_11 = first_child(fragment_14);
                    {
                      var consequent_8 = /* @__PURE__ */ __name(($$anchor7) => {
                        var fragment_15 = root_19$2(), i_4 = first_child(fragment_15), span_11 = sibling(i_4, 2), text_11 = child(span_11);
                        template_effect(
                          ($0, $1) => {
                            set_class(i_4, `mdi mdi-heart-pulse -fontsize6 ${$0 ?? ""}`), set_class(span_11, `-aligncontentcenter -fontface-stylized
                        ${$0 ?? ""}
                        ${(logographic ? "-fontsize3" : "-fontsizesmall") ?? ""}`), set_text(text_11, $1);
                          },
                          [
                            () => photosensitiveStyling("horus--subtle"),
                            () => getLocalized("LA.pilot.activity.5.label")
                          ]
                        ), append($$anchor7, fragment_15);
                      }, "consequent_8"), alternate_1 = /* @__PURE__ */ __name(($$anchor7) => {
                        var fragment_16 = root_20$3(), i_5 = first_child(fragment_16), span_12 = sibling(i_5, 2), text_12 = child(span_12);
                        template_effect(
                          ($0, $1) => {
                            set_class(i_5, `mdi mdi-heart-pulse -fontsize6 ${$0 ?? ""}`), set_class(span_12, `-aligncontentcenter -fontface-stylized
                        ${$0 ?? ""}
                        ${(logographic ? "-fontsize3" : "-fontsizesmall") ?? ""}`), set_text(text_12, $1);
                          },
                          [
                            () => photosensitiveStyling("horus--subtle"),
                            () => getLocalized("LA.pilot.activity.6.label")
                          ]
                        ), append($$anchor7, fragment_16);
                      }, "alternate_1");
                      if_block(
                        node_11,
                        ($$render) => {
                          get$1(system).hp.value <= get$1(system).hp.max * 0.25 && get$1(system).hp.value > 0 ? $$render(consequent_8) : $$render(alternate_1, !1);
                        },
                        !0
                      );
                    }
                    append($$anchor6, fragment_14);
                  }, "alternate_2");
                  if_block(
                    node_10,
                    ($$render) => {
                      get$1(system).hp.value <= get$1(system).hp.max * 0.5 && get$1(system).hp.value > get$1(system).hp.max * 0.25 ? $$render(consequent_7) : $$render(alternate_2, !1);
                    },
                    !0
                  );
                }
                append($$anchor5, fragment_12);
              }, "alternate_3");
              if_block(
                node_9,
                ($$render) => {
                  get$1(system).hp.value <= get$1(system).hp.max * 0.75 && get$1(system).hp.value > get$1(system).hp.max * 0.5 ? $$render(consequent_6) : $$render(alternate_3, !1);
                },
                !0
              );
            }
            append($$anchor4, fragment_10);
          }, "alternate_4");
          if_block(
            node_8,
            ($$render) => {
              get$1(system).hp.value <= get$1(system).hp.max && get$1(system).hp.value > get$1(system).hp.max * 0.75 ? $$render(consequent_5) : $$render(alternate_4, !1);
            },
            !0
          );
        }
        append($$anchor3, fragment_8);
      }, "alternate_5");
      if_block(node_7, ($$render) => {
        get$1(system).hp.value >= get$1(system).hp.max ? $$render(consequent_4) : $$render(alternate_5, !1);
      });
    }
    template_effect(
      ($0, $1) => {
        set_text(text_3, `${$0 ?? ""} ${$0 ?? ""} ${$0 ?? ""}`), set_text(text_4, $1);
      },
      [
        () => getLocalized("LA.pilot.fluff.1"),
        () => getLocalized("LA.pilot.fluff.2")
      ]
    ), append($$anchor2, fragment_4);
  }, "actorImageFluff"), textLog = /* @__PURE__ */ __name(($$anchor2) => {
    var span_13 = root_21$2(), node_12 = child(span_13);
    TextLog(node_12, {
      style: [
        "-widthfull -heightfull -fontface-stylized",
        logographic ? "-fontsize3" : "-fontsizemediumer"
      ],
      get uuid() {
        return get$1(actor).uuid;
      },
      get hookID() {
        return TextConsoleHook.PilotHeader;
      },
      get hookResetID() {
        return TextConsoleHook.PilotHeaderReset;
      },
      get logHookID() {
        return TextLogHook.PilotLog;
      },
      get logHookResetID() {
        return TextLogHook.PilotLogReset;
      },
      runIntro: !1
    }), append($$anchor2, span_13);
  }, "textLog"), props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), system = /* @__PURE__ */ derived(() => props.system), owner = /* @__PURE__ */ derived(() => props.owner);
  setActorContext(get$1(actor));
  const logographic = logographicLanguage(), tooltipEnabled = getPilotSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), tokenImageLocked = /* @__PURE__ */ derived(() => getTokenImageLock(get$1(actor).uuid)), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  let imageComponent;
  function resetImageSettings(uuid, imageComponent2) {
    imageComponent2.resetLocalState(), setImageBatched$1(uuid, 0, 0, 0);
  }
  __name(resetImageSettings, "resetImageSettings"), onMount(() => {
    setTokenImageLock(get$1(actor).uuid, getActorTokenSync$3(get$1(actor).uuid));
  });
  var div_13 = root$i(), node_13 = child(div_13);
  advancedOptionsToggle(node_13);
  var div_14 = sibling(node_13, 2), node_14 = child(div_14);
  identificationMain(node_14);
  var div_15 = sibling(div_14, 4), node_15 = child(div_15);
  identificationSecondary(node_15);
  var div_16 = sibling(div_15, 2), node_16 = child(div_16);
  actorImageFluff(node_16);
  var div_17 = sibling(div_16, 2), node_17 = child(div_17);
  actorImage(node_17);
  var node_18 = sibling(div_17, 2);
  textLog(node_18), append($$anchor, div_13), pop();
}
__name(Header$1, "Header$1");
var root_1$8 = /* @__PURE__ */ template("<i></i>"), root_2$6 = /* @__PURE__ */ template("<i></i>"), on_change$5 = /* @__PURE__ */ __name((event2, system) => handleRelativeDataInput(event2, get$1(system).overshield.value), "on_change$5"), on_change_1$3 = /* @__PURE__ */ __name((event2, system) => handleRelativeDataInput(event2, get$1(system).burn), "on_change_1$3"), root_3$b = /* @__PURE__ */ template('<div class="la-flexrow -gap2 -fontface-stylized"><div class="la-visuals -flex5"><!></div> <div><input class="la-damage__input la-shadow -medium -inset la-text-text -width7 -heightfull -bordersround-lrt -small -bordersoff"> <span> </span></div> <div><input class="la-damage__input la-shadow -medium -inset la-text-text -width7 -heightfull -bordersround-lrt -small -bordersoff"> <span> </span></div></div>'), on_change_2$2 = /* @__PURE__ */ __name((event2, system) => handleRelativeDataInput(event2, get$1(system).overshield.value), "on_change_2$2"), on_change_3$2 = /* @__PURE__ */ __name((event2, system) => handleRelativeDataInput(event2, get$1(system).burn), "on_change_3$2"), root_4$6 = /* @__PURE__ */ template('<div class="la-flexrow -gap2 -alignend -fontface-stylized"><div class="la-visuals -flex5"><!></div> <div><span> </span> <input class="la-damage__input la-shadow -medium -inset la-text-text -width7 -heightfull -bordersround-lrb -small -bordersoff"></div></div> <div class="la-spacer -tiny"></div> <div class="la-flexrow -gap2 -fontface-stylized"><div class="la-visuals -flex5"><div class="la-spacer -tiny"></div> <!></div> <div><input class="la-damage__input la-shadow -medium -inset la-text-text -width7 -heightfull -bordersround-lrt -small -bordersoff"> <span> </span></div></div>', 1), root_9$9 = /* @__PURE__ */ template('<div class="la-flexcol -widthfull -fontface-stylized"><div class="la-flexrow -widthfull"><div class="-width14"></div> <div class="-flex5"><!></div> <div class="-width11"></div></div> <span> </span></div>'), on_change_4$2 = /* @__PURE__ */ __name((event2, actor, data) => handleCustomFlagValueInput(event2, get$1(actor), CustomFlagKey.Pilot, data()), "on_change_4$2"), root_10$7 = /* @__PURE__ */ template('<div class="-widthfull"><div class="la-shortstat la-flexrow la-text-text -fontsize6"><i></i> <div><input class="la-top__input -widthfull -medium -inset la-text-text -fontface-neutral -height4" type="text"> <span class="la-bottom__span"> </span></div></div></div>'), root_7$8 = /* @__PURE__ */ template('<hr class="-widthfull"> <div class="la-flags la-flexcol -gap1 la-dropshadow -margin0-lr -widthfull"></div> <hr class="-widthfull">', 1), root$h = /* @__PURE__ */ template('<div class="la-licenselevel la-dropshadow -overflowhidden"><div class="la-flow -textalignleft -letterspacing0 la-bckg-primary la-text-header clipped-bot-alt -padding0-tb -margin7-t -margin1-l -fontface-stylized"><span class="la-cmdline la-text-header -fadein -fontface-neutral">>//:</span><span> </span><span class="la-extension la-text-header -lower -fadein"> </span><span class="la-cursor la-prmy-header -fadein"></span></div></div> <div class="la-pilot__sidebar la-dropshadow -aligncontentcenter -positionrelative"><div class="la-flexcol -positionabsolute -left0 -top0 -fontsize19"><!> <div class="la-flexrow -fontsize9"><i></i> <span> </span></div></div> <!></div> <div class="la-stats la-dropshadow la-flexrow -justifyevenly -fontface-stylized"><!> <!> <!></div> <div class="la-damage la-dropshadow -margin0-lr -margin0-t"><!></div> <div class="la-dropshadow la-flexrow -justifyevenly"></div> <div class="la-stats la-dropshadow la-flexrow -justifyevenly -fontface-stylized"><!> <!> <!></div> <!> <!>', 1);
function Sidebar($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), system = /* @__PURE__ */ derived(() => props.system), actor = /* @__PURE__ */ derived(() => props.actor), itemTypes = /* @__PURE__ */ derived(() => props.itemTypes);
  setActorContext(get$1(actor));
  let advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), component = state(null), editingBurn = state(!1), editingShield = state(!1);
  const logographic = logographicLanguage(), tooltipEnabled = getPilotSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), showSensors = getPilotSheetSensorsEnabled(), showTechAttack = getPilotSheetTechAttackEnabled(), themeOverride = /* @__PURE__ */ derived(() => getBrightness(getThemeKey(get$1(actor).uuid)) === "light" ? "la-text-primary" : "la-text-text"), sidebarExes = /* @__PURE__ */ derived(() => getSidebarExecutables$2(get$1(actor).uuid)), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid)), customFlags = /* @__PURE__ */ derived(() => getCustomFlags(get$1(actor), CustomFlagKey.Pilot)), visibleCustomFlags = /* @__PURE__ */ derived(() => Object.values(get$1(customFlags)).filter((flag) => flag.showInSidebar)), sizeTip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.size.tooltip"), `${getLocalized("LA.size.label")} ${get$1(system).size}`)), speedTip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.speed.tooltip"), `${getLocalized("LA.speed.label")} ${get$1(system).speed}`)), shieldTip = TooltipFactory.buildTooltip(getLocalized("LA.overshield.tooltip")), burnTip = TooltipFactory.buildTooltip(getLocalized("LA.burn.tooltip"));
  onMount(() => {
    if (get$1(component)) {
      const ratio = getSidebarRatio$1(get$1(actor).uuid), sidebar = jQuery(get$1(component)).closest(".la-root").find(".la-sidebar");
      sidebar && sidebar.css("flex", ratio.toString());
    }
  });
  function checkExecutables() {
    const newUuids = get$1(itemTypes).skill.map((skill) => skill.uuid).filter((uuid) => !get$1(sidebarExes).includes(uuid));
    return get$1(sidebarExes).unshift(...newUuids), get$1(sidebarExes);
  }
  __name(checkExecutables, "checkExecutables");
  var fragment = root$h(), div = first_child(fragment), div_1 = child(div), span = sibling(child(div_1)), text2 = child(span), span_1 = sibling(span), text_1 = child(span_1);
  bind_this(div, ($$value) => set(component, $$value), () => get$1(component));
  var div_2 = sibling(div, 2), div_3 = child(div_2), node = child(div_3);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var i = root_1$8();
      template_effect(() => {
        set_class(i, `cci cci-size-half ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_attribute(i, "data-tooltip", tooltipEnabled ? get$1(sizeTip) : void 0), set_attribute(i, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i, "data-tooltip-direction", TooltipDirection.RIGHT);
      }), append($$anchor2, i);
    }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor2) => {
      var i_1 = root_2$6();
      template_effect(() => {
        set_class(i_1, `cci cci-size-${get$1(system).size ?? ""} ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_attribute(i_1, "data-tooltip", tooltipEnabled ? get$1(sizeTip) : void 0), set_attribute(i_1, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i_1, "data-tooltip-direction", TooltipDirection.RIGHT);
      }), append($$anchor2, i_1);
    }, "alternate");
    if_block(node, ($$render) => {
      get$1(system).size < 1 ? $$render(consequent) : $$render(alternate, !1);
    });
  }
  var div_4 = sibling(node, 2), i_2 = child(div_4), span_2 = sibling(i_2, 2), text_2 = child(span_2), node_1 = sibling(div_3, 2);
  const expression = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.token.tooltip")), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.token.tooltip"));
  ImageVideo(node_1, {
    get actor() {
      return get$1(actor);
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    },
    get logText() {
      return get$1(expression_1);
    },
    logging: !0,
    onPointerClick: /* @__PURE__ */ __name((event2) => handleEditToken(event2, get$1(actor)), "onPointerClick")
  });
  var div_5 = sibling(div_2, 2), node_2 = child(div_5);
  const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.armor.short")), expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.armor.tooltip"));
  StatComboShort(node_2, {
    icon: "cci cci-role-defender -alignselfcenter",
    get label() {
      return get$1(expression_2);
    },
    get value() {
      return get$1(system).armor;
    },
    outerStyle: ["la-text-text -fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_3);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var node_3 = sibling(node_2, 2);
  const expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.evasion.short")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.evasion.tooltip"));
  StatComboShort(node_3, {
    icon: "cci cci-evasion -alignselfcenter",
    get label() {
      return get$1(expression_4);
    },
    get value() {
      return get$1(system).evasion;
    },
    outerStyle: ["la-text-text -fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_5);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var node_4 = sibling(node_3, 2);
  const expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.edefense.short")), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.edefense.tooltip"));
  StatComboShort(node_4, {
    icon: "cci cci-edef -alignselfcenter",
    get label() {
      return get$1(expression_6);
    },
    get value() {
      return get$1(system).edef;
    },
    outerStyle: ["la-text-text -fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_7);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var div_6 = sibling(div_5, 2), node_5 = child(div_6);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var div_7 = root_3$b(), div_8 = child(div_7), node_6 = child(div_8);
      const expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.hitpoint.short")), expression_9 = /* @__PURE__ */ derived(() => get$1(system).bond ? void 0 : get$1(system).burn), expression_10 = /* @__PURE__ */ derived(() => get$1(system).bond ? void 0 : get$1(system).hp.max), expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.hitpoint.tooltip"));
      StatusBar(node_6, {
        get name() {
          return get$1(expression_8);
        },
        nameStyle: [logographic ? "-fontsizemedium" : ""],
        dataName: "system.hp.value",
        get currentValue() {
          return get$1(system).hp.value;
        },
        get maxValue() {
          return get$1(system).hp.max;
        },
        get currentValueSecondary() {
          return get$1(system).overshield.value;
        },
        get maxValueSecondary() {
          return get$1(system).hp.max;
        },
        get currentValueTertiary() {
          return get$1(expression_9);
        },
        get maxValueTertiary() {
          return get$1(expression_10);
        },
        barStyle: ["la-bckg-bar-health"],
        barEditStyle: ["la-prmy-bar-health"],
        barStyleSecondary: ["la-bckg-bar-shield -shield"],
        barEditStyleSecondary: ["la-prmy-bar-shield"],
        barStyleTertiary: ["la-bckg-bar-burn -burn"],
        barEditStyleTertiary: ["la-prmy-bar-burn"],
        textStyle: ["la-text-text"],
        clipPath: "clipped",
        get editSecondary() {
          return get$1(editingShield);
        },
        get editTertiary() {
          return get$1(editingBurn);
        },
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_11);
        },
        get tooltipDirection() {
          return TooltipDirection.RIGHT;
        }
      });
      var div_9 = sibling(div_8, 2);
      set_class(div_9, `la-flexcol -divider la-prmy-bar-shield -flex0 -textaligncenter la-prmy-bar-shield -margin0-r
                ${(qualityMode ? "-glow-prmy" : "") ?? ""}
                ${(logographic ? "-width4ch" : "-width3ch") ?? ""}`);
      var input = child(div_9);
      set_attribute(input, "type", "text"), set_attribute(input, "name", "system.overshield.value"), set_attribute(input, "data-dtype", "Number"), input.__change = [on_change$5, system];
      var span_3 = sibling(input, 2);
      set_class(span_3, `la-damage__span -heightfull -lineheight3
                    ${(logographic ? "-fontsizemedium" : "-fontsizesmall") ?? ""}`), set_attribute(span_3, "data-tooltip", tooltipEnabled ? shieldTip : void 0);
      var text_3 = child(span_3), div_10 = sibling(div_9, 2);
      set_class(div_10, `la-flexcol -divider la-prmy-bar-burn -flex0 -textaligncenter la-prmy-bar-burn -margin1-r
                ${(qualityMode ? "-glow-prmy" : "") ?? ""}
                ${(logographic ? "-width4ch" : "-width3ch") ?? ""}`);
      var input_1 = child(div_10);
      set_attribute(input_1, "type", "text"), set_attribute(input_1, "name", "system.burn"), set_attribute(input_1, "data-dtype", "Number"), input_1.__change = [on_change_1$3, system];
      var span_4 = sibling(input_1, 2);
      set_class(span_4, `la-damage__span -heightfull -lineheight3
                    ${(logographic ? "-fontsizemedium" : "-fontsizesmall") ?? ""}`), set_attribute(span_4, "data-tooltip", tooltipEnabled ? burnTip : void 0);
      var text_4 = child(span_4);
      template_effect(
        ($0, $1) => {
          set_value(input, get$1(system).overshield.value), set_attribute(span_3, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span_3, "data-tooltip-direction", TooltipDirection.RIGHT), set_text(text_3, $0), set_value(input_1, get$1(system).burn), set_attribute(span_4, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span_4, "data-tooltip-direction", TooltipDirection.RIGHT), set_text(text_4, $1);
        },
        [
          () => getLocalized("LA.overshield.short"),
          () => getLocalized("LA.burn.short")
        ]
      ), event("focus", input, (event2) => {
        event2.currentTarget.select(), set(editingShield, !0);
      }), event("blur", input, () => {
        set(editingShield, !1);
      }), event("focus", input_1, (event2) => {
        event2.currentTarget.select(), set(editingBurn, !0);
      }), event("blur", input_1, () => {
        set(editingBurn, !1);
      }), append($$anchor2, div_7);
    }, "consequent_1"), alternate_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_1 = root_4$6(), div_11 = first_child(fragment_1), div_12 = child(div_11), node_7 = child(div_12);
      const expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.hitpoint.short")), expression_13 = /* @__PURE__ */ derived(() => get$1(system).bond ? void 0 : get$1(system).burn), expression_14 = /* @__PURE__ */ derived(() => get$1(system).bond ? void 0 : get$1(system).hp.max), expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.hitpoint.tooltip"));
      StatusBar(node_7, {
        get name() {
          return get$1(expression_12);
        },
        nameStyle: [logographic ? "-fontsizemedium" : ""],
        dataName: "system.hp.value",
        get currentValue() {
          return get$1(system).hp.value;
        },
        get maxValue() {
          return get$1(system).hp.max;
        },
        get currentValueSecondary() {
          return get$1(system).overshield.value;
        },
        get maxValueSecondary() {
          return get$1(system).hp.max;
        },
        get currentValueTertiary() {
          return get$1(expression_13);
        },
        get maxValueTertiary() {
          return get$1(expression_14);
        },
        barStyle: ["la-bckg-bar-health"],
        barEditStyle: ["la-prmy-bar-health"],
        barStyleSecondary: ["la-bckg-bar-shield -shield"],
        barEditStyleSecondary: ["la-prmy-bar-shield"],
        textStyle: ["la-text-text"],
        clipPath: "clipped",
        get editSecondary() {
          return get$1(editingShield);
        },
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_15);
        },
        get tooltipDirection() {
          return TooltipDirection.RIGHT;
        }
      });
      var div_13 = sibling(div_12, 2);
      set_class(div_13, `la-flexcol -divider la-prmy-bar-shield -flex0 -textaligncenter la-prmy-bar-shield -margin1-r
                ${(qualityMode ? "-glow-prmy" : "") ?? ""}
                ${(logographic ? "-width4ch" : "-width3ch") ?? ""}`);
      var span_5 = child(div_13);
      set_class(span_5, `la-damage__span -heightfull -lineheight3
                    ${(logographic ? "-fontsizemedium" : "-fontsizesmall") ?? ""}`), set_attribute(span_5, "data-tooltip", tooltipEnabled ? shieldTip : void 0);
      var text_5 = child(span_5), input_2 = sibling(span_5, 2);
      set_attribute(input_2, "type", "text"), set_attribute(input_2, "name", "system.overshield.value"), set_attribute(input_2, "data-dtype", "Number"), input_2.__change = [on_change_2$2, system];
      var div_14 = sibling(div_11, 4), div_15 = child(div_14), node_8 = sibling(child(div_15), 2);
      const expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.stress.label")), expression_17 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.stress.tooltip"));
      StatusBar(node_8, {
        get name() {
          return get$1(expression_16);
        },
        nameStyle: [logographic ? "-fontsizemedium" : ""],
        dataName: "system.bond_state.stress.value",
        get currentValue() {
          return get$1(system).bond_state.stress.value;
        },
        get maxValue() {
          return get$1(system).bond_state.stress.max;
        },
        get currentValueSecondary() {
          return get$1(system).burn;
        },
        get maxValueSecondary() {
          return get$1(system).bond_state.stress.max;
        },
        barStyle: ["la-bckg-bar-heat"],
        barEditStyle: ["la-prmy-bar-heat"],
        barStyleSecondary: ["la-bckg-bar-burn -burn"],
        barEditStyleSecondary: ["la-prmy-bar-burn"],
        textStyle: ["la-text-text"],
        clipPath: "clipped",
        get editSecondary() {
          return get$1(editingBurn);
        },
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_17);
        },
        get tooltipDirection() {
          return TooltipDirection.RIGHT;
        }
      });
      var div_16 = sibling(div_15, 2);
      set_class(div_16, `la-flexcol -divider la-prmy-bar-burn -flex0 -textaligncenter la-prmy-bar-burn -margin1-r
                ${(qualityMode ? "-glow-prmy" : "") ?? ""}
                ${(logographic ? "-width4ch" : "-width3ch") ?? ""}`);
      var input_3 = child(div_16);
      set_attribute(input_3, "type", "text"), set_attribute(input_3, "name", "system.burn"), set_attribute(input_3, "data-dtype", "Number"), input_3.__change = [on_change_3$2, system];
      var span_6 = sibling(input_3, 2);
      set_class(span_6, `la-damage__span -heightfull -lineheight3
                    ${(logographic ? "-fontsizemedium" : "-fontsizesmall") ?? ""}`), set_attribute(span_6, "data-tooltip", tooltipEnabled ? burnTip : void 0);
      var text_6 = child(span_6);
      template_effect(
        ($0, $1) => {
          set_attribute(span_5, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span_5, "data-tooltip-direction", TooltipDirection.RIGHT), set_text(text_5, $0), set_value(input_2, get$1(system).overshield.value), set_value(input_3, get$1(system).burn), set_attribute(span_6, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span_6, "data-tooltip-direction", TooltipDirection.RIGHT), set_text(text_6, $1);
        },
        [
          () => getLocalized("LA.overshield.short"),
          () => getLocalized("LA.burn.short")
        ]
      ), event("focus", input_2, (event2) => {
        event2.currentTarget.select(), set(editingShield, !0);
      }), event("blur", input_2, () => {
        set(editingShield, !1);
      }), event("focus", input_3, (event2) => {
        event2.currentTarget.select(), set(editingBurn, !0);
      }), event("blur", input_3, () => {
        set(editingBurn, !1);
      }), append($$anchor2, fragment_1);
    }, "alternate_1");
    if_block(node_5, ($$render) => {
      get$1(system).bond ? $$render(alternate_1, !1) : $$render(consequent_1);
    });
  }
  var div_17 = sibling(div_6, 4), node_9 = child(div_17);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      const expression_18 = /* @__PURE__ */ derived(() => getLocalized("LA.tattack.short")), expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.tattack.tooltip"));
      StatComboShort($$anchor2, {
        icon: "cci cci-tech-full -alignselfcenter",
        get label() {
          return get$1(expression_18);
        },
        get value() {
          return get$1(system).tech_attack;
        },
        outerStyle: ["la-text-text -fontsize7"],
        innerStyle: [
          "-divider -fontsizemedium la-prmy-accent -textaligncenter",
          logographic ? "" : "-bold"
        ],
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_19);
        },
        get tooltipDirection() {
          return TooltipDirection.RIGHT;
        }
      });
    }, "consequent_2");
    if_block(node_9, ($$render) => {
      showTechAttack && $$render(consequent_2);
    });
  }
  var node_10 = sibling(node_9, 2);
  const expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.save.short")), expression_21 = /* @__PURE__ */ derived(() => getLocalized("LA.save.tooltip"));
  StatComboShort(node_10, {
    icon: "cci cci-save -alignselfcenter",
    get label() {
      return get$1(expression_20);
    },
    get value() {
      return get$1(system).save;
    },
    outerStyle: ["la-text-text -fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_21);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    }
  });
  var node_11 = sibling(node_10, 2);
  {
    var consequent_3 = /* @__PURE__ */ __name(($$anchor2) => {
      const expression_22 = /* @__PURE__ */ derived(() => getLocalized("LA.sensor.short")), expression_23 = /* @__PURE__ */ derived(() => getLocalized("LA.sensor.tooltip"));
      StatComboShort($$anchor2, {
        icon: "cci cci-sensor -alignselfcenter",
        get label() {
          return get$1(expression_22);
        },
        get value() {
          return get$1(system).sensor_range;
        },
        outerStyle: ["la-text-text -fontsize7"],
        innerStyle: [
          "-divider -fontsizemedium la-prmy-accent -textaligncenter",
          logographic ? "" : "-bold"
        ],
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_23);
        },
        get tooltipDirection() {
          return TooltipDirection.RIGHT;
        }
      });
    }, "consequent_3");
    if_block(node_11, ($$render) => {
      showSensors && $$render(consequent_3);
    });
  }
  var node_12 = sibling(div_17, 2);
  {
    var consequent_5 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_4 = root_7$8(), div_18 = sibling(first_child(fragment_4), 2);
      each(div_18, 21, () => get$1(visibleCustomFlags), (flag) => flag.id, ($$anchor3, flag) => {
        var fragment_5 = comment();
        const createFractionBar = /* @__PURE__ */ __name(($$anchor4, data = noop) => {
          var div_19 = root_9$9(), div_20 = child(div_19), div_21 = sibling(child(div_20), 2), node_13 = child(div_21);
          const expression_24 = /* @__PURE__ */ derived(() => getCustomFlagPath(CustomFlagKey.Pilot, data().id, "value"));
          StatusBar(node_13, {
            name: "",
            nameStyle: [logographic ? "-fontsizemedium" : ""],
            get dataName() {
              return get$1(expression_24);
            },
            get currentValue() {
              return data().content.value;
            },
            get maxValue() {
              return data().content.max;
            },
            barStyle: ["la-bckg-custom"],
            barEditStyle: ["la-bckg-custom"],
            textStyle: ["la-text-text"],
            clipPath: "clipped-alt"
          });
          var span_7 = sibling(div_20, 2);
          set_class(span_7, `-fontsizemedium -upper -padding4-l
                ${(logographic ? "" : "-bold") ?? ""}`);
          var text_7 = child(span_7);
          template_effect(
            ($0) => {
              set_attribute(div_21, "style", `--la-flag-custom: ${data().color ?? ""};`), set_attribute(span_7, "data-tooltip", $0), set_attribute(span_7, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span_7, "data-tooltip-direction", TooltipDirection.RIGHT), set_text(text_7, data().name);
            },
            [
              () => tooltipEnabled && data().tooltip ? TooltipFactory.buildTooltip(data().tooltip) : void 0
            ]
          ), append($$anchor4, div_19);
        }, "createFractionBar"), createValueGlyph = /* @__PURE__ */ __name(($$anchor4, data = noop) => {
          var div_22 = root_10$7(), div_23 = child(div_22), i_3 = child(div_23), div_24 = sibling(i_3, 2);
          set_class(div_24, `la-flexcol -divider -upper -fontface-stylized -fontsizemedium la-prmy-accent -textaligncenter
                    ${(logographic ? "" : "-bold") ?? ""}`);
          var input_4 = child(div_24);
          input_4.__change = [on_change_4$2, actor, data];
          var span_8 = sibling(input_4, 2), text_8 = child(span_8);
          template_effect(
            ($0) => {
              set_class(i_3, `${(data().icon ? data().icon : "mdi mdi-abacus") ?? ""} -alignselfcenter`), set_attribute(div_24, "data-tooltip", $0), set_attribute(div_24, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(div_24, "data-tooltip-direction", TooltipDirection.RIGHT), set_value(input_4, data().content.value), set_text(text_8, data().name);
            },
            [
              () => tooltipEnabled && data().tooltip ? TooltipFactory.buildTooltip(data().tooltip) : void 0
            ]
          ), event("focus", input_4, (event2) => event2.currentTarget.select()), append($$anchor4, div_22);
        }, "createValueGlyph");
        var node_14 = first_child(fragment_5);
        {
          var consequent_4 = /* @__PURE__ */ __name(($$anchor4) => {
            createFractionBar($$anchor4, () => get$1(flag));
          }, "consequent_4"), alternate_2 = /* @__PURE__ */ __name(($$anchor4) => {
            createValueGlyph($$anchor4, () => get$1(flag));
          }, "alternate_2");
          if_block(node_14, ($$render) => {
            get$1(flag).contentType === CustomFlagContentType.Fraction ? $$render(consequent_4) : $$render(alternate_2, !1);
          });
        }
        append($$anchor3, fragment_5);
      }), append($$anchor2, fragment_4);
    }, "consequent_5");
    if_block(node_12, ($$render) => {
      get$1(visibleCustomFlags).length && $$render(consequent_5);
    });
  }
  var node_15 = sibling(node_12, 2);
  {
    var consequent_6 = /* @__PURE__ */ __name(($$anchor2) => {
      const expression_25 = /* @__PURE__ */ derived(checkExecutables), expression_26 = /* @__PURE__ */ derived(() => [
        FLOW_BUTTON_DEFAULT(),
        get$1(advancedOptions) ? "-margin7-l" : "-margin2-l"
      ]);
      MacroDropBox($$anchor2, {
        get uuid() {
          return get$1(actor).uuid;
        },
        get getExes() {
          return get$1(expression_25);
        },
        setExes: setSidebarExecutables$2,
        hintDropArea: !0,
        get allowDrop() {
          return get$1(advancedOptions);
        },
        get buttonStyle() {
          return get$1(expression_26);
        },
        tooltipEnabled,
        logging: !0
      });
    }, "consequent_6");
    if_block(node_15, ($$render) => {
      get$1(itemTypes).skill.length && $$render(consequent_6);
    });
  }
  template_effect(
    ($0) => {
      set_text(text2, `LL${get$1(system).level ?? ""} — ${get$1(actor).system.callsign ?? ""}`), set_text(text_1, `--${$0 ?? ""}`), set_attribute(div_4, "data-tooltip", tooltipEnabled ? get$1(speedTip) : void 0), set_attribute(div_4, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(div_4, "data-tooltip-direction", TooltipDirection.RIGHT), set_class(i_2, `mdi mdi-arrow-right-bold-hexagon-outline ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_class(span_2, `${get$1(themeOverride) ?? ""} la-outl-shadow -bold`), set_text(text_2, get$1(system).speed);
    },
    [() => getLocalized("LA.scan.label")]
  ), append($$anchor, fragment), pop();
}
__name(Sidebar, "Sidebar");
delegate(["change"]);
var root_6$c = /* @__PURE__ */ template('<div class="la-flexrow clipped-bot-alt la-bckg-header-anti -widthfull"><!> <!> <!></div>'), root_5$a = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull -padding2-l"><!> <!></div>'), root_11$7 = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_12$6 = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_10$6 = /* @__PURE__ */ template('<!> <div class="la-flexcol -margin3-lr"><!> <!></div>', 1), root_13$5 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!> <!> <!></div>'), root_3$a = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>');
function Weapon($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      logging: !0,
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let collapseAllButtonHover = state(!1), attackButtonHover = state(!1), damageButtonHover = state(!1), messageButtonHover = state(!1), editButtonHover = state(!1);
  const tooltipEnabled = getPilotSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.weapons`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function getWeaponPath(index2) {
    return `system.loadout.weapons.${index2}.value`;
  }
  __name(getWeaponPath, "getWeaponPath");
  function getRollWeaponTip(weapon) {
    return formatString(getLocalized("LA.flow.rollAttack.template.tooltip"), weapon.name);
  }
  __name(getRollWeaponTip, "getRollWeaponTip");
  function renderOuter(weapon) {
    return weapon.system.sp || isLoading(weapon) || weapon.isLimited() || weapon.system.counters.length;
  }
  __name(renderOuter, "renderOuter");
  function sendToChat(event2, weapon) {
    var _a;
    if (event2.stopPropagation(), (_a = $$props.actor) != null && _a.uuid && weapon) {
      let range = "";
      weapon.system.range.map((rng) => {
        range += `<div class="la-flexrow">${rng.val}<i class="cci cci-${rng.type.toLowerCase()} -fontsize6"></i></div>`;
      });
      let damage = "";
      weapon.system.damage.map((dmg) => {
        damage += `<div class="la-flexrow">${dmg.val}<i class="cci cci-${dmg.type.toLowerCase()} -fontsize6"></i></div>`;
      });
      const description = `
                <div>
                    ${weapon.system.description}
                </div>
                <hr>
                <div 
                    class="la-flexrow -justifyevenly clipped-alt -fontsize5 -padding0-tb -padding1-lr"
                    style="
                        background-color: var(--weapon-color);
                        color: var(--light-text);
                        align-items: baseline;
                    "
                >
                    ${range}
                    ${damage}
                </div>
            `;
      let chatData = {
        title: weapon.name,
        description,
        trigger: weapon.system.trigger,
        effect: weapon.system.effect,
        onHit: weapon.system.on_hit,
        tags: weapon.system.tags,
        color: CHAT_CARD_COLOR_MAP[ChatCardType.Weapon]
      };
      SendUnknownToChatBase.getInstance().startFlow($$props.actor.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendToChat, "sendToChat");
  const expression = /* @__PURE__ */ derived(() => getLocalized("LA.weapons.label"));
  HeaderMain($$anchor, {
    get text() {
      return get$1(expression);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-primary"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
    }, "extensionTextFunction"),
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !0,
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var fragment_2 = comment(), node = first_child(fragment_2);
      {
        var consequent_3 = /* @__PURE__ */ __name(($$anchor3) => {
          var div = root_3$a();
          each(div, 21, () => $$props.weapons, index, ($$anchor4, weapon, index$1) => {
            const outerContent = /* @__PURE__ */ __name(($$anchor5) => {
              var div_1 = root_5$a(), node_1 = child(div_1);
              {
                var consequent = /* @__PURE__ */ __name(($$anchor6) => {
                  var div_2 = root_6$c(), node_2 = child(div_2);
                  const expression_1 = /* @__PURE__ */ derived(() => getWeaponPath(index$1));
                  LoadedBox(node_2, {
                    get item() {
                      return get$1(weapon);
                    },
                    get path() {
                      return get$1(expression_1);
                    },
                    logging: !0
                  });
                  var node_3 = sibling(node_2, 2);
                  const expression_2 = /* @__PURE__ */ derived(() => getWeaponPath(index$1));
                  LimitedBox(node_3, {
                    get usesValue() {
                      return get$1(weapon).system.uses.value;
                    },
                    get usesMax() {
                      return get$1(weapon).system.uses.max;
                    },
                    get path() {
                      return get$1(expression_2);
                    },
                    logging: !0
                  });
                  var node_4 = sibling(node_3, 2);
                  SPCostArray(node_4, {
                    get cost() {
                      return get$1(weapon).system.sp;
                    }
                  }), append($$anchor6, div_2);
                }, "consequent");
                if_block(node_1, ($$render) => {
                  (isLoading(get$1(weapon)) || get$1(weapon).isLimited() || get$1(weapon).system.sp) && $$render(consequent);
                });
              }
              var node_5 = sibling(node_1, 2);
              {
                var consequent_1 = /* @__PURE__ */ __name(($$anchor6) => {
                  var fragment_3 = comment(), node_6 = first_child(fragment_3);
                  each(node_6, 17, () => get$1(weapon).system.counters, index, ($$anchor7, counter, jndex) => {
                    const expression_3 = /* @__PURE__ */ derived(() => getWeaponPath(index$1));
                    CounterBox($$anchor7, {
                      get text() {
                        return get$1(counter).name;
                      },
                      get type() {
                        return CounterBoxType.Counter;
                      },
                      get usesValue() {
                        return get$1(counter).value;
                      },
                      get usesMax() {
                        return get$1(counter).max;
                      },
                      get path() {
                        return `${get$1(expression_3) ?? ""}.system.counters.${jndex ?? ""}`;
                      },
                      logging: !0
                    });
                  }), append($$anchor6, fragment_3);
                }, "consequent_1");
                if_block(node_5, ($$render) => {
                  get$1(weapon).system.counters.length && $$render(consequent_1);
                });
              }
              append($$anchor5, div_1);
            }, "outerContent"), headerTertiaryLeftOptions = /* @__PURE__ */ __name(($$anchor5) => {
              const expression_4 = /* @__PURE__ */ derived(() => getWeaponPath(index$1)), expression_5 = /* @__PURE__ */ derived(() => getRollWeaponTip(get$1(weapon))), expression_6 = /* @__PURE__ */ derived(() => getRollWeaponTip(get$1(weapon)));
              AttackButton($$anchor5, {
                iconStyle: [H3_ICON_SIZE, "la-text-header cci cci-weapon"],
                iconBackgroundStyle: [
                  "la-prmy-secondary",
                  H3_ICON_SIZE,
                  qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
                ],
                get flowClass() {
                  return FlowClass.RollAttack;
                },
                get path() {
                  return get$1(expression_4);
                },
                tooltipEnabled,
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltipDirection() {
                  return TooltipDirection.LEFT;
                },
                get tooltip() {
                  return get$1(expression_5);
                },
                get logText() {
                  return get$1(expression_6);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(attackButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(attackButtonHover, !1);
                }, "onPointerLeave")
              });
            }, "headerTertiaryLeftOptions"), headerTertiaryRightOptions = /* @__PURE__ */ __name(($$anchor5) => {
              var fragment_6 = root_10$6(), node_7 = first_child(fragment_6);
              DamageButton(node_7, {
                iconBackgroundStyle: [
                  "-fontsize9 la-prmy-secondary",
                  qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
                ],
                get flowClass() {
                  return FlowClass.RollDamage;
                },
                get range() {
                  return get$1(weapon).system.range;
                },
                get damage() {
                  return get$1(weapon).system.damage;
                },
                tooltipEnabled,
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(damageButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(damageButtonHover, !1);
                }, "onPointerLeave")
              });
              var div_3 = sibling(node_7, 2), node_8 = child(div_3);
              const expression_7 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE()]), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip")), expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
              GlyphButton(node_8, {
                get style() {
                  return get$1(expression_7);
                },
                get flowClass() {
                  return FlowClass.None;
                },
                get uuid() {
                  return get$1(weapon).uuid;
                },
                tooltipEnabled,
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_8);
                },
                get logText() {
                  return get$1(expression_9);
                },
                logging: !0,
                onClick: /* @__PURE__ */ __name((event2) => sendToChat(event2, get$1(weapon)), "onClick"),
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i = root_11$7();
                  append($$anchor6, i);
                }, "children"),
                $$slots: { default: !0 }
              });
              var node_9 = sibling(node_8, 2);
              const expression_10 = /* @__PURE__ */ derived(() => [
                H2_BUTTON_ICON_STYLE(),
                "-padding0-lr la-flexrow -margin0-lr"
              ]), expression_11 = /* @__PURE__ */ derived(() => getWeaponPath(index$1)), expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
              GlyphButton(node_9, {
                get style() {
                  return get$1(expression_10);
                },
                get flowClass() {
                  return FlowClass.ContextMenu;
                },
                get path() {
                  return get$1(expression_11);
                },
                tooltipEnabled,
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_12);
                },
                get logText() {
                  return get$1(expression_13);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i_1 = root_12$6();
                  append($$anchor6, i_1);
                }, "children"),
                $$slots: { default: !0 }
              }), append($$anchor5, fragment_6);
            }, "headerTertiaryRightOptions"), expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.weapons.label")), expression_15 = /* @__PURE__ */ derived(() => getWeaponPath(index$1)), expression_16 = /* @__PURE__ */ derived(() => renderOuter(get$1(weapon)) ? outerContent : void 0);
            HeaderTertiary($$anchor4, {
              get text() {
                return get$1(weapon).name;
              },
              get subText() {
                return get$1(expression_14);
              },
              subHeaderFontStyle: [
                "la-text-header la-prmy-header -fontsizesmall -fontface-stylized"
              ],
              borderStyle: ["-bordersoff"],
              extensionTextFunction: /* @__PURE__ */ __name(() => {
                if (get$1(attackButtonHover)) return `--${getLocalized("LA.flow.rollAttack.extension")}`;
                if (get$1(damageButtonHover)) return `--${getLocalized("LA.flow.rollDamage.extension")}`;
                if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
                if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
              }, "extensionTextFunction"),
              headerStyle: [H3_HEADER_STYLE, "la-bckg-pilot"],
              headerFontStyle: [H2_TEXT_SIZE, "-fontface-stylized"],
              get itemID() {
                return get$1(weapon).id;
              },
              get uuid() {
                return get$1(weapon).uuid;
              },
              get path() {
                return get$1(expression_15);
              },
              acceptTypes: "pilot_weapon",
              get collapseID() {
                return get$1(weapon).uuid;
              },
              startCollapsed: !0,
              get renderOutsideCollapse() {
                return get$1(expression_16);
              },
              contentLeft: headerTertiaryLeftOptions,
              contentRight: headerTertiaryRightOptions,
              children: /* @__PURE__ */ __name(($$anchor5, $$slotProps2) => {
                var div_4 = root_13$5(), node_10 = child(div_4);
                const expression_17 = /* @__PURE__ */ derived(() => `${getWeaponPath(index$1)}.system.bonuses`);
                BonusBox(node_10, {
                  get bonuses() {
                    return get$1(weapon).system.bonuses;
                  },
                  get bonusPath() {
                    return get$1(expression_17);
                  }
                });
                var node_11 = sibling(node_10, 2);
                DeployableBox(node_11, {
                  get source() {
                    return $$props.actor;
                  },
                  get lidSource() {
                    return get$1(weapon).system;
                  },
                  get uuid() {
                    return $$props.actor.uuid;
                  },
                  get sheetUUID() {
                    return $$props.actor.uuid;
                  },
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  logging: !0
                });
                var node_12 = sibling(node_11, 2);
                const expression_18 = /* @__PURE__ */ derived(() => `${get$1(weapon).uuid}.actions`);
                ActionBox(node_12, {
                  get actions() {
                    return get$1(weapon).system.actions;
                  },
                  get actor() {
                    return $$props.actor;
                  },
                  get uuid() {
                    return get$1(weapon).uuid;
                  },
                  path: "system.actions",
                  get collapseID() {
                    return get$1(expression_18);
                  },
                  startCollapsed: !0,
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  logging: !0
                });
                var node_13 = sibling(node_12, 2);
                const expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.description.label"));
                EffectBox(node_13, {
                  get name() {
                    return get$1(expression_19);
                  },
                  get effect() {
                    return get$1(weapon).system.description;
                  },
                  tooltipEnabled,
                  logging: !0
                });
                var node_14 = sibling(node_13, 2);
                {
                  var consequent_2 = /* @__PURE__ */ __name(($$anchor6) => {
                    const expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.effect.label"));
                    EffectBox($$anchor6, {
                      get name() {
                        return get$1(expression_20);
                      },
                      get effect() {
                        return get$1(weapon).system.effect;
                      },
                      tooltipEnabled,
                      logging: !0
                    });
                  }, "consequent_2");
                  if_block(node_14, ($$render) => {
                    get$1(weapon).system.effect && $$render(consequent_2);
                  });
                }
                var node_15 = sibling(node_14, 2);
                TagArray(node_15, {
                  get tags() {
                    return get$1(weapon).system.tags;
                  },
                  justify: "start",
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  }
                }), append($$anchor5, div_4);
              }, "children"),
              $$slots: { default: !0 }
            });
          }), append($$anchor3, div);
        }, "consequent_3"), alternate = /* @__PURE__ */ __name(($$anchor3) => {
          const expression_21 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.weapon.empty.label")), expression_22 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.weapon.empty.subLabel"));
          EmptyBox($$anchor3, {
            get label() {
              return get$1(expression_21);
            },
            get subLabel() {
              return get$1(expression_22);
            },
            get type() {
              return AcceptType.PilotWeapon;
            },
            get path() {
              return `system.loadout.weapons.${$$props.weapons.length ?? ""}.value`;
            }
          });
        }, "alternate");
        if_block(node, ($$render) => {
          $$props.weapons.length ? $$render(consequent_3) : $$render(alternate, !1);
        });
      }
      append($$anchor2, fragment_2);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(Weapon, "Weapon");
var root_7$7 = /* @__PURE__ */ template('<span class="la-flexrow -justifycenter -aligncenter -fontsize5 -padding0-lr -padding0-tb la-text-header -gap0"> <i class="mdi mdi-heart-half-full -fontsize5"></i></span>'), root_8$5 = /* @__PURE__ */ template('<span class="la-flexrow -justifycenter -aligncenter -fontsize5 -padding0-lr la-text-header"> <i class="cci cci-role-defender -fontsize6"></i></span>'), root_9$8 = /* @__PURE__ */ template('<span class="la-flexrow -justifycenter -aligncenter -fontsize5 -padding0-lr la-text-header"> <i class="cci cci-evasion -fontsize6"></i></span>'), root_10$5 = /* @__PURE__ */ template('<span class="la-flexrow -justifycenter -aligncenter -fontsize5 -padding0-lr la-text-header"> <i class="cci cci-edef -fontsize6"></i></span>'), root_11$6 = /* @__PURE__ */ template('<span class="la-flexrow -justifycenter -aligncenter -fontsize5 -padding0-lr la-text-header"> <i class="mdi mdi-arrow-right-bold-hexagon-outline -fontsize5"></i></span>'), root_6$b = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull -padding2-l -fontface-stylized"><div class="la-flexrow clipped-bot-alt la-bckg-header-anti -widthfull -justifyevenly"><!> <!> <!> <!> <!></div> <!></div>'), root_14$4 = /* @__PURE__ */ template("<i></i>"), root_16$3 = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_17$2 = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_15$4 = /* @__PURE__ */ template("<!> <!>", 1), root_18$2 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!> <!> <!></div>'), root_3$9 = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>');
function Armor($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let collapseAllButtonHover = state(!1), editButtonHover = state(!1), messageButtonHover = state(!1);
  const $$d = /* @__PURE__ */ derived(() => $$props.armors.map((armor) => armor.system.bonuses.reduce(
    (bonusCategories, bonus) => {
      const categoryKey = [
        "pilot_hp",
        "pilot_armor",
        "pilot_evasion",
        "pilot_edef",
        "pilot_speed"
      ].includes(bonus.lid) ? "armorBonuses" : "otherBonuses";
      return bonusCategories[categoryKey][bonus.lid] = bonus.val, bonusCategories;
    },
    { armorBonuses: {}, otherBonuses: {} }
  )).reduce(
    ([armorBns, otherBns], { armorBonuses: armorBonuses2, otherBonuses: otherBonuses2 }) => (Object.keys(armorBonuses2).length > 0 && armorBns.push(armorBonuses2), Object.keys(otherBonuses2).length > 0 && otherBns.push(otherBonuses2), [armorBns, otherBns]),
    [[], []]
  )), armorBonuses = /* @__PURE__ */ derived(() => get$1($$d)[0]), otherBonuses = /* @__PURE__ */ derived(() => get$1($$d)[1]), tooltipEnabled = getPilotSheetTooltipEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.armors`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), healthTip = TooltipFactory.buildTooltip(getLocalized("LA.pilot.hardsuit.health.tooltip")), evasionTip = TooltipFactory.buildTooltip(getLocalized("LA.pilot.hardsuit.evasion.tooltip")), edefenseTip = TooltipFactory.buildTooltip(getLocalized("LA.pilot.hardsuit.edefense.tooltip")), speedTip = TooltipFactory.buildTooltip(getLocalized("LA.pilot.hardsuit.speed.tooltip")), armorTip = TooltipFactory.buildTooltip(getLocalized("LA.pilot.hardsuit.armor.tooltip"));
  function getArmorPath(index2) {
    return `itemTypes.pilot_armor.${index2}`;
  }
  __name(getArmorPath, "getArmorPath");
  function sendToChat(event2, armor) {
    var _a;
    if (event2.stopPropagation(), (_a = $$props.actor) != null && _a.uuid && armor) {
      const description = `
                ${armor.system.description}
                <hr>
                <div 
                    class="la-flexrow -justifyevenly clipped-alt -fontsize5 -padding0-tb -padding1-lr" 
                    style="
                        background-color: var(--weapon-color);
                        color: var(--light-text);
                        align-items: baseline;
                    "
                >
                    <div>${armor.system.bonuses[0].val}<i class="mdi mdi-heart-half-full" style="padding-left: 2px; padding-right: 2px;"></i></div>
                    <div class="la-flexrow">${armor.system.bonuses[1].val}<i class="cci cci-role-defender -fontsize6"></i></div>
                    <div class="la-flexrow">${armor.system.bonuses[2].val}<i class="cci cci-evasion -fontsize6"></i></div>
                    <div class="la-flexrow">${armor.system.bonuses[3].val}<i class="cci cci-edef -fontsize6"></i></div>
                    <div>${armor.system.bonuses[4].val}<i class="mdi mdi-arrow-right-bold-hexagon-outline" style="padding-left: 2px; padding-right: 2px;"></i></div>
                </div>
            `;
      let chatData = {
        title: armor.name,
        description,
        tags: armor.system.tags,
        color: CHAT_CARD_COLOR_MAP[ChatCardType.Armor]
      };
      SendUnknownToChatBase.getInstance().startFlow(armor.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendToChat, "sendToChat");
  const expression = /* @__PURE__ */ derived(() => getLocalized("LA.armor.label"));
  HeaderMain($$anchor, {
    get text() {
      return get$1(expression);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-weapon"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-weapon"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
    }, "extensionTextFunction"),
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !0,
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var fragment_2 = comment(), node = first_child(fragment_2);
      {
        var consequent_9 = /* @__PURE__ */ __name(($$anchor3) => {
          var div = root_3$9();
          each(div, 21, () => $$props.armors, index, ($$anchor4, armor, index$1) => {
            const outerContent = /* @__PURE__ */ __name(($$anchor5) => {
              var fragment_3 = comment(), node_1 = first_child(fragment_3);
              {
                var consequent_6 = /* @__PURE__ */ __name(($$anchor6) => {
                  var div_1 = root_6$b(), div_2 = child(div_1), node_2 = child(div_2);
                  {
                    var consequent = /* @__PURE__ */ __name(($$anchor7) => {
                      var span = root_7$7();
                      set_attribute(span, "data-tooltip", tooltipEnabled ? healthTip : void 0);
                      var text2 = child(span);
                      template_effect(() => {
                        set_attribute(span, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text2, `${get$1(armorBonuses)[index$1].pilot_hp ?? ""} `);
                      }), append($$anchor7, span);
                    }, "consequent");
                    if_block(node_2, ($$render) => {
                      get$1(armorBonuses)[index$1].pilot_hp && $$render(consequent);
                    });
                  }
                  var node_3 = sibling(node_2, 2);
                  {
                    var consequent_1 = /* @__PURE__ */ __name(($$anchor7) => {
                      var span_1 = root_8$5();
                      set_attribute(span_1, "data-tooltip", tooltipEnabled ? armorTip : void 0);
                      var text_1 = child(span_1);
                      template_effect(() => {
                        set_attribute(span_1, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span_1, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text_1, `${get$1(armorBonuses)[index$1].pilot_armor ?? ""} `);
                      }), append($$anchor7, span_1);
                    }, "consequent_1");
                    if_block(node_3, ($$render) => {
                      get$1(armorBonuses)[index$1].pilot_armor && $$render(consequent_1);
                    });
                  }
                  var node_4 = sibling(node_3, 2);
                  {
                    var consequent_2 = /* @__PURE__ */ __name(($$anchor7) => {
                      var span_2 = root_9$8();
                      set_attribute(span_2, "data-tooltip", tooltipEnabled ? evasionTip : void 0);
                      var text_2 = child(span_2);
                      template_effect(() => {
                        set_attribute(span_2, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span_2, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text_2, `${get$1(armorBonuses)[index$1].pilot_evasion ?? ""} `);
                      }), append($$anchor7, span_2);
                    }, "consequent_2");
                    if_block(node_4, ($$render) => {
                      get$1(armorBonuses)[index$1].pilot_evasion && $$render(consequent_2);
                    });
                  }
                  var node_5 = sibling(node_4, 2);
                  {
                    var consequent_3 = /* @__PURE__ */ __name(($$anchor7) => {
                      var span_3 = root_10$5();
                      set_attribute(span_3, "data-tooltip", tooltipEnabled ? edefenseTip : void 0);
                      var text_3 = child(span_3);
                      template_effect(() => {
                        set_attribute(span_3, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span_3, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text_3, `${get$1(armorBonuses)[index$1].pilot_edef ?? ""} `);
                      }), append($$anchor7, span_3);
                    }, "consequent_3");
                    if_block(node_5, ($$render) => {
                      get$1(armorBonuses)[index$1].pilot_edef && $$render(consequent_3);
                    });
                  }
                  var node_6 = sibling(node_5, 2);
                  {
                    var consequent_4 = /* @__PURE__ */ __name(($$anchor7) => {
                      var span_4 = root_11$6();
                      set_attribute(span_4, "data-tooltip", tooltipEnabled ? speedTip : void 0);
                      var text_4 = child(span_4);
                      template_effect(() => {
                        set_attribute(span_4, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span_4, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text_4, `${get$1(armorBonuses)[index$1].pilot_speed ?? ""} `);
                      }), append($$anchor7, span_4);
                    }, "consequent_4");
                    if_block(node_6, ($$render) => {
                      get$1(armorBonuses)[index$1].pilot_speed && $$render(consequent_4);
                    });
                  }
                  var node_7 = sibling(div_2, 2);
                  {
                    var consequent_5 = /* @__PURE__ */ __name(($$anchor7) => {
                      var fragment_4 = comment(), node_8 = first_child(fragment_4);
                      each(node_8, 17, () => get$1(armor).system.counters, index, ($$anchor8, counter, jndex) => {
                        const expression_1 = /* @__PURE__ */ derived(() => getArmorPath(index$1));
                        CounterBox($$anchor8, {
                          get text() {
                            return get$1(counter).name;
                          },
                          get type() {
                            return CounterBoxType.Counter;
                          },
                          get usesValue() {
                            return get$1(counter).value;
                          },
                          get usesMax() {
                            return get$1(counter).max;
                          },
                          get path() {
                            return `${get$1(expression_1) ?? ""}.system.counters.${jndex ?? ""}`;
                          },
                          logging: !0
                        });
                      }), append($$anchor7, fragment_4);
                    }, "consequent_5");
                    if_block(node_7, ($$render) => {
                      get$1(armor).system.counters.length && $$render(consequent_5);
                    });
                  }
                  append($$anchor6, div_1);
                }, "consequent_6");
                if_block(node_1, ($$render) => {
                  Object.keys(get$1(armorBonuses)[index$1]).length && $$render(consequent_6);
                });
              }
              append($$anchor5, fragment_3);
            }, "outerContent"), headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor5) => {
              var i = root_14$4();
              set_class(i, `${H2_ICON_SIZE} cci cci-pilot`), append($$anchor5, i);
            }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor5) => {
              var fragment_6 = root_15$4(), node_9 = first_child(fragment_6);
              const expression_2 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_3 = /* @__PURE__ */ derived(() => getArmorPath(index$1)), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
              GlyphButton(node_9, {
                get style() {
                  return get$1(expression_2);
                },
                get flowClass() {
                  return FlowClass.ContextMenu;
                },
                get path() {
                  return get$1(expression_3);
                },
                tooltipEnabled,
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_4);
                },
                get logText() {
                  return get$1(expression_5);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i_1 = root_16$3();
                  append($$anchor6, i_1);
                }, "children"),
                $$slots: { default: !0 }
              });
              var node_10 = sibling(node_9, 2);
              const expression_6 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip")), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
              GlyphButton(node_10, {
                get style() {
                  return get$1(expression_6);
                },
                get flowClass() {
                  return FlowClass.None;
                },
                index: index$1,
                get uuid() {
                  return get$1(armor).uuid;
                },
                tooltipEnabled,
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_7);
                },
                get logText() {
                  return get$1(expression_8);
                },
                logging: !0,
                onClick: /* @__PURE__ */ __name((event2) => sendToChat(event2, get$1(armor)), "onClick"),
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i_2 = root_17$2();
                  append($$anchor6, i_2);
                }, "children"),
                $$slots: { default: !0 }
              }), append($$anchor5, fragment_6);
            }, "headerSecondaryRightOptions"), expression_9 = /* @__PURE__ */ derived(() => getArmorPath(index$1));
            HeaderSecondary($$anchor4, {
              get text() {
                return get$1(armor).name;
              },
              headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
              textStyle: [
                H2_TEXT_SIZE,
                "-overflowhidden -fontface-stylized"
              ],
              borderStyle: ["-bordersoff"],
              extensionTextFunction: /* @__PURE__ */ __name(() => {
                if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
                if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
              }, "extensionTextFunction"),
              get itemID() {
                return get$1(armor).id;
              },
              get uuid() {
                return get$1(armor).uuid;
              },
              get path() {
                return get$1(expression_9);
              },
              acceptTypes: "pilot_armor",
              get collapseID() {
                return get$1(armor).uuid;
              },
              startCollapsed: !0,
              renderOutsideCollapse: outerContent,
              contentLeft: headerSecondaryLeftOptions2,
              contentRight: headerSecondaryRightOptions,
              children: /* @__PURE__ */ __name(($$anchor5, $$slotProps2) => {
                var div_3 = root_18$2(), node_11 = child(div_3);
                {
                  var consequent_7 = /* @__PURE__ */ __name(($$anchor6) => {
                    const expression_10 = /* @__PURE__ */ derived(() => `${getArmorPath(index$1)}.system.bonuses`);
                    BonusBox($$anchor6, {
                      get bonuses() {
                        return get$1(otherBonuses);
                      },
                      get bonusPath() {
                        return get$1(expression_10);
                      }
                    });
                  }, "consequent_7");
                  if_block(node_11, ($$render) => {
                    get$1(otherBonuses).length && $$render(consequent_7);
                  });
                }
                var node_12 = sibling(node_11, 2);
                DeployableBox(node_12, {
                  get source() {
                    return $$props.actor;
                  },
                  get lidSource() {
                    return get$1(armor).system;
                  },
                  get uuid() {
                    return $$props.actor.uuid;
                  },
                  get sheetUUID() {
                    return $$props.actor.uuid;
                  },
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  logging: !0
                });
                var node_13 = sibling(node_12, 2);
                const expression_11 = /* @__PURE__ */ derived(() => `${get$1(armor).uuid}.actions`);
                ActionBox(node_13, {
                  get actions() {
                    return get$1(armor).system.actions;
                  },
                  get actor() {
                    return $$props.actor;
                  },
                  get uuid() {
                    return get$1(armor).uuid;
                  },
                  path: "system.actions",
                  get collapseID() {
                    return get$1(expression_11);
                  },
                  startCollapsed: !0,
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  logging: !0
                });
                var node_14 = sibling(node_13, 2);
                const expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.description.label"));
                EffectBox(node_14, {
                  get name() {
                    return get$1(expression_12);
                  },
                  get effect() {
                    return get$1(armor).system.description;
                  },
                  tooltipEnabled,
                  logging: !0
                });
                var node_15 = sibling(node_14, 2);
                {
                  var consequent_8 = /* @__PURE__ */ __name(($$anchor6) => {
                    const expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.effect.label"));
                    EffectBox($$anchor6, {
                      get name() {
                        return get$1(expression_13);
                      },
                      get effect() {
                        return get$1(armor).system.effect;
                      },
                      tooltipEnabled,
                      logging: !0
                    });
                  }, "consequent_8");
                  if_block(node_15, ($$render) => {
                    get$1(armor).system.effect && $$render(consequent_8);
                  });
                }
                var node_16 = sibling(node_15, 2);
                TagArray(node_16, {
                  get tags() {
                    return get$1(armor).system.tags;
                  },
                  justify: "start",
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  }
                }), append($$anchor5, div_3);
              }, "children"),
              $$slots: { default: !0 }
            });
          }), append($$anchor3, div);
        }, "consequent_9"), alternate = /* @__PURE__ */ __name(($$anchor3) => {
          const expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.hardsuit.empty.label")), expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.hardsuit.empty.subLabel"));
          EmptyBox($$anchor3, {
            get label() {
              return get$1(expression_14);
            },
            get subLabel() {
              return get$1(expression_15);
            },
            get type() {
              return AcceptType.PilotArmor;
            },
            get path() {
              return `system.loadout.armor.${$$props.armors.length ?? ""}.value`;
            }
          });
        }, "alternate");
        if_block(node, ($$render) => {
          $$props.armors.length ? $$render(consequent_9) : $$render(alternate, !1);
        });
      }
      append($$anchor2, fragment_2);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(Armor, "Armor");
var root_6$a = /* @__PURE__ */ template('<div class="la-flexrow clipped-bot-alt la-bckg-header-anti -widthfull"><!></div>'), root_5$9 = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull -padding2-l -fontface-stylized"><!> <!></div>'), root_9$7 = /* @__PURE__ */ template("<i></i>"), root_11$5 = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_12$5 = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_10$4 = /* @__PURE__ */ template("<!> <!>", 1), root_13$4 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!> <!> <!></div>'), root_3$8 = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>');
function Gear($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let collapseAllButtonHover = state(!1), editButtonHover = state(!1), messageButtonHover = state(!1);
  const tooltipEnabled = getPilotSheetTooltipEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.gears`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function getGearPath(index2) {
    return `system.loadout.gear.${index2}.value`;
  }
  __name(getGearPath, "getGearPath");
  function renderOuter(gear) {
    return gear.system.uses.max || gear.system.counters.length;
  }
  __name(renderOuter, "renderOuter");
  const expression = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.gear.label"));
  HeaderMain($$anchor, {
    get text() {
      return get$1(expression);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-system"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-system"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
    }, "extensionTextFunction"),
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !0,
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var fragment_2 = comment(), node = first_child(fragment_2);
      {
        var consequent_3 = /* @__PURE__ */ __name(($$anchor3) => {
          var div = root_3$8();
          each(div, 21, () => $$props.gears, index, ($$anchor4, gear, index$1) => {
            const outerContent = /* @__PURE__ */ __name(($$anchor5) => {
              var div_1 = root_5$9(), node_1 = child(div_1);
              {
                var consequent = /* @__PURE__ */ __name(($$anchor6) => {
                  var div_2 = root_6$a(), node_2 = child(div_2);
                  const expression_1 = /* @__PURE__ */ derived(() => getGearPath(index$1));
                  LimitedBox(node_2, {
                    get usesValue() {
                      return get$1(gear).system.uses.value;
                    },
                    get usesMax() {
                      return get$1(gear).system.uses.max;
                    },
                    get path() {
                      return get$1(expression_1);
                    },
                    logging: !0
                  }), append($$anchor6, div_2);
                }, "consequent");
                if_block(node_1, ($$render) => {
                  get$1(gear).system.uses.max && $$render(consequent);
                });
              }
              var node_3 = sibling(node_1, 2);
              {
                var consequent_1 = /* @__PURE__ */ __name(($$anchor6) => {
                  var fragment_3 = comment(), node_4 = first_child(fragment_3);
                  each(node_4, 17, () => get$1(gear).system.counters, index, ($$anchor7, counter, jndex) => {
                    const expression_2 = /* @__PURE__ */ derived(() => getGearPath(index$1));
                    CounterBox($$anchor7, {
                      get text() {
                        return get$1(counter).name;
                      },
                      get type() {
                        return CounterBoxType.Counter;
                      },
                      get usesValue() {
                        return get$1(counter).value;
                      },
                      get usesMax() {
                        return get$1(counter).max;
                      },
                      get path() {
                        return `${get$1(expression_2) ?? ""}.system.counters.${jndex ?? ""}`;
                      },
                      logging: !0
                    });
                  }), append($$anchor6, fragment_3);
                }, "consequent_1");
                if_block(node_3, ($$render) => {
                  get$1(gear).system.counters.length && $$render(consequent_1);
                });
              }
              append($$anchor5, div_1);
            }, "outerContent"), headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor5) => {
              var i = root_9$7();
              set_class(i, `${H2_ICON_SIZE} cci cci-system`), append($$anchor5, i);
            }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor5) => {
              var fragment_5 = root_10$4(), node_5 = first_child(fragment_5);
              const expression_3 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_4 = /* @__PURE__ */ derived(() => getGearPath(index$1)), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
              GlyphButton(node_5, {
                get style() {
                  return get$1(expression_3);
                },
                get flowClass() {
                  return FlowClass.ContextMenu;
                },
                get path() {
                  return get$1(expression_4);
                },
                tooltipEnabled,
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_5);
                },
                get logText() {
                  return get$1(expression_6);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i_1 = root_11$5();
                  append($$anchor6, i_1);
                }, "children"),
                $$slots: { default: !0 }
              });
              var node_6 = sibling(node_5, 2);
              const expression_7 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip")), expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
              GlyphButton(node_6, {
                get style() {
                  return get$1(expression_7);
                },
                get flowClass() {
                  return FlowClass.SendToChat;
                },
                index: index$1,
                get uuid() {
                  return get$1(gear).uuid;
                },
                tooltipEnabled,
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_8);
                },
                get logText() {
                  return get$1(expression_9);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i_2 = root_12$5();
                  append($$anchor6, i_2);
                }, "children"),
                $$slots: { default: !0 }
              }), append($$anchor5, fragment_5);
            }, "headerSecondaryRightOptions"), expression_10 = /* @__PURE__ */ derived(() => getGearPath(index$1)), expression_11 = /* @__PURE__ */ derived(() => renderOuter(get$1(gear)) ? outerContent : void 0);
            HeaderSecondary($$anchor4, {
              get text() {
                return get$1(gear).name;
              },
              headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
              textStyle: [
                H2_TEXT_SIZE,
                "-overflowhidden -fontface-stylized"
              ],
              borderStyle: ["-bordersoff"],
              extensionTextFunction: /* @__PURE__ */ __name(() => {
                if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
                if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
              }, "extensionTextFunction"),
              get itemID() {
                return get$1(gear).lid;
              },
              get uuid() {
                return get$1(gear).uuid;
              },
              get path() {
                return get$1(expression_10);
              },
              acceptTypes: "pilot_gear",
              get collapseID() {
                return get$1(gear).uuid;
              },
              startCollapsed: !0,
              get renderOutsideCollapse() {
                return get$1(expression_11);
              },
              contentLeft: headerSecondaryLeftOptions2,
              contentRight: headerSecondaryRightOptions,
              children: /* @__PURE__ */ __name(($$anchor5, $$slotProps2) => {
                var div_3 = root_13$4(), node_7 = child(div_3);
                const expression_12 = /* @__PURE__ */ derived(() => `${getGearPath(index$1)}.system.bonuses`);
                BonusBox(node_7, {
                  get bonuses() {
                    return get$1(gear).system.bonuses;
                  },
                  get bonusPath() {
                    return get$1(expression_12);
                  }
                });
                var node_8 = sibling(node_7, 2);
                DeployableBox(node_8, {
                  get source() {
                    return $$props.actor;
                  },
                  get lidSource() {
                    return get$1(gear).system;
                  },
                  get uuid() {
                    return $$props.actor.uuid;
                  },
                  get sheetUUID() {
                    return $$props.actor.uuid;
                  },
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  logging: !0
                });
                var node_9 = sibling(node_8, 2);
                const expression_13 = /* @__PURE__ */ derived(() => `${get$1(gear).uuid}.actions`);
                ActionBox(node_9, {
                  get actions() {
                    return get$1(gear).system.actions;
                  },
                  get actor() {
                    return $$props.actor;
                  },
                  get uuid() {
                    return get$1(gear).uuid;
                  },
                  path: "system.actions",
                  get collapseID() {
                    return get$1(expression_13);
                  },
                  startCollapsed: !0,
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  logging: !0
                });
                var node_10 = sibling(node_9, 2);
                const expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.description.label"));
                EffectBox(node_10, {
                  get name() {
                    return get$1(expression_14);
                  },
                  get effect() {
                    return get$1(gear).system.description;
                  },
                  tooltipEnabled,
                  logging: !0
                });
                var node_11 = sibling(node_10, 2);
                {
                  var consequent_2 = /* @__PURE__ */ __name(($$anchor6) => {
                    const expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.effect.label"));
                    EffectBox($$anchor6, {
                      get name() {
                        return get$1(expression_15);
                      },
                      get effect() {
                        return get$1(gear).system.effect;
                      },
                      tooltipEnabled,
                      logging: !0
                    });
                  }, "consequent_2");
                  if_block(node_11, ($$render) => {
                    get$1(gear).system.effect && $$render(consequent_2);
                  });
                }
                var node_12 = sibling(node_11, 2);
                TagArray(node_12, {
                  get tags() {
                    return get$1(gear).system.tags;
                  },
                  justify: "start",
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  }
                }), append($$anchor5, div_3);
              }, "children"),
              $$slots: { default: !0 }
            });
          }), append($$anchor3, div);
        }, "consequent_3"), alternate = /* @__PURE__ */ __name(($$anchor3) => {
          const expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.gear.empty.label")), expression_17 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.gear.empty.subLabel"));
          EmptyBox($$anchor3, {
            get label() {
              return get$1(expression_16);
            },
            get subLabel() {
              return get$1(expression_17);
            },
            get type() {
              return AcceptType.PilotGear;
            },
            get path() {
              return `system.loadout.gear.${$$props.gears.length ?? ""}.value`;
            }
          });
        }, "alternate");
        if_block(node, ($$render) => {
          $$props.gears.length ? $$render(consequent_3) : $$render(alternate, !1);
        });
      }
      append($$anchor2, fragment_2);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(Gear, "Gear");
var root_7$6 = /* @__PURE__ */ template('<div class="la-flexrow clipped-bot-alt la-bckg-header-anti -widthfull"><!></div>'), root_6$9 = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull -padding2-l"><!> <!></div>'), root_9$6 = /* @__PURE__ */ template("<i></i>"), root_11$4 = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_12$4 = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_10$3 = /* @__PURE__ */ template("<!> <!>", 1), root_13$3 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!> <!></div>'), root_3$7 = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>');
function Reserve($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let collapseAllButtonHover = state(!1), editButtonHover = state(!1), messageButtonHover = state(!1);
  const tooltipEnabled = getPilotSheetTooltipEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.reserves`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function getReservePath(index2) {
    return `itemTypes.reserve.${index2}`;
  }
  __name(getReservePath, "getReservePath");
  function updateReserveUses(reserve) {
    reserve.system.used = !reserve.system.used, $$props.actor.updateEmbeddedDocuments("Item", reserve);
  }
  __name(updateReserveUses, "updateReserveUses");
  function getHeaderStyle(reserve) {
    return reserve.system.used ? "la-text-repcap -strikethrough" : "la-text-header";
  }
  __name(getHeaderStyle, "getHeaderStyle");
  const expression = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.reserve.label"));
  HeaderMain($$anchor, {
    get text() {
      return get$1(expression);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-action--downtime"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-action--downtime"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
    }, "extensionTextFunction"),
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !0,
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var fragment_2 = comment(), node = first_child(fragment_2);
      {
        var consequent_2 = /* @__PURE__ */ __name(($$anchor3) => {
          var div = root_3$7();
          each(div, 21, () => $$props.reserves, index, ($$anchor4, reserve, index$1) => {
            const outerContent = /* @__PURE__ */ __name(($$anchor5) => {
              var fragment_3 = comment(), node_1 = first_child(fragment_3);
              {
                var consequent_1 = /* @__PURE__ */ __name(($$anchor6) => {
                  var div_1 = root_6$9(), node_2 = child(div_1);
                  {
                    var consequent = /* @__PURE__ */ __name(($$anchor7) => {
                      var div_2 = root_7$6(), node_3 = child(div_2);
                      const expression_1 = /* @__PURE__ */ derived(() => get$1(reserve).system.used ? 0 : 1), expression_2 = /* @__PURE__ */ derived(() => getReservePath(index$1));
                      LimitedBox(node_3, {
                        get usesValue() {
                          return get$1(expression_1);
                        },
                        usesMax: 1,
                        get path() {
                          return `${get$1(expression_2) ?? ""}.system.used`;
                        },
                        onPointerClick: updateReserveUses,
                        logging: !0
                      }), append($$anchor7, div_2);
                    }, "consequent");
                    if_block(node_2, ($$render) => {
                      get$1(reserve).system.consumable && $$render(consequent);
                    });
                  }
                  var node_4 = sibling(node_2, 2);
                  each(node_4, 17, () => get$1(reserve).system.counters, index, ($$anchor7, counter, jndex) => {
                    const expression_3 = /* @__PURE__ */ derived(() => getReservePath(index$1));
                    CounterBox($$anchor7, {
                      get text() {
                        return get$1(counter).name;
                      },
                      get type() {
                        return CounterBoxType.Counter;
                      },
                      get usesValue() {
                        return get$1(counter).value;
                      },
                      get usesMax() {
                        return get$1(counter).max;
                      },
                      get path() {
                        return `${get$1(expression_3) ?? ""}.system.counters.${jndex ?? ""}`;
                      },
                      logging: !0
                    });
                  }), append($$anchor6, div_1);
                }, "consequent_1");
                if_block(node_1, ($$render) => {
                  (get$1(reserve).system.counters.length || get$1(reserve).system.consumable) && $$render(consequent_1);
                });
              }
              append($$anchor5, fragment_3);
            }, "outerContent"), headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor5) => {
              var i = root_9$6();
              template_effect(() => set_class(i, `${H2_ICON_SIZE} cci ${RESERVE_ICON_MAP[get$1(reserve).system.type] ?? ""}`)), append($$anchor5, i);
            }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor5) => {
              var fragment_5 = root_10$3(), node_5 = first_child(fragment_5);
              const expression_4 = /* @__PURE__ */ derived(() => [
                H2_BUTTON_ICON_STYLE(),
                "-padding0-lr la-flexrow"
              ]), expression_5 = /* @__PURE__ */ derived(() => getReservePath(index$1)), expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
              GlyphButton(node_5, {
                get style() {
                  return get$1(expression_4);
                },
                get flowClass() {
                  return FlowClass.ContextMenu;
                },
                get path() {
                  return get$1(expression_5);
                },
                tooltipEnabled,
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_6);
                },
                get logText() {
                  return get$1(expression_7);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i_1 = root_11$4();
                  append($$anchor6, i_1);
                }, "children"),
                $$slots: { default: !0 }
              });
              var node_6 = sibling(node_5, 2);
              const expression_8 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip")), expression_10 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
              GlyphButton(node_6, {
                get style() {
                  return get$1(expression_8);
                },
                get flowClass() {
                  return FlowClass.SendToChat;
                },
                index: index$1,
                get uuid() {
                  return $$props.reserves.uuid;
                },
                tooltipEnabled,
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_9);
                },
                get logText() {
                  return get$1(expression_10);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i_2 = root_12$4();
                  append($$anchor6, i_2);
                }, "children"),
                $$slots: { default: !0 }
              }), append($$anchor5, fragment_5);
            }, "headerSecondaryRightOptions"), expression_11 = /* @__PURE__ */ derived(() => [
              H2_TEXT_SIZE,
              getHeaderStyle(get$1(reserve)),
              "-fontface-stylized"
            ]), expression_12 = /* @__PURE__ */ derived(() => getReservePath(index$1));
            HeaderSecondary($$anchor4, {
              get text() {
                return get$1(reserve).name;
              },
              headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
              get textStyle() {
                return get$1(expression_11);
              },
              borderStyle: ["-bordersoff"],
              extensionTextFunction: /* @__PURE__ */ __name(() => {
                if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
                if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
              }, "extensionTextFunction"),
              get itemID() {
                return get$1(reserve).lid;
              },
              get uuid() {
                return get$1(reserve).uuid;
              },
              get path() {
                return get$1(expression_12);
              },
              acceptTypes: "reserve",
              get collapseID() {
                return get$1(reserve).uuid;
              },
              startCollapsed: !0,
              renderOutsideCollapse: outerContent,
              contentLeft: headerSecondaryLeftOptions2,
              contentRight: headerSecondaryRightOptions,
              children: /* @__PURE__ */ __name(($$anchor5, $$slotProps2) => {
                var div_3 = root_13$3(), node_7 = child(div_3);
                const expression_13 = /* @__PURE__ */ derived(() => `${getReservePath(index$1)}.system.bonuses`);
                BonusBox(node_7, {
                  get bonuses() {
                    return get$1(reserve).system.bonuses;
                  },
                  get bonusPath() {
                    return get$1(expression_13);
                  }
                });
                var node_8 = sibling(node_7, 2);
                DeployableBox(node_8, {
                  get source() {
                    return $$props.actor;
                  },
                  get lidSource() {
                    return get$1(reserve).system;
                  },
                  get uuid() {
                    return $$props.actor.uuid;
                  },
                  get sheetUUID() {
                    return $$props.actor.uuid;
                  },
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  logging: !0
                });
                var node_9 = sibling(node_8, 2);
                const expression_14 = /* @__PURE__ */ derived(() => `${get$1(reserve).uuid}.actions`);
                ActionBox(node_9, {
                  get actions() {
                    return get$1(reserve).system.actions;
                  },
                  get actor() {
                    return $$props.actor;
                  },
                  get uuid() {
                    return get$1(reserve).uuid;
                  },
                  path: "system.actions",
                  get collapseID() {
                    return get$1(expression_14);
                  },
                  startCollapsed: !0,
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  logging: !0
                });
                var node_10 = sibling(node_9, 2);
                const expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.description.label"));
                EffectBox(node_10, {
                  get name() {
                    return get$1(expression_15);
                  },
                  get effect() {
                    return get$1(reserve).system.description;
                  },
                  tooltipEnabled,
                  logging: !0
                });
                var node_11 = sibling(node_10, 2);
                TagArray(node_11, {
                  get tags() {
                    return get$1(reserve).system.tags;
                  },
                  justify: "start",
                  tooltipEnabled,
                  get tooltipTheme() {
                    return get$1(theme);
                  }
                }), append($$anchor5, div_3);
              }, "children"),
              $$slots: { default: !0 }
            });
          }), append($$anchor3, div);
        }, "consequent_2"), alternate = /* @__PURE__ */ __name(($$anchor3) => {
          const expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.reserve.empty.label")), expression_17 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.reserve.empty.subLabel"));
          EmptyBox($$anchor3, {
            get label() {
              return get$1(expression_16);
            },
            get subLabel() {
              return get$1(expression_17);
            },
            get type() {
              return AcceptType.Reserve;
            },
            get path() {
              return `itemTypes.reserve.${$$props.reserves.length ?? ""}`;
            }
          });
        }, "alternate");
        if_block(node, ($$render) => {
          $$props.reserves.length ? $$render(consequent_2) : $$render(alternate, !1);
        });
      }
      append($$anchor2, fragment_2);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(Reserve, "Reserve");
var root$g = /* @__PURE__ */ template("<!> <!> <!> <!>", 1);
function Equipment($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), itemTypes = /* @__PURE__ */ derived(() => props.itemTypes);
  setActorContext(get$1(actor));
  var fragment = root$g(), node = first_child(fragment);
  Weapon(node, {
    get actor() {
      return get$1(actor);
    },
    get weapons() {
      return get$1(itemTypes).pilot_weapon;
    }
  });
  var node_1 = sibling(node, 2);
  Armor(node_1, {
    get actor() {
      return get$1(actor);
    },
    get armors() {
      return get$1(itemTypes).pilot_armor;
    }
  });
  var node_2 = sibling(node_1, 2);
  Gear(node_2, {
    get actor() {
      return get$1(actor);
    },
    get gears() {
      return get$1(itemTypes).pilot_gear;
    }
  });
  var node_3 = sibling(node_2, 2);
  Reserve(node_3, {
    get actor() {
      return get$1(actor);
    },
    get reserves() {
      return get$1(itemTypes).reserve;
    }
  }), append($$anchor, fragment), pop();
}
__name(Equipment, "Equipment");
var root_6$8 = /* @__PURE__ */ template('<div class="-padding2-l"><!></div>'), root_7$5 = /* @__PURE__ */ template('<i class="mdi mdi-weather-night -fontsize5 -padding0-lr"></i>'), root_9$5 = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_5$8 = /* @__PURE__ */ template('<div class="la-flexcol -widthfull -fontface-stylized"><!></div>'), root_4$5 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"></div>');
function Burden($$anchor, $$props) {
  push($$props, !0);
  let editButtonHover = state(!1), addButtonHover = state(!1);
  const tooltipEnabled = getPilotSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.burdens`), burdens = /* @__PURE__ */ derived(() => $$props.system.bond_state.burdens), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), addBurdenTip = TooltipFactory.buildTooltip(getLocalized("LA.pilot.bond.burden.add.tooltip"));
  function getBurdenPath(index2) {
    return `system.bond_state.burdens.${index2}`;
  }
  __name(getBurdenPath, "getBurdenPath");
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      const headerContent = /* @__PURE__ */ __name(($$anchor3) => {
        const expression = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.burden.add.tooltip")), expression_1 = /* @__PURE__ */ derived(() => $$props.system.bond === null);
        GlyphButton($$anchor3, {
          style: [
            "mdi mdi-plus-circle-outline -fontsize5 -height4 -lineheight4 la-prmy-header la-scdy-primary",
            qualityMode ? "-glow-prmy -glow-scdy-hover" : ""
          ],
          get flowClass() {
            return FlowClass.GeneralControl;
          },
          path: "system.bond_state.burdens",
          action: "append",
          actionValue: "(struct)counter",
          tooltipEnabled,
          get tooltipTheme() {
            return get$1(theme);
          },
          tooltip: addBurdenTip,
          get tooltipDirection() {
            return TooltipDirection.UP;
          },
          get logText() {
            return get$1(expression);
          },
          logging: !0,
          get disabled() {
            return get$1(expression_1);
          },
          onPointerEnter: /* @__PURE__ */ __name(() => {
            set(addButtonHover, !0);
          }, "onPointerEnter"),
          onPointerLeave: /* @__PURE__ */ __name(() => {
            set(addButtonHover, !1);
          }, "onPointerLeave")
        });
      }, "headerContent"), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.burden.label"));
      HeaderMain($$anchor2, {
        get text() {
          return get$1(expression_2);
        },
        headerStyle: [MAIN_HEADER_STYLE, "la-bckg-weapon"],
        textStyle: ["la-text-header -fontsize4 -overflowhidden"],
        borderStyle: ["la-brdr-weapon"],
        extensionTextFunction: /* @__PURE__ */ __name(() => {
          if (get$1(addButtonHover)) return `--${getLocalized("LA.add.extension")}`;
        }, "extensionTextFunction"),
        get collapseID() {
          return get$1(collID);
        },
        startCollapsed: !0,
        headerContent,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var fragment_3 = comment(), node_1 = first_child(fragment_3);
          {
            var consequent = /* @__PURE__ */ __name(($$anchor4) => {
              var div = root_4$5();
              each(div, 21, () => get$1(burdens), index, ($$anchor5, burden, index2) => {
                var div_1 = root_5$8();
                {
                  const outerContent = /* @__PURE__ */ __name(($$anchor6) => {
                    var div_2 = root_6$8(), node_2 = child(div_2);
                    CounterBox(node_2, {
                      get type() {
                        return CounterBoxType.Counter;
                      },
                      get usesValue() {
                        return get$1(burden).value;
                      },
                      get usesMax() {
                        return get$1(burden).max;
                      },
                      path: `system.bond_state.burdens.${index2 ?? ""}`,
                      style: [
                        "clipped-bot-alt -widthfull la-bckg-header-anti"
                      ],
                      logging: !0
                    }), append($$anchor6, div_2);
                  }, "outerContent"), headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor6) => {
                    var i = root_7$5();
                    append($$anchor6, i);
                  }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor6) => {
                    const expression_3 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_4 = /* @__PURE__ */ derived(() => getBurdenPath(index2)), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
                    GlyphButton($$anchor6, {
                      get style() {
                        return get$1(expression_3);
                      },
                      get flowClass() {
                        return FlowClass.ContextMenu;
                      },
                      get path() {
                        return get$1(expression_4);
                      },
                      tooltipEnabled,
                      get tooltipDirection() {
                        return TooltipDirection.UP;
                      },
                      get tooltipTheme() {
                        return get$1(theme);
                      },
                      get tooltip() {
                        return get$1(expression_5);
                      },
                      get logText() {
                        return get$1(expression_6);
                      },
                      logging: !0,
                      onPointerEnter: /* @__PURE__ */ __name(() => {
                        set(editButtonHover, !0);
                      }, "onPointerEnter"),
                      onPointerLeave: /* @__PURE__ */ __name(() => {
                        set(editButtonHover, !1);
                      }, "onPointerLeave"),
                      children: /* @__PURE__ */ __name(($$anchor7, $$slotProps2) => {
                        var i_1 = root_9$5();
                        append($$anchor7, i_1);
                      }, "children"),
                      $$slots: { default: !0 }
                    });
                  }, "headerSecondaryRightOptions");
                  var node_3 = child(div_1);
                  HeaderSecondary(node_3, {
                    get text() {
                      return get$1(burden).name;
                    },
                    headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
                    textStyle: [
                      H2_TEXT_SIZE,
                      "-overflowhidden -fontface-stylized"
                    ],
                    borderStyle: ["-bordersoff"],
                    extensionTextFunction: /* @__PURE__ */ __name(() => {
                      if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
                    }, "extensionTextFunction"),
                    get itemID() {
                      return get$1(burden).lid;
                    },
                    get uuid() {
                      return get$1(burden).uuid;
                    },
                    renderOutsideCollapse: outerContent,
                    contentLeft: headerSecondaryLeftOptions2,
                    contentRight: headerSecondaryRightOptions
                  });
                }
                append($$anchor5, div_1);
              }), append($$anchor4, div);
            }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor4) => {
              const expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.burden.empty.label")), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.burden.empty.subLabel"));
              EmptyBox($$anchor4, {
                get label() {
                  return get$1(expression_7);
                },
                get subLabel() {
                  return get$1(expression_8);
                }
              });
            }, "alternate");
            if_block(node_1, ($$render) => {
              get$1(burdens).length ? $$render(consequent) : $$render(alternate, !1);
            });
          }
          append($$anchor3, fragment_3);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent_1");
    if_block(node, ($$render) => {
      $$props.system.bond && $$render(consequent_1);
    });
  }
  append($$anchor, fragment), pop();
}
__name(Burden, "Burden");
var root_2$5 = /* @__PURE__ */ template('<button type="button"><i></i></button>'), root_1$7 = /* @__PURE__ */ template(`<div class="la-limited la-flexrow la-text-header 
        -aligncenter -padding1-lr"><span class="la-hexarray__span -fontsizemedium"> </span> <!></div>`);
function LimitedBondBox($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const actorUuid = (_a = getActorContext()) == null ? void 0 : _a.uuid, qualityMode = getExtraEffectsEnabled(), log = /* @__PURE__ */ derived(() => $$props.logText || getLocalized("LA.limited.tooltip"));
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var div = root_1$7(), span = child(div), text2 = child(span), node_1 = sibling(span, 2);
      each(node_1, 17, () => ({ length: $$props.usesMax }), index, ($$anchor3, _, index2) => {
        var button = root_2$5();
        set_class(button, `la-prmy-header la-scdy-primary -fontsize7
            ${(qualityMode ? "-glow-prmy -glow-scdy-hover" : "") ?? ""}`);
        var i = child(button);
        template_effect(
          ($0) => {
            set_attribute(button, "aria-label", $0), set_class(i, `mdi ${(index2 < $$props.usesValue ? "mdi-hexagon-slice-6" : "mdi-hexagon-outline") ?? ""}
                power-uses-hex`), set_attribute(i, "data-available", index2 < $$props.usesValue), set_attribute(i, "data-uuid", $$props.uuid), set_attribute(i, "data-power-index", $$props.power), set_attribute(i, "data-path", `system.bond.system.powers.${$$props.power}`);
          },
          [() => getLocalized("LA.use.label")]
        ), event("pointerenter", button, function(...$$args) {
          var _a2;
          (_a2 = $$props.logging ? (event2) => sendToTextConsole(event2, get$1(log), actorUuid) : void 0) == null || _a2.apply(this, $$args);
        }), event("pointerleave", button, function(...$$args) {
          var _a2;
          (_a2 = $$props.logging ? (event2) => resetTextConsole(event2, actorUuid) : void 0) == null || _a2.apply(this, $$args);
        }), append($$anchor3, button);
      }), template_effect(($0) => set_text(text2, $0), [() => getLocalized("LA.limited.label")]), append($$anchor2, div);
    }, "consequent");
    if_block(node, ($$render) => {
      $$props.usesMax && $$render(consequent);
    });
  }
  append($$anchor, fragment), pop();
}
__name(LimitedBondBox, "LimitedBondBox");
var root_9$4 = /* @__PURE__ */ template('<span class="la-text-header -aligncontentcenter -fontsizesmall -upper"> </span>'), root_7$4 = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull -padding2-l -fontface-stylized"><div class="la-flexrow clipped-bot-alt la-bckg-header-anti -widthfull"><!> <!></div></div>'), root_12$3 = /* @__PURE__ */ template('<span class="-fontsizesmall -letterspacing0"> </span>'), root_13$2 = /* @__PURE__ */ template('<span class="-fontsizesmall -letterspacing0"> </span>'), root_14$3 = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_11$3 = /* @__PURE__ */ template('<span class="la-flexrow -gap0 -padding2-r"><!> <!></span> <!>', 1), root_15$3 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!></div>'), root_4$4 = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>');
function Power($$anchor, $$props) {
  push($$props, !0);
  let collapseAllButtonHover = state(!1), effectButtonHover = state(!1), messageButtonHover = state(!1);
  const tooltipEnabled = getPilotSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), unlockedPowers = /* @__PURE__ */ derived(() => {
    var _a;
    return ((_a = $$props.system.bond) == null ? void 0 : _a.system.powers.map((power, index2) => ({ ...power, index: index2 })).filter((power) => power.unlocked)) || [];
  }), bondUUID = /* @__PURE__ */ derived(() => {
    var _a;
    return (_a = $$props.system.bond) == null ? void 0 : _a.uuid;
  }), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.powers`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function getPowerCollapseID(index2) {
    return `${$$props.actor.uuid}.powers.${index2}`;
  }
  __name(getPowerCollapseID, "getPowerCollapseID");
  function sendToChat(event2, power) {
    var _a;
    if (event2.stopPropagation(), (_a = $$props.actor) != null && _a.uuid && power) {
      let chatData = {
        title: power.name,
        description: power.description
      };
      SendUnknownToChatBase.getInstance().startFlow($$props.actor.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendToChat, "sendToChat");
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_6 = /* @__PURE__ */ __name(($$anchor2) => {
      const headerOptions = /* @__PURE__ */ __name(($$anchor3) => {
        CollapseAllButton($$anchor3, {
          get collapseID() {
            return get$1(collID);
          },
          tooltipEnabled,
          get tooltipTheme() {
            return get$1(theme);
          },
          onPointerEnter: /* @__PURE__ */ __name(() => {
            set(collapseAllButtonHover, !0);
          }, "onPointerEnter"),
          onPointerLeave: /* @__PURE__ */ __name(() => {
            set(collapseAllButtonHover, !1);
          }, "onPointerLeave")
        });
      }, "headerOptions"), expression = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.power.label"));
      HeaderMain($$anchor2, {
        get text() {
          return get$1(expression);
        },
        headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
        textStyle: ["la-text-header -fontsize4 -overflowhidden"],
        borderStyle: ["la-brdr-primary"],
        extensionTextFunction: /* @__PURE__ */ __name(() => {
          if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
        }, "extensionTextFunction"),
        get collapseID() {
          return get$1(collID);
        },
        startCollapsed: !0,
        headerContent: headerOptions,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var fragment_3 = comment(), node_1 = first_child(fragment_3);
          {
            var consequent_5 = /* @__PURE__ */ __name(($$anchor4) => {
              var div = root_4$4();
              each(div, 21, () => get$1(unlockedPowers), index, ($$anchor5, power) => {
                const outerContent = /* @__PURE__ */ __name(($$anchor6) => {
                  var fragment_4 = comment(), node_2 = first_child(fragment_4);
                  {
                    var consequent_2 = /* @__PURE__ */ __name(($$anchor7) => {
                      var div_1 = root_7$4(), div_2 = child(div_1), node_3 = child(div_2);
                      {
                        var consequent = /* @__PURE__ */ __name(($$anchor8) => {
                          LimitedBondBox($$anchor8, {
                            get usesValue() {
                              return get$1(power).uses.value;
                            },
                            get usesMax() {
                              return get$1(power).uses.max;
                            },
                            get uuid() {
                              return get$1(bondUUID);
                            },
                            get power() {
                              return get$1(power).index;
                            }
                          });
                        }, "consequent");
                        if_block(node_3, ($$render) => {
                          get$1(power).uses && $$render(consequent);
                        });
                      }
                      var node_4 = sibling(node_3, 2);
                      {
                        var consequent_1 = /* @__PURE__ */ __name(($$anchor8) => {
                          var span = root_9$4(), text2 = child(span);
                          template_effect(() => set_text(text2, get$1(power).frequency)), append($$anchor8, span);
                        }, "consequent_1");
                        if_block(node_4, ($$render) => {
                          get$1(power).frequency && $$render(consequent_1);
                        });
                      }
                      append($$anchor7, div_1);
                    }, "consequent_2");
                    if_block(node_2, ($$render) => {
                      (get$1(power).uses || get$1(power).frequency) && $$render(consequent_2);
                    });
                  }
                  append($$anchor6, fragment_4);
                }, "outerContent"), headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor6) => {
                  const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.power.subLabel"));
                  EffectButton($$anchor6, {
                    iconStyle: [
                      "la-text-header -fontsize6 mdi mdi-weather-sunny"
                    ],
                    iconBackgroundStyle: [
                      "-fontsize7 la-prmy-secondary",
                      qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
                    ],
                    get flowClass() {
                      return FlowClass.BondPower;
                    },
                    get uuid() {
                      return get$1(bondUUID);
                    },
                    get powerIndex() {
                      return get$1(power).index;
                    },
                    tooltipEnabled,
                    get tooltipTheme() {
                      return get$1(theme);
                    },
                    get tooltipDirection() {
                      return TooltipDirection.LEFT;
                    },
                    get tooltip() {
                      return get$1(power).description;
                    },
                    get tooltipHeader() {
                      return get$1(expression_1);
                    },
                    logging: !0,
                    onPointerEnter: /* @__PURE__ */ __name(() => {
                      set(effectButtonHover, !0);
                    }, "onPointerEnter"),
                    onPointerLeave: /* @__PURE__ */ __name(() => {
                      set(effectButtonHover, !1);
                    }, "onPointerLeave")
                  });
                }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor6) => {
                  var fragment_7 = root_11$3(), span_1 = first_child(fragment_7), node_5 = child(span_1);
                  {
                    var consequent_3 = /* @__PURE__ */ __name(($$anchor7) => {
                      var span_2 = root_12$3(), text_1 = child(span_2);
                      template_effect(($0) => set_text(text_1, $0), [
                        () => getLocalized("LA.pilot.bond.power.veteran.label")
                      ]), append($$anchor7, span_2);
                    }, "consequent_3");
                    if_block(node_5, ($$render) => {
                      get$1(power).veteran && $$render(consequent_3);
                    });
                  }
                  var node_6 = sibling(node_5, 2);
                  {
                    var consequent_4 = /* @__PURE__ */ __name(($$anchor7) => {
                      var span_3 = root_13$2(), text_2 = child(span_3);
                      template_effect(($0) => set_text(text_2, $0), [
                        () => getLocalized("LA.pilot.bond.power.master.label")
                      ]), append($$anchor7, span_3);
                    }, "consequent_4");
                    if_block(node_6, ($$render) => {
                      get$1(power).master && $$render(consequent_4);
                    });
                  }
                  var node_7 = sibling(span_1, 2);
                  const expression_2 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip")), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
                  GlyphButton(node_7, {
                    get style() {
                      return get$1(expression_2);
                    },
                    get flowClass() {
                      return FlowClass.None;
                    },
                    get index() {
                      return get$1(power).index;
                    },
                    get uuid() {
                      return get$1(power).uuid;
                    },
                    tooltipEnabled,
                    get tooltipDirection() {
                      return TooltipDirection.UP;
                    },
                    get tooltipTheme() {
                      return get$1(theme);
                    },
                    get tooltip() {
                      return get$1(expression_3);
                    },
                    get logText() {
                      return get$1(expression_4);
                    },
                    logging: !0,
                    onClick: /* @__PURE__ */ __name((event2) => sendToChat(event2, get$1(power)), "onClick"),
                    onPointerEnter: /* @__PURE__ */ __name(() => {
                      set(messageButtonHover, !0);
                    }, "onPointerEnter"),
                    onPointerLeave: /* @__PURE__ */ __name(() => {
                      set(messageButtonHover, !1);
                    }, "onPointerLeave"),
                    children: /* @__PURE__ */ __name(($$anchor7, $$slotProps2) => {
                      var i = root_14$3();
                      append($$anchor7, i);
                    }, "children"),
                    $$slots: { default: !0 }
                  }), append($$anchor6, fragment_7);
                }, "headerSecondaryRightOptions"), expression_5 = /* @__PURE__ */ derived(() => getPowerCollapseID(get$1(power).index));
                HeaderSecondary($$anchor5, {
                  get text() {
                    return get$1(power).name;
                  },
                  headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
                  textStyle: [
                    H2_TEXT_SIZE,
                    "-overflowhidden -fontface-stylized"
                  ],
                  borderStyle: ["-bordersoff"],
                  extensionTextFunction: /* @__PURE__ */ __name(() => {
                    if (get$1(effectButtonHover)) return `--${getLocalized("LA.use.label")}`;
                    if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
                  }, "extensionTextFunction"),
                  get itemID() {
                    return get$1(power).lid;
                  },
                  get uuid() {
                    return get$1(power).uuid;
                  },
                  get collapseID() {
                    return get$1(expression_5);
                  },
                  startCollapsed: !0,
                  renderOutsideCollapse: outerContent,
                  contentLeft: headerSecondaryLeftOptions2,
                  contentRight: headerSecondaryRightOptions,
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                    var div_3 = root_15$3(), node_8 = child(div_3);
                    const expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.description.label"));
                    EffectBox(node_8, {
                      get name() {
                        return get$1(expression_6);
                      },
                      get effect() {
                        return get$1(power).description;
                      },
                      tooltipEnabled,
                      logging: !0
                    }), append($$anchor6, div_3);
                  }, "children"),
                  $$slots: { default: !0 }
                });
              }), append($$anchor4, div);
            }, "consequent_5"), alternate = /* @__PURE__ */ __name(($$anchor4) => {
              const expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.power.empty.label")), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.power.empty.subLabel"));
              EmptyBox($$anchor4, {
                get label() {
                  return get$1(expression_7);
                },
                get subLabel() {
                  return get$1(expression_8);
                }
              });
            }, "alternate");
            if_block(node_1, ($$render) => {
              get$1(unlockedPowers).length ? $$render(consequent_5) : $$render(alternate, !1);
            });
          }
          append($$anchor3, fragment_3);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "consequent_6");
    if_block(node, ($$render) => {
      $$props.system.bond && $$render(consequent_6);
    });
  }
  append($$anchor, fragment), pop();
}
__name(Power, "Power");
var root_5$7 = /* @__PURE__ */ template('<div class="-padding2-l"><!></div>'), root_6$7 = /* @__PURE__ */ template('<i class="mdi mdi-progress-clock -fontsize5 -padding0-lr"></i>'), root_8$4 = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_4$3 = /* @__PURE__ */ template('<div class="la-flexcol -widthfull -fontface-stylized"><!></div>'), root_3$6 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"></div>');
function Clock($$anchor, $$props) {
  push($$props, !0);
  const headerContent = /* @__PURE__ */ __name(($$anchor2) => {
    const expression = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.clock.add.tooltip"));
    GlyphButton($$anchor2, {
      style: [
        "mdi mdi-plus-circle-outline -fontsize5 -height4 -lineheight4 la-prmy-header la-scdy-primary",
        qualityMode ? "-glow-prmy -glow-scdy-hover" : ""
      ],
      get flowClass() {
        return FlowClass.GeneralControl;
      },
      path: "system.bond_state.clocks",
      action: "append",
      actionValue: "(struct)counter",
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      tooltip: addClockTip,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get logText() {
        return get$1(expression);
      },
      logging: !0,
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(addButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(addButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerContent");
  let editButtonHover = state(!1), addButtonHover = state(!1);
  const tooltipEnabled = getPilotSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), addClockTip = TooltipFactory.buildTooltip(getLocalized("LA.pilot.bond.clock.add.tooltip")), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.clocks`), clocks = /* @__PURE__ */ derived(() => $$props.system.bond_state.clocks), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function getClockPath(index2) {
    return `system.bond_state.clocks.${index2}`;
  }
  __name(getClockPath, "getClockPath");
  const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.clock.label"));
  HeaderMain($$anchor, {
    get text() {
      return get$1(expression_1);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-weapon"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-weapon"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(addButtonHover)) return `--${getLocalized("LA.add.extension")}`;
    }, "extensionTextFunction"),
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !0,
    headerContent,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var fragment_2 = comment(), node = first_child(fragment_2);
      {
        var consequent = /* @__PURE__ */ __name(($$anchor3) => {
          var div = root_3$6();
          each(div, 21, () => get$1(clocks), index, ($$anchor4, clock, index2) => {
            var div_1 = root_4$3();
            {
              const outerContent = /* @__PURE__ */ __name(($$anchor5) => {
                var div_2 = root_5$7(), node_1 = child(div_2);
                CounterBox(node_1, {
                  get type() {
                    return CounterBoxType.Counter;
                  },
                  get usesValue() {
                    return get$1(clock).value;
                  },
                  get usesMax() {
                    return get$1(clock).max;
                  },
                  path: `system.bond_state.clocks.${index2 ?? ""}`,
                  style: [
                    "clipped-bot-alt -widthfull la-bckg-header-anti"
                  ],
                  logging: !0
                }), append($$anchor5, div_2);
              }, "outerContent"), headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor5) => {
                var i = root_6$7();
                append($$anchor5, i);
              }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor5) => {
                const expression_2 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_3 = /* @__PURE__ */ derived(() => getClockPath(index2)), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
                GlyphButton($$anchor5, {
                  get style() {
                    return get$1(expression_2);
                  },
                  get flowClass() {
                    return FlowClass.ContextMenu;
                  },
                  get path() {
                    return get$1(expression_3);
                  },
                  tooltipEnabled,
                  get tooltipDirection() {
                    return TooltipDirection.UP;
                  },
                  get tooltipTheme() {
                    return get$1(theme);
                  },
                  get tooltip() {
                    return get$1(expression_4);
                  },
                  get logText() {
                    return get$1(expression_5);
                  },
                  logging: !0,
                  onPointerEnter: /* @__PURE__ */ __name(() => {
                    set(editButtonHover, !0);
                  }, "onPointerEnter"),
                  onPointerLeave: /* @__PURE__ */ __name(() => {
                    set(editButtonHover, !1);
                  }, "onPointerLeave"),
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                    var i_1 = root_8$4();
                    append($$anchor6, i_1);
                  }, "children"),
                  $$slots: { default: !0 }
                });
              }, "headerSecondaryRightOptions");
              var node_2 = child(div_1);
              HeaderSecondary(node_2, {
                get text() {
                  return get$1(clock).name;
                },
                headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
                textStyle: [H2_TEXT_SIZE, "-fontface-stylized"],
                borderStyle: ["-bordersoff"],
                extensionTextFunction: /* @__PURE__ */ __name(() => {
                  if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
                }, "extensionTextFunction"),
                get itemID() {
                  return get$1(clock).lid;
                },
                get uuid() {
                  return get$1(clock).uuid;
                },
                renderOutsideCollapse: outerContent,
                contentLeft: headerSecondaryLeftOptions2,
                contentRight: headerSecondaryRightOptions
              });
            }
            append($$anchor4, div_1);
          }), append($$anchor3, div);
        }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor3) => {
          const expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.clock.empty.label")), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.clock.empty.subLabel"));
          EmptyBox($$anchor3, {
            get label() {
              return get$1(expression_6);
            },
            get subLabel() {
              return get$1(expression_7);
            }
          });
        }, "alternate");
        if_block(node, ($$render) => {
          get$1(clocks).length ? $$render(consequent) : $$render(alternate, !1);
        });
      }
      append($$anchor2, fragment_2);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(Clock, "Clock");
function getBondQNAMode(uuid) {
  return PilotStore.get(uuid).bondQNAMode;
}
__name(getBondQNAMode, "getBondQNAMode");
function setBondQNAMode(uuid, enabled) {
  PilotStore.set(uuid, { bondQNAMode: enabled });
}
__name(setBondQNAMode, "setBondQNAMode");
var root_3$5 = /* @__PURE__ */ template('<div class="la-flexrow"><input type="checkbox"> <span class="-fontsizemedium -lineheight5 -padding0-lr"> </span></div>'), root_4$2 = /* @__PURE__ */ template('<option style="color: black"> </option>'), root_2$4 = /* @__PURE__ */ template('<div class="la-bond-card__content la-flexcol -positionabsolute -margin0-tb -heightfull -justifyevenly la-reveal"><div></div> <div><div class="la-flexrow -widthfull"><input type="checkbox" name="system.bond_state.xp_checklist.minor_ideal"> <select class="la-bond__select -fontsizemedium -lineheight5 la-bckg-transparent la-text-text -widthfull" name="system.bond_state.minor_ideal" data-type="String"></select></div> <div class="la-flexrow"><input type="checkbox" name="system.bond_state.xp_checklist.veteran_power"> <span class="-fontsizemedium -lineheight5 -padding0-lr"> </span></div></div></div>'), root_7$3 = /* @__PURE__ */ template("<option> </option>"), root_6$6 = /* @__PURE__ */ template('<div><span class="-fontsizemedium -lineheight5"> </span> <select class="la-bond__select -fontsizemedium -lineheight5 la-bckg-transparent la-text-text" data-type="String"></select></div>'), root_5$6 = /* @__PURE__ */ template('<div class="la-bond-card__content la-flexcol -positionabsolute -margin0-tb -heightfull -justifyevenly la-reveal"></div>'), root_1$6 = /* @__PURE__ */ template('<div><span class="-fontsize6 -letterspacing1 -upper"> </span> <div class="-widthhalf -padding0-tb -fontface-stylized"><!></div> <div><div class="la-bond-card__img-anchor -margin7-tb"><img class="la-bond-card__img"></div> <!></div> <div class="la-flexrow"><!> <div><!> <!></div> <div class="la-flexrow -positionabsolute -left0 -padding3-l -gap1"><i></i> <!> <!></div></div></div>');
function Passion($$anchor, $$props) {
  push($$props, !0);
  let bondImageSrc = state(proxy(getBondImageSrc($$props.actor.uuid)));
  const logographic = logographicLanguage(), tooltipEnabled = getPilotSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState($$props.actor.uuid)), questionAnswer = /* @__PURE__ */ derived(() => getBondQNAMode($$props.actor.uuid)), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), darkTheme = /* @__PURE__ */ derived(() => getBrightness(getThemeKey($$props.actor.uuid)) === "dark");
  function getGlowColor() {
    return get$1(darkTheme) ? "la-prmy-text" : "la-prmy-primary";
  }
  __name(getGlowColor, "getGlowColor");
  function browseImage() {
    new FilePicker({
      current: get$1(bondImageSrc),
      type: "image",
      callback: /* @__PURE__ */ __name((path) => {
        setBondImageSrc($$props.actor.uuid, path), set(bondImageSrc, proxy(path));
      }, "callback")
    }).render(!0);
  }
  __name(browseImage, "browseImage");
  function tallyAndUpdate(event2) {
    event2.stopPropagation();
    let expTotal = 0;
    const updatedMajorIdeals = $$props.system.bond_state.xp_checklist.major_ideals.map((major) => (major === !0 && expTotal++, !1));
    $$props.system.bond_state.xp_checklist.minor_ideal === !0 && expTotal++, $$props.system.bond_state.xp_checklist.veteran_power === !0 && expTotal++, expTotal > 0 && $$props.actor.update({
      "system.bond_state.xp.value": $$props.system.bond_state.xp.value + expTotal,
      "system.bond_state.xp_checklist": {
        major_ideals: updatedMajorIdeals,
        minor_ideal: !1,
        veteran_power: !1
      }
    });
  }
  __name(tallyAndUpdate, "tallyAndUpdate");
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var div = root_1$6();
      set_class(div, `la-flexcol -widthfull -margin1-b -padding1-tb la-reveal-hover
        ${(qualityMode ? "la-bg-scroll-alt" : "la-bg-alt") ?? ""}`);
      var span = child(div), text2 = child(span), div_1 = sibling(span, 2), node_1 = child(div_1);
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.hitpoint.tooltip"));
      StatusBar(node_1, {
        dataName: "system.bond_state.xp.value",
        nameStyle: [logographic ? "-fontsizemedium" : ""],
        get currentValue() {
          return $$props.system.bond_state.xp.value;
        },
        get maxValue() {
          return $$props.system.bond_state.xp.max;
        },
        barStyle: ["la-bckg-bar-health"],
        barStyleSecondary: ["la-bckg-bar-shield -shield"],
        barStyleTertiary: ["la-bckg-bar-burn -burn"],
        textStyle: ["la-text-text"],
        clipPath: "clipped",
        tooltipEnabled,
        get tooltip() {
          return get$1(expression);
        },
        get tooltipDirection() {
          return TooltipDirection.RIGHT;
        }
      });
      var div_2 = sibling(div_1, 2);
      set_class(div_2, `la-flexrow -positionrelative -widthfull -aligncenter
            ${(qualityMode ? "la-bond-card-spin" : "la-bond-card") ?? ""}`);
      var div_3 = child(div_2), img = child(div_3), node_2 = sibling(div_3, 2);
      {
        var consequent = /* @__PURE__ */ __name(($$anchor3) => {
          var div_4 = root_2$4(), div_5 = child(div_4);
          each(div_5, 21, () => $$props.system.bond.system.major_ideals, index, ($$anchor4, major, index2) => {
            var div_6 = root_3$5(), input = child(div_6);
            set_attribute(input, "name", `system.bond_state.xp_checklist.major_ideals.${index2 ?? ""}`);
            var span_1 = sibling(input, 2), text_1 = child(span_1);
            template_effect(() => {
              set_checked(input, $$props.system.bond_state.xp_checklist.major_ideals[index2]), set_text(text_1, get$1(major));
            }), append($$anchor4, div_6);
          });
          var div_7 = sibling(div_5, 2), div_8 = child(div_7), input_1 = child(div_8), select = sibling(input_1, 2);
          each(select, 21, () => $$props.system.bond.system.minor_ideals, index, ($$anchor4, minor) => {
            var option = root_4$2(), option_value = {}, text_2 = child(option);
            template_effect(() => {
              option_value !== (option_value = get$1(minor)) && (option.value = (option.__value = get$1(minor)) == null ? "" : get$1(minor)), set_selected(option, get$1(minor) === $$props.system.bond_state.minor_ideal), set_text(text_2, get$1(minor));
            }), append($$anchor4, option);
          });
          var div_9 = sibling(div_8, 2), input_2 = child(div_9), span_2 = sibling(input_2, 2), text_3 = child(span_2);
          template_effect(
            ($0) => {
              set_class(div_5, `la-bond-major la-flexcol -alignstart clipped -widthfull -padding0 -padding1-r
                    ${(get$1(darkTheme) ? "la-bckg-darken-1" : "la-bckg-lighten-5") ?? ""}`), set_class(div_7, `la-bond-minor la-flexcol -alignstart clipped -widthfull -padding0 -padding1-r
                    ${(get$1(darkTheme) ? "la-bckg-darken-1" : "la-bckg-lighten-5") ?? ""}`), set_checked(input_1, $$props.system.bond_state.xp_checklist.minor_ideal), set_checked(input_2, $$props.system.bond_state.xp_checklist.veteran_power), set_text(text_3, $0);
            },
            [
              () => getLocalized("LA.pilot.bond.other.label")
            ]
          ), append($$anchor3, div_4);
        }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor3) => {
          var div_10 = root_5$6();
          each(div_10, 21, () => $$props.system.bond.system.questions, index, ($$anchor4, qna, index$1) => {
            var div_11 = root_6$6(), span_3 = child(div_11), text_4 = child(span_3), select_1 = sibling(span_3, 2);
            set_attribute(select_1, "name", `system.bond_state.answers.${index$1 ?? ""}`), each(select_1, 21, () => get$1(qna).options, index, ($$anchor5, answer) => {
              var option_1 = root_7$3(), option_1_value = {}, text_5 = child(option_1);
              template_effect(() => {
                option_1_value !== (option_1_value = get$1(answer)) && (option_1.value = (option_1.__value = get$1(answer)) == null ? "" : get$1(answer)), set_selected(option_1, get$1(answer) === $$props.system.bond_state.answers[index$1]), set_text(text_5, get$1(answer));
              }), append($$anchor5, option_1);
            }), template_effect(() => {
              set_class(div_11, `la-bond-question la-flexcol -alignstart clipped -widthfull -padding2-lr -padding0-t -padding1-b
                        ${(get$1(darkTheme) ? "la-bckg-darken-1" : "la-bckg-lighten-5") ?? ""}`), set_text(text_4, get$1(qna).question);
            }), append($$anchor4, div_11);
          }), append($$anchor3, div_10);
        }, "alternate");
        if_block(node_2, ($$render) => {
          get$1(questionAnswer) ? $$render(alternate, !1) : $$render(consequent);
        });
      }
      var div_12 = sibling(div_2, 2), node_3 = child(div_12);
      const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.tally.label")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.tally.tooltip")), expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.tally.tooltip"));
      FlowButton(node_3, {
        get text() {
          return get$1(expression_1);
        },
        style: [
          "clipped la-bckg-secondary -padding0-tb -flex1"
        ],
        get flowClass() {
          return FlowClass.None;
        },
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipDirection() {
          return TooltipDirection.DOWN;
        },
        get tooltip() {
          return get$1(expression_2);
        },
        get logText() {
          return get$1(expression_3);
        },
        logging: !0,
        onClick: tallyAndUpdate
      });
      var div_13 = sibling(node_3, 2), node_4 = child(div_13);
      const expression_4 = /* @__PURE__ */ derived(() => [
        "mdi mdi-image-edit la-text-secondary -fontsize7 la-flexrow -justifycenter -aligncenter",
        qualityMode ? "-glow-prmy la-prmy-primary -glow-prmy-hover " + getGlowColor() : ""
      ]), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.changeImage.tooltip")), expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.changeImage.tooltip"));
      GlyphButton(node_4, {
        get style() {
          return get$1(expression_4);
        },
        get flowClass() {
          return FlowClass.None;
        },
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_5);
        },
        get logText() {
          return get$1(expression_6);
        },
        logging: !0,
        onClick: browseImage
      });
      var node_5 = sibling(node_4, 2);
      const expression_7 = /* @__PURE__ */ derived(() => [
        "mdi mdi-pencil la-text-secondary -fontsize6 -lineheight8 -justifycenter -aligncenter",
        qualityMode ? " -glow-prmy la-prmy-primary -glow-prmy-hover " + getGlowColor() : ""
      ]), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
      GlyphButton(node_5, {
        get style() {
          return get$1(expression_7);
        },
        get flowClass() {
          return FlowClass.ContextMenu;
        },
        get uuid() {
          return $$props.system.bond.uuid;
        },
        path: "itemTypes.bond",
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_8);
        },
        get logText() {
          return get$1(expression_9);
        },
        logging: !0
      });
      var div_14 = sibling(div_13, 2), i = child(div_14), node_6 = sibling(i, 2);
      const expression_10 = /* @__PURE__ */ derived(() => [
        "la-text-secondary -fontsize7 la-flexrow -justifycenter -aligncenter",
        get$1(questionAnswer) ? "mdi mdi-list-box" : "mdi mdi-help-circle",
        qualityMode ? "-glow-prmy la-prmy-primary -glow-prmy-hover " + getGlowColor() : ""
      ]), expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.swap.tooltip")), expression_12 = /* @__PURE__ */ derived(() => getLocalized(get$1(questionAnswer) ? "LA.pilot.bond.xp.tooltip" : "LA.pilot.bond.qa.tooltip"));
      GlyphButton(node_6, {
        get style() {
          return get$1(expression_10);
        },
        get flowClass() {
          return FlowClass.None;
        },
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_11);
        },
        get logText() {
          return get$1(expression_12);
        },
        logging: !0,
        onClick: /* @__PURE__ */ __name(() => {
          setBondQNAMode($$props.actor.uuid, !get$1(questionAnswer));
        }, "onClick")
      });
      var node_7 = sibling(node_6, 2);
      const expression_13 = /* @__PURE__ */ derived(() => [
        "mdi mdi-refresh-circle la-text-secondary -fontsize7 -justifycenter",
        qualityMode ? "-glow-prmy la-prmy-primary -glow-prmy-hover " + getGlowColor() : ""
      ]), expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.power.refresh.tooltip")), expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.bond.power.refresh.tooltip"));
      GlyphButton(node_7, {
        get style() {
          return get$1(expression_13);
        },
        get flowClass() {
          return FlowClass.BondPowerRefresh;
        },
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_14);
        },
        get logText() {
          return get$1(expression_15);
        },
        logging: !0,
        onClick: /* @__PURE__ */ __name(() => {
          setBondQNAMode($$props.actor.uuid, !get$1(questionAnswer));
        }, "onClick")
      }), template_effect(
        ($0, $1) => {
          set_text(text2, $$props.system.bond.name), set_attribute(img, "src", get$1(bondImageSrc)), set_attribute(img, "alt", $0), set_class(div_13, `la-flexrow -positionabsolute -right0 -padding3-r -gap2 ${(get$1(advancedOptions) ? "" : "-visibilityhidden") ?? ""}`), set_class(i, `mdi mdi-swap-vertical -fontsize la-text-text -positionabsolute -left0
                ${$1 ?? ""}`);
        },
        [
          () => getLocalized("LA.placeholder"),
          () => qualityMode ? "-glow-prmy la-prmy-primary -glow-prmy-hover" + getGlowColor() : ""
        ]
      ), append($$anchor2, div);
    }, "consequent_1");
    if_block(node, ($$render) => {
      $$props.system.bond && $$render(consequent_1);
    });
  }
  append($$anchor, fragment), pop();
}
__name(Passion, "Passion");
var root$f = /* @__PURE__ */ template("<!> <!> <!> <!>", 1);
function Bond($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), system = /* @__PURE__ */ derived(() => props.system);
  setActorContext(get$1(actor));
  var fragment = root$f(), node = first_child(fragment);
  Passion(node, {
    get actor() {
      return get$1(actor);
    },
    get system() {
      return get$1(system);
    }
  });
  var node_1 = sibling(node, 2);
  Power(node_1, {
    get actor() {
      return get$1(actor);
    },
    get system() {
      return get$1(system);
    }
  });
  var node_2 = sibling(node_1, 2);
  Burden(node_2, {
    get actor() {
      return get$1(actor);
    },
    get system() {
      return get$1(system);
    }
  });
  var node_3 = sibling(node_2, 2);
  Clock(node_3, {
    get actor() {
      return get$1(actor);
    },
    get system() {
      return get$1(system);
    }
  }), append($$anchor, fragment), pop();
}
__name(Bond, "Bond");
const headerSecondaryInnerLeftOptions$1 = /* @__PURE__ */ __name(($$anchor) => {
  var i = root_2$3();
  append($$anchor, i);
}, "headerSecondaryInnerLeftOptions$1");
var root_1$5 = /* @__PURE__ */ template("<!> <!>", 1), root_2$3 = /* @__PURE__ */ template('<i class="mdi mdi-code-json -padding0-lr"></i>'), root_5$5 = /* @__PURE__ */ template("<i></i>"), on_change$4 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { name: event2.target.value }), "on_change$4"), root_9$3 = /* @__PURE__ */ template('<input type="text" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr">'), on_change_1$2 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { contentType: event2.target.value }), "on_change_1$2"), root_10$2 = /* @__PURE__ */ template('<select class="la-customvalue__select la-text-text -bordersround -small la-brdr-repcap -padding0-lr -widthfull"><option> </option><option> </option></select>'), on_change_2$1 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2, flag) => handleUpdateCustomFlag($$props.actor, id2(), {
  content: {
    ...flag().content,
    value: Number(event2.target.value)
  }
}), "on_change_2$1"), on_change_3$1 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2, flag) => handleUpdateCustomFlag($$props.actor, id2(), {
  content: {
    ...flag().content,
    max: Number(event2.target.value)
  }
}), "on_change_3$1"), on_change_4$1 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2, flag) => handleUpdateCustomFlag($$props.actor, id2(), {
  content: {
    ...flag().content,
    min: Number(event2.target.value)
  }
}), "on_change_4$1"), root_12$2 = /* @__PURE__ */ template('<div class="la-flexcol -gap0"><span class="-fontsizesmall -upper"> </span> <input type="number" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr"></div> <div class="la-flexcol -gap0"><span class="-fontsizesmall -upper"> </span> <input type="number" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr"></div>', 1), root_11$2 = /* @__PURE__ */ template('<div class="la-flexrow -gap1"><div class="la-flexcol -gap0"><span class="-fontsizesmall -upper"> </span> <input type="number" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr"></div> <!></div>'), on_change_5$1 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { showInSidebar: event2.target.checked }), "on_change_5$1"), root_13$1 = /* @__PURE__ */ template('<input type="checkbox" class="-widthfull">'), on_change_6$1 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { color: event2.target.value }), "on_change_6$1"), root_14$2 = /* @__PURE__ */ template('<input type="color" class="la-customvalue__input -widthfull">'), on_change_7$1 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { icon: event2.target.value }), "on_change_7$1"), root_15$2 = /* @__PURE__ */ template('<input type="text" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr">'), on_change_8$1 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { tooltip: event2.target.value }), "on_change_8$1"), root_16$2 = /* @__PURE__ */ template('<input type="text" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr">'), root_19$1 = /* @__PURE__ */ template('<span class=" -upper"> </span> <input type="text" readonly=""> <span class=" -upper"> </span> <input type="text" readonly="">', 1), root_18$1 = /* @__PURE__ */ template('<div class="la-combine-grid -horizontal2-auto -aligncenter -gap1 -widthfull"><span class=" -upper"> </span> <input type="text" readonly=""> <!></div>'), root_21$1 = /* @__PURE__ */ template('<span class=" -upper"> </span> <input type="text" readonly=""> <span class=" -upper"> </span> <input type="text" readonly="">', 1), root_20$2 = /* @__PURE__ */ template('<div class="la-combine-grid -horizontal2-auto -aligncenter -gap1 -widthfull"><span class=" -upper"> </span> <input type="text" readonly=""> <!></div>'), root_17$1 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!></div>'), root_8$3 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!> <!> <!> <!> <!></div>'), root_3$4 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"></div>'), root$e = /* @__PURE__ */ template('<div class="la-custom__list la-flexcol -widthfull"><!></div>');
function Custom$1($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment = root_1$5(), node = first_child(fragment);
    const expression = /* @__PURE__ */ derived(() => [
      "la-text-header la-prmy-header la-scdy-primary -fontsize5 -alignselfcenter",
      qualityMode ? " -glow-prmy -glow-scdy-hover " : "",
      get$1(sortable) ? " mdi mdi-sort-variant-lock-open " : " mdi mdi-sort-variant-lock "
    ]), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.sort.tooltip")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.sort.tooltip"));
    GlyphButton(node, {
      type: "button",
      get flowClass() {
        return FlowClass.None;
      },
      get style() {
        return get$1(expression);
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_1);
      },
      get logText() {
        return get$1(expression_2);
      },
      logging: !0,
      onClick: /* @__PURE__ */ __name(() => setCustomFlagsSortable($$props.actor.uuid, !get$1(sortable)), "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(sortButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(sortButtonHover, !1);
      }, "onPointerLeave")
    });
    var node_1 = sibling(node, 2);
    const expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.add.tooltip")), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.add.tooltip"));
    GlyphButton(node_1, {
      type: "button",
      get flowClass() {
        return FlowClass.None;
      },
      style: [
        "mdi mdi-plus-thick la-text-header la-prmy-header la-scdy-primary -fontsize5 -alignselfcenter",
        qualityMode ? " -glow-prmy -glow-scdy-hover " : ""
      ],
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_3);
      },
      get logText() {
        return get$1(expression_4);
      },
      logging: !0,
      onClick: /* @__PURE__ */ __name((event2) => handleAddCustomFlag(event2, $$props.actor), "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(addButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(addButtonHover, !1);
      }, "onPointerLeave")
    }), append($$anchor2, fragment);
  }, "headerOptions");
  setActorContext($$props.actor);
  let component = state(null), deleteButtonHover = state(!1), addButtonHover = state(!1), sortButtonHover = state(!1);
  const theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), customFlags = /* @__PURE__ */ derived(() => getCustomFlags($$props.actor, CustomFlagKey.Pilot)), flagEntries = /* @__PURE__ */ derived(() => Object.entries(get$1(customFlags))), sortable = /* @__PURE__ */ derived(() => getCustomFlagsSortable($$props.actor.uuid)), tooltipEnabled = getPilotSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), refCopyTip = TooltipFactory.buildTooltip(getLocalized("LA.tab.custom.flag.ref.tooltip")), enrichCopyTip = TooltipFactory.buildTooltip(getLocalized("LA.tab.custom.flag.enricher.tooltip"));
  function handleAddCustomFlag(_event, actor) {
    addCustomFlag(actor, CustomFlagKey.Pilot);
  }
  __name(handleAddCustomFlag, "handleAddCustomFlag");
  function handleDeleteCustomFlag(event2, actor, id2) {
    event2.stopPropagation(), deleteCustomFlag(actor, CustomFlagKey.Pilot, id2);
  }
  __name(handleDeleteCustomFlag, "handleDeleteCustomFlag");
  function handleUpdateCustomFlag(actor, id2, changes) {
    updateCustomFlag(actor, CustomFlagKey.Pilot, id2, changes);
  }
  __name(handleUpdateCustomFlag, "handleUpdateCustomFlag");
  function handleReorderCustomFlag(_event, dropData, thisData) {
    dropData.type === LADataType.Sorting && reorderCustomFlags($$props.actor, CustomFlagKey.Pilot, dropData.index, thisData.index);
  }
  __name(handleReorderCustomFlag, "handleReorderCustomFlag");
  function getTypeIcon(type) {
    return type == CustomFlagContentType.Fraction ? "mdi-fraction-one-half" : "mdi-numeric";
  }
  __name(getTypeIcon, "getTypeIcon");
  var div = root$e(), node_2 = child(div);
  const expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.subLabel"));
  HeaderMain(node_2, {
    get text() {
      return get$1(expression_5);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-transparent clipped-bot-alt"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(addButtonHover)) return `--${getLocalized("LA.tab.custom.add.extension")}`;
      if (get$1(sortButtonHover)) return `--${getLocalized("LA.tab.custom.sort.extension")}`;
    }, "extensionTextFunction"),
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div_1 = root_3$4();
      each(div_1, 23, () => get$1(flagEntries), ([id2, flag]) => id2, ($$anchor3, $$item, index2) => {
        let id2 = /* @__PURE__ */ __name(() => get$1($$item)[0], "id"), flag = /* @__PURE__ */ __name(() => get$1($$item)[1], "flag");
        const headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor4) => {
          var i_1 = root_5$5();
          template_effect(
            ($0) => set_class(i_1, `mdi -padding0-lr
                ${$0 ?? ""}`),
            [() => getTypeIcon(flag().contentType)]
          ), append($$anchor4, i_1);
        }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor4) => {
          const expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.delete.tooltip")), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.delete.tooltip"));
          GlyphButton($$anchor4, {
            type: "button",
            get flowClass() {
              return FlowClass.None;
            },
            style: [
              "mdi mdi-close-thick la-prmy-header la-scdy-primary -fontsize5 -alignselfcenter",
              qualityMode ? " -glow-prmy -glow-scdy-hover " : ""
            ],
            tooltipEnabled,
            get tooltipDirection() {
              return TooltipDirection.UP;
            },
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltip() {
              return get$1(expression_6);
            },
            get logText() {
              return get$1(expression_7);
            },
            logging: !0,
            onClick: /* @__PURE__ */ __name((event2) => handleDeleteCustomFlag(event2, $$props.actor, id2()), "onClick"),
            onPointerEnter: /* @__PURE__ */ __name(() => {
              set(deleteButtonHover, !0);
            }, "onPointerEnter"),
            onPointerLeave: /* @__PURE__ */ __name(() => {
              set(deleteButtonHover, !1);
            }, "onPointerLeave")
          });
        }, "headerSecondaryRightOptions"), expression_8 = /* @__PURE__ */ derived(() => [get$1(sortable) ? "-padding5-l" : ""]), expression_9 = /* @__PURE__ */ derived(() => [get$1(sortable) ? "" : "-displaynone"]), expression_10 = /* @__PURE__ */ derived(() => ({
          type: LADataType.Sorting,
          index: get$1(index2)
        })), expression_11 = /* @__PURE__ */ derived(() => !get$1(sortable));
        DragDropHandle($$anchor3, {
          get style() {
            return get$1(expression_8);
          },
          get iconStyle() {
            return get$1(expression_9);
          },
          get index() {
            return get$1(index2);
          },
          get root() {
            return get$1(component);
          },
          get data() {
            return get$1(expression_10);
          },
          onDrop: handleReorderCustomFlag,
          deleteDisabled: !0,
          logging: !1,
          get disabled() {
            return get$1(expression_11);
          },
          children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
            const expression_12 = /* @__PURE__ */ derived(() => flag().name || getLocalized("LA.tab.custom.flag.name.label")), expression_13 = /* @__PURE__ */ derived(() => `custom.${id2()}`);
            HeaderSecondary($$anchor4, {
              get text() {
                return get$1(expression_12);
              },
              headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
              textStyle: [H2_TEXT_SIZE, "-fontface-stylized"],
              borderStyle: ["la-brdr-pilot"],
              extensionTextFunction: /* @__PURE__ */ __name(() => {
                if (get$1(deleteButtonHover)) return `--${getLocalized("LA.tab.custom.delete.extension")}`;
              }, "extensionTextFunction"),
              get collapseID() {
                return get$1(expression_13);
              },
              startCollapsed: !1,
              contentLeft: headerSecondaryLeftOptions2,
              contentRight: headerSecondaryRightOptions,
              children: /* @__PURE__ */ __name(($$anchor5, $$slotProps3) => {
                var div_2 = root_8$3(), node_3 = child(div_2);
                const expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.name.label"));
                EffectBox(node_3, {
                  get name() {
                    return get$1(expression_14);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input = root_9$3();
                    input.__change = [
                      on_change$4,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(
                      ($0) => {
                        set_value(input, flag().name), set_attribute(input, "placeholder", $0);
                      },
                      [() => getLocalized("LA.namePlaceholder")]
                    ), event("focus", input, (event2) => event2.currentTarget.select()), append($$anchor6, input);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_4 = sibling(node_3, 2);
                const expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.contentType.label"));
                EffectBox(node_4, {
                  get name() {
                    return get$1(expression_15);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var select = root_10$2();
                    select.__change = [
                      on_change_1$2,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ];
                    var option = child(select), option_value = {}, text2 = child(option), option_1 = sibling(option), option_1_value = {}, text_1 = child(option_1);
                    template_effect(
                      ($0, $1) => {
                        option_value !== (option_value = CustomFlagContentType.Value) && (option.value = (option.__value = CustomFlagContentType.Value) == null ? "" : CustomFlagContentType.Value), set_selected(option, flag().contentType === CustomFlagContentType.Value), set_text(text2, $0), option_1_value !== (option_1_value = CustomFlagContentType.Fraction) && (option_1.value = (option_1.__value = CustomFlagContentType.Fraction) == null ? "" : CustomFlagContentType.Fraction), set_selected(option_1, flag().contentType === CustomFlagContentType.Fraction), set_text(text_1, $1);
                      },
                      [
                        () => getLocalized("LA.tab.custom.flag.contentType.value.label"),
                        () => getLocalized("LA.tab.custom.flag.contentType.fraction.label")
                      ]
                    ), append($$anchor6, select);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_5 = sibling(node_4, 2);
                const expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.content.label"));
                EffectBox(node_5, {
                  get name() {
                    return get$1(expression_16);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var div_3 = root_11$2(), div_4 = child(div_3), span = child(div_4), text_2 = child(span), input_1 = sibling(span, 2);
                    input_1.__change = [
                      on_change_2$1,
                      handleUpdateCustomFlag,
                      $$props,
                      id2,
                      flag
                    ];
                    var node_6 = sibling(div_4, 2);
                    {
                      var consequent = /* @__PURE__ */ __name(($$anchor7) => {
                        var fragment_4 = root_12$2(), div_5 = first_child(fragment_4), span_1 = child(div_5), text_3 = child(span_1), input_2 = sibling(span_1, 2);
                        input_2.__change = [
                          on_change_3$1,
                          handleUpdateCustomFlag,
                          $$props,
                          id2,
                          flag
                        ];
                        var div_6 = sibling(div_5, 2), span_2 = child(div_6), text_4 = child(span_2), input_3 = sibling(span_2, 2);
                        input_3.__change = [
                          on_change_4$1,
                          handleUpdateCustomFlag,
                          $$props,
                          id2,
                          flag
                        ], template_effect(
                          ($0, $1) => {
                            set_text(text_3, $0), set_value(input_2, flag().content.max), set_text(text_4, $1), set_value(input_3, flag().content.min);
                          },
                          [
                            () => getLocalized("LA.tab.custom.flag.content.max.label"),
                            () => getLocalized("LA.tab.custom.flag.content.min.label")
                          ]
                        ), event("focus", input_2, (event2) => event2.currentTarget.select()), event("focus", input_3, (event2) => event2.currentTarget.select()), append($$anchor7, fragment_4);
                      }, "consequent");
                      if_block(node_6, ($$render) => {
                        flag().contentType === CustomFlagContentType.Fraction && $$render(consequent);
                      });
                    }
                    template_effect(
                      ($0) => {
                        set_text(text_2, $0), set_value(input_1, flag().content.value);
                      },
                      [
                        () => getLocalized("LA.tab.custom.flag.content.value.label")
                      ]
                    ), event("focus", input_1, (event2) => event2.currentTarget.select()), append($$anchor6, div_3);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_7 = sibling(node_5, 2);
                const expression_17 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.sidebarToggle.label"));
                EffectBox(node_7, {
                  get name() {
                    return get$1(expression_17);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_4 = root_13$1();
                    input_4.__change = [
                      on_change_5$1,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_checked(input_4, flag().showInSidebar)), append($$anchor6, input_4);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_8 = sibling(node_7, 2);
                const expression_18 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.color.label"));
                EffectBox(node_8, {
                  get name() {
                    return get$1(expression_18);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_5 = root_14$2();
                    input_5.__change = [
                      on_change_6$1,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_value(input_5, flag().color)), append($$anchor6, input_5);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_9 = sibling(node_8, 2);
                const expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.icon.label"));
                EffectBox(node_9, {
                  get name() {
                    return get$1(expression_19);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_6 = root_15$2();
                    set_attribute(input_6, "placeholder", "mdi mdi-abacus"), input_6.__change = [
                      on_change_7$1,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_value(input_6, flag().icon)), event("focus", input_6, (event2) => event2.currentTarget.select()), append($$anchor6, input_6);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_10 = sibling(node_9, 2);
                const expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.tooltip.label"));
                EffectBox(node_10, {
                  get name() {
                    return get$1(expression_20);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_7 = root_16$2();
                    input_7.__change = [
                      on_change_8$1,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_value(input_7, flag().tooltip)), event("focus", input_7, (event2) => event2.currentTarget.select()), append($$anchor6, input_7);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_11 = sibling(node_10, 2);
                const expression_21 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.assist.label")), expression_22 = /* @__PURE__ */ derived(() => `custom.${id2()}.assist`);
                HeaderSecondary(node_11, {
                  get text() {
                    return get$1(expression_21);
                  },
                  headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
                  textStyle: [H2_TEXT_SIZE, "-fontface-stylized"],
                  borderStyle: ["la-brdr-pilot"],
                  get collapseID() {
                    return get$1(expression_22);
                  },
                  startCollapsed: !1,
                  contentLeft: headerSecondaryInnerLeftOptions$1,
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var div_7 = root_17$1(), node_12 = child(div_7);
                    const expression_23 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.ref.label"));
                    EffectBox(node_12, {
                      get name() {
                        return get$1(expression_23);
                      },
                      children: /* @__PURE__ */ __name(($$anchor7, $$slotProps5) => {
                        var div_8 = root_18$1(), span_3 = child(div_8), text_5 = child(span_3), input_8 = sibling(span_3, 2);
                        set_attribute(input_8, "data-tooltip", tooltipEnabled ? refCopyTip : void 0);
                        var node_13 = sibling(input_8, 2);
                        {
                          var consequent_1 = /* @__PURE__ */ __name(($$anchor8) => {
                            var fragment_5 = root_19$1(), span_4 = first_child(fragment_5), text_6 = child(span_4), input_9 = sibling(span_4, 2);
                            set_attribute(input_9, "data-tooltip", tooltipEnabled ? refCopyTip : void 0);
                            var span_5 = sibling(input_9, 2), text_7 = child(span_5), input_10 = sibling(span_5, 2);
                            set_attribute(input_10, "data-tooltip", tooltipEnabled ? refCopyTip : void 0), template_effect(
                              ($0, $1, $2, $3, $4) => {
                                set_text(text_6, $0), set_class(input_9, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_9, $2), set_attribute(input_9, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_9, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text_7, $3), set_class(input_10, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_10, $4), set_attribute(input_10, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_10, "data-tooltip-direction", TooltipDirection.DOWN);
                              },
                              [
                                () => getLocalized("LA.tab.custom.flag.content.max.label"),
                                () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                                () => getCustomFlagPath(CustomFlagKey.Pilot, id2(), "max"),
                                () => getLocalized("LA.tab.custom.flag.content.min.label"),
                                () => getCustomFlagPath(CustomFlagKey.Pilot, id2(), "min")
                              ]
                            ), event("pointerenter", input_9, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.ref.tooltip"), $$props.actor.uuid)), event("pointerleave", input_9, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_9, (event2) => event2.currentTarget.select()), event("pointerenter", input_10, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.ref.tooltip"), $$props.actor.uuid)), event("pointerleave", input_10, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_10, (event2) => event2.currentTarget.select()), append($$anchor8, fragment_5);
                          }, "consequent_1");
                          if_block(node_13, ($$render) => {
                            flag().contentType === CustomFlagContentType.Fraction && $$render(consequent_1);
                          });
                        }
                        template_effect(
                          ($0, $1, $2) => {
                            set_text(text_5, $0), set_class(input_8, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                        ${$1 ?? ""}`), set_value(input_8, $2), set_attribute(input_8, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_8, "data-tooltip-direction", TooltipDirection.DOWN);
                          },
                          [
                            () => getLocalized("LA.tab.custom.flag.content.value.label"),
                            () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                            () => getCustomFlagPath(CustomFlagKey.Pilot, id2(), "value")
                          ]
                        ), event("pointerenter", input_8, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.ref.tooltip"), $$props.actor.uuid)), event("pointerleave", input_8, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_8, (event2) => event2.currentTarget.select()), append($$anchor7, div_8);
                      }, "children"),
                      $$slots: { default: !0 }
                    });
                    var node_14 = sibling(node_12, 2);
                    const expression_24 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.enricher.label"));
                    EffectBox(node_14, {
                      get name() {
                        return get$1(expression_24);
                      },
                      children: /* @__PURE__ */ __name(($$anchor7, $$slotProps5) => {
                        var div_9 = root_20$2(), span_6 = child(div_9), text_8 = child(span_6), input_11 = sibling(span_6, 2);
                        set_attribute(input_11, "data-tooltip", tooltipEnabled ? enrichCopyTip : void 0);
                        var node_15 = sibling(input_11, 2);
                        {
                          var consequent_2 = /* @__PURE__ */ __name(($$anchor8) => {
                            var fragment_6 = root_21$1(), span_7 = first_child(fragment_6), text_9 = child(span_7), input_12 = sibling(span_7, 2);
                            set_attribute(input_12, "data-tooltip", tooltipEnabled ? enrichCopyTip : void 0);
                            var span_8 = sibling(input_12, 2), text_10 = child(span_8), input_13 = sibling(span_8, 2);
                            set_attribute(input_13, "data-tooltip", tooltipEnabled ? enrichCopyTip : void 0), template_effect(
                              ($0, $1, $2, $3, $4) => {
                                set_text(text_9, $0), set_class(input_12, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_12, $2), set_attribute(input_12, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_12, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text_10, $3), set_class(input_13, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_13, $4), set_attribute(input_13, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_13, "data-tooltip-direction", TooltipDirection.DOWN);
                              },
                              [
                                () => getLocalized("LA.tab.custom.flag.content.max.label"),
                                () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                                () => getEnricher($$props.actor.uuid, CustomFlagKey.Pilot, id2(), "max"),
                                () => getLocalized("LA.tab.custom.flag.content.min.label"),
                                () => getEnricher($$props.actor.uuid, CustomFlagKey.Pilot, id2(), "min")
                              ]
                            ), event("pointerenter", input_12, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.enricher.tooltip"), $$props.actor.uuid)), event("pointerleave", input_12, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_12, (event2) => event2.currentTarget.select()), event("pointerenter", input_13, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.enricher.tooltip"), $$props.actor.uuid)), event("pointerleave", input_13, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_13, (event2) => event2.currentTarget.select()), append($$anchor8, fragment_6);
                          }, "consequent_2");
                          if_block(node_15, ($$render) => {
                            flag().contentType === CustomFlagContentType.Fraction && $$render(consequent_2);
                          });
                        }
                        template_effect(
                          ($0, $1, $2) => {
                            set_text(text_8, $0), set_class(input_11, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                        ${$1 ?? ""}`), set_value(input_11, $2), set_attribute(input_11, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_11, "data-tooltip-direction", TooltipDirection.DOWN);
                          },
                          [
                            () => getLocalized("LA.tab.custom.flag.content.value.label"),
                            () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                            () => getEnricher($$props.actor.uuid, CustomFlagKey.Pilot, id2(), "value")
                          ]
                        ), event("pointerenter", input_11, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.enricher.tooltip"), $$props.actor.uuid)), event("pointerleave", input_11, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_11, (event2) => event2.currentTarget.select()), append($$anchor7, div_9);
                      }, "children"),
                      $$slots: { default: !0 }
                    }), append($$anchor6, div_7);
                  }, "children"),
                  $$slots: { default: !0 }
                }), append($$anchor5, div_2);
              }, "children"),
              $$slots: { default: !0 }
            });
          }, "children"),
          $$slots: { default: !0 }
        });
      }), bind_this(div_1, ($$value) => set(component, $$value), () => get$1(component)), append($$anchor2, div_1);
    }, "children"),
    $$slots: { default: !0 }
  }), append($$anchor, div), pop();
}
__name(Custom$1, "Custom$1");
delegate(["change"]);
function CustomToggle$1($$anchor, $$props) {
  push($$props, !0);
  const advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState($$props.actor.uuid));
  user_effect(() => {
    var _a;
    (_a = $$props.button) == null || _a.classList.toggle("-displaynone", !get$1(advancedOptions));
  }), pop();
}
__name(CustomToggle$1, "CustomToggle$1");
var root$d = /* @__PURE__ */ template('<div><span> </span> <div class="la-flexcol -alignstart -padding1-b -heightfull"><!> <!></div></div>');
function LevelSettings($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), document2 = /* @__PURE__ */ derived(() => props.document), system = /* @__PURE__ */ derived(() => props.system), tooltipEnabled = getPilotSheetTooltipEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  function levelUp(event2) {
    event2.stopPropagation(), get$1(document2).update({ "system.level": get$1(system).level + 1 });
  }
  __name(levelUp, "levelUp");
  function levelDown(event2) {
    event2.stopPropagation(), get$1(document2).update({
      "system.level": Math.max(get$1(system).level - 1, 0)
    });
  }
  __name(levelDown, "levelDown");
  var div = root$d(), span = child(div), text2 = child(span), div_1 = sibling(span, 2), node = child(div_1);
  const expression = /* @__PURE__ */ derived(() => [
    SETTINGS_BUTTON_STYLE(),
    "mdi mdi-plus-box -verticalaligntop"
  ]), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.level.up.tooltip")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.level.up.tooltip"));
  GlyphButton(node, {
    get style() {
      return get$1(expression);
    },
    get flowClass() {
      return FlowClass.None;
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_1);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    },
    get logText() {
      return get$1(expression_2);
    },
    logging: !0,
    onClick: levelUp
  });
  var node_1 = sibling(node, 2);
  const expression_3 = /* @__PURE__ */ derived(() => [
    SETTINGS_BUTTON_STYLE(),
    "mdi mdi-minus-box -verticalaligntop"
  ]), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.level.down.tooltip")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.level.down.tooltip"));
  GlyphButton(node_1, {
    get style() {
      return get$1(expression_3);
    },
    get flowClass() {
      return FlowClass.None;
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_4);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    },
    get logText() {
      return get$1(expression_5);
    },
    logging: !0,
    onClick: levelDown
  }), template_effect(
    ($0, $1) => {
      set_class(div, `-heightfull
    ${(get$1(advancedOptions) ? "la-flexrow" : "-displaynone") ?? ""}`), set_class(span, `${$0 ?? ""} -alignend`), set_text(text2, $1);
    },
    [
      SETTINGS_HEADER_STYLE,
      () => getLocalized("LA.pilot.level.label")
    ]
  ), append($$anchor, div), pop();
}
__name(LevelSettings, "LevelSettings");
var root$c = /* @__PURE__ */ template('<div><span> </span> <div class="la-flexcol -alignstart -padding1-b -heightfull"><!> <!></div></div>');
function HullSettings($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), document2 = /* @__PURE__ */ derived(() => props.document), system = /* @__PURE__ */ derived(() => props.system), tooltipEnabled = getPilotSheetTooltipEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  function levelUp(event2) {
    event2.stopPropagation(), get$1(document2).update({ "system.hull": get$1(system).hull + 1 });
  }
  __name(levelUp, "levelUp");
  function levelDown(event2) {
    event2.stopPropagation(), get$1(document2).update({
      "system.hull": Math.max(get$1(system).hull - 1, 0)
    });
  }
  __name(levelDown, "levelDown");
  var div = root$c(), span = child(div), text2 = child(span), div_1 = sibling(span, 2), node = child(div_1);
  const expression = /* @__PURE__ */ derived(() => [
    SETTINGS_BUTTON_STYLE(),
    "mdi mdi-plus-box -verticalaligntop"
  ]), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.hull.up.tooltip")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.hull.up.tooltip"));
  GlyphButton(node, {
    get style() {
      return get$1(expression);
    },
    get flowClass() {
      return FlowClass.None;
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_1);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    },
    get logText() {
      return get$1(expression_2);
    },
    logging: !0,
    onClick: levelUp
  });
  var node_1 = sibling(node, 2);
  const expression_3 = /* @__PURE__ */ derived(() => [
    SETTINGS_BUTTON_STYLE(),
    "mdi mdi-minus-box -verticalaligntop"
  ]), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.hull.down.tooltip")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.hull.down.tooltip"));
  GlyphButton(node_1, {
    get style() {
      return get$1(expression_3);
    },
    get flowClass() {
      return FlowClass.None;
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_4);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    },
    get logText() {
      return get$1(expression_5);
    },
    logging: !0,
    onClick: levelDown
  }), template_effect(
    ($0, $1) => {
      set_class(div, `-heightfull
    ${(get$1(advancedOptions) ? "la-flexrow" : "-displaynone") ?? ""}`), set_class(span, `${$0 ?? ""} -alignend -capitalize`), set_text(text2, $1);
    },
    [
      SETTINGS_HEADER_STYLE,
      () => getLocalized("LA.hull.label")
    ]
  ), append($$anchor, div), pop();
}
__name(HullSettings, "HullSettings");
var root$b = /* @__PURE__ */ template('<div><span> </span> <div class="la-flexcol -alignstart -padding1-b -heightfull"><!> <!></div></div>');
function AgilitySettings($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), document2 = /* @__PURE__ */ derived(() => props.document), system = /* @__PURE__ */ derived(() => props.system), tooltipEnabled = getPilotSheetTooltipEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  function levelUp(event2) {
    event2.stopPropagation(), get$1(document2).update({ "system.agi": get$1(system).agi + 1 });
  }
  __name(levelUp, "levelUp");
  function levelDown(event2) {
    event2.stopPropagation(), get$1(document2).update({
      "system.agi": Math.max(get$1(system).agi - 1, 0)
    });
  }
  __name(levelDown, "levelDown");
  var div = root$b(), span = child(div), text2 = child(span), div_1 = sibling(span, 2), node = child(div_1);
  const expression = /* @__PURE__ */ derived(() => [
    SETTINGS_BUTTON_STYLE(),
    "mdi mdi-plus-box -verticalaligntop"
  ]), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.level.up.tooltip")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.level.up.tooltip"));
  GlyphButton(node, {
    get style() {
      return get$1(expression);
    },
    get flowClass() {
      return FlowClass.None;
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_1);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    },
    get logText() {
      return get$1(expression_2);
    },
    logging: !0,
    onClick: levelUp
  });
  var node_1 = sibling(node, 2);
  const expression_3 = /* @__PURE__ */ derived(() => [
    SETTINGS_BUTTON_STYLE(),
    "mdi mdi-minus-box -verticalaligntop"
  ]), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.agility.down.tooltip")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.agility.down.tooltip"));
  GlyphButton(node_1, {
    get style() {
      return get$1(expression_3);
    },
    get flowClass() {
      return FlowClass.None;
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_4);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    },
    get logText() {
      return get$1(expression_5);
    },
    logging: !0,
    onClick: levelDown
  }), template_effect(
    ($0, $1) => {
      set_class(div, `-heightfull
    ${(get$1(advancedOptions) ? "la-flexrow" : "-displaynone") ?? ""}`), set_class(span, `${$0 ?? ""} -alignend -capitalize`), set_text(text2, $1);
    },
    [
      SETTINGS_HEADER_STYLE,
      () => getLocalized("LA.agility.label")
    ]
  ), append($$anchor, div), pop();
}
__name(AgilitySettings, "AgilitySettings");
var root$a = /* @__PURE__ */ template('<div><span> </span> <div class="la-flexcol -alignstart -padding1-b -heightfull"><!> <!></div></div>');
function SystemsSettings($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), document2 = /* @__PURE__ */ derived(() => props.document), system = /* @__PURE__ */ derived(() => props.system), tooltipEnabled = getPilotSheetTooltipEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid));
  function levelUp(event2) {
    event2.stopPropagation(), get$1(document2).update({ "system.sys": get$1(system).sys + 1 });
  }
  __name(levelUp, "levelUp");
  function levelDown(event2) {
    event2.stopPropagation(), get$1(document2).update({
      "system.sys": Math.max(get$1(system).sys - 1, 0)
    });
  }
  __name(levelDown, "levelDown");
  var div = root$a(), span = child(div), text2 = child(span), div_1 = sibling(span, 2), node = child(div_1);
  const expression = /* @__PURE__ */ derived(() => [
    SETTINGS_BUTTON_STYLE(),
    "mdi mdi-plus-box -verticalaligntop"
  ]), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.systems.up.tooltip")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.systems.up.tooltip"));
  GlyphButton(node, {
    get style() {
      return get$1(expression);
    },
    get flowClass() {
      return FlowClass.None;
    },
    get tooltip() {
      return get$1(expression_1);
    },
    tooltipEnabled,
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    },
    get logText() {
      return get$1(expression_2);
    },
    logging: !0,
    onClick: levelUp
  });
  var node_1 = sibling(node, 2);
  const expression_3 = /* @__PURE__ */ derived(() => [
    SETTINGS_BUTTON_STYLE(),
    "mdi mdi-minus-box -verticalaligntop"
  ]), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.systems.down.tooltip")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.systems.down.tooltip"));
  GlyphButton(node_1, {
    get style() {
      return get$1(expression_3);
    },
    get flowClass() {
      return FlowClass.None;
    },
    get tooltip() {
      return get$1(expression_4);
    },
    tooltipEnabled,
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    },
    get logText() {
      return get$1(expression_5);
    },
    logging: !0,
    onClick: levelDown
  }), template_effect(
    ($0, $1) => {
      set_class(div, `-heightfull
    ${(get$1(advancedOptions) ? "la-flexrow" : "-displaynone") ?? ""}`), set_class(span, `${$0 ?? ""} -alignend -capitalize`), set_text(text2, $1);
    },
    [
      SETTINGS_HEADER_STYLE,
      () => getLocalized("LA.systems.label")
    ]
  ), append($$anchor, div), pop();
}
__name(SystemsSettings, "SystemsSettings");
var root$9 = /* @__PURE__ */ template('<div><span> </span> <div class="la-flexcol -alignstart -padding1-b -heightfull"><!> <!></div></div>');
function EngineeringSettings($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), document2 = /* @__PURE__ */ derived(() => props.document), system = /* @__PURE__ */ derived(() => props.system), tooltipEnabled = getPilotSheetTooltipEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  function levelUp(event2) {
    event2.stopPropagation(), get$1(document2).update({ "system.eng": get$1(system).eng + 1 });
  }
  __name(levelUp, "levelUp");
  function levelDown(event2) {
    event2.stopPropagation(), get$1(document2).update({
      "system.eng": Math.max(get$1(system).eng - 1, 0)
    });
  }
  __name(levelDown, "levelDown");
  var div = root$9(), span = child(div), text2 = child(span), div_1 = sibling(span, 2), node = child(div_1);
  const expression = /* @__PURE__ */ derived(() => [
    SETTINGS_BUTTON_STYLE(),
    "mdi mdi-plus-box -verticalaligntop"
  ]), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.engineering.up.tooltip")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.engineering.up.tooltip"));
  GlyphButton(node, {
    get style() {
      return get$1(expression);
    },
    get flowClass() {
      return FlowClass.None;
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_1);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    },
    get logText() {
      return get$1(expression_2);
    },
    logging: !0,
    onClick: levelUp
  });
  var node_1 = sibling(node, 2);
  const expression_3 = /* @__PURE__ */ derived(() => [
    SETTINGS_BUTTON_STYLE(),
    "mdi mdi-minus-box -verticalaligntop"
  ]), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.engineering.down.tooltip")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.engineering.down.tooltip"));
  GlyphButton(node_1, {
    get style() {
      return get$1(expression_3);
    },
    get flowClass() {
      return FlowClass.None;
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_4);
    },
    get tooltipDirection() {
      return TooltipDirection.RIGHT;
    },
    get logText() {
      return get$1(expression_5);
    },
    logging: !0,
    onClick: levelDown
  }), template_effect(
    ($0, $1) => {
      set_class(div, `-heightfull
    ${(get$1(advancedOptions) ? "la-flexrow" : "-displaynone") ?? ""}`), set_class(span, `${$0 ?? ""} -alignend -capitalize`), set_text(text2, $1);
    },
    [
      SETTINGS_HEADER_STYLE,
      () => getLocalized("LA.engineering.label")
    ]
  ), append($$anchor, div), pop();
}
__name(EngineeringSettings, "EngineeringSettings");
const SETTINGS_BUTTON_STYLE = /* @__PURE__ */ __name(() => " la-text-secondary la-prmy-primary -fontsize5 -height4 " + (getExtraEffectsEnabled() ? "-glow-prmy-hover " : " "), "SETTINGS_BUTTON_STYLE"), SETTINGS_HEADER_STYLE = /* @__PURE__ */ __name(() => " la-bckg-primary la-text-header clipped-top -width7 -padding0-b -padding1-t -fontface-stylized " + (logographicLanguage() ? "-fontsizemedium -padding0-lr" : "-fontsizemediumer -writingmode-v"), "SETTINGS_HEADER_STYLE");
var root$8 = /* @__PURE__ */ template("<!> <!> <!> <!> <!>", 1);
function AdvancedSettings($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]);
  setActorContext($$props.actor);
  var fragment = root$8(), node = first_child(fragment);
  LevelSettings(node, spread_props(() => props));
  var node_1 = sibling(node, 2);
  HullSettings(node_1, spread_props(() => props));
  var node_2 = sibling(node_1, 2);
  AgilitySettings(node_2, spread_props(() => props));
  var node_3 = sibling(node_2, 2);
  SystemsSettings(node_3, spread_props(() => props));
  var node_4 = sibling(node_3, 2);
  EngineeringSettings(node_4, spread_props(() => props)), append($$anchor, fragment), pop();
}
__name(AdvancedSettings, "AdvancedSettings");
var root$7 = /* @__PURE__ */ template("<!> <!>", 1);
function AdvancedSettingsNav($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor);
  setActorContext(get$1(actor));
  const tooltipEnabled = getPilotSheetTooltipEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid));
  var fragment = root$7(), node = first_child(fragment);
  SidebarRatioSlider(node, {
    get uuid() {
      return get$1(actor).uuid;
    },
    ratioGetter: getSidebarRatio$1,
    ratioSetter: setSidebarRatio$1,
    style: ["-aligncontentcenter"],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    logging: !0
  });
  var node_1 = sibling(node, 2);
  const expression = /* @__PURE__ */ derived(() => !get$1(advancedOptions));
  ThemeOverrideButton(node_1, {
    get disabled() {
      return get$1(expression);
    },
    get uuid() {
      return get$1(actor).uuid;
    },
    style: ["-alignselfstart"],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    setOverride: setThemeOverride$3,
    logging: !0
  }), append($$anchor, fragment), pop();
}
__name(AdvancedSettingsNav, "AdvancedSettingsNav");
var root$6 = /* @__PURE__ */ template('<div class="-margin7-t"><!></div>');
function Activity$1($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor);
  setActorContext(get$1(actor));
  const actionLogSaveCollapse = getPilotSheetLogActionDontSaveCollapse(), actionLogStartCollapsed = getPilotSheetLogActionStartCollapsed();
  var div = root$6(), node = child(div);
  ActionLog(node, {
    get uuid() {
      return get$1(actor).uuid;
    },
    dontSaveCollapse: actionLogSaveCollapse,
    startCollapsed: actionLogStartCollapsed,
    get collapsePrefix() {
      return ActionLogCollapsePrefix.PilotSheet;
    }
  }), append($$anchor, div), pop();
}
__name(Activity$1, "Activity$1");
var root_7$2 = /* @__PURE__ */ template('<span class="-fontsize4">+</span>'), root_9$2 = /* @__PURE__ */ template('<span class="-fontsize4">-</span>'), root_10$1 = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_11$1 = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_6$5 = /* @__PURE__ */ template('<span class="la-flexrow -gap0 -padding2-r -fontface-stylized"><!> </span> <!> <!>', 1), root_12$1 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!></div>'), root_3$3 = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>');
function SkillTriggers($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let collapseAllButtonHover = state(!1), editButtonHover = state(!1), messageButtonHover = state(!1), effectButtonHover = state(!1);
  const tooltipEnabled = getPilotSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.skills`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function getSkillPath(index2) {
    return `itemTypes.skill.${index2}`;
  }
  __name(getSkillPath, "getSkillPath");
  const expression = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.skill.label"));
  HeaderMain($$anchor, {
    get text() {
      return get$1(expression);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-primary"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
    }, "extensionTextFunction"),
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !0,
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var fragment_2 = comment(), node = first_child(fragment_2);
      {
        var consequent_2 = /* @__PURE__ */ __name(($$anchor3) => {
          var div = root_3$3();
          each(div, 21, () => $$props.skills, index, ($$anchor4, skill, index2) => {
            const headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor5) => {
              const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.skillTrigger.label"));
              EffectButton($$anchor5, {
                iconStyle: ["la-text-header cci cci-skill -fontsize7"],
                iconBackgroundStyle: [
                  "-fontsize7 la-prmy-secondary",
                  qualityMode ? "-pulse-prmy" : "la-text-scrollbar-secondary"
                ],
                get flowClass() {
                  return FlowClass.Skill;
                },
                get uuid() {
                  return get$1(skill).uuid;
                },
                tooltipEnabled,
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltipDirection() {
                  return TooltipDirection.LEFT;
                },
                get tooltip() {
                  return get$1(skill).system.description;
                },
                get tooltipHeader() {
                  return get$1(expression_1);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(effectButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(effectButtonHover, !1);
                }, "onPointerLeave")
              });
            }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor5) => {
              var fragment_4 = root_6$5(), span = first_child(fragment_4), node_1 = child(span);
              {
                var consequent = /* @__PURE__ */ __name(($$anchor6) => {
                  var span_1 = root_7$2();
                  append($$anchor6, span_1);
                }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor6) => {
                  var fragment_5 = comment(), node_2 = first_child(fragment_5);
                  {
                    var consequent_1 = /* @__PURE__ */ __name(($$anchor7) => {
                      var span_2 = root_9$2();
                      append($$anchor7, span_2);
                    }, "consequent_1");
                    if_block(
                      node_2,
                      ($$render) => {
                        get$1(skill).system.curr_rank < 0 && $$render(consequent_1);
                      },
                      !0
                    );
                  }
                  append($$anchor6, fragment_5);
                }, "alternate");
                if_block(node_1, ($$render) => {
                  get$1(skill).system.curr_rank > 0 ? $$render(consequent) : $$render(alternate, !1);
                });
              }
              var text2 = sibling(node_1), node_3 = sibling(span, 2);
              const expression_2 = /* @__PURE__ */ derived(() => [
                H2_BUTTON_ICON_STYLE(),
                "-padding0-lr la-flexrow"
              ]), expression_3 = /* @__PURE__ */ derived(() => getSkillPath(index2)), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
              GlyphButton(node_3, {
                get style() {
                  return get$1(expression_2);
                },
                get flowClass() {
                  return FlowClass.ContextMenu;
                },
                get path() {
                  return get$1(expression_3);
                },
                tooltipEnabled,
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_4);
                },
                get logText() {
                  return get$1(expression_5);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i = root_10$1();
                  append($$anchor6, i);
                }, "children"),
                $$slots: { default: !0 }
              });
              var node_4 = sibling(node_3, 2);
              const expression_6 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip")), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
              GlyphButton(node_4, {
                get style() {
                  return get$1(expression_6);
                },
                get flowClass() {
                  return FlowClass.SendToChat;
                },
                index: index2,
                get uuid() {
                  return get$1(skill).uuid;
                },
                tooltipEnabled,
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_7);
                },
                get logText() {
                  return get$1(expression_8);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i_1 = root_11$1();
                  append($$anchor6, i_1);
                }, "children"),
                $$slots: { default: !0 }
              }), template_effect(() => set_text(text2, ` ${get$1(skill).system.curr_rank * 2}`)), append($$anchor5, fragment_4);
            }, "headerSecondaryRightOptions"), expression_9 = /* @__PURE__ */ derived(() => getSkillPath(index2));
            HeaderSecondary($$anchor4, {
              get text() {
                return get$1(skill).name;
              },
              headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
              textStyle: [
                H2_TEXT_SIZE,
                "-overflowhidden -fontface-stylized"
              ],
              borderStyle: ["-bordersoff"],
              extensionTextFunction: /* @__PURE__ */ __name(() => {
                if (get$1(effectButtonHover)) return `--${getLocalized("LA.use.label")}`;
                if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
                if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
              }, "extensionTextFunction"),
              get itemID() {
                return get$1(skill).lid;
              },
              get uuid() {
                return get$1(skill).uuid;
              },
              get path() {
                return get$1(expression_9);
              },
              acceptTypes: "skill",
              get collapseID() {
                return get$1(skill).uuid;
              },
              startCollapsed: !0,
              contentLeft: headerSecondaryLeftOptions2,
              contentRight: headerSecondaryRightOptions,
              children: /* @__PURE__ */ __name(($$anchor5, $$slotProps2) => {
                var div_1 = root_12$1(), node_5 = child(div_1);
                const expression_10 = /* @__PURE__ */ derived(() => getLocalized("LA.description.label"));
                EffectBox(node_5, {
                  get name() {
                    return get$1(expression_10);
                  },
                  get effect() {
                    return get$1(skill).system.description;
                  },
                  tooltipEnabled,
                  logging: !0
                });
                var node_6 = sibling(node_5, 2);
                const expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.detail.label"));
                EffectBox(node_6, {
                  get name() {
                    return get$1(expression_11);
                  },
                  get effect() {
                    return get$1(skill).system.detail;
                  },
                  tooltipEnabled,
                  logging: !0
                }), append($$anchor5, div_1);
              }, "children"),
              $$slots: { default: !0 }
            });
          }), append($$anchor3, div);
        }, "consequent_2"), alternate_1 = /* @__PURE__ */ __name(($$anchor3) => {
          const expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.skill.empty.label")), expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.skill.empty.subLabel"));
          EmptyBox($$anchor3, {
            get label() {
              return get$1(expression_12);
            },
            get subLabel() {
              return get$1(expression_13);
            },
            get type() {
              return AcceptType.Skill;
            },
            get path() {
              return `itemTypes.skill.${$$props.skills.length ?? ""}`;
            }
          });
        }, "alternate_1");
        if_block(node, ($$render) => {
          $$props.skills.length ? $$render(consequent_2) : $$render(alternate_1, !1);
        });
      }
      append($$anchor2, fragment_2);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(SkillTriggers, "SkillTriggers");
var root_5$4 = /* @__PURE__ */ template("<i></i>"), root_7$1 = /* @__PURE__ */ template('<i class="fas fa-ellipsis-v"></i>'), root_8$2 = /* @__PURE__ */ template('<i class="mdi mdi-message"></i>'), root_6$4 = /* @__PURE__ */ template('<span class="la-flexrow -gap0 -padding2-r -fontface-stylized"><span class="-fontsizesmall -letterspacing0"> </span> </span> <!> <!>', 1), root_9$1 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!></div>'), root_3$2 = /* @__PURE__ */ template('<div class="la-flexcol -gap0 -widthfull"></div>');
function License($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return get$1(collID);
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let collapseAllButtonHover = state(!1), editButtonHover = state(!1), messageButtonHover = state(!1), licenseDescriptions = proxy([]);
  const tooltipEnabled = getNPCSheetTooltipEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.licenses`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  onMount(() => {
    $$props.licenses.forEach((license, index2) => {
      fetchLicenseDescription(license, index2);
    });
  });
  async function fetchLicenseDescription(license, index2) {
    try {
      const item = await game.lancer.fromLid(license.system.key), frame = await fromUuid(item.uuid);
      updateLicenseDescription(index2, (frame == null ? void 0 : frame.system.description) || "");
    } catch (error) {
      console.error(`Failed to fetch license description for index ${index2}:`, error);
    }
  }
  __name(fetchLicenseDescription, "fetchLicenseDescription");
  function updateLicenseDescription(index2, description) {
    licenseDescriptions[index2] = description;
  }
  __name(updateLicenseDescription, "updateLicenseDescription");
  function getLicensePath(index2) {
    return `itemTypes.license.${index2}`;
  }
  __name(getLicensePath, "getLicensePath");
  function sendToChat(event2, license, index2) {
    var _a;
    if (event2.stopPropagation(), (_a = $$props.actor) != null && _a.uuid && license) {
      let chatData = {
        title: `${license.name} ${license.system.curr_rank}`,
        description: licenseDescriptions[index2] || ""
      };
      SendUnknownToChatBase.getInstance().startFlow($$props.actor.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendToChat, "sendToChat");
  const expression = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.license.label"));
  HeaderMain($$anchor, {
    get text() {
      return get$1(expression);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-weapon"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-weapon"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
    }, "extensionTextFunction"),
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !0,
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var fragment_2 = comment(), node = first_child(fragment_2);
      {
        var consequent = /* @__PURE__ */ __name(($$anchor3) => {
          var div = root_3$2();
          each(div, 21, () => $$props.licenses, index, ($$anchor4, license, index2) => {
            const headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor5) => {
              var i = root_5$4();
              set_class(i, `${H2_ICON_SIZE} cci cci-license`), append($$anchor5, i);
            }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor5) => {
              var fragment_3 = root_6$4(), span = first_child(fragment_3), span_1 = child(span), text2 = child(span_1), text_1 = sibling(span_1), node_1 = sibling(span, 2);
              const expression_1 = /* @__PURE__ */ derived(() => [
                H2_BUTTON_ICON_STYLE(),
                "-padding0-lr la-flexrow"
              ]), expression_2 = /* @__PURE__ */ derived(() => getLicensePath(index2)), expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
              GlyphButton(node_1, {
                get style() {
                  return get$1(expression_1);
                },
                get flowClass() {
                  return FlowClass.ContextMenu;
                },
                get path() {
                  return get$1(expression_2);
                },
                tooltipEnabled,
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_3);
                },
                get logText() {
                  return get$1(expression_4);
                },
                logging: !0,
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(editButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i_1 = root_7$1();
                  append($$anchor6, i_1);
                }, "children"),
                $$slots: { default: !0 }
              });
              var node_2 = sibling(node_1, 2);
              const expression_5 = /* @__PURE__ */ derived(() => [H2_BUTTON_ICON_STYLE(), "-padding0-lr"]), expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip")), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.chat.tooltip"));
              GlyphButton(node_2, {
                get style() {
                  return get$1(expression_5);
                },
                get flowClass() {
                  return FlowClass.None;
                },
                index: index2,
                get uuid() {
                  return get$1(license).uuid;
                },
                tooltipEnabled,
                get tooltipDirection() {
                  return TooltipDirection.UP;
                },
                get tooltipTheme() {
                  return get$1(theme);
                },
                get tooltip() {
                  return get$1(expression_6);
                },
                get logText() {
                  return get$1(expression_7);
                },
                logging: !0,
                onClick: /* @__PURE__ */ __name((event2) => sendToChat(event2, get$1(license), index2), "onClick"),
                onPointerEnter: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !0);
                }, "onPointerEnter"),
                onPointerLeave: /* @__PURE__ */ __name(() => {
                  set(messageButtonHover, !1);
                }, "onPointerLeave"),
                children: /* @__PURE__ */ __name(($$anchor6, $$slotProps2) => {
                  var i_2 = root_8$2();
                  append($$anchor6, i_2);
                }, "children"),
                $$slots: { default: !0 }
              }), template_effect(
                ($0) => {
                  set_text(text2, $0), set_text(text_1, ` ${get$1(license).system.curr_rank ?? ""}`);
                },
                [() => getLocalized("LA.rank.label")]
              ), append($$anchor5, fragment_3);
            }, "headerSecondaryRightOptions"), expression_8 = /* @__PURE__ */ derived(() => `${get$1(license).system.manufacturer} ${get$1(license).name}`), expression_9 = /* @__PURE__ */ derived(() => getLicensePath(index2));
            HeaderSecondary($$anchor4, {
              get text() {
                return get$1(expression_8);
              },
              headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
              textStyle: [
                H2_TEXT_SIZE,
                "-overflowhidden -fontface-stylized"
              ],
              borderStyle: ["-bordersoff"],
              extensionTextFunction: /* @__PURE__ */ __name(() => {
                if (get$1(messageButtonHover)) return `--${getLocalized("LA.chat.extension")}`;
                if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
              }, "extensionTextFunction"),
              get itemID() {
                return get$1(license).lid;
              },
              get uuid() {
                return get$1(license).uuid;
              },
              get path() {
                return get$1(expression_9);
              },
              acceptTypes: "license",
              get collapseID() {
                return get$1(license).uuid;
              },
              startCollapsed: !0,
              contentLeft: headerSecondaryLeftOptions2,
              contentRight: headerSecondaryRightOptions,
              children: /* @__PURE__ */ __name(($$anchor5, $$slotProps2) => {
                var div_1 = root_9$1(), node_3 = child(div_1);
                const expression_10 = /* @__PURE__ */ derived(() => getLocalized("LA.description.label"));
                EffectBox(node_3, {
                  get name() {
                    return get$1(expression_10);
                  },
                  get effect() {
                    return licenseDescriptions[index2];
                  },
                  tooltipEnabled,
                  logging: !0
                }), append($$anchor5, div_1);
              }, "children"),
              $$slots: { default: !0 }
            });
          }), append($$anchor3, div);
        }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor3) => {
          const expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.license.empty.label")), expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.license.empty.subLabel"));
          EmptyBox($$anchor3, {
            get label() {
              return get$1(expression_11);
            },
            get subLabel() {
              return get$1(expression_12);
            },
            get type() {
              return AcceptType.License;
            },
            get path() {
              return `itemTypes.license.${$$props.licenses.length ?? ""}`;
            }
          });
        }, "alternate");
        if_block(node, ($$render) => {
          $$props.licenses.length ? $$render(consequent) : $$render(alternate, !1);
        });
      }
      append($$anchor2, fragment_2);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(License, "License");
var root$5 = /* @__PURE__ */ template("<!> <!> <!> <!>", 1);
function Abilities($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), itemTypes = /* @__PURE__ */ derived(() => props.itemTypes);
  setActorContext(get$1(actor));
  var fragment = root$5(), node = first_child(fragment);
  SkillTriggers(node, {
    get actor() {
      return get$1(actor);
    },
    get skills() {
      return get$1(itemTypes).skill;
    }
  });
  var node_1 = sibling(node, 2);
  License(node_1, {
    get actor() {
      return get$1(actor);
    },
    get licenses() {
      return get$1(itemTypes).license;
    }
  });
  var node_2 = sibling(node_1, 2);
  CoreBonus(node_2, {
    get actor() {
      return get$1(actor);
    },
    get sheetActor() {
      return get$1(actor);
    }
  });
  var node_3 = sibling(node_2, 2);
  Talents(node_3, {
    get actor() {
      return get$1(actor);
    },
    get sheetActor() {
      return get$1(actor);
    }
  }), append($$anchor, fragment), pop();
}
__name(Abilities, "Abilities");
function History($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    const expression = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
    GlyphButton($$anchor2, {
      style: [
        "mdi mdi-pencil -fontsize4 -height4 -lineheight4 la-prmy-header la-scdy-primary",
        qualityMode ? " -glow-prmy -glow-scdy-hover " : ""
      ],
      get flowClass() {
        return FlowClass.EditText;
      },
      path: "system.history",
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression);
      },
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get logText() {
        return get$1(expression_1);
      },
      logging: !0,
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let editButtonHover = state(!1);
  const tooltipEnabled = getPilotSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.history`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), labelTheme = /* @__PURE__ */ derived(() => getThemeKey($$props.actor.uuid)), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.history.label"));
  HeaderMain($$anchor, {
    get text() {
      return get$1(expression_2);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-weapon"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-weapon"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
    }, "extensionTextFunction"),
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !0,
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      const expression_3 = /* @__PURE__ */ derived(() => getThemeHistoryLabel(get$1(labelTheme))), expression_4 = /* @__PURE__ */ derived(() => $$props.system.history ? $$props.system.history : getLocalized("LA.placeholder"));
      EffectBox($$anchor2, {
        get name() {
          return get$1(expression_3);
        },
        get effect() {
          return get$1(expression_4);
        }
      });
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(History, "History");
function Note($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    const expression = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip")), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.tooltip"));
    GlyphButton($$anchor2, {
      style: [
        "mdi mdi-pencil -fontsize4 -height4 -lineheight4 la-prmy-header la-scdy-primary",
        qualityMode ? " -glow-prmy -glow-scdy-hover" : ""
      ],
      get flowClass() {
        return FlowClass.EditText;
      },
      path: "system.notes",
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression);
      },
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get logText() {
        return get$1(expression_1);
      },
      logging: !0,
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(editButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions");
  let editButtonHover = state(!1);
  const tooltipEnabled = getPilotSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.notes`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), labelTheme = /* @__PURE__ */ derived(() => getThemeKey($$props.actor.uuid)), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.notes.label"));
  HeaderMain($$anchor, {
    get text() {
      return get$1(expression_2);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-weapon"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-weapon"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(editButtonHover)) return `--${getLocalized("LA.edit.extension")}`;
    }, "extensionTextFunction"),
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !0,
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      const expression_3 = /* @__PURE__ */ derived(() => getThemeHistoryLabel(get$1(labelTheme))), expression_4 = /* @__PURE__ */ derived(() => $$props.system.notes ? $$props.system.notes : getLocalized("LA.placeholder"));
      EffectBox($$anchor2, {
        get name() {
          return get$1(expression_3);
        },
        get effect() {
          return get$1(expression_4);
        }
      });
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(Note, "Note");
var root_3$1 = /* @__PURE__ */ template('<span class="-fontsizesmall -upper -fontface-stylized">SYNC</span>'), on_change$3 = /* @__PURE__ */ __name((event2, overridePilotIDWithCloudID) => overridePilotIDWithCloudID(event2), "on_change$3"), root_5$3 = /* @__PURE__ */ template("<option> </option>"), root_4$1 = /* @__PURE__ */ template('<select class="la-sync__select -textaligncenter la-bckg-transparent la-text-text la-brdr-text" name="selectCloudId" data-type="text"></select>'), root_2$2 = /* @__PURE__ */ template('<div class="la-flexrow -aligncenter -widthfull"><!> <div class="la-flexcol -widthfull -gap0"><!> <input type="text" class="-bordersround -small la-text-text -padding1-lr -letterspacing1 -fontface-stylized -fontsize4" name="system.cloud_id" data-dtype="string"></div></div>'), root_6$3 = /* @__PURE__ */ template(`<input type="file" class="la-text-text -widthfull -padding0-tb -fontface-stylized -upper
                    lcp-up" id="pilot-json-import" name="pilot-json-up" accept=".json">`), root_1$4 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!></div>');
function Sync($$anchor, $$props) {
  push($$props, !0);
  let cloudID = state(proxy($$props.system.cloud_id || ""));
  const tooltipEnabled = getPilotSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.sync`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid));
  function overridePilotIDWithCloudID(event2) {
    event2.stopPropagation(), set(cloudID, proxy(event2.target.value));
  }
  __name(overridePilotIDWithCloudID, "overridePilotIDWithCloudID");
  function getGlowColor() {
    return getBrightness(getThemeKey($$props.actor.uuid)) === "dark" ? "la-text-text" : "la-text-secondary";
  }
  __name(getGlowColor, "getGlowColor");
  const expression = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.sync.label"));
  HeaderMain($$anchor, {
    get text() {
      return get$1(expression);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-primary"],
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !1,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div = root_1$4(), node = child(div);
      const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.sync.download.label"));
      EffectBox(node, {
        get name() {
          return get$1(expression_1);
        },
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps2) => {
          var div_1 = root_2$2(), node_1 = child(div_1);
          const expression_2 = /* @__PURE__ */ derived(() => [
            "la-flexcol mdi mdi-cloud-download -fontsize7 la-prmy-header la-scdy-primary -padding1-lr",
            qualityMode ? " -glow-prmy -glow-scdy-hover " + getGlowColor() : ""
          ]), expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.sync.download.tooltip")), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.sync.download.tooltip"));
          GlyphButton(node_1, {
            get style() {
              return get$1(expression_2);
            },
            get flowClass() {
              return FlowClass.DownloadFromCloud;
            },
            action: "download",
            tooltipEnabled,
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltip() {
              return get$1(expression_3);
            },
            get tooltipDirection() {
              return TooltipDirection.LEFT;
            },
            get logText() {
              return get$1(expression_4);
            },
            logging: !0,
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps3) => {
              var span = root_3$1();
              append($$anchor4, span);
            }, "children"),
            $$slots: { default: !0 }
          });
          var div_2 = sibling(node_1, 2), node_2 = child(div_2);
          {
            var consequent = /* @__PURE__ */ __name(($$anchor4) => {
              var select = root_4$1();
              select.__change = [on_change$3, overridePilotIDWithCloudID], each(select, 21, () => $$props.pilotCache, index, ($$anchor5, pilot) => {
                var option = root_5$3(), option_value = {}, text2 = child(option);
                template_effect(() => {
                  option_value !== (option_value = get$1(pilot).id) && (option.value = (option.__value = get$1(pilot).id) == null ? "" : get$1(pilot).id), set_selected(option, get$1(pilot).id === get$1(cloudID)), set_text(text2, `${get$1(pilot).callsign} - ${get$1(pilot).name}`);
                }), append($$anchor5, option);
              }), append($$anchor4, select);
            }, "consequent");
            if_block(node_2, ($$render) => {
              var _a;
              (_a = $$props.pilotCache) != null && _a.length && $$render(consequent);
            });
          }
          var input = sibling(node_2, 2);
          template_effect(
            ($0) => {
              set_value(input, get$1(cloudID)), set_attribute(input, "placeholder", $0);
            },
            [
              () => getLocalized("LA.pilot.sync.download.subLabel")
            ]
          ), append($$anchor3, div_1);
        }, "children"),
        $$slots: { default: !0 }
      });
      var node_3 = sibling(node, 2);
      const expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.sync.import.label"));
      EffectBox(node_3, {
        get name() {
          return get$1(expression_5);
        },
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps2) => {
          var input_1 = root_6$3();
          append($$anchor3, input_1);
        }, "children"),
        $$slots: { default: !0 }
      }), append($$anchor2, div);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(Sync, "Sync");
delegate(["change"]);
var root$4 = /* @__PURE__ */ template("<!> <!> <!> <!>", 1);
function Dossier($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor);
  setActorContext(get$1(actor));
  const collID = /* @__PURE__ */ derived(() => `${get$1(actor).uuid}.status.activeEffects`);
  var fragment = root$4(), node = first_child(fragment);
  Sync(node, spread_props(() => props));
  var node_1 = sibling(node, 2);
  const expression = /* @__PURE__ */ derived(() => getLocalized("LA.tab.status.effects.label"));
  HeaderMain(node_1, {
    get text() {
      return get$1(expression);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-primary"],
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !1,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      ActiveEffects($$anchor2, spread_props(() => props));
    }, "children"),
    $$slots: { default: !0 }
  });
  var node_2 = sibling(node_1, 2);
  History(node_2, spread_props(() => props));
  var node_3 = sibling(node_2, 2);
  Note(node_3, spread_props(() => props)), append($$anchor, fragment), pop();
}
__name(Dossier, "Dossier");
var root_1$3 = /* @__PURE__ */ template('<div class="la-flexcol -widthfull clipped-bot-alt -fontface-stylized"><div class="la-flexrow -justifyevenly -widthfull la-bckg-darken-1 -padding0-tb"><!> <!> <!></div> <div class="la-flexrow -justifyevenly -widthfull -padding1-tb -fontsizemedium"><!> <!> <!> <!></div> <div class="la-flexrow -justifyevenly -widthfull la-bckg-darken-1 -padding0-tb"><!> <!> <!></div></div>');
function MechStats($$anchor, $$props) {
  push($$props, !0);
  const logographic = logographicLanguage(), tooltipEnabled = getPilotSheetTooltipEnabled(), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.mechStats`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), expression = /* @__PURE__ */ derived(() => getLocalized("LA.tab.statistics.label"));
  HeaderMain($$anchor, {
    get text() {
      return get$1(expression);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-weapon"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: [
      "la-brdr-transparent la-bckg-card clipped-bot-alt"
    ],
    get collapseID() {
      return get$1(collID);
    },
    startCollapsed: !0,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div = root_1$3(), div_1 = child(div), node = child(div_1);
      const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.armor.short")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.armor.tooltip"));
      StatComboShort(node, {
        icon: "cci cci-role-defender -alignselfcenter",
        get label() {
          return get$1(expression_1);
        },
        get value() {
          return $$props.selectedMech.system.armor;
        },
        outerStyle: ["la-text-text -fontsize7"],
        innerStyle: [
          "-divider -fontsizemedium la-prmy-accent -textaligncenter",
          logographic ? "" : "-bold"
        ],
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_2);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        }
      });
      var node_1 = sibling(node, 2);
      const expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.evasion.short")), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.evasion.tooltip"));
      StatComboShort(node_1, {
        icon: "cci cci-evasion -alignselfcenter",
        get label() {
          return get$1(expression_3);
        },
        get value() {
          return $$props.selectedMech.system.evasion;
        },
        outerStyle: ["la-text-text -fontsize7"],
        innerStyle: [
          "-divider -fontsizemedium la-prmy-accent -textaligncenter",
          logographic ? "" : "-bold"
        ],
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_4);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        }
      });
      var node_2 = sibling(node_1, 2);
      const expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.edefense.short")), expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.edefense.tooltip"));
      StatComboShort(node_2, {
        icon: "cci cci-edef -alignselfcenter",
        get label() {
          return get$1(expression_5);
        },
        get value() {
          return $$props.selectedMech.system.edef;
        },
        outerStyle: ["la-text-text -fontsize7"],
        innerStyle: [
          "-divider -fontsizemedium la-prmy-accent -textaligncenter",
          logographic ? "" : "-bold"
        ],
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_6);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        }
      });
      var div_2 = sibling(div_1, 2), node_3 = child(div_2);
      const expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.hitpoint.short")), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.hitpoint.tooltip"));
      StatComboShort(node_3, {
        icon: "mdi mdi-heart-flash -alignselfcenter",
        get label() {
          return get$1(expression_7);
        },
        get value() {
          return $$props.selectedMech.system.hp.max;
        },
        outerStyle: ["la-text-text -fontsize6"],
        innerStyle: [
          "-divider -fontsizemedium la-prmy-accent -textaligncenter",
          logographic ? "" : "-bold"
        ],
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_8);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        }
      });
      var node_4 = sibling(node_3, 2);
      const expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.structure.label")), expression_10 = /* @__PURE__ */ derived(() => getLocalized("LA.structure.tooltip"));
      StatComboShort(node_4, {
        icon: "cci cci-structure -alignselfcenter",
        get label() {
          return get$1(expression_9);
        },
        get value() {
          return $$props.selectedMech.system.structure.max;
        },
        outerStyle: ["la-text-text -fontsize7"],
        innerStyle: [
          "-divider -fontsizemedium la-prmy-accent -textaligncenter",
          logographic ? "" : "-bold"
        ],
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_10);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        }
      });
      var node_5 = sibling(node_4, 2);
      const expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.heat.label")), expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.heat.tooltip"));
      StatComboShort(node_5, {
        icon: "cci cci-heat -alignselfcenter",
        get label() {
          return get$1(expression_11);
        },
        get value() {
          return $$props.selectedMech.system.heat.max;
        },
        outerStyle: ["la-text-text -fontsize7"],
        innerStyle: [
          "-divider -fontsizemedium la-prmy-accent -textaligncenter",
          logographic ? "" : "-bold"
        ],
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_12);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        }
      });
      var node_6 = sibling(node_5, 2);
      const expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.stress.label")), expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.stress.tooltip"));
      StatComboShort(node_6, {
        icon: "cci cci-reactor -alignselfcenter",
        get label() {
          return get$1(expression_13);
        },
        get value() {
          return $$props.selectedMech.system.stress.max;
        },
        outerStyle: ["la-text-text -fontsize7"],
        innerStyle: [
          "-divider -fontsizemedium la-prmy-accent -textaligncenter",
          logographic ? "" : "-bold"
        ],
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_14);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        }
      });
      var div_3 = sibling(div_2, 2), node_7 = child(div_3);
      const expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.tattack.short")), expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.tattack.tooltip"));
      StatComboShort(node_7, {
        icon: "cci cci-tech-full -alignselfcenter",
        get label() {
          return get$1(expression_15);
        },
        get value() {
          return $$props.selectedMech.system.tech_attack;
        },
        outerStyle: ["la-text-text -fontsize7"],
        innerStyle: [
          "-divider -fontsizemedium la-prmy-accent -textaligncenter",
          logographic ? "" : "-bold"
        ],
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_16);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        }
      });
      var node_8 = sibling(node_7, 2);
      const expression_17 = /* @__PURE__ */ derived(() => getLocalized("LA.save.short")), expression_18 = /* @__PURE__ */ derived(() => getLocalized("LA.save.tooltip"));
      StatComboShort(node_8, {
        icon: "cci cci-save -alignselfcenter",
        get label() {
          return get$1(expression_17);
        },
        get value() {
          return $$props.selectedMech.system.save;
        },
        outerStyle: ["la-text-text -fontsize7"],
        innerStyle: [
          "-divider -fontsizemedium la-prmy-accent -textaligncenter",
          logographic ? "" : "-bold"
        ],
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_18);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        }
      });
      var node_9 = sibling(node_8, 2);
      const expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.sensor.short")), expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.sensor.tooltip"));
      StatComboShort(node_9, {
        icon: "cci cci-sensor -alignselfcenter",
        get label() {
          return get$1(expression_19);
        },
        get value() {
          return $$props.selectedMech.system.sensor_range;
        },
        outerStyle: ["la-text-text -fontsize7"],
        innerStyle: [
          "-divider -fontsizemedium la-prmy-accent -textaligncenter",
          logographic ? "" : "-bold"
        ],
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltip() {
          return get$1(expression_20);
        },
        get tooltipDirection() {
          return TooltipDirection.LEFT;
        }
      }), append($$anchor2, div);
    }, "children"),
    $$slots: { default: !0 }
  }), pop();
}
__name(MechStats, "MechStats");
function setActiveMech(event2, system, ownedMechs, selectedMechIndex, actor) {
  event2.stopPropagation(), get$1(system).active_mech && get$1(system).active_mech.id === ownedMechs[get$1(selectedMechIndex)].uuid ? get$1(actor).update({ "system.active_mech": null }) : (ownedMechs[get$1(selectedMechIndex)].update({ "system.pilot": get$1(actor).uuid }), get$1(actor).update({
    "system.active_mech": ownedMechs[get$1(selectedMechIndex)].uuid
  }));
}
__name(setActiveMech, "setActiveMech");
var root_4 = /* @__PURE__ */ template("<i></i>"), root_5$2 = /* @__PURE__ */ template("<i></i>"), root_7 = /* @__PURE__ */ template('<button type="button"><img class="la-available-mechs__img"> <span class="-fontsizesmall -fontface-stylized"> </span></button>'), root_6$2 = /* @__PURE__ */ template('<div class="la-flexcol -widthfull"><div role="none" class="la-available-mechs__list"><div class=" la-flexrow -justifystart -padding0-b"></div></div></div>'), root_1$2 = /* @__PURE__ */ template('<div><div class="-positionrelative -widthfull la-reveal"><span><!></span></div> <button> </button> <span class="-fontsizemedium -letterspacing0 -upper"> </span> <img class="la-selected-mech__img"> <div class="la-flexcol -positionabsolute -right0"><div class=" -fontsize19"><!></div> <div class=" la-flexrow -fontsize9"><i></i> <span> </span></div></div> <div class="-positionrelative"><button type="button"></button></div></div> <!> <!>', 1);
function MechStorage($$anchor, $$props) {
  var _a;
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), system = /* @__PURE__ */ derived(() => props.system);
  setActorContext(get$1(actor));
  const ownedMechs = ((_a = game.actors) == null ? void 0 : _a.filter((mech) => {
    var _a2;
    return mech.type === "mech" && ((_a2 = mech.system.pilot) == null ? void 0 : _a2.status) === "resolved" && mech.system.pilot.value.id === get$1(actor).id;
  })) ?? [];
  let selectedMechIndex = state(proxy(PilotStore.get(get$1(actor).uuid).selectedMech));
  const qualityMode = getExtraEffectsEnabled(), tooltipEnabled = getPilotSheetTooltipEnabled(), themeOverride = /* @__PURE__ */ derived(() => getBrightness(getThemeKey(get$1(actor).uuid)) === "light" ? "la-text-primary" : "la-text-text"), collID = /* @__PURE__ */ derived(() => `${get$1(actor).uuid}.mechStorage`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid)), activateTip = TooltipFactory.buildTooltip(getLocalized("LA.pilot.mechStorage.activate.tooltip")), deactivateTip = TooltipFactory.buildTooltip(getLocalized("LA.pilot.mechStorage.deactivate.tooltip"));
  function isInactive() {
    return !get$1(system).active_mech || get$1(system).active_mech.id !== ownedMechs[get$1(selectedMechIndex)].uuid;
  }
  __name(isInactive, "isInactive");
  function getGlowColor() {
    return isInactive() ? "la-prmy-system" : "la-prmy-text";
  }
  __name(getGlowColor, "getGlowColor");
  function getSizeTip() {
    return TooltipFactory.buildTooltip(getLocalized("LA.size.tooltip"), `${getLocalized("LA.size.label")} ${ownedMechs[get$1(selectedMechIndex)].system.size}`);
  }
  __name(getSizeTip, "getSizeTip");
  function getSpeedTip() {
    return TooltipFactory.buildTooltip(getLocalized("LA.speed.tooltip"), `${getLocalized("LA.speed.label")} ${ownedMechs[get$1(selectedMechIndex)].system.speed}`);
  }
  __name(getSpeedTip, "getSpeedTip");
  function handleMechSelect(event2, index2) {
    event2.stopPropagation(), set(selectedMechIndex, proxy(index2)), PilotStore.set(get$1(actor).uuid, { selectedMech: index2 });
  }
  __name(handleMechSelect, "handleMechSelect");
  var fragment = comment(), node = first_child(fragment);
  {
    var consequent_2 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_1 = root_1$2(), div = first_child(fragment_1);
      set_class(div, `la-flexcol -widthfull -margin1-b -padding1-tb la-reveal-hover
        ${(qualityMode ? "la-bg-scroll-alt" : "la-bg-alt") ?? ""}`);
      var div_1 = child(div), span = child(div_1), node_1 = child(span);
      {
        var consequent = /* @__PURE__ */ __name(($$anchor3) => {
          var text$1 = text();
          template_effect(($0) => set_text(text$1, $0), [
            () => getLocalized("LA.pilot.mechstorage.inactive.label")
          ]), append($$anchor3, text$1);
        }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor3) => {
          var text_1 = text();
          template_effect(($0) => set_text(text_1, $0), [
            () => getLocalized("LA.pilot.mechstorage.active.label")
          ]), append($$anchor3, text_1);
        }, "alternate");
        if_block(node_1, ($$render) => {
          isInactive() ? $$render(consequent) : $$render(alternate, !1);
        });
      }
      var button = sibling(div_1, 2);
      set_class(button, `-fontsize6 -letterspacing1 -upper
            ${(qualityMode ? "-glow-hover-primary" : "") ?? ""}
            ref set click-open`), set_attribute(button, "draggable", !0);
      var text_2 = child(button), span_1 = sibling(button, 2), text_3 = child(span_1), img = sibling(span_1, 2), div_2 = sibling(img, 2), div_3 = child(div_2), node_2 = child(div_3);
      {
        var consequent_1 = /* @__PURE__ */ __name(($$anchor3) => {
          var i = root_4();
          template_effect(
            ($0) => {
              set_class(i, `cci cci-size-half ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_attribute(i, "data-tooltip", $0), set_attribute(i, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i, "data-tooltip-direction", TooltipDirection.LEFT);
            },
            [
              () => tooltipEnabled ? getSizeTip() : void 0
            ]
          ), append($$anchor3, i);
        }, "consequent_1"), alternate_1 = /* @__PURE__ */ __name(($$anchor3) => {
          var i_1 = root_5$2();
          template_effect(
            ($0) => {
              set_class(i_1, `cci cci-size-${ownedMechs[get$1(selectedMechIndex)].system.size ?? ""} ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_attribute(i_1, "data-tooltip", $0), set_attribute(i_1, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i_1, "data-tooltip-direction", TooltipDirection.LEFT);
            },
            [
              () => tooltipEnabled ? getSizeTip() : void 0
            ]
          ), append($$anchor3, i_1);
        }, "alternate_1");
        if_block(node_2, ($$render) => {
          ownedMechs[get$1(selectedMechIndex)].system.size < 1 ? $$render(consequent_1) : $$render(alternate_1, !1);
        });
      }
      var div_4 = sibling(div_3, 2), i_2 = child(div_4), span_2 = sibling(i_2, 2), text_4 = child(span_2), div_5 = sibling(div_2, 2), button_1 = child(div_5);
      button_1.__click = [
        setActiveMech,
        system,
        ownedMechs,
        selectedMechIndex,
        actor
      ];
      var node_3 = sibling(div, 2);
      const expression = /* @__PURE__ */ derived(() => getLocalized("LA.tab.mechs.label"));
      HeaderMain(node_3, {
        get text() {
          return get$1(expression);
        },
        headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
        textStyle: ["la-text-header -fontsize4 -overflowhidden"],
        borderStyle: [
          "la-brdr-transparent la-bckg-card clipped-bot-alt"
        ],
        get collapseID() {
          return get$1(collID);
        },
        startCollapsed: !0,
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps) => {
          var div_6 = root_6$2(), div_7 = child(div_6), div_8 = child(div_7);
          each(div_8, 21, () => ownedMechs, index, ($$anchor4, mech, index2) => {
            var button_2 = root_7();
            button_2.__click = (event2) => handleMechSelect(event2, index2);
            var img_1 = child(button_2), span_3 = sibling(img_1, 2), text_5 = child(span_3);
            template_effect(
              ($0, $1) => {
                set_class(button_2, `la-flexcol -bordersround ${(get$1(selectedMechIndex) === index2 ? "la-brdr-accent" : "la-brdr-transparent") ?? ""}`), set_attribute(button_2, "aria-label", $0), set_attribute(img_1, "src", get$1(mech).img), set_attribute(img_1, "alt", $1), set_text(text_5, get$1(mech).name);
              },
              [
                () => getLocalized("LA.pilot.mechStorage.select.tooltip"),
                () => getLocalized("LA.placeholder")
              ]
            ), append($$anchor4, button_2);
          }), event("pointerenter", div_7, (event2) => sendToTextConsole(event2, getLocalized("LA.pilot.mechStorage.select.tooltip"), get$1(actor).uuid)), event("pointerleave", div_7, (event2) => resetTextConsole(event2, get$1(actor).uuid)), append($$anchor3, div_6);
        }, "children"),
        $$slots: { default: !0 }
      });
      var node_4 = sibling(node_3, 2);
      MechStats(node_4, {
        get actor() {
          return get$1(actor);
        },
        get selectedMech() {
          return ownedMechs[get$1(selectedMechIndex)];
        }
      }), template_effect(
        ($0, $1, $2, $3, $4, $5, $6, $7) => {
          set_class(span, `la-selected-mech__active -positionabsolute la-outl-header -bold -textaligncenter -letterspacing1 -widthfull -height5 -lineheight5 la-bckg-darken-2
            ${$0 ?? ""}`), set_attribute(button, "data-uuid", ownedMechs[get$1(selectedMechIndex)].uuid), set_text(text_2, ownedMechs[get$1(selectedMechIndex)].name), set_text(text_3, $1), set_attribute(img, "src", ownedMechs[get$1(selectedMechIndex)].img === "systems/lancer/assets/icons/mech.svg" ? `modules/${id}/assets/nodata.png` : ownedMechs[get$1(selectedMechIndex)].img), set_attribute(img, "alt", $2), set_attribute(div_4, "data-tooltip", $3), set_attribute(div_4, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(div_4, "data-tooltip-direction", TooltipDirection.LEFT), set_class(i_2, `mdi mdi-arrow-right-bold-hexagon-outline ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_class(span_2, `${get$1(themeOverride) ?? ""} la-outl-shadow -bold`), set_text(text_4, ownedMechs[get$1(selectedMechIndex)].system.speed), set_class(button_1, `la-flexrow -widthfull -fontsize13 -positionabsolute -bottom0 
                ${$4 ?? ""}
                ${$5 ?? ""}`), set_attribute(button_1, "data-tooltip", $6), set_attribute(button_1, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(button_1, "data-tooltip-direction", TooltipDirection.DOWN), set_attribute(button_1, "aria-label", $7);
        },
        [
          () => isInactive() ? "la-text-error" : "la-text-system",
          () => {
            var _a2;
            return ((_a2 = ownedMechs[get$1(selectedMechIndex)].system.loadout.frame) == null ? void 0 : _a2.value.system.manufacturer) || getLocalized("LA.placeholder");
          },
          () => getLocalized("LA.placeholder"),
          () => tooltipEnabled ? getSpeedTip() : void 0,
          () => isInactive() ? "cci cci-activate la-text-system" : "cci cci-deactivate la-text-weapon",
          () => qualityMode ? "-glow-prmy la-prmy-primary -glow-prmy-hover" + getGlowColor() : "",
          () => tooltipEnabled ? isInactive() ? activateTip : deactivateTip : void 0,
          () => isInactive() ? activateTip : deactivateTip
        ]
      ), event("pointerenter", button, (event2) => sendToTextConsole(event2, getLocalized("LA.pilot.mechStorage.open.tooltip"), get$1(actor).uuid)), event("pointerleave", button, (event2) => resetTextConsole(event2, get$1(actor).uuid)), event("pointerenter", button_1, (event2) => sendToTextConsole(event2, isInactive() ? getLocalized("LA.pilot.mechStorage.activate.tooltip") : getLocalized("LA.pilot.mechStorage.deactivate.tooltip"), get$1(actor).uuid)), event("pointerleave", button_1, (event2) => resetTextConsole(event2, get$1(actor).uuid)), append($$anchor2, fragment_1);
    }, "consequent_2"), alternate_2 = /* @__PURE__ */ __name(($$anchor2) => {
      const expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.mechStorage.empty.label")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.pilot.mechStorage.empty.subLabel"));
      EmptyBox($$anchor2, {
        get label() {
          return get$1(expression_1);
        },
        get subLabel() {
          return get$1(expression_2);
        }
      });
    }, "alternate_2");
    if_block(node, ($$render) => {
      ownedMechs.length ? $$render(consequent_2) : $$render(alternate_2, !1);
    });
  }
  append($$anchor, fragment), pop();
}
__name(MechStorage, "MechStorage");
delegate(["click"]);
const _PilotSheetBase = class _PilotSheetBase {
  static get mergeOptions() {
    return {
      classes: [
        "la-common la-override__header clipped-alt",
        "lancer sheet actor pilot",
        getCSSSystemTheme()
      ],
      template: TEMPLATE_PATHS.pilotSheetSvelte,
      width: 900,
      height: 800,
      tabs: [
        {
          navSelector: ".la-tabs",
          contentSelector: ".la-content",
          initial: "equipment"
        },
        {
          navSelector: ".la-tabs-secondary",
          contentSelector: ".la-content-secondary",
          initial: "statistics"
        },
        {
          navSelector: ".la-tabs-tertiary",
          contentSelector: ".la-content-tertiary",
          initial: "loadout"
        },
        {
          navSelector: ".la-tabs-quaternary",
          contentSelector: ".la-content-quaternary",
          initial: "dossier"
        }
      ],
      scrollY: [".la-dossier", ".la-mechstorage", ".la-abilities", ".la-bonds", ".la-equipment", ".la-custom", ".la-sidebar__statistics", ".la-sidebar__activity"]
    };
  }
  static setupSheet() {
    var _a;
    const LAPilotSheet = (_a = class extends game.lancer.applications.LancerPilotSheet {
      constructor(...args) {
        super(...args), Hooks.on("laOverrideTheme", (uuid, theme) => {
          uuid === this.actor.uuid && (setThemeKey(this.actor.uuid, theme), this.render());
        }), Hooks.on("laForceRerender", (uuid, callback) => {
          uuid === this.actor.uuid && (this.render(), callback && callback());
        }), Hooks.on("updateActor", (document2, changes) => {
          var _a2, _b;
          document2.uuid === this.actor.uuid && ((_b = (_a2 = changes.prototypeToken) == null ? void 0 : _a2.texture) != null && _b.src) && getActorTokenSync$3(this.actor.uuid) && (setSelectedTokenImage(this.actor.uuid, changes.prototypeToken.texture.src), isValidImageContainer(changes.prototypeToken.texture.src) && this.actor.update({ img: changes.prototypeToken.texture.src }));
        }), Hooks.on("closeSettingsConfig", () => {
          this.render(), setIntroRun(this.actor.uuid, !1);
        });
      }
      static get defaultOptions() {
        return foundry.utils.mergeObject(super.defaultOptions, _PilotSheetBase.mergeOptions);
      }
      activateListeners(html2) {
        super.activateListeners(html2), this.applyTabListener(html2);
      }
      // The more pressing issue is whether or not this 
      // function's is networked and if it's return is internally cached
      async getData() {
        return await super.getData();
      }
      async _injectHTML(html2) {
        super._injectHTML(html2), setThemeKey(this.actor.uuid, getThemeOverride$3(this.actor.uuid)), applyThemeTo(this.element, getThemeKey(this.actor.uuid)), this.mountComponents(html2, dataMap[this.actor.uuid]);
      }
      // (#10)
      // @ts-expect-error We're overriding a function in LancerActorSheet
      _propagateData(formData) {
        super._propagateData(formData), delete formData["prototypeToken.texture.src"];
        const updateToken = getSelectedTokenImage(this.actor.uuid);
        updateToken && (formData["prototypeToken.texture.src"] = updateToken);
      }
      async _replaceHTML(element, html2) {
        super._replaceHTML(element, html2), applyThemeTo(element, getThemeKey(this.actor.uuid)), this.mountComponents(html2, dataMap[this.actor.uuid]), this._restoreScrollPositions(html2);
      }
      mountComponents(html2, data) {
        unregisterTrackedHooks(this.actor.uuid), mount(Header$1, {
          target: html2.find(".la-SVELTE-HEADER")[0],
          props: data
        }), mount(AdvancedSettingsNav, {
          target: html2.find(".la-SVELTE-ADVANCEDNAV")[0],
          props: data
        }), mount(Sidebar, {
          target: html2.find(".la-SVELTE-SIDEBARSTATISTICS")[0],
          props: data
        }), mount(Dossier, {
          target: html2.find(".la-SVELTE-DOSSIER")[0],
          props: data
        }), mount(MechStorage, {
          target: html2.find(".la-SVELTE-MECHSTORAGE")[0],
          props: data
        }), mount(Activity$1, {
          target: html2.find(".la-SVELTE-SIDEBARACTIVITY")[0],
          props: data
        }), mount(Equipment, {
          target: html2.find(".la-SVELTE-EQUIPMENT")[0],
          props: data
        }), mount(Abilities, {
          target: html2.find(".la-SVELTE-ABILITIES")[0],
          props: data
        }), mount(Bond, {
          target: html2.find(".la-SVELTE-BONDS")[0],
          props: data
        }), mount(Custom$1, {
          target: html2.find(".la-SVELTE-CUSTOM")[0],
          props: data
        }), mount(CustomToggle$1, {
          // (#14)
          target: html2.find(".la-tabs-tertiary")[0],
          props: {
            actor: data.actor,
            button: html2.find('.la-tabs-tertiary>[data-tab="custom"]')[0]
          }
        }), mount(AdvancedSettings, {
          target: html2.find(".la-SVELTE-ADVANCED")[0],
          props: data
        }), mount(HaseArray, {
          target: html2.find(".la-SVELTE-HASE")[0],
          props: {
            pilot: data.actor,
            actor: data.actor,
            system: data.system,
            tooltipEnabled: getPilotSheetTooltipEnabled(),
            logging: !0
          }
        });
      }
      applyTabListener(html2) {
        html2.find(".la-nav__island .la-tabs-tertiary>.la-tab").each((_, button) => {
          $(button).on("click", (event2) => {
            const tab = $(event2.currentTarget).data("tab");
            setActiveTab(this.actor.uuid, ActiveTab.Tertiary, tab);
          });
        }), html2.find(".la-tabs>.la-tab").each((_, button) => {
          $(button).on("click", (event2) => {
            const tab = $(event2.currentTarget).data("tab");
            setActiveTab(this.actor.uuid, ActiveTab.Primary, tab);
          });
        }), html2.find(".la-tabs-quaternary>.la-tab").each((_, button) => {
          $(button).on("click", (event2) => {
            const tab = $(event2.currentTarget).data("tab");
            setActiveTab(this.actor.uuid, ActiveTab.Primary, tab);
          });
        }), html2.find(".la-nav-secondary__island>.la-tabs-secondary>.la-tab").each((_, button) => {
          $(button).on("click", (event2) => {
            const tab = $(event2.currentTarget).data("tab");
            setActiveTab(this.actor.uuid, ActiveTab.Secondary, tab);
          });
        });
      }
    }, __name(_a, "LAPilotSheet"), _a);
    foundry.documents.collections.Actors.registerSheet(LancerAlternative.Name, LAPilotSheet, {
      types: ["pilot"],
      // Lancer system actor subtype (registered by the system at runtime)
      label: getLocalized("LA.SHEET.pilot.label"),
      makeDefault: !1
    });
  }
};
__name(_PilotSheetBase, "PilotSheetBase");
let PilotSheetBase = _PilotSheetBase;
var root_6$1 = /* @__PURE__ */ template('<div class="la-flexrow -wrapwrap -widthfull -gap0"><div class="la-flexcol -gap0 -flex1 -widthfull"><!></div> <div class="la-flexcol -gap0 -flex1 -widthfull"><!></div></div>'), root_8$1 = /* @__PURE__ */ template('<div class="la-flexrow -wrapwrap -widthfull -gap0"><div class="la-flexcol -gap0 -flex1 -widthfull"></div> <div class="la-flexcol -gap0 -flex1 -widthfull"></div></div>'), root_5$1 = /* @__PURE__ */ template('<div class="la-flexcol -gap1 -widthfull -fontsize4"><!> <!> <!></div>'), root_15$1 = /* @__PURE__ */ template('<div class="la-flexcol -widthfull -fontface-stylized"><div class="la-flexrow -widthfull"><div class="-width10"></div> <div class="-flex5"><!></div> <div class="-width10"></div></div> <span> </span></div>'), on_change$2 = /* @__PURE__ */ __name((event2, $$props, data) => handleCustomFlagValueInput(event2, $$props.actor, CustomFlagKey.Deployable, data()), "on_change$2"), root_16$1 = /* @__PURE__ */ template('<div class="-widthfull"><div class="la-shortstat la-flexrow la-text-text -fontsize6"><i></i> <div><input class="la-top__input -widthfull -medium -inset la-text-text -fontface-neutral -height4" type="text"> <span class="la-bottom__span"> </span></div></div></div>'), root_14$1 = /* @__PURE__ */ template('<div class="la-flags la-flexcol -gap1 -widthfull"></div>'), root_20$1 = /* @__PURE__ */ template('<details class="la-details -widthfull la-flexcol"><summary class="la-details__summary la-flexrow clipped-bot-alt la-bckg-repcap la-text-header -padding1-l -widthfull"><span class="la-left la-flexrow"><i class="la-icon mdi mdi-card-off-outline -fontsize4 -margin1-lr"></i> <span class="la-name__span -fontsize4"> </span></span></summary></details>'), root$3 = /* @__PURE__ */ template('<div class="la-flexcol -widthfull"><!> <!> <!></div>');
function Detail($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2, collID2 = noop) => {
    CollapseAllButton($$anchor2, {
      get collapseID() {
        return collID2();
      },
      tooltipEnabled,
      get tooltipTheme() {
        return get$1(theme);
      },
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(collapseAllButtonHover, !1);
      }, "onPointerLeave")
    });
  }, "headerOptions"), headerActions = /* @__PURE__ */ __name(($$anchor2) => {
    headerOptions($$anchor2, () => `${get$1(collID)}.actions`);
  }, "headerActions");
  let collapseAllButtonHover = state(!1);
  const logographic = logographicLanguage(), tooltipEnabled = getDeployableSheetTooltipEnabled(), advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState($$props.actor.uuid)), collID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.systems`), customFlagsCollID = /* @__PURE__ */ derived(() => `${$$props.actor.uuid}.detail.customFlags`), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), actions = /* @__PURE__ */ derived(() => getDeployableActions($$props.actor)), customFlagsEmptyTipMain = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.tab.custom.empty.tooltip.0"))), customFlagsEmptyTipAlt = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(formatString(getLocalized("LA.tab.custom.empty.tooltip.1"), getLocalized("LA.tab.custom.flag.sidebarToggle.deployable.label")))), customFlags = /* @__PURE__ */ derived(() => getCustomFlags($$props.actor, CustomFlagKey.Deployable)), visibleCustomFlags = /* @__PURE__ */ derived(() => Object.values(get$1(customFlags)).filter((flag) => flag.showInSidebar));
  function getDeployableActions(deployable) {
    return [
      {
        label: "LA.mech.system.deployable.activate.label",
        tooltip: "LA.mech.system.deployable.activate.tooltip",
        deployableAction: deployable.system.activation
      },
      {
        label: "LA.mech.system.deployable.deactivate.label",
        tooltip: "LA.mech.system.deployable.deactivate.tooltip",
        deployableAction: deployable.system.deactivation
      },
      {
        label: "LA.mech.system.deployable.recall.label",
        tooltip: "LA.mech.system.deployable.recall.tooltip",
        deployableAction: deployable.system.recall
      },
      {
        label: "LA.mech.system.deployable.redeploy.label",
        tooltip: "LA.mech.system.deployable.redeploy.tooltip",
        deployableAction: deployable.system.redeploy
      }
    ].filter((a) => !!a.deployableAction);
  }
  __name(getDeployableActions, "getDeployableActions");
  function sendActionToChat(event2, action2) {
    var _a;
    if (event2.stopPropagation(), (_a = $$props.actor) != null && _a.uuid && action2) {
      let chatData = {
        title: action2.name,
        trigger: action2.trigger,
        effect: action2.detail
      };
      SendUnknownToChatBase.getInstance().startFlow($$props.actor.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendActionToChat, "sendActionToChat");
  function sendDeployableActionToChat(event2, action2, deployable) {
    var _a;
    if (event2.stopPropagation(), (_a = $$props.actor) != null && _a.uuid && action2) {
      const description = `
                <details>
                    <summary>
                    ${getLocalized("LA.mech.system.effect.label")}
                    </summary>
                    ${deployable.system.detail}
                </details>
                <hr>
                <div 
                    class="clipped lancer-header ${CHAT_CARD_ACTIVATION_COLOR_MAP[action2.deployableAction]}"
                    style="
                        padding: 0.25rem;
                    "
                >
                    ${getLocalized(ACTIVATION_LOCALIZE_MAP[action2.deployableAction])}
                </div>
                <div
                    style="
                        padding-top: 0.25rem;
                    "
                >
                ${getLocalized(action2.tooltip)}
                </div>
            `;
      let chatData = { title: deployable.name, description };
      SendUnknownToChatBase.getInstance().startFlow($$props.actor.uuid, chatData);
    } else Logger.error("Tried to call LAS sendToChat without either an actor's UUID or associated object");
  }
  __name(sendDeployableActionToChat, "sendDeployableActionToChat");
  var div = root$3(), node = child(div);
  const expression = /* @__PURE__ */ derived(() => [
    `${$$props.system.detail || get$1(advancedOptions) ? "" : "-displaynone"}`
  ]), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.deployable.effects.label"));
  HeaderMain(node, {
    get rootStyle() {
      return get$1(expression);
    },
    get text() {
      return get$1(expression_1);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
    textStyle: ["-fontsize4 -overflowhidden -upper"],
    borderStyle: ["la-brdr-primary -gap0"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
    }, "extensionTextFunction"),
    get collapseID() {
      return `${get$1(collID) ?? ""}.details`;
    },
    startCollapsed: !0,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.mech.system.effect.label"));
      EffectBox($$anchor2, {
        get name() {
          return get$1(expression_2);
        },
        get editOption() {
          return get$1(advancedOptions);
        },
        editPath: "system.detail",
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps2) => {
          var fragment_3 = comment(), node_1 = first_child(fragment_3);
          html(node_1, () => $$props.system.detail), append($$anchor3, fragment_3);
        }, "children"),
        $$slots: { default: !0 }
      });
    }, "children"),
    $$slots: { default: !0 }
  });
  var node_2 = sibling(node, 2);
  const expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.deployable.actions.label"));
  HeaderMain(node_2, {
    get text() {
      return get$1(expression_3);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
    textStyle: ["-fontsize4 -overflowhidden -upper"],
    borderStyle: ["la-brdr-primary -gap0"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(collapseAllButtonHover)) return `--${getLocalized("LA.collapseAll.extension")}`;
    }, "extensionTextFunction"),
    get collapseID() {
      return `${get$1(collID) ?? ""}.actions`;
    },
    startCollapsed: !0,
    headerContent: headerActions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div_1 = root_5$1(), node_3 = child(div_1);
      const expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.npc.utilities.label"));
      EffectBox(node_3, {
        get name() {
          return get$1(expression_4);
        },
        children: /* @__PURE__ */ __name(($$anchor3, $$slotProps2) => {
          var div_2 = root_6$1(), div_3 = child(div_2), node_4 = child(div_3);
          const expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.rollAttack.label")), expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.rollAttack.tooltip"));
          FlowButton(node_4, {
            style: [
              "clipped-alt la-bckg-secondary -widthfull -overflowhidden -lineheight3"
            ],
            get text() {
              return get$1(expression_5);
            },
            get uuid() {
              return $$props.actor.uuid;
            },
            get flowClass() {
              return FlowClass.Standard;
            },
            flowType: "BasicAttack",
            tooltipEnabled,
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltipDirection() {
              return TooltipDirection.UP;
            },
            get tooltip() {
              return get$1(expression_6);
            }
          });
          var div_4 = sibling(div_3, 2), node_5 = child(div_4);
          const expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.rollDamage.label")), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.flow.rollDamage.tooltip"));
          FlowButton(node_5, {
            style: [
              "clipped la-bckg-secondary -widthfull -overflowhidden -lineheight3"
            ],
            get text() {
              return get$1(expression_7);
            },
            get uuid() {
              return $$props.actor.uuid;
            },
            get flowClass() {
              return FlowClass.Standard;
            },
            flowType: "Damage",
            tooltipEnabled,
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltipDirection() {
              return TooltipDirection.UP;
            },
            get tooltip() {
              return get$1(expression_8);
            }
          }), append($$anchor3, div_2);
        }, "children"),
        $$slots: { default: !0 }
      });
      var node_6 = sibling(node_3, 2);
      {
        var consequent_2 = /* @__PURE__ */ __name(($$anchor3) => {
          const expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.deployable.deployment.label"));
          EffectBox($$anchor3, {
            get name() {
              return get$1(expression_9);
            },
            children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
              var div_5 = root_8$1(), div_6 = child(div_5);
              each(div_6, 21, () => get$1(actions), index, ($$anchor5, action2, index2) => {
                var fragment_5 = comment(), node_7 = first_child(fragment_5);
                {
                  var consequent = /* @__PURE__ */ __name(($$anchor6) => {
                    const expression_10 = /* @__PURE__ */ derived(() => getLocalized(get$1(action2).label)), expression_11 = /* @__PURE__ */ derived(() => [
                      "clipped-alt -widthfull -overflowhidden -lineheight3",
                      ACTIVATION_COLOR_MAP[get$1(action2).deployableAction]
                    ]), expression_12 = /* @__PURE__ */ derived(() => getLocalized(ACTIVATION_LOCALIZE_MAP[get$1(action2).deployableAction])), expression_13 = /* @__PURE__ */ derived(() => `${getLocalized(get$1(action2).tooltip)}<br><br>${getLocalized(ACTIVATION_TOOLTIP_LOCALIZE_MAP[get$1(action2).deployableAction])}`);
                    FlowButton($$anchor6, {
                      get text() {
                        return get$1(expression_10);
                      },
                      get style() {
                        return get$1(expression_11);
                      },
                      get uuid() {
                        return $$props.actor.uuid;
                      },
                      path: "system.lid",
                      get flowClass() {
                        return FlowClass.None;
                      },
                      onClick: /* @__PURE__ */ __name((event2) => sendDeployableActionToChat(event2, get$1(action2), $$props.actor), "onClick"),
                      tooltipEnabled,
                      get tooltipTheme() {
                        return get$1(theme);
                      },
                      get tooltipDirection() {
                        return TooltipDirection.UP;
                      },
                      get tooltipHeader() {
                        return get$1(expression_12);
                      },
                      get tooltip() {
                        return get$1(expression_13);
                      }
                    });
                  }, "consequent");
                  if_block(node_7, ($$render) => {
                    index2 % 2 == 0 && $$render(consequent);
                  });
                }
                append($$anchor5, fragment_5);
              });
              var div_7 = sibling(div_6, 2);
              each(div_7, 21, () => get$1(actions), index, ($$anchor5, action2, index2) => {
                var fragment_7 = comment(), node_8 = first_child(fragment_7);
                {
                  var consequent_1 = /* @__PURE__ */ __name(($$anchor6) => {
                    const expression_14 = /* @__PURE__ */ derived(() => getLocalized(get$1(action2).label)), expression_15 = /* @__PURE__ */ derived(() => [
                      "clipped -widthfull -overflowhidden -lineheight3",
                      ACTIVATION_COLOR_MAP[get$1(action2).deployableAction]
                    ]), expression_16 = /* @__PURE__ */ derived(() => getLocalized(ACTIVATION_LOCALIZE_MAP[get$1(action2).deployableAction])), expression_17 = /* @__PURE__ */ derived(() => `${getLocalized(get$1(action2).tooltip)}<br><br>${getLocalized(ACTIVATION_TOOLTIP_LOCALIZE_MAP[get$1(action2).deployableAction])}`);
                    FlowButton($$anchor6, {
                      get text() {
                        return get$1(expression_14);
                      },
                      get style() {
                        return get$1(expression_15);
                      },
                      get uuid() {
                        return $$props.actor.uuid;
                      },
                      path: "system.lid",
                      get flowClass() {
                        return FlowClass.None;
                      },
                      onClick: /* @__PURE__ */ __name((event2) => sendDeployableActionToChat(event2, get$1(action2), $$props.actor), "onClick"),
                      tooltipEnabled,
                      get tooltipTheme() {
                        return get$1(theme);
                      },
                      get tooltipDirection() {
                        return TooltipDirection.UP;
                      },
                      get tooltipHeader() {
                        return get$1(expression_16);
                      },
                      get tooltip() {
                        return get$1(expression_17);
                      }
                    });
                  }, "consequent_1");
                  if_block(node_8, ($$render) => {
                    index2 % 2 != 0 && $$render(consequent_1);
                  });
                }
                append($$anchor5, fragment_7);
              }), append($$anchor4, div_5);
            }, "children"),
            $$slots: { default: !0 }
          });
        }, "consequent_2");
        if_block(node_6, ($$render) => {
          get$1(actions).length && $$render(consequent_2);
        });
      }
      var node_9 = sibling(node_6, 2);
      const expression_18 = /* @__PURE__ */ derived(() => `${get$1(collID)}.actions.list`);
      ActionBox(node_9, {
        get actions() {
          return $$props.system.actions;
        },
        get collapseID() {
          return get$1(expression_18);
        },
        startCollapsed: !1,
        get uuid() {
          return $$props.actor.uuid;
        },
        get actor() {
          return $$props.actor;
        },
        onClick: sendActionToChat,
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        }
      }), append($$anchor2, div_1);
    }, "children"),
    $$slots: { default: !0 }
  });
  var node_10 = sibling(node_2, 2);
  const expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.subLabel"));
  HeaderMain(node_10, {
    get text() {
      return get$1(expression_19);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
    textStyle: ["-fontsize4 -overflowhidden -upper"],
    borderStyle: ["la-brdr-primary -gap0"],
    get collapseID() {
      return get$1(customFlagsCollID);
    },
    startCollapsed: !0,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var fragment_9 = comment(), node_11 = first_child(fragment_9);
      {
        var consequent_4 = /* @__PURE__ */ __name(($$anchor3) => {
          var div_8 = root_14$1();
          {
            const createFractionBar = /* @__PURE__ */ __name(($$anchor4, data = noop) => {
              var div_9 = root_15$1(), div_10 = child(div_9), div_11 = sibling(child(div_10), 2), node_12 = child(div_11);
              const expression_20 = /* @__PURE__ */ derived(() => getCustomFlagPath(CustomFlagKey.Deployable, data().id, "value"));
              StatusBar(node_12, {
                name: "",
                nameStyle: [logographic ? "-fontsizemedium" : ""],
                get dataName() {
                  return get$1(expression_20);
                },
                get currentValue() {
                  return data().content.value;
                },
                get maxValue() {
                  return data().content.max;
                },
                barStyle: ["la-bckg-custom"],
                barEditStyle: ["la-bckg-custom"],
                textStyle: ["la-text-text"],
                clipPath: "clipped-alt"
              });
              var span = sibling(div_10, 2);
              set_class(span, `-fontsizemedium -upper
                    ${(logographic ? "" : "-bold") ?? ""}`);
              var text2 = child(span);
              template_effect(
                ($0) => {
                  set_attribute(div_11, "style", `--la-flag-custom: ${data().color ?? ""};`), set_attribute(span, "data-tooltip", $0), set_attribute(span, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(span, "data-tooltip-direction", TooltipDirection.UP), set_text(text2, data().name);
                },
                [
                  () => tooltipEnabled && data().tooltip ? TooltipFactory.buildTooltip(data().tooltip) : void 0
                ]
              ), append($$anchor4, div_9);
            }, "createFractionBar"), createValueGlyph = /* @__PURE__ */ __name(($$anchor4, data = noop) => {
              var div_12 = root_16$1(), div_13 = child(div_12), i = child(div_13), div_14 = sibling(i, 2);
              set_class(div_14, `la-flexcol -divider -upper -fontface-stylized -fontsizemedium la-prmy-accent -textaligncenter
                        ${(logographic ? "" : "-bold") ?? ""}`);
              var input = child(div_14);
              input.__change = [on_change$2, $$props, data];
              var span_1 = sibling(input, 2), text_1 = child(span_1);
              template_effect(
                ($0) => {
                  set_class(i, `${(data().icon ? data().icon : "mdi mdi-abacus") ?? ""} -alignselfcenter`), set_attribute(div_14, "data-tooltip", $0), set_attribute(div_14, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(div_14, "data-tooltip-direction", TooltipDirection.UP), set_value(input, data().content.value), set_text(text_1, data().name);
                },
                [
                  () => tooltipEnabled && data().tooltip ? TooltipFactory.buildTooltip(data().tooltip) : void 0
                ]
              ), event("focus", input, (event2) => event2.currentTarget.select()), append($$anchor4, div_12);
            }, "createValueGlyph");
            each(div_8, 21, () => get$1(visibleCustomFlags), (flag) => flag.id, ($$anchor4, flag) => {
              var fragment_10 = comment(), node_13 = first_child(fragment_10);
              {
                var consequent_3 = /* @__PURE__ */ __name(($$anchor5) => {
                  createFractionBar($$anchor5, () => get$1(flag));
                }, "consequent_3"), alternate = /* @__PURE__ */ __name(($$anchor5) => {
                  createValueGlyph($$anchor5, () => get$1(flag));
                }, "alternate");
                if_block(node_13, ($$render) => {
                  get$1(flag).contentType === CustomFlagContentType.Fraction ? $$render(consequent_3) : $$render(alternate, !1);
                });
              }
              append($$anchor4, fragment_10);
            });
          }
          append($$anchor3, div_8);
        }, "consequent_4"), alternate_1 = /* @__PURE__ */ __name(($$anchor3) => {
          var details = root_20$1(), summary = child(details), span_2 = child(summary), span_3 = sibling(child(span_2), 2), text_2 = child(span_3);
          template_effect(
            ($0) => {
              set_attribute(summary, "data-tooltip", tooltipEnabled ? get$1(advancedOptions) ? get$1(customFlagsEmptyTipAlt) : get$1(customFlagsEmptyTipMain) : void 0), set_attribute(summary, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(summary, "data-tooltip-direction", TooltipDirection.UP), set_text(text_2, $0);
            },
            [
              () => getLocalized("LA.tab.custom.empty.label")
            ]
          ), append($$anchor3, details);
        }, "alternate_1");
        if_block(node_11, ($$render) => {
          get$1(visibleCustomFlags).length ? $$render(consequent_4) : $$render(alternate_1, !1);
        });
      }
      append($$anchor2, fragment_9);
    }, "children"),
    $$slots: { default: !0 }
  }), append($$anchor, div), pop();
}
__name(Detail, "Detail");
delegate(["change"]);
var root_1$1 = /* @__PURE__ */ template("<i></i>"), root_2$1 = /* @__PURE__ */ template("<i></i>"), root_6 = /* @__PURE__ */ template("<i></i>"), on_change$1 = /* @__PURE__ */ __name((event2, system) => handleRelativeDataInput(event2, get$1(system).overshield.value), "on_change$1"), on_change_1$1 = /* @__PURE__ */ __name((event2, system) => handleRelativeDataInput(event2, get$1(system).burn), "on_change_1$1"), root$2 = /* @__PURE__ */ template(`<div><div class="la-flexrow la-dropshadow -justifyevenly"><div class="la-flexcol -gap1"><div class="la-flexrow -height4 "></div> <div class="la-flexrow -widthfull -heightfull"><div class="la-stat__island -positionrelative la-dropshadow"><div class="la-flexcol -positionabsolute -top0 -left0 -fontsize13 -heightfull -margin3-t"><div><!></div> <div><!></div> <div><div class="la-flexrow"><i></i> <span> </span></div></div> <div><!></div></div></div> <div class="la-deployable__img -aligncontentcenter
                        ref set"><!></div></div></div> <div class="la-flexrow -padding1-r -fontface-stylized"><div class="la-flexcol -gap1"><div class="la-flexrow -height4 -justifybetween -widthfull"><div class="la-flexrow -gap1"><!> <!> <!> <!></div> <div class="la-flexrow -gap1"></div></div> <div class="-flex1"><div class="la-stats la-flexrow -justifyevenly"><!> <!> <!></div> <div class="la-damage -margin0-lr -margin2-tb"><div class="la-flexrow -gap2"><div class="la-visuals -flex5"><span>&nbsp;</span> <!></div> <div><span data-tooltip-direction="LEFT"> </span> <input type="text" class="la-damage__input la-shadow -medium -inset la-text-text -width7 -heightfull -bordersround-lrt -small -bordersoff" name="system.overshield.value" data-dtype="Number"></div></div> <div class="la-flexrow -gap2"><div class="la-visuals -flex5"><!></div> <div><input type="text" class="la-damage__input la-shadow -medium -inset la-text-text -width7 -heightfull -bordersround-lrt -small -bordersoff" name="system.burn" data-dtype="Number"> <span data-tooltip-direction="LEFT"> </span></div></div></div> <div class="la-stats la-flexrow -justifyevenly"><!> <!> <!></div></div></div></div></div></div>`);
function Stats($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), document2 = /* @__PURE__ */ derived(() => props.document), actor = /* @__PURE__ */ derived(() => props.actor), system = /* @__PURE__ */ derived(() => props.system);
  let advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState(get$1(actor).uuid)), tokenImageLocked = /* @__PURE__ */ derived(() => getTokenImageLock(get$1(actor).uuid)), editingBurn = state(!1), editingShield = state(!1);
  const logographic = logographicLanguage(), tooltipEnabled = getDeployableSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), isInstanced = /* @__PURE__ */ derived(() => get$1(actor).parent && get$1(actor).type === "deployable"), themeOverride = /* @__PURE__ */ derived(() => getBrightness(getThemeKey(get$1(actor).uuid)) === "light" ? "la-text-primary" : "la-text-text"), theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme(get$1(actor).uuid)), sizeTip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.size.tooltip"), `${getLocalized("LA.size.label")} ${get$1(system).stats.size}`)), speedTip = /* @__PURE__ */ derived(() => TooltipFactory.buildTooltip(getLocalized("LA.speed.tooltip"), `${getLocalized("LA.speed.label")} ${get$1(system).stats.speed}`)), shieldTip = TooltipFactory.buildTooltip(getLocalized("LA.overshield.tooltip")), burnTip = TooltipFactory.buildTooltip(getLocalized("LA.burn.tooltip")), tokenErrorTip = TooltipFactory.buildTooltip(getLocalized("LA.edit.image.token.error"));
  onMount(() => {
    setTokenImageLock(get$1(actor).uuid, getActorTokenSync(get$1(actor).uuid));
  });
  function handleEditStat(event2, value, valuePath, mod) {
    switch (event2.stopPropagation(), mod) {
      case EditMode.Subtract:
        get$1(document2).update({ [valuePath]: Math.max(value--, 0) });
        break;
      case EditMode.Add:
        get$1(document2).update({ [valuePath]: value++ });
        break;
    }
  }
  __name(handleEditStat, "handleEditStat");
  function handleEditToken2(event2) {
    event2.stopPropagation(), get$1(tokenImageLocked) ? browseActorImageSync(event2, get$1(actor)) : browseTokenImage(event2, get$1(actor));
  }
  __name(handleEditToken2, "handleEditToken");
  var div = root$2();
  set_class(div, `la-bckg-background la-shadow -medium -inset -widthfull -heightfull
        ${(qualityMode ? "la-bg-scroll" : "la-bg") ?? ""}`);
  var div_1 = child(div), div_2 = child(div_1), div_3 = sibling(child(div_2), 2), div_4 = child(div_3), div_5 = child(div_4), div_6 = child(div_5), node = child(div_6);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var i = root_1$1();
      template_effect(() => {
        set_class(i, `cci cci-size-half ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_attribute(i, "data-tooltip", tooltipEnabled ? get$1(sizeTip) : void 0), set_attribute(i, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i, "data-tooltip-direction", TooltipDirection.RIGHT);
      }), append($$anchor2, i);
    }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor2) => {
      var i_1 = root_2$1();
      template_effect(() => {
        set_class(i_1, `cci cci-size-${get$1(system).stats.size ?? ""} ${get$1(themeOverride) ?? ""} la-outl-shadow`), set_attribute(i_1, "data-tooltip", tooltipEnabled ? get$1(sizeTip) : void 0), set_attribute(i_1, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i_1, "data-tooltip-direction", TooltipDirection.RIGHT);
      }), append($$anchor2, i_1);
    }, "alternate");
    if_block(node, ($$render) => {
      get$1(system).stats.size < 1 ? $$render(consequent) : $$render(alternate, !1);
    });
  }
  var div_7 = sibling(div_6, 2), node_1 = child(div_7);
  const expression = /* @__PURE__ */ derived(() => getLocalized("LA.size.short")), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.size.tooltip"));
  StatComboShort(node_1, {
    icon: "",
    get label() {
      return get$1(expression);
    },
    get value() {
      return get$1(system).stats.size;
    },
    valuePath: "system.stats.size",
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    bottomStyle: [logographic ? "-fontsize3" : ""],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_1);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get editable() {
      return get$1(advancedOptions);
    },
    onPointerClick: handleEditStat
  });
  var div_8 = sibling(div_7, 2), div_9 = child(div_8), i_2 = child(div_9), span = sibling(i_2, 2), text2 = child(span), div_10 = sibling(div_8, 2), node_2 = child(div_10);
  const expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.speed.short")), expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.speed.tooltip"));
  StatComboShort(node_2, {
    icon: "",
    get label() {
      return get$1(expression_2);
    },
    get value() {
      return get$1(system).stats.speed;
    },
    valuePath: "system.stats.speed",
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    bottomStyle: [logographic ? "-fontsize3" : ""],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_3);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get editable() {
      return get$1(advancedOptions);
    },
    onPointerClick: handleEditStat
  });
  var div_11 = sibling(div_4, 2), node_3 = child(div_11);
  ImageVideo(node_3, {
    get actor() {
      return get$1(actor);
    },
    get editDisabled() {
      return get$1(isInstanced);
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    onPointerClick: handleEditToken2
  });
  var div_12 = sibling(div_2, 2), div_13 = child(div_12), div_14 = child(div_13), div_15 = child(div_14), node_4 = child(div_15);
  AdvancedButton(node_4, {
    get uuid() {
      return get$1(actor).uuid;
    },
    style: [
      "-lineheight5 la-prmy-primary",
      qualityMode ? "-glow-prmy-hover" : ""
    ],
    iconStyle: ["-fontsize7"],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltipDirection() {
      return TooltipDirection.UP;
    }
  });
  var node_5 = sibling(node_4, 2);
  {
    var consequent_1 = /* @__PURE__ */ __name(($$anchor2) => {
      LockImageButton($$anchor2, {
        style: `-fontsize4 la-text-text la-prmy-primary
                                ${(qualityMode ? "-glow-prmy-hover" : "") ?? ""}`,
        get actor() {
          return get$1(actor);
        },
        setState: setActorTokenSync,
        tooltipEnabled
      });
    }, "consequent_1");
    if_block(node_5, ($$render) => {
      get$1(advancedOptions) && !get$1(isInstanced) && $$render(consequent_1);
    });
  }
  var node_6 = sibling(node_5, 2);
  {
    var consequent_3 = /* @__PURE__ */ __name(($$anchor2) => {
      var fragment_1 = comment(), node_7 = first_child(fragment_1);
      {
        var consequent_2 = /* @__PURE__ */ __name(($$anchor3) => {
          const expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.edit.image.actor.tooltip"));
          GlyphButton($$anchor3, {
            get flowClass() {
              return FlowClass.None;
            },
            style: [
              "mdi mdi-image-edit -fontsize4 la-text-text la-prmy-primary",
              qualityMode ? "-glow-prmy-hover" : ""
            ],
            onClick: /* @__PURE__ */ __name((event2) => browseActorImage(event2, get$1(actor)), "onClick"),
            tooltipEnabled,
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltip() {
              return get$1(expression_4);
            },
            get tooltipDirection() {
              return TooltipDirection.UP;
            }
          });
        }, "consequent_2");
        if_block(node_7, ($$render) => {
          get$1(tokenImageLocked) || $$render(consequent_2);
        });
      }
      append($$anchor2, fragment_1);
    }, "consequent_3"), alternate_1 = /* @__PURE__ */ __name(($$anchor2) => {
      var i_3 = root_6();
      set_class(i_3, `mdi mdi-creation la-text-text -fontsize4 la-prmy-warning
                                ${(qualityMode ? "-glow-prmy" : "") ?? ""}`), set_attribute(i_3, "data-tooltip", tooltipEnabled ? tokenErrorTip : void 0), template_effect(() => {
        set_attribute(i_3, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(i_3, "data-tooltip-direction", TooltipDirection.DOWN);
      }), append($$anchor2, i_3);
    }, "alternate_1");
    if_block(node_6, ($$render) => {
      get$1(isInstanced) ? $$render(alternate_1, !1) : $$render(consequent_3);
    });
  }
  var node_8 = sibling(node_6, 2);
  {
    var consequent_4 = /* @__PURE__ */ __name(($$anchor2) => {
      ThemeOverrideButton($$anchor2, {
        get uuid() {
          return get$1(actor).uuid;
        },
        style: ["-lineheight5"],
        iconStyle: ["-fontsize4"],
        setOverride: setThemeOverride,
        tooltipEnabled,
        get tooltipTheme() {
          return get$1(theme);
        },
        get tooltipDirection() {
          return TooltipDirection.UP;
        }
      });
    }, "consequent_4");
    if_block(node_8, ($$render) => {
      get$1(advancedOptions) && $$render(consequent_4);
    });
  }
  var div_16 = sibling(div_14, 2), div_17 = child(div_16), node_9 = child(div_17);
  const expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.armor.short")), expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.armor.tooltip"));
  StatComboShort(node_9, {
    icon: "cci cci-role-defender",
    get label() {
      return get$1(expression_5);
    },
    get value() {
      return get$1(system).stats.armor;
    },
    valuePath: "system.stats.armor",
    outerStyle: ["-fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_6);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get editable() {
      return get$1(advancedOptions);
    },
    onPointerClick: handleEditStat
  });
  var node_10 = sibling(node_9, 2);
  const expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.evasion.short")), expression_8 = /* @__PURE__ */ derived(() => getLocalized("LA.evasion.tooltip"));
  StatComboShort(node_10, {
    icon: "cci cci-evasion",
    get label() {
      return get$1(expression_7);
    },
    get value() {
      return get$1(system).stats.evasion;
    },
    valuePath: "system.stats.evasion",
    outerStyle: ["-fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_8);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get editable() {
      return get$1(advancedOptions);
    },
    onPointerClick: handleEditStat
  });
  var node_11 = sibling(node_10, 2);
  const expression_9 = /* @__PURE__ */ derived(() => getLocalized("LA.edefense.short")), expression_10 = /* @__PURE__ */ derived(() => getLocalized("LA.edefense.tooltip"));
  StatComboShort(node_11, {
    icon: "cci cci-edef",
    get label() {
      return get$1(expression_9);
    },
    get value() {
      return get$1(system).stats.edef;
    },
    valuePath: "system.stats.edef",
    outerStyle: ["-fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_10);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get editable() {
      return get$1(advancedOptions);
    },
    onPointerClick: handleEditStat
  });
  var div_18 = sibling(div_17, 2), div_19 = child(div_18), div_20 = child(div_19), node_12 = sibling(child(div_20), 2);
  const expression_11 = /* @__PURE__ */ derived(() => getLocalized("LA.hitpoint.short")), expression_12 = /* @__PURE__ */ derived(() => getLocalized("LA.deployable.hitpointMax.tooltip"));
  StatusBar(node_12, {
    get name() {
      return get$1(expression_11);
    },
    nameStyle: [logographic ? "-fontsizemedium" : ""],
    dataName: "system.hp.value",
    get currentValue() {
      return get$1(system).hp.value;
    },
    get maxValue() {
      return get$1(system).hp.max;
    },
    barStyle: ["la-bckg-bar-health"],
    barEditStyle: ["la-prmy-bar-health"],
    get currentValueSecondary() {
      return get$1(system).overshield.value;
    },
    get maxValueSecondary() {
      return get$1(system).hp.max;
    },
    barStyleSecondary: ["la-bckg-bar-shield -shield"],
    barEditStyleSecondary: ["la-prmy-bar-shield"],
    textStyle: ["la-text-text"],
    clipPath: "clipped",
    get editSecondary() {
      return get$1(editingShield);
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get tooltip() {
      return get$1(expression_12);
    }
  });
  var div_21 = sibling(div_20, 2);
  set_class(div_21, `la-flexcol -divider la-prmy-bar-shield -flex0 -textaligncenter la-prmy-bar-shield
                                    ${(qualityMode ? "-glow-prmy" : "") ?? ""}
                                    ${(logographic ? "-width4ch" : "-width3ch") ?? ""}`);
  var span_1 = child(div_21);
  set_class(span_1, `la-damage__span -heightfull -lineheight3
                                        ${(logographic ? "-fontsizemedium" : "-fontsizesmall") ?? ""}`), set_attribute(span_1, "data-tooltip", tooltipEnabled ? shieldTip : void 0);
  var text_1 = child(span_1), input = sibling(span_1, 2);
  input.__change = [on_change$1, system];
  var div_22 = sibling(div_19, 2), div_23 = child(div_22), node_13 = child(div_23);
  const expression_13 = /* @__PURE__ */ derived(() => getLocalized("LA.heat.label")), expression_14 = /* @__PURE__ */ derived(() => get$1(system).heat.max || get$1(system).hp.max), expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.deployable.heatMax.tooltip"));
  StatusBar(node_13, {
    get name() {
      return get$1(expression_13);
    },
    nameStyle: [logographic ? "-fontsizemedium" : ""],
    dataName: "system.heat.value",
    get currentValue() {
      return get$1(system).heat.value;
    },
    get maxValue() {
      return get$1(system).heat.max;
    },
    barStyle: ["la-bckg-bar-heat"],
    barEditStyle: ["la-prmy-bar-heat"],
    get currentValueSecondary() {
      return get$1(system).burn;
    },
    get maxValueSecondary() {
      return get$1(expression_14);
    },
    barStyleSecondary: ["la-bckg-bar-burn -burn"],
    barEditStyleSecondary: ["la-prmy-bar-burn"],
    textStyle: ["la-text-text"],
    clipPath: "clipped-alt",
    get editSecondary() {
      return get$1(editingBurn);
    },
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get tooltip() {
      return get$1(expression_15);
    }
  });
  var div_24 = sibling(div_23, 2);
  set_class(div_24, `la-flexcol -divider la-prmy-bar-burn -flex0 -textaligncenter la-prmy-bar-burn
                                    ${(qualityMode ? "-glow-prmy" : "") ?? ""}
                                    ${(logographic ? "-width4ch" : "-width3ch") ?? ""}`);
  var input_1 = child(div_24);
  input_1.__change = [on_change_1$1, system];
  var span_2 = sibling(input_1, 2);
  set_class(span_2, `la-damage__span -heightfull -lineheight3
                                        ${(logographic ? "-fontsizemedium" : "-fontsizesmall") ?? ""}`), set_attribute(span_2, "data-tooltip", tooltipEnabled ? burnTip : void 0);
  var text_2 = child(span_2), div_25 = sibling(div_18, 2), node_14 = child(div_25);
  const expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.deployable.hitpointMax.short")), expression_17 = /* @__PURE__ */ derived(() => parseInt(get$1(system).stats.hp)), expression_18 = /* @__PURE__ */ derived(() => [
    "-fontsize6",
    `${get$1(advancedOptions) ? "" : "-displaynone"}`
  ]), expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.deployable.hitpointMax.tooltip"));
  StatComboShort(node_14, {
    icon: "mdi mdi-heart-flash",
    get label() {
      return get$1(expression_16);
    },
    get value() {
      return get$1(expression_17);
    },
    valuePath: "system.stats.hp",
    get outerStyle() {
      return get$1(expression_18);
    },
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_19);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get editable() {
      return get$1(advancedOptions);
    },
    onPointerClick: handleEditStat
  });
  var node_15 = sibling(node_14, 2);
  const expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.save.short")), expression_21 = /* @__PURE__ */ derived(() => getLocalized("LA.save.tooltip"));
  StatComboShort(node_15, {
    icon: "cci cci-save",
    get label() {
      return get$1(expression_20);
    },
    get value() {
      return get$1(system).stats.save;
    },
    valuePath: "system.stats.save",
    outerStyle: ["-fontsize7"],
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_21);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get editable() {
      return get$1(advancedOptions);
    },
    onPointerClick: handleEditStat
  });
  var node_16 = sibling(node_15, 2);
  const expression_22 = /* @__PURE__ */ derived(() => getLocalized("LA.deployable.heatMax.short")), expression_23 = /* @__PURE__ */ derived(() => [
    "-fontsize7",
    `${get$1(advancedOptions) ? "" : "-displaynone"}`
  ]), expression_24 = /* @__PURE__ */ derived(() => getLocalized("LA.deployable.heatMax.tooltip"));
  StatComboShort(node_16, {
    icon: "cci cci-heat",
    get label() {
      return get$1(expression_22);
    },
    get value() {
      return get$1(system).stats.heatcap;
    },
    valuePath: "system.stats.heatcap",
    get outerStyle() {
      return get$1(expression_23);
    },
    innerStyle: [
      "-divider -fontsizemedium la-prmy-accent -textaligncenter",
      logographic ? "" : "-bold"
    ],
    tooltipEnabled,
    get tooltipTheme() {
      return get$1(theme);
    },
    get tooltip() {
      return get$1(expression_24);
    },
    get tooltipDirection() {
      return TooltipDirection.LEFT;
    },
    get editable() {
      return get$1(advancedOptions);
    },
    onPointerClick: handleEditStat
  }), template_effect(
    ($0, $1) => {
      set_class(div_6, get$1(advancedOptions) ? "-displaynone" : ""), set_class(div_7, `${(get$1(advancedOptions) ? "" : "-displaynone") ?? ""} -fontface-stylized`), set_class(div_8, get$1(advancedOptions) ? "-displaynone" : ""), set_attribute(div_9, "data-tooltip", tooltipEnabled ? get$1(speedTip) : void 0), set_attribute(div_9, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(div_9, "data-tooltip-direction", TooltipDirection.RIGHT), set_class(i_2, `mdi mdi-arrow-right-bold-hexagon-outline ${get$1(themeOverride) ?? ""} la-outl-shadow -fontsize8`), set_class(span, `${get$1(themeOverride) ?? ""} la-outl-shadow -fontsize7 -bold`), set_text(text2, get$1(system).stats.speed), set_class(div_10, `${(get$1(advancedOptions) ? "" : "-displaynone") ?? ""} -fontface-stylized`), set_attribute(div_11, "data-uuid", get$1(actor).uuid), set_attribute(span_1, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_text(text_1, $0), set_value(input, get$1(system).overshield.value), set_value(input_1, get$1(system).burn), set_attribute(span_2, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_text(text_2, $1);
    },
    [
      () => getLocalized("LA.overshield.short"),
      () => getLocalized("LA.burn.short")
    ]
  ), event("focus", input, (event2) => {
    event2.currentTarget.select(), set(editingShield, !0);
  }), event("blur", input, () => {
    set(editingShield, !1);
  }), event("focus", input_1, (event2) => {
    event2.currentTarget.select(), set(editingBurn, !0);
  }), event("blur", input_1, () => {
    set(editingBurn, !1);
  }), append($$anchor, div), pop();
}
__name(Stats, "Stats");
delegate(["change"]);
var root$1 = /* @__PURE__ */ template(`<div class="la-flexcol -widthfull -heightfull"><div><div class="la-flexcol -widthfull -heightfull -padding1-lr"><input type="text" class="la-actorname__input la-text-header -upper -fontsize6 -textaligncenter -heightfull" name="name"> <div class="la-flexrow -gap5 la-text-header -widthfull -textaligncenter -padding0-tb"><span class="-upper -fontsize4 -fontface-stylized
                        mech ref set click-open"><!></span></div></div></div> <!></div>`);
function Header($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), system = /* @__PURE__ */ derived(() => props.system), qualityMode = getExtraEffectsEnabled();
  var div = root$1(), div_1 = child(div);
  set_class(div_1, `la-bckg-primary -widthfull -height15
            ${(qualityMode ? "la-bg-scroll-alt" : "la-bg-alt") ?? ""}`);
  var div_2 = child(div_1), input = child(div_2), div_3 = sibling(input, 2), span = child(div_3), node = child(span);
  {
    var consequent = /* @__PURE__ */ __name(($$anchor2) => {
      var text$1 = text();
      template_effect(() => {
        var _a;
        return set_text(text$1, (_a = get$1(system).owner) == null ? void 0 : _a.value.name);
      }), append($$anchor2, text$1);
    }, "consequent"), alternate = /* @__PURE__ */ __name(($$anchor2) => {
      var text_1 = text();
      template_effect(($0) => set_text(text_1, $0), [() => getLocalized("LA.placeholder")]), append($$anchor2, text_1);
    }, "alternate");
    if_block(node, ($$render) => {
      var _a;
      (_a = get$1(system).owner) != null && _a.value ? $$render(consequent) : $$render(alternate, !1);
    });
  }
  var node_1 = sibling(div_1, 2);
  Stats(node_1, spread_props(() => props)), template_effect(
    ($0) => {
      var _a;
      set_value(input, get$1(actor).name), set_attribute(input, "placeholder", $0), set_attribute(span, "data-uuid", (_a = get$1(system).owner) == null ? void 0 : _a.id);
    },
    [() => getLocalized("LA.placeholder")]
  ), append($$anchor, div), pop();
}
__name(Header, "Header");
function Activity($$anchor, $$props) {
  push($$props, !0);
  const props = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy"]), actor = /* @__PURE__ */ derived(() => props.actor), actionLogSaveCollapse = getDeployableSheetLogActionDontSaveCollapse(), actionLogStartCollapsed = getDeployableSheetLogActionStartCollapsed();
  ActionLog($$anchor, {
    get uuid() {
      return get$1(actor).uuid;
    },
    dontSaveCollapse: actionLogSaveCollapse,
    startCollapsed: actionLogStartCollapsed,
    get collapsePrefix() {
      return ActionLogCollapsePrefix.DeployableSheet;
    }
  }), pop();
}
__name(Activity, "Activity");
const headerSecondaryInnerLeftOptions = /* @__PURE__ */ __name(($$anchor) => {
  var i = root_2();
  append($$anchor, i);
}, "headerSecondaryInnerLeftOptions");
var root_1 = /* @__PURE__ */ template("<!> <!>", 1), root_2 = /* @__PURE__ */ template('<i class="mdi mdi-code-json -padding0-lr"></i>'), root_5 = /* @__PURE__ */ template("<i></i>"), on_change = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { name: event2.target.value }), "on_change"), root_9 = /* @__PURE__ */ template('<input type="text" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr">'), on_change_1 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { contentType: event2.target.value }), "on_change_1"), root_10 = /* @__PURE__ */ template('<select class="la-customvalue__select la-text-text -bordersround -small la-brdr-repcap -padding0-lr -widthfull"><option> </option><option> </option></select>'), on_change_2 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2, flag) => handleUpdateCustomFlag($$props.actor, id2(), {
  content: {
    ...flag().content,
    value: Number(event2.target.value)
  }
}), "on_change_2"), on_change_3 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2, flag) => handleUpdateCustomFlag($$props.actor, id2(), {
  content: {
    ...flag().content,
    max: Number(event2.target.value)
  }
}), "on_change_3"), on_change_4 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2, flag) => handleUpdateCustomFlag($$props.actor, id2(), {
  content: {
    ...flag().content,
    min: Number(event2.target.value)
  }
}), "on_change_4"), root_12 = /* @__PURE__ */ template('<div class="la-flexcol -gap0"><span class="-fontsizesmall -upper"> </span> <input type="number" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr"></div> <div class="la-flexcol -gap0"><span class="-fontsizesmall -upper"> </span> <input type="number" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr"></div>', 1), root_11 = /* @__PURE__ */ template('<div class="la-flexrow -gap1"><div class="la-flexcol -gap0"><span class="-fontsizesmall -upper"> </span> <input type="number" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr"></div> <!></div>'), on_change_5 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { showInSidebar: event2.target.checked }), "on_change_5"), root_13 = /* @__PURE__ */ template('<input type="checkbox" class="-widthfull">'), on_change_6 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { color: event2.target.value }), "on_change_6"), root_14 = /* @__PURE__ */ template('<input type="color" class="la-customvalue__input -widthfull">'), on_change_7 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { icon: event2.target.value }), "on_change_7"), root_15 = /* @__PURE__ */ template('<input type="text" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr">'), on_change_8 = /* @__PURE__ */ __name((event2, handleUpdateCustomFlag, $$props, id2) => handleUpdateCustomFlag($$props.actor, id2(), { tooltip: event2.target.value }), "on_change_8"), root_16 = /* @__PURE__ */ template('<input type="text" class="la-customvalue__input la-text-text -bordersround -small la-brdr-repcap -padding0-lr">'), root_19 = /* @__PURE__ */ template('<span class=" -upper"> </span> <input type="text" readonly=""> <span class=" -upper"> </span> <input type="text" readonly="">', 1), root_18 = /* @__PURE__ */ template('<div class="la-combine-grid -horizontal2-auto -aligncenter -gap1 -widthfull"><span class=" -upper"> </span> <input type="text" readonly=""> <!></div>'), root_21 = /* @__PURE__ */ template('<span class=" -upper"> </span> <input type="text" readonly=""> <span class=" -upper"> </span> <input type="text" readonly="">', 1), root_20 = /* @__PURE__ */ template('<div class="la-combine-grid -horizontal2-auto -aligncenter -gap1 -widthfull"><span class=" -upper"> </span> <input type="text" readonly=""> <!></div>'), root_17 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!></div>'), root_8 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"><!> <!> <!> <!> <!> <!> <!> <!></div>'), root_3 = /* @__PURE__ */ template('<div class="la-generated -widthfull -gap1 la-flexcol"></div>'), root = /* @__PURE__ */ template('<div class="la-custom__list la-flexcol -widthfull"><!></div>');
function Custom($$anchor, $$props) {
  push($$props, !0);
  const headerOptions = /* @__PURE__ */ __name(($$anchor2) => {
    var fragment = root_1(), node = first_child(fragment);
    const expression = /* @__PURE__ */ derived(() => [
      "la-text-header la-prmy-header la-scdy-primary -fontsize5 -alignselfcenter",
      qualityMode ? " -glow-prmy -glow-scdy-hover " : "",
      get$1(sortable) ? " mdi mdi-sort-variant-lock-open " : " mdi mdi-sort-variant-lock "
    ]), expression_1 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.sort.tooltip")), expression_2 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.sort.tooltip"));
    GlyphButton(node, {
      type: "button",
      get flowClass() {
        return FlowClass.None;
      },
      get style() {
        return get$1(expression);
      },
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_1);
      },
      get logText() {
        return get$1(expression_2);
      },
      logging: !0,
      onClick: /* @__PURE__ */ __name(() => setCustomFlagsSortable($$props.actor.uuid, !get$1(sortable)), "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(sortButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(sortButtonHover, !1);
      }, "onPointerLeave")
    });
    var node_1 = sibling(node, 2);
    const expression_3 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.add.tooltip")), expression_4 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.add.tooltip"));
    GlyphButton(node_1, {
      type: "button",
      get flowClass() {
        return FlowClass.None;
      },
      style: [
        "mdi mdi-plus-thick la-text-header la-prmy-header la-scdy-primary -fontsize5 -alignselfcenter",
        qualityMode ? " -glow-prmy -glow-scdy-hover " : ""
      ],
      tooltipEnabled,
      get tooltipDirection() {
        return TooltipDirection.UP;
      },
      get tooltipTheme() {
        return get$1(theme);
      },
      get tooltip() {
        return get$1(expression_3);
      },
      get logText() {
        return get$1(expression_4);
      },
      logging: !0,
      onClick: /* @__PURE__ */ __name((event2) => handleAddCustomFlag(event2, $$props.actor), "onClick"),
      onPointerEnter: /* @__PURE__ */ __name(() => {
        set(addButtonHover, !0);
      }, "onPointerEnter"),
      onPointerLeave: /* @__PURE__ */ __name(() => {
        set(addButtonHover, !1);
      }, "onPointerLeave")
    }), append($$anchor2, fragment);
  }, "headerOptions");
  setActorContext($$props.actor);
  let component = state(null), deleteButtonHover = state(!1), addButtonHover = state(!1), sortButtonHover = state(!1);
  const theme = /* @__PURE__ */ derived(() => getCSSDocumentTheme($$props.actor.uuid)), customFlags = /* @__PURE__ */ derived(() => getCustomFlags($$props.actor, CustomFlagKey.Deployable)), flagEntries = /* @__PURE__ */ derived(() => Object.entries(get$1(customFlags))), sortable = /* @__PURE__ */ derived(() => getCustomFlagsSortable($$props.actor.uuid)), tooltipEnabled = getDeployableSheetTooltipEnabled(), qualityMode = getExtraEffectsEnabled(), refCopyTip = TooltipFactory.buildTooltip(getLocalized("LA.tab.custom.flag.ref.tooltip")), enrichCopyTip = TooltipFactory.buildTooltip(getLocalized("LA.tab.custom.flag.enricher.tooltip"));
  function handleAddCustomFlag(_event, actor) {
    addCustomFlag(actor, CustomFlagKey.Deployable);
  }
  __name(handleAddCustomFlag, "handleAddCustomFlag");
  function handleDeleteCustomFlag(event2, actor, id2) {
    event2.stopPropagation(), deleteCustomFlag(actor, CustomFlagKey.Deployable, id2);
  }
  __name(handleDeleteCustomFlag, "handleDeleteCustomFlag");
  function handleUpdateCustomFlag(actor, id2, changes) {
    updateCustomFlag(actor, CustomFlagKey.Deployable, id2, changes);
  }
  __name(handleUpdateCustomFlag, "handleUpdateCustomFlag");
  function handleReorderCustomFlag(_event, dropData, thisData) {
    dropData.type === LADataType.Sorting && reorderCustomFlags($$props.actor, CustomFlagKey.Deployable, dropData.index, thisData.index);
  }
  __name(handleReorderCustomFlag, "handleReorderCustomFlag");
  function getTypeIcon(type) {
    return type == CustomFlagContentType.Fraction ? "mdi-fraction-one-half" : "mdi-numeric";
  }
  __name(getTypeIcon, "getTypeIcon");
  var div = root(), node_2 = child(div);
  const expression_5 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.subLabel"));
  HeaderMain(node_2, {
    get text() {
      return get$1(expression_5);
    },
    headerStyle: [MAIN_HEADER_STYLE, "la-bckg-primary"],
    textStyle: ["la-text-header -fontsize4 -overflowhidden"],
    borderStyle: ["la-brdr-transparent clipped-bot-alt"],
    extensionTextFunction: /* @__PURE__ */ __name(() => {
      if (get$1(addButtonHover)) return `--${getLocalized("LA.tab.custom.add.extension")}`;
      if (get$1(sortButtonHover)) return `--${getLocalized("LA.tab.custom.sort.extension")}`;
    }, "extensionTextFunction"),
    headerContent: headerOptions,
    children: /* @__PURE__ */ __name(($$anchor2, $$slotProps) => {
      var div_1 = root_3();
      each(div_1, 23, () => get$1(flagEntries), ([id2, flag]) => id2, ($$anchor3, $$item, index2) => {
        let id2 = /* @__PURE__ */ __name(() => get$1($$item)[0], "id"), flag = /* @__PURE__ */ __name(() => get$1($$item)[1], "flag");
        const headerSecondaryLeftOptions2 = /* @__PURE__ */ __name(($$anchor4) => {
          var i_1 = root_5();
          template_effect(
            ($0) => set_class(i_1, `mdi -padding0-lr
                ${$0 ?? ""}`),
            [() => getTypeIcon(flag().contentType)]
          ), append($$anchor4, i_1);
        }, "headerSecondaryLeftOptions"), headerSecondaryRightOptions = /* @__PURE__ */ __name(($$anchor4) => {
          const expression_6 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.delete.tooltip")), expression_7 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.delete.tooltip"));
          GlyphButton($$anchor4, {
            type: "button",
            get flowClass() {
              return FlowClass.None;
            },
            style: [
              "mdi mdi-close-thick la-prmy-header la-scdy-primary -fontsize5 -alignselfcenter",
              qualityMode ? " -glow-prmy -glow-scdy-hover " : ""
            ],
            tooltipEnabled,
            get tooltipDirection() {
              return TooltipDirection.UP;
            },
            get tooltipTheme() {
              return get$1(theme);
            },
            get tooltip() {
              return get$1(expression_6);
            },
            get logText() {
              return get$1(expression_7);
            },
            logging: !0,
            onClick: /* @__PURE__ */ __name((event2) => handleDeleteCustomFlag(event2, $$props.actor, id2()), "onClick"),
            onPointerEnter: /* @__PURE__ */ __name(() => {
              set(deleteButtonHover, !0);
            }, "onPointerEnter"),
            onPointerLeave: /* @__PURE__ */ __name(() => {
              set(deleteButtonHover, !1);
            }, "onPointerLeave")
          });
        }, "headerSecondaryRightOptions"), expression_8 = /* @__PURE__ */ derived(() => [get$1(sortable) ? "-padding5-l" : ""]), expression_9 = /* @__PURE__ */ derived(() => [get$1(sortable) ? "" : "-displaynone"]), expression_10 = /* @__PURE__ */ derived(() => ({
          type: LADataType.Sorting,
          index: get$1(index2)
        })), expression_11 = /* @__PURE__ */ derived(() => !get$1(sortable));
        DragDropHandle($$anchor3, {
          get style() {
            return get$1(expression_8);
          },
          get iconStyle() {
            return get$1(expression_9);
          },
          get index() {
            return get$1(index2);
          },
          get root() {
            return get$1(component);
          },
          get data() {
            return get$1(expression_10);
          },
          onDrop: handleReorderCustomFlag,
          deleteDisabled: !0,
          logging: !1,
          get disabled() {
            return get$1(expression_11);
          },
          children: /* @__PURE__ */ __name(($$anchor4, $$slotProps2) => {
            const expression_12 = /* @__PURE__ */ derived(() => flag().name || getLocalized("LA.tab.custom.flag.name.label")), expression_13 = /* @__PURE__ */ derived(() => `custom.${id2()}`);
            HeaderSecondary($$anchor4, {
              get text() {
                return get$1(expression_12);
              },
              headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
              textStyle: [H2_TEXT_SIZE, "-fontface-stylized"],
              borderStyle: ["la-brdr-pilot"],
              extensionTextFunction: /* @__PURE__ */ __name(() => {
                if (get$1(deleteButtonHover)) return `--${getLocalized("LA.tab.custom.delete.extension")}`;
              }, "extensionTextFunction"),
              get collapseID() {
                return get$1(expression_13);
              },
              startCollapsed: !1,
              contentLeft: headerSecondaryLeftOptions2,
              contentRight: headerSecondaryRightOptions,
              children: /* @__PURE__ */ __name(($$anchor5, $$slotProps3) => {
                var div_2 = root_8(), node_3 = child(div_2);
                const expression_14 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.name.label"));
                EffectBox(node_3, {
                  get name() {
                    return get$1(expression_14);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input = root_9();
                    input.__change = [
                      on_change,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(
                      ($0) => {
                        set_value(input, flag().name), set_attribute(input, "placeholder", $0);
                      },
                      [() => getLocalized("LA.namePlaceholder")]
                    ), event("focus", input, (event2) => event2.currentTarget.select()), append($$anchor6, input);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_4 = sibling(node_3, 2);
                const expression_15 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.contentType.label"));
                EffectBox(node_4, {
                  get name() {
                    return get$1(expression_15);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var select = root_10();
                    select.__change = [
                      on_change_1,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ];
                    var option = child(select), option_value = {}, text2 = child(option), option_1 = sibling(option), option_1_value = {}, text_1 = child(option_1);
                    template_effect(
                      ($0, $1) => {
                        option_value !== (option_value = CustomFlagContentType.Value) && (option.value = (option.__value = CustomFlagContentType.Value) == null ? "" : CustomFlagContentType.Value), set_selected(option, flag().contentType === CustomFlagContentType.Value), set_text(text2, $0), option_1_value !== (option_1_value = CustomFlagContentType.Fraction) && (option_1.value = (option_1.__value = CustomFlagContentType.Fraction) == null ? "" : CustomFlagContentType.Fraction), set_selected(option_1, flag().contentType === CustomFlagContentType.Fraction), set_text(text_1, $1);
                      },
                      [
                        () => getLocalized("LA.tab.custom.flag.contentType.value.label"),
                        () => getLocalized("LA.tab.custom.flag.contentType.fraction.label")
                      ]
                    ), append($$anchor6, select);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_5 = sibling(node_4, 2);
                const expression_16 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.content.label"));
                EffectBox(node_5, {
                  get name() {
                    return get$1(expression_16);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var div_3 = root_11(), div_4 = child(div_3), span = child(div_4), text_2 = child(span), input_1 = sibling(span, 2);
                    input_1.__change = [
                      on_change_2,
                      handleUpdateCustomFlag,
                      $$props,
                      id2,
                      flag
                    ];
                    var node_6 = sibling(div_4, 2);
                    {
                      var consequent = /* @__PURE__ */ __name(($$anchor7) => {
                        var fragment_4 = root_12(), div_5 = first_child(fragment_4), span_1 = child(div_5), text_3 = child(span_1), input_2 = sibling(span_1, 2);
                        input_2.__change = [
                          on_change_3,
                          handleUpdateCustomFlag,
                          $$props,
                          id2,
                          flag
                        ];
                        var div_6 = sibling(div_5, 2), span_2 = child(div_6), text_4 = child(span_2), input_3 = sibling(span_2, 2);
                        input_3.__change = [
                          on_change_4,
                          handleUpdateCustomFlag,
                          $$props,
                          id2,
                          flag
                        ], template_effect(
                          ($0, $1) => {
                            set_text(text_3, $0), set_value(input_2, flag().content.max), set_text(text_4, $1), set_value(input_3, flag().content.min);
                          },
                          [
                            () => getLocalized("LA.tab.custom.flag.content.max.label"),
                            () => getLocalized("LA.tab.custom.flag.content.min.label")
                          ]
                        ), event("focus", input_2, (event2) => event2.currentTarget.select()), event("focus", input_3, (event2) => event2.currentTarget.select()), append($$anchor7, fragment_4);
                      }, "consequent");
                      if_block(node_6, ($$render) => {
                        flag().contentType === CustomFlagContentType.Fraction && $$render(consequent);
                      });
                    }
                    template_effect(
                      ($0) => {
                        set_text(text_2, $0), set_value(input_1, flag().content.value);
                      },
                      [
                        () => getLocalized("LA.tab.custom.flag.content.value.label")
                      ]
                    ), event("focus", input_1, (event2) => event2.currentTarget.select()), append($$anchor6, div_3);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_7 = sibling(node_5, 2);
                const expression_17 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.sidebarToggle.deployable.label"));
                EffectBox(node_7, {
                  get name() {
                    return get$1(expression_17);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_4 = root_13();
                    input_4.__change = [
                      on_change_5,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_checked(input_4, flag().showInSidebar)), append($$anchor6, input_4);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_8 = sibling(node_7, 2);
                const expression_18 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.color.label"));
                EffectBox(node_8, {
                  get name() {
                    return get$1(expression_18);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_5 = root_14();
                    input_5.__change = [
                      on_change_6,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_value(input_5, flag().color)), append($$anchor6, input_5);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_9 = sibling(node_8, 2);
                const expression_19 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.icon.label"));
                EffectBox(node_9, {
                  get name() {
                    return get$1(expression_19);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_6 = root_15();
                    set_attribute(input_6, "placeholder", "mdi mdi-abacus"), input_6.__change = [
                      on_change_7,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_value(input_6, flag().icon)), event("focus", input_6, (event2) => event2.currentTarget.select()), append($$anchor6, input_6);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_10 = sibling(node_9, 2);
                const expression_20 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.tooltip.label"));
                EffectBox(node_10, {
                  get name() {
                    return get$1(expression_20);
                  },
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var input_7 = root_16();
                    input_7.__change = [
                      on_change_8,
                      handleUpdateCustomFlag,
                      $$props,
                      id2
                    ], template_effect(() => set_value(input_7, flag().tooltip)), event("focus", input_7, (event2) => event2.currentTarget.select()), append($$anchor6, input_7);
                  }, "children"),
                  $$slots: { default: !0 }
                });
                var node_11 = sibling(node_10, 2);
                const expression_21 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.assist.label")), expression_22 = /* @__PURE__ */ derived(() => `custom.${id2()}.assist`);
                HeaderSecondary(node_11, {
                  get text() {
                    return get$1(expression_21);
                  },
                  headerStyle: [H2_HEADER_STYLE, "la-bckg-pilot"],
                  textStyle: [H2_TEXT_SIZE, "-fontface-stylized"],
                  borderStyle: ["la-brdr-pilot"],
                  get collapseID() {
                    return get$1(expression_22);
                  },
                  startCollapsed: !1,
                  contentLeft: headerSecondaryInnerLeftOptions,
                  children: /* @__PURE__ */ __name(($$anchor6, $$slotProps4) => {
                    var div_7 = root_17(), node_12 = child(div_7);
                    const expression_23 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.ref.label"));
                    EffectBox(node_12, {
                      get name() {
                        return get$1(expression_23);
                      },
                      children: /* @__PURE__ */ __name(($$anchor7, $$slotProps5) => {
                        var div_8 = root_18(), span_3 = child(div_8), text_5 = child(span_3), input_8 = sibling(span_3, 2);
                        set_attribute(input_8, "data-tooltip", tooltipEnabled ? refCopyTip : void 0);
                        var node_13 = sibling(input_8, 2);
                        {
                          var consequent_1 = /* @__PURE__ */ __name(($$anchor8) => {
                            var fragment_5 = root_19(), span_4 = first_child(fragment_5), text_6 = child(span_4), input_9 = sibling(span_4, 2);
                            set_attribute(input_9, "data-tooltip", tooltipEnabled ? refCopyTip : void 0);
                            var span_5 = sibling(input_9, 2), text_7 = child(span_5), input_10 = sibling(span_5, 2);
                            set_attribute(input_10, "data-tooltip", tooltipEnabled ? refCopyTip : void 0), template_effect(
                              ($0, $1, $2, $3, $4) => {
                                set_text(text_6, $0), set_class(input_9, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_9, $2), set_attribute(input_9, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_9, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text_7, $3), set_class(input_10, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_10, $4), set_attribute(input_10, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_10, "data-tooltip-direction", TooltipDirection.DOWN);
                              },
                              [
                                () => getLocalized("LA.tab.custom.flag.content.max.label"),
                                () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                                () => getCustomFlagPath(CustomFlagKey.Deployable, id2(), "max"),
                                () => getLocalized("LA.tab.custom.flag.content.min.label"),
                                () => getCustomFlagPath(CustomFlagKey.Deployable, id2(), "min")
                              ]
                            ), event("pointerenter", input_9, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.ref.tooltip"), $$props.actor.uuid)), event("pointerleave", input_9, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_9, (event2) => event2.currentTarget.select()), event("pointerenter", input_10, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.ref.tooltip"), $$props.actor.uuid)), event("pointerleave", input_10, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_10, (event2) => event2.currentTarget.select()), append($$anchor8, fragment_5);
                          }, "consequent_1");
                          if_block(node_13, ($$render) => {
                            flag().contentType === CustomFlagContentType.Fraction && $$render(consequent_1);
                          });
                        }
                        template_effect(
                          ($0, $1, $2) => {
                            set_text(text_5, $0), set_class(input_8, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                        ${$1 ?? ""}`), set_value(input_8, $2), set_attribute(input_8, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_8, "data-tooltip-direction", TooltipDirection.DOWN);
                          },
                          [
                            () => getLocalized("LA.tab.custom.flag.content.value.label"),
                            () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                            () => getCustomFlagPath(CustomFlagKey.Deployable, id2(), "value")
                          ]
                        ), event("pointerenter", input_8, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.ref.tooltip"), $$props.actor.uuid)), event("pointerleave", input_8, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_8, (event2) => event2.currentTarget.select()), append($$anchor7, div_8);
                      }, "children"),
                      $$slots: { default: !0 }
                    });
                    var node_14 = sibling(node_12, 2);
                    const expression_24 = /* @__PURE__ */ derived(() => getLocalized("LA.tab.custom.flag.enricher.label"));
                    EffectBox(node_14, {
                      get name() {
                        return get$1(expression_24);
                      },
                      children: /* @__PURE__ */ __name(($$anchor7, $$slotProps5) => {
                        var div_9 = root_20(), span_6 = child(div_9), text_8 = child(span_6), input_11 = sibling(span_6, 2);
                        set_attribute(input_11, "data-tooltip", tooltipEnabled ? enrichCopyTip : void 0);
                        var node_15 = sibling(input_11, 2);
                        {
                          var consequent_2 = /* @__PURE__ */ __name(($$anchor8) => {
                            var fragment_6 = root_21(), span_7 = first_child(fragment_6), text_9 = child(span_7), input_12 = sibling(span_7, 2);
                            set_attribute(input_12, "data-tooltip", tooltipEnabled ? enrichCopyTip : void 0);
                            var span_8 = sibling(input_12, 2), text_10 = child(span_8), input_13 = sibling(span_8, 2);
                            set_attribute(input_13, "data-tooltip", tooltipEnabled ? enrichCopyTip : void 0), template_effect(
                              ($0, $1, $2, $3, $4) => {
                                set_text(text_9, $0), set_class(input_12, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_12, $2), set_attribute(input_12, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_12, "data-tooltip-direction", TooltipDirection.DOWN), set_text(text_10, $3), set_class(input_13, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                            ${$1 ?? ""}`), set_value(input_13, $4), set_attribute(input_13, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_13, "data-tooltip-direction", TooltipDirection.DOWN);
                              },
                              [
                                () => getLocalized("LA.tab.custom.flag.content.max.label"),
                                () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                                () => getEnricher($$props.actor.uuid, CustomFlagKey.Deployable, id2(), "max"),
                                () => getLocalized("LA.tab.custom.flag.content.min.label"),
                                () => getEnricher($$props.actor.uuid, CustomFlagKey.Deployable, id2(), "min")
                              ]
                            ), event("pointerenter", input_12, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.enricher.tooltip"), $$props.actor.uuid)), event("pointerleave", input_12, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_12, (event2) => event2.currentTarget.select()), event("pointerenter", input_13, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.enricher.tooltip"), $$props.actor.uuid)), event("pointerleave", input_13, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_13, (event2) => event2.currentTarget.select()), append($$anchor8, fragment_6);
                          }, "consequent_2");
                          if_block(node_15, ($$render) => {
                            flag().contentType === CustomFlagContentType.Fraction && $$render(consequent_2);
                          });
                        }
                        template_effect(
                          ($0, $1, $2) => {
                            set_text(text_8, $0), set_class(input_11, `la-customvalue__input -bordersround -small -padding0-lr -widthfull
                                        ${$1 ?? ""}`), set_value(input_11, $2), set_attribute(input_11, "data-tooltip-class", `clipped-bot la-tooltip ${get$1(theme) ?? ""}`), set_attribute(input_11, "data-tooltip-direction", TooltipDirection.DOWN);
                          },
                          [
                            () => getLocalized("LA.tab.custom.flag.content.value.label"),
                            () => getBrightness(getThemeKey($$props.actor.uuid)) === "light" ? "la-brdr-darken-3 la-text-darken-7 la-bckg-darken-1" : "la-brdr-lighten-3 la-text-lighten-7 la-bckg-lighten-1",
                            () => getEnricher($$props.actor.uuid, CustomFlagKey.Deployable, id2(), "value")
                          ]
                        ), event("pointerenter", input_11, (event2) => sendToTextConsole(event2, getLocalized("LA.tab.custom.flag.enricher.tooltip"), $$props.actor.uuid)), event("pointerleave", input_11, (event2) => resetTextConsole(event2, $$props.actor.uuid)), event("focus", input_11, (event2) => event2.currentTarget.select()), append($$anchor7, div_9);
                      }, "children"),
                      $$slots: { default: !0 }
                    }), append($$anchor6, div_7);
                  }, "children"),
                  $$slots: { default: !0 }
                }), append($$anchor5, div_2);
              }, "children"),
              $$slots: { default: !0 }
            });
          }, "children"),
          $$slots: { default: !0 }
        });
      }), bind_this(div_1, ($$value) => set(component, $$value), () => get$1(component)), append($$anchor2, div_1);
    }, "children"),
    $$slots: { default: !0 }
  }), append($$anchor, div), pop();
}
__name(Custom, "Custom");
delegate(["change"]);
function CustomToggle($$anchor, $$props) {
  push($$props, !0);
  const advancedOptions = /* @__PURE__ */ derived(() => getAdvancedState($$props.actor.uuid));
  user_effect(() => {
    var _a;
    (_a = $$props.button) == null || _a.classList.toggle("-displaynone", !get$1(advancedOptions));
  }), pop();
}
__name(CustomToggle, "CustomToggle");
const _DeployableSheetBase = class _DeployableSheetBase {
  static get mergeOptions() {
    return {
      classes: [
        "la-common la-override__header clipped-alt",
        "lancer sheet actor deployable",
        getCSSSystemTheme()
      ],
      template: TEMPLATE_PATHS.deployableSheetSvelte,
      width: getDeployableSheetWidth() || 500,
      height: getDeployableSheetHeight() || 800,
      tabs: [
        {
          navSelector: ".la-tabs",
          contentSelector: ".la-content",
          initial: "detail"
        }
      ],
      scrollY: [".la-SVELTE-DETAIL", ".la-SVELTE-CUSTOM", ".la-SVELTE-ACTIVITY"]
    };
  }
  static setupSheet() {
    var _a;
    const LADeployableSheet = (_a = class extends game.lancer.applications.LancerDeployableSheet {
      constructor(...args) {
        super(...args), Hooks.on("laOverrideTheme", (uuid, theme) => {
          uuid === this.actor.uuid && (setThemeKey(this.actor.uuid, theme), this.render());
        }), Hooks.on("updateActor", (document2, changes) => {
          var _a2, _b;
          document2.uuid === this.actor.uuid && ((_b = (_a2 = changes.prototypeToken) == null ? void 0 : _a2.texture) != null && _b.src) && getActorTokenSync(this.actor.uuid) && (setSelectedTokenImage(this.actor.uuid, changes.prototypeToken.texture.src), isValidImageContainer(changes.prototypeToken.texture.src) && this.actor.update({ img: changes.prototypeToken.texture.src }));
        }), Hooks.on("closeSettingsConfig", () => {
          this.render();
        });
      }
      static get defaultOptions() {
        return foundry.utils.mergeObject(super.defaultOptions, _DeployableSheetBase.mergeOptions);
      }
      async getData() {
        return await super.getData();
      }
      // (#10)
      // @ts-expect-error We're overriding a function in LancerActorSheet
      _propagateData(formData) {
        super._propagateData(formData), delete formData["prototypeToken.texture.src"];
        const updateToken = getSelectedTokenImage(this.actor.uuid);
        updateToken && (formData["prototypeToken.texture.src"] = updateToken);
      }
      async _injectHTML(html2) {
        super._injectHTML(html2), setThemeKey(this.actor.uuid, getThemeOverride(this.actor.uuid)), applyThemeTo(this.element, getThemeKey(this.actor.uuid)), this.mountComponents(html2, dataMap[this.actor.uuid]);
      }
      async _replaceHTML(element, html2) {
        super._replaceHTML(element, html2), applyThemeTo(element, getThemeKey(this.actor.uuid)), this.mountComponents(html2, dataMap[this.actor.uuid]), this._restoreScrollPositions(html2);
      }
      mountComponents(html2, data) {
        unregisterTrackedHooks(this.actor.uuid), mount(
          Header,
          {
            target: html2.find(".la-SVELTE-HEADER")[0],
            props: data
          }
        ), mount(
          Detail,
          {
            target: html2.find(".la-SVELTE-DETAIL")[0],
            props: data
          }
        ), mount(
          Activity,
          {
            target: html2.find(".la-SVELTE-ACTIVITY")[0],
            props: data
          }
        ), mount(Custom, {
          target: html2.find(".la-SVELTE-CUSTOM")[0],
          props: data
        }), mount(CustomToggle, {
          // (#14)
          target: html2.find(".la-tabs")[0],
          props: {
            actor: data.actor,
            button: html2.find('.la-tabs>[data-tab="custom"]')[0]
          }
        });
      }
    }, __name(_a, "LADeployableSheet"), _a);
    foundry.documents.collections.Actors.registerSheet(LancerAlternative.Name, LADeployableSheet, {
      types: ["deployable"],
      // Lancer system actor subtype (registered by the system at runtime)
      label: getLocalized("LA.SHEET.deployable.label"),
      makeDefault: !1
    });
  }
};
__name(_DeployableSheetBase, "DeployableSheetBase");
let DeployableSheetBase = _DeployableSheetBase;
Hooks.once("init", () => {
  registerHandlebarsHelpers(), registerSettings(), registerCustomFlagEnricher();
});
Hooks.once("setup", async () => {
  preloadTemplates(), setupSheets(), registerFlows();
});
Hooks.once("ready", async () => {
  game.modules.get(LancerAlternative.Name).api = {
    settings: {
      resetMechSheetLocalData,
      resetMechSheetData,
      resetNPCSheetData,
      resetPilotSheetLocalData,
      resetPilotSheetData,
      resetDeployableSheetData
    },
    textLog: {
      sendToTextLog,
      resetTextLog
    },
    flags: {
      getCustomFlags,
      setCustomFlags,
      addCustomFlag,
      updateCustomFlag,
      deleteCustomFlag,
      getCustomFlagPath
    }
  };
});
function registerHandlebarsHelpers() {
  Handlebars.registerHelper("la_logData", logData), Handlebars.registerHelper("la_logConsole", logConsole), Handlebars.registerHelper("la_setDatastore", forwardData), Handlebars.registerHelper("la_getBackgroundStyle", () => getExtraEffectsEnabled() ? "la-bg-scroll" : "la-bg"), Handlebars.registerHelper("la_getBackgroundAltStyle", () => getExtraEffectsEnabled() ? "la-bg-scroll-alt" : "la-bg-alt"), Handlebars.registerHelper("la_getScrollStyle", () => getExtraEffectsEnabled() ? "la-ruler-scroll" : "la-ruler"), Handlebars.registerHelper("la_getAdvancedStyle", (uuid) => getAdvancedState(uuid) ? "" : "-displaynone");
}
__name(registerHandlebarsHelpers, "registerHandlebarsHelpers");
function registerSettings() {
  registerModuleSettings(), registerMechSheetSettings(), registerNPCSheetSettings(), registerPilotSheetSettings(), registerDeployableSheetSettings();
}
__name(registerSettings, "registerSettings");
function registerFlows() {
  const customFlows = [
    SendUnknownToChatBase.getInstance().setupFlow(),
    RunMacroBase.getInstance().setupFlow(),
    SkillTriggerOtherBase.getInstance().setupFlow()
  ], customSteps = [
    ...SendUnknownToChatBase.getInstance().setupFlowSteps(),
    ...RunMacroBase.getInstance().setupFlowSteps(),
    ...SkillTriggerOtherBase.getInstance().setupFlowSteps()
  ], flows = game.lancer.flows;
  for (const flow of customFlows)
    flows.set(flow.name, flow);
  const flowSteps = game.lancer.flowSteps;
  for (const step of customSteps)
    flowSteps.set(step.name, step);
  Logger.log(`Registered flows: ${customFlows.map((flow) => flow.name).join(", ")}`), Logger.log(`Registered steps: ${customSteps.map((flowStep) => flowStep.name).join(", ")}`);
}
__name(registerFlows, "registerFlows");
function setupSheets() {
  MechSheetBase.setupSheet(), NPCSheetBase.setupSheet(), PilotSheetBase.setupSheet(), DeployableSheetBase.setupSheet();
}
__name(setupSheets, "setupSheets");
//# sourceMappingURL=lancer-alternative-sheets.mjs.map
