module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "lib/mapboxgl/";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 837);
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/interopRequireDefault");

/***/ }),

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

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
/* globals __VUE_SSR_CONTEXT__ */

// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.

function normalizeComponent(
  scriptExports,
  render,
  staticRenderFns,
  functionalTemplate,
  injectStyles,
  scopeId,
  moduleIdentifier /* server only */,
  shadowMode /* vue-cli only */
) {
  // Vue.extend constructor export interop
  var options =
    typeof scriptExports === 'function' ? scriptExports.options : scriptExports

  // render functions
  if (render) {
    options.render = render
    options.staticRenderFns = staticRenderFns
    options._compiled = true
  }

  // functional template
  if (functionalTemplate) {
    options.functional = true
  }

  // scopedId
  if (scopeId) {
    options._scopeId = 'data-v-' + scopeId
  }

  var hook
  if (moduleIdentifier) {
    // server build
    hook = function (context) {
      // 2.3 injection
      context =
        context || // cached call
        (this.$vnode && this.$vnode.ssrContext) || // stateful
        (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
      // 2.2 with runInNewContext: true
      if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
        context = __VUE_SSR_CONTEXT__
      }
      // inject component styles
      if (injectStyles) {
        injectStyles.call(this, context)
      }
      // register component module identifier for async chunk inferrence
      if (context && context._registeredComponents) {
        context._registeredComponents.add(moduleIdentifier)
      }
    }
    // used by ssr in case component is cached and beforeCreate
    // never gets called
    options._ssrRegister = hook
  } else if (injectStyles) {
    hook = shadowMode
      ? function () {
          injectStyles.call(
            this,
            (options.functional ? this.parent : this).$root.$options.shadowRoot
          )
        }
      : injectStyles
  }

  if (hook) {
    if (options.functional) {
      // for template-only hot-reload because in that case the render fn doesn't
      // go through the normalizer
      options._injectStyles = hook
      // register for functional component in vue file
      var originalRender = options.render
      options.render = function renderWithStyleInjection(h, context) {
        hook.call(context)
        return originalRender(h, context)
      }
    } else {
      // inject component registration as beforeCreate hook
      var existing = options.beforeCreate
      options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
    }
  }

  return {
    exports: scriptExports,
    options: options
  }
}


/***/ }),

/***/ 14:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/createClass");

/***/ }),

/***/ 19:
/***/ (function(module, exports) {

module.exports = require("lodash.clonedeep");

/***/ }),

/***/ 2:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/init.js");

/***/ }),

/***/ 21:
/***/ (function(module, exports) {

module.exports = require("lodash.uniqueid");

/***/ }),

/***/ 24:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/assertThisInitialized");

/***/ }),

/***/ 3:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/inheritsLoose");

/***/ }),

/***/ 35:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/spin");

/***/ }),

/***/ 36:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/regenerator");

/***/ }),

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

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

/***/ }),

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

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _createClass2 = _interopRequireDefault(__webpack_require__(14));
var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(3));
var _vuePropertyDecorator = __webpack_require__(9);
var _videoPlusEvent = _interopRequireDefault(__webpack_require__(417));
var _VideoPlusViewModel = _interopRequireWildcard(__webpack_require__(839));
var _Spin = _interopRequireDefault(__webpack_require__(35));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
  var c = arguments.length,
    r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
    d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var SmVideoPlus = /*#__PURE__*/function (_Vue) {
  (0, _inheritsLoose2.default)(SmVideoPlus, _Vue);
  function SmVideoPlus() {
    var _this;
    _this = _Vue.apply(this, arguments) || this;
    _this.viewModel = null;
    _this.spinning = true;
    _this.innerAutoplay = false;
    return _this;
  }
  var _proto = SmVideoPlus.prototype;
  _proto.playChanged = function playChanged(val) {
    if (val) {
      this.viewModel.play();
    } else {
      this.viewModel.pause();
      this.innerAutoplay = false;
    }
  };
  _proto.srcChanged = function srcChanged() {
    if (this.viewModel) {
      this.viewModel.removed();
    }
    this.createVideoPlus();
  };
  _proto.videoWidthChanged = function videoWidthChanged(newVal, oldVal) {
    if (newVal !== oldVal && this.viewModel) {
      this.viewModel.changeVideoSize(newVal, this.videoHeight);
    }
  };
  _proto.videoHeightChanged = function videoHeightChanged(newVal, oldVal) {
    if (newVal !== oldVal && this.viewModel) {
      this.viewModel.changeVideoSize(this.videoWidth, newVal);
    }
  };
  _proto.created = function created() {
    this.innerAutoplay = this.autoplay;
  };
  _proto.mounted = function mounted() {
    this.createVideoPlus();
  };
  _proto.createVideoPlus = function createVideoPlus() {
    var target = this.target,
      url = this.url,
      loop = this.loop,
      videoWidth = this.videoWidth,
      videoHeight = this.videoHeight;
    this.viewModel = new _VideoPlusViewModel.default({
      target: target,
      url: url,
      videoWidth: videoWidth,
      videoHeight: videoHeight,
      autoplay: this.innerAutoplay,
      loop: loop
    });
    this._bindEvents();
  };
  _proto.resize = function resize() {
    if (this.viewModel && this.viewModel.resize) {
      this.viewModel.resize();
    }
  };
  _proto._bindEvents = function _bindEvents() {
    var _this2 = this;
    Object.keys(this.$listeners).forEach(function (eventName) {
      if (_VideoPlusViewModel.EVENTS.includes(eventName)) {
        _this2.viewModel.on(eventName, _this2._bindMapEvent);
      }
    });
    this.viewModel.on('load', function (e) {
      _this2.spinning = false;
      _videoPlusEvent.default.$options.setVideo(_this2.target, e.videoPlus);
      _videoPlusEvent.default.$emit('load-video', e.videoPlus, _this2.target);
      _this2.load({
        videoPlus: e.videoPlus
      });
    });
  };
  _proto._bindMapEvent = function _bindMapEvent(e) {
    if (e.layerId) {
      return;
    }
    this.$emit(e.type, e.event);
  };
  _proto._clearEvents = function _clearEvents() {
    var _this3 = this;
    _VideoPlusViewModel.EVENTS.forEach(function (eventName) {
      _this3.viewModel.off(eventName, _this3._bindMapEvent);
    });
  };
  _proto.beforeDestroy = function beforeDestroy() {
    this._clearEvents();
  };
  _proto.destroyed = function destroyed() {
    this.viewModel.removed();
    _videoPlusEvent.default.$options.deleteVideo(this.target);
  };
  _proto.load = function load(value) {
    return value;
  };
  (0, _createClass2.default)(SmVideoPlus, [{
    key: "style",
    get: function get() {
      return {
        width: '100%',
        height: '100%'
      };
    }
  }, {
    key: "loaded",
    get: function get() {
      return this.spinning && this.url;
    }
  }]);
  return SmVideoPlus;
}(_vuePropertyDecorator.Vue);
__decorate([(0, _vuePropertyDecorator.Prop)({
  default: 'video'
})], SmVideoPlus.prototype, "target", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], SmVideoPlus.prototype, "url", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], SmVideoPlus.prototype, "videoWidth", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], SmVideoPlus.prototype, "videoHeight", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)({
  default: false
})], SmVideoPlus.prototype, "loop", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)({
  default: false
})], SmVideoPlus.prototype, "play", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)({
  default: false
})], SmVideoPlus.prototype, "autoplay", void 0);
__decorate([(0, _vuePropertyDecorator.Watch)('play')], SmVideoPlus.prototype, "playChanged", null);
__decorate([(0, _vuePropertyDecorator.Watch)('url')], SmVideoPlus.prototype, "srcChanged", null);
__decorate([(0, _vuePropertyDecorator.Watch)('videoWidth')], SmVideoPlus.prototype, "videoWidthChanged", null);
__decorate([(0, _vuePropertyDecorator.Watch)('videoHeight')], SmVideoPlus.prototype, "videoHeightChanged", null);
__decorate([(0, _vuePropertyDecorator.Emit)()], SmVideoPlus.prototype, "load", null);
SmVideoPlus = __decorate([(0, _vuePropertyDecorator.Component)({
  name: 'SmVideoPlus',
  components: {
    SmSpin: _Spin.default
  }
})], SmVideoPlus);
var _default = exports.default = SmVideoPlus;

/***/ }),

/***/ 387:
/***/ (function(module, exports) {

module.exports = require("video.js");

/***/ }),

/***/ 388:
/***/ (function(module, exports) {

module.exports = require("flv.js");

/***/ }),

/***/ 389:
/***/ (function(module, exports) {

module.exports = require("videojs-flvjs-es6");

/***/ }),

/***/ 417:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_types/video-plus-event.js");

/***/ }),

/***/ 418:
/***/ (function(module, exports) {

module.exports = require("@turf/meta");

/***/ }),

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

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ render; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ staticRenderFns; });

// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./src/mapboxgl/video-plus/VideoPlus.vue?vue&type=template&id=305a4612&
var render = function () {
  var _vm = this
  var _h = _vm.$createElement
  var _c = _vm._self._c || _h
  return _c(
    "div",
    {
      staticClass: "sm-component-video-plus",
      style: _vm.style,
      attrs: { id: _vm.target },
    },
    [
      _vm._t("default"),
      _vm.loaded
        ? _c("sm-spin", {
            attrs: {
              size: "large",
              tip: _vm.$t("videoPlus.loadingTip"),
              spinning: _vm.spinning,
            },
          })
        : _vm._e(),
    ],
    2
  )
}
var staticRenderFns = []
render._withStripped = true


// CONCATENATED MODULE: ./src/mapboxgl/video-plus/VideoPlus.vue?vue&type=template&id=305a4612&


/***/ }),

/***/ 5:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/static/libs/mapboxgl/mapbox-gl-enhance.js");

/***/ }),

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

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _VideoPlus = _interopRequireDefault(__webpack_require__(838));
var _init = _interopRequireDefault(__webpack_require__(2));
_VideoPlus.default.install = function (Vue, opts) {
  (0, _init.default)(Vue, opts);
  Vue.component(_VideoPlus.default.options ? _VideoPlus.default.options.name : _VideoPlus.default.name, _VideoPlus.default);
};
var _default = exports.default = _VideoPlus.default;

/***/ }),

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

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _VideoPlus_vue_vue_type_template_id_305a4612___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(468);
/* harmony import */ var _VideoPlus_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(366);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _VideoPlus_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_1__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _VideoPlus_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_1__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);





/* normalize component */

var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(
  _VideoPlus_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_1__["default"],
  _VideoPlus_vue_vue_type_template_id_305a4612___WEBPACK_IMPORTED_MODULE_0__[/* render */ "a"],
  _VideoPlus_vue_vue_type_template_id_305a4612___WEBPACK_IMPORTED_MODULE_0__[/* staticRenderFns */ "b"],
  false,
  null,
  null,
  null
  
)

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

/***/ }),

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

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.MAP_DRAW_EVENTS = exports.LAYER_EVENTS = exports.EVENTS = void 0;
var _regenerator = _interopRequireDefault(__webpack_require__(36));
var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(24));
var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(3));
var _mapboxGlEnhance = _interopRequireDefault(__webpack_require__(5));
var _lodash = _interopRequireDefault(__webpack_require__(21));
var _lodash2 = _interopRequireDefault(__webpack_require__(19));
var _video = _interopRequireDefault(__webpack_require__(387));
__webpack_require__(388);
__webpack_require__(389);
var _meta = __webpack_require__(418);
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
  function adopt(value) {
    return value instanceof P ? value : new P(function (resolve) {
      resolve(value);
    });
  }
  return new (P || (P = Promise))(function (resolve, reject) {
    function fulfilled(value) {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    }
    function rejected(value) {
      try {
        step(generator["throw"](value));
      } catch (e) {
        reject(e);
      }
    }
    function step(result) {
      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
    }
    step((generator = generator.apply(thisArg, _arguments || [])).next());
  });
};
var MAP_DRAW_EVENTS = exports.MAP_DRAW_EVENTS = ['draw.create', 'draw.delete'];
var LAYER_EVENTS = exports.LAYER_EVENTS = ['mousedown', 'mouseup', 'click', 'dblclick', 'mousemove', 'mouseenter', 'mouseleave', 'mouseover', 'mouseout', 'contextmenu'];
var EVENTS = exports.EVENTS = ['resize', 'remove', 'movestart', 'contextmenu', 'dblclick', 'click', 'touchcancel', 'touchmove', 'touchend', 'touchstart', 'dataloading', 'mousemove', 'mouseup', 'mousedown', 'sourcedataloading', 'error', 'data', 'styledata', 'sourcedata', 'mouseout', 'styledataloading', 'moveend', 'move', 'render', 'zoom', 'zoomstart', 'zoomend', 'boxzoomstart', 'boxzoomcancel', 'boxzoomend', 'rotate', 'rotatestart', 'rotateend', 'dragend', 'drag', 'dragstart', 'pitch', 'idle'];
var VideoPlusViewModel = exports.default = /*#__PURE__*/function (_mapboxgl$Evented) {
  (0, _inheritsLoose2.default)(VideoPlusViewModel, _mapboxgl$Evented);
  function VideoPlusViewModel(options) {
    var _this;
    _this = _mapboxgl$Evented.call(this) || this;
    _this._bindMapEventFn = _this._bindMapEvent.bind((0, _assertThisInitialized2.default)(_this));
    _this._bindDrawEventFn = _this._bindDrawEvent.bind((0, _assertThisInitialized2.default)(_this));
    _this._layerEventMap = {};
    _this.init(options);
    return _this;
  }
  var _proto = VideoPlusViewModel.prototype;
  _proto.init = function init(options) {
    return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator.default.mark(function _callee() {
      var target, url, autoplay, loop, videoWidth, videoHeight;
      return _regenerator.default.wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            target = options.target, url = options.url, autoplay = options.autoplay, loop = options.loop, videoWidth = options.videoWidth, videoHeight = options.videoHeight;
            this.id = (0, _lodash.default)('videoLayer_');
            this.autoplay = autoplay;
            this.loop = loop;
            this.target = target;
            _context.next = 7;
            return this._createMap();
          case 7:
            this.map = _context.sent;
            this.url = url;
            this.add(videoWidth, videoHeight);
            this._bindEvents();
          case 11:
          case "end":
            return _context.stop();
        }
      }, _callee, this);
    }));
  };
  _proto.add = function add(videoWidth, videoHeight) {
    var _this2 = this;
    this.video = this._createVideo();
    this.videoWidth = videoWidth || this.map.getCanvas().width;
    this.videoHeight = videoHeight || this.map.getCanvas().height;
    this.videoDomId = this._getVideoDom();
    this.video.one('firstplay', function () {
      if (_this2.autoplay) {
        _this2.play();
      }
    });
    this.video.one('ready', function () {
      _this2._addVideoLayer(_this2.map);
    });
    this.video.one('canplay', function () {
      setTimeout(function () {
        if (_this2.autoplay) {
          _this2.play();
        } else {
          _this2.pause();
        }
      }, 100);
    });
  };
  _proto.addControl = function addControl(control, position) {
    var _this3 = this;
    this.map.addControl(control, position);
    MAP_DRAW_EVENTS.forEach(function (eventName) {
      _this3.map.on(eventName, _this3._bindDrawEventFn);
    });
  };
  _proto._bindDrawEvent = function _bindDrawEvent(e) {
    var _this4 = this;
    if (e) {
      (0, _meta.coordEach)(e.features[0], function (coord) {
        var pixelPoint = _this4.transformLatLngToPoint(coord);
        coord[0] = pixelPoint[0];
        coord[1] = pixelPoint[1];
      });
    }
    this.fire(e.type, {
      e: e
    });
  };
  _proto.removeControl = function removeControl(control) {
    var _this5 = this;
    this.map.removeControl(control);
    MAP_DRAW_EVENTS.forEach(function (eventName) {
      _this5.map.off(eventName, _this5.__bindDrawEventFn);
    });
  };
  _proto.addToMap = function addToMap(control) {
    control.addTo(this.map);
  };
  _proto.setCoordinate = function setCoordinate(control, coordinate) {
    if (this.originCoordsRightBottom || this.originCoordsLeftTop) {
      coordinate = this.transformPointToLatLng(coordinate);
      return control.setLngLat(coordinate);
    }
  };
  _proto.setPaintProperty = function setPaintProperty(layerId, name, value) {
    this.map.setPaintProperty(layerId, name, value);
    return this;
  };
  _proto.setLayoutProperty = function setLayoutProperty(layerId, name, value) {
    this.map.setLayoutProperty(layerId, name, value);
    return this;
  };
  _proto.addLayer = function addLayer(layer) {
    var _this6 = this;
    var source = layer.source,
      id = layer.id;
    var newData = this.eachData((0, _lodash2.default)(source.data));
    layer.source.data = newData;
    this.map.addLayer(layer);
    this._layerEventMap[id] = this._bindLayerEvent.bind(this, id);
    LAYER_EVENTS.forEach(function (eventName) {
      _this6.map.on(eventName, id, _this6._layerEventMap[id]);
    });
    return this;
  };
  _proto._bindLayerEvent = function _bindLayerEvent(id, e) {
    if (e.lngLat) {
      if (this.originCoordsRightBottom && this.originCoordsLeftTop && this.videoWidth && this.videoHeight) {
        var coord = [e.lngLat.lng, e.lngLat.lat];
        var pixelPoint = this.transformLatLngToPoint(coord);
        e.pixelPoint = [pixelPoint[0], pixelPoint[1]];
      }
    }
    this.fire(e.type, {
      event: e,
      layerId: id
    });
  };
  _proto.eachData = function eachData(features) {
    var _this7 = this;
    if (!this.originCoordsRightBottom && !this.originCoordsLeftTop) {
      return [];
    }
    (0, _meta.featureEach)(features, function (currentFeature) {
      (0, _meta.coordEach)(currentFeature, function (curCoords) {
        var transCoords = (0, _lodash2.default)(curCoords);
        curCoords.length = 0;
        if (transCoords.length) {
          curCoords.push.apply(curCoords, _this7.transformPointToLatLng(transCoords));
        }
      });
    });
    return features;
  };
  _proto.setData = function setData(id, data) {
    var newData = this.eachData((0, _lodash2.default)(data));
    this.map.getSource(id).setData(newData);
  };
  _proto.removeLayer = function removeLayer(id) {
    var _this8 = this;
    if (this.map) {
      this.map.removeLayer(id);
      LAYER_EVENTS.forEach(function (eventName) {
        _this8.map.off(eventName, id, _this8._layerEventMap[id]);
      });
    }
    delete this._layerEventMap[id];
    return this;
  };
  _proto.getLayer = function getLayer(layerId) {
    this.map.getLayer(layerId);
    return this;
  };
  _proto.transformPointToLatLng = function transformPointToLatLng(pixelPoint) {
    var perWidth = Math.abs(this.originCoordsRightBottom.lng - this.originCoordsLeftTop.lng) / this.videoWidth;
    var perHeight = Math.abs(this.originCoordsRightBottom.lat - this.originCoordsLeftTop.lat) / this.videoHeight;
    return [pixelPoint[0] * perWidth + this.originCoordsLeftTop.lng, this.originCoordsLeftTop.lat - pixelPoint[1] * perHeight];
  };
  _proto.transformLatLngToPoint = function transformLatLngToPoint(coord) {
    var perWidth = Math.abs(this.originCoordsRightBottom.lng - this.originCoordsLeftTop.lng) / this.videoWidth;
    var perHeight = Math.abs(this.originCoordsRightBottom.lat - this.originCoordsLeftTop.lat) / this.videoHeight;
    return [(coord[0] - this.originCoordsLeftTop.lng) / perWidth, (this.originCoordsLeftTop.lat - coord[1]) / perHeight];
  };
  _proto.resize = function resize() {
    this._mapExisted() && this.map.resize();
  };
  _proto._createVideo = function _createVideo() {
    this._createVideoElement();
    var options = this._getVideoOptions();
    return (0, _video.default)(this.id, options, function () {});
  };
  _proto._getVideoOptions = function _getVideoOptions() {
    if (!this.url) {
      return;
    }
    var options = {
      autoplay: true,
      muted: true
    };
    options.loop = this.loop !== false;
    if (this.url.includes('mp4')) {
      options['sources'] = [{
        src: this.url,
        type: 'video/mp4'
      }];
    } else if (this.url.includes('flv')) {
      options = {
        autoplay: this.autoplay,
        techOrder: ['html5', 'flvjs'],
        flvjs: {
          mediaDataSource: {
            isLive: true,
            cors: true,
            withCredentials: false
          }
        },
        sources: [{
          src: this.url,
          type: 'video/x-flv'
        }]
      };
    } else if (this.url.includes('m3u8')) {
      options['sources'] = [{
        src: this.url
      }];
    }
    return options;
  };
  _proto._getVideoDom = function _getVideoDom() {
    if (!this.url) {
      return;
    }
    var videoDomId;
    if (this.url.includes('flv')) {
      var videoWrap = document.querySelector("#" + this.id);
      videoDomId = this.id + "_flvjs_api";
      videoWrap.style.position = 'fixed';
      videoWrap.style.left = '-200%';
    } else {
      videoDomId = this.video.el_.firstChild.id;
    }
    return videoDomId;
  };
  _proto._createVideoElement = function _createVideoElement() {
    var video = document.createElement('video');
    video.id = this.id;
    video.className = 'video-js';
    video.style.position = 'fixed';
    video.style.left = '-200%';
    video.setAttribute('crossorigin', 'anonymous');
    document.body.appendChild(video);
  };
  _proto._addVideoLayer = function _addVideoLayer(map) {
    var width = this.width,
      height = this.height,
      videoWidth = this.videoWidth,
      videoHeight = this.videoHeight;
    var videoBounds = this._calcCoords({
      width: width,
      height: height,
      videoWidth: videoWidth,
      videoHeight: videoHeight
    });
    var videoBoundsFormat = videoBounds.map(function (obj) {
      return [obj.lng, obj.lat];
    });
    var url = this.videoDomId || this.url;
    map.addSource(this.id, {
      type: 'video',
      urls: [url],
      coordinates: videoBoundsFormat
    });
    if (map.getStyle().layers.length >= 1) {
      this.beforeLayerId = map.getStyle().layers[0].id;
    }
    map.addLayer({
      id: this.id,
      type: 'raster',
      source: this.id
    }, this.beforeLayerId);
    this._afterAddVideoLayer();
  };
  _proto._afterAddVideoLayer = function _afterAddVideoLayer() {
    this.fire('videolayeradded', {
      originCoordsRightBottom: this.originCoordsRightBottom,
      originCoordsLeftTop: this.originCoordsLeftTop
    });
    this.fire('load', {
      videoPlus: this,
      map: this.map
    });
  };
  _proto._calcCoords = function _calcCoords(_ref) {
    var _this9 = this;
    var width = _ref.width,
      height = _ref.height,
      videoWidth = _ref.videoWidth,
      videoHeight = _ref.videoHeight;
    var ratioX = videoWidth / width;
    var ratioY = videoHeight / height;
    var ratio = Math.min(ratioX, ratioY);
    var realWidth = videoWidth / ratio;
    var realHeight = videoHeight / ratio;
    var center = {
      x: width / 2,
      y: height / 2
    };
    var cx = realWidth / 2;
    var cy = realHeight / 2;
    var pos = [[center.x - cx, center.y - cy], [center.x + cx, center.y - cy], [center.x + cx, center.y + cy], [center.x - cx, center.y + cy]];
    var coords = pos.map(function (coord) {
      return _this9.map.unproject(coord);
    });
    this.originCoordsLeftTop = coords[0];
    this.originCoordsRightBottom = coords[2];
    return coords;
  };
  _proto.play = function play() {
    this.video && this.video.play();
  };
  _proto.pause = function pause() {
    this.video && this.video.pause();
  };
  _proto.changeVideoSize = function changeVideoSize(videoWidth, videoHeight) {
    var width = this.width,
      height = this.height;
    if (!width || !height || !this.map) {
      return;
    }
    var videoBounds = this._calcCoords({
      width: width,
      height: height,
      videoWidth: videoWidth,
      videoHeight: videoHeight
    });
    var videoBoundsFormat = videoBounds.map(function (obj) {
      return [obj.lng, obj.lat];
    });
    if (this.map.getSource(this.id)) {
      this.map.getSource(this.id).setCoordinates(videoBoundsFormat);
    }
  };
  _proto._createMap = function _createMap() {
    var _this10 = this;
    return new Promise(function (resolve) {
      var map = new _mapboxGlEnhance.default.Map({
        container: _this10.target,
        style: {
          version: 8,
          sources: {},
          layers: []
        },
        renderWorldCopies: false,
        center: [0, 0],
        zoom: 8
      });
      var container = map.getContainer();
      _this10.width = container.clientWidth || 400;
      _this10.height = container.clientHeight || 300;
      map.on('load', function () {
        resolve(map);
      });
    });
  };
  _proto.removed = function removed() {
    if (this.id && this.map) {
      this.map.getLayer(this.id) && this.map.removeLayer(this.id);
      this.map.getSource(this.id) && this.map.removeSource(this.id);
    }
    this._clearEvents();
    if (this._mapExisted()) {
      this.map.remove();
      this.map = null;
    }
    this.video = null;
    this._layerEventMap = null;
  };
  _proto._mapExisted = function _mapExisted() {
    return !!this.map;
  };
  _proto._bindEvents = function _bindEvents() {
    var _this11 = this;
    EVENTS.forEach(function (eventName) {
      _this11.map.on(eventName, _this11._bindMapEventFn);
    });
  };
  _proto._clearEvents = function _clearEvents() {
    var _this12 = this;
    EVENTS.forEach(function (eventName) {
      _this12.map.off(eventName, _this12._bindMapEventFn);
    });
  };
  _proto._bindMapEvent = function _bindMapEvent(e) {
    if (e.lngLat) {
      if (this.originCoordsRightBottom && this.originCoordsLeftTop && this.videoWidth && this.videoHeight) {
        var coord = [e.lngLat.lng, e.lngLat.lat];
        var pixelPoint = this.transformLatLngToPoint(coord);
        e.pixelPoint = [pixelPoint[0], pixelPoint[1]];
      }
    }
    this.fire(e.type, {
      event: e
    });
  };
  return VideoPlusViewModel;
}(_mapboxGlEnhance.default.Evented);

/***/ }),

/***/ 9:
/***/ (function(module, exports) {

module.exports = require("vue-property-decorator");

/***/ })

/******/ });