diandi-ele-form-tmap
Version:
vue-ele-form 的 百度地图组件
1,971 lines (1,697 loc) • 139 kB
JavaScript
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 = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "fb15");
/******/ })
/************************************************************************/
/******/ ({
/***/ "0637":
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "165e":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _base_mixins_common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("2da4");
/* harmony import */ var _base_bindEvent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("4fab");
/* harmony import */ var _base_factory_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("76f3");
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["a"] = ({
name: 'bm-marker',
mixins: [Object(_base_mixins_common_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])('overlay')],
props: {
position: {},
offset: {},
icon: {},
massClear: {
type: Boolean,
default: true
},
dragging: {
type: Boolean,
default: false
},
clicking: {
type: Boolean,
default: true
},
raiseOnDrag: {
type: Boolean,
default: false
},
draggingCursor: {
type: String
},
rotation: {
type: Number
},
shadow: {
type: Object
},
title: {
type: String
},
label: {
type: Object
},
animation: {
type: String
},
top: {
type: Boolean,
default: false
},
zIndex: {
type: Number,
default: 0
}
},
watch: {
'position.lng'(val, oldVal) {
const {
BMap,
originInstance,
position,
renderByParent,
$parent
} = this;
if (val !== oldVal && val >= -180 && val <= 180) {
originInstance.setPosition(Object(_base_factory_js__WEBPACK_IMPORTED_MODULE_2__[/* createPoint */ "d"])(BMap, {
lng: val,
lat: position.lat
}));
}
renderByParent && $parent.reload();
},
'position.lat'(val, oldVal) {
const {
BMap,
originInstance,
position,
renderByParent,
$parent
} = this;
if (val !== oldVal && val >= -74 && val <= 74) {
originInstance.setPosition(Object(_base_factory_js__WEBPACK_IMPORTED_MODULE_2__[/* createPoint */ "d"])(BMap, {
lng: position.lng,
lat: val
}));
}
renderByParent && $parent.reload();
},
'offset.width'(val, oldVal) {
const {
BMap,
originInstance
} = this;
if (val !== oldVal) {
originInstance.setOffset(new BMap.Size(val, this.offset.height));
}
},
'offset.height'(val, oldVal) {
const {
BMap,
originInstance
} = this;
if (val !== oldVal) {
originInstance.setOffset(new BMap.Size(this.offset.width, val));
}
},
icon: {
deep: true,
handler(val) {
const {
BMap,
originInstance,
rotation
} = this;
originInstance && originInstance.setIcon(Object(_base_factory_js__WEBPACK_IMPORTED_MODULE_2__[/* createIcon */ "b"])(BMap, val));
rotation && originInstance && originInstance.setRotation(rotation);
}
},
massClear(val) {
val ? this.originInstance.enableMassClear() : this.originInstance.disableMassClear();
},
dragging(val) {
val ? this.originInstance.enableDragging() : this.originInstance.disableDragging();
},
clicking() {
this.reload();
},
raiseOnDrag() {
this.reload();
},
draggingCursor(val) {
this.originInstance.setDraggingCursor(val);
},
rotation(val) {
this.originInstance.setRotation(val);
},
shadow(val) {
this.originInstance.setShadow(val);
},
title(val) {
this.originInstance.setTitle(val);
},
label(val) {
this.reload();
},
animation(val) {
this.originInstance.setAnimation(global[val]);
},
top(val) {
this.originInstance.setTop(val);
},
zIndex(val) {
this.originInstance.setZIndex(val);
}
},
methods: {
load() {
const {
BMap,
map,
position,
offset,
icon,
massClear,
dragging,
clicking,
raiseOnDrag,
draggingCursor,
rotation,
shadow,
title,
label,
animation,
top,
renderByParent,
$parent,
zIndex
} = this;
const overlay = new BMap.Marker(new BMap.Point(position.lng, position.lat), {
offset,
icon: icon && Object(_base_factory_js__WEBPACK_IMPORTED_MODULE_2__[/* createIcon */ "b"])(BMap, icon),
enableMassClear: massClear,
enableDragging: dragging,
enableClicking: clicking,
raiseOnDrag,
draggingCursor,
rotation,
shadow,
title
});
this.originInstance = overlay;
label && overlay && overlay.setLabel(Object(_base_factory_js__WEBPACK_IMPORTED_MODULE_2__[/* createLabel */ "c"])(BMap, label));
overlay.setTop(top);
overlay.setZIndex(zIndex);
_base_bindEvent_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].call(this, overlay);
if (renderByParent) {
$parent.reload();
} else {
map.addOverlay(overlay);
}
overlay.setAnimation(global[animation]);
}
}
});
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba")))
/***/ }),
/***/ "1fb5":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.byteLength = byteLength
exports.toByteArray = toByteArray
exports.fromByteArray = fromByteArray
var lookup = []
var revLookup = []
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
for (var i = 0, len = code.length; i < len; ++i) {
lookup[i] = code[i]
revLookup[code.charCodeAt(i)] = i
}
// Support decoding URL-safe base64 strings, as Node.js does.
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
revLookup['-'.charCodeAt(0)] = 62
revLookup['_'.charCodeAt(0)] = 63
function getLens (b64) {
var len = b64.length
if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4')
}
// Trim off extra bytes after placeholder bytes are found
// See: https://github.com/beatgammit/base64-js/issues/42
var validLen = b64.indexOf('=')
if (validLen === -1) validLen = len
var placeHoldersLen = validLen === len
? 0
: 4 - (validLen % 4)
return [validLen, placeHoldersLen]
}
// base64 is 4/3 + up to two characters of the original data
function byteLength (b64) {
var lens = getLens(b64)
var validLen = lens[0]
var placeHoldersLen = lens[1]
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
}
function _byteLength (b64, validLen, placeHoldersLen) {
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
}
function toByteArray (b64) {
var tmp
var lens = getLens(b64)
var validLen = lens[0]
var placeHoldersLen = lens[1]
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
var curByte = 0
// if there are placeholders, only get up to the last complete 4 chars
var len = placeHoldersLen > 0
? validLen - 4
: validLen
var i
for (i = 0; i < len; i += 4) {
tmp =
(revLookup[b64.charCodeAt(i)] << 18) |
(revLookup[b64.charCodeAt(i + 1)] << 12) |
(revLookup[b64.charCodeAt(i + 2)] << 6) |
revLookup[b64.charCodeAt(i + 3)]
arr[curByte++] = (tmp >> 16) & 0xFF
arr[curByte++] = (tmp >> 8) & 0xFF
arr[curByte++] = tmp & 0xFF
}
if (placeHoldersLen === 2) {
tmp =
(revLookup[b64.charCodeAt(i)] << 2) |
(revLookup[b64.charCodeAt(i + 1)] >> 4)
arr[curByte++] = tmp & 0xFF
}
if (placeHoldersLen === 1) {
tmp =
(revLookup[b64.charCodeAt(i)] << 10) |
(revLookup[b64.charCodeAt(i + 1)] << 4) |
(revLookup[b64.charCodeAt(i + 2)] >> 2)
arr[curByte++] = (tmp >> 8) & 0xFF
arr[curByte++] = tmp & 0xFF
}
return arr
}
function tripletToBase64 (num) {
return lookup[num >> 18 & 0x3F] +
lookup[num >> 12 & 0x3F] +
lookup[num >> 6 & 0x3F] +
lookup[num & 0x3F]
}
function encodeChunk (uint8, start, end) {
var tmp
var output = []
for (var i = start; i < end; i += 3) {
tmp =
((uint8[i] << 16) & 0xFF0000) +
((uint8[i + 1] << 8) & 0xFF00) +
(uint8[i + 2] & 0xFF)
output.push(tripletToBase64(tmp))
}
return output.join('')
}
function fromByteArray (uint8) {
var tmp
var len = uint8.length
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
var parts = []
var maxChunkLength = 16383 // must be multiple of 3
// go through the array every three bytes, we'll deal with trailing stuff later
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
}
// pad the end with zeros, but make sure to not forget the extra bytes
if (extraBytes === 1) {
tmp = uint8[len - 1]
parts.push(
lookup[tmp >> 2] +
lookup[(tmp << 4) & 0x3F] +
'=='
)
} else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
parts.push(
lookup[tmp >> 10] +
lookup[(tmp >> 4) & 0x3F] +
lookup[(tmp << 2) & 0x3F] +
'='
)
}
return parts.join('')
}
/***/ }),
/***/ "2da4":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
const types = {
control: {
unload: 'removeControl'
},
layer: {
unload: 'removeTileLayer'
},
overlay: {
unload: 'removeOverlay'
},
contextMenu: {
unload: 'removeContextMenu'
}
}
const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component
function destroyInstance () {
const {unload, renderByParent, $parent} = this
if (renderByParent) {
$parent.reload()
}
unload()
}
class Mixin {
constructor (prop) {
this.methods = {
ready () {
const $parent = getParent(this.$parent)
const BMap = this.BMap = $parent.BMap
const map = this.map = $parent.map
this.load()
this.$emit('ready', {
BMap,
map
})
},
transmitEvent (e) {
this.$emit(e.type.replace(/^on/, ''), e)
},
reload () {
this && this.BMap && this.$nextTick(() => {
this.unload()
this.$nextTick(this.load)
})
},
unload () {
const {map, originInstance} = this
try {
switch (prop.type) {
case 'search':
return originInstance.clearResults()
case 'autoComplete':
case 'lushu':
return originInstance.dispose()
case 'markerClusterer':
return originInstance.clearMarkers()
default:
map[types[prop.type].unload](originInstance)
}
} catch (e) {}
}
}
this.computed = {
renderByParent () {
return this.$parent.preventChildrenRender
}
}
this.mounted = function () {
const $parent = getParent(this.$parent)
const map = $parent.map
const {ready} = this
map ? ready() : $parent.$on('ready', ready)
}
this.destroyed = destroyInstance
this.beforeDestroy = destroyInstance
}
}
/* harmony default export */ __webpack_exports__["a"] = (type => new Mixin({type}));
/***/ }),
/***/ "33d3":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isPoint; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return checkType; });
/* unused harmony export getPosition */
/* harmony import */ var _factory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("76f3");
const isPoint = obj => obj.lng && obj.lat
const checkType = val => Object.prototype.toString.call(val).slice(8, -1)
const getPosition = (BMap, point) => isPoint(point) ? Object(_factory__WEBPACK_IMPORTED_MODULE_0__[/* createPoint */ "d"])(BMap, point) : point
/***/ }),
/***/ "3c4e":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var isMergeableObject = function isMergeableObject(value) {
return isNonNullObject(value)
&& !isSpecial(value)
};
function isNonNullObject(value) {
return !!value && typeof value === 'object'
}
function isSpecial(value) {
var stringValue = Object.prototype.toString.call(value);
return stringValue === '[object RegExp]'
|| stringValue === '[object Date]'
|| isReactElement(value)
}
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
function isReactElement(value) {
return value.$$typeof === REACT_ELEMENT_TYPE
}
function emptyTarget(val) {
return Array.isArray(val) ? [] : {}
}
function cloneIfNecessary(value, optionsArgument) {
var clone = optionsArgument && optionsArgument.clone === true;
return (clone && isMergeableObject(value)) ? deepmerge(emptyTarget(value), value, optionsArgument) : value
}
function defaultArrayMerge(target, source, optionsArgument) {
var destination = target.slice();
source.forEach(function(e, i) {
if (typeof destination[i] === 'undefined') {
destination[i] = cloneIfNecessary(e, optionsArgument);
} else if (isMergeableObject(e)) {
destination[i] = deepmerge(target[i], e, optionsArgument);
} else if (target.indexOf(e) === -1) {
destination.push(cloneIfNecessary(e, optionsArgument));
}
});
return destination
}
function mergeObject(target, source, optionsArgument) {
var destination = {};
if (isMergeableObject(target)) {
Object.keys(target).forEach(function(key) {
destination[key] = cloneIfNecessary(target[key], optionsArgument);
});
}
Object.keys(source).forEach(function(key) {
if (!isMergeableObject(source[key]) || !target[key]) {
destination[key] = cloneIfNecessary(source[key], optionsArgument);
} else {
destination[key] = deepmerge(target[key], source[key], optionsArgument);
}
});
return destination
}
function deepmerge(target, source, optionsArgument) {
var sourceIsArray = Array.isArray(source);
var targetIsArray = Array.isArray(target);
var options = optionsArgument || { arrayMerge: defaultArrayMerge };
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
if (!sourceAndTargetTypesMatch) {
return cloneIfNecessary(source, optionsArgument)
} else if (sourceIsArray) {
var arrayMerge = options.arrayMerge || defaultArrayMerge;
return arrayMerge(target, source, optionsArgument)
} else {
return mergeObject(target, source, optionsArgument)
}
}
deepmerge.all = function deepmergeAll(array, optionsArgument) {
if (!Array.isArray(array) || array.length < 2) {
throw new Error('first argument should be an array with at least two elements')
}
// we are sure there are at least 2 values, so it is safe to have no initial value
return array.reduce(function(prev, next) {
return deepmerge(prev, next, optionsArgument)
})
};
var deepmerge_1 = deepmerge;
module.exports = deepmerge_1;
/***/ }),
/***/ "4757":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _base_mixins_common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("2da4");
/* harmony import */ var _base_bindEvent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("4fab");
/* harmony import */ var _base_factory_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("76f3");
/* harmony default export */ __webpack_exports__["a"] = ({
name: 'bm-geolocation',
render() {},
mixins: [Object(_base_mixins_common_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])('control')],
props: {
anchor: {
type: String
},
offset: {
type: Object
},
showAddressBar: {
type: Boolean
},
autoLocation: {
type: Boolean
},
locationIcon: {
type: Object
}
},
watch: {
anchor() {
this.reload();
},
offset() {
this.reload();
},
showAddressBar() {
this.reload();
},
autoLocation() {
this.reload();
},
locationIcon() {
this.reload();
}
},
methods: {
load() {
const {
BMap,
map,
anchor,
showAddressBar,
autoLocation,
locationIcon,
offset
} = this;
this.originInstance = new BMap.GeolocationControl({
anchor: global[anchor],
showAddressBar,
enableAutoLocation: autoLocation,
offset: offset && Object(_base_factory_js__WEBPACK_IMPORTED_MODULE_2__[/* createSize */ "e"])(BMap, offset),
locationIcon: locationIcon && Object(_base_factory_js__WEBPACK_IMPORTED_MODULE_2__[/* createIcon */ "b"])(BMap, locationIcon)
});
_base_bindEvent_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].call(this, this.originInstance);
map.addControl(this.originInstance);
}
}
});
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba")))
/***/ }),
/***/ "4fab":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/base/events.js
/* harmony default export */ var events = ({
'bm-map': [
'click',
'dblclick',
'rightclick',
'rightdblclick',
'maptypechange',
'mousemove',
'mouseover',
'mouseout',
'movestart',
'moving',
'moveend',
'zoomstart',
'zoomend',
'addoverlay',
'addcontrol',
'removecontrol',
'removeoverlay',
'clearoverlays',
'dragstart',
'dragging',
'dragend',
'addtilelayer',
'removetilelayer',
'load',
'resize',
'hotspotclick',
'hotspotover',
'hotspotout',
'tilesloaded',
'touchstart',
'touchmove',
'touchend',
'longpress'
],
'bm-geolocation': [
'locationSuccess',
'locationError'
],
'bm-overview-map': [
'viewchanged',
'viewchanging'
],
'bm-marker': [
'click',
'dblclick',
'mousedown',
'mouseup',
'mouseout',
'mouseover',
'remove',
'infowindowclose',
'infowindowopen',
'dragstart',
'dragging',
'dragend',
'rightclick'
],
'bm-polyline': [
'click',
'dblclick',
'mousedown',
'mouseup',
'mouseout',
'mouseover',
'remove',
'lineupdate'
],
'bm-polygon': [
'click',
'dblclick',
'mousedown',
'mouseup',
'mouseout',
'mouseover',
'remove',
'lineupdate'
],
'bm-circle': [
'click',
'dblclick',
'mousedown',
'mouseup',
'mouseout',
'mouseover',
'remove',
'lineupdate'
],
'bm-label': [
'click',
'dblclick',
'mousedown',
'mouseup',
'mouseout',
'mouseover',
'remove',
'rightclick'
],
'bm-info-window': [
'close',
'open',
'maximize',
'restore',
'clickclose'
],
'bm-ground': [
'click',
'dblclick'
],
'bm-autocomplete': [
'onconfirm',
'onhighlight'
],
'bm-point-collection': [
'click',
'mouseover',
'mouseout'
]
});
// CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/base/bindEvent.js
/* harmony default export */ var bindEvent = __webpack_exports__["a"] = (function (instance, eventList) {
const ev = eventList || events[this.$options.name]
ev && ev.forEach(event => {
const hasOn = event.slice(0, 2) === 'on'
const eventName = hasOn ? event.slice(2) : event
const listener = this.$listeners[eventName]
listener && instance.addEventListener(event, listener.fns)
})
});
/***/ }),
/***/ "67a0":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_EleFormBmap_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("0637");
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_EleFormBmap_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_EleFormBmap_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
/* unused harmony reexport * */
/***/ }),
/***/ "76f3":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return createPoint; });
/* unused harmony export createPixel */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createBounds; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return createSize; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return createIcon; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return createLabel; });
function createPoint (BMap, options = {}) {
const {lng, lat} = options
return new BMap.Point(lng, lat)
}
function createPixel (BMap, options = {}) {
const {x, y} = options
return new BMap.Pixel(x, y)
}
function createBounds (BMap, options = {}) {
const {sw, ne} = options
return new BMap.Bounds(createPoint(BMap, sw), createPoint(BMap, ne))
}
function createSize (BMap, options = {}) {
const {width, height} = options
return new BMap.Size(width, height)
}
function createIcon (BMap, options = {}) {
const {url, size, opts = {}} = options
return new BMap.Icon(url, createSize(BMap, size), {
anchor: opts.anchor && createSize(BMap, opts.anchor),
imageSize: opts.imageSize && createSize(BMap, opts.imageSize),
imageOffset: opts.imageOffset && createSize(BMap, opts.imageOffset),
infoWindowAnchor: opts.infoWindowAnchor && createSize(BMap, opts.infoWindowAnchor),
printImageUrl: opts.printImageUrl
})
}
function createLabel (BMap, options = {}) {
const {content, opts} = options
return new BMap.Label(content, {
offset: opts.offset && createSize(BMap, opts.offset),
position: opts.position && createPoint(BMap, opts.position),
enableMassClear: opts.enableMassClear
})
}
/***/ }),
/***/ "7f25":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _base_bindEvent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("4fab");
/* harmony import */ var _base_util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("33d3");
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["a"] = ({
name: 'bm-map',
props: {
ak: {
type: String
},
center: {
type: [Object, String]
},
zoom: {
type: Number
},
minZoom: {
type: Number
},
maxZoom: {
type: Number
},
highResolution: {
type: Boolean,
default: true
},
mapClick: {
type: Boolean,
default: true
},
mapType: {
type: String
},
dragging: {
type: Boolean,
default: true
},
scrollWheelZoom: {
type: Boolean,
default: false
},
doubleClickZoom: {
type: Boolean,
default: true
},
keyboard: {
type: Boolean,
default: true
},
inertialDragging: {
type: Boolean,
default: true
},
continuousZoom: {
type: Boolean,
default: true
},
pinchToZoom: {
type: Boolean,
default: true
},
autoResize: {
type: Boolean,
default: true
},
theme: {
type: Array
},
mapStyle: {
type: Object
}
},
watch: {
center(val, oldVal) {
const {
map,
zoom
} = this;
if (Object(_base_util_js__WEBPACK_IMPORTED_MODULE_1__[/* checkType */ "a"])(val) === 'String' && val !== oldVal) {
map.centerAndZoom(val, zoom);
}
},
'center.lng'(val, oldVal) {
const {
BMap,
map,
zoom,
center
} = this;
if (val !== oldVal && val >= -180 && val <= 180) {
map.centerAndZoom(new BMap.Point(val, center.lat), zoom);
}
},
'center.lat'(val, oldVal) {
const {
BMap,
map,
zoom,
center
} = this;
if (val !== oldVal && val >= -74 && val <= 74) {
map.centerAndZoom(new BMap.Point(center.lng, val), zoom);
}
},
zoom(val, oldVal) {
const {
map
} = this;
if (val !== oldVal && val >= 3 && val <= 19) {
map.setZoom(val);
}
},
minZoom(val) {
const {
map
} = this;
map.setMinZoom(val);
},
maxZoom(val) {
const {
map
} = this;
map.setMaxZoom(val);
},
highResolution() {
this.reset();
},
mapClick() {
this.reset();
},
mapType(val) {
const {
map
} = this;
map.setMapType(global[val]);
},
dragging(val) {
const {
map
} = this;
val ? map.enableDragging() : map.disableDragging();
},
scrollWheelZoom(val) {
const {
map
} = this;
val ? map.enableScrollWheelZoom() : map.disableScrollWheelZoom();
},
doubleClickZoom(val) {
const {
map
} = this;
val ? map.enableDoubleClickZoom() : map.disableDoubleClickZoom();
},
keyboard(val) {
const {
map
} = this;
val ? map.enableKeyboard() : map.disableKeyboard();
},
inertialDragging(val) {
const {
map
} = this;
val ? map.enableInertialDragging() : map.disableInertialDragging();
},
continuousZoom(val) {
const {
map
} = this;
val ? map.enableContinuousZoom() : map.disableContinuousZoom();
},
pinchToZoom(val) {
const {
map
} = this;
val ? map.enablePinchToZoom() : map.disablePinchToZoom();
},
autoResize(val) {
const {
map
} = this;
val ? map.enableAutoResize() : map.disableAutoResize();
},
theme(val) {
const {
map
} = this;
map.setMapStyle({
styleJson: val
});
},
'mapStyle.features': {
handler(val, oldVal) {
const {
map,
mapStyle
} = this;
const {
style,
styleJson
} = mapStyle;
map.setMapStyle({
styleJson,
features: val,
style
});
},
deep: true
},
'mapStyle.style'(val, oldVal) {
const {
map,
mapStyle
} = this;
const {
features,
styleJson
} = mapStyle;
map.setMapStyle({
styleJson,
features,
style: val
});
},
'mapStyle.styleJson': {
handler(val, oldVal) {
const {
map,
mapStyle
} = this;
const {
features,
style
} = mapStyle;
map.setMapStyle({
styleJson: val,
features,
style
});
},
deep: true
},
mapStyle(val) {
const {
map,
theme
} = this;
!theme && map.setMapStyle(val);
}
},
methods: {
setMapOptions() {
const {
map,
minZoom,
maxZoom,
mapType,
dragging,
scrollWheelZoom,
doubleClickZoom,
keyboard,
inertialDragging,
continuousZoom,
pinchToZoom,
autoResize
} = this;
minZoom && map.setMinZoom(minZoom);
maxZoom && map.setMaxZoom(maxZoom);
mapType && map.setMapType(global[mapType]);
dragging ? map.enableDragging() : map.disableDragging();
scrollWheelZoom ? map.enableScrollWheelZoom() : map.disableScrollWheelZoom();
doubleClickZoom ? map.enableDoubleClickZoom() : map.disableDoubleClickZoom();
keyboard ? map.enableKeyboard() : map.disableKeyboard();
inertialDragging ? map.enableInertialDragging() : map.disableInertialDragging();
continuousZoom ? map.enableContinuousZoom() : map.disableContinuousZoom();
pinchToZoom ? map.enablePinchToZoom() : map.disablePinchToZoom();
autoResize ? map.enableAutoResize() : map.disableAutoResize();
},
init(BMap) {
if (this.map) {
return;
}
let $el = this.$refs.view;
for (let $node of this.$slots.default || []) {
if ($node.componentOptions && $node.componentOptions.tag === 'bm-view') {
this.hasBmView = true;
$el = $node.elm;
}
}
const map = new BMap.Map($el, {
enableHighResolution: this.highResolution,
enableMapClick: this.mapClick
});
this.map = map;
const {
setMapOptions,
zoom,
getCenterPoint,
theme,
mapStyle
} = this;
theme ? map.setMapStyle({
styleJson: theme
}) : map.setMapStyle(mapStyle);
setMapOptions();
_base_bindEvent_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].call(this, map); // 此处强行初始化一次地图 回避一个由于错误的 center 字符串导致初始化失败抛出的错误
map.reset();
map.centerAndZoom(getCenterPoint(), zoom);
this.$emit('ready', {
BMap,
map
}); // Debug
// global.map = map
// global.mapComponent = this
},
getCenterPoint() {
const {
center,
BMap
} = this;
switch (Object(_base_util_js__WEBPACK_IMPORTED_MODULE_1__[/* checkType */ "a"])(center)) {
case 'String':
return center;
case 'Object':
return new BMap.Point(center.lng, center.lat);
default:
return new BMap.Point();
}
},
initMap(BMap) {
this.BMap = BMap;
this.init(BMap);
},
getMapScript() {
if (!global.BMap) {
const ak = this.ak || this._BMap().ak;
global.BMap = {};
global.BMap._preloader = new Promise((resolve, reject) => {
global._initBaiduMap = function () {
resolve(global.BMap);
global.document.body.removeChild($script);
global.BMap._preloader = null;
global._initBaiduMap = null;
};
const $script = document.createElement('script');
global.document.body.appendChild($script);
$script.src = `https://api.map.baidu.com/api?v=2.0&ak=${ak}&callback=_initBaiduMap`;
});
return global.BMap._preloader;
} else if (!global.BMap._preloader) {
return Promise.resolve(global.BMap);
} else {
return global.BMap._preloader;
}
},
reset() {
const {
getMapScript,
initMap
} = this;
getMapScript().then(initMap);
}
},
mounted() {
this.reset();
},
data() {
return {
hasBmView: false
};
}
});
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba")))
/***/ }),
/***/ "8bbf":
/***/ (function(module, exports) {
module.exports = require("vue");
/***/ }),
/***/ "9152":
/***/ (function(module, exports) {
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
var e, m
var eLen = (nBytes * 8) - mLen - 1
var eMax = (1 << eLen) - 1
var eBias = eMax >> 1
var nBits = -7
var i = isLE ? (nBytes - 1) : 0
var d = isLE ? -1 : 1
var s = buffer[offset + i]
i += d
e = s & ((1 << (-nBits)) - 1)
s >>= (-nBits)
nBits += eLen
for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
m = e & ((1 << (-nBits)) - 1)
e >>= (-nBits)
nBits += mLen
for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
if (e === 0) {
e = 1 - eBias
} else if (e === eMax) {
return m ? NaN : ((s ? -1 : 1) * Infinity)
} else {
m = m + Math.pow(2, mLen)
e = e - eBias
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
}
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
var e, m, c
var eLen = (nBytes * 8) - mLen - 1
var eMax = (1 << eLen) - 1
var eBias = eMax >> 1
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
var i = isLE ? 0 : (nBytes - 1)
var d = isLE ? 1 : -1
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
value = Math.abs(value)
if (isNaN(value) || value === Infinity) {
m = isNaN(value) ? 1 : 0
e = eMax
} else {
e = Math.floor(Math.log(value) / Math.LN2)
if (value * (c = Math.pow(2, -e)) < 1) {
e--
c *= 2
}
if (e + eBias >= 1) {
value += rt / c
} else {
value += rt * Math.pow(2, 1 - eBias)
}
if (value * c >= 2) {
e++
c /= 2
}
if (e + eBias >= eMax) {
m = 0
e = eMax
} else if (e + eBias >= 1) {
m = ((value * c) - 1) * Math.pow(2, mLen)
e = e + eBias
} else {
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
e = 0
}
}
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
e = (e << mLen) | m
eLen += mLen
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
buffer[offset + i - d] |= s * 128
}
/***/ }),
/***/ "b5c1":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _base_mixins_common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("2da4");
/* harmony import */ var _base_factory_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("76f3");
/* harmony default export */ __webpack_exports__["a"] = ({
name: 'bm-navigation',
render() {},
mixins: [Object(_base_mixins_common_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])('control')],
props: {
anchor: {
type: String
},
offset: {
type: Object
},
type: {
type: String
},
showZoomInfo: {
type: Boolean
},
enableGeolocation: {
type: Boolean,
default: false
}
},
watch: {
anchor() {
this.reload();
},
offset() {
this.reload();
},
type() {
this.reload();
},
showZoomInfo() {
this.reload();
}
},
methods: {
load() {
const {
BMap,
map,
anchor,
offset,
type,
showZoomInfo,
enableGeolocation
} = this;
this.originInstance = new BMap.NavigationControl({
anchor: global[anchor],
offset: offset && Object(_base_factory_js__WEBPACK_IMPORTED_MODULE_1__[/* createSize */ "e"])(BMap, offset),
type: global[type],
showZoomInfo,
enableGeolocation
});
map.addControl(this.originInstance);
}
}
});
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba")))
/***/ }),
/***/ "b639":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
/* eslint-disable no-proto */
var base64 = __webpack_require__("1fb5")
var ieee754 = __webpack_require__("9152")
var isArray = __webpack_require__("e3db")
exports.Buffer = Buffer
exports.SlowBuffer = SlowBuffer
exports.INSPECT_MAX_BYTES = 50
/**
* If `Buffer.TYPED_ARRAY_SUPPORT`:
* === true Use Uint8Array implementation (fastest)
* === false Use Object implementation (most compatible, even IE6)
*
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
* Opera 11.6+, iOS 4.2+.
*
* Due to various browser bugs, sometimes the Object implementation will be used even
* when the browser supports typed arrays.
*
* Note:
*
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
*
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
*
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
* incorrect length in some situations.
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
* get the Object implementation, which is slower but behaves correctly.
*/
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
? global.TYPED_ARRAY_SUPPORT
: typedArraySupport()
/*
* Export kMaxLength after typed array support is determined.
*/
exports.kMaxLength = kMaxLength()
function typedArraySupport () {
try {
var arr = new Uint8Array(1)
arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
return arr.foo() === 42 && // typed array instances can be augmented
typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
} catch (e) {
return false
}
}
function kMaxLength () {
return Buffer.TYPED_ARRAY_SUPPORT
? 0x7fffffff
: 0x3fffffff
}
function createBuffer (that, length) {
if (kMaxLength() < length) {
throw new RangeError('Invalid typed array length')
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = new Uint8Array(length)
that.__proto__ = Buffer.prototype
} else {
// Fallback: Return an object instance of the Buffer class
if (that === null) {
that = new Buffer(length)
}
that.length = length
}
return that
}
/**
* The Buffer constructor returns instances of `Uint8Array` that have their
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
* returns a single octet.
*
* The `Uint8Array` prototype remains unmodified.
*/
function Buffer (arg, encodingOrOffset, length) {
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
return new Buffer(arg, encodingOrOffset, length)
}
// Common case.
if (typeof arg === 'number') {
if (typeof encodingOrOffset === 'string') {
throw new Error(
'If encoding is specified then the first argument must be a string'
)
}
return allocUnsafe(this, arg)
}
return from(this, arg, encodingOrOffset, length)
}
Buffer.poolSize = 8192 // not used by this implementation
// TODO: Legacy, not needed anymore. Remove in next major version.
Buffer._augment = function (arr) {
arr.__proto__ = Buffer.prototype
return arr
}
function from (that, value, encodingOrOffset, length) {
if (typeof value === 'number') {
throw new TypeError('"value" argument must not be a number')
}
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
return fromArrayBuffer(that, value, encodingOrOffset, length)
}
if (typeof value === 'string') {
return fromString(that, value, encodingOrOffset)
}
return fromObject(that, value)
}
/**
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
* if value is a number.
* Buffer.from(str[, encoding])
* Buffer.from(array)
* Buffer.from(buffer)
* Buffer.from(arrayBuffer[, byteOffset[, length]])
**/
Buffer.from = function (value, encodingOrOffset, length) {
return from(null, value, encodingOrOffset, length)
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
Buffer.prototype.__proto__ = Uint8Array.prototype
Buffer.__proto__ = Uint8Array
if (typeof Symbol !== 'undefined' && Symbol.species &&
Buffer[Symbol.species] === Buffer) {
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
Object.defineProperty(Buffer, Symbol.species, {
value: null,
configurable: true
})
}
}
function assertSize (size) {
if (typeof size !== 'number') {
throw new TypeError('"size" argument must be a number')
} else if (size < 0) {
throw new RangeError('"size" argument must not be negative')
}
}
function alloc (that, size, fill, encoding) {
assertSize(size)
if (size <= 0) {
return createBuffer(that, size)
}
if (fill !== undefined) {
// Only pay attention to encoding if it's a string. This
// prevents accidentally sending in a number that would
// be interpretted as a start offset.
return typeof encoding === 'string'
? createBuffer(that, size).fill(fill, encoding)
: createBuffer(that, size).fill(fill)
}
return createBuffer(that, size)
}
/**
* Creates a new filled Buffer instance.
* alloc(size[, fill[, encoding]])
**/
Buffer.alloc = function (size, fill, encoding) {
return alloc(null, size, fill, encoding)
}
function allocUnsafe (that, size) {
assertSize(size)
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
if (!Buffer.TYPED_ARRAY_SUPPORT) {
for (var i = 0; i < size; ++i) {
that[i] = 0
}
}
return that
}
/**
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
* */
Buffer.allocUnsafe = function (size) {
return allocUnsafe(null, size)
}
/**
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
*/
Buffer.allocUnsafeSlow = function (size) {
return allocUnsafe(null, size)
}
function fromString (that, string, encoding) {
if (typeof encoding !== 'string' || encoding === '') {
encoding = 'utf8'
}
if (!Buffer.isEncoding(encoding)) {
throw new TypeError('"encoding" must be a valid string encoding')
}
var length = byteLength(string, encoding) | 0
that = createBuffer(that, length)
var actual = that.write(string, encoding)
if (actual !== length) {
// Writing a hex string, for example, that contains invalid characters will
// cause everything after the first invalid character to be ignored. (e.g.
// 'abxxcd' will be treated as 'ab')
that = that.slice(0, actual)
}
return that
}
function fromArrayLike (that, array) {
var length = array.length < 0 ? 0 : checked(array.length) | 0
that = createBuffer(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
}
function fromArrayBuffer (that, array, byteOffset, length) {
array.byteLength // this throws if `array` is not a valid ArrayBuffer
if (byteOffset < 0 || array.byteLength < byteOffset) {
throw new RangeError('\'offset\' is out of bounds')
}
if (array.byteLength < byteOffset + (length || 0)) {
throw new RangeError('\'length\' is out of bounds')
}
if (byteOffset === undefined && length === undefined) {
array = new Uint8Array(array)
} else if (length === undefined) {
array = new Uint8Array(array, byteOffset)
} else {
array = new Uint8Array(array, byteOffset, length)
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = array
that.__proto__ = Buffer.prototype
} else {
// Fallback: Return an object instance of the Buffer class
that = fromArrayLike(that, array)
}
return that
}
function fromObject (that, obj) {
if (Buffer.isBuffer(obj)) {
var len = checked(obj.length) | 0
that = createBuffer(that, len)
if (that.length === 0) {
return that
}
obj.copy(that, 0, 0, len)
return that
}
if (obj) {
if ((typeof ArrayBuffer !== 'undefined' &&
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
if (typeof obj.length !== 'number' || isnan(obj.length)) {
return createBuffer(that, 0)
}
return fromArrayLike(that, obj)
}
if (obj.type === 'Buffer' && isArray(obj.data)) {
return fromArrayLike(that, obj.data)
}
}
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
}
function checked (length) {
// Note: cannot use `length < kMaxLength()` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if (length >= kMaxLength()) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + kMaxLength().toString(16) + ' bytes')
}
return length | 0
}
function SlowBuffer (length) {
if (+length != length) { // eslint-disable-line eqeqeq
length = 0
}
return Buffer.alloc(+length)
}
Buffer.isBuffer = function isBuffer (b) {
return !!(b != null && b._isBuffer)
}
Buffer.compare = function compare (a, b) {
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
throw new TypeError('Arguments must be Buffers')
}
if (a === b) return 0
var x = a.length
var y = b.length
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
if (a[i] !== b[i]) {
x = a[i]
y = b[i]
break
}
}
if