"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var consts_exports = {};
__export(consts_exports, {
  AUDIO_ACTION_NAMES: () => AUDIO_ACTION_NAMES,
  AUDIO_BI_VALUES: () => AUDIO_BI_VALUES,
  AUDIO_BUTTONS: () => AUDIO_BUTTONS,
  AUDIO_INSERT_AUDIO_MODAL_ID: () => AUDIO_INSERT_AUDIO_MODAL_ID,
  AUDIO_INSERT_SOUNDCLOUD_MODAL_ID: () => AUDIO_INSERT_SOUNDCLOUD_MODAL_ID,
  AUDIO_INSERT_SPOTIFY_MODAL_ID: () => AUDIO_INSERT_SPOTIFY_MODAL_ID,
  AUDIO_REPLACE_MODAL_ID: () => AUDIO_REPLACE_MODAL_ID,
  AUDIO_SETTINGS_MODAL_ID: () => AUDIO_SETTINGS_MODAL_ID,
  AUDIO_TYPES: () => AUDIO_TYPES,
  INSERT_AUDIO_MODAL_ID: () => INSERT_AUDIO_MODAL_ID,
  audioFileTypes: () => audioFileTypes,
  downloadFile: () => downloadFile,
  getAudioSrc: () => getAudioSrc,
  playbackRates: () => playbackRates
});
module.exports = __toCommonJS(consts_exports);
var import_ricos_types = require("./../ricos-types/index.js");
const downloadFile = (url, fileName) => {
  fetch(url, {
    method: "GET"
  }).then((response) => response.blob()).then((blob) => {
    const url2 = window.URL.createObjectURL(blob);
    const a = document.createElement("a");
    a.href = url2;
    a.download = fileName;
    document.body.appendChild(a);
    a.click();
    a.remove();
  });
};
const getAudioSrc = (src, config) => {
  if (src?.url) {
    return src.url;
  }
  if (typeof src === "object") {
    if (config && config.getAudioUrl) {
      return config.getAudioUrl(src);
    } else {
      console.error("must set getAudioUrl in plugin config when using custom audio source!", src);
    }
  }
  return src;
};
const playbackRates = [
  {
    text: "0.25",
    rate: 0.25
  },
  {
    text: "0.5",
    rate: 0.5
  },
  {
    text: "0.75",
    rate: 0.75
  },
  {
    text: "Normal",
    rate: 1
  },
  {
    text: "1.25",
    rate: 1.25
  },
  {
    text: "1.5",
    rate: 1.5
  },
  {
    text: "1.75",
    rate: 1.75
  },
  {
    text: "2",
    rate: 2
  }
];
const AUDIO_ACTION_NAMES = {
  fileDownloaded: "fileDownloaded",
  playAudio: "playAudio",
  changeTitle: "changeTitle",
  changeCreator: "changeCreator",
  changeCover: "changeCover",
  downloadAudio: "downloadAudio"
};
const AUDIO_BI_VALUES = {
  PLAY: "play",
  PAUSE: "pause",
  PLAYBACK_COMPLETED: "playbackCompleted",
  YES: "yes",
  NO: "no",
  click: "Click"
};
const AUDIO_TYPES = { custom: "File Upload", spotify: "Spotify", soundCloud: "SoundCloud" };
const audioFileTypes = ".mp3,.pcm,.wav,.aiff,.aif,.aac,.ogg,.wma,.m4a,.flac";
const INSERT_AUDIO_MODAL_ID = "AUDIO.insert";
const AUDIO_SETTINGS_MODAL_ID = "AUDIO.settings";
const AUDIO_INSERT_AUDIO_MODAL_ID = "AUDIO.insertAudio";
const AUDIO_INSERT_SPOTIFY_MODAL_ID = "AUDIO.insertSpotify";
const AUDIO_INSERT_SOUNDCLOUD_MODAL_ID = "AUDIO.insertSoundCloud";
const AUDIO_REPLACE_MODAL_ID = "AUDIO.replace";
const AUDIO_BUTTONS = {
  size: `${import_ricos_types.Node_Type.AUDIO}.size`,
  alignment: `${import_ricos_types.Node_Type.AUDIO}.alignment`
};
//# sourceMappingURL=consts.js.map
