function loadScript(src) {
  return new Promise((resolve) => {
    const script = document.createElement("script");
    script.src = src;
    script.onload = resolve;
    document.head.appendChild(script);
  });
}
const IMAGE_STUDIO_OPENER_SRC = (
  // oxlint-disable-next-line max-len
  "https://static.parastorage.com/unpkg/@wix/media-image-studio-opener@3.299.0/dist/statics/MediaImageStudio.bundle.min.js"
);
let mediaImageStudioPackageLoader;
function getImageStudioPackage() {
  if (!mediaImageStudioPackageLoader) {
    disableRequireJS();
    mediaImageStudioPackageLoader = loadScript(IMAGE_STUDIO_OPENER_SRC);
  }
  return mediaImageStudioPackageLoader.then(() => {
    enableRequireJS();
    return window.MediaImageStudio;
  });
}
function disableRequireJS() {
  if (window.requirejs && !window.requirejsBackup) {
    window.requirejsBackup = {
      define: window.define,
      require: window.require,
      requirejs: window.requirejs
    };
    window.define = void 0;
    window.require = void 0;
    window.requirejs = void 0;
  }
}
function enableRequireJS() {
  if (window.requirejsBackup) {
    Object.assign(window, window.requirejsBackup);
    window.requirejsBackup = void 0;
  }
}
export {
  getImageStudioPackage
};
//# sourceMappingURL=image-studio-opener-loader.js.map
