(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory(require("vue"), require("@kq_npm/client_common_vue/_utils/util"), require("@kq_npm/client_common_vue/_utils/gis-utils"), require("@kq_npm/client_common_vue/init.js"));
	else if(typeof define === 'function' && define.amd)
		define(["vue", "@kq_npm/client_common_vue/_utils/util", "@kq_npm/client_common_vue/_utils/gis-utils", "@kq_npm/client_common_vue/init.js"], factory);
	else {
		var a = typeof exports === 'object' ? factory(require("vue"), require("@kq_npm/client_common_vue/_utils/util"), require("@kq_npm/client_common_vue/_utils/gis-utils"), require("@kq_npm/client_common_vue/init.js")) : factory(root["Vue"], root["@kq_npm/client_common_vue/_utils/util"], root["@kq_npm/client_common_vue/_utils/gis-utils"], root["@kq_npm/client_common_vue/init.js"]);
		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
	}
})(this, function(__WEBPACK_EXTERNAL_MODULE__1895__, __WEBPACK_EXTERNAL_MODULE__3458__, __WEBPACK_EXTERNAL_MODULE__7135__, __WEBPACK_EXTERNAL_MODULE__7997__) {
return /******/ (function() { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ({

/***/ 348:
/***/ (function(module) {

module.exports = require("@kq_npm/client_icons_vue");

/***/ }),

/***/ 2118:
/***/ (function(module) {

module.exports = require("core-js/modules/es.array.push.js");

/***/ }),

/***/ 8470:
/***/ (function(module) {

module.exports = require("core-js/modules/esnext.iterator.constructor.js");

/***/ }),

/***/ 8697:
/***/ (function(module) {

module.exports = require("core-js/modules/esnext.iterator.find.js");

/***/ }),

/***/ 1058:
/***/ (function(module) {

module.exports = require("core-js/modules/esnext.iterator.for-each.js");

/***/ }),

/***/ 7080:
/***/ (function(module) {

module.exports = require("vue-i18n/dist/vue-i18n.cjs.js");

/***/ }),

/***/ 6869:
/***/ (function(module) {

module.exports = require("xe-utils");

/***/ }),

/***/ 7135:
/***/ (function(module) {

module.exports = __WEBPACK_EXTERNAL_MODULE__7135__;

/***/ }),

/***/ 3458:
/***/ (function(module) {

module.exports = __WEBPACK_EXTERNAL_MODULE__3458__;

/***/ }),

/***/ 7997:
/***/ (function(module) {

module.exports = __WEBPACK_EXTERNAL_MODULE__7997__;

/***/ }),

/***/ 1895:
/***/ (function(module) {

module.exports = __WEBPACK_EXTERNAL_MODULE__1895__;

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	!function() {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = function(module) {
/******/ 			var getter = module && module.__esModule ?
/******/ 				function() { return module['default']; } :
/******/ 				function() { return module; };
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	!function() {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = function(exports, definition) {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	!function() {
/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	!function() {
/******/ 		// 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 });
/******/ 		};
/******/ 	}();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
!function() {
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "RollerViewModel": function() { return /* reexport */ RollerViewModel; },
  "default": function() { return /* reexport */ Roller; }
});

// EXTERNAL MODULE: external "core-js/modules/esnext.iterator.constructor.js"
var esnext_iterator_constructor_js_ = __webpack_require__(8470);
// EXTERNAL MODULE: external "core-js/modules/esnext.iterator.find.js"
var esnext_iterator_find_js_ = __webpack_require__(8697);
// EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(1895);
// EXTERNAL MODULE: external "xe-utils"
var external_xe_utils_ = __webpack_require__(6869);
var external_xe_utils_default = /*#__PURE__*/__webpack_require__.n(external_xe_utils_);
// EXTERNAL MODULE: external "@kq_npm/client_icons_vue"
var client_icons_vue_ = __webpack_require__(348);
// EXTERNAL MODULE: external "@kq_npm/client_common_vue/_utils/util"
var util_ = __webpack_require__(3458);
// EXTERNAL MODULE: external "core-js/modules/es.array.push.js"
var es_array_push_js_ = __webpack_require__(2118);
// EXTERNAL MODULE: external "core-js/modules/esnext.iterator.for-each.js"
var esnext_iterator_for_each_js_ = __webpack_require__(1058);
// EXTERNAL MODULE: external "@kq_npm/client_common_vue/_utils/gis-utils"
var gis_utils_ = __webpack_require__(7135);
;// CONCATENATED MODULE: ./src/leaflet/roller/RollerViewModel.js



/*
 * Copyright (C) 2019 KQ GEO Technologies Co., Ltd.
 * All rights reserved.
 */
/**
 * Author: 朱鹏超
 * Date: 2022-11-23
 * Description: 卷帘逻辑层
 */



/**
 * @class RollerViewModel
 * @classdesc 卷帘
 * @param {string} mapTarget - 绑定的当前mapview
 */
class RollerViewModel extends L.Evented {
  constructor(mapTarget) {
    super();
    this._props = {
      mapTarget
    };
    this._webMap = null;
    // 事件绑定this
    this._loadedAsync = this._loadedAsync.bind(this);
    this._loadedSync = this._loadedSync.bind(this);
    this._updateLayerData = this._updateLayerData.bind(this);
    this.setLayerData = this.setLayerData.bind(this);
  }

  /**
   * @description 逻辑初始化
   */
  init() {
    let maplayers = gis_utils_.mapLayerUtils.getLayerDataKey(this._props.mapTarget);
    if (!maplayers) {
      // mapview初始化结束监听 如果view已经存在了，mounted事件不会添加监听，异步
      gis_utils_.mapViewUtils.bindViewOnceEvents("mounted", this._loadedAsync, this._props.mapTarget);
    } else {
      // 同步
      gis_utils_.utils.getWebMap(this._props.mapTarget, this._loadedSync);
    }
    this._registerEvents();
  }

  /**
   * @description 注册事件
   * @private
   */
  _registerEvents() {
    // 监听地图初始化完成事件
    gis_utils_.mapViewUtils.bindViewEvents("resetLayerDatas", this._updateLayerData, this._props.mapTarget);
  }

  /**
   * @description 异步加载
   * @private
   */
  _loadedAsync(e) {
    // 如果图层变化事件是自己触发的 则不继续执行 避免死循环
    if (e.eventTarget && e.eventTarget === this) {
      return;
    }
    this._webMap = e.target;
    this.setLayerData();
  }

  /**
   * @description 同步加载
   * @private
   */
  _loadedSync(e) {
    this._webMap = e;
    this.setLayerData();
  }

  /**
   * @description 返回卷帘下拉选择框所需图层树
   * @fires event:setData
   */
  setLayerData() {
    const maplayers = gis_utils_.mapLayerUtils.getLayerCheckedList(this._props.mapTarget);
    if (maplayers && maplayers.length > 0) {
      const newLayer = this._filterData(maplayers);
      this.fire("setData", {
        maplayers: newLayer
      });
    }
  }

  /**
   * @description 更新图层树
   * @fires event:updateData
   * @private
   */
  _updateLayerData() {
    const maplayers = gis_utils_.mapLayerUtils.getLayerCheckedList(this._props.mapTarget);
    const newLayer = this._filterData(maplayers);
    this.fire("updateData", {
      maplayers: newLayer
    });
  }

  /**
   * 过滤数据 geojson不支持卷帘
   * @param data
   * @returns {*[]}
   * @private
   */
  _filterData(data) {
    let newData = [];
    data.forEach(l => {
      if (l.renderType !== "geojson") {
        newData.push(l);
      }
    });
    return newData;
  }

  /**
   * @description 初始化，生成卷帘
   * @param {Object} layer - 选中需要卷帘的图层，不传时会清除卷帘
   */
  initRoller(layer) {
    this._webMap.mapControl.initRoller(layer);
  }

  /**
   * @description 销毁
   */
  destroy() {
    this.off();
  }
}
// EXTERNAL MODULE: external "vue-i18n/dist/vue-i18n.cjs.js"
var vue_i18n_cjs_js_ = __webpack_require__(7080);
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/dist/index.js??ruleSet[0]!./src/leaflet/roller/Roller.vue?vue&type=script&setup=true&lang=js









const __default__ = {
  name: "Kq2dRoller"
};
/* harmony default export */ var Rollervue_type_script_setup_true_lang_js = (/*#__PURE__*/Object.assign(__default__, {
  props: {
    // 每个地图相关组件的必须参数 非必传 指定组件绑定的map对象的div的id
    mapTarget: String,
    // 是否显示阴影
    showShadow: {
      type: Boolean,
      default: false
    },
    /**
     * 例："center","topLeft","topRight","bottomLeft","bottomRight", "topCenter", "bottomCenter" {top:'16px',left:'16px'}, {top:16,left:16}
     */
    position: [String, Object],
    // 是否生成HeaderTemp
    showHeaderTemp: {
      type: Boolean,
      default: false
    },
    // 是否折叠HeaderTemp，showHeaderTemp为true时生效
    isCollapseHeaderTemp: {
      type: Boolean,
      default: false
    },
    // HeaderTemp标题
    headerTempTitle: {
      type: String
      // default: "卷帘"
    },
    // HeaderTempIcon
    headerTempIcon: {
      type: [Object, String],
      default: client_icons_vue_.IconRoller
    },
    // HeaderTemp Title&Icon的位置
    isRight: {
      type: Boolean,
      default: true
    }
  },
  setup(__props, {
    expose: __expose
  }) {
    const props = __props;
    const {
      proxy
    } = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.getCurrentInstance)();

    // 卷帘下拉框图层数据源
    let layers = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.reactive)({
      data: []
    });
    // 默认值
    let defaultSelected = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)("");
    // 逻辑类
    let viewModel = null;
    // 组件容器Ref
    let boxRef = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(null);
    // 选择的图层
    let selectedLayer = null;
    // 生成组件默认header
    let headerTemp = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)();
    let headerTempRef = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)();
    // 国际化
    let {
      locale,
      messages
    } = (0,vue_i18n_cjs_js_.useI18n)();
    let language = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(proxy.$i18n.global.messages[proxy.$i18n.global.locale]["leaflet"]);
    let rollerTitle = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(null);
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.watch)(() => locale.value, (newVal, oldVal) => {
      language.value = messages.value[newVal]["leaflet"];
      rollerTitle.value = language.value.rollerTitle;
    });
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.onMounted)(() => {
      // 组件位置定位
      (0,util_.updatePosition)(boxRef.value, props);
      (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.watch)(() => props.position, (newVal, oldVal) => {
        (0,util_.updatePosition)(boxRef.value, props);
      });
      watchCreateHeaderTemp();
      (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.watch)(() => props.showHeaderTemp, (newVal, oldVal) => {
        (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.nextTick)(() => {
          watchCreateHeaderTemp();
        });
      });
      viewModel = new RollerViewModel(props.mapTarget);
      // 获取图层树数据
      viewModel.on("setData", _data => {
        setLayer(_data.maplayers);
      });
      // 逻辑初始化
      viewModel.init();
      // 更新图层数据
      viewModel.on("updateData", _data => {
        layers.data = _data.maplayers;
        if (selectedLayer) {
          let result = external_xe_utils_default().find(layers.data, item => item.guid === selectedLayer.guid);
          if (!result) {
            resetRoller();
          }
        }
      });
    });
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.onBeforeUnmount)(() => {
      clear();
      viewModel = null;
    });

    /**
     * @description 监听header生成
     */
    const watchCreateHeaderTemp = () => {
      if (props.showHeaderTemp) {
        // 生成headerTemp
        headerTemp.value = (0,util_.createHeaderTemp)(boxRef.value, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.toRefs)(props), headerTempRef, rollerTitle);
      }
    };

    /**
     * @description 下拉选择框事件
     * @param {string} guid - 返回的图层guid
     */
    const onChangeSelect = guid => {
      selectedLayer = external_xe_utils_default().find(layers.data, item => item.guid === guid);
      viewModel.initRoller(selectedLayer);
    };

    /**
     * @description 设置选中的卷帘图层
     */
    const setLayer = maplayers => {
      layers.data = maplayers;
      if (maplayers.length === 0) {
        defaultSelected.value = "";
        return;
      }
    };

    /**
     * @description 开始卷帘操作
     */
    const start = layer => {
      if (!layer) {
        if (!selectedLayer) {
          layer = layers.data[0];
        } else {
          layer = selectedLayer;
        }
      }
      if (layer) {
        defaultSelected.value = layer.guid;
        selectedLayer = layer;
        viewModel.initRoller(selectedLayer);
      }
    };

    /**
     * @description 清除卷帘
     */
    const clear = () => {
      resetRoller();
      viewModel.destroy();
    };

    /**
     * @description 重置卷帘
     */
    const resetRoller = () => {
      viewModel.initRoller();
      selectedLayer = null;
      defaultSelected.value = null;
    };
    __expose({
      start,
      clear
    });
    return (_ctx, _cache) => {
      const _component_kq_option = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveComponent)("kq-option");
      const _component_kq_select = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveComponent)("kq-select");
      const _component_kq_form_item = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveComponent)("kq-form-item");
      const _component_kq_form = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveComponent)("kq-form");
      return (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.openBlock)(), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementBlock)("section", {
        class: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.normalizeClass)(["kq-2d-roller", [{
          'kq-box-shadow': __props.showShadow
        }]]),
        ref_key: "boxRef",
        ref: boxRef
      }, [__props.showHeaderTemp ? ((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.openBlock)(), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createBlock)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveDynamicComponent)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(headerTemp)), {
        key: 0,
        ref_key: "headerTempRef",
        ref: headerTempRef
      }, null, 512 /* NEED_PATCH */)) : (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createCommentVNode)("v-if", true), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_form, {
        "label-width": "86px",
        "label-position": "left"
      }, {
        default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_form_item, {
          label: _ctx.$t('leaflet.selectLayerLabel')
        }, {
          default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_select, {
            modelValue: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(defaultSelected),
            "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.isRef)(defaultSelected) ? defaultSelected.value = $event : defaultSelected = $event),
            onChange: onChangeSelect,
            placeholder: _ctx.$t('leaflet.selectLayer'),
            clearable: "",
            onClear: resetRoller
          }, {
            default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.openBlock)(true), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementBlock)(external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.Fragment, null, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.renderList)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(layers).data, item => {
              return (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.openBlock)(), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createBlock)(_component_kq_option, {
                label: item.name,
                value: item.guid,
                key: item.guid
              }, null, 8 /* PROPS */, ["label", "value"]);
            }), 128 /* KEYED_FRAGMENT */))]),
            _: 1 /* STABLE */
          }, 8 /* PROPS */, ["modelValue", "placeholder"])]),
          _: 1 /* STABLE */
        }, 8 /* PROPS */, ["label"])]),
        _: 1 /* STABLE */
      })], 2 /* CLASS */);
    };
  }
}));
;// CONCATENATED MODULE: ./src/leaflet/roller/Roller.vue?vue&type=script&setup=true&lang=js
 
;// CONCATENATED MODULE: ./src/leaflet/roller/Roller.vue



const __exports__ = Rollervue_type_script_setup_true_lang_js;

/* harmony default export */ var Roller = (__exports__);
// EXTERNAL MODULE: external "@kq_npm/client_common_vue/init.js"
var init_js_ = __webpack_require__(7997);
var init_js_default = /*#__PURE__*/__webpack_require__.n(init_js_);
;// CONCATENATED MODULE: ./src/leaflet/roller/index.js
/*
 * Copyright (C) 2019 KQ GEO Technologies Co., Ltd.
 * All rights reserved.
 */



Roller.install = (Vue, opts) => {
  init_js_default()(Vue, opts);
  Vue.component(Roller.name, Roller);
};

}();
/******/ 	return __webpack_exports__;
/******/ })()
;
});