import { R as D, S as F, b as O, s as N, f as g, c as P, e as H, t as p, g as m, C as A, k as G, l as L, w as I, H as J, d as K, T as M, F as v, u as Q, h as V, j as X, m as k, U as Y, o as y, q as h, z as S, D as Z } from "./CashierConfirmModal-CtWSrqbM.js";
function x(n, { delay: t = 0, duration: e = 400, easing: i = D } = {}) {
  const l = +getComputedStyle(n).opacity;
  return {
    delay: t,
    duration: e,
    easing: i,
    css: (o) => `opacity: ${o * l}`
  };
}
function $(n) {
  P(n, "svelte-pil2bm", "*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}.ModalWindow{display:flex;position:absolute;align-items:center;justify-content:center;width:100%;height:100%;z-index:4;top:0;left:0;background-color:var(--mmw--color-black-transparency-10, rgba(0, 0, 0, 0.1));container-type:inline-size;container-name:modal-window;border-radius:6px}.ModalContainer{background:var(--emw--color-white, #fff);border-radius:var(--emw--border-radius-medium, 4px);padding:var(--emw--spacing-large, 20px);width:400px}.ModalCloseBtn{position:absolute;display:flex;align-items:center;justify-content:center;top:10px;right:10px;padding:var(--emw--spacing-small-minus, 10px);border-radius:50%;color:var(--emw--color-white, #fff);background:var(--mmw--color-gray-transparency-85, rgba(255, 255, 255, 0.85));cursor:pointer;transition:all 150ms ease-in-out}.ModalCloseBtn svg{width:32px;height:32px}.ModalCloseBtn:hover{background:var(--emw--color-gray-transparency-20, rgba(255, 255, 255, 0.2))}@container modal-window (max-width:750px){.ModalWindow .ModalContainer{width:90%;max-width:400px}}");
}
const tt = (n) => ({}), z = (n) => ({});
function E(n) {
  let t, e, i, l, o, d;
  const f = (
    /*#slots*/
    n[9].content
  ), a = K(
    f,
    n,
    /*$$scope*/
    n[8],
    z
  );
  return {
    c() {
      t = y("div"), e = y("div"), i = y("div"), a && a.c(), h(i, "class", "ModalContainer"), h(i, "part", "ModalContainer"), h(e, "class", "ModalWindow"), h(e, "part", "ModalWindow"), h(e, "id", "Modal"), v(() => (
        /*div1_elementresize_handler*/
        n[11].call(e)
      )), h(t, "part", "CustomStylingContainer");
    },
    m(r, c) {
      L(r, t, c), k(t, e), k(e, i), a && a.m(i, null), n[10](e), l = Y(
        e,
        /*div1_elementresize_handler*/
        n[11].bind(e)
      ), n[12](t), d = !0;
    },
    p(r, c) {
      n = r, a && a.p && (!d || c & /*$$scope*/
      256) && Q(
        a,
        f,
        n,
        /*$$scope*/
        n[8],
        d ? X(
          f,
          /*$$scope*/
          n[8],
          c,
          tt
        ) : V(
          /*$$scope*/
          n[8]
        ),
        z
      );
    },
    i(r) {
      d || (m(a, r), r && v(() => {
        d && (o || (o = M(
          e,
          x,
          /*duration*/
          n[2],
          !0
        )), o.run(1));
      }), d = !0);
    },
    o(r) {
      p(a, r), r && (o || (o = M(
        e,
        x,
        /*duration*/
        n[2],
        !1
      )), o.run(0)), d = !1;
    },
    d(r) {
      r && H(t), a && a.d(r), n[10](null), l(), r && o && o.end(), n[12](null);
    }
  };
}
function et(n) {
  let t, e, i = (
    /*show*/
    n[5] && E(n)
  );
  return {
    c() {
      i && i.c(), t = I();
    },
    m(l, o) {
      i && i.m(l, o), L(l, t, o), e = !0;
    },
    p(l, [o]) {
      /*show*/
      l[5] ? i ? (i.p(l, o), o & /*show*/
      32 && m(i, 1)) : (i = E(l), i.c(), m(i, 1), i.m(t.parentNode, t)) : i && (A(), p(i, 1, 1, () => {
        i = null;
      }), G());
    },
    i(l) {
      e || (m(i), e = !0);
    },
    o(l) {
      p(i), e = !1;
    },
    d(l) {
      l && H(t), i && i.d(l);
    }
  };
}
function nt(n, t, e) {
  let { $$slots: i = {}, $$scope: l } = t, { clientstyling: o = "" } = t, { clientstylingurl: d = "" } = t, { duration: f = 200 } = t, { width: a } = t, { height: r } = t, c, u, _ = !1;
  const T = () => {
    e(5, _ = !1), window.postMessage({ type: "ClosedCashierModal" }, window.location.href), window.postMessage({ type: "EnableScroll" }, window.location.href);
  }, b = (s) => {
    s.data.type == "ShowCashierModal" && (e(5, _ = !0), window.postMessage({ type: "DisableScroll" }, window.location.href)), s.data.type == "HideCashierModal" && T();
  }, W = () => {
    let s = document.createElement("style");
    s.innerHTML = o, u.appendChild(s);
  }, B = () => {
    let s = new URL(d), C = document.createElement("style");
    fetch(s.href).then((w) => w.text()).then((w) => {
      C.innerHTML = w, setTimeout(
        () => {
          u.appendChild(C);
        },
        1
      );
    });
  };
  J(() => (window.addEventListener("message", b, !1), () => {
    window.removeEventListener("message", b);
  }));
  function R(s) {
    S[s ? "unshift" : "push"](() => {
      c = s, e(4, c);
    });
  }
  function U() {
    a = this.clientWidth, r = this.clientHeight, e(0, a), e(1, r);
  }
  function q(s) {
    S[s ? "unshift" : "push"](() => {
      u = s, e(3, u);
    });
  }
  return n.$$set = (s) => {
    "clientstyling" in s && e(6, o = s.clientstyling), "clientstylingurl" in s && e(7, d = s.clientstylingurl), "duration" in s && e(2, f = s.duration), "width" in s && e(0, a = s.width), "height" in s && e(1, r = s.height), "$$scope" in s && e(8, l = s.$$scope);
  }, n.$$.update = () => {
    n.$$.dirty & /*clientstyling, customStylingContainer*/
    72 && o && u && W(), n.$$.dirty & /*clientstylingurl, customStylingContainer*/
    136 && d && u && B();
  }, [
    a,
    r,
    f,
    u,
    c,
    _,
    o,
    d,
    l,
    i,
    R,
    U,
    q
  ];
}
class j extends F {
  constructor(t) {
    super(), O(
      this,
      t,
      nt,
      et,
      N,
      {
        clientstyling: 6,
        clientstylingurl: 7,
        duration: 2,
        width: 0,
        height: 1
      },
      $
    );
  }
  get clientstyling() {
    return this.$$.ctx[6];
  }
  set clientstyling(t) {
    this.$$set({ clientstyling: t }), g();
  }
  get clientstylingurl() {
    return this.$$.ctx[7];
  }
  set clientstylingurl(t) {
    this.$$set({ clientstylingurl: t }), g();
  }
  get duration() {
    return this.$$.ctx[2];
  }
  set duration(t) {
    this.$$set({ duration: t }), g();
  }
  get width() {
    return this.$$.ctx[0];
  }
  set width(t) {
    this.$$set({ width: t }), g();
  }
  get height() {
    return this.$$.ctx[1];
  }
  set height(t) {
    this.$$set({ height: t }), g();
  }
}
Z(j, { clientstyling: {}, clientstylingurl: {}, duration: {}, width: {}, height: {} }, ["content"], [], !0);
const st = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: j
}, Symbol.toStringTag, { value: "Module" }));
export {
  st as C,
  x as f
};
