import "grapesjs";
const Q = "app.grapesjs.com", ee = "app-stage.grapesjs.com", H = [
  Q,
  ee,
  "localhost",
  "127.0.0.1",
  ".local-credentialless.webcontainer.io",
  // For stackblitz.com demos
  ".local.webcontainer.io",
  // For stackblitz.com demos
  "-sandpack.codesandbox.io"
  // For Sandpack demos
], te = "license:check:start", ae = "license:check:end", le = () => typeof window < "u", se = ({ isDev: e, isStage: l }) => `${e ? "" : `https://${l ? ee : Q}`}/api`, ne = () => {
  const e = le() && window.location.hostname;
  return !!e && (H.includes(e) || H.some((l) => e.endsWith(l)));
}, ie = (e) => e.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (l, a) => (a ? "-" : "") + l.toLowerCase()), oe = (e) => typeof e < "u";
var T = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(T || {});
async function re({
  path: e,
  baseApiUrl: l,
  method: a = "GET",
  headers: s = {},
  params: i,
  body: f
}) {
  const d = `${l || se({ isDev: !1, isStage: !1 })}${e}`, p = {
    method: a,
    headers: {
      "Content-Type": "application/json",
      ...s
    }
  };
  f && (p.body = JSON.stringify(f));
  const b = i ? new URLSearchParams(i).toString() : "", o = b ? `?${b}` : "", h = await fetch(`${d}${o}`, p);
  if (!h.ok)
    throw new Error(`HTTP error! status: ${h.status}`);
  return h.json();
}
const G = {
  [T.free]: 0,
  [T.startup]: 10,
  [T.business]: 20,
  [T.enterprise]: 30
};
function ce(e) {
  const l = e;
  return l.init = (a) => (s) => e(s, a), l;
}
const de = (e) => /* @__PURE__ */ ce(e);
async function pe({
  editor: e,
  plan: l,
  pluginName: a,
  licenseKey: s,
  cleanup: i
}) {
  let f = "", c = !1;
  const d = ne(), p = (o) => {
    console.warn("Cleanup plugin:", a, "Reason:", o), i();
  }, b = (o = {}) => {
    var S;
    const { error: h, sdkLicense: t } = o, n = (S = o.plan) == null ? void 0 : S.category;
    if (!(t || o.license) || h)
      p(h || "Invalid license");
    else if (n) {
      const R = G[l], $ = G[n];
      R > $ && p({ pluginRequiredPlan: l, licensePlan: n });
    }
  };
  e.on(te, (o) => {
    f = o == null ? void 0 : o.baseApiUrl, c = !0;
  }), e.on(ae, (o) => {
    b(o);
  }), setTimeout(async () => {
    if (!c) {
      if (d) return;
      if (s) {
        const o = await ue({ licenseKey: s, pluginName: a, baseApiUrl: f });
        o && b(o);
      } else
        p("The `licenseKey` option not provided");
    }
  }, 2e3);
}
async function ue(e) {
  const { licenseKey: l, pluginName: a, baseApiUrl: s } = e;
  try {
    return (await re({
      baseApiUrl: s,
      path: `/sdk/${l || "na"}`,
      method: "POST",
      params: {
        d: window.location.hostname,
        pn: a
      }
    })).result || {};
  } catch (i) {
    return console.error("Error during SDK license check:", i), !1;
  }
}
const P = (e, l) => {
  var a;
  return !!((a = e == null ? void 0 : e.classList) != null && a.contains(l));
}, be = (e, l = {}) => {
  var f;
  const a = {}, s = [], i = [];
  for (const c in e) {
    const { value: d, ...p } = e[c];
    s.push({ id: c, name: c, changeProp: !0, category: l.category, ...p }), a[c] = d, !oe(d) && i.push(c);
    const { subTraits: b = {} } = p;
    for (const o in p.subTraits)
      (f = b[o]) == null || f.forEach((h) => {
        const t = h.id || h.name;
        a[t] = h.value;
      });
  }
  return {
    propKeys: Object.keys(a),
    propsNoValues: i,
    props: a,
    traits: s
  };
}, fe = (e, l) => {
  l.forEach((a) => {
    if (a.subTraits) {
      const s = `${a.id || a.name}`, i = a.changeProp ? `change:${s}` : `change:attributes:${s}`;
      e.on(i, () => U(e, s)), U(e, s);
    }
  });
}, U = (e, l) => {
  const a = e.getTrait(l), s = a.get("category"), i = a.get("subTraits") || {}, c = (Object.values(i).flat() || []).map((b) => b.id || b.name);
  e.removeTrait(c);
  const d = i[a.getValue()], p = e.getTraitIndex(l) + 1;
  d && e.addTrait(
    d.map((b) => ({ category: s, ...b })),
    { at: p }
  );
}, he = (e, l) => {
  l.forEach((a) => {
    const s = ie(a);
    s !== a && e.has(s) && e.set({ [a]: e.get(s), [s]: void 0 });
  });
}, m = "swiper", M = `${m}-slide`, x = `${m}-wrapper`, L = `${m}-nav-prev`, V = `${m}-nav-next`, k = `${m}-pagination`, N = `${m}-scrollbar`, u = {
  slider: `<svg viewBox="0 0 24 24">
  <path d="M22 7.6c0-1-.5-1.6-1.3-1.6H3.4C2.5 6 2 6.7 2 7.6v9.8c0 1 .5 1.6 1.3 1.6h17.4c.8 0 1.3-.6 1.3-1.6V7.6zM21 18H3V7h18v11z" fill-rule="nonzero"/>
  <path d="M4 12.5L6 14v-3zM20 12.5L18 14v-3z"/>
</svg>`,
  effect: `<svg viewBox="0 0 24 24">
  <path d="M7.5 5.6 5 7l1.4-2.5L5 2l2.5 1.4L10 2 8.6 4.5 10 7 7.5 5.6m12 9.8L22 14l-1.4 2.5L22 19l-2.5-1.4L17 19l1.4-2.5L17 14l2.5 1.4M22 2l-1.4 2.5L22 7l-2.5-1.4L17 7l1.4-2.5L17 2l2.5 1.4L22 2m-8.7 10.8 2.5-2.5-2.1-2-2.5 2.4 2.1 2m1-5.4 2.4 2.3c.4.4.4 1 0 1.4L5 22.7a1 1 0 0 1-1.4 0l-2.3-2.3a1 1 0 0 1 0-1.4L13 7.3a1 1 0 0 1 1.4 0Z"/>
</svg>`,
  autoplay: `<svg viewBox="0 0 24 24">
  <path d="M5 6.3A1 1 0 0 1 5 5a1 1 0 0 1 1.3 0l6.8 5.4.3.3a2 2 0 0 1-2.8 2.8l-.3-.3L5 6.3M12 20a8 8 0 0 0 8-8 8 8 0 0 0-2.3-5.7L19 5a10 10 0 0 1 3 7 10 10 0 0 1-10 10A10 10 0 0 1 2 12h2a8 8 0 0 0 8 8m0-19a2 2 0 0 1 2 2 2 2 0 0 1-2 2 2 2 0 0 1-2-2 2 2 0 0 1 2-2Z"/>
</svg>`,
  pagination: `<svg viewBox="0 0 24 24">
  <path d="M16 12a2 2 0 0 1 2-2 2 2 0 0 1 2 2 2 2 0 0 1-2 2 2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2 2 2 0 0 1 2 2 2 2 0 0 1-2 2 2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2 2 2 0 0 1 2 2 2 2 0 0 1-2 2 2 2 0 0 1-2-2Z"/>
</svg>`,
  scrollbar: `<svg viewBox="0 0 24 24">
  <path d="M7.2 9.2 5.8 7.8 1.5 12l4.3 4.2 1.4-1.4L4.4 12zm9.6 5.6 1.4 1.4 4.3-4.2-4.3-4.2-1.4 1.4 2.8 2.8z"/>
  <path fill-rule="evenodd" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0m-2 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0" clip-rule="evenodd"/>
</svg>`,
  parallax: `<svg viewBox="0 0 24 24">
  <path d="M12.6 23.3h-.2v.5h.2v-.5m.3-.2-.2.1v.5l.2.1v-.6m-.8 0v.6h.2v-.5z"/>
  <path fill="currentColor" d="M18 9.4a2.5 2.5 0 0 1 3 2.3v5.7a3 3 0 0 1-2.2 2.9h-.2L13 21.4a2.5 2.5 0 0 1-3-2.3v-5.7a3 3 0 0 1 2.2-2.9h.2zM14.5 6a2.5 2.5 0 0 1 3 2.3v.4l-5.3 1A4 4 0 0 0 9 13.4v4.8a2.5 2.5 0 0 1-2.5-2.4v-5.7a3 3 0 0 1 2.2-2.9H9zM11 2.6a2.5 2.5 0 0 1 3 2.3v.3l-5.3 1A4 4 0 0 0 5.5 10v4.8A2.5 2.5 0 0 1 3 12.3V6.6a3 3 0 0 1 2.2-2.9h.2z"/>
</svg>`,
  responsive: `<svg viewBox="0 0 24 24">
  <path d="M17 21q-.4 0-.7-.3T16 20V10q0-.8-.6-1.4T14 8h-3.5q-.4 0-.7-.3T9.5 7V4q0-.4.3-.7t.7-.3H20q.4 0 .7.3t.3.7v16q0 .4-.3.7t-.7.3zm-6.5 0q-.4 0-.7-.3t-.3-.7v-9q0-.4.3-.7t.7-.3H13q.4 0 .7.3t.3.7v9q0 .4-.3.7t-.7.3zM4 21q-.4 0-.7-.3T3 20v-9q0-.4.3-.7T4 10h2.5q.4 0 .7.3t.3.7v9q0 .4-.3.7t-.7.3z"/>
</svg>`,
  extra: `<svg viewBox="0 0 24 24">
  <path fill-rule="evenodd" d="M5.4 3h13.2A2.4 2.4 0 0 1 21 5.4v13.2a2.4 2.4 0 0 1-2.4 2.4H5.4A2.4 2.4 0 0 1 3 18.6V5.4A2.4 2.4 0 0 1 5.4 3M5 12a2 2 0 1 1 4 0 2 2 0 0 1-4 0m5 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0m7-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4" clip-rule="evenodd"/>
</svg>`,
  reload: `<svg viewBox="0 0 24 24">
  <path d="M2 12c0 5 4 9 9 9 2.4 0 4.7-1 6.4-2.6l-1.5-1.5A6.7 6.7 0 0 1 11 19a7 7 0 1 1 7-7h-3l4 4h.1l3.9-4h-3a9 9 0 0 0-18 0Z"/>
</svg>`,
  prev: '<svg viewBox="0 0 24 24"><path d="M15.4 16.6 10.8 12l4.6-4.6L14 6l-6 6 6 6 1.4-1.4Z"/></svg>',
  next: '<svg viewBox="0 0 24 24"><path d="m8.6 16.6 4.6-4.6-4.6-4.6L10 6l6 6-6 6-1.4-1.4Z"/></svg>',
  add: `<svg viewBox="0 0 24 24">
  <path d="M12 20a8 8 0 1 1 0-16 8 8 0 0 1 0 16m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m1 5h-2v4H7v2h4v4h2v-4h4v-2h-4V7Z"/>
</svg>`
}, j = { id: "swiper-responsive", label: "Responsive", icon: u.responsive }, K = { id: "swiper-extra", label: "Extra", icon: u.extra }, ve = {
  actions: {
    type: "radio",
    label: !1,
    labelToTitle: !0,
    options: [
      { id: "r", label: "Reload slider", icon: u.reload },
      { id: "p", label: "Previous slide", icon: u.prev },
      { id: "n", label: "Next slide", icon: u.next },
      { id: "a", label: "Add new slide", icon: u.add }
    ],
    setValue: ({ component: e, value: l }) => {
      var s;
      const a = (s = e.getView()) == null ? void 0 : s.getSwiper();
      switch (l) {
        case "r":
          e.reloadSlider();
          break;
        case "p":
          a == null || a.slidePrev();
          break;
        case "n":
          a == null || a.slideNext();
          break;
        case "a":
          e.addSlide();
          break;
      }
    }
  },
  vertical: {
    type: "checkbox",
    label: "Vertical",
    value: !1
  },
  loop: {
    type: "checkbox",
    label: "Loop",
    value: !1
  },
  freeMode: {
    type: "checkbox",
    label: "Free mode",
    value: !1
  },
  autoHeight: {
    type: "checkbox",
    label: "Auto height",
    value: !1
  },
  navigation: {
    type: "checkbox",
    label: "Navigation",
    getValue: ({ component: e }) => !!e.findFirstType(L),
    setValue: ({ component: e, value: l }) => {
      var a, s;
      l ? e.append([{ type: L }, { type: V }]) : ((a = e.findFirstType(L)) == null || a.remove(), (s = e.findFirstType(V)) == null || s.remove()), e.set({ navigation: l });
    }
  },
  initialSlide: {
    type: "number",
    label: "Initial slide",
    min: 0,
    value: "0"
  },
  speed: {
    type: "number",
    label: "Speed",
    tip: "Transition duration (in ms)",
    step: 500,
    min: 0,
    value: 300
  },
  effect: {
    category: { id: "swiper-effect", label: "Effects", icon: u.effect },
    type: "select",
    label: "Effect Type",
    value: "slide",
    options: [
      { id: "slide", label: "Slide" },
      { id: "fade", label: "Fade" },
      { id: "cube", label: "Cube" },
      { id: "coverflow", label: "Coverflow" },
      { id: "flip", label: "Flip" },
      { id: "cards", label: "Cards" }
    ],
    subTraits: {
      slide: [
        {
          type: "number",
          name: "slidesPerView",
          label: "Slides per view",
          changeProp: !0,
          min: 1,
          value: 1
        },
        {
          type: "number",
          name: "slidesPerGroup",
          label: "Slides per group",
          tip: "Numbers of slides for group sliding",
          changeProp: !0,
          min: 1,
          value: 1
        },
        {
          type: "number",
          name: "spaceBetween",
          label: "Space between",
          tip: "Distance between slides in px",
          changeProp: !0,
          min: 0,
          value: 0
        },
        {
          type: "number",
          name: "slidesOffsetBefore",
          label: "Slides offset before",
          tip: "Add additional slide offset in the beginning of the container (in px, before all slides)",
          changeProp: !0,
          min: 0,
          value: 0
        },
        {
          type: "number",
          name: "slidesOffsetAfter",
          label: "Slides offset after",
          tip: "Add additional slide offset in the end of the container (in px, after all slides)",
          changeProp: !0,
          min: 0,
          value: 0
        },
        {
          type: "checkbox",
          name: "centeredSlides",
          label: "Centered slides",
          tip: "If enabled, the active slide will be centered",
          changeProp: !0,
          value: !1
        }
      ],
      fade: [
        {
          type: "checkbox",
          name: "crossFade",
          tip: "Enables slides cross fade",
          label: "Cross fade",
          changeProp: !0,
          value: !1
        }
      ],
      cube: [
        {
          type: "checkbox",
          name: "cubeEffectShadow",
          label: "Shadow",
          changeProp: !0,
          value: !0
        },
        {
          type: "checkbox",
          name: "cubeEffectSlideShadows",
          label: "Slide shadows",
          changeProp: !0,
          value: !0
        },
        {
          type: "number",
          name: "cubeEffectShadowOffset",
          label: "Shadow offset",
          changeProp: !0,
          value: 20
        },
        {
          type: "number",
          name: "cubeEffectShadowScale",
          label: "Shadow scale",
          changeProp: !0,
          value: 0.94
        }
      ],
      coverflow: [
        {
          type: "number",
          name: "coverflowEffectDepth",
          tip: "Depth offset in px (slides translate in Z axis)",
          label: "Depth",
          changeProp: !0,
          min: 0,
          value: 100
        },
        {
          type: "number",
          name: "coverflowEffectModifier",
          tip: "Effect multiplier",
          label: "Modifier",
          changeProp: !0,
          step: 0.1,
          min: 0,
          value: 1
        },
        {
          type: "number",
          name: "coverflowEffectRotate",
          tip: "Slide rotate in degrees",
          label: "Rotate",
          changeProp: !0,
          min: 0,
          value: 50
        },
        {
          type: "number",
          name: "coverflowEffectScale",
          tip: "Slide scale effect",
          label: "Scale",
          changeProp: !0,
          min: 0,
          step: 0.1,
          value: 1
        },
        {
          type: "number",
          name: "coverflowEffectStretch",
          tip: "Stretch space between slides (in px)",
          label: "Stretch",
          changeProp: !0,
          min: 0,
          value: 0
        },
        {
          type: "checkbox",
          name: "coverflowEffectSlideShadows",
          tip: "Enables slides shadows",
          label: "Slide shadow",
          changeProp: !0,
          value: !0
        }
      ],
      flip: [
        {
          type: "checkbox",
          name: "flipEffectLimitRotation",
          tip: "Limit edge slides rotation",
          label: "Limit rotation",
          changeProp: !0,
          value: !0
        },
        {
          type: "checkbox",
          name: "flipEffectSlideShadows",
          tip: "Enables slides shadows",
          label: "Slide shadows",
          changeProp: !0,
          value: !0
        }
      ],
      cards: [
        {
          type: "number",
          name: "cardsEffectPerSlideOffset",
          tip: "Offset distance per slide (in px)",
          label: "Slide offset",
          changeProp: !0,
          min: 0,
          value: 8
        },
        {
          type: "number",
          name: "cardsEffectPerSlideRotate",
          tip: "Rotate angle per slide (in degrees)",
          label: "Slide rotate",
          changeProp: !0,
          min: 0,
          value: 2
        },
        {
          type: "checkbox",
          name: "cardsEffectRotate",
          tip: "Enables cards rotation",
          label: "Rotate",
          changeProp: !0,
          value: !0
        },
        {
          type: "checkbox",
          name: "cardsEffectSlideShadows",
          tip: "Enables slides shadows",
          label: "Slide shadows",
          changeProp: !0,
          value: !0
        }
      ]
    }
  },
  autoplay: {
    category: { id: "swiper-autoplay", label: "Autoplay", icon: u.autoplay },
    type: "checkbox",
    label: "Enable Autoplay",
    value: !1,
    subTraits: {
      true: [
        {
          type: "number",
          name: "autoplayDelay",
          label: "Delay",
          changeProp: !0,
          value: 3e3
        },
        {
          type: "checkbox",
          name: "autoplayDisableOnInteraction",
          label: "Disable on interaction",
          changeProp: !0,
          value: !0
        },
        {
          type: "checkbox",
          name: "autoplayWaitForTransition",
          label: "Wait for transition",
          changeProp: !0,
          value: !0
        },
        {
          type: "checkbox",
          name: "autoplayPauseOnMouseEnter",
          label: "Pause on mouse enter",
          changeProp: !0,
          value: !1
        },
        {
          type: "checkbox",
          name: "autoplayReverseDirection",
          label: "Reverse direction",
          changeProp: !0,
          value: !1
        },
        {
          type: "checkbox",
          name: "autoplayStopOnLastSlide",
          label: "Stop on last slide",
          changeProp: !0,
          value: !1
        }
      ]
    }
  },
  pagination: {
    category: { id: "swiper-pagination", label: "Pagination", icon: u.pagination },
    type: "select",
    label: "Pagination Type",
    options: [
      { id: "none", label: "None" },
      { id: "bullets", label: "Bullets" },
      { id: "progressbar", label: "Progressbar" },
      { id: "fraction", label: "Fraction" }
    ],
    getValue: ({ component: e }) => e.findFirstType(k) ? e.get("pagination") || "bullets" : "none",
    setValue: ({ component: e, value: l }) => {
      const a = e.findFirstType(k);
      a == null || a.remove(), l !== "none" && e.append({ type: k }), e.set({ pagination: l });
    },
    subTraits: {
      bullets: [
        {
          type: "checkbox",
          name: "dynamicBullets",
          label: "Dynamic bullets",
          changeProp: !0,
          value: !1
        },
        {
          type: "checkbox",
          name: "clickableBullets",
          label: "Clickable bullets",
          changeProp: !0,
          value: !0
        }
      ],
      progressbar: [
        {
          type: "checkbox",
          name: "progressbarOpposite",
          label: "Progress opposite",
          changeProp: !0,
          value: !1
        }
      ]
    }
  },
  scrollbar: {
    category: { id: "swiper-scrollbar", label: "Scrollbar", icon: u.scrollbar },
    type: "checkbox",
    label: "Enable Scrollbar",
    getValue: ({ component: e }) => !!e.findFirstType(N),
    setValue: ({ component: e, value: l }) => {
      const a = e.findFirstType(N);
      a == null || a.remove(), l && e.append({ type: N }), e.set({ scrollbar: l });
    },
    subTraits: {
      false: [],
      true: [
        {
          type: "checkbox",
          name: "scrollbarDraggable",
          label: "Draggable",
          changeProp: !0,
          value: !1
        },
        {
          type: "checkbox",
          name: "scrollbarHide",
          label: "Hide",
          tip: "Hide scrollbar automatically after user interaction",
          changeProp: !0,
          value: !0
        }
      ]
    }
  },
  parallax: {
    category: { id: "swiper-parallax", label: "Parallax", icon: u.parallax },
    type: "checkbox",
    label: "Enable Parallax",
    value: !1
  },
  mobile: {
    category: j,
    type: "checkbox",
    label: "Enable mobile breakpoint",
    value: !1,
    subTraits: {
      true: [
        {
          type: "number",
          name: "mobileBreakpoint",
          label: "Mobile breakpoint",
          tip: "Slide values below will be applied when the screen width is greater than this value",
          changeProp: !0,
          min: 1,
          value: 460
        },
        {
          type: "number",
          name: "mobileSlidesPerView",
          label: "Slides per view",
          changeProp: !0,
          min: 1,
          value: 1
        },
        {
          type: "number",
          name: "mobileSlidesPerGroup",
          label: "Slides per group",
          changeProp: !0,
          min: 1,
          value: 1
        },
        {
          type: "number",
          name: "mobileSpaceBetween",
          label: "Space between",
          changeProp: !0,
          min: 0,
          value: 0
        }
      ]
    }
  },
  tablet: {
    category: j,
    type: "checkbox",
    label: "Enable tablet breakpoint",
    value: !1,
    subTraits: {
      true: [
        {
          type: "number",
          name: "tabletBreakpoint",
          label: "Tablet breakpoint",
          tip: "Slide values below will be applied when the screen width is greater than this value",
          changeProp: !0,
          min: 1,
          value: 991
        },
        {
          type: "number",
          name: "tabletSlidesPerView",
          label: "Slides per view",
          changeProp: !0,
          min: 1,
          value: 1
        },
        {
          type: "number",
          name: "tabletSlidesPerGroup",
          label: "Slides per group",
          changeProp: !0,
          min: 1,
          value: 1
        },
        {
          type: "number",
          name: "tabletSpaceBetween",
          label: "Space between",
          changeProp: !0,
          min: 0,
          value: 0
        }
      ]
    }
  },
  allowTouchMove: {
    category: K,
    type: "checkbox",
    label: "Allow touch move",
    tip: "Allow touch interactions",
    value: !0
  },
  grabCursor: {
    category: K,
    type: "checkbox",
    label: "Grab cursor",
    tip: 'If enabled, the user will see the "grab" cursor when hover the slider',
    value: !1
  }
}, Z = "Slider", q = "swiper", C = `${q}-`, me = (e, l) => {
  const { Components: a, Blocks: s, Commands: i } = e, { block: f } = l, c = be(ve), d = "core:preview", p = i.events, b = function(t) {
    const n = this, A = window, S = n.__onLoad, R = n.__activeSlide, $ = n.__inPreview, { cdnScript: D, cdnStyle: I, slidesPerView: F } = t || {}, r = (v) => isNaN(v) ? void 0 : parseFloat(v), z = () => {
      const v = {
        loop: t.loop,
        speed: t.speed,
        initialSlide: t.initialSlide,
        direction: t.vertical ? "vertical" : "horizontal",
        effect: t.effect,
        freeMode: t.freeMode,
        parallax: t.parallax,
        autoHeight: t.autoHeight,
        allowTouchMove: t.allowTouchMove,
        grabCursor: t.grabCursor,
        simulateTouch: !0,
        breakpoints: {},
        slidesPerView: isNaN(F) ? F : r(F),
        slidesPerGroup: r(t.slidesPerGroup),
        spaceBetween: r(t.spaceBetween),
        slidesOffsetBefore: r(t.slidesOffsetBefore),
        slidesOffsetAfter: r(t.slidesOffsetAfter),
        centeredSlides: t.centeredSlides,
        fadeEffect: { crossFade: t.crossFade },
        cubeEffect: {
          shadow: t.cubeEffectShadow,
          slideShadows: t.cubeEffectSlideShadows,
          shadowOffset: r(t.cubeEffectShadowOffset),
          shadowScale: r(t.cubeEffectShadowScale)
        },
        coverflowEffect: {
          depth: r(t.coverflowEffectDepth),
          modifier: r(t.coverflowEffectModifier),
          rotate: r(t.coverflowEffectRotate),
          scale: r(t.coverflowEffectScale),
          stretch: r(t.coverflowEffectStretch),
          slideShadows: t.coverflowEffectSlideShadows
        },
        flipEffect: {
          limitRotation: t.flipEffectLimitRotation,
          slideShadows: t.flipEffectSlideShadows
        },
        cardsEffect: {
          perSlideOffset: r(t.cardsEffectPerSlideOffset),
          perSlideRotate: r(t.cardsEffectPerSlideRotate),
          rotate: t.cardsEffectRotate,
          slideShadows: t.cardsEffectSlideShadows
        },
        navigation: {
          nextEl: n.querySelector(".swiper-button-next"),
          prevEl: n.querySelector(".swiper-button-prev")
        },
        pagination: {
          type: t.pagination || "bullets",
          dynamicBullets: t.dynamicBullets,
          clickable: t.clickableBullets,
          progressbarOpposite: t.progressbarOpposite,
          el: n.querySelector(".swiper-pagination")
        },
        scrollbar: {
          el: n.querySelector(".swiper-scrollbar"),
          draggable: t.scrollbarDraggable,
          hide: t.scrollbarHide
        },
        autoplay: t.autoplay && {
          delay: t.autoplayDelay,
          disableOnInteraction: t.autoplayDisableOnInteraction,
          pauseOnMouseEnter: t.autoplayPauseOnMouseEnter,
          reverseDirection: t.autoplayReverseDirection,
          stopOnLastSlide: t.autoplayStopOnLastSlide,
          waitForTransition: t.autoplayWaitForTransition
        }
      };
      if (t.tablet) {
        const { tabletBreakpoint: _, tabletSlidesPerView: g } = t, E = r(_);
        v.breakpoints[E] = {
          slidesPerView: isNaN(g) ? g : r(g),
          slidesPerGroup: r(t.tabletSlidesPerGroup),
          spaceBetween: r(t.tabletSpaceBetween)
        };
      }
      if (t.mobile) {
        const { mobileBreakpoint: _, mobileSlidesPerView: g } = t, E = r(_);
        v.breakpoints[E] = {
          slidesPerView: isNaN(g) ? g : r(g),
          slidesPerGroup: r(t.mobileSlidesPerGroup),
          spaceBetween: r(t.mobileSpaceBetween)
        };
      }
      S && !$ && (v.simulateTouch = !1), R && (v.initialSlide = R);
      const W = new A.Swiper(n, v);
      S == null || S(W);
    };
    if (A.Swiper)
      z();
    else {
      const { head: v } = document, W = Array.isArray(D) ? [...D] : [D], _ = Array.isArray(I) ? [...I] : [I], g = (w) => {
        if (w.length) {
          const y = document.createElement("link");
          y.href = w.shift(), y.rel = "stylesheet", v.appendChild(y), g(w);
        }
      }, E = (w) => {
        if (w.length) {
          const y = document.createElement("script");
          y.src = w.shift(), y.onerror = y.onload = E.bind(null, w), v.appendChild(y);
        } else
          z();
      };
      g(_), E(W);
    }
  }, o = (t = 0) => ({
    type: M,
    style: { padding: "50px" },
    components: { type: "text", components: { type: "textnode", content: `Slide ${t}` } }
  }), h = a.getType("default").model;
  return a.addType(m, {
    block: f && {
      label: Z,
      media: u.slider,
      category: "Extra",
      select: !0,
      ...l.block
    },
    isComponent: (t) => P(t, q),
    model: {
      defaults: () => ({
        name: Z,
        icon: u.slider,
        classes: q,
        draggable: (t, n) => !n.is(m),
        components: [
          {
            type: x,
            components: [o(1), o(2), o(3)]
          },
          { type: k }
        ],
        script: b,
        cdnScript: l.cdnScript,
        cdnStyle: l.cdnStyle,
        "script-props": ["cdnScript", "cdnStyle", ...c.propKeys],
        ...c.props,
        traits: [...c.traits]
      }),
      init() {
        const { em: t } = this;
        fe(this, c.traits), he(this, c.propKeys), this.listenTo(t, `${p.runCommand}${d}`, this.onPreviewOn), this.listenTo(t, `${p.stopCommand}${d}`, this.onPreviewOff);
      },
      onPreviewOn() {
        this.__inPreview = !0, this.reloadSlider();
      },
      onPreviewOff() {
        this.__inPreview = !1, this.reloadSlider();
      },
      reloadSlider() {
        this.trigger("rerender");
      },
      addSlide() {
        const t = this.findFirstType(x);
        t == null || t.append(this.getNewSlideComponentDef());
      },
      getNewSlideComponentDef() {
        var n;
        const t = ((n = this.findFirstType(x)) == null ? void 0 : n.components().length) || 0;
        return {
          type: M,
          components: { type: "text", components: { type: "textnode", content: `Slide ${t + 1}` } }
        };
      },
      toJSON(...t) {
        const n = h.prototype.toJSON.apply(this, t);
        return c.propsNoValues.forEach((A) => delete n[A]), delete n["script-props"], n;
      }
    },
    view: {
      init() {
        const t = a.events.scriptUnmount;
        t && this.listenTo(this.model, t, this.destroySwiper);
      },
      getSwiper() {
        return this.el.swiper;
      },
      destroySwiper() {
        var t;
        (t = this.getSwiper()) == null || t.destroy();
      },
      onRender() {
        const t = this.el;
        t.__onLoad = (n) => n.on("slideChange", () => this.__activeSlide = n.activeIndex), t.__activeSlide = this.__activeSlide, t.__inPreview = this.model.__inPreview;
      }
    }
  }), () => {
    a.removeType(m), s.remove(m);
  };
}, ge = "Nav Prev", ye = "Nav Next", O = `${C}button-prev`, B = `${C}button-next`, Se = (e) => {
  const { Components: l } = e, a = (s) => ({
    type: "svg",
    selectable: !1,
    hoverable: !1,
    attributes: { viewBox: "0 0 27 44" },
    components: {
      type: "svg-in",
      tagName: "path",
      attributes: { d: s, fill: "currentColor" }
    }
  });
  return l.addType(L, {
    isComponent: (s) => P(s, O),
    model: {
      defaults: {
        name: ge,
        classes: O,
        copyable: !1,
        highlightable: !1,
        droppable: !1,
        draggable: !1,
        selectable: !1,
        hoverable: !1,
        layerable: !1,
        components: a("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),
        styles: `
          .${O} {
            color: inherit;
          }
          .${O}:after {
            content: none;
          }
        `
      }
    }
  }), l.addType(V, {
    extend: L,
    isComponent: (s) => P(s, B),
    model: {
      defaults: {
        name: ye,
        classes: B,
        components: a("M27,22L27,22L5,44l-2.1-2.1L22.8,22L2.9,2.1L5,0L27,22L27,22z"),
        styles: `
          .${B} {
            color: inherit;
          }
          .${B}:after {
            content: none;
          }
        `
      }
    }
  }), () => {
    l.removeType(L), l.removeType(V);
  };
}, we = (e) => {
  const { Components: l } = e, a = `${C}pagination`;
  return l.addType(k, {
    isComponent: (s) => P(s, a),
    model: {
      defaults: {
        name: "Pagination",
        classes: a,
        copyable: !1,
        highlightable: !1,
        droppable: !1,
        draggable: !1,
        selectable: !1,
        hoverable: !1,
        layerable: !1,
        styles: `
          .${a}-bullet-active {
            background-color: currentColor;
          }
          .${a}-progressbar-fill {
            --swiper-pagination-color: currentColor;
          }
        `
      }
    }
  }), () => {
    l.removeType(k);
  };
}, Pe = "Scrollbar", Y = `${C}scrollbar`, Ee = (e) => {
  const { Components: l } = e;
  return l.addType(N, {
    isComponent: (a) => P(a, Y),
    model: {
      defaults: {
        name: Pe,
        classes: Y,
        copyable: !1,
        highlightable: !1,
        removable: !1,
        selectable: !1,
        hoverable: !1,
        layerable: !1,
        droppable: !1,
        draggable: !1
      }
    }
  }), () => {
    l.removeType(N);
  };
}, Te = "Slide", X = `${C}slide`, xe = (e) => {
  const { Components: l } = e;
  return l.addType(M, {
    isComponent: (a) => P(a, X),
    model: {
      defaults: {
        name: Te,
        classes: X,
        icon: u.slider,
        draggable: (a, s) => s.is(x)
      }
      // TODO VIEW slide to this slide when selected
    }
  }), () => {
    l.removeType(M);
  };
}, Le = "Wrapper", J = `${C}wrapper`, ke = (e) => {
  const { Components: l } = e, { events: a } = l;
  return l.addType(x, {
    isComponent: (s) => P(s, J),
    model: {
      defaults: {
        name: Le,
        icon: u.slider,
        classes: J,
        copyable: !1,
        removable: !1,
        draggable: !1,
        highlightable: !1,
        droppable: (s) => s.is(M)
      },
      init() {
        const s = this.components();
        this.listenTo(s, "add remove", this.updateSlider);
      },
      updateSlider(s) {
        const i = this.closestType(m);
        if (i) {
          const f = i.getView();
          i.reloadSlider();
          const c = a.scriptMount;
          c && this.em.once(c, () => {
            setTimeout(() => {
              var d;
              return (d = f.getSwiper()) == null ? void 0 : d.slideTo(s.index());
            }, 100);
          });
        }
      }
    }
  }), () => {
    l.removeType(x);
  };
}, Ce = "swiperComponent", Ae = function(e, l = {}) {
  const a = {
    block: {},
    cdnScript: "https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js",
    cdnStyle: "https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",
    ...l
  }, s = [
    me(e, a),
    Se(e),
    ke(e),
    xe(e),
    we(e),
    Ee(e)
  ];
  pe({
    editor: e,
    plan: T.startup,
    licenseKey: a.licenseKey,
    pluginName: Ce,
    cleanup: () => {
      s.forEach((i) => i());
    }
  });
}, Ne = de(Ae);
export {
  Ne as default
};
