import { T as TailwindStyledElement, x } from '../../index-db8c2781.js';
import { n, t } from '../../property-81c75dec.js';
import { r } from '../../state-ebd3d73f.js';
import { c as customClassMap } from '../../index-5e194caf.js';
import '../lukso-icon/index.js';
import '../lukso-sanitize/index.js';
import '../../directive-2bb7789e.js';
import '../../style-map-d9a53ff6.js';

const style = ":host {\n    display: flex;\n    height: 100%\n}";

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result)
    __defProp(target, key, result);
  return result;
};
let LuksoTerms = class extends TailwindStyledElement(style) {
  text = "";
  hasScrollButton = true;
  defaultStyles = `h-[56px] w-full sticky bottom-0 -mt-[56px]
    bg-gradient-to-b from-transparent to-neutral-100/80
    flex justify-center transition-opacity opacity-0`;
  onScrollBottom() {
    const event = new CustomEvent("on-bottom-scroll", {
      bubbles: true,
      composed: true
    });
    this.dispatchEvent(event);
  }
  handleScroll() {
    const scrollContainer = this.shadowRoot.getElementById("scroll-container");
    const scrollHeight = scrollContainer.scrollHeight - scrollContainer.offsetHeight;
    const scrollTop = scrollContainer.scrollTop;
    if (scrollTop >= scrollHeight) {
      this.onScrollBottom();
      this.hasScrollButton = false;
    } else {
      this.hasScrollButton = true;
    }
  }
  handleBottomScroll() {
    const scrollEnd = this.shadowRoot.getElementById("scroll-end");
    scrollEnd && scrollEnd.scrollIntoView({
      behavior: "smooth",
      block: "nearest",
      inline: "start"
    });
  }
  render() {
    return x`<div
      id="scroll-container"
      class="border border-solid border-neutral-90 rounded-12 overflow-y-scroll relative scrollbar-none"
      @scroll=${this.handleScroll}
    >
      <div class="paragraph-inter-12-regular px-4 pt-3">
        <lukso-sanitize html-content=${this.text} is-pre></lukso-sanitize>
        <br />
        <br />
        <div id="scroll-end"></div>
      </div>
      <div
        class=${customClassMap({
      [this.defaultStyles]: true,
      "!opacity-100": this.hasScrollButton
    })}
      >
        <div
          data-testid="scroll-to-bottom"
          class="w-10 h-10 bg-neutral-100 rounded-full shadow-1xl flex items-center justify-center animate-bounce2 cursor-pointer"
          @click=${this.handleBottomScroll}
        >
          <lukso-icon name="arrow-down-lg"></lukso-icon>
        </div>
      </div>
    </div>`;
  }
};
__decorateClass([
  n({ type: String })
], LuksoTerms.prototype, "text", 2);
__decorateClass([
  r()
], LuksoTerms.prototype, "hasScrollButton", 2);
LuksoTerms = __decorateClass([
  t("lukso-terms")
], LuksoTerms);

export { LuksoTerms };
