"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isRtl = exports.enableDocumentScroll = exports.disableDocumentScroll = exports.copyToClipboard = void 0;
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.

const isRtl = () => getComputedStyle(document.documentElement).direction === 'rtl';
exports.isRtl = isRtl;
let hasDocumentScroll = true;
const disableDocumentScroll = () => {
  if (hasDocumentScroll) {
    const top = `${-window.pageYOffset}px`;
    document.documentElement.style.position = 'fixed';
    document.body.style.marginTop = top;
    hasDocumentScroll = false;
  }
};
exports.disableDocumentScroll = disableDocumentScroll;
const enableDocumentScroll = () => {
  if (!hasDocumentScroll) {
    const scrollTop = Math.abs(parseInt(document.body.style.marginTop || '0'));
    document.documentElement.style.position = '';
    document.body.style.marginTop = '';
    window.scrollTo(0, scrollTop);
    hasDocumentScroll = true;
  }
};
exports.enableDocumentScroll = enableDocumentScroll;
const copyToClipboard = value => {
  const el = document.createElement('textarea');
  el.value = value;
  el.setAttribute('readonly', '');
  el.style.position = 'absolute';
  el.style.left = '-9999px';
  document.body.appendChild(el);
  el.select();
  document.execCommand('copy');
  document.body.removeChild(el);
};
exports.copyToClipboard = copyToClipboard;