@eodash/eodash 5.0.0-alpha.2.5 → 5.0.0-alpha.2.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/README.md +19 -5
- package/core/client/App.vue +6 -7
- package/core/client/SuspensedDashboard.ce.vue +58 -40
- package/core/client/asWebComponent.d.ts +10 -5
- package/core/client/asWebComponent.js +6 -6
- package/core/client/components/DashboardLayout.vue +35 -16
- package/core/client/components/DynamicWebComponent.vue +44 -44
- package/core/client/components/ErrorAlert.vue +19 -7
- package/core/client/components/Footer.vue +28 -14
- package/core/client/components/Header.vue +4 -4
- package/core/client/components/IframeWrapper.vue +3 -3
- package/core/client/components/Loading.vue +17 -18
- package/core/client/components/MobileLayout.vue +48 -26
- package/core/client/composables/DefineEodash.js +38 -29
- package/core/client/composables/DefineWidgets.js +101 -81
- package/core/client/composables/index.js +32 -29
- package/core/client/eodash.js +44 -39
- package/core/client/main.js +2 -2
- package/core/client/plugins/index.js +9 -10
- package/core/client/plugins/vuetify.js +9 -10
- package/core/client/render.js +4 -5
- package/core/client/store/States.js +8 -13
- package/core/client/store/index.js +14 -11
- package/core/client/store/stac.js +51 -37
- package/core/client/types.d.ts +169 -201
- package/core/client/utils/eodashSTAC.js +130 -49
- package/core/client/utils/helpers.js +18 -20
- package/core/client/utils/index.js +17 -10
- package/core/client/utils/keys.js +2 -2
- package/core/client/views/Dashboard.vue +53 -36
- package/core/client/vite-env.d.ts +19 -17
- package/dist/client/{DashboardLayout-BYROtP-7.js → DashboardLayout-BuDcv6LM.js} +9 -9
- package/dist/client/{DynamicWebComponent-BQhxFPM0.js → DynamicWebComponent-BEP4rVce.js} +2 -2
- package/dist/client/EodashDatePicker-oFb1zt5E.js +1211 -0
- package/dist/client/{EodashItemFilter-DIBDAHcc.js → EodashItemFilter-BElmgrST.js} +4 -6
- package/dist/client/{EodashMap-C6jJ2Lb_.js → EodashMap-DXyOgcEd.js} +13131 -14490
- package/dist/client/{Footer-BVIZms1S.js → Footer-CoPx6UXQ.js} +3 -3
- package/dist/client/{Header-TsTL1d2R.js → Header-C-zX31Ys.js} +169 -167
- package/dist/client/{IframeWrapper-XKChM78a.js → IframeWrapper-2w2ye0zM.js} +1 -1
- package/dist/client/{MobileLayout-BlGcMQra.js → MobileLayout-C9OVcP12.js} +45 -57
- package/dist/client/{VMain-C9XV5Lyg.js → VMain-Dm43jd43.js} +2 -2
- package/dist/client/{WidgetsContainer-BQXHnZpa.js → WidgetsContainer-BS87sLqk.js} +10 -3
- package/dist/client/{asWebComponent-CbdGxelK.js → asWebComponent-CpQUVi2N.js} +5508 -5561
- package/dist/client/{basedecoder-Qm25PwVp-CHo5Pomv.js → basedecoder-DHcBySSe-BmCFNFnw.js} +5 -6
- package/dist/client/{decoder-HRvnjnEI-CHAYOWhz.js → decoder-CP4lv0Kb-BHrv68IA.js} +1 -1
- package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +10 -0
- package/dist/client/eo-dash.js +3 -3
- package/dist/client/eodashSTAC-Q7kbX1Gy.js +2788 -0
- package/dist/client/{eox-itemfilter-DcQkRD2l.js → eox-itemfilter-TaBxgqq_.js} +1002 -974
- package/dist/client/{eox-map-C3DL31fp.js → eox-map-L7abwKTR.js} +5677 -5695
- package/dist/client/{forwardRefs-CyCJOFsz.js → forwardRefs-BVFQ82G4.js} +12 -21
- package/dist/client/{index-CabQjjQg.js → index-dOzyv_xR.js} +1 -1
- package/dist/client/{jpeg-DNfUpLwy-Fjan-04T.js → jpeg-BAgeD1d3-oeHbFPUL.js} +5 -6
- package/dist/client/{lerc-_E46UbWQ-TxBH4OeK.js → lerc-DzVumYtB-rm1Xco54.js} +5 -7
- package/dist/client/{lzw-BOMhmEDy-Dboc93VO.js → lzw-LAGDNbSC-DkP96qO9.js} +1 -1
- package/dist/client/{packbits-DaUD6MLm-Bu1PoTGa.js → packbits-BlDR4Kj5-C66n1-zr.js} +1 -1
- package/dist/client/{pako.esm-C3kYPGGQ-BMki8cQY.js → pako.esm-CB1uQYY0-DB0PYm1P.js} +6 -12
- package/dist/client/{raw-CcGKjn8q-DFOt-i8n.js → raw-CMGvRjfu-BRi6E4i1.js} +1 -1
- package/dist/client/{ssrBoot-DWJ-z4I-.js → ssrBoot-L9KejErM.js} +1 -1
- package/dist/client/style.css +2 -2
- package/dist/client/{transition-BlLt41wg.js → transition-DCePIwYR.js} +1 -1
- package/dist/client/{webfontloader-CyOFAuFB.js → webfontloader-qotgY98I.js} +56 -92
- package/dist/client/{webimage-D2c098k3-DLj1LQxB.js → webimage-BM_pbLN3-L2cGWK5l.js} +1 -1
- package/dist/node/cli.js +1 -1
- package/dist/node/types.d.ts +32 -38
- package/package.json +11 -11
- package/widgets/EodashDatePicker.vue +94 -43
- package/widgets/EodashItemFilter.vue +13 -10
- package/widgets/EodashMap.vue +87 -20
- package/widgets/WidgetsContainer.vue +45 -27
- package/dist/client/EodashDatePicker-CFltnt5d.js +0 -1194
- package/dist/client/deflate-Be2Arps5-hDqMz3RA.js +0 -10
- package/dist/client/http-ZWiLaAeR.js +0 -1337
|
@@ -0,0 +1,2788 @@
|
|
|
1
|
+
import { c as X, g as Te } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
2
|
+
import { b5 as Ce } from "./asWebComponent-CpQUVi2N.js";
|
|
3
|
+
var Ae = { exports: {} }, ee = { exports: {} };
|
|
4
|
+
/*! https://mths.be/punycode v1.4.0 by @mathias */
|
|
5
|
+
ee.exports;
|
|
6
|
+
var ve;
|
|
7
|
+
function Oe() {
|
|
8
|
+
return ve || (ve = 1, function(f, r) {
|
|
9
|
+
(function(s) {
|
|
10
|
+
var a = r && !r.nodeType && r, u = f && !f.nodeType && f, m = typeof X == "object" && X;
|
|
11
|
+
(m.global === m || m.window === m || m.self === m) && (s = m);
|
|
12
|
+
var n, g = 2147483647, l = 36, x = 1, k = 26, b = 38, v = 700, T = 72, P = 128, w = "-", F = /^xn--/, N = /[^\x20-\x7E]/, U = /[\x2E\u3002\uFF0E\uFF61]/g, L = {
|
|
13
|
+
overflow: "Overflow: input needs wider integers to process",
|
|
14
|
+
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
15
|
+
"invalid-input": "Invalid input"
|
|
16
|
+
}, R = l - x, j = Math.floor, W = String.fromCharCode, $;
|
|
17
|
+
function V(d) {
|
|
18
|
+
throw new RangeError(L[d]);
|
|
19
|
+
}
|
|
20
|
+
function ie(d, y) {
|
|
21
|
+
for (var _ = d.length, I = []; _--; )
|
|
22
|
+
I[_] = y(d[_]);
|
|
23
|
+
return I;
|
|
24
|
+
}
|
|
25
|
+
function se(d, y) {
|
|
26
|
+
var _ = d.split("@"), I = "";
|
|
27
|
+
_.length > 1 && (I = _[0] + "@", d = _[1]), d = d.replace(U, ".");
|
|
28
|
+
var A = d.split("."), z = ie(A, y).join(".");
|
|
29
|
+
return I + z;
|
|
30
|
+
}
|
|
31
|
+
function oe(d) {
|
|
32
|
+
for (var y = [], _ = 0, I = d.length, A, z; _ < I; )
|
|
33
|
+
A = d.charCodeAt(_++), A >= 55296 && A <= 56319 && _ < I ? (z = d.charCodeAt(_++), (z & 64512) == 56320 ? y.push(((A & 1023) << 10) + (z & 1023) + 65536) : (y.push(A), _--)) : y.push(A);
|
|
34
|
+
return y;
|
|
35
|
+
}
|
|
36
|
+
function ae(d) {
|
|
37
|
+
return ie(d, function(y) {
|
|
38
|
+
var _ = "";
|
|
39
|
+
return y > 65535 && (y -= 65536, _ += W(y >>> 10 & 1023 | 55296), y = 56320 | y & 1023), _ += W(y), _;
|
|
40
|
+
}).join("");
|
|
41
|
+
}
|
|
42
|
+
function e(d) {
|
|
43
|
+
return d - 48 < 10 ? d - 22 : d - 65 < 26 ? d - 65 : d - 97 < 26 ? d - 97 : l;
|
|
44
|
+
}
|
|
45
|
+
function t(d, y) {
|
|
46
|
+
return d + 22 + 75 * (d < 26) - ((y != 0) << 5);
|
|
47
|
+
}
|
|
48
|
+
function i(d, y, _) {
|
|
49
|
+
var I = 0;
|
|
50
|
+
for (d = _ ? j(d / v) : d >> 1, d += j(d / y); d > R * k >> 1; I += l)
|
|
51
|
+
d = j(d / R);
|
|
52
|
+
return j(I + (R + 1) * d / (d + b));
|
|
53
|
+
}
|
|
54
|
+
function o(d) {
|
|
55
|
+
var y = [], _ = d.length, I, A = 0, z = P, S = T, O, D, Q, G, E, M, H, Z, K;
|
|
56
|
+
for (O = d.lastIndexOf(w), O < 0 && (O = 0), D = 0; D < O; ++D)
|
|
57
|
+
d.charCodeAt(D) >= 128 && V("not-basic"), y.push(d.charCodeAt(D));
|
|
58
|
+
for (Q = O > 0 ? O + 1 : 0; Q < _; ) {
|
|
59
|
+
for (G = A, E = 1, M = l; Q >= _ && V("invalid-input"), H = e(d.charCodeAt(Q++)), (H >= l || H > j((g - A) / E)) && V("overflow"), A += H * E, Z = M <= S ? x : M >= S + k ? k : M - S, !(H < Z); M += l)
|
|
60
|
+
K = l - Z, E > j(g / K) && V("overflow"), E *= K;
|
|
61
|
+
I = y.length + 1, S = i(A - G, I, G == 0), j(A / I) > g - z && V("overflow"), z += j(A / I), A %= I, y.splice(A++, 0, z);
|
|
62
|
+
}
|
|
63
|
+
return ae(y);
|
|
64
|
+
}
|
|
65
|
+
function c(d) {
|
|
66
|
+
var y, _, I, A, z, S, O, D, Q, G, E, M = [], H, Z, K, ce;
|
|
67
|
+
for (d = oe(d), H = d.length, y = P, _ = 0, z = T, S = 0; S < H; ++S)
|
|
68
|
+
E = d[S], E < 128 && M.push(W(E));
|
|
69
|
+
for (I = A = M.length, A && M.push(w); I < H; ) {
|
|
70
|
+
for (O = g, S = 0; S < H; ++S)
|
|
71
|
+
E = d[S], E >= y && E < O && (O = E);
|
|
72
|
+
for (Z = I + 1, O - y > j((g - _) / Z) && V("overflow"), _ += (O - y) * Z, y = O, S = 0; S < H; ++S)
|
|
73
|
+
if (E = d[S], E < y && ++_ > g && V("overflow"), E == y) {
|
|
74
|
+
for (D = _, Q = l; G = Q <= z ? x : Q >= z + k ? k : Q - z, !(D < G); Q += l)
|
|
75
|
+
ce = D - G, K = l - G, M.push(
|
|
76
|
+
W(t(G + ce % K, 0))
|
|
77
|
+
), D = j(ce / K);
|
|
78
|
+
M.push(W(t(D, 0))), z = i(_, Z, I == A), _ = 0, ++I;
|
|
79
|
+
}
|
|
80
|
+
++_, ++y;
|
|
81
|
+
}
|
|
82
|
+
return M.join("");
|
|
83
|
+
}
|
|
84
|
+
function h(d) {
|
|
85
|
+
return se(d, function(y) {
|
|
86
|
+
return F.test(y) ? o(y.slice(4).toLowerCase()) : y;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function p(d) {
|
|
90
|
+
return se(d, function(y) {
|
|
91
|
+
return N.test(y) ? "xn--" + c(y) : y;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (n = {
|
|
95
|
+
/**
|
|
96
|
+
* A string representing the current Punycode.js version number.
|
|
97
|
+
* @memberOf punycode
|
|
98
|
+
* @type String
|
|
99
|
+
*/
|
|
100
|
+
version: "1.3.2",
|
|
101
|
+
/**
|
|
102
|
+
* An object of methods to convert from JavaScript's internal character
|
|
103
|
+
* representation (UCS-2) to Unicode code points, and back.
|
|
104
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
105
|
+
* @memberOf punycode
|
|
106
|
+
* @type Object
|
|
107
|
+
*/
|
|
108
|
+
ucs2: {
|
|
109
|
+
decode: oe,
|
|
110
|
+
encode: ae
|
|
111
|
+
},
|
|
112
|
+
decode: o,
|
|
113
|
+
encode: c,
|
|
114
|
+
toASCII: p,
|
|
115
|
+
toUnicode: h
|
|
116
|
+
}, a && u)
|
|
117
|
+
if (f.exports == a)
|
|
118
|
+
u.exports = n;
|
|
119
|
+
else
|
|
120
|
+
for ($ in n)
|
|
121
|
+
n.hasOwnProperty($) && (a[$] = n[$]);
|
|
122
|
+
else
|
|
123
|
+
s.punycode = n;
|
|
124
|
+
})(X);
|
|
125
|
+
}(ee, ee.exports)), ee.exports;
|
|
126
|
+
}
|
|
127
|
+
var fe = { exports: {} };
|
|
128
|
+
/*!
|
|
129
|
+
* URI.js - Mutating URLs
|
|
130
|
+
* IPv6 Support
|
|
131
|
+
*
|
|
132
|
+
* Version: 1.19.11
|
|
133
|
+
*
|
|
134
|
+
* Author: Rodney Rehm
|
|
135
|
+
* Web: http://medialize.github.io/URI.js/
|
|
136
|
+
*
|
|
137
|
+
* Licensed under
|
|
138
|
+
* MIT License http://www.opensource.org/licenses/mit-license
|
|
139
|
+
*
|
|
140
|
+
*/
|
|
141
|
+
var be;
|
|
142
|
+
function Re() {
|
|
143
|
+
return be || (be = 1, function(f) {
|
|
144
|
+
(function(r, s) {
|
|
145
|
+
f.exports ? f.exports = s() : r.IPv6 = s(r);
|
|
146
|
+
})(X, function(r) {
|
|
147
|
+
var s = r && r.IPv6;
|
|
148
|
+
function a(m) {
|
|
149
|
+
var n = m.toLowerCase(), g = n.split(":"), l = g.length, x = 8;
|
|
150
|
+
g[0] === "" && g[1] === "" && g[2] === "" ? (g.shift(), g.shift()) : g[0] === "" && g[1] === "" ? g.shift() : g[l - 1] === "" && g[l - 2] === "" && g.pop(), l = g.length, g[l - 1].indexOf(".") !== -1 && (x = 7);
|
|
151
|
+
var k;
|
|
152
|
+
for (k = 0; k < l && g[k] !== ""; k++)
|
|
153
|
+
;
|
|
154
|
+
if (k < x)
|
|
155
|
+
for (g.splice(k, 1, "0000"); g.length < x; )
|
|
156
|
+
g.splice(k, 0, "0000");
|
|
157
|
+
for (var b, v = 0; v < x; v++) {
|
|
158
|
+
b = g[v].split("");
|
|
159
|
+
for (var T = 0; T < 3 && (b[0] === "0" && b.length > 1); T++)
|
|
160
|
+
b.splice(0, 1);
|
|
161
|
+
g[v] = b.join("");
|
|
162
|
+
}
|
|
163
|
+
var P = -1, w = 0, F = 0, N = -1, U = !1;
|
|
164
|
+
for (v = 0; v < x; v++)
|
|
165
|
+
U ? g[v] === "0" ? F += 1 : (U = !1, F > w && (P = N, w = F)) : g[v] === "0" && (U = !0, N = v, F = 1);
|
|
166
|
+
F > w && (P = N, w = F), w > 1 && g.splice(P, w, ""), l = g.length;
|
|
167
|
+
var L = "";
|
|
168
|
+
for (g[0] === "" && (L = ":"), v = 0; v < l && (L += g[v], v !== l - 1); v++)
|
|
169
|
+
L += ":";
|
|
170
|
+
return g[l - 1] === "" && (L += ":"), L;
|
|
171
|
+
}
|
|
172
|
+
function u() {
|
|
173
|
+
return r.IPv6 === this && (r.IPv6 = s), this;
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
best: a,
|
|
177
|
+
noConflict: u
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
}(fe)), fe.exports;
|
|
181
|
+
}
|
|
182
|
+
var he = { exports: {} };
|
|
183
|
+
/*!
|
|
184
|
+
* URI.js - Mutating URLs
|
|
185
|
+
* Second Level Domain (SLD) Support
|
|
186
|
+
*
|
|
187
|
+
* Version: 1.19.11
|
|
188
|
+
*
|
|
189
|
+
* Author: Rodney Rehm
|
|
190
|
+
* Web: http://medialize.github.io/URI.js/
|
|
191
|
+
*
|
|
192
|
+
* Licensed under
|
|
193
|
+
* MIT License http://www.opensource.org/licenses/mit-license
|
|
194
|
+
*
|
|
195
|
+
*/
|
|
196
|
+
var _e;
|
|
197
|
+
function Qe() {
|
|
198
|
+
return _e || (_e = 1, function(f) {
|
|
199
|
+
(function(r, s) {
|
|
200
|
+
f.exports ? f.exports = s() : r.SecondLevelDomains = s(r);
|
|
201
|
+
})(X, function(r) {
|
|
202
|
+
var s = r && r.SecondLevelDomains, a = {
|
|
203
|
+
// list of known Second Level Domains
|
|
204
|
+
// converted list of SLDs from https://github.com/gavingmiller/second-level-domains
|
|
205
|
+
// ----
|
|
206
|
+
// publicsuffix.org is more current and actually used by a couple of browsers internally.
|
|
207
|
+
// downside is it also contains domains like "dyndns.org" - which is fine for the security
|
|
208
|
+
// issues browser have to deal with (SOP for cookies, etc) - but is way overboard for URI.js
|
|
209
|
+
// ----
|
|
210
|
+
list: {
|
|
211
|
+
ac: " com gov mil net org ",
|
|
212
|
+
ae: " ac co gov mil name net org pro sch ",
|
|
213
|
+
af: " com edu gov net org ",
|
|
214
|
+
al: " com edu gov mil net org ",
|
|
215
|
+
ao: " co ed gv it og pb ",
|
|
216
|
+
ar: " com edu gob gov int mil net org tur ",
|
|
217
|
+
at: " ac co gv or ",
|
|
218
|
+
au: " asn com csiro edu gov id net org ",
|
|
219
|
+
ba: " co com edu gov mil net org rs unbi unmo unsa untz unze ",
|
|
220
|
+
bb: " biz co com edu gov info net org store tv ",
|
|
221
|
+
bh: " biz cc com edu gov info net org ",
|
|
222
|
+
bn: " com edu gov net org ",
|
|
223
|
+
bo: " com edu gob gov int mil net org tv ",
|
|
224
|
+
br: " adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",
|
|
225
|
+
bs: " com edu gov net org ",
|
|
226
|
+
bz: " du et om ov rg ",
|
|
227
|
+
ca: " ab bc mb nb nf nl ns nt nu on pe qc sk yk ",
|
|
228
|
+
ck: " biz co edu gen gov info net org ",
|
|
229
|
+
cn: " ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",
|
|
230
|
+
co: " com edu gov mil net nom org ",
|
|
231
|
+
cr: " ac c co ed fi go or sa ",
|
|
232
|
+
cy: " ac biz com ekloges gov ltd name net org parliament press pro tm ",
|
|
233
|
+
do: " art com edu gob gov mil net org sld web ",
|
|
234
|
+
dz: " art asso com edu gov net org pol ",
|
|
235
|
+
ec: " com edu fin gov info med mil net org pro ",
|
|
236
|
+
eg: " com edu eun gov mil name net org sci ",
|
|
237
|
+
er: " com edu gov ind mil net org rochest w ",
|
|
238
|
+
es: " com edu gob nom org ",
|
|
239
|
+
et: " biz com edu gov info name net org ",
|
|
240
|
+
fj: " ac biz com info mil name net org pro ",
|
|
241
|
+
fk: " ac co gov net nom org ",
|
|
242
|
+
fr: " asso com f gouv nom prd presse tm ",
|
|
243
|
+
gg: " co net org ",
|
|
244
|
+
gh: " com edu gov mil org ",
|
|
245
|
+
gn: " ac com gov net org ",
|
|
246
|
+
gr: " com edu gov mil net org ",
|
|
247
|
+
gt: " com edu gob ind mil net org ",
|
|
248
|
+
gu: " com edu gov net org ",
|
|
249
|
+
hk: " com edu gov idv net org ",
|
|
250
|
+
hu: " 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",
|
|
251
|
+
id: " ac co go mil net or sch web ",
|
|
252
|
+
il: " ac co gov idf k12 muni net org ",
|
|
253
|
+
in: " ac co edu ernet firm gen gov i ind mil net nic org res ",
|
|
254
|
+
iq: " com edu gov i mil net org ",
|
|
255
|
+
ir: " ac co dnssec gov i id net org sch ",
|
|
256
|
+
it: " edu gov ",
|
|
257
|
+
je: " co net org ",
|
|
258
|
+
jo: " com edu gov mil name net org sch ",
|
|
259
|
+
jp: " ac ad co ed go gr lg ne or ",
|
|
260
|
+
ke: " ac co go info me mobi ne or sc ",
|
|
261
|
+
kh: " com edu gov mil net org per ",
|
|
262
|
+
ki: " biz com de edu gov info mob net org tel ",
|
|
263
|
+
km: " asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",
|
|
264
|
+
kn: " edu gov net org ",
|
|
265
|
+
kr: " ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",
|
|
266
|
+
kw: " com edu gov net org ",
|
|
267
|
+
ky: " com edu gov net org ",
|
|
268
|
+
kz: " com edu gov mil net org ",
|
|
269
|
+
lb: " com edu gov net org ",
|
|
270
|
+
lk: " assn com edu gov grp hotel int ltd net ngo org sch soc web ",
|
|
271
|
+
lr: " com edu gov net org ",
|
|
272
|
+
lv: " asn com conf edu gov id mil net org ",
|
|
273
|
+
ly: " com edu gov id med net org plc sch ",
|
|
274
|
+
ma: " ac co gov m net org press ",
|
|
275
|
+
mc: " asso tm ",
|
|
276
|
+
me: " ac co edu gov its net org priv ",
|
|
277
|
+
mg: " com edu gov mil nom org prd tm ",
|
|
278
|
+
mk: " com edu gov inf name net org pro ",
|
|
279
|
+
ml: " com edu gov net org presse ",
|
|
280
|
+
mn: " edu gov org ",
|
|
281
|
+
mo: " com edu gov net org ",
|
|
282
|
+
mt: " com edu gov net org ",
|
|
283
|
+
mv: " aero biz com coop edu gov info int mil museum name net org pro ",
|
|
284
|
+
mw: " ac co com coop edu gov int museum net org ",
|
|
285
|
+
mx: " com edu gob net org ",
|
|
286
|
+
my: " com edu gov mil name net org sch ",
|
|
287
|
+
nf: " arts com firm info net other per rec store web ",
|
|
288
|
+
ng: " biz com edu gov mil mobi name net org sch ",
|
|
289
|
+
ni: " ac co com edu gob mil net nom org ",
|
|
290
|
+
np: " com edu gov mil net org ",
|
|
291
|
+
nr: " biz com edu gov info net org ",
|
|
292
|
+
om: " ac biz co com edu gov med mil museum net org pro sch ",
|
|
293
|
+
pe: " com edu gob mil net nom org sld ",
|
|
294
|
+
ph: " com edu gov i mil net ngo org ",
|
|
295
|
+
pk: " biz com edu fam gob gok gon gop gos gov net org web ",
|
|
296
|
+
pl: " art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",
|
|
297
|
+
pr: " ac biz com edu est gov info isla name net org pro prof ",
|
|
298
|
+
ps: " com edu gov net org plo sec ",
|
|
299
|
+
pw: " belau co ed go ne or ",
|
|
300
|
+
ro: " arts com firm info nom nt org rec store tm www ",
|
|
301
|
+
rs: " ac co edu gov in org ",
|
|
302
|
+
sb: " com edu gov net org ",
|
|
303
|
+
sc: " com edu gov net org ",
|
|
304
|
+
sh: " co com edu gov net nom org ",
|
|
305
|
+
sl: " com edu gov net org ",
|
|
306
|
+
st: " co com consulado edu embaixada gov mil net org principe saotome store ",
|
|
307
|
+
sv: " com edu gob org red ",
|
|
308
|
+
sz: " ac co org ",
|
|
309
|
+
tr: " av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",
|
|
310
|
+
tt: " aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",
|
|
311
|
+
tw: " club com ebiz edu game gov idv mil net org ",
|
|
312
|
+
mu: " ac co com gov net or org ",
|
|
313
|
+
mz: " ac co edu gov org ",
|
|
314
|
+
na: " co com ",
|
|
315
|
+
nz: " ac co cri geek gen govt health iwi maori mil net org parliament school ",
|
|
316
|
+
pa: " abo ac com edu gob ing med net nom org sld ",
|
|
317
|
+
pt: " com edu gov int net nome org publ ",
|
|
318
|
+
py: " com edu gov mil net org ",
|
|
319
|
+
qa: " com edu gov mil net org ",
|
|
320
|
+
re: " asso com nom ",
|
|
321
|
+
ru: " ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",
|
|
322
|
+
rw: " ac co com edu gouv gov int mil net ",
|
|
323
|
+
sa: " com edu gov med net org pub sch ",
|
|
324
|
+
sd: " com edu gov info med net org tv ",
|
|
325
|
+
se: " a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",
|
|
326
|
+
sg: " com edu gov idn net org per ",
|
|
327
|
+
sn: " art com edu gouv org perso univ ",
|
|
328
|
+
sy: " com edu gov mil net news org ",
|
|
329
|
+
th: " ac co go in mi net or ",
|
|
330
|
+
tj: " ac biz co com edu go gov info int mil name net nic org test web ",
|
|
331
|
+
tn: " agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",
|
|
332
|
+
tz: " ac co go ne or ",
|
|
333
|
+
ua: " biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",
|
|
334
|
+
ug: " ac co go ne or org sc ",
|
|
335
|
+
uk: " ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",
|
|
336
|
+
us: " dni fed isa kids nsn ",
|
|
337
|
+
uy: " com edu gub mil net org ",
|
|
338
|
+
ve: " co com edu gob info mil net org web ",
|
|
339
|
+
vi: " co com k12 net org ",
|
|
340
|
+
vn: " ac biz com edu gov health info int name net org pro ",
|
|
341
|
+
ye: " co com gov ltd me net org plc ",
|
|
342
|
+
yu: " ac co edu gov org ",
|
|
343
|
+
za: " ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",
|
|
344
|
+
zm: " ac co com edu gov net org sch ",
|
|
345
|
+
// https://en.wikipedia.org/wiki/CentralNic#Second-level_domains
|
|
346
|
+
com: "ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",
|
|
347
|
+
net: "gb jp se uk ",
|
|
348
|
+
org: "ae",
|
|
349
|
+
de: "com "
|
|
350
|
+
},
|
|
351
|
+
// gorhill 2013-10-25: Using indexOf() instead Regexp(). Significant boost
|
|
352
|
+
// in both performance and memory footprint. No initialization required.
|
|
353
|
+
// http://jsperf.com/uri-js-sld-regex-vs-binary-search/4
|
|
354
|
+
// Following methods use lastIndexOf() rather than array.split() in order
|
|
355
|
+
// to avoid any memory allocations.
|
|
356
|
+
has: function(u) {
|
|
357
|
+
var m = u.lastIndexOf(".");
|
|
358
|
+
if (m <= 0 || m >= u.length - 1)
|
|
359
|
+
return !1;
|
|
360
|
+
var n = u.lastIndexOf(".", m - 1);
|
|
361
|
+
if (n <= 0 || n >= m - 1)
|
|
362
|
+
return !1;
|
|
363
|
+
var g = a.list[u.slice(m + 1)];
|
|
364
|
+
return g ? g.indexOf(" " + u.slice(n + 1, m) + " ") >= 0 : !1;
|
|
365
|
+
},
|
|
366
|
+
is: function(u) {
|
|
367
|
+
var m = u.lastIndexOf(".");
|
|
368
|
+
if (m <= 0 || m >= u.length - 1)
|
|
369
|
+
return !1;
|
|
370
|
+
var n = u.lastIndexOf(".", m - 1);
|
|
371
|
+
if (n >= 0)
|
|
372
|
+
return !1;
|
|
373
|
+
var g = a.list[u.slice(m + 1)];
|
|
374
|
+
return g ? g.indexOf(" " + u.slice(0, m) + " ") >= 0 : !1;
|
|
375
|
+
},
|
|
376
|
+
get: function(u) {
|
|
377
|
+
var m = u.lastIndexOf(".");
|
|
378
|
+
if (m <= 0 || m >= u.length - 1)
|
|
379
|
+
return null;
|
|
380
|
+
var n = u.lastIndexOf(".", m - 1);
|
|
381
|
+
if (n <= 0 || n >= m - 1)
|
|
382
|
+
return null;
|
|
383
|
+
var g = a.list[u.slice(m + 1)];
|
|
384
|
+
return !g || g.indexOf(" " + u.slice(n + 1, m) + " ") < 0 ? null : u.slice(n + 1);
|
|
385
|
+
},
|
|
386
|
+
noConflict: function() {
|
|
387
|
+
return r.SecondLevelDomains === this && (r.SecondLevelDomains = s), this;
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
return a;
|
|
391
|
+
});
|
|
392
|
+
}(he)), he.exports;
|
|
393
|
+
}
|
|
394
|
+
/*!
|
|
395
|
+
* URI.js - Mutating URLs
|
|
396
|
+
*
|
|
397
|
+
* Version: 1.19.11
|
|
398
|
+
*
|
|
399
|
+
* Author: Rodney Rehm
|
|
400
|
+
* Web: http://medialize.github.io/URI.js/
|
|
401
|
+
*
|
|
402
|
+
* Licensed under
|
|
403
|
+
* MIT License http://www.opensource.org/licenses/mit-license
|
|
404
|
+
*
|
|
405
|
+
*/
|
|
406
|
+
(function(f) {
|
|
407
|
+
(function(r, s) {
|
|
408
|
+
f.exports ? f.exports = s(Oe(), Re(), Qe()) : r.URI = s(r.punycode, r.IPv6, r.SecondLevelDomains, r);
|
|
409
|
+
})(X, function(r, s, a, u) {
|
|
410
|
+
var m = u && u.URI;
|
|
411
|
+
function n(e, t) {
|
|
412
|
+
var i = arguments.length >= 1, o = arguments.length >= 2;
|
|
413
|
+
if (!(this instanceof n))
|
|
414
|
+
return i ? o ? new n(e, t) : new n(e) : new n();
|
|
415
|
+
if (e === void 0) {
|
|
416
|
+
if (i)
|
|
417
|
+
throw new TypeError("undefined is not a valid argument for URI");
|
|
418
|
+
typeof location < "u" ? e = location.href + "" : e = "";
|
|
419
|
+
}
|
|
420
|
+
if (e === null && i)
|
|
421
|
+
throw new TypeError("null is not a valid argument for URI");
|
|
422
|
+
return this.href(e), t !== void 0 ? this.absoluteTo(t) : this;
|
|
423
|
+
}
|
|
424
|
+
function g(e) {
|
|
425
|
+
return /^[0-9]+$/.test(e);
|
|
426
|
+
}
|
|
427
|
+
n.version = "1.19.11";
|
|
428
|
+
var l = n.prototype, x = Object.prototype.hasOwnProperty;
|
|
429
|
+
function k(e) {
|
|
430
|
+
return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
|
|
431
|
+
}
|
|
432
|
+
function b(e) {
|
|
433
|
+
return e === void 0 ? "Undefined" : String(Object.prototype.toString.call(e)).slice(8, -1);
|
|
434
|
+
}
|
|
435
|
+
function v(e) {
|
|
436
|
+
return b(e) === "Array";
|
|
437
|
+
}
|
|
438
|
+
function T(e, t) {
|
|
439
|
+
var i = {}, o, c;
|
|
440
|
+
if (b(t) === "RegExp")
|
|
441
|
+
i = null;
|
|
442
|
+
else if (v(t))
|
|
443
|
+
for (o = 0, c = t.length; o < c; o++)
|
|
444
|
+
i[t[o]] = !0;
|
|
445
|
+
else
|
|
446
|
+
i[t] = !0;
|
|
447
|
+
for (o = 0, c = e.length; o < c; o++) {
|
|
448
|
+
var h = i && i[e[o]] !== void 0 || !i && t.test(e[o]);
|
|
449
|
+
h && (e.splice(o, 1), c--, o--);
|
|
450
|
+
}
|
|
451
|
+
return e;
|
|
452
|
+
}
|
|
453
|
+
function P(e, t) {
|
|
454
|
+
var i, o;
|
|
455
|
+
if (v(t)) {
|
|
456
|
+
for (i = 0, o = t.length; i < o; i++)
|
|
457
|
+
if (!P(e, t[i]))
|
|
458
|
+
return !1;
|
|
459
|
+
return !0;
|
|
460
|
+
}
|
|
461
|
+
var c = b(t);
|
|
462
|
+
for (i = 0, o = e.length; i < o; i++)
|
|
463
|
+
if (c === "RegExp") {
|
|
464
|
+
if (typeof e[i] == "string" && e[i].match(t))
|
|
465
|
+
return !0;
|
|
466
|
+
} else if (e[i] === t)
|
|
467
|
+
return !0;
|
|
468
|
+
return !1;
|
|
469
|
+
}
|
|
470
|
+
function w(e, t) {
|
|
471
|
+
if (!v(e) || !v(t) || e.length !== t.length)
|
|
472
|
+
return !1;
|
|
473
|
+
e.sort(), t.sort();
|
|
474
|
+
for (var i = 0, o = e.length; i < o; i++)
|
|
475
|
+
if (e[i] !== t[i])
|
|
476
|
+
return !1;
|
|
477
|
+
return !0;
|
|
478
|
+
}
|
|
479
|
+
function F(e) {
|
|
480
|
+
var t = /^\/+|\/+$/g;
|
|
481
|
+
return e.replace(t, "");
|
|
482
|
+
}
|
|
483
|
+
n._parts = function() {
|
|
484
|
+
return {
|
|
485
|
+
protocol: null,
|
|
486
|
+
username: null,
|
|
487
|
+
password: null,
|
|
488
|
+
hostname: null,
|
|
489
|
+
urn: null,
|
|
490
|
+
port: null,
|
|
491
|
+
path: null,
|
|
492
|
+
query: null,
|
|
493
|
+
fragment: null,
|
|
494
|
+
// state
|
|
495
|
+
preventInvalidHostname: n.preventInvalidHostname,
|
|
496
|
+
duplicateQueryParameters: n.duplicateQueryParameters,
|
|
497
|
+
escapeQuerySpace: n.escapeQuerySpace
|
|
498
|
+
};
|
|
499
|
+
}, n.preventInvalidHostname = !1, n.duplicateQueryParameters = !1, n.escapeQuerySpace = !0, n.protocol_expression = /^[a-z][a-z0-9.+-]*$/i, n.idn_expression = /[^a-z0-9\._-]/i, n.punycode_expression = /(xn--)/i, n.ip4_expression = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/, n.ip6_expression = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/, n.find_uri_expression = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig, n.findUri = {
|
|
500
|
+
// valid "scheme://" or "www."
|
|
501
|
+
start: /\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,
|
|
502
|
+
// everything up to the next whitespace
|
|
503
|
+
end: /[\s\r\n]|$/,
|
|
504
|
+
// trim trailing punctuation captured by end RegExp
|
|
505
|
+
trim: /[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,
|
|
506
|
+
// balanced parens inclusion (), [], {}, <>
|
|
507
|
+
parens: /(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g
|
|
508
|
+
}, n.leading_whitespace_expression = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/, n.ascii_tab_whitespace = /[\u0009\u000A\u000D]+/g, n.defaultPorts = {
|
|
509
|
+
http: "80",
|
|
510
|
+
https: "443",
|
|
511
|
+
ftp: "21",
|
|
512
|
+
gopher: "70",
|
|
513
|
+
ws: "80",
|
|
514
|
+
wss: "443"
|
|
515
|
+
}, n.hostProtocols = [
|
|
516
|
+
"http",
|
|
517
|
+
"https"
|
|
518
|
+
], n.invalid_hostname_characters = /[^a-zA-Z0-9\.\-:_]/, n.domAttributes = {
|
|
519
|
+
a: "href",
|
|
520
|
+
blockquote: "cite",
|
|
521
|
+
link: "href",
|
|
522
|
+
base: "href",
|
|
523
|
+
script: "src",
|
|
524
|
+
form: "action",
|
|
525
|
+
img: "src",
|
|
526
|
+
area: "href",
|
|
527
|
+
iframe: "src",
|
|
528
|
+
embed: "src",
|
|
529
|
+
source: "src",
|
|
530
|
+
track: "src",
|
|
531
|
+
input: "src",
|
|
532
|
+
// but only if type="image"
|
|
533
|
+
audio: "src",
|
|
534
|
+
video: "src"
|
|
535
|
+
}, n.getDomAttribute = function(e) {
|
|
536
|
+
if (!(!e || !e.nodeName)) {
|
|
537
|
+
var t = e.nodeName.toLowerCase();
|
|
538
|
+
if (!(t === "input" && e.type !== "image"))
|
|
539
|
+
return n.domAttributes[t];
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
function N(e) {
|
|
543
|
+
return escape(e);
|
|
544
|
+
}
|
|
545
|
+
function U(e) {
|
|
546
|
+
return encodeURIComponent(e).replace(/[!'()*]/g, N).replace(/\*/g, "%2A");
|
|
547
|
+
}
|
|
548
|
+
n.encode = U, n.decode = decodeURIComponent, n.iso8859 = function() {
|
|
549
|
+
n.encode = escape, n.decode = unescape;
|
|
550
|
+
}, n.unicode = function() {
|
|
551
|
+
n.encode = U, n.decode = decodeURIComponent;
|
|
552
|
+
}, n.characters = {
|
|
553
|
+
pathname: {
|
|
554
|
+
encode: {
|
|
555
|
+
// RFC3986 2.1: For consistency, URI producers and normalizers should
|
|
556
|
+
// use uppercase hexadecimal digits for all percent-encodings.
|
|
557
|
+
expression: /%(24|26|2B|2C|3B|3D|3A|40)/ig,
|
|
558
|
+
map: {
|
|
559
|
+
// -._~!'()*
|
|
560
|
+
"%24": "$",
|
|
561
|
+
"%26": "&",
|
|
562
|
+
"%2B": "+",
|
|
563
|
+
"%2C": ",",
|
|
564
|
+
"%3B": ";",
|
|
565
|
+
"%3D": "=",
|
|
566
|
+
"%3A": ":",
|
|
567
|
+
"%40": "@"
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
decode: {
|
|
571
|
+
expression: /[\/\?#]/g,
|
|
572
|
+
map: {
|
|
573
|
+
"/": "%2F",
|
|
574
|
+
"?": "%3F",
|
|
575
|
+
"#": "%23"
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
reserved: {
|
|
580
|
+
encode: {
|
|
581
|
+
// RFC3986 2.1: For consistency, URI producers and normalizers should
|
|
582
|
+
// use uppercase hexadecimal digits for all percent-encodings.
|
|
583
|
+
expression: /%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,
|
|
584
|
+
map: {
|
|
585
|
+
// gen-delims
|
|
586
|
+
"%3A": ":",
|
|
587
|
+
"%2F": "/",
|
|
588
|
+
"%3F": "?",
|
|
589
|
+
"%23": "#",
|
|
590
|
+
"%5B": "[",
|
|
591
|
+
"%5D": "]",
|
|
592
|
+
"%40": "@",
|
|
593
|
+
// sub-delims
|
|
594
|
+
"%21": "!",
|
|
595
|
+
"%24": "$",
|
|
596
|
+
"%26": "&",
|
|
597
|
+
"%27": "'",
|
|
598
|
+
"%28": "(",
|
|
599
|
+
"%29": ")",
|
|
600
|
+
"%2A": "*",
|
|
601
|
+
"%2B": "+",
|
|
602
|
+
"%2C": ",",
|
|
603
|
+
"%3B": ";",
|
|
604
|
+
"%3D": "="
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
urnpath: {
|
|
609
|
+
// The characters under `encode` are the characters called out by RFC 2141 as being acceptable
|
|
610
|
+
// for usage in a URN. RFC2141 also calls out "-", ".", and "_" as acceptable characters, but
|
|
611
|
+
// these aren't encoded by encodeURIComponent, so we don't have to call them out here. Also
|
|
612
|
+
// note that the colon character is not featured in the encoding map; this is because URI.js
|
|
613
|
+
// gives the colons in URNs semantic meaning as the delimiters of path segements, and so it
|
|
614
|
+
// should not appear unencoded in a segment itself.
|
|
615
|
+
// See also the note above about RFC3986 and capitalalized hex digits.
|
|
616
|
+
encode: {
|
|
617
|
+
expression: /%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,
|
|
618
|
+
map: {
|
|
619
|
+
"%21": "!",
|
|
620
|
+
"%24": "$",
|
|
621
|
+
"%27": "'",
|
|
622
|
+
"%28": "(",
|
|
623
|
+
"%29": ")",
|
|
624
|
+
"%2A": "*",
|
|
625
|
+
"%2B": "+",
|
|
626
|
+
"%2C": ",",
|
|
627
|
+
"%3B": ";",
|
|
628
|
+
"%3D": "=",
|
|
629
|
+
"%40": "@"
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
// These characters are the characters called out by RFC2141 as "reserved" characters that
|
|
633
|
+
// should never appear in a URN, plus the colon character (see note above).
|
|
634
|
+
decode: {
|
|
635
|
+
expression: /[\/\?#:]/g,
|
|
636
|
+
map: {
|
|
637
|
+
"/": "%2F",
|
|
638
|
+
"?": "%3F",
|
|
639
|
+
"#": "%23",
|
|
640
|
+
":": "%3A"
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}, n.encodeQuery = function(e, t) {
|
|
645
|
+
var i = n.encode(e + "");
|
|
646
|
+
return t === void 0 && (t = n.escapeQuerySpace), t ? i.replace(/%20/g, "+") : i;
|
|
647
|
+
}, n.decodeQuery = function(e, t) {
|
|
648
|
+
e += "", t === void 0 && (t = n.escapeQuerySpace);
|
|
649
|
+
try {
|
|
650
|
+
return n.decode(t ? e.replace(/\+/g, "%20") : e);
|
|
651
|
+
} catch {
|
|
652
|
+
return e;
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
var L = { encode: "encode", decode: "decode" }, R, j = function(e, t) {
|
|
656
|
+
return function(i) {
|
|
657
|
+
try {
|
|
658
|
+
return n[t](i + "").replace(n.characters[e][t].expression, function(o) {
|
|
659
|
+
return n.characters[e][t].map[o];
|
|
660
|
+
});
|
|
661
|
+
} catch {
|
|
662
|
+
return i;
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
};
|
|
666
|
+
for (R in L)
|
|
667
|
+
n[R + "PathSegment"] = j("pathname", L[R]), n[R + "UrnPathSegment"] = j("urnpath", L[R]);
|
|
668
|
+
var W = function(e, t, i) {
|
|
669
|
+
return function(o) {
|
|
670
|
+
var c;
|
|
671
|
+
i ? c = function(y) {
|
|
672
|
+
return n[t](n[i](y));
|
|
673
|
+
} : c = n[t];
|
|
674
|
+
for (var h = (o + "").split(e), p = 0, d = h.length; p < d; p++)
|
|
675
|
+
h[p] = c(h[p]);
|
|
676
|
+
return h.join(e);
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
n.decodePath = W("/", "decodePathSegment"), n.decodeUrnPath = W(":", "decodeUrnPathSegment"), n.recodePath = W("/", "encodePathSegment", "decode"), n.recodeUrnPath = W(":", "encodeUrnPathSegment", "decode"), n.encodeReserved = j("reserved", "encode"), n.parse = function(e, t) {
|
|
680
|
+
var i;
|
|
681
|
+
return t || (t = {
|
|
682
|
+
preventInvalidHostname: n.preventInvalidHostname
|
|
683
|
+
}), e = e.replace(n.leading_whitespace_expression, ""), e = e.replace(n.ascii_tab_whitespace, ""), i = e.indexOf("#"), i > -1 && (t.fragment = e.substring(i + 1) || null, e = e.substring(0, i)), i = e.indexOf("?"), i > -1 && (t.query = e.substring(i + 1) || null, e = e.substring(0, i)), e = e.replace(/^(https?|ftp|wss?)?:+[/\\]*/i, "$1://"), e = e.replace(/^[/\\]{2,}/i, "//"), e.substring(0, 2) === "//" ? (t.protocol = null, e = e.substring(2), e = n.parseAuthority(e, t)) : (i = e.indexOf(":"), i > -1 && (t.protocol = e.substring(0, i) || null, t.protocol && !t.protocol.match(n.protocol_expression) ? t.protocol = void 0 : e.substring(i + 1, i + 3).replace(/\\/g, "/") === "//" ? (e = e.substring(i + 3), e = n.parseAuthority(e, t)) : (e = e.substring(i + 1), t.urn = !0))), t.path = e, t;
|
|
684
|
+
}, n.parseHost = function(e, t) {
|
|
685
|
+
e || (e = ""), e = e.replace(/\\/g, "/");
|
|
686
|
+
var i = e.indexOf("/"), o, c;
|
|
687
|
+
if (i === -1 && (i = e.length), e.charAt(0) === "[")
|
|
688
|
+
o = e.indexOf("]"), t.hostname = e.substring(1, o) || null, t.port = e.substring(o + 2, i) || null, t.port === "/" && (t.port = null);
|
|
689
|
+
else {
|
|
690
|
+
var h = e.indexOf(":"), p = e.indexOf("/"), d = e.indexOf(":", h + 1);
|
|
691
|
+
d !== -1 && (p === -1 || d < p) ? (t.hostname = e.substring(0, i) || null, t.port = null) : (c = e.substring(0, i).split(":"), t.hostname = c[0] || null, t.port = c[1] || null);
|
|
692
|
+
}
|
|
693
|
+
return t.hostname && e.substring(i).charAt(0) !== "/" && (i++, e = "/" + e), t.preventInvalidHostname && n.ensureValidHostname(t.hostname, t.protocol), t.port && n.ensureValidPort(t.port), e.substring(i) || "/";
|
|
694
|
+
}, n.parseAuthority = function(e, t) {
|
|
695
|
+
return e = n.parseUserinfo(e, t), n.parseHost(e, t);
|
|
696
|
+
}, n.parseUserinfo = function(e, t) {
|
|
697
|
+
var i = e, o = e.indexOf("\\");
|
|
698
|
+
o !== -1 && (e = e.replace(/\\/g, "/"));
|
|
699
|
+
var c = e.indexOf("/"), h = e.lastIndexOf("@", c > -1 ? c : e.length - 1), p;
|
|
700
|
+
return h > -1 && (c === -1 || h < c) ? (p = e.substring(0, h).split(":"), t.username = p[0] ? n.decode(p[0]) : null, p.shift(), t.password = p[0] ? n.decode(p.join(":")) : null, e = i.substring(h + 1)) : (t.username = null, t.password = null), e;
|
|
701
|
+
}, n.parseQuery = function(e, t) {
|
|
702
|
+
if (!e)
|
|
703
|
+
return {};
|
|
704
|
+
if (e = e.replace(/&+/g, "&").replace(/^\?*&*|&+$/g, ""), !e)
|
|
705
|
+
return {};
|
|
706
|
+
for (var i = {}, o = e.split("&"), c = o.length, h, p, d, y = 0; y < c; y++)
|
|
707
|
+
h = o[y].split("="), p = n.decodeQuery(h.shift(), t), d = h.length ? n.decodeQuery(h.join("="), t) : null, p !== "__proto__" && (x.call(i, p) ? ((typeof i[p] == "string" || i[p] === null) && (i[p] = [i[p]]), i[p].push(d)) : i[p] = d);
|
|
708
|
+
return i;
|
|
709
|
+
}, n.build = function(e) {
|
|
710
|
+
var t = "", i = !1;
|
|
711
|
+
return e.protocol && (t += e.protocol + ":"), !e.urn && (t || e.hostname) && (t += "//", i = !0), t += n.buildAuthority(e) || "", typeof e.path == "string" && (e.path.charAt(0) !== "/" && i && (t += "/"), t += e.path), typeof e.query == "string" && e.query && (t += "?" + e.query), typeof e.fragment == "string" && e.fragment && (t += "#" + e.fragment), t;
|
|
712
|
+
}, n.buildHost = function(e) {
|
|
713
|
+
var t = "";
|
|
714
|
+
if (e.hostname)
|
|
715
|
+
n.ip6_expression.test(e.hostname) ? t += "[" + e.hostname + "]" : t += e.hostname;
|
|
716
|
+
else return "";
|
|
717
|
+
return e.port && (t += ":" + e.port), t;
|
|
718
|
+
}, n.buildAuthority = function(e) {
|
|
719
|
+
return n.buildUserinfo(e) + n.buildHost(e);
|
|
720
|
+
}, n.buildUserinfo = function(e) {
|
|
721
|
+
var t = "";
|
|
722
|
+
return e.username && (t += n.encode(e.username)), e.password && (t += ":" + n.encode(e.password)), t && (t += "@"), t;
|
|
723
|
+
}, n.buildQuery = function(e, t, i) {
|
|
724
|
+
var o = "", c, h, p, d;
|
|
725
|
+
for (h in e)
|
|
726
|
+
if (h !== "__proto__" && x.call(e, h))
|
|
727
|
+
if (v(e[h]))
|
|
728
|
+
for (c = {}, p = 0, d = e[h].length; p < d; p++)
|
|
729
|
+
e[h][p] !== void 0 && c[e[h][p] + ""] === void 0 && (o += "&" + n.buildQueryParameter(h, e[h][p], i), t !== !0 && (c[e[h][p] + ""] = !0));
|
|
730
|
+
else e[h] !== void 0 && (o += "&" + n.buildQueryParameter(h, e[h], i));
|
|
731
|
+
return o.substring(1);
|
|
732
|
+
}, n.buildQueryParameter = function(e, t, i) {
|
|
733
|
+
return n.encodeQuery(e, i) + (t !== null ? "=" + n.encodeQuery(t, i) : "");
|
|
734
|
+
}, n.addQuery = function(e, t, i) {
|
|
735
|
+
if (typeof t == "object")
|
|
736
|
+
for (var o in t)
|
|
737
|
+
x.call(t, o) && n.addQuery(e, o, t[o]);
|
|
738
|
+
else if (typeof t == "string") {
|
|
739
|
+
if (e[t] === void 0) {
|
|
740
|
+
e[t] = i;
|
|
741
|
+
return;
|
|
742
|
+
} else typeof e[t] == "string" && (e[t] = [e[t]]);
|
|
743
|
+
v(i) || (i = [i]), e[t] = (e[t] || []).concat(i);
|
|
744
|
+
} else
|
|
745
|
+
throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");
|
|
746
|
+
}, n.setQuery = function(e, t, i) {
|
|
747
|
+
if (typeof t == "object")
|
|
748
|
+
for (var o in t)
|
|
749
|
+
x.call(t, o) && n.setQuery(e, o, t[o]);
|
|
750
|
+
else if (typeof t == "string")
|
|
751
|
+
e[t] = i === void 0 ? null : i;
|
|
752
|
+
else
|
|
753
|
+
throw new TypeError("URI.setQuery() accepts an object, string as the name parameter");
|
|
754
|
+
}, n.removeQuery = function(e, t, i) {
|
|
755
|
+
var o, c, h;
|
|
756
|
+
if (v(t))
|
|
757
|
+
for (o = 0, c = t.length; o < c; o++)
|
|
758
|
+
e[t[o]] = void 0;
|
|
759
|
+
else if (b(t) === "RegExp")
|
|
760
|
+
for (h in e)
|
|
761
|
+
t.test(h) && (e[h] = void 0);
|
|
762
|
+
else if (typeof t == "object")
|
|
763
|
+
for (h in t)
|
|
764
|
+
x.call(t, h) && n.removeQuery(e, h, t[h]);
|
|
765
|
+
else if (typeof t == "string")
|
|
766
|
+
i !== void 0 ? b(i) === "RegExp" ? !v(e[t]) && i.test(e[t]) ? e[t] = void 0 : e[t] = T(e[t], i) : e[t] === String(i) && (!v(i) || i.length === 1) ? e[t] = void 0 : v(e[t]) && (e[t] = T(e[t], i)) : e[t] = void 0;
|
|
767
|
+
else
|
|
768
|
+
throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");
|
|
769
|
+
}, n.hasQuery = function(e, t, i, o) {
|
|
770
|
+
switch (b(t)) {
|
|
771
|
+
case "String":
|
|
772
|
+
break;
|
|
773
|
+
case "RegExp":
|
|
774
|
+
for (var c in e)
|
|
775
|
+
if (x.call(e, c) && t.test(c) && (i === void 0 || n.hasQuery(e, c, i)))
|
|
776
|
+
return !0;
|
|
777
|
+
return !1;
|
|
778
|
+
case "Object":
|
|
779
|
+
for (var h in t)
|
|
780
|
+
if (x.call(t, h) && !n.hasQuery(e, h, t[h]))
|
|
781
|
+
return !1;
|
|
782
|
+
return !0;
|
|
783
|
+
default:
|
|
784
|
+
throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter");
|
|
785
|
+
}
|
|
786
|
+
switch (b(i)) {
|
|
787
|
+
case "Undefined":
|
|
788
|
+
return t in e;
|
|
789
|
+
case "Boolean":
|
|
790
|
+
var p = !!(v(e[t]) ? e[t].length : e[t]);
|
|
791
|
+
return i === p;
|
|
792
|
+
case "Function":
|
|
793
|
+
return !!i(e[t], t, e);
|
|
794
|
+
case "Array":
|
|
795
|
+
if (!v(e[t]))
|
|
796
|
+
return !1;
|
|
797
|
+
var d = o ? P : w;
|
|
798
|
+
return d(e[t], i);
|
|
799
|
+
case "RegExp":
|
|
800
|
+
return v(e[t]) ? o ? P(e[t], i) : !1 : !!(e[t] && e[t].match(i));
|
|
801
|
+
case "Number":
|
|
802
|
+
i = String(i);
|
|
803
|
+
case "String":
|
|
804
|
+
return v(e[t]) ? o ? P(e[t], i) : !1 : e[t] === i;
|
|
805
|
+
default:
|
|
806
|
+
throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter");
|
|
807
|
+
}
|
|
808
|
+
}, n.joinPaths = function() {
|
|
809
|
+
for (var e = [], t = [], i = 0, o = 0; o < arguments.length; o++) {
|
|
810
|
+
var c = new n(arguments[o]);
|
|
811
|
+
e.push(c);
|
|
812
|
+
for (var h = c.segment(), p = 0; p < h.length; p++)
|
|
813
|
+
typeof h[p] == "string" && t.push(h[p]), h[p] && i++;
|
|
814
|
+
}
|
|
815
|
+
if (!t.length || !i)
|
|
816
|
+
return new n("");
|
|
817
|
+
var d = new n("").segment(t);
|
|
818
|
+
return (e[0].path() === "" || e[0].path().slice(0, 1) === "/") && d.path("/" + d.path()), d.normalize();
|
|
819
|
+
}, n.commonPath = function(e, t) {
|
|
820
|
+
var i = Math.min(e.length, t.length), o;
|
|
821
|
+
for (o = 0; o < i; o++)
|
|
822
|
+
if (e.charAt(o) !== t.charAt(o)) {
|
|
823
|
+
o--;
|
|
824
|
+
break;
|
|
825
|
+
}
|
|
826
|
+
return o < 1 ? e.charAt(0) === t.charAt(0) && e.charAt(0) === "/" ? "/" : "" : ((e.charAt(o) !== "/" || t.charAt(o) !== "/") && (o = e.substring(0, o).lastIndexOf("/")), e.substring(0, o + 1));
|
|
827
|
+
}, n.withinString = function(e, t, i) {
|
|
828
|
+
i || (i = {});
|
|
829
|
+
var o = i.start || n.findUri.start, c = i.end || n.findUri.end, h = i.trim || n.findUri.trim, p = i.parens || n.findUri.parens, d = /[a-z0-9-]=["']?$/i;
|
|
830
|
+
for (o.lastIndex = 0; ; ) {
|
|
831
|
+
var y = o.exec(e);
|
|
832
|
+
if (!y)
|
|
833
|
+
break;
|
|
834
|
+
var _ = y.index;
|
|
835
|
+
if (i.ignoreHtml) {
|
|
836
|
+
var I = e.slice(Math.max(_ - 3, 0), _);
|
|
837
|
+
if (I && d.test(I))
|
|
838
|
+
continue;
|
|
839
|
+
}
|
|
840
|
+
for (var A = _ + e.slice(_).search(c), z = e.slice(_, A), S = -1; ; ) {
|
|
841
|
+
var O = p.exec(z);
|
|
842
|
+
if (!O)
|
|
843
|
+
break;
|
|
844
|
+
var D = O.index + O[0].length;
|
|
845
|
+
S = Math.max(S, D);
|
|
846
|
+
}
|
|
847
|
+
if (S > -1 ? z = z.slice(0, S) + z.slice(S).replace(h, "") : z = z.replace(h, ""), !(z.length <= y[0].length) && !(i.ignore && i.ignore.test(z))) {
|
|
848
|
+
A = _ + z.length;
|
|
849
|
+
var Q = t(z, _, A, e);
|
|
850
|
+
if (Q === void 0) {
|
|
851
|
+
o.lastIndex = A;
|
|
852
|
+
continue;
|
|
853
|
+
}
|
|
854
|
+
Q = String(Q), e = e.slice(0, _) + Q + e.slice(A), o.lastIndex = _ + Q.length;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
return o.lastIndex = 0, e;
|
|
858
|
+
}, n.ensureValidHostname = function(e, t) {
|
|
859
|
+
var i = !!e, o = !!t, c = !1;
|
|
860
|
+
if (o && (c = P(n.hostProtocols, t)), c && !i)
|
|
861
|
+
throw new TypeError("Hostname cannot be empty, if protocol is " + t);
|
|
862
|
+
if (e && e.match(n.invalid_hostname_characters)) {
|
|
863
|
+
if (!r)
|
|
864
|
+
throw new TypeError('Hostname "' + e + '" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');
|
|
865
|
+
if (r.toASCII(e).match(n.invalid_hostname_characters))
|
|
866
|
+
throw new TypeError('Hostname "' + e + '" contains characters other than [A-Z0-9.-:_]');
|
|
867
|
+
}
|
|
868
|
+
}, n.ensureValidPort = function(e) {
|
|
869
|
+
if (e) {
|
|
870
|
+
var t = Number(e);
|
|
871
|
+
if (!(g(t) && t > 0 && t < 65536))
|
|
872
|
+
throw new TypeError('Port "' + e + '" is not a valid port');
|
|
873
|
+
}
|
|
874
|
+
}, n.noConflict = function(e) {
|
|
875
|
+
if (e) {
|
|
876
|
+
var t = {
|
|
877
|
+
URI: this.noConflict()
|
|
878
|
+
};
|
|
879
|
+
return u.URITemplate && typeof u.URITemplate.noConflict == "function" && (t.URITemplate = u.URITemplate.noConflict()), u.IPv6 && typeof u.IPv6.noConflict == "function" && (t.IPv6 = u.IPv6.noConflict()), u.SecondLevelDomains && typeof u.SecondLevelDomains.noConflict == "function" && (t.SecondLevelDomains = u.SecondLevelDomains.noConflict()), t;
|
|
880
|
+
} else u.URI === this && (u.URI = m);
|
|
881
|
+
return this;
|
|
882
|
+
}, l.build = function(e) {
|
|
883
|
+
return e === !0 ? this._deferred_build = !0 : (e === void 0 || this._deferred_build) && (this._string = n.build(this._parts), this._deferred_build = !1), this;
|
|
884
|
+
}, l.clone = function() {
|
|
885
|
+
return new n(this);
|
|
886
|
+
}, l.valueOf = l.toString = function() {
|
|
887
|
+
return this.build(!1)._string;
|
|
888
|
+
};
|
|
889
|
+
function $(e) {
|
|
890
|
+
return function(t, i) {
|
|
891
|
+
return t === void 0 ? this._parts[e] || "" : (this._parts[e] = t || null, this.build(!i), this);
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
function V(e, t) {
|
|
895
|
+
return function(i, o) {
|
|
896
|
+
return i === void 0 ? this._parts[e] || "" : (i !== null && (i = i + "", i.charAt(0) === t && (i = i.substring(1))), this._parts[e] = i, this.build(!o), this);
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
l.protocol = $("protocol"), l.username = $("username"), l.password = $("password"), l.hostname = $("hostname"), l.port = $("port"), l.query = V("query", "?"), l.fragment = V("fragment", "#"), l.search = function(e, t) {
|
|
900
|
+
var i = this.query(e, t);
|
|
901
|
+
return typeof i == "string" && i.length ? "?" + i : i;
|
|
902
|
+
}, l.hash = function(e, t) {
|
|
903
|
+
var i = this.fragment(e, t);
|
|
904
|
+
return typeof i == "string" && i.length ? "#" + i : i;
|
|
905
|
+
}, l.pathname = function(e, t) {
|
|
906
|
+
if (e === void 0 || e === !0) {
|
|
907
|
+
var i = this._parts.path || (this._parts.hostname ? "/" : "");
|
|
908
|
+
return e ? (this._parts.urn ? n.decodeUrnPath : n.decodePath)(i) : i;
|
|
909
|
+
} else
|
|
910
|
+
return this._parts.urn ? this._parts.path = e ? n.recodeUrnPath(e) : "" : this._parts.path = e ? n.recodePath(e) : "/", this.build(!t), this;
|
|
911
|
+
}, l.path = l.pathname, l.href = function(e, t) {
|
|
912
|
+
var i;
|
|
913
|
+
if (e === void 0)
|
|
914
|
+
return this.toString();
|
|
915
|
+
this._string = "", this._parts = n._parts();
|
|
916
|
+
var o = e instanceof n, c = typeof e == "object" && (e.hostname || e.path || e.pathname);
|
|
917
|
+
if (e.nodeName) {
|
|
918
|
+
var h = n.getDomAttribute(e);
|
|
919
|
+
e = e[h] || "", c = !1;
|
|
920
|
+
}
|
|
921
|
+
if (!o && c && e.pathname !== void 0 && (e = e.toString()), typeof e == "string" || e instanceof String)
|
|
922
|
+
this._parts = n.parse(String(e), this._parts);
|
|
923
|
+
else if (o || c) {
|
|
924
|
+
var p = o ? e._parts : e;
|
|
925
|
+
for (i in p)
|
|
926
|
+
i !== "query" && x.call(this._parts, i) && (this._parts[i] = p[i]);
|
|
927
|
+
p.query && this.query(p.query, !1);
|
|
928
|
+
} else
|
|
929
|
+
throw new TypeError("invalid input");
|
|
930
|
+
return this.build(!t), this;
|
|
931
|
+
}, l.is = function(e) {
|
|
932
|
+
var t = !1, i = !1, o = !1, c = !1, h = !1, p = !1, d = !1, y = !this._parts.urn;
|
|
933
|
+
switch (this._parts.hostname && (y = !1, i = n.ip4_expression.test(this._parts.hostname), o = n.ip6_expression.test(this._parts.hostname), t = i || o, c = !t, h = c && a && a.has(this._parts.hostname), p = c && n.idn_expression.test(this._parts.hostname), d = c && n.punycode_expression.test(this._parts.hostname)), e.toLowerCase()) {
|
|
934
|
+
case "relative":
|
|
935
|
+
return y;
|
|
936
|
+
case "absolute":
|
|
937
|
+
return !y;
|
|
938
|
+
case "domain":
|
|
939
|
+
case "name":
|
|
940
|
+
return c;
|
|
941
|
+
case "sld":
|
|
942
|
+
return h;
|
|
943
|
+
case "ip":
|
|
944
|
+
return t;
|
|
945
|
+
case "ip4":
|
|
946
|
+
case "ipv4":
|
|
947
|
+
case "inet4":
|
|
948
|
+
return i;
|
|
949
|
+
case "ip6":
|
|
950
|
+
case "ipv6":
|
|
951
|
+
case "inet6":
|
|
952
|
+
return o;
|
|
953
|
+
case "idn":
|
|
954
|
+
return p;
|
|
955
|
+
case "url":
|
|
956
|
+
return !this._parts.urn;
|
|
957
|
+
case "urn":
|
|
958
|
+
return !!this._parts.urn;
|
|
959
|
+
case "punycode":
|
|
960
|
+
return d;
|
|
961
|
+
}
|
|
962
|
+
return null;
|
|
963
|
+
};
|
|
964
|
+
var ie = l.protocol, se = l.port, oe = l.hostname;
|
|
965
|
+
l.protocol = function(e, t) {
|
|
966
|
+
if (e && (e = e.replace(/:(\/\/)?$/, ""), !e.match(n.protocol_expression)))
|
|
967
|
+
throw new TypeError('Protocol "' + e + `" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);
|
|
968
|
+
return ie.call(this, e, t);
|
|
969
|
+
}, l.scheme = l.protocol, l.port = function(e, t) {
|
|
970
|
+
return this._parts.urn ? e === void 0 ? "" : this : (e !== void 0 && (e === 0 && (e = null), e && (e += "", e.charAt(0) === ":" && (e = e.substring(1)), n.ensureValidPort(e))), se.call(this, e, t));
|
|
971
|
+
}, l.hostname = function(e, t) {
|
|
972
|
+
if (this._parts.urn)
|
|
973
|
+
return e === void 0 ? "" : this;
|
|
974
|
+
if (e !== void 0) {
|
|
975
|
+
var i = { preventInvalidHostname: this._parts.preventInvalidHostname }, o = n.parseHost(e, i);
|
|
976
|
+
if (o !== "/")
|
|
977
|
+
throw new TypeError('Hostname "' + e + '" contains characters other than [A-Z0-9.-]');
|
|
978
|
+
e = i.hostname, this._parts.preventInvalidHostname && n.ensureValidHostname(e, this._parts.protocol);
|
|
979
|
+
}
|
|
980
|
+
return oe.call(this, e, t);
|
|
981
|
+
}, l.origin = function(e, t) {
|
|
982
|
+
if (this._parts.urn)
|
|
983
|
+
return e === void 0 ? "" : this;
|
|
984
|
+
if (e === void 0) {
|
|
985
|
+
var i = this.protocol(), o = this.authority();
|
|
986
|
+
return o ? (i ? i + "://" : "") + this.authority() : "";
|
|
987
|
+
} else {
|
|
988
|
+
var c = n(e);
|
|
989
|
+
return this.protocol(c.protocol()).authority(c.authority()).build(!t), this;
|
|
990
|
+
}
|
|
991
|
+
}, l.host = function(e, t) {
|
|
992
|
+
if (this._parts.urn)
|
|
993
|
+
return e === void 0 ? "" : this;
|
|
994
|
+
if (e === void 0)
|
|
995
|
+
return this._parts.hostname ? n.buildHost(this._parts) : "";
|
|
996
|
+
var i = n.parseHost(e, this._parts);
|
|
997
|
+
if (i !== "/")
|
|
998
|
+
throw new TypeError('Hostname "' + e + '" contains characters other than [A-Z0-9.-]');
|
|
999
|
+
return this.build(!t), this;
|
|
1000
|
+
}, l.authority = function(e, t) {
|
|
1001
|
+
if (this._parts.urn)
|
|
1002
|
+
return e === void 0 ? "" : this;
|
|
1003
|
+
if (e === void 0)
|
|
1004
|
+
return this._parts.hostname ? n.buildAuthority(this._parts) : "";
|
|
1005
|
+
var i = n.parseAuthority(e, this._parts);
|
|
1006
|
+
if (i !== "/")
|
|
1007
|
+
throw new TypeError('Hostname "' + e + '" contains characters other than [A-Z0-9.-]');
|
|
1008
|
+
return this.build(!t), this;
|
|
1009
|
+
}, l.userinfo = function(e, t) {
|
|
1010
|
+
if (this._parts.urn)
|
|
1011
|
+
return e === void 0 ? "" : this;
|
|
1012
|
+
if (e === void 0) {
|
|
1013
|
+
var i = n.buildUserinfo(this._parts);
|
|
1014
|
+
return i && i.substring(0, i.length - 1);
|
|
1015
|
+
} else
|
|
1016
|
+
return e[e.length - 1] !== "@" && (e += "@"), n.parseUserinfo(e, this._parts), this.build(!t), this;
|
|
1017
|
+
}, l.resource = function(e, t) {
|
|
1018
|
+
var i;
|
|
1019
|
+
return e === void 0 ? this.path() + this.search() + this.hash() : (i = n.parse(e), this._parts.path = i.path, this._parts.query = i.query, this._parts.fragment = i.fragment, this.build(!t), this);
|
|
1020
|
+
}, l.subdomain = function(e, t) {
|
|
1021
|
+
if (this._parts.urn)
|
|
1022
|
+
return e === void 0 ? "" : this;
|
|
1023
|
+
if (e === void 0) {
|
|
1024
|
+
if (!this._parts.hostname || this.is("IP"))
|
|
1025
|
+
return "";
|
|
1026
|
+
var i = this._parts.hostname.length - this.domain().length - 1;
|
|
1027
|
+
return this._parts.hostname.substring(0, i) || "";
|
|
1028
|
+
} else {
|
|
1029
|
+
var o = this._parts.hostname.length - this.domain().length, c = this._parts.hostname.substring(0, o), h = new RegExp("^" + k(c));
|
|
1030
|
+
if (e && e.charAt(e.length - 1) !== "." && (e += "."), e.indexOf(":") !== -1)
|
|
1031
|
+
throw new TypeError("Domains cannot contain colons");
|
|
1032
|
+
return e && n.ensureValidHostname(e, this._parts.protocol), this._parts.hostname = this._parts.hostname.replace(h, e), this.build(!t), this;
|
|
1033
|
+
}
|
|
1034
|
+
}, l.domain = function(e, t) {
|
|
1035
|
+
if (this._parts.urn)
|
|
1036
|
+
return e === void 0 ? "" : this;
|
|
1037
|
+
if (typeof e == "boolean" && (t = e, e = void 0), e === void 0) {
|
|
1038
|
+
if (!this._parts.hostname || this.is("IP"))
|
|
1039
|
+
return "";
|
|
1040
|
+
var i = this._parts.hostname.match(/\./g);
|
|
1041
|
+
if (i && i.length < 2)
|
|
1042
|
+
return this._parts.hostname;
|
|
1043
|
+
var o = this._parts.hostname.length - this.tld(t).length - 1;
|
|
1044
|
+
return o = this._parts.hostname.lastIndexOf(".", o - 1) + 1, this._parts.hostname.substring(o) || "";
|
|
1045
|
+
} else {
|
|
1046
|
+
if (!e)
|
|
1047
|
+
throw new TypeError("cannot set domain empty");
|
|
1048
|
+
if (e.indexOf(":") !== -1)
|
|
1049
|
+
throw new TypeError("Domains cannot contain colons");
|
|
1050
|
+
if (n.ensureValidHostname(e, this._parts.protocol), !this._parts.hostname || this.is("IP"))
|
|
1051
|
+
this._parts.hostname = e;
|
|
1052
|
+
else {
|
|
1053
|
+
var c = new RegExp(k(this.domain()) + "$");
|
|
1054
|
+
this._parts.hostname = this._parts.hostname.replace(c, e);
|
|
1055
|
+
}
|
|
1056
|
+
return this.build(!t), this;
|
|
1057
|
+
}
|
|
1058
|
+
}, l.tld = function(e, t) {
|
|
1059
|
+
if (this._parts.urn)
|
|
1060
|
+
return e === void 0 ? "" : this;
|
|
1061
|
+
if (typeof e == "boolean" && (t = e, e = void 0), e === void 0) {
|
|
1062
|
+
if (!this._parts.hostname || this.is("IP"))
|
|
1063
|
+
return "";
|
|
1064
|
+
var i = this._parts.hostname.lastIndexOf("."), o = this._parts.hostname.substring(i + 1);
|
|
1065
|
+
return t !== !0 && a && a.list[o.toLowerCase()] && a.get(this._parts.hostname) || o;
|
|
1066
|
+
} else {
|
|
1067
|
+
var c;
|
|
1068
|
+
if (e)
|
|
1069
|
+
if (e.match(/[^a-zA-Z0-9-]/))
|
|
1070
|
+
if (a && a.is(e))
|
|
1071
|
+
c = new RegExp(k(this.tld()) + "$"), this._parts.hostname = this._parts.hostname.replace(c, e);
|
|
1072
|
+
else
|
|
1073
|
+
throw new TypeError('TLD "' + e + '" contains characters other than [A-Z0-9]');
|
|
1074
|
+
else {
|
|
1075
|
+
if (!this._parts.hostname || this.is("IP"))
|
|
1076
|
+
throw new ReferenceError("cannot set TLD on non-domain host");
|
|
1077
|
+
c = new RegExp(k(this.tld()) + "$"), this._parts.hostname = this._parts.hostname.replace(c, e);
|
|
1078
|
+
}
|
|
1079
|
+
else throw new TypeError("cannot set TLD empty");
|
|
1080
|
+
return this.build(!t), this;
|
|
1081
|
+
}
|
|
1082
|
+
}, l.directory = function(e, t) {
|
|
1083
|
+
if (this._parts.urn)
|
|
1084
|
+
return e === void 0 ? "" : this;
|
|
1085
|
+
if (e === void 0 || e === !0) {
|
|
1086
|
+
if (!this._parts.path && !this._parts.hostname)
|
|
1087
|
+
return "";
|
|
1088
|
+
if (this._parts.path === "/")
|
|
1089
|
+
return "/";
|
|
1090
|
+
var i = this._parts.path.length - this.filename().length - 1, o = this._parts.path.substring(0, i) || (this._parts.hostname ? "/" : "");
|
|
1091
|
+
return e ? n.decodePath(o) : o;
|
|
1092
|
+
} else {
|
|
1093
|
+
var c = this._parts.path.length - this.filename().length, h = this._parts.path.substring(0, c), p = new RegExp("^" + k(h));
|
|
1094
|
+
return this.is("relative") || (e || (e = "/"), e.charAt(0) !== "/" && (e = "/" + e)), e && e.charAt(e.length - 1) !== "/" && (e += "/"), e = n.recodePath(e), this._parts.path = this._parts.path.replace(p, e), this.build(!t), this;
|
|
1095
|
+
}
|
|
1096
|
+
}, l.filename = function(e, t) {
|
|
1097
|
+
if (this._parts.urn)
|
|
1098
|
+
return e === void 0 ? "" : this;
|
|
1099
|
+
if (typeof e != "string") {
|
|
1100
|
+
if (!this._parts.path || this._parts.path === "/")
|
|
1101
|
+
return "";
|
|
1102
|
+
var i = this._parts.path.lastIndexOf("/"), o = this._parts.path.substring(i + 1);
|
|
1103
|
+
return e ? n.decodePathSegment(o) : o;
|
|
1104
|
+
} else {
|
|
1105
|
+
var c = !1;
|
|
1106
|
+
e.charAt(0) === "/" && (e = e.substring(1)), e.match(/\.?\//) && (c = !0);
|
|
1107
|
+
var h = new RegExp(k(this.filename()) + "$");
|
|
1108
|
+
return e = n.recodePath(e), this._parts.path = this._parts.path.replace(h, e), c ? this.normalizePath(t) : this.build(!t), this;
|
|
1109
|
+
}
|
|
1110
|
+
}, l.suffix = function(e, t) {
|
|
1111
|
+
if (this._parts.urn)
|
|
1112
|
+
return e === void 0 ? "" : this;
|
|
1113
|
+
if (e === void 0 || e === !0) {
|
|
1114
|
+
if (!this._parts.path || this._parts.path === "/")
|
|
1115
|
+
return "";
|
|
1116
|
+
var i = this.filename(), o = i.lastIndexOf("."), c, h;
|
|
1117
|
+
return o === -1 ? "" : (c = i.substring(o + 1), h = /^[a-z0-9%]+$/i.test(c) ? c : "", e ? n.decodePathSegment(h) : h);
|
|
1118
|
+
} else {
|
|
1119
|
+
e.charAt(0) === "." && (e = e.substring(1));
|
|
1120
|
+
var p = this.suffix(), d;
|
|
1121
|
+
if (p)
|
|
1122
|
+
e ? d = new RegExp(k(p) + "$") : d = new RegExp(k("." + p) + "$");
|
|
1123
|
+
else {
|
|
1124
|
+
if (!e)
|
|
1125
|
+
return this;
|
|
1126
|
+
this._parts.path += "." + n.recodePath(e);
|
|
1127
|
+
}
|
|
1128
|
+
return d && (e = n.recodePath(e), this._parts.path = this._parts.path.replace(d, e)), this.build(!t), this;
|
|
1129
|
+
}
|
|
1130
|
+
}, l.segment = function(e, t, i) {
|
|
1131
|
+
var o = this._parts.urn ? ":" : "/", c = this.path(), h = c.substring(0, 1) === "/", p = c.split(o);
|
|
1132
|
+
if (e !== void 0 && typeof e != "number" && (i = t, t = e, e = void 0), e !== void 0 && typeof e != "number")
|
|
1133
|
+
throw new Error('Bad segment "' + e + '", must be 0-based integer');
|
|
1134
|
+
if (h && p.shift(), e < 0 && (e = Math.max(p.length + e, 0)), t === void 0)
|
|
1135
|
+
return e === void 0 ? p : p[e];
|
|
1136
|
+
if (e === null || p[e] === void 0)
|
|
1137
|
+
if (v(t)) {
|
|
1138
|
+
p = [];
|
|
1139
|
+
for (var d = 0, y = t.length; d < y; d++)
|
|
1140
|
+
!t[d].length && (!p.length || !p[p.length - 1].length) || (p.length && !p[p.length - 1].length && p.pop(), p.push(F(t[d])));
|
|
1141
|
+
} else (t || typeof t == "string") && (t = F(t), p[p.length - 1] === "" ? p[p.length - 1] = t : p.push(t));
|
|
1142
|
+
else
|
|
1143
|
+
t ? p[e] = F(t) : p.splice(e, 1);
|
|
1144
|
+
return h && p.unshift(""), this.path(p.join(o), i);
|
|
1145
|
+
}, l.segmentCoded = function(e, t, i) {
|
|
1146
|
+
var o, c, h;
|
|
1147
|
+
if (typeof e != "number" && (i = t, t = e, e = void 0), t === void 0) {
|
|
1148
|
+
if (o = this.segment(e, t, i), !v(o))
|
|
1149
|
+
o = o !== void 0 ? n.decode(o) : void 0;
|
|
1150
|
+
else
|
|
1151
|
+
for (c = 0, h = o.length; c < h; c++)
|
|
1152
|
+
o[c] = n.decode(o[c]);
|
|
1153
|
+
return o;
|
|
1154
|
+
}
|
|
1155
|
+
if (!v(t))
|
|
1156
|
+
t = typeof t == "string" || t instanceof String ? n.encode(t) : t;
|
|
1157
|
+
else
|
|
1158
|
+
for (c = 0, h = t.length; c < h; c++)
|
|
1159
|
+
t[c] = n.encode(t[c]);
|
|
1160
|
+
return this.segment(e, t, i);
|
|
1161
|
+
};
|
|
1162
|
+
var ae = l.query;
|
|
1163
|
+
return l.query = function(e, t) {
|
|
1164
|
+
if (e === !0)
|
|
1165
|
+
return n.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
|
|
1166
|
+
if (typeof e == "function") {
|
|
1167
|
+
var i = n.parseQuery(this._parts.query, this._parts.escapeQuerySpace), o = e.call(this, i);
|
|
1168
|
+
return this._parts.query = n.buildQuery(o || i, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), this.build(!t), this;
|
|
1169
|
+
} else return e !== void 0 && typeof e != "string" ? (this._parts.query = n.buildQuery(e, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), this.build(!t), this) : ae.call(this, e, t);
|
|
1170
|
+
}, l.setQuery = function(e, t, i) {
|
|
1171
|
+
var o = n.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
|
|
1172
|
+
if (typeof e == "string" || e instanceof String)
|
|
1173
|
+
o[e] = t !== void 0 ? t : null;
|
|
1174
|
+
else if (typeof e == "object")
|
|
1175
|
+
for (var c in e)
|
|
1176
|
+
x.call(e, c) && (o[c] = e[c]);
|
|
1177
|
+
else
|
|
1178
|
+
throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");
|
|
1179
|
+
return this._parts.query = n.buildQuery(o, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), typeof e != "string" && (i = t), this.build(!i), this;
|
|
1180
|
+
}, l.addQuery = function(e, t, i) {
|
|
1181
|
+
var o = n.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
|
|
1182
|
+
return n.addQuery(o, e, t === void 0 ? null : t), this._parts.query = n.buildQuery(o, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), typeof e != "string" && (i = t), this.build(!i), this;
|
|
1183
|
+
}, l.removeQuery = function(e, t, i) {
|
|
1184
|
+
var o = n.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
|
|
1185
|
+
return n.removeQuery(o, e, t), this._parts.query = n.buildQuery(o, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), typeof e != "string" && (i = t), this.build(!i), this;
|
|
1186
|
+
}, l.hasQuery = function(e, t, i) {
|
|
1187
|
+
var o = n.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
|
|
1188
|
+
return n.hasQuery(o, e, t, i);
|
|
1189
|
+
}, l.setSearch = l.setQuery, l.addSearch = l.addQuery, l.removeSearch = l.removeQuery, l.hasSearch = l.hasQuery, l.normalize = function() {
|
|
1190
|
+
return this._parts.urn ? this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build() : this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build();
|
|
1191
|
+
}, l.normalizeProtocol = function(e) {
|
|
1192
|
+
return typeof this._parts.protocol == "string" && (this._parts.protocol = this._parts.protocol.toLowerCase(), this.build(!e)), this;
|
|
1193
|
+
}, l.normalizeHostname = function(e) {
|
|
1194
|
+
return this._parts.hostname && (this.is("IDN") && r ? this._parts.hostname = r.toASCII(this._parts.hostname) : this.is("IPv6") && s && (this._parts.hostname = s.best(this._parts.hostname)), this._parts.hostname = this._parts.hostname.toLowerCase(), this.build(!e)), this;
|
|
1195
|
+
}, l.normalizePort = function(e) {
|
|
1196
|
+
return typeof this._parts.protocol == "string" && this._parts.port === n.defaultPorts[this._parts.protocol] && (this._parts.port = null, this.build(!e)), this;
|
|
1197
|
+
}, l.normalizePath = function(e) {
|
|
1198
|
+
var t = this._parts.path;
|
|
1199
|
+
if (!t)
|
|
1200
|
+
return this;
|
|
1201
|
+
if (this._parts.urn)
|
|
1202
|
+
return this._parts.path = n.recodeUrnPath(this._parts.path), this.build(!e), this;
|
|
1203
|
+
if (this._parts.path === "/")
|
|
1204
|
+
return this;
|
|
1205
|
+
t = n.recodePath(t);
|
|
1206
|
+
var i, o = "", c, h;
|
|
1207
|
+
for (t.charAt(0) !== "/" && (i = !0, t = "/" + t), (t.slice(-3) === "/.." || t.slice(-2) === "/.") && (t += "/"), t = t.replace(/(\/(\.\/)+)|(\/\.$)/g, "/").replace(/\/{2,}/g, "/"), i && (o = t.substring(1).match(/^(\.\.\/)+/) || "", o && (o = o[0])); c = t.search(/\/\.\.(\/|$)/), c !== -1; ) {
|
|
1208
|
+
if (c === 0) {
|
|
1209
|
+
t = t.substring(3);
|
|
1210
|
+
continue;
|
|
1211
|
+
}
|
|
1212
|
+
h = t.substring(0, c).lastIndexOf("/"), h === -1 && (h = c), t = t.substring(0, h) + t.substring(c + 3);
|
|
1213
|
+
}
|
|
1214
|
+
return i && this.is("relative") && (t = o + t.substring(1)), this._parts.path = t, this.build(!e), this;
|
|
1215
|
+
}, l.normalizePathname = l.normalizePath, l.normalizeQuery = function(e) {
|
|
1216
|
+
return typeof this._parts.query == "string" && (this._parts.query.length ? this.query(n.parseQuery(this._parts.query, this._parts.escapeQuerySpace)) : this._parts.query = null, this.build(!e)), this;
|
|
1217
|
+
}, l.normalizeFragment = function(e) {
|
|
1218
|
+
return this._parts.fragment || (this._parts.fragment = null, this.build(!e)), this;
|
|
1219
|
+
}, l.normalizeSearch = l.normalizeQuery, l.normalizeHash = l.normalizeFragment, l.iso8859 = function() {
|
|
1220
|
+
var e = n.encode, t = n.decode;
|
|
1221
|
+
n.encode = escape, n.decode = decodeURIComponent;
|
|
1222
|
+
try {
|
|
1223
|
+
this.normalize();
|
|
1224
|
+
} finally {
|
|
1225
|
+
n.encode = e, n.decode = t;
|
|
1226
|
+
}
|
|
1227
|
+
return this;
|
|
1228
|
+
}, l.unicode = function() {
|
|
1229
|
+
var e = n.encode, t = n.decode;
|
|
1230
|
+
n.encode = U, n.decode = unescape;
|
|
1231
|
+
try {
|
|
1232
|
+
this.normalize();
|
|
1233
|
+
} finally {
|
|
1234
|
+
n.encode = e, n.decode = t;
|
|
1235
|
+
}
|
|
1236
|
+
return this;
|
|
1237
|
+
}, l.readable = function() {
|
|
1238
|
+
var e = this.clone();
|
|
1239
|
+
e.username("").password("").normalize();
|
|
1240
|
+
var t = "";
|
|
1241
|
+
if (e._parts.protocol && (t += e._parts.protocol + "://"), e._parts.hostname && (e.is("punycode") && r ? (t += r.toUnicode(e._parts.hostname), e._parts.port && (t += ":" + e._parts.port)) : t += e.host()), e._parts.hostname && e._parts.path && e._parts.path.charAt(0) !== "/" && (t += "/"), t += e.path(!0), e._parts.query) {
|
|
1242
|
+
for (var i = "", o = 0, c = e._parts.query.split("&"), h = c.length; o < h; o++) {
|
|
1243
|
+
var p = (c[o] || "").split("=");
|
|
1244
|
+
i += "&" + n.decodeQuery(p[0], this._parts.escapeQuerySpace).replace(/&/g, "%26"), p[1] !== void 0 && (i += "=" + n.decodeQuery(p[1], this._parts.escapeQuerySpace).replace(/&/g, "%26"));
|
|
1245
|
+
}
|
|
1246
|
+
t += "?" + i.substring(1);
|
|
1247
|
+
}
|
|
1248
|
+
return t += n.decodeQuery(e.hash(), !0), t;
|
|
1249
|
+
}, l.absoluteTo = function(e) {
|
|
1250
|
+
var t = this.clone(), i = ["protocol", "username", "password", "hostname", "port"], o, c, h;
|
|
1251
|
+
if (this._parts.urn)
|
|
1252
|
+
throw new Error("URNs do not have any generally defined hierarchical components");
|
|
1253
|
+
if (e instanceof n || (e = new n(e)), t._parts.protocol || (t._parts.protocol = e._parts.protocol, this._parts.hostname))
|
|
1254
|
+
return t;
|
|
1255
|
+
for (c = 0; h = i[c]; c++)
|
|
1256
|
+
t._parts[h] = e._parts[h];
|
|
1257
|
+
return t._parts.path ? (t._parts.path.substring(-2) === ".." && (t._parts.path += "/"), t.path().charAt(0) !== "/" && (o = e.directory(), o = o || (e.path().indexOf("/") === 0 ? "/" : ""), t._parts.path = (o ? o + "/" : "") + t._parts.path, t.normalizePath())) : (t._parts.path = e._parts.path, t._parts.query || (t._parts.query = e._parts.query)), t.build(), t;
|
|
1258
|
+
}, l.relativeTo = function(e) {
|
|
1259
|
+
var t = this.clone().normalize(), i, o, c, h, p;
|
|
1260
|
+
if (t._parts.urn)
|
|
1261
|
+
throw new Error("URNs do not have any generally defined hierarchical components");
|
|
1262
|
+
if (e = new n(e).normalize(), i = t._parts, o = e._parts, h = t.path(), p = e.path(), h.charAt(0) !== "/")
|
|
1263
|
+
throw new Error("URI is already relative");
|
|
1264
|
+
if (p.charAt(0) !== "/")
|
|
1265
|
+
throw new Error("Cannot calculate a URI relative to another relative URI");
|
|
1266
|
+
if (i.protocol === o.protocol && (i.protocol = null), i.username !== o.username || i.password !== o.password || i.protocol !== null || i.username !== null || i.password !== null)
|
|
1267
|
+
return t.build();
|
|
1268
|
+
if (i.hostname === o.hostname && i.port === o.port)
|
|
1269
|
+
i.hostname = null, i.port = null;
|
|
1270
|
+
else
|
|
1271
|
+
return t.build();
|
|
1272
|
+
if (h === p)
|
|
1273
|
+
return i.path = "", t.build();
|
|
1274
|
+
if (c = n.commonPath(h, p), !c)
|
|
1275
|
+
return t.build();
|
|
1276
|
+
var d = o.path.substring(c.length).replace(/[^\/]*$/, "").replace(/.*?\//g, "../");
|
|
1277
|
+
return i.path = d + i.path.substring(c.length) || "./", t.build();
|
|
1278
|
+
}, l.equals = function(e) {
|
|
1279
|
+
var t = this.clone(), i = new n(e), o = {}, c = {}, h = {}, p, d, y;
|
|
1280
|
+
if (t.normalize(), i.normalize(), t.toString() === i.toString())
|
|
1281
|
+
return !0;
|
|
1282
|
+
if (p = t.query(), d = i.query(), t.query(""), i.query(""), t.toString() !== i.toString() || p.length !== d.length)
|
|
1283
|
+
return !1;
|
|
1284
|
+
o = n.parseQuery(p, this._parts.escapeQuerySpace), c = n.parseQuery(d, this._parts.escapeQuerySpace);
|
|
1285
|
+
for (y in o)
|
|
1286
|
+
if (x.call(o, y)) {
|
|
1287
|
+
if (v(o[y])) {
|
|
1288
|
+
if (!w(o[y], c[y]))
|
|
1289
|
+
return !1;
|
|
1290
|
+
} else if (o[y] !== c[y])
|
|
1291
|
+
return !1;
|
|
1292
|
+
h[y] = !0;
|
|
1293
|
+
}
|
|
1294
|
+
for (y in c)
|
|
1295
|
+
if (x.call(c, y) && !h[y])
|
|
1296
|
+
return !1;
|
|
1297
|
+
return !0;
|
|
1298
|
+
}, l.preventInvalidHostname = function(e) {
|
|
1299
|
+
return this._parts.preventInvalidHostname = !!e, this;
|
|
1300
|
+
}, l.duplicateQueryParameters = function(e) {
|
|
1301
|
+
return this._parts.duplicateQueryParameters = !!e, this;
|
|
1302
|
+
}, l.escapeQuerySpace = function(e) {
|
|
1303
|
+
return this._parts.escapeQuerySpace = !!e, this;
|
|
1304
|
+
}, n;
|
|
1305
|
+
});
|
|
1306
|
+
})(Ae);
|
|
1307
|
+
var Ee = Ae.exports;
|
|
1308
|
+
const de = /* @__PURE__ */ Te(Ee), xe = [
|
|
1309
|
+
"http",
|
|
1310
|
+
"https"
|
|
1311
|
+
];
|
|
1312
|
+
function Fe(f) {
|
|
1313
|
+
return typeof f == "string" && f.startsWith("/vsi") && !f.startsWith("/vsicurl/");
|
|
1314
|
+
}
|
|
1315
|
+
function me(f, r, s = !0) {
|
|
1316
|
+
return Le(f, r, !1, s);
|
|
1317
|
+
}
|
|
1318
|
+
function Le(f, r = null, s = !1, a = !0) {
|
|
1319
|
+
typeof f == "string" && f.startsWith("/vsicurl/") && (f = f.replace(/^\/vsicurl\//, ""));
|
|
1320
|
+
let u = de(f);
|
|
1321
|
+
if (r && u.is("relative") && !Fe(f)) {
|
|
1322
|
+
let m = de(r), n = m.path();
|
|
1323
|
+
!n.endsWith("/") && !n.endsWith(".json") && m.path(n + "/"), u = u.absoluteTo(m);
|
|
1324
|
+
}
|
|
1325
|
+
return u.normalize(), s && (u.query(""), u.fragment("")), a ? u.toString() : u;
|
|
1326
|
+
}
|
|
1327
|
+
var Ue = { exports: {} };
|
|
1328
|
+
(function(f, r) {
|
|
1329
|
+
(function(s, a) {
|
|
1330
|
+
f.exports = a();
|
|
1331
|
+
})(X, function() {
|
|
1332
|
+
var s = /^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
|
|
1333
|
+
function a(b, v) {
|
|
1334
|
+
return b.indexOf(v) === -1 ? b.length : b.indexOf(v);
|
|
1335
|
+
}
|
|
1336
|
+
function u(b) {
|
|
1337
|
+
var v = b.replace(/^v/, "").replace(/\+.*$/, ""), T = a(v, "-"), P = v.substring(0, T).split(".");
|
|
1338
|
+
return P.push(v.substring(T + 1)), P;
|
|
1339
|
+
}
|
|
1340
|
+
function m(b) {
|
|
1341
|
+
return isNaN(Number(b)) ? b : Number(b);
|
|
1342
|
+
}
|
|
1343
|
+
function n(b) {
|
|
1344
|
+
if (typeof b != "string")
|
|
1345
|
+
throw new TypeError("Invalid argument expected string");
|
|
1346
|
+
if (!s.test(b))
|
|
1347
|
+
throw new Error("Invalid argument not valid semver ('" + b + "' received)");
|
|
1348
|
+
}
|
|
1349
|
+
function g(b, v) {
|
|
1350
|
+
[b, v].forEach(n);
|
|
1351
|
+
for (var T = u(b), P = u(v), w = 0; w < Math.max(T.length - 1, P.length - 1); w++) {
|
|
1352
|
+
var F = parseInt(T[w] || 0, 10), N = parseInt(P[w] || 0, 10);
|
|
1353
|
+
if (F > N) return 1;
|
|
1354
|
+
if (N > F) return -1;
|
|
1355
|
+
}
|
|
1356
|
+
var U = T[T.length - 1], L = P[P.length - 1];
|
|
1357
|
+
if (U && L) {
|
|
1358
|
+
var R = U.split(".").map(m), j = L.split(".").map(m);
|
|
1359
|
+
for (w = 0; w < Math.max(R.length, j.length); w++) {
|
|
1360
|
+
if (R[w] === void 0 || typeof j[w] == "string" && typeof R[w] == "number") return -1;
|
|
1361
|
+
if (j[w] === void 0 || typeof R[w] == "string" && typeof j[w] == "number" || R[w] > j[w]) return 1;
|
|
1362
|
+
if (j[w] > R[w]) return -1;
|
|
1363
|
+
}
|
|
1364
|
+
} else if (U || L)
|
|
1365
|
+
return U ? -1 : 1;
|
|
1366
|
+
return 0;
|
|
1367
|
+
}
|
|
1368
|
+
var l = [
|
|
1369
|
+
">",
|
|
1370
|
+
">=",
|
|
1371
|
+
"=",
|
|
1372
|
+
"<",
|
|
1373
|
+
"<="
|
|
1374
|
+
], x = {
|
|
1375
|
+
">": [1],
|
|
1376
|
+
">=": [0, 1],
|
|
1377
|
+
"=": [0],
|
|
1378
|
+
"<=": [-1, 0],
|
|
1379
|
+
"<": [-1]
|
|
1380
|
+
};
|
|
1381
|
+
function k(b) {
|
|
1382
|
+
if (typeof b != "string")
|
|
1383
|
+
throw new TypeError("Invalid operator type, expected string but got " + typeof b);
|
|
1384
|
+
if (l.indexOf(b) === -1)
|
|
1385
|
+
throw new TypeError("Invalid operator, expected one of " + l.join("|"));
|
|
1386
|
+
}
|
|
1387
|
+
return g.validate = function(b) {
|
|
1388
|
+
return typeof b == "string" && s.test(b);
|
|
1389
|
+
}, g.compare = function(b, v, T) {
|
|
1390
|
+
k(T);
|
|
1391
|
+
var P = g(b, v);
|
|
1392
|
+
return x[T].indexOf(P) > -1;
|
|
1393
|
+
}, g;
|
|
1394
|
+
});
|
|
1395
|
+
})(Ue);
|
|
1396
|
+
const C = {
|
|
1397
|
+
classification: "https://stac-extensions.github.io/classification/v1.1.0/schema.json",
|
|
1398
|
+
datacube: "https://stac-extensions.github.io/datacube/v2.1.0/schema.json",
|
|
1399
|
+
eo: "https://stac-extensions.github.io/eo/v1.0.0/schema.json",
|
|
1400
|
+
file: "https://stac-extensions.github.io/file/v1.0.0/schema.json",
|
|
1401
|
+
"item-assets": "https://stac-extensions.github.io/item-assets/v1.0.0/schema.json",
|
|
1402
|
+
label: "https://stac-extensions.github.io/label/v1.0.1/schema.json",
|
|
1403
|
+
pointcloud: "https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json",
|
|
1404
|
+
processing: "https://stac-extensions.github.io/processing/v1.1.0/schema.json",
|
|
1405
|
+
projection: "https://stac-extensions.github.io/projection/v1.0.0/schema.json",
|
|
1406
|
+
raster: "https://stac-extensions.github.io/raster/v1.1.0/schema.json",
|
|
1407
|
+
sar: "https://stac-extensions.github.io/sar/v1.0.0/schema.json",
|
|
1408
|
+
sat: "https://stac-extensions.github.io/sat/v1.0.0/schema.json",
|
|
1409
|
+
scientific: "https://stac-extensions.github.io/scientific/v1.0.0/schema.json",
|
|
1410
|
+
table: "https://stac-extensions.github.io/table/v1.2.0/schema.json",
|
|
1411
|
+
timestamps: "https://stac-extensions.github.io/timestamps/v1.0.0/schema.json",
|
|
1412
|
+
version: "https://stac-extensions.github.io/version/v1.0.0/schema.json",
|
|
1413
|
+
view: "https://stac-extensions.github.io/view/v1.0.0/schema.json"
|
|
1414
|
+
}, Y = {
|
|
1415
|
+
// Add a : at the end to indicate it has a prefix, otherwise list all fields separately (see version extension for example).
|
|
1416
|
+
itemAndCollection: {
|
|
1417
|
+
// with prefix
|
|
1418
|
+
"cube:": C.datacube,
|
|
1419
|
+
"eo:": C.eo,
|
|
1420
|
+
"file:": C.file,
|
|
1421
|
+
"label:": C.label,
|
|
1422
|
+
"pc:": C.pointcloud,
|
|
1423
|
+
"processing:": C.processing,
|
|
1424
|
+
"proj:": C.projection,
|
|
1425
|
+
"raster:": C.raster,
|
|
1426
|
+
"sar:": C.sar,
|
|
1427
|
+
"sat:": C.sat,
|
|
1428
|
+
"sci:": C.scientific,
|
|
1429
|
+
"view:": C.view,
|
|
1430
|
+
// without prefix
|
|
1431
|
+
version: C.version,
|
|
1432
|
+
deprecated: C.version,
|
|
1433
|
+
published: C.timestamps,
|
|
1434
|
+
expires: C.timestamps,
|
|
1435
|
+
unpublished: C.timestamps
|
|
1436
|
+
},
|
|
1437
|
+
catalog: {
|
|
1438
|
+
// None yet
|
|
1439
|
+
},
|
|
1440
|
+
collection: {
|
|
1441
|
+
item_assets: C["item-assets"]
|
|
1442
|
+
},
|
|
1443
|
+
item: {
|
|
1444
|
+
// None yet
|
|
1445
|
+
}
|
|
1446
|
+
};
|
|
1447
|
+
Y.collection = Object.assign(Y.collection, Y.itemAndCollection);
|
|
1448
|
+
Y.item = Object.assign(Y.item, Y.itemAndCollection);
|
|
1449
|
+
function ne(f) {
|
|
1450
|
+
let r = f.length >= 6, s = f[0], a = f[r ? 3 : 2], u = f[1], m = f[r ? 4 : 3], n = { west: s, east: a, south: u, north: m };
|
|
1451
|
+
return r && (n.base = f[2], n.height = f[5]), n;
|
|
1452
|
+
}
|
|
1453
|
+
function pe(f) {
|
|
1454
|
+
let { west: r, east: s, south: a, north: u } = ne(f);
|
|
1455
|
+
return [
|
|
1456
|
+
[
|
|
1457
|
+
[r, u],
|
|
1458
|
+
[r, a],
|
|
1459
|
+
[s, a],
|
|
1460
|
+
[s, u],
|
|
1461
|
+
[r, u]
|
|
1462
|
+
]
|
|
1463
|
+
];
|
|
1464
|
+
}
|
|
1465
|
+
function Be(f) {
|
|
1466
|
+
if (!J(f))
|
|
1467
|
+
return null;
|
|
1468
|
+
let r = ne(f), s = [];
|
|
1469
|
+
if (Ie(f)) {
|
|
1470
|
+
let a = (r.west + 360 + r.east) / 2;
|
|
1471
|
+
a > 180 && (a -= 360), s.push(a);
|
|
1472
|
+
} else
|
|
1473
|
+
s.push((r.west + r.east) / 2);
|
|
1474
|
+
return s.push((r.south + r.north) / 2), typeof r.base < "u" && s.push((r.base + r.height) / 2), s;
|
|
1475
|
+
}
|
|
1476
|
+
function qe(f) {
|
|
1477
|
+
if (J(f) ? f = [f] : Array.isArray(f) && (f = f.filter((a) => J(a))), !Array.isArray(f) || f.length === 0)
|
|
1478
|
+
return null;
|
|
1479
|
+
let r = f.reduce((a, u) => {
|
|
1480
|
+
if (Ie(u)) {
|
|
1481
|
+
let { west: m, east: n, south: g, north: l } = ne(u);
|
|
1482
|
+
a.push(pe([-180, g, n, l])), a.push(pe([m, g, 180, l]));
|
|
1483
|
+
} else
|
|
1484
|
+
a.push(pe(u));
|
|
1485
|
+
return a;
|
|
1486
|
+
}, []), s = null;
|
|
1487
|
+
if (r.length === 1 ? s = {
|
|
1488
|
+
type: "Polygon",
|
|
1489
|
+
coordinates: r[0]
|
|
1490
|
+
} : r.length > 1 && (s = {
|
|
1491
|
+
type: "MultiPolygon",
|
|
1492
|
+
coordinates: r
|
|
1493
|
+
}), s)
|
|
1494
|
+
return {
|
|
1495
|
+
type: "Feature",
|
|
1496
|
+
geometry: s,
|
|
1497
|
+
properties: {}
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
function J(f) {
|
|
1501
|
+
if (!Array.isArray(f) || ![4, 6].includes(f.length) || f.some((m) => typeof m != "number"))
|
|
1502
|
+
return !1;
|
|
1503
|
+
let { west: r, east: s, south: a, north: u } = ne(f);
|
|
1504
|
+
return a <= u && r >= -180 && r <= 180 && a >= -90 && s <= 180 && s >= -180 && u <= 90;
|
|
1505
|
+
}
|
|
1506
|
+
function Ie(f) {
|
|
1507
|
+
if (!J(f))
|
|
1508
|
+
return !1;
|
|
1509
|
+
let { west: r, east: s } = ne(f);
|
|
1510
|
+
return r > s;
|
|
1511
|
+
}
|
|
1512
|
+
function q(f) {
|
|
1513
|
+
return typeof f == "string" && f.length > 0;
|
|
1514
|
+
}
|
|
1515
|
+
function B(f) {
|
|
1516
|
+
return typeof f == "object" && f === Object(f) && !Array.isArray(f);
|
|
1517
|
+
}
|
|
1518
|
+
function ze(...f) {
|
|
1519
|
+
if (f = f.filter((r) => Array.isArray(r)), f.length > 1) {
|
|
1520
|
+
let r = Math.max(...f.map((a) => a.length)), s = [];
|
|
1521
|
+
for (let a = 0; a < r; a++)
|
|
1522
|
+
s.push(Object.assign({}, ...f.map((u) => u[a])));
|
|
1523
|
+
return s;
|
|
1524
|
+
} else if (f.length === 1)
|
|
1525
|
+
return f[0];
|
|
1526
|
+
return [];
|
|
1527
|
+
}
|
|
1528
|
+
function De(f) {
|
|
1529
|
+
switch (f) {
|
|
1530
|
+
case "int8":
|
|
1531
|
+
return -128;
|
|
1532
|
+
case "int16":
|
|
1533
|
+
return -32768;
|
|
1534
|
+
case "int32":
|
|
1535
|
+
return -2147483648;
|
|
1536
|
+
}
|
|
1537
|
+
return f.startsWith("u") ? 0 : null;
|
|
1538
|
+
}
|
|
1539
|
+
function Me(f) {
|
|
1540
|
+
switch (f) {
|
|
1541
|
+
case "int8":
|
|
1542
|
+
return 127;
|
|
1543
|
+
case "uint8":
|
|
1544
|
+
return 255;
|
|
1545
|
+
case "int16":
|
|
1546
|
+
return 32767;
|
|
1547
|
+
case "uint16":
|
|
1548
|
+
return 65535;
|
|
1549
|
+
case "int32":
|
|
1550
|
+
return 2147483647;
|
|
1551
|
+
case "uint32":
|
|
1552
|
+
return 4294967295;
|
|
1553
|
+
}
|
|
1554
|
+
return null;
|
|
1555
|
+
}
|
|
1556
|
+
class ue {
|
|
1557
|
+
constructor(r, s = {}, a = []) {
|
|
1558
|
+
if (!B(r))
|
|
1559
|
+
throw new Error("Given data is not an object");
|
|
1560
|
+
if (r instanceof ue) {
|
|
1561
|
+
for (let u of a)
|
|
1562
|
+
this[u] = r[u];
|
|
1563
|
+
r = r.toJSON();
|
|
1564
|
+
}
|
|
1565
|
+
this._keyMap = s, this._privateKeys = ["_keyMap", "_privateKeys"].concat(a);
|
|
1566
|
+
for (let u in r)
|
|
1567
|
+
typeof this[u] > "u" && (u in s ? this[u] = s[u](r[u], this) : this[u] = r[u]);
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* Check whether this given object is a STAC Item.
|
|
1571
|
+
*
|
|
1572
|
+
* @returns {boolean} `true` if the object is a STAC Item, `false` otherwise.
|
|
1573
|
+
*/
|
|
1574
|
+
isItem() {
|
|
1575
|
+
return this.type === "Feature";
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1578
|
+
* Check whether this given object is a STAC Catalog.
|
|
1579
|
+
*
|
|
1580
|
+
* @returns {boolean} `true` if the object is a STAC Catalog, `false` otherwise.
|
|
1581
|
+
*/
|
|
1582
|
+
isCatalog() {
|
|
1583
|
+
return this.type === "Catalog";
|
|
1584
|
+
}
|
|
1585
|
+
/**
|
|
1586
|
+
* Check whether this given object is "catalog-like", i.e. a Catalog or Collection.
|
|
1587
|
+
*
|
|
1588
|
+
* @returns {boolean} `true` if the object is a "catalog-like", `false` otherwise.
|
|
1589
|
+
*/
|
|
1590
|
+
isCatalogLike() {
|
|
1591
|
+
return this.isCatalog() || this.isCollection();
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* Check whether this given object is a STAC Collection.
|
|
1595
|
+
*
|
|
1596
|
+
* @returns {boolean} `true` if the object is a STAC Collection, `false` otherwise.
|
|
1597
|
+
*/
|
|
1598
|
+
isCollection() {
|
|
1599
|
+
return this.type === "Collection";
|
|
1600
|
+
}
|
|
1601
|
+
/**
|
|
1602
|
+
* Check whether this given object is a STAC ItemCollection.
|
|
1603
|
+
*
|
|
1604
|
+
* @returns {boolean} `true` if the object is a STAC ItemCollection, `false` otherwise.
|
|
1605
|
+
*/
|
|
1606
|
+
isItemCollection() {
|
|
1607
|
+
return this.type === "FeatureCollection";
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Check whether this given object is a STAC Collection of Collections (i.e. API Collections).
|
|
1611
|
+
*
|
|
1612
|
+
* @returns {boolean} `true` if the object is a STAC CollectionCollection, `false` otherwise.
|
|
1613
|
+
*/
|
|
1614
|
+
isCollectionCollection() {
|
|
1615
|
+
return !1;
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* Check whether this given object is a STAC Asset.
|
|
1619
|
+
*
|
|
1620
|
+
* @returns {boolean} `true` if the object is a STAC Asset, `false` otherwise.
|
|
1621
|
+
*/
|
|
1622
|
+
isAsset() {
|
|
1623
|
+
return !1;
|
|
1624
|
+
}
|
|
1625
|
+
/**
|
|
1626
|
+
* Check whether this given object is a STAC LInk.
|
|
1627
|
+
*
|
|
1628
|
+
* @returns {boolean} `true` if the object is a STAC Link, `false` otherwise.
|
|
1629
|
+
*/
|
|
1630
|
+
isLink() {
|
|
1631
|
+
return !1;
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* Returns the type of the STAC object.
|
|
1635
|
+
*
|
|
1636
|
+
* One of:
|
|
1637
|
+
* - Asset
|
|
1638
|
+
* - Catalog
|
|
1639
|
+
* - Collection
|
|
1640
|
+
* - CollectionCollection
|
|
1641
|
+
* - Item
|
|
1642
|
+
* - ItemCollection
|
|
1643
|
+
* - Link
|
|
1644
|
+
* @abstract
|
|
1645
|
+
* @returns {string}
|
|
1646
|
+
*/
|
|
1647
|
+
getObjectType() {
|
|
1648
|
+
}
|
|
1649
|
+
/**
|
|
1650
|
+
* Gets the absolute URL of the STAC entity (if provided explicitly or available from the self link).
|
|
1651
|
+
*
|
|
1652
|
+
* @returns {string|null} Absolute URL
|
|
1653
|
+
*/
|
|
1654
|
+
getAbsoluteUrl() {
|
|
1655
|
+
return null;
|
|
1656
|
+
}
|
|
1657
|
+
/**
|
|
1658
|
+
* Returns the metadata for the STAC entity.
|
|
1659
|
+
*
|
|
1660
|
+
* @param {string} field Field name
|
|
1661
|
+
* @returns {*}
|
|
1662
|
+
*/
|
|
1663
|
+
getMetadata(r) {
|
|
1664
|
+
return this[r];
|
|
1665
|
+
}
|
|
1666
|
+
/**
|
|
1667
|
+
* Returns a GeoJSON Feature or FeatureCollection for this STAC object.
|
|
1668
|
+
*
|
|
1669
|
+
* @returns {Object|null} GeoJSON object or `null`
|
|
1670
|
+
*/
|
|
1671
|
+
toGeoJSON() {
|
|
1672
|
+
return null;
|
|
1673
|
+
}
|
|
1674
|
+
/**
|
|
1675
|
+
* Returns a single bounding box for the STAC entity.
|
|
1676
|
+
*
|
|
1677
|
+
* @returns {BoundingBox|null}
|
|
1678
|
+
*/
|
|
1679
|
+
getBoundingBox() {
|
|
1680
|
+
return null;
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* Returns the center of the STAC entity.
|
|
1684
|
+
*
|
|
1685
|
+
* @returns {BoundingBox|null}
|
|
1686
|
+
*/
|
|
1687
|
+
getCenter() {
|
|
1688
|
+
return Be(this.getBoundingBox());
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Returns a list of bounding boxes for the STAC entity.
|
|
1692
|
+
*
|
|
1693
|
+
* @returns {Array.<BoundingBox>}
|
|
1694
|
+
*/
|
|
1695
|
+
getBoundingBoxes() {
|
|
1696
|
+
return [];
|
|
1697
|
+
}
|
|
1698
|
+
/**
|
|
1699
|
+
* Returns a plain object for JSON export.
|
|
1700
|
+
*
|
|
1701
|
+
* @returns {Object} Plain object
|
|
1702
|
+
*/
|
|
1703
|
+
toJSON() {
|
|
1704
|
+
let r = {};
|
|
1705
|
+
return Object.keys(this).forEach((s) => {
|
|
1706
|
+
if (typeof this[s] == "function" || this._privateKeys.includes(s))
|
|
1707
|
+
return;
|
|
1708
|
+
let a = this[s];
|
|
1709
|
+
if (s in this._keyMap) {
|
|
1710
|
+
let u = Array.isArray(a) ? [] : {};
|
|
1711
|
+
for (let m in a)
|
|
1712
|
+
u[m] = a[m].toJSON();
|
|
1713
|
+
a = u;
|
|
1714
|
+
}
|
|
1715
|
+
r[s] = a;
|
|
1716
|
+
}), r;
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
const He = "application/geo+json", Ne = [
|
|
1720
|
+
"application/json",
|
|
1721
|
+
He,
|
|
1722
|
+
"text/json"
|
|
1723
|
+
], we = [
|
|
1724
|
+
"image/gif",
|
|
1725
|
+
"image/jpeg",
|
|
1726
|
+
"image/apng",
|
|
1727
|
+
"image/png",
|
|
1728
|
+
"image/webp"
|
|
1729
|
+
], Se = [
|
|
1730
|
+
"image/tiff; application=geotiff; profile=cloud-optimized",
|
|
1731
|
+
"image/vnd.stac.geotiff; cloud-optimized=true"
|
|
1732
|
+
], Pe = [
|
|
1733
|
+
"application/geotiff",
|
|
1734
|
+
"image/tiff; application=geotiff",
|
|
1735
|
+
"image/vnd.stac.geotiff"
|
|
1736
|
+
].concat(Se);
|
|
1737
|
+
function ge(f, r, s = !1) {
|
|
1738
|
+
return Array.isArray(r) || (r = [r]), s && typeof f > "u" ? !0 : typeof f != "string" ? !1 : (r = r.map((a) => a.toLowerCase()), r.includes(f.toLowerCase()));
|
|
1739
|
+
}
|
|
1740
|
+
function We(f, r = !1) {
|
|
1741
|
+
return ge(f, Ne, r);
|
|
1742
|
+
}
|
|
1743
|
+
class je extends ue {
|
|
1744
|
+
constructor(r, s = null, a = {}, u = []) {
|
|
1745
|
+
super(r, a, ["_context"].concat(u)), this._context || (this._context = s);
|
|
1746
|
+
}
|
|
1747
|
+
/**
|
|
1748
|
+
* Gets the URL of the reference as absolute URL.
|
|
1749
|
+
*
|
|
1750
|
+
* @param {boolean} stringify
|
|
1751
|
+
* @returns {string|null}
|
|
1752
|
+
*/
|
|
1753
|
+
getAbsoluteUrl(r = !0) {
|
|
1754
|
+
return this._context ? me(this.href, this._context.getAbsoluteUrl(), r) : this.href.includes("://") ? this.href : null;
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* Returns the STAC entity that contains the reference.
|
|
1758
|
+
*
|
|
1759
|
+
* @returns {STAC|null}
|
|
1760
|
+
*/
|
|
1761
|
+
getContext() {
|
|
1762
|
+
return this._context;
|
|
1763
|
+
}
|
|
1764
|
+
/**
|
|
1765
|
+
* Checks whether a given reference can be displayed by a browser.
|
|
1766
|
+
*
|
|
1767
|
+
* A browser can usually display an image if it is a specific file format (e.g. JPEG, PNG, ...) and is served over HTTP(S).
|
|
1768
|
+
*
|
|
1769
|
+
* @returns {boolean} `true` if a browser can display the given reference, `false` otherwise.
|
|
1770
|
+
* @see {canBrowserDisplayImage}
|
|
1771
|
+
*/
|
|
1772
|
+
canBrowserDisplayImage(r = !1) {
|
|
1773
|
+
if (typeof this.href != "string")
|
|
1774
|
+
return !1;
|
|
1775
|
+
if (!r && typeof this.type > "u")
|
|
1776
|
+
return !1;
|
|
1777
|
+
let s = new de(this.href), a = s.protocol().toLowerCase(), u = s.suffix().toLowerCase();
|
|
1778
|
+
return q(a) && !xe.includes(a) ? !1 : q(this.type) && we.includes(this.type.toLowerCase()) ? !0 : !!(typeof this.type > "u" && q(u) && (u === "jpg" || we.includes("image/" + u)));
|
|
1779
|
+
}
|
|
1780
|
+
/**
|
|
1781
|
+
* Checks whether this asset is of a specific type.
|
|
1782
|
+
*
|
|
1783
|
+
* @param {string|Array.<string>} types One or more media types.
|
|
1784
|
+
* @returns {boolean} `true` is this asset is one of the given types, `false` otherwise.
|
|
1785
|
+
*/
|
|
1786
|
+
isType(r) {
|
|
1787
|
+
return q(this.type) && ge(this.type, r);
|
|
1788
|
+
}
|
|
1789
|
+
/**
|
|
1790
|
+
* Checks whether this asset is a GeoTiff (including COGs).
|
|
1791
|
+
*
|
|
1792
|
+
* @returns {boolean} `true` is this asset is a GeoTiff, `false` otherwise.
|
|
1793
|
+
*/
|
|
1794
|
+
isGeoTIFF() {
|
|
1795
|
+
return this.isType(Pe);
|
|
1796
|
+
}
|
|
1797
|
+
/**
|
|
1798
|
+
* Checks whether this asset is a COG (excluding pure GeoTiffs).
|
|
1799
|
+
*
|
|
1800
|
+
* @returns {boolean} `true` is this asset is a COG, `false` otherwise.
|
|
1801
|
+
*/
|
|
1802
|
+
isCOG() {
|
|
1803
|
+
return this.isType(Se);
|
|
1804
|
+
}
|
|
1805
|
+
/**
|
|
1806
|
+
* Checks whether the asset is accessible via HTTP or HTTPS.
|
|
1807
|
+
*
|
|
1808
|
+
* Returns `null` for item asset definitions, otherwise a `boolean` value.
|
|
1809
|
+
*
|
|
1810
|
+
* @returns {boolean|null} `true` is this asset is available via HTTP or HTTPS, `false` or `null` otherwise.
|
|
1811
|
+
*/
|
|
1812
|
+
isHTTP() {
|
|
1813
|
+
let s = this.getAbsoluteUrl(!1).protocol().toLowerCase();
|
|
1814
|
+
return q(s) && xe.includes(s);
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
class ye extends je {
|
|
1818
|
+
constructor(r, s = null) {
|
|
1819
|
+
super(r, s);
|
|
1820
|
+
}
|
|
1821
|
+
/**
|
|
1822
|
+
* Check whether this given object is a STAC LInk.
|
|
1823
|
+
*
|
|
1824
|
+
* @returns {boolean} `true` if the object is a STAC Link, `false` otherwise.
|
|
1825
|
+
*/
|
|
1826
|
+
isLink() {
|
|
1827
|
+
return !0;
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* Returns the type of the STAC object, here: 'Link'.
|
|
1831
|
+
*
|
|
1832
|
+
* @returns {string}
|
|
1833
|
+
*/
|
|
1834
|
+
getObjectType() {
|
|
1835
|
+
return "Link";
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* Converts an array of STAC Links into an array of stac-js Links.
|
|
1839
|
+
*
|
|
1840
|
+
* @param {Array.<Object>} links Links
|
|
1841
|
+
* @param {STAC|null} context The object that contains the links
|
|
1842
|
+
* @returns {Array.<Link>} Improved Links
|
|
1843
|
+
*/
|
|
1844
|
+
static fromLinks(r, s = null) {
|
|
1845
|
+
return Array.isArray(r) ? r.map((a) => B(a) ? new ye(a, s) : a) : [];
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
class $e extends ue {
|
|
1849
|
+
constructor(r, s = null, a = {}, u = []) {
|
|
1850
|
+
if (super(
|
|
1851
|
+
r,
|
|
1852
|
+
Object.assign({ links: ye.fromLinks }, a),
|
|
1853
|
+
["_url"].concat(u)
|
|
1854
|
+
), !this._url && (this._url = s, !this._url)) {
|
|
1855
|
+
let m = this.getSelfLink();
|
|
1856
|
+
m && (this._url = m.href);
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* Gets the absolute URL of the STAC entity (if provided explicitly or available from the self link).
|
|
1861
|
+
*
|
|
1862
|
+
* @returns {string|null} Absolute URL
|
|
1863
|
+
*/
|
|
1864
|
+
getAbsoluteUrl() {
|
|
1865
|
+
return this._url;
|
|
1866
|
+
}
|
|
1867
|
+
/**
|
|
1868
|
+
* Sets the absolute URL of the STAC entity.
|
|
1869
|
+
*
|
|
1870
|
+
* @param {string} url Absolute URL
|
|
1871
|
+
*/
|
|
1872
|
+
setAbsoluteUrl(r) {
|
|
1873
|
+
this._url = r;
|
|
1874
|
+
}
|
|
1875
|
+
/**
|
|
1876
|
+
*
|
|
1877
|
+
* @todo
|
|
1878
|
+
* @param {string} rel
|
|
1879
|
+
* @param {boolean} allowUndefined
|
|
1880
|
+
* @returns {Array.<Link>}
|
|
1881
|
+
*/
|
|
1882
|
+
getStacLinksWithRel(r, s = !0) {
|
|
1883
|
+
return this.getLinksWithRels([r]).filter((a) => We(a.type, s));
|
|
1884
|
+
}
|
|
1885
|
+
/**
|
|
1886
|
+
*
|
|
1887
|
+
* @todo
|
|
1888
|
+
* @param {string} rel
|
|
1889
|
+
* @param {boolean} allowUndefined
|
|
1890
|
+
* @returns {Link}
|
|
1891
|
+
*/
|
|
1892
|
+
getStacLinkWithRel(r, s = !0) {
|
|
1893
|
+
const a = this.getStacLinksWithRel(r, s);
|
|
1894
|
+
return a.length > 0 ? a[0] : null;
|
|
1895
|
+
}
|
|
1896
|
+
/**
|
|
1897
|
+
*
|
|
1898
|
+
* @todo
|
|
1899
|
+
* @returns {Array.<Link>}
|
|
1900
|
+
*/
|
|
1901
|
+
getLinks() {
|
|
1902
|
+
return Array.isArray(this.links) ? this.links.filter((r) => B(r) && q(r.href)) : [];
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
*
|
|
1906
|
+
* @todo
|
|
1907
|
+
* @param {string} rel
|
|
1908
|
+
* @returns {Link}
|
|
1909
|
+
*/
|
|
1910
|
+
getLinkWithRel(r) {
|
|
1911
|
+
return this.getLinks().find((s) => s.rel === r) || null;
|
|
1912
|
+
}
|
|
1913
|
+
/**
|
|
1914
|
+
*
|
|
1915
|
+
* @todo
|
|
1916
|
+
* @param {Array.<string>} rels
|
|
1917
|
+
* @returns {Array.<Link>}
|
|
1918
|
+
*/
|
|
1919
|
+
getLinksWithRels(r) {
|
|
1920
|
+
return this.getLinks().filter((s) => r.includes(s.rel));
|
|
1921
|
+
}
|
|
1922
|
+
/**
|
|
1923
|
+
*
|
|
1924
|
+
* @todo
|
|
1925
|
+
* @param {Array.<string>} rels
|
|
1926
|
+
* @returns {Array.<Link>}
|
|
1927
|
+
*/
|
|
1928
|
+
getLinksWithOtherRels(r) {
|
|
1929
|
+
return this.getLinks().filter((s) => !r.includes(s.rel));
|
|
1930
|
+
}
|
|
1931
|
+
/**
|
|
1932
|
+
* Returns the self link, if present.
|
|
1933
|
+
*
|
|
1934
|
+
* @returns {Link|null} The self link
|
|
1935
|
+
*/
|
|
1936
|
+
getSelfLink() {
|
|
1937
|
+
return this.getStacLinkWithRel("self");
|
|
1938
|
+
}
|
|
1939
|
+
/**
|
|
1940
|
+
* Returns the root link, if present.
|
|
1941
|
+
*
|
|
1942
|
+
* @returns {Link|null} The root link
|
|
1943
|
+
*/
|
|
1944
|
+
getRootLink() {
|
|
1945
|
+
return this.getStacLinkWithRel("root");
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Returns the parent link, if present.
|
|
1949
|
+
*
|
|
1950
|
+
* @returns {Link|null} The parent link
|
|
1951
|
+
*/
|
|
1952
|
+
getParentLink() {
|
|
1953
|
+
return this.getStacLinkWithRel("parent");
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
class re extends je {
|
|
1957
|
+
constructor(r, s = null, a = null) {
|
|
1958
|
+
super(r, a, {}, ["_key"]), this._key || (this._key = s);
|
|
1959
|
+
}
|
|
1960
|
+
/**
|
|
1961
|
+
* Returns the type of the STAC object, here: 'Asset'.
|
|
1962
|
+
*
|
|
1963
|
+
* @returns {string}
|
|
1964
|
+
*/
|
|
1965
|
+
getObjectType() {
|
|
1966
|
+
return "Asset";
|
|
1967
|
+
}
|
|
1968
|
+
/**
|
|
1969
|
+
* Check whether this given object is a STAC Asset.
|
|
1970
|
+
*
|
|
1971
|
+
* @returns {boolean} `true` if the object is a STAC Asset, `false` otherwise.
|
|
1972
|
+
*/
|
|
1973
|
+
isAsset() {
|
|
1974
|
+
return !0;
|
|
1975
|
+
}
|
|
1976
|
+
/**
|
|
1977
|
+
* Gets the URL of the asset as absolute URL.
|
|
1978
|
+
*
|
|
1979
|
+
* @param {boolean} stringify
|
|
1980
|
+
* @returns {URI|string|null}
|
|
1981
|
+
*/
|
|
1982
|
+
getAbsoluteUrl(r = !0) {
|
|
1983
|
+
return this.isDefinition() ? null : super.getAbsoluteUrl(r);
|
|
1984
|
+
}
|
|
1985
|
+
/**
|
|
1986
|
+
* Returns the key of the asset.
|
|
1987
|
+
*
|
|
1988
|
+
* @returns {string|null} Key of the asset
|
|
1989
|
+
*/
|
|
1990
|
+
getKey() {
|
|
1991
|
+
return this._key;
|
|
1992
|
+
}
|
|
1993
|
+
/**
|
|
1994
|
+
* Returns the metadata for the given field name.
|
|
1995
|
+
*
|
|
1996
|
+
* Returns the metadata from the asset, if present.
|
|
1997
|
+
* Otherwise, returns the metadata from calling `getMetadata()` on the STAC entity that contains the asset.
|
|
1998
|
+
*
|
|
1999
|
+
* @param {string} field Field name
|
|
2000
|
+
* @returns {*} The value of the field
|
|
2001
|
+
*/
|
|
2002
|
+
getMetadata(r) {
|
|
2003
|
+
if (typeof this[r] < "u")
|
|
2004
|
+
return this[r];
|
|
2005
|
+
if (this._context)
|
|
2006
|
+
return this._context.getMetadata(r);
|
|
2007
|
+
}
|
|
2008
|
+
/**
|
|
2009
|
+
* Returns the bands for the asset.
|
|
2010
|
+
*
|
|
2011
|
+
* This is usually a merge of eo:bands and raster:bands.
|
|
2012
|
+
*
|
|
2013
|
+
* @returns {Array.<Object>}
|
|
2014
|
+
*/
|
|
2015
|
+
getBands() {
|
|
2016
|
+
return ze(this["eo:bands"], this["raster:bands"]);
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* The RGB bands.
|
|
2020
|
+
*
|
|
2021
|
+
* @typedef {Object} VisualBands
|
|
2022
|
+
* @property {BandWithIndex} red The red band with its index
|
|
2023
|
+
* @property {BandWithIndex} green The green band with its index
|
|
2024
|
+
* @property {BandWithIndex} blue The blue band with its index
|
|
2025
|
+
*/
|
|
2026
|
+
/**
|
|
2027
|
+
* Find the RGB bands.
|
|
2028
|
+
*
|
|
2029
|
+
* @returns {VisualBands|null} Object with the RGB bands or null
|
|
2030
|
+
*/
|
|
2031
|
+
findVisualBands() {
|
|
2032
|
+
let r = {
|
|
2033
|
+
red: null,
|
|
2034
|
+
green: null,
|
|
2035
|
+
blue: null
|
|
2036
|
+
}, s = this.getBands();
|
|
2037
|
+
for (let u in s) {
|
|
2038
|
+
let m = parseInt(u, 10), n = s[m];
|
|
2039
|
+
B(n) && q(n.common_name) && n.common_name in r && (r[n.common_name] = { index: m, band: n });
|
|
2040
|
+
}
|
|
2041
|
+
return Object.values(r).every((u) => u !== null) ? r : null;
|
|
2042
|
+
}
|
|
2043
|
+
/**
|
|
2044
|
+
* Returns the band for the given criteria.
|
|
2045
|
+
*
|
|
2046
|
+
* Searches the given `property` (default: `name`) for the given value(s).
|
|
2047
|
+
*
|
|
2048
|
+
* @param {*} value A single value to find or a list of values to find one of.
|
|
2049
|
+
* @param {string} property The property in the bands to match against.
|
|
2050
|
+
* @param {Array.<Object>} bands For performance reasons you can provide a list of merged bands from `getBands()`.
|
|
2051
|
+
* @returns {BandWithIndex|null}
|
|
2052
|
+
* @see {getBands}
|
|
2053
|
+
*/
|
|
2054
|
+
findBand(r, s = "name", a = null) {
|
|
2055
|
+
Array.isArray(r) || (r = [r]), B(a) || (a = this.getBands());
|
|
2056
|
+
let u = a.findIndex((m) => B(m) && r.includes(m[s]));
|
|
2057
|
+
return u >= 0 ? { index: u, band: a[u] } : null;
|
|
2058
|
+
}
|
|
2059
|
+
/**
|
|
2060
|
+
* Returns the band for the given band index.
|
|
2061
|
+
*
|
|
2062
|
+
* Passes through the (band) objects.
|
|
2063
|
+
*
|
|
2064
|
+
* @param {number|Object} band
|
|
2065
|
+
* @returns {Object|null}
|
|
2066
|
+
* @see {getBands}
|
|
2067
|
+
*/
|
|
2068
|
+
getBand(r) {
|
|
2069
|
+
return B(r) || r === null ? r : this.getBands()[r] || null;
|
|
2070
|
+
}
|
|
2071
|
+
/**
|
|
2072
|
+
* Gets the reported minimum and maximum values for an asset (or band).
|
|
2073
|
+
*
|
|
2074
|
+
* Searches through different extension fields in raster, claasification, and file.
|
|
2075
|
+
*
|
|
2076
|
+
* @param {Object|number} band
|
|
2077
|
+
* @returns {Statistics}
|
|
2078
|
+
*/
|
|
2079
|
+
getMinMaxValues(r = null) {
|
|
2080
|
+
r = this.getBand(r);
|
|
2081
|
+
const s = {
|
|
2082
|
+
minimum: null,
|
|
2083
|
+
maximum: null
|
|
2084
|
+
}, a = (g) => g.minimum !== null && g.maximum !== null;
|
|
2085
|
+
if (r && (B(r.statistics) && (typeof r.statistics.minimum == "number" && (s.minimum = r.statistics.minimum), typeof r.statistics.maximum == "number" && (s.maximum = r.statistics.maximum), a(s)) || B(r.histogram) && (typeof r.histogram.min == "number" && (s.minimum = r.histogram.min), typeof r.histogram.max == "number" && (s.maximum = r.histogram.max), a(s))))
|
|
2086
|
+
return s;
|
|
2087
|
+
let u = this.getMetadata("classification:classes");
|
|
2088
|
+
if (Array.isArray(u) && (u.reduce((g, l) => (g.minimum = Math.min(g.minimum, l.value), g.maximum = Math.max(g.maximum, l.value), g), s), a(s)))
|
|
2089
|
+
return s;
|
|
2090
|
+
let m = this.getMetadata("file:values");
|
|
2091
|
+
if (Array.isArray(m) && (m.reduce((g, l) => (g.minimum = Math.min(g.minimum, ...l.values), g.maximum = Math.max(g.maximum, ...l.values), g), s), a(s)))
|
|
2092
|
+
return s;
|
|
2093
|
+
let n = B(r) && r.data_type || this.getMetadata("file:data_type");
|
|
2094
|
+
return n && (s.minimum = De(n), s.maximum = Me(n)), s;
|
|
2095
|
+
}
|
|
2096
|
+
/**
|
|
2097
|
+
* Gets the reported no-data values for an asset (or band).
|
|
2098
|
+
*
|
|
2099
|
+
* Searches through different extension fields in raster, claasification, and file.
|
|
2100
|
+
*
|
|
2101
|
+
* @param {Object|number} band
|
|
2102
|
+
* @returns {Array.<*>}
|
|
2103
|
+
*/
|
|
2104
|
+
getNoDataValues(r = null) {
|
|
2105
|
+
r = this.getBand(r);
|
|
2106
|
+
let s = [];
|
|
2107
|
+
if (r && typeof r.nodata < "u")
|
|
2108
|
+
s.push(r.nodata);
|
|
2109
|
+
else {
|
|
2110
|
+
let a = this.getMetadata("file:nodata");
|
|
2111
|
+
if (typeof a < "u")
|
|
2112
|
+
s = a;
|
|
2113
|
+
else {
|
|
2114
|
+
let u = this.getMetadata("classification:classes");
|
|
2115
|
+
Array.isArray(u) && (s = u.filter((m) => !!m.nodata).map((m) => m.value));
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
return s.map((a) => a === "nan" ? NaN : a === "+inf" ? 1 / 0 : a === "-inf" ? -1 / 0 : a);
|
|
2119
|
+
}
|
|
2120
|
+
/**
|
|
2121
|
+
* Returns whether this asset is an Item Asset definition (i.e. doesn't have an href) or not.
|
|
2122
|
+
*
|
|
2123
|
+
* @returns {boolean} `true` is this asset is an Item Asset definition, `false` otherwise.
|
|
2124
|
+
*/
|
|
2125
|
+
isDefinition() {
|
|
2126
|
+
return !q(this.href);
|
|
2127
|
+
}
|
|
2128
|
+
/**
|
|
2129
|
+
* Checks whether the asset is accessible via HTTP or HTTPS.
|
|
2130
|
+
*
|
|
2131
|
+
* Returns `null` for item asset definitions, otherwise a `boolean` value.
|
|
2132
|
+
*
|
|
2133
|
+
* @returns {boolean|null} `true` is this asset is available via HTTP or HTTPS, `false` or `null` otherwise.
|
|
2134
|
+
*/
|
|
2135
|
+
isHTTP() {
|
|
2136
|
+
return this.isDefinition() ? null : super.isHTTP();
|
|
2137
|
+
}
|
|
2138
|
+
/**
|
|
2139
|
+
* Checks whether this asset as a specific role assigned.
|
|
2140
|
+
*
|
|
2141
|
+
* @param {string|Array.<string>} roles One or more roles.
|
|
2142
|
+
* @param {boolean} includeKey Also returns `true` if the asset key equals to one of the given roles.
|
|
2143
|
+
* @returns {boolean} `true` is this asset is one of the given roles (or key), `false` otherwise.
|
|
2144
|
+
*/
|
|
2145
|
+
hasRole(r, s = !1) {
|
|
2146
|
+
return Array.isArray(r) || (r = [r]), s && r.includes(this.getKey()) ? !0 : Array.isArray(this.roles) && !!this.roles.find((a) => r.includes(a));
|
|
2147
|
+
}
|
|
2148
|
+
/**
|
|
2149
|
+
* Converts an object of STAC Assets into an object of stac-js Assets.
|
|
2150
|
+
*
|
|
2151
|
+
* @param {Object.<string, Object>} assets Assets
|
|
2152
|
+
* @param {Collection|Item|null} context The object that contains the assets
|
|
2153
|
+
* @returns {Object.<string, Asset>} Improved Assets
|
|
2154
|
+
*/
|
|
2155
|
+
static fromAssets(r, s = null) {
|
|
2156
|
+
let a = {};
|
|
2157
|
+
if (B(r))
|
|
2158
|
+
for (let u in r)
|
|
2159
|
+
a[u] = new re(r[u], u, s);
|
|
2160
|
+
return a;
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
class le extends $e {
|
|
2164
|
+
constructor(r, s = null, a = {}, u = []) {
|
|
2165
|
+
super(r, s, a, u);
|
|
2166
|
+
}
|
|
2167
|
+
/**
|
|
2168
|
+
* Returns a single temporal extent for the STAC entity.
|
|
2169
|
+
*
|
|
2170
|
+
* @returns {Array.<Date|null>|null}
|
|
2171
|
+
*/
|
|
2172
|
+
getTemporalExtent() {
|
|
2173
|
+
return null;
|
|
2174
|
+
}
|
|
2175
|
+
/**
|
|
2176
|
+
* Returns the temporal extent(s) for the STAC entity.
|
|
2177
|
+
*
|
|
2178
|
+
* @returns {Array.<Array.<Date|null>>}
|
|
2179
|
+
*/
|
|
2180
|
+
getTemporalExtents() {
|
|
2181
|
+
return [];
|
|
2182
|
+
}
|
|
2183
|
+
/**
|
|
2184
|
+
* Get the icons from the links in a STAC entity.
|
|
2185
|
+
*
|
|
2186
|
+
* @param {boolean} allowUndefined
|
|
2187
|
+
* @returns {Array.<Link>}
|
|
2188
|
+
*/
|
|
2189
|
+
getIcons(r = !0) {
|
|
2190
|
+
return this.getLinksWithRels(["icon"]).filter((s) => s.canBrowserDisplayImage(r));
|
|
2191
|
+
}
|
|
2192
|
+
/**
|
|
2193
|
+
* Get the thumbnails from the assets and links in a STAC entity.
|
|
2194
|
+
*
|
|
2195
|
+
* @param {boolean} browserOnly - Return only images that can be shown in a browser natively (PNG/JPG/GIF/WEBP + HTTP/S).
|
|
2196
|
+
* @param {string|null} prefer - If not `null` (default), prefers a role over the other. Either `thumbnail` or `overview`.
|
|
2197
|
+
* @returns {Array.<STACReference>} Asset or Link
|
|
2198
|
+
*/
|
|
2199
|
+
getThumbnails(r = !0, s = null) {
|
|
2200
|
+
let a = this.getAssetsWithRoles(["thumbnail", "overview"], !0);
|
|
2201
|
+
if (a.length === 0 && (a = this.getLinksWithRels(["preview"])), r && (a = a.filter((u) => u.canBrowserDisplayImage())), s && a.length > 1) {
|
|
2202
|
+
let u = (m) => Array.isArray(m.roles) && m.roles.includes(s) || m.getKey() === s;
|
|
2203
|
+
a = a.filter(u).concat(a.filter((m) => !u(m)));
|
|
2204
|
+
}
|
|
2205
|
+
return a;
|
|
2206
|
+
}
|
|
2207
|
+
/**
|
|
2208
|
+
* Determines the default GeoTiff asset for visualization.
|
|
2209
|
+
*
|
|
2210
|
+
* @param {boolean} httpOnly Return only GeoTiffs that can be accessed via HTTP(S)
|
|
2211
|
+
* @param {boolean} cogOnly Return only COGs
|
|
2212
|
+
* @returns {Asset} Default GeoTiff asset
|
|
2213
|
+
* @see {rankGeoTIFFs}
|
|
2214
|
+
*/
|
|
2215
|
+
getDefaultGeoTIFF(r = !0, s = !1) {
|
|
2216
|
+
return this.rankGeoTIFFs(r, s)[0]?.asset;
|
|
2217
|
+
}
|
|
2218
|
+
/**
|
|
2219
|
+
* Object with an asset and the corresponding score.
|
|
2220
|
+
*
|
|
2221
|
+
* @typedef {Object} AssetScore
|
|
2222
|
+
* @property {Asset} asset
|
|
2223
|
+
* @property {number} score
|
|
2224
|
+
*/
|
|
2225
|
+
/**
|
|
2226
|
+
* A function that can influence the score.
|
|
2227
|
+
*
|
|
2228
|
+
* Returns a relative addition to the score.
|
|
2229
|
+
* Negative values subtract from the score.
|
|
2230
|
+
*
|
|
2231
|
+
* @callback STAC~rankGeoTIFFs
|
|
2232
|
+
* @param {Asset} asset The asset to calculate the score for.
|
|
2233
|
+
*/
|
|
2234
|
+
/**
|
|
2235
|
+
* Ranks the GeoTiff assets for visualization purposes.
|
|
2236
|
+
*
|
|
2237
|
+
* The score factors can be found below:
|
|
2238
|
+
* - Roles/Keys (by default) - if multiple roles apply only the highest score is added:
|
|
2239
|
+
* - overview => +3
|
|
2240
|
+
* - thumbnail => +2
|
|
2241
|
+
* - visual => +2
|
|
2242
|
+
* - data => +1
|
|
2243
|
+
* - none of the above => no change
|
|
2244
|
+
* - Other factors:
|
|
2245
|
+
* - media type is COG: +2 (if cogOnly = false)
|
|
2246
|
+
* - has RGB bands: +1
|
|
2247
|
+
* - additionalCriteria: +/- a custom value
|
|
2248
|
+
*
|
|
2249
|
+
* @param {boolean} httpOnly Return only GeoTiffs that can be accessed via HTTP(S)
|
|
2250
|
+
* @param {boolean} cogOnly Return only COGs
|
|
2251
|
+
* @param {Object.<string, number>} roleScores Roles (and keys) considered for the scoring. They key is the role name, the value is the score. Higher is better. Defaults to the roles and scores detailed above. An empty object disables role-based scoring.
|
|
2252
|
+
* @param {STAC~rankGeoTIFFs} additionalCriteria A function to customize the score by adding/subtracting.
|
|
2253
|
+
* @returns {Array.<AssetScore>} GeoTiff assets sorted by score in descending order.
|
|
2254
|
+
*/
|
|
2255
|
+
rankGeoTIFFs(r = !0, s = !1, a = null, u = null) {
|
|
2256
|
+
B(a) || (a = {
|
|
2257
|
+
data: 1,
|
|
2258
|
+
visual: 2,
|
|
2259
|
+
thumbnail: 2,
|
|
2260
|
+
overview: 3
|
|
2261
|
+
});
|
|
2262
|
+
let m = [], n = this.getAssetsByTypes(Pe);
|
|
2263
|
+
r && (n = n.filter((l) => l.isHTTP() && (!s || l.isCOG())));
|
|
2264
|
+
let g = Object.entries(a);
|
|
2265
|
+
for (let l of n) {
|
|
2266
|
+
let x = 0;
|
|
2267
|
+
if (g.length > 0) {
|
|
2268
|
+
let k = g.filter(([b]) => l.hasRole(b, !0)).map(([, b]) => b);
|
|
2269
|
+
k.length > 0 && (x += Math.max(...k));
|
|
2270
|
+
}
|
|
2271
|
+
!s && l.isCOG() && (x += 2), l.findVisualBands() && (x += 1), typeof u == "function" && (x += u(l)), m.push({ asset: l, score: x });
|
|
2272
|
+
}
|
|
2273
|
+
return m.sort((l, x) => x.score - l.score), m;
|
|
2274
|
+
}
|
|
2275
|
+
/**
|
|
2276
|
+
* The single-band assets for RGB composites.
|
|
2277
|
+
*
|
|
2278
|
+
* @typedef {Object} VisualAssets
|
|
2279
|
+
* @property {BandWithIndex} red The red band with its index
|
|
2280
|
+
* @property {BandWithIndex} green The green band with its index
|
|
2281
|
+
* @property {BandWithIndex} blue The blue band with its index
|
|
2282
|
+
*/
|
|
2283
|
+
/**
|
|
2284
|
+
* Find the single-band assets for RGB.
|
|
2285
|
+
*
|
|
2286
|
+
* @returns {VisualAssets|null} Object with the RGB bands or null
|
|
2287
|
+
*/
|
|
2288
|
+
findVisualAssets() {
|
|
2289
|
+
let r = {
|
|
2290
|
+
red: null,
|
|
2291
|
+
green: null,
|
|
2292
|
+
blue: null
|
|
2293
|
+
}, s = Object.keys(r), a = this.getAssets();
|
|
2294
|
+
for (let m of a) {
|
|
2295
|
+
let n = m.getBands();
|
|
2296
|
+
if (n.length !== 1)
|
|
2297
|
+
continue;
|
|
2298
|
+
let g = m.findBand(s, "common_name", n);
|
|
2299
|
+
g && (r[g.band.common_name] = m);
|
|
2300
|
+
}
|
|
2301
|
+
return Object.values(r).every((m) => m !== null) ? r : null;
|
|
2302
|
+
}
|
|
2303
|
+
/**
|
|
2304
|
+
*
|
|
2305
|
+
* @todo
|
|
2306
|
+
* @param {string} key
|
|
2307
|
+
* @returns {Asset|null}
|
|
2308
|
+
*/
|
|
2309
|
+
getAsset(r) {
|
|
2310
|
+
return B(this.assets) && this.assets[r] || null;
|
|
2311
|
+
}
|
|
2312
|
+
/**
|
|
2313
|
+
*
|
|
2314
|
+
* @todo
|
|
2315
|
+
* @returns {Array.<Asset>}
|
|
2316
|
+
*/
|
|
2317
|
+
getAssets() {
|
|
2318
|
+
return B(this.assets) ? Object.values(this.assets) : [];
|
|
2319
|
+
}
|
|
2320
|
+
/**
|
|
2321
|
+
* Returns all assets that contain at least one of the given roles.
|
|
2322
|
+
*
|
|
2323
|
+
* @param {string|Array.<string>} roles One or more roles.
|
|
2324
|
+
* @param {boolean} includeKey Also returns `true` if the asset key equals to one of the given roles.
|
|
2325
|
+
* @returns {Array.<Asset>} The assets with the given roles.
|
|
2326
|
+
*/
|
|
2327
|
+
getAssetsWithRoles(r, s = !1) {
|
|
2328
|
+
return this.getAssets().filter((a) => a.hasRole(r, s));
|
|
2329
|
+
}
|
|
2330
|
+
/**
|
|
2331
|
+
*
|
|
2332
|
+
* @todo
|
|
2333
|
+
* @param {string} role
|
|
2334
|
+
* @param {boolean} includeKey
|
|
2335
|
+
* @returns {Asset|null}
|
|
2336
|
+
*/
|
|
2337
|
+
getAssetWithRole(r, s = !1) {
|
|
2338
|
+
return this.getAssetsWithRoles([r], s)[0] || null;
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
*
|
|
2342
|
+
* @todo
|
|
2343
|
+
* @param {Array.<string>} types
|
|
2344
|
+
* @returns {Array.<Asset>}
|
|
2345
|
+
*/
|
|
2346
|
+
getAssetsByTypes(r) {
|
|
2347
|
+
return this.getAssets().filter((s) => ge(s.type, r));
|
|
2348
|
+
}
|
|
2349
|
+
/**
|
|
2350
|
+
*
|
|
2351
|
+
* @todo
|
|
2352
|
+
* @param {*} other
|
|
2353
|
+
* @returns {boolean}
|
|
2354
|
+
*/
|
|
2355
|
+
equals(r) {
|
|
2356
|
+
return this === r ? !0 : !(r instanceof le) || this.getObjectType() !== r.getObjectType() ? !1 : !!(this.id && this.id === r.id);
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
class Ve extends le {
|
|
2360
|
+
constructor(r, s = null, a = {}, u = []) {
|
|
2361
|
+
super(r, s, a, u);
|
|
2362
|
+
}
|
|
2363
|
+
/**
|
|
2364
|
+
* Returns the type of the STAC object, here: 'Catalog' or 'Collection'.
|
|
2365
|
+
*
|
|
2366
|
+
* @returns {string}
|
|
2367
|
+
*/
|
|
2368
|
+
getObjectType() {
|
|
2369
|
+
return this.type;
|
|
2370
|
+
}
|
|
2371
|
+
/**
|
|
2372
|
+
* Returns the search link, if present.
|
|
2373
|
+
*
|
|
2374
|
+
* If a specific method is provied, can exclude other methods from being returned.
|
|
2375
|
+
*
|
|
2376
|
+
* @returns {Link|null} The search link
|
|
2377
|
+
*/
|
|
2378
|
+
getSearchLink(r = null) {
|
|
2379
|
+
let s = this.getStacLinksWithRel("search");
|
|
2380
|
+
return r ? s[0] || null : s.find((a) => a.method === r || !r && !a.method) || null;
|
|
2381
|
+
}
|
|
2382
|
+
/**
|
|
2383
|
+
* Returns the link for API collections, if present.
|
|
2384
|
+
*
|
|
2385
|
+
* @returns {Link|null} The API collections link
|
|
2386
|
+
*/
|
|
2387
|
+
getApiCollectionsLink() {
|
|
2388
|
+
return this.getStacLinkWithRel("data");
|
|
2389
|
+
}
|
|
2390
|
+
/**
|
|
2391
|
+
* Returns the link for API items, if present.
|
|
2392
|
+
*
|
|
2393
|
+
* @returns {Link|null} The API items link
|
|
2394
|
+
*/
|
|
2395
|
+
getApiItemsLink() {
|
|
2396
|
+
return this.getStacLinkWithRel("items");
|
|
2397
|
+
}
|
|
2398
|
+
/**
|
|
2399
|
+
* Returns all child links.
|
|
2400
|
+
*
|
|
2401
|
+
* @returns {Array.<Link>} The child links
|
|
2402
|
+
*/
|
|
2403
|
+
getChildLinks() {
|
|
2404
|
+
return this.getStacLinksWithRel("child");
|
|
2405
|
+
}
|
|
2406
|
+
/**
|
|
2407
|
+
* Returns all item links.
|
|
2408
|
+
*
|
|
2409
|
+
* @returns {Array.<Link>} The child links
|
|
2410
|
+
*/
|
|
2411
|
+
getItemLinks() {
|
|
2412
|
+
return this.getStacLinksWithRel("item");
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
function te(f) {
|
|
2416
|
+
if (q(f) && f.length >= 10)
|
|
2417
|
+
try {
|
|
2418
|
+
let s = f.match(/^(-?\d{1,})-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(?:\.(\d*))?(?:Z|[+-]00:00)?$/i).slice(1).map((a) => parseInt(a, 10));
|
|
2419
|
+
return new Date(Date.UTC(s[0], s[1] - 1, s[2], s[3], s[4], s[5], s[6] || 0));
|
|
2420
|
+
} catch {
|
|
2421
|
+
return null;
|
|
2422
|
+
}
|
|
2423
|
+
return null;
|
|
2424
|
+
}
|
|
2425
|
+
function Ge(f, r) {
|
|
2426
|
+
return new Date(f.valueOf() + (r - f) / 2);
|
|
2427
|
+
}
|
|
2428
|
+
class ke extends Ve {
|
|
2429
|
+
constructor(r, s = null) {
|
|
2430
|
+
const a = {
|
|
2431
|
+
assets: re.fromAssets,
|
|
2432
|
+
item_assets: re.fromAssets
|
|
2433
|
+
};
|
|
2434
|
+
super(r, s, a);
|
|
2435
|
+
}
|
|
2436
|
+
/**
|
|
2437
|
+
* Returns a GeoJSON Feature for this STAC Collection.
|
|
2438
|
+
*
|
|
2439
|
+
* The Feature contains a Polygon or MultiPolygon based on the given number of valid bounding boxes.
|
|
2440
|
+
*
|
|
2441
|
+
* @returns {Object|null} GeoJSON object or `null`
|
|
2442
|
+
*/
|
|
2443
|
+
toGeoJSON() {
|
|
2444
|
+
let r = qe(this.getBoundingBoxes());
|
|
2445
|
+
return r && (r.id = this.id), r;
|
|
2446
|
+
}
|
|
2447
|
+
/**
|
|
2448
|
+
* Returns a single union bounding box for the whole collection.
|
|
2449
|
+
*
|
|
2450
|
+
* @returns {BoundingBox|null}
|
|
2451
|
+
*/
|
|
2452
|
+
getBoundingBox() {
|
|
2453
|
+
let r = this.getRawBoundingBoxes();
|
|
2454
|
+
return r.length > 0 && J(r[0]) ? r[0] : null;
|
|
2455
|
+
}
|
|
2456
|
+
/**
|
|
2457
|
+
* Returns the individual bounding boxes for the collection,
|
|
2458
|
+
* without the union bounding box if multiple bounding boxes are given.
|
|
2459
|
+
*
|
|
2460
|
+
* @returns {Array.<BoundingBox>}
|
|
2461
|
+
*/
|
|
2462
|
+
getBoundingBoxes() {
|
|
2463
|
+
let r = this.getRawBoundingBoxes();
|
|
2464
|
+
return r.length === 1 && J(r[0]) ? r : r.length > 1 ? r.filter((s, a) => a > 0 && J(s)) : [];
|
|
2465
|
+
}
|
|
2466
|
+
/**
|
|
2467
|
+
* Returns all bounding boxes from the collection, including the union bounding box.
|
|
2468
|
+
*
|
|
2469
|
+
* @returns {Array.<BoundingBox>}
|
|
2470
|
+
*/
|
|
2471
|
+
getRawBoundingBoxes() {
|
|
2472
|
+
let r = this.extent?.spatial?.bbox;
|
|
2473
|
+
return Array.isArray(r) && r.length > 0 ? r : [];
|
|
2474
|
+
}
|
|
2475
|
+
/**
|
|
2476
|
+
* Returns a single temporal extent for the STAC Collection.
|
|
2477
|
+
*
|
|
2478
|
+
* @returns {Array.<Date|null>|null}
|
|
2479
|
+
*/
|
|
2480
|
+
getTemporalExtent() {
|
|
2481
|
+
return this.getTemporalExtents()[0] || null;
|
|
2482
|
+
}
|
|
2483
|
+
/**
|
|
2484
|
+
* Returns the temporal extent(s) for the STAC Collection.
|
|
2485
|
+
*
|
|
2486
|
+
* @returns {Array.<Array.<Date|null>>}
|
|
2487
|
+
*/
|
|
2488
|
+
getTemporalExtents() {
|
|
2489
|
+
let r = this.extent?.temporal?.interval;
|
|
2490
|
+
return Array.isArray(r) && r.length > 0 ? r.filter((s) => Array.isArray(s) && (q(s[0]) || q(s[1]))).map((s) => s.map((a) => te(a))) : [];
|
|
2491
|
+
}
|
|
2492
|
+
/**
|
|
2493
|
+
* Returns metadata from the Collection summaries for the given field name.
|
|
2494
|
+
*
|
|
2495
|
+
* @param {string} field Field name
|
|
2496
|
+
* @returns {Array.<*>|Object} The value of the field
|
|
2497
|
+
*/
|
|
2498
|
+
getSummary(r) {
|
|
2499
|
+
return this.summaries[r];
|
|
2500
|
+
}
|
|
2501
|
+
/**
|
|
2502
|
+
* Returns the bands.
|
|
2503
|
+
*
|
|
2504
|
+
* This is usually a merge of eo:bands and raster:bands from the summaries.
|
|
2505
|
+
*
|
|
2506
|
+
* @returns {Array.<Object>}
|
|
2507
|
+
*/
|
|
2508
|
+
getBands() {
|
|
2509
|
+
let r = this.getSummary("eo:bands"), s = this.getSummary("raster:bands"), a = [r, s].filter((u) => Array.isArray(u));
|
|
2510
|
+
return a.length >= 2 ? ze(...a) : a.length === 1 ? a[0] : [];
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
class Je extends le {
|
|
2514
|
+
constructor(r, s = null) {
|
|
2515
|
+
super(r, s, { assets: re.fromAssets });
|
|
2516
|
+
}
|
|
2517
|
+
/**
|
|
2518
|
+
* Returns the type of the STAC object, here: 'Item'.
|
|
2519
|
+
*
|
|
2520
|
+
* @returns {string}
|
|
2521
|
+
*/
|
|
2522
|
+
getObjectType() {
|
|
2523
|
+
return "Item";
|
|
2524
|
+
}
|
|
2525
|
+
/**
|
|
2526
|
+
* Returns a GeoJSON Feature for this STAC object.
|
|
2527
|
+
*
|
|
2528
|
+
* @returns {Object|null} GeoJSON object or `null`
|
|
2529
|
+
*/
|
|
2530
|
+
toGeoJSON() {
|
|
2531
|
+
return this.toJSON();
|
|
2532
|
+
}
|
|
2533
|
+
/**
|
|
2534
|
+
* Returns a single bounding box for the item.
|
|
2535
|
+
*
|
|
2536
|
+
* @returns {BoundingBox|null}
|
|
2537
|
+
*/
|
|
2538
|
+
getBoundingBox() {
|
|
2539
|
+
return J(this.bbox) ? this.bbox : null;
|
|
2540
|
+
}
|
|
2541
|
+
/**
|
|
2542
|
+
* Returns bounding boxes for the item.
|
|
2543
|
+
*
|
|
2544
|
+
* @returns {Array.<BoundingBox>}
|
|
2545
|
+
*/
|
|
2546
|
+
getBoundingBoxes() {
|
|
2547
|
+
return J(this.bbox) ? [this.bbox] : [];
|
|
2548
|
+
}
|
|
2549
|
+
/**
|
|
2550
|
+
* Returns a datetime for the STAC Item.
|
|
2551
|
+
*
|
|
2552
|
+
* If no datetime but start or end datetime are specified, computes a datetime from them.
|
|
2553
|
+
*
|
|
2554
|
+
* @returns {Date|null}
|
|
2555
|
+
*/
|
|
2556
|
+
getDateTime() {
|
|
2557
|
+
let r = te(this.properties.datetime);
|
|
2558
|
+
if (!r) {
|
|
2559
|
+
let s = te(this.properties.start_datetime), a = te(this.properties.end_datetime);
|
|
2560
|
+
return s && a ? Ge(s, a) : s || a;
|
|
2561
|
+
}
|
|
2562
|
+
return r;
|
|
2563
|
+
}
|
|
2564
|
+
/**
|
|
2565
|
+
* Returns a single temporal extent for the STAC Item.
|
|
2566
|
+
*
|
|
2567
|
+
* @returns {Array.<Date|null>|null}
|
|
2568
|
+
*/
|
|
2569
|
+
getTemporalExtent() {
|
|
2570
|
+
return this.getTemporalExtents()[0] || null;
|
|
2571
|
+
}
|
|
2572
|
+
/**
|
|
2573
|
+
* Returns the temporal extent(s) for the STAC Item.
|
|
2574
|
+
*
|
|
2575
|
+
* @returns {Array.<Array.<Date|null>>}
|
|
2576
|
+
*/
|
|
2577
|
+
getTemporalExtents() {
|
|
2578
|
+
let r = [];
|
|
2579
|
+
return q(this.properties.start_datetime) || q(this.properties.end_datetime) ? r = [[this.properties.start_datetime || null, this.properties.end_datetime || null]] : q(this.properties.datetime) && (r = [[this.properties.datetime, this.properties.datetime]]), r.map((s) => s.map((a) => te(a)));
|
|
2580
|
+
}
|
|
2581
|
+
/**
|
|
2582
|
+
* Returns metadata from the Item properties for the given field name.
|
|
2583
|
+
*
|
|
2584
|
+
* @param {string} field Field name
|
|
2585
|
+
* @returns {*} The value of the field
|
|
2586
|
+
*/
|
|
2587
|
+
getMetadata(r) {
|
|
2588
|
+
return this.properties[r];
|
|
2589
|
+
}
|
|
2590
|
+
/**
|
|
2591
|
+
* Returns the bands.
|
|
2592
|
+
*
|
|
2593
|
+
* @todo Merge bands from assets
|
|
2594
|
+
* @returns {Array.<Object>}
|
|
2595
|
+
*/
|
|
2596
|
+
getBands() {
|
|
2597
|
+
let r = this.getMetadata("eo:bands");
|
|
2598
|
+
return Array.isArray(r) ? r : [];
|
|
2599
|
+
}
|
|
2600
|
+
/**
|
|
2601
|
+
* Returns the collection link, if present.
|
|
2602
|
+
*
|
|
2603
|
+
* @returns {Link|null} The collection link
|
|
2604
|
+
*/
|
|
2605
|
+
getCollectionLink() {
|
|
2606
|
+
return this.getStacLinkWithRel("collection");
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
function Ze(f) {
|
|
2610
|
+
const r = [];
|
|
2611
|
+
return f.forEach((a) => {
|
|
2612
|
+
if (a.rel === "item" && "latlng" in a) {
|
|
2613
|
+
const [u, m] = (
|
|
2614
|
+
/** @type {string} */
|
|
2615
|
+
a.latlng.split(",").map((n) => Number(n))
|
|
2616
|
+
);
|
|
2617
|
+
r.push({
|
|
2618
|
+
type: "Feature",
|
|
2619
|
+
geometry: {
|
|
2620
|
+
type: "Point",
|
|
2621
|
+
coordinates: [m, u]
|
|
2622
|
+
}
|
|
2623
|
+
});
|
|
2624
|
+
}
|
|
2625
|
+
}), {
|
|
2626
|
+
type: "FeatureCollection",
|
|
2627
|
+
crs: {
|
|
2628
|
+
type: "name",
|
|
2629
|
+
properties: {
|
|
2630
|
+
name: "EPSG:4326"
|
|
2631
|
+
}
|
|
2632
|
+
},
|
|
2633
|
+
features: r
|
|
2634
|
+
};
|
|
2635
|
+
}
|
|
2636
|
+
function Ye(f, r) {
|
|
2637
|
+
const s = [];
|
|
2638
|
+
return f?.links && f?.links[1].rel === "item" ? s.push(r) : f?.links[1].rel === "child" && f.links.forEach((a) => {
|
|
2639
|
+
a.rel === "child" && s.push(me(a.href, r));
|
|
2640
|
+
}), s;
|
|
2641
|
+
}
|
|
2642
|
+
class et {
|
|
2643
|
+
/** @type {string} */
|
|
2644
|
+
#t = "";
|
|
2645
|
+
/** @type {import("stac-ts").StacCollection | undefined} */
|
|
2646
|
+
#e;
|
|
2647
|
+
/**
|
|
2648
|
+
* @type {import("stac-ts").StacLink
|
|
2649
|
+
* | import("stac-ts").StacItem
|
|
2650
|
+
* | undefined}
|
|
2651
|
+
*/
|
|
2652
|
+
selectedItem;
|
|
2653
|
+
/** @param {string} collectionUrl */
|
|
2654
|
+
constructor(r) {
|
|
2655
|
+
this.#t = r;
|
|
2656
|
+
}
|
|
2657
|
+
/**
|
|
2658
|
+
* @async
|
|
2659
|
+
* @param {any} item
|
|
2660
|
+
* @returns
|
|
2661
|
+
*/
|
|
2662
|
+
createLayersJson = async (r = null) => {
|
|
2663
|
+
let s, a, u = [
|
|
2664
|
+
/*{
|
|
2665
|
+
type: "Tile",
|
|
2666
|
+
properties: {
|
|
2667
|
+
id: "OSM",
|
|
2668
|
+
},
|
|
2669
|
+
source: {
|
|
2670
|
+
type: "OSM",
|
|
2671
|
+
},
|
|
2672
|
+
},*/
|
|
2673
|
+
];
|
|
2674
|
+
if (this.#e || (a = await (await Ce.get(this.#t)).data, this.#e = new ke(a)), a && a.endpointtype === "GeoDB") {
|
|
2675
|
+
const m = Ze(a.links);
|
|
2676
|
+
return u.unshift({
|
|
2677
|
+
type: "Vector",
|
|
2678
|
+
properties: {
|
|
2679
|
+
id: a.id
|
|
2680
|
+
},
|
|
2681
|
+
source: {
|
|
2682
|
+
type: "Vector",
|
|
2683
|
+
url: "data:," + encodeURIComponent(JSON.stringify(m)),
|
|
2684
|
+
format: "GeoJSON"
|
|
2685
|
+
},
|
|
2686
|
+
style: {
|
|
2687
|
+
"circle-radius": 5,
|
|
2688
|
+
"circle-fill-color": "#00417077",
|
|
2689
|
+
"circle-stroke-color": "#004170",
|
|
2690
|
+
"fill-color": "#00417077",
|
|
2691
|
+
"stroke-color": "#004170"
|
|
2692
|
+
}
|
|
2693
|
+
}), u;
|
|
2694
|
+
} else if (r instanceof Date ? (s = this.getItems()?.sort((n, g) => {
|
|
2695
|
+
const l = Math.abs(
|
|
2696
|
+
new Date(
|
|
2697
|
+
/** @type {number} */
|
|
2698
|
+
n.datetime
|
|
2699
|
+
).getTime() - r.getTime()
|
|
2700
|
+
), x = Math.abs(
|
|
2701
|
+
new Date(
|
|
2702
|
+
/** @type {number} */
|
|
2703
|
+
g.datetime
|
|
2704
|
+
).getTime() - r.getTime()
|
|
2705
|
+
);
|
|
2706
|
+
return l - x;
|
|
2707
|
+
})[0], this.selectedItem = s) : s = r, a = await (await fetch(
|
|
2708
|
+
s ? me(s.href, this.#t) : this.#t
|
|
2709
|
+
)).json(), s) {
|
|
2710
|
+
const n = new Je(a);
|
|
2711
|
+
return this.selectedItem = n, u.unshift(...this.buildJsonArray(n)), u;
|
|
2712
|
+
} else {
|
|
2713
|
+
this.#e = new ke(a);
|
|
2714
|
+
const n = this.getItems();
|
|
2715
|
+
return this.selectedItem = n?.[n.length - 1], this.selectedItem && (u = await this.createLayersJson(this.selectedItem)), [];
|
|
2716
|
+
}
|
|
2717
|
+
};
|
|
2718
|
+
/** @param {import("stac-ts").StacItem} item */
|
|
2719
|
+
buildJsonArray(r) {
|
|
2720
|
+
const s = [], a = r.links.find((u) => u.rel === "wms");
|
|
2721
|
+
if (a) {
|
|
2722
|
+
let u = {
|
|
2723
|
+
type: "Tile",
|
|
2724
|
+
properties: {
|
|
2725
|
+
id: r.id
|
|
2726
|
+
},
|
|
2727
|
+
source: {
|
|
2728
|
+
// if no projection information is provided we should
|
|
2729
|
+
// assume one, else for WMS requests it will try to get
|
|
2730
|
+
// the map projection that might not be supported
|
|
2731
|
+
// projection: projDef ? projDef : "EPSG:4326",
|
|
2732
|
+
type: "TileWMS",
|
|
2733
|
+
url: a.href,
|
|
2734
|
+
params: {
|
|
2735
|
+
LAYERS: a["wms:layers"],
|
|
2736
|
+
TILED: !0
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
};
|
|
2740
|
+
"wms:dimensions" in a && (u.source.params.time = a["wms:dimensions"]), s.push(u);
|
|
2741
|
+
} else r.links.find((u) => u.rel === "wmts" || u.rel === "xyz") ? s.push({
|
|
2742
|
+
type: "STAC",
|
|
2743
|
+
displayWebMapLink: !0,
|
|
2744
|
+
displayFootprint: !1,
|
|
2745
|
+
data: r,
|
|
2746
|
+
properties: {
|
|
2747
|
+
id: r.id
|
|
2748
|
+
}
|
|
2749
|
+
}) : s.push({
|
|
2750
|
+
type: "Vector",
|
|
2751
|
+
source: {
|
|
2752
|
+
type: "Vector",
|
|
2753
|
+
url: "data:," + encodeURIComponent(JSON.stringify(r.geometry)),
|
|
2754
|
+
format: "GeoJSON"
|
|
2755
|
+
},
|
|
2756
|
+
properties: {
|
|
2757
|
+
id: r.id
|
|
2758
|
+
}
|
|
2759
|
+
});
|
|
2760
|
+
return s;
|
|
2761
|
+
}
|
|
2762
|
+
getItems() {
|
|
2763
|
+
return this.#e?.links.filter((r) => r.rel === "item").sort(
|
|
2764
|
+
(r, s) => (
|
|
2765
|
+
/** @type {number} */
|
|
2766
|
+
r.datetime < /** @type {number} */
|
|
2767
|
+
s.datetime ? -1 : 1
|
|
2768
|
+
)
|
|
2769
|
+
);
|
|
2770
|
+
}
|
|
2771
|
+
getDates() {
|
|
2772
|
+
return this.#e?.links.filter((r) => r.rel === "item").sort(
|
|
2773
|
+
(r, s) => (
|
|
2774
|
+
/** @type {number} */
|
|
2775
|
+
r.datetime < /** @type {number} */
|
|
2776
|
+
s.datetime ? -1 : 1
|
|
2777
|
+
)
|
|
2778
|
+
).map((r) => new Date(
|
|
2779
|
+
/** @type {number} */
|
|
2780
|
+
r.datetime
|
|
2781
|
+
));
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
export {
|
|
2785
|
+
et as E,
|
|
2786
|
+
Ye as e,
|
|
2787
|
+
me as t
|
|
2788
|
+
};
|