exports.ids = [31];
exports.modules = {

/***/ 100:
/***/ (function(module, exports, __webpack_require__) {

// style-loader: Adds some css to the DOM by adding a <style> tag

// load the styles
var content = __webpack_require__(107);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add CSS to SSR context
var add = __webpack_require__(6).default
module.exports.__inject__ = function (context) {
  add("52122ee5", content, true, context)
};

/***/ }),

/***/ 106:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_cache_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_vue_style_loader_index_js_ref_3_oneOf_1_1_node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_2_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_3_oneOf_1_3_node_modules_vue_loader_lib_index_js_vue_loader_options_MediaInput_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(100);
/* harmony import */ var _node_modules_cache_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_vue_style_loader_index_js_ref_3_oneOf_1_1_node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_2_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_3_oneOf_1_3_node_modules_vue_loader_lib_index_js_vue_loader_options_MediaInput_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_cache_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_vue_style_loader_index_js_ref_3_oneOf_1_1_node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_2_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_3_oneOf_1_3_node_modules_vue_loader_lib_index_js_vue_loader_options_MediaInput_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_cache_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_vue_style_loader_index_js_ref_3_oneOf_1_1_node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_2_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_3_oneOf_1_3_node_modules_vue_loader_lib_index_js_vue_loader_options_MediaInput_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_cache_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_vue_style_loader_index_js_ref_3_oneOf_1_1_node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_2_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_3_oneOf_1_3_node_modules_vue_loader_lib_index_js_vue_loader_options_MediaInput_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));


/***/ }),

/***/ 107:
/***/ (function(module, exports, __webpack_require__) {

// Imports
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(5);
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(false);
// Module
___CSS_LOADER_EXPORT___.push([module.i, ".cursorPointer{cursor:crosshair}.img{width:100%;-o-object-fit:cover;object-fit:cover;-o-object-position:top;object-position:top;aspect-ratio:1.7778}#focalPointSelector{position:relative;cursor:move;overflow:hidden;display:flex;height:100%;justify-self:center;align-items:center}#focalPointSelector img{width:100%}.focalPoint{position:absolute;width:50px;height:50px;top:100px;left:100px;transform:translate(-25px,-25px);border-radius:50%;border:1px solid rgba(255,109,64,.55686);box-shadow:0 0 0 9999em rgba(0,0,0,.65)}", ""]);
// Exports
module.exports = ___CSS_LOADER_EXPORT___;


/***/ }),

/***/ 123:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/pug-plain-loader??ref--1-oneOf-0-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/add/MediaInput.vue?vue&type=template&id=c3476064&lang=pug&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',[_c('v-dialog',{attrs:{"fullscreen":_vm.$vuetify.breakpoint.xsOnly,"width":"1000px"},model:{value:(_vm.openMediaDetails),callback:function ($$v) {_vm.openMediaDetails=$$v},expression:"openMediaDetails"}},[_c('v-card',[_c('v-card-title',[_vm._v(_vm._s(_vm.$t('common.media')))]),_c('v-card-text',[_c('v-row',{staticClass:"mt-1"},[_c('v-col',{attrs:{"id":"focalPointSelector"},on:{"mousedown":_vm.handleStart,"touchstart":_vm.handleStart,"mousemove":_vm.handleMove,"touchmove":_vm.handleMove,"mouseup":_vm.handleStop,"touchend":_vm.handleStop}},[_c('div',{staticClass:"focalPoint",style:({ top: _vm.top, left: _vm.left })}),(_vm.mediaPreview)?_c('img',{attrs:{"src":_vm.mediaPreview}}):_vm._e()]),_c('v-col',{staticClass:"col-12 col-sm-4"},[_c('p',[_vm._v(_vm._s(_vm.$t('event.choose_focal_point')))]),(_vm.mediaPreview)?_c('img',{staticClass:"img d-none d-sm-block",style:({ 'object-position': _vm.position }),attrs:{"src":_vm.mediaPreview}}):_vm._e(),_c('v-textarea',{staticClass:"mt-4",attrs:{"type":"text","label":"Alternative text","persistent-hint":"","value":_vm.value.name,"filled":"","hint":_vm.$t("event.alt_text_description")},on:{"input":function (v) { return _vm.name=v; }}}),_c('br'),_c('v-card-actions',{staticClass:"justify-space-between"},[_c('v-btn',{attrs:{"text":"","color":"warning"},on:{"click":function($event){_vm.openMediaDetails=false}}},[_vm._v("Cancel")]),_c('v-btn',{attrs:{"text":"","color":"primary"},on:{"click":_vm.save}},[_vm._v("Save")])],1)],1)],1)],1)],1)],1),_vm._ssrNode(((_vm.mediaPreview)?("<h3 class=\"mb-3 font-weight-regular\">"+_vm._ssrEscape(_vm._s(_vm.$t('common.media')))+"</h3>"):"<!---->")),(_vm.mediaPreview)?_c('v-card-actions',[_c('v-spacer'),_c('v-btn',{attrs:{"text":"","color":"primary"},on:{"click":function($event){_vm.openMediaDetails = true}}},[_vm._v(_vm._s(_vm.$t('common.edit')))]),_c('v-btn',{attrs:{"text":"","color":"error"},on:{"click":_vm.remove}},[_vm._v(_vm._s(_vm.$t('common.remove')))])],1):_vm._e(),(_vm.mediaPreview)?_vm._ssrNode("<div>","</div>",[_vm._ssrNode("<img"+(_vm._ssrAttr("src",_vm.mediaPreview))+" class=\"img col-12 ml-3\""+(_vm._ssrStyle(null,{ 'object-position': _vm.savedPosition }, null))+"><span class=\"float-right\">"+_vm._ssrEscape(_vm._s(_vm.event.media[0].name))+"</span>")],2):_c('v-file-input',{attrs:{"label":_vm.$t('common.media'),"hint":_vm.$t('event.media_description'),"prepend-icon":"mdi-camera","value":_vm.value.image,"persistent-hint":"","accept":"image/*"},on:{"change":_vm.selectMedia}})],2)}
var staticRenderFns = []


// CONCATENATED MODULE: ./pages/add/MediaInput.vue?vue&type=template&id=c3476064&lang=pug&

// EXTERNAL MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--2-0!./node_modules/babel-loader/lib??ref--2-1!./node_modules/vue-loader/lib??vue-loader-options!./pages/add/MediaInput.vue?vue&type=script&lang=js&
var MediaInputvue_type_script_lang_js_ = __webpack_require__(95);

// CONCATENATED MODULE: ./pages/add/MediaInput.vue?vue&type=script&lang=js&
 /* harmony default export */ var add_MediaInputvue_type_script_lang_js_ = (MediaInputvue_type_script_lang_js_["a" /* default */]); 
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(1);

// CONCATENATED MODULE: ./pages/add/MediaInput.vue



function injectStyles (context) {
  
  var style0 = __webpack_require__(106)
if (style0.__inject__) style0.__inject__(context)

}

/* normalize component */

var component = Object(componentNormalizer["a" /* default */])(
  add_MediaInputvue_type_script_lang_js_,
  render,
  staticRenderFns,
  false,
  injectStyles,
  null,
  "81521190"
  
)

/* harmony default export */ var MediaInput = __webpack_exports__["default"] = (component.exports);

/***/ }),

/***/ 95:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(URL) {//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["a"] = ({
  name: 'MediaInput',
  props: {
    value: {
      type: Object,
      default: () => ({
        image: null
      })
    },
    event: {
      type: Object,
      default: () => {}
    }
  },

  data() {
    return {
      openMediaDetails: false,
      name: this.value.name || '',
      focalpoint: this.value.focalpoint || [0, 0],
      dragging: false
    };
  },

  computed: {
    mediaPreview() {
      if (!this.value.url && !this.value.image) {
        return false;
      }

      const url = this.value.image ? URL.createObjectURL(this.value.image) : /^https?:\/\//.test(this.value.url) ? this.value.url : `/media/thumb/${this.value.url}`;
      return url;
    },

    top() {
      return (this.focalpoint[1] + 1) * 50 + '%';
    },

    left() {
      return (this.focalpoint[0] + 1) * 50 + '%';
    },

    savedPosition() {
      const focalpoint = this.value.focalpoint || [0, 0];
      return `${(focalpoint[0] + 1) * 50}% ${(focalpoint[1] + 1) * 50}%`;
    },

    position() {
      const focalpoint = this.focalpoint || [0, 0];
      return `${(focalpoint[0] + 1) * 50}% ${(focalpoint[1] + 1) * 50}%`;
    }

  },
  methods: {
    save() {
      this.$emit('input', {
        url: this.value.url,
        image: this.value.image,
        name: this.name || this.value.image && this.value.image.name || '',
        focalpoint: [...this.focalpoint]
      });
      this.openMediaDetails = false;
    },

    async remove() {
      const ret = await this.$root.$confirm('event.remove_media_confirmation');

      if (!ret) {
        return;
      }

      this.$emit('remove');
    },

    selectMedia(v) {
      this.$emit('input', {
        image: v,
        name: v.name,
        focalpoint: [0, 0]
      });
    },

    handleStart(ev) {
      ev.preventDefault();
      this.dragging = true;
      this.handleMove(ev, true);
      return false;
    },

    handleStop(ev) {
      this.dragging = false;
    },

    handleMove(ev, manual = false) {
      if (!this.dragging && !manual) return;
      ev.stopPropagation();
      const boundingClientRect = document.getElementById('focalPointSelector').getBoundingClientRect();
      const clientX = ev.changedTouches ? ev.changedTouches[0].clientX : ev.clientX;
      const clientY = ev.changedTouches ? ev.changedTouches[0].clientY : ev.clientY; // get relative coordinate

      let x = Math.ceil(clientX - boundingClientRect.left);
      let y = Math.ceil(clientY - boundingClientRect.top); // snap to border

      x = x < 30 ? 0 : x > boundingClientRect.width - 30 ? boundingClientRect.width : x;
      y = y < 30 ? 0 : y > boundingClientRect.height - 30 ? boundingClientRect.height : y; // this.relativeFocalpoint = [x + 'px', y + 'px']
      // map to real image coordinate

      const posY = -1 + y / boundingClientRect.height * 2;
      const posX = -1 + x / boundingClientRect.width * 2;
      this.focalpoint = [posX, posY];
      return false;
    }

  }
});
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(62)["URL"]))

/***/ })

};;
//# sourceMappingURL=MediaInput.js.map