// packages/block-library/src/audio/transforms.js
import { createBlobURL } from "@wordpress/blob";
import { createBlock } from "@wordpress/blocks";
var transforms = {
  from: [
    {
      type: "files",
      isMatch(files) {
        return files.length === 1 && files[0].type.indexOf("audio/") === 0;
      },
      transform(files) {
        const file = files[0];
        const block = createBlock("core/audio", {
          blob: createBlobURL(file)
        });
        return block;
      }
    },
    {
      type: "shortcode",
      tag: "audio",
      attributes: {
        src: {
          type: "string",
          shortcode: ({
            named: { src, mp3, m4a, ogg, wav, wma }
          }) => {
            return src || mp3 || m4a || ogg || wav || wma;
          }
        },
        loop: {
          type: "string",
          shortcode: ({ named: { loop } }) => {
            return loop;
          }
        },
        autoplay: {
          type: "string",
          shortcode: ({ named: { autoplay } }) => {
            return autoplay;
          }
        },
        preload: {
          type: "string",
          shortcode: ({ named: { preload } }) => {
            return preload;
          }
        }
      }
    }
  ]
};
var transforms_default = transforms;
export {
  transforms_default as default
};
//# sourceMappingURL=transforms.js.map
