@vidro/map-handler 1.0.4 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +326 -118
- package/dist/map-handler.js +1 -1
- package/doc/giswater.png +0 -0
- package/doc/giswaterInfo.png +0 -0
- package/doc/giswaterInfoApi.png +0 -0
- package/doc/giswatergeojson.png +0 -0
- package/doc/multiTile.png +0 -0
- package/doc/multiTileNoGutter.png +0 -0
- package/doc/togglelayergiswater.png +0 -0
- package/doc/vidromaps-basic.png +0 -0
- package/examples/externalwms/index.js +20 -0
- package/examples/externalwms/index.php +88 -0
- package/examples/full/apidemo.js +54 -11
- package/examples/full/cachedToken.dat +1 -1
- package/examples/full/cachedTokenData.dat +1 -1
- package/examples/full/index.php +37 -18
- package/examples/full/tester.js +177 -13
- package/examples/integration/tool/css/dist/home.css.min.css +0 -0
- package/examples/integration/tool/css/dist/home.min.css +1 -0
- package/examples/integration/tool/css/dist/home.min.css.map +10 -0
- package/examples/integration/tool/css/dist/style-login.css.min.css +0 -0
- package/examples/integration/tool/css/dist/style-login.min.css +1 -0
- package/examples/integration/tool/css/dist/style-login.min.css.map +10 -0
- package/examples/integration/tool/css/dist/style.css.min.css +0 -0
- package/examples/integration/tool/css/dist/style.min.css +1 -0
- package/examples/integration/tool/css/dist/style.min.css.map +23 -0
- package/examples/integration/tool/css/master/_bottom-sheet-2.scss +103 -0
- package/examples/integration/tool/css/master/_bottom-sheet.scss +142 -0
- package/examples/integration/tool/css/master/_colors.scss +35 -0
- package/examples/integration/tool/css/master/_dropdown-form.scss +167 -0
- package/examples/integration/tool/css/master/_forms.scss +416 -0
- package/examples/integration/tool/css/master/_header.scss +134 -0
- package/examples/integration/tool/css/master/_menu-toc.scss +135 -0
- package/examples/integration/tool/css/master/_menu-tools.scss +187 -0
- package/examples/integration/tool/css/master/_mixins.scss +42 -0
- package/examples/integration/tool/css/master/_notifyjs.scss +39 -0
- package/examples/integration/tool/css/master/_ol-map-controls.scss +117 -0
- package/examples/integration/tool/css/master/_simplelightbox.scss +287 -0
- package/examples/integration/tool/css/master/_toc-config.scss +28 -0
- package/examples/integration/tool/css/master/_toc-layouts.scss +173 -0
- package/examples/integration/tool/css/master/_tooltip.scss +34 -0
- package/examples/integration/tool/css/master/home.scss +266 -0
- package/examples/integration/tool/css/master/style-login.scss +240 -0
- package/examples/integration/tool/css/master/style.scss +166 -0
- package/examples/integration/tool/img/doc-gallery-placeholder.svg +3 -0
- package/examples/integration/tool/img/home/ic_calendar-clock.svg +1 -0
- package/examples/integration/tool/img/home/ic_caret-down.svg +1 -0
- package/examples/integration/tool/img/home/ic_cog.svg +1 -0
- package/examples/integration/tool/img/home/ic_marker.svg +1 -0
- package/examples/integration/tool/img/home/ic_play-circle.svg +1 -0
- package/examples/integration/tool/img/home/ic_power.svg +1 -0
- package/examples/integration/tool/img/home/ic_squares.svg +1 -0
- package/examples/integration/tool/img/home/ic_user-pointer.svg +1 -0
- package/examples/integration/tool/img/home/ic_user-square.svg +1 -0
- package/examples/integration/tool/img/home/logo_footer.svg +1 -0
- package/examples/integration/tool/img/ic/accessControl.svg +1 -0
- package/examples/integration/tool/img/ic/account-location.svg +1 -0
- package/examples/integration/tool/img/ic/actionDelete.svg +64 -0
- package/examples/integration/tool/img/ic/actionOpen.svg +64 -0
- package/examples/integration/tool/img/ic/addFile.svg +100 -0
- package/examples/integration/tool/img/ic/addFile_off.svg +102 -0
- package/examples/integration/tool/img/ic/arrow-left.svg +1 -0
- package/examples/integration/tool/img/ic/arrow-right-drop-circle-outline.svg +1 -0
- package/examples/integration/tool/img/ic/bt_add_photo.svg +3 -0
- package/examples/integration/tool/img/ic/bug.svg +1 -0
- package/examples/integration/tool/img/ic/caret-down-bottomsheet.svg +3 -0
- package/examples/integration/tool/img/ic/checkbox-blank-outline-grey.svg +8 -0
- package/examples/integration/tool/img/ic/checkbox-blank-outline-white.svg +8 -0
- package/examples/integration/tool/img/ic/checkbox-blank-outline.svg +1 -0
- package/examples/integration/tool/img/ic/checkbox-marked-outline-grey.svg +8 -0
- package/examples/integration/tool/img/ic/checkbox-marked-outline-white.svg +8 -0
- package/examples/integration/tool/img/ic/checkbox-marked-outline.svg +1 -0
- package/examples/integration/tool/img/ic/chevron-down-grey.svg +7 -0
- package/examples/integration/tool/img/ic/chevron-down-white.svg +7 -0
- package/examples/integration/tool/img/ic/chevron-down.svg +1 -0
- package/examples/integration/tool/img/ic/chevron-right-grey.svg +7 -0
- package/examples/integration/tool/img/ic/chevron-right-white.svg +7 -0
- package/examples/integration/tool/img/ic/chevron-right.svg +1 -0
- package/examples/integration/tool/img/ic/comment-text-outline.svg +1 -0
- package/examples/integration/tool/img/ic/cookie.svg +1 -0
- package/examples/integration/tool/img/ic/delete.svg +1 -0
- package/examples/integration/tool/img/ic/dot.svg +1 -0
- package/examples/integration/tool/img/ic/dump.svg +1 -0
- package/examples/integration/tool/img/ic/e.svg +9 -0
- package/examples/integration/tool/img/ic/eye-off.svg +1 -0
- package/examples/integration/tool/img/ic/eye.svg +1 -0
- package/examples/integration/tool/img/ic/forbidden.svg +1 -0
- package/examples/integration/tool/img/ic/form-title-1.svg +3 -0
- package/examples/integration/tool/img/ic/group.svg +1 -0
- package/examples/integration/tool/img/ic/hamburger.svg +1 -0
- package/examples/integration/tool/img/ic/ic-users.svg +1 -0
- package/examples/integration/tool/img/ic/ic_dropdown-form-close.svg +3 -0
- package/examples/integration/tool/img/ic/ic_dropdown-form-link.svg +3 -0
- package/examples/integration/tool/img/ic/ic_feature-edit-cancel.svg +14 -0
- package/examples/integration/tool/img/ic/ic_feature-edit-save.svg +14 -0
- package/examples/integration/tool/img/ic/ic_gallery-item-delete.svg +3 -0
- package/examples/integration/tool/img/ic/ic_gallery-item-view.svg +3 -0
- package/examples/integration/tool/img/ic/ic_gps.svg +3 -0
- package/examples/integration/tool/img/ic/ic_search.svg +5 -0
- package/examples/integration/tool/img/ic/ic_selector_fechas.svg +63 -0
- package/examples/integration/tool/img/ic/ic_zoom-to-extent.svg +3 -0
- package/examples/integration/tool/img/ic/icon_reminder.png +0 -0
- package/examples/integration/tool/img/ic/image-gallery-placeholder.svg +55 -0
- package/examples/integration/tool/img/ic/imaqua.svg +87 -0
- package/examples/integration/tool/img/ic/incidencia.svg +77 -0
- package/examples/integration/tool/img/ic/info_multi_selection.svg +230 -0
- package/examples/integration/tool/img/ic/layers.svg +1 -0
- package/examples/integration/tool/img/ic/map-marker.svg +3 -0
- package/examples/integration/tool/img/ic/map.svg +1 -0
- package/examples/integration/tool/img/ic/measure_area.svg +111 -0
- package/examples/integration/tool/img/ic/minus.svg +7 -0
- package/examples/integration/tool/img/ic/notification.svg +1 -0
- package/examples/integration/tool/img/ic/offline.svg +3 -0
- package/examples/integration/tool/img/ic/online.svg +1 -0
- package/examples/integration/tool/img/ic/pencil.svg +3 -0
- package/examples/integration/tool/img/ic/plus.svg +1 -0
- package/examples/integration/tool/img/ic/polygon_selection.svg +68 -0
- package/examples/integration/tool/img/ic/power.svg +1 -0
- package/examples/integration/tool/img/ic/remoteLocalized.svg +4 -0
- package/examples/integration/tool/img/ic/remoteStartLocalize.svg +4 -0
- package/examples/integration/tool/img/ic/ruler.svg +125 -0
- package/examples/integration/tool/img/ic/selection-plus.svg +10 -0
- package/examples/integration/tool/img/ic/selection.svg +1 -0
- package/examples/integration/tool/img/ic/settings.svg +1 -0
- package/examples/integration/tool/img/ic/sort.svg +1 -0
- package/examples/integration/tool/img/ic/sort_asc.svg +1 -0
- package/examples/integration/tool/img/ic/sort_desc.svg +1 -0
- package/examples/integration/tool/img/ic/spreadsheet.svg +3 -0
- package/examples/integration/tool/img/ic/times.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/AB3.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/AB4.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/IC1.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB1.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB11.svg +5 -0
- package/examples/integration/tool/img/ic/toolbar/TB2.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB20.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB21.svg +54 -0
- package/examples/integration/tool/img/ic/toolbar/TB3.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB31.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB32.svg +57 -0
- package/examples/integration/tool/img/ic/toolbar/TB4.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB5.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB6.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB7.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB8.svg +1 -0
- package/examples/integration/tool/img/ic/tools.svg +28 -0
- package/examples/integration/tool/img/ic/user.svg +1 -0
- package/examples/integration/tool/img/ic/vector-polygon.svg +1 -0
- package/examples/integration/tool/img/ic/visit_manager.svg +135 -0
- package/examples/integration/tool/img/logo-footer-login.png +0 -0
- package/examples/integration/tool/img/logo-footer.png +0 -0
- package/examples/integration/tool/img/logo-header-login.png +0 -0
- package/examples/integration/tool/img/logo-header-login@2x.png +0 -0
- package/examples/integration/tool/img/logo-header-login@3x.png +0 -0
- package/examples/integration/tool/img/logo-header.png +0 -0
- package/examples/integration/tool/img/logo-header@2x.png +0 -0
- package/examples/integration/tool/img/logo-header@3x.png +0 -0
- package/examples/integration/tool/img/logo_project.png +0 -0
- package/examples/integration/tool/img/photo-gallery-placeholder.svg +3 -0
- package/examples/integration/tool/img/pixel.png +0 -0
- package/examples/integration/tool/index.html +228 -0
- package/examples/integration/tool/js/demo.js +238 -0
- package/examples/integration/tool/js/interface.js +147 -0
- package/examples/integration/tool/js/jquery.js +4 -0
- package/examples/integration/vanguardia.html +6636 -0
- package/examples/multipleIframes/index.js +82 -0
- package/examples/multipleIframes/index.php +52 -0
- package/examples/serverLess/dist/index.23420cfa.js +2973 -0
- package/examples/serverLess/dist/index.23420cfa.js.map +1 -0
- package/examples/serverLess/dist/index.91b6cacc.js +2 -0
- package/examples/serverLess/dist/index.91b6cacc.js.map +1 -0
- package/examples/serverLess/dist/index.html +1 -0
- package/examples/serverLess/index.html +39 -0
- package/examples/serverLess/main.js +113 -0
- package/examples/serverLess/package.json +18 -0
- package/examples/serverLess/readme.md +41 -0
- package/examples/simple/index.html +1 -1
- package/examples/simple/simple.js +63 -65
- package/examples/vidromap/index.js +20 -0
- package/examples/vidromap/index.php +48 -51
- package/flows.md +73 -0
- package/package.json +2 -2
- package/src/index.js +156 -42
- package/src/shared/iframe-communicator.js +12 -5
- package/examples/vidromap/vidromap.js +0 -87
@@ -0,0 +1,2973 @@
|
|
1
|
+
// modules are defined as an array
|
2
|
+
// [ module function, map of requires ]
|
3
|
+
//
|
4
|
+
// map of requires is short require name -> numeric require
|
5
|
+
//
|
6
|
+
// anything defined in a previous bundle is accessed via the
|
7
|
+
// orig method which is the require for previous bundles
|
8
|
+
|
9
|
+
(function(modules, entry, mainEntry, parcelRequireName, globalName) {
|
10
|
+
/* eslint-disable no-undef */
|
11
|
+
var globalObject =
|
12
|
+
typeof globalThis !== 'undefined'
|
13
|
+
? globalThis
|
14
|
+
: typeof self !== 'undefined'
|
15
|
+
? self
|
16
|
+
: typeof window !== 'undefined'
|
17
|
+
? window
|
18
|
+
: typeof global !== 'undefined'
|
19
|
+
? global
|
20
|
+
: {};
|
21
|
+
/* eslint-enable no-undef */
|
22
|
+
|
23
|
+
// Save the require from previous bundle to this closure if any
|
24
|
+
var previousRequire =
|
25
|
+
typeof globalObject[parcelRequireName] === 'function' &&
|
26
|
+
globalObject[parcelRequireName];
|
27
|
+
|
28
|
+
var cache = previousRequire.cache || {};
|
29
|
+
// Do not use `require` to prevent Webpack from trying to bundle this call
|
30
|
+
var nodeRequire =
|
31
|
+
typeof module !== 'undefined' &&
|
32
|
+
typeof module.require === 'function' &&
|
33
|
+
module.require.bind(module);
|
34
|
+
|
35
|
+
function newRequire(name, jumped) {
|
36
|
+
if (!cache[name]) {
|
37
|
+
if (!modules[name]) {
|
38
|
+
// if we cannot find the module within our internal map or
|
39
|
+
// cache jump to the current global require ie. the last bundle
|
40
|
+
// that was added to the page.
|
41
|
+
var currentRequire =
|
42
|
+
typeof globalObject[parcelRequireName] === 'function' &&
|
43
|
+
globalObject[parcelRequireName];
|
44
|
+
if (!jumped && currentRequire) {
|
45
|
+
return currentRequire(name, true);
|
46
|
+
}
|
47
|
+
|
48
|
+
// If there are other bundles on this page the require from the
|
49
|
+
// previous one is saved to 'previousRequire'. Repeat this as
|
50
|
+
// many times as there are bundles until the module is found or
|
51
|
+
// we exhaust the require chain.
|
52
|
+
if (previousRequire) {
|
53
|
+
return previousRequire(name, true);
|
54
|
+
}
|
55
|
+
|
56
|
+
// Try the node require function if it exists.
|
57
|
+
if (nodeRequire && typeof name === 'string') {
|
58
|
+
return nodeRequire(name);
|
59
|
+
}
|
60
|
+
|
61
|
+
var err = new Error("Cannot find module '" + name + "'");
|
62
|
+
err.code = 'MODULE_NOT_FOUND';
|
63
|
+
throw err;
|
64
|
+
}
|
65
|
+
|
66
|
+
localRequire.resolve = resolve;
|
67
|
+
localRequire.cache = {};
|
68
|
+
|
69
|
+
var module = (cache[name] = new newRequire.Module(name));
|
70
|
+
|
71
|
+
modules[name][0].call(
|
72
|
+
module.exports,
|
73
|
+
localRequire,
|
74
|
+
module,
|
75
|
+
module.exports,
|
76
|
+
this
|
77
|
+
);
|
78
|
+
}
|
79
|
+
|
80
|
+
return cache[name].exports;
|
81
|
+
|
82
|
+
function localRequire(x) {
|
83
|
+
return newRequire(localRequire.resolve(x));
|
84
|
+
}
|
85
|
+
|
86
|
+
function resolve(x) {
|
87
|
+
return modules[name][1][x] || x;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
function Module(moduleName) {
|
92
|
+
this.id = moduleName;
|
93
|
+
this.bundle = newRequire;
|
94
|
+
this.exports = {};
|
95
|
+
}
|
96
|
+
|
97
|
+
newRequire.isParcelRequire = true;
|
98
|
+
newRequire.Module = Module;
|
99
|
+
newRequire.modules = modules;
|
100
|
+
newRequire.cache = cache;
|
101
|
+
newRequire.parent = previousRequire;
|
102
|
+
newRequire.register = function(id, exports) {
|
103
|
+
modules[id] = [
|
104
|
+
function(require, module) {
|
105
|
+
module.exports = exports;
|
106
|
+
},
|
107
|
+
{},
|
108
|
+
];
|
109
|
+
};
|
110
|
+
|
111
|
+
Object.defineProperty(newRequire, 'root', {
|
112
|
+
get: function() {
|
113
|
+
return globalObject[parcelRequireName];
|
114
|
+
},
|
115
|
+
});
|
116
|
+
|
117
|
+
globalObject[parcelRequireName] = newRequire;
|
118
|
+
|
119
|
+
for (var i = 0; i < entry.length; i++) {
|
120
|
+
newRequire(entry[i]);
|
121
|
+
}
|
122
|
+
|
123
|
+
if (mainEntry) {
|
124
|
+
// Expose entry point to Node, AMD or browser globals
|
125
|
+
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
126
|
+
var mainExports = newRequire(mainEntry);
|
127
|
+
|
128
|
+
// CommonJS
|
129
|
+
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
130
|
+
module.exports = mainExports;
|
131
|
+
|
132
|
+
// RequireJS
|
133
|
+
} else if (typeof define === 'function' && define.amd) {
|
134
|
+
define(function() {
|
135
|
+
return mainExports;
|
136
|
+
});
|
137
|
+
|
138
|
+
// <script>
|
139
|
+
} else if (globalName) {
|
140
|
+
this[globalName] = mainExports;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
})({"1sDb8":[function(require,module,exports) {
|
144
|
+
var HMR_HOST = null;
|
145
|
+
var HMR_PORT = 1234;
|
146
|
+
var HMR_SECURE = false;
|
147
|
+
var HMR_ENV_HASH = "d751713988987e9331980363e24189ce";
|
148
|
+
module.bundle.HMR_BUNDLE_ID = "ba76236dc15f498c73ded0e523420cfa";
|
149
|
+
// @flow
|
150
|
+
/*global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE*/
|
151
|
+
/*::
|
152
|
+
import type {
|
153
|
+
HMRAsset,
|
154
|
+
HMRMessage,
|
155
|
+
} from '@parcel/reporter-dev-server/src/HMRServer.js';
|
156
|
+
interface ParcelRequire {
|
157
|
+
(string): mixed;
|
158
|
+
cache: {|[string]: ParcelModule|};
|
159
|
+
hotData: mixed;
|
160
|
+
Module: any;
|
161
|
+
parent: ?ParcelRequire;
|
162
|
+
isParcelRequire: true;
|
163
|
+
modules: {|[string]: [Function, {|[string]: string|}]|};
|
164
|
+
HMR_BUNDLE_ID: string;
|
165
|
+
root: ParcelRequire;
|
166
|
+
}
|
167
|
+
interface ParcelModule {
|
168
|
+
hot: {|
|
169
|
+
data: mixed,
|
170
|
+
accept(cb: (Function) => void): void,
|
171
|
+
dispose(cb: (mixed) => void): void,
|
172
|
+
// accept(deps: Array<string> | string, cb: (Function) => void): void,
|
173
|
+
// decline(): void,
|
174
|
+
_acceptCallbacks: Array<(Function) => void>,
|
175
|
+
_disposeCallbacks: Array<(mixed) => void>,
|
176
|
+
|};
|
177
|
+
}
|
178
|
+
declare var module: {bundle: ParcelRequire, ...};
|
179
|
+
declare var HMR_HOST: string;
|
180
|
+
declare var HMR_PORT: string;
|
181
|
+
declare var HMR_ENV_HASH: string;
|
182
|
+
declare var HMR_SECURE: boolean;
|
183
|
+
*/
|
184
|
+
var OVERLAY_ID = '__parcel__error__overlay__';
|
185
|
+
var OldModule = module.bundle.Module;
|
186
|
+
function Module(moduleName) {
|
187
|
+
OldModule.call(this, moduleName);
|
188
|
+
this.hot = {
|
189
|
+
data: module.bundle.hotData,
|
190
|
+
_acceptCallbacks: [],
|
191
|
+
_disposeCallbacks: [],
|
192
|
+
accept: function (fn) {
|
193
|
+
this._acceptCallbacks.push(fn || (function () {}));
|
194
|
+
},
|
195
|
+
dispose: function (fn) {
|
196
|
+
this._disposeCallbacks.push(fn);
|
197
|
+
}
|
198
|
+
};
|
199
|
+
module.bundle.hotData = undefined;
|
200
|
+
}
|
201
|
+
module.bundle.Module = Module;
|
202
|
+
var checkedAssets, /*: {|[string]: boolean|}*/
|
203
|
+
acceptedAssets, /*: {|[string]: boolean|}*/
|
204
|
+
/*: {|[string]: boolean|}*/
|
205
|
+
assetsToAccept;
|
206
|
+
function getHostname() {
|
207
|
+
return HMR_HOST || (location.protocol.indexOf('http') === 0 ? location.hostname : 'localhost');
|
208
|
+
}
|
209
|
+
function getPort() {
|
210
|
+
return HMR_PORT || location.port;
|
211
|
+
}
|
212
|
+
// eslint-disable-next-line no-redeclare
|
213
|
+
var parent = module.bundle.parent;
|
214
|
+
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
|
215
|
+
var hostname = getHostname();
|
216
|
+
var port = getPort();
|
217
|
+
var protocol = HMR_SECURE || location.protocol == 'https:' && !(/localhost|127.0.0.1|0.0.0.0/).test(hostname) ? 'wss' : 'ws';
|
218
|
+
var ws = new WebSocket(protocol + '://' + hostname + (port ? ':' + port : '') + '/');
|
219
|
+
// $FlowFixMe
|
220
|
+
ws.onmessage = function (event) /*: {data: string, ...}*/
|
221
|
+
{
|
222
|
+
checkedAssets = {
|
223
|
+
/*: {|[string]: boolean|}*/
|
224
|
+
};
|
225
|
+
acceptedAssets = {
|
226
|
+
/*: {|[string]: boolean|}*/
|
227
|
+
};
|
228
|
+
assetsToAccept = [];
|
229
|
+
var data = /*: HMRMessage*/
|
230
|
+
JSON.parse(event.data);
|
231
|
+
if (data.type === 'update') {
|
232
|
+
// Remove error overlay if there is one
|
233
|
+
removeErrorOverlay();
|
234
|
+
let assets = data.assets.filter(asset => asset.envHash === HMR_ENV_HASH);
|
235
|
+
// Handle HMR Update
|
236
|
+
var handled = false;
|
237
|
+
assets.forEach(asset => {
|
238
|
+
var didAccept = asset.type === 'css' || asset.type === 'js' && hmrAcceptCheck(module.bundle.root, asset.id, asset.depsByBundle);
|
239
|
+
if (didAccept) {
|
240
|
+
handled = true;
|
241
|
+
}
|
242
|
+
});
|
243
|
+
if (handled) {
|
244
|
+
console.clear();
|
245
|
+
assets.forEach(function (asset) {
|
246
|
+
hmrApply(module.bundle.root, asset);
|
247
|
+
});
|
248
|
+
for (var i = 0; i < assetsToAccept.length; i++) {
|
249
|
+
var id = assetsToAccept[i][1];
|
250
|
+
if (!acceptedAssets[id]) {
|
251
|
+
hmrAcceptRun(assetsToAccept[i][0], id);
|
252
|
+
}
|
253
|
+
}
|
254
|
+
} else {
|
255
|
+
window.location.reload();
|
256
|
+
}
|
257
|
+
}
|
258
|
+
if (data.type === 'error') {
|
259
|
+
// Log parcel errors to console
|
260
|
+
for (let ansiDiagnostic of data.diagnostics.ansi) {
|
261
|
+
let stack = ansiDiagnostic.codeframe ? ansiDiagnostic.codeframe : ansiDiagnostic.stack;
|
262
|
+
console.error('🚨 [parcel]: ' + ansiDiagnostic.message + '\n' + stack + '\n\n' + ansiDiagnostic.hints.join('\n'));
|
263
|
+
}
|
264
|
+
// Render the fancy html overlay
|
265
|
+
removeErrorOverlay();
|
266
|
+
var overlay = createErrorOverlay(data.diagnostics.html);
|
267
|
+
// $FlowFixMe
|
268
|
+
document.body.appendChild(overlay);
|
269
|
+
}
|
270
|
+
};
|
271
|
+
ws.onerror = function (e) {
|
272
|
+
console.error(e.message);
|
273
|
+
};
|
274
|
+
ws.onclose = function (e) {
|
275
|
+
if (undefined !== 'test') {
|
276
|
+
console.warn('[parcel] 🚨 Connection to the HMR server was lost');
|
277
|
+
}
|
278
|
+
};
|
279
|
+
}
|
280
|
+
function removeErrorOverlay() {
|
281
|
+
var overlay = document.getElementById(OVERLAY_ID);
|
282
|
+
if (overlay) {
|
283
|
+
overlay.remove();
|
284
|
+
console.log('[parcel] ✨ Error resolved');
|
285
|
+
}
|
286
|
+
}
|
287
|
+
function createErrorOverlay(diagnostics) {
|
288
|
+
var overlay = document.createElement('div');
|
289
|
+
overlay.id = OVERLAY_ID;
|
290
|
+
let errorHTML = '<div style="background: black; opacity: 0.85; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; font-family: Menlo, Consolas, monospace; z-index: 9999;">';
|
291
|
+
for (let diagnostic of diagnostics) {
|
292
|
+
let stack = diagnostic.codeframe ? diagnostic.codeframe : diagnostic.stack;
|
293
|
+
errorHTML += `
|
294
|
+
<div>
|
295
|
+
<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">
|
296
|
+
🚨 ${diagnostic.message}
|
297
|
+
</div>
|
298
|
+
<pre>
|
299
|
+
${stack}
|
300
|
+
</pre>
|
301
|
+
<div>
|
302
|
+
${diagnostic.hints.map(hint => '<div>' + hint + '</div>').join('')}
|
303
|
+
</div>
|
304
|
+
</div>
|
305
|
+
`;
|
306
|
+
}
|
307
|
+
errorHTML += '</div>';
|
308
|
+
overlay.innerHTML = errorHTML;
|
309
|
+
return overlay;
|
310
|
+
}
|
311
|
+
function getParents(bundle, id) /*: Array<[ParcelRequire, string]>*/
|
312
|
+
{
|
313
|
+
var modules = bundle.modules;
|
314
|
+
if (!modules) {
|
315
|
+
return [];
|
316
|
+
}
|
317
|
+
var parents = [];
|
318
|
+
var k, d, dep;
|
319
|
+
for (k in modules) {
|
320
|
+
for (d in modules[k][1]) {
|
321
|
+
dep = modules[k][1][d];
|
322
|
+
if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) {
|
323
|
+
parents.push([bundle, k]);
|
324
|
+
}
|
325
|
+
}
|
326
|
+
}
|
327
|
+
if (bundle.parent) {
|
328
|
+
parents = parents.concat(getParents(bundle.parent, id));
|
329
|
+
}
|
330
|
+
return parents;
|
331
|
+
}
|
332
|
+
function updateLink(link) {
|
333
|
+
var newLink = link.cloneNode();
|
334
|
+
newLink.onload = function () {
|
335
|
+
if (link.parentNode !== null) {
|
336
|
+
// $FlowFixMe
|
337
|
+
link.parentNode.removeChild(link);
|
338
|
+
}
|
339
|
+
};
|
340
|
+
newLink.setAttribute('href', // $FlowFixMe
|
341
|
+
link.getAttribute('href').split('?')[0] + '?' + Date.now());
|
342
|
+
// $FlowFixMe
|
343
|
+
link.parentNode.insertBefore(newLink, link.nextSibling);
|
344
|
+
}
|
345
|
+
var cssTimeout = null;
|
346
|
+
function reloadCSS() {
|
347
|
+
if (cssTimeout) {
|
348
|
+
return;
|
349
|
+
}
|
350
|
+
cssTimeout = setTimeout(function () {
|
351
|
+
var links = document.querySelectorAll('link[rel="stylesheet"]');
|
352
|
+
for (var i = 0; i < links.length; i++) {
|
353
|
+
// $FlowFixMe[incompatible-type]
|
354
|
+
var href = /*: string*/
|
355
|
+
links[i].getAttribute('href');
|
356
|
+
var hostname = getHostname();
|
357
|
+
var servedFromHMRServer = hostname === 'localhost' ? new RegExp('^(https?:\\/\\/(0.0.0.0|127.0.0.1)|localhost):' + getPort()).test(href) : href.indexOf(hostname + ':' + getPort());
|
358
|
+
var absolute = (/^https?:\/\//i).test(href) && href.indexOf(window.location.origin) !== 0 && !servedFromHMRServer;
|
359
|
+
if (!absolute) {
|
360
|
+
updateLink(links[i]);
|
361
|
+
}
|
362
|
+
}
|
363
|
+
cssTimeout = null;
|
364
|
+
}, 50);
|
365
|
+
}
|
366
|
+
function hmrApply(bundle, /*: ParcelRequire*/
|
367
|
+
asset) /*: HMRAsset*/
|
368
|
+
{
|
369
|
+
var modules = bundle.modules;
|
370
|
+
if (!modules) {
|
371
|
+
return;
|
372
|
+
}
|
373
|
+
if (asset.type === 'css') {
|
374
|
+
reloadCSS();
|
375
|
+
return;
|
376
|
+
}
|
377
|
+
let deps = asset.depsByBundle[bundle.HMR_BUNDLE_ID];
|
378
|
+
if (deps) {
|
379
|
+
var fn = new Function('require', 'module', 'exports', asset.output);
|
380
|
+
modules[asset.id] = [fn, deps];
|
381
|
+
} else if (bundle.parent) {
|
382
|
+
hmrApply(bundle.parent, asset);
|
383
|
+
}
|
384
|
+
}
|
385
|
+
function hmrAcceptCheck(bundle, /*: ParcelRequire*/
|
386
|
+
id, /*: ParcelRequire*/
|
387
|
+
/*: string*/
|
388
|
+
depsByBundle) /*: ?{ [string]: { [string]: string } }*/
|
389
|
+
{
|
390
|
+
var modules = bundle.modules;
|
391
|
+
if (!modules) {
|
392
|
+
return;
|
393
|
+
}
|
394
|
+
if (depsByBundle && !depsByBundle[bundle.HMR_BUNDLE_ID]) {
|
395
|
+
// If we reached the root bundle without finding where the asset should go,
|
396
|
+
// there's nothing to do. Mark as "accepted" so we don't reload the page.
|
397
|
+
if (!bundle.parent) {
|
398
|
+
return true;
|
399
|
+
}
|
400
|
+
return hmrAcceptCheck(bundle.parent, id, depsByBundle);
|
401
|
+
}
|
402
|
+
if (checkedAssets[id]) {
|
403
|
+
return;
|
404
|
+
}
|
405
|
+
checkedAssets[id] = true;
|
406
|
+
var cached = bundle.cache[id];
|
407
|
+
assetsToAccept.push([bundle, id]);
|
408
|
+
if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
|
409
|
+
return true;
|
410
|
+
}
|
411
|
+
return getParents(module.bundle.root, id).some(function (v) {
|
412
|
+
return hmrAcceptCheck(v[0], v[1], null);
|
413
|
+
});
|
414
|
+
}
|
415
|
+
function hmrAcceptRun(bundle, /*: ParcelRequire*/
|
416
|
+
id) /*: string*/
|
417
|
+
{
|
418
|
+
var cached = bundle.cache[id];
|
419
|
+
bundle.hotData = {};
|
420
|
+
if (cached && cached.hot) {
|
421
|
+
cached.hot.data = bundle.hotData;
|
422
|
+
}
|
423
|
+
if (cached && cached.hot && cached.hot._disposeCallbacks.length) {
|
424
|
+
cached.hot._disposeCallbacks.forEach(function (cb) {
|
425
|
+
cb(bundle.hotData);
|
426
|
+
});
|
427
|
+
}
|
428
|
+
delete bundle.cache[id];
|
429
|
+
bundle(id);
|
430
|
+
cached = bundle.cache[id];
|
431
|
+
if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
|
432
|
+
cached.hot._acceptCallbacks.forEach(function (cb) {
|
433
|
+
var assetsToAlsoAccept = cb(function () {
|
434
|
+
return getParents(module.bundle.root, id);
|
435
|
+
});
|
436
|
+
if (assetsToAlsoAccept && assetsToAccept.length) {
|
437
|
+
assetsToAccept.push.apply(assetsToAccept, assetsToAlsoAccept);
|
438
|
+
}
|
439
|
+
});
|
440
|
+
}
|
441
|
+
acceptedAssets[id] = true;
|
442
|
+
}
|
443
|
+
|
444
|
+
},{}],"2X3X1":[function(require,module,exports) {
|
445
|
+
var _axios = require("axios");
|
446
|
+
var _parcelHelpers = require("@parcel/transformer-js/lib/esmodule-helpers.js");
|
447
|
+
var _axiosDefault = _parcelHelpers.interopDefault(_axios);
|
448
|
+
var _vidroMapHandler = require("@vidro/map-handler");
|
449
|
+
var _xml2jsonLight = require("xml2json-light");
|
450
|
+
var _xml2jsonLightDefault = _parcelHelpers.interopDefault(_xml2jsonLight);
|
451
|
+
// open source XML to JSON, used for parse WMS Info
|
452
|
+
let clickedPoint = null;
|
453
|
+
// store clicked coordinates for further use
|
454
|
+
const apiUrl = "https://bmaps.bgeo.es/api/";
|
455
|
+
const user = "test@bgeo.es";
|
456
|
+
const pwd = "test.12345";
|
457
|
+
const customLogo = "https://ssl.gstatic.com/ui/v1/icons/mail/rfr/logo_gmail_lockup_default_2x_r2.png";
|
458
|
+
const layerToLoad = "Arc";
|
459
|
+
const zoomLevel = 17;
|
460
|
+
// DOM Elements
|
461
|
+
const iframe = document.querySelector("#map-frame");
|
462
|
+
const infoContainer = document.querySelector("#infoContainer");
|
463
|
+
const infoContent = document.querySelector("#infoContent");
|
464
|
+
const closeInfo = document.querySelector("#closeInfo");
|
465
|
+
// 1. Get BMAPS user token
|
466
|
+
_axiosDefault.default.post(`${apiUrl}letsgo`, {
|
467
|
+
user: user,
|
468
|
+
pwd: pwd
|
469
|
+
}).then(function (response) {
|
470
|
+
console.log(response.data.message);
|
471
|
+
const userToken = response.data.message.token;
|
472
|
+
// 2. Get first user project
|
473
|
+
const project_id = response.data.message.projects[0];
|
474
|
+
console.log(project_id);
|
475
|
+
// 3. Get Map
|
476
|
+
_axiosDefault.default.get(`${apiUrl}map/${project_id}`, {
|
477
|
+
headers: {
|
478
|
+
Authorization: `Bearer ${userToken}`
|
479
|
+
},
|
480
|
+
params: {
|
481
|
+
logo: customLogo,
|
482
|
+
active_layer: layerToLoad,
|
483
|
+
show_layers: layerToLoad,
|
484
|
+
zoom: zoomLevel
|
485
|
+
}
|
486
|
+
}).then(function (response) {
|
487
|
+
console.log(response.data.message);
|
488
|
+
const sessionToken = response.data.message.sessionToken;
|
489
|
+
// 4. Load iframe
|
490
|
+
iframe.src = `${response.data.message.iframe}?sessionToken=${sessionToken}`;
|
491
|
+
// 5. Use js lib
|
492
|
+
const communicator = new _vidroMapHandler.Communicator({
|
493
|
+
sessionToken: sessionToken
|
494
|
+
});
|
495
|
+
// 6. Do WMS info on clickclicked coordinates
|
496
|
+
communicator.on("coordinates", function (data) {
|
497
|
+
console.info("clicked coordinates", data);
|
498
|
+
// create geometry for highlight clicked point and center map
|
499
|
+
clickedPoint = `POINT(${data.coordinates[0]} ${data.coordinates[1]})`;
|
500
|
+
communicator.infoFromCoordinates("wms", layerToLoad);
|
501
|
+
});
|
502
|
+
// info event
|
503
|
+
communicator.on("info", function (data) {
|
504
|
+
console.log("info received", data);
|
505
|
+
communicator.clear();
|
506
|
+
// clear previous higlight geometry
|
507
|
+
// highlight click point and center map o it
|
508
|
+
communicator.Highlight({
|
509
|
+
geom: clickedPoint,
|
510
|
+
zoom: {
|
511
|
+
type: "level",
|
512
|
+
zoomLevel: zoomLevel
|
513
|
+
}
|
514
|
+
});
|
515
|
+
// parse WMS and display Arc Id attributte
|
516
|
+
let arc_id = parseWMSInfo(data.data);
|
517
|
+
if (arc_id) {
|
518
|
+
infoContainer.style.display = "block";
|
519
|
+
// show info container
|
520
|
+
infoContent.innerHTML = `ID: ${parseWMSInfo(data.data)}`;
|
521
|
+
} else {
|
522
|
+
infoContainer.style.display = "none";
|
523
|
+
}
|
524
|
+
});
|
525
|
+
}).catch(function (error) {
|
526
|
+
console.log(error);
|
527
|
+
});
|
528
|
+
}).catch(function (error) {
|
529
|
+
console.log(error);
|
530
|
+
});
|
531
|
+
// DOM handlers
|
532
|
+
closeInfo.addEventListener("click", evt => {
|
533
|
+
infoContainer.style.display = "none";
|
534
|
+
});
|
535
|
+
const parseWMSInfo = data => {
|
536
|
+
// console.log("parseWMSInfo", data);
|
537
|
+
try {
|
538
|
+
let parsedData = _xml2jsonLightDefault.default.xml2json(data);
|
539
|
+
for (let i = 0; i < parsedData.GetFeatureInfoResponse.Layer.Feature.Attribute.length; i++) {
|
540
|
+
if (parsedData.GetFeatureInfoResponse.Layer.Feature.Attribute[i].name === "arc_id") {
|
541
|
+
return parsedData.GetFeatureInfoResponse.Layer.Feature.Attribute[i].value;
|
542
|
+
}
|
543
|
+
}
|
544
|
+
} catch (e) {
|
545
|
+
return false;
|
546
|
+
}
|
547
|
+
};
|
548
|
+
|
549
|
+
},{"axios":"7rA65","@parcel/transformer-js/lib/esmodule-helpers.js":"5gA8y","@vidro/map-handler":"4YjT0","xml2json-light":"4Mf7p"}],"7rA65":[function(require,module,exports) {
|
550
|
+
module.exports = require('./lib/axios');
|
551
|
+
},{"./lib/axios":"4qfhW"}],"4qfhW":[function(require,module,exports) {
|
552
|
+
'use strict';
|
553
|
+
|
554
|
+
var utils = require('./utils');
|
555
|
+
var bind = require('./helpers/bind');
|
556
|
+
var Axios = require('./core/Axios');
|
557
|
+
var mergeConfig = require('./core/mergeConfig');
|
558
|
+
var defaults = require('./defaults');
|
559
|
+
|
560
|
+
/**
|
561
|
+
* Create an instance of Axios
|
562
|
+
*
|
563
|
+
* @param {Object} defaultConfig The default config for the instance
|
564
|
+
* @return {Axios} A new instance of Axios
|
565
|
+
*/
|
566
|
+
function createInstance(defaultConfig) {
|
567
|
+
var context = new Axios(defaultConfig);
|
568
|
+
var instance = bind(Axios.prototype.request, context);
|
569
|
+
|
570
|
+
// Copy axios.prototype to instance
|
571
|
+
utils.extend(instance, Axios.prototype, context);
|
572
|
+
|
573
|
+
// Copy context to instance
|
574
|
+
utils.extend(instance, context);
|
575
|
+
|
576
|
+
return instance;
|
577
|
+
}
|
578
|
+
|
579
|
+
// Create the default instance to be exported
|
580
|
+
var axios = createInstance(defaults);
|
581
|
+
|
582
|
+
// Expose Axios class to allow class inheritance
|
583
|
+
axios.Axios = Axios;
|
584
|
+
|
585
|
+
// Factory for creating new instances
|
586
|
+
axios.create = function create(instanceConfig) {
|
587
|
+
return createInstance(mergeConfig(axios.defaults, instanceConfig));
|
588
|
+
};
|
589
|
+
|
590
|
+
// Expose Cancel & CancelToken
|
591
|
+
axios.Cancel = require('./cancel/Cancel');
|
592
|
+
axios.CancelToken = require('./cancel/CancelToken');
|
593
|
+
axios.isCancel = require('./cancel/isCancel');
|
594
|
+
|
595
|
+
// Expose all/spread
|
596
|
+
axios.all = function all(promises) {
|
597
|
+
return Promise.all(promises);
|
598
|
+
};
|
599
|
+
axios.spread = require('./helpers/spread');
|
600
|
+
|
601
|
+
// Expose isAxiosError
|
602
|
+
axios.isAxiosError = require('./helpers/isAxiosError');
|
603
|
+
|
604
|
+
module.exports = axios;
|
605
|
+
|
606
|
+
// Allow use of default import syntax in TypeScript
|
607
|
+
module.exports.default = axios;
|
608
|
+
|
609
|
+
},{"./utils":"7J9rV","./helpers/bind":"78Fwk","./core/Axios":"26bz2","./core/mergeConfig":"42z1a","./defaults":"5j10E","./cancel/Cancel":"1Ql7i","./cancel/CancelToken":"hHamf","./cancel/isCancel":"3MAgn","./helpers/spread":"9FoXt","./helpers/isAxiosError":"1bzv8"}],"7J9rV":[function(require,module,exports) {
|
610
|
+
'use strict';
|
611
|
+
|
612
|
+
var bind = require('./helpers/bind');
|
613
|
+
|
614
|
+
/*global toString:true*/
|
615
|
+
|
616
|
+
// utils is a library of generic helper functions non-specific to axios
|
617
|
+
|
618
|
+
var toString = Object.prototype.toString;
|
619
|
+
|
620
|
+
/**
|
621
|
+
* Determine if a value is an Array
|
622
|
+
*
|
623
|
+
* @param {Object} val The value to test
|
624
|
+
* @returns {boolean} True if value is an Array, otherwise false
|
625
|
+
*/
|
626
|
+
function isArray(val) {
|
627
|
+
return toString.call(val) === '[object Array]';
|
628
|
+
}
|
629
|
+
|
630
|
+
/**
|
631
|
+
* Determine if a value is undefined
|
632
|
+
*
|
633
|
+
* @param {Object} val The value to test
|
634
|
+
* @returns {boolean} True if the value is undefined, otherwise false
|
635
|
+
*/
|
636
|
+
function isUndefined(val) {
|
637
|
+
return typeof val === 'undefined';
|
638
|
+
}
|
639
|
+
|
640
|
+
/**
|
641
|
+
* Determine if a value is a Buffer
|
642
|
+
*
|
643
|
+
* @param {Object} val The value to test
|
644
|
+
* @returns {boolean} True if value is a Buffer, otherwise false
|
645
|
+
*/
|
646
|
+
function isBuffer(val) {
|
647
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
648
|
+
&& typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
|
649
|
+
}
|
650
|
+
|
651
|
+
/**
|
652
|
+
* Determine if a value is an ArrayBuffer
|
653
|
+
*
|
654
|
+
* @param {Object} val The value to test
|
655
|
+
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
656
|
+
*/
|
657
|
+
function isArrayBuffer(val) {
|
658
|
+
return toString.call(val) === '[object ArrayBuffer]';
|
659
|
+
}
|
660
|
+
|
661
|
+
/**
|
662
|
+
* Determine if a value is a FormData
|
663
|
+
*
|
664
|
+
* @param {Object} val The value to test
|
665
|
+
* @returns {boolean} True if value is an FormData, otherwise false
|
666
|
+
*/
|
667
|
+
function isFormData(val) {
|
668
|
+
return (typeof FormData !== 'undefined') && (val instanceof FormData);
|
669
|
+
}
|
670
|
+
|
671
|
+
/**
|
672
|
+
* Determine if a value is a view on an ArrayBuffer
|
673
|
+
*
|
674
|
+
* @param {Object} val The value to test
|
675
|
+
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
676
|
+
*/
|
677
|
+
function isArrayBufferView(val) {
|
678
|
+
var result;
|
679
|
+
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
680
|
+
result = ArrayBuffer.isView(val);
|
681
|
+
} else {
|
682
|
+
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
683
|
+
}
|
684
|
+
return result;
|
685
|
+
}
|
686
|
+
|
687
|
+
/**
|
688
|
+
* Determine if a value is a String
|
689
|
+
*
|
690
|
+
* @param {Object} val The value to test
|
691
|
+
* @returns {boolean} True if value is a String, otherwise false
|
692
|
+
*/
|
693
|
+
function isString(val) {
|
694
|
+
return typeof val === 'string';
|
695
|
+
}
|
696
|
+
|
697
|
+
/**
|
698
|
+
* Determine if a value is a Number
|
699
|
+
*
|
700
|
+
* @param {Object} val The value to test
|
701
|
+
* @returns {boolean} True if value is a Number, otherwise false
|
702
|
+
*/
|
703
|
+
function isNumber(val) {
|
704
|
+
return typeof val === 'number';
|
705
|
+
}
|
706
|
+
|
707
|
+
/**
|
708
|
+
* Determine if a value is an Object
|
709
|
+
*
|
710
|
+
* @param {Object} val The value to test
|
711
|
+
* @returns {boolean} True if value is an Object, otherwise false
|
712
|
+
*/
|
713
|
+
function isObject(val) {
|
714
|
+
return val !== null && typeof val === 'object';
|
715
|
+
}
|
716
|
+
|
717
|
+
/**
|
718
|
+
* Determine if a value is a plain Object
|
719
|
+
*
|
720
|
+
* @param {Object} val The value to test
|
721
|
+
* @return {boolean} True if value is a plain Object, otherwise false
|
722
|
+
*/
|
723
|
+
function isPlainObject(val) {
|
724
|
+
if (toString.call(val) !== '[object Object]') {
|
725
|
+
return false;
|
726
|
+
}
|
727
|
+
|
728
|
+
var prototype = Object.getPrototypeOf(val);
|
729
|
+
return prototype === null || prototype === Object.prototype;
|
730
|
+
}
|
731
|
+
|
732
|
+
/**
|
733
|
+
* Determine if a value is a Date
|
734
|
+
*
|
735
|
+
* @param {Object} val The value to test
|
736
|
+
* @returns {boolean} True if value is a Date, otherwise false
|
737
|
+
*/
|
738
|
+
function isDate(val) {
|
739
|
+
return toString.call(val) === '[object Date]';
|
740
|
+
}
|
741
|
+
|
742
|
+
/**
|
743
|
+
* Determine if a value is a File
|
744
|
+
*
|
745
|
+
* @param {Object} val The value to test
|
746
|
+
* @returns {boolean} True if value is a File, otherwise false
|
747
|
+
*/
|
748
|
+
function isFile(val) {
|
749
|
+
return toString.call(val) === '[object File]';
|
750
|
+
}
|
751
|
+
|
752
|
+
/**
|
753
|
+
* Determine if a value is a Blob
|
754
|
+
*
|
755
|
+
* @param {Object} val The value to test
|
756
|
+
* @returns {boolean} True if value is a Blob, otherwise false
|
757
|
+
*/
|
758
|
+
function isBlob(val) {
|
759
|
+
return toString.call(val) === '[object Blob]';
|
760
|
+
}
|
761
|
+
|
762
|
+
/**
|
763
|
+
* Determine if a value is a Function
|
764
|
+
*
|
765
|
+
* @param {Object} val The value to test
|
766
|
+
* @returns {boolean} True if value is a Function, otherwise false
|
767
|
+
*/
|
768
|
+
function isFunction(val) {
|
769
|
+
return toString.call(val) === '[object Function]';
|
770
|
+
}
|
771
|
+
|
772
|
+
/**
|
773
|
+
* Determine if a value is a Stream
|
774
|
+
*
|
775
|
+
* @param {Object} val The value to test
|
776
|
+
* @returns {boolean} True if value is a Stream, otherwise false
|
777
|
+
*/
|
778
|
+
function isStream(val) {
|
779
|
+
return isObject(val) && isFunction(val.pipe);
|
780
|
+
}
|
781
|
+
|
782
|
+
/**
|
783
|
+
* Determine if a value is a URLSearchParams object
|
784
|
+
*
|
785
|
+
* @param {Object} val The value to test
|
786
|
+
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
787
|
+
*/
|
788
|
+
function isURLSearchParams(val) {
|
789
|
+
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
790
|
+
}
|
791
|
+
|
792
|
+
/**
|
793
|
+
* Trim excess whitespace off the beginning and end of a string
|
794
|
+
*
|
795
|
+
* @param {String} str The String to trim
|
796
|
+
* @returns {String} The String freed of excess whitespace
|
797
|
+
*/
|
798
|
+
function trim(str) {
|
799
|
+
return str.replace(/^\s*/, '').replace(/\s*$/, '');
|
800
|
+
}
|
801
|
+
|
802
|
+
/**
|
803
|
+
* Determine if we're running in a standard browser environment
|
804
|
+
*
|
805
|
+
* This allows axios to run in a web worker, and react-native.
|
806
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
807
|
+
*
|
808
|
+
* web workers:
|
809
|
+
* typeof window -> undefined
|
810
|
+
* typeof document -> undefined
|
811
|
+
*
|
812
|
+
* react-native:
|
813
|
+
* navigator.product -> 'ReactNative'
|
814
|
+
* nativescript
|
815
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
816
|
+
*/
|
817
|
+
function isStandardBrowserEnv() {
|
818
|
+
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
|
819
|
+
navigator.product === 'NativeScript' ||
|
820
|
+
navigator.product === 'NS')) {
|
821
|
+
return false;
|
822
|
+
}
|
823
|
+
return (
|
824
|
+
typeof window !== 'undefined' &&
|
825
|
+
typeof document !== 'undefined'
|
826
|
+
);
|
827
|
+
}
|
828
|
+
|
829
|
+
/**
|
830
|
+
* Iterate over an Array or an Object invoking a function for each item.
|
831
|
+
*
|
832
|
+
* If `obj` is an Array callback will be called passing
|
833
|
+
* the value, index, and complete array for each item.
|
834
|
+
*
|
835
|
+
* If 'obj' is an Object callback will be called passing
|
836
|
+
* the value, key, and complete object for each property.
|
837
|
+
*
|
838
|
+
* @param {Object|Array} obj The object to iterate
|
839
|
+
* @param {Function} fn The callback to invoke for each item
|
840
|
+
*/
|
841
|
+
function forEach(obj, fn) {
|
842
|
+
// Don't bother if no value provided
|
843
|
+
if (obj === null || typeof obj === 'undefined') {
|
844
|
+
return;
|
845
|
+
}
|
846
|
+
|
847
|
+
// Force an array if not already something iterable
|
848
|
+
if (typeof obj !== 'object') {
|
849
|
+
/*eslint no-param-reassign:0*/
|
850
|
+
obj = [obj];
|
851
|
+
}
|
852
|
+
|
853
|
+
if (isArray(obj)) {
|
854
|
+
// Iterate over array values
|
855
|
+
for (var i = 0, l = obj.length; i < l; i++) {
|
856
|
+
fn.call(null, obj[i], i, obj);
|
857
|
+
}
|
858
|
+
} else {
|
859
|
+
// Iterate over object keys
|
860
|
+
for (var key in obj) {
|
861
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
862
|
+
fn.call(null, obj[key], key, obj);
|
863
|
+
}
|
864
|
+
}
|
865
|
+
}
|
866
|
+
}
|
867
|
+
|
868
|
+
/**
|
869
|
+
* Accepts varargs expecting each argument to be an object, then
|
870
|
+
* immutably merges the properties of each object and returns result.
|
871
|
+
*
|
872
|
+
* When multiple objects contain the same key the later object in
|
873
|
+
* the arguments list will take precedence.
|
874
|
+
*
|
875
|
+
* Example:
|
876
|
+
*
|
877
|
+
* ```js
|
878
|
+
* var result = merge({foo: 123}, {foo: 456});
|
879
|
+
* console.log(result.foo); // outputs 456
|
880
|
+
* ```
|
881
|
+
*
|
882
|
+
* @param {Object} obj1 Object to merge
|
883
|
+
* @returns {Object} Result of all merge properties
|
884
|
+
*/
|
885
|
+
function merge(/* obj1, obj2, obj3, ... */) {
|
886
|
+
var result = {};
|
887
|
+
function assignValue(val, key) {
|
888
|
+
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
889
|
+
result[key] = merge(result[key], val);
|
890
|
+
} else if (isPlainObject(val)) {
|
891
|
+
result[key] = merge({}, val);
|
892
|
+
} else if (isArray(val)) {
|
893
|
+
result[key] = val.slice();
|
894
|
+
} else {
|
895
|
+
result[key] = val;
|
896
|
+
}
|
897
|
+
}
|
898
|
+
|
899
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
900
|
+
forEach(arguments[i], assignValue);
|
901
|
+
}
|
902
|
+
return result;
|
903
|
+
}
|
904
|
+
|
905
|
+
/**
|
906
|
+
* Extends object a by mutably adding to it the properties of object b.
|
907
|
+
*
|
908
|
+
* @param {Object} a The object to be extended
|
909
|
+
* @param {Object} b The object to copy properties from
|
910
|
+
* @param {Object} thisArg The object to bind function to
|
911
|
+
* @return {Object} The resulting value of object a
|
912
|
+
*/
|
913
|
+
function extend(a, b, thisArg) {
|
914
|
+
forEach(b, function assignValue(val, key) {
|
915
|
+
if (thisArg && typeof val === 'function') {
|
916
|
+
a[key] = bind(val, thisArg);
|
917
|
+
} else {
|
918
|
+
a[key] = val;
|
919
|
+
}
|
920
|
+
});
|
921
|
+
return a;
|
922
|
+
}
|
923
|
+
|
924
|
+
/**
|
925
|
+
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
926
|
+
*
|
927
|
+
* @param {string} content with BOM
|
928
|
+
* @return {string} content value without BOM
|
929
|
+
*/
|
930
|
+
function stripBOM(content) {
|
931
|
+
if (content.charCodeAt(0) === 0xFEFF) {
|
932
|
+
content = content.slice(1);
|
933
|
+
}
|
934
|
+
return content;
|
935
|
+
}
|
936
|
+
|
937
|
+
module.exports = {
|
938
|
+
isArray: isArray,
|
939
|
+
isArrayBuffer: isArrayBuffer,
|
940
|
+
isBuffer: isBuffer,
|
941
|
+
isFormData: isFormData,
|
942
|
+
isArrayBufferView: isArrayBufferView,
|
943
|
+
isString: isString,
|
944
|
+
isNumber: isNumber,
|
945
|
+
isObject: isObject,
|
946
|
+
isPlainObject: isPlainObject,
|
947
|
+
isUndefined: isUndefined,
|
948
|
+
isDate: isDate,
|
949
|
+
isFile: isFile,
|
950
|
+
isBlob: isBlob,
|
951
|
+
isFunction: isFunction,
|
952
|
+
isStream: isStream,
|
953
|
+
isURLSearchParams: isURLSearchParams,
|
954
|
+
isStandardBrowserEnv: isStandardBrowserEnv,
|
955
|
+
forEach: forEach,
|
956
|
+
merge: merge,
|
957
|
+
extend: extend,
|
958
|
+
trim: trim,
|
959
|
+
stripBOM: stripBOM
|
960
|
+
};
|
961
|
+
|
962
|
+
},{"./helpers/bind":"78Fwk"}],"78Fwk":[function(require,module,exports) {
|
963
|
+
'use strict';
|
964
|
+
|
965
|
+
module.exports = function bind(fn, thisArg) {
|
966
|
+
return function wrap() {
|
967
|
+
var args = new Array(arguments.length);
|
968
|
+
for (var i = 0; i < args.length; i++) {
|
969
|
+
args[i] = arguments[i];
|
970
|
+
}
|
971
|
+
return fn.apply(thisArg, args);
|
972
|
+
};
|
973
|
+
};
|
974
|
+
|
975
|
+
},{}],"26bz2":[function(require,module,exports) {
|
976
|
+
'use strict';
|
977
|
+
|
978
|
+
var utils = require('./../utils');
|
979
|
+
var buildURL = require('../helpers/buildURL');
|
980
|
+
var InterceptorManager = require('./InterceptorManager');
|
981
|
+
var dispatchRequest = require('./dispatchRequest');
|
982
|
+
var mergeConfig = require('./mergeConfig');
|
983
|
+
|
984
|
+
/**
|
985
|
+
* Create a new instance of Axios
|
986
|
+
*
|
987
|
+
* @param {Object} instanceConfig The default config for the instance
|
988
|
+
*/
|
989
|
+
function Axios(instanceConfig) {
|
990
|
+
this.defaults = instanceConfig;
|
991
|
+
this.interceptors = {
|
992
|
+
request: new InterceptorManager(),
|
993
|
+
response: new InterceptorManager()
|
994
|
+
};
|
995
|
+
}
|
996
|
+
|
997
|
+
/**
|
998
|
+
* Dispatch a request
|
999
|
+
*
|
1000
|
+
* @param {Object} config The config specific for this request (merged with this.defaults)
|
1001
|
+
*/
|
1002
|
+
Axios.prototype.request = function request(config) {
|
1003
|
+
/*eslint no-param-reassign:0*/
|
1004
|
+
// Allow for axios('example/url'[, config]) a la fetch API
|
1005
|
+
if (typeof config === 'string') {
|
1006
|
+
config = arguments[1] || {};
|
1007
|
+
config.url = arguments[0];
|
1008
|
+
} else {
|
1009
|
+
config = config || {};
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
config = mergeConfig(this.defaults, config);
|
1013
|
+
|
1014
|
+
// Set config.method
|
1015
|
+
if (config.method) {
|
1016
|
+
config.method = config.method.toLowerCase();
|
1017
|
+
} else if (this.defaults.method) {
|
1018
|
+
config.method = this.defaults.method.toLowerCase();
|
1019
|
+
} else {
|
1020
|
+
config.method = 'get';
|
1021
|
+
}
|
1022
|
+
|
1023
|
+
// Hook up interceptors middleware
|
1024
|
+
var chain = [dispatchRequest, undefined];
|
1025
|
+
var promise = Promise.resolve(config);
|
1026
|
+
|
1027
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
1028
|
+
chain.unshift(interceptor.fulfilled, interceptor.rejected);
|
1029
|
+
});
|
1030
|
+
|
1031
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
1032
|
+
chain.push(interceptor.fulfilled, interceptor.rejected);
|
1033
|
+
});
|
1034
|
+
|
1035
|
+
while (chain.length) {
|
1036
|
+
promise = promise.then(chain.shift(), chain.shift());
|
1037
|
+
}
|
1038
|
+
|
1039
|
+
return promise;
|
1040
|
+
};
|
1041
|
+
|
1042
|
+
Axios.prototype.getUri = function getUri(config) {
|
1043
|
+
config = mergeConfig(this.defaults, config);
|
1044
|
+
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
|
1045
|
+
};
|
1046
|
+
|
1047
|
+
// Provide aliases for supported request methods
|
1048
|
+
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
1049
|
+
/*eslint func-names:0*/
|
1050
|
+
Axios.prototype[method] = function(url, config) {
|
1051
|
+
return this.request(mergeConfig(config || {}, {
|
1052
|
+
method: method,
|
1053
|
+
url: url,
|
1054
|
+
data: (config || {}).data
|
1055
|
+
}));
|
1056
|
+
};
|
1057
|
+
});
|
1058
|
+
|
1059
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
1060
|
+
/*eslint func-names:0*/
|
1061
|
+
Axios.prototype[method] = function(url, data, config) {
|
1062
|
+
return this.request(mergeConfig(config || {}, {
|
1063
|
+
method: method,
|
1064
|
+
url: url,
|
1065
|
+
data: data
|
1066
|
+
}));
|
1067
|
+
};
|
1068
|
+
});
|
1069
|
+
|
1070
|
+
module.exports = Axios;
|
1071
|
+
|
1072
|
+
},{"./../utils":"7J9rV","../helpers/buildURL":"25KfR","./InterceptorManager":"33sRR","./dispatchRequest":"1mCjo","./mergeConfig":"42z1a"}],"25KfR":[function(require,module,exports) {
|
1073
|
+
'use strict';
|
1074
|
+
|
1075
|
+
var utils = require('./../utils');
|
1076
|
+
|
1077
|
+
function encode(val) {
|
1078
|
+
return encodeURIComponent(val).
|
1079
|
+
replace(/%3A/gi, ':').
|
1080
|
+
replace(/%24/g, '$').
|
1081
|
+
replace(/%2C/gi, ',').
|
1082
|
+
replace(/%20/g, '+').
|
1083
|
+
replace(/%5B/gi, '[').
|
1084
|
+
replace(/%5D/gi, ']');
|
1085
|
+
}
|
1086
|
+
|
1087
|
+
/**
|
1088
|
+
* Build a URL by appending params to the end
|
1089
|
+
*
|
1090
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
1091
|
+
* @param {object} [params] The params to be appended
|
1092
|
+
* @returns {string} The formatted url
|
1093
|
+
*/
|
1094
|
+
module.exports = function buildURL(url, params, paramsSerializer) {
|
1095
|
+
/*eslint no-param-reassign:0*/
|
1096
|
+
if (!params) {
|
1097
|
+
return url;
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
var serializedParams;
|
1101
|
+
if (paramsSerializer) {
|
1102
|
+
serializedParams = paramsSerializer(params);
|
1103
|
+
} else if (utils.isURLSearchParams(params)) {
|
1104
|
+
serializedParams = params.toString();
|
1105
|
+
} else {
|
1106
|
+
var parts = [];
|
1107
|
+
|
1108
|
+
utils.forEach(params, function serialize(val, key) {
|
1109
|
+
if (val === null || typeof val === 'undefined') {
|
1110
|
+
return;
|
1111
|
+
}
|
1112
|
+
|
1113
|
+
if (utils.isArray(val)) {
|
1114
|
+
key = key + '[]';
|
1115
|
+
} else {
|
1116
|
+
val = [val];
|
1117
|
+
}
|
1118
|
+
|
1119
|
+
utils.forEach(val, function parseValue(v) {
|
1120
|
+
if (utils.isDate(v)) {
|
1121
|
+
v = v.toISOString();
|
1122
|
+
} else if (utils.isObject(v)) {
|
1123
|
+
v = JSON.stringify(v);
|
1124
|
+
}
|
1125
|
+
parts.push(encode(key) + '=' + encode(v));
|
1126
|
+
});
|
1127
|
+
});
|
1128
|
+
|
1129
|
+
serializedParams = parts.join('&');
|
1130
|
+
}
|
1131
|
+
|
1132
|
+
if (serializedParams) {
|
1133
|
+
var hashmarkIndex = url.indexOf('#');
|
1134
|
+
if (hashmarkIndex !== -1) {
|
1135
|
+
url = url.slice(0, hashmarkIndex);
|
1136
|
+
}
|
1137
|
+
|
1138
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
1139
|
+
}
|
1140
|
+
|
1141
|
+
return url;
|
1142
|
+
};
|
1143
|
+
|
1144
|
+
},{"./../utils":"7J9rV"}],"33sRR":[function(require,module,exports) {
|
1145
|
+
'use strict';
|
1146
|
+
|
1147
|
+
var utils = require('./../utils');
|
1148
|
+
|
1149
|
+
function InterceptorManager() {
|
1150
|
+
this.handlers = [];
|
1151
|
+
}
|
1152
|
+
|
1153
|
+
/**
|
1154
|
+
* Add a new interceptor to the stack
|
1155
|
+
*
|
1156
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
1157
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
1158
|
+
*
|
1159
|
+
* @return {Number} An ID used to remove interceptor later
|
1160
|
+
*/
|
1161
|
+
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
1162
|
+
this.handlers.push({
|
1163
|
+
fulfilled: fulfilled,
|
1164
|
+
rejected: rejected
|
1165
|
+
});
|
1166
|
+
return this.handlers.length - 1;
|
1167
|
+
};
|
1168
|
+
|
1169
|
+
/**
|
1170
|
+
* Remove an interceptor from the stack
|
1171
|
+
*
|
1172
|
+
* @param {Number} id The ID that was returned by `use`
|
1173
|
+
*/
|
1174
|
+
InterceptorManager.prototype.eject = function eject(id) {
|
1175
|
+
if (this.handlers[id]) {
|
1176
|
+
this.handlers[id] = null;
|
1177
|
+
}
|
1178
|
+
};
|
1179
|
+
|
1180
|
+
/**
|
1181
|
+
* Iterate over all the registered interceptors
|
1182
|
+
*
|
1183
|
+
* This method is particularly useful for skipping over any
|
1184
|
+
* interceptors that may have become `null` calling `eject`.
|
1185
|
+
*
|
1186
|
+
* @param {Function} fn The function to call for each interceptor
|
1187
|
+
*/
|
1188
|
+
InterceptorManager.prototype.forEach = function forEach(fn) {
|
1189
|
+
utils.forEach(this.handlers, function forEachHandler(h) {
|
1190
|
+
if (h !== null) {
|
1191
|
+
fn(h);
|
1192
|
+
}
|
1193
|
+
});
|
1194
|
+
};
|
1195
|
+
|
1196
|
+
module.exports = InterceptorManager;
|
1197
|
+
|
1198
|
+
},{"./../utils":"7J9rV"}],"1mCjo":[function(require,module,exports) {
|
1199
|
+
'use strict';
|
1200
|
+
|
1201
|
+
var utils = require('./../utils');
|
1202
|
+
var transformData = require('./transformData');
|
1203
|
+
var isCancel = require('../cancel/isCancel');
|
1204
|
+
var defaults = require('../defaults');
|
1205
|
+
|
1206
|
+
/**
|
1207
|
+
* Throws a `Cancel` if cancellation has been requested.
|
1208
|
+
*/
|
1209
|
+
function throwIfCancellationRequested(config) {
|
1210
|
+
if (config.cancelToken) {
|
1211
|
+
config.cancelToken.throwIfRequested();
|
1212
|
+
}
|
1213
|
+
}
|
1214
|
+
|
1215
|
+
/**
|
1216
|
+
* Dispatch a request to the server using the configured adapter.
|
1217
|
+
*
|
1218
|
+
* @param {object} config The config that is to be used for the request
|
1219
|
+
* @returns {Promise} The Promise to be fulfilled
|
1220
|
+
*/
|
1221
|
+
module.exports = function dispatchRequest(config) {
|
1222
|
+
throwIfCancellationRequested(config);
|
1223
|
+
|
1224
|
+
// Ensure headers exist
|
1225
|
+
config.headers = config.headers || {};
|
1226
|
+
|
1227
|
+
// Transform request data
|
1228
|
+
config.data = transformData(
|
1229
|
+
config.data,
|
1230
|
+
config.headers,
|
1231
|
+
config.transformRequest
|
1232
|
+
);
|
1233
|
+
|
1234
|
+
// Flatten headers
|
1235
|
+
config.headers = utils.merge(
|
1236
|
+
config.headers.common || {},
|
1237
|
+
config.headers[config.method] || {},
|
1238
|
+
config.headers
|
1239
|
+
);
|
1240
|
+
|
1241
|
+
utils.forEach(
|
1242
|
+
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
1243
|
+
function cleanHeaderConfig(method) {
|
1244
|
+
delete config.headers[method];
|
1245
|
+
}
|
1246
|
+
);
|
1247
|
+
|
1248
|
+
var adapter = config.adapter || defaults.adapter;
|
1249
|
+
|
1250
|
+
return adapter(config).then(function onAdapterResolution(response) {
|
1251
|
+
throwIfCancellationRequested(config);
|
1252
|
+
|
1253
|
+
// Transform response data
|
1254
|
+
response.data = transformData(
|
1255
|
+
response.data,
|
1256
|
+
response.headers,
|
1257
|
+
config.transformResponse
|
1258
|
+
);
|
1259
|
+
|
1260
|
+
return response;
|
1261
|
+
}, function onAdapterRejection(reason) {
|
1262
|
+
if (!isCancel(reason)) {
|
1263
|
+
throwIfCancellationRequested(config);
|
1264
|
+
|
1265
|
+
// Transform response data
|
1266
|
+
if (reason && reason.response) {
|
1267
|
+
reason.response.data = transformData(
|
1268
|
+
reason.response.data,
|
1269
|
+
reason.response.headers,
|
1270
|
+
config.transformResponse
|
1271
|
+
);
|
1272
|
+
}
|
1273
|
+
}
|
1274
|
+
|
1275
|
+
return Promise.reject(reason);
|
1276
|
+
});
|
1277
|
+
};
|
1278
|
+
|
1279
|
+
},{"./../utils":"7J9rV","./transformData":"1ueU6","../cancel/isCancel":"3MAgn","../defaults":"5j10E"}],"1ueU6":[function(require,module,exports) {
|
1280
|
+
'use strict';
|
1281
|
+
|
1282
|
+
var utils = require('./../utils');
|
1283
|
+
|
1284
|
+
/**
|
1285
|
+
* Transform the data for a request or a response
|
1286
|
+
*
|
1287
|
+
* @param {Object|String} data The data to be transformed
|
1288
|
+
* @param {Array} headers The headers for the request or response
|
1289
|
+
* @param {Array|Function} fns A single function or Array of functions
|
1290
|
+
* @returns {*} The resulting transformed data
|
1291
|
+
*/
|
1292
|
+
module.exports = function transformData(data, headers, fns) {
|
1293
|
+
/*eslint no-param-reassign:0*/
|
1294
|
+
utils.forEach(fns, function transform(fn) {
|
1295
|
+
data = fn(data, headers);
|
1296
|
+
});
|
1297
|
+
|
1298
|
+
return data;
|
1299
|
+
};
|
1300
|
+
|
1301
|
+
},{"./../utils":"7J9rV"}],"3MAgn":[function(require,module,exports) {
|
1302
|
+
'use strict';
|
1303
|
+
|
1304
|
+
module.exports = function isCancel(value) {
|
1305
|
+
return !!(value && value.__CANCEL__);
|
1306
|
+
};
|
1307
|
+
|
1308
|
+
},{}],"5j10E":[function(require,module,exports) {
|
1309
|
+
"use strict";
|
1310
|
+
var process = require("process");
|
1311
|
+
var utils = require('./utils');
|
1312
|
+
var normalizeHeaderName = require('./helpers/normalizeHeaderName');
|
1313
|
+
var DEFAULT_CONTENT_TYPE = {
|
1314
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
1315
|
+
};
|
1316
|
+
function setContentTypeIfUnset(headers, value) {
|
1317
|
+
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
1318
|
+
headers['Content-Type'] = value;
|
1319
|
+
}
|
1320
|
+
}
|
1321
|
+
function getDefaultAdapter() {
|
1322
|
+
var adapter;
|
1323
|
+
if (typeof XMLHttpRequest !== 'undefined') {
|
1324
|
+
// For browsers use XHR adapter
|
1325
|
+
adapter = require('./adapters/xhr');
|
1326
|
+
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
1327
|
+
// For node use HTTP adapter
|
1328
|
+
adapter = require('./adapters/http');
|
1329
|
+
}
|
1330
|
+
return adapter;
|
1331
|
+
}
|
1332
|
+
var defaults = {
|
1333
|
+
adapter: getDefaultAdapter(),
|
1334
|
+
transformRequest: [function transformRequest(data, headers) {
|
1335
|
+
normalizeHeaderName(headers, 'Accept');
|
1336
|
+
normalizeHeaderName(headers, 'Content-Type');
|
1337
|
+
if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) {
|
1338
|
+
return data;
|
1339
|
+
}
|
1340
|
+
if (utils.isArrayBufferView(data)) {
|
1341
|
+
return data.buffer;
|
1342
|
+
}
|
1343
|
+
if (utils.isURLSearchParams(data)) {
|
1344
|
+
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
1345
|
+
return data.toString();
|
1346
|
+
}
|
1347
|
+
if (utils.isObject(data)) {
|
1348
|
+
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
|
1349
|
+
return JSON.stringify(data);
|
1350
|
+
}
|
1351
|
+
return data;
|
1352
|
+
}],
|
1353
|
+
transformResponse: [function transformResponse(data) {
|
1354
|
+
/*eslint no-param-reassign:0*/
|
1355
|
+
if (typeof data === 'string') {
|
1356
|
+
try {
|
1357
|
+
data = JSON.parse(data);
|
1358
|
+
} catch (e) {}
|
1359
|
+
}
|
1360
|
+
return data;
|
1361
|
+
}],
|
1362
|
+
/**
|
1363
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
1364
|
+
* timeout is not created.
|
1365
|
+
*/
|
1366
|
+
timeout: 0,
|
1367
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
1368
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
1369
|
+
maxContentLength: -1,
|
1370
|
+
maxBodyLength: -1,
|
1371
|
+
validateStatus: function validateStatus(status) {
|
1372
|
+
return status >= 200 && status < 300;
|
1373
|
+
}
|
1374
|
+
};
|
1375
|
+
defaults.headers = {
|
1376
|
+
common: {
|
1377
|
+
'Accept': 'application/json, text/plain, */*'
|
1378
|
+
}
|
1379
|
+
};
|
1380
|
+
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
1381
|
+
defaults.headers[method] = {};
|
1382
|
+
});
|
1383
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
1384
|
+
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
1385
|
+
});
|
1386
|
+
module.exports = defaults;
|
1387
|
+
|
1388
|
+
},{"process":"7AgFc","./utils":"7J9rV","./helpers/normalizeHeaderName":"5yMqL","./adapters/xhr":"6pJqL","./adapters/http":"6pJqL"}],"7AgFc":[function(require,module,exports) {
|
1389
|
+
// shim for using process in browser
|
1390
|
+
var process = module.exports = {};
|
1391
|
+
// cached from whatever global is present so that test runners that stub it
|
1392
|
+
// don't break things. But we need to wrap it in a try catch in case it is
|
1393
|
+
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
1394
|
+
// function because try/catches deoptimize in certain engines.
|
1395
|
+
var cachedSetTimeout;
|
1396
|
+
var cachedClearTimeout;
|
1397
|
+
function defaultSetTimout() {
|
1398
|
+
throw new Error('setTimeout has not been defined');
|
1399
|
+
}
|
1400
|
+
function defaultClearTimeout() {
|
1401
|
+
throw new Error('clearTimeout has not been defined');
|
1402
|
+
}
|
1403
|
+
(function () {
|
1404
|
+
try {
|
1405
|
+
if (typeof setTimeout === 'function') {
|
1406
|
+
cachedSetTimeout = setTimeout;
|
1407
|
+
} else {
|
1408
|
+
cachedSetTimeout = defaultSetTimout;
|
1409
|
+
}
|
1410
|
+
} catch (e) {
|
1411
|
+
cachedSetTimeout = defaultSetTimout;
|
1412
|
+
}
|
1413
|
+
try {
|
1414
|
+
if (typeof clearTimeout === 'function') {
|
1415
|
+
cachedClearTimeout = clearTimeout;
|
1416
|
+
} else {
|
1417
|
+
cachedClearTimeout = defaultClearTimeout;
|
1418
|
+
}
|
1419
|
+
} catch (e) {
|
1420
|
+
cachedClearTimeout = defaultClearTimeout;
|
1421
|
+
}
|
1422
|
+
})();
|
1423
|
+
function runTimeout(fun) {
|
1424
|
+
if (cachedSetTimeout === setTimeout) {
|
1425
|
+
// normal enviroments in sane situations
|
1426
|
+
return setTimeout(fun, 0);
|
1427
|
+
}
|
1428
|
+
// if setTimeout wasn't available but was latter defined
|
1429
|
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
1430
|
+
cachedSetTimeout = setTimeout;
|
1431
|
+
return setTimeout(fun, 0);
|
1432
|
+
}
|
1433
|
+
try {
|
1434
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
1435
|
+
return cachedSetTimeout(fun, 0);
|
1436
|
+
} catch (e) {
|
1437
|
+
try {
|
1438
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
1439
|
+
return cachedSetTimeout.call(null, fun, 0);
|
1440
|
+
} catch (e) {
|
1441
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
1442
|
+
return cachedSetTimeout.call(this, fun, 0);
|
1443
|
+
}
|
1444
|
+
}
|
1445
|
+
}
|
1446
|
+
function runClearTimeout(marker) {
|
1447
|
+
if (cachedClearTimeout === clearTimeout) {
|
1448
|
+
// normal enviroments in sane situations
|
1449
|
+
return clearTimeout(marker);
|
1450
|
+
}
|
1451
|
+
// if clearTimeout wasn't available but was latter defined
|
1452
|
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
1453
|
+
cachedClearTimeout = clearTimeout;
|
1454
|
+
return clearTimeout(marker);
|
1455
|
+
}
|
1456
|
+
try {
|
1457
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
1458
|
+
return cachedClearTimeout(marker);
|
1459
|
+
} catch (e) {
|
1460
|
+
try {
|
1461
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
1462
|
+
return cachedClearTimeout.call(null, marker);
|
1463
|
+
} catch (e) {
|
1464
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
1465
|
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
1466
|
+
return cachedClearTimeout.call(this, marker);
|
1467
|
+
}
|
1468
|
+
}
|
1469
|
+
}
|
1470
|
+
var queue = [];
|
1471
|
+
var draining = false;
|
1472
|
+
var currentQueue;
|
1473
|
+
var queueIndex = -1;
|
1474
|
+
function cleanUpNextTick() {
|
1475
|
+
if (!draining || !currentQueue) {
|
1476
|
+
return;
|
1477
|
+
}
|
1478
|
+
draining = false;
|
1479
|
+
if (currentQueue.length) {
|
1480
|
+
queue = currentQueue.concat(queue);
|
1481
|
+
} else {
|
1482
|
+
queueIndex = -1;
|
1483
|
+
}
|
1484
|
+
if (queue.length) {
|
1485
|
+
drainQueue();
|
1486
|
+
}
|
1487
|
+
}
|
1488
|
+
function drainQueue() {
|
1489
|
+
if (draining) {
|
1490
|
+
return;
|
1491
|
+
}
|
1492
|
+
var timeout = runTimeout(cleanUpNextTick);
|
1493
|
+
draining = true;
|
1494
|
+
var len = queue.length;
|
1495
|
+
while (len) {
|
1496
|
+
currentQueue = queue;
|
1497
|
+
queue = [];
|
1498
|
+
while (++queueIndex < len) {
|
1499
|
+
if (currentQueue) {
|
1500
|
+
currentQueue[queueIndex].run();
|
1501
|
+
}
|
1502
|
+
}
|
1503
|
+
queueIndex = -1;
|
1504
|
+
len = queue.length;
|
1505
|
+
}
|
1506
|
+
currentQueue = null;
|
1507
|
+
draining = false;
|
1508
|
+
runClearTimeout(timeout);
|
1509
|
+
}
|
1510
|
+
process.nextTick = function (fun) {
|
1511
|
+
var args = new Array(arguments.length - 1);
|
1512
|
+
if (arguments.length > 1) {
|
1513
|
+
for (var i = 1; i < arguments.length; i++) {
|
1514
|
+
args[i - 1] = arguments[i];
|
1515
|
+
}
|
1516
|
+
}
|
1517
|
+
queue.push(new Item(fun, args));
|
1518
|
+
if (queue.length === 1 && !draining) {
|
1519
|
+
runTimeout(drainQueue);
|
1520
|
+
}
|
1521
|
+
};
|
1522
|
+
// v8 likes predictible objects
|
1523
|
+
function Item(fun, array) {
|
1524
|
+
this.fun = fun;
|
1525
|
+
this.array = array;
|
1526
|
+
}
|
1527
|
+
Item.prototype.run = function () {
|
1528
|
+
this.fun.apply(null, this.array);
|
1529
|
+
};
|
1530
|
+
process.title = 'browser';
|
1531
|
+
process.browser = true;
|
1532
|
+
process.env = {};
|
1533
|
+
process.argv = [];
|
1534
|
+
process.version = '';
|
1535
|
+
// empty string to avoid regexp issues
|
1536
|
+
process.versions = {};
|
1537
|
+
function noop() {}
|
1538
|
+
process.on = noop;
|
1539
|
+
process.addListener = noop;
|
1540
|
+
process.once = noop;
|
1541
|
+
process.off = noop;
|
1542
|
+
process.removeListener = noop;
|
1543
|
+
process.removeAllListeners = noop;
|
1544
|
+
process.emit = noop;
|
1545
|
+
process.prependListener = noop;
|
1546
|
+
process.prependOnceListener = noop;
|
1547
|
+
process.listeners = function (name) {
|
1548
|
+
return [];
|
1549
|
+
};
|
1550
|
+
process.binding = function (name) {
|
1551
|
+
throw new Error('process.binding is not supported');
|
1552
|
+
};
|
1553
|
+
process.cwd = function () {
|
1554
|
+
return '/';
|
1555
|
+
};
|
1556
|
+
process.chdir = function (dir) {
|
1557
|
+
throw new Error('process.chdir is not supported');
|
1558
|
+
};
|
1559
|
+
process.umask = function () {
|
1560
|
+
return 0;
|
1561
|
+
};
|
1562
|
+
|
1563
|
+
},{}],"5yMqL":[function(require,module,exports) {
|
1564
|
+
'use strict';
|
1565
|
+
|
1566
|
+
var utils = require('../utils');
|
1567
|
+
|
1568
|
+
module.exports = function normalizeHeaderName(headers, normalizedName) {
|
1569
|
+
utils.forEach(headers, function processHeader(value, name) {
|
1570
|
+
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
1571
|
+
headers[normalizedName] = value;
|
1572
|
+
delete headers[name];
|
1573
|
+
}
|
1574
|
+
});
|
1575
|
+
};
|
1576
|
+
|
1577
|
+
},{"../utils":"7J9rV"}],"6pJqL":[function(require,module,exports) {
|
1578
|
+
'use strict';
|
1579
|
+
|
1580
|
+
var utils = require('./../utils');
|
1581
|
+
var settle = require('./../core/settle');
|
1582
|
+
var cookies = require('./../helpers/cookies');
|
1583
|
+
var buildURL = require('./../helpers/buildURL');
|
1584
|
+
var buildFullPath = require('../core/buildFullPath');
|
1585
|
+
var parseHeaders = require('./../helpers/parseHeaders');
|
1586
|
+
var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
|
1587
|
+
var createError = require('../core/createError');
|
1588
|
+
|
1589
|
+
module.exports = function xhrAdapter(config) {
|
1590
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
1591
|
+
var requestData = config.data;
|
1592
|
+
var requestHeaders = config.headers;
|
1593
|
+
|
1594
|
+
if (utils.isFormData(requestData)) {
|
1595
|
+
delete requestHeaders['Content-Type']; // Let the browser set it
|
1596
|
+
}
|
1597
|
+
|
1598
|
+
var request = new XMLHttpRequest();
|
1599
|
+
|
1600
|
+
// HTTP basic authentication
|
1601
|
+
if (config.auth) {
|
1602
|
+
var username = config.auth.username || '';
|
1603
|
+
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
1604
|
+
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
1605
|
+
}
|
1606
|
+
|
1607
|
+
var fullPath = buildFullPath(config.baseURL, config.url);
|
1608
|
+
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
1609
|
+
|
1610
|
+
// Set the request timeout in MS
|
1611
|
+
request.timeout = config.timeout;
|
1612
|
+
|
1613
|
+
// Listen for ready state
|
1614
|
+
request.onreadystatechange = function handleLoad() {
|
1615
|
+
if (!request || request.readyState !== 4) {
|
1616
|
+
return;
|
1617
|
+
}
|
1618
|
+
|
1619
|
+
// The request errored out and we didn't get a response, this will be
|
1620
|
+
// handled by onerror instead
|
1621
|
+
// With one exception: request that using file: protocol, most browsers
|
1622
|
+
// will return status as 0 even though it's a successful request
|
1623
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
1624
|
+
return;
|
1625
|
+
}
|
1626
|
+
|
1627
|
+
// Prepare the response
|
1628
|
+
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
1629
|
+
var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
|
1630
|
+
var response = {
|
1631
|
+
data: responseData,
|
1632
|
+
status: request.status,
|
1633
|
+
statusText: request.statusText,
|
1634
|
+
headers: responseHeaders,
|
1635
|
+
config: config,
|
1636
|
+
request: request
|
1637
|
+
};
|
1638
|
+
|
1639
|
+
settle(resolve, reject, response);
|
1640
|
+
|
1641
|
+
// Clean up request
|
1642
|
+
request = null;
|
1643
|
+
};
|
1644
|
+
|
1645
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
1646
|
+
request.onabort = function handleAbort() {
|
1647
|
+
if (!request) {
|
1648
|
+
return;
|
1649
|
+
}
|
1650
|
+
|
1651
|
+
reject(createError('Request aborted', config, 'ECONNABORTED', request));
|
1652
|
+
|
1653
|
+
// Clean up request
|
1654
|
+
request = null;
|
1655
|
+
};
|
1656
|
+
|
1657
|
+
// Handle low level network errors
|
1658
|
+
request.onerror = function handleError() {
|
1659
|
+
// Real errors are hidden from us by the browser
|
1660
|
+
// onerror should only fire if it's a network error
|
1661
|
+
reject(createError('Network Error', config, null, request));
|
1662
|
+
|
1663
|
+
// Clean up request
|
1664
|
+
request = null;
|
1665
|
+
};
|
1666
|
+
|
1667
|
+
// Handle timeout
|
1668
|
+
request.ontimeout = function handleTimeout() {
|
1669
|
+
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
1670
|
+
if (config.timeoutErrorMessage) {
|
1671
|
+
timeoutErrorMessage = config.timeoutErrorMessage;
|
1672
|
+
}
|
1673
|
+
reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
|
1674
|
+
request));
|
1675
|
+
|
1676
|
+
// Clean up request
|
1677
|
+
request = null;
|
1678
|
+
};
|
1679
|
+
|
1680
|
+
// Add xsrf header
|
1681
|
+
// This is only done if running in a standard browser environment.
|
1682
|
+
// Specifically not if we're in a web worker, or react-native.
|
1683
|
+
if (utils.isStandardBrowserEnv()) {
|
1684
|
+
// Add xsrf header
|
1685
|
+
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
|
1686
|
+
cookies.read(config.xsrfCookieName) :
|
1687
|
+
undefined;
|
1688
|
+
|
1689
|
+
if (xsrfValue) {
|
1690
|
+
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
1691
|
+
}
|
1692
|
+
}
|
1693
|
+
|
1694
|
+
// Add headers to the request
|
1695
|
+
if ('setRequestHeader' in request) {
|
1696
|
+
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
1697
|
+
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
|
1698
|
+
// Remove Content-Type if data is undefined
|
1699
|
+
delete requestHeaders[key];
|
1700
|
+
} else {
|
1701
|
+
// Otherwise add header to the request
|
1702
|
+
request.setRequestHeader(key, val);
|
1703
|
+
}
|
1704
|
+
});
|
1705
|
+
}
|
1706
|
+
|
1707
|
+
// Add withCredentials to request if needed
|
1708
|
+
if (!utils.isUndefined(config.withCredentials)) {
|
1709
|
+
request.withCredentials = !!config.withCredentials;
|
1710
|
+
}
|
1711
|
+
|
1712
|
+
// Add responseType to request if needed
|
1713
|
+
if (config.responseType) {
|
1714
|
+
try {
|
1715
|
+
request.responseType = config.responseType;
|
1716
|
+
} catch (e) {
|
1717
|
+
// Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
|
1718
|
+
// But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
|
1719
|
+
if (config.responseType !== 'json') {
|
1720
|
+
throw e;
|
1721
|
+
}
|
1722
|
+
}
|
1723
|
+
}
|
1724
|
+
|
1725
|
+
// Handle progress if needed
|
1726
|
+
if (typeof config.onDownloadProgress === 'function') {
|
1727
|
+
request.addEventListener('progress', config.onDownloadProgress);
|
1728
|
+
}
|
1729
|
+
|
1730
|
+
// Not all browsers support upload events
|
1731
|
+
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
1732
|
+
request.upload.addEventListener('progress', config.onUploadProgress);
|
1733
|
+
}
|
1734
|
+
|
1735
|
+
if (config.cancelToken) {
|
1736
|
+
// Handle cancellation
|
1737
|
+
config.cancelToken.promise.then(function onCanceled(cancel) {
|
1738
|
+
if (!request) {
|
1739
|
+
return;
|
1740
|
+
}
|
1741
|
+
|
1742
|
+
request.abort();
|
1743
|
+
reject(cancel);
|
1744
|
+
// Clean up request
|
1745
|
+
request = null;
|
1746
|
+
});
|
1747
|
+
}
|
1748
|
+
|
1749
|
+
if (!requestData) {
|
1750
|
+
requestData = null;
|
1751
|
+
}
|
1752
|
+
|
1753
|
+
// Send the request
|
1754
|
+
request.send(requestData);
|
1755
|
+
});
|
1756
|
+
};
|
1757
|
+
|
1758
|
+
},{"./../utils":"7J9rV","./../core/settle":"72M6J","./../helpers/cookies":"1m0F1","./../helpers/buildURL":"25KfR","../core/buildFullPath":"5fWja","./../helpers/parseHeaders":"1KizL","./../helpers/isURLSameOrigin":"6Gtz3","../core/createError":"7ETv1"}],"72M6J":[function(require,module,exports) {
|
1759
|
+
'use strict';
|
1760
|
+
|
1761
|
+
var createError = require('./createError');
|
1762
|
+
|
1763
|
+
/**
|
1764
|
+
* Resolve or reject a Promise based on response status.
|
1765
|
+
*
|
1766
|
+
* @param {Function} resolve A function that resolves the promise.
|
1767
|
+
* @param {Function} reject A function that rejects the promise.
|
1768
|
+
* @param {object} response The response.
|
1769
|
+
*/
|
1770
|
+
module.exports = function settle(resolve, reject, response) {
|
1771
|
+
var validateStatus = response.config.validateStatus;
|
1772
|
+
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
1773
|
+
resolve(response);
|
1774
|
+
} else {
|
1775
|
+
reject(createError(
|
1776
|
+
'Request failed with status code ' + response.status,
|
1777
|
+
response.config,
|
1778
|
+
null,
|
1779
|
+
response.request,
|
1780
|
+
response
|
1781
|
+
));
|
1782
|
+
}
|
1783
|
+
};
|
1784
|
+
|
1785
|
+
},{"./createError":"7ETv1"}],"7ETv1":[function(require,module,exports) {
|
1786
|
+
'use strict';
|
1787
|
+
|
1788
|
+
var enhanceError = require('./enhanceError');
|
1789
|
+
|
1790
|
+
/**
|
1791
|
+
* Create an Error with the specified message, config, error code, request and response.
|
1792
|
+
*
|
1793
|
+
* @param {string} message The error message.
|
1794
|
+
* @param {Object} config The config.
|
1795
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
1796
|
+
* @param {Object} [request] The request.
|
1797
|
+
* @param {Object} [response] The response.
|
1798
|
+
* @returns {Error} The created error.
|
1799
|
+
*/
|
1800
|
+
module.exports = function createError(message, config, code, request, response) {
|
1801
|
+
var error = new Error(message);
|
1802
|
+
return enhanceError(error, config, code, request, response);
|
1803
|
+
};
|
1804
|
+
|
1805
|
+
},{"./enhanceError":"2O2Ud"}],"2O2Ud":[function(require,module,exports) {
|
1806
|
+
'use strict';
|
1807
|
+
|
1808
|
+
/**
|
1809
|
+
* Update an Error with the specified config, error code, and response.
|
1810
|
+
*
|
1811
|
+
* @param {Error} error The error to update.
|
1812
|
+
* @param {Object} config The config.
|
1813
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
1814
|
+
* @param {Object} [request] The request.
|
1815
|
+
* @param {Object} [response] The response.
|
1816
|
+
* @returns {Error} The error.
|
1817
|
+
*/
|
1818
|
+
module.exports = function enhanceError(error, config, code, request, response) {
|
1819
|
+
error.config = config;
|
1820
|
+
if (code) {
|
1821
|
+
error.code = code;
|
1822
|
+
}
|
1823
|
+
|
1824
|
+
error.request = request;
|
1825
|
+
error.response = response;
|
1826
|
+
error.isAxiosError = true;
|
1827
|
+
|
1828
|
+
error.toJSON = function toJSON() {
|
1829
|
+
return {
|
1830
|
+
// Standard
|
1831
|
+
message: this.message,
|
1832
|
+
name: this.name,
|
1833
|
+
// Microsoft
|
1834
|
+
description: this.description,
|
1835
|
+
number: this.number,
|
1836
|
+
// Mozilla
|
1837
|
+
fileName: this.fileName,
|
1838
|
+
lineNumber: this.lineNumber,
|
1839
|
+
columnNumber: this.columnNumber,
|
1840
|
+
stack: this.stack,
|
1841
|
+
// Axios
|
1842
|
+
config: this.config,
|
1843
|
+
code: this.code
|
1844
|
+
};
|
1845
|
+
};
|
1846
|
+
return error;
|
1847
|
+
};
|
1848
|
+
|
1849
|
+
},{}],"1m0F1":[function(require,module,exports) {
|
1850
|
+
'use strict';
|
1851
|
+
|
1852
|
+
var utils = require('./../utils');
|
1853
|
+
|
1854
|
+
module.exports = (
|
1855
|
+
utils.isStandardBrowserEnv() ?
|
1856
|
+
|
1857
|
+
// Standard browser envs support document.cookie
|
1858
|
+
(function standardBrowserEnv() {
|
1859
|
+
return {
|
1860
|
+
write: function write(name, value, expires, path, domain, secure) {
|
1861
|
+
var cookie = [];
|
1862
|
+
cookie.push(name + '=' + encodeURIComponent(value));
|
1863
|
+
|
1864
|
+
if (utils.isNumber(expires)) {
|
1865
|
+
cookie.push('expires=' + new Date(expires).toGMTString());
|
1866
|
+
}
|
1867
|
+
|
1868
|
+
if (utils.isString(path)) {
|
1869
|
+
cookie.push('path=' + path);
|
1870
|
+
}
|
1871
|
+
|
1872
|
+
if (utils.isString(domain)) {
|
1873
|
+
cookie.push('domain=' + domain);
|
1874
|
+
}
|
1875
|
+
|
1876
|
+
if (secure === true) {
|
1877
|
+
cookie.push('secure');
|
1878
|
+
}
|
1879
|
+
|
1880
|
+
document.cookie = cookie.join('; ');
|
1881
|
+
},
|
1882
|
+
|
1883
|
+
read: function read(name) {
|
1884
|
+
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
1885
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
1886
|
+
},
|
1887
|
+
|
1888
|
+
remove: function remove(name) {
|
1889
|
+
this.write(name, '', Date.now() - 86400000);
|
1890
|
+
}
|
1891
|
+
};
|
1892
|
+
})() :
|
1893
|
+
|
1894
|
+
// Non standard browser env (web workers, react-native) lack needed support.
|
1895
|
+
(function nonStandardBrowserEnv() {
|
1896
|
+
return {
|
1897
|
+
write: function write() {},
|
1898
|
+
read: function read() { return null; },
|
1899
|
+
remove: function remove() {}
|
1900
|
+
};
|
1901
|
+
})()
|
1902
|
+
);
|
1903
|
+
|
1904
|
+
},{"./../utils":"7J9rV"}],"5fWja":[function(require,module,exports) {
|
1905
|
+
'use strict';
|
1906
|
+
|
1907
|
+
var isAbsoluteURL = require('../helpers/isAbsoluteURL');
|
1908
|
+
var combineURLs = require('../helpers/combineURLs');
|
1909
|
+
|
1910
|
+
/**
|
1911
|
+
* Creates a new URL by combining the baseURL with the requestedURL,
|
1912
|
+
* only when the requestedURL is not already an absolute URL.
|
1913
|
+
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
1914
|
+
*
|
1915
|
+
* @param {string} baseURL The base URL
|
1916
|
+
* @param {string} requestedURL Absolute or relative URL to combine
|
1917
|
+
* @returns {string} The combined full path
|
1918
|
+
*/
|
1919
|
+
module.exports = function buildFullPath(baseURL, requestedURL) {
|
1920
|
+
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
1921
|
+
return combineURLs(baseURL, requestedURL);
|
1922
|
+
}
|
1923
|
+
return requestedURL;
|
1924
|
+
};
|
1925
|
+
|
1926
|
+
},{"../helpers/isAbsoluteURL":"4FcN1","../helpers/combineURLs":"qMap4"}],"4FcN1":[function(require,module,exports) {
|
1927
|
+
'use strict';
|
1928
|
+
|
1929
|
+
/**
|
1930
|
+
* Determines whether the specified URL is absolute
|
1931
|
+
*
|
1932
|
+
* @param {string} url The URL to test
|
1933
|
+
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
1934
|
+
*/
|
1935
|
+
module.exports = function isAbsoluteURL(url) {
|
1936
|
+
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
1937
|
+
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
1938
|
+
// by any combination of letters, digits, plus, period, or hyphen.
|
1939
|
+
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
1940
|
+
};
|
1941
|
+
|
1942
|
+
},{}],"qMap4":[function(require,module,exports) {
|
1943
|
+
'use strict';
|
1944
|
+
|
1945
|
+
/**
|
1946
|
+
* Creates a new URL by combining the specified URLs
|
1947
|
+
*
|
1948
|
+
* @param {string} baseURL The base URL
|
1949
|
+
* @param {string} relativeURL The relative URL
|
1950
|
+
* @returns {string} The combined URL
|
1951
|
+
*/
|
1952
|
+
module.exports = function combineURLs(baseURL, relativeURL) {
|
1953
|
+
return relativeURL
|
1954
|
+
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
1955
|
+
: baseURL;
|
1956
|
+
};
|
1957
|
+
|
1958
|
+
},{}],"1KizL":[function(require,module,exports) {
|
1959
|
+
'use strict';
|
1960
|
+
|
1961
|
+
var utils = require('./../utils');
|
1962
|
+
|
1963
|
+
// Headers whose duplicates are ignored by node
|
1964
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
1965
|
+
var ignoreDuplicateOf = [
|
1966
|
+
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
1967
|
+
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
1968
|
+
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
1969
|
+
'referer', 'retry-after', 'user-agent'
|
1970
|
+
];
|
1971
|
+
|
1972
|
+
/**
|
1973
|
+
* Parse headers into an object
|
1974
|
+
*
|
1975
|
+
* ```
|
1976
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
1977
|
+
* Content-Type: application/json
|
1978
|
+
* Connection: keep-alive
|
1979
|
+
* Transfer-Encoding: chunked
|
1980
|
+
* ```
|
1981
|
+
*
|
1982
|
+
* @param {String} headers Headers needing to be parsed
|
1983
|
+
* @returns {Object} Headers parsed into an object
|
1984
|
+
*/
|
1985
|
+
module.exports = function parseHeaders(headers) {
|
1986
|
+
var parsed = {};
|
1987
|
+
var key;
|
1988
|
+
var val;
|
1989
|
+
var i;
|
1990
|
+
|
1991
|
+
if (!headers) { return parsed; }
|
1992
|
+
|
1993
|
+
utils.forEach(headers.split('\n'), function parser(line) {
|
1994
|
+
i = line.indexOf(':');
|
1995
|
+
key = utils.trim(line.substr(0, i)).toLowerCase();
|
1996
|
+
val = utils.trim(line.substr(i + 1));
|
1997
|
+
|
1998
|
+
if (key) {
|
1999
|
+
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
2000
|
+
return;
|
2001
|
+
}
|
2002
|
+
if (key === 'set-cookie') {
|
2003
|
+
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
2004
|
+
} else {
|
2005
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
2006
|
+
}
|
2007
|
+
}
|
2008
|
+
});
|
2009
|
+
|
2010
|
+
return parsed;
|
2011
|
+
};
|
2012
|
+
|
2013
|
+
},{"./../utils":"7J9rV"}],"6Gtz3":[function(require,module,exports) {
|
2014
|
+
'use strict';
|
2015
|
+
|
2016
|
+
var utils = require('./../utils');
|
2017
|
+
|
2018
|
+
module.exports = (
|
2019
|
+
utils.isStandardBrowserEnv() ?
|
2020
|
+
|
2021
|
+
// Standard browser envs have full support of the APIs needed to test
|
2022
|
+
// whether the request URL is of the same origin as current location.
|
2023
|
+
(function standardBrowserEnv() {
|
2024
|
+
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
2025
|
+
var urlParsingNode = document.createElement('a');
|
2026
|
+
var originURL;
|
2027
|
+
|
2028
|
+
/**
|
2029
|
+
* Parse a URL to discover it's components
|
2030
|
+
*
|
2031
|
+
* @param {String} url The URL to be parsed
|
2032
|
+
* @returns {Object}
|
2033
|
+
*/
|
2034
|
+
function resolveURL(url) {
|
2035
|
+
var href = url;
|
2036
|
+
|
2037
|
+
if (msie) {
|
2038
|
+
// IE needs attribute set twice to normalize properties
|
2039
|
+
urlParsingNode.setAttribute('href', href);
|
2040
|
+
href = urlParsingNode.href;
|
2041
|
+
}
|
2042
|
+
|
2043
|
+
urlParsingNode.setAttribute('href', href);
|
2044
|
+
|
2045
|
+
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
2046
|
+
return {
|
2047
|
+
href: urlParsingNode.href,
|
2048
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
2049
|
+
host: urlParsingNode.host,
|
2050
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
2051
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
2052
|
+
hostname: urlParsingNode.hostname,
|
2053
|
+
port: urlParsingNode.port,
|
2054
|
+
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
2055
|
+
urlParsingNode.pathname :
|
2056
|
+
'/' + urlParsingNode.pathname
|
2057
|
+
};
|
2058
|
+
}
|
2059
|
+
|
2060
|
+
originURL = resolveURL(window.location.href);
|
2061
|
+
|
2062
|
+
/**
|
2063
|
+
* Determine if a URL shares the same origin as the current location
|
2064
|
+
*
|
2065
|
+
* @param {String} requestURL The URL to test
|
2066
|
+
* @returns {boolean} True if URL shares the same origin, otherwise false
|
2067
|
+
*/
|
2068
|
+
return function isURLSameOrigin(requestURL) {
|
2069
|
+
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
2070
|
+
return (parsed.protocol === originURL.protocol &&
|
2071
|
+
parsed.host === originURL.host);
|
2072
|
+
};
|
2073
|
+
})() :
|
2074
|
+
|
2075
|
+
// Non standard browser envs (web workers, react-native) lack needed support.
|
2076
|
+
(function nonStandardBrowserEnv() {
|
2077
|
+
return function isURLSameOrigin() {
|
2078
|
+
return true;
|
2079
|
+
};
|
2080
|
+
})()
|
2081
|
+
);
|
2082
|
+
|
2083
|
+
},{"./../utils":"7J9rV"}],"42z1a":[function(require,module,exports) {
|
2084
|
+
'use strict';
|
2085
|
+
|
2086
|
+
var utils = require('../utils');
|
2087
|
+
|
2088
|
+
/**
|
2089
|
+
* Config-specific merge-function which creates a new config-object
|
2090
|
+
* by merging two configuration objects together.
|
2091
|
+
*
|
2092
|
+
* @param {Object} config1
|
2093
|
+
* @param {Object} config2
|
2094
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
2095
|
+
*/
|
2096
|
+
module.exports = function mergeConfig(config1, config2) {
|
2097
|
+
// eslint-disable-next-line no-param-reassign
|
2098
|
+
config2 = config2 || {};
|
2099
|
+
var config = {};
|
2100
|
+
|
2101
|
+
var valueFromConfig2Keys = ['url', 'method', 'data'];
|
2102
|
+
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
|
2103
|
+
var defaultToConfig2Keys = [
|
2104
|
+
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
2105
|
+
'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
2106
|
+
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
|
2107
|
+
'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
|
2108
|
+
'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
|
2109
|
+
];
|
2110
|
+
var directMergeKeys = ['validateStatus'];
|
2111
|
+
|
2112
|
+
function getMergedValue(target, source) {
|
2113
|
+
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
2114
|
+
return utils.merge(target, source);
|
2115
|
+
} else if (utils.isPlainObject(source)) {
|
2116
|
+
return utils.merge({}, source);
|
2117
|
+
} else if (utils.isArray(source)) {
|
2118
|
+
return source.slice();
|
2119
|
+
}
|
2120
|
+
return source;
|
2121
|
+
}
|
2122
|
+
|
2123
|
+
function mergeDeepProperties(prop) {
|
2124
|
+
if (!utils.isUndefined(config2[prop])) {
|
2125
|
+
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
2126
|
+
} else if (!utils.isUndefined(config1[prop])) {
|
2127
|
+
config[prop] = getMergedValue(undefined, config1[prop]);
|
2128
|
+
}
|
2129
|
+
}
|
2130
|
+
|
2131
|
+
utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
|
2132
|
+
if (!utils.isUndefined(config2[prop])) {
|
2133
|
+
config[prop] = getMergedValue(undefined, config2[prop]);
|
2134
|
+
}
|
2135
|
+
});
|
2136
|
+
|
2137
|
+
utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
2138
|
+
|
2139
|
+
utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
|
2140
|
+
if (!utils.isUndefined(config2[prop])) {
|
2141
|
+
config[prop] = getMergedValue(undefined, config2[prop]);
|
2142
|
+
} else if (!utils.isUndefined(config1[prop])) {
|
2143
|
+
config[prop] = getMergedValue(undefined, config1[prop]);
|
2144
|
+
}
|
2145
|
+
});
|
2146
|
+
|
2147
|
+
utils.forEach(directMergeKeys, function merge(prop) {
|
2148
|
+
if (prop in config2) {
|
2149
|
+
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
2150
|
+
} else if (prop in config1) {
|
2151
|
+
config[prop] = getMergedValue(undefined, config1[prop]);
|
2152
|
+
}
|
2153
|
+
});
|
2154
|
+
|
2155
|
+
var axiosKeys = valueFromConfig2Keys
|
2156
|
+
.concat(mergeDeepPropertiesKeys)
|
2157
|
+
.concat(defaultToConfig2Keys)
|
2158
|
+
.concat(directMergeKeys);
|
2159
|
+
|
2160
|
+
var otherKeys = Object
|
2161
|
+
.keys(config1)
|
2162
|
+
.concat(Object.keys(config2))
|
2163
|
+
.filter(function filterAxiosKeys(key) {
|
2164
|
+
return axiosKeys.indexOf(key) === -1;
|
2165
|
+
});
|
2166
|
+
|
2167
|
+
utils.forEach(otherKeys, mergeDeepProperties);
|
2168
|
+
|
2169
|
+
return config;
|
2170
|
+
};
|
2171
|
+
|
2172
|
+
},{"../utils":"7J9rV"}],"1Ql7i":[function(require,module,exports) {
|
2173
|
+
'use strict';
|
2174
|
+
|
2175
|
+
/**
|
2176
|
+
* A `Cancel` is an object that is thrown when an operation is canceled.
|
2177
|
+
*
|
2178
|
+
* @class
|
2179
|
+
* @param {string=} message The message.
|
2180
|
+
*/
|
2181
|
+
function Cancel(message) {
|
2182
|
+
this.message = message;
|
2183
|
+
}
|
2184
|
+
|
2185
|
+
Cancel.prototype.toString = function toString() {
|
2186
|
+
return 'Cancel' + (this.message ? ': ' + this.message : '');
|
2187
|
+
};
|
2188
|
+
|
2189
|
+
Cancel.prototype.__CANCEL__ = true;
|
2190
|
+
|
2191
|
+
module.exports = Cancel;
|
2192
|
+
|
2193
|
+
},{}],"hHamf":[function(require,module,exports) {
|
2194
|
+
'use strict';
|
2195
|
+
|
2196
|
+
var Cancel = require('./Cancel');
|
2197
|
+
|
2198
|
+
/**
|
2199
|
+
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
2200
|
+
*
|
2201
|
+
* @class
|
2202
|
+
* @param {Function} executor The executor function.
|
2203
|
+
*/
|
2204
|
+
function CancelToken(executor) {
|
2205
|
+
if (typeof executor !== 'function') {
|
2206
|
+
throw new TypeError('executor must be a function.');
|
2207
|
+
}
|
2208
|
+
|
2209
|
+
var resolvePromise;
|
2210
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
2211
|
+
resolvePromise = resolve;
|
2212
|
+
});
|
2213
|
+
|
2214
|
+
var token = this;
|
2215
|
+
executor(function cancel(message) {
|
2216
|
+
if (token.reason) {
|
2217
|
+
// Cancellation has already been requested
|
2218
|
+
return;
|
2219
|
+
}
|
2220
|
+
|
2221
|
+
token.reason = new Cancel(message);
|
2222
|
+
resolvePromise(token.reason);
|
2223
|
+
});
|
2224
|
+
}
|
2225
|
+
|
2226
|
+
/**
|
2227
|
+
* Throws a `Cancel` if cancellation has been requested.
|
2228
|
+
*/
|
2229
|
+
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
2230
|
+
if (this.reason) {
|
2231
|
+
throw this.reason;
|
2232
|
+
}
|
2233
|
+
};
|
2234
|
+
|
2235
|
+
/**
|
2236
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
2237
|
+
* cancels the `CancelToken`.
|
2238
|
+
*/
|
2239
|
+
CancelToken.source = function source() {
|
2240
|
+
var cancel;
|
2241
|
+
var token = new CancelToken(function executor(c) {
|
2242
|
+
cancel = c;
|
2243
|
+
});
|
2244
|
+
return {
|
2245
|
+
token: token,
|
2246
|
+
cancel: cancel
|
2247
|
+
};
|
2248
|
+
};
|
2249
|
+
|
2250
|
+
module.exports = CancelToken;
|
2251
|
+
|
2252
|
+
},{"./Cancel":"1Ql7i"}],"9FoXt":[function(require,module,exports) {
|
2253
|
+
'use strict';
|
2254
|
+
|
2255
|
+
/**
|
2256
|
+
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
2257
|
+
*
|
2258
|
+
* Common use case would be to use `Function.prototype.apply`.
|
2259
|
+
*
|
2260
|
+
* ```js
|
2261
|
+
* function f(x, y, z) {}
|
2262
|
+
* var args = [1, 2, 3];
|
2263
|
+
* f.apply(null, args);
|
2264
|
+
* ```
|
2265
|
+
*
|
2266
|
+
* With `spread` this example can be re-written.
|
2267
|
+
*
|
2268
|
+
* ```js
|
2269
|
+
* spread(function(x, y, z) {})([1, 2, 3]);
|
2270
|
+
* ```
|
2271
|
+
*
|
2272
|
+
* @param {Function} callback
|
2273
|
+
* @returns {Function}
|
2274
|
+
*/
|
2275
|
+
module.exports = function spread(callback) {
|
2276
|
+
return function wrap(arr) {
|
2277
|
+
return callback.apply(null, arr);
|
2278
|
+
};
|
2279
|
+
};
|
2280
|
+
|
2281
|
+
},{}],"1bzv8":[function(require,module,exports) {
|
2282
|
+
'use strict';
|
2283
|
+
|
2284
|
+
/**
|
2285
|
+
* Determines whether the payload is an error thrown by Axios
|
2286
|
+
*
|
2287
|
+
* @param {*} payload The value to test
|
2288
|
+
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
2289
|
+
*/
|
2290
|
+
module.exports = function isAxiosError(payload) {
|
2291
|
+
return (typeof payload === 'object') && (payload.isAxiosError === true);
|
2292
|
+
};
|
2293
|
+
|
2294
|
+
},{}],"5gA8y":[function(require,module,exports) {
|
2295
|
+
"use strict";
|
2296
|
+
|
2297
|
+
exports.interopDefault = function (a) {
|
2298
|
+
return a && a.__esModule ? a : {
|
2299
|
+
default: a
|
2300
|
+
};
|
2301
|
+
};
|
2302
|
+
|
2303
|
+
exports.defineInteropFlag = function (a) {
|
2304
|
+
Object.defineProperty(a, '__esModule', {
|
2305
|
+
value: true
|
2306
|
+
});
|
2307
|
+
};
|
2308
|
+
|
2309
|
+
exports.exportAll = function (source, dest) {
|
2310
|
+
Object.keys(source).forEach(function (key) {
|
2311
|
+
if (key === 'default' || key === '__esModule') {
|
2312
|
+
return;
|
2313
|
+
} // Skip duplicate re-exports when they have the same value.
|
2314
|
+
|
2315
|
+
|
2316
|
+
if (key in dest && dest[key] === source[key]) {
|
2317
|
+
return;
|
2318
|
+
}
|
2319
|
+
|
2320
|
+
Object.defineProperty(dest, key, {
|
2321
|
+
enumerable: true,
|
2322
|
+
get: function () {
|
2323
|
+
return source[key];
|
2324
|
+
}
|
2325
|
+
});
|
2326
|
+
});
|
2327
|
+
return dest;
|
2328
|
+
};
|
2329
|
+
|
2330
|
+
exports.export = function (dest, destName, get) {
|
2331
|
+
Object.defineProperty(dest, destName, {
|
2332
|
+
enumerable: true,
|
2333
|
+
get: get
|
2334
|
+
});
|
2335
|
+
};
|
2336
|
+
},{}],"4YjT0":[function(require,module,exports) {
|
2337
|
+
var define;
|
2338
|
+
!(function (e, t) {
|
2339
|
+
"object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.VidroMaps = t() : e.VidroMaps = t();
|
2340
|
+
})(self, function () {
|
2341
|
+
return (() => {
|
2342
|
+
"use strict";
|
2343
|
+
var e = {
|
2344
|
+
187: e => {
|
2345
|
+
var t, n = "object" == typeof Reflect ? Reflect : null, o = n && "function" == typeof n.apply ? n.apply : function (e, t, n) {
|
2346
|
+
return Function.prototype.apply.call(e, t, n);
|
2347
|
+
};
|
2348
|
+
t = n && "function" == typeof n.ownKeys ? n.ownKeys : Object.getOwnPropertySymbols ? function (e) {
|
2349
|
+
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
|
2350
|
+
} : function (e) {
|
2351
|
+
return Object.getOwnPropertyNames(e);
|
2352
|
+
};
|
2353
|
+
var r = Number.isNaN || (function (e) {
|
2354
|
+
return e != e;
|
2355
|
+
});
|
2356
|
+
function i() {
|
2357
|
+
i.init.call(this);
|
2358
|
+
}
|
2359
|
+
(e.exports = i, e.exports.once = function (e, t) {
|
2360
|
+
return new Promise(function (n, o) {
|
2361
|
+
function r(n) {
|
2362
|
+
(e.removeListener(t, i), o(n));
|
2363
|
+
}
|
2364
|
+
function i() {
|
2365
|
+
("function" == typeof e.removeListener && e.removeListener("error", r), n([].slice.call(arguments)));
|
2366
|
+
}
|
2367
|
+
(v(e, t, i, {
|
2368
|
+
once: !0
|
2369
|
+
}), "error" !== t && (function (e, t, n) {
|
2370
|
+
"function" == typeof e.on && v(e, "error", t, {
|
2371
|
+
once: !0
|
2372
|
+
});
|
2373
|
+
})(e, r));
|
2374
|
+
});
|
2375
|
+
}, i.EventEmitter = i, i.prototype._events = void 0, i.prototype._eventsCount = 0, i.prototype._maxListeners = void 0);
|
2376
|
+
var s = 10;
|
2377
|
+
function a(e) {
|
2378
|
+
if ("function" != typeof e) throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof e);
|
2379
|
+
}
|
2380
|
+
function u(e) {
|
2381
|
+
return void 0 === e._maxListeners ? i.defaultMaxListeners : e._maxListeners;
|
2382
|
+
}
|
2383
|
+
function c(e, t, n, o) {
|
2384
|
+
var r, i, s, c;
|
2385
|
+
if ((a(n), void 0 === (i = e._events) ? (i = e._events = Object.create(null), e._eventsCount = 0) : (void 0 !== i.newListener && (e.emit("newListener", t, n.listener ? n.listener : n), i = e._events), s = i[t]), void 0 === s)) (s = i[t] = n, ++e._eventsCount); else if (("function" == typeof s ? s = i[t] = o ? [n, s] : [s, n] : o ? s.unshift(n) : s.push(n), (r = u(e)) > 0 && s.length > r && !s.warned)) {
|
2386
|
+
s.warned = !0;
|
2387
|
+
var f = new Error("Possible EventEmitter memory leak detected. " + s.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
2388
|
+
(f.name = "MaxListenersExceededWarning", f.emitter = e, f.type = t, f.count = s.length, c = f, console && console.warn && console.warn(c));
|
2389
|
+
}
|
2390
|
+
return e;
|
2391
|
+
}
|
2392
|
+
function f() {
|
2393
|
+
if (!this.fired) return (this.target.removeListener(this.type, this.wrapFn), this.fired = !0, 0 === arguments.length ? this.listener.call(this.target) : this.listener.apply(this.target, arguments));
|
2394
|
+
}
|
2395
|
+
function l(e, t, n) {
|
2396
|
+
var o = {
|
2397
|
+
fired: !1,
|
2398
|
+
wrapFn: void 0,
|
2399
|
+
target: e,
|
2400
|
+
type: t,
|
2401
|
+
listener: n
|
2402
|
+
}, r = f.bind(o);
|
2403
|
+
return (r.listener = n, o.wrapFn = r, r);
|
2404
|
+
}
|
2405
|
+
function p(e, t, n) {
|
2406
|
+
var o = e._events;
|
2407
|
+
if (void 0 === o) return [];
|
2408
|
+
var r = o[t];
|
2409
|
+
return void 0 === r ? [] : "function" == typeof r ? n ? [r.listener || r] : [r] : n ? (function (e) {
|
2410
|
+
for (var t = new Array(e.length), n = 0; n < t.length; ++n) t[n] = e[n].listener || e[n];
|
2411
|
+
return t;
|
2412
|
+
})(r) : d(r, r.length);
|
2413
|
+
}
|
2414
|
+
function y(e) {
|
2415
|
+
var t = this._events;
|
2416
|
+
if (void 0 !== t) {
|
2417
|
+
var n = t[e];
|
2418
|
+
if ("function" == typeof n) return 1;
|
2419
|
+
if (void 0 !== n) return n.length;
|
2420
|
+
}
|
2421
|
+
return 0;
|
2422
|
+
}
|
2423
|
+
function d(e, t) {
|
2424
|
+
for (var n = new Array(t), o = 0; o < t; ++o) n[o] = e[o];
|
2425
|
+
return n;
|
2426
|
+
}
|
2427
|
+
function v(e, t, n, o) {
|
2428
|
+
if ("function" == typeof e.on) o.once ? e.once(t, n) : e.on(t, n); else {
|
2429
|
+
if ("function" != typeof e.addEventListener) throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof e);
|
2430
|
+
e.addEventListener(t, function r(i) {
|
2431
|
+
(o.once && e.removeEventListener(t, r), n(i));
|
2432
|
+
});
|
2433
|
+
}
|
2434
|
+
}
|
2435
|
+
(Object.defineProperty(i, "defaultMaxListeners", {
|
2436
|
+
enumerable: !0,
|
2437
|
+
get: function () {
|
2438
|
+
return s;
|
2439
|
+
},
|
2440
|
+
set: function (e) {
|
2441
|
+
if ("number" != typeof e || e < 0 || r(e)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + ".");
|
2442
|
+
s = e;
|
2443
|
+
}
|
2444
|
+
}), i.init = function () {
|
2445
|
+
(void 0 !== this._events && this._events !== Object.getPrototypeOf(this)._events || (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0);
|
2446
|
+
}, i.prototype.setMaxListeners = function (e) {
|
2447
|
+
if ("number" != typeof e || e < 0 || r(e)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
|
2448
|
+
return (this._maxListeners = e, this);
|
2449
|
+
}, i.prototype.getMaxListeners = function () {
|
2450
|
+
return u(this);
|
2451
|
+
}, i.prototype.emit = function (e) {
|
2452
|
+
for (var t = [], n = 1; n < arguments.length; n++) t.push(arguments[n]);
|
2453
|
+
var r = "error" === e, i = this._events;
|
2454
|
+
if (void 0 !== i) r = r && void 0 === i.error; else if (!r) return !1;
|
2455
|
+
if (r) {
|
2456
|
+
var s;
|
2457
|
+
if ((t.length > 0 && (s = t[0]), s instanceof Error)) throw s;
|
2458
|
+
var a = new Error("Unhandled error." + (s ? " (" + s.message + ")" : ""));
|
2459
|
+
throw (a.context = s, a);
|
2460
|
+
}
|
2461
|
+
var u = i[e];
|
2462
|
+
if (void 0 === u) return !1;
|
2463
|
+
if ("function" == typeof u) o(u, this, t); else {
|
2464
|
+
var c = u.length, f = d(u, c);
|
2465
|
+
for (n = 0; n < c; ++n) o(f[n], this, t);
|
2466
|
+
}
|
2467
|
+
return !0;
|
2468
|
+
}, i.prototype.addListener = function (e, t) {
|
2469
|
+
return c(this, e, t, !1);
|
2470
|
+
}, i.prototype.on = i.prototype.addListener, i.prototype.prependListener = function (e, t) {
|
2471
|
+
return c(this, e, t, !0);
|
2472
|
+
}, i.prototype.once = function (e, t) {
|
2473
|
+
return (a(t), this.on(e, l(this, e, t)), this);
|
2474
|
+
}, i.prototype.prependOnceListener = function (e, t) {
|
2475
|
+
return (a(t), this.prependListener(e, l(this, e, t)), this);
|
2476
|
+
}, i.prototype.removeListener = function (e, t) {
|
2477
|
+
var n, o, r, i, s;
|
2478
|
+
if ((a(t), void 0 === (o = this._events))) return this;
|
2479
|
+
if (void 0 === (n = o[e])) return this;
|
2480
|
+
if (n === t || n.listener === t) 0 == --this._eventsCount ? this._events = Object.create(null) : (delete o[e], o.removeListener && this.emit("removeListener", e, n.listener || t)); else if ("function" != typeof n) {
|
2481
|
+
for ((r = -1, i = n.length - 1); i >= 0; i--) if (n[i] === t || n[i].listener === t) {
|
2482
|
+
(s = n[i].listener, r = i);
|
2483
|
+
break;
|
2484
|
+
}
|
2485
|
+
if (r < 0) return this;
|
2486
|
+
(0 === r ? n.shift() : (function (e, t) {
|
2487
|
+
for (; t + 1 < e.length; t++) e[t] = e[t + 1];
|
2488
|
+
e.pop();
|
2489
|
+
})(n, r), 1 === n.length && (o[e] = n[0]), void 0 !== o.removeListener && this.emit("removeListener", e, s || t));
|
2490
|
+
}
|
2491
|
+
return this;
|
2492
|
+
}, i.prototype.off = i.prototype.removeListener, i.prototype.removeAllListeners = function (e) {
|
2493
|
+
var t, n, o;
|
2494
|
+
if (void 0 === (n = this._events)) return this;
|
2495
|
+
if (void 0 === n.removeListener) return (0 === arguments.length ? (this._events = Object.create(null), this._eventsCount = 0) : void 0 !== n[e] && (0 == --this._eventsCount ? this._events = Object.create(null) : delete n[e]), this);
|
2496
|
+
if (0 === arguments.length) {
|
2497
|
+
var r, i = Object.keys(n);
|
2498
|
+
for (o = 0; o < i.length; ++o) "removeListener" !== (r = i[o]) && this.removeAllListeners(r);
|
2499
|
+
return (this.removeAllListeners("removeListener"), this._events = Object.create(null), this._eventsCount = 0, this);
|
2500
|
+
}
|
2501
|
+
if ("function" == typeof (t = n[e])) this.removeListener(e, t); else if (void 0 !== t) for (o = t.length - 1; o >= 0; o--) this.removeListener(e, t[o]);
|
2502
|
+
return this;
|
2503
|
+
}, i.prototype.listeners = function (e) {
|
2504
|
+
return p(this, e, !0);
|
2505
|
+
}, i.prototype.rawListeners = function (e) {
|
2506
|
+
return p(this, e, !1);
|
2507
|
+
}, i.listenerCount = function (e, t) {
|
2508
|
+
return "function" == typeof e.listenerCount ? e.listenerCount(t) : y.call(e, t);
|
2509
|
+
}, i.prototype.listenerCount = y, i.prototype.eventNames = function () {
|
2510
|
+
return this._eventsCount > 0 ? t(this._events) : [];
|
2511
|
+
});
|
2512
|
+
}
|
2513
|
+
}, t = {};
|
2514
|
+
function n(o) {
|
2515
|
+
var r = t[o];
|
2516
|
+
if (void 0 !== r) return r.exports;
|
2517
|
+
var i = t[o] = {
|
2518
|
+
exports: {}
|
2519
|
+
};
|
2520
|
+
return (e[o](i, i.exports, n), i.exports);
|
2521
|
+
}
|
2522
|
+
(n.d = (e, t) => {
|
2523
|
+
for (var o in t) n.o(t, o) && !n.o(e, o) && Object.defineProperty(e, o, {
|
2524
|
+
enumerable: !0,
|
2525
|
+
get: t[o]
|
2526
|
+
});
|
2527
|
+
}, n.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t), n.r = e => {
|
2528
|
+
("undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
|
2529
|
+
value: "Module"
|
2530
|
+
}), Object.defineProperty(e, "__esModule", {
|
2531
|
+
value: !0
|
2532
|
+
}));
|
2533
|
+
});
|
2534
|
+
var o = {};
|
2535
|
+
return ((() => {
|
2536
|
+
(n.r(o), n.d(o, {
|
2537
|
+
Communicator: () => l
|
2538
|
+
}));
|
2539
|
+
var e = n(187), t = "undefined" == typeof window, r = function (e) {
|
2540
|
+
t || window.top.frames["map-frame"].postMessage(e, "*");
|
2541
|
+
};
|
2542
|
+
function i(e) {
|
2543
|
+
return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
|
2544
|
+
return typeof e;
|
2545
|
+
} : function (e) {
|
2546
|
+
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
2547
|
+
})(e);
|
2548
|
+
}
|
2549
|
+
function s(e, t) {
|
2550
|
+
return (s = Object.setPrototypeOf || (function (e, t) {
|
2551
|
+
return (e.__proto__ = t, e);
|
2552
|
+
}))(e, t);
|
2553
|
+
}
|
2554
|
+
function a(e, t) {
|
2555
|
+
return !t || "object" !== i(t) && "function" != typeof t ? u(e) : t;
|
2556
|
+
}
|
2557
|
+
function u(e) {
|
2558
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
2559
|
+
return e;
|
2560
|
+
}
|
2561
|
+
function c(e) {
|
2562
|
+
return (c = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
|
2563
|
+
return e.__proto__ || Object.getPrototypeOf(e);
|
2564
|
+
})(e);
|
2565
|
+
}
|
2566
|
+
function f(e, t, n) {
|
2567
|
+
return ((t in e) ? Object.defineProperty(e, t, {
|
2568
|
+
value: n,
|
2569
|
+
enumerable: !0,
|
2570
|
+
configurable: !0,
|
2571
|
+
writable: !0
|
2572
|
+
}) : e[t] = n, e);
|
2573
|
+
}
|
2574
|
+
var l = (function (e) {
|
2575
|
+
!(function (e, t) {
|
2576
|
+
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
2577
|
+
(e.prototype = Object.create(t && t.prototype, {
|
2578
|
+
constructor: {
|
2579
|
+
value: e,
|
2580
|
+
writable: !0,
|
2581
|
+
configurable: !0
|
2582
|
+
}
|
2583
|
+
}), t && s(e, t));
|
2584
|
+
})(l, e);
|
2585
|
+
var t, n, o = (t = l, n = (function () {
|
2586
|
+
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
|
2587
|
+
if (Reflect.construct.sham) return !1;
|
2588
|
+
if ("function" == typeof Proxy) return !0;
|
2589
|
+
try {
|
2590
|
+
return (Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})), !0);
|
2591
|
+
} catch (e) {
|
2592
|
+
return !1;
|
2593
|
+
}
|
2594
|
+
})(), function () {
|
2595
|
+
var e, o = c(t);
|
2596
|
+
if (n) {
|
2597
|
+
var r = c(this).constructor;
|
2598
|
+
e = Reflect.construct(o, arguments, r);
|
2599
|
+
} else e = o.apply(this, arguments);
|
2600
|
+
return a(this, e);
|
2601
|
+
});
|
2602
|
+
function l(e) {
|
2603
|
+
var t, n = e.sessionToken;
|
2604
|
+
return ((function (e, t) {
|
2605
|
+
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
2606
|
+
})(this, l), f(u(t = o.call(this)), "onMessageReceived", function (e) {
|
2607
|
+
switch (e.data.type) {
|
2608
|
+
case "onZoomChange":
|
2609
|
+
t.emit("onZoomChange", e.data.zoom);
|
2610
|
+
break;
|
2611
|
+
case "geomAdded":
|
2612
|
+
t.emit("geomAdded", e.data.geom_astext);
|
2613
|
+
break;
|
2614
|
+
case "layers":
|
2615
|
+
t.emit("layers", e.data.layers);
|
2616
|
+
break;
|
2617
|
+
case "geoJSONlayers":
|
2618
|
+
t.emit("geoJSONlayers", e.data.layers);
|
2619
|
+
break;
|
2620
|
+
case "info":
|
2621
|
+
t.emit("info", e.data);
|
2622
|
+
break;
|
2623
|
+
case "error":
|
2624
|
+
t.emit("error", e.data);
|
2625
|
+
break;
|
2626
|
+
case "coordinates":
|
2627
|
+
t.emit("coordinates", e.data);
|
2628
|
+
break;
|
2629
|
+
case "activeLayer":
|
2630
|
+
t.emit("activeLayer", e.data);
|
2631
|
+
break;
|
2632
|
+
case "geolocation":
|
2633
|
+
t.emit("geolocation", e.data);
|
2634
|
+
break;
|
2635
|
+
case "WMSInfoAvailable":
|
2636
|
+
t.emit("WMSInfoAvailable", e.data);
|
2637
|
+
break;
|
2638
|
+
case "giswaterTiledBackgroundDisplayed":
|
2639
|
+
t.emit("giswaterTiledBackgroundDisplayed", e.data);
|
2640
|
+
break;
|
2641
|
+
case "giswaterTiledBackgroundAvailable":
|
2642
|
+
t.emit("giswaterTiledBackgroundAvailable", e.data);
|
2643
|
+
break;
|
2644
|
+
case "GiswaterLayerAvailableFilters":
|
2645
|
+
t.emit("GiswaterLayerAvailableFilters", e.data);
|
2646
|
+
}
|
2647
|
+
}), f(u(t), "ZoomIn", function () {
|
2648
|
+
r({
|
2649
|
+
type: "zoomIn",
|
2650
|
+
sessionToken: t.sessionToken
|
2651
|
+
});
|
2652
|
+
}), f(u(t), "ZoomOut", function () {
|
2653
|
+
r({
|
2654
|
+
type: "zoomOut",
|
2655
|
+
sessionToken: t.sessionToken
|
2656
|
+
});
|
2657
|
+
}), f(u(t), "AddGeom", function (e) {
|
2658
|
+
r({
|
2659
|
+
type: "AddGeom",
|
2660
|
+
geom: e,
|
2661
|
+
sessionToken: t.sessionToken
|
2662
|
+
});
|
2663
|
+
}), f(u(t), "toggleLayer", function (e) {
|
2664
|
+
r({
|
2665
|
+
type: "toggleLayer",
|
2666
|
+
layer: e,
|
2667
|
+
sessionToken: t.sessionToken
|
2668
|
+
});
|
2669
|
+
}), f(u(t), "setActiveLayer", function (e) {
|
2670
|
+
r({
|
2671
|
+
type: "setActiveLayer",
|
2672
|
+
layer: e,
|
2673
|
+
sessionToken: t.sessionToken
|
2674
|
+
});
|
2675
|
+
}), f(u(t), "getActiveLayer", function () {
|
2676
|
+
r({
|
2677
|
+
type: "getActiveLayer",
|
2678
|
+
sessionToken: t.sessionToken
|
2679
|
+
});
|
2680
|
+
}), f(u(t), "clear", function () {
|
2681
|
+
r({
|
2682
|
+
type: "clear",
|
2683
|
+
sessionToken: t.sessionToken
|
2684
|
+
});
|
2685
|
+
}), f(u(t), "Highlight", function (e) {
|
2686
|
+
r({
|
2687
|
+
type: "highlight",
|
2688
|
+
geom: e.geom,
|
2689
|
+
zoom: e.zoom,
|
2690
|
+
sessionToken: t.sessionToken
|
2691
|
+
});
|
2692
|
+
}), f(u(t), "zoomToExtent", function () {
|
2693
|
+
r({
|
2694
|
+
type: "zoomToExtent",
|
2695
|
+
sessionToken: t.sessionToken
|
2696
|
+
});
|
2697
|
+
}), f(u(t), "infoFromCoordinates", function (e, n, o) {
|
2698
|
+
r({
|
2699
|
+
type: "infoFromCoordinates",
|
2700
|
+
info: e,
|
2701
|
+
layer: void 0 === n ? null : n,
|
2702
|
+
hitTolerance: void 0 !== o ? parseInt(o) : 5,
|
2703
|
+
sessionToken: t.sessionToken
|
2704
|
+
});
|
2705
|
+
}), f(u(t), "Geolocalize", function (e) {
|
2706
|
+
r({
|
2707
|
+
type: "Geolocalize",
|
2708
|
+
toggle: e,
|
2709
|
+
sessionToken: t.sessionToken
|
2710
|
+
});
|
2711
|
+
}), f(u(t), "toggleGiswaterTiled", function (e) {
|
2712
|
+
r({
|
2713
|
+
type: "toggleGiswaterTiled",
|
2714
|
+
toggle: e,
|
2715
|
+
sessionToken: t.sessionToken
|
2716
|
+
});
|
2717
|
+
}), f(u(t), "reloadDisplayedLayers", function () {
|
2718
|
+
return r({
|
2719
|
+
type: "reloadDisplayedLayers",
|
2720
|
+
sessionToken: t.sessionToken
|
2721
|
+
});
|
2722
|
+
}), f(u(t), "addGeoJSON", function (e, n, o) {
|
2723
|
+
return e ? r({
|
2724
|
+
type: "addGeoJSON",
|
2725
|
+
geoJSON: e,
|
2726
|
+
options: void 0 !== n ? n : {
|
2727
|
+
fillcolor: null,
|
2728
|
+
strokecolor: null
|
2729
|
+
},
|
2730
|
+
name: o || Math.random().toString(36).substring(7),
|
2731
|
+
sessionToken: t.sessionToken
|
2732
|
+
}) : void t.emit("error", {
|
2733
|
+
error: "No geoJSON data"
|
2734
|
+
});
|
2735
|
+
}), f(u(t), "clearGeoJSON", function () {
|
2736
|
+
return r({
|
2737
|
+
type: "clearGeoJSON",
|
2738
|
+
sessionToken: t.sessionToken
|
2739
|
+
});
|
2740
|
+
}), f(u(t), "removeGeoJSONLayer", function (e) {
|
2741
|
+
return e ? r({
|
2742
|
+
type: "removeGeoJSONLayer",
|
2743
|
+
name: e,
|
2744
|
+
sessionToken: t.sessionToken
|
2745
|
+
}) : void t.emit("error", {
|
2746
|
+
error: "No geoJSON data"
|
2747
|
+
});
|
2748
|
+
}), f(u(t), "setGiswaterFilters", function (e) {
|
2749
|
+
var n = e;
|
2750
|
+
if (e) {
|
2751
|
+
if ("object" != i(e)) {
|
2752
|
+
e = (e = (e = e.trim()).replace(/^\s+|\s+$/g, "")).replace(/\\/g, "");
|
2753
|
+
try {
|
2754
|
+
n = JSON.parse(e);
|
2755
|
+
} catch (e) {
|
2756
|
+
return void t.emit("error", {
|
2757
|
+
error: "Filters is not a valid JSON"
|
2758
|
+
});
|
2759
|
+
}
|
2760
|
+
}
|
2761
|
+
return r({
|
2762
|
+
type: "setGiswaterFilters",
|
2763
|
+
filters: n,
|
2764
|
+
sessionToken: t.sessionToken
|
2765
|
+
});
|
2766
|
+
}
|
2767
|
+
t.emit("error", {
|
2768
|
+
error: "No filters"
|
2769
|
+
});
|
2770
|
+
}), f(u(t), "getGiswaterLayerAvailableFilters", function (e) {
|
2771
|
+
return e ? r({
|
2772
|
+
type: "getGiswaterLayerAvailableFilters",
|
2773
|
+
name: e,
|
2774
|
+
sessionToken: t.sessionToken
|
2775
|
+
}) : void t.emit("error", {
|
2776
|
+
error: "No layer_name"
|
2777
|
+
});
|
2778
|
+
}), "undefined" == typeof window ? a(t) : (window.addEventListener("message", function (e) {
|
2779
|
+
return t.onMessageReceived(e);
|
2780
|
+
}), t.sessionToken = n, t));
|
2781
|
+
}
|
2782
|
+
return l;
|
2783
|
+
})(e.EventEmitter);
|
2784
|
+
})(), o);
|
2785
|
+
})();
|
2786
|
+
});
|
2787
|
+
|
2788
|
+
},{}],"4Mf7p":[function(require,module,exports) {
|
2789
|
+
'use strict';
|
2790
|
+
|
2791
|
+
module.exports = {
|
2792
|
+
xml2json: xml2json
|
2793
|
+
};
|
2794
|
+
|
2795
|
+
//***********************************************************************
|
2796
|
+
// Main function. Clears the given xml and then starts the recursion
|
2797
|
+
//***********************************************************************
|
2798
|
+
function xml2json(xmlStr){
|
2799
|
+
xmlStr = cleanXML(xmlStr);
|
2800
|
+
return xml2jsonRecurse(xmlStr,0);
|
2801
|
+
}
|
2802
|
+
|
2803
|
+
//***********************************************************************
|
2804
|
+
// Recursive function that creates a JSON object with a given XML string.
|
2805
|
+
//***********************************************************************
|
2806
|
+
function xml2jsonRecurse(xmlStr) {
|
2807
|
+
var obj = {},
|
2808
|
+
tagName, indexClosingTag, inner_substring, tempVal, openingTag;
|
2809
|
+
|
2810
|
+
while (xmlStr.match(/<[^\/][^>]*>/)) {
|
2811
|
+
openingTag = xmlStr.match(/<[^\/][^>]*>/)[0];
|
2812
|
+
tagName = openingTag.substring(1, openingTag.length - 1);
|
2813
|
+
indexClosingTag = xmlStr.indexOf(openingTag.replace('<', '</'));
|
2814
|
+
|
2815
|
+
// account for case where additional information in the openning tag
|
2816
|
+
if (indexClosingTag == -1) {
|
2817
|
+
|
2818
|
+
tagName = openingTag.match(/[^<][\w+$]*/)[0];
|
2819
|
+
indexClosingTag = xmlStr.indexOf('</' + tagName);
|
2820
|
+
if (indexClosingTag == -1) {
|
2821
|
+
indexClosingTag = xmlStr.indexOf('<\\/' + tagName);
|
2822
|
+
}
|
2823
|
+
}
|
2824
|
+
inner_substring = xmlStr.substring(openingTag.length, indexClosingTag);
|
2825
|
+
if (inner_substring.match(/<[^\/][^>]*>/)) {
|
2826
|
+
tempVal = xml2json(inner_substring);
|
2827
|
+
}
|
2828
|
+
else {
|
2829
|
+
tempVal = inner_substring;
|
2830
|
+
}
|
2831
|
+
// account for array or obj //
|
2832
|
+
if (obj[tagName] === undefined) {
|
2833
|
+
obj[tagName] = tempVal;
|
2834
|
+
}
|
2835
|
+
else if (Array.isArray(obj[tagName])) {
|
2836
|
+
obj[tagName].push(tempVal);
|
2837
|
+
}
|
2838
|
+
else {
|
2839
|
+
obj[tagName] = [obj[tagName], tempVal];
|
2840
|
+
}
|
2841
|
+
|
2842
|
+
xmlStr = xmlStr.substring(openingTag.length * 2 + 1 + inner_substring.length);
|
2843
|
+
}
|
2844
|
+
|
2845
|
+
return obj;
|
2846
|
+
}
|
2847
|
+
|
2848
|
+
//*****************************************************************
|
2849
|
+
// Removes some characters that would break the recursive function.
|
2850
|
+
//*****************************************************************
|
2851
|
+
function cleanXML(xmlStr) {
|
2852
|
+
|
2853
|
+
xmlStr = xmlStr.replace( /<!--[\s\S]*?-->/g, '' ); //remove commented lines
|
2854
|
+
xmlStr = xmlStr.replace(/\n|\t|\r/g, ''); //replace special characters
|
2855
|
+
xmlStr = xmlStr.replace(/ {1,}<|\t{1,}</g, '<'); //replace leading spaces and tabs
|
2856
|
+
xmlStr = xmlStr.replace(/> {1,}|>\t{1,}/g, '>'); //replace trailing spaces and tabs
|
2857
|
+
xmlStr = xmlStr.replace(/<\?[^>]*\?>/g, ''); //delete docType tags
|
2858
|
+
|
2859
|
+
xmlStr = replaceSelfClosingTags(xmlStr); //replace self closing tags
|
2860
|
+
xmlStr = replaceAloneValues(xmlStr); //replace the alone tags values
|
2861
|
+
xmlStr = replaceAttributes(xmlStr); //replace attributes
|
2862
|
+
|
2863
|
+
return xmlStr;
|
2864
|
+
}
|
2865
|
+
|
2866
|
+
//************************************************************************************************************
|
2867
|
+
// Replaces all the self closing tags with attributes with another tag containing its attribute as a property.
|
2868
|
+
// The function works if the tag contains multiple attributes.
|
2869
|
+
//
|
2870
|
+
// Example : '<tagName attrName="attrValue" />' becomes
|
2871
|
+
// '<tagName><attrName>attrValue</attrName></tagName>'
|
2872
|
+
//************************************************************************************************************
|
2873
|
+
function replaceSelfClosingTags(xmlStr) {
|
2874
|
+
|
2875
|
+
var selfClosingTags = xmlStr.match(/<[^/][^>]*\/>/g);
|
2876
|
+
|
2877
|
+
if (selfClosingTags) {
|
2878
|
+
for (var i = 0; i < selfClosingTags.length; i++) {
|
2879
|
+
|
2880
|
+
var oldTag = selfClosingTags[i];
|
2881
|
+
var tempTag = oldTag.substring(0, oldTag.length - 2);
|
2882
|
+
tempTag += ">";
|
2883
|
+
|
2884
|
+
var tagName = oldTag.match(/[^<][\w+$]*/)[0];
|
2885
|
+
var closingTag = "</" + tagName + ">";
|
2886
|
+
var newTag = "<" + tagName + ">";
|
2887
|
+
|
2888
|
+
var attrs = tempTag.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/g);
|
2889
|
+
|
2890
|
+
if (attrs) {
|
2891
|
+
for(var j = 0; j < attrs.length; j++) {
|
2892
|
+
var attr = attrs[j];
|
2893
|
+
var attrName = attr.substring(0, attr.indexOf('='));
|
2894
|
+
var attrValue = attr.substring(attr.indexOf('"') + 1, attr.lastIndexOf('"'));
|
2895
|
+
|
2896
|
+
newTag += "<" + attrName + ">" + attrValue + "</" + attrName + ">";
|
2897
|
+
}
|
2898
|
+
}
|
2899
|
+
|
2900
|
+
newTag += closingTag;
|
2901
|
+
|
2902
|
+
xmlStr = xmlStr.replace(oldTag, newTag);
|
2903
|
+
}
|
2904
|
+
}
|
2905
|
+
|
2906
|
+
return xmlStr;
|
2907
|
+
}
|
2908
|
+
|
2909
|
+
//*************************************************************************************************
|
2910
|
+
// Replaces all the tags with attributes and a value with a new tag.
|
2911
|
+
//
|
2912
|
+
// Example : '<tagName attrName="attrValue">tagValue</tagName>' becomes
|
2913
|
+
// '<tagName><attrName>attrValue</attrName><_@attribute>tagValue</_@attribute></tagName>'
|
2914
|
+
//*************************************************************************************************
|
2915
|
+
function replaceAloneValues(xmlStr) {
|
2916
|
+
|
2917
|
+
var tagsWithAttributesAndValue = xmlStr.match(/<[^\/][^>][^<]+\s+.[^<]+[=][^<]+>{1}([^<]+)/g);
|
2918
|
+
|
2919
|
+
if (tagsWithAttributesAndValue) {
|
2920
|
+
for(var i = 0; i < tagsWithAttributesAndValue.length; i++) {
|
2921
|
+
|
2922
|
+
var oldTag = tagsWithAttributesAndValue[i];
|
2923
|
+
var oldTagName = oldTag.substring(0, oldTag.indexOf(">") + 1);
|
2924
|
+
var oldTagValue = oldTag.substring(oldTag.indexOf(">") + 1);
|
2925
|
+
|
2926
|
+
var newTag = oldTagName + "<_@ttribute>" + oldTagValue + "</_@ttribute>";
|
2927
|
+
|
2928
|
+
xmlStr = xmlStr.replace(oldTag, newTag);
|
2929
|
+
}
|
2930
|
+
}
|
2931
|
+
|
2932
|
+
return xmlStr;
|
2933
|
+
}
|
2934
|
+
|
2935
|
+
//*****************************************************************************************************************
|
2936
|
+
// Replaces all the tags with attributes with another tag containing its attribute as a property.
|
2937
|
+
// The function works if the tag contains multiple attributes.
|
2938
|
+
//
|
2939
|
+
// Example : '<tagName attrName="attrValue"></tagName>' becomes '<tagName><attrName>attrValue</attrName></tagName>'
|
2940
|
+
//*****************************************************************************************************************
|
2941
|
+
function replaceAttributes(xmlStr) {
|
2942
|
+
|
2943
|
+
var tagsWithAttributes = xmlStr.match(/<[^\/][^>][^<]+\s+.[^<]+[=][^<]+>/g);
|
2944
|
+
|
2945
|
+
if (tagsWithAttributes) {
|
2946
|
+
for (var i = 0; i < tagsWithAttributes.length; i++) {
|
2947
|
+
|
2948
|
+
var oldTag = tagsWithAttributes[i];
|
2949
|
+
var tagName = oldTag.match(/[^<][\w+$]*/)[0];
|
2950
|
+
var newTag = "<" + tagName + ">";
|
2951
|
+
var attrs = oldTag.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/g);
|
2952
|
+
|
2953
|
+
if (attrs) {
|
2954
|
+
for(var j = 0; j < attrs.length; j++) {
|
2955
|
+
|
2956
|
+
var attr = attrs[j];
|
2957
|
+
var attrName = attr.substring(0, attr.indexOf('='));
|
2958
|
+
var attrValue = attr.substring(attr.indexOf('"') + 1, attr.lastIndexOf('"'));
|
2959
|
+
|
2960
|
+
newTag += "<" + attrName + ">" + attrValue + "</" + attrName + ">";
|
2961
|
+
}
|
2962
|
+
}
|
2963
|
+
|
2964
|
+
xmlStr = xmlStr.replace(oldTag, newTag);
|
2965
|
+
}
|
2966
|
+
}
|
2967
|
+
|
2968
|
+
return xmlStr;
|
2969
|
+
}
|
2970
|
+
|
2971
|
+
},{}]},["1sDb8","2X3X1"], "2X3X1", "parcelRequire917b")
|
2972
|
+
|
2973
|
+
//# sourceMappingURL=index.23420cfa.js.map
|