import { k as kebabToCamel, F as FontFamilyOptions, a as appendToHead, L as LisioStyleSheetController, d as defautValueOfNumericParameters, b as LisioNumericParameterNames, c as LisioStringParameterNames, e as LisioBooleanParameterNames, f as LisioBlurController, l as lisioGetInitLang, g as convertTabstoHide, h as domainFromUrl, i as LisioTranslationController, j as LisioLightMessageManager, m as LisioMessageReceivedName, n as LisioShadowRootController, o as isTouchDeviceLisio, p as isInViewport, q as decodeHTMLEntity, r as escapeRegexSpecialChars, T as ThemeOptions, G as GlobalContext } from "./lisio-popin-factory-X1jIIGTD.js";
import "./lisio-config-BrvJH5QT.js";
import { L as LisioBroadcastChannelController, a as LisioBroadcastChannelNames } from "./lisio-broadcast-channel-controller-Deuub9SH.js";
import "../lisioinit.js";
var LisioCSSProperties = /* @__PURE__ */ ((LisioCSSProperties2) => {
  LisioCSSProperties2["FONT_SIZE"] = "font-size";
  LisioCSSProperties2["LINE_HEIGHT"] = "line-height";
  LisioCSSProperties2["WORD_SPACING"] = "word-spacing";
  LisioCSSProperties2["LETTER_SPACING"] = "letter-spacing";
  LisioCSSProperties2["OVERFLOW_WRAP"] = "overflow-wrap";
  LisioCSSProperties2["WORD_BREAK"] = "word-break";
  LisioCSSProperties2["HYPHENS"] = "hyphens";
  LisioCSSProperties2["FONT_FAMILY"] = "font-family";
  LisioCSSProperties2["FILTER"] = "filter";
  LisioCSSProperties2["PADDING_RIGHT"] = "padding-right";
  LisioCSSProperties2["PADDING_LEFT"] = "padding-left";
  LisioCSSProperties2["PADDING_TOP"] = "padding-top";
  LisioCSSProperties2["PADDING_BOTTOM"] = "padding-bottom";
  LisioCSSProperties2["PADDING"] = "padding";
  LisioCSSProperties2["BORDER"] = "border";
  LisioCSSProperties2["DISPLAY"] = "display";
  LisioCSSProperties2["BACKGROUND"] = "background";
  LisioCSSProperties2["BACKGROUND_COLOR"] = "background-color";
  LisioCSSProperties2["COLOR"] = "color";
  LisioCSSProperties2["BOX_SHADOW"] = "box-shadow";
  LisioCSSProperties2["_WEBKIT_TEXT_FILL_COLOR"] = "-webkit-text-fill-color";
  LisioCSSProperties2["ZOOM"] = "zoom";
  LisioCSSProperties2["BORDER_COLOR"] = "border-color";
  LisioCSSProperties2["BACKGROUND_IMAGE"] = "background-image";
  LisioCSSProperties2["TEXT_ALIGN"] = "text-align";
  LisioCSSProperties2["TRANSITION_DURATION"] = "transition-duration";
  LisioCSSProperties2["ANIMATION_DURATION"] = "animation-duration";
  LisioCSSProperties2["ANIMATION"] = "animation";
  LisioCSSProperties2["TRANSITION"] = "transition";
  LisioCSSProperties2["POSITION"] = "position";
  LisioCSSProperties2["TOP"] = "top";
  LisioCSSProperties2["Z_INDEX"] = "z-index";
  LisioCSSProperties2["CURSOR"] = "cursor";
  LisioCSSProperties2["MIN_HEIGHT"] = "min-height";
  LisioCSSProperties2["TRANSFORM"] = "transform";
  LisioCSSProperties2["MARGIN_LEFT"] = "margin-left";
  return LisioCSSProperties2;
})(LisioCSSProperties || {});
class LisioAdapter {
  findOldSelector(elementToCheck, style) {
    const reg = new RegExp(`lisio-${style}-\\w+`, "g");
    const regExecResults = reg.exec(
      elementToCheck.className
    );
    const oldSelector = regExecResults == void 0 ? "" : regExecResults[0];
    return oldSelector;
  }
  /**
   * Abstract method
   * @param {HTMLElement} element -
   * @param {Map<CSSProperties, string>} properties -
   * @returns Returns nothing
   */
  saveInAttributes(element, properties) {
    for (const [property, value] of properties.entries()) {
      element.dataset[kebabToCamel(`lisio-${property}`)] = value;
    }
  }
}
class LisioFontFamilyAdapter extends LisioAdapter {
  _correspondingFonts = /* @__PURE__ */ new Map([
    ["default", "default"],
    [FontFamilyOptions.ANDIKA, "Andika"],
    [FontFamilyOptions.ARIAL, "Arial"],
    [FontFamilyOptions.COMIC_NEUE, "Comic Neue"],
    [FontFamilyOptions.INCLUSIVE_SANS, "Inclusive Sans"],
    [FontFamilyOptions.LUCIOLE, "Luciole"],
    [FontFamilyOptions.OPEN_DYSLEXIC, "Open Dyslexic"]
  ]);
  _fontFiles = /* @__PURE__ */ new Map([
    [FontFamilyOptions.ANDIKA, "andika"],
    [FontFamilyOptions.COMIC_NEUE, "comic-neue"],
    [FontFamilyOptions.INCLUSIVE_SANS, "inclusive-sans"],
    [FontFamilyOptions.LUCIOLE, "luciole"],
    [FontFamilyOptions.OPEN_DYSLEXIC, "open-dyslexic"]
  ]);
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {string} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(walker, value) {
    const convertedValue = this._correspondingFonts.get(value);
    if (convertedValue != void 0) {
      const fontFile = this._fontFiles.get(value);
      if (fontFile != void 0) {
        {
          if (document.querySelector(`link[href*="${fontFile}.css"]`) == void 0) {
            const link = document.createElement("link");
            link.rel = "stylesheet";
            link.href = `${"https://env-preprod-solution.lisio.fr"}/solution/dist-site/css/${fontFile}.css`;
            appendToHead(link);
          }
        }
      }
      for (const tag of walker.tags.values()) {
        if (tag.localName != "option") {
          this.adaptFunction(tag, convertedValue);
        }
      }
      const formTags = document.body.querySelectorAll(
        "input, select, textarea, optgroup, i"
      );
      for (const formTag of formTags) {
        this.adaptFunction(formTag, convertedValue);
      }
      LisioStyleSheetController.current.removeRule(".lisio-fonts");
      LisioStyleSheetController.current.removeRule(".lisio-fonts *");
      if (convertedValue !== "default") {
        LisioStyleSheetController.current.insertRule(
          ".lisio-fonts",
          /* @__PURE__ */ new Map([[LisioCSSProperties.FONT_FAMILY, convertedValue]])
        );
        LisioStyleSheetController.current.insertRule(
          ".lisio-fonts *",
          /* @__PURE__ */ new Map([[LisioCSSProperties.FONT_FAMILY, convertedValue]])
        );
      }
    }
  }
  adaptFunction(element, value) {
    if (typeof element.className === "string") {
      if (value != "default" && element.tagName != "I" && !element.className.includes("material-icons") && !element.className.includes("material-symbols") && !element.className.includes("glyphicon") && !element.className.includes("fa-") && !element.className.includes("AEfont-") && !element.className.includes("icon")) {
        element.classList.add(`lisio-fonts`);
        LisioStyleSheetController.current.replaceImportantInStyleAttribute(
          [LisioCSSProperties.FONT_FAMILY],
          element
        );
        if (value == FontFamilyOptions.OPEN_DYSLEXIC && !element.getAttribute("lisio-already-min") && element.localName != "strong") {
          const fontSize = parseInt(
            window.getComputedStyle(element).fontSize
          );
          if (fontSize > 20) {
            const size = Math.floor(fontSize * 0.75);
            LisioStyleSheetController.current.insertRule(
              `.lisio-font-size-dys-${size}`,
              /* @__PURE__ */ new Map([
                [LisioCSSProperties.FONT_SIZE, `${size}px`]
              ])
            );
            element.classList.add(`lisio-font-size-dys-${size}`);
            element.setAttribute("lisio-already-min", "true");
          }
        } else if (value != FontFamilyOptions.OPEN_DYSLEXIC && element.getAttribute("lisio-already-min") && element.localName != "strong") {
          const classToRemove = Array.from(element.classList).find(
            (className) => className.startsWith("lisio-font-size-dys-")
          );
          if (classToRemove) {
            element.classList.remove(classToRemove);
          }
          element.removeAttribute("lisio-already-min");
        }
      } else {
        element.classList.remove(`lisio-fonts`);
        const classToRemove = Array.from(element.classList).find(
          (className) => className.startsWith("lisio-font-size-dys-")
        );
        if (classToRemove) {
          element.classList.remove(classToRemove);
        }
        element.removeAttribute("lisio-already-min");
      }
    }
  }
}
class LisioFontStyleAdapter extends LisioAdapter {
  _extraProperties = /* @__PURE__ */ new Map([
    [LisioCSSProperties.OVERFLOW_WRAP, "break-word"],
    [LisioCSSProperties.WORD_BREAK, "break-word"],
    [LisioCSSProperties.HYPHENS, "auto"]
  ]);
  _fontStyle;
  /**
   * Constructor of class {@link Adapter | Adapter}
   * @param {LisioCSSProperties.FONT_SIZE | LisioCSSProperties.LETTER_SPACING | LisioCSSProperties.LINE_HEIGHT | LisioCSSProperties.WORD_SPACING} fontStyle - Name of font style to modify
   */
  constructor(fontStyle) {
    super();
    this._fontStyle = fontStyle;
  }
  fontStyleCalculator(adapter, element, value) {
    if (defautValueOfNumericParameters.get(adapter) === value) {
      delete element.dataset[kebabToCamel(`lisio-${this._fontStyle}`)];
      if (this._fontStyle == "font-size") {
        delete element.dataset.lisioLineHeight;
      }
      return -1;
    } else {
      let currentValue = element.dataset[kebabToCamel(`lisio-${this._fontStyle}`)];
      const stylesToSave = /* @__PURE__ */ new Map();
      let currentNumericValue;
      if (currentValue == null) {
        const computedStyle = window.getComputedStyle(element);
        currentValue = computedStyle.getPropertyValue(this._fontStyle);
        if (currentValue == "normal") {
          if (this._fontStyle == "line-height") {
            currentNumericValue = Number.parseFloat(computedStyle.getPropertyValue("font-size")) * 1.2;
          } else if (this._fontStyle == "letter-spacing") {
            currentNumericValue = 2;
          } else if (this._fontStyle == "word-spacing") {
            currentNumericValue = Number.parseFloat(computedStyle.getPropertyValue("font-size")) * 1.25;
          }
        } else {
          currentNumericValue = Number.parseFloat(currentValue);
          if (currentNumericValue === 0 && this._fontStyle == "word-spacing") {
            currentNumericValue = 1;
          }
        }
        if (currentNumericValue != void 0) {
          stylesToSave.set(this._fontStyle, currentNumericValue.toString());
        }
      } else {
        currentNumericValue = Number.parseFloat(currentValue);
      }
      let adpatedValue = -1;
      if (currentNumericValue != void 0) {
        if (this._fontStyle == "font-size") {
          if (currentNumericValue < 14) {
            adpatedValue = Math.ceil(currentNumericValue + 5 * value);
          } else if (currentNumericValue < 20) {
            adpatedValue = Math.ceil(currentNumericValue + 3.5 * value);
          } else {
            adpatedValue = Math.ceil(currentNumericValue + 3 * value);
          }
          stylesToSave.set(
            LisioCSSProperties.LINE_HEIGHT,
            Math.ceil(adpatedValue * 1.2).toString()
          );
        } else {
          adpatedValue = Math.ceil(currentNumericValue * value);
        }
      }
      if (element.dataset[kebabToCamel(`lisio-${this._fontStyle}`)] == void 0) {
        this.saveInAttributes(element, stylesToSave);
      }
      return adpatedValue;
    }
  }
  fontStyleCalculatorApply(elementToCheck, value) {
    LisioStyleSheetController.current.replaceImportantInStyleAttribute(
      [this._fontStyle],
      elementToCheck
    );
    const oldSelector = this.findOldSelector(elementToCheck, this._fontStyle);
    if (oldSelector != "") {
      elementToCheck.classList.remove(oldSelector);
    }
    if (value === -1) {
      LisioStyleSheetController.current.removeRule(oldSelector);
      if (this._fontStyle === LisioCSSProperties.LINE_HEIGHT) {
        elementToCheck.classList.remove("lisio-lh-priority");
      }
    } else {
      const newSelector = `lisio-${this._fontStyle}-${value}`;
      elementToCheck.classList.add(newSelector);
      if (this._fontStyle === LisioCSSProperties.LINE_HEIGHT) {
        elementToCheck.classList.add("lisio-lh-priority");
      }
      this._extraProperties.set(this._fontStyle, `${value.toString()}px`);
      LisioStyleSheetController.current.insertOrReplaceRule(
        this._extraProperties,
        `.${newSelector}${this._fontStyle === LisioCSSProperties.LINE_HEIGHT ? ".lisio-lh-priority" : ""}`,
        `.${oldSelector}`
      );
    }
  }
}
class LisioFontSizeAdapter extends LisioFontStyleAdapter {
  constructor() {
    super(LisioCSSProperties.FONT_SIZE);
  }
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {number} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(walker, value) {
    for (const tag of walker.tags.values()) {
      if (tag.localName != "option") {
        this.adaptFunction(tag, value);
      }
    }
    const formTags = document.body.querySelectorAll(
      "input, select, textarea, optgroup, i"
    );
    for (const formTag of formTags) {
      this.adaptFunction(formTag, value);
    }
  }
  adaptFunction(element, value) {
    if (defautValueOfNumericParameters.get(LisioNumericParameterNames.FONT_SIZE) === value) {
      const defaultValue = element.dataset.lisioFontSize;
      if (defaultValue == void 0) {
        return;
      }
    }
    value = this.fontStyleCalculator(LisioNumericParameterNames.FONT_SIZE, element, value);
    const extraPropertyValue = `${value * 1.5}px`;
    if (this._extraProperties.get(LisioCSSProperties.LINE_HEIGHT) !== extraPropertyValue) {
      this._extraProperties.set(
        LisioCSSProperties.LINE_HEIGHT,
        extraPropertyValue
      );
    }
    this.fontStyleCalculatorApply(element, value);
  }
}
class LisioLetterSpacingAdapter extends LisioFontStyleAdapter {
  constructor() {
    super(LisioCSSProperties.LETTER_SPACING);
  }
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {number} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(walker, value) {
    for (const tag of walker.tags.values()) {
      if (tag.localName != "option") {
        this.adaptFunction(tag, value);
      }
    }
    const formTags = document.body.querySelectorAll("input, textarea, i");
    for (const formTag of formTags) {
      this.adaptFunction(formTag, value);
    }
  }
  adaptFunction(element, value) {
    if (value === defautValueOfNumericParameters.get(LisioNumericParameterNames.LETTER_SPACING)) {
      if (element.dataset.lisioLetterSpacing == void 0) {
        return;
      }
    }
    const adaptedValue = this.fontStyleCalculator(LisioNumericParameterNames.LETTER_SPACING, element, value);
    this.fontStyleCalculatorApply(element, adaptedValue);
  }
}
class LisioLineHeightAdapter extends LisioFontStyleAdapter {
  constructor() {
    super(LisioCSSProperties.LINE_HEIGHT);
  }
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {string} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(walker, value) {
    for (const tag of walker.tags.values()) {
      if (tag.localName != "option") {
        this.adaptFunction(tag, value);
      }
    }
    const formTags = document.body.querySelectorAll("i");
    for (const formTag of formTags) {
      this.adaptFunction(formTag, value);
    }
  }
  adaptFunction(element, value) {
    if (value === defautValueOfNumericParameters.get(LisioNumericParameterNames.LINE_HEIGHT)) {
      if (element.dataset.lisioLineHeight == void 0) {
        return;
      }
    }
    const adaptedValue = this.fontStyleCalculator(LisioNumericParameterNames.LINE_HEIGHT, element, value);
    this.fontStyleCalculatorApply(element, adaptedValue);
  }
}
class LisioTextAlignAdapter extends LisioAdapter {
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {string} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(walker, value) {
    for (const tag of walker.tags.values()) {
      this.adaptFunction(tag, value);
    }
    if (value === "default") {
      LisioStyleSheetController.current.removeRule(".lisio-align");
    } else {
      LisioStyleSheetController.current.insertOrReplaceRule(
        /* @__PURE__ */ new Map([
          [LisioCSSProperties.TEXT_ALIGN, value]
        ]),
        ".lisio-align",
        ".lisio-align"
      );
    }
  }
  adaptFunction(element, value) {
    LisioStyleSheetController.current.replaceImportantInStyleAttribute(
      [LisioCSSProperties.TEXT_ALIGN],
      element
    );
    if (element.textContent?.trim() != "" && element.localName != "script" && element.localName != "style") {
      if (value === "default") {
        element.classList.remove(`lisio-align`);
      } else {
        element.classList.add(`lisio-align`);
      }
    }
  }
}
class LisioWordSpacingAdapter extends LisioFontStyleAdapter {
  constructor() {
    super(LisioCSSProperties.WORD_SPACING);
  }
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {number} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(walker, value) {
    for (const tag of walker.tags.values()) {
      if (tag.localName != "option") {
        this.adaptFunction(tag, value);
      }
    }
    const formTags = document.body.querySelectorAll("input, textarea, i");
    for (const formTag of formTags) {
      this.adaptFunction(formTag, value);
    }
  }
  adaptFunction(element, value) {
    if (value === defautValueOfNumericParameters.get(LisioNumericParameterNames.WORD_SPACING)) {
      if (element.dataset.lisioWordSpacing == void 0) {
        return;
      }
    }
    const adaptedValue = this.fontStyleCalculator(LisioNumericParameterNames.WORD_SPACING, element, value);
    this.fontStyleCalculatorApply(element, adaptedValue);
  }
}
class LisioBiggerClickAdapter extends LisioAdapter {
  _mouseEnterHandlerBind = this.mouseEnterHandler.bind(this);
  _mouseLeaveHandlerBind = this.mouseLeaveHandler.bind(this);
  _numericValue = 0;
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {string} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(_, value) {
    const elements = document.body.querySelectorAll(
      "input, button, a, select, textarea"
    );
    for (const element of elements) {
      this._numericValue = value;
      this.adaptFunction(element, value);
    }
  }
  adaptFunction(element, value) {
    const prefix = "lisio-bigger-";
    let paddingT = 0;
    let paddingR = 0;
    let paddingB = 0;
    let paddingL = 0;
    if (value === 0) {
      element.removeEventListener("mouseenter", this._mouseEnterHandlerBind);
      element.removeEventListener("mouseleave", this._mouseLeaveHandlerBind);
      const classesToRemove = Array.from(element.classList).filter(
        (cssClass) => cssClass.includes(prefix)
      );
      for (const classToRemove of classesToRemove) {
        LisioStyleSheetController.current.removeRule(classToRemove);
        element.classList.remove(classToRemove);
      }
    } else {
      const classToRemove = Array.from(element.classList).find(
        (cssClass) => cssClass.includes(prefix)
      );
      if (classToRemove != void 0) {
        element.classList.remove(classToRemove);
      }
      if (element.dataset.lisioBigger == null) {
        const { paddingTop, paddingRight, paddingBottom, paddingLeft } = window.getComputedStyle(element);
        paddingT = Number.parseInt(paddingTop);
        paddingR = Number.parseInt(paddingRight);
        paddingB = Number.parseInt(paddingBottom);
        paddingL = Number.parseInt(paddingLeft);
      } else {
        const paddings = element.dataset.lisioBigger.split(" ");
        paddingT = Number.parseInt(paddings[0]);
        paddingR = Number.parseInt(paddings[1]);
        paddingB = Number.parseInt(paddings[2]);
        paddingL = Number.parseInt(paddings[3]);
      }
      element.dataset.lisioBigger = `${paddingT} ${paddingR} ${paddingB} ${paddingL}`;
      paddingT = Math.ceil(paddingT + 5 * value);
      paddingR = Math.ceil(paddingR + 5 * value);
      paddingB = Math.ceil(paddingB + 5 * value);
      paddingL = Math.ceil(paddingL + 5 * value);
      element.addEventListener("mouseenter", this._mouseEnterHandlerBind);
      element.addEventListener("mouseleave", this._mouseLeaveHandlerBind);
      LisioStyleSheetController.current.replaceImportantInStyleAttribute(
        [
          LisioCSSProperties.PADDING,
          LisioCSSProperties.PADDING_TOP,
          LisioCSSProperties.PADDING_RIGHT,
          LisioCSSProperties.PADDING_BOTTOM,
          LisioCSSProperties.PADDING_LEFT
        ],
        element
      );
      const selector = `${paddingT}${paddingR}${paddingB}${paddingL}`;
      const propertiesToAdd = /* @__PURE__ */ new Map([
        [
          LisioCSSProperties.PADDING,
          `${paddingT}px ${paddingR}px ${paddingB}px ${paddingL}px`
        ],
        [LisioCSSProperties.BORDER, "5px solid blue"]
      ]);
      LisioStyleSheetController.current.insertRule(
        `.lisio-bigger-${selector}`,
        propertiesToAdd
      );
      propertiesToAdd.set(LisioCSSProperties.DISPLAY, "inline-block");
      LisioStyleSheetController.current.insertRule(
        `.lisio-bigger-display-${selector}`,
        propertiesToAdd
      );
    }
  }
  mouseEnterHandler(event) {
    if (event.target instanceof HTMLElement) {
      const paddings = event.target?.dataset.lisioBigger?.split(" ");
      if (paddings != void 0) {
        const paddingT = parseInt(paddings[0]);
        const paddingR = parseInt(paddings[1]);
        const paddingB = parseInt(paddings[2]);
        const paddingL = parseInt(paddings[3]);
        const selectorValue = `${Math.ceil(
          paddingT + 5 * this._numericValue
        )}${Math.ceil(paddingR + 5 * this._numericValue)}${Math.ceil(
          paddingB + 5 * this._numericValue
        )}${Math.ceil(paddingL + 5 * this._numericValue)}`;
        if (window.getComputedStyle(event.target).display == "inline") {
          event.target.classList.add(`lisio-bigger-display-${selectorValue}`);
        } else {
          event.target.classList.add(`lisio-bigger-${selectorValue}`);
        }
      }
    }
  }
  mouseLeaveHandler(event) {
    if (event.target instanceof HTMLElement) {
      const paddings = event.target?.dataset.lisioBigger?.split(" ");
      if (paddings != void 0) {
        const paddingT = parseInt(paddings[0]);
        const paddingR = parseInt(paddings[1]);
        const paddingB = parseInt(paddings[2]);
        const paddingL = parseInt(paddings[3]);
        const selectorValue = `${Math.ceil(
          paddingT + 5 * this._numericValue
        )}${Math.ceil(paddingR + 5 * this._numericValue)}${Math.ceil(
          paddingB + 5 * this._numericValue
        )}${Math.ceil(paddingL + 5 * this._numericValue)}`;
        event.target.classList.remove(`lisio-bigger-${selectorValue}`);
        event.target.classList.remove(`lisio-bigger-display-${selectorValue}`);
      }
    }
  }
}
function lisioActiveResponseMessageHandler(datas) {
  const { value, isConfigured } = JSON.parse(datas);
  this.popin?.refreshLabel(value, isConfigured);
  this.setDisableBand(value);
  if (!value && isConfigured) {
    window.dispatchEvent(new CustomEvent("lisio-disabled"));
  }
}
function lisioFeatureMessageHandler(datas) {
  const {
    feature,
    value,
    defaultValue,
    isReallyActive,
    isConfigured
  } = JSON.parse(datas);
  if ([
    LisioStringParameterNames.UNDERLINE_RED,
    LisioStringParameterNames.UNDERLINE_GREEN,
    LisioStringParameterNames.UNDERLINE_BLUE
  ].includes(feature) && !(this.isBookPage || this.isReadingMode)) {
    return;
  }
  const currentFeatureValue = this.params.params.get(feature);
  if (this.textTreeWalker.texts.size == 0) {
    this.textTreeWalker.getTextes();
  }
  if (currentFeatureValue === value || feature !== LisioBooleanParameterNames.IS_ACTIVE && currentFeatureValue == void 0 && currentFeatureValue === defaultValue) {
    return;
  }
  if (feature === LisioBooleanParameterNames.IS_ACTIVE) {
    this.popin?.refreshLabel(isReallyActive, isConfigured);
    this.setDisableBand(isReallyActive);
    if (value) {
      this.apply(false);
      this.mutationObserverController.canReapply = true;
    } else {
      this.setDefault(isConfigured, true);
      window.dispatchEvent(new CustomEvent("lisio-disabled"));
    }
  } else if (feature === LisioBooleanParameterNames.BOOK_PAGE && !this.isBookPage) {
    this.params.updateParam(feature, value);
    this.confirmationModal.attachEventListenerOnButtons(
      this.confirmationModal.buttonYes,
      "click",
      (event) => {
        const bookPageAdapter = this.adapters.get(LisioBooleanParameterNames.BOOK_PAGE);
        if (bookPageAdapter != void 0) {
          this.confirmationModal.yesHandler(event, this.widget, feature);
        }
        LisioBlurController.current.enableBlur();
      }
    );
    this.confirmationModal.attachEventListenerOnButtons(
      this.confirmationModal.buttonNo,
      "click",
      (event) => {
        const bookPageAdapter = this.adapters.get(LisioBooleanParameterNames.BOOK_PAGE);
        if (bookPageAdapter != void 0) {
          this.confirmationModal.noHandler(event, this.widget, feature);
        }
        LisioBlurController.current.disableBlur();
      }
    );
  } else if (feature === LisioBooleanParameterNames.READING_MODE && !this.isReadingMode && typeof value === "boolean") {
    this.params.updateParam(feature, value);
    if (window.localStorage.getItem("lisio_reading_mode") === "1") {
      const bookPageAdapter = this.adapters.get(LisioBooleanParameterNames.READING_MODE);
      bookPageAdapter?.adapt(this.textTreeWalker, value);
    } else {
      this.confirmationModal.attachEventListenerOnButtons(
        this.confirmationModal.buttonYes,
        "click",
        (event) => {
          const bookPageAdapter = this.adapters.get(LisioBooleanParameterNames.READING_MODE);
          if (bookPageAdapter != void 0) {
            this.confirmationModal.yesHandler(event, this.widget, feature);
          }
          LisioBlurController.current.enableBlur();
        }
      );
      this.confirmationModal.attachEventListenerOnButtons(
        this.confirmationModal.buttonNo,
        "click",
        (event) => {
          const bookPageAdapter = this.adapters.get(LisioBooleanParameterNames.READING_MODE);
          if (bookPageAdapter != void 0) {
            this.confirmationModal.noHandler(event, this.widget, feature);
          }
          LisioBlurController.current.disableBlur();
        }
      );
    }
  } else {
    this.params.updateParam(feature, value);
    if (this.mutationObserverController.observer == void 0) {
      this.mutationObserverController.setObserver();
    } else {
      this.mutationObserverController.connectObserver();
    }
    this.textTreeWalker.resetWalker();
    this.textTreeWalker.getTextes();
    if ([LisioNumericParameterNames.DALTONISM_R, LisioNumericParameterNames.DALTONISM_G, LisioNumericParameterNames.DALTONISM_B, LisioNumericParameterNames.DALTONISM_HUE, LisioNumericParameterNames.DALTONISM_SATURATION, LisioNumericParameterNames.DALTONISM_BRIGHTNESS].includes(feature)) {
      this.applyFeature(feature, value, defaultValue);
    } else {
      this.applyFeature(feature, value);
    }
  }
  this.popin?.refreshLabel(this.params.params.size > 0, isConfigured);
  this.setDisableBand(this.params.params.size > 0);
}
function lisioBulkFeaturesMessageHandler(datas) {
  this.mutationObserverController.disconnectObserver();
  const {
    bulk,
    isReallyActive,
    isConfigured
  } = JSON.parse(datas);
  if (this.textTreeWalker.texts.size == 0) {
    this.textTreeWalker.getTextes();
  }
  const hasBookPageOrReadingMode = [
    LisioBooleanParameterNames.BOOK_PAGE,
    LisioBooleanParameterNames.READING_MODE
  ].includes(bulk[0].feature);
  if (!this.isBookPage && !this.isReadingMode && hasBookPageOrReadingMode) {
    if (bulk[0].value && window.localStorage.getItem("lisio_reading_mode") == void 0) {
      bulk.shift();
    } else if (window.localStorage.getItem("lisio_reading_mode") === "1" && bulk[0] != void 0) {
      const strigifiedDatas = JSON.stringify({
        feature: bulk[0].feature,
        value: bulk[0].value,
        defaultValue: bulk[0].defaultValue,
        isReallyActive,
        isConfigured
      });
      this.mutationObserverController.modifyPendingProcess(1);
      lisioFeatureMessageHandler.bind(this)(strigifiedDatas);
      this.mutationObserverController.modifyPendingProcess(-1);
    } else if (this.confirmationModal.isEnabled && !bulk[0].value) {
      this.confirmationModal.closeButton?.click();
    }
  } else if ((this.isBookPage || this.isReadingMode) && hasBookPageOrReadingMode) {
    if (bulk[0].value) {
      bulk.shift();
    } else {
      console.log("close all");
    }
  }
  if (!this.confirmationModal.isEnabled && !hasBookPageOrReadingMode || this.isBookPage || this.isReadingMode)
    for (const { feature, value, defaultValue } of bulk) {
      const strigifiedDatas = JSON.stringify({
        feature,
        value,
        defaultValue,
        isReallyActive,
        isConfigured
      });
      this.mutationObserverController.modifyPendingProcess(1);
      lisioFeatureMessageHandler.bind(this)(strigifiedDatas);
      this.mutationObserverController.modifyPendingProcess(-1);
    }
}
function lisioCloseMessageHandler() {
  this.mutationObserverController.disconnectObserver();
  this.widget.closeWidget();
  this.mutationObserverController.connectObserver();
}
function lisioDisableAllMessageHandler() {
  this.setDefault(false, true);
}
function lisioEncodeProfilesResponseMessageHandler(datas) {
  const profils = JSON.parse(datas);
  document.getSelection()?.removeAllRanges();
  const dictionaryAdapter = this.adapters.get(
    LisioBooleanParameterNames.VOCA
  );
  if (dictionaryAdapter != void 0 && dictionaryAdapter.query != void 0) {
    window.open(
      `${"https://env-preprod-mobiledition.lisio.fr"}/IM_GenerationMinisite.php?fic_id=3493&wsu=lisiojs${"&test=4"}&params=${profils}&url=https://www.larousse.fr/dictionnaires/francais/${dictionaryAdapter.query}/`,
      "",
      `top:0, left:0, width:${window.innerWidth}, height:${window.innerHeight}`
    );
  }
}
function lisioInitFrontMessageHandler(datas) {
  const parsedDatas = JSON.parse(datas);
  const initLang = lisioGetInitLang();
  if (!this.isBookPage && !this.isReadingMode) {
    this.setDefault(false, false);
    this.textTreeWalker.resetWalker();
    this.textTreeWalker.getTextes();
  }
  const dataHide = convertTabstoHide(this.lisioConfig.userSettings.tabsToHide);
  const originDomain = (this.isBookPage ? domainFromUrl(
    decodeURIComponent(
      decodeURIComponent(window.location.href.split(/&url=/g)[1])
    )
  ) : window.location.origin) + "/";
  LisioTranslationController.current.loadTranslationFile(initLang).then(() => {
    this.popin?.refreshLabel(parsedDatas.adaptation, parsedDatas.isConfigured);
    this.setDisableBand(parsedDatas.adaptation);
    if (this.popin != void 0) {
      LisioLightMessageManager.current.sendInitBackMessage(
        this.popin.shortcutoTo,
        this.popin.eventShortcutTo,
        dataHide,
        originDomain,
        this.lisioConfig,
        this.popin.name
      );
    }
  });
}
function lisioNewTabMessageHandler(datas) {
  const { url, same, ecoOrRural, urlQuery } = JSON.parse(datas);
  if (url === "urlOrigin") {
    this.newTab(urlOrigin.replace(/&.+/, ""), false, "");
  } else if (window.location.origin + "/" == "https://env-preprod-mobiledition.lisio.fr" && same) {
    window.location.reload();
  } else if (window.location.origin + "/" != "https://env-preprod-mobiledition.lisio.fr") {
    this.newTab(url, ecoOrRural, urlQuery);
  }
}
const urlOrigin = window.location.href.includes("mobiledition") ? decodeURIComponent(
  decodeURIComponent(window.location.href.split(/&url=/g)[1])
) : "";
function lisioReadingModeResponseMessageHandler(_datas) {
  if (this.textTreeWalker.texts.size <= 0) {
    this.textTreeWalker.getTextes();
  }
  this.adapters.get(LisioBooleanParameterNames.READING_MODE)?.adapt(this.textTreeWalker, true);
}
function lisioTransBannerPopupMessageHandler(datas) {
  const {
    confirmationModalDescription,
    confirmationModalParameter,
    confirmationModalWidgetTriggererFocus
  } = JSON.parse(datas);
  if (!this.isReadingMode && !this.isBookPage && window.localStorage.getItem("lisio_reading_mode") == void 0) {
    this.confirmationModal.changeTexts(confirmationModalDescription);
    this.confirmationModal.setDataFocus(
      this.confirmationModal.buttonNo,
      confirmationModalWidgetTriggererFocus
    );
    this.confirmationModal.setDataFocus(
      this.confirmationModal.closeButton,
      confirmationModalWidgetTriggererFocus
    );
    this.confirmationModal.attachEventListenerOnButtons(
      this.confirmationModal.buttonYes,
      "click",
      (event) => {
        this.confirmationModal.yesHandler(
          event,
          this.widget,
          confirmationModalParameter
        );
      }
    );
    this.confirmationModal.attachEventListenerOnButtons(
      this.confirmationModal.buttonNo,
      "click",
      (event) => {
        this.confirmationModal.noHandler(
          event,
          this.widget,
          confirmationModalParameter
        );
      }
    );
    this.confirmationModal.openModal();
  }
}
function lisioTranslationLanguageChangeMessageHandler(datas) {
  const { flagIso } = JSON.parse(datas);
  LisioTranslationController.current.loadTranslationFile(flagIso).then(() => {
    window.dispatchEvent(
      new CustomEvent("lisio-lang-change", { detail: { flagIso } })
    );
  });
}
function lisioDicoApiResponseMessageHandler(datas) {
  const formatedData = JSON.parse(datas).word;
  this.adapters.get(LisioBooleanParameterNames.VOCA).dicoModal.openModal();
  if (formatedData.length > 0) {
    this.adapters.get(
      LisioBooleanParameterNames.VOCA
    ).dicoModal.changeContent(formatedData);
  } else {
    this.adapters.get(
      LisioBooleanParameterNames.VOCA
    ).dicoModal.changeContent(void 0);
  }
}
class LisioMessageManager {
  static _current;
  _channels = /* @__PURE__ */ new Map();
  _contentWindow;
  _lisioServerIframe = "";
  _messageHandlers = /* @__PURE__ */ new Map();
  constructor() {
    {
      this._lisioServerIframe = "https://env-preprod-solution.lisio.fr";
      window.addEventListener("message", (event) => {
        if (event.origin === this._lisioServerIframe && event.data.target === "full") {
          const message = event.data;
          if (message.name == void 0) {
            throw new Error(
              "Message name is not defined : " + JSON.stringify(message)
            );
          } else {
            const handler = this._messageHandlers.get(message.name);
            if (handler == void 0) {
              throw new Error("Message handler is not defined");
            } else {
              handler(message.datas);
            }
          }
        }
      });
    }
  }
  static get current() {
    if (!this._current) {
      this._current = new LisioMessageManager();
    }
    return this._current;
  }
  set contentWindow(value) {
    this._contentWindow = value;
  }
  attachHandler(name, handler) {
    this._messageHandlers.set(name, handler);
  }
  detachHandler(name) {
    this._messageHandlers.delete(name);
  }
  initMessages(lisio) {
    this._messageHandlers.set(
      LisioMessageReceivedName.ACTIVE_RESPONSE,
      lisioActiveResponseMessageHandler.bind(lisio)
    );
    this._messageHandlers.set(
      LisioMessageReceivedName.CLOSE_WIDGET,
      lisioCloseMessageHandler.bind(lisio)
    );
    this._messageHandlers.set(
      LisioMessageReceivedName.DICO_API_RESPONSE,
      lisioDicoApiResponseMessageHandler.bind(lisio)
    );
    this._messageHandlers.set(
      LisioMessageReceivedName.DISABLE_ALL,
      lisioDisableAllMessageHandler.bind(lisio)
    );
    this._messageHandlers.set(
      LisioMessageReceivedName.ENCODE_PROFILES_RESPONSE,
      lisioEncodeProfilesResponseMessageHandler.bind(lisio)
    );
    this._messageHandlers.set(
      LisioMessageReceivedName.FEATURE,
      lisioFeatureMessageHandler.bind(lisio)
    );
    this._messageHandlers.set(
      LisioMessageReceivedName.BULK_FEATURES,
      lisioBulkFeaturesMessageHandler.bind(lisio)
    );
    this._messageHandlers.set(
      LisioMessageReceivedName.INIT_FRONT,
      lisioInitFrontMessageHandler.bind(lisio)
    );
    this._messageHandlers.set(
      LisioMessageReceivedName.NEW_TAB,
      lisioNewTabMessageHandler.bind(lisio)
    );
    this._messageHandlers.set(
      LisioMessageReceivedName.READING_MODE_RESPONSE,
      lisioReadingModeResponseMessageHandler.bind(lisio)
    );
    this._messageHandlers.set(
      LisioMessageReceivedName.TRANS_BANNER_POPUP,
      lisioTransBannerPopupMessageHandler.bind(lisio)
    );
    this._messageHandlers.set(
      LisioMessageReceivedName.TRANSLATION_LANGUAGE_CHANGE,
      lisioTranslationLanguageChangeMessageHandler.bind(lisio)
    );
  }
  sendAllEncodedMessage() {
    this.sendMessage("all_encoded", {});
  }
  sendCloseExtensionPopup() {
    this.sendMessage("close_extension_popup", {});
  }
  sendCloseReadingModeMessage() {
    this.sendMessage("close_reading_mode", {});
  }
  sendCloseWidgetMessage() {
    this.sendMessage("close_widget", {});
  }
  sendDisableParameter(parameter) {
    this.sendMessage("disable_parameter", { value: parameter });
  }
  sendDisableReadingMaskMessage() {
    this.sendMessage("disable_reading_mask", {});
  }
  sendEncodeProfilesMessage() {
    this.sendMessage("encode_profiles", {});
  }
  sendEndInitHtml() {
    this.sendMessage("end_init_html", {});
  }
  sendOpenSidePanel() {
    this.sendMessage("open_side", {});
  }
  sendPopupResponse(value, parameter, triggererToFocus) {
    if (triggererToFocus) {
      this.sendMessage("popup_response", {
        value,
        parameter,
        focus: triggererToFocus
      });
    } else {
      this.sendMessage("popup_response", { value, parameter });
    }
  }
  sendProcessEndMessage(value) {
    this.sendMessage("process_end", { value });
  }
  sendTranslatorAPITranslate(keyHandler, originLang, destLang, texts) {
    this.sendMessage("translator_api_translate", {
      keyHandler,
      body: {
        originLangISO: originLang,
        translateLangISO: destLang,
        originalTexts: texts,
        epochSent: Date.now()
      }
    });
  }
  sendDicoAPI(word) {
    this.sendMessage("dico_api", {
      word
    });
  }
  sendMessage(name, datas) {
    {
      this._contentWindow?.postMessage(
        {
          name,
          datas: JSON.stringify(datas)
        },
        this._lisioServerIframe
      );
    }
  }
}
class LisioBookPageAdapter extends LisioAdapter {
  _bookPageUrlOrigin = "";
  _lisio;
  constructor(isBookPage, lisio) {
    super();
    const tmpOriginPageUrl = isBookPage ? window.location.search?.split("&")?.find((search) => search.startsWith("url="))?.split("=")[1] : "";
    if (tmpOriginPageUrl != void 0) {
      this._bookPageUrlOrigin = tmpOriginPageUrl;
    }
    this._lisio = lisio;
  }
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {string} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(_, value) {
    if (LisioMessageManager.current != void 0) {
      if (value) ;
      else {
        this._lisio.newTab(this._bookPageUrlOrigin, false, "");
      }
    }
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
  adaptFunction(_element, _value) {
  }
}
class LisioContrastAdapter extends LisioAdapter {
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {number} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(_, value) {
    this.adaptFunction(document.documentElement, value);
  }
  adaptFunction(element, value) {
    const numericValue = value >= 1 ? value / 10 : value;
    let svg = document.querySelector("#lisio-svg");
    let matrice = document.querySelector("#lisio-svg feColorMatrix");
    if (svg == void 0) {
      const filter = document.createElementNS(
        "http://www.w3.org/2000/svg",
        "filter"
      );
      svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
      matrice = document.createElementNS(
        "http://www.w3.org/2000/svg",
        "feColorMatrix"
      );
      svg.setAttribute("height", "0");
      svg.id = "lisio-svg";
      filter.id = "filter";
      document.body.appendChild(svg);
      document.querySelector("#lisio-svg")?.appendChild(filter);
      document.querySelector("#filter")?.appendChild(matrice);
    }
    LisioStyleSheetController.current.replaceImportantInStyleAttribute(
      [LisioCSSProperties.FILTER],
      element
    );
    if (numericValue === 1) {
      LisioStyleSheetController.current.removeRule(".lisio-filters");
      element.classList.remove("lisio-filters");
    } else {
      element.classList.add("lisio-filters");
      LisioStyleSheetController.current.removeRule(".lisio-filters");
      LisioStyleSheetController.current.insertRule(
        ".lisio-filters",
        /* @__PURE__ */ new Map([
          [
            LisioCSSProperties.FILTER,
            `url(#lisio-filter) contrast(${numericValue})`
          ]
        ])
      );
    }
  }
}
class LisioCursorAdapter extends LisioAdapter {
  _cursors = {
    auto: {
      big: "cursors/auto/auto-big.svg",
      very_big: "cursors/auto/auto-verybig.svg"
    },
    default: {
      big: "cursors/default/default-big.svg",
      very_big: "cursors/default/default-verybig.svg"
    },
    pointer: {
      big: "cursors/pointer/pointer-big.svg",
      very_big: "cursors/pointer/pointer-verybig.svg"
    },
    text: {
      big: "cursors/text/text-big.svg",
      very_big: "cursors/text/text-verybig.svg"
    },
    help: {
      big: "cursors/help/help-big.svg",
      very_big: "cursors/help/help-verybig.svg"
    },
    play: {
      big: "cursors/play/play-big.svg",
      very_big: "cursors/play/play-verybig.svg"
    },
    vocal: {
      big: "cursors/vocal/vocal-big.svg",
      very_big: "cursors/vocal/vocal-verybig.svg"
    },
    pause: {
      big: "cursors/pause/pause-big.svg",
      very_big: "cursors/pause/pause-verybig.svg"
    }
  };
  _cursorsPath = `${"https://env-preprod-solution.lisio.fr"}/solution/dist-site/`;
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {string} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(walker, value) {
    for (const tag of [
      document.body,
      document.documentElement,
      ...walker.tags.values()
    ]) {
      this.adaptFunction(tag, value);
    }
    if (value === "default") {
      document.querySelector("div#lisio-label")?.classList.remove(`lisio-cursor-pointer`);
    } else {
      document.querySelector("div#lisio-label")?.classList.add(`lisio-cursor-pointer`);
    }
    if (value === "default") {
      document.documentElement.classList.remove("synth-verybig");
      document.documentElement.classList.remove("synth-big");
    } else if (value === "big") {
      document.documentElement.classList.remove("synth-verybig");
      document.documentElement.classList.add("synth-big");
    } else if (value === "very_big") {
      document.documentElement.classList.remove("synth-big");
      document.documentElement.classList.add("synth-verybig");
    }
  }
  adaptFunction(element, value) {
    if (element.localName != "style" && element.localName != "script") {
      const { cursor } = window.getComputedStyle(element);
      const allCursors = cursor.split(/,\s+/);
      let selectedCursor;
      if (cursor.includes("url") && (cursor.includes("play.svg") || cursor.includes("vocal.svg") || cursor.includes("pause.svg"))) {
        if (cursor.includes("play.svg")) {
          selectedCursor = "play";
        }
        if (cursor.includes("vocal.svg")) {
          selectedCursor = "vocal";
        }
        if (cursor.includes("pause.svg")) {
          selectedCursor = "pause";
        }
      } else {
        selectedCursor = allCursors.pop()?.split(" ").shift();
      }
      if (selectedCursor === "auto" || selectedCursor === "pointer" || selectedCursor === "text" || selectedCursor === "default" || selectedCursor === "help" || selectedCursor === "vocal" || selectedCursor === "play" || selectedCursor === "pause") {
        if (value === "default") {
          element.classList.remove(`lisio-cursor-${selectedCursor}`);
        } else {
          element.classList.add(`lisio-cursor-${selectedCursor}`);
        }
        LisioStyleSheetController.current.replaceImportantInStyleAttribute(
          [LisioCSSProperties.CURSOR],
          element
        );
        if (value === "default") {
          LisioStyleSheetController.current.removeRule(
            `.lisio-cursor-${selectedCursor}`
          );
        } else {
          const cursorUrl = this._cursorsPath + this._cursors[selectedCursor][value];
          LisioStyleSheetController.current.insertOrReplaceRule(
            /* @__PURE__ */ new Map([
              [
                LisioCSSProperties.CURSOR,
                `url(${cursorUrl})${selectedCursor == "text" ? value == "big" ? "25 25" : "50 50" : ""}, ${["play", "pause", "vocal"].includes(selectedCursor) ? "default" : selectedCursor}`
              ]
            ]),
            `.lisio-cursor-${selectedCursor}`,
            `.lisio-cursor-${selectedCursor}`
          );
        }
      }
    }
  }
}
class LisioDaltonismAdapter extends LisioAdapter {
  areInDefaultState = {
    [LisioStringParameterNames.DALTONISM]: true,
    [LisioNumericParameterNames.DALTONISM_R]: true,
    [LisioNumericParameterNames.DALTONISM_G]: true,
    [LisioNumericParameterNames.DALTONISM_B]: true,
    [LisioNumericParameterNames.DALTONISM_HUE]: true,
    [LisioNumericParameterNames.DALTONISM_SATURATION]: true,
    [LisioNumericParameterNames.DALTONISM_BRIGHTNESS]: true
  };
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {string} value - Value of the functionality
   * @param {LisioParameterNames | undefined} feature - feature that has to be applied by this adapter, if not the default one
   * @param {boolean | number | string | undefined} defaultValue - default value of the input
   * @returns Returns nothing
   * @source
   */
  adapt(_, value, feature, defaultValue) {
    if (feature) {
      this.areInDefaultState[feature] = value === defaultValue;
    } else {
      this.areInDefaultState[LisioStringParameterNames.DALTONISM] = !["protanopia", "deuteranopia", "tritanopia", "monochromacy", "enhance_r", "enhance_g"].includes(value);
    }
    this.adaptFunction(document.documentElement);
    let svg = document.querySelector("#lisio-svg");
    let matrice = document.querySelector("#lisio-svg .daltonism-profile-matrix");
    let colorMatrix = document.querySelector("#lisio-svg .daltonism-color-matrix");
    let hueMatrix = document.querySelector("#lisio-svg .daltonism-hue-matrix");
    let saturationMatrix = document.querySelector("#lisio-svg .daltonism-saturation-matrix");
    let brightnessMatrix = document.querySelector("#lisio-svg .daltonism-brightness-matrix");
    if (svg && !matrice) return;
    if (svg == void 0) {
      const filter = document.createElementNS(
        "http://www.w3.org/2000/svg",
        "filter"
      );
      svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
      matrice = document.createElementNS(
        "http://www.w3.org/2000/svg",
        "feColorMatrix"
      );
      matrice.classList.add("daltonism-profile-matrix");
      colorMatrix = document.createElementNS(
        "http://www.w3.org/2000/svg",
        "feColorMatrix"
      );
      colorMatrix.classList.add("daltonism-color-matrix");
      hueMatrix = document.createElementNS(
        "http://www.w3.org/2000/svg",
        "feColorMatrix"
      );
      hueMatrix.classList.add("daltonism-hue-matrix");
      hueMatrix.setAttribute("type", "hueRotate");
      hueMatrix.setAttribute("value", "0");
      saturationMatrix = document.createElementNS(
        "http://www.w3.org/2000/svg",
        "feColorMatrix"
      );
      saturationMatrix.classList.add("daltonism-saturation-matrix");
      saturationMatrix.setAttribute("type", "saturate");
      saturationMatrix.setAttribute("value", "0");
      brightnessMatrix = document.createElementNS(
        "http://www.w3.org/2000/svg",
        "feComponentTransfer"
      );
      brightnessMatrix.classList.add("daltonism-brightness-matrix");
      const brightnessMatrixR = document.createElementNS("http://www.w3.org/2000/svg", "feFuncR");
      const brightnessMatrixG = document.createElementNS("http://www.w3.org/2000/svg", "feFuncG");
      const brightnessMatrixB = document.createElementNS("http://www.w3.org/2000/svg", "feFuncB");
      [brightnessMatrixR, brightnessMatrixG, brightnessMatrixB].forEach((matrix) => {
        matrix.setAttribute("type", "linear");
        matrix.setAttribute("slope", "1");
      });
      brightnessMatrix.append(brightnessMatrixR);
      brightnessMatrix.append(brightnessMatrixG);
      brightnessMatrix.append(brightnessMatrixB);
      svg.setAttribute("height", "0");
      svg.id = "lisio-svg";
      filter.id = "lisio-filter";
      filter.append(matrice);
      filter.append(colorMatrix);
      filter.append(hueMatrix);
      filter.append(saturationMatrix);
      filter.append(brightnessMatrix);
      svg.append(filter);
      document.body.appendChild(svg);
      LisioStyleSheetController.current.insertOrReplaceRule(
        /* @__PURE__ */ new Map([
          [LisioCSSProperties.FILTER, "url(#lisio-filter) contrast(1)"]
        ]),
        ".lisio-filters",
        ".lisio-filters"
      );
      LisioStyleSheetController.current.insertOrReplaceRule(
        /* @__PURE__ */ new Map([
          [LisioCSSProperties.DISPLAY, "none"]
        ]),
        "#lisio-svg",
        "#lisio-svg"
      );
    }
    if (this.isAllDefault()) {
      svg.remove();
      LisioStyleSheetController.current.removeRule(".lisio-filters");
      LisioStyleSheetController.current.removeRule("#lisio-filters");
    }
    if (feature === void 0) {
      if (value !== "default") {
        LisioStyleSheetController.current.insertOrReplaceRule(
          /* @__PURE__ */ new Map([
            [LisioCSSProperties.FILTER, "url(#lisio-filter) contrast(1)"]
          ]),
          ".lisio-filters",
          ".lisio-filters"
        );
        LisioStyleSheetController.current.insertOrReplaceRule(
          /* @__PURE__ */ new Map([
            [LisioCSSProperties.DISPLAY, "none"]
          ]),
          "#lisio-svg",
          "#lisio-svg"
        );
        let matriceValue = "";
        if (value == "protanopia") {
          matriceValue = "0.56667 0.43333 0.00000 0 0 0.55833 0.44167 0.00000 0 0 0.00000 0.24167 0.75833 0 0 0 0 0 1 0";
        } else if (value == "deuteranopia") {
          matriceValue = "0.4251 0.6934 -0.1147 0 0 0.3417 0.5882 0.0692 0 0 -0.0105 0.0234 0.9870 0 0 0 0 0 1 0";
        } else if (value == "tritanopia") {
          matriceValue = "0.95000 0.05000 0.00000 0 0 0.00000 0.83333 0.16700 0 0 0.00000 0.87500 0.12500 0 0 0 0 0 1 0";
        } else if (value == "monochromacy") {
          matriceValue = "0.33 0.33 0.33 0 0 0.33 0.33 0.33 0 0 0.33 0.33 0.33 0 0 0 0 0 1 0";
        } else if (value == "enhance_r") {
          matriceValue = "1.00 0.00 0.00 0 0 0.00 1.00 0.00 0 0 1.00 0.00 0.00 0 0 0 0 0 1 0";
        } else if (value == "enhance_g") {
          matriceValue = "1.00 0.00 0.00 0 0 0.00 1.00 0.00 0 0 0.00 1.00 0.00 0 0 0 0 0 1 0";
        }
        matrice?.setAttribute("values", matriceValue);
      } else {
        matrice?.removeAttribute("values");
      }
    } else if ([LisioNumericParameterNames.DALTONISM_R, LisioNumericParameterNames.DALTONISM_G, LisioNumericParameterNames.DALTONISM_B].includes(feature) && !this.isAllDefault()) {
      let matrixValues = document.querySelector("#lisio-filter .daltonism-color-matrix").getAttribute("values");
      if (!matrixValues) {
        matrixValues = "1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0";
      }
      const matrixValuesArray = matrixValues.split(" ");
      if (feature === LisioNumericParameterNames.DALTONISM_R) {
        this.updateColorMatrix(0, parseInt(value, 10), matrixValuesArray);
      } else if (feature === LisioNumericParameterNames.DALTONISM_G) {
        this.updateColorMatrix(6, parseInt(value, 10), matrixValuesArray);
      } else if (feature === LisioNumericParameterNames.DALTONISM_B) {
        this.updateColorMatrix(12, parseInt(value, 10), matrixValuesArray);
      }
    } else if (feature === LisioNumericParameterNames.DALTONISM_HUE) {
      hueMatrix.setAttribute("values", value);
    } else if (feature === LisioNumericParameterNames.DALTONISM_SATURATION) {
      saturationMatrix.setAttribute("values", (parseInt(value, 10) / 100).toString());
    } else {
      const v = parseInt(value, 10) / 100;
      brightnessMatrix.querySelector("feFuncR").setAttribute("slope", v.toString());
      brightnessMatrix.querySelector("feFuncG").setAttribute("slope", v.toString());
      brightnessMatrix.querySelector("feFuncB").setAttribute("slope", v.toString());
    }
  }
  updateColorMatrix(index, value, matrixValuesArray) {
    matrixValuesArray[index] = (value / 100).toString();
    let endValues = "";
    matrixValuesArray.forEach((matrixValue, indexValue) => {
      if (indexValue !== 0) {
        endValues += " ";
      }
      endValues += matrixValue;
    });
    document.querySelector("#lisio-filter .daltonism-color-matrix").setAttribute("values", endValues);
  }
  isAllDefault() {
    return this.areInDefaultState[LisioStringParameterNames.DALTONISM] && this.areInDefaultState[LisioNumericParameterNames.DALTONISM_R] && this.areInDefaultState[LisioNumericParameterNames.DALTONISM_G] && this.areInDefaultState[LisioNumericParameterNames.DALTONISM_B] && this.areInDefaultState[LisioNumericParameterNames.DALTONISM_HUE] && this.areInDefaultState[LisioNumericParameterNames.DALTONISM_SATURATION] && this.areInDefaultState[LisioNumericParameterNames.DALTONISM_BRIGHTNESS];
  }
  adaptFunction(element) {
    if (this.isAllDefault()) {
      LisioStyleSheetController.current.replaceImportantInStyleAttribute(
        [LisioCSSProperties.FILTER],
        element
      );
      element.classList.remove("lisio-filters");
    } else {
      element.classList.add("lisio-filters");
    }
  }
}
const styles$5 = ".lisio-modal-container {\n  border-radius: 27px;\n  position: fixed;\n  background-color: white;\n  z-index: 2147483647;\n  overflow: hidden;\n  display: none;\n  flex-direction: column;\n  height: fit-content;\n  top: 50%;\n  left: 50%;\n  transform: translate(-50%, -50%);\n}\n\n.lisio-modal-container *:focus,\n.lisio-modal-container *:focus-visible {\n  outline: 2px solid rgba(0, 0, 0, 0.5);\n}\n\n.lisio-modal-container.active {\n  display: flex;\n}\n\n.lisio-modal-container * {\n  font-family: Calibri, sans-serif;\n  line-height: 1.5;\n}\n\n.lisio-modal-header {\n  background-color: #ededed;\n  padding: 10px;\n  display: flex;\n  align-items: center;\n  position: relative;\n  justify-content: space-between;\n}\n\n.lisio-modal-header > p {\n  width: 100%;\n  text-align: center;\n  margin: 0;\n  font-weight: bold;\n  text-align: center;\n  font-size: 1.7em;\n  margin: 0;\n  padding: 0;\n  line-height: 1.5;\n}\n\n.lisio-modal-header > img {\n  width: 32px;\n  height: 32px;\n}\n\n.lisio-modal-body {\n  display: flex;\n  flex-direction: column;\n  overflow-y: auto;\n  overscroll-behavior: contain;\n  padding-left: 30px;\n  padding-right: 30px;\n  padding-bottom: 10px;\n  margin-bottom: 20px;\n}\n\n.lisio-modal-close-button {\n  width: 33px;\n  height: 33px;\n  border-radius: 50%;\n  background: #ededed !important;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  z-index: 2147483647;\n  cursor: pointer;\n  border: none;\n}\n\n.lisio-modal-close-button svg {\n  color: #555555;\n}\n\n.lisio-modal-close-button:hover svg {\n  color: #ededed !important;\n}\n\n.lisio-modal-close-button:hover {\n  background: #555555 !important;\n}\n\n.lisio-modal-close-button:hover:before {\n  background: #ededed !important;\n}\n\n.lisio-modal-close-button:hover:after {\n  background: #ededed !important;\n}\n\np.lisio-modal-title {\n  font-weight: bold;\n  color: black;\n  text-align: center;\n  margin-top: 1em;\n  margin-top: 0.5em;\n  font-size: 1.7em;\n}\n\np.lisio-dico-not-found {\n  text-align: center;\n  margin-block: 1em;\n}\n";
class LisioModalController {
  _metaViewport;
  _oldViewportContent;
  _isActive = false;
  _modalContainer;
  _closeButton;
  _logo;
  _modalBody;
  _title;
  constructor(id, headerTitleId, headerTitleTextId, isTitleVisible) {
    this._modalContainer = document.createElement("div");
    this._modalContainer.id = id;
    this._modalContainer.classList.add("lisio-modal-container");
    this._modalContainer.setAttribute("aria-modal", "true");
    this._modalContainer.setAttribute("role", "dialog");
    this.keyDownHandler = this.keyDownHandler.bind(this);
    this._logo = document.createElement("img");
    this._logo.id = "lisio-modal-img";
    this._logo.alt = "";
    this._logo.setAttribute("aria-hidden", "true");
    this._logo.src = `${"https://env-preprod-solution.lisio.fr"}/solution/dist-site/svg/hippo_logo.svg`;
    this._closeButton = document.createElement("button");
    this._closeButton?.classList.add("lisio-modal-close-button");
    this._closeButton.tabIndex = 0;
    this._closeButton.setAttribute(
      "aria-label",
      LisioTranslationController.current.getTranslation(
        "confirmation-modal-close"
      )
    );
    this._closeButton.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="22" height="22" viewBox="0 0 22 22" fill="none"><path d="M1 1L20.9878 20.9783M21 1.0217L1.0122 21" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>`;
    const header = document.createElement("div");
    header.classList.add("lisio-modal-header");
    header.appendChild(this._logo);
    header.appendChild(this._closeButton);
    this._modalBody = document.createElement("div");
    this._modalBody.classList.add("lisio-modal-body");
    this._modalContainer.appendChild(header);
    this._modalContainer.appendChild(this._modalBody);
    if (isTitleVisible) {
      this._modalContainer.setAttribute("aria-labelledby", headerTitleId);
      this._title = document.createElement("p");
      this._title.classList.add("lisio-modal-title");
      this._title.id = headerTitleId;
      this._title.innerText = LisioTranslationController.current.getTranslation(headerTitleTextId);
      this._modalBody.appendChild(this._title);
    } else {
      this._modalContainer.setAttribute(
        "aria-label",
        LisioTranslationController.current.getTranslation(headerTitleTextId)
      );
    }
    const viewportMeta = document.querySelector('meta[name="viewport"]');
    if (viewportMeta) {
      this._metaViewport = viewportMeta;
      this._oldViewportContent = viewportMeta.getAttribute("content");
      viewportMeta.setAttribute(
        "content",
        "height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
      );
    } else {
      const newViewportMeta = document.createElement("meta");
      this._metaViewport = newViewportMeta;
      newViewportMeta.setAttribute("name", "viewport");
      newViewportMeta.setAttribute(
        "content",
        "height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
      );
    }
    this._modalContainer.addEventListener("keydown", (e) => {
      if (e.code === "Escape") {
        this._closeButton?.click();
      }
    });
    window.addEventListener("lisio-lang-change", () => {
      LisioTranslationController.current.translateModal(
        this._closeButton,
        this._modalContainer,
        this._title,
        headerTitleTextId,
        isTitleVisible
      );
    });
  }
  closeModal() {
    LisioShadowRootController.current.removeElement(
      this._modalContainer,
      styles$5
    );
    if (this._oldViewportContent != void 0) {
      this._metaViewport.content = this._oldViewportContent;
    } else {
      this._metaViewport.remove();
    }
    this._isActive = false;
    this._modalContainer.classList.remove("active");
    document.body.style.overflow = "auto";
    LisioBlurController.current.goOnBack();
  }
  openModal() {
    LisioShadowRootController.current.appendElement(
      this._modalContainer,
      styles$5
    );
    if (this._oldViewportContent == void 0) {
      appendToHead(this._metaViewport);
    }
    this._isActive = true;
    this._modalContainer.classList.add("active");
    document.body.style.overflow = "hidden";
    this.activateFocusTrap();
    if (!LisioBlurController.current.isActive) {
      LisioBlurController.current.enableBlur();
      LisioBlurController.current.goOnTop();
    }
  }
  setDataFocus(element, parameterName) {
    element.dataset.focus = parameterName;
  }
  getFocusableElements() {
    return Array.from(this._modalContainer.querySelectorAll("*")).filter((el) => {
      const e = el;
      return el.tabIndex >= 0 && !e.disabled && el.offsetParent !== null;
    });
  }
  keyDownHandler = (e) => {
    if (e.code !== "Tab") return;
    const focusables = this.getFocusableElements();
    if (focusables.length === 0) return;
    const firstEl = focusables[0];
    const lastEl = focusables[focusables.length - 1];
    const focusedEl = this._modalContainer.querySelector(":focus");
    if (e.shiftKey) {
      if (focusedEl === firstEl || focusedEl === this._modalContainer || focusedEl === null) {
        e.preventDefault();
        lastEl.focus();
      }
    } else {
      if (focusedEl === lastEl || focusedEl === null) {
        e.preventDefault();
        firstEl.focus();
      }
    }
  };
  clickHandler = (e) => {
    if (e.isTrusted) {
      const focusables = this.getFocusableElements();
      focusables[0].focus();
    }
  };
  activateFocusTrap() {
    document.addEventListener("keydown", this.keyDownHandler);
    document.addEventListener("click", this.clickHandler);
    const focusables = this.getFocusableElements();
    focusables[0].focus();
  }
  deactivateFocusTrap() {
    document.removeEventListener("keydown", this.keyDownHandler);
    document.removeEventListener("click", this.clickHandler);
  }
}
const dicoModalStyles = "#lisio-dico-modal-container {\n  max-height: 400px;\n  min-width: 300px;\n  width: 50%;\n  padding: 0;\n}\n\n.lisio-dico-modal-words > p {\n  font-weight: bold;\n  text-align: center;\n  margin: 0;\n  padding-block: 10px;\n}\n\n.lisio-dico-modal-content p {\n  font-size: 1.2em;\n}\n\n.lisio-dico-modal-content p > span {\n  color: var(--theme-primary);\n  font-weight: bold;\n  font-size: 1.3em;\n}\n\n.lisio-dico-modal-words > p {\n  font-size: 1.5em;\n}\n\n.lisio-dico-modal-words > p > span {\n  font-size: 1.5em !important;\n}\n\n.lisio-dico-modal-words > p span {\n  text-transform: capitalize;\n  font-weight: bold;\n}\n\n.lisio-dico-modal-words > p > span.lisio-dico-phonetic {\n  color: #555555;\n  font-size: 1.2em !important;\n}\n\n.lisio-dico-modal-words:not(:last-child) {\n  padding-bottom: 25px;\n}\n\n.lisio-dico-modal-words:not(:first-child) {\n  padding-top: 25px;\n  border-top: solid 2px #e4e4e4;\n}\n\n#lisio-dico-modal-container span {\n  background-color: unset;\n}\n\n@media screen and (max-width: 960px) {\n  #lisio-dico-modal-container {\n    width: 80%;\n  }\n}\n\n@supports(padding-inline: 30px){\n  .lisio-modal-body {\n    padding-inline: 30px;\n  }\n}";
class LisioDicoModal extends LisioModalController {
  _contentSection;
  _listeners = /* @__PURE__ */ new Map();
  _triggerer;
  _notFoundText;
  set triggerer(triggerer) {
    this._triggerer = triggerer;
  }
  constructor() {
    super(
      "lisio-dico-modal-container",
      "lisio-dico-title",
      "dictionary-modal-title",
      true
    );
    const modalContent = document.createElement("div");
    modalContent.classList.add("lisio-dico-modal-content");
    this._modalBody.appendChild(modalContent);
    this._modalContainer.querySelector(
      ".lisio-modal-close-button"
    ).addEventListener("click", () => {
      this.closeModal();
    });
    this._contentSection = this._modalContainer.querySelector(
      ".lisio-dico-modal-content"
    );
    LisioShadowRootController.current.addStyles(dicoModalStyles);
  }
  attachEventListenerOnButtons(button, eventName, listener) {
    const eventListeners = this._listeners.get(button);
    if (eventListeners != void 0) {
      eventListeners.set(eventName, listener);
      button.addEventListener(eventName, listener);
    }
  }
  openModal() {
    super.openModal();
  }
  closeModal() {
    super.closeModal();
    this.deactivateFocusTrap();
    LisioBlurController.current.disableBlur();
  }
  changeContent(formatedData) {
    if (formatedData) {
      this._contentSection.innerHTML = `
        ${formatedData.map(
        (word) => `
            ${Object.keys(word.values).map(
          (key) => `<div class="lisio-dico-modal-words">
                <p><span>${word.word}</span> - ${key} - <span class="lisio-dico-phonetic">${word.syl}</span></p>
                <div>
                  ${word.values[key].map(
            (def, index) => `
                      <p><span>${index + 1}. </span>${def}</p>
                    `
          ).join("")}  
                </div>
              </div>`
        ).join("")}
            `
      ).join("")}
      `;
      if (this._modalContainer.id === "lisio-dico-modal-container") {
        if (this._contentSection.offsetHeight > this._modalContainer.offsetHeight - this._modalContainer.querySelector(
          ".lisio-modal-header"
        ).offsetHeight) {
          this._modalContainer.querySelector(
            ".lisio-modal-body"
          ).classList.add("overflow-y-scroll");
        } else {
          this._modalContainer.querySelector(
            ".lisio-modal-body"
          ).classList.remove("overflow-y-scroll");
        }
      }
      this._notFoundText = void 0;
    } else {
      this._contentSection.innerHTML = `<p class="lisio-dico-not-found">${LisioTranslationController.current.getTranslation("dico-no-definition-found")}</p>`;
      this._notFoundText = this._contentSection.querySelector(
        ".lisio-dico-not-found"
      );
    }
    window.addEventListener("lisio-lang-change", () => {
      LisioTranslationController.current.translateDicoModal(this._notFoundText);
    });
  }
  deactivateFocusTrap() {
    super.deactivateFocusTrap();
    if (this._triggerer) {
      if (this._triggerer.tabIndex === -1) {
        this._triggerer.setAttribute("tabindex", "-1");
      }
      this._triggerer.focus();
    }
  }
}
class LisioDictionaryAdapter extends LisioAdapter {
  _dictionaryTimeout = -1;
  _isEnabled = false;
  _query;
  _dicoModal;
  _boundedDef;
  get dicoModal() {
    return this._dicoModal;
  }
  constructor() {
    super();
    this._dicoModal = new LisioDicoModal();
    this._boundedDef = this.findDef.bind(this);
  }
  get query() {
    return this._query;
  }
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {string} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(walker, value) {
    if (value && !this._isEnabled) {
      this._isEnabled = true;
      document.addEventListener("selectionchange", this._boundedDef);
      document.documentElement.style.userSelect = "auto";
      document.documentElement.style.webkitUserSelect = "auto";
      LisioStyleSheetController.current.insertRule(
        ".lisio-cursor-help",
        /* @__PURE__ */ new Map([[LisioCSSProperties.CURSOR, "help"]])
      );
    } else {
      this._isEnabled = false;
      document.removeEventListener("selectionchange", this._boundedDef);
      document.documentElement.style.userSelect = "";
      document.documentElement.style.webkitUserSelect = "";
      LisioStyleSheetController.current.removeRule(".lisio-cursor-help");
    }
    for (const tag of walker.tags.values()) {
      this.adaptFunction(tag, value);
    }
  }
  adaptFunction(element, value) {
    if (element.textContent?.trim() != "" && element instanceof HTMLElement) {
      if (element.localName != "i" && element.localName != "script" && element.localName != "style" && !element.className.includes("icon")) {
        if (value) {
          element.classList.add("lisio-cursor-help");
        } else {
          element.classList.remove("lisio-cursor-help");
        }
      }
    }
  }
  findDef() {
    if (this._dictionaryTimeout != null) {
      clearTimeout(this._dictionaryTimeout);
    }
    this._dictionaryTimeout = setTimeout(() => {
      const str = document.getSelection()?.toString().trim().toLowerCase();
      const normalizedStr = str?.normalize == void 0 ? str : str.normalize("NFD");
      this._query = normalizedStr?.replace(/\s+/g, " ").split(" ").slice(0, 3).join(" ");
      if (this._query != void 0 && this._query.length > 1 && /[a-zA-Z]+/g.test(this._query)) {
        const selection = document.getSelection();
        if (selection?.anchorNode?.parentElement != void 0 && selection.anchorNode.nodeType === Node.TEXT_NODE) {
          this._dicoModal.triggerer = selection.anchorNode.parentElement;
        } else if (selection?.anchorNode?.parentElement != void 0 && selection.anchorNode.nodeType === Node.ELEMENT_NODE) {
          this._dicoModal.triggerer = selection.anchorNode;
        }
        LisioMessageManager.current.sendDicoAPI(this._query);
      }
    }, 1e3);
  }
}
class LisioDyslexiaAdapter extends LisioAdapter {
  _nodes = [];
  _params;
  constructor(params) {
    super();
    this._params = params;
  }
  get nodes() {
    return this._nodes;
  }
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {boolean | string} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(walker, value) {
    const isActive = typeof value === "string" ? this._params.params.get(
      LisioBooleanParameterNames.ACTIVE_UNDERLINE
    ) || false : value;
    const lettersToRemove = document.querySelectorAll(
      `[data-lisio-letter].r,[data-lisio-letter].b,[data-lisio-letter].g`
    );
    for (const letterToRemove of lettersToRemove) {
      this.deleteLetter(letterToRemove);
    }
    const red = this._params.params.get(
      LisioStringParameterNames.UNDERLINE_RED
    );
    const green = this._params.params.get(
      LisioStringParameterNames.UNDERLINE_GREEN
    );
    const blue = this._params.params.get(
      LisioStringParameterNames.UNDERLINE_BLUE
    );
    const colors = [
      [LisioStringParameterNames.UNDERLINE_RED, red],
      [LisioStringParameterNames.UNDERLINE_GREEN, green],
      [LisioStringParameterNames.UNDERLINE_BLUE, blue]
    ];
    if (isActive && (red != "" || green != "" || blue != "")) {
      LisioStyleSheetController.current.insertRule(
        ".underline-red",
        /* @__PURE__ */ new Map([
          [LisioCSSProperties.BACKGROUND_COLOR, "#e68989"]
        ])
      );
      LisioStyleSheetController.current.insertRule(
        ".underline-green",
        /* @__PURE__ */ new Map([
          [LisioCSSProperties.BACKGROUND_COLOR, "#bae28e"]
        ])
      );
      LisioStyleSheetController.current.insertRule(
        ".underline-blue",
        /* @__PURE__ */ new Map([
          [LisioCSSProperties.BACKGROUND_COLOR, "#86a5ec"]
        ])
      );
      for (const tag of walker.tags.values()) {
        this.adaptFunction(tag, isActive);
      }
      for (const [key, values] of colors) {
        if (values != void 0 && key != void 0 && values != "") {
          for (const letter of values.split(" ")) {
            const letters2 = document.querySelectorAll(
              `[data-lisio-letter="${letter}"]`
            );
            for (const letter2 of letters2) {
              letter2.className = key.replace("_", "-");
            }
          }
        }
      }
      const letters = document.querySelectorAll(
        "[data-lisio-letter]"
      );
      if (letters != null) {
        const oldLetters = [];
        for (const letter of letters) {
          const letterTxt = letter.getAttribute("data-lisio-letter");
          if (letterTxt != void 0 && oldLetters.indexOf(letterTxt) == -1) {
            oldLetters.push(letterTxt);
          }
        }
        const newLetters = [];
        for (const [_, values] of colors) {
          if (values != void 0 && values != "") {
            for (const value2 of values.split(" ")) {
              newLetters.push(value2.toLocaleLowerCase());
            }
          }
        }
        const supprs = oldLetters.filter((letterTxt) => {
          return !newLetters.includes(letterTxt.toLocaleLowerCase());
        });
        for (const suppr of supprs) {
          document.querySelectorAll(`[data-lisio-letter=${suppr}]`).forEach((elt) => {
            this.deleteLetter(elt);
          });
        }
        for (let index = this._nodes.length - 1; index > 0; index--) {
          const cloneNode = this._nodes[index].cloneNode(true);
          for (let index2 = 0; index2 < cloneNode.childNodes.length; index2++) {
            if (cloneNode.childNodes[index2].nodeType == 3) {
              for (const [key, values] of colors) {
                if (values != void 0 && values != "") {
                  for (const value2 of values.split(" ")) {
                    const nodeCompl = cloneNode.childNodes.length > 1 ? true : false;
                    if (cloneNode.childNodes[index2].nodeType == 3) {
                      const insertBefore = cloneNode.childNodes[index2].nextSibling;
                      const regExp = RegExp(value2, "gi");
                      let exec;
                      let i = 0;
                      let find = false;
                      const base = cloneNode.childNodes[index2].nodeValue || "";
                      while ((exec = regExp.exec(base)) != void 0) {
                        if (!find) {
                          i = exec["index"];
                          cloneNode.replaceChild(
                            document.createTextNode(base.slice(0, i)),
                            cloneNode.childNodes[index2]
                          );
                        } else {
                          if (insertBefore != void 0 && nodeCompl) {
                            cloneNode.insertBefore(
                              document.createTextNode(
                                base.slice(i + value2.length, exec["index"])
                              ),
                              insertBefore
                            );
                          } else {
                            cloneNode.appendChild(
                              document.createTextNode(
                                base.slice(i + value2.length, exec["index"])
                              )
                            );
                          }
                          i = exec["index"];
                        }
                        find = true;
                        const letterDys = document.createElement("strong");
                        letterDys.className = `${key?.replace("_", "-")}`;
                        letterDys.dataset.LisioLetter = value2.toLowerCase();
                        letterDys.innerText = exec[0];
                        if (insertBefore != void 0 && nodeCompl != void 0) {
                          cloneNode.insertBefore(letterDys, insertBefore);
                        } else {
                          cloneNode.appendChild(letterDys);
                        }
                      }
                      if (find) {
                        if (insertBefore != void 0 && nodeCompl) {
                          cloneNode.insertBefore(
                            document.createTextNode(
                              base.slice(i + value2.length)
                            ),
                            insertBefore
                          );
                        } else {
                          cloneNode.appendChild(
                            document.createTextNode(
                              base.slice(i + value2.length)
                            )
                          );
                        }
                        index2 = 0;
                      }
                    }
                  }
                }
              }
            }
          }
          const parent = this._nodes[index].parentElement;
          if (parent != void 0) {
            parent.replaceChild(cloneNode, this._nodes[index]);
            if (this._nodes.indexOf(parent) != -1) {
              this._nodes[this._nodes.indexOf(parent)].replaceChild(
                cloneNode,
                this._nodes[index]
              );
            }
          }
          this._nodes[index] = cloneNode;
        }
      }
    } else {
      LisioStyleSheetController.current.removeRule(".underline-red");
      LisioStyleSheetController.current.removeRule(".underline-green");
      LisioStyleSheetController.current.removeRule(".underline-blue");
    }
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  adaptFunction(element, _value) {
    if (element.textContent?.trim() != "") {
      if (this._nodes.indexOf(element) == -1 && element.localName != "i" && element.localName != "script" && element.localName != "style" && !element.className.includes("icon")) {
        this._nodes.push(element);
        if (window.getComputedStyle(element).display == "flex") {
          element.style.display = "block";
        }
      }
    }
  }
  deleteLetter(letter) {
    const letterTxt = letter.innerText;
    if (letter.previousSibling != void 0 && letter.previousSibling.nodeValue != void 0) {
      if (letter.previousSibling.nodeType == 3) {
        letter.previousSibling.nodeValue = letter.previousSibling.nodeValue.concat(
          letterTxt,
          letter.nextSibling?.nodeValue == void 0 ? "" : letter.nextSibling.nodeValue
        );
        if (letter.nextSibling != void 0) {
          letter.nextSibling.remove();
        }
      }
    } else {
      if (letter.nextSibling != null) {
        if (letter.nextSibling.nodeType == 3) {
          letter.nextSibling.nodeValue = letterTxt.concat(
            letter.nextSibling.nodeValue == void 0 ? "" : letter.nextSibling.nodeValue
          );
          letter.nextSibling.remove();
        }
      }
    }
    letter.remove();
  }
}
class LisioHightlightLinksAdapter extends LisioAdapter {
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {string} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(_, value) {
    const elements = document.body.querySelectorAll(
      'a,button,input[type="submit"],[role="button"]'
    );
    for (const element of elements) {
      this.adaptFunction(element, value);
    }
    LisioStyleSheetController.current.removeRule(".lisio-highlight");
    if (value) {
      const propertiesToAdd = /* @__PURE__ */ new Map([
        [LisioCSSProperties.BACKGROUND, "none"],
        [LisioCSSProperties.BACKGROUND_COLOR, "yellow"],
        [LisioCSSProperties.COLOR, "blue"],
        [LisioCSSProperties.BOX_SHADOW, "-5px 5px 2px #FFFF50"],
        [LisioCSSProperties.BORDER, "yellow 3px solid"],
        [LisioCSSProperties._WEBKIT_TEXT_FILL_COLOR, "initial"]
      ]);
      LisioStyleSheetController.current.insertRule(
        ".lisio-highlight",
        propertiesToAdd
      );
    }
  }
  adaptFunction(element, value) {
    if (value) {
      if (element.firstElementChild != null && element.firstElementChild.localName == "img") {
        element.firstElementChild.classList.add("lisio-highlight");
        LisioStyleSheetController.current.replaceImportantInStyleAttribute(
          [
            LisioCSSProperties.COLOR,
            LisioCSSProperties.BACKGROUND,
            LisioCSSProperties.BACKGROUND_COLOR,
            LisioCSSProperties.BOX_SHADOW,
            LisioCSSProperties.BORDER
          ],
          element.firstElementChild
        );
      } else {
        element.classList.add("lisio-highlight");
        LisioStyleSheetController.current.replaceImportantInStyleAttribute(
          [
            LisioCSSProperties.COLOR,
            LisioCSSProperties.BACKGROUND,
            LisioCSSProperties.BACKGROUND_COLOR,
            LisioCSSProperties.BOX_SHADOW,
            LisioCSSProperties.BORDER
          ],
          element
        );
      }
    } else {
      if (element.firstElementChild != null && element.firstElementChild.localName == "img") {
        element.firstElementChild.classList.remove("lisio-highlight");
      } else {
        element.classList.remove("lisio-highlight");
      }
    }
  }
}
class LisioKeyboardNavigationAdapter extends LisioAdapter {
  _keyDownHandlerBind = this.keyDownHandler.bind(this);
  _navigableElements = {
    title: {
      array: [],
      currentIndex: 0
    },
    list: {
      array: [],
      currentIndex: 0
    },
    list_item: {
      array: [],
      currentIndex: 0
    },
    form: {
      array: [],
      currentIndex: 0
    },
    img: {
      array: [],
      currentIndex: 0
    }
  };
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {boolean} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(_, value) {
    this.adaptFunction(document.documentElement, value);
    if (value) {
      const navigableElements = Array.from(
        document.body.querySelectorAll(
          "h1,h2,h3,h4,h5,h6,ul,ol,form,li,img,svg"
        )
      );
      for (const navigableElement of navigableElements) {
        if (/h[1-6]/.test(navigableElement.localName)) {
          this._navigableElements.title.array.push(navigableElement);
        } else if (["ul", "ol"].includes(navigableElement.localName)) {
          this._navigableElements.list.array.push(navigableElement);
        } else if (navigableElement.localName === "li") {
          this._navigableElements.list_item.array.push(navigableElement);
        } else if (navigableElement.localName === "form") {
          this._navigableElements.form.array.push(navigableElement);
        } else if (navigableElement.localName === "img" || navigableElement.localName === "svg") {
          this._navigableElements.img.array.push(navigableElement);
        }
      }
    }
  }
  adaptFunction(element, value) {
    if (value) {
      element.addEventListener("keydown", this._keyDownHandlerBind);
    } else {
      element.removeEventListener("keydown", this._keyDownHandlerBind);
    }
  }
  isActuallyVisible(element) {
    if (!document.documentElement.contains(element)) return false;
    const style = getComputedStyle(element);
    if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0" || element.hidden) {
      return false;
    }
    const rect = element.getBoundingClientRect();
    if (rect.width === 0 || rect.height === 0) {
      return false;
    }
    if (element.parentElement) {
      return this.isActuallyVisible(element.parentElement);
    }
    return true;
  }
  keyDownHandler(event) {
    const target = event.target;
    if (event.key.toLowerCase() === "t" && target?.localName != "input" && target?.localName != "textarea") {
      this.navigateTo(
        this._navigableElements.title,
        this._navigableElements.title.currentIndex,
        true
      );
    } else if (event.key.toLowerCase() === "l" && target?.localName != "input" && target?.localName != "textarea") {
      this.navigateTo(
        this._navigableElements.list,
        this._navigableElements.list.currentIndex,
        true
      );
    } else if (event.key.toLowerCase() === "e" && target?.localName != "input" && target?.localName != "textarea") {
      this.navigateTo(
        this._navigableElements.list_item,
        this._navigableElements.list_item.currentIndex,
        true
      );
    } else if (event.key.toLowerCase() === "f" && target?.localName != "input" && target?.localName != "textarea") {
      this.navigateTo(
        this._navigableElements.form,
        this._navigableElements.form.currentIndex,
        true
      );
    } else if (event.key.toLowerCase() === "i" && target?.localName != "input" && target?.localName != "textarea") {
      this.navigateTo(
        this._navigableElements.img,
        this._navigableElements.img.currentIndex,
        true
      );
    }
  }
  navigateTo(navigableElement, startingIndex, isStart) {
    if (startingIndex !== navigableElement.currentIndex || startingIndex === navigableElement.currentIndex && isStart) {
      if (!this.isActuallyVisible(
        navigableElement.array[navigableElement.currentIndex]
      )) {
        navigableElement.currentIndex++;
        if (navigableElement.currentIndex == navigableElement.array.length) {
          navigableElement.currentIndex = 0;
        }
        this.navigateTo(navigableElement, startingIndex, false);
      } else {
        if (navigableElement.array[navigableElement.currentIndex].tabIndex === -1) {
          navigableElement.array[navigableElement.currentIndex].setAttribute(
            "tabindex",
            "-1"
          );
        }
        navigableElement.array[navigableElement.currentIndex].focus();
        navigableElement.array[navigableElement.currentIndex].scrollIntoView({
          behavior: "smooth",
          block: "center",
          inline: "nearest"
        });
        navigableElement.currentIndex++;
        if (navigableElement.currentIndex == navigableElement.array.length) {
          navigableElement.currentIndex = 0;
        }
      }
    }
  }
}
const styles$4 = '.sr-only-list {\n  border: 0 !important;\n  clip: rect(1px, 1px, 1px, 1px) !important;\n  -webkit-clip-path: inset(50%) !important;\n  clip-path: inset(50%) !important;\n  height: 1px !important;\n  overflow: hidden !important;\n  padding: 0 !important;\n  width: 1px !important;\n  white-space: nowrap !important;\n  display: inline-block !important;\n  margin-left: 2px !important;\n}\n\ndiv#lisio-list-div {\n  position: fixed;\n  top: 0;\n  z-index: 100;\n  display: flex;\n  flex-direction: column;\n  height: 100vh;\n  justify-content: center;\n  padding-block: 6vh;\n}\n\ndiv#lisio-list-div.lisio-right {\n  align-items: end;\n}\n\ndiv#lisio-list-div.lisio-left {\n  align-items: start;\n}\n\nbutton#lisio-list-button {\n  background-color: var(--theme-primary);\n  width: 30px;\n  height: 30px;\n  margin-bottom: 10px;\n  position: relative;\n  border-radius: 1000px;\n  border: none;\n  cursor: pointer;\n}\n\nbutton#lisio-list-button:before,\nbutton#lisio-list-button:after {\n  background-color: white;\n}\n\nbutton#lisio-list-button:after {\n  content: "";\n  position: absolute;\n  height: 80%;\n  width: 4px;\n  transform: translate(-50%, -50%) rotate(45deg);\n  border-radius: 10px;\n  top: 50%;\n  left: 50%;\n}\n\nbutton#lisio-list-button:before {\n  content: "";\n  position: absolute;\n  height: 80%;\n  width: 4px;\n  transform: translate(-50%, -50%) rotate(-45deg);\n  border-radius: 10px;\n  top: 50%;\n  left: 50%;\n}\n\n.lisio-closed button#lisio-list-button:after {\n  transform: translate(-50%, -50%) rotate(90deg);\n}\n\n.lisio-closed button#lisio-list-button:before {\n  transform: translate(-50%, -50%) rotate(0deg);\n}\n\nsection#lisio-list-section {\n  display: flex;\n  flex-direction: column;\n  background-color: #fff;\n  max-width: 30vw;\n  border: 1px solid #e4e4e4;\n  height: calc(88vh - 40px); \n  border-radius: 15px;\n  overflow: hidden;\n  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);\n}\n\nsection#lisio-list-section a {\n  text-decoration: none;\n  color: black;\n}\nsection#lisio-list-section a:hover {\n  text-decoration: underline;\n  color: black;\n}\n\nnav#lisio-list-nav {\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n  border-bottom: 1px solid #000;\n}\n\nnav#lisio-list-nav > div.lisio-nav-div {\n  width: 50%;\n  text-align: center;\n  cursor: pointer;\n  font-size: 25px;\n  padding-block: 2px;\n}\n\nnav#lisio-list-nav > div.lisio-nav-div.lisio-list-active {\n  background-color: var(--theme-primary);\n  color: white;\n}\n\nnav#lisio-list-nav #lisio-list-title,\nnav#lisio-list-nav #lisio-list-link {\n  pointer-events: none;\n  margin-block: 5px;\n}\n\n#lisio-list-links > li::before {\n  content: "🔗";\n  font-size: 20px;\n}\n\nnav#lisio-list-nav > div.lisio-nav-div:first-child {\n  border-right: 1px solid #000;\n}\n\nsection#lisio-list-section ul {\n  list-style-type: none;\n  padding: 10px;\n}\n\nsection#lisio-list-section > article > ul > li > a {\n  display: block;\n  width: 15vw;\n}\n\nsection#lisio-list-section > article > ul > li {\n  display: flex;\n  align-items: baseline;\n  gap: 8px;\n}\n\nsection#lisio-list-section > article > ul > li > span {\n  background-color: var(--theme-primary);\n  color: white;\n  padding: 0 2px 0 4px;\n  border-radius: 4px;\n  font-size: 15px;\n}\n\n.lisio-list-h1 {\n  font-size: 1.5em;\n  line-height: 1.5;\n}\n\n.lisio-list-h2 {\n  font-size: 1.4em;\n  line-height: 1.5;\n}\n\n.lisio-list-h3 {\n  font-size: 1.3em;\n  line-height: 1.5;\n}\n\n.lisio-list-h4 {\n  font-size: 1.2em;\n  line-height: 1.5;\n}\n\n.lisio-list-h5 {\n  font-size: 1.1em;\n  line-height: 1.5;\n}\n\n.lisio-list-h6 {\n  font-size: 1em;\n  line-height: 1.5;\n}\n\n.lisio-list-link {\n  font-size: 1.5em;\n  line-height: 1.5;\n}\n\n.lisio-overflow-auto {\n  overflow: auto;\n}\n\n@supports(height:1dvh){\n  div#lisio-list-div{\n    height: 100dvh;\n    padding-block: 6dvh;\n  }\n  section#lisio-list-section{\n    height: calc(88dvh - 40px);\n  }\n}\n';
class LisioWalker {
  _walker;
  /**
   * Constructor of class {@link Walker | Walker}
   * @param {number} whatToShow - Type of tree walker
   * @param {NodeFilter | undefined} filter - Custom filter for tree walker
   */
  constructor(whatToShow, root, filter) {
    this._walker = document.createTreeWalker(root, whatToShow, filter);
  }
  explore(callback) {
    let node = this._walker.nextNode();
    while (node != void 0) {
      callback(node);
      node = this._walker.nextNode();
    }
    this._walker.currentNode = this._walker.root;
  }
  resetWalker() {
    this._walker.currentNode = this._walker.root;
  }
}
class LisioTextTreeWalker extends LisioWalker {
  _tags = /* @__PURE__ */ new Map();
  _texts = /* @__PURE__ */ new Map();
  // public recursive(
  //   parent: HTMLElement,
  //   id: number,
  // ) {
  //   if (
  //     parent.localName == "span" ||
  //     parent.localName == "i" ||
  //     parent.localName == "strong" ||
  //     /h[123456]/.test(parent.tagName)
  //   ) {
  //     this._tags.delete(id);
  //     this._tags.set(id, parent);
  //     // this.texts[i] = this.tags[i].innerText;
  //     parent.dataset.lisioIndex = id.toString();
  //     for (const child of parent.children) {
  //       delete (child as HTMLElement).dataset.lisioIndex;
  //     }
  //     if (parent.parentElement != undefined) {
  //       this.recursive(parent.parentElement, id);
  //     }
  //   }
  // }
  /**
   * Constructor of class {@link TextTreeWalker | TextTreeWalker}
   * @param {NodeFilter | undefined} filter - Custom filter for tree walker
   */
  constructor(root, filter) {
    super(NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT, root, filter);
  }
  get tags() {
    return this._tags;
  }
  get texts() {
    return this._texts;
  }
  getTextes() {
    if (this._texts.size <= 0) {
      this.explore(this.getTextesExploreCallback.bind(this));
    }
    for (const tag of Array.from(this._tags.values())) {
      const uselessLisioIndexes = tag.querySelectorAll("[data-lisio-index]");
      for (const uselessLisioIndex of uselessLisioIndexes) {
        this._tags.delete(
          Number.parseInt(uselessLisioIndex.dataset.lisioIndex)
        );
        delete uselessLisioIndex.dataset.lisioIndex;
      }
    }
  }
  resetWalker() {
    super.resetWalker();
    this._texts.clear();
    this._tags.clear();
  }
  setDefault() {
    if (this._tags.size <= 0) {
      this.explore(this.setDefaultWalkerCallback);
    }
  }
  getTextesExploreCallback(node) {
    const parent = node.parentElement;
    if (!parent || ["script", "noscript", "style", "title"].includes(parent.localName) || node.nodeValue === void 0) {
      return;
    }
    const trimmedValue = node.nodeType === Node.TEXT_NODE ? node.nodeValue?.trim() : node.getAttribute("placeholder");
    if (!trimmedValue || !/[\p{L}\p{N}]/u.test(trimmedValue)) {
      return;
    }
    let targetElement = null;
    if (node.nodeType === Node.TEXT_NODE) {
      if (parent.localName === "font" && parent.dataset.lisioLetter === void 0 && parent.parentElement?.parentElement) {
        targetElement = parent.closest(":not(font)");
      } else {
        targetElement = parent;
      }
    }
    if (node.nodeType === Node.ELEMENT_NODE) {
      if (node.getAttribute("placeholder")) {
        targetElement = node;
      }
    }
    if (!targetElement) return;
    const textContent = node.nodeType === Node.TEXT_NODE ? targetElement.innerText?.trim() || targetElement.textContent?.trim() : node.getAttribute("placeholder");
    if (!textContent) return;
    const index = this._tags.size;
    this._texts.set(index, textContent);
    this._tags.set(index, targetElement);
    targetElement.dataset.lisioIndex = index.toString();
  }
  setDefaultWalkerCallback(node) {
    const element = node;
    const prefix = "lisio-";
    const classes = element.className ? element.className.split(" ").filter((c) => !c.startsWith(prefix)) : [];
    element.className = classes.join(" ").trim();
    if (element.classList.contains("start-synth")) {
      element.classList.add("lisio-hidden");
    }
    delete element.dataset.lisioFontSize;
    delete element.dataset.lisioLineHeight;
    delete element.dataset.lisioWordSpacing;
    delete element.dataset.lisioLetterSpacing;
    delete element.dataset.lisioBigger;
    delete element.dataset.lisioTransition;
    delete element.dataset.lisioAnimation;
    if (element.hasAttribute("lisio-already-trans-in") && element.dataset.lisioOriginalText != void 0) {
      delete element.dataset.lisioAlreadyTransIn;
      element.innerHTML = element.dataset.lisioOriginalText;
      delete element.dataset.lisioOriginalText;
      element.removeAttribute("lang");
      element.removeAttribute("xml:lang");
      element.removeAttribute("dir");
    }
    delete element.dataset.lisioAlreadyMin;
  }
}
class LisioListAdapter extends LisioAdapter {
  _deeplAdapter;
  _idPlaceholder = 0;
  _lisioListDiv;
  _listLinks;
  _listTitles;
  _paramsController;
  _sectionList;
  constructor(lisioConfig, paramsController, deeplAdapter) {
    super();
    this._paramsController = paramsController;
    this._deeplAdapter = deeplAdapter;
    this._listTitles = document.createElement("ul");
    this._listTitles.id = "lisio-list-titles";
    this._listTitles.dataset.lisioList = "titles";
    this._listLinks = document.createElement("ul");
    this._listLinks.id = "lisio-list-links";
    this._listLinks.dataset.lisioList = "links";
    this._listLinks.classList.add("lisio-hidden");
    const article = document.createElement("article");
    article.classList.add("lisio-overflow-auto");
    article.append(this._listTitles, this._listLinks);
    this._sectionList = document.createElement("section");
    this._sectionList.innerHTML = `
      <nav id="lisio-list-nav">
        <div class="lisio-nav-div lisio-list-active" data-lisio-target="titles" tabindex="0">
          <p id="lisio-list-title">${LisioTranslationController.current.getTranslation("listTitle")}</p>
        </div>
        <div class="lisio-nav-div" data-lisio-target="links" tabindex="0">
          <p id="lisio-list-link">${LisioTranslationController.current.getTranslation("listLink")}</p>
        </div>
      </nav>
    `;
    this._sectionList.append(article);
    this._sectionList.id = "lisio-list-section";
    this._lisioListDiv = document.createElement("div");
    this._lisioListDiv.id = "lisio-list-div";
    this._lisioListDiv.classList.add(
      "lisio-flex-col",
      lisioConfig.userSettings.positionX === "R" ? "lisio-right" : "lisio-left"
    );
    this._lisioListDiv.innerHTML = `
      <button id="lisio-list-button" aria-controls="lisio-list-section" aria-label="${LisioTranslationController.current.getTranslation("closeWindow")}" class="${lisioConfig.userSettings.positionX === "R" ? "lisio-right" : "lisio-left"} lisio-self-end"></button>
    `;
    this._lisioListDiv.append(this._sectionList);
    const button = this._lisioListDiv.querySelector("button#lisio-list-button");
    const disableHandler = (event) => {
      if (event.target instanceof HTMLElement && event.target.nextElementSibling != void 0) {
        LisioMessageManager.current.sendDisableParameter(
          LisioBooleanParameterNames.LIST
        );
      }
    };
    if (button instanceof HTMLElement) {
      button.addEventListener("click", disableHandler);
      button.addEventListener("keydown", (event) => {
        if (event.isComposing || event.key === "Enter") {
          event.preventDefault();
          disableHandler(event);
        }
      });
    }
    window.addEventListener("lisio-lang-change", () => {
      LisioTranslationController.current.translateList(this._sectionList);
    });
  }
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {boolean} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(_, value) {
    const titles = document.body.querySelectorAll("h1,h2,h3,h4,h5,h6");
    const links = document.body.querySelectorAll("a");
    while (this._listTitles.firstChild != void 0) {
      this._listTitles.firstChild.remove();
    }
    while (this._listLinks.firstChild != void 0) {
      this._listLinks.firstChild.remove();
    }
    for (const element of this._sectionList.querySelectorAll(
      "div.lisio-nav-div"
    )) {
      const lists = this._sectionList?.querySelectorAll("ul");
      const changeTab = (event) => {
        if (event.target instanceof HTMLElement) {
          const target = event.target.dataset.lisioTarget;
          LisioShadowRootController.current.root.querySelectorAll("div.lisio-nav-div.lisio-list-active").forEach((element2) => {
            element2.classList.remove("lisio-list-active");
          });
          for (const list of lists) {
            if (list.dataset.lisioList == target) {
              list.classList.remove("lisio-hidden");
              event.target.classList.add("lisio-list-active");
            } else {
              list.classList.add("lisio-hidden");
            }
          }
        }
      };
      const htmlElement = element;
      htmlElement.addEventListener("click", changeTab);
      htmlElement.addEventListener("keydown", (event) => {
        if (event.key === "Enter" || event.key === " ") {
          changeTab(event);
        }
      });
    }
    if (value) {
      for (const tag of [...titles, ...links]) {
        if (tag.innerText?.trim() != "") {
          this.adaptFunction(tag, value);
        }
      }
      LisioShadowRootController.current.appendElement(
        this._lisioListDiv,
        styles$4
      );
      if (this._paramsController.params.has(
        LisioStringParameterNames.DEEPL_TRANSLATION
      )) {
        const deeplValue = this._paramsController.params.get(
          LisioStringParameterNames.DEEPL_TRANSLATION
        );
        this.prepareForDeeplTrans(deeplValue);
      }
    } else {
      LisioShadowRootController.current.removeElement(
        this._lisioListDiv,
        styles$4
      );
    }
  }
  createOpenTab(aDomElement) {
    const spanOpenNewTab = document.createElement("span");
    spanOpenNewTab.className = "sr-only-list";
    spanOpenNewTab.innerHTML = `&nbsp;-&nbsp;${LisioTranslationController.current.getTranslation("popin2025_newTab")}`;
    const svgNS = "http://www.w3.org/2000/svg";
    const svg = document.createElementNS(svgNS, "svg");
    svg.setAttribute("xmlns", svgNS);
    svg.setAttribute("aria-hidden", "true");
    svg.setAttribute("width", "10");
    svg.setAttribute("height", "10");
    svg.setAttribute("viewBox", "0 0 10 10");
    svg.setAttribute("fill", "none");
    svg.classList.add("newtab");
    const path = document.createElementNS(svgNS, "path");
    path.setAttribute(
      "d",
      "M6.25 0a.62.62 0 1 0 0 1.25h1.62L3.93 5.18a.63.63 0 0 0 .89.89l3.93-3.94v1.62a.62.62 0 1 0 1.25 0V.62A.62.62 0 0 0 9.37 0H6.25ZM1.56.63C.7.63 0 1.32 0 2.19v6.25C0 9.3.7 10 1.56 10h6.25c.87 0 1.57-.7 1.57-1.56V6.25a.62.62 0 1 0-1.26 0v2.19c0 .17-.14.31-.3.31H1.55a.31.31 0 0 1-.31-.31V2.19c0-.17.14-.31.31-.31h2.19a.62.62 0 1 0 0-1.25H1.56Z"
    );
    path.setAttribute("fill", "currentColor");
    svg.appendChild(path);
    aDomElement.appendChild(spanOpenNewTab);
    aDomElement.appendChild(svg);
  }
  prepareForDeeplTrans(value) {
    const hTreeWalker = new LisioTextTreeWalker(this._listTitles, (n) => {
      if (n.nodeType === Node.TEXT_NODE) {
        if (n.nodeValue?.trim() != "" && n.parentElement != void 0 && !["script", "noscript", "style", "title"].includes(
          n.parentElement.localName
        )) {
          return NodeFilter.FILTER_ACCEPT;
        } else {
          return NodeFilter.FILTER_REJECT;
        }
      }
      return NodeFilter.FILTER_SKIP;
    });
    const listTreeWalker = new LisioTextTreeWalker(this._listTitles, (n) => {
      if (n.nodeType === Node.TEXT_NODE) {
        if (n.nodeValue?.trim() != "" && n.parentElement != void 0 && !["script", "noscript", "style", "title"].includes(
          n.parentElement.localName
        )) {
          return NodeFilter.FILTER_ACCEPT;
        } else {
          return NodeFilter.FILTER_REJECT;
        }
      }
      return NodeFilter.FILTER_SKIP;
    });
    hTreeWalker.getTextes();
    listTreeWalker.getTextes();
    this._deeplAdapter.observeTags(hTreeWalker, value);
    this._deeplAdapter.observeTags(listTreeWalker, value);
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  adaptFunction(element, _value) {
    if (element instanceof HTMLHeadingElement) {
      const li = document.createElement("li");
      let h = 0;
      if (element.localName == "h1") {
        h = 1;
      } else if (element.localName == "h2") {
        h = 2;
      } else if (element.localName == "h3") {
        h = 3;
      } else if (element.localName == "h4") {
        h = 4;
      } else if (element.localName == "h5") {
        h = 5;
      } else if (element.localName == "h6") {
        h = 6;
      }
      if (h > 1) {
        const styleRule = `li.lisio-list-h${h} { ${LisioCSSProperties.MARGIN_LEFT}: ${h - 1}rem; }`;
        LisioShadowRootController.current.addStyles(styleRule);
      }
      this._listTitles.appendChild(li);
      li.classList.add(`lisio-list-h${h}`);
      const span = document.createElement("span");
      span.innerText = `${h}.`;
      li.appendChild(span);
      const a = document.createElement("a");
      a.innerText += element.innerText.trim();
      a.innerText = a.innerText.split("\n")[0];
      if (element.id == "") {
        element.id = `lisio-placeholder-id-${this._idPlaceholder}`;
        this._idPlaceholder++;
      }
      a.href = `#${element.id}`;
      li.appendChild(a);
    } else if (element instanceof HTMLAnchorElement) {
      if (element.innerText.trim() != "") {
        const li = document.createElement("li");
        li.classList.add("lisio-list-link");
        this._listLinks.appendChild(li);
        const a = document.createElement("a");
        a.innerText += element.innerText.trim();
        a.innerText = a.innerText.split("\n")[0];
        a.href = element.href;
        this.createOpenTab(a);
        li.appendChild(a);
      }
    }
  }
}
const styles$3 = "#lisio-echap {\n  color: white;\n  margin-top: 10%;\n  font-size: 1.5em;\n}\n\n.lisio-mask {\n  display: block;\n  position: fixed;\n  box-shadow: 0 0 0 100vh rgba(0, 0, 0, 0.9);\n  z-index: 536870911;\n  background: transparent;\n  pointer-events: none;\n  width: 100%;\n  height: 15vh;\n  transition: none;\n}\n";
class LisioReadingMask extends LisioAdapter {
  _mask;
  _mouseMoveHandlerBind = this.mouseMoveHandler.bind(this);
  _keyDownHandlerBind = this.keyDownHandler.bind(this);
  constructor() {
    super();
    this._mask = document.createElement("div");
    this._mask.classList.add("lisio-mask", "lisio-hidden");
    const p = document.createElement("p");
    p.innerHTML = "Pour quitter : cliquez sur la page, puis appuyer sur &Eacutechap";
    p.id = "lisio-echap";
    this._mask.appendChild(p);
  }
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {string} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(_, value) {
    this.adaptFunction(document.body, value);
  }
  adaptFunction(_element, value) {
    if (value) {
      LisioShadowRootController.current.appendElement(this._mask, styles$3);
      this._mask.classList.remove("lisio-hidden");
      window.addEventListener("mousemove", this._mouseMoveHandlerBind);
      window.addEventListener("keydown", this._keyDownHandlerBind);
    } else {
      this._mask.classList.add("lisio-hidden");
      window.removeEventListener("mousemove", this._mouseMoveHandlerBind);
      window.removeEventListener("keydown", this._keyDownHandlerBind);
      LisioShadowRootController.current.removeElement(this._mask, styles$3);
    }
  }
  keyDownHandler(event) {
    if (event.key.toLowerCase() === "escape" || event.key.toLowerCase() === "esc") {
      LisioMessageManager.current.sendDisableParameter(
        LisioBooleanParameterNames.READING_MASK
      );
    }
  }
  mouseMoveHandler(event) {
    this._mask.style.top = `${event.clientY - this._mask.offsetHeight / 2}px`;
  }
}
const styles$2 = "#lisio-bubble {\n  display: block;\n  position: absolute;\n  padding: 0.25em;\n  z-index: 2147483647;\n  background-color: #fff;\n  border: 1px #000 solid;\n  font-size: 1.5em;\n  min-width: 20ch;\n}";
class LisioShowAltAdapter extends LisioAdapter {
  _bubble;
  _mouseEnterHandlerBind = this.mouseEnterHandler.bind(this);
  _mouseMoveHandlerBind = this.mouseMoveHandler.bind(this);
  _mouseOutHandlerBind = this.mouseOutHandler.bind(this);
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {boolean} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(_, value) {
    const imgs = document.body.querySelectorAll("img");
    for (const img of imgs) {
      this.adaptFunction(img, value);
    }
    if (value && this._bubble == void 0) {
      this._bubble = document.createElement("div");
      this._bubble.id = "lisio-bubble";
      this._bubble.classList.add("lisio-bubble", "lisio-hidden");
      LisioShadowRootController.current.appendElement(this._bubble, styles$2);
    } else if (this._bubble != void 0) {
      LisioShadowRootController.current.removeElement(this._bubble, styles$2);
      this._bubble = void 0;
    }
  }
  adaptFunction(element, value) {
    if (value && !element.src.includes("/solution")) {
      element.addEventListener("mouseenter", this._mouseEnterHandlerBind);
      element.addEventListener("mousemove", this._mouseMoveHandlerBind);
      element.addEventListener("mouseout", this._mouseOutHandlerBind);
    } else if (!value && !element.src.includes("/solution")) {
      element.removeEventListener("mouseenter", this._mouseEnterHandlerBind);
      element.removeEventListener("mousemove", this._mouseMoveHandlerBind);
      element.removeEventListener("mouseout", this._mouseOutHandlerBind);
    }
  }
  mouseEnterHandler(event) {
    if (this._bubble != void 0) {
      if (this._bubble.textContent === "") {
        const txt = event.target.alt;
        if (txt != null && txt.trim() != "") {
          this._bubble.textContent = txt;
        } else {
          this._bubble.textContent = "Pas de description";
        }
      }
      this._bubble.classList.remove("lisio-hidden");
    }
  }
  mouseMoveHandler(event) {
    if (this._bubble != void 0) {
      this._bubble.style.top = `${event.clientY - 15}px`;
      this._bubble.style.left = `${event.clientX + 15}px`;
    }
  }
  mouseOutHandler() {
    if (this._bubble != void 0) {
      this._bubble.textContent = "";
      this._bubble.classList.add("lisio-hidden");
    }
  }
}
const helperStyles = "#lisio-explain-click {\n  position: absolute;\n  padding: 10px;\n  background-color: #005282;\n  border-radius: 5px;\n  z-index: 9999;\n  display: flex;\n  align-items: center;\n  gap: 5px;\n  min-width: 300px;\n  backdrop-filter: blur(2px);\n  -webkit-backdrop-filter: blur(2px), important;\n}\n\n#lisio-explain-click p {\n  font-size: 18px;\n  font-family: Arial, sans-serif;\n  padding: 0;\n  margin: 0;\n  color: white;\n}\n\n#lisio-explain-click svg {\n  vertical-align: initial;\n}\n\n#lisio-explain-click div {\n  height: 20px;\n  line-height: 0;\n}\n";
class LisioSpeechSynthesisAdapter extends LisioAdapter {
  _autoEnabled = true;
  _autoTimeout = -1;
  _currentIndexSynthVocal = -1;
  _cursorSize = "default";
  _iText = 0;
  _isFromKeyboard = false;
  _lastIText = 0;
  _lastTarget;
  _lisioExplainClick;
  _mutationObserver;
  _offsetTexts = [];
  _params;
  _pauseButton = `<path d="M0 11.7733C0 5.27106 6.00341 0 13.4091 0H43.591C50.9965 0 57 5.27106 57 11.7733V12.2268C57 18.7289 50.9965 24 43.591 24H13.4091C6.00341 24 0 18.7289 0 12.2268V11.7733Z" fill="#AD1A00"></path><path d="M50 12C50 16.9706 45.9706 21 41 21C36.0294 21 32 16.9706 32 12C32 7.02946 36.0294 3 41 3C45.9706 3 50 7.02946 50 12Z" fill="white"></path><path d="M19.37 13.6039C18.4421 14.2567 17.3285 14.6079 16.1862 14.6079C15.0439 14.6079 13.9303 14.2567 13.0024 13.6039C11.9242 13.6921 10.9177 14.1694 10.1782 14.9431C9.43863 15.717 9.01883 16.7322 9 17.7921V19.4852C9 20.5545 9.54579 21 10.5464 21H21.826C22.7356 21 23.3723 20.5545 23.3723 19.4852V17.7921C23.3723 15.6535 21.644 13.8713 19.37 13.6039ZM16.1862 5.31682C15.6367 5.31682 15.0926 5.42293 14.585 5.62887C14.0772 5.83482 13.6159 6.13674 13.2274 6.51738C12.4427 7.28614 12.0019 8.32868 12.0019 9.41583C12.0136 9.95421 12.1336 10.485 12.3549 10.9779C12.5761 11.4707 12.8944 11.9161 13.2915 12.2884C13.6885 12.6608 14.1565 12.953 14.6688 13.1481C15.1811 13.3432 15.7277 13.4376 16.2772 13.4257C17.3555 13.403 18.3832 12.9732 19.146 12.2262C19.9086 11.479 20.3473 10.4722 20.3705 9.41583C20.3705 8.32868 19.9297 7.28614 19.145 6.51738C18.3602 5.74869 17.296 5.31682 16.1862 5.31682ZM25.5555 14.9406C27.1663 13.3543 28.0707 11.2078 28.0707 8.97033C28.0707 6.73277 27.1663 4.58633 25.5555 3L24.1911 4.33665C24.8182 4.94186 25.3161 5.6633 25.6559 6.45865C25.9958 7.25421 26.1708 8.10795 26.1708 8.97033C26.1708 9.83265 25.9958 10.6864 25.6559 11.4819C25.3161 12.2774 24.8182 12.9987 24.1911 13.6039L25.5555 14.9406Z" fill="white"></path><path d="M23.589 12.8049C24.0442 12.3265 24.4053 11.7578 24.6518 11.1314C24.8983 10.505 25.0252 9.83327 25.0252 9.15492C25.0252 8.4765 24.8983 7.80479 24.6518 7.17838C24.4053 6.55197 24.0442 5.98326 23.589 5.50488L22.3494 6.81518C22.6438 7.12014 22.8778 7.48416 23.0376 7.88595C23.1974 8.28768 23.2795 8.71904 23.2795 9.15492C23.2795 9.59072 23.1974 10.0221 23.0376 10.4239C22.8778 10.8256 22.6438 11.1897 22.3494 11.4947L23.589 12.8049Z" fill="white"></path><path d="M38.2 6H37.8C36.8059 6 36 6.71108 36 7.58824V16.4118C36 17.2889 36.8059 18 37.8 18H38.2C39.1941 18 40 17.2889 40 16.4118V7.58824C40 6.71108 39.1941 6 38.2 6Z" fill="#AD1A00"></path><path d="M44.2 6H43.8C42.8059 6 42 6.71108 42 7.58824V16.4118C42 17.2889 42.8059 18 43.8 18H44.2C45.1941 18 46 17.2889 46 16.4118V7.58824C46 6.71108 45.1941 6 44.2 6Z" fill="#AD1A00"></path>`;
  _playButton = `<path d="M0 11.7733C0 5.27106 6.00341 0 13.4091 0H43.591C50.9965 0 57 5.27106 57 11.7733V12.2268C57 18.7289 50.9965 24 43.591 24H13.4091C6.00341 24 0 18.7289 0 12.2268V11.7733Z" fill="#005282"></path><path d="M50 12C50 16.9706 45.9706 21 41 21C36.0294 21 32 16.9706 32 12C32 7.02946 36.0294 3 41 3C45.9706 3 50 7.02946 50 12Z" fill="white"></path><path d="M19.37 13.6039C18.4421 14.2567 17.3285 14.6079 16.1862 14.6079C15.0439 14.6079 13.9303 14.2567 13.0024 13.6039C11.9242 13.6921 10.9177 14.1694 10.1782 14.9431C9.43863 15.717 9.01883 16.7322 9 17.7921V19.4852C9 20.5545 9.54579 21 10.5464 21H21.826C22.7356 21 23.3723 20.5545 23.3723 19.4852V17.7921C23.3723 15.6535 21.644 13.8713 19.37 13.6039ZM16.1862 5.31682C15.6367 5.31682 15.0926 5.42293 14.585 5.62887C14.0772 5.83482 13.6159 6.13674 13.2274 6.51738C12.4427 7.28614 12.0019 8.32868 12.0019 9.41583C12.0136 9.95421 12.1336 10.485 12.3549 10.9779C12.5761 11.4707 12.8944 11.9161 13.2915 12.2884C13.6885 12.6608 14.1565 12.953 14.6688 13.1481C15.1811 13.3432 15.7277 13.4376 16.2772 13.4257C17.3555 13.403 18.3832 12.9732 19.146 12.2262C19.9086 11.479 20.3473 10.4722 20.3705 9.41583C20.3705 8.32868 19.9297 7.28614 19.145 6.51738C18.3602 5.74869 17.296 5.31682 16.1862 5.31682ZM25.5555 14.9406C27.1663 13.3543 28.0707 11.2078 28.0707 8.97033C28.0707 6.73277 27.1663 4.58633 25.5555 3L24.1911 4.33665C24.8182 4.94186 25.3161 5.6633 25.6559 6.45865C25.9958 7.25421 26.1708 8.10795 26.1708 8.97033C26.1708 9.83265 25.9958 10.6864 25.6559 11.4819C25.3161 12.2774 24.8182 12.9987 24.1911 13.6039L25.5555 14.9406Z" fill="white"></path><path d="M23.589 12.8049C24.0442 12.3265 24.4053 11.7578 24.6518 11.1314C24.8983 10.505 25.0252 9.83327 25.0252 9.15492C25.0252 8.4765 24.8983 7.80479 24.6518 7.17838C24.4053 6.55197 24.0442 5.98326 23.589 5.50488L22.3494 6.81518C22.6438 7.12014 22.8778 7.48416 23.0376 7.88595C23.1974 8.28768 23.2795 8.71904 23.2795 9.15492C23.2795 9.59072 23.1974 10.0221 23.0376 10.4239C22.8778 10.8256 22.6438 11.1897 22.3494 11.4947L23.589 12.8049Z" fill="white"></path><path d="M46.7105 11.4247C47.0965 11.6888 47.0965 12.3112 46.7105 12.5753L38.9298 17.8982C38.5236 18.1761 38 17.8522 38 17.323V6.67705C38 6.14785 38.5236 5.82389 38.9298 6.10176L46.7105 11.4247Z" fill="#005282"></path>`;
  _playPauseInterval = -1;
  _previousReadenWord = {
    word: "",
    wordIndex: -1
  };
  _readenText;
  _stateSynth = false;
  _synthVocaleLeftClickMessageTimeOut = -1;
  _target;
  _utterThis;
  _vocalSynthesisMode = 0;
  _walker;
  clickRightSynthEventListenerBind = this.clickRightSynthEventListener.bind(this);
  clickSynthEventListenerBind = this.clickSynthEventListener.bind(this);
  clickSynthPauseEventListenerBind = this.clickSynthPauseEventListener.bind(this);
  constructor(walker, mutationObserver, params, vocalSynthesisMode) {
    super();
    this._walker = walker;
    this._mutationObserver = mutationObserver;
    this._params = params;
    this._cursorSize = this._params.params.get(LisioStringParameterNames.CURSOR_SIZE) || "default";
    this._vocalSynthesisMode = vocalSynthesisMode;
    window.addEventListener("lisio-lang-change", () => {
      LisioTranslationController.current.translateSpeechSynthesisButtons();
    });
  }
  set iText(value) {
    this._iText = value;
  }
  get lastIText() {
    return this._lastIText;
  }
  adapt(walker, value) {
    if (value) {
      const playMap = /* @__PURE__ */ new Map();
      const playBigMap = /* @__PURE__ */ new Map();
      const playVeryBigMap = /* @__PURE__ */ new Map();
      const pauseMap = /* @__PURE__ */ new Map();
      const pauseBigMap = /* @__PURE__ */ new Map();
      const pauseVeryBigMap = /* @__PURE__ */ new Map();
      const vocalMap = /* @__PURE__ */ new Map();
      const vocalBigMap = /* @__PURE__ */ new Map();
      const vocalVeryBigMap = /* @__PURE__ */ new Map();
      {
        playMap.set(
          LisioCSSProperties.CURSOR,
          `url("${"https://env-preprod-solution.lisio.fr"}/solution/dist-site/cursors/play/play.svg"), default`
        );
        playBigMap.set(
          LisioCSSProperties.CURSOR,
          `url("${"https://env-preprod-solution.lisio.fr"}/solution/dist-site/cursors/play/play-big.svg"), default`
        );
        playVeryBigMap.set(
          LisioCSSProperties.CURSOR,
          `url("${"https://env-preprod-solution.lisio.fr"}/solution/dist-site/cursors/play/play-verybig.svg"), default`
        );
        pauseMap.set(
          LisioCSSProperties.CURSOR,
          `url("${"https://env-preprod-solution.lisio.fr"}/solution/dist-site/cursors/pause/pause.svg"), default`
        );
        pauseBigMap.set(
          LisioCSSProperties.CURSOR,
          `url("${"https://env-preprod-solution.lisio.fr"}/solution/dist-site/cursors/pause/pause-big.svg"), default`
        );
        pauseVeryBigMap.set(
          LisioCSSProperties.CURSOR,
          `url("${"https://env-preprod-solution.lisio.fr"}/solution/dist-site/cursors/pause/pause-verybig.svg"), default`
        );
        vocalMap.set(
          LisioCSSProperties.CURSOR,
          `url("${"https://env-preprod-solution.lisio.fr"}/solution/dist-site/cursors/vocal/vocal.svg"), default`
        );
        vocalBigMap.set(
          LisioCSSProperties.CURSOR,
          `url("${"https://env-preprod-solution.lisio.fr"}/solution/dist-site/cursors/vocal/vocal-big.svg"), default`
        );
        vocalVeryBigMap.set(
          LisioCSSProperties.CURSOR,
          `url("${"https://env-preprod-solution.lisio.fr"}/solution/dist-site/cursors/vocal/vocal-verybig.svg"), default`
        );
      }
      LisioStyleSheetController.current.insertRule(
        ".lisio-vocal-synthesis-active:not(.lisio-vocal-synthesis-reading) *[data-lisio-index]:hover,.lisio-vocal-synthesis-active:not(.lisio-vocal-synthesis-reading) *[data-lisio-index]:hover *,.lisio-vocal-synthesis-active:not(.lisio-vocal-synthesis-reading) *[data-lisio-index]:hover::placeholder",
        playMap
      );
      LisioStyleSheetController.current.insertRule(
        ".lisio-vocal-synthesis-active.synth-big:not(.lisio-vocal-synthesis-reading) *[data-lisio-index]:hover,.lisio-vocal-synthesis-active.synth-big:not(.lisio-vocal-synthesis-reading) *[data-lisio-index]:hover *,.lisio-vocal-synthesis-active.synth-big:not(.lisio-vocal-synthesis-reading) *[data-lisio-index]:hover::placeholder",
        playBigMap
      );
      LisioStyleSheetController.current.insertRule(
        ".lisio-vocal-synthesis-active.synth-very-big:not(.lisio-vocal-synthesis-reading) *[data-lisio-index]:hover,.lisio-vocal-synthesis-active.synth-very-big:not(.lisio-vocal-synthesis-reading) *[data-lisio-index]:hover *,.lisio-vocal-synthesis-active.synth-very-big:not(.lisio-vocal-synthesis-reading) *[data-lisio-index]:hover::placeholder",
        playVeryBigMap
      );
      LisioStyleSheetController.current.insertRule(
        ".lisio-vocal-synthesis-active.lisio-vocal-synthesis-reading.lisio-default *",
        pauseMap
      );
      LisioStyleSheetController.current.insertRule(
        ".lisio-vocal-synthesis-active.lisio-vocal-synthesis-reading.lisio-default.synth-big *",
        pauseBigMap
      );
      LisioStyleSheetController.current.insertRule(
        ".lisio-vocal-synthesis-active.lisio-vocal-synthesis-reading.lisio-default.synth-verybig * ",
        pauseVeryBigMap
      );
      LisioStyleSheetController.current.insertRule(
        ".lisio-vocal-synthesis-active:not(.lisio-vocal-synthesis-reading):not(.lisio-vocal-synthesis-mode-1) *",
        vocalMap
      );
      LisioStyleSheetController.current.insertRule(
        ".lisio-vocal-synthesis-active:not(.lisio-vocal-synthesis-reading):not(.lisio-vocal-synthesis-mode-1).synth-big *",
        vocalBigMap
      );
      LisioStyleSheetController.current.insertRule(
        ".lisio-vocal-synthesis-active:not(.lisio-vocal-synthesis-reading):not(.lisio-vocal-synthesis-mode-1).synth-verybig *",
        vocalVeryBigMap
      );
      LisioStyleSheetController.current.insertRawRule(
        "start-synth",
        `.start-synth{border: none;background-color: transparent;padding: 0;}`
      );
      LisioStyleSheetController.current.insertRawRule(
        "start-synth svg",
        `.start-synth svg{display: block;}`
      );
      LisioStyleSheetController.current.insertRawRule(
        "start-synth-first",
        `.start-synth-first{position: absolute; z-index:2147483647}`
      );
      LisioStyleSheetController.current.insertRawRule(
        "lisio-vocal-synthesis-active:not",
        `.lisio-vocal-synthesis-active:not(.lisio-vocal-synthesis-reading) *[data-lisio-index]:hover,.lisio-vocal-synthesis-active:not(.lisio-vocal-synthesis-reading) *[data-lisio-index]:hover *,.lisio-vocal-synthesis-active:not(.lisio-vocal-synthesis-reading) *[data-lisio-index]:hover::placeholder{background-color: rgb(197, 241, 243)!important;border-radius: 5px;color: black !important;-webkit-text-fill-color: black !important;}`
      );
      LisioStyleSheetController.current.insertRawRule(
        "lisio-vocal-synthesis-active",
        `.lisio-vocal-synthesis-active.lisio-vocal-synthesis-reading .lisio-speech-active, .lisio-vocal-synthesis-active.lisio-vocal-synthesis-reading .lisio-speech-active::placeholder{box-shadow: 0px 0px 0px 2px #4ab7ba;background-color: white !important;color: black !important;-webkit-text-fill-color: black !important;border-radius: 5px;}`
      );
      LisioStyleSheetController.current.insertRawRule(
        "mark",
        `mark[data-mark="lisio"],mark[data-mark="lisio"] *{background-color: rgb(197, 241, 243)!important;border-radius: 3px;color: black !important;-webkit-text-fill-color: black !important;padding: 0 !important; font: inherit !important}`
      );
      if (this._offsetTexts.length === 0) {
        this.initialize(walker);
      }
      this._cursorSize = this._params.params.get(LisioStringParameterNames.CURSOR_SIZE) || "default";
      if (!isTouchDeviceLisio()) {
        for (const element of document.querySelectorAll(
          "[data-lisio-index]"
        )) {
          element.addEventListener("click", this.clickSynthEventListenerBind);
        }
      }
      if (!isTouchDeviceLisio()) {
        document.documentElement.addEventListener(
          "click",
          this.clickSynthPauseEventListenerBind
        );
      }
      if (!isTouchDeviceLisio()) {
        document.addEventListener("keydown", (e) => {
          this._isFromKeyboard = e.key === "ContextMenu" || e.shiftKey && e.key === "F10";
        });
        document.addEventListener(
          "contextmenu",
          this.clickRightSynthEventListenerBind
        );
      }
      if (!this._utterThis) {
        this._utterThis = new SpeechSynthesisUtterance("");
        this._utterThis.addEventListener("end", () => {
          if (!this._autoEnabled) {
            this._autoTimeout = setTimeout(this.next.bind(this), 100);
          }
        });
      }
      this._stateSynth = true;
      document.documentElement.classList.add("lisio-vocal-synthesis-active");
      if (this._cursorSize === "big") {
        document.documentElement.classList.add("synth-big");
      } else if (this._cursorSize === "very_big") {
        document.documentElement.classList.add("synth-verybig");
      }
      for (const button of document.querySelectorAll(
        "button.start-synth"
      )) {
        button.style.width = "57px";
        button.style.height = "24px";
        button.classList.remove("lisio-hidden");
        const altAria = LisioTranslationController.current.getTranslation("pauseSynthButton");
        if (window.speechSynthesis?.speaking) {
          if (button.children[0]) {
            button.children[0].innerHTML = this._pauseButton;
          }
          button.setAttribute("aria-label", altAria);
        }
      }
    } else if (!value) {
      LisioStyleSheetController.current.removeRule(
        ".lisio-vocal-synthesis-active *[data-lisio-index], .lisio-vocal-synthesis-active *[data-lisio-index] *"
      );
      LisioStyleSheetController.current.removeRule(
        ".lisio-vocal-synthesis-active.synth-big *[data-lisio-index], .lisio-vocal-synthesis-active.synth-big *[data-lisio-index] *"
      );
      LisioStyleSheetController.current.removeRule(
        ".lisio-vocal-synthesis-active.synth-verybig *[data-lisio-index], .lisio-vocal-synthesis-active.synth-verybig *[data-lisio-index] * "
      );
      LisioStyleSheetController.current.removeRule(
        ".lisio-vocal-synthesis-active.lisio-vocal-synthesis-reading.lisio-default *"
      );
      LisioStyleSheetController.current.removeRule(
        ".lisio-vocal-synthesis-active.lisio-vocal-synthesis-reading.lisio-default.synth-big *"
      );
      LisioStyleSheetController.current.removeRule(
        ".lisio-vocal-synthesis-active.lisio-vocal-synthesis-reading.lisio-default.synth-verybig * "
      );
      LisioStyleSheetController.current.removeRule(
        ".lisio-vocal-synthesis-active:not(.lisio-vocal-synthesis-reading):not(.lisio-vocal-synthesis-mode-1) *"
      );
      LisioStyleSheetController.current.removeRule(
        ".lisio-vocal-synthesis-active:not(.lisio-vocal-synthesis-reading):not(.lisio-vocal-synthesis-mode-1).synth-big *"
      );
      LisioStyleSheetController.current.removeRule(
        ".lisio-vocal-synthesis-active:not(.lisio-vocal-synthesis-reading):not(.lisio-vocal-synthesis-mode-1).synth-verybig *"
      );
      LisioStyleSheetController.current.removeRule("start-synth");
      LisioStyleSheetController.current.removeRule("start-synth svg");
      LisioStyleSheetController.current.removeRule(
        "lisio-vocal-synthesis-active:not"
      );
      LisioStyleSheetController.current.removeRule(
        "lisio-vocal-synthesis-active"
      );
      LisioStyleSheetController.current.removeRule("mark");
      this._iText = 0;
      document.removeEventListener("click", this.clickSynthEventListenerBind);
      document.removeEventListener(
        "contextmenu",
        this.clickRightSynthEventListenerBind
      );
      document.documentElement.classList.remove("lisio-vocal-synthesis-active");
      document.body.classList.remove("lisio-cursor-vocal");
      document.documentElement.classList.remove("synth-verybig");
      document.documentElement.classList.remove("synth-big");
      for (const elt of document.querySelectorAll(
        ".lisio-cursor-play"
      )) {
        elt.classList.remove("lisio-cursor-play");
      }
      window.speechSynthesis?.cancel();
      this.removeMarker();
      this._autoEnabled = true;
      this._stateSynth = false;
      if (this._autoTimeout != void 0) {
        clearTimeout(this._autoTimeout);
      }
      this._lastTarget = document.querySelector(".lisio-speech-active");
      if (this._lastTarget != null) {
        this._lastTarget.classList.remove("lisio-speech-active");
      }
      const altAria = LisioTranslationController.current.getTranslation("startSynthButton");
      for (const synthButton of document.querySelectorAll(".start-synth")) {
        synthButton.classList.add("lisio-hidden");
        if (synthButton.classList.contains("start-synth-first")) {
          synthButton.setAttribute(
            "aria-label",
            LisioTranslationController.current.getTranslation(
              "startSynthFirstButton"
            )
          );
        } else {
          synthButton.setAttribute("aria-label", altAria);
        }
        if (synthButton.children[0] != void 0) {
          synthButton.children[0].innerHTML = this._playButton;
        }
      }
      this._utterThis = void 0;
      if (!isTouchDeviceLisio()) {
        document.documentElement.removeEventListener(
          "click",
          this.clickSynthPauseEventListenerBind
        );
      }
    }
  }
  initialize(walker) {
    const hsX = [[], [], [], [], [], []];
    const txtsX = [[], [], []];
    let max = 20;
    for (let i = walker.tags.size - 1; i > -1; i--) {
      const tag = walker.tags.get(i);
      if (tag != void 0 && tag.textContent) {
        for (const child of tag.querySelectorAll("[data-lisio-index]")) {
          delete child.dataset.lisioIndex;
        }
        if (isInViewport(tag)) {
          if (/h[123456]/g.test(tag.localName)) {
            hsX[parseInt(tag.tagName.charAt(1)) - 1].push(tag);
          } else if (tag.textContent.length > 79 && !txtsX[0].includes(tag)) {
            txtsX[0].push(tag);
          } else if (tag.textContent.length > 39 && !txtsX[1].includes(tag)) {
            txtsX[1].push(tag);
          } else if (tag.textContent.length > 19 && !txtsX[2].includes(tag)) {
            txtsX[2].push(tag);
          }
        }
      }
      if (tag?.nodeType === Node.ELEMENT_NODE && tag.tagName === "INPUT" && !txtsX[0].includes(tag)) {
        txtsX[0].push(tag);
      }
    }
    if (this._vocalSynthesisMode === 0) {
      if (isTouchDeviceLisio()) {
        let i = 0;
        hsX.forEach((hs) => {
          while (max > 0 && i < hs.length) {
            if (hs[i].previousElementSibling == null) {
              this.makeSynthButton(hs[i]);
            } else {
              if (hs[i].previousElementSibling?.localName != "button") {
                this.makeSynthButton(hs[i]);
              }
            }
            max--;
            i++;
          }
          i = 0;
        });
        txtsX.forEach((txts) => {
          while (max > 0 && i < txts.length) {
            if (txts[i].previousElementSibling == null && txts[i].dataset.lisioIndex && isInViewport(txts[i])) {
              this.makeSynthButton(txts[i]);
            } else {
              if (txts[i].previousElementSibling && txts[i].previousElementSibling?.localName != "button" && txts[i].dataset.lisioIndex && isInViewport(txts[i])) {
                this.makeSynthButton(txts[i]);
              }
            }
            max--;
            i++;
          }
          i = 0;
        });
      }
      if (!document.body?.firstElementChild?.classList.contains("start-synth") && !document.body?.firstElementChild?.classList.contains("skiptranslate")) {
        const button = document.createElement("button");
        const svg = document.createElementNS(
          "http://www.w3.org/2000/svg",
          "svg",
          {}
        );
        svg.setAttribute("width", "57");
        svg.setAttribute("height", "24");
        svg.setAttribute("viewBox", "0 0 57 24");
        svg.setAttribute("fill", "none");
        svg.innerHTML = this._playButton;
        const altAria = LisioTranslationController.current.getTranslation(
          "startSynthFirstButton"
        );
        button.setAttribute("aria-label", altAria);
        button.className = "start-synth start-synth-first lisio-hidden notranslate";
        button.appendChild(svg);
        button.addEventListener("click", () => {
          const htmlVocalReading = document.querySelector(
            ".lisio-vocal-synthesis-reading"
          );
          if (htmlVocalReading) {
            htmlVocalReading.classList.remove("lisio-vocal-synthesis-reading");
          } else {
            document.documentElement.classList.add(
              "lisio-vocal-synthesis-reading"
            );
            document.documentElement.classList.add(`lisio-${this._cursorSize}`);
          }
          this._iText = 0;
          this.auto();
        });
        document.body.prepend(button);
      }
    } else {
      document.querySelectorAll("button.start-synth").forEach((button) => {
        this.makeSynthButton(button, false);
      });
    }
    const activeSpeechElement = document.querySelector(
      ".lisio-speech-active"
    );
    this._iText = activeSpeechElement != void 0 && activeSpeechElement.dataset.lisioIndex != void 0 ? Number.parseInt(activeSpeechElement.dataset.lisioIndex) : 0;
    this._offsetTexts = Array.from(
      document.querySelectorAll("[data-lisio-index]")
    ).filter((elt) => elt.dataset.lisioIndex != void 0).map(
      (elt) => Number.parseInt(elt.dataset.lisioIndex || "-1")
    );
  }
  /**
   * lance la lecture d'un texte
   * @param {string} speech
   */
  synthVocal(speech) {
    if (this._utterThis != void 0) {
      this._readenText = speech;
      this._lastIText = this._iText;
      const rate = this._params.params.get(
        LisioNumericParameterNames.SPEECH_SYNTHESIS_RATE
      );
      const pitch = this._params.params.get(
        LisioNumericParameterNames.SPEECH_SYNTHESIS_PITCH
      );
      const deeplLang = this._params.params.get(
        LisioStringParameterNames.DEEPL_TRANSLATION
      );
      const googleLang = this._params.params.get(
        LisioStringParameterNames.GOOGLE_TRANSLATION
      );
      const deeplOrGoogleLang = deeplLang || googleLang;
      this._utterThis.text = speech.textContent ? speech.textContent : speech.getAttribute("placeholder") || "";
      this._utterThis.rate = rate || 1;
      this._utterThis.pitch = pitch || 1;
      const lang = this._readenText.lang;
      if (lang != void 0 && lang != "") {
        this._utterThis.lang = lang;
      } else {
        this._utterThis.lang = deeplOrGoogleLang == void 0 || deeplOrGoogleLang == "default" ? window.location.origin == "https://alpine-region.eu" ? "en" : document.documentElement.lang : deeplOrGoogleLang;
      }
      this._utterThis.voice = null;
      const voices = speechSynthesis.getVoices();
      const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
      if (isSafari) {
        if (this._utterThis?.lang.toLowerCase().startsWith("fr")) {
          this._utterThis.voice = voices.find((v) => v.name === "Thomas") || null;
        } else if (this._utterThis?.lang.toLowerCase().startsWith("en")) {
          this._utterThis.voice = voices.find((v) => v.name === "Samantha") || null;
        } else {
          const matching = voices.find((v) => v.lang.toLowerCase().startsWith(this._utterThis?.lang.toLowerCase() ?? "fr"));
          if (matching) {
            this._utterThis.voice = matching;
          }
        }
      }
      if (this._utterThis.voice === null) {
        const matching = voices.find((v) => v.lang.toLowerCase().startsWith(this._utterThis?.lang.toLowerCase() ?? "fr"));
        if (matching) {
          this._utterThis.voice = matching;
        }
      }
      this._utterThis.volume = 1;
      this._currentIndexSynthVocal = 0;
      this._utterThis.onboundary = (event) => {
        const googleTrans = this._params.params.get(
          LisioStringParameterNames.GOOGLE_TRANSLATION
        );
        if (googleTrans == void 0 || googleTrans === "default") {
          this._mutationObserver.disconnectObserver();
          if (event.name === "sentence") return;
          const word = event.utterance.text.substring(event.charIndex, event.charIndex + event.charLength).trim();
          if (this._readenText) {
            this.highlightWord(word, event.charIndex, this._readenText);
          }
        }
      };
      this._utterThis.onend = () => {
        if (!this._autoEnabled) {
          this._autoTimeout = setTimeout(this.next.bind(this), 200);
        }
        clearInterval(this._playPauseInterval);
        this.removeMarker();
        if (this._target) {
          this._target.classList.remove("lisio-speech-active");
        }
      };
      this._target = this._readenText;
      if (getComputedStyle(this._readenText).display == "flex") {
        document.querySelector(
          `[data-lisio-index='${this._readenText.dataset.lisioIndex}']`
        )?.childNodes.forEach((child) => {
          if (child.nodeType === 3) {
            const span = document.createElement("span");
            span.setAttribute("data-mark", "lisio");
            span.textContent = child.textContent;
            child.parentNode?.insertBefore(span, child);
            child.remove();
          }
        });
      }
      window.speechSynthesis?.speak(this._utterThis);
      const userAgent = navigator.userAgent.toLowerCase();
      const isChrome = userAgent.includes("chrome") && !userAgent.includes("edge") && !userAgent.includes("opr");
      if (isChrome) {
        this._playPauseInterval = setInterval(() => {
          if (!window.speechSynthesis?.speaking) {
            clearInterval(this._playPauseInterval);
          } else {
            window.speechSynthesis?.pause();
            window.speechSynthesis?.resume();
          }
        }, 14e3);
      }
    }
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
  adaptFunction(_element, _value) {
  }
  /**
   * Permet d'activer/désactiver la lecture auto
   */
  auto() {
    this._mutationObserver.disconnectObserver();
    if (this._autoEnabled) {
      this._autoEnabled = false;
      this.next();
      const altAria = LisioTranslationController.current.getTranslation("pauseSynthButton");
      document.querySelectorAll(".start-synth").forEach((button) => {
        if (button.children[0]) {
          button.children[0].innerHTML = this._pauseButton;
        }
        button.setAttribute("aria-label", altAria);
      });
    } else {
      this._autoEnabled = true;
      if (this._autoTimeout != void 0) {
        clearTimeout(this._autoTimeout);
      }
      const altAria = LisioTranslationController.current.getTranslation("startSynthButton");
      this.stopSynthVocalEntirely();
      document.querySelectorAll(".start-synth").forEach((button) => {
        if (button.children[0]) {
          button.children[0].innerHTML = this._playButton;
        }
        if (button.classList.contains("start-synth-first")) {
          button.setAttribute(
            "aria-label",
            LisioTranslationController.current.getTranslation(
              "startSynthFirstButton"
            )
          );
        } else {
          button.setAttribute("aria-label", altAria);
        }
      });
      this._mutationObserver.setObserver();
    }
  }
  clickRightSynthEventListener(event) {
    if (!event.ctrlKey && !this._isFromKeyboard) {
      event.preventDefault();
      this._lisioExplainClick?.remove();
      this._lisioExplainClick = void 0;
      this.stopSynthVocalEntirely();
      if (event.target?.dataset.lisioIndex) {
        const indexInOffsetText = this._offsetTexts.findIndex(
          (elt) => elt === Number.parseInt(
            event.target?.dataset.lisioIndex || "-1"
          )
        );
        this._iText = indexInOffsetText;
        if (this._autoEnabled) {
          document.documentElement.classList.add(
            "lisio-vocal-synthesis-reading"
          );
          document.documentElement.classList.add(`lisio-${this._cursorSize}`);
        }
        this.auto();
      } else if (event.target?.classList.contains(
        "start-synth"
      )) {
        this.start(event);
      } else {
        const parentWithDataLisioIndex = event.target?.closest("[data-lisio-index]");
        if (parentWithDataLisioIndex) {
          if (this._autoEnabled) {
            document.documentElement.classList.add(
              "lisio-vocal-synthesis-reading"
            );
            document.documentElement.classList.add(`lisio-${this._cursorSize}`);
          }
          const indexInOffsetText = this._offsetTexts.findIndex(
            (elt) => elt === Number.parseInt(
              parentWithDataLisioIndex.dataset.lisioIndex || "-1"
            )
          );
          this._iText = indexInOffsetText;
          this.auto();
        } else {
          if (!this._autoEnabled) {
            this.auto();
          } else {
            this._autoEnabled = true;
          }
        }
      }
    } else {
      this._isFromKeyboard = false;
    }
  }
  clickSynthEventListener(event) {
    if (event.detail === 1 && this._stateSynth === true) {
      document.removeEventListener("mousemove", this.lisioMouseMoveHandler);
      this._lisioExplainClick?.remove();
      const message = document.createElement("div");
      this._lisioExplainClick = message;
      message.id = "lisio-explain-click";
      message.innerHTML = `
      <div>
        <svg width="20" height="20" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.5098 0C19.4105 0 25.0098 5.59591 25.0098 12.5C25.0098 19.4007 19.4105 25 12.5098 25C5.60568 25 0.00976562 19.4007 0.00976562 12.5C0.00976562 5.59591 5.60568 0 12.5098 0ZM14.0298 4.41889C14.9714 4.41889 15.7348 5.18563 15.7348 6.12725C15.7348 7.06887 14.9714 7.83226 14.0298 7.83226C13.0848 7.83226 12.3214 7.06887 12.3214 6.12725C12.3214 5.18563 13.0848 4.41889 14.0298 4.41889ZM9.36207 10.7883C10.4651 8.55529 15.1631 7.83226 14.3257 10.8892C13.8482 12.6345 12.5838 17.2653 12.3853 18.0421C12.1432 19.0039 13.2462 19.0577 14.4266 18.5297C13.4211 21.1225 8.34982 21.5362 9.43269 18.106C9.43269 18.106 10.872 12.8699 11.2621 11.6862C11.6993 10.3713 10.2162 10.3545 9.36207 10.7849V10.7883ZM12.5098 1.18375C6.25809 1.18375 1.19352 6.24832 1.19352 12.4966C1.19352 18.7483 6.26145 23.8129 12.5098 23.8129C18.7614 23.8129 23.826 18.7483 23.826 12.4966C23.826 6.24832 18.7581 1.18375 12.5098 1.18375Z" fill="white"/></svg>
      </div>
      <p class="notranslate">
        ${LisioTranslationController.current.getTranslation("explainCursor")}
      </p>`;
      LisioShadowRootController.current.appendElement(message, helperStyles);
      const cursorHeight = this._cursorSize === "default" ? 31 : this._cursorSize === "big" ? 44 : 64;
      message.style.left = `${event.clientX}px`;
      message.style.top = `${event.clientY}px`;
      const messageHeight = this._lisioExplainClick.offsetHeight;
      const messageWidth = this._lisioExplainClick.offsetWidth;
      let transform = "";
      if (event.pageY - messageHeight < 0) {
        transform += `translateY(${cursorHeight}px) `;
      } else {
        transform += `translateY(-100%) `;
      }
      if (event.pageX + messageWidth > document.documentElement.clientWidth) {
        transform += `translateX(-100%)`;
      } else {
        transform += `translateX(0px) `;
      }
      message.style.transform = transform;
      this.lisioMouseMoveHandler = this.lisioMouseMoveHandler.bind(this);
      document.addEventListener("mousemove", this.lisioMouseMoveHandler);
      clearTimeout(this._synthVocaleLeftClickMessageTimeOut);
      this._synthVocaleLeftClickMessageTimeOut = setTimeout(() => {
        message.remove();
        document.removeEventListener("mousemove", this.lisioMouseMoveHandler);
      }, 3e3);
    }
  }
  clickSynthPauseEventListener(event) {
    if (event.detail === 1 && event.currentTarget?.classList.contains(
      "lisio-vocal-synthesis-reading"
    )) {
      this.clickSynthEventListener(event);
    }
  }
  /**
   *
   * @param html
   * @returns
   * Ne pas demander à Flora ce qu'il se passe ici
   */
  flattenHTML(html) {
    let flatText = "";
    const mapping = [];
    let insideTag = false;
    let entityBuffer = "";
    for (let i = 0; i < html.length; i++) {
      if (html[i] === "<") {
        insideTag = true;
      }
      if (!insideTag) {
        if (html[i] === "&") {
          entityBuffer += html[i];
        } else if (entityBuffer) {
          entityBuffer += html[i];
          if (html[i] === ";") {
            const decodedChar = decodeHTMLEntity(entityBuffer);
            if (decodedChar !== entityBuffer) {
              flatText += decodedChar;
              for (const _j of decodedChar) {
                mapping.push(i);
              }
            } else {
              flatText += entityBuffer;
              for (let j = 0; j < entityBuffer.length; j++) {
                mapping.push(i - entityBuffer.length + j + 1);
              }
            }
            entityBuffer = "";
          } else if (!entityBuffer.match(/^&[\w#]*$/)) {
            flatText += entityBuffer;
            for (let j = 0; j < entityBuffer.length; j++) {
              mapping.push(i - entityBuffer.length + j + 1);
            }
            entityBuffer = "";
          }
        } else {
          flatText += html[i];
          mapping.push(i);
        }
      }
      if (html[i] === ">") {
        insideTag = false;
      }
    }
    if (entityBuffer) {
      flatText += entityBuffer;
      for (let j = 0; j < entityBuffer.length; j++) {
        mapping.push(html.length - entityBuffer.length + j);
      }
    }
    return { flatText, mapping };
  }
  // Fonction pour surligner un mot lu
  highlightWord(word, wordIndex, element) {
    if (!this._previousReadenWord || word !== this._previousReadenWord.word || wordIndex !== this._previousReadenWord.wordIndex) {
      const originalHTML = element.innerHTML.replace(/amp;/gm, "");
      let { flatText, mapping } = this.flattenHTML(originalHTML);
      const escapedWord = escapeRegexSpecialChars(word);
      const regex = new RegExp(
        `(?=|^|\\s|[^\\\\w])(${escapedWord})(?=\\s|$|[^\\\\w]|<)`,
        "gi"
      );
      let match;
      const matches = [];
      while ((match = regex.exec(flatText)) !== null) {
        matches.push({
          word: match[1],
          // Correspondance trouvée
          index: match.index + match[0].indexOf(match[1])
          // Index du mot dans le texte
        });
      }
      for (const match2 of matches) {
        if (match2.index >= this._currentIndexSynthVocal) {
          const start = mapping[match2.index];
          let tempIndex = start;
          let remainingLength = word.length;
          let markedHTML = "";
          while (remainingLength > 0 && tempIndex < originalHTML.length) {
            if (originalHTML[tempIndex] === "<") {
              let tagEnd = tempIndex;
              while (tagEnd < originalHTML.length && originalHTML[tagEnd] !== ">") {
                tagEnd++;
              }
              tagEnd++;
              markedHTML += originalHTML.slice(tempIndex, tagEnd);
              tempIndex = tagEnd;
            } else {
              const segmentStart = tempIndex;
              while (remainingLength > 0 && tempIndex < originalHTML.length && originalHTML[tempIndex] !== "<") {
                tempIndex++;
                remainingLength--;
              }
              markedHTML += `<mark data-mark='lisio'>${originalHTML.slice(
                segmentStart,
                tempIndex
              )}</mark>`;
            }
          }
          const newHTML = originalHTML.slice(0, start) + markedHTML + originalHTML.slice(tempIndex);
          element.innerHTML = newHTML;
          ({ flatText, mapping } = this.flattenHTML(newHTML));
          this._currentIndexSynthVocal = match2.index + match2.word.length;
          break;
        }
      }
    }
    this._previousReadenWord = { word, wordIndex };
  }
  lisioMouseMoveHandler(event) {
    if (this._lisioExplainClick != void 0) {
      const cursorHeight = this._cursorSize === "default" ? 31 : this._cursorSize === "big" ? 44 : 64;
      this._lisioExplainClick.style.left = `${event.clientX}px`;
      this._lisioExplainClick.style.top = `${event.clientY}px`;
      const messageHeight = document.querySelector("#lisio-explain-clic")?.offsetHeight;
      const messageWidth = document.querySelector("#lisio-explain-clic")?.offsetWidth;
      let transform = "";
      if (event.pageY - messageHeight < 0) {
        transform += `translateY(${cursorHeight}px) `;
      } else {
        transform += `translateY(-100%) `;
      }
      if (event.pageX + messageWidth > document.documentElement.clientWidth) {
        transform += `translateX(-100%)`;
      } else {
        transform += `translateX(0px) `;
      }
      this._lisioExplainClick.style.transform = transform;
    }
  }
  makeSynthButton(element, create = true) {
    let button;
    if (create) {
      button = document.createElement("button");
      element.parentElement?.insertBefore(button, element);
    } else {
      button = element;
    }
    if (!button.hasChildNodes()) {
      const svg = document.createElementNS(
        "http://www.w3.org/2000/svg",
        "svg",
        {}
      );
      const altAria = LisioTranslationController.current.getTranslation("startSynthButton");
      button.className = "start-synth lisio-hidden notranslate";
      button.setAttribute("aria-label", altAria);
      button.append(svg);
      svg.setAttribute("width", "57");
      svg.setAttribute("height", "24");
      svg.setAttribute("viewBox", "0 0 57 24");
      svg.setAttribute("fill", "none");
      svg.innerHTML = this._playButton;
      button.addEventListener("click", this.start.bind(this));
    }
  }
  /**
   * Permet de lire le texte suivant
   */
  next() {
    clearTimeout(this._autoTimeout);
    window.speechSynthesis?.cancel();
    let target = this._walker.tags.get(this._offsetTexts[this._iText]);
    if (target != void 0) {
      let bounding = target.getBoundingClientRect();
      let style = window.getComputedStyle(target);
      while (target?.dataset.lisioIndex == void 0 || target == this._lastTarget || bounding.height == 0 || bounding.width == 0 || style.display == "none" || style.visibility == "lisio-hidden") {
        this._iText++;
        if (this._iText >= this._offsetTexts.length - 1) {
          this._iText = 0;
        }
        target = this._walker.tags.get(this._offsetTexts[this._iText]);
        if (target != void 0) {
          bounding = target.getBoundingClientRect();
          style = window.getComputedStyle(target);
        }
      }
      this._lastTarget = document.querySelector(".lisio-speech-active");
      if (this._lastTarget != null) {
        this._lastTarget.classList.remove("lisio-speech-active");
      }
      target?.classList.add("lisio-speech-active");
      target?.scrollIntoView({
        behavior: "smooth",
        block: "center",
        inline: "nearest"
      });
      this._lastTarget = target;
      if (target != void 0) {
        this.synthVocal(target);
      }
    }
  }
  removeMarker() {
    this._previousReadenWord = { word: "", wordIndex: -1 };
    this._currentIndexSynthVocal = 0;
    const markers = document.querySelectorAll('[data-mark="lisio"]');
    for (const marker of markers) {
      if (marker != void 0 && marker.parentNode != void 0) {
        const parent = marker.parentNode;
        const fragment = document.createDocumentFragment();
        while (marker.firstChild) {
          fragment.appendChild(marker.firstChild);
        }
        parent.replaceChild(fragment, marker);
        let child = parent.firstChild;
        while (child && child.nextSibling && child.nodeValue) {
          if (child.nodeType === Node.TEXT_NODE && child.nextSibling.nodeType === Node.TEXT_NODE) {
            child.nodeValue += child.nextSibling.nodeValue;
            parent.removeChild(child.nextSibling);
          } else {
            child = child.nextSibling;
          }
        }
      }
    }
  }
  /**
   * lance le mode auto de la synthèse vocale
   * @param {Event} event
   */
  start(event) {
    event.preventDefault();
    event.stopPropagation();
    document.documentElement.classList.add("lisio-vocal-synthesis-reading");
    document.documentElement.classList.add(`lisio-${this._cursorSize}`);
    this._iText = this._offsetTexts.findIndex((elt) => {
      let nextSibling = event.currentTarget.nextElementSibling;
      while (nextSibling) {
        if (nextSibling.dataset.lisioIndex != void 0) {
          return elt == Number.parseInt(nextSibling.dataset.lisioIndex || "-1");
        } else if (nextSibling.querySelector("[data-lisio-index]")) {
          return elt == Number.parseInt(
            nextSibling.querySelector("[data-lisio-index]")?.dataset.lisioIndex || "-1"
          );
        }
        nextSibling = nextSibling.nextElementSibling;
      }
      return false;
    });
    clearInterval(this._playPauseInterval);
    this.removeMarker();
    window.speechSynthesis?.cancel();
    if (this._readenText) {
      this._readenText.classList.remove("lisio-speech-active");
    }
    if (!this._autoEnabled) {
      window.speechSynthesis?.cancel();
      clearTimeout(this._autoTimeout);
    }
    if (event.target && this._lastTarget == event.target.nextSibling) {
      this._lastTarget = void 0;
    }
    this.auto();
  }
  stopSynthVocalEntirely() {
    this._lastTarget = void 0;
    clearInterval(this._playPauseInterval);
    this.removeMarker();
    window.speechSynthesis?.cancel();
    document.documentElement.classList.remove("lisio-vocal-synthesis-reading");
    const elemActive = document.querySelector(".lisio-speech-active");
    if (elemActive != void 0) {
      elemActive.classList.remove("lisio-speech-active");
    }
  }
}
class LisioStopAnimationAdapter extends LisioAdapter {
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {boolean} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(walker, value) {
    for (const tag of walker.tags.values()) {
      this.adaptFunction(tag, value);
    }
    if (value) {
      LisioStyleSheetController.current.insertRule(
        ".lisio-stop-animation",
        /* @__PURE__ */ new Map([
          [LisioCSSProperties.TRANSITION_DURATION, "0s"],
          [LisioCSSProperties.ANIMATION_DURATION, "0s"]
        ])
      );
    } else {
      LisioStyleSheetController.current.removeRule(".lisio-stop-animation");
    }
  }
  adaptFunction(element, value) {
    const { transitionDuration, animationDuration } = window.getComputedStyle(element);
    const defaultB = element.dataset.lisioTransition;
    const defaultA = element.dataset.lisioAnimation;
    if (element.localName != "script" && (transitionDuration != "0s" || animationDuration != "0s" || defaultB != null || defaultA != null)) {
      if (defaultA != void 0) {
        element.dataset.lisioAnimation = defaultA;
        element.dataset.lisioAnimationDuration = defaultA;
      }
      if (defaultB != void 0) {
        element.dataset.lisioTransition = defaultB;
        element.dataset.lisioTransitionDuration = defaultB;
      }
    }
    if (!value) {
      element.classList.remove(`lisio-stop-animation`);
    } else {
      LisioStyleSheetController.current.replaceImportantInStyleAttribute(
        [
          LisioCSSProperties.ANIMATION_DURATION,
          LisioCSSProperties.ANIMATION,
          LisioCSSProperties.TRANSITION_DURATION,
          LisioCSSProperties.TRANSITION
        ],
        element
      );
      element.classList.add(`lisio-stop-animation`);
    }
  }
}
class LisioThemeAdapter extends LisioAdapter {
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {string} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(_walker, value) {
    for (const tag of document.body.querySelectorAll(
      "*:not(script):not(link):not(style):not(svg)"
    )) {
      if (tag.localName != "option") {
        this.adaptFunction(tag, value);
      }
    }
    document.body.classList.add(`lisio-theme`);
    const propertiesToAdd = /* @__PURE__ */ new Map([
      [LisioCSSProperties.BACKGROUND, "none"],
      [LisioCSSProperties.BACKGROUND_IMAGE, "none"]
    ]);
    if (value === ThemeOptions.C_Y_BG_BL) {
      propertiesToAdd.set(LisioCSSProperties.COLOR, "yellow");
      propertiesToAdd.set(LisioCSSProperties.BORDER_COLOR, "yellow");
      propertiesToAdd.set(LisioCSSProperties.BACKGROUND_COLOR, "blue");
    } else if (value == ThemeOptions.C_BL_BG_W) {
      propertiesToAdd.set(LisioCSSProperties.COLOR, "blue");
      propertiesToAdd.set(LisioCSSProperties.BORDER_COLOR, "blue");
      propertiesToAdd.set(LisioCSSProperties.BACKGROUND_COLOR, "white");
    } else if (value == ThemeOptions.C_W_BG_BK) {
      propertiesToAdd.set(LisioCSSProperties.COLOR, "white");
      propertiesToAdd.set(LisioCSSProperties.BORDER_COLOR, "white");
      propertiesToAdd.set(LisioCSSProperties.BACKGROUND_COLOR, "black");
    } else if (value == ThemeOptions.C_BK_BG_W) {
      propertiesToAdd.set(LisioCSSProperties.COLOR, "black");
      propertiesToAdd.set(LisioCSSProperties.BORDER_COLOR, "black");
      propertiesToAdd.set(LisioCSSProperties.BACKGROUND_COLOR, "white");
    } else if (value == ThemeOptions.C_BK_BG_G) {
      propertiesToAdd.set(LisioCSSProperties.COLOR, "black");
      propertiesToAdd.set(LisioCSSProperties.BORDER_COLOR, "black");
      propertiesToAdd.set(LisioCSSProperties.BACKGROUND_COLOR, "#E8E8E8");
    } else if (value == ThemeOptions.C_W_BG_GY) {
      propertiesToAdd.set(LisioCSSProperties.COLOR, "#DFE3E7");
      propertiesToAdd.set(LisioCSSProperties.BORDER_COLOR, "#DFE3E7");
      propertiesToAdd.set(LisioCSSProperties.BACKGROUND_COLOR, "#212629");
    }
    if (value === "default") {
      LisioStyleSheetController.current.removeRule(".lisio-theme");
      LisioStyleSheetController.current.removeRule(".lisio-theme-form");
      LisioStyleSheetController.current.removeRule(
        ".lisio-theme-form::placeholder"
      );
      LisioStyleSheetController.current.removeRule(".lisio-theme-image");
    } else {
      LisioStyleSheetController.current.insertOrReplaceRule(
        propertiesToAdd,
        ".lisio-theme",
        ".lisio-theme"
      );
      LisioStyleSheetController.current.insertOrReplaceRule(
        propertiesToAdd,
        ".lisio-theme-form",
        ".lisio-theme-form"
      );
      LisioStyleSheetController.current.insertOrReplaceRule(
        propertiesToAdd,
        ".lisio-theme-form::placeholder",
        ".lisio-theme-form::placeholder"
      );
      LisioStyleSheetController.current.insertRule(
        ".lisio-theme-image",
        /* @__PURE__ */ new Map([
          [LisioCSSProperties.FILTER, "brightness(50%)"]
        ])
      );
      propertiesToAdd.set(
        LisioCSSProperties._WEBKIT_TEXT_FILL_COLOR,
        "initial"
      );
      LisioStyleSheetController.current.insertOrReplaceRule(
        propertiesToAdd,
        ".lisio-theme-text",
        ".lisio-theme-text"
      );
    }
  }
  adaptFunction(element, value) {
    if (value == "default") {
      if (element.classList.contains("lisio-theme")) {
        element.classList.remove("lisio-theme");
      } else if (element.classList.contains("lisio-theme-form")) {
        element.classList.remove("lisio-theme-form");
      } else if (element.classList.contains("lisio-theme-image")) {
        element.classList.remove("lisio-theme-image");
      } else if (element.classList.contains("lisio-theme-text")) {
        element.classList.remove("lisio-theme-text");
      }
      if (element.localName != "style" && element.localName != "svg" && element.localName != "filter" && element.localName != "feColorMatrix" && !element.classList.contains("blur_lisio")) {
        element.classList.remove("lisio-theme");
        element.classList.remove("lisio-theme-form");
        element.classList.remove("lisio-theme-image");
      }
    } else {
      document.body.classList.remove("lisio-theme");
      const styles2 = window.getComputedStyle(element);
      if (element.textContent != void 0 && element.textContent.trim() != "") {
        element.classList.add("lisio-theme-text");
      } else if (!/rgba\(\s?0\s?,\s?0\s?,\s?0\s?,\s?0\s?\)/.test(styles2.background) && !/rgb\(\s?0\s?,\s?0\s?,\s?0\s?\)/.test(styles2.background) && styles2.background != "none" && !element.classList.contains("blur_lisio")) {
        if (styles2.backgroundImage != "none" && value == ThemeOptions.C_W_BG_BK) {
          element.classList.add("lisio-theme-image");
        } else {
          if (element.localName === "input" || element.localName === "select" || element.localName === "textarea" || element.localName === "optgroup" || element.localName === "option") {
            element.classList.add(`lisio-theme-form`);
          } else if ((/lisio-theme-\w+/g.exec(element.className) == null || element.className == "") && element.localName !== "br") {
            element.classList.add(`lisio-theme`);
          }
        }
        LisioStyleSheetController.current.replaceImportantInStyleAttribute(
          [
            LisioCSSProperties.BACKGROUND_COLOR,
            LisioCSSProperties.COLOR,
            LisioCSSProperties.BORDER_COLOR,
            LisioCSSProperties.BACKGROUND,
            LisioCSSProperties.BACKGROUND_IMAGE
          ],
          element
        );
      }
    }
  }
}
const styles$1 = '.borders-container {\n  --space: 20px;\n  --inner-space: 5px;\n  --button-side: 60px;\n  position: fixed;\n  z-index: 134217728;\n  top: 100%;\n  right: 0;\n  transform: translate(calc(0% - var(--space)), calc(-100% - var(--space)));\n  pointer-events: none;\n}\n.borders-container > * {\n  display: flex;\n  justify-content: center;\n}\n.borders-container > *:first-child {\n  margin-bottom: var(--inner-space);\n}\n.borders-container > *:last-child {\n  gap: var(--inner-space);\n}\n.lisio-band {\n  pointer-events: all;\n  width: var(--button-side);\n  height: var(--button-side);\n  background-color: #2c2c2c;\n  border: 2px solid #1a1a1a;\n  border-radius: 8px;\n  box-shadow:\n    inset 0 -2px 0 #1a1a1a,\n    /* ombre intérieure discrète */ 0 4px 6px rgba(0, 0, 0, 0.6),\n    /* ombre externe pour le relief */ 0 1px 0 rgba(255, 255, 255, 0.1); /* liseré clair en haut pour "biseau" */\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  cursor: pointer;\n  user-select: none;\n  transition: all 0.1s ease;\n}\n.lisio-band svg {\n  width: 30px;\n  height: 30px;\n}\n.lisio-band:hover {\n  box-shadow:\n    inset 0 2px 4px rgba(0, 0, 0, 0.8),\n    inset 0 -1px 0 rgba(255, 255, 255, 0.1);\n  transform: translateY(2px);\n}\n\n.lisio-band.right svg {\n  transform: rotate(90deg);\n}\n.lisio-band.bottom svg {\n  transform: rotate(180deg);\n}\n.lisio-band.left svg {\n  transform: rotate(270deg);\n}\n';
class LisioZoomAdapter extends LisioAdapter {
  // private _cursors: LisioArrowCursors = {
  //   top: __BUILD_TARGET__ === "extension" ? "data:image/svg+xml;base64, " : "/solution/dist-site/cursors/top-arrow-verybig.svg",
  //   right: __BUILD_TARGET__ === "extension" ? "data:image/svg+xml;base64, " : "/solution/dist-site/cursors/right-arrow-verybig.svg",
  //   bottom: __BUILD_TARGET__ === "extension" ? "data:image/svg+xml;base64, " : "/solution/dist-site/cursors/bottom-arrow-verybig.svg",
  //   left: __BUILD_TARGET__ === "extension" ? "data:image/svg+xml;base64, " : "/solution/dist-site/cursors/left-arrow-verybig.svg",
  // }
  _borders;
  _bordersContainer;
  _interval = void 0;
  constructor() {
    super();
    const topBorder = document.createElement("div");
    const rightBorder = document.createElement("div");
    const bottomBorder = document.createElement("div");
    const leftBorder = document.createElement("div");
    topBorder.classList.add("lisio-band", "top", "verybig");
    rightBorder.classList.add("lisio-band", "right", "verybig");
    bottomBorder.classList.add("lisio-band", "bottom", "verybig");
    leftBorder.classList.add("lisio-band", "left", "verybig");
    const arrowSvg = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 32 32" fill="none"><path d="M13.8271 30C13.8271 31.1046 14.7999 32 15.9999 32C17.1998 32 18.1726 31.1046 18.1726 30H13.8271ZM17.5365 0.585798C16.688 -0.195257 15.3123 -0.195267 14.4638 0.585774L0.636396 13.3136C-0.212122 14.0946 -0.212133 15.361 0.63637 16.142C1.48488 16.9231 2.86057 16.9231 3.7091 16.142L16.0001 4.82842L28.2909 16.1422C29.1393 16.9233 30.5151 16.9233 31.3636 16.1423C32.212 15.3612 32.2123 14.0949 31.3636 13.3138L17.5365 0.585798ZM18.1726 30L18.1729 2.00002L13.8274 1.99998L13.8271 30H18.1726Z" fill="white"></path></svg>`;
    topBorder.innerHTML = arrowSvg;
    rightBorder.innerHTML = arrowSvg;
    bottomBorder.innerHTML = arrowSvg;
    leftBorder.innerHTML = arrowSvg;
    this._bordersContainer = document.createElement("div");
    const firstContainer = document.createElement("div");
    const secondContainer = document.createElement("div");
    firstContainer.appendChild(topBorder);
    secondContainer.appendChild(leftBorder);
    secondContainer.appendChild(bottomBorder);
    secondContainer.appendChild(rightBorder);
    this._bordersContainer.appendChild(firstContainer);
    this._bordersContainer.appendChild(secondContainer);
    this._bordersContainer.classList.add("borders-container");
    this._borders = {
      top: topBorder,
      right: rightBorder,
      bottom: bottomBorder,
      left: leftBorder
    };
  }
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {number} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(_, value) {
    this.adaptFunction(document.body, value);
    if (value !== 1) {
      LisioShadowRootController.current.appendElement(
        this._bordersContainer,
        styles$1
      );
      LisioShadowRootController.current.addStyles(`
        section#lisio-list-section {
          height: calc(88vh - 140px - 40px);
        }
        #lisio-list-div:not(.lisio-closed) {
          padding-bottom: calc(6vh + 140px) !important;
        }
        @supports (height: 1dvh) {
          section#lisio-list-section {
            height: calc(88dvh - 140px - 40px);
          }
          #lisio-list-div:not(.lisio-closed) {
            padding-bottom: calc(6dvh + 140px) !important;
          }
        }
      `);
      const sides = ["top", "right", "bottom", "left"];
      for (const side of sides) {
        this._borders[side].addEventListener("mouseenter", (e) => {
          this.evtMouseEnter(e);
        });
        this._borders[side].addEventListener("mouseleave", () => {
          this.evtMouseLeave();
        });
      }
    } else {
      window.scrollTo({ left: 0, behavior: "smooth" });
      LisioShadowRootController.current.removeElement(
        this._bordersContainer,
        styles$1
      );
      LisioShadowRootController.current.removeStyles(`
        section#lisio-list-section {
          height: calc(88vh - 140px - 40px);
        }
        #lisio-list-div:not(.lisio-closed) {
          padding-bottom: calc(6vh + 140px) !important;
        }
        @supports (height: 1dvh) {
          section#lisio-list-section {
            height: calc(88dvh - 140px - 40px);
          }
          #lisio-list-div:not(.lisio-closed) {
            padding-bottom: calc(6dvh + 140px) !important;
          }
        }
      `);
    }
  }
  adaptFunction(element, value) {
    LisioStyleSheetController.current.removeRule("#lisio-shadow-env");
    LisioStyleSheetController.current.insertOrReplaceRule(
      /* @__PURE__ */ new Map([[LisioCSSProperties.ZOOM, (1 / value).toString()]]),
      "#lisio-shadow-env"
    );
    LisioStyleSheetController.current.removeRule(".lisio-zoom");
    const scrollEl = document.documentElement;
    const applyScrollDetection = () => {
      const hasScroll = scrollEl.scrollWidth > scrollEl.clientWidth;
      ["left", "right"].forEach((side) => {
        this._borders[side].classList[hasScroll ? "remove" : "add"](
          "lisio-hidden"
        );
      });
    };
    const observer = new ResizeObserver(() => {
      observer.disconnect();
      applyScrollDetection();
    });
    observer.observe(scrollEl);
    if (value === 1) {
      element.classList.remove("lisio-zoom");
      observer.disconnect();
    } else {
      LisioStyleSheetController.current.replaceImportantInStyleAttribute(
        [LisioCSSProperties.ZOOM],
        element
      );
      element.classList.add(`lisio-zoom`);
      LisioStyleSheetController.current.insertRule(
        ".lisio-zoom",
        /* @__PURE__ */ new Map([[LisioCSSProperties.ZOOM, value.toString()]])
      );
    }
  }
  evtMouseEnter(e) {
    let y = 0;
    let x = 0;
    clearInterval(this._interval);
    if (e.target) {
      if (e.target.classList.contains("bottom")) {
        y = 50;
      } else if (e.target.classList.contains("top")) {
        y = -50;
      } else if (e.target.classList.contains("right")) {
        x = 50;
      } else if (e.target.classList.contains("left")) {
        x = -50;
      }
      this._interval = setInterval(() => {
        window.scrollBy({
          left: x,
          top: y,
          behavior: "smooth"
        });
      }, 100);
    }
  }
  evtMouseLeave() {
    clearInterval(this._interval);
  }
}
class LisioDeeplTranslationAdapter extends LisioAdapter {
  _entries = /* @__PURE__ */ new Map();
  _intersect;
  _listAdapter;
  _mutationController;
  _originLang;
  _paramsController;
  _sanitizedTexts = [];
  _translatorAPIBoundedResponseHandlers = /* @__PURE__ */ new Map();
  _translatorAPITimeout = -1;
  constructor(mutationController, paramsController) {
    super();
    this._mutationController = mutationController;
    this._paramsController = paramsController;
  }
  set listAdapter(value) {
    this._listAdapter = value;
  }
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {string} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(walker, value) {
    value = value.replace("_", "-");
    if (this._originLang != void 0) {
      this._originLang = document.documentElement.lang.toUpperCase().replace("_", "-");
    }
    if (value != "default" && value != this._originLang) {
      if (!this._originLang || /^FR/.test(this._originLang)) {
        this._originLang = "FR";
      }
      this._intersect?.disconnect();
      this._intersect = new IntersectionObserver(
        this.translatorAPIIntersectionCallback.bind(this, value),
        {
          rootMargin: "0px",
          threshold: 1
        }
      );
      if (this._paramsController.params.has(LisioBooleanParameterNames.LIST)) {
        this._listAdapter?.prepareForDeeplTrans(value);
      }
      this.observeTags(walker, value);
    } else if (value == "default" || this._originLang != void 0 && value === this._originLang) {
      this._sanitizedTexts = [];
      if (this._translatorAPITimeout) {
        clearTimeout(this._translatorAPITimeout);
      }
      if (this._intersect != void 0) {
        this._intersect.disconnect();
        this._intersect = void 0;
      }
      const tagsToTranslate = document.querySelectorAll(
        "[lisio-original-text], [dir]:not([lisio-original-text])"
      );
      for (const tagToTranslate of tagsToTranslate) {
        if (tagToTranslate.hasAttribute("lisio-original-text")) {
          tagToTranslate.innerHTML = tagToTranslate.getAttribute("lisio-original-text") || "";
        }
        tagToTranslate.removeAttribute("lisio-already-trans-in");
        tagToTranslate.removeAttribute("lang");
        tagToTranslate.removeAttribute("xml:lang");
        tagToTranslate.removeAttribute("dir");
      }
      this._entries = /* @__PURE__ */ new Map();
      LisioMessageManager.current.detachHandler(
        LisioMessageReceivedName.TRANSLATOR_API_TRANSLATE_RESPONSE
      );
    }
  }
  observeTags(walker, value) {
    const tags = Array.from(walker.tags.values()).filter(
      (tag) => tag.hasAttribute("data-lisio-index") && !tag.hasAttribute("translate")
    );
    const sanitizedTags = new Set(
      tags.concat(
        Array.from(
          document.querySelectorAll(
            'input[type="submit"], input[type="reset"]'
          )
        )
      )
    );
    for (const sanitizedTag of sanitizedTags) {
      const alreadyTradLang = sanitizedTag.getAttribute(
        "lisio-already-trans-in"
      );
      const innerHTML = alreadyTradLang ? sanitizedTag.getAttribute("lisio-original-text") : sanitizedTag instanceof HTMLInputElement ? sanitizedTag.value.trim() : sanitizedTag.innerHTML.trim().replace(/\s{2,}/g, " ");
      if (innerHTML != void 0 && /[a-zA-Z]+/.test(innerHTML)) {
        if (alreadyTradLang != value) {
          const find = this._sanitizedTexts.find(
            (obj) => obj.text === innerHTML
          );
          if (find && find.tags.some((tag) => tag.dataset.lisioDataIndex !== sanitizedTag.dataset.lisioDataIndex)) {
            find.tags.push(sanitizedTag);
          } else {
            this._sanitizedTexts.push({
              text: innerHTML,
              tags: [sanitizedTag]
            });
          }
          if (sanitizedTag.localName === "option") {
            let parent = sanitizedTag.parentElement;
            while (parent?.localName != "select") {
              parent = parent?.parentElement;
            }
            this._intersect?.unobserve(parent);
            this._intersect?.observe(parent);
          } else {
            this._intersect?.observe(sanitizedTag);
          }
        }
      }
    }
    LisioMessageManager.current.attachHandler(
      LisioMessageReceivedName.TRANSLATOR_API_TRANSLATE_RESPONSE,
      this.translatorAPIResponseHandler.bind(this)
    );
  }
  adaptFunction(element, value) {
    if (element instanceof HTMLInputElement) {
      element.value = value;
    } else {
      element.innerHTML = value;
    }
  }
  translatorAPIIntersectionCallback(lang, entries) {
    if (this._translatorAPITimeout) {
      clearTimeout(this._translatorAPITimeout);
    }
    for (const entry of entries) {
      if (Math.round(entry.intersectionRatio) == 1) {
        this._entries.set(entry.target, entry);
      } else if (Math.round(entry.intersectionRatio) == 0) {
        this._entries.delete(entry.target);
      }
    }
    if (this._entries.size) {
      this._translatorAPITimeout = setTimeout(() => {
        let textsToSend = [];
        for (const entry of this._entries.values()) {
          const hasInput = entry.target.querySelector("input") != void 0;
          if (!hasInput || hasInput && Array.from(entry.target.childNodes).filter((node) => node.nodeType === 3 && node.nodeValue?.trim() != "").length === 0) {
            const allLisioTags = Array.from(entry.target.querySelectorAll("[data-lisio-index]"));
            const tags = [];
            if (allLisioTags.length == 0 && entry.target instanceof HTMLElement && !tags.some((tag) => tag.dataset.lisioIndex === entry.target.dataset.lisioIndex)) {
              tags.push(entry.target);
            } else {
              for (const lisioTag of allLisioTags) {
                if (!tags.some((tag) => tag.dataset.lisioIndex === lisioTag.dataset.lisioIndex)) {
                  tags.push(lisioTag);
                }
              }
            }
            for (const tag of tags) {
              this._intersect?.unobserve(tag);
              const already = textsToSend.find((text) => text.tags.includes(tag));
              const toSend = this._sanitizedTexts.find(
                (text) => text.tags.includes(tag)
              );
              if (!already && toSend != void 0) {
                textsToSend.push(toSend);
              }
            }
          }
        }
        textsToSend = textsToSend.filter((textToSend) => textToSend);
        this._entries.clear();
        if (textsToSend.length > 0) {
          const keyHandler = (+/* @__PURE__ */ new Date()).toString(36).slice(-8);
          LisioMessageManager.current.sendTranslatorAPITranslate(
            keyHandler,
            this._originLang == void 0 ? "fr" : this._originLang,
            lang,
            textsToSend.map((t) => t.text).filter((text) => text != void 0)
          );
          this._translatorAPIBoundedResponseHandlers.set(
            keyHandler,
            (texts) => {
              this.translatorAPIResponse(textsToSend, texts);
            }
          );
        }
      }, 250);
    }
  }
  translatorAPIResponse(originTexts, texts) {
    const textObjs = texts;
    if (originTexts.length != textObjs.length) {
      throw new Error("not same size");
    }
    this._mutationController.disconnectObserver();
    for (const [index, textObj] of textObjs.entries()) {
      for (const tag of originTexts[index].tags) {
        this.adaptFunction(tag, textObj.translatedText);
        tag.setAttribute(
          "lisio-already-trans-in",
          textObj.translateLangDTO.languageISO
        );
        if (!tag.getAttribute("lisio-original-text")) {
          tag.setAttribute(
            "lisio-original-text",
            textObj.originTextDTO.originText
          );
        }
        tag.setAttribute("lang", textObj.translateLangDTO.languageISO);
        tag.setAttribute("xml:lang", textObj.translateLangDTO.languageISO);
        tag.setAttribute("dir", textObj.translateLangDTO.languageDirection);
        const closestUl = tag.closest("ul:not([dir])");
        if (closestUl != void 0) {
          closestUl.setAttribute(
            "dir",
            textObj.translateLangDTO.languageDirection
          );
        }
      }
    }
  }
  translatorAPIResponseHandler(datas) {
    const {
      keyHandler,
      texts
    } = JSON.parse(datas);
    const handler = this._translatorAPIBoundedResponseHandlers.get(keyHandler);
    if (handler != void 0) {
      try {
        handler(texts);
      } catch (err) {
        console.log(err);
      } finally {
        this._translatorAPIBoundedResponseHandlers.delete(keyHandler);
        if (this._translatorAPIBoundedResponseHandlers.size === 0) {
          this._mutationController.connectObserver();
        }
      }
    }
  }
}
class LisioGoogleTranslationAdapter extends LisioAdapter {
  _scriptGoogleTrans;
  _tradButtonsGoogle = [];
  constructor() {
    super();
    this._scriptGoogleTrans = document.createElement("script");
    this._scriptGoogleTrans.id = "googleTradScript";
    this._scriptGoogleTrans.setAttribute("type", "text/javascript");
    this._scriptGoogleTrans.src = "https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit";
  }
  /**
   * Public method implementing abstract method adapt of Adapter
   * @param {LisioTextTreeWalker} walker - A walker to explore the DOM
   * @param {string} value - Value of the functionality
   * @returns Returns nothing
   * @source
   */
  adapt(_, value) {
    const domainCookieName = window.location.host;
    this.eraseAllGoogtransCookies();
    const originLang = document.documentElement.lang == void 0 ? "fr" : document.documentElement.lang;
    if (value != "default" && (!value.includes(document.documentElement.lang) || document.documentElement.lang === "")) {
      if (!document.querySelector("script#googleTradScript")) {
        this._scriptGoogleTrans.addEventListener("load", () => {
          const stylesBody = window.getComputedStyle(document.body);
          const topBody = stylesBody.getPropertyValue("top");
          const minHeightBody = stylesBody.getPropertyValue("min-height");
          const positionBody = stylesBody.getPropertyValue("position");
          LisioStyleSheetController.current.insertRule(
            `body`,
            /* @__PURE__ */ new Map([
              [LisioCSSProperties.TOP, topBody],
              [LisioCSSProperties.MIN_HEIGHT, minHeightBody],
              [LisioCSSProperties.POSITION, positionBody]
            ])
          );
          LisioStyleSheetController.current.insertRule(
            `.goog-te-banner-frame`,
            /* @__PURE__ */ new Map([[LisioCSSProperties.DISPLAY, "none"]])
          );
          LisioStyleSheetController.current.insertRule(
            `iframe#\\:0\\.container`,
            /* @__PURE__ */ new Map([[LisioCSSProperties.DISPLAY, "none"]])
          );
          LisioStyleSheetController.current.insertRule(
            `#goog-gt-tt`,
            /* @__PURE__ */ new Map([[LisioCSSProperties.DISPLAY, "none"]])
          );
          LisioStyleSheetController.current.insertRule(
            `.VIpgJd-yAWNEb-VIpgJd-fmcmS-sn54Q`,
            /* @__PURE__ */ new Map([
              [LisioCSSProperties.BOX_SHADOW, "none"],
              [LisioCSSProperties.BACKGROUND_COLOR, "transparent"]
            ])
          );
          LisioStyleSheetController.current.insertRule(
            `iframe.VIpgJd-ZVi9od-ORHb-OEVmcd`,
            /* @__PURE__ */ new Map([[LisioCSSProperties.DISPLAY, "none"]])
          );
          LisioStyleSheetController.current.insertRule(
            `.VIpgJd-ZVi9od-aZ2wEe-wOHMyf`,
            /* @__PURE__ */ new Map([[LisioCSSProperties.DISPLAY, "none"]])
          );
          LisioStyleSheetController.current.insertRule(
            `.VIpgJd-ZVi9od-aZ2wEe-OiiCO`,
            /* @__PURE__ */ new Map([[LisioCSSProperties.TRANSFORM, "none"]])
          );
          document.cookie = `googtrans=/${originLang}/${value.replace("_", "-")}; domain=${domainCookieName}; path=/`;
          const interval = setInterval(() => {
            if (google.translate.TranslateElement != void 0) {
              clearInterval(interval);
              google.translate.TranslateElement(
                {
                  pageLanguage: document.documentElement.lang == void 0 ? "fr" : document.documentElement.lang,
                  autoDisplay: false
                },
                "google_translate_element"
              );
            }
          }, 100);
        });
        appendToHead(this._scriptGoogleTrans);
      } else {
        if (this._tradButtonsGoogle.length === 0) {
          const googleButtons = document.querySelector(
            "iframe:not(#\\:0\\.container).skiptranslate"
          )?.contentDocument?.querySelector("#\\:1\\.menuBody")?.querySelectorAll("a");
          if (googleButtons != void 0) {
            this._tradButtonsGoogle = Array.from(googleButtons);
          }
        }
        const confirm = document.querySelector("iframe#\\:0\\.container") ? document.querySelector("iframe#\\:0\\.container")?.contentDocument?.querySelector("#\\:0\\.confirm") : void 0;
        if (confirm != void 0) {
          confirm.dispatchEvent(new Event("click"));
        }
        setTimeout(() => {
          const langLink = this._tradButtonsGoogle.find(
            (a) => Object.getOwnPropertyDescriptor(a, "value")?.value === value.replace("_", "-")
          );
          langLink?.dispatchEvent(new Event("click"));
        }, 1e3);
      }
    } else if (value != "default" && document.querySelector("iframe#\\:0\\.container") != void 0) {
      const stylesBody = window.getComputedStyle(document.body);
      const topBody = stylesBody.getPropertyValue("top");
      LisioStyleSheetController.current.insertRule(
        `body`,
        /* @__PURE__ */ new Map([
          [LisioCSSProperties.TOP, `calc(${topBody} - 40px)`]
        ])
      );
      LisioStyleSheetController.current.insertRule(
        `.goog-te-banner-frame`,
        /* @__PURE__ */ new Map([[LisioCSSProperties.DISPLAY, "none"]])
      );
      LisioStyleSheetController.current.insertRule(
        `iframe#\\:0\\.container`,
        /* @__PURE__ */ new Map([[LisioCSSProperties.DISPLAY, "none"]])
      );
      LisioStyleSheetController.current.insertRule(
        `#goog-gt-tt`,
        /* @__PURE__ */ new Map([[LisioCSSProperties.DISPLAY, "none"]])
      );
      LisioStyleSheetController.current.insertRule(
        `.VIpgJd-yAWNEb-VIpgJd-fmcmS-sn54Q`,
        /* @__PURE__ */ new Map([
          [LisioCSSProperties.BOX_SHADOW, "none"],
          [LisioCSSProperties.BACKGROUND_COLOR, "transparent"]
        ])
      );
      LisioStyleSheetController.current.insertRule(
        `.VIpgJd-ZVi9od-aZ2wEe-wOHMyf`,
        /* @__PURE__ */ new Map([[LisioCSSProperties.DISPLAY, "none"]])
      );
      LisioStyleSheetController.current.insertRule(
        `.VIpgJd-ZVi9od-aZ2wEe-OiiCO`,
        /* @__PURE__ */ new Map([[LisioCSSProperties.TRANSFORM, "none"]])
      );
      document.querySelector("iframe#\\:0\\.container")?.contentDocument?.querySelector("#\\:0\\.restore")?.dispatchEvent(new Event("click"));
    } else if (document.querySelector("iframe#\\:0\\.container") != void 0) {
      this.eraseAllGoogtransCookies();
      this._scriptGoogleTrans.remove();
      window.location.reload();
    }
  }
  adaptFunction(element, value) {
    if (value === "true") {
      if (element.firstElementChild != null && element.firstElementChild.localName == "img") {
        element.firstElementChild.classList.add("lisio-highlight");
        LisioStyleSheetController.current.replaceImportantInStyleAttribute(
          [
            LisioCSSProperties.COLOR,
            LisioCSSProperties.BACKGROUND,
            LisioCSSProperties.BACKGROUND_COLOR,
            LisioCSSProperties.BOX_SHADOW,
            LisioCSSProperties.BORDER
          ],
          element.firstElementChild
        );
      } else {
        element.classList.add("lisio-highlight");
        LisioStyleSheetController.current.replaceImportantInStyleAttribute(
          [
            LisioCSSProperties.COLOR,
            LisioCSSProperties.BACKGROUND,
            LisioCSSProperties.BACKGROUND_COLOR,
            LisioCSSProperties.BOX_SHADOW,
            LisioCSSProperties.BORDER
          ],
          element
        );
      }
    } else {
      if (element.firstElementChild != null && element.firstElementChild.localName == "img") {
        element.firstElementChild.classList.remove("lisio-highlight");
      } else {
        element.classList.remove("lisio-highlight");
      }
    }
  }
  eraseAllGoogtransCookies() {
    const cookieName = "googtrans";
    const domainParts = window.location.hostname.split(".");
    const paths = ["/", ""];
    const domainsToTry = [];
    domainsToTry.push(window.location.hostname);
    for (let i = 1; i < domainParts.length - 1; i++) {
      domainsToTry.push("." + domainParts.slice(i).join("."));
    }
    if (domainParts.length >= 2) {
      domainsToTry.push(domainParts.slice(-2).join("."));
    }
    domainsToTry.forEach((domain) => {
      paths.forEach((path) => {
        document.cookie = `${cookieName}=; domain=${domain}; path=${path}; expires=Thu, 01 Jan 1970 00:00:00 GMT;`;
        if (path === paths[0]) {
          document.cookie = `${cookieName}=; path=${path}; expires=Thu, 01 Jan 1970 00:00:00 GMT;`;
        }
      });
    });
    document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT;`;
  }
}
class LisioMutationObserverController {
  _broadcastChannel;
  _canReapply = false;
  _lisio;
  _mutationsQueue = [];
  _observer;
  _timeout;
  _pendingConnect;
  _pendingProcess;
  constructor(broadcastChannel, lisio) {
    this._broadcastChannel = broadcastChannel;
    this._lisio = lisio;
    this._pendingConnect = false;
    this._pendingProcess = 0;
  }
  set canReapply(value) {
    this._canReapply = value;
  }
  get observer() {
    return this._observer;
  }
  modifyPendingProcess(value) {
    this._pendingProcess += value;
    if (this._pendingConnect && this._pendingProcess <= 0) {
      this._pendingProcess = 0;
      this.connectObserver();
    }
  }
  checkObserverTagFilter(mutationList) {
    const tagFilter = ["SCRIPT", "STYLE"];
    return mutationList.findIndex((mutation) => {
      if (mutation.addedNodes.length === 1) {
        return this.checkTagNameTagFilter(mutation.addedNodes, tagFilter);
      } else if (mutation.removedNodes.length) {
        return this.checkTagNameTagFilter(mutation.removedNodes, tagFilter);
      } else {
        return 0;
      }
    }) == -1;
  }
  checkTagNameTagFilter(nodes, tagFilter) {
    return Array.from(nodes).findIndex(
      ({ nodeName }) => tagFilter.includes(nodeName)
    );
  }
  connectObserver() {
    if (this._pendingProcess <= 0) {
      this._pendingProcess = 0;
      if (this._observer != void 0) {
        this._observer.disconnect();
        this._canReapply = true;
        this._observer.takeRecords();
        this._observer.observe(document.body, {
          childList: true,
          subtree: true,
          attributes: false,
          characterData: true
        });
      }
    } else {
      this._pendingConnect = true;
    }
  }
  disconnectObserver() {
    this._canReapply = false;
    this._observer?.disconnect();
    if (this._timeout != void 0) {
      clearTimeout(this._timeout);
    }
  }
  setObserver() {
    this._canReapply = false;
    this._mutationsQueue.splice(0, Infinity);
    this._observer = new MutationObserver((mutationList) => {
      this._observer?.takeRecords();
      if (this._canReapply && !this.checkObserverTagFilter(mutationList)) {
        for (const mutation of mutationList) {
          if (Array.from(mutation.addedNodes).find(
            (node) => node.textContent != ""
          ) != null || mutation.removedNodes.length > 0) {
            this._mutationsQueue.push(mutation);
          }
        }
        if (this._timeout == void 0) {
          clearTimeout(this._timeout);
        }
        this._timeout = setTimeout(() => {
          clearTimeout(this._timeout);
          this._timeout = void 0;
          this._observer?.disconnect();
          this._lisio.reset(false);
          this.connectObserver();
          const toSend = [];
          const toRemove = [];
          const readerAdapter = this._lisio.params.params.has(
            LisioBooleanParameterNames.READING_MODE
          ) ? this._lisio.adapters.get(
            LisioBooleanParameterNames.READING_MODE
          ) : void 0;
          for (const mutation of this._mutationsQueue) {
            if (mutation.type === "childList") {
              for (const addedNode of mutation.addedNodes) {
                if (addedNode != void 0 && addedNode.parentElement != void 0 && addedNode.nodeType === 3) {
                  const closestLisioIndex = (addedNode instanceof HTMLElement ? addedNode : addedNode.parentElement).closest("[data-lisio-index]");
                  if (closestLisioIndex != void 0) {
                    const nodeIterator = document.createNodeIterator(
                      closestLisioIndex,
                      NodeFilter.SHOW_TEXT,
                      {
                        acceptNode(node) {
                          return node.textContent?.trim() === "" ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
                        }
                      }
                    );
                    const nodeIteratorAddedNode = document.createNodeIterator(
                      addedNode,
                      NodeFilter.SHOW_TEXT,
                      {
                        acceptNode(node) {
                          return node.textContent?.trim() === "" ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
                        }
                      }
                    );
                    if (readerAdapter != void 0 && closestLisioIndex instanceof HTMLElement && addedNode instanceof HTMLElement && closestLisioIndex.dataset.lisioClickable == void 0 && (closestLisioIndex.tagName === "A" || closestLisioIndex.tagName === "BUTTON" || closestLisioIndex.tagName === "INPUT" && closestLisioIndex.getAttribute("type") === "button" || addedNode.onclick != void 0)) {
                      closestLisioIndex.dataset.lisioClickable = readerAdapter.dataLisioClickable.toString();
                      addedNode.dataset.lisioClickable = readerAdapter.dataLisioClickable.toString();
                      readerAdapter.dataLisioClickable++;
                    }
                    let child;
                    while (child = nodeIterator.nextNode()) {
                      const childAdded = nodeIteratorAddedNode.nextNode();
                      if (child.parentElement != void 0) {
                        for (const attribute of Array.from(
                          child.parentElement.attributes
                        )) {
                          if (attribute.name != "data-lisio-index" && attribute.name != "class" && attribute.name != "style") {
                            child.parentElement.removeAttribute(attribute.name);
                          }
                        }
                        if (readerAdapter != void 0 && childAdded?.parentElement != void 0 && child.parentElement.dataset.lisioClickable == void 0 && (child.parentElement.tagName === "A" || child.parentElement.tagName === "BUTTON" || child.parentElement.tagName === "INPUT" && child.parentElement.getAttribute("type") === "button" || child.parentElement.onclick != void 0)) {
                          child.parentElement.dataset.lisioClickable = readerAdapter.dataLisioClickable.toString();
                          childAdded.parentElement.dataset.lisioClickable = readerAdapter.dataLisioClickable.toString();
                          readerAdapter.dataLisioClickable++;
                        }
                      }
                    }
                    if (readerAdapter != void 0 && window.origin != "null" && closestLisioIndex instanceof HTMLElement) {
                      toSend.push({
                        name: closestLisioIndex.tagName,
                        index: Number.parseInt(
                          closestLisioIndex.dataset.lisioIndex || "-1"
                        ),
                        content: closestLisioIndex.innerHTML,
                        classes: closestLisioIndex.className,
                        position: readerAdapter.all.indexOf(closestLisioIndex),
                        alreadyExists: closestLisioIndex != addedNode,
                        clickable: Number.parseInt(
                          closestLisioIndex.dataset.lisioClickable || "-1"
                        )
                      });
                    }
                  }
                }
              }
              if (location.origin != "null") {
                for (const removedNode of mutation.removedNodes) {
                  if (mutation.target instanceof Element) {
                    const closestLisioIndex = mutation.target.closest("[data-lisio-index]");
                    if (closestLisioIndex instanceof HTMLElement || closestLisioIndex instanceof SVGElement) {
                      const clonedNode = closestLisioIndex.cloneNode(true);
                      const nodeIterator = document.createNodeIterator(
                        clonedNode,
                        NodeFilter.SHOW_TEXT,
                        {
                          acceptNode(node) {
                            return node.textContent?.trim() === "" ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
                          }
                        }
                      );
                      let child;
                      while (child = nodeIterator.nextNode()) {
                        if (child.parentElement instanceof Element) {
                          for (const attribute of Array.from(
                            child.parentElement.attributes
                          )) {
                            if (attribute.name != "data-lisio-index" && attribute.name != "class" && attribute.name != "style") {
                              child.parentElement?.removeAttribute(
                                attribute.name
                              );
                            }
                          }
                        }
                      }
                      if (readerAdapter != void 0) {
                        toRemove.push({
                          content: closestLisioIndex.innerHTML,
                          position: readerAdapter.oldAll.indexOf(closestLisioIndex),
                          alreadyExists: closestLisioIndex != removedNode
                        });
                      }
                    }
                  }
                }
              }
            } else if (mutation.type === "characterData" && window.origin != "null" && mutation.target.parentElement instanceof Element) {
              const text = mutation.target.parentElement.closest("[data-lisio-index]");
              if (text instanceof HTMLElement && text.dataset.lisioIndex != void 0 && mutation.target.textContent != void 0) {
                const nodeIterator = document.createNodeIterator(
                  text,
                  NodeFilter.SHOW_TEXT,
                  {
                    acceptNode(node) {
                      return node.textContent?.trim() === "" ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
                    }
                  }
                );
                let iChild = 1;
                let child = nodeIterator.nextNode();
                while (child != null && child !== mutation.target) {
                  child = nodeIterator.nextNode();
                  iChild++;
                }
                this._broadcastChannel.sendModifiedTextMessage(
                  text.dataset.lisioIndex,
                  iChild,
                  mutation.target.textContent
                );
              }
            }
          }
          if (readerAdapter != void 0) {
            if (toSend.length > 0) {
              this._broadcastChannel.sendNewNodesMessage(toSend);
            }
            if (toRemove.length > 0) {
              this._broadcastChannel.sendRemovedNodesMessage(toRemove);
            }
            this._mutationsQueue.splice(0, Infinity);
            toSend.splice(0, toSend.length);
            toRemove.splice(0, toSend.length);
          }
          this._lisio.apply(true);
        }, 500);
      }
    });
    this.connectObserver();
  }
}
class LisioParamsController {
  _params = /* @__PURE__ */ new Map();
  get params() {
    return this._params;
  }
  deleteParam(parameterName) {
    this._params.delete(parameterName);
  }
  reset() {
    this._params.clear();
  }
  updateParam(parameterName, value) {
    if (Object.values(LisioNumericParameterNames).includes(
      parameterName
    ) && typeof value === "number") {
      if (value === defautValueOfNumericParameters.get(
        parameterName
      )) {
        this.deleteParam(parameterName);
      } else {
        this._params.set(parameterName, value);
      }
    } else if (Object.values(LisioBooleanParameterNames).includes(
      parameterName
    ) && typeof value === "boolean") {
      if (value) {
        this._params.set(parameterName, value);
      } else {
        this.deleteParam(parameterName);
      }
    } else if (Object.values(LisioStringParameterNames).includes(
      parameterName
    ) && typeof value === "string") {
      if (value === "default") {
        this.deleteParam(parameterName);
      } else {
        this._params.set(parameterName, value);
      }
    }
  }
}
const styles = "#lisio-modal-container {\n  max-width: 650px;\n}\n\np#lisio-modal-first-text {\n  font-weight: bold;\n  font-style: normal;\n  color: black;\n  text-align: center;\n  margin: 1rem;\n  font-size: 23px;\n}\n\n#lisio-modal-button-container {\n  display: flex;\n  margin-top: 20px;\n  margin-bottom: 30px;\n  gap: 4px;\n  flex-direction: column-reverse;\n  align-items: center;\n  position: relative;\n  flex-direction: row;\n  justify-content: space-between;\n  width: 70%;\n  margin: auto;\n  min-height: 42px;\n}\n\nbutton#lisio-modal-button-no,\nbutton#lisio-modal-button-yes {\n  color: black;\n  border-radius: 9999rem;\n  font-size: 23px;\n  cursor: pointer;\n  padding: 5px 10px 5px 10px;\n  line-height: 1;\n  position: relative;\n  min-width: 40%;\n  text-align: center;\n  font-weight: normal;\n  height: auto;\n  width: auto;\n  text-transform: capitalize;\n  margin: 10px;\n}\n\nbutton#lisio-modal-button-yes {\n  background: var(--theme-primary);\n  border: 2px solid var(--theme-primary);\n  color: white;\n}\n\nbutton#lisio-modal-button-yes:hover,\nbutton#lisio-modal-button-yes:focus,\nbutton#lisio-modal-button-yes:focus-visible {\n  border: 2px solid var(--theme-primary);\n  background: white;\n  color: var(--theme-primary);\n  font-weight: 700;\n  outline: none;\n}\nbutton#lisio-modal-button-no {\n  background: white;\n  border: 2px solid black;\n}\n\nbutton#lisio-modal-button-no:hover,\nbutton#lisio-modal-button-no:focus,\nbutton#lisio-modal-button-no:focus-visible {\n  background: #ededed;\n  border: 2px solid #ededed;\n  outline: none;\n}\n\n#lisio-modal-description-text {\n  padding: 15px;\n  font-size: 18px;\n  color: #000;\n}\n\n@media (max-width: 420px) {\n  #lisio-modal-description-text {\n    margin-right: 10px;\n    margin-left: 10px;\n    margin-bottom: 10px;\n  }\n}\n\n@media screen and (max-width: 960px) {\n  #lisio-modal-button-container {\n    width: auto;\n  }\n}\n";
class LisioConfirmationModal extends LisioModalController {
  _buttonNo;
  _buttonYes;
  _description;
  _firstText;
  _isEnabled = false;
  _listeners = /* @__PURE__ */ new Map();
  constructor() {
    super(
      "lisio-modal-container",
      "lisio-confirmation-modal-title",
      "confirmation-modal-title",
      false
    );
    this._description = document.createElement("p");
    this._description.id = "lisio-modal-description-text";
    this._firstText = document.createElement("p");
    this._firstText.id = "lisio-modal-first-text";
    this._firstText.innerHTML = LisioTranslationController.current.getTranslation(
      "confirmation-modal-text"
    );
    this._buttonYes = document.createElement("button");
    this._buttonYes.id = "lisio-modal-button-yes";
    this._buttonYes.innerHTML = LisioTranslationController.current.getTranslation(
      "confirmation-modal-yes-button"
    );
    this._buttonYes.setAttribute(
      "aria-describedby",
      "lisio-modal-description-text"
    );
    this._buttonNo = document.createElement("button");
    this._buttonNo.id = "lisio-modal-button-no";
    this._buttonNo.innerHTML = LisioTranslationController.current.getTranslation(
      "confirmation-modal-no-button"
    );
    const buttonContainer = document.createElement("div");
    buttonContainer.id = "lisio-modal-button-container";
    buttonContainer.appendChild(this._buttonNo);
    buttonContainer.appendChild(this._buttonYes);
    this._modalBody.appendChild(this._firstText);
    this._modalBody.append(buttonContainer);
    this._modalBody.append(this._description);
    this._closeButton?.addEventListener("click", () => {
      this._buttonNo.click();
    });
    this._listeners.set(
      this._buttonYes,
      /* @__PURE__ */ new Map()
    );
    this._listeners.set(
      this._buttonNo,
      /* @__PURE__ */ new Map()
    );
    LisioShadowRootController.current.addStyles(styles);
    window.addEventListener("lisio-lang-change", () => {
      this._firstText.innerHTML = LisioTranslationController.current.getTranslation(
        "confirmation-modal-text"
      );
      this._buttonYes.innerHTML = LisioTranslationController.current.getTranslation(
        "confirmation-modal-yes-button"
      );
      this._buttonNo.innerHTML = LisioTranslationController.current.getTranslation(
        "confirmation-modal-no-button"
      );
    });
  }
  get buttonNo() {
    return this._buttonNo;
  }
  get closeButton() {
    return this._closeButton;
  }
  get logo() {
    return this._logo;
  }
  get buttonYes() {
    return this._buttonYes;
  }
  get isEnabled() {
    return this._isEnabled;
  }
  attachEventListenerOnButtons(button, eventName, listener) {
    const eventListeners = this._listeners.get(button);
    if (eventListeners != void 0) {
      eventListeners.set(eventName, listener);
      button.addEventListener(eventName, listener);
    }
  }
  changeTexts(descriptionText) {
    this._description.innerHTML = descriptionText;
  }
  closeModal() {
    super.closeModal();
    this._isEnabled = false;
    this.deactivateFocusTrap();
  }
  detachEventListenerOnButtons(button, eventName) {
    const eventListeners = this._listeners.get(button);
    if (eventListeners != void 0) {
      const eventListener = eventListeners.get(eventName);
      if (eventListener != void 0) {
        eventListeners.delete(eventName);
        button.removeEventListener(eventName, eventListener);
      }
    }
  }
  noHandler(event, widget, parameterName) {
    event.stopPropagation();
    this.detachEventListenerOnButtons(this.buttonYes, "click");
    this.detachEventListenerOnButtons(this.buttonNo, "click");
    LisioMessageManager.current.sendPopupResponse(
      false,
      parameterName,
      this._buttonNo.dataset.focus
    );
    this.closeModal();
    if (!widget.isOpen) {
      LisioBlurController.current.disableBlur();
    }
  }
  openModal() {
    super.openModal();
    this._isEnabled = true;
  }
  yesHandler(event, widget, parameterName) {
    event.stopPropagation();
    this.detachEventListenerOnButtons(this.buttonYes, "click");
    this.detachEventListenerOnButtons(this.buttonNo, "click");
    LisioMessageManager.current.sendPopupResponse(true, parameterName);
    widget.closeWidget();
    this.closeModal();
    LisioBlurController.current.disableBlur();
  }
}
const disableStyles = "#lisio-disable-band {\n  background-color: var(--theme-primary);\n  display: flex;\n  position: fixed;\n  justify-content: center;\n  align-items: center;\n  width: 40vw;\n  height: 60px;\n  bottom: 0;\n  z-index: 536870912;\n  left: 50%;\n  transform: translateX(-50%);\n  border-radius: 9px 9px 0px 0px;\n  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);\n}\n\n#lisio-disable-button:hover {\n  box-shadow:\n    inset -2px -2px 4px rgba(255, 255, 255, 0.3),\n    inset 2px 2px 4px rgba(0, 0, 0, 0.3);\n}\n#lisio-disable-button {\n  box-shadow:\n    inset 2px 2px 4px rgba(255, 255, 255, 0.3),\n    inset -2px -2px 4px rgba(0, 0, 0, 0.3);\n}\n#lisio-disable-band > button {\n  height: 50px;\n  width: 330px;\n  font-size: 20px;\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  background-color: #fff;\n  color: #000;\n  font-family: Calibri, sans-serif;\n  cursor: pointer;\n  text-transform: none;\n  letter-spacing: normal;\n  border-radius: 30px;\n  border: none;\n  transition: none;\n  transform: none;\n  font-weight: normal;\n  background: #fff;\n  padding: 5px;\n  margin: 0;\n  gap: unset;\n  box-sizing: border-box;\n}\n\n#lisio-disable-band > button > svg {\n  height: auto;\n  width: auto;\n  z-index: 5;\n  padding-right: 10px;\n}\n";
class LisioDisableBannerController {
  _banner;
  _bannerText;
  _disableButton;
  _spacer;
  constructor(primaryColor) {
    this._spacer = document.createElement("div");
    this._spacer.id = "lisio-div-spacing";
    this._spacer.style.display = "none";
    this._spacer.style.width = "100%";
    this._spacer.style.height = "60px";
    this._banner = document.createElement("div");
    this._banner.id = "lisio-disable-band";
    this._banner.classList.add("lisio-hidden");
    this._banner.innerHTML = this.getHTML(primaryColor);
    const text = this._banner.querySelector(
      "button#lisio-disable-button p"
    );
    if (text != void 0) {
      this._bannerText = text;
    }
    this._disableButton = this._banner.firstElementChild;
    this._disableButton.addEventListener("click", () => {
      LisioLightMessageManager.current.sendDisableMessageToIframe();
      if (window.location.origin === "null") {
        window.close();
      }
    });
    window.addEventListener("lisio-lang-change", () => {
      if (this._bannerText != void 0) {
        LisioTranslationController.current.translateBanner(this._bannerText);
      }
    });
  }
  get banner() {
    return this._banner;
  }
  get spacer() {
    return this._spacer;
  }
  hideBanner() {
    this._banner.classList.add("lisio-hidden");
    this._spacer.style.display = "none";
  }
  showBanner() {
    this._banner.classList.remove("lisio-hidden");
    this._spacer.style.display = "block";
  }
  getHTML(primaryColor) {
    return `
      <button id="lisio-disable-button" class="lisio-disable" >                      
          <svg aria-hidden="true" style="border-radius:20px  !important" xmlns="http://www.w3.org/2000/svg" height="42" viewbox="0 0 27 26" fill="none"><path fill="${primaryColor}" d="M13 26c7.18 0 13-5.82 13-13S20.18 0 13 0 0 5.82 0 13s5.82 13 13 13Z"/><path fill="#fff" d="M15.698 7.303c.271-.579.986-.814 1.501-.474a7.41 7.41 0 0 1 2.842 3.682 7.319 7.319 0 0 1 .07 4.63 7.419 7.419 0 0 1-2.727 3.77 7.57 7.57 0 0 1-4.46 1.433 7.558 7.558 0 0 1-4.45-1.462 7.4 7.4 0 0 1-2.697-3.786 7.32 7.32 0 0 1 .108-4.63 7.428 7.428 0 0 1 2.872-3.664c.566-.373 1.297-.04 1.53.523.307.561.04 1.282-.454 1.653a4.987 4.987 0 0 0-1.693 2.516 4.926 4.926 0 0 0 .088 3.018 4.986 4.986 0 0 0 1.835 2.413 5.096 5.096 0 0 0 5.828.018 4.998 4.998 0 0 0 1.854-2.402c.352-.97.391-2.024.111-3.017a4.975 4.975 0 0 0-1.673-2.526c-.518-.412-.755-1.117-.485-1.695Z"/><path stroke="#fff" stroke-linecap="round" stroke-width="2.5" d="M13 11V7"/></svg>
          <p class="notranslate">${LisioTranslationController.current.getTranslation("disable")}</p>
          <svg width="25" aria-hidden="true" height="30" viewBox="0 0 25 30" fill="none" xmlns="http://www.w3.org/2000/svg"><mask id="mask0_107_31" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="15" y="3" width="4" height="7"><path d="M16.4695 6.79946C16.4419 6.61533 16.4846 6.42754 16.5891 6.27346C16.6936 6.11937 16.8523 6.01028 17.0336 5.9679C17.2149 5.92552 17.4055 5.95294 17.5675 6.04473C17.7295 6.13651 17.851 6.28592 17.9079 6.46322C17.9358 6.57327 17.9372 6.68839 17.9119 6.79908C17.8866 6.90977 17.8354 7.01286 17.7624 7.09984C17.6894 7.18682 17.5968 7.25519 17.4922 7.29932C17.3875 7.34345 17.2739 7.36207 17.1607 7.35363C16.9982 7.35936 16.8391 7.30657 16.7122 7.20486C16.5854 7.10316 16.4993 6.9593 16.4695 6.79946ZM16.8369 3.10083C14.6451 3.31876 15.274 9.90656 17.4596 9.70731C19.6451 9.50805 19.0847 3.10083 16.9365 3.10083H16.8556" fill="white"/></mask><g mask="url(#mask0_107_31)"><path d="M14.6787 3.10874L14.6292 10.0264L19.7037 10.0627L19.7532 3.14505L14.6787 3.10874Z" fill="url(#paint0_linear_107_31)"/></g><mask id="mask1_107_31" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="24" height="29"><path d="M1.6875 12.086C3.24416 13.3313 7.78339 16.0088 10.741 16.0026C10.3488 15.7971 9.49572 13.5119 9.49572 13.35C9.58912 13.5866 10.4795 15.7659 11.2828 16.2329C11.2129 16.2489 11.1422 16.2614 11.0711 16.2703C10.8649 16.2996 10.6566 16.312 10.4484 16.3077H10.2429C6.84939 16.3077 1.89298 12.4347 1.7124 12.0798M20.3924 7.91413C19.9503 7.04863 19.2093 3.46208 19.365 2.87677C19.8008 3.35 20.7846 7.49072 20.6476 8.26905L20.3924 7.91413ZM16.7435 0.242899C15.7596 0.426375 14.8074 0.751463 13.9166 1.20803C13.0059 1.12453 12.1155 0.888796 11.2828 0.510645C10.3674 1.65635 11.6937 3.69869 8.62398 3.0013C8.60712 3.21505 8.64573 3.42952 8.73606 3.62397C9.80705 5.48574 7.75225 4.52061 7.12959 5.28026C8.62398 6.52559 8.37492 6.99259 6.82448 8.10093C9.75101 9.17814 7.97019 10.4359 7.59659 10.629C10.0872 11.482 9.53308 10.9527 9.50194 13.3375C6.53806 9.95647 3.35001 12.6153 0.280273 10.3674C1.09596 13.9664 4.21552 17.6464 7.66508 17.472C8.28774 17.3973 9.3276 17.2354 9.92535 17.1607C11.0211 16.9576 12.151 17.0478 13.2006 17.4222C13.2566 17.4222 19.3525 21.4571 17.8394 24.7759C16.8556 28.1819 11.1894 28.35 10.6352 24.695C10.0125 22.4471 13.9291 20.2678 14.8942 22.4658C15.4671 23.5617 14.6016 25.0686 13.3562 24.1906C11.8183 23.6302 11.756 25.604 13.1445 25.8407C16.756 26.7373 17.416 21.8556 14.9004 20.5418C9.47081 18.3375 7.086 26.1458 12.1358 28.3002C15.6352 29.9191 19.6078 26.9365 20.8531 23.1072C22.3351 15.7784 16.4945 15.0125 15.2491 11.5754C17.4038 11.7523 19.5443 12.0727 21.6564 12.5343C22.9328 12.9639 23.2628 11.9116 23.9851 11.015C23.1196 10.3238 21.8743 9.63891 21.1022 8.817C21.3201 7.6962 20.4795 2.47204 19.2342 2.29769C18.4621 2.72733 18.9602 4.52061 19.2716 5.56668C20.2678 10.9901 15.3924 12.1918 14.9814 6.2703C14.3587 6.03991 11.4758 5.02497 10.2367 6.46955C10.2181 6.48876 10.1959 6.50403 10.1712 6.51446C10.1466 6.52489 10.1202 6.53027 10.0935 6.53027C10.0668 6.53027 10.0403 6.52489 10.0157 6.51446C9.99109 6.50403 9.96884 6.48876 9.95026 6.46955C10.3674 4.51438 14.3089 5.51687 14.9814 5.81575C15.0623 3.94776 15.8407 2.47204 17.2105 2.70243C16.7747 2.12335 17.4409 0.292712 17.4409 0.292712C17.2865 0.241324 17.1241 0.218124 16.9615 0.224219C16.8893 0.21237 16.8157 0.21237 16.7435 0.224219" fill="white"/></mask><g mask="url(#mask1_107_31)"><path d="M0.209809 0.000913364L-0.00366211 29.832L23.9247 30.0033L24.1382 0.172144L0.209809 0.000913364Z" fill="url(#paint1_linear_107_31)"/></g><defs><linearGradient id="paint0_linear_107_31" x1="-0.50061" y1="6.70008" x2="25.2248" y2="6.88417" gradientUnits="userSpaceOnUse"><stop offset="0.05" stop-color="#81BB27"/><stop offset="0.05" stop-color="#81BB27"/><stop offset="0.21" stop-color="#37B37B"/><stop offset="0.35" stop-color="#00ADBA"/><stop offset="0.63" stop-color="#2853A1"/><stop offset="0.64" stop-color="#2753A0"/><stop offset="0.74" stop-color="#125980"/><stop offset="0.83" stop-color="#065D6D"/><stop offset="0.89" stop-color="#015E66"/><stop offset="1" stop-color="#015E66"/></linearGradient><linearGradient id="paint1_linear_107_31" x1="-0.268706" y1="14.8174" x2="25.1806" y2="14.9995" gradientUnits="userSpaceOnUse"><stop offset="0.05" stop-color="#81BB27"/><stop offset="0.05" stop-color="#81BB27"/><stop offset="0.21" stop-color="#37B37B"/><stop offset="0.35" stop-color="#00ADBA"/><stop offset="0.63" stop-color="#2853A1"/><stop offset="0.64" stop-color="#2753A0"/><stop offset="0.74" stop-color="#125980"/><stop offset="0.83" stop-color="#065D6D"/><stop offset="0.89" stop-color="#015E66"/><stop offset="1" stop-color="#015E66"/></linearGradient></defs></svg>
      </button>
    `;
  }
}
class Lisio {
  _adapters = /* @__PURE__ */ new Map();
  _broadcastChannel;
  _confirmationModal;
  _isBookPage = false;
  _isReadingMode = false;
  _lisioConfig;
  _loadingImage;
  _mutationObserverController;
  // private _version: string = "";
  _params = new LisioParamsController();
  _popin;
  _textTreeWalker;
  _widget;
  _disableBand;
  constructor(lisioConfig, widget, popin) {
    this._broadcastChannel = new LisioBroadcastChannelController(
      LisioBroadcastChannelNames.READER
    );
    this._disableBand = new LisioDisableBannerController("#ad1a00");
    this._lisioConfig = lisioConfig;
    this._widget = widget;
    if (widget.widget?.contentWindow != void 0) {
      LisioMessageManager.current.contentWindow = widget.widget.contentWindow;
    }
    this._popin = popin;
    this._loadingImage = document.createElement("img");
    this._mutationObserverController = new LisioMutationObserverController(
      this._broadcastChannel,
      this
    );
    this._textTreeWalker = new LisioTextTreeWalker(document.body, (n) => {
      if (n.nodeType === Node.TEXT_NODE) {
        if (n.nodeValue?.trim() != "" && n.parentElement != void 0 && !["script", "noscript", "style", "title"].includes(
          n.parentElement.localName
        )) {
          return NodeFilter.FILTER_ACCEPT;
        } else {
          return NodeFilter.FILTER_REJECT;
        }
      }
      if (n.nodeType === Node.ELEMENT_NODE) {
        const el = n;
        if (el.hasAttribute("placeholder")) {
          return NodeFilter.FILTER_ACCEPT;
        }
        return NodeFilter.FILTER_SKIP;
      }
      return NodeFilter.FILTER_SKIP;
    });
    this._isBookPage = window.location.origin.includes("mobiledition");
    {
      this._isReadingMode = window.location.origin === "null";
    }
    this._confirmationModal = new LisioConfirmationModal();
    this.initialize();
    {
      if (document.readyState !== "loading") {
        LisioLightMessageManager.current.sendLisioFrontLoaded();
      } else {
        const loadedHandler = () => {
          LisioLightMessageManager.current.sendLisioFrontLoaded();
          document.removeEventListener("DOMContentLoaded", loadedHandler);
        };
        document.addEventListener("DOMContentLoaded", loadedHandler);
      }
    }
  }
  get adapters() {
    return this._adapters;
  }
  get confirmationModal() {
    return this._confirmationModal;
  }
  get isBookPage() {
    return this._isBookPage;
  }
  get isReadingMode() {
    return this._isReadingMode;
  }
  get lisioConfig() {
    return this._lisioConfig;
  }
  get loadingImage() {
    return this._loadingImage;
  }
  get mutationObserverController() {
    return this._mutationObserverController;
  }
  get params() {
    return this._params;
  }
  get popin() {
    return this._popin;
  }
  get textTreeWalker() {
    return this._textTreeWalker;
  }
  get widget() {
    return this._widget;
  }
  apply(fromObserver) {
    this.mutationObserverController.disconnectObserver();
    this._textTreeWalker.resetWalker();
    this._textTreeWalker.getTextes();
    for (const [paramName, value] of this.params.params.entries()) {
      if (fromObserver && paramName != LisioStringParameterNames.GOOGLE_TRANSLATION || !fromObserver) {
        this.mutationObserverController.modifyPendingProcess(1);
        this._adapters.get(paramName)?.adapt(this._textTreeWalker, value);
        this.mutationObserverController.modifyPendingProcess(-1);
      }
    }
    this.mutationObserverController.connectObserver();
  }
  applyFeature(feature, value, defaultValue) {
    if (this._mutationObserverController.observer == void 0) {
      this._mutationObserverController.setObserver();
    }
    this._mutationObserverController.disconnectObserver();
    const adpater = this._adapters.get(feature);
    if (booleanParameterNames.includes(feature) && typeof value === "boolean") {
      adpater?.adapt(this._textTreeWalker, value);
    } else if (stringParameterNames.includes(feature) && typeof value === "string") {
      adpater?.adapt(this._textTreeWalker, value);
    } else if (numberParameterNames.includes(feature) && typeof value === "number") {
      if ([LisioNumericParameterNames.DALTONISM_R, LisioNumericParameterNames.DALTONISM_G, LisioNumericParameterNames.DALTONISM_B, LisioNumericParameterNames.DALTONISM_HUE, LisioNumericParameterNames.DALTONISM_SATURATION, LisioNumericParameterNames.DALTONISM_BRIGHTNESS].includes(feature)) {
        adpater?.adapt(this._textTreeWalker, value, feature, defaultValue);
      } else {
        adpater?.adapt(this._textTreeWalker, value);
      }
    } else {
      console.log(`Type mismatch : ${feature}, ${value}`);
    }
    this._mutationObserverController.connectObserver();
  }
  removeCharging() {
    this._loadingImage.remove();
  }
  reset(removeAdaptation) {
    this._textTreeWalker.resetWalker();
    const speechSynthesisAdapter = this._adapters.get(
      LisioBooleanParameterNames.SPEECH_SYNTHESIS_STATE
    );
    if (speechSynthesisAdapter != void 0) {
      speechSynthesisAdapter.iText = speechSynthesisAdapter.lastIText;
    }
    const dyslexiaAdapter = this._adapters.get(
      LisioBooleanParameterNames.ACTIVE_UNDERLINE
    );
    if (dyslexiaAdapter != void 0) {
      dyslexiaAdapter.nodes.splice(0, Infinity);
    }
    this._textTreeWalker.getTextes();
    if (removeAdaptation) {
      this.apply(false);
    }
    const readerAdapter = this._adapters.get(
      LisioBooleanParameterNames.READING_MODE
    );
    if (readerAdapter != void 0) {
      readerAdapter.all.splice(0, Infinity);
      readerAdapter.oldAll.splice(0, Infinity);
    }
  }
  setLoading() {
    document.body.appendChild(this._loadingImage);
    document.body.style.cursor = "wait";
  }
  // private _popin: LisioPopin | undefined;
  /**
   * Permet de tout remettre par défaut
   */
  setDefault(isConfigured, resetReadingMode) {
    if (this._isBookPage) {
      this._adapters.get(LisioBooleanParameterNames.BOOK_PAGE)?.adapt(this._textTreeWalker, false);
    } else {
      for (const paramName of this._params.params.keys()) {
        let defaultValue;
        if (numberParameterNames.includes(paramName)) {
          defaultValue = defautValueOfNumericParameters.get(
            paramName
          );
        } else if (stringParameterNames.includes(paramName)) {
          defaultValue = "default";
        } else if (booleanParameterNames.includes(
          paramName
        )) {
          defaultValue = false;
        }
        if (defaultValue != void 0) {
          const adapter = this._adapters.get(paramName);
          if ([LisioNumericParameterNames.DALTONISM_R, LisioNumericParameterNames.DALTONISM_G, LisioNumericParameterNames.DALTONISM_B, LisioNumericParameterNames.DALTONISM_HUE, LisioNumericParameterNames.DALTONISM_SATURATION, LisioNumericParameterNames.DALTONISM_BRIGHTNESS].includes(paramName)) {
            adapter?.adapt(this._textTreeWalker, defaultValue, paramName, defaultValue);
          } else {
            adapter?.adapt(this._textTreeWalker, defaultValue);
          }
        }
      }
      this._params.reset();
      this._textTreeWalker.resetWalker();
      this._mutationObserverController.disconnectObserver();
      if (resetReadingMode) {
        if (window.location.origin != "null" || window.location.pathname != "/reading-mode.html") {
          window.localStorage.removeItem("lisio_reading_mode");
          this._broadcastChannel?.sendCloseMessage();
        } else {
          window.close();
        }
      }
      LisioTranslationController.current.loadTranslationFile(
        lisioGetInitLang()
      );
      this._popin?.refreshLabel(false, isConfigured);
      this.setDisableBand(false);
    }
  }
  newTab(url, ecoOrRural, queryUrl) {
    url = decodeURIComponent(decodeURIComponent(url));
    if (url == "default") {
      fetch("https://env-preprod-mobiledition.lisio.fr", {
        mode: "no-cors"
      }).then(() => {
        const newUrl = window.location.href.replace(
          /&lisioUsernames%3D.+&lisioUsers%3D[\w-%3D]*/,
          ""
        );
        window.location.assign(
          `${"https://env-preprod-mobiledition.lisio.fr"}/IM_GenerationMinisite.php?wsu=lisiojs${"&test=4"}${ecoOrRural ? "&mode=eco" : ""}&fic_id=${window.lisioAccesskey.trim()}&${queryUrl}&url=${newUrl.charAt(newUrl.length - 1) === "?" ? window.location.origin + window.location.pathname : newUrl}`
        );
      }).catch((error) => {
        console.log(error);
      });
    } else {
      if (window.location.href.includes("IM_GenerationMinisite.php")) {
        const handler = (datas) => {
          window.location.assign(`${url}?&${datas}`);
        };
        LisioMessageManager.current.attachHandler(
          LisioMessageReceivedName.ALL_ENCODED_RESPONSE,
          handler
        );
        LisioMessageManager.current.sendAllEncodedMessage();
      } else {
        window.location.assign(url);
      }
    }
  }
  initialize() {
    this._adapters.set(
      LisioNumericParameterNames.FONT_SIZE,
      new LisioFontSizeAdapter()
    );
    this._adapters.set(
      LisioNumericParameterNames.LINE_HEIGHT,
      new LisioLineHeightAdapter()
    );
    this._adapters.set(
      LisioNumericParameterNames.WORD_SPACING,
      new LisioWordSpacingAdapter()
    );
    this._adapters.set(
      LisioNumericParameterNames.LETTER_SPACING,
      new LisioLetterSpacingAdapter()
    );
    this._adapters.set(
      LisioNumericParameterNames.CONTRAST,
      new LisioContrastAdapter()
    );
    if (!this._lisioConfig.userSettings.tabsToHide.includes("sur_zom")) {
      this._adapters.set(
        LisioNumericParameterNames.ZOOM,
        new LisioZoomAdapter()
      );
    }
    this._adapters.set(
      LisioNumericParameterNames.BIGGER_CLICK,
      new LisioBiggerClickAdapter()
    );
    this._adapters.set(
      LisioBooleanParameterNames.DISABLE_ANIMATION,
      new LisioStopAnimationAdapter()
    );
    this._adapters.set(
      LisioBooleanParameterNames.HIGHLIGHT,
      new LisioHightlightLinksAdapter()
    );
    this._adapters.set(
      LisioBooleanParameterNames.SHOW_ALT,
      new LisioShowAltAdapter()
    );
    const deeplAdapter = new LisioDeeplTranslationAdapter(
      this._mutationObserverController,
      this._params
    );
    this._adapters.set(
      LisioStringParameterNames.DEEPL_TRANSLATION,
      deeplAdapter
    );
    const listAdapter = new LisioListAdapter(
      this.lisioConfig,
      this._params,
      deeplAdapter
    );
    this._adapters.set(LisioBooleanParameterNames.LIST, listAdapter);
    deeplAdapter.listAdapter = listAdapter;
    this._adapters.set(
      LisioBooleanParameterNames.READING_MASK,
      new LisioReadingMask()
    );
    this._adapters.set(
      LisioStringParameterNames.THEME,
      new LisioThemeAdapter()
    );
    this._adapters.set(
      LisioStringParameterNames.FONT_FAMILY,
      new LisioFontFamilyAdapter()
    );
    this._adapters.set(
      LisioBooleanParameterNames.KEYBOARD_NAVIGATION,
      new LisioKeyboardNavigationAdapter()
    );
    this._adapters.set(
      LisioStringParameterNames.TEXT_ALIGN,
      new LisioTextAlignAdapter()
    );
    this._adapters.set(
      LisioStringParameterNames.CURSOR_SIZE,
      new LisioCursorAdapter()
    );
    const daltonismeAdapter = new LisioDaltonismAdapter();
    this._adapters.set(
      LisioStringParameterNames.DALTONISM,
      daltonismeAdapter
    );
    this._adapters.set(
      LisioNumericParameterNames.DALTONISM_R,
      daltonismeAdapter
    );
    this._adapters.set(
      LisioNumericParameterNames.DALTONISM_G,
      daltonismeAdapter
    );
    this._adapters.set(
      LisioNumericParameterNames.DALTONISM_B,
      daltonismeAdapter
    );
    this._adapters.set(
      LisioNumericParameterNames.DALTONISM_HUE,
      daltonismeAdapter
    );
    this._adapters.set(
      LisioNumericParameterNames.DALTONISM_SATURATION,
      daltonismeAdapter
    );
    this._adapters.set(
      LisioNumericParameterNames.DALTONISM_BRIGHTNESS,
      daltonismeAdapter
    );
    this._adapters.set(
      LisioBooleanParameterNames.VOCA,
      new LisioDictionaryAdapter()
    );
    if ("speechSynthesis" in window) {
      this._adapters.set(
        LisioBooleanParameterNames.SPEECH_SYNTHESIS_STATE,
        new LisioSpeechSynthesisAdapter(
          this._textTreeWalker,
          this._mutationObserverController,
          this._params,
          this._lisioConfig.userSettings.vocalSynthesisMode
        )
      );
    }
    const dyslexia = new LisioDyslexiaAdapter(this._params);
    this._adapters.set(LisioBooleanParameterNames.ACTIVE_UNDERLINE, dyslexia);
    this._adapters.set(
      LisioStringParameterNames.GOOGLE_TRANSLATION,
      new LisioGoogleTranslationAdapter()
    );
    if (!this.isReadingMode) {
      this._adapters.set(
        LisioBooleanParameterNames.BOOK_PAGE,
        new LisioBookPageAdapter(this._isBookPage, this)
      );
    }
    this._adapters.set(LisioStringParameterNames.UNDERLINE_RED, dyslexia);
    this._adapters.set(LisioStringParameterNames.UNDERLINE_GREEN, dyslexia);
    this._adapters.set(LisioStringParameterNames.UNDERLINE_BLUE, dyslexia);
    if (this._lisioConfig.userSettings.vocalSynthesisMode === 1) {
      document.documentElement.classList.add("lisio-vocal-synthesis-mode-1");
    }
    const style = document.createElement("style");
    style.id = "lisio-common-styles";
    appendToHead(style);
    window.addEventListener("visibilitychange", () => {
      if (document.visibilityState === "hidden") {
        window.speechSynthesis?.cancel();
      }
    });
    LisioMessageManager.current.initMessages(this);
    LisioBlurController.current.blur.addEventListener("click", () => {
      if (!this._confirmationModal.isEnabled) {
        this._widget.closeWidget();
      }
    });
  }
  setDisableBand(adaptation) {
    this._mutationObserverController.disconnectObserver();
    if (adaptation) {
      if (!GlobalContext.current.isMobile) {
        LisioShadowRootController.current.appendElement(
          this._disableBand.banner,
          disableStyles
        );
        document.body.appendChild(this._disableBand.spacer);
      }
      this._disableBand?.showBanner();
    } else {
      this._disableBand?.hideBanner();
    }
    this._mutationObserverController.connectObserver();
  }
}
const booleanParameterNames = Object.values(LisioBooleanParameterNames);
const stringParameterNames = Object.values(LisioStringParameterNames);
const numberParameterNames = Object.values(LisioNumericParameterNames);
export {
  Lisio
};
//# sourceMappingURL=lisio-CkyVMiYd.js.map
