@nextgis/ngw-leaflet 3.0.0-alpha.4 → 3.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ngw-leaflet.esm-browser.js +1495 -1075
- package/lib/ngw-leaflet.esm-browser.js.map +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js.map +1 -1
- package/lib/ngw-leaflet.esm-bundler.js +1 -1
- package/lib/ngw-leaflet.global.js +1495 -1075
- package/lib/ngw-leaflet.global.js.map +1 -1
- package/lib/ngw-leaflet.global.prod.js +1 -1
- package/lib/ngw-leaflet.global.prod.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.6; author: NextGIS */
|
|
2
2
|
var NgwLeaflet = (function () {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -65,7 +65,7 @@ var NgwLeaflet = (function () {
|
|
|
65
65
|
this.domain = null;
|
|
66
66
|
if (EventEmitter.usingDomains) {
|
|
67
67
|
// if there is an active domain, then attach to it.
|
|
68
|
-
if (domain.active
|
|
68
|
+
if (domain.active) ;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
if (!this._events || this._events === Object.getPrototypeOf(this)._events) {
|
|
@@ -15065,15 +15065,15 @@ var NgwLeaflet = (function () {
|
|
|
15065
15065
|
};
|
|
15066
15066
|
}
|
|
15067
15067
|
|
|
15068
|
-
var __defProp$
|
|
15069
|
-
var __defNormalProp$
|
|
15070
|
-
var __publicField$
|
|
15068
|
+
var __defProp$11 = Object.defineProperty;
|
|
15069
|
+
var __defNormalProp$11 = (obj, key, value) => key in obj ? __defProp$11(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15070
|
+
var __publicField$H = (obj, key, value) => __defNormalProp$11(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15071
15071
|
class BaseAdapter {
|
|
15072
15072
|
constructor(map, options) {
|
|
15073
15073
|
this.map = map;
|
|
15074
15074
|
this.options = options;
|
|
15075
|
-
__publicField$
|
|
15076
|
-
__publicField$
|
|
15075
|
+
__publicField$H(this, "layer");
|
|
15076
|
+
__publicField$H(this, "pane", "order-0");
|
|
15077
15077
|
if (options.order !== void 0) {
|
|
15078
15078
|
const pane = "order-" + options.order;
|
|
15079
15079
|
let exist = map.getPane(pane);
|
|
@@ -15102,19 +15102,19 @@ var NgwLeaflet = (function () {
|
|
|
15102
15102
|
};
|
|
15103
15103
|
}
|
|
15104
15104
|
|
|
15105
|
-
var __defProp$
|
|
15106
|
-
var __getOwnPropSymbols$
|
|
15107
|
-
var __hasOwnProp$
|
|
15108
|
-
var __propIsEnum$
|
|
15109
|
-
var __defNormalProp$
|
|
15110
|
-
var __spreadValues$
|
|
15105
|
+
var __defProp$10 = Object.defineProperty;
|
|
15106
|
+
var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
|
|
15107
|
+
var __hasOwnProp$I = Object.prototype.hasOwnProperty;
|
|
15108
|
+
var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
|
|
15109
|
+
var __defNormalProp$10 = (obj, key, value) => key in obj ? __defProp$10(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15110
|
+
var __spreadValues$H = (a, b) => {
|
|
15111
15111
|
for (var prop in b || (b = {}))
|
|
15112
|
-
if (__hasOwnProp$
|
|
15113
|
-
__defNormalProp$
|
|
15114
|
-
if (__getOwnPropSymbols$
|
|
15115
|
-
for (var prop of __getOwnPropSymbols$
|
|
15116
|
-
if (__propIsEnum$
|
|
15117
|
-
__defNormalProp$
|
|
15112
|
+
if (__hasOwnProp$I.call(b, prop))
|
|
15113
|
+
__defNormalProp$10(a, prop, b[prop]);
|
|
15114
|
+
if (__getOwnPropSymbols$I)
|
|
15115
|
+
for (var prop of __getOwnPropSymbols$I(b)) {
|
|
15116
|
+
if (__propIsEnum$I.call(b, prop))
|
|
15117
|
+
__defNormalProp$10(a, prop, b[prop]);
|
|
15118
15118
|
}
|
|
15119
15119
|
return a;
|
|
15120
15120
|
};
|
|
@@ -15124,7 +15124,7 @@ var NgwLeaflet = (function () {
|
|
|
15124
15124
|
}) {
|
|
15125
15125
|
const layer_ = source.target;
|
|
15126
15126
|
const feature = layer_.feature;
|
|
15127
|
-
const opt = __spreadValues$
|
|
15127
|
+
const opt = __spreadValues$H({
|
|
15128
15128
|
layer,
|
|
15129
15129
|
feature,
|
|
15130
15130
|
event: convertMapClickEvent(source),
|
|
@@ -15133,30 +15133,30 @@ var NgwLeaflet = (function () {
|
|
|
15133
15133
|
return opt;
|
|
15134
15134
|
}
|
|
15135
15135
|
|
|
15136
|
-
var __defProp
|
|
15137
|
-
var __getOwnPropSymbols$
|
|
15138
|
-
var __hasOwnProp$
|
|
15139
|
-
var __propIsEnum$
|
|
15140
|
-
var __defNormalProp
|
|
15141
|
-
var __spreadValues$
|
|
15136
|
+
var __defProp$$ = Object.defineProperty;
|
|
15137
|
+
var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
|
|
15138
|
+
var __hasOwnProp$H = Object.prototype.hasOwnProperty;
|
|
15139
|
+
var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
|
|
15140
|
+
var __defNormalProp$$ = (obj, key, value) => key in obj ? __defProp$$(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15141
|
+
var __spreadValues$G = (a, b) => {
|
|
15142
15142
|
for (var prop in b || (b = {}))
|
|
15143
|
-
if (__hasOwnProp$
|
|
15144
|
-
__defNormalProp
|
|
15145
|
-
if (__getOwnPropSymbols$
|
|
15146
|
-
for (var prop of __getOwnPropSymbols$
|
|
15147
|
-
if (__propIsEnum$
|
|
15148
|
-
__defNormalProp
|
|
15143
|
+
if (__hasOwnProp$H.call(b, prop))
|
|
15144
|
+
__defNormalProp$$(a, prop, b[prop]);
|
|
15145
|
+
if (__getOwnPropSymbols$H)
|
|
15146
|
+
for (var prop of __getOwnPropSymbols$H(b)) {
|
|
15147
|
+
if (__propIsEnum$H.call(b, prop))
|
|
15148
|
+
__defNormalProp$$(a, prop, b[prop]);
|
|
15149
15149
|
}
|
|
15150
15150
|
return a;
|
|
15151
15151
|
};
|
|
15152
|
-
var __publicField$
|
|
15152
|
+
var __publicField$G = (obj, key, value) => __defNormalProp$$(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15153
15153
|
class GeoJsonEvents {
|
|
15154
15154
|
constructor(layer) {
|
|
15155
|
-
__publicField$
|
|
15156
|
-
__publicField$
|
|
15157
|
-
__publicField$
|
|
15158
|
-
__publicField$
|
|
15159
|
-
__publicField$
|
|
15155
|
+
__publicField$G(this, "layer");
|
|
15156
|
+
__publicField$G(this, "_onclick");
|
|
15157
|
+
__publicField$G(this, "_ondblclick");
|
|
15158
|
+
__publicField$G(this, "_mouseout");
|
|
15159
|
+
__publicField$G(this, "_mouseover");
|
|
15160
15160
|
this.layer = layer;
|
|
15161
15161
|
}
|
|
15162
15162
|
handleMouseEvents(layer) {
|
|
@@ -15165,7 +15165,7 @@ var NgwLeaflet = (function () {
|
|
|
15165
15165
|
if (onClick_) {
|
|
15166
15166
|
this._onclick = (e) => {
|
|
15167
15167
|
const selected = !!this.layer._getSelected(layer);
|
|
15168
|
-
onClick_(__spreadValues$
|
|
15168
|
+
onClick_(__spreadValues$G({
|
|
15169
15169
|
selected
|
|
15170
15170
|
}, this._createMouseEvent(e)));
|
|
15171
15171
|
};
|
|
@@ -15175,7 +15175,7 @@ var NgwLeaflet = (function () {
|
|
|
15175
15175
|
this._ondblclick = (e) => {
|
|
15176
15176
|
leafletSrcExports.DomEvent.stopPropagation(e);
|
|
15177
15177
|
const selected = !!this.layer._getSelected(layer);
|
|
15178
|
-
onDoubleClick(__spreadValues$
|
|
15178
|
+
onDoubleClick(__spreadValues$G({
|
|
15179
15179
|
selected
|
|
15180
15180
|
}, this._createMouseEvent(e)));
|
|
15181
15181
|
};
|
|
@@ -15853,19 +15853,19 @@ var NgwLeaflet = (function () {
|
|
|
15853
15853
|
typeof: evaluateArgs(([arg]) => typeOfValue(arg))
|
|
15854
15854
|
};
|
|
15855
15855
|
|
|
15856
|
-
var __defProp$
|
|
15857
|
-
var __getOwnPropSymbols$
|
|
15858
|
-
var __hasOwnProp$
|
|
15859
|
-
var __propIsEnum$
|
|
15860
|
-
var __defNormalProp$
|
|
15861
|
-
var __spreadValues$
|
|
15856
|
+
var __defProp$_ = Object.defineProperty;
|
|
15857
|
+
var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
|
|
15858
|
+
var __hasOwnProp$G = Object.prototype.hasOwnProperty;
|
|
15859
|
+
var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
|
|
15860
|
+
var __defNormalProp$_ = (obj, key, value) => key in obj ? __defProp$_(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15861
|
+
var __spreadValues$F = (a, b) => {
|
|
15862
15862
|
for (var prop in b || (b = {}))
|
|
15863
|
-
if (__hasOwnProp$
|
|
15864
|
-
__defNormalProp$
|
|
15865
|
-
if (__getOwnPropSymbols$
|
|
15866
|
-
for (var prop of __getOwnPropSymbols$
|
|
15867
|
-
if (__propIsEnum$
|
|
15868
|
-
__defNormalProp$
|
|
15863
|
+
if (__hasOwnProp$G.call(b, prop))
|
|
15864
|
+
__defNormalProp$_(a, prop, b[prop]);
|
|
15865
|
+
if (__getOwnPropSymbols$G)
|
|
15866
|
+
for (var prop of __getOwnPropSymbols$G(b)) {
|
|
15867
|
+
if (__propIsEnum$G.call(b, prop))
|
|
15868
|
+
__defNormalProp$_(a, prop, b[prop]);
|
|
15869
15869
|
}
|
|
15870
15870
|
return a;
|
|
15871
15871
|
};
|
|
@@ -15877,7 +15877,7 @@ var NgwLeaflet = (function () {
|
|
|
15877
15877
|
}
|
|
15878
15878
|
return false;
|
|
15879
15879
|
}
|
|
15880
|
-
const expressions = __spreadValues$
|
|
15880
|
+
const expressions = __spreadValues$F(__spreadValues$F(__spreadValues$F(__spreadValues$F(__spreadValues$F(__spreadValues$F({}, mathExpressions), typeExpressions), stringExpressions), lookupExpressions), decisionExpressions), interpolationExpressions);
|
|
15881
15881
|
function evaluate(expression, data = {}) {
|
|
15882
15882
|
const [name, ...args] = expression;
|
|
15883
15883
|
const expressionFun = expressions[name];
|
|
@@ -15890,19 +15890,19 @@ var NgwLeaflet = (function () {
|
|
|
15890
15890
|
throw new Error(`Expression "${name}" is not supported.`);
|
|
15891
15891
|
}
|
|
15892
15892
|
|
|
15893
|
-
var __defProp$
|
|
15894
|
-
var __getOwnPropSymbols$
|
|
15895
|
-
var __hasOwnProp$
|
|
15896
|
-
var __propIsEnum$
|
|
15897
|
-
var __defNormalProp$
|
|
15898
|
-
var __spreadValues$
|
|
15893
|
+
var __defProp$Z = Object.defineProperty;
|
|
15894
|
+
var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
|
|
15895
|
+
var __hasOwnProp$F = Object.prototype.hasOwnProperty;
|
|
15896
|
+
var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
|
|
15897
|
+
var __defNormalProp$Z = (obj, key, value) => key in obj ? __defProp$Z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15898
|
+
var __spreadValues$E = (a, b) => {
|
|
15899
15899
|
for (var prop in b || (b = {}))
|
|
15900
|
-
if (__hasOwnProp$
|
|
15901
|
-
__defNormalProp$
|
|
15902
|
-
if (__getOwnPropSymbols$
|
|
15903
|
-
for (var prop of __getOwnPropSymbols$
|
|
15904
|
-
if (__propIsEnum$
|
|
15905
|
-
__defNormalProp$
|
|
15900
|
+
if (__hasOwnProp$F.call(b, prop))
|
|
15901
|
+
__defNormalProp$Z(a, prop, b[prop]);
|
|
15902
|
+
if (__getOwnPropSymbols$F)
|
|
15903
|
+
for (var prop of __getOwnPropSymbols$F(b)) {
|
|
15904
|
+
if (__propIsEnum$F.call(b, prop))
|
|
15905
|
+
__defNormalProp$Z(a, prop, b[prop]);
|
|
15906
15906
|
}
|
|
15907
15907
|
return a;
|
|
15908
15908
|
};
|
|
@@ -15935,25 +15935,25 @@ var NgwLeaflet = (function () {
|
|
|
15935
15935
|
for (const p in expressions) {
|
|
15936
15936
|
fromCb[p] = expressions[p](feature);
|
|
15937
15937
|
}
|
|
15938
|
-
return __spreadValues$
|
|
15938
|
+
return __spreadValues$E(__spreadValues$E({}, paint), fromCb);
|
|
15939
15939
|
};
|
|
15940
15940
|
}
|
|
15941
15941
|
return;
|
|
15942
15942
|
}
|
|
15943
15943
|
|
|
15944
|
-
var __defProp$
|
|
15945
|
-
var __getOwnPropSymbols$
|
|
15946
|
-
var __hasOwnProp$
|
|
15947
|
-
var __propIsEnum$
|
|
15948
|
-
var __defNormalProp$
|
|
15949
|
-
var __spreadValues$
|
|
15944
|
+
var __defProp$Y = Object.defineProperty;
|
|
15945
|
+
var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
|
|
15946
|
+
var __hasOwnProp$E = Object.prototype.hasOwnProperty;
|
|
15947
|
+
var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
|
|
15948
|
+
var __defNormalProp$Y = (obj, key, value) => key in obj ? __defProp$Y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15949
|
+
var __spreadValues$D = (a, b) => {
|
|
15950
15950
|
for (var prop in b || (b = {}))
|
|
15951
|
-
if (__hasOwnProp$
|
|
15952
|
-
__defNormalProp$
|
|
15953
|
-
if (__getOwnPropSymbols$
|
|
15954
|
-
for (var prop of __getOwnPropSymbols$
|
|
15955
|
-
if (__propIsEnum$
|
|
15956
|
-
__defNormalProp$
|
|
15951
|
+
if (__hasOwnProp$E.call(b, prop))
|
|
15952
|
+
__defNormalProp$Y(a, prop, b[prop]);
|
|
15953
|
+
if (__getOwnPropSymbols$E)
|
|
15954
|
+
for (var prop of __getOwnPropSymbols$E(b)) {
|
|
15955
|
+
if (__propIsEnum$E.call(b, prop))
|
|
15956
|
+
__defNormalProp$Y(a, prop, b[prop]);
|
|
15957
15957
|
}
|
|
15958
15958
|
return a;
|
|
15959
15959
|
};
|
|
@@ -16000,7 +16000,7 @@ var NgwLeaflet = (function () {
|
|
|
16000
16000
|
return false;
|
|
16001
16001
|
}
|
|
16002
16002
|
function featureFilter(feature, filters) {
|
|
16003
|
-
const properties = __spreadValues$
|
|
16003
|
+
const properties = __spreadValues$D({}, feature.properties);
|
|
16004
16004
|
if (properties) {
|
|
16005
16005
|
properties.$id = feature.id;
|
|
16006
16006
|
return propertiesFilter(properties, filters);
|
|
@@ -16035,19 +16035,19 @@ var NgwLeaflet = (function () {
|
|
|
16035
16035
|
return logic === "any" ? filters_.some(filterFunction) : filters_.every(filterFunction);
|
|
16036
16036
|
}
|
|
16037
16037
|
|
|
16038
|
-
var __defProp$
|
|
16039
|
-
var __getOwnPropSymbols$
|
|
16040
|
-
var __hasOwnProp$
|
|
16041
|
-
var __propIsEnum$
|
|
16042
|
-
var __defNormalProp$
|
|
16043
|
-
var __spreadValues$
|
|
16038
|
+
var __defProp$X = Object.defineProperty;
|
|
16039
|
+
var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
|
|
16040
|
+
var __hasOwnProp$D = Object.prototype.hasOwnProperty;
|
|
16041
|
+
var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
|
|
16042
|
+
var __defNormalProp$X = (obj, key, value) => key in obj ? __defProp$X(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16043
|
+
var __spreadValues$C = (a, b) => {
|
|
16044
16044
|
for (var prop in b || (b = {}))
|
|
16045
|
-
if (__hasOwnProp$
|
|
16046
|
-
__defNormalProp$
|
|
16047
|
-
if (__getOwnPropSymbols$
|
|
16048
|
-
for (var prop of __getOwnPropSymbols$
|
|
16049
|
-
if (__propIsEnum$
|
|
16050
|
-
__defNormalProp$
|
|
16045
|
+
if (__hasOwnProp$D.call(b, prop))
|
|
16046
|
+
__defNormalProp$X(a, prop, b[prop]);
|
|
16047
|
+
if (__getOwnPropSymbols$D)
|
|
16048
|
+
for (var prop of __getOwnPropSymbols$D(b)) {
|
|
16049
|
+
if (__propIsEnum$D.call(b, prop))
|
|
16050
|
+
__defNormalProp$X(a, prop, b[prop]);
|
|
16051
16051
|
}
|
|
16052
16052
|
return a;
|
|
16053
16053
|
};
|
|
@@ -16076,7 +16076,7 @@ var NgwLeaflet = (function () {
|
|
|
16076
16076
|
return (feature) => {
|
|
16077
16077
|
const paint = paintsFilters.find((x) => featureFilter(feature, x[0]));
|
|
16078
16078
|
if (paint) {
|
|
16079
|
-
return __spreadValues$
|
|
16079
|
+
return __spreadValues$C(__spreadValues$C({}, mask), paint[1]);
|
|
16080
16080
|
}
|
|
16081
16081
|
return mask;
|
|
16082
16082
|
};
|
|
@@ -16100,8 +16100,8 @@ var NgwLeaflet = (function () {
|
|
|
16100
16100
|
}
|
|
16101
16101
|
function finalizePaint({ paint, defaultPaint }) {
|
|
16102
16102
|
var _a;
|
|
16103
|
-
let newPaint = __spreadValues$
|
|
16104
|
-
newPaint = __spreadValues$
|
|
16103
|
+
let newPaint = __spreadValues$C({}, defaultPaint);
|
|
16104
|
+
newPaint = __spreadValues$C(__spreadValues$C({}, newPaint), paint);
|
|
16105
16105
|
newPaint.fill = (_a = newPaint.fill) != null ? _a : true;
|
|
16106
16106
|
newPaint.stroke = newPaint.stroke !== void 0 ? newPaint.stroke : !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
|
|
16107
16107
|
return newPaint;
|
|
@@ -16114,7 +16114,7 @@ var NgwLeaflet = (function () {
|
|
|
16114
16114
|
if (!paint) {
|
|
16115
16115
|
throw new Error("paint is empty");
|
|
16116
16116
|
}
|
|
16117
|
-
let newPaint = __spreadValues$
|
|
16117
|
+
let newPaint = __spreadValues$C({}, defaultPaint);
|
|
16118
16118
|
if (isPaintCallback(paint)) {
|
|
16119
16119
|
const getPaintFunction = (feature) => {
|
|
16120
16120
|
const getPaint = preparePaint({
|
|
@@ -16171,41 +16171,41 @@ var NgwLeaflet = (function () {
|
|
|
16171
16171
|
return newPaint;
|
|
16172
16172
|
}
|
|
16173
16173
|
|
|
16174
|
-
var __defProp$
|
|
16175
|
-
var __defProps$
|
|
16176
|
-
var __getOwnPropDescs$
|
|
16177
|
-
var __getOwnPropSymbols$
|
|
16178
|
-
var __hasOwnProp$
|
|
16179
|
-
var __propIsEnum$
|
|
16180
|
-
var __defNormalProp$
|
|
16181
|
-
var __spreadValues$
|
|
16174
|
+
var __defProp$W = Object.defineProperty;
|
|
16175
|
+
var __defProps$n = Object.defineProperties;
|
|
16176
|
+
var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
|
|
16177
|
+
var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
|
|
16178
|
+
var __hasOwnProp$C = Object.prototype.hasOwnProperty;
|
|
16179
|
+
var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
|
|
16180
|
+
var __defNormalProp$W = (obj, key, value) => key in obj ? __defProp$W(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16181
|
+
var __spreadValues$B = (a, b) => {
|
|
16182
16182
|
for (var prop in b || (b = {}))
|
|
16183
|
-
if (__hasOwnProp$
|
|
16184
|
-
__defNormalProp$
|
|
16185
|
-
if (__getOwnPropSymbols$
|
|
16186
|
-
for (var prop of __getOwnPropSymbols$
|
|
16187
|
-
if (__propIsEnum$
|
|
16188
|
-
__defNormalProp$
|
|
16183
|
+
if (__hasOwnProp$C.call(b, prop))
|
|
16184
|
+
__defNormalProp$W(a, prop, b[prop]);
|
|
16185
|
+
if (__getOwnPropSymbols$C)
|
|
16186
|
+
for (var prop of __getOwnPropSymbols$C(b)) {
|
|
16187
|
+
if (__propIsEnum$C.call(b, prop))
|
|
16188
|
+
__defNormalProp$W(a, prop, b[prop]);
|
|
16189
16189
|
}
|
|
16190
16190
|
return a;
|
|
16191
16191
|
};
|
|
16192
|
-
var __spreadProps$
|
|
16193
|
-
var __objRest$
|
|
16192
|
+
var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
|
|
16193
|
+
var __objRest$8 = (source, exclude) => {
|
|
16194
16194
|
var target = {};
|
|
16195
16195
|
for (var prop in source)
|
|
16196
|
-
if (__hasOwnProp$
|
|
16196
|
+
if (__hasOwnProp$C.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
16197
16197
|
target[prop] = source[prop];
|
|
16198
|
-
if (source != null && __getOwnPropSymbols$
|
|
16199
|
-
for (var prop of __getOwnPropSymbols$
|
|
16200
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
16198
|
+
if (source != null && __getOwnPropSymbols$C)
|
|
16199
|
+
for (var prop of __getOwnPropSymbols$C(source)) {
|
|
16200
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$C.call(source, prop))
|
|
16201
16201
|
target[prop] = source[prop];
|
|
16202
16202
|
}
|
|
16203
16203
|
return target;
|
|
16204
16204
|
};
|
|
16205
|
-
var __publicField$
|
|
16205
|
+
var __publicField$F = (obj, key, value) => __defNormalProp$W(obj, key + "" , value);
|
|
16206
16206
|
class GeoJsonPaint {
|
|
16207
16207
|
constructor(layer) {
|
|
16208
|
-
__publicField$
|
|
16208
|
+
__publicField$F(this, "layer");
|
|
16209
16209
|
this.layer = layer;
|
|
16210
16210
|
}
|
|
16211
16211
|
setPaintEachLayer(paint) {
|
|
@@ -16273,7 +16273,7 @@ var NgwLeaflet = (function () {
|
|
|
16273
16273
|
return PAINT;
|
|
16274
16274
|
}
|
|
16275
16275
|
_createDivIcon(icon) {
|
|
16276
|
-
const _a = icon, { html, rotate, className } = _a, toLIconOpt = __objRest$
|
|
16276
|
+
const _a = icon, { html, rotate, className } = _a, toLIconOpt = __objRest$8(_a, ["html", "rotate", "className"]);
|
|
16277
16277
|
const element = document.createElement("div");
|
|
16278
16278
|
if (className) {
|
|
16279
16279
|
element.className = className;
|
|
@@ -16284,7 +16284,7 @@ var NgwLeaflet = (function () {
|
|
|
16284
16284
|
if (html) {
|
|
16285
16285
|
element.innerHTML = html;
|
|
16286
16286
|
}
|
|
16287
|
-
const divIcon = new leafletSrcExports.DivIcon(__spreadProps$
|
|
16287
|
+
const divIcon = new leafletSrcExports.DivIcon(__spreadProps$n(__spreadValues$B({
|
|
16288
16288
|
className: ""
|
|
16289
16289
|
}, toLIconOpt), {
|
|
16290
16290
|
html: element
|
|
@@ -16310,7 +16310,7 @@ var NgwLeaflet = (function () {
|
|
|
16310
16310
|
}
|
|
16311
16311
|
return (_, latlng) => {
|
|
16312
16312
|
const p = PAINT;
|
|
16313
|
-
return new leafletSrcExports.CircleMarker(latlng, this.preparePaint(__spreadValues$
|
|
16313
|
+
return new leafletSrcExports.CircleMarker(latlng, this.preparePaint(__spreadValues$B(__spreadValues$B({}, p), icon)));
|
|
16314
16314
|
};
|
|
16315
16315
|
}
|
|
16316
16316
|
createPaintOptions(paint) {
|
|
@@ -16332,27 +16332,27 @@ var NgwLeaflet = (function () {
|
|
|
16332
16332
|
}
|
|
16333
16333
|
}
|
|
16334
16334
|
|
|
16335
|
-
var __defProp$
|
|
16336
|
-
var __defProps$
|
|
16337
|
-
var __getOwnPropDescs$
|
|
16338
|
-
var __getOwnPropSymbols$
|
|
16339
|
-
var __hasOwnProp$
|
|
16340
|
-
var __propIsEnum$
|
|
16341
|
-
var __defNormalProp$
|
|
16342
|
-
var __spreadValues$
|
|
16335
|
+
var __defProp$V = Object.defineProperty;
|
|
16336
|
+
var __defProps$m = Object.defineProperties;
|
|
16337
|
+
var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
|
|
16338
|
+
var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
|
|
16339
|
+
var __hasOwnProp$B = Object.prototype.hasOwnProperty;
|
|
16340
|
+
var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
|
|
16341
|
+
var __defNormalProp$V = (obj, key, value) => key in obj ? __defProp$V(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16342
|
+
var __spreadValues$A = (a, b) => {
|
|
16343
16343
|
for (var prop in b || (b = {}))
|
|
16344
|
-
if (__hasOwnProp$
|
|
16345
|
-
__defNormalProp$
|
|
16346
|
-
if (__getOwnPropSymbols$
|
|
16347
|
-
for (var prop of __getOwnPropSymbols$
|
|
16348
|
-
if (__propIsEnum$
|
|
16349
|
-
__defNormalProp$
|
|
16344
|
+
if (__hasOwnProp$B.call(b, prop))
|
|
16345
|
+
__defNormalProp$V(a, prop, b[prop]);
|
|
16346
|
+
if (__getOwnPropSymbols$B)
|
|
16347
|
+
for (var prop of __getOwnPropSymbols$B(b)) {
|
|
16348
|
+
if (__propIsEnum$B.call(b, prop))
|
|
16349
|
+
__defNormalProp$V(a, prop, b[prop]);
|
|
16350
16350
|
}
|
|
16351
16351
|
return a;
|
|
16352
16352
|
};
|
|
16353
|
-
var __spreadProps$
|
|
16354
|
-
var __publicField$
|
|
16355
|
-
var __async$
|
|
16353
|
+
var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
|
|
16354
|
+
var __publicField$E = (obj, key, value) => __defNormalProp$V(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16355
|
+
var __async$u = (__this, __arguments, generator) => {
|
|
16356
16356
|
return new Promise((resolve, reject) => {
|
|
16357
16357
|
var fulfilled = (value) => {
|
|
16358
16358
|
try {
|
|
@@ -16375,22 +16375,22 @@ var NgwLeaflet = (function () {
|
|
|
16375
16375
|
class GeoJsonAdapter extends BaseAdapter {
|
|
16376
16376
|
constructor(map, options) {
|
|
16377
16377
|
super(map, options);
|
|
16378
|
-
__publicField$
|
|
16379
|
-
__publicField$
|
|
16380
|
-
__publicField$
|
|
16381
|
-
__publicField$
|
|
16382
|
-
__publicField$
|
|
16383
|
-
__publicField$
|
|
16384
|
-
__publicField$
|
|
16385
|
-
__publicField$
|
|
16386
|
-
__publicField$
|
|
16387
|
-
__publicField$
|
|
16388
|
-
__publicField$
|
|
16389
|
-
__publicField$
|
|
16390
|
-
__publicField$
|
|
16378
|
+
__publicField$E(this, "layer");
|
|
16379
|
+
__publicField$E(this, "selected", false);
|
|
16380
|
+
__publicField$E(this, "type");
|
|
16381
|
+
__publicField$E(this, "_layers", []);
|
|
16382
|
+
__publicField$E(this, "_events");
|
|
16383
|
+
__publicField$E(this, "paint");
|
|
16384
|
+
__publicField$E(this, "selectedPaint");
|
|
16385
|
+
__publicField$E(this, "_selectedLayers", []);
|
|
16386
|
+
__publicField$E(this, "_filteredLayers", []);
|
|
16387
|
+
__publicField$E(this, "_filterFun");
|
|
16388
|
+
__publicField$E(this, "_openedPopup", []);
|
|
16389
|
+
__publicField$E(this, "_paint");
|
|
16390
|
+
__publicField$E(this, "$updateTooltip", debounce(() => {
|
|
16391
16391
|
this.updateTooltip();
|
|
16392
16392
|
}, 300));
|
|
16393
|
-
__publicField$
|
|
16393
|
+
__publicField$E(this, "$unselect", () => {
|
|
16394
16394
|
this.unselect();
|
|
16395
16395
|
});
|
|
16396
16396
|
this._events = new GeoJsonEvents(this);
|
|
@@ -16399,7 +16399,7 @@ var NgwLeaflet = (function () {
|
|
|
16399
16399
|
addLayer(options) {
|
|
16400
16400
|
Object.assign(this.options, options);
|
|
16401
16401
|
this.paint = options.paint;
|
|
16402
|
-
this.layer = new leafletSrcExports.FeatureGroup([], __spreadProps$
|
|
16402
|
+
this.layer = new leafletSrcExports.FeatureGroup([], __spreadProps$m(__spreadValues$A({}, options.nativeOptions), {
|
|
16403
16403
|
pane: this.pane
|
|
16404
16404
|
}));
|
|
16405
16405
|
this.selectedPaint = options.selectedPaint;
|
|
@@ -16448,7 +16448,7 @@ var NgwLeaflet = (function () {
|
|
|
16448
16448
|
}
|
|
16449
16449
|
getSelected() {
|
|
16450
16450
|
return this._selectedLayers.map((x) => {
|
|
16451
|
-
return __spreadValues$
|
|
16451
|
+
return __spreadValues$A({
|
|
16452
16452
|
target: this,
|
|
16453
16453
|
feature: x.feature,
|
|
16454
16454
|
layer: x
|
|
@@ -16467,14 +16467,14 @@ var NgwLeaflet = (function () {
|
|
|
16467
16467
|
const filteredLayers = [];
|
|
16468
16468
|
this._layers.forEach(({ feature, layer }) => {
|
|
16469
16469
|
if (layer) {
|
|
16470
|
-
const ok = fun ? fun(__spreadValues$
|
|
16470
|
+
const ok = fun ? fun(__spreadValues$A({
|
|
16471
16471
|
target: this,
|
|
16472
16472
|
feature,
|
|
16473
16473
|
layer
|
|
16474
16474
|
}, createFeaturePositionOptions(feature))) : true;
|
|
16475
16475
|
if (ok) {
|
|
16476
16476
|
layer_.addLayer(layer);
|
|
16477
|
-
filteredLayers.push(__spreadValues$
|
|
16477
|
+
filteredLayers.push(__spreadValues$A({
|
|
16478
16478
|
target: this,
|
|
16479
16479
|
feature,
|
|
16480
16480
|
layer
|
|
@@ -16495,7 +16495,7 @@ var NgwLeaflet = (function () {
|
|
|
16495
16495
|
getLayers() {
|
|
16496
16496
|
return this._layers.map(({ layer, feature }) => {
|
|
16497
16497
|
const visible = layer && !!layer._map;
|
|
16498
|
-
return __spreadValues$
|
|
16498
|
+
return __spreadValues$A({
|
|
16499
16499
|
feature,
|
|
16500
16500
|
layer,
|
|
16501
16501
|
visible,
|
|
@@ -16613,13 +16613,13 @@ var NgwLeaflet = (function () {
|
|
|
16613
16613
|
}
|
|
16614
16614
|
}
|
|
16615
16615
|
updatePaint(paint) {
|
|
16616
|
-
this.paint = __spreadValues$
|
|
16616
|
+
this.paint = __spreadValues$A(__spreadValues$A({}, this.paint), paint);
|
|
16617
16617
|
for (const l of this._layers) {
|
|
16618
16618
|
this._paint.setPaint(l, this.paint);
|
|
16619
16619
|
}
|
|
16620
16620
|
}
|
|
16621
16621
|
updateSelectedPaint(paint) {
|
|
16622
|
-
this.selectedPaint = __spreadValues$
|
|
16622
|
+
this.selectedPaint = __spreadValues$A(__spreadValues$A({}, this.selectedPaint), paint);
|
|
16623
16623
|
for (const l of this._selectedLayers) {
|
|
16624
16624
|
this._paint.setPaint(l, this.selectedPaint);
|
|
16625
16625
|
}
|
|
@@ -16636,7 +16636,7 @@ var NgwLeaflet = (function () {
|
|
|
16636
16636
|
if (feature.properties && labelField) {
|
|
16637
16637
|
message = feature.properties[labelField];
|
|
16638
16638
|
} else if (label) {
|
|
16639
|
-
message = label(__spreadValues$
|
|
16639
|
+
message = label(__spreadValues$A(__spreadValues$A({
|
|
16640
16640
|
target: this
|
|
16641
16641
|
}, layerDef), createFeaturePositionOptions(feature)));
|
|
16642
16642
|
}
|
|
@@ -16647,7 +16647,7 @@ var NgwLeaflet = (function () {
|
|
|
16647
16647
|
}
|
|
16648
16648
|
}
|
|
16649
16649
|
_openPopup(_0) {
|
|
16650
|
-
return __async$
|
|
16650
|
+
return __async$u(this, arguments, function* (def, options = {}, type, latLng) {
|
|
16651
16651
|
var _a, _b;
|
|
16652
16652
|
const { feature, layer } = def;
|
|
16653
16653
|
const {
|
|
@@ -16655,7 +16655,7 @@ var NgwLeaflet = (function () {
|
|
|
16655
16655
|
autoPan,
|
|
16656
16656
|
maxWidth,
|
|
16657
16657
|
closeButton: closeButton_
|
|
16658
|
-
} = __spreadValues$
|
|
16658
|
+
} = __spreadValues$A({
|
|
16659
16659
|
minWidth: 300
|
|
16660
16660
|
}, options);
|
|
16661
16661
|
const closeButton = closeButton_ != null ? closeButton_ : !this.options.selectOnHover;
|
|
@@ -16671,7 +16671,7 @@ var NgwLeaflet = (function () {
|
|
|
16671
16671
|
};
|
|
16672
16672
|
let content;
|
|
16673
16673
|
if (options.createPopupContent) {
|
|
16674
|
-
content = yield options.createPopupContent(__spreadValues$
|
|
16674
|
+
content = yield options.createPopupContent(__spreadValues$A({
|
|
16675
16675
|
layer,
|
|
16676
16676
|
feature,
|
|
16677
16677
|
target: this,
|
|
@@ -16747,9 +16747,9 @@ var NgwLeaflet = (function () {
|
|
|
16747
16747
|
lopt = {
|
|
16748
16748
|
style: (feature) => {
|
|
16749
16749
|
if (feature) {
|
|
16750
|
-
return this._paint.preparePaint(__spreadValues$
|
|
16750
|
+
return this._paint.preparePaint(__spreadValues$A(__spreadValues$A({}, PAINT), paint(feature)));
|
|
16751
16751
|
} else {
|
|
16752
|
-
return this._paint.preparePaint(__spreadProps$
|
|
16752
|
+
return this._paint.preparePaint(__spreadProps$m(__spreadValues$A({}, PAINT), { type: "path" }));
|
|
16753
16753
|
}
|
|
16754
16754
|
}
|
|
16755
16755
|
};
|
|
@@ -16765,7 +16765,7 @@ var NgwLeaflet = (function () {
|
|
|
16765
16765
|
_onEachFeature(feature, layer) {
|
|
16766
16766
|
const layer_ = this.layer;
|
|
16767
16767
|
if (layer_) {
|
|
16768
|
-
const def = __spreadValues$
|
|
16768
|
+
const def = __spreadValues$A({
|
|
16769
16769
|
target: this,
|
|
16770
16770
|
feature,
|
|
16771
16771
|
layer
|
|
@@ -16800,7 +16800,7 @@ var NgwLeaflet = (function () {
|
|
|
16800
16800
|
setTimeout(() => {
|
|
16801
16801
|
if (popup) {
|
|
16802
16802
|
this._openPopup(
|
|
16803
|
-
__spreadValues$
|
|
16803
|
+
__spreadValues$A({
|
|
16804
16804
|
target: this,
|
|
16805
16805
|
layer,
|
|
16806
16806
|
feature
|
|
@@ -16818,7 +16818,7 @@ var NgwLeaflet = (function () {
|
|
|
16818
16818
|
leafletSrcExports.DomEvent.stopPropagation(e);
|
|
16819
16819
|
const layer = e.target;
|
|
16820
16820
|
const feature = layer.feature;
|
|
16821
|
-
const def = __spreadValues$
|
|
16821
|
+
const def = __spreadValues$A({
|
|
16822
16822
|
target: this,
|
|
16823
16823
|
layer,
|
|
16824
16824
|
feature
|
|
@@ -16851,7 +16851,7 @@ var NgwLeaflet = (function () {
|
|
|
16851
16851
|
}
|
|
16852
16852
|
if (this.options.onSelect) {
|
|
16853
16853
|
const features = def.feature ? [def.feature] : [];
|
|
16854
|
-
this.options.onSelect(__spreadValues$
|
|
16854
|
+
this.options.onSelect(__spreadValues$A({
|
|
16855
16855
|
type,
|
|
16856
16856
|
layer: this,
|
|
16857
16857
|
features
|
|
@@ -16943,20 +16943,20 @@ var NgwLeaflet = (function () {
|
|
|
16943
16943
|
return [promise, abortFunc];
|
|
16944
16944
|
}
|
|
16945
16945
|
|
|
16946
|
-
var __defProp$
|
|
16947
|
-
var __defNormalProp$
|
|
16948
|
-
var __publicField$
|
|
16946
|
+
var __defProp$U = Object.defineProperty;
|
|
16947
|
+
var __defNormalProp$U = (obj, key, value) => key in obj ? __defProp$U(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16948
|
+
var __publicField$D = (obj, key, value) => __defNormalProp$U(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16949
16949
|
class Queue {
|
|
16950
16950
|
/**
|
|
16951
16951
|
* @param {PromiseQueueOptions} options - Configuration options for the queue.
|
|
16952
16952
|
*/
|
|
16953
16953
|
constructor({ concurrency = 1, delay = 0 } = {}) {
|
|
16954
|
-
__publicField$
|
|
16955
|
-
__publicField$
|
|
16956
|
-
__publicField$
|
|
16957
|
-
__publicField$
|
|
16958
|
-
__publicField$
|
|
16959
|
-
__publicField$
|
|
16954
|
+
__publicField$D(this, "queue", []);
|
|
16955
|
+
__publicField$D(this, "concurrency");
|
|
16956
|
+
__publicField$D(this, "activeCount", 0);
|
|
16957
|
+
__publicField$D(this, "timeoutId");
|
|
16958
|
+
__publicField$D(this, "delay");
|
|
16959
|
+
__publicField$D(this, "toAbort", []);
|
|
16960
16960
|
this.concurrency = concurrency;
|
|
16961
16961
|
this.delay = delay;
|
|
16962
16962
|
}
|
|
@@ -17032,13 +17032,13 @@ var NgwLeaflet = (function () {
|
|
|
17032
17032
|
|
|
17033
17033
|
const imageQueue = new Queue({ concurrency: 6, delay: 200 });
|
|
17034
17034
|
|
|
17035
|
-
var __defProp$
|
|
17036
|
-
var __defNormalProp$
|
|
17037
|
-
var __publicField$
|
|
17035
|
+
var __defProp$T = Object.defineProperty;
|
|
17036
|
+
var __defNormalProp$T = (obj, key, value) => key in obj ? __defProp$T(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17037
|
+
var __publicField$C = (obj, key, value) => __defNormalProp$T(obj, key + "" , value);
|
|
17038
17038
|
class ImageOverlay extends leafletSrcExports.ImageOverlay {
|
|
17039
17039
|
constructor(imageUrl, bounds, options) {
|
|
17040
17040
|
super(imageUrl, bounds, options);
|
|
17041
|
-
__publicField$
|
|
17041
|
+
__publicField$C(this, "_aborter");
|
|
17042
17042
|
}
|
|
17043
17043
|
cancelLoad() {
|
|
17044
17044
|
if (this._aborter) {
|
|
@@ -17067,14 +17067,14 @@ var NgwLeaflet = (function () {
|
|
|
17067
17067
|
}
|
|
17068
17068
|
}
|
|
17069
17069
|
|
|
17070
|
-
var __defProp$
|
|
17071
|
-
var __defNormalProp$
|
|
17072
|
-
var __publicField$
|
|
17070
|
+
var __defProp$S = Object.defineProperty;
|
|
17071
|
+
var __defNormalProp$S = (obj, key, value) => key in obj ? __defProp$S(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17072
|
+
var __publicField$B = (obj, key, value) => __defNormalProp$S(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
17073
17073
|
class ImageLayer extends leafletSrcExports.Layer {
|
|
17074
17074
|
constructor(url, options) {
|
|
17075
17075
|
var _a;
|
|
17076
17076
|
super(options);
|
|
17077
|
-
__publicField$
|
|
17077
|
+
__publicField$B(this, "defaultWmsParams", {
|
|
17078
17078
|
service: "WMS",
|
|
17079
17079
|
request: "GetMap",
|
|
17080
17080
|
version: "1.1.1",
|
|
@@ -17083,7 +17083,7 @@ var NgwLeaflet = (function () {
|
|
|
17083
17083
|
format: "image/jpeg",
|
|
17084
17084
|
transparent: false
|
|
17085
17085
|
});
|
|
17086
|
-
__publicField$
|
|
17086
|
+
__publicField$B(this, "options", {
|
|
17087
17087
|
crs: null,
|
|
17088
17088
|
uppercase: false,
|
|
17089
17089
|
attribution: "",
|
|
@@ -17096,11 +17096,11 @@ var NgwLeaflet = (function () {
|
|
|
17096
17096
|
viewPortBuffer: 0,
|
|
17097
17097
|
setViewDelay: 100
|
|
17098
17098
|
});
|
|
17099
|
-
__publicField$
|
|
17100
|
-
__publicField$
|
|
17101
|
-
__publicField$
|
|
17102
|
-
__publicField$
|
|
17103
|
-
__publicField$
|
|
17099
|
+
__publicField$B(this, "wmsParams");
|
|
17100
|
+
__publicField$B(this, "_url");
|
|
17101
|
+
__publicField$B(this, "_currentUrl");
|
|
17102
|
+
__publicField$B(this, "_currentOverlay");
|
|
17103
|
+
__publicField$B(this, "_loadedOverlay");
|
|
17104
17104
|
this._url = url;
|
|
17105
17105
|
const params = {};
|
|
17106
17106
|
const opts = {};
|
|
@@ -17264,34 +17264,34 @@ var NgwLeaflet = (function () {
|
|
|
17264
17264
|
}
|
|
17265
17265
|
}
|
|
17266
17266
|
|
|
17267
|
-
var __defProp$
|
|
17268
|
-
var __getOwnPropSymbols$
|
|
17269
|
-
var __hasOwnProp$
|
|
17270
|
-
var __propIsEnum$
|
|
17271
|
-
var __defNormalProp$
|
|
17272
|
-
var __spreadValues$
|
|
17267
|
+
var __defProp$R = Object.defineProperty;
|
|
17268
|
+
var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
|
|
17269
|
+
var __hasOwnProp$A = Object.prototype.hasOwnProperty;
|
|
17270
|
+
var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
|
|
17271
|
+
var __defNormalProp$R = (obj, key, value) => key in obj ? __defProp$R(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17272
|
+
var __spreadValues$z = (a, b) => {
|
|
17273
17273
|
for (var prop in b || (b = {}))
|
|
17274
|
-
if (__hasOwnProp$
|
|
17275
|
-
__defNormalProp$
|
|
17276
|
-
if (__getOwnPropSymbols$
|
|
17277
|
-
for (var prop of __getOwnPropSymbols$
|
|
17278
|
-
if (__propIsEnum$
|
|
17279
|
-
__defNormalProp$
|
|
17274
|
+
if (__hasOwnProp$A.call(b, prop))
|
|
17275
|
+
__defNormalProp$R(a, prop, b[prop]);
|
|
17276
|
+
if (__getOwnPropSymbols$A)
|
|
17277
|
+
for (var prop of __getOwnPropSymbols$A(b)) {
|
|
17278
|
+
if (__propIsEnum$A.call(b, prop))
|
|
17279
|
+
__defNormalProp$R(a, prop, b[prop]);
|
|
17280
17280
|
}
|
|
17281
17281
|
return a;
|
|
17282
17282
|
};
|
|
17283
|
-
var __publicField$
|
|
17283
|
+
var __publicField$A = (obj, key, value) => __defNormalProp$R(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
17284
17284
|
class ImageAdapter extends BaseAdapter {
|
|
17285
17285
|
constructor() {
|
|
17286
17286
|
super(...arguments);
|
|
17287
|
-
__publicField$
|
|
17287
|
+
__publicField$A(this, "layer");
|
|
17288
17288
|
}
|
|
17289
17289
|
addLayer(options) {
|
|
17290
17290
|
const url = options && options.url;
|
|
17291
17291
|
if (url) {
|
|
17292
|
-
options = __spreadValues$
|
|
17292
|
+
options = __spreadValues$z({ transparent: true }, options);
|
|
17293
17293
|
const updateWmsParamsFromOpt = options.updateWmsParams;
|
|
17294
|
-
this.layer = new ImageLayer(url, __spreadValues$
|
|
17294
|
+
this.layer = new ImageLayer(url, __spreadValues$z(__spreadValues$z(__spreadValues$z({
|
|
17295
17295
|
pane: this.pane,
|
|
17296
17296
|
headers: options.headers,
|
|
17297
17297
|
setViewDelay: options.setViewDelay
|
|
@@ -17314,7 +17314,7 @@ var NgwLeaflet = (function () {
|
|
|
17314
17314
|
}
|
|
17315
17315
|
}
|
|
17316
17316
|
}
|
|
17317
|
-
__publicField$
|
|
17317
|
+
__publicField$A(ImageAdapter, "queue", imageQueue);
|
|
17318
17318
|
|
|
17319
17319
|
function makeRemote(Base) {
|
|
17320
17320
|
return class RemoteTileLayer extends Base {
|
|
@@ -17376,33 +17376,33 @@ var NgwLeaflet = (function () {
|
|
|
17376
17376
|
}
|
|
17377
17377
|
const TileLayer = makeRemote(TileLayerBase);
|
|
17378
17378
|
|
|
17379
|
-
var __defProp$
|
|
17380
|
-
var __defProps$
|
|
17381
|
-
var __getOwnPropDescs$
|
|
17382
|
-
var __getOwnPropSymbols$
|
|
17383
|
-
var __hasOwnProp$
|
|
17384
|
-
var __propIsEnum$
|
|
17385
|
-
var __defNormalProp$
|
|
17386
|
-
var __spreadValues$
|
|
17379
|
+
var __defProp$Q = Object.defineProperty;
|
|
17380
|
+
var __defProps$l = Object.defineProperties;
|
|
17381
|
+
var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
|
|
17382
|
+
var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
|
|
17383
|
+
var __hasOwnProp$z = Object.prototype.hasOwnProperty;
|
|
17384
|
+
var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
|
|
17385
|
+
var __defNormalProp$Q = (obj, key, value) => key in obj ? __defProp$Q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17386
|
+
var __spreadValues$y = (a, b) => {
|
|
17387
17387
|
for (var prop in b || (b = {}))
|
|
17388
|
-
if (__hasOwnProp$
|
|
17389
|
-
__defNormalProp$
|
|
17390
|
-
if (__getOwnPropSymbols$
|
|
17391
|
-
for (var prop of __getOwnPropSymbols$
|
|
17392
|
-
if (__propIsEnum$
|
|
17393
|
-
__defNormalProp$
|
|
17388
|
+
if (__hasOwnProp$z.call(b, prop))
|
|
17389
|
+
__defNormalProp$Q(a, prop, b[prop]);
|
|
17390
|
+
if (__getOwnPropSymbols$z)
|
|
17391
|
+
for (var prop of __getOwnPropSymbols$z(b)) {
|
|
17392
|
+
if (__propIsEnum$z.call(b, prop))
|
|
17393
|
+
__defNormalProp$Q(a, prop, b[prop]);
|
|
17394
17394
|
}
|
|
17395
17395
|
return a;
|
|
17396
17396
|
};
|
|
17397
|
-
var __spreadProps$
|
|
17398
|
-
var __objRest$
|
|
17397
|
+
var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
|
|
17398
|
+
var __objRest$7 = (source, exclude) => {
|
|
17399
17399
|
var target = {};
|
|
17400
17400
|
for (var prop in source)
|
|
17401
|
-
if (__hasOwnProp$
|
|
17401
|
+
if (__hasOwnProp$z.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
17402
17402
|
target[prop] = source[prop];
|
|
17403
|
-
if (source != null && __getOwnPropSymbols$
|
|
17404
|
-
for (var prop of __getOwnPropSymbols$
|
|
17405
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
17403
|
+
if (source != null && __getOwnPropSymbols$z)
|
|
17404
|
+
for (var prop of __getOwnPropSymbols$z(source)) {
|
|
17405
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$z.call(source, prop))
|
|
17406
17406
|
target[prop] = source[prop];
|
|
17407
17407
|
}
|
|
17408
17408
|
return target;
|
|
@@ -17411,9 +17411,9 @@ var NgwLeaflet = (function () {
|
|
|
17411
17411
|
addLayer(options) {
|
|
17412
17412
|
this.options = Object.assign(this.options, options);
|
|
17413
17413
|
if (options) {
|
|
17414
|
-
const _a = options, { url } = _a, opt = __objRest$
|
|
17414
|
+
const _a = options, { url } = _a, opt = __objRest$7(_a, ["url"]);
|
|
17415
17415
|
if (url) {
|
|
17416
|
-
const tileLayerOptions = __spreadValues$
|
|
17416
|
+
const tileLayerOptions = __spreadValues$y({
|
|
17417
17417
|
pane: this.pane,
|
|
17418
17418
|
attribution: opt.attribution,
|
|
17419
17419
|
minZoom: opt.minZoom,
|
|
@@ -17424,7 +17424,7 @@ var NgwLeaflet = (function () {
|
|
|
17424
17424
|
}
|
|
17425
17425
|
let layer;
|
|
17426
17426
|
if (opt.headers || opt.withCredentials) {
|
|
17427
|
-
layer = new TileLayer(url, __spreadProps$
|
|
17427
|
+
layer = new TileLayer(url, __spreadProps$l(__spreadValues$y({}, tileLayerOptions), {
|
|
17428
17428
|
headers: opt.headers,
|
|
17429
17429
|
withCredentials: opt.withCredentials,
|
|
17430
17430
|
setViewDelay: opt.setViewDelay
|
|
@@ -17447,29 +17447,29 @@ var NgwLeaflet = (function () {
|
|
|
17447
17447
|
}
|
|
17448
17448
|
}
|
|
17449
17449
|
|
|
17450
|
-
var __defProp$
|
|
17451
|
-
var __defProps$
|
|
17452
|
-
var __getOwnPropDescs$
|
|
17453
|
-
var __getOwnPropSymbols$
|
|
17454
|
-
var __hasOwnProp$
|
|
17455
|
-
var __propIsEnum$
|
|
17456
|
-
var __defNormalProp$
|
|
17457
|
-
var __spreadValues$
|
|
17450
|
+
var __defProp$P = Object.defineProperty;
|
|
17451
|
+
var __defProps$k = Object.defineProperties;
|
|
17452
|
+
var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
|
|
17453
|
+
var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
|
|
17454
|
+
var __hasOwnProp$y = Object.prototype.hasOwnProperty;
|
|
17455
|
+
var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
|
|
17456
|
+
var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17457
|
+
var __spreadValues$x = (a, b) => {
|
|
17458
17458
|
for (var prop in b || (b = {}))
|
|
17459
|
-
if (__hasOwnProp$
|
|
17460
|
-
__defNormalProp$
|
|
17461
|
-
if (__getOwnPropSymbols$
|
|
17462
|
-
for (var prop of __getOwnPropSymbols$
|
|
17463
|
-
if (__propIsEnum$
|
|
17464
|
-
__defNormalProp$
|
|
17459
|
+
if (__hasOwnProp$y.call(b, prop))
|
|
17460
|
+
__defNormalProp$P(a, prop, b[prop]);
|
|
17461
|
+
if (__getOwnPropSymbols$y)
|
|
17462
|
+
for (var prop of __getOwnPropSymbols$y(b)) {
|
|
17463
|
+
if (__propIsEnum$y.call(b, prop))
|
|
17464
|
+
__defNormalProp$P(a, prop, b[prop]);
|
|
17465
17465
|
}
|
|
17466
17466
|
return a;
|
|
17467
17467
|
};
|
|
17468
|
-
var __spreadProps$
|
|
17468
|
+
var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
|
|
17469
17469
|
class OsmAdapter extends TileAdapter {
|
|
17470
17470
|
addLayer(options) {
|
|
17471
17471
|
const url = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
|
|
17472
|
-
return super.addLayer(__spreadProps$
|
|
17472
|
+
return super.addLayer(__spreadProps$k(__spreadValues$x({
|
|
17473
17473
|
name: "OpenStreetMap",
|
|
17474
17474
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
17475
17475
|
}, options), {
|
|
@@ -17485,33 +17485,33 @@ var NgwLeaflet = (function () {
|
|
|
17485
17485
|
}
|
|
17486
17486
|
const WmsLayer = makeRemote(WmsLayerBase);
|
|
17487
17487
|
|
|
17488
|
-
var __defProp$
|
|
17489
|
-
var __defProps$
|
|
17490
|
-
var __getOwnPropDescs$
|
|
17491
|
-
var __getOwnPropSymbols$
|
|
17492
|
-
var __hasOwnProp$
|
|
17493
|
-
var __propIsEnum$
|
|
17494
|
-
var __defNormalProp$
|
|
17495
|
-
var __spreadValues$
|
|
17488
|
+
var __defProp$O = Object.defineProperty;
|
|
17489
|
+
var __defProps$j = Object.defineProperties;
|
|
17490
|
+
var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
|
|
17491
|
+
var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
|
|
17492
|
+
var __hasOwnProp$x = Object.prototype.hasOwnProperty;
|
|
17493
|
+
var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
|
|
17494
|
+
var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17495
|
+
var __spreadValues$w = (a, b) => {
|
|
17496
17496
|
for (var prop in b || (b = {}))
|
|
17497
|
-
if (__hasOwnProp$
|
|
17498
|
-
__defNormalProp$
|
|
17499
|
-
if (__getOwnPropSymbols$
|
|
17500
|
-
for (var prop of __getOwnPropSymbols$
|
|
17501
|
-
if (__propIsEnum$
|
|
17502
|
-
__defNormalProp$
|
|
17497
|
+
if (__hasOwnProp$x.call(b, prop))
|
|
17498
|
+
__defNormalProp$O(a, prop, b[prop]);
|
|
17499
|
+
if (__getOwnPropSymbols$x)
|
|
17500
|
+
for (var prop of __getOwnPropSymbols$x(b)) {
|
|
17501
|
+
if (__propIsEnum$x.call(b, prop))
|
|
17502
|
+
__defNormalProp$O(a, prop, b[prop]);
|
|
17503
17503
|
}
|
|
17504
17504
|
return a;
|
|
17505
17505
|
};
|
|
17506
|
-
var __spreadProps$
|
|
17507
|
-
var __objRest$
|
|
17506
|
+
var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
|
|
17507
|
+
var __objRest$6 = (source, exclude) => {
|
|
17508
17508
|
var target = {};
|
|
17509
17509
|
for (var prop in source)
|
|
17510
|
-
if (__hasOwnProp$
|
|
17510
|
+
if (__hasOwnProp$x.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
17511
17511
|
target[prop] = source[prop];
|
|
17512
|
-
if (source != null && __getOwnPropSymbols$
|
|
17513
|
-
for (var prop of __getOwnPropSymbols$
|
|
17514
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
17512
|
+
if (source != null && __getOwnPropSymbols$x)
|
|
17513
|
+
for (var prop of __getOwnPropSymbols$x(source)) {
|
|
17514
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$x.call(source, prop))
|
|
17515
17515
|
target[prop] = source[prop];
|
|
17516
17516
|
}
|
|
17517
17517
|
return target;
|
|
@@ -17519,9 +17519,9 @@ var NgwLeaflet = (function () {
|
|
|
17519
17519
|
class WmsAdapter extends BaseAdapter {
|
|
17520
17520
|
addLayer(options) {
|
|
17521
17521
|
Object.assign(this.options, options);
|
|
17522
|
-
const _a = options, { url } = _a, opt = __objRest$
|
|
17522
|
+
const _a = options, { url } = _a, opt = __objRest$6(_a, ["url"]);
|
|
17523
17523
|
if (url) {
|
|
17524
|
-
const layerOptions = __spreadValues$
|
|
17524
|
+
const layerOptions = __spreadValues$w({
|
|
17525
17525
|
pane: this.pane,
|
|
17526
17526
|
attribution: opt.attribution,
|
|
17527
17527
|
minZoom: opt.minZoom,
|
|
@@ -17532,7 +17532,7 @@ var NgwLeaflet = (function () {
|
|
|
17532
17532
|
}, options.nativeOptions);
|
|
17533
17533
|
let layer;
|
|
17534
17534
|
if (opt.headers || opt.withCredentials) {
|
|
17535
|
-
layer = new WmsLayer(url, __spreadProps$
|
|
17535
|
+
layer = new WmsLayer(url, __spreadProps$j(__spreadValues$w({}, layerOptions), {
|
|
17536
17536
|
headers: opt.headers,
|
|
17537
17537
|
withCredentials: opt.withCredentials
|
|
17538
17538
|
}));
|
|
@@ -17552,33 +17552,33 @@ var NgwLeaflet = (function () {
|
|
|
17552
17552
|
];
|
|
17553
17553
|
}
|
|
17554
17554
|
|
|
17555
|
-
var __defProp$
|
|
17556
|
-
var __getOwnPropSymbols$
|
|
17557
|
-
var __hasOwnProp$
|
|
17558
|
-
var __propIsEnum$
|
|
17559
|
-
var __defNormalProp$
|
|
17560
|
-
var __spreadValues$
|
|
17555
|
+
var __defProp$N = Object.defineProperty;
|
|
17556
|
+
var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
|
|
17557
|
+
var __hasOwnProp$w = Object.prototype.hasOwnProperty;
|
|
17558
|
+
var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
|
|
17559
|
+
var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17560
|
+
var __spreadValues$v = (a, b) => {
|
|
17561
17561
|
for (var prop in b || (b = {}))
|
|
17562
|
-
if (__hasOwnProp$
|
|
17563
|
-
__defNormalProp$
|
|
17564
|
-
if (__getOwnPropSymbols$
|
|
17565
|
-
for (var prop of __getOwnPropSymbols$
|
|
17566
|
-
if (__propIsEnum$
|
|
17567
|
-
__defNormalProp$
|
|
17562
|
+
if (__hasOwnProp$w.call(b, prop))
|
|
17563
|
+
__defNormalProp$N(a, prop, b[prop]);
|
|
17564
|
+
if (__getOwnPropSymbols$w)
|
|
17565
|
+
for (var prop of __getOwnPropSymbols$w(b)) {
|
|
17566
|
+
if (__propIsEnum$w.call(b, prop))
|
|
17567
|
+
__defNormalProp$N(a, prop, b[prop]);
|
|
17568
17568
|
}
|
|
17569
17569
|
return a;
|
|
17570
17570
|
};
|
|
17571
|
-
var __publicField$
|
|
17571
|
+
var __publicField$z = (obj, key, value) => __defNormalProp$N(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
17572
17572
|
const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
17573
17573
|
constructor() {
|
|
17574
|
-
__publicField$
|
|
17575
|
-
__publicField$
|
|
17576
|
-
__publicField$
|
|
17577
|
-
__publicField$
|
|
17578
|
-
__publicField$
|
|
17579
|
-
__publicField$
|
|
17580
|
-
__publicField$
|
|
17581
|
-
__publicField$
|
|
17574
|
+
__publicField$z(this, "options", { target: "map" });
|
|
17575
|
+
__publicField$z(this, "layerAdapters", _LeafletMapAdapter.layerAdapters);
|
|
17576
|
+
__publicField$z(this, "controlAdapters", _LeafletMapAdapter.controlAdapters);
|
|
17577
|
+
__publicField$z(this, "emitter", new EventEmitter());
|
|
17578
|
+
__publicField$z(this, "map");
|
|
17579
|
+
__publicField$z(this, "_resizeObserver");
|
|
17580
|
+
__publicField$z(this, "_unselectCb", []);
|
|
17581
|
+
__publicField$z(this, "_universalEvents", [
|
|
17582
17582
|
"move",
|
|
17583
17583
|
"zoom",
|
|
17584
17584
|
"zoomend",
|
|
@@ -17586,14 +17586,14 @@ var NgwLeaflet = (function () {
|
|
|
17586
17586
|
"moveend",
|
|
17587
17587
|
"movestart"
|
|
17588
17588
|
]);
|
|
17589
|
-
__publicField$
|
|
17589
|
+
__publicField$z(this, "_positionEvents", [
|
|
17590
17590
|
"mousemove",
|
|
17591
17591
|
"mouseout",
|
|
17592
17592
|
"mouseover"
|
|
17593
17593
|
]);
|
|
17594
17594
|
}
|
|
17595
17595
|
create(options) {
|
|
17596
|
-
this.options = __spreadValues$
|
|
17596
|
+
this.options = __spreadValues$v({}, options);
|
|
17597
17597
|
if (this.options.target) {
|
|
17598
17598
|
const {
|
|
17599
17599
|
zoom,
|
|
@@ -17603,7 +17603,7 @@ var NgwLeaflet = (function () {
|
|
|
17603
17603
|
maxBounds: mb,
|
|
17604
17604
|
mapAdapterOptions
|
|
17605
17605
|
} = this.options;
|
|
17606
|
-
this.map = this.options.map || new leafletSrcExports.Map(this.options.target, __spreadValues$
|
|
17606
|
+
this.map = this.options.map || new leafletSrcExports.Map(this.options.target, __spreadValues$v({
|
|
17607
17607
|
attributionControl: false,
|
|
17608
17608
|
zoomControl: false,
|
|
17609
17609
|
maxBounds: mb ? arrayToBoundsExpression(mb) : void 0,
|
|
@@ -17886,7 +17886,7 @@ var NgwLeaflet = (function () {
|
|
|
17886
17886
|
}
|
|
17887
17887
|
}
|
|
17888
17888
|
};
|
|
17889
|
-
__publicField$
|
|
17889
|
+
__publicField$z(_LeafletMapAdapter, "layerAdapters", {
|
|
17890
17890
|
GEOJSON: GeoJsonAdapter,
|
|
17891
17891
|
IMAGE: ImageAdapter,
|
|
17892
17892
|
TILE: TileAdapter,
|
|
@@ -17894,11 +17894,11 @@ var NgwLeaflet = (function () {
|
|
|
17894
17894
|
// // MVT: MvtAdapter,
|
|
17895
17895
|
OSM: OsmAdapter
|
|
17896
17896
|
});
|
|
17897
|
-
__publicField$
|
|
17897
|
+
__publicField$z(_LeafletMapAdapter, "controlAdapters", {
|
|
17898
17898
|
ZOOM: leafletSrcExports.Control.Zoom,
|
|
17899
17899
|
ATTRIBUTION: AttributionControl
|
|
17900
17900
|
});
|
|
17901
|
-
__publicField$
|
|
17901
|
+
__publicField$z(_LeafletMapAdapter, "Map", leafletSrcExports.Map);
|
|
17902
17902
|
let LeafletMapAdapter = _LeafletMapAdapter;
|
|
17903
17903
|
|
|
17904
17904
|
const svgPath = {
|
|
@@ -17973,12 +17973,12 @@ var NgwLeaflet = (function () {
|
|
|
17973
17973
|
};
|
|
17974
17974
|
}
|
|
17975
17975
|
|
|
17976
|
-
var __defProp$
|
|
17977
|
-
var __defNormalProp$
|
|
17978
|
-
var __publicField$
|
|
17976
|
+
var __defProp$M = Object.defineProperty;
|
|
17977
|
+
var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17978
|
+
var __publicField$y = (obj, key, value) => __defNormalProp$M(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
17979
17979
|
const _Cache = class _Cache {
|
|
17980
17980
|
constructor(options = {}) {
|
|
17981
|
-
__publicField$
|
|
17981
|
+
__publicField$y(this, "cache", []);
|
|
17982
17982
|
var _a;
|
|
17983
17983
|
const namespace = (_a = options.namespace) != null ? _a : "default";
|
|
17984
17984
|
if (_Cache.instance[namespace]) {
|
|
@@ -18084,12 +18084,12 @@ var NgwLeaflet = (function () {
|
|
|
18084
18084
|
return objectDeepEqual(itemProps || {}, objectRemoveEmpty(props));
|
|
18085
18085
|
}
|
|
18086
18086
|
};
|
|
18087
|
-
__publicField$
|
|
18087
|
+
__publicField$y(_Cache, "instance", {});
|
|
18088
18088
|
let Cache = _Cache;
|
|
18089
18089
|
|
|
18090
18090
|
var pkg = {
|
|
18091
18091
|
name: "@nextgis/ngw-connector",
|
|
18092
|
-
version: "3.0.0-alpha.
|
|
18092
|
+
version: "3.0.0-alpha.6",
|
|
18093
18093
|
_priority: 12,
|
|
18094
18094
|
description: "A lightweight HTTP client optimized for use with NextGIS Web API",
|
|
18095
18095
|
main: "index.js",
|
|
@@ -18098,15 +18098,15 @@ var NgwLeaflet = (function () {
|
|
|
18098
18098
|
jsdelivr: "lib/ngw-connector.global.prod.js",
|
|
18099
18099
|
types: "lib/index.d.ts",
|
|
18100
18100
|
dependencies: {
|
|
18101
|
-
"@nextgis/cache": "^3.0.0-alpha.
|
|
18102
|
-
"@nextgis/cancelable-promise": "^3.0.0-alpha.
|
|
18103
|
-
"@nextgis/utils": "^3.0.0-alpha.
|
|
18101
|
+
"@nextgis/cache": "^3.0.0-alpha.5",
|
|
18102
|
+
"@nextgis/cancelable-promise": "^3.0.0-alpha.5",
|
|
18103
|
+
"@nextgis/utils": "^3.0.0-alpha.5",
|
|
18104
18104
|
"@types/events": "^3.0.0",
|
|
18105
18105
|
events: "*",
|
|
18106
18106
|
"form-data": "^4.0.0"
|
|
18107
18107
|
},
|
|
18108
18108
|
devDependencies: {
|
|
18109
|
-
"@nextgis/build-tools": "^3.0.0-alpha.
|
|
18109
|
+
"@nextgis/build-tools": "^3.0.0-alpha.5"
|
|
18110
18110
|
},
|
|
18111
18111
|
scripts: {
|
|
18112
18112
|
clean: "rimraf ./lib",
|
|
@@ -18140,87 +18140,179 @@ var NgwLeaflet = (function () {
|
|
|
18140
18140
|
type: "git",
|
|
18141
18141
|
url: "git://github.com/nextgis/nextgis_frontend.git"
|
|
18142
18142
|
},
|
|
18143
|
+
engines: {
|
|
18144
|
+
node: ">=18.20.4"
|
|
18145
|
+
},
|
|
18143
18146
|
gitHead: "edc68033f914f6c95c4125b9738bba6d36e990b4"
|
|
18144
18147
|
};
|
|
18145
18148
|
|
|
18146
|
-
|
|
18147
|
-
|
|
18148
|
-
|
|
18149
|
+
const CONNECTORS = [];
|
|
18150
|
+
function addConnector(connector) {
|
|
18151
|
+
CONNECTORS.push(connector);
|
|
18152
|
+
}
|
|
18153
|
+
function findConnector(options) {
|
|
18154
|
+
return CONNECTORS.find((x) => {
|
|
18155
|
+
if (x.options.baseUrl === options.baseUrl) {
|
|
18156
|
+
if (options.auth) {
|
|
18157
|
+
if (x.options.auth) {
|
|
18158
|
+
return objectDeepEqual(x.options.auth, options.auth);
|
|
18159
|
+
}
|
|
18160
|
+
} else {
|
|
18161
|
+
return true;
|
|
18162
|
+
}
|
|
18163
|
+
}
|
|
18164
|
+
});
|
|
18165
|
+
}
|
|
18166
|
+
function removeConnector(connector) {
|
|
18167
|
+
const index = CONNECTORS.indexOf(connector);
|
|
18168
|
+
if (index !== -1) {
|
|
18169
|
+
CONNECTORS.splice(index, 1);
|
|
18170
|
+
}
|
|
18171
|
+
}
|
|
18172
|
+
|
|
18173
|
+
class AbortError extends Error {
|
|
18174
|
+
constructor(message = "AbortError") {
|
|
18175
|
+
super(message);
|
|
18176
|
+
this.name = "AbortError";
|
|
18177
|
+
}
|
|
18178
|
+
}
|
|
18179
|
+
|
|
18180
|
+
var __defProp$L = Object.defineProperty;
|
|
18181
|
+
var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18182
|
+
var __publicField$x = (obj, key, value) => __defNormalProp$L(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18149
18183
|
class NgwError extends Error {
|
|
18150
18184
|
constructor(er) {
|
|
18151
18185
|
super();
|
|
18152
|
-
__publicField$
|
|
18153
|
-
__publicField$
|
|
18154
|
-
__publicField$
|
|
18155
|
-
__publicField$
|
|
18156
|
-
__publicField$
|
|
18157
|
-
__publicField$
|
|
18158
|
-
__publicField$
|
|
18159
|
-
__publicField$
|
|
18186
|
+
__publicField$x(this, "name", "NgwError");
|
|
18187
|
+
__publicField$x(this, "title");
|
|
18188
|
+
__publicField$x(this, "message");
|
|
18189
|
+
__publicField$x(this, "detail");
|
|
18190
|
+
__publicField$x(this, "exception");
|
|
18191
|
+
__publicField$x(this, "status_code");
|
|
18192
|
+
__publicField$x(this, "data");
|
|
18193
|
+
__publicField$x(this, "guru_meditation");
|
|
18160
18194
|
Object.assign(this, er);
|
|
18161
18195
|
Object.setPrototypeOf(this, NgwError.prototype);
|
|
18162
18196
|
}
|
|
18163
18197
|
}
|
|
18164
18198
|
|
|
18165
|
-
var __defProp$
|
|
18166
|
-
var __defNormalProp$
|
|
18167
|
-
var __publicField$
|
|
18199
|
+
var __defProp$K = Object.defineProperty;
|
|
18200
|
+
var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18201
|
+
var __publicField$w = (obj, key, value) => __defNormalProp$K(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18202
|
+
class InsufficientPermissionsError extends NgwError {
|
|
18203
|
+
constructor(obj) {
|
|
18204
|
+
super(obj);
|
|
18205
|
+
__publicField$w(this, "name", "InsufficientPermissionsError");
|
|
18206
|
+
__publicField$w(this, "exception", "nextgisweb.core.exception.InsufficientPermissions");
|
|
18207
|
+
Object.setPrototypeOf(this, InsufficientPermissionsError.prototype);
|
|
18208
|
+
}
|
|
18209
|
+
}
|
|
18210
|
+
|
|
18211
|
+
var __defProp$J = Object.defineProperty;
|
|
18212
|
+
var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18213
|
+
var __publicField$v = (obj, key, value) => __defNormalProp$J(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18168
18214
|
class ResourceNotFoundError extends NgwError {
|
|
18169
18215
|
constructor(obj) {
|
|
18170
18216
|
super(obj);
|
|
18171
|
-
__publicField$
|
|
18172
|
-
__publicField$
|
|
18217
|
+
__publicField$v(this, "name", "ResourceNotFoundError");
|
|
18218
|
+
__publicField$v(this, "exception", "nextgisweb.resource.exception.ResourceNotFound");
|
|
18173
18219
|
Object.setPrototypeOf(this, ResourceNotFoundError.prototype);
|
|
18174
18220
|
}
|
|
18175
18221
|
}
|
|
18176
18222
|
|
|
18177
|
-
|
|
18178
|
-
|
|
18223
|
+
var __defProp$I = Object.defineProperty;
|
|
18224
|
+
var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18225
|
+
var __publicField$u = (obj, key, value) => __defNormalProp$I(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18226
|
+
class BaseAPIError extends Error {
|
|
18227
|
+
constructor(message) {
|
|
18228
|
+
super(message || "Something went wrong.");
|
|
18229
|
+
__publicField$u(this, "title");
|
|
18230
|
+
this.name = "BaseAPIError";
|
|
18231
|
+
this.title = "Unknown API error";
|
|
18232
|
+
if (Error.captureStackTrace) {
|
|
18233
|
+
Error.captureStackTrace(this, BaseAPIError);
|
|
18234
|
+
}
|
|
18235
|
+
}
|
|
18179
18236
|
}
|
|
18180
|
-
|
|
18181
|
-
|
|
18182
|
-
|
|
18237
|
+
class NetworksResponseError extends BaseAPIError {
|
|
18238
|
+
// prettier-ignore
|
|
18239
|
+
constructor(message) {
|
|
18240
|
+
super(message || "There is no response from the server or problem connecting to server.");
|
|
18241
|
+
__publicField$u(this, "detail");
|
|
18242
|
+
this.title = "Network error";
|
|
18243
|
+
this.detail = "Check network connectivity and try again later.";
|
|
18244
|
+
}
|
|
18183
18245
|
}
|
|
18184
|
-
|
|
18185
|
-
|
|
18186
|
-
|
|
18187
|
-
|
|
18188
|
-
|
|
18189
|
-
|
|
18190
|
-
|
|
18191
|
-
|
|
18192
|
-
|
|
18193
|
-
|
|
18194
|
-
|
|
18195
|
-
|
|
18196
|
-
|
|
18197
|
-
|
|
18198
|
-
|
|
18199
|
-
|
|
18200
|
-
|
|
18246
|
+
class InvalidResponseError extends BaseAPIError {
|
|
18247
|
+
constructor(message) {
|
|
18248
|
+
super(message || "Something went wrong.");
|
|
18249
|
+
this.title = "Unexpected server response";
|
|
18250
|
+
}
|
|
18251
|
+
}
|
|
18252
|
+
class ServerResponseError extends BaseAPIError {
|
|
18253
|
+
constructor(data) {
|
|
18254
|
+
super(data.message);
|
|
18255
|
+
__publicField$u(this, "detail");
|
|
18256
|
+
__publicField$u(this, "data");
|
|
18257
|
+
this.title = data.title || this.title;
|
|
18258
|
+
this.detail = data.detail || null;
|
|
18259
|
+
this.data = data;
|
|
18260
|
+
}
|
|
18261
|
+
}
|
|
18262
|
+
class LunkwillError extends Error {
|
|
18263
|
+
// prettier-ignore
|
|
18264
|
+
constructor(message, data = {}) {
|
|
18265
|
+
super(message || "Unexpected error while processing long-running request.");
|
|
18266
|
+
__publicField$u(this, "title");
|
|
18267
|
+
__publicField$u(this, "data");
|
|
18268
|
+
this.name = "LunkwillError";
|
|
18269
|
+
this.title = "Long-running request error";
|
|
18270
|
+
this.data = data;
|
|
18271
|
+
if (Error.captureStackTrace) {
|
|
18272
|
+
Error.captureStackTrace(this, LunkwillError);
|
|
18201
18273
|
}
|
|
18202
18274
|
}
|
|
18203
|
-
|
|
18275
|
+
}
|
|
18276
|
+
class LunkwillRequestCancelled extends LunkwillError {
|
|
18277
|
+
constructor(data) {
|
|
18278
|
+
super("Long-running request was cancelled.", data);
|
|
18279
|
+
}
|
|
18280
|
+
}
|
|
18281
|
+
class LunkwillRequestFailed extends LunkwillError {
|
|
18282
|
+
constructor(data) {
|
|
18283
|
+
super(void 0, data);
|
|
18284
|
+
}
|
|
18204
18285
|
}
|
|
18205
18286
|
|
|
18206
|
-
var __defProp$
|
|
18207
|
-
var __getOwnPropSymbols$
|
|
18208
|
-
var __hasOwnProp$
|
|
18209
|
-
var __propIsEnum$
|
|
18210
|
-
var __defNormalProp$
|
|
18211
|
-
var __spreadValues$
|
|
18287
|
+
var __defProp$H = Object.defineProperty;
|
|
18288
|
+
var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
|
|
18289
|
+
var __hasOwnProp$v = Object.prototype.hasOwnProperty;
|
|
18290
|
+
var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
|
|
18291
|
+
var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18292
|
+
var __spreadValues$u = (a, b) => {
|
|
18212
18293
|
for (var prop in b || (b = {}))
|
|
18213
|
-
if (__hasOwnProp$
|
|
18214
|
-
__defNormalProp$
|
|
18215
|
-
if (__getOwnPropSymbols$
|
|
18216
|
-
for (var prop of __getOwnPropSymbols$
|
|
18217
|
-
if (__propIsEnum$
|
|
18218
|
-
__defNormalProp$
|
|
18294
|
+
if (__hasOwnProp$v.call(b, prop))
|
|
18295
|
+
__defNormalProp$H(a, prop, b[prop]);
|
|
18296
|
+
if (__getOwnPropSymbols$v)
|
|
18297
|
+
for (var prop of __getOwnPropSymbols$v(b)) {
|
|
18298
|
+
if (__propIsEnum$v.call(b, prop))
|
|
18299
|
+
__defNormalProp$H(a, prop, b[prop]);
|
|
18219
18300
|
}
|
|
18220
18301
|
return a;
|
|
18221
18302
|
};
|
|
18222
|
-
var
|
|
18223
|
-
|
|
18303
|
+
var __objRest$5 = (source, exclude) => {
|
|
18304
|
+
var target = {};
|
|
18305
|
+
for (var prop in source)
|
|
18306
|
+
if (__hasOwnProp$v.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
18307
|
+
target[prop] = source[prop];
|
|
18308
|
+
if (source != null && __getOwnPropSymbols$v)
|
|
18309
|
+
for (var prop of __getOwnPropSymbols$v(source)) {
|
|
18310
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$v.call(source, prop))
|
|
18311
|
+
target[prop] = source[prop];
|
|
18312
|
+
}
|
|
18313
|
+
return target;
|
|
18314
|
+
};
|
|
18315
|
+
var __async$t = (__this, __arguments, generator) => {
|
|
18224
18316
|
return new Promise((resolve, reject) => {
|
|
18225
18317
|
var fulfilled = (value) => {
|
|
18226
18318
|
try {
|
|
@@ -18240,62 +18332,915 @@ var NgwLeaflet = (function () {
|
|
|
18240
18332
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
18241
18333
|
});
|
|
18242
18334
|
};
|
|
18243
|
-
|
|
18244
|
-
|
|
18245
|
-
|
|
18246
|
-
|
|
18247
|
-
|
|
18248
|
-
|
|
18249
|
-
|
|
18250
|
-
|
|
18251
|
-
|
|
18252
|
-
|
|
18253
|
-
|
|
18254
|
-
|
|
18255
|
-
|
|
18256
|
-
|
|
18257
|
-
|
|
18258
|
-
|
|
18259
|
-
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18272
|
-
|
|
18273
|
-
|
|
18274
|
-
|
|
18335
|
+
function lunkwillCheckResponse(lwResp) {
|
|
18336
|
+
const ct = lwResp.headers.get("content-type");
|
|
18337
|
+
return ct !== void 0 && ct !== null && ct.includes("application/vnd.lunkwill.request-summary+json");
|
|
18338
|
+
}
|
|
18339
|
+
function responseJson(response) {
|
|
18340
|
+
return __async$t(this, null, function* () {
|
|
18341
|
+
try {
|
|
18342
|
+
return response.json();
|
|
18343
|
+
} catch (e) {
|
|
18344
|
+
throw new Error();
|
|
18345
|
+
}
|
|
18346
|
+
});
|
|
18347
|
+
}
|
|
18348
|
+
function lunkwillResponseUrl(lwResp) {
|
|
18349
|
+
return __async$t(this, null, function* () {
|
|
18350
|
+
const lwData = yield responseJson(lwResp);
|
|
18351
|
+
let delay = lwData.delay_ms;
|
|
18352
|
+
const retry = lwData.retry_ms !== void 0 ? lwData.retry_ms : 2e3;
|
|
18353
|
+
const sum = `/api/lunkwill/${lwData.id}/summary`;
|
|
18354
|
+
const res = `/api/lunkwill/${lwData.id}/response`;
|
|
18355
|
+
const sleep = (msec) => new Promise((resolve) => setTimeout(resolve, msec));
|
|
18356
|
+
let failed = false;
|
|
18357
|
+
let ready = false;
|
|
18358
|
+
while (!ready) {
|
|
18359
|
+
yield sleep(failed ? retry : delay);
|
|
18360
|
+
failed = false;
|
|
18361
|
+
let lwResp2;
|
|
18362
|
+
let lwData2;
|
|
18363
|
+
try {
|
|
18364
|
+
lwResp2 = yield fetch(sum, { credentials: "same-origin" });
|
|
18365
|
+
lwData2 = yield lwResp2.json();
|
|
18366
|
+
} catch (e) {
|
|
18367
|
+
failed = true;
|
|
18368
|
+
continue;
|
|
18369
|
+
}
|
|
18370
|
+
switch (lwData2.status) {
|
|
18371
|
+
case void 0:
|
|
18372
|
+
throw new LunkwillError(void 0, lwData2);
|
|
18373
|
+
case "ready":
|
|
18374
|
+
ready = true;
|
|
18375
|
+
break;
|
|
18376
|
+
case "cancelled":
|
|
18377
|
+
throw new LunkwillRequestCancelled(lwData2);
|
|
18378
|
+
case "failed":
|
|
18379
|
+
throw new LunkwillRequestFailed(lwData2);
|
|
18380
|
+
case "spooled":
|
|
18381
|
+
case "processing":
|
|
18382
|
+
case "buffering":
|
|
18383
|
+
delay = lwData2.delay_ms;
|
|
18384
|
+
break;
|
|
18385
|
+
default:
|
|
18386
|
+
throw new LunkwillError(void 0, lwData2);
|
|
18275
18387
|
}
|
|
18276
18388
|
}
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
|
|
18282
|
-
|
|
18389
|
+
return res;
|
|
18390
|
+
});
|
|
18391
|
+
}
|
|
18392
|
+
function lunkwillFetch(lwRespUrl) {
|
|
18393
|
+
return __async$t(this, null, function* () {
|
|
18394
|
+
try {
|
|
18395
|
+
return yield window.fetch(lwRespUrl, { credentials: "same-origin" });
|
|
18396
|
+
} catch (e) {
|
|
18397
|
+
throw new NetworksResponseError();
|
|
18283
18398
|
}
|
|
18284
|
-
|
|
18285
|
-
|
|
18286
|
-
|
|
18287
|
-
|
|
18288
|
-
|
|
18289
|
-
|
|
18399
|
+
});
|
|
18400
|
+
}
|
|
18401
|
+
const mediaContentTypes = [
|
|
18402
|
+
"application/pdf",
|
|
18403
|
+
"image/png",
|
|
18404
|
+
"image/jpeg",
|
|
18405
|
+
"image/tiff",
|
|
18406
|
+
"text/csv"
|
|
18407
|
+
];
|
|
18408
|
+
const mediaContentTypesRegex = new RegExp(mediaContentTypes.join("|"));
|
|
18409
|
+
function isMediaContentType(contentType) {
|
|
18410
|
+
return mediaContentTypesRegex.test(contentType);
|
|
18411
|
+
}
|
|
18412
|
+
function encodeQueryParams(value) {
|
|
18413
|
+
const result = [];
|
|
18414
|
+
for (const [k, v] of Object.entries(value)) {
|
|
18415
|
+
if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") {
|
|
18416
|
+
result.push(`${k}=${encodeURIComponent(v)}`);
|
|
18417
|
+
} else if (Array.isArray(v)) {
|
|
18418
|
+
result.push(`${k}=${v.map(encodeURIComponent).join(",")}`);
|
|
18419
|
+
} else {
|
|
18420
|
+
for (const [sk, sv] of Object.entries(v)) {
|
|
18421
|
+
const ske = `${k}[${encodeURIComponent(sk)}]`;
|
|
18422
|
+
if (typeof sv === "string" || typeof sv === "number" || typeof sv === "boolean") {
|
|
18423
|
+
result.push(`${ske}=${encodeURIComponent(sv)}`);
|
|
18424
|
+
} else if (Array.isArray(sv)) {
|
|
18425
|
+
const sve = sv.map(encodeURIComponent);
|
|
18426
|
+
result.push(`${ske}=${sve.join(",")}`);
|
|
18427
|
+
}
|
|
18290
18428
|
}
|
|
18291
|
-
|
|
18292
|
-
});
|
|
18429
|
+
}
|
|
18293
18430
|
}
|
|
18294
|
-
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
|
|
18298
|
-
|
|
18431
|
+
return result.join("&");
|
|
18432
|
+
}
|
|
18433
|
+
function generateUrl(path, query) {
|
|
18434
|
+
let urlParams = "";
|
|
18435
|
+
if (query !== void 0) {
|
|
18436
|
+
urlParams = "?" + encodeQueryParams(query);
|
|
18437
|
+
}
|
|
18438
|
+
return path + urlParams;
|
|
18439
|
+
}
|
|
18440
|
+
function request(path, options, cacheEngine) {
|
|
18441
|
+
return __async$t(this, null, function* () {
|
|
18442
|
+
var _b;
|
|
18443
|
+
const defaults = {
|
|
18444
|
+
method: "GET",
|
|
18445
|
+
credentials: "same-origin",
|
|
18446
|
+
headers: {}
|
|
18447
|
+
};
|
|
18448
|
+
const _a = __spreadValues$u(__spreadValues$u({}, defaults), options), {
|
|
18449
|
+
withCredentials,
|
|
18450
|
+
responseType,
|
|
18451
|
+
cacheProps,
|
|
18452
|
+
cacheName,
|
|
18453
|
+
lunkwill,
|
|
18454
|
+
cache,
|
|
18455
|
+
query,
|
|
18456
|
+
json
|
|
18457
|
+
} = _a, opt = __objRest$5(_a, [
|
|
18458
|
+
"withCredentials",
|
|
18459
|
+
"responseType",
|
|
18460
|
+
"cacheProps",
|
|
18461
|
+
"cacheName",
|
|
18462
|
+
"lunkwill",
|
|
18463
|
+
"cache",
|
|
18464
|
+
"query",
|
|
18465
|
+
"json"
|
|
18466
|
+
]);
|
|
18467
|
+
if (withCredentials) {
|
|
18468
|
+
opt.credentials = "include";
|
|
18469
|
+
}
|
|
18470
|
+
let useLunkwill = false;
|
|
18471
|
+
if (lunkwill !== void 0) {
|
|
18472
|
+
lunkwill.toHeaders(opt.headers || {});
|
|
18473
|
+
useLunkwill = true;
|
|
18474
|
+
}
|
|
18475
|
+
const lunkwillReturnUrl = !!opt.lunkwillReturnUrl;
|
|
18476
|
+
delete opt.lunkwillReturnUrl;
|
|
18477
|
+
if (json !== void 0) {
|
|
18478
|
+
opt.body = JSON.stringify(json);
|
|
18479
|
+
const headers = opt.headers || {};
|
|
18480
|
+
headers["Content-Type"] = "application/json";
|
|
18481
|
+
opt.headers = headers;
|
|
18482
|
+
}
|
|
18483
|
+
const url = generateUrl(path, query);
|
|
18484
|
+
const makeRequest = () => __async$t(this, null, function* () {
|
|
18485
|
+
let response;
|
|
18486
|
+
try {
|
|
18487
|
+
response = yield fetch(url, opt);
|
|
18488
|
+
} catch (e) {
|
|
18489
|
+
if (e.name === "AbortError") {
|
|
18490
|
+
throw e;
|
|
18491
|
+
}
|
|
18492
|
+
throw new NetworksResponseError();
|
|
18493
|
+
}
|
|
18494
|
+
if (useLunkwill && lunkwillCheckResponse(response)) {
|
|
18495
|
+
const lwRespUrl = yield lunkwillResponseUrl(response);
|
|
18496
|
+
if (lunkwillReturnUrl) {
|
|
18497
|
+
return lwRespUrl;
|
|
18498
|
+
}
|
|
18499
|
+
response = yield lunkwillFetch(lwRespUrl);
|
|
18500
|
+
}
|
|
18501
|
+
const respCType = response.headers.get("content-type");
|
|
18502
|
+
const respJSON = respCType && (respCType.includes("application/json") || respCType.includes("application/vnd.lunkwill.request-summary+json"));
|
|
18503
|
+
let body;
|
|
18504
|
+
try {
|
|
18505
|
+
const respMedia = respCType && isMediaContentType(respCType);
|
|
18506
|
+
if (responseType === "blob" || respMedia) {
|
|
18507
|
+
body = yield response.blob();
|
|
18508
|
+
} else if (respJSON) {
|
|
18509
|
+
body = yield response.json();
|
|
18510
|
+
} else {
|
|
18511
|
+
throw new InvalidResponseError();
|
|
18512
|
+
}
|
|
18513
|
+
} catch (e) {
|
|
18514
|
+
if (e.name === "AbortError" || e instanceof InvalidResponseError) {
|
|
18515
|
+
throw e;
|
|
18516
|
+
}
|
|
18517
|
+
throw new InvalidResponseError();
|
|
18518
|
+
}
|
|
18519
|
+
if (400 <= response.status && response.status <= 599) {
|
|
18520
|
+
throw new ServerResponseError(body);
|
|
18521
|
+
}
|
|
18522
|
+
return body;
|
|
18523
|
+
});
|
|
18524
|
+
if (cacheEngine && cache && ((_b = opt.method) == null ? void 0 : _b.toUpperCase()) === "GET") {
|
|
18525
|
+
const cacheOptions = cacheProps ? cacheProps : __spreadValues$u({}, objectRemoveEmpty({
|
|
18526
|
+
withCredentials,
|
|
18527
|
+
responseType
|
|
18528
|
+
}));
|
|
18529
|
+
return cacheEngine.add(cacheName || url, makeRequest, cacheOptions, false);
|
|
18530
|
+
}
|
|
18531
|
+
return makeRequest();
|
|
18532
|
+
});
|
|
18533
|
+
}
|
|
18534
|
+
|
|
18535
|
+
var __defProp$G = Object.defineProperty;
|
|
18536
|
+
var __defProps$i = Object.defineProperties;
|
|
18537
|
+
var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
|
|
18538
|
+
var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
|
|
18539
|
+
var __hasOwnProp$u = Object.prototype.hasOwnProperty;
|
|
18540
|
+
var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
|
|
18541
|
+
var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18542
|
+
var __spreadValues$t = (a, b) => {
|
|
18543
|
+
for (var prop in b || (b = {}))
|
|
18544
|
+
if (__hasOwnProp$u.call(b, prop))
|
|
18545
|
+
__defNormalProp$G(a, prop, b[prop]);
|
|
18546
|
+
if (__getOwnPropSymbols$u)
|
|
18547
|
+
for (var prop of __getOwnPropSymbols$u(b)) {
|
|
18548
|
+
if (__propIsEnum$u.call(b, prop))
|
|
18549
|
+
__defNormalProp$G(a, prop, b[prop]);
|
|
18550
|
+
}
|
|
18551
|
+
return a;
|
|
18552
|
+
};
|
|
18553
|
+
var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
|
|
18554
|
+
var __objRest$4 = (source, exclude) => {
|
|
18555
|
+
var target = {};
|
|
18556
|
+
for (var prop in source)
|
|
18557
|
+
if (__hasOwnProp$u.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
18558
|
+
target[prop] = source[prop];
|
|
18559
|
+
if (source != null && __getOwnPropSymbols$u)
|
|
18560
|
+
for (var prop of __getOwnPropSymbols$u(source)) {
|
|
18561
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$u.call(source, prop))
|
|
18562
|
+
target[prop] = source[prop];
|
|
18563
|
+
}
|
|
18564
|
+
return target;
|
|
18565
|
+
};
|
|
18566
|
+
var __async$s = (__this, __arguments, generator) => {
|
|
18567
|
+
return new Promise((resolve, reject) => {
|
|
18568
|
+
var fulfilled = (value) => {
|
|
18569
|
+
try {
|
|
18570
|
+
step(generator.next(value));
|
|
18571
|
+
} catch (e) {
|
|
18572
|
+
reject(e);
|
|
18573
|
+
}
|
|
18574
|
+
};
|
|
18575
|
+
var rejected = (value) => {
|
|
18576
|
+
try {
|
|
18577
|
+
step(generator.throw(value));
|
|
18578
|
+
} catch (e) {
|
|
18579
|
+
reject(e);
|
|
18580
|
+
}
|
|
18581
|
+
};
|
|
18582
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18583
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
18584
|
+
});
|
|
18585
|
+
};
|
|
18586
|
+
function routeURL(name, baseUrl, routeData, ...rest) {
|
|
18587
|
+
const [template, ...params] = routeData[name];
|
|
18588
|
+
const first = rest[0];
|
|
18589
|
+
let sub;
|
|
18590
|
+
if (first === void 0) {
|
|
18591
|
+
sub = [];
|
|
18592
|
+
} else if (typeof first === "object" && first !== null) {
|
|
18593
|
+
if (rest.length > 1) {
|
|
18594
|
+
throw new Error("Too many arguments for route(name, object)!");
|
|
18595
|
+
}
|
|
18596
|
+
sub = [];
|
|
18597
|
+
for (const [p, v] of Object.entries(first)) {
|
|
18598
|
+
sub[params.indexOf(p)] = String(v);
|
|
18599
|
+
}
|
|
18600
|
+
} else {
|
|
18601
|
+
sub = rest.map((v) => String(v));
|
|
18602
|
+
}
|
|
18603
|
+
return fixUrlStr(
|
|
18604
|
+
baseUrl + template.replace(/\{(\w+)\}/g, function(m, a) {
|
|
18605
|
+
const idx = parseInt(a);
|
|
18606
|
+
const value = sub[idx];
|
|
18607
|
+
if (value === void 0) {
|
|
18608
|
+
const msg = `Undefined parameter ${idx} in "${template}".`;
|
|
18609
|
+
throw new Error(msg);
|
|
18610
|
+
}
|
|
18611
|
+
return String(value);
|
|
18612
|
+
})
|
|
18613
|
+
);
|
|
18614
|
+
}
|
|
18615
|
+
function route(name, connector, ...rest) {
|
|
18616
|
+
const result = {
|
|
18617
|
+
url: (opt) => __async$s(this, null, function* () {
|
|
18618
|
+
var _a;
|
|
18619
|
+
const routeData = yield connector.connect();
|
|
18620
|
+
const template = routeURL(
|
|
18621
|
+
name,
|
|
18622
|
+
(_a = connector.options.baseUrl) != null ? _a : "",
|
|
18623
|
+
routeData,
|
|
18624
|
+
...rest
|
|
18625
|
+
);
|
|
18626
|
+
return generateUrl(template, opt == null ? void 0 : opt.query);
|
|
18627
|
+
})
|
|
18628
|
+
};
|
|
18629
|
+
const methods = ["get", "post", "put", "delete", "patch"];
|
|
18630
|
+
for (const method of methods) {
|
|
18631
|
+
const methodResp = (requestOptions) => __async$s(this, null, function* () {
|
|
18632
|
+
var _b;
|
|
18633
|
+
const _a = requestOptions || {}, { headers: optHeaders } = _a, restOpt = __objRest$4(_a, ["headers"]);
|
|
18634
|
+
const routeData = yield connector.connect();
|
|
18635
|
+
const template = routeURL(
|
|
18636
|
+
name,
|
|
18637
|
+
(_b = connector.options.baseUrl) != null ? _b : "",
|
|
18638
|
+
routeData,
|
|
18639
|
+
...rest
|
|
18640
|
+
);
|
|
18641
|
+
const headers = objectRemoveEmpty(__spreadValues$t(__spreadValues$t({}, connector.getAuthorizationHeaders()), optHeaders != null ? optHeaders : {}));
|
|
18642
|
+
return request(
|
|
18643
|
+
template,
|
|
18644
|
+
__spreadProps$i(__spreadValues$t({
|
|
18645
|
+
headers
|
|
18646
|
+
}, restOpt), {
|
|
18647
|
+
method
|
|
18648
|
+
}),
|
|
18649
|
+
connector.cache
|
|
18650
|
+
);
|
|
18651
|
+
});
|
|
18652
|
+
result[method] = methodResp;
|
|
18653
|
+
}
|
|
18654
|
+
return result;
|
|
18655
|
+
}
|
|
18656
|
+
|
|
18657
|
+
var __defProp$F = Object.defineProperty;
|
|
18658
|
+
var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18659
|
+
var __publicField$t = (obj, key, value) => __defNormalProp$F(obj, key + "" , value);
|
|
18660
|
+
class NetworkError extends Error {
|
|
18661
|
+
constructor(url) {
|
|
18662
|
+
super();
|
|
18663
|
+
__publicField$t(this, "name", "NetworkError");
|
|
18664
|
+
Object.setPrototypeOf(this, NetworkError.prototype);
|
|
18665
|
+
this.message = `Unable to request ${url}.
|
|
18666
|
+
Possibly invalid NGW URL entered or CORS not configured to get request from ${location.origin}`;
|
|
18667
|
+
}
|
|
18668
|
+
}
|
|
18669
|
+
|
|
18670
|
+
function isObject(val) {
|
|
18671
|
+
return Object.prototype.toString.call(val) === "[object Object]";
|
|
18672
|
+
}
|
|
18673
|
+
|
|
18674
|
+
let loadData;
|
|
18675
|
+
{
|
|
18676
|
+
loadData = (url, callback, options = {}, error, onCancel) => {
|
|
18677
|
+
options.method = options.method || "GET";
|
|
18678
|
+
const xhr = new XMLHttpRequest();
|
|
18679
|
+
xhr.open(options.method || "GET", url, true);
|
|
18680
|
+
if (options.responseType === "blob") {
|
|
18681
|
+
xhr.responseType = options.responseType;
|
|
18682
|
+
}
|
|
18683
|
+
const getResponseText = () => {
|
|
18684
|
+
try {
|
|
18685
|
+
return JSON.parse(xhr.responseText);
|
|
18686
|
+
} catch (er) {
|
|
18687
|
+
return xhr.responseText;
|
|
18688
|
+
}
|
|
18689
|
+
};
|
|
18690
|
+
const processingResponse = (forError = false) => {
|
|
18691
|
+
const cb = forError ? error : callback;
|
|
18692
|
+
if (options.responseType === "blob") {
|
|
18693
|
+
cb(xhr.response);
|
|
18694
|
+
} else {
|
|
18695
|
+
if (xhr.responseText) {
|
|
18696
|
+
cb(getResponseText());
|
|
18697
|
+
} else {
|
|
18698
|
+
error({ message: "" });
|
|
18699
|
+
}
|
|
18700
|
+
}
|
|
18701
|
+
};
|
|
18702
|
+
xhr.onload = () => {
|
|
18703
|
+
if ([401, 403, 404, 422, 500].indexOf(xhr.status) !== -1) {
|
|
18704
|
+
error(new NgwError(getResponseText()));
|
|
18705
|
+
}
|
|
18706
|
+
processingResponse();
|
|
18707
|
+
};
|
|
18708
|
+
xhr.onerror = (er) => {
|
|
18709
|
+
if (xhr.status === 0) {
|
|
18710
|
+
error(new NetworkError(url));
|
|
18711
|
+
} else {
|
|
18712
|
+
error(er);
|
|
18713
|
+
}
|
|
18714
|
+
};
|
|
18715
|
+
xhr.upload.onprogress = function(e) {
|
|
18716
|
+
if (e.lengthComputable) {
|
|
18717
|
+
const percentComplete = e.loaded / e.total * 100;
|
|
18718
|
+
if (options.onProgress) {
|
|
18719
|
+
options.onProgress(percentComplete, e);
|
|
18720
|
+
}
|
|
18721
|
+
}
|
|
18722
|
+
};
|
|
18723
|
+
const headers = options.headers;
|
|
18724
|
+
if (headers) {
|
|
18725
|
+
for (const h in headers) {
|
|
18726
|
+
const header = headers[h];
|
|
18727
|
+
if (typeof header === "string") {
|
|
18728
|
+
xhr.setRequestHeader(h, header);
|
|
18729
|
+
}
|
|
18730
|
+
}
|
|
18731
|
+
}
|
|
18732
|
+
if (options.withCredentials !== void 0) {
|
|
18733
|
+
xhr.withCredentials = options.withCredentials;
|
|
18734
|
+
}
|
|
18735
|
+
let data;
|
|
18736
|
+
if (options.file) {
|
|
18737
|
+
data = new FormData();
|
|
18738
|
+
data.append("file", options.file);
|
|
18739
|
+
if (options.data) {
|
|
18740
|
+
for (const d in options.data) {
|
|
18741
|
+
data.append(d, data[d]);
|
|
18742
|
+
}
|
|
18743
|
+
}
|
|
18744
|
+
} else {
|
|
18745
|
+
data = options.data ? typeof options.data === "string" ? options.data : JSON.stringify(options.data) : null;
|
|
18746
|
+
}
|
|
18747
|
+
if (onCancel) {
|
|
18748
|
+
onCancel(() => {
|
|
18749
|
+
xhr.abort();
|
|
18750
|
+
});
|
|
18751
|
+
}
|
|
18752
|
+
xhr.send(data);
|
|
18753
|
+
};
|
|
18754
|
+
}
|
|
18755
|
+
|
|
18756
|
+
const templateRe = /\{ *([\w_-]+) *\}/g;
|
|
18757
|
+
function template(str, data) {
|
|
18758
|
+
return str.replace(templateRe, (s, key) => {
|
|
18759
|
+
let value = data[key];
|
|
18760
|
+
if (value === void 0) {
|
|
18761
|
+
throw new Error("No value provided for letiable " + s);
|
|
18762
|
+
} else if (typeof value === "function") {
|
|
18763
|
+
value = value(data);
|
|
18764
|
+
}
|
|
18765
|
+
return value;
|
|
18766
|
+
});
|
|
18767
|
+
}
|
|
18768
|
+
|
|
18769
|
+
var __defProp$E = Object.defineProperty;
|
|
18770
|
+
var __defProps$h = Object.defineProperties;
|
|
18771
|
+
var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
|
|
18772
|
+
var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
|
|
18773
|
+
var __hasOwnProp$t = Object.prototype.hasOwnProperty;
|
|
18774
|
+
var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
|
|
18775
|
+
var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18776
|
+
var __spreadValues$s = (a, b) => {
|
|
18777
|
+
for (var prop in b || (b = {}))
|
|
18778
|
+
if (__hasOwnProp$t.call(b, prop))
|
|
18779
|
+
__defNormalProp$E(a, prop, b[prop]);
|
|
18780
|
+
if (__getOwnPropSymbols$t)
|
|
18781
|
+
for (var prop of __getOwnPropSymbols$t(b)) {
|
|
18782
|
+
if (__propIsEnum$t.call(b, prop))
|
|
18783
|
+
__defNormalProp$E(a, prop, b[prop]);
|
|
18784
|
+
}
|
|
18785
|
+
return a;
|
|
18786
|
+
};
|
|
18787
|
+
var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
|
|
18788
|
+
var __objRest$3 = (source, exclude) => {
|
|
18789
|
+
var target = {};
|
|
18790
|
+
for (var prop in source)
|
|
18791
|
+
if (__hasOwnProp$t.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
18792
|
+
target[prop] = source[prop];
|
|
18793
|
+
if (source != null && __getOwnPropSymbols$t)
|
|
18794
|
+
for (var prop of __getOwnPropSymbols$t(source)) {
|
|
18795
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$t.call(source, prop))
|
|
18796
|
+
target[prop] = source[prop];
|
|
18797
|
+
}
|
|
18798
|
+
return target;
|
|
18799
|
+
};
|
|
18800
|
+
var __publicField$s = (obj, key, value) => __defNormalProp$E(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18801
|
+
var __async$r = (__this, __arguments, generator) => {
|
|
18802
|
+
return new Promise((resolve, reject) => {
|
|
18803
|
+
var fulfilled = (value) => {
|
|
18804
|
+
try {
|
|
18805
|
+
step(generator.next(value));
|
|
18806
|
+
} catch (e) {
|
|
18807
|
+
reject(e);
|
|
18808
|
+
}
|
|
18809
|
+
};
|
|
18810
|
+
var rejected = (value) => {
|
|
18811
|
+
try {
|
|
18812
|
+
step(generator.throw(value));
|
|
18813
|
+
} catch (e) {
|
|
18814
|
+
reject(e);
|
|
18815
|
+
}
|
|
18816
|
+
};
|
|
18817
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18818
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
18819
|
+
});
|
|
18820
|
+
};
|
|
18821
|
+
let ID$2 = 0;
|
|
18822
|
+
let REQUEST_ID = 0;
|
|
18823
|
+
class NgwConnector {
|
|
18824
|
+
constructor(options) {
|
|
18825
|
+
this.options = options;
|
|
18826
|
+
__publicField$s(this, "id", ID$2++);
|
|
18827
|
+
__publicField$s(this, "emitter", new EventEmitter());
|
|
18828
|
+
__publicField$s(this, "user");
|
|
18829
|
+
__publicField$s(this, "cache");
|
|
18830
|
+
__publicField$s(this, "withCredentials");
|
|
18831
|
+
__publicField$s(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
|
|
18832
|
+
__publicField$s(this, "routeStr", "/api/component/pyramid/route");
|
|
18833
|
+
__publicField$s(this, "activeRequests", {});
|
|
18834
|
+
__publicField$s(this, "requestTransform");
|
|
18835
|
+
const exist = findConnector(options);
|
|
18836
|
+
this.cache = new Cache({ namespace: options.cacheId });
|
|
18837
|
+
if (exist) {
|
|
18838
|
+
return exist;
|
|
18839
|
+
} else {
|
|
18840
|
+
const { route: route2, requestTransform, withCredentials } = this.options;
|
|
18841
|
+
if (route2) {
|
|
18842
|
+
this.routeStr = route2;
|
|
18843
|
+
}
|
|
18844
|
+
if (requestTransform) {
|
|
18845
|
+
this.requestTransform = requestTransform;
|
|
18846
|
+
}
|
|
18847
|
+
if (withCredentials !== void 0) {
|
|
18848
|
+
this.withCredentials = withCredentials;
|
|
18849
|
+
}
|
|
18850
|
+
addConnector(this);
|
|
18851
|
+
}
|
|
18852
|
+
}
|
|
18853
|
+
static create(options) {
|
|
18854
|
+
return new this(options);
|
|
18855
|
+
}
|
|
18856
|
+
/**
|
|
18857
|
+
* Clear the cache.
|
|
18858
|
+
*/
|
|
18859
|
+
clearCache() {
|
|
18860
|
+
this.cache.clean();
|
|
18861
|
+
}
|
|
18862
|
+
setRequestTransform(requestTransform) {
|
|
18863
|
+
this.requestTransform = requestTransform;
|
|
18864
|
+
}
|
|
18865
|
+
/**
|
|
18866
|
+
* Fast way to specify the connection address to NextGIS Web.
|
|
18867
|
+
* The current connection will be severed.
|
|
18868
|
+
* @param baseUrl - NGW url
|
|
18869
|
+
*/
|
|
18870
|
+
setNgw(baseUrl) {
|
|
18871
|
+
this.logout();
|
|
18872
|
+
this.options.baseUrl = baseUrl;
|
|
18873
|
+
addConnector(this);
|
|
18874
|
+
}
|
|
18875
|
+
/**
|
|
18876
|
+
* Establishing a connection with NextGIS Web to fulfill all other requests.
|
|
18877
|
+
* @remarks
|
|
18878
|
+
* This method need not be called manually as it is used when forming a request in {@link apiRequest | apiRequest}.
|
|
18879
|
+
* Can be used to check connection.
|
|
18880
|
+
* @example
|
|
18881
|
+
* ```javascript
|
|
18882
|
+
* const connector = new NgwConnector({ baseUrl: 'https://demo.nextgis.com' });
|
|
18883
|
+
* connector.connect()
|
|
18884
|
+
* .then(() => console.log('Ok'))
|
|
18885
|
+
* .catch((er) => console.log('Connection problem', er));
|
|
18886
|
+
* ```
|
|
18887
|
+
*/
|
|
18888
|
+
connect() {
|
|
18889
|
+
return __async$r(this, null, function* () {
|
|
18890
|
+
const auth = this.options.auth;
|
|
18891
|
+
if (auth) {
|
|
18892
|
+
const { login, password } = auth;
|
|
18893
|
+
if (login && password) {
|
|
18894
|
+
yield this._login({ login, password });
|
|
18895
|
+
}
|
|
18896
|
+
}
|
|
18897
|
+
const routeUrl = `${this.routeStr}?client=${this.client}`;
|
|
18898
|
+
return yield this.makeQuery(
|
|
18899
|
+
routeUrl,
|
|
18900
|
+
{},
|
|
18901
|
+
{
|
|
18902
|
+
cacheName: "route",
|
|
18903
|
+
cache: true,
|
|
18904
|
+
cacheProps: {
|
|
18905
|
+
id: this.id,
|
|
18906
|
+
auth,
|
|
18907
|
+
baseUrl: this.options.baseUrl
|
|
18908
|
+
}
|
|
18909
|
+
}
|
|
18910
|
+
);
|
|
18911
|
+
});
|
|
18912
|
+
}
|
|
18913
|
+
/**
|
|
18914
|
+
* Quick way to change NextGIS Web user.
|
|
18915
|
+
* @param credentials - New user credentials
|
|
18916
|
+
*/
|
|
18917
|
+
login(credentials, options) {
|
|
18918
|
+
this.logout();
|
|
18919
|
+
addConnector(this);
|
|
18920
|
+
return this._login(credentials, options);
|
|
18921
|
+
}
|
|
18922
|
+
/**
|
|
18923
|
+
* Disconnecting a user. Aborting all current requests
|
|
18924
|
+
*/
|
|
18925
|
+
logout() {
|
|
18926
|
+
this.abort();
|
|
18927
|
+
removeConnector(this);
|
|
18928
|
+
this.options.auth = void 0;
|
|
18929
|
+
this.user = void 0;
|
|
18930
|
+
this.clearCache();
|
|
18931
|
+
this.emitter.emit("logout");
|
|
18932
|
+
}
|
|
18933
|
+
getUserInfo(credentials, options) {
|
|
18934
|
+
return __async$r(this, null, function* () {
|
|
18935
|
+
if (this.user && this.user.id) {
|
|
18936
|
+
return this.user;
|
|
18937
|
+
}
|
|
18938
|
+
if (credentials) {
|
|
18939
|
+
this.options.auth = credentials;
|
|
18940
|
+
}
|
|
18941
|
+
const options_ = __spreadValues$s({
|
|
18942
|
+
headers: this.getAuthorizationHeaders(credentials),
|
|
18943
|
+
cache: true
|
|
18944
|
+
}, options);
|
|
18945
|
+
return this.makeQuery(
|
|
18946
|
+
"/api/component/auth/current_user",
|
|
18947
|
+
{},
|
|
18948
|
+
options_
|
|
18949
|
+
);
|
|
18950
|
+
});
|
|
18951
|
+
}
|
|
18952
|
+
/**
|
|
18953
|
+
* Obtaining the required Headers for authentication of requests in the NGW.
|
|
18954
|
+
*/
|
|
18955
|
+
getAuthorizationHeaders(credentials) {
|
|
18956
|
+
const client = this.makeClientId(credentials);
|
|
18957
|
+
if (client) {
|
|
18958
|
+
return {
|
|
18959
|
+
Authorization: `Basic ${client}`
|
|
18960
|
+
};
|
|
18961
|
+
}
|
|
18962
|
+
return {};
|
|
18963
|
+
}
|
|
18964
|
+
makeClientId(credentials) {
|
|
18965
|
+
credentials = credentials || this.options.auth;
|
|
18966
|
+
if (credentials) {
|
|
18967
|
+
const { login, password } = credentials;
|
|
18968
|
+
const encodedStr = [login, password].map(encodeURIComponent).join(":");
|
|
18969
|
+
{
|
|
18970
|
+
return window.btoa(encodedStr);
|
|
18971
|
+
}
|
|
18972
|
+
}
|
|
18973
|
+
}
|
|
18974
|
+
/** Stop all api requests */
|
|
18975
|
+
abort() {
|
|
18976
|
+
for (const abortController of Object.values(this.activeRequests)) {
|
|
18977
|
+
abortController.abort();
|
|
18978
|
+
}
|
|
18979
|
+
this.activeRequests = {};
|
|
18980
|
+
}
|
|
18981
|
+
getActiveApiRequests() {
|
|
18982
|
+
return __spreadValues$s({}, this.activeRequests);
|
|
18983
|
+
}
|
|
18984
|
+
route(name, ...rest) {
|
|
18985
|
+
return route(name, this, ...rest);
|
|
18986
|
+
}
|
|
18987
|
+
/**
|
|
18988
|
+
* Send request to NGW.
|
|
18989
|
+
* @param url - URL address to NGW
|
|
18990
|
+
* @param params - Query params
|
|
18991
|
+
* @param options - Request options
|
|
18992
|
+
*/
|
|
18993
|
+
makeQuery(_0, _1) {
|
|
18994
|
+
return __async$r(this, arguments, function* (url, params, options = {}) {
|
|
18995
|
+
var _b;
|
|
18996
|
+
url = (this.options.baseUrl ? this.options.baseUrl : "") + url;
|
|
18997
|
+
if (!url) {
|
|
18998
|
+
throw new Error("Empty `url` not allowed");
|
|
18999
|
+
}
|
|
19000
|
+
if (params) {
|
|
19001
|
+
const _a = params, restParams = __objRest$3(_a, ["paramList"]);
|
|
19002
|
+
url = template(url, restParams);
|
|
19003
|
+
}
|
|
19004
|
+
url = encodeURI(fixUrlStr(url));
|
|
19005
|
+
options = __spreadValues$s({ withCredentials: this.withCredentials }, options);
|
|
19006
|
+
const {
|
|
19007
|
+
cache,
|
|
19008
|
+
signal: externalSignal,
|
|
19009
|
+
method = "GET",
|
|
19010
|
+
headers,
|
|
19011
|
+
cacheName,
|
|
19012
|
+
cacheProps,
|
|
19013
|
+
responseType,
|
|
19014
|
+
withCredentials
|
|
19015
|
+
} = options;
|
|
19016
|
+
const internalAbortController = new AbortController();
|
|
19017
|
+
const internalSignal = internalAbortController.signal;
|
|
19018
|
+
if (externalSignal) {
|
|
19019
|
+
if (externalSignal.aborted) {
|
|
19020
|
+
throw new AbortError();
|
|
19021
|
+
}
|
|
19022
|
+
externalSignal.addEventListener("abort", () => {
|
|
19023
|
+
internalAbortController.abort();
|
|
19024
|
+
});
|
|
19025
|
+
}
|
|
19026
|
+
options.signal = internalSignal;
|
|
19027
|
+
const createPromise = () => __async$r(this, null, function* () {
|
|
19028
|
+
const id = REQUEST_ID++;
|
|
19029
|
+
this.activeRequests[id] = internalAbortController;
|
|
19030
|
+
try {
|
|
19031
|
+
return this._loadData(url, options);
|
|
19032
|
+
} finally {
|
|
19033
|
+
this._cleanActiveRequest(id);
|
|
19034
|
+
}
|
|
19035
|
+
});
|
|
19036
|
+
if (cache && method === "GET") {
|
|
19037
|
+
const cacheOptions = cacheProps ? cacheProps : __spreadProps$h(__spreadValues$s({}, objectRemoveEmpty({
|
|
19038
|
+
headers,
|
|
19039
|
+
withCredentials,
|
|
19040
|
+
responseType,
|
|
19041
|
+
baseUrl: this.options.baseUrl,
|
|
19042
|
+
userId: (_b = this.user) == null ? void 0 : _b.id
|
|
19043
|
+
})), {
|
|
19044
|
+
params
|
|
19045
|
+
});
|
|
19046
|
+
return this.cache.add(
|
|
19047
|
+
cacheName || url,
|
|
19048
|
+
createPromise,
|
|
19049
|
+
cacheOptions,
|
|
19050
|
+
false
|
|
19051
|
+
);
|
|
19052
|
+
}
|
|
19053
|
+
return createPromise();
|
|
19054
|
+
});
|
|
19055
|
+
}
|
|
19056
|
+
_loadData(url, options) {
|
|
19057
|
+
options.responseType = options.responseType || "json";
|
|
19058
|
+
return new Promise((resolve, reject) => {
|
|
19059
|
+
var _a;
|
|
19060
|
+
if (this.user) {
|
|
19061
|
+
options = options || {};
|
|
19062
|
+
options.headers = __spreadValues$s(__spreadValues$s({}, this.getAuthorizationHeaders()), options.headers);
|
|
19063
|
+
}
|
|
19064
|
+
if (this.requestTransform) {
|
|
19065
|
+
const [transUrl, transOptions] = this.requestTransform(url, options);
|
|
19066
|
+
url = transUrl;
|
|
19067
|
+
options = transOptions;
|
|
19068
|
+
}
|
|
19069
|
+
let runOnAbort = void 0;
|
|
19070
|
+
loadData(url, resolve, options, reject, (handler) => {
|
|
19071
|
+
runOnAbort = handler;
|
|
19072
|
+
});
|
|
19073
|
+
(_a = options.signal) == null ? void 0 : _a.addEventListener("abort", () => {
|
|
19074
|
+
if (runOnAbort !== void 0) {
|
|
19075
|
+
runOnAbort();
|
|
19076
|
+
}
|
|
19077
|
+
reject(new AbortError());
|
|
19078
|
+
});
|
|
19079
|
+
}).catch((httpError) => {
|
|
19080
|
+
if (httpError.name !== "AbortError") {
|
|
19081
|
+
{
|
|
19082
|
+
console.warn("DEV WARN", httpError);
|
|
19083
|
+
}
|
|
19084
|
+
const er = this._handleHttpError(httpError);
|
|
19085
|
+
if (er) {
|
|
19086
|
+
throw er;
|
|
19087
|
+
}
|
|
19088
|
+
}
|
|
19089
|
+
throw httpError;
|
|
19090
|
+
});
|
|
19091
|
+
}
|
|
19092
|
+
_login(credentials, options) {
|
|
19093
|
+
return __async$r(this, null, function* () {
|
|
19094
|
+
try {
|
|
19095
|
+
const data = yield this.getUserInfo(credentials, options);
|
|
19096
|
+
this.user = data;
|
|
19097
|
+
this.emitter.emit("login", data);
|
|
19098
|
+
return data;
|
|
19099
|
+
} catch (er) {
|
|
19100
|
+
this.emitter.emit("login:error", er);
|
|
19101
|
+
throw er;
|
|
19102
|
+
}
|
|
19103
|
+
});
|
|
19104
|
+
}
|
|
19105
|
+
_cleanActiveRequest(requestId) {
|
|
19106
|
+
delete this.activeRequests[requestId];
|
|
19107
|
+
}
|
|
19108
|
+
_handleHttpError(er) {
|
|
19109
|
+
if (er) {
|
|
19110
|
+
if (er instanceof NgwError) {
|
|
19111
|
+
if (er.exception === "nextgisweb.resource.exception.ResourceNotFound") {
|
|
19112
|
+
throw new ResourceNotFoundError(er);
|
|
19113
|
+
} else if (er.exception === "nextgisweb.core.exception.InsufficientPermissions") {
|
|
19114
|
+
throw new InsufficientPermissionsError(er);
|
|
19115
|
+
}
|
|
19116
|
+
}
|
|
19117
|
+
}
|
|
19118
|
+
return er;
|
|
19119
|
+
}
|
|
19120
|
+
}
|
|
19121
|
+
__publicField$s(NgwConnector, "errors", {
|
|
19122
|
+
NgwError,
|
|
19123
|
+
ResourceNotFoundError
|
|
19124
|
+
});
|
|
19125
|
+
|
|
19126
|
+
function resourceCompare(res1, res2) {
|
|
19127
|
+
return objectDeepEqual(res1, res2);
|
|
19128
|
+
}
|
|
19129
|
+
|
|
19130
|
+
const exclude = ["description"];
|
|
19131
|
+
function resourceToQuery(resource, prefix = "") {
|
|
19132
|
+
prefix = prefix ? prefix + "__" : "";
|
|
19133
|
+
const query = {};
|
|
19134
|
+
for (const [key, value] of Object.entries(resource)) {
|
|
19135
|
+
if (exclude.indexOf(key) === -1) {
|
|
19136
|
+
if (isObject(value)) {
|
|
19137
|
+
if (key === "owner_user") {
|
|
19138
|
+
const children = resourceToQuery(value, key);
|
|
19139
|
+
Object.assign(query, children);
|
|
19140
|
+
} else if (key === "parent" && "id" in value) {
|
|
19141
|
+
query.parent_id = value.id;
|
|
19142
|
+
}
|
|
19143
|
+
} else if (defined(value)) {
|
|
19144
|
+
query[prefix + key] = value;
|
|
19145
|
+
}
|
|
19146
|
+
}
|
|
19147
|
+
}
|
|
19148
|
+
return query;
|
|
19149
|
+
}
|
|
19150
|
+
|
|
19151
|
+
var __defProp$D = Object.defineProperty;
|
|
19152
|
+
var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
|
|
19153
|
+
var __hasOwnProp$s = Object.prototype.hasOwnProperty;
|
|
19154
|
+
var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
|
|
19155
|
+
var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
19156
|
+
var __spreadValues$r = (a, b) => {
|
|
19157
|
+
for (var prop in b || (b = {}))
|
|
19158
|
+
if (__hasOwnProp$s.call(b, prop))
|
|
19159
|
+
__defNormalProp$D(a, prop, b[prop]);
|
|
19160
|
+
if (__getOwnPropSymbols$s)
|
|
19161
|
+
for (var prop of __getOwnPropSymbols$s(b)) {
|
|
19162
|
+
if (__propIsEnum$s.call(b, prop))
|
|
19163
|
+
__defNormalProp$D(a, prop, b[prop]);
|
|
19164
|
+
}
|
|
19165
|
+
return a;
|
|
19166
|
+
};
|
|
19167
|
+
var __publicField$r = (obj, key, value) => __defNormalProp$D(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
19168
|
+
var __async$q = (__this, __arguments, generator) => {
|
|
19169
|
+
return new Promise((resolve, reject) => {
|
|
19170
|
+
var fulfilled = (value) => {
|
|
19171
|
+
try {
|
|
19172
|
+
step(generator.next(value));
|
|
19173
|
+
} catch (e) {
|
|
19174
|
+
reject(e);
|
|
19175
|
+
}
|
|
19176
|
+
};
|
|
19177
|
+
var rejected = (value) => {
|
|
19178
|
+
try {
|
|
19179
|
+
step(generator.throw(value));
|
|
19180
|
+
} catch (e) {
|
|
19181
|
+
reject(e);
|
|
19182
|
+
}
|
|
19183
|
+
};
|
|
19184
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
19185
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19186
|
+
});
|
|
19187
|
+
};
|
|
19188
|
+
class ResourcesControl {
|
|
19189
|
+
constructor({
|
|
19190
|
+
connector,
|
|
19191
|
+
cacheId
|
|
19192
|
+
}) {
|
|
19193
|
+
__publicField$r(this, "cache");
|
|
19194
|
+
__publicField$r(this, "connector");
|
|
19195
|
+
this.connector = connector;
|
|
19196
|
+
this.cache = new Cache({ namespace: cacheId });
|
|
19197
|
+
}
|
|
19198
|
+
// -------------------------------------------------------------------------
|
|
19199
|
+
// Resource Methods
|
|
19200
|
+
// -------------------------------------------------------------------------
|
|
19201
|
+
/**
|
|
19202
|
+
* Receive resource from NGW by id, keyname or search-object parameter.
|
|
19203
|
+
* @param resource - Resource id, keyname or search-object
|
|
19204
|
+
*
|
|
19205
|
+
* @remarks
|
|
19206
|
+
* Fetching resource would be cached to speed up next call
|
|
19207
|
+
*/
|
|
19208
|
+
getOne(resource, requestOptions) {
|
|
19209
|
+
const opt = __spreadValues$r({}, requestOptions);
|
|
19210
|
+
if (typeof resource === "string") ; else if (typeof resource === "number") ; else if (isObject(resource)) {
|
|
19211
|
+
if (resource.id !== void 0) {
|
|
19212
|
+
resource.id;
|
|
19213
|
+
} else {
|
|
19214
|
+
if (resource.keyname) {
|
|
19215
|
+
resource.keyname;
|
|
19216
|
+
}
|
|
19217
|
+
if (resource.display_name) {
|
|
19218
|
+
resource.display_name;
|
|
19219
|
+
}
|
|
19220
|
+
}
|
|
19221
|
+
}
|
|
19222
|
+
if (typeof resource === "string") {
|
|
19223
|
+
return this._fetchResourceBy({ keyname: resource }, opt);
|
|
19224
|
+
} else if (typeof resource === "number") {
|
|
19225
|
+
return this._fetchResourceById(resource, opt);
|
|
19226
|
+
} else if (isObject(resource)) {
|
|
19227
|
+
return this._fetchResourceBy(resource, opt);
|
|
19228
|
+
}
|
|
19229
|
+
return Promise.resolve(void 0);
|
|
19230
|
+
}
|
|
19231
|
+
getOneOrFail(resource, requestOptions) {
|
|
19232
|
+
return this.getOne(resource, requestOptions).then((res) => {
|
|
19233
|
+
if (res) {
|
|
19234
|
+
return res;
|
|
19235
|
+
}
|
|
19236
|
+
throw new ResourceNotFoundError();
|
|
19237
|
+
});
|
|
19238
|
+
}
|
|
19239
|
+
/**
|
|
19240
|
+
* A fast way to retrieve resource ID for any resource definition.
|
|
19241
|
+
* @param resource - Any available resource definition
|
|
19242
|
+
*
|
|
19243
|
+
* @remarks
|
|
18299
19244
|
* There are situations when exactly the resource id is needed
|
|
18300
19245
|
* (for example, to compose the correct request to the api)
|
|
18301
19246
|
* then this method will come in handy to facilitate the extraction of the identifier
|
|
@@ -18338,7 +19283,7 @@ var NgwLeaflet = (function () {
|
|
|
18338
19283
|
} else {
|
|
18339
19284
|
Object.assign(query, resourceToQuery(resource));
|
|
18340
19285
|
}
|
|
18341
|
-
return this.connector.get("resource.search", requestOptions, __spreadValues$
|
|
19286
|
+
return this.connector.get("resource.search", requestOptions, __spreadValues$r({
|
|
18342
19287
|
serialization: "full"
|
|
18343
19288
|
}, query)).then((resources) => {
|
|
18344
19289
|
if ((requestOptions == null ? void 0 : requestOptions.cache) && resources) {
|
|
@@ -18396,348 +19341,94 @@ var NgwLeaflet = (function () {
|
|
|
18396
19341
|
for (const item of items) {
|
|
18397
19342
|
if (requestOptions == null ? void 0 : requestOptions.cache) {
|
|
18398
19343
|
this.cache.add("resource.item", Promise.resolve(item), {
|
|
18399
|
-
id: item.resource.id
|
|
18400
|
-
});
|
|
18401
|
-
}
|
|
18402
|
-
_items.push(item);
|
|
18403
|
-
if ((requestOptions == null ? void 0 : requestOptions.recursive) && item.resource.children) {
|
|
18404
|
-
recursivePromises.push(
|
|
18405
|
-
this._getChildrenOf(item.resource.id, requestOptions, _items)
|
|
18406
|
-
);
|
|
18407
|
-
}
|
|
18408
|
-
}
|
|
18409
|
-
if (recursivePromises.length) {
|
|
18410
|
-
return Promise.all(recursivePromises).then(() => {
|
|
18411
|
-
return _items;
|
|
18412
|
-
});
|
|
18413
|
-
}
|
|
18414
|
-
return _items;
|
|
18415
|
-
});
|
|
18416
|
-
}
|
|
18417
|
-
_cleanResourceItemCache(id) {
|
|
18418
|
-
return __async$r(this, null, function* () {
|
|
18419
|
-
var _a;
|
|
18420
|
-
const all = this.cache.all();
|
|
18421
|
-
const toDelete = [];
|
|
18422
|
-
for (const c of all) {
|
|
18423
|
-
const cid = (_a = c.props) == null ? void 0 : _a.id;
|
|
18424
|
-
if (["resource.item", "resource"].includes(c.key) && cid !== void 0) {
|
|
18425
|
-
if (typeof cid === "number") {
|
|
18426
|
-
if (cid === id) {
|
|
18427
|
-
toDelete.push(c);
|
|
18428
|
-
}
|
|
18429
|
-
} else {
|
|
18430
|
-
const rid = yield this.getId(cid);
|
|
18431
|
-
if (rid === id) {
|
|
18432
|
-
toDelete.push(c);
|
|
18433
|
-
}
|
|
18434
|
-
}
|
|
18435
|
-
}
|
|
18436
|
-
}
|
|
18437
|
-
for (const d of toDelete) {
|
|
18438
|
-
this.cache.delete(d);
|
|
18439
|
-
}
|
|
18440
|
-
});
|
|
18441
|
-
}
|
|
18442
|
-
_fetchResourceById(id, requestOptions) {
|
|
18443
|
-
return this.connector.get("resource.item", requestOptions, { id });
|
|
18444
|
-
}
|
|
18445
|
-
_fetchResourceBy(resource, requestOptions) {
|
|
18446
|
-
return this.getMany(resource, requestOptions).then((resources) => {
|
|
18447
|
-
return resources[0];
|
|
18448
|
-
});
|
|
18449
|
-
}
|
|
18450
|
-
_resourceCacheFilter(resource) {
|
|
18451
|
-
return Promise.all(this.cache.matchAll("resource.item")).then(
|
|
18452
|
-
(resources) => {
|
|
18453
|
-
const items = [];
|
|
18454
|
-
resources.filter((x) => {
|
|
18455
|
-
if (x) {
|
|
18456
|
-
if (resource.keyname && x.resource.keyname) {
|
|
18457
|
-
return resource.keyname === x.resource.keyname;
|
|
18458
|
-
}
|
|
18459
|
-
if (defined(resource.id) && defined(x.resource.id)) {
|
|
18460
|
-
return resource.id === x.resource.id;
|
|
18461
|
-
}
|
|
18462
|
-
return resourceCompare(resource, x.resource);
|
|
18463
|
-
}
|
|
18464
|
-
});
|
|
18465
|
-
return items;
|
|
18466
|
-
}
|
|
18467
|
-
);
|
|
18468
|
-
}
|
|
18469
|
-
}
|
|
18470
|
-
|
|
18471
|
-
const CONNECTORS = [];
|
|
18472
|
-
function addConnector(connector) {
|
|
18473
|
-
CONNECTORS.push(connector);
|
|
18474
|
-
}
|
|
18475
|
-
function findConnector(options) {
|
|
18476
|
-
return CONNECTORS.find((x) => {
|
|
18477
|
-
if (x.options.baseUrl === options.baseUrl) {
|
|
18478
|
-
if (options.auth) {
|
|
18479
|
-
if (x.options.auth) {
|
|
18480
|
-
return objectDeepEqual(x.options.auth, options.auth);
|
|
18481
|
-
}
|
|
18482
|
-
} else {
|
|
18483
|
-
return true;
|
|
18484
|
-
}
|
|
18485
|
-
}
|
|
18486
|
-
});
|
|
18487
|
-
}
|
|
18488
|
-
function removeConnector(connector) {
|
|
18489
|
-
const index = CONNECTORS.indexOf(connector);
|
|
18490
|
-
if (index !== -1) {
|
|
18491
|
-
CONNECTORS.splice(index, 1);
|
|
18492
|
-
}
|
|
18493
|
-
}
|
|
18494
|
-
|
|
18495
|
-
class AbortError extends Error {
|
|
18496
|
-
constructor(message = "AbortError") {
|
|
18497
|
-
super(message);
|
|
18498
|
-
this.name = "AbortError";
|
|
18499
|
-
}
|
|
18500
|
-
}
|
|
18501
|
-
|
|
18502
|
-
var __defProp$E = Object.defineProperty;
|
|
18503
|
-
var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18504
|
-
var __publicField$s = (obj, key, value) => __defNormalProp$E(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18505
|
-
class InsufficientPermissionsError extends NgwError {
|
|
18506
|
-
constructor(obj) {
|
|
18507
|
-
super(obj);
|
|
18508
|
-
__publicField$s(this, "name", "InsufficientPermissionsError");
|
|
18509
|
-
__publicField$s(this, "exception", "nextgisweb.core.exception.InsufficientPermissions");
|
|
18510
|
-
Object.setPrototypeOf(this, InsufficientPermissionsError.prototype);
|
|
18511
|
-
}
|
|
18512
|
-
}
|
|
18513
|
-
|
|
18514
|
-
const templateRe = /\{ *([\w_-]+) *\}/g;
|
|
18515
|
-
function template(str, data) {
|
|
18516
|
-
return str.replace(templateRe, (s, key) => {
|
|
18517
|
-
let value = data[key];
|
|
18518
|
-
if (value === void 0) {
|
|
18519
|
-
throw new Error("No value provided for letiable " + s);
|
|
18520
|
-
} else if (typeof value === "function") {
|
|
18521
|
-
value = value(data);
|
|
18522
|
-
}
|
|
18523
|
-
return value;
|
|
18524
|
-
});
|
|
18525
|
-
}
|
|
18526
|
-
|
|
18527
|
-
var __defProp$D = Object.defineProperty;
|
|
18528
|
-
var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
|
|
18529
|
-
var __hasOwnProp$s = Object.prototype.hasOwnProperty;
|
|
18530
|
-
var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
|
|
18531
|
-
var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18532
|
-
var __spreadValues$r = (a, b) => {
|
|
18533
|
-
for (var prop in b || (b = {}))
|
|
18534
|
-
if (__hasOwnProp$s.call(b, prop))
|
|
18535
|
-
__defNormalProp$D(a, prop, b[prop]);
|
|
18536
|
-
if (__getOwnPropSymbols$s)
|
|
18537
|
-
for (var prop of __getOwnPropSymbols$s(b)) {
|
|
18538
|
-
if (__propIsEnum$s.call(b, prop))
|
|
18539
|
-
__defNormalProp$D(a, prop, b[prop]);
|
|
18540
|
-
}
|
|
18541
|
-
return a;
|
|
18542
|
-
};
|
|
18543
|
-
var __async$q = (__this, __arguments, generator) => {
|
|
18544
|
-
return new Promise((resolve, reject) => {
|
|
18545
|
-
var fulfilled = (value) => {
|
|
18546
|
-
try {
|
|
18547
|
-
step(generator.next(value));
|
|
18548
|
-
} catch (e) {
|
|
18549
|
-
reject(e);
|
|
18550
|
-
}
|
|
18551
|
-
};
|
|
18552
|
-
var rejected = (value) => {
|
|
18553
|
-
try {
|
|
18554
|
-
step(generator.throw(value));
|
|
18555
|
-
} catch (e) {
|
|
18556
|
-
reject(e);
|
|
18557
|
-
}
|
|
18558
|
-
};
|
|
18559
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18560
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
18561
|
-
});
|
|
18562
|
-
};
|
|
18563
|
-
function apiRequest(opt) {
|
|
18564
|
-
return __async$q(this, null, function* () {
|
|
18565
|
-
const { params, name, connector, requestOptions } = opt;
|
|
18566
|
-
const apiItems = yield connector.connect();
|
|
18567
|
-
let apiItem = apiItems && apiItems[name];
|
|
18568
|
-
if (apiItem) {
|
|
18569
|
-
apiItem = [...apiItem];
|
|
18570
|
-
let url = apiItem.shift();
|
|
18571
|
-
if (apiItem.length) {
|
|
18572
|
-
const replaceParams = {};
|
|
18573
|
-
for (let fry = 0; fry < apiItem.length; fry++) {
|
|
18574
|
-
const arg = apiItem[fry];
|
|
18575
|
-
replaceParams[fry] = `{${arg}}`;
|
|
18576
|
-
if (params[arg] === void 0) {
|
|
18577
|
-
throw new Error(`\`${arg}\` URL API argument is not specified`);
|
|
18578
|
-
}
|
|
18579
|
-
}
|
|
18580
|
-
if (url) {
|
|
18581
|
-
url = template(url, replaceParams);
|
|
18582
|
-
}
|
|
18583
|
-
}
|
|
18584
|
-
if (params) {
|
|
18585
|
-
const paramArray = [];
|
|
18586
|
-
const paramList = params.paramList;
|
|
18587
|
-
if (Array.isArray(paramList)) {
|
|
18588
|
-
paramList.forEach(([key, value]) => {
|
|
18589
|
-
paramArray.push(`${key}=${value}`);
|
|
19344
|
+
id: item.resource.id
|
|
18590
19345
|
});
|
|
18591
19346
|
}
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18595
|
-
|
|
18596
|
-
|
|
18597
|
-
if (paramArray.length) {
|
|
18598
|
-
url = `${url}?${paramArray.join("&")}`;
|
|
19347
|
+
_items.push(item);
|
|
19348
|
+
if ((requestOptions == null ? void 0 : requestOptions.recursive) && item.resource.children) {
|
|
19349
|
+
recursivePromises.push(
|
|
19350
|
+
this._getChildrenOf(item.resource.id, requestOptions, _items)
|
|
19351
|
+
);
|
|
18599
19352
|
}
|
|
18600
19353
|
}
|
|
18601
|
-
if (
|
|
18602
|
-
return
|
|
18603
|
-
|
|
18604
|
-
}
|
|
18605
|
-
} else {
|
|
18606
|
-
throw new Error("Request URL is not set");
|
|
19354
|
+
if (recursivePromises.length) {
|
|
19355
|
+
return Promise.all(recursivePromises).then(() => {
|
|
19356
|
+
return _items;
|
|
19357
|
+
});
|
|
18607
19358
|
}
|
|
18608
|
-
|
|
18609
|
-
|
|
18610
|
-
}
|
|
18611
|
-
});
|
|
18612
|
-
}
|
|
18613
|
-
|
|
18614
|
-
var __defProp$C = Object.defineProperty;
|
|
18615
|
-
var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18616
|
-
var __publicField$r = (obj, key, value) => __defNormalProp$C(obj, key + "" , value);
|
|
18617
|
-
class NetworkError extends Error {
|
|
18618
|
-
constructor(url) {
|
|
18619
|
-
super();
|
|
18620
|
-
__publicField$r(this, "name", "NetworkError");
|
|
18621
|
-
Object.setPrototypeOf(this, NetworkError.prototype);
|
|
18622
|
-
this.message = `Unable to request ${url}.
|
|
18623
|
-
Possibly invalid NGW URL entered or CORS not configured to get request from ${location.origin}`;
|
|
19359
|
+
return _items;
|
|
19360
|
+
});
|
|
18624
19361
|
}
|
|
18625
|
-
|
|
18626
|
-
|
|
18627
|
-
|
|
18628
|
-
|
|
18629
|
-
|
|
18630
|
-
|
|
18631
|
-
|
|
18632
|
-
|
|
18633
|
-
|
|
18634
|
-
|
|
18635
|
-
|
|
18636
|
-
|
|
18637
|
-
|
|
18638
|
-
|
|
18639
|
-
|
|
18640
|
-
|
|
18641
|
-
|
|
18642
|
-
|
|
18643
|
-
const processingResponse = (forError = false) => {
|
|
18644
|
-
const cb = forError ? error : callback;
|
|
18645
|
-
if (options.responseType === "blob") {
|
|
18646
|
-
cb(xhr.response);
|
|
18647
|
-
} else {
|
|
18648
|
-
if (xhr.responseText) {
|
|
18649
|
-
cb(getResponseText());
|
|
18650
|
-
} else {
|
|
18651
|
-
error({ message: "" });
|
|
18652
|
-
}
|
|
18653
|
-
}
|
|
18654
|
-
};
|
|
18655
|
-
xhr.onload = () => {
|
|
18656
|
-
if ([401, 403, 404, 422, 500].indexOf(xhr.status) !== -1) {
|
|
18657
|
-
error(new NgwError(getResponseText()));
|
|
18658
|
-
}
|
|
18659
|
-
processingResponse();
|
|
18660
|
-
};
|
|
18661
|
-
xhr.onerror = (er) => {
|
|
18662
|
-
if (xhr.status === 0) {
|
|
18663
|
-
error(new NetworkError(url));
|
|
18664
|
-
} else {
|
|
18665
|
-
error(er);
|
|
18666
|
-
}
|
|
18667
|
-
};
|
|
18668
|
-
xhr.upload.onprogress = function(e) {
|
|
18669
|
-
if (e.lengthComputable) {
|
|
18670
|
-
const percentComplete = e.loaded / e.total * 100;
|
|
18671
|
-
if (options.onProgress) {
|
|
18672
|
-
options.onProgress(percentComplete, e);
|
|
19362
|
+
_cleanResourceItemCache(id) {
|
|
19363
|
+
return __async$q(this, null, function* () {
|
|
19364
|
+
var _a;
|
|
19365
|
+
const all = this.cache.all();
|
|
19366
|
+
const toDelete = [];
|
|
19367
|
+
for (const c of all) {
|
|
19368
|
+
const cid = (_a = c.props) == null ? void 0 : _a.id;
|
|
19369
|
+
if (["resource.item", "resource"].includes(c.key) && cid !== void 0) {
|
|
19370
|
+
if (typeof cid === "number") {
|
|
19371
|
+
if (cid === id) {
|
|
19372
|
+
toDelete.push(c);
|
|
19373
|
+
}
|
|
19374
|
+
} else {
|
|
19375
|
+
const rid = yield this.getId(cid);
|
|
19376
|
+
if (rid === id) {
|
|
19377
|
+
toDelete.push(c);
|
|
19378
|
+
}
|
|
19379
|
+
}
|
|
18673
19380
|
}
|
|
18674
19381
|
}
|
|
18675
|
-
|
|
18676
|
-
|
|
18677
|
-
if (headers) {
|
|
18678
|
-
for (const h in headers) {
|
|
18679
|
-
const header = headers[h];
|
|
18680
|
-
if (typeof header === "string") {
|
|
18681
|
-
xhr.setRequestHeader(h, header);
|
|
18682
|
-
}
|
|
19382
|
+
for (const d of toDelete) {
|
|
19383
|
+
this.cache.delete(d);
|
|
18683
19384
|
}
|
|
18684
|
-
}
|
|
18685
|
-
|
|
18686
|
-
|
|
18687
|
-
}
|
|
18688
|
-
|
|
18689
|
-
|
|
18690
|
-
|
|
18691
|
-
|
|
18692
|
-
|
|
18693
|
-
|
|
18694
|
-
|
|
18695
|
-
|
|
19385
|
+
});
|
|
19386
|
+
}
|
|
19387
|
+
_fetchResourceById(id, requestOptions) {
|
|
19388
|
+
return this.connector.get("resource.item", requestOptions, { id });
|
|
19389
|
+
}
|
|
19390
|
+
_fetchResourceBy(resource, requestOptions) {
|
|
19391
|
+
return this.getMany(resource, requestOptions).then((resources) => {
|
|
19392
|
+
return resources[0];
|
|
19393
|
+
});
|
|
19394
|
+
}
|
|
19395
|
+
_resourceCacheFilter(resource) {
|
|
19396
|
+
return Promise.all(this.cache.matchAll("resource.item")).then(
|
|
19397
|
+
(resources) => {
|
|
19398
|
+
const items = [];
|
|
19399
|
+
resources.filter((x) => {
|
|
19400
|
+
if (x) {
|
|
19401
|
+
if (resource.keyname && x.resource.keyname) {
|
|
19402
|
+
return resource.keyname === x.resource.keyname;
|
|
19403
|
+
}
|
|
19404
|
+
if (defined(resource.id) && defined(x.resource.id)) {
|
|
19405
|
+
return resource.id === x.resource.id;
|
|
19406
|
+
}
|
|
19407
|
+
return resourceCompare(resource, x.resource);
|
|
19408
|
+
}
|
|
19409
|
+
});
|
|
19410
|
+
return items;
|
|
18696
19411
|
}
|
|
18697
|
-
|
|
18698
|
-
|
|
18699
|
-
}
|
|
18700
|
-
if (onCancel) {
|
|
18701
|
-
onCancel(() => {
|
|
18702
|
-
xhr.abort();
|
|
18703
|
-
});
|
|
18704
|
-
}
|
|
18705
|
-
xhr.send(data);
|
|
18706
|
-
};
|
|
19412
|
+
);
|
|
19413
|
+
}
|
|
18707
19414
|
}
|
|
18708
19415
|
|
|
18709
|
-
var __defProp$
|
|
18710
|
-
var __defProps$h = Object.defineProperties;
|
|
18711
|
-
var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
|
|
19416
|
+
var __defProp$C = Object.defineProperty;
|
|
18712
19417
|
var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
|
|
18713
19418
|
var __hasOwnProp$r = Object.prototype.hasOwnProperty;
|
|
18714
19419
|
var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
|
|
18715
|
-
var __defNormalProp$
|
|
19420
|
+
var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18716
19421
|
var __spreadValues$q = (a, b) => {
|
|
18717
19422
|
for (var prop in b || (b = {}))
|
|
18718
19423
|
if (__hasOwnProp$r.call(b, prop))
|
|
18719
|
-
__defNormalProp$
|
|
19424
|
+
__defNormalProp$C(a, prop, b[prop]);
|
|
18720
19425
|
if (__getOwnPropSymbols$r)
|
|
18721
19426
|
for (var prop of __getOwnPropSymbols$r(b)) {
|
|
18722
19427
|
if (__propIsEnum$r.call(b, prop))
|
|
18723
|
-
__defNormalProp$
|
|
19428
|
+
__defNormalProp$C(a, prop, b[prop]);
|
|
18724
19429
|
}
|
|
18725
19430
|
return a;
|
|
18726
19431
|
};
|
|
18727
|
-
var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
|
|
18728
|
-
var __objRest$3 = (source, exclude) => {
|
|
18729
|
-
var target = {};
|
|
18730
|
-
for (var prop in source)
|
|
18731
|
-
if (__hasOwnProp$r.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
18732
|
-
target[prop] = source[prop];
|
|
18733
|
-
if (source != null && __getOwnPropSymbols$r)
|
|
18734
|
-
for (var prop of __getOwnPropSymbols$r(source)) {
|
|
18735
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$r.call(source, prop))
|
|
18736
|
-
target[prop] = source[prop];
|
|
18737
|
-
}
|
|
18738
|
-
return target;
|
|
18739
|
-
};
|
|
18740
|
-
var __publicField$q = (obj, key, value) => __defNormalProp$B(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18741
19432
|
var __async$p = (__this, __arguments, generator) => {
|
|
18742
19433
|
return new Promise((resolve, reject) => {
|
|
18743
19434
|
var fulfilled = (value) => {
|
|
@@ -18758,172 +19449,75 @@ var NgwLeaflet = (function () {
|
|
|
18758
19449
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
18759
19450
|
});
|
|
18760
19451
|
};
|
|
18761
|
-
|
|
18762
|
-
|
|
18763
|
-
|
|
18764
|
-
|
|
18765
|
-
|
|
18766
|
-
|
|
18767
|
-
|
|
18768
|
-
|
|
18769
|
-
|
|
18770
|
-
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
|
|
18780
|
-
} else {
|
|
18781
|
-
const { route, requestTransform, withCredentials } = this.options;
|
|
18782
|
-
if (route) {
|
|
18783
|
-
this.routeStr = route;
|
|
18784
|
-
}
|
|
18785
|
-
if (requestTransform) {
|
|
18786
|
-
this.requestTransform = requestTransform;
|
|
18787
|
-
}
|
|
18788
|
-
if (withCredentials !== void 0) {
|
|
18789
|
-
this.withCredentials = withCredentials;
|
|
18790
|
-
}
|
|
18791
|
-
this.resources = new ResourcesControl({
|
|
18792
|
-
connector: this,
|
|
18793
|
-
cacheId: options.cacheId
|
|
18794
|
-
});
|
|
18795
|
-
addConnector(this);
|
|
18796
|
-
}
|
|
18797
|
-
}
|
|
18798
|
-
static create(options) {
|
|
18799
|
-
return new this(options);
|
|
18800
|
-
}
|
|
18801
|
-
/**
|
|
18802
|
-
* Clear the cache.
|
|
18803
|
-
*/
|
|
18804
|
-
clearCache() {
|
|
18805
|
-
this.cache.clean();
|
|
18806
|
-
this.resources.cache.clean();
|
|
18807
|
-
}
|
|
18808
|
-
setRequestTransform(requestTransform) {
|
|
18809
|
-
this.requestTransform = requestTransform;
|
|
18810
|
-
}
|
|
18811
|
-
/**
|
|
18812
|
-
* Fast way to specify the connection address to NextGIS Web.
|
|
18813
|
-
* The current connection will be severed.
|
|
18814
|
-
* @param baseUrl - NGW url
|
|
18815
|
-
*/
|
|
18816
|
-
setNgw(baseUrl) {
|
|
18817
|
-
this.logout();
|
|
18818
|
-
this.options.baseUrl = baseUrl;
|
|
18819
|
-
addConnector(this);
|
|
18820
|
-
}
|
|
18821
|
-
/**
|
|
18822
|
-
* Establishing a connection with NextGIS Web to fulfill all other requests.
|
|
18823
|
-
* @remarks
|
|
18824
|
-
* This method need not be called manually as it is used when forming a request in {@link apiRequest | apiRequest}.
|
|
18825
|
-
* Can be used to check connection.
|
|
18826
|
-
* @example
|
|
18827
|
-
* ```javascript
|
|
18828
|
-
* const connector = new NgwConnector({baseUrl: 'https://demo.nextgis.com'});
|
|
18829
|
-
* connector.connect()
|
|
18830
|
-
* .then(() => console.log('Ok'))
|
|
18831
|
-
* .catch((er) => console.log('Connection problem', er));
|
|
18832
|
-
* ```
|
|
18833
|
-
*/
|
|
18834
|
-
connect() {
|
|
18835
|
-
return __async$p(this, null, function* () {
|
|
18836
|
-
const auth = this.options.auth;
|
|
18837
|
-
if (auth) {
|
|
18838
|
-
const { login, password } = auth;
|
|
18839
|
-
if (login && password) {
|
|
18840
|
-
yield this._login({ login, password });
|
|
19452
|
+
function apiRequest(opt) {
|
|
19453
|
+
return __async$p(this, null, function* () {
|
|
19454
|
+
const { params, name, connector, requestOptions } = opt;
|
|
19455
|
+
const apiItems = yield connector.connect();
|
|
19456
|
+
let apiItem = apiItems && apiItems[name];
|
|
19457
|
+
if (apiItem) {
|
|
19458
|
+
apiItem = [...apiItem];
|
|
19459
|
+
let url = apiItem.shift();
|
|
19460
|
+
if (apiItem.length) {
|
|
19461
|
+
const replaceParams = {};
|
|
19462
|
+
for (let fry = 0; fry < apiItem.length; fry++) {
|
|
19463
|
+
const arg = apiItem[fry];
|
|
19464
|
+
replaceParams[fry] = `{${arg}}`;
|
|
19465
|
+
if (params[arg] === void 0) {
|
|
19466
|
+
throw new Error(`\`${arg}\` URL API argument is not specified`);
|
|
19467
|
+
}
|
|
19468
|
+
}
|
|
19469
|
+
if (url) {
|
|
19470
|
+
url = template(url, replaceParams);
|
|
18841
19471
|
}
|
|
18842
19472
|
}
|
|
18843
|
-
|
|
18844
|
-
|
|
18845
|
-
|
|
18846
|
-
{
|
|
18847
|
-
|
|
18848
|
-
|
|
18849
|
-
|
|
18850
|
-
|
|
18851
|
-
|
|
18852
|
-
|
|
18853
|
-
|
|
19473
|
+
if (params) {
|
|
19474
|
+
const paramArray = [];
|
|
19475
|
+
const paramList = params.paramList;
|
|
19476
|
+
if (Array.isArray(paramList)) {
|
|
19477
|
+
paramList.forEach(([key, value]) => {
|
|
19478
|
+
paramArray.push(`${key}=${value}`);
|
|
19479
|
+
});
|
|
19480
|
+
}
|
|
19481
|
+
for (const p in params) {
|
|
19482
|
+
if (apiItem.indexOf(p) === -1) {
|
|
19483
|
+
paramArray.push(`${p}=${params[p]}`);
|
|
18854
19484
|
}
|
|
18855
19485
|
}
|
|
18856
|
-
|
|
18857
|
-
|
|
18858
|
-
|
|
18859
|
-
/**
|
|
18860
|
-
* Quick way to change NextGIS Web user.
|
|
18861
|
-
* @param credentials - New user credentials
|
|
18862
|
-
*/
|
|
18863
|
-
login(credentials, options) {
|
|
18864
|
-
this.logout();
|
|
18865
|
-
addConnector(this);
|
|
18866
|
-
return this._login(credentials, options);
|
|
18867
|
-
}
|
|
18868
|
-
/**
|
|
18869
|
-
* Disconnecting a user. Aborting all current requests
|
|
18870
|
-
*/
|
|
18871
|
-
logout() {
|
|
18872
|
-
this.abort();
|
|
18873
|
-
removeConnector(this);
|
|
18874
|
-
this.options.auth = void 0;
|
|
18875
|
-
this.user = void 0;
|
|
18876
|
-
this.clearCache();
|
|
18877
|
-
this.emitter.emit("logout");
|
|
18878
|
-
}
|
|
18879
|
-
getUserInfo(credentials, options) {
|
|
18880
|
-
return __async$p(this, null, function* () {
|
|
18881
|
-
if (this.user && this.user.id) {
|
|
18882
|
-
return this.user;
|
|
19486
|
+
if (paramArray.length) {
|
|
19487
|
+
url = `${url}?${paramArray.join("&")}`;
|
|
19488
|
+
}
|
|
18883
19489
|
}
|
|
18884
|
-
if (
|
|
18885
|
-
|
|
19490
|
+
if (url) {
|
|
19491
|
+
return connector.makeQuery(url, params, __spreadValues$q({
|
|
19492
|
+
cacheName: name
|
|
19493
|
+
}, requestOptions));
|
|
19494
|
+
} else {
|
|
19495
|
+
throw new Error("Request URL is not set");
|
|
18886
19496
|
}
|
|
18887
|
-
|
|
18888
|
-
|
|
18889
|
-
|
|
18890
|
-
|
|
18891
|
-
|
|
18892
|
-
|
|
18893
|
-
|
|
18894
|
-
|
|
19497
|
+
} else {
|
|
19498
|
+
return void 0;
|
|
19499
|
+
}
|
|
19500
|
+
});
|
|
19501
|
+
}
|
|
19502
|
+
|
|
19503
|
+
var __defProp$B = Object.defineProperty;
|
|
19504
|
+
var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
19505
|
+
var __publicField$q = (obj, key, value) => __defNormalProp$B(obj, key + "" , value);
|
|
19506
|
+
class NgwConnectorExtended extends NgwConnector {
|
|
19507
|
+
constructor(options) {
|
|
19508
|
+
super(options);
|
|
19509
|
+
__publicField$q(this, "resources");
|
|
19510
|
+
this.resources = new ResourcesControl({
|
|
19511
|
+
connector: this,
|
|
19512
|
+
cacheId: options.cacheId
|
|
18895
19513
|
});
|
|
18896
19514
|
}
|
|
18897
19515
|
/**
|
|
18898
|
-
*
|
|
19516
|
+
* Clear the cache.
|
|
18899
19517
|
*/
|
|
18900
|
-
|
|
18901
|
-
|
|
18902
|
-
|
|
18903
|
-
return {
|
|
18904
|
-
Authorization: `Basic ${client}`
|
|
18905
|
-
};
|
|
18906
|
-
}
|
|
18907
|
-
}
|
|
18908
|
-
makeClientId(credentials) {
|
|
18909
|
-
credentials = credentials || this.options.auth;
|
|
18910
|
-
if (credentials) {
|
|
18911
|
-
const { login, password } = credentials;
|
|
18912
|
-
const encodedStr = [login, password].map(encodeURIComponent).join(":");
|
|
18913
|
-
{
|
|
18914
|
-
return window.btoa(encodedStr);
|
|
18915
|
-
}
|
|
18916
|
-
}
|
|
18917
|
-
}
|
|
18918
|
-
/** Stop all api requests */
|
|
18919
|
-
abort() {
|
|
18920
|
-
for (const abortController of Object.values(this.activeRequests)) {
|
|
18921
|
-
abortController.abort();
|
|
18922
|
-
}
|
|
18923
|
-
this.activeRequests = {};
|
|
18924
|
-
}
|
|
18925
|
-
getActiveApiRequests() {
|
|
18926
|
-
return __spreadValues$q({}, this.activeRequests);
|
|
19518
|
+
clearCache() {
|
|
19519
|
+
super.clearCache();
|
|
19520
|
+
this.resources.cache.clean();
|
|
18927
19521
|
}
|
|
18928
19522
|
/**
|
|
18929
19523
|
* Send request to NGW api router.
|
|
@@ -19042,75 +19636,6 @@ var NgwLeaflet = (function () {
|
|
|
19042
19636
|
options
|
|
19043
19637
|
);
|
|
19044
19638
|
}
|
|
19045
|
-
/**
|
|
19046
|
-
* Send request to NGW.
|
|
19047
|
-
* @param url - URL address to NGW
|
|
19048
|
-
* @param params - Query params
|
|
19049
|
-
* @param options - Request options
|
|
19050
|
-
*/
|
|
19051
|
-
makeQuery(_0, _1) {
|
|
19052
|
-
return __async$p(this, arguments, function* (url, params, options = {}) {
|
|
19053
|
-
var _b;
|
|
19054
|
-
url = (this.options.baseUrl ? this.options.baseUrl : "") + url;
|
|
19055
|
-
if (!url) {
|
|
19056
|
-
throw new Error("Empty `url` not allowed");
|
|
19057
|
-
}
|
|
19058
|
-
if (params) {
|
|
19059
|
-
const _a = params, restParams = __objRest$3(_a, ["paramList"]);
|
|
19060
|
-
url = template(url, restParams);
|
|
19061
|
-
}
|
|
19062
|
-
url = encodeURI(fixUrlStr(url));
|
|
19063
|
-
options = __spreadValues$q({ withCredentials: this.withCredentials }, options);
|
|
19064
|
-
const {
|
|
19065
|
-
cache,
|
|
19066
|
-
signal: externalSignal,
|
|
19067
|
-
method = "GET",
|
|
19068
|
-
headers,
|
|
19069
|
-
cacheName,
|
|
19070
|
-
cacheProps,
|
|
19071
|
-
responseType,
|
|
19072
|
-
withCredentials
|
|
19073
|
-
} = options;
|
|
19074
|
-
const internalAbortController = new AbortController();
|
|
19075
|
-
const internalSignal = internalAbortController.signal;
|
|
19076
|
-
if (externalSignal) {
|
|
19077
|
-
if (externalSignal.aborted) {
|
|
19078
|
-
throw new AbortError();
|
|
19079
|
-
}
|
|
19080
|
-
externalSignal.addEventListener("abort", () => {
|
|
19081
|
-
internalAbortController.abort();
|
|
19082
|
-
});
|
|
19083
|
-
}
|
|
19084
|
-
options.signal = internalSignal;
|
|
19085
|
-
const createPromise = () => __async$p(this, null, function* () {
|
|
19086
|
-
const id = REQUEST_ID++;
|
|
19087
|
-
this.activeRequests[id] = internalAbortController;
|
|
19088
|
-
try {
|
|
19089
|
-
return this._loadData(url, options);
|
|
19090
|
-
} finally {
|
|
19091
|
-
this._cleanActiveRequest(id);
|
|
19092
|
-
}
|
|
19093
|
-
});
|
|
19094
|
-
if (cache && method === "GET") {
|
|
19095
|
-
const cacheOptions = cacheProps ? cacheProps : __spreadProps$h(__spreadValues$q({}, objectRemoveEmpty({
|
|
19096
|
-
headers,
|
|
19097
|
-
withCredentials,
|
|
19098
|
-
responseType,
|
|
19099
|
-
baseUrl: this.options.baseUrl,
|
|
19100
|
-
userId: (_b = this.user) == null ? void 0 : _b.id
|
|
19101
|
-
})), {
|
|
19102
|
-
params
|
|
19103
|
-
});
|
|
19104
|
-
return this.cache.add(
|
|
19105
|
-
cacheName || url,
|
|
19106
|
-
createPromise,
|
|
19107
|
-
cacheOptions,
|
|
19108
|
-
false
|
|
19109
|
-
);
|
|
19110
|
-
}
|
|
19111
|
-
return createPromise();
|
|
19112
|
-
});
|
|
19113
|
-
}
|
|
19114
19639
|
// -------------------------------------------------------------------------
|
|
19115
19640
|
// Resource Methods
|
|
19116
19641
|
// -------------------------------------------------------------------------
|
|
@@ -19186,78 +19711,7 @@ var NgwLeaflet = (function () {
|
|
|
19186
19711
|
deleteResource(resource) {
|
|
19187
19712
|
return this.resources.delete(resource);
|
|
19188
19713
|
}
|
|
19189
|
-
/**
|
|
19190
|
-
* @internal
|
|
19191
|
-
*/
|
|
19192
|
-
_loadData(url, options) {
|
|
19193
|
-
options.responseType = options.responseType || "json";
|
|
19194
|
-
return new Promise((resolve, reject) => {
|
|
19195
|
-
var _a;
|
|
19196
|
-
if (this.user) {
|
|
19197
|
-
options = options || {};
|
|
19198
|
-
options.headers = __spreadValues$q(__spreadValues$q({}, this.getAuthorizationHeaders()), options.headers);
|
|
19199
|
-
}
|
|
19200
|
-
if (this.requestTransform) {
|
|
19201
|
-
const [transUrl, transOptions] = this.requestTransform(url, options);
|
|
19202
|
-
url = transUrl;
|
|
19203
|
-
options = transOptions;
|
|
19204
|
-
}
|
|
19205
|
-
let runOnAbort = void 0;
|
|
19206
|
-
loadData(url, resolve, options, reject, (handler) => {
|
|
19207
|
-
runOnAbort = handler;
|
|
19208
|
-
});
|
|
19209
|
-
(_a = options.signal) == null ? void 0 : _a.addEventListener("abort", () => {
|
|
19210
|
-
if (runOnAbort !== void 0) {
|
|
19211
|
-
runOnAbort();
|
|
19212
|
-
}
|
|
19213
|
-
reject(new AbortError());
|
|
19214
|
-
});
|
|
19215
|
-
}).catch((httpError) => {
|
|
19216
|
-
if (httpError.name !== "AbortError") {
|
|
19217
|
-
{
|
|
19218
|
-
console.warn("DEV WARN", httpError);
|
|
19219
|
-
}
|
|
19220
|
-
const er = this._handleHttpError(httpError);
|
|
19221
|
-
if (er) {
|
|
19222
|
-
throw er;
|
|
19223
|
-
}
|
|
19224
|
-
}
|
|
19225
|
-
throw httpError;
|
|
19226
|
-
});
|
|
19227
|
-
}
|
|
19228
|
-
_login(credentials, options) {
|
|
19229
|
-
return __async$p(this, null, function* () {
|
|
19230
|
-
try {
|
|
19231
|
-
const data = yield this.getUserInfo(credentials, options);
|
|
19232
|
-
this.user = data;
|
|
19233
|
-
this.emitter.emit("login", data);
|
|
19234
|
-
return data;
|
|
19235
|
-
} catch (er) {
|
|
19236
|
-
this.emitter.emit("login:error", er);
|
|
19237
|
-
throw er;
|
|
19238
|
-
}
|
|
19239
|
-
});
|
|
19240
|
-
}
|
|
19241
|
-
_cleanActiveRequest(requestId) {
|
|
19242
|
-
delete this.activeRequests[requestId];
|
|
19243
|
-
}
|
|
19244
|
-
_handleHttpError(er) {
|
|
19245
|
-
if (er) {
|
|
19246
|
-
if (er instanceof NgwError) {
|
|
19247
|
-
if (er.exception === "nextgisweb.resource.exception.ResourceNotFound") {
|
|
19248
|
-
throw new ResourceNotFoundError(er);
|
|
19249
|
-
} else if (er.exception === "nextgisweb.core.exception.InsufficientPermissions") {
|
|
19250
|
-
throw new InsufficientPermissionsError(er);
|
|
19251
|
-
}
|
|
19252
|
-
}
|
|
19253
|
-
}
|
|
19254
|
-
return er;
|
|
19255
|
-
}
|
|
19256
19714
|
}
|
|
19257
|
-
__publicField$q(NgwConnector, "errors", {
|
|
19258
|
-
NgwError,
|
|
19259
|
-
ResourceNotFoundError
|
|
19260
|
-
});
|
|
19261
19715
|
|
|
19262
19716
|
var __defProp$A = Object.defineProperty;
|
|
19263
19717
|
var __defProps$g = Object.defineProperties;
|
|
@@ -22356,7 +22810,6 @@ var NgwLeaflet = (function () {
|
|
|
22356
22810
|
__publicField$c(this, "emitter", new EventEmitter());
|
|
22357
22811
|
__publicField$c(this, "_extent");
|
|
22358
22812
|
__publicField$c(this, "response");
|
|
22359
|
-
__publicField$c(this, "_webmapLayersIds");
|
|
22360
22813
|
__publicField$c(this, "_webmapBaselayersIds", []);
|
|
22361
22814
|
__publicField$c(this, "_lastActiveBaselayer");
|
|
22362
22815
|
const r = options.resourceId;
|
|
@@ -22401,7 +22854,6 @@ var NgwLeaflet = (function () {
|
|
|
22401
22854
|
}
|
|
22402
22855
|
delete this.layer;
|
|
22403
22856
|
delete this.response;
|
|
22404
|
-
delete this._webmapLayersIds;
|
|
22405
22857
|
}
|
|
22406
22858
|
showLayer() {
|
|
22407
22859
|
return __async$9(this, null, function* () {
|
|
@@ -22492,26 +22944,19 @@ var NgwLeaflet = (function () {
|
|
|
22492
22944
|
getIdentificationIds(options) {
|
|
22493
22945
|
return __async$9(this, null, function* () {
|
|
22494
22946
|
const visibleLayers = [];
|
|
22495
|
-
let
|
|
22496
|
-
|
|
22497
|
-
|
|
22498
|
-
|
|
22499
|
-
|
|
22500
|
-
|
|
22501
|
-
|
|
22502
|
-
|
|
22503
|
-
|
|
22504
|
-
|
|
22505
|
-
const parentId = item.parentId;
|
|
22506
|
-
if (parentId !== void 0 && item.item_type === "layer" && item.layer_identifiable) {
|
|
22507
|
-
const visible = x.properties.property("visibility");
|
|
22508
|
-
const isVisible = visible.get() && !visible.isBlocked();
|
|
22509
|
-
if (isVisible) {
|
|
22510
|
-
visibleLayers.push(parentId);
|
|
22511
|
-
}
|
|
22947
|
+
let deps = this.getDependLayers();
|
|
22948
|
+
deps = deps.sort((a, b) => b.id - a.id);
|
|
22949
|
+
deps.forEach((x) => {
|
|
22950
|
+
const item = x.item;
|
|
22951
|
+
const parentId = item.style_parent_id;
|
|
22952
|
+
if (parentId !== void 0 && item.item_type === "layer" && item.layer_identifiable) {
|
|
22953
|
+
const visible = x.properties.property("visibility");
|
|
22954
|
+
const isVisible = visible.get() && !visible.isBlocked();
|
|
22955
|
+
if (isVisible) {
|
|
22956
|
+
visibleLayers.push(parentId);
|
|
22512
22957
|
}
|
|
22513
|
-
}
|
|
22514
|
-
}
|
|
22958
|
+
}
|
|
22959
|
+
});
|
|
22515
22960
|
return visibleLayers;
|
|
22516
22961
|
});
|
|
22517
22962
|
}
|
|
@@ -22640,31 +23085,6 @@ var NgwLeaflet = (function () {
|
|
|
22640
23085
|
}
|
|
22641
23086
|
return item;
|
|
22642
23087
|
}
|
|
22643
|
-
_getWebMapIds(options) {
|
|
22644
|
-
return __async$9(this, null, function* () {
|
|
22645
|
-
const webMapItem = this.layer;
|
|
22646
|
-
if (webMapItem && webMapItem.item.item_type === "root") {
|
|
22647
|
-
const layers = webMapItem.tree.getDescendants();
|
|
22648
|
-
const promises = [];
|
|
22649
|
-
for (const x of layers) {
|
|
22650
|
-
const item = x.item;
|
|
22651
|
-
if (item.item_type === "layer") {
|
|
22652
|
-
const id = item.layer_style_id;
|
|
22653
|
-
const promise = this.options.connector.getResource(id, options).then((y) => {
|
|
22654
|
-
if (y) {
|
|
22655
|
-
const parentId = Number(y.resource.parent.id);
|
|
22656
|
-
item.parentId = parentId;
|
|
22657
|
-
return parentId;
|
|
22658
|
-
}
|
|
22659
|
-
});
|
|
22660
|
-
promises.push(promise);
|
|
22661
|
-
}
|
|
22662
|
-
}
|
|
22663
|
-
const ids = yield Promise.all(promises);
|
|
22664
|
-
return ids.filter((x) => x !== void 0);
|
|
22665
|
-
}
|
|
22666
|
-
});
|
|
22667
|
-
}
|
|
22668
23088
|
}
|
|
22669
23089
|
|
|
22670
23090
|
var __defProp$f = Object.defineProperty;
|
|
@@ -22719,7 +23139,7 @@ var NgwLeaflet = (function () {
|
|
|
22719
23139
|
} else {
|
|
22720
23140
|
throw new Error("url is not defined");
|
|
22721
23141
|
}
|
|
22722
|
-
this.connector = new
|
|
23142
|
+
this.connector = new NgwConnectorExtended({
|
|
22723
23143
|
baseUrl: this.url,
|
|
22724
23144
|
auth: this.options.auth
|
|
22725
23145
|
});
|
|
@@ -25340,7 +25760,7 @@ var NgwLeaflet = (function () {
|
|
|
25340
25760
|
});
|
|
25341
25761
|
}
|
|
25342
25762
|
if (!options.connector) {
|
|
25343
|
-
options.connector = new
|
|
25763
|
+
options.connector = new NgwConnectorExtended({
|
|
25344
25764
|
baseUrl: options.baseUrl || "",
|
|
25345
25765
|
auth: options.auth,
|
|
25346
25766
|
withCredentials: options.withCredentials
|
|
@@ -25614,7 +26034,7 @@ var NgwLeaflet = (function () {
|
|
|
25614
26034
|
if (mem.layer.getDependLayers) {
|
|
25615
26035
|
const dependLayers = mem.layer.getDependLayers();
|
|
25616
26036
|
const dependFit = dependLayers.find((x) => {
|
|
25617
|
-
return x.item && x.item.
|
|
26037
|
+
return x.item && x.item.style_parent_id === id;
|
|
25618
26038
|
});
|
|
25619
26039
|
if (dependFit) {
|
|
25620
26040
|
return dependFit.layer;
|