import { h, r as render } from './d4789960.js';
import { g as getComponentOrDefine } from './642a44cd.js';
import '../kun-icon.js';

const style = `
    .name {
    top: 10%;
    position: fixed;
    left: 0;
    right: 0;
    background: #1b1a1a85;
    padding: 5px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 24px;
    width: min-content;
    margin: 0 auto;
    border-radius: 6px;
    color: white;
    }
`;
const SixLoading = () => h("host", {
  shadowDom: true
}, h("style", null, style), h("div", {
  class: "name"
}, h("kun-icon", {
  iconType: "loading",
  iconHeight: 26,
  iconWidth: 26
})));
getComponentOrDefine("six-loading", SixLoading);

let loading = false;
const execWithSixLoad = async callback => {
  if (loading) {
    return;
  }

  const container = document.createElement("div");
  document.body.appendChild(container);
  loading = true;
  render(h("host", null, h("six-loading", null)), container);

  try {
    const r = await callback(); // eslint-disable-next-line consistent-return

    return r;
  } catch (e) {// toastrError(String(e));
  } finally {
    document.body.removeChild(container);
    loading = false;
  }
};

export { execWithSixLoad as e };
//# sourceMappingURL=115171ee.js.map
