import './es.object.values-69a95046.js';
import './es.array.join-407e20e6.js';
import './es.array.map-2dfef513.js';
import './es.object.keys-9aa2f274.js';
import './es.array.concat-669570ef.js';
import 'lazysizes';
import { n as normalizeComponent } from './normalize-component-1b2cdbb6.js';
import './well-known-symbol-6e9136be.js';
import './object-keys-24d2d6fd.js';
import './array-method-is-strict-52649d4d.js';
import './array-iteration-ec419780.js';
import './function-bind-context-b3fabf77.js';
import './array-species-create-6fc0b2c4.js';
import './array-method-has-species-support-4ec91b65.js';
import './create-property-2fc26c80.js';

/**
 * Component to render an image and optional lazy-loading
 */

var script = {
  name: 'BaseImage',
  props: {
    /**
     * set alt attribute
     */
    alt: {
      type: String,
      default: ''
    },

    /**
     * specify lazy image loading
     */
    lazyload: {
      type: Boolean,
      default: false
    },

    /**
     * set src attribute
     */
    src: {
      type: String,
      default: ''
    },

    /**
     * set srcSet attribute<br>
     * structure: [
     *   {
     *     '640w': 'path'
     *   },
     * ]
     */
    srcset: {
      type: Array,
      default: function _default() {
        return [];
      }
    }
  },
  computed: {
    clearPng: function clearPng() {
      return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8//t3PQAJbAN2AyakNQAAAABJRU5ErkJggg==';
    },
    source: function source() {
      var last = this.srcset.length - 1;
      return this.srcset[last] ? Object.values(this.srcset[last])[0] : this.src;
    },
    sourceSet: function sourceSet() {
      return this.srcset.length ? this.srcset.map(function (size) {
        return Object.keys(size).map(function (width) {
          return "".concat(size[width], " ").concat(width);
        });
      }).join(', ') : null;
    }
  },
  methods: {
    emitError: function emitError(event) {
      this.$emit('error', event);
    }
  }
};

/* script */
var __vue_script__ = script;
/* template */

var __vue_render__ = function __vue_render__() {
  var _vm = this;

  var _h = _vm.$createElement;

  var _c = _vm._self._c || _h;

  return _c('img', {
    class: ['base-image', {
      'lazyload': _vm.lazyload
    }],
    attrs: {
      "alt": _vm.alt,
      "data-src": _vm.lazyload ? _vm.source : null,
      "data-srcset": _vm.lazyload ? _vm.sourceSet : null,
      "src": _vm.lazyload ? _vm.clearPng : _vm.source,
      "srcset": _vm.lazyload ? null : _vm.sourceSet
    },
    on: {
      "error": _vm.emitError
    }
  });
};

var __vue_staticRenderFns__ = [];
/* style */

var __vue_inject_styles__ = undefined;
/* scoped */

var __vue_scope_id__ = "data-v-8d7112ca";
/* module identifier */

var __vue_module_identifier__ = undefined;
/* functional template */

var __vue_is_functional_template__ = false;
/* style inject */

/* style inject SSR */

/* style inject shadow dom */

var __vue_component__ = /*#__PURE__*/normalizeComponent({
  render: __vue_render__,
  staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);

var BaseImage = __vue_component__;

export { BaseImage as default };
