@esri/hub-common 9.21.2 → 9.23.1
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/dist/es2017/content/_fetch.js +87 -0
- package/dist/es2017/content/_fetch.js.map +1 -0
- package/dist/es2017/content/_internal.js +75 -3
- package/dist/es2017/content/_internal.js.map +1 -1
- package/dist/es2017/content/compose.js +59 -22
- package/dist/es2017/content/compose.js.map +1 -1
- package/dist/es2017/content/fetch.js +109 -0
- package/dist/es2017/content/fetch.js.map +1 -0
- package/dist/es2017/content/index.js +9 -80
- package/dist/es2017/content/index.js.map +1 -1
- package/dist/es2017/content/slugs.js +63 -0
- package/dist/es2017/content/slugs.js.map +1 -0
- package/dist/es2017/content/types.js +1 -0
- package/dist/es2017/content/types.js.map +1 -0
- package/dist/es2017/items/_enrichments.js +176 -0
- package/dist/es2017/items/_enrichments.js.map +1 -0
- package/dist/esm/content/_fetch.js +102 -0
- package/dist/esm/content/_fetch.js.map +1 -0
- package/dist/esm/content/_internal.js +75 -3
- package/dist/esm/content/_internal.js.map +1 -1
- package/dist/esm/content/compose.js +60 -21
- package/dist/esm/content/compose.js.map +1 -1
- package/dist/esm/content/fetch.js +177 -0
- package/dist/esm/content/fetch.js.map +1 -0
- package/dist/esm/content/index.js +9 -80
- package/dist/esm/content/index.js.map +1 -1
- package/dist/esm/content/slugs.js +63 -0
- package/dist/esm/content/slugs.js.map +1 -0
- package/dist/esm/content/types.js +1 -0
- package/dist/esm/content/types.js.map +1 -0
- package/dist/esm/items/_enrichments.js +177 -0
- package/dist/esm/items/_enrichments.js.map +1 -0
- package/dist/node/content/_fetch.js +90 -0
- package/dist/node/content/_fetch.js.map +1 -0
- package/dist/node/content/_internal.js +76 -4
- package/dist/node/content/_internal.js.map +1 -1
- package/dist/node/content/compose.js +59 -22
- package/dist/node/content/compose.js.map +1 -1
- package/dist/node/content/fetch.js +112 -0
- package/dist/node/content/fetch.js.map +1 -0
- package/dist/node/content/index.js +11 -86
- package/dist/node/content/index.js.map +1 -1
- package/dist/node/content/slugs.js +70 -0
- package/dist/node/content/slugs.js.map +1 -0
- package/dist/node/content/types.js +3 -0
- package/dist/node/content/types.js.map +1 -0
- package/dist/node/items/_enrichments.js +179 -0
- package/dist/node/items/_enrichments.js.map +1 -0
- package/dist/types/content/_fetch.d.ts +60 -0
- package/dist/types/content/_internal.d.ts +79 -0
- package/dist/types/content/compose.d.ts +31 -0
- package/dist/types/content/fetch.d.ts +24 -0
- package/dist/types/content/index.d.ts +4 -41
- package/dist/types/content/slugs.d.ts +34 -0
- package/dist/types/content/types.d.ts +7 -0
- package/dist/types/core/types/IHubContent.d.ts +4 -0
- package/dist/types/items/_enrichments.d.ts +24 -0
- package/dist/umd/common.umd.js +2238 -836
- package/dist/umd/common.umd.js.map +1 -1
- package/dist/umd/common.umd.min.js +1 -1
- package/dist/umd/common.umd.min.js.map +1 -1
- package/package.json +2 -1
package/dist/umd/common.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/hub-common - v9.
|
|
2
|
+
* @esri/hub-common - v9.23.0 - Thu Mar 17 2022 18:52:07 GMT+0000 (Coordinated Universal Time)
|
|
3
3
|
* Copyright (c) 2022 Environmental Systems Research Institute, Inc.
|
|
4
4
|
* Apache-2.0
|
|
5
5
|
*/
|
|
@@ -860,6 +860,18 @@
|
|
|
860
860
|
return __assign.apply(this, arguments);
|
|
861
861
|
};
|
|
862
862
|
|
|
863
|
+
function __rest(s, e) {
|
|
864
|
+
var t = {};
|
|
865
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
866
|
+
t[p] = s[p];
|
|
867
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
868
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
869
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
870
|
+
t[p[i]] = s[p[i]];
|
|
871
|
+
}
|
|
872
|
+
return t;
|
|
873
|
+
}
|
|
874
|
+
|
|
863
875
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
864
876
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
865
877
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -3350,6 +3362,19 @@
|
|
|
3350
3362
|
return createItemInFolder(options);
|
|
3351
3363
|
}
|
|
3352
3364
|
|
|
3365
|
+
// eslint-disable-next-line no-control-regex
|
|
3366
|
+
var CONTROL_CHAR_MATCHER = /[\x00-\x1F\x7F-\x9F\xA0]/g;
|
|
3367
|
+
/**
|
|
3368
|
+
* Returns a new string with all control characters removed.
|
|
3369
|
+
*
|
|
3370
|
+
* Doesn't remove characters from input string.
|
|
3371
|
+
*
|
|
3372
|
+
* @param str - the string to scrub
|
|
3373
|
+
*/
|
|
3374
|
+
function scrubControlChars(str) {
|
|
3375
|
+
return str.replace(CONTROL_CHAR_MATCHER, "");
|
|
3376
|
+
}
|
|
3377
|
+
|
|
3353
3378
|
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
|
|
3354
3379
|
* Apache-2.0 */
|
|
3355
3380
|
/**
|
|
@@ -3466,6 +3491,85 @@
|
|
|
3466
3491
|
options.params = __assign({ num: 1000 }, options.params);
|
|
3467
3492
|
return request(url, options);
|
|
3468
3493
|
}
|
|
3494
|
+
/**
|
|
3495
|
+
* ```js
|
|
3496
|
+
* import { getItemGroups } from "@esri/arcgis-rest-portal";
|
|
3497
|
+
* //
|
|
3498
|
+
* getItemGroups("30e5fe3149c34df1ba922e6f5bbf808f")
|
|
3499
|
+
* .then(response)
|
|
3500
|
+
* ```
|
|
3501
|
+
* Lists the groups of which the item is a part, only showing the groups that the calling user can access. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/groups.htm) for more information.
|
|
3502
|
+
*
|
|
3503
|
+
* @param id - The Id of the item to query group association for.
|
|
3504
|
+
* @param requestOptions - Options for the request
|
|
3505
|
+
* @returns A Promise to get some item groups.
|
|
3506
|
+
*/
|
|
3507
|
+
function getItemGroups(id, requestOptions) {
|
|
3508
|
+
var url = getItemBaseUrl(id, requestOptions) + "/groups";
|
|
3509
|
+
return request(url, requestOptions);
|
|
3510
|
+
}
|
|
3511
|
+
/**
|
|
3512
|
+
* ```
|
|
3513
|
+
* import { getItemInfo } from "@esri/arcgis-rest-portal";
|
|
3514
|
+
* // get the "Info Card" for the item
|
|
3515
|
+
* getItemInfo("ae7")
|
|
3516
|
+
* .then(itemInfoXml) // XML document as a string
|
|
3517
|
+
* // or get the contents of a specific file
|
|
3518
|
+
* getItemInfo("ae7", { fileName: "form.json", readAs: "json", authentication })
|
|
3519
|
+
* .then(formJson) // JSON document as JSON
|
|
3520
|
+
* ```
|
|
3521
|
+
* Get an info file for an item. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/item-info-file.htm) for more information.
|
|
3522
|
+
* @param id - Item Id
|
|
3523
|
+
* @param requestOptions - Options for the request, including the file name which defaults to `iteminfo.xml`.
|
|
3524
|
+
* If the file is not a text file (XML, HTML, etc) you will need to specify the `readAs` parameter
|
|
3525
|
+
* @returns A Promise that will resolve with the contents of the info file for the item.
|
|
3526
|
+
*/
|
|
3527
|
+
function getItemInfo(id, requestOptions) {
|
|
3528
|
+
var _a = requestOptions || {}, _b = _a.fileName, fileName = _b === void 0 ? "iteminfo.xml" : _b, _c = _a.readAs, readAs = _c === void 0 ? "text" : _c;
|
|
3529
|
+
var options = __assign({ httpMethod: "GET" }, requestOptions);
|
|
3530
|
+
return getItemFile(id, "/info/" + fileName, readAs, options);
|
|
3531
|
+
}
|
|
3532
|
+
/**
|
|
3533
|
+
* ```
|
|
3534
|
+
* import { getItemMetadata } from "@esri/arcgis-rest-portal";
|
|
3535
|
+
* // get the metadata for the item
|
|
3536
|
+
* getItemMetadata("ae7")
|
|
3537
|
+
* .then(itemMetadataXml) // XML document as a string
|
|
3538
|
+
* // or with additional request options
|
|
3539
|
+
* getItemMetadata("ae7", { authentication })
|
|
3540
|
+
* .then(itemMetadataXml) // XML document as a string
|
|
3541
|
+
* ```
|
|
3542
|
+
* Get the standard formal metadata XML file for an item (`/info/metadata/metadata.xml`)
|
|
3543
|
+
* @param id - Item Id
|
|
3544
|
+
* @param requestOptions - Options for the request
|
|
3545
|
+
* @returns A Promise that will resolve with the contents of the metadata file for the item as a string.
|
|
3546
|
+
*/
|
|
3547
|
+
function getItemMetadata(id, requestOptions) {
|
|
3548
|
+
var options = __assign(__assign({}, requestOptions), { fileName: "metadata/metadata.xml" });
|
|
3549
|
+
return getItemInfo(id, options);
|
|
3550
|
+
}
|
|
3551
|
+
// overrides request()'s default behavior for reading the response
|
|
3552
|
+
// which is based on `params.f` and defaults to JSON
|
|
3553
|
+
// Also adds JSON parse error protection by sanitizing out any unescaped control characters before parsing
|
|
3554
|
+
function getItemFile(id,
|
|
3555
|
+
// NOTE: fileName should include any folder/subfolders
|
|
3556
|
+
fileName, readMethod, requestOptions) {
|
|
3557
|
+
var url = "" + getItemBaseUrl(id, requestOptions) + fileName;
|
|
3558
|
+
// preserve escape hatch to let the consumer read the response
|
|
3559
|
+
// and ensure the f param is not appended to the query string
|
|
3560
|
+
var options = __assign({ params: {} }, requestOptions);
|
|
3561
|
+
var justReturnResponse = options.rawResponse;
|
|
3562
|
+
options.rawResponse = true;
|
|
3563
|
+
options.params.f = null;
|
|
3564
|
+
return request(url, options).then(function (response) {
|
|
3565
|
+
if (justReturnResponse) {
|
|
3566
|
+
return response;
|
|
3567
|
+
}
|
|
3568
|
+
return readMethod !== 'json'
|
|
3569
|
+
? response[readMethod]()
|
|
3570
|
+
: response.text().then(function (text) { return JSON.parse(scrubControlChars(text)); });
|
|
3571
|
+
});
|
|
3572
|
+
}
|
|
3469
3573
|
|
|
3470
3574
|
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
|
|
3471
3575
|
* Apache-2.0 */
|
|
@@ -5963,6 +6067,131 @@
|
|
|
5963
6067
|
})));
|
|
5964
6068
|
}
|
|
5965
6069
|
|
|
6070
|
+
/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
|
|
6071
|
+
* Apache-2.0 */
|
|
6072
|
+
/**
|
|
6073
|
+
* ```js
|
|
6074
|
+
* import { queryFeatures } from '@esri/arcgis-rest-feature-layer';
|
|
6075
|
+
* //
|
|
6076
|
+
* queryFeatures({
|
|
6077
|
+
* url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3",
|
|
6078
|
+
* where: "STATE_NAME = 'Alaska'"
|
|
6079
|
+
* })
|
|
6080
|
+
* .then(result)
|
|
6081
|
+
* ```
|
|
6082
|
+
* Query a feature service. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information.
|
|
6083
|
+
*
|
|
6084
|
+
* @param requestOptions - Options for the request
|
|
6085
|
+
* @returns A Promise that will resolve with the query response.
|
|
6086
|
+
*/
|
|
6087
|
+
function queryFeatures(requestOptions) {
|
|
6088
|
+
var queryOptions = appendCustomParams(requestOptions, [
|
|
6089
|
+
"where",
|
|
6090
|
+
"objectIds",
|
|
6091
|
+
"relationParam",
|
|
6092
|
+
"time",
|
|
6093
|
+
"distance",
|
|
6094
|
+
"units",
|
|
6095
|
+
"outFields",
|
|
6096
|
+
"geometry",
|
|
6097
|
+
"geometryType",
|
|
6098
|
+
"spatialRel",
|
|
6099
|
+
"returnGeometry",
|
|
6100
|
+
"maxAllowableOffset",
|
|
6101
|
+
"geometryPrecision",
|
|
6102
|
+
"inSR",
|
|
6103
|
+
"outSR",
|
|
6104
|
+
"gdbVersion",
|
|
6105
|
+
"returnDistinctValues",
|
|
6106
|
+
"returnIdsOnly",
|
|
6107
|
+
"returnCountOnly",
|
|
6108
|
+
"returnExtentOnly",
|
|
6109
|
+
"orderByFields",
|
|
6110
|
+
"groupByFieldsForStatistics",
|
|
6111
|
+
"outStatistics",
|
|
6112
|
+
"returnZ",
|
|
6113
|
+
"returnM",
|
|
6114
|
+
"multipatchOption",
|
|
6115
|
+
"resultOffset",
|
|
6116
|
+
"resultRecordCount",
|
|
6117
|
+
"quantizationParameters",
|
|
6118
|
+
"returnCentroid",
|
|
6119
|
+
"resultType",
|
|
6120
|
+
"historicMoment",
|
|
6121
|
+
"returnTrueCurves",
|
|
6122
|
+
"sqlFormat",
|
|
6123
|
+
"returnExceededLimitFeatures",
|
|
6124
|
+
"f"
|
|
6125
|
+
], {
|
|
6126
|
+
httpMethod: "GET",
|
|
6127
|
+
params: __assign({
|
|
6128
|
+
// set default query parameters
|
|
6129
|
+
where: "1=1", outFields: "*" }, requestOptions.params)
|
|
6130
|
+
});
|
|
6131
|
+
return request(cleanUrl(requestOptions.url) + "/query", queryOptions);
|
|
6132
|
+
}
|
|
6133
|
+
|
|
6134
|
+
/* Copyright (c) 2017-2019 Environmental Systems Research Institute, Inc.
|
|
6135
|
+
* Apache-2.0 */
|
|
6136
|
+
var serviceRegex = new RegExp(/.+(?:map|feature|image)server/i);
|
|
6137
|
+
/**
|
|
6138
|
+
* Return the service url. If not matched, returns what was passed in
|
|
6139
|
+
*/
|
|
6140
|
+
function parseServiceUrl(url) {
|
|
6141
|
+
var match = url.match(serviceRegex);
|
|
6142
|
+
if (match) {
|
|
6143
|
+
return match[0];
|
|
6144
|
+
}
|
|
6145
|
+
else {
|
|
6146
|
+
return stripQueryString(url);
|
|
6147
|
+
}
|
|
6148
|
+
}
|
|
6149
|
+
function stripQueryString(url) {
|
|
6150
|
+
var stripped = url.split('?')[0];
|
|
6151
|
+
return cleanUrl(stripped);
|
|
6152
|
+
}
|
|
6153
|
+
|
|
6154
|
+
/**
|
|
6155
|
+
* ```js
|
|
6156
|
+
* import { getAllLayersAndTables } from '@esri/arcgis-rest-feature-layer';
|
|
6157
|
+
* getAllLayersAndTables({
|
|
6158
|
+
* url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0"
|
|
6159
|
+
* })
|
|
6160
|
+
* .then(response) // { layers: [...], tables: [...] }
|
|
6161
|
+
* ```
|
|
6162
|
+
* Fetches all the layers and tables associated with a given layer service.
|
|
6163
|
+
* Wrapper for https://developers.arcgis.com/rest/services-reference/all-layers-and-tables.htm
|
|
6164
|
+
*
|
|
6165
|
+
* @param options - Request options, including the url for the layer service
|
|
6166
|
+
* @returns A Promise that will resolve with the layers and tables for the given service
|
|
6167
|
+
*/
|
|
6168
|
+
// TODO: should we expand this to support other valid params of the endpoint?
|
|
6169
|
+
function getAllLayersAndTables(options) {
|
|
6170
|
+
var url = options.url, requestOptions = __rest(options, ["url"]);
|
|
6171
|
+
var layersUrl = parseServiceUrl(url) + "/layers";
|
|
6172
|
+
return request(layersUrl, requestOptions);
|
|
6173
|
+
}
|
|
6174
|
+
|
|
6175
|
+
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
|
|
6176
|
+
* Apache-2.0 */
|
|
6177
|
+
/**
|
|
6178
|
+
* ```js
|
|
6179
|
+
* import { getService } from '@esri/arcgis-rest-feature-layer';
|
|
6180
|
+
* //
|
|
6181
|
+
* getService({
|
|
6182
|
+
* url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer"
|
|
6183
|
+
* })
|
|
6184
|
+
* .then(response) // { name: "311", id: 0, ... }
|
|
6185
|
+
* ```
|
|
6186
|
+
* Feature Service request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/feature-service.htm) for more information.
|
|
6187
|
+
*
|
|
6188
|
+
* @param options - Options for the request.
|
|
6189
|
+
* @returns A Promise that will resolve with the getService response.
|
|
6190
|
+
*/
|
|
6191
|
+
function getService(options) {
|
|
6192
|
+
return request(cleanUrl(options.url), options);
|
|
6193
|
+
}
|
|
6194
|
+
|
|
5966
6195
|
function createExtent(xmin, ymin, xmax, ymax, wkid) {
|
|
5967
6196
|
if (wkid === void 0) { wkid = 4326; }
|
|
5968
6197
|
return {
|
|
@@ -6105,26 +6334,6 @@
|
|
|
6105
6334
|
};
|
|
6106
6335
|
};
|
|
6107
6336
|
|
|
6108
|
-
/* Copyright (c) 2017-2019 Environmental Systems Research Institute, Inc.
|
|
6109
|
-
* Apache-2.0 */
|
|
6110
|
-
var serviceRegex = new RegExp(/.+(?:map|feature|image)server/i);
|
|
6111
|
-
/**
|
|
6112
|
-
* Return the service url. If not matched, returns what was passed in
|
|
6113
|
-
*/
|
|
6114
|
-
function parseServiceUrl(url) {
|
|
6115
|
-
var match = url.match(serviceRegex);
|
|
6116
|
-
if (match) {
|
|
6117
|
-
return match[0];
|
|
6118
|
-
}
|
|
6119
|
-
else {
|
|
6120
|
-
return stripQueryString(url);
|
|
6121
|
-
}
|
|
6122
|
-
}
|
|
6123
|
-
function stripQueryString(url) {
|
|
6124
|
-
var stripped = url.split('?')[0];
|
|
6125
|
-
return cleanUrl(stripped);
|
|
6126
|
-
}
|
|
6127
|
-
|
|
6128
6337
|
// private helper functions
|
|
6129
6338
|
function collectionToFamily(collection) {
|
|
6130
6339
|
var overrides = {
|
|
@@ -6166,6 +6375,12 @@
|
|
|
6166
6375
|
return family;
|
|
6167
6376
|
}
|
|
6168
6377
|
|
|
6378
|
+
/**
|
|
6379
|
+
* get a content's boundary based on the item's boundary property
|
|
6380
|
+
* @param item
|
|
6381
|
+
* @returns
|
|
6382
|
+
* @private
|
|
6383
|
+
*/
|
|
6169
6384
|
// TODO: this needs to be able to handle "automatic"
|
|
6170
6385
|
var getContentBoundary = function (item) {
|
|
6171
6386
|
var _a;
|
|
@@ -6191,18 +6406,36 @@
|
|
|
6191
6406
|
geometry: geometry,
|
|
6192
6407
|
};
|
|
6193
6408
|
};
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6409
|
+
/**
|
|
6410
|
+
* Determine if we are in an enterprise environment
|
|
6411
|
+
* NOTE: when no request options are provided, the underlying
|
|
6412
|
+
* request functions assume that we are online in production
|
|
6413
|
+
* so we only want use enterprise logic if isPortal is explicitly defined
|
|
6414
|
+
* @param requestOptions
|
|
6415
|
+
* @returns
|
|
6416
|
+
* @private
|
|
6417
|
+
*/
|
|
6197
6418
|
var isPortal = function (requestOptions) {
|
|
6198
6419
|
return requestOptions && requestOptions.isPortal;
|
|
6199
6420
|
};
|
|
6421
|
+
/**
|
|
6422
|
+
* Determine if we can use the Hub API for an item, i.e.
|
|
6423
|
+
* the item is public and we are not in an enterprise environment
|
|
6424
|
+
* @param item
|
|
6425
|
+
* @param requestOptions
|
|
6426
|
+
* @returns
|
|
6427
|
+
* @private
|
|
6428
|
+
*/
|
|
6429
|
+
var canUseHubApiForItem = function (item, requestOptions) {
|
|
6430
|
+
return !!item && item.access === "public" && !isPortal(requestOptions);
|
|
6431
|
+
};
|
|
6200
6432
|
/**
|
|
6201
6433
|
* Returns whether or not an item is a proxied csv
|
|
6202
6434
|
*
|
|
6203
6435
|
* @param item
|
|
6204
6436
|
* @param requestOptions Hub Request Options (including whether we're in portal)
|
|
6205
6437
|
* @returns
|
|
6438
|
+
* @private
|
|
6206
6439
|
*/
|
|
6207
6440
|
var isProxiedCSV = function (item, requestOptions) {
|
|
6208
6441
|
return !isPortal(requestOptions) &&
|
|
@@ -6210,6 +6443,14 @@
|
|
|
6210
6443
|
item.type === "CSV" &&
|
|
6211
6444
|
item.size <= 5000000;
|
|
6212
6445
|
};
|
|
6446
|
+
/**
|
|
6447
|
+
* Get the relative URL to use for the item in a hub site
|
|
6448
|
+
* @param type
|
|
6449
|
+
* @param identifier
|
|
6450
|
+
* @param typeKeywords
|
|
6451
|
+
* @returns
|
|
6452
|
+
* @private
|
|
6453
|
+
*/
|
|
6213
6454
|
var getHubRelativeUrl = function (type, identifier, typeKeywords) {
|
|
6214
6455
|
// solution types have their own logic
|
|
6215
6456
|
var contentUrl = getSolutionUrl(type, identifier, typeKeywords);
|
|
@@ -6242,6 +6483,12 @@
|
|
|
6242
6483
|
}
|
|
6243
6484
|
return contentUrl;
|
|
6244
6485
|
};
|
|
6486
|
+
/**
|
|
6487
|
+
* Is this content type a page?
|
|
6488
|
+
* @param type
|
|
6489
|
+
* @returns
|
|
6490
|
+
* @private
|
|
6491
|
+
*/
|
|
6245
6492
|
var isPageType = function (type) {
|
|
6246
6493
|
return ["Hub Page", "Site Page"].includes(type);
|
|
6247
6494
|
};
|
|
@@ -6260,6 +6507,12 @@
|
|
|
6260
6507
|
}
|
|
6261
6508
|
return hubUrl;
|
|
6262
6509
|
};
|
|
6510
|
+
/**
|
|
6511
|
+
* Get the path to a well known metadata value
|
|
6512
|
+
* @param identifier identifier for well known metadata value
|
|
6513
|
+
* @returns path to be used like get(metadata, path)
|
|
6514
|
+
* @private
|
|
6515
|
+
*/
|
|
6263
6516
|
function getMetadataPath(identifier) {
|
|
6264
6517
|
// NOTE: i have verified that this will work regardless of the "Metadata Style" set on the org
|
|
6265
6518
|
var metadataPaths = {
|
|
@@ -6272,10 +6525,20 @@
|
|
|
6272
6525
|
};
|
|
6273
6526
|
return metadataPaths[identifier];
|
|
6274
6527
|
}
|
|
6528
|
+
/**
|
|
6529
|
+
* Get a well known value from metadata
|
|
6530
|
+
* @param metadata
|
|
6531
|
+
* @param identifier identifier for well known metadata value
|
|
6532
|
+
* @returns
|
|
6533
|
+
* @private
|
|
6534
|
+
*/
|
|
6275
6535
|
function getValueFromMetadata(metadata, identifier) {
|
|
6276
6536
|
var path = getMetadataPath(identifier);
|
|
6277
6537
|
return path && getProp(metadata, path);
|
|
6278
6538
|
}
|
|
6539
|
+
/**
|
|
6540
|
+
* Date precisions
|
|
6541
|
+
*/
|
|
6279
6542
|
var DatePrecision;
|
|
6280
6543
|
(function (DatePrecision) {
|
|
6281
6544
|
DatePrecision["Year"] = "year";
|
|
@@ -6293,6 +6556,7 @@
|
|
|
6293
6556
|
*
|
|
6294
6557
|
* @param {string} isoString
|
|
6295
6558
|
* @return { date: Date, precision: DatePrecision }
|
|
6559
|
+
* @private
|
|
6296
6560
|
*/
|
|
6297
6561
|
function parseISODateString(isoString) {
|
|
6298
6562
|
isoString = "" + isoString;
|
|
@@ -6324,6 +6588,13 @@
|
|
|
6324
6588
|
}
|
|
6325
6589
|
return date && precision && { date: date, precision: precision };
|
|
6326
6590
|
}
|
|
6591
|
+
/**
|
|
6592
|
+
* Get the spatial reference from layer or server info
|
|
6593
|
+
* @param server
|
|
6594
|
+
* @param layer
|
|
6595
|
+
* @returns
|
|
6596
|
+
* @private
|
|
6597
|
+
*/
|
|
6327
6598
|
var getServerSpatialReference = function (server, layer) {
|
|
6328
6599
|
var _a;
|
|
6329
6600
|
var layerSpatialReference = (_a = layer === null || layer === void 0 ? void 0 : layer.extent) === null || _a === void 0 ? void 0 : _a.spatialReference;
|
|
@@ -6334,6 +6605,12 @@
|
|
|
6334
6605
|
// that is always either WKID like "102100" or
|
|
6335
6606
|
// WKT like "NAD_1983_HARN_StatePlane_Hawaii_3_FIPS_5103_Feet"
|
|
6336
6607
|
// so we coerce those string into a ISpatialReference object
|
|
6608
|
+
/**
|
|
6609
|
+
* Get the spatial reference as an object for an item
|
|
6610
|
+
* @param item
|
|
6611
|
+
* @returns spatial reference object
|
|
6612
|
+
* @private
|
|
6613
|
+
*/
|
|
6337
6614
|
var getItemSpatialReference = function (item) {
|
|
6338
6615
|
var spatialReference = item.spatialReference;
|
|
6339
6616
|
if (!spatialReference || typeof spatialReference === "object") {
|
|
@@ -6359,6 +6636,7 @@
|
|
|
6359
6636
|
* @param item
|
|
6360
6637
|
* @param metadata formal metadata
|
|
6361
6638
|
* @returns
|
|
6639
|
+
* @private
|
|
6362
6640
|
*/
|
|
6363
6641
|
var getAdditionalResources = function (item, metadata, requestOptions) {
|
|
6364
6642
|
var rawResources = getProp(metadata, "metadata.distInfo.distTranOps.onLineSrc") || null;
|
|
@@ -6381,6 +6659,7 @@
|
|
|
6381
6659
|
* @param resource raw additional resource of an item
|
|
6382
6660
|
* @param item
|
|
6383
6661
|
* @returns
|
|
6662
|
+
* @private
|
|
6384
6663
|
*/
|
|
6385
6664
|
var isDataSourceOfItem = function (resource, item) {
|
|
6386
6665
|
var serviceUrl = item.url && parseServiceUrl(item.url);
|
|
@@ -6396,6 +6675,7 @@
|
|
|
6396
6675
|
* @param item
|
|
6397
6676
|
* @param requestOptions IHubRequestOptions, including authentication
|
|
6398
6677
|
* @returns
|
|
6678
|
+
* @private
|
|
6399
6679
|
*/
|
|
6400
6680
|
var getAdditionalResourceUrl = function (resource, item, requestOptions) {
|
|
6401
6681
|
var result = resource.linkage;
|
|
@@ -7099,6 +7379,38 @@
|
|
|
7099
7379
|
var flattened = parsed.reduce(function (acc, arr, _) { return __spreadArrays(acc, arr); }, []);
|
|
7100
7380
|
return flattened.filter(function (cat) { return !includes(exclude, cat.toLowerCase()); });
|
|
7101
7381
|
}
|
|
7382
|
+
/**
|
|
7383
|
+
* get the layer object for
|
|
7384
|
+
* - an item that refers to a specific layer of a service
|
|
7385
|
+
* - a multi-layer services (if a layer id was passed in)
|
|
7386
|
+
* - a single layer feature service
|
|
7387
|
+
* @param item
|
|
7388
|
+
* @param layers the layers and tables returned from the service
|
|
7389
|
+
* @param layerId a specific id
|
|
7390
|
+
* @returns layer definition
|
|
7391
|
+
* @private
|
|
7392
|
+
*/
|
|
7393
|
+
var getItemLayer = function (item, layers, layerId) {
|
|
7394
|
+
// if item refers to a layer we always want to use that layer id
|
|
7395
|
+
// otherwise use the layer id that was passed in (if any)
|
|
7396
|
+
var _layerIdFromUrl = getLayerIdFromUrl(item.url);
|
|
7397
|
+
var _layerId = _layerIdFromUrl ? parseInt(_layerIdFromUrl, 10) : layerId;
|
|
7398
|
+
return (layers &&
|
|
7399
|
+
(!isNil(_layerId)
|
|
7400
|
+
? // find the explicitly set layer id
|
|
7401
|
+
layers.find(function (_layer) { return _layer.id === _layerId; })
|
|
7402
|
+
: // for feature servers with a single layer always show the layer
|
|
7403
|
+
isFeatureService(item.type) && getOnlyQueryLayer(layers)));
|
|
7404
|
+
};
|
|
7405
|
+
/**
|
|
7406
|
+
* determine if a layer is a layer view
|
|
7407
|
+
* @param layer
|
|
7408
|
+
* @returns
|
|
7409
|
+
* @private
|
|
7410
|
+
*/
|
|
7411
|
+
var isLayerView = function (layer) {
|
|
7412
|
+
return layer.isView;
|
|
7413
|
+
};
|
|
7102
7414
|
/**
|
|
7103
7415
|
* Compose a new content object out of an item, enrichments, and context
|
|
7104
7416
|
* @param item
|
|
@@ -7107,23 +7419,11 @@
|
|
|
7107
7419
|
*/
|
|
7108
7420
|
var composeContent = function (item, options) {
|
|
7109
7421
|
// extract enrichments and context out of the options
|
|
7110
|
-
var _a = options || {}, slug = _a.slug, requestOptions = _a.requestOptions, data = _a.data, metadata = _a.metadata, groupIds = _a.groupIds, ownerUser = _a.ownerUser, org = _a.org, errors = _a.errors, server = _a.server, layers = _a.layers, recordCount = _a.recordCount, boundary = _a.boundary, statistics = _a.statistics;
|
|
7422
|
+
var _a = options || {}, slug = _a.slug, requestOptions = _a.requestOptions, data = _a.data, metadata = _a.metadata, groupIds = _a.groupIds, ownerUser = _a.ownerUser, org = _a.org, errors = _a.errors, server = _a.server, layers = _a.layers, recordCount = _a.recordCount, boundary = _a.boundary, extent = _a.extent, searchDescription = _a.searchDescription, statistics = _a.statistics;
|
|
7111
7423
|
// set common variables that we will use in the derived properties below
|
|
7112
|
-
|
|
7113
|
-
// otherwise use the layer id that was passed in (if any)
|
|
7114
|
-
var _layerIdFromUrl = getLayerIdFromUrl(item.url);
|
|
7115
|
-
var layerId = _layerIdFromUrl
|
|
7116
|
-
? parseInt(_layerIdFromUrl, 10)
|
|
7117
|
-
: options === null || options === void 0 ? void 0 : options.layerId;
|
|
7118
|
-
var layer = layers &&
|
|
7119
|
-
(!isNil(layerId)
|
|
7120
|
-
? // find the explicitly set layer id
|
|
7121
|
-
layers.find(function (_layer) { return _layer.id === layerId; })
|
|
7122
|
-
: // for feature servers with a single layer always show the layer
|
|
7123
|
-
isFeatureService(item.type) && getOnlyQueryLayer(layers));
|
|
7424
|
+
var layer = getItemLayer(item, layers, options === null || options === void 0 ? void 0 : options.layerId);
|
|
7124
7425
|
// NOTE: we only set hubId for public items in online
|
|
7125
|
-
var
|
|
7126
|
-
var hubId = _canUseHubApi
|
|
7426
|
+
var hubId = canUseHubApiForItem(item, requestOptions)
|
|
7127
7427
|
? layer
|
|
7128
7428
|
? item.id + "_" + layer.id
|
|
7129
7429
|
: getItemHubId(item)
|
|
@@ -7181,13 +7481,13 @@
|
|
|
7181
7481
|
return name;
|
|
7182
7482
|
},
|
|
7183
7483
|
get description() {
|
|
7184
|
-
return _layerDescription || item.description;
|
|
7484
|
+
return searchDescription || _layerDescription || item.description;
|
|
7185
7485
|
}, type: type, get family() {
|
|
7186
7486
|
return getFamily(type);
|
|
7187
7487
|
}, get url() {
|
|
7188
7488
|
return _proxyUrl
|
|
7189
7489
|
? _proxyUrl
|
|
7190
|
-
:
|
|
7490
|
+
: layer
|
|
7191
7491
|
? parseServiceUrl(item.url) + "/" + layer.id
|
|
7192
7492
|
: item.url;
|
|
7193
7493
|
}, get categories() {
|
|
@@ -7212,6 +7512,15 @@
|
|
|
7212
7512
|
};
|
|
7213
7513
|
},
|
|
7214
7514
|
// TODO: do we want to add dataset extent logic as a getter here?
|
|
7515
|
+
get extent() {
|
|
7516
|
+
return !isBBox(item.extent) && extent && isBBox(extent.coordinates)
|
|
7517
|
+
? // we fall back to the extent derived by the Hub API
|
|
7518
|
+
// which prefers layer or service extents and ultimately
|
|
7519
|
+
// falls back to the org's extent
|
|
7520
|
+
extent.coordinates
|
|
7521
|
+
: // prefer item extent
|
|
7522
|
+
item.extent;
|
|
7523
|
+
},
|
|
7215
7524
|
// would require us to do client-side projection of server/layer extent
|
|
7216
7525
|
get boundary() {
|
|
7217
7526
|
// TODO: need to be able to handle automatic w/ additional enrichment
|
|
@@ -7294,11 +7603,20 @@
|
|
|
7294
7603
|
return (getItemSpatialReference(item) ||
|
|
7295
7604
|
getServerSpatialReference(server, layer) ||
|
|
7296
7605
|
null);
|
|
7606
|
+
}, get viewDefinition() {
|
|
7607
|
+
// if this is a layer view and we have the item data
|
|
7608
|
+
// find the definition that corresponds to the current layer
|
|
7609
|
+
var dataLayer = layer &&
|
|
7610
|
+
isLayerView(layer) &&
|
|
7611
|
+
data &&
|
|
7612
|
+
Array.isArray(data.layers) &&
|
|
7613
|
+
data.layers.find(function (_layer) { return _layer.id === layer.id; });
|
|
7614
|
+
return dataLayer ? dataLayer.layerDefinition : undefined;
|
|
7297
7615
|
},
|
|
7298
7616
|
get orgId() {
|
|
7299
7617
|
// NOTE: it's undocumented, but the portal API will return orgId for items... sometimes
|
|
7300
|
-
return org ? org.id : item.orgId;
|
|
7301
|
-
},
|
|
7618
|
+
return org ? org.id : item.orgId || (ownerUser === null || ownerUser === void 0 ? void 0 : ownerUser.orgId);
|
|
7619
|
+
},
|
|
7302
7620
|
// deprecated properties
|
|
7303
7621
|
// TODO: should we add these in legacy wrappers
|
|
7304
7622
|
// like itemToContent or datasetToContent instead?
|
|
@@ -7326,162 +7644,47 @@
|
|
|
7326
7644
|
} });
|
|
7327
7645
|
};
|
|
7328
7646
|
|
|
7329
|
-
|
|
7647
|
+
//////////////////////
|
|
7648
|
+
// Slug Helpers
|
|
7649
|
+
//////////////////////
|
|
7330
7650
|
/**
|
|
7331
|
-
*
|
|
7332
|
-
*
|
|
7333
|
-
*
|
|
7334
|
-
*
|
|
7335
|
-
* > 'dataset'
|
|
7336
|
-
* ```
|
|
7337
|
-
* **DEPRECATED: Use getCollection() instead**
|
|
7338
|
-
* returns the Hub category for a given item type
|
|
7339
|
-
* @param itemType The ArcGIS [item type](https://developers.arcgis.com/rest/users-groups-and-items/items-and-item-types.htm).
|
|
7340
|
-
* @returns the category of a given item type.
|
|
7651
|
+
* Parse item ID and layer ID (if any) from dataset record ID
|
|
7652
|
+
*
|
|
7653
|
+
* @param datasetId Hub API dataset record id ({itemId}_{layerId} or {itemId})
|
|
7654
|
+
* @returns A hash with the `itemId` and `layerId` (if any)
|
|
7341
7655
|
*/
|
|
7342
|
-
function
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
console.warn("DEPRECATED: Use getCollection() instead. getCategory will be removed at v10.0.0");
|
|
7346
|
-
/* tslint:enable no-console */
|
|
7347
|
-
var collection = getCollection(itemType);
|
|
7348
|
-
// for backwards compatibility
|
|
7349
|
-
return collection === "feedback" ? "app" : collection;
|
|
7656
|
+
function parseDatasetId(datasetId) {
|
|
7657
|
+
var _a = datasetId ? datasetId.split("_") : [], itemId = _a[0], layerId = _a[1];
|
|
7658
|
+
return { itemId: itemId, layerId: layerId };
|
|
7350
7659
|
}
|
|
7351
7660
|
/**
|
|
7352
|
-
*
|
|
7353
|
-
* import { getTypes } from "@esri/hub-common";
|
|
7354
|
-
* //
|
|
7355
|
-
* getTypes('site')
|
|
7356
|
-
* > [ 'hub site application' ]
|
|
7357
|
-
* ```
|
|
7358
|
-
* To do.
|
|
7359
|
-
* @param category The ArcGIS Hub category.
|
|
7360
|
-
* @returns all the item types for the given category.
|
|
7661
|
+
* Determine if an identifier is a Hub API slug
|
|
7361
7662
|
*
|
|
7663
|
+
* @param identifier Hub API slug ({orgKey}::{title-as-slug} or {title-as-slug})
|
|
7664
|
+
* or record id ((itemId}_{layerId} or {itemId})
|
|
7665
|
+
* @returns true if the identifier is valid _and_ is **not** a record id
|
|
7362
7666
|
*/
|
|
7363
|
-
function
|
|
7364
|
-
|
|
7365
|
-
|
|
7667
|
+
function isSlug(identifier) {
|
|
7668
|
+
var itemId = parseDatasetId(identifier).itemId;
|
|
7669
|
+
if (!itemId || isGuid(itemId)) {
|
|
7670
|
+
// it's either invalid, or an item id, or a dataset id
|
|
7671
|
+
return false;
|
|
7672
|
+
}
|
|
7673
|
+
// otherwise assume it's a slug
|
|
7674
|
+
return true;
|
|
7366
7675
|
}
|
|
7367
7676
|
/**
|
|
7368
|
-
*
|
|
7369
|
-
* import { getTypeCategories } from "@esri/hub-common";
|
|
7370
|
-
* //
|
|
7371
|
-
* getTypeCategories(item)
|
|
7372
|
-
* > [ 'Hub Site Application' ]
|
|
7373
|
-
* ```
|
|
7374
|
-
* @param item Item object.
|
|
7375
|
-
* @returns typeCategory of the input item.
|
|
7677
|
+
* Add a context (prefix) to slug if it doesn't already have one
|
|
7376
7678
|
*
|
|
7679
|
+
* @param slug Hub API slug (with or without context)
|
|
7680
|
+
* @param context usually a portal's orgKey
|
|
7681
|
+
* @returns slug with context ({context}::{slug})
|
|
7377
7682
|
*/
|
|
7378
|
-
function
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
// upper case first letter and return as element in array for backwards compatibility
|
|
7384
|
-
var chars = Array.from(category);
|
|
7385
|
-
chars[0] = chars[0].toUpperCase();
|
|
7386
|
-
return [chars.join("")];
|
|
7387
|
-
}
|
|
7388
|
-
else {
|
|
7389
|
-
return ["Other"];
|
|
7390
|
-
}
|
|
7391
|
-
}
|
|
7392
|
-
/**
|
|
7393
|
-
* ```js
|
|
7394
|
-
* import { getContentIdentifier } from "@esri/hub-common";
|
|
7395
|
-
* //
|
|
7396
|
-
* getContentIdentifier(content, site)
|
|
7397
|
-
* > 'f12hhjk32' // id
|
|
7398
|
-
* // OR
|
|
7399
|
-
* > 'content-slug' // human-readable slug
|
|
7400
|
-
* ```
|
|
7401
|
-
* Returns the preferred identifier for a piece of content (determined by content type):
|
|
7402
|
-
* - Content from the 'template' and 'feedback' families return the standard id field
|
|
7403
|
-
* - Pages that are linked to the site parameter will return the slug defined by the site. Otherwise, the page id will be returned
|
|
7404
|
-
* - All other content will return the highest available item in the following hierarchy:
|
|
7405
|
-
* 1. slug - includes org prefix if the site parameter is a portal or has an orgKey different from the slug prefix
|
|
7406
|
-
* 2. hubId
|
|
7407
|
-
* 3. id
|
|
7408
|
-
* @param content The IHubContent item
|
|
7409
|
-
* @param site The site to compare content against
|
|
7410
|
-
* @returns the preferred id for the given content.
|
|
7411
|
-
*/
|
|
7412
|
-
function getContentIdentifier(content, site) {
|
|
7413
|
-
// We don't currently support slugs for hub initiative templates, solutions or surveys
|
|
7414
|
-
if (includes(["template", "feedback"], content.family)) {
|
|
7415
|
-
return content.id;
|
|
7416
|
-
}
|
|
7417
|
-
// If it is a hub page linked to a site, return the page slug at the
|
|
7418
|
-
// site data instead. Because this one is the original one that was used
|
|
7419
|
-
// to create the page url (not mutable once created) and the slug (below)
|
|
7420
|
-
// generated by the hub-indexer could simply change with page name.
|
|
7421
|
-
if (isPageType(content.type)) {
|
|
7422
|
-
// check if the page is linked to the current site
|
|
7423
|
-
var pages = getProp(site, "data.values.pages") || [];
|
|
7424
|
-
// if so, return the page slug otherwise the page id
|
|
7425
|
-
var page = pages.find(function (p) { return p.id === content.id; });
|
|
7426
|
-
return page ? page.slug : content.id;
|
|
7427
|
-
}
|
|
7428
|
-
// If a slug is present, always return it
|
|
7429
|
-
if (content.slug) {
|
|
7430
|
-
var slug = void 0;
|
|
7431
|
-
var orgKey = getProp(site, "domainInfo.orgKey");
|
|
7432
|
-
// Use namespaced slug when on the umbrella site
|
|
7433
|
-
if (getProp(site, "data.values.isUmbrella")) {
|
|
7434
|
-
slug = content.slug;
|
|
7435
|
-
}
|
|
7436
|
-
else {
|
|
7437
|
-
// Use shortened slug if the slug's namespace is the same as the orgKey
|
|
7438
|
-
slug = removeContextFromSlug(content.slug, orgKey);
|
|
7439
|
-
}
|
|
7440
|
-
return slug;
|
|
7441
|
-
}
|
|
7442
|
-
return content.hubId || content.id;
|
|
7443
|
-
}
|
|
7444
|
-
//////////////////////
|
|
7445
|
-
// Slug Helpers
|
|
7446
|
-
//////////////////////
|
|
7447
|
-
/**
|
|
7448
|
-
* Parse item ID and layer ID (if any) from dataset record ID
|
|
7449
|
-
*
|
|
7450
|
-
* @param datasetId Hub API dataset record id ({itemId}_{layerId} or {itemId})
|
|
7451
|
-
* @returns A hash with the `itemId` and `layerId` (if any)
|
|
7452
|
-
*/
|
|
7453
|
-
function parseDatasetId(datasetId) {
|
|
7454
|
-
var _a = datasetId ? datasetId.split("_") : [], itemId = _a[0], layerId = _a[1];
|
|
7455
|
-
return { itemId: itemId, layerId: layerId };
|
|
7456
|
-
}
|
|
7457
|
-
/**
|
|
7458
|
-
* Determine if an identifier is a Hub API slug
|
|
7459
|
-
*
|
|
7460
|
-
* @param identifier Hub API slug ({orgKey}::{title-as-slug} or {title-as-slug})
|
|
7461
|
-
* or record id ((itemId}_{layerId} or {itemId})
|
|
7462
|
-
* @returns true if the identifier is valid _and_ is **not** a record id
|
|
7463
|
-
*/
|
|
7464
|
-
function isSlug(identifier) {
|
|
7465
|
-
var itemId = parseDatasetId(identifier).itemId;
|
|
7466
|
-
if (!itemId || isGuid(itemId)) {
|
|
7467
|
-
// it's either invalid, or an item id, or a dataset id
|
|
7468
|
-
return false;
|
|
7469
|
-
}
|
|
7470
|
-
// otherwise assume it's a slug
|
|
7471
|
-
return true;
|
|
7472
|
-
}
|
|
7473
|
-
/**
|
|
7474
|
-
* Add a context (prefix) to slug if it doesn't already have one
|
|
7475
|
-
*
|
|
7476
|
-
* @param slug Hub API slug (with or without context)
|
|
7477
|
-
* @param context usually a portal's orgKey
|
|
7478
|
-
* @returns slug with context ({context}::{slug})
|
|
7479
|
-
*/
|
|
7480
|
-
function addContextToSlug(slug, context) {
|
|
7481
|
-
// the slug has an org key already e.g. dc::crime-incidents
|
|
7482
|
-
if (/.+::.+/.test(slug)) {
|
|
7483
|
-
return slug;
|
|
7484
|
-
// the slug belongs to the org that owns the site e.g. crime-incidents
|
|
7683
|
+
function addContextToSlug(slug, context) {
|
|
7684
|
+
// the slug has an org key already e.g. dc::crime-incidents
|
|
7685
|
+
if (/.+::.+/.test(slug)) {
|
|
7686
|
+
return slug;
|
|
7687
|
+
// the slug belongs to the org that owns the site e.g. crime-incidents
|
|
7485
7688
|
}
|
|
7486
7689
|
else {
|
|
7487
7690
|
return context + "::" + slug;
|
|
@@ -7502,145 +7705,1667 @@
|
|
|
7502
7705
|
return slug;
|
|
7503
7706
|
}
|
|
7504
7707
|
}
|
|
7708
|
+
|
|
7709
|
+
/* Copyright (c) 2018-2020 Environmental Systems Research Institute, Inc.
|
|
7710
|
+
* Apache-2.0 */
|
|
7505
7711
|
/**
|
|
7506
|
-
*
|
|
7712
|
+
* Allows an application to track a series of operations, storing information
|
|
7713
|
+
* about the arguments passes in and the results returned
|
|
7507
7714
|
*
|
|
7508
|
-
*
|
|
7715
|
+
* ```js
|
|
7716
|
+
* import { OperationStack } from '@esri/solution-common';
|
|
7509
7717
|
*
|
|
7510
|
-
*
|
|
7511
|
-
*/
|
|
7512
|
-
function getItemHubType(itemOrType) {
|
|
7513
|
-
/* tslint:disable no-console */
|
|
7514
|
-
console.warn("DEPRECATED: Use getFamily() instead. getItemHubType() will be removed at v10.0.0");
|
|
7515
|
-
/* tslint:enable no-console */
|
|
7516
|
-
if (typeof itemOrType === "string") {
|
|
7517
|
-
itemOrType = { type: itemOrType };
|
|
7518
|
-
}
|
|
7519
|
-
var itemType = normalizeItemType(itemOrType);
|
|
7520
|
-
// TODO: not all categories are Hub types, may need to validate
|
|
7521
|
-
return getCollection(itemType);
|
|
7522
|
-
}
|
|
7523
|
-
/**
|
|
7524
|
-
* Convert a Portal item to Hub content
|
|
7718
|
+
* const stack = new OperationStack();
|
|
7525
7719
|
*
|
|
7526
|
-
*
|
|
7527
|
-
*
|
|
7528
|
-
*
|
|
7529
|
-
|
|
7530
|
-
function itemToContent(item) {
|
|
7531
|
-
return composeContent(item);
|
|
7532
|
-
}
|
|
7533
|
-
/**
|
|
7534
|
-
* Convert a Hub API dataset resource to Hub Content
|
|
7720
|
+
* // start an operation by type
|
|
7721
|
+
* const id = stack.start('getItem');
|
|
7722
|
+
* //.. work happens...
|
|
7723
|
+
* stack.finish(id);
|
|
7535
7724
|
*
|
|
7536
|
-
*
|
|
7537
|
-
*
|
|
7538
|
-
*
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
server = _a.server, layers = _a.layers, layer = _a.layer, recordCount = _a.recordCount, statistics = _a.statistics,
|
|
7549
|
-
// additional attributes needed
|
|
7550
|
-
extent = _a.extent; _a.itemExtent; var searchDescription = _a.searchDescription;
|
|
7551
|
-
// get the layerId from the layer
|
|
7552
|
-
var layerId = layer && layer.id;
|
|
7553
|
-
// re-assemble the org as an enrichment
|
|
7554
|
-
var org = orgId && {
|
|
7555
|
-
id: orgId,
|
|
7556
|
-
name: orgName || organization,
|
|
7557
|
-
extent: orgExtent,
|
|
7558
|
-
};
|
|
7559
|
-
// compose a content out of the above
|
|
7560
|
-
var content = composeContent(item, {
|
|
7561
|
-
layerId: layerId,
|
|
7562
|
-
slug: slug,
|
|
7563
|
-
errors: errors,
|
|
7564
|
-
// setting this to null signals to enrichMetadata to skip this
|
|
7565
|
-
metadata: metadata || null,
|
|
7566
|
-
groupIds: groupIds,
|
|
7567
|
-
org: org,
|
|
7568
|
-
server: server,
|
|
7569
|
-
layers: layers,
|
|
7570
|
-
recordCount: recordCount,
|
|
7571
|
-
boundary: boundary,
|
|
7572
|
-
statistics: statistics,
|
|
7573
|
-
});
|
|
7574
|
-
// TODO: need to add searchDescription logic to composeContent()
|
|
7575
|
-
// or fetch it as a Hub enrichment like boundary
|
|
7576
|
-
if (searchDescription) {
|
|
7577
|
-
// overwrite default summary (from snippet) w/ search description
|
|
7578
|
-
content.summary = searchDescription;
|
|
7579
|
-
}
|
|
7580
|
-
// TODO: need to add extent logic to composeContent()
|
|
7581
|
-
// or fetch it as a Hub enrichment like boundary
|
|
7582
|
-
if (!isBBox(item.extent) && extent && isBBox(extent.coordinates)) {
|
|
7583
|
-
// we fall back to the extent derived by the API
|
|
7584
|
-
// which prefers layer or service extents and ultimately
|
|
7585
|
-
// falls back to the org's extent
|
|
7586
|
-
content.extent = extent.coordinates;
|
|
7587
|
-
}
|
|
7588
|
-
return content;
|
|
7589
|
-
}
|
|
7590
|
-
/**
|
|
7591
|
-
* Convert a Hub API dataset resource to a portal item
|
|
7725
|
+
* // start an operation with an Operation object
|
|
7726
|
+
* stack.start({
|
|
7727
|
+
* id: 'createItem_1',
|
|
7728
|
+
* type: 'createItem',
|
|
7729
|
+
* inputs: {
|
|
7730
|
+
* item: {...truncated...},
|
|
7731
|
+
* portal: 'https://www.arcgis.com',
|
|
7732
|
+
* username: 'jsmith'
|
|
7733
|
+
* },
|
|
7734
|
+
* });
|
|
7735
|
+
* // make the call
|
|
7736
|
+
* stack.finish('createItem_1', {newItemId: '00cf213'});
|
|
7592
7737
|
*
|
|
7593
|
-
*
|
|
7594
|
-
*
|
|
7595
|
-
*
|
|
7738
|
+
* // later you can get that information back out of the stack
|
|
7739
|
+
* const prevOp = stack.getOperation('createItem_1);
|
|
7740
|
+
*
|
|
7741
|
+
* // and if you need to roll back you can use the
|
|
7742
|
+
* // .cleanup and .output properties to help orchestrate
|
|
7743
|
+
*
|
|
7744
|
+
* ```
|
|
7745
|
+
*
|
|
7746
|
+
*
|
|
7747
|
+
* Can be used to implement "atomic" operations in an environment that does not
|
|
7748
|
+
* have this as a core feature
|
|
7596
7749
|
*/
|
|
7597
|
-
function
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7750
|
+
var OperationStack = /** @class */ (function () {
|
|
7751
|
+
/**
|
|
7752
|
+
* Creates an instance of OperationStack.
|
|
7753
|
+
* @memberof OperationStack
|
|
7754
|
+
*/
|
|
7755
|
+
function OperationStack() {
|
|
7756
|
+
this.operations = [];
|
|
7604
7757
|
}
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7758
|
+
/**
|
|
7759
|
+
* Start an Operation
|
|
7760
|
+
*
|
|
7761
|
+
* ```js
|
|
7762
|
+
* const stack = new OperationStack();
|
|
7763
|
+
* stack.startOperation({
|
|
7764
|
+
* id: 'get-bc3',
|
|
7765
|
+
* type: 'getItem',
|
|
7766
|
+
* cleanup: 'n/a',
|
|
7767
|
+
* inputs: {
|
|
7768
|
+
* id: 'bc3',
|
|
7769
|
+
* owner: 'vader'
|
|
7770
|
+
* }
|
|
7771
|
+
* });
|
|
7772
|
+
* // do work
|
|
7773
|
+
* stack.finish('get-bc3');
|
|
7774
|
+
* ```
|
|
7775
|
+
*
|
|
7776
|
+
*
|
|
7777
|
+
* @param {IOperation} operation
|
|
7778
|
+
* @memberof OperationStack
|
|
7779
|
+
*/
|
|
7780
|
+
OperationStack.prototype.startOperation = function (operation) {
|
|
7781
|
+
var op = cloneObject$1(operation);
|
|
7782
|
+
op.startedAt = new Date().getTime();
|
|
7783
|
+
op.state = "working";
|
|
7784
|
+
this.operations.push(op);
|
|
7785
|
+
};
|
|
7786
|
+
/**
|
|
7787
|
+
* Start an operation without requiring a full operation
|
|
7788
|
+
*
|
|
7789
|
+
* ```js
|
|
7790
|
+
* const opId = stack.start('getItems');
|
|
7791
|
+
* //...work happens
|
|
7792
|
+
* stack.finish(opId);
|
|
7793
|
+
* ```
|
|
7794
|
+
*
|
|
7795
|
+
* @param {string} type Type of the operation. i.e. getItem
|
|
7796
|
+
* @param {Record<string, unknown>} [params] optionally pass in id, inputs, cleanup
|
|
7797
|
+
* @returns {string} Identifier of the new stack entry
|
|
7798
|
+
* @memberof OperationStack
|
|
7799
|
+
*/
|
|
7800
|
+
OperationStack.prototype.start = function (type, params) {
|
|
7801
|
+
var op = {
|
|
7802
|
+
type: type,
|
|
7803
|
+
id: getWithDefault$1(params, "id", createId(type + "_")),
|
|
7804
|
+
inputs: getWithDefault$1(params, "inputs", {}),
|
|
7805
|
+
cleanup: getWithDefault$1(params, "cleanup", "n/a"),
|
|
7806
|
+
startedAt: new Date().getTime(),
|
|
7807
|
+
state: "working"
|
|
7808
|
+
};
|
|
7809
|
+
this.operations.push(op);
|
|
7810
|
+
return op.id;
|
|
7811
|
+
};
|
|
7812
|
+
/**
|
|
7813
|
+
* Returns a reference to an Operation
|
|
7814
|
+
*
|
|
7815
|
+
* @param {string} id Unique Identifier
|
|
7816
|
+
* @returns {Operation}
|
|
7817
|
+
* @memberof OperationStack
|
|
7818
|
+
*/
|
|
7819
|
+
OperationStack.prototype.getOperation = function (id) {
|
|
7820
|
+
return this.operations.find(function (o) { return o.id === id; });
|
|
7821
|
+
};
|
|
7822
|
+
/**
|
|
7823
|
+
* Returns reference to the operations array
|
|
7824
|
+
*
|
|
7825
|
+
* @returns {Operation[]}
|
|
7826
|
+
* @memberof OperationStack
|
|
7827
|
+
*/
|
|
7828
|
+
OperationStack.prototype.getOperations = function () {
|
|
7829
|
+
return this.operations;
|
|
7830
|
+
};
|
|
7831
|
+
/**
|
|
7832
|
+
* Inform the stack that an operation has finished.
|
|
7833
|
+
*
|
|
7834
|
+
* This will append in a duration property, and mark
|
|
7835
|
+
* the state as 'completed'.
|
|
7836
|
+
*
|
|
7837
|
+
* @param {string} id Unique identifier of the Operation
|
|
7838
|
+
* @param {Record<string, unknown>} [options] outputs
|
|
7839
|
+
* @memberof OperationStack
|
|
7840
|
+
*/
|
|
7841
|
+
OperationStack.prototype.finish = function (id, options) {
|
|
7842
|
+
var op = this.getOperation(id);
|
|
7843
|
+
if (op) {
|
|
7844
|
+
op.duration = new Date().getTime() - op.startedAt;
|
|
7845
|
+
op.state = "completed";
|
|
7846
|
+
if (options) {
|
|
7847
|
+
op.output = cloneObject$1(options);
|
|
7848
|
+
}
|
|
7849
|
+
}
|
|
7850
|
+
else {
|
|
7851
|
+
throw new Error("No operation with id " + id + " present in stack");
|
|
7852
|
+
}
|
|
7853
|
+
};
|
|
7854
|
+
/**
|
|
7855
|
+
* Merge a serialized operation stack into
|
|
7856
|
+
* a stack instance
|
|
7857
|
+
*
|
|
7858
|
+
* ```js
|
|
7859
|
+
* import { OperationStack } from '@esri/solution-common';
|
|
7860
|
+
* function someFunction() {
|
|
7861
|
+
* const stack = new OperationStack();
|
|
7862
|
+
* stack.start('getItem', {id: 'get-bc3'});
|
|
7863
|
+
* // do some work...
|
|
7864
|
+
* stack.finish('get-bc3');
|
|
7865
|
+
*
|
|
7866
|
+
* const itm = {title: 'Fake Item', type: 'Web Map'};
|
|
7867
|
+
* // create an entry for the function we are about to call...
|
|
7868
|
+
* stack.start('createItem', {id: 'createItem_01', inputs: {item: itm}});
|
|
7869
|
+
* // call a function that does work, and has it's own stack
|
|
7870
|
+
* // and returns a serialized version as part of it's results
|
|
7871
|
+
* return createItem(itm)
|
|
7872
|
+
* .then((result) => {
|
|
7873
|
+
* // tell the stack the last operation finished...
|
|
7874
|
+
* stack.finish('createItem_01');
|
|
7875
|
+
* // merge in the stack from the function we called
|
|
7876
|
+
* stack.merge(result.stack);
|
|
7877
|
+
* // > stack.getCompleted().length === 3
|
|
7878
|
+
* });
|
|
7879
|
+
* }
|
|
7880
|
+
*
|
|
7881
|
+
* function createItem (itm) {
|
|
7882
|
+
* const otherStack = new OperationStack();
|
|
7883
|
+
* const id = otherStack.start('createItem');
|
|
7884
|
+
* // make calls to create item etc
|
|
7885
|
+
* otherStack.finish(id, {itemId: newItem.id});
|
|
7886
|
+
* otherStack.start('protectItem', {id: 'protect-00c'});
|
|
7887
|
+
* // make call to protect item...
|
|
7888
|
+
* otherStack.finish('protect-00c');
|
|
7889
|
+
* // all done... return a result with a stack
|
|
7890
|
+
* return Promise.resolve({
|
|
7891
|
+
* success:true,
|
|
7892
|
+
* stack: otherStack.serialize()
|
|
7893
|
+
* });
|
|
7894
|
+
* }
|
|
7895
|
+
* ```
|
|
7896
|
+
*
|
|
7897
|
+
* Typically used to create a comprehensive list of operations
|
|
7898
|
+
* when a function returns a `SerializedOperationStack` as part of
|
|
7899
|
+
* it's response
|
|
7900
|
+
*
|
|
7901
|
+
*
|
|
7902
|
+
* @param {ISerializedOperationStack} stack
|
|
7903
|
+
* @memberof OperationStack
|
|
7904
|
+
*/
|
|
7905
|
+
OperationStack.prototype.merge = function (stack) {
|
|
7906
|
+
this.operations = __spreadArrays(this.operations, stack.operations);
|
|
7907
|
+
};
|
|
7908
|
+
/**
|
|
7909
|
+
* Get a list of the completed operations
|
|
7910
|
+
*
|
|
7911
|
+
* @returns {IOperation[]}
|
|
7912
|
+
* @memberof OperationStack
|
|
7913
|
+
*/
|
|
7914
|
+
OperationStack.prototype.getCompleted = function () {
|
|
7915
|
+
return cloneObject$1(this.operations.filter(function (e) { return e.state === "completed"; }));
|
|
7916
|
+
};
|
|
7917
|
+
/**
|
|
7918
|
+
* Return an array of working operations
|
|
7919
|
+
*
|
|
7920
|
+
* @returns {IOperation[]}
|
|
7921
|
+
* @memberof OperationStack
|
|
7922
|
+
*/
|
|
7923
|
+
OperationStack.prototype.getWorking = function () {
|
|
7924
|
+
return cloneObject$1(this.operations.filter(function (e) { return e.state === "working"; }));
|
|
7925
|
+
};
|
|
7926
|
+
/**
|
|
7927
|
+
* Serialize the completed operations into a set of
|
|
7928
|
+
* human readable messages, sorted by the startedAt timestamp
|
|
7929
|
+
*
|
|
7930
|
+
*
|
|
7931
|
+
* @returns {string}
|
|
7932
|
+
* @memberof IOperationStack
|
|
7933
|
+
*/
|
|
7934
|
+
OperationStack.prototype.toString = function () {
|
|
7935
|
+
// sort the operations by StartedAt
|
|
7936
|
+
var allOps = this.operations.sort(function (a, b) {
|
|
7937
|
+
if (a.startedAt < b.startedAt) {
|
|
7938
|
+
return -1;
|
|
7939
|
+
}
|
|
7940
|
+
if (b.startedAt < a.startedAt) {
|
|
7941
|
+
return 1;
|
|
7942
|
+
}
|
|
7943
|
+
return 0;
|
|
7944
|
+
});
|
|
7945
|
+
return allOps.map(getOperationMessage).join("\n");
|
|
7946
|
+
};
|
|
7947
|
+
/**
|
|
7948
|
+
* Serialize the stack into simple objects
|
|
7949
|
+
*
|
|
7950
|
+
* @returns {ISerializedOperationStack}
|
|
7951
|
+
* @memberof OperationStack
|
|
7952
|
+
*/
|
|
7953
|
+
OperationStack.prototype.serialize = function () {
|
|
7954
|
+
return {
|
|
7955
|
+
operations: cloneObject$1(this.getOperations())
|
|
7956
|
+
};
|
|
7957
|
+
};
|
|
7958
|
+
return OperationStack;
|
|
7959
|
+
}());
|
|
7960
|
+
function getOperationMessage(op) {
|
|
7961
|
+
var msg = op.startedAt + " : Operation " + op.id + " started with inputs " + JSON.stringify(op.inputs) + " but was not completed";
|
|
7962
|
+
if (op.state === "completed") {
|
|
7963
|
+
msg = op.startedAt + " : Operation " + op.id + " took " + op.duration + " ms with inputs " + JSON.stringify(op.inputs) + " and output " + (op.output ? JSON.stringify(op.output) : "n/a");
|
|
7964
|
+
}
|
|
7965
|
+
return msg;
|
|
7966
|
+
}
|
|
7967
|
+
|
|
7968
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
7969
|
+
|
|
7970
|
+
function createCommonjsModule(fn, basedir, module) {
|
|
7971
|
+
return module = {
|
|
7972
|
+
path: basedir,
|
|
7973
|
+
exports: {},
|
|
7974
|
+
require: function (path, base) {
|
|
7975
|
+
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
|
7976
|
+
}
|
|
7977
|
+
}, fn(module, module.exports), module.exports;
|
|
7978
|
+
}
|
|
7979
|
+
|
|
7980
|
+
function commonjsRequire () {
|
|
7981
|
+
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
7982
|
+
}
|
|
7983
|
+
|
|
7984
|
+
var util = createCommonjsModule(function (module, exports) {
|
|
7985
|
+
var getAllMatches = function(string, regex) {
|
|
7986
|
+
var matches = [];
|
|
7987
|
+
var match = regex.exec(string);
|
|
7988
|
+
while (match) {
|
|
7989
|
+
var allmatches = [];
|
|
7990
|
+
var len = match.length;
|
|
7991
|
+
for (var index = 0; index < len; index++) {
|
|
7992
|
+
allmatches.push(match[index]);
|
|
7993
|
+
}
|
|
7994
|
+
matches.push(allmatches);
|
|
7995
|
+
match = regex.exec(string);
|
|
7996
|
+
}
|
|
7997
|
+
return matches;
|
|
7998
|
+
};
|
|
7999
|
+
|
|
8000
|
+
|
|
8001
|
+
var doesMatch = function(string,regex){
|
|
8002
|
+
var match = regex.exec(string);
|
|
8003
|
+
if(match === null || typeof match === "undefined") return false;
|
|
8004
|
+
else return true;
|
|
8005
|
+
};
|
|
8006
|
+
|
|
8007
|
+
var doesNotMatch = function(string,regex){
|
|
8008
|
+
return !doesMatch(string,regex);
|
|
8009
|
+
};
|
|
8010
|
+
|
|
8011
|
+
|
|
8012
|
+
exports.isExist= function(v){
|
|
8013
|
+
return typeof v !== "undefined";
|
|
8014
|
+
};
|
|
8015
|
+
|
|
8016
|
+
exports.isEmptyObject= function(obj) {
|
|
8017
|
+
return Object.keys(obj).length === 0
|
|
8018
|
+
};
|
|
8019
|
+
|
|
8020
|
+
/**
|
|
8021
|
+
* Copy all the properties of a into b.
|
|
8022
|
+
* @param {*} target
|
|
8023
|
+
* @param {*} a
|
|
8024
|
+
*/
|
|
8025
|
+
exports.merge =function (target,a){
|
|
8026
|
+
if(a){
|
|
8027
|
+
var keys = Object.keys(a); // will return an array of own properties
|
|
8028
|
+
var len = keys.length; //don't make it inline
|
|
8029
|
+
for(var i = 0; i < len; i++){
|
|
8030
|
+
target[keys[i]] = a[keys[i]] ;
|
|
8031
|
+
}
|
|
8032
|
+
}
|
|
8033
|
+
};
|
|
8034
|
+
/* exports.merge =function (b,a){
|
|
8035
|
+
return Object.assign(b,a);
|
|
8036
|
+
} */
|
|
8037
|
+
|
|
8038
|
+
exports.getValue = function (v){
|
|
8039
|
+
if(exports.isExist(v)){
|
|
8040
|
+
return v;
|
|
8041
|
+
}else {
|
|
8042
|
+
return "";
|
|
8043
|
+
}
|
|
8044
|
+
};
|
|
8045
|
+
|
|
8046
|
+
exports.doesMatch = doesMatch;
|
|
8047
|
+
exports.doesNotMatch = doesNotMatch;
|
|
8048
|
+
exports.getAllMatches = getAllMatches;
|
|
8049
|
+
});
|
|
8050
|
+
|
|
8051
|
+
var xmlNode = function(tagname,parent,val){
|
|
8052
|
+
this.tagname = tagname;
|
|
8053
|
+
this.parent = parent;
|
|
8054
|
+
this.child = [];//child tags
|
|
8055
|
+
this.attrsMap;//attributes map
|
|
8056
|
+
this.val = val;//text only
|
|
8057
|
+
this.addChild = function (child){
|
|
8058
|
+
this.child.push(child);
|
|
8059
|
+
};
|
|
8060
|
+
};
|
|
8061
|
+
|
|
8062
|
+
var he = createCommonjsModule(function (module, exports) {
|
|
8063
|
+
(function(root) {
|
|
8064
|
+
|
|
8065
|
+
// Detect free variables `exports`.
|
|
8066
|
+
var freeExports = exports;
|
|
8067
|
+
|
|
8068
|
+
// Detect free variable `module`.
|
|
8069
|
+
var freeModule = module &&
|
|
8070
|
+
module.exports == freeExports && module;
|
|
8071
|
+
|
|
8072
|
+
// Detect free variable `global`, from Node.js or Browserified code,
|
|
8073
|
+
// and use it as `root`.
|
|
8074
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal;
|
|
8075
|
+
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
|
|
8076
|
+
root = freeGlobal;
|
|
8077
|
+
}
|
|
8078
|
+
|
|
8079
|
+
/*--------------------------------------------------------------------------*/
|
|
8080
|
+
|
|
8081
|
+
// All astral symbols.
|
|
8082
|
+
var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
8083
|
+
// All ASCII symbols (not just printable ASCII) except those listed in the
|
|
8084
|
+
// first column of the overrides table.
|
|
8085
|
+
// https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides
|
|
8086
|
+
var regexAsciiWhitelist = /[\x01-\x7F]/g;
|
|
8087
|
+
// All BMP symbols that are not ASCII newlines, printable ASCII symbols, or
|
|
8088
|
+
// code points listed in the first column of the overrides table on
|
|
8089
|
+
// https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides.
|
|
8090
|
+
var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;
|
|
8091
|
+
|
|
8092
|
+
var regexEncodeNonAscii = /<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g;
|
|
8093
|
+
var encodeMap = {'\xAD':'shy','\u200C':'zwnj','\u200D':'zwj','\u200E':'lrm','\u2063':'ic','\u2062':'it','\u2061':'af','\u200F':'rlm','\u200B':'ZeroWidthSpace','\u2060':'NoBreak','\u0311':'DownBreve','\u20DB':'tdot','\u20DC':'DotDot','\t':'Tab','\n':'NewLine','\u2008':'puncsp','\u205F':'MediumSpace','\u2009':'thinsp','\u200A':'hairsp','\u2004':'emsp13','\u2002':'ensp','\u2005':'emsp14','\u2003':'emsp','\u2007':'numsp','\xA0':'nbsp','\u205F\u200A':'ThickSpace','\u203E':'oline','_':'lowbar','\u2010':'dash','\u2013':'ndash','\u2014':'mdash','\u2015':'horbar',',':'comma',';':'semi','\u204F':'bsemi',':':'colon','\u2A74':'Colone','!':'excl','\xA1':'iexcl','?':'quest','\xBF':'iquest','.':'period','\u2025':'nldr','\u2026':'mldr','\xB7':'middot','\'':'apos','\u2018':'lsquo','\u2019':'rsquo','\u201A':'sbquo','\u2039':'lsaquo','\u203A':'rsaquo','"':'quot','\u201C':'ldquo','\u201D':'rdquo','\u201E':'bdquo','\xAB':'laquo','\xBB':'raquo','(':'lpar',')':'rpar','[':'lsqb',']':'rsqb','{':'lcub','}':'rcub','\u2308':'lceil','\u2309':'rceil','\u230A':'lfloor','\u230B':'rfloor','\u2985':'lopar','\u2986':'ropar','\u298B':'lbrke','\u298C':'rbrke','\u298D':'lbrkslu','\u298E':'rbrksld','\u298F':'lbrksld','\u2990':'rbrkslu','\u2991':'langd','\u2992':'rangd','\u2993':'lparlt','\u2994':'rpargt','\u2995':'gtlPar','\u2996':'ltrPar','\u27E6':'lobrk','\u27E7':'robrk','\u27E8':'lang','\u27E9':'rang','\u27EA':'Lang','\u27EB':'Rang','\u27EC':'loang','\u27ED':'roang','\u2772':'lbbrk','\u2773':'rbbrk','\u2016':'Vert','\xA7':'sect','\xB6':'para','@':'commat','*':'ast','/':'sol','undefined':null,'&':'amp','#':'num','%':'percnt','\u2030':'permil','\u2031':'pertenk','\u2020':'dagger','\u2021':'Dagger','\u2022':'bull','\u2043':'hybull','\u2032':'prime','\u2033':'Prime','\u2034':'tprime','\u2057':'qprime','\u2035':'bprime','\u2041':'caret','`':'grave','\xB4':'acute','\u02DC':'tilde','^':'Hat','\xAF':'macr','\u02D8':'breve','\u02D9':'dot','\xA8':'die','\u02DA':'ring','\u02DD':'dblac','\xB8':'cedil','\u02DB':'ogon','\u02C6':'circ','\u02C7':'caron','\xB0':'deg','\xA9':'copy','\xAE':'reg','\u2117':'copysr','\u2118':'wp','\u211E':'rx','\u2127':'mho','\u2129':'iiota','\u2190':'larr','\u219A':'nlarr','\u2192':'rarr','\u219B':'nrarr','\u2191':'uarr','\u2193':'darr','\u2194':'harr','\u21AE':'nharr','\u2195':'varr','\u2196':'nwarr','\u2197':'nearr','\u2198':'searr','\u2199':'swarr','\u219D':'rarrw','\u219D\u0338':'nrarrw','\u219E':'Larr','\u219F':'Uarr','\u21A0':'Rarr','\u21A1':'Darr','\u21A2':'larrtl','\u21A3':'rarrtl','\u21A4':'mapstoleft','\u21A5':'mapstoup','\u21A6':'map','\u21A7':'mapstodown','\u21A9':'larrhk','\u21AA':'rarrhk','\u21AB':'larrlp','\u21AC':'rarrlp','\u21AD':'harrw','\u21B0':'lsh','\u21B1':'rsh','\u21B2':'ldsh','\u21B3':'rdsh','\u21B5':'crarr','\u21B6':'cularr','\u21B7':'curarr','\u21BA':'olarr','\u21BB':'orarr','\u21BC':'lharu','\u21BD':'lhard','\u21BE':'uharr','\u21BF':'uharl','\u21C0':'rharu','\u21C1':'rhard','\u21C2':'dharr','\u21C3':'dharl','\u21C4':'rlarr','\u21C5':'udarr','\u21C6':'lrarr','\u21C7':'llarr','\u21C8':'uuarr','\u21C9':'rrarr','\u21CA':'ddarr','\u21CB':'lrhar','\u21CC':'rlhar','\u21D0':'lArr','\u21CD':'nlArr','\u21D1':'uArr','\u21D2':'rArr','\u21CF':'nrArr','\u21D3':'dArr','\u21D4':'iff','\u21CE':'nhArr','\u21D5':'vArr','\u21D6':'nwArr','\u21D7':'neArr','\u21D8':'seArr','\u21D9':'swArr','\u21DA':'lAarr','\u21DB':'rAarr','\u21DD':'zigrarr','\u21E4':'larrb','\u21E5':'rarrb','\u21F5':'duarr','\u21FD':'loarr','\u21FE':'roarr','\u21FF':'hoarr','\u2200':'forall','\u2201':'comp','\u2202':'part','\u2202\u0338':'npart','\u2203':'exist','\u2204':'nexist','\u2205':'empty','\u2207':'Del','\u2208':'in','\u2209':'notin','\u220B':'ni','\u220C':'notni','\u03F6':'bepsi','\u220F':'prod','\u2210':'coprod','\u2211':'sum','+':'plus','\xB1':'pm','\xF7':'div','\xD7':'times','<':'lt','\u226E':'nlt','<\u20D2':'nvlt','=':'equals','\u2260':'ne','=\u20E5':'bne','\u2A75':'Equal','>':'gt','\u226F':'ngt','>\u20D2':'nvgt','\xAC':'not','|':'vert','\xA6':'brvbar','\u2212':'minus','\u2213':'mp','\u2214':'plusdo','\u2044':'frasl','\u2216':'setmn','\u2217':'lowast','\u2218':'compfn','\u221A':'Sqrt','\u221D':'prop','\u221E':'infin','\u221F':'angrt','\u2220':'ang','\u2220\u20D2':'nang','\u2221':'angmsd','\u2222':'angsph','\u2223':'mid','\u2224':'nmid','\u2225':'par','\u2226':'npar','\u2227':'and','\u2228':'or','\u2229':'cap','\u2229\uFE00':'caps','\u222A':'cup','\u222A\uFE00':'cups','\u222B':'int','\u222C':'Int','\u222D':'tint','\u2A0C':'qint','\u222E':'oint','\u222F':'Conint','\u2230':'Cconint','\u2231':'cwint','\u2232':'cwconint','\u2233':'awconint','\u2234':'there4','\u2235':'becaus','\u2236':'ratio','\u2237':'Colon','\u2238':'minusd','\u223A':'mDDot','\u223B':'homtht','\u223C':'sim','\u2241':'nsim','\u223C\u20D2':'nvsim','\u223D':'bsim','\u223D\u0331':'race','\u223E':'ac','\u223E\u0333':'acE','\u223F':'acd','\u2240':'wr','\u2242':'esim','\u2242\u0338':'nesim','\u2243':'sime','\u2244':'nsime','\u2245':'cong','\u2247':'ncong','\u2246':'simne','\u2248':'ap','\u2249':'nap','\u224A':'ape','\u224B':'apid','\u224B\u0338':'napid','\u224C':'bcong','\u224D':'CupCap','\u226D':'NotCupCap','\u224D\u20D2':'nvap','\u224E':'bump','\u224E\u0338':'nbump','\u224F':'bumpe','\u224F\u0338':'nbumpe','\u2250':'doteq','\u2250\u0338':'nedot','\u2251':'eDot','\u2252':'efDot','\u2253':'erDot','\u2254':'colone','\u2255':'ecolon','\u2256':'ecir','\u2257':'cire','\u2259':'wedgeq','\u225A':'veeeq','\u225C':'trie','\u225F':'equest','\u2261':'equiv','\u2262':'nequiv','\u2261\u20E5':'bnequiv','\u2264':'le','\u2270':'nle','\u2264\u20D2':'nvle','\u2265':'ge','\u2271':'nge','\u2265\u20D2':'nvge','\u2266':'lE','\u2266\u0338':'nlE','\u2267':'gE','\u2267\u0338':'ngE','\u2268\uFE00':'lvnE','\u2268':'lnE','\u2269':'gnE','\u2269\uFE00':'gvnE','\u226A':'ll','\u226A\u0338':'nLtv','\u226A\u20D2':'nLt','\u226B':'gg','\u226B\u0338':'nGtv','\u226B\u20D2':'nGt','\u226C':'twixt','\u2272':'lsim','\u2274':'nlsim','\u2273':'gsim','\u2275':'ngsim','\u2276':'lg','\u2278':'ntlg','\u2277':'gl','\u2279':'ntgl','\u227A':'pr','\u2280':'npr','\u227B':'sc','\u2281':'nsc','\u227C':'prcue','\u22E0':'nprcue','\u227D':'sccue','\u22E1':'nsccue','\u227E':'prsim','\u227F':'scsim','\u227F\u0338':'NotSucceedsTilde','\u2282':'sub','\u2284':'nsub','\u2282\u20D2':'vnsub','\u2283':'sup','\u2285':'nsup','\u2283\u20D2':'vnsup','\u2286':'sube','\u2288':'nsube','\u2287':'supe','\u2289':'nsupe','\u228A\uFE00':'vsubne','\u228A':'subne','\u228B\uFE00':'vsupne','\u228B':'supne','\u228D':'cupdot','\u228E':'uplus','\u228F':'sqsub','\u228F\u0338':'NotSquareSubset','\u2290':'sqsup','\u2290\u0338':'NotSquareSuperset','\u2291':'sqsube','\u22E2':'nsqsube','\u2292':'sqsupe','\u22E3':'nsqsupe','\u2293':'sqcap','\u2293\uFE00':'sqcaps','\u2294':'sqcup','\u2294\uFE00':'sqcups','\u2295':'oplus','\u2296':'ominus','\u2297':'otimes','\u2298':'osol','\u2299':'odot','\u229A':'ocir','\u229B':'oast','\u229D':'odash','\u229E':'plusb','\u229F':'minusb','\u22A0':'timesb','\u22A1':'sdotb','\u22A2':'vdash','\u22AC':'nvdash','\u22A3':'dashv','\u22A4':'top','\u22A5':'bot','\u22A7':'models','\u22A8':'vDash','\u22AD':'nvDash','\u22A9':'Vdash','\u22AE':'nVdash','\u22AA':'Vvdash','\u22AB':'VDash','\u22AF':'nVDash','\u22B0':'prurel','\u22B2':'vltri','\u22EA':'nltri','\u22B3':'vrtri','\u22EB':'nrtri','\u22B4':'ltrie','\u22EC':'nltrie','\u22B4\u20D2':'nvltrie','\u22B5':'rtrie','\u22ED':'nrtrie','\u22B5\u20D2':'nvrtrie','\u22B6':'origof','\u22B7':'imof','\u22B8':'mumap','\u22B9':'hercon','\u22BA':'intcal','\u22BB':'veebar','\u22BD':'barvee','\u22BE':'angrtvb','\u22BF':'lrtri','\u22C0':'Wedge','\u22C1':'Vee','\u22C2':'xcap','\u22C3':'xcup','\u22C4':'diam','\u22C5':'sdot','\u22C6':'Star','\u22C7':'divonx','\u22C8':'bowtie','\u22C9':'ltimes','\u22CA':'rtimes','\u22CB':'lthree','\u22CC':'rthree','\u22CD':'bsime','\u22CE':'cuvee','\u22CF':'cuwed','\u22D0':'Sub','\u22D1':'Sup','\u22D2':'Cap','\u22D3':'Cup','\u22D4':'fork','\u22D5':'epar','\u22D6':'ltdot','\u22D7':'gtdot','\u22D8':'Ll','\u22D8\u0338':'nLl','\u22D9':'Gg','\u22D9\u0338':'nGg','\u22DA\uFE00':'lesg','\u22DA':'leg','\u22DB':'gel','\u22DB\uFE00':'gesl','\u22DE':'cuepr','\u22DF':'cuesc','\u22E6':'lnsim','\u22E7':'gnsim','\u22E8':'prnsim','\u22E9':'scnsim','\u22EE':'vellip','\u22EF':'ctdot','\u22F0':'utdot','\u22F1':'dtdot','\u22F2':'disin','\u22F3':'isinsv','\u22F4':'isins','\u22F5':'isindot','\u22F5\u0338':'notindot','\u22F6':'notinvc','\u22F7':'notinvb','\u22F9':'isinE','\u22F9\u0338':'notinE','\u22FA':'nisd','\u22FB':'xnis','\u22FC':'nis','\u22FD':'notnivc','\u22FE':'notnivb','\u2305':'barwed','\u2306':'Barwed','\u230C':'drcrop','\u230D':'dlcrop','\u230E':'urcrop','\u230F':'ulcrop','\u2310':'bnot','\u2312':'profline','\u2313':'profsurf','\u2315':'telrec','\u2316':'target','\u231C':'ulcorn','\u231D':'urcorn','\u231E':'dlcorn','\u231F':'drcorn','\u2322':'frown','\u2323':'smile','\u232D':'cylcty','\u232E':'profalar','\u2336':'topbot','\u233D':'ovbar','\u233F':'solbar','\u237C':'angzarr','\u23B0':'lmoust','\u23B1':'rmoust','\u23B4':'tbrk','\u23B5':'bbrk','\u23B6':'bbrktbrk','\u23DC':'OverParenthesis','\u23DD':'UnderParenthesis','\u23DE':'OverBrace','\u23DF':'UnderBrace','\u23E2':'trpezium','\u23E7':'elinters','\u2423':'blank','\u2500':'boxh','\u2502':'boxv','\u250C':'boxdr','\u2510':'boxdl','\u2514':'boxur','\u2518':'boxul','\u251C':'boxvr','\u2524':'boxvl','\u252C':'boxhd','\u2534':'boxhu','\u253C':'boxvh','\u2550':'boxH','\u2551':'boxV','\u2552':'boxdR','\u2553':'boxDr','\u2554':'boxDR','\u2555':'boxdL','\u2556':'boxDl','\u2557':'boxDL','\u2558':'boxuR','\u2559':'boxUr','\u255A':'boxUR','\u255B':'boxuL','\u255C':'boxUl','\u255D':'boxUL','\u255E':'boxvR','\u255F':'boxVr','\u2560':'boxVR','\u2561':'boxvL','\u2562':'boxVl','\u2563':'boxVL','\u2564':'boxHd','\u2565':'boxhD','\u2566':'boxHD','\u2567':'boxHu','\u2568':'boxhU','\u2569':'boxHU','\u256A':'boxvH','\u256B':'boxVh','\u256C':'boxVH','\u2580':'uhblk','\u2584':'lhblk','\u2588':'block','\u2591':'blk14','\u2592':'blk12','\u2593':'blk34','\u25A1':'squ','\u25AA':'squf','\u25AB':'EmptyVerySmallSquare','\u25AD':'rect','\u25AE':'marker','\u25B1':'fltns','\u25B3':'xutri','\u25B4':'utrif','\u25B5':'utri','\u25B8':'rtrif','\u25B9':'rtri','\u25BD':'xdtri','\u25BE':'dtrif','\u25BF':'dtri','\u25C2':'ltrif','\u25C3':'ltri','\u25CA':'loz','\u25CB':'cir','\u25EC':'tridot','\u25EF':'xcirc','\u25F8':'ultri','\u25F9':'urtri','\u25FA':'lltri','\u25FB':'EmptySmallSquare','\u25FC':'FilledSmallSquare','\u2605':'starf','\u2606':'star','\u260E':'phone','\u2640':'female','\u2642':'male','\u2660':'spades','\u2663':'clubs','\u2665':'hearts','\u2666':'diams','\u266A':'sung','\u2713':'check','\u2717':'cross','\u2720':'malt','\u2736':'sext','\u2758':'VerticalSeparator','\u27C8':'bsolhsub','\u27C9':'suphsol','\u27F5':'xlarr','\u27F6':'xrarr','\u27F7':'xharr','\u27F8':'xlArr','\u27F9':'xrArr','\u27FA':'xhArr','\u27FC':'xmap','\u27FF':'dzigrarr','\u2902':'nvlArr','\u2903':'nvrArr','\u2904':'nvHarr','\u2905':'Map','\u290C':'lbarr','\u290D':'rbarr','\u290E':'lBarr','\u290F':'rBarr','\u2910':'RBarr','\u2911':'DDotrahd','\u2912':'UpArrowBar','\u2913':'DownArrowBar','\u2916':'Rarrtl','\u2919':'latail','\u291A':'ratail','\u291B':'lAtail','\u291C':'rAtail','\u291D':'larrfs','\u291E':'rarrfs','\u291F':'larrbfs','\u2920':'rarrbfs','\u2923':'nwarhk','\u2924':'nearhk','\u2925':'searhk','\u2926':'swarhk','\u2927':'nwnear','\u2928':'toea','\u2929':'tosa','\u292A':'swnwar','\u2933':'rarrc','\u2933\u0338':'nrarrc','\u2935':'cudarrr','\u2936':'ldca','\u2937':'rdca','\u2938':'cudarrl','\u2939':'larrpl','\u293C':'curarrm','\u293D':'cularrp','\u2945':'rarrpl','\u2948':'harrcir','\u2949':'Uarrocir','\u294A':'lurdshar','\u294B':'ldrushar','\u294E':'LeftRightVector','\u294F':'RightUpDownVector','\u2950':'DownLeftRightVector','\u2951':'LeftUpDownVector','\u2952':'LeftVectorBar','\u2953':'RightVectorBar','\u2954':'RightUpVectorBar','\u2955':'RightDownVectorBar','\u2956':'DownLeftVectorBar','\u2957':'DownRightVectorBar','\u2958':'LeftUpVectorBar','\u2959':'LeftDownVectorBar','\u295A':'LeftTeeVector','\u295B':'RightTeeVector','\u295C':'RightUpTeeVector','\u295D':'RightDownTeeVector','\u295E':'DownLeftTeeVector','\u295F':'DownRightTeeVector','\u2960':'LeftUpTeeVector','\u2961':'LeftDownTeeVector','\u2962':'lHar','\u2963':'uHar','\u2964':'rHar','\u2965':'dHar','\u2966':'luruhar','\u2967':'ldrdhar','\u2968':'ruluhar','\u2969':'rdldhar','\u296A':'lharul','\u296B':'llhard','\u296C':'rharul','\u296D':'lrhard','\u296E':'udhar','\u296F':'duhar','\u2970':'RoundImplies','\u2971':'erarr','\u2972':'simrarr','\u2973':'larrsim','\u2974':'rarrsim','\u2975':'rarrap','\u2976':'ltlarr','\u2978':'gtrarr','\u2979':'subrarr','\u297B':'suplarr','\u297C':'lfisht','\u297D':'rfisht','\u297E':'ufisht','\u297F':'dfisht','\u299A':'vzigzag','\u299C':'vangrt','\u299D':'angrtvbd','\u29A4':'ange','\u29A5':'range','\u29A6':'dwangle','\u29A7':'uwangle','\u29A8':'angmsdaa','\u29A9':'angmsdab','\u29AA':'angmsdac','\u29AB':'angmsdad','\u29AC':'angmsdae','\u29AD':'angmsdaf','\u29AE':'angmsdag','\u29AF':'angmsdah','\u29B0':'bemptyv','\u29B1':'demptyv','\u29B2':'cemptyv','\u29B3':'raemptyv','\u29B4':'laemptyv','\u29B5':'ohbar','\u29B6':'omid','\u29B7':'opar','\u29B9':'operp','\u29BB':'olcross','\u29BC':'odsold','\u29BE':'olcir','\u29BF':'ofcir','\u29C0':'olt','\u29C1':'ogt','\u29C2':'cirscir','\u29C3':'cirE','\u29C4':'solb','\u29C5':'bsolb','\u29C9':'boxbox','\u29CD':'trisb','\u29CE':'rtriltri','\u29CF':'LeftTriangleBar','\u29CF\u0338':'NotLeftTriangleBar','\u29D0':'RightTriangleBar','\u29D0\u0338':'NotRightTriangleBar','\u29DC':'iinfin','\u29DD':'infintie','\u29DE':'nvinfin','\u29E3':'eparsl','\u29E4':'smeparsl','\u29E5':'eqvparsl','\u29EB':'lozf','\u29F4':'RuleDelayed','\u29F6':'dsol','\u2A00':'xodot','\u2A01':'xoplus','\u2A02':'xotime','\u2A04':'xuplus','\u2A06':'xsqcup','\u2A0D':'fpartint','\u2A10':'cirfnint','\u2A11':'awint','\u2A12':'rppolint','\u2A13':'scpolint','\u2A14':'npolint','\u2A15':'pointint','\u2A16':'quatint','\u2A17':'intlarhk','\u2A22':'pluscir','\u2A23':'plusacir','\u2A24':'simplus','\u2A25':'plusdu','\u2A26':'plussim','\u2A27':'plustwo','\u2A29':'mcomma','\u2A2A':'minusdu','\u2A2D':'loplus','\u2A2E':'roplus','\u2A2F':'Cross','\u2A30':'timesd','\u2A31':'timesbar','\u2A33':'smashp','\u2A34':'lotimes','\u2A35':'rotimes','\u2A36':'otimesas','\u2A37':'Otimes','\u2A38':'odiv','\u2A39':'triplus','\u2A3A':'triminus','\u2A3B':'tritime','\u2A3C':'iprod','\u2A3F':'amalg','\u2A40':'capdot','\u2A42':'ncup','\u2A43':'ncap','\u2A44':'capand','\u2A45':'cupor','\u2A46':'cupcap','\u2A47':'capcup','\u2A48':'cupbrcap','\u2A49':'capbrcup','\u2A4A':'cupcup','\u2A4B':'capcap','\u2A4C':'ccups','\u2A4D':'ccaps','\u2A50':'ccupssm','\u2A53':'And','\u2A54':'Or','\u2A55':'andand','\u2A56':'oror','\u2A57':'orslope','\u2A58':'andslope','\u2A5A':'andv','\u2A5B':'orv','\u2A5C':'andd','\u2A5D':'ord','\u2A5F':'wedbar','\u2A66':'sdote','\u2A6A':'simdot','\u2A6D':'congdot','\u2A6D\u0338':'ncongdot','\u2A6E':'easter','\u2A6F':'apacir','\u2A70':'apE','\u2A70\u0338':'napE','\u2A71':'eplus','\u2A72':'pluse','\u2A73':'Esim','\u2A77':'eDDot','\u2A78':'equivDD','\u2A79':'ltcir','\u2A7A':'gtcir','\u2A7B':'ltquest','\u2A7C':'gtquest','\u2A7D':'les','\u2A7D\u0338':'nles','\u2A7E':'ges','\u2A7E\u0338':'nges','\u2A7F':'lesdot','\u2A80':'gesdot','\u2A81':'lesdoto','\u2A82':'gesdoto','\u2A83':'lesdotor','\u2A84':'gesdotol','\u2A85':'lap','\u2A86':'gap','\u2A87':'lne','\u2A88':'gne','\u2A89':'lnap','\u2A8A':'gnap','\u2A8B':'lEg','\u2A8C':'gEl','\u2A8D':'lsime','\u2A8E':'gsime','\u2A8F':'lsimg','\u2A90':'gsiml','\u2A91':'lgE','\u2A92':'glE','\u2A93':'lesges','\u2A94':'gesles','\u2A95':'els','\u2A96':'egs','\u2A97':'elsdot','\u2A98':'egsdot','\u2A99':'el','\u2A9A':'eg','\u2A9D':'siml','\u2A9E':'simg','\u2A9F':'simlE','\u2AA0':'simgE','\u2AA1':'LessLess','\u2AA1\u0338':'NotNestedLessLess','\u2AA2':'GreaterGreater','\u2AA2\u0338':'NotNestedGreaterGreater','\u2AA4':'glj','\u2AA5':'gla','\u2AA6':'ltcc','\u2AA7':'gtcc','\u2AA8':'lescc','\u2AA9':'gescc','\u2AAA':'smt','\u2AAB':'lat','\u2AAC':'smte','\u2AAC\uFE00':'smtes','\u2AAD':'late','\u2AAD\uFE00':'lates','\u2AAE':'bumpE','\u2AAF':'pre','\u2AAF\u0338':'npre','\u2AB0':'sce','\u2AB0\u0338':'nsce','\u2AB3':'prE','\u2AB4':'scE','\u2AB5':'prnE','\u2AB6':'scnE','\u2AB7':'prap','\u2AB8':'scap','\u2AB9':'prnap','\u2ABA':'scnap','\u2ABB':'Pr','\u2ABC':'Sc','\u2ABD':'subdot','\u2ABE':'supdot','\u2ABF':'subplus','\u2AC0':'supplus','\u2AC1':'submult','\u2AC2':'supmult','\u2AC3':'subedot','\u2AC4':'supedot','\u2AC5':'subE','\u2AC5\u0338':'nsubE','\u2AC6':'supE','\u2AC6\u0338':'nsupE','\u2AC7':'subsim','\u2AC8':'supsim','\u2ACB\uFE00':'vsubnE','\u2ACB':'subnE','\u2ACC\uFE00':'vsupnE','\u2ACC':'supnE','\u2ACF':'csub','\u2AD0':'csup','\u2AD1':'csube','\u2AD2':'csupe','\u2AD3':'subsup','\u2AD4':'supsub','\u2AD5':'subsub','\u2AD6':'supsup','\u2AD7':'suphsub','\u2AD8':'supdsub','\u2AD9':'forkv','\u2ADA':'topfork','\u2ADB':'mlcp','\u2AE4':'Dashv','\u2AE6':'Vdashl','\u2AE7':'Barv','\u2AE8':'vBar','\u2AE9':'vBarv','\u2AEB':'Vbar','\u2AEC':'Not','\u2AED':'bNot','\u2AEE':'rnmid','\u2AEF':'cirmid','\u2AF0':'midcir','\u2AF1':'topcir','\u2AF2':'nhpar','\u2AF3':'parsim','\u2AFD':'parsl','\u2AFD\u20E5':'nparsl','\u266D':'flat','\u266E':'natur','\u266F':'sharp','\xA4':'curren','\xA2':'cent','$':'dollar','\xA3':'pound','\xA5':'yen','\u20AC':'euro','\xB9':'sup1','\xBD':'half','\u2153':'frac13','\xBC':'frac14','\u2155':'frac15','\u2159':'frac16','\u215B':'frac18','\xB2':'sup2','\u2154':'frac23','\u2156':'frac25','\xB3':'sup3','\xBE':'frac34','\u2157':'frac35','\u215C':'frac38','\u2158':'frac45','\u215A':'frac56','\u215D':'frac58','\u215E':'frac78','\uD835\uDCB6':'ascr','\uD835\uDD52':'aopf','\uD835\uDD1E':'afr','\uD835\uDD38':'Aopf','\uD835\uDD04':'Afr','\uD835\uDC9C':'Ascr','\xAA':'ordf','\xE1':'aacute','\xC1':'Aacute','\xE0':'agrave','\xC0':'Agrave','\u0103':'abreve','\u0102':'Abreve','\xE2':'acirc','\xC2':'Acirc','\xE5':'aring','\xC5':'angst','\xE4':'auml','\xC4':'Auml','\xE3':'atilde','\xC3':'Atilde','\u0105':'aogon','\u0104':'Aogon','\u0101':'amacr','\u0100':'Amacr','\xE6':'aelig','\xC6':'AElig','\uD835\uDCB7':'bscr','\uD835\uDD53':'bopf','\uD835\uDD1F':'bfr','\uD835\uDD39':'Bopf','\u212C':'Bscr','\uD835\uDD05':'Bfr','\uD835\uDD20':'cfr','\uD835\uDCB8':'cscr','\uD835\uDD54':'copf','\u212D':'Cfr','\uD835\uDC9E':'Cscr','\u2102':'Copf','\u0107':'cacute','\u0106':'Cacute','\u0109':'ccirc','\u0108':'Ccirc','\u010D':'ccaron','\u010C':'Ccaron','\u010B':'cdot','\u010A':'Cdot','\xE7':'ccedil','\xC7':'Ccedil','\u2105':'incare','\uD835\uDD21':'dfr','\u2146':'dd','\uD835\uDD55':'dopf','\uD835\uDCB9':'dscr','\uD835\uDC9F':'Dscr','\uD835\uDD07':'Dfr','\u2145':'DD','\uD835\uDD3B':'Dopf','\u010F':'dcaron','\u010E':'Dcaron','\u0111':'dstrok','\u0110':'Dstrok','\xF0':'eth','\xD0':'ETH','\u2147':'ee','\u212F':'escr','\uD835\uDD22':'efr','\uD835\uDD56':'eopf','\u2130':'Escr','\uD835\uDD08':'Efr','\uD835\uDD3C':'Eopf','\xE9':'eacute','\xC9':'Eacute','\xE8':'egrave','\xC8':'Egrave','\xEA':'ecirc','\xCA':'Ecirc','\u011B':'ecaron','\u011A':'Ecaron','\xEB':'euml','\xCB':'Euml','\u0117':'edot','\u0116':'Edot','\u0119':'eogon','\u0118':'Eogon','\u0113':'emacr','\u0112':'Emacr','\uD835\uDD23':'ffr','\uD835\uDD57':'fopf','\uD835\uDCBB':'fscr','\uD835\uDD09':'Ffr','\uD835\uDD3D':'Fopf','\u2131':'Fscr','\uFB00':'fflig','\uFB03':'ffilig','\uFB04':'ffllig','\uFB01':'filig','fj':'fjlig','\uFB02':'fllig','\u0192':'fnof','\u210A':'gscr','\uD835\uDD58':'gopf','\uD835\uDD24':'gfr','\uD835\uDCA2':'Gscr','\uD835\uDD3E':'Gopf','\uD835\uDD0A':'Gfr','\u01F5':'gacute','\u011F':'gbreve','\u011E':'Gbreve','\u011D':'gcirc','\u011C':'Gcirc','\u0121':'gdot','\u0120':'Gdot','\u0122':'Gcedil','\uD835\uDD25':'hfr','\u210E':'planckh','\uD835\uDCBD':'hscr','\uD835\uDD59':'hopf','\u210B':'Hscr','\u210C':'Hfr','\u210D':'Hopf','\u0125':'hcirc','\u0124':'Hcirc','\u210F':'hbar','\u0127':'hstrok','\u0126':'Hstrok','\uD835\uDD5A':'iopf','\uD835\uDD26':'ifr','\uD835\uDCBE':'iscr','\u2148':'ii','\uD835\uDD40':'Iopf','\u2110':'Iscr','\u2111':'Im','\xED':'iacute','\xCD':'Iacute','\xEC':'igrave','\xCC':'Igrave','\xEE':'icirc','\xCE':'Icirc','\xEF':'iuml','\xCF':'Iuml','\u0129':'itilde','\u0128':'Itilde','\u0130':'Idot','\u012F':'iogon','\u012E':'Iogon','\u012B':'imacr','\u012A':'Imacr','\u0133':'ijlig','\u0132':'IJlig','\u0131':'imath','\uD835\uDCBF':'jscr','\uD835\uDD5B':'jopf','\uD835\uDD27':'jfr','\uD835\uDCA5':'Jscr','\uD835\uDD0D':'Jfr','\uD835\uDD41':'Jopf','\u0135':'jcirc','\u0134':'Jcirc','\u0237':'jmath','\uD835\uDD5C':'kopf','\uD835\uDCC0':'kscr','\uD835\uDD28':'kfr','\uD835\uDCA6':'Kscr','\uD835\uDD42':'Kopf','\uD835\uDD0E':'Kfr','\u0137':'kcedil','\u0136':'Kcedil','\uD835\uDD29':'lfr','\uD835\uDCC1':'lscr','\u2113':'ell','\uD835\uDD5D':'lopf','\u2112':'Lscr','\uD835\uDD0F':'Lfr','\uD835\uDD43':'Lopf','\u013A':'lacute','\u0139':'Lacute','\u013E':'lcaron','\u013D':'Lcaron','\u013C':'lcedil','\u013B':'Lcedil','\u0142':'lstrok','\u0141':'Lstrok','\u0140':'lmidot','\u013F':'Lmidot','\uD835\uDD2A':'mfr','\uD835\uDD5E':'mopf','\uD835\uDCC2':'mscr','\uD835\uDD10':'Mfr','\uD835\uDD44':'Mopf','\u2133':'Mscr','\uD835\uDD2B':'nfr','\uD835\uDD5F':'nopf','\uD835\uDCC3':'nscr','\u2115':'Nopf','\uD835\uDCA9':'Nscr','\uD835\uDD11':'Nfr','\u0144':'nacute','\u0143':'Nacute','\u0148':'ncaron','\u0147':'Ncaron','\xF1':'ntilde','\xD1':'Ntilde','\u0146':'ncedil','\u0145':'Ncedil','\u2116':'numero','\u014B':'eng','\u014A':'ENG','\uD835\uDD60':'oopf','\uD835\uDD2C':'ofr','\u2134':'oscr','\uD835\uDCAA':'Oscr','\uD835\uDD12':'Ofr','\uD835\uDD46':'Oopf','\xBA':'ordm','\xF3':'oacute','\xD3':'Oacute','\xF2':'ograve','\xD2':'Ograve','\xF4':'ocirc','\xD4':'Ocirc','\xF6':'ouml','\xD6':'Ouml','\u0151':'odblac','\u0150':'Odblac','\xF5':'otilde','\xD5':'Otilde','\xF8':'oslash','\xD8':'Oslash','\u014D':'omacr','\u014C':'Omacr','\u0153':'oelig','\u0152':'OElig','\uD835\uDD2D':'pfr','\uD835\uDCC5':'pscr','\uD835\uDD61':'popf','\u2119':'Popf','\uD835\uDD13':'Pfr','\uD835\uDCAB':'Pscr','\uD835\uDD62':'qopf','\uD835\uDD2E':'qfr','\uD835\uDCC6':'qscr','\uD835\uDCAC':'Qscr','\uD835\uDD14':'Qfr','\u211A':'Qopf','\u0138':'kgreen','\uD835\uDD2F':'rfr','\uD835\uDD63':'ropf','\uD835\uDCC7':'rscr','\u211B':'Rscr','\u211C':'Re','\u211D':'Ropf','\u0155':'racute','\u0154':'Racute','\u0159':'rcaron','\u0158':'Rcaron','\u0157':'rcedil','\u0156':'Rcedil','\uD835\uDD64':'sopf','\uD835\uDCC8':'sscr','\uD835\uDD30':'sfr','\uD835\uDD4A':'Sopf','\uD835\uDD16':'Sfr','\uD835\uDCAE':'Sscr','\u24C8':'oS','\u015B':'sacute','\u015A':'Sacute','\u015D':'scirc','\u015C':'Scirc','\u0161':'scaron','\u0160':'Scaron','\u015F':'scedil','\u015E':'Scedil','\xDF':'szlig','\uD835\uDD31':'tfr','\uD835\uDCC9':'tscr','\uD835\uDD65':'topf','\uD835\uDCAF':'Tscr','\uD835\uDD17':'Tfr','\uD835\uDD4B':'Topf','\u0165':'tcaron','\u0164':'Tcaron','\u0163':'tcedil','\u0162':'Tcedil','\u2122':'trade','\u0167':'tstrok','\u0166':'Tstrok','\uD835\uDCCA':'uscr','\uD835\uDD66':'uopf','\uD835\uDD32':'ufr','\uD835\uDD4C':'Uopf','\uD835\uDD18':'Ufr','\uD835\uDCB0':'Uscr','\xFA':'uacute','\xDA':'Uacute','\xF9':'ugrave','\xD9':'Ugrave','\u016D':'ubreve','\u016C':'Ubreve','\xFB':'ucirc','\xDB':'Ucirc','\u016F':'uring','\u016E':'Uring','\xFC':'uuml','\xDC':'Uuml','\u0171':'udblac','\u0170':'Udblac','\u0169':'utilde','\u0168':'Utilde','\u0173':'uogon','\u0172':'Uogon','\u016B':'umacr','\u016A':'Umacr','\uD835\uDD33':'vfr','\uD835\uDD67':'vopf','\uD835\uDCCB':'vscr','\uD835\uDD19':'Vfr','\uD835\uDD4D':'Vopf','\uD835\uDCB1':'Vscr','\uD835\uDD68':'wopf','\uD835\uDCCC':'wscr','\uD835\uDD34':'wfr','\uD835\uDCB2':'Wscr','\uD835\uDD4E':'Wopf','\uD835\uDD1A':'Wfr','\u0175':'wcirc','\u0174':'Wcirc','\uD835\uDD35':'xfr','\uD835\uDCCD':'xscr','\uD835\uDD69':'xopf','\uD835\uDD4F':'Xopf','\uD835\uDD1B':'Xfr','\uD835\uDCB3':'Xscr','\uD835\uDD36':'yfr','\uD835\uDCCE':'yscr','\uD835\uDD6A':'yopf','\uD835\uDCB4':'Yscr','\uD835\uDD1C':'Yfr','\uD835\uDD50':'Yopf','\xFD':'yacute','\xDD':'Yacute','\u0177':'ycirc','\u0176':'Ycirc','\xFF':'yuml','\u0178':'Yuml','\uD835\uDCCF':'zscr','\uD835\uDD37':'zfr','\uD835\uDD6B':'zopf','\u2128':'Zfr','\u2124':'Zopf','\uD835\uDCB5':'Zscr','\u017A':'zacute','\u0179':'Zacute','\u017E':'zcaron','\u017D':'Zcaron','\u017C':'zdot','\u017B':'Zdot','\u01B5':'imped','\xFE':'thorn','\xDE':'THORN','\u0149':'napos','\u03B1':'alpha','\u0391':'Alpha','\u03B2':'beta','\u0392':'Beta','\u03B3':'gamma','\u0393':'Gamma','\u03B4':'delta','\u0394':'Delta','\u03B5':'epsi','\u03F5':'epsiv','\u0395':'Epsilon','\u03DD':'gammad','\u03DC':'Gammad','\u03B6':'zeta','\u0396':'Zeta','\u03B7':'eta','\u0397':'Eta','\u03B8':'theta','\u03D1':'thetav','\u0398':'Theta','\u03B9':'iota','\u0399':'Iota','\u03BA':'kappa','\u03F0':'kappav','\u039A':'Kappa','\u03BB':'lambda','\u039B':'Lambda','\u03BC':'mu','\xB5':'micro','\u039C':'Mu','\u03BD':'nu','\u039D':'Nu','\u03BE':'xi','\u039E':'Xi','\u03BF':'omicron','\u039F':'Omicron','\u03C0':'pi','\u03D6':'piv','\u03A0':'Pi','\u03C1':'rho','\u03F1':'rhov','\u03A1':'Rho','\u03C3':'sigma','\u03A3':'Sigma','\u03C2':'sigmaf','\u03C4':'tau','\u03A4':'Tau','\u03C5':'upsi','\u03A5':'Upsilon','\u03D2':'Upsi','\u03C6':'phi','\u03D5':'phiv','\u03A6':'Phi','\u03C7':'chi','\u03A7':'Chi','\u03C8':'psi','\u03A8':'Psi','\u03C9':'omega','\u03A9':'ohm','\u0430':'acy','\u0410':'Acy','\u0431':'bcy','\u0411':'Bcy','\u0432':'vcy','\u0412':'Vcy','\u0433':'gcy','\u0413':'Gcy','\u0453':'gjcy','\u0403':'GJcy','\u0434':'dcy','\u0414':'Dcy','\u0452':'djcy','\u0402':'DJcy','\u0435':'iecy','\u0415':'IEcy','\u0451':'iocy','\u0401':'IOcy','\u0454':'jukcy','\u0404':'Jukcy','\u0436':'zhcy','\u0416':'ZHcy','\u0437':'zcy','\u0417':'Zcy','\u0455':'dscy','\u0405':'DScy','\u0438':'icy','\u0418':'Icy','\u0456':'iukcy','\u0406':'Iukcy','\u0457':'yicy','\u0407':'YIcy','\u0439':'jcy','\u0419':'Jcy','\u0458':'jsercy','\u0408':'Jsercy','\u043A':'kcy','\u041A':'Kcy','\u045C':'kjcy','\u040C':'KJcy','\u043B':'lcy','\u041B':'Lcy','\u0459':'ljcy','\u0409':'LJcy','\u043C':'mcy','\u041C':'Mcy','\u043D':'ncy','\u041D':'Ncy','\u045A':'njcy','\u040A':'NJcy','\u043E':'ocy','\u041E':'Ocy','\u043F':'pcy','\u041F':'Pcy','\u0440':'rcy','\u0420':'Rcy','\u0441':'scy','\u0421':'Scy','\u0442':'tcy','\u0422':'Tcy','\u045B':'tshcy','\u040B':'TSHcy','\u0443':'ucy','\u0423':'Ucy','\u045E':'ubrcy','\u040E':'Ubrcy','\u0444':'fcy','\u0424':'Fcy','\u0445':'khcy','\u0425':'KHcy','\u0446':'tscy','\u0426':'TScy','\u0447':'chcy','\u0427':'CHcy','\u045F':'dzcy','\u040F':'DZcy','\u0448':'shcy','\u0428':'SHcy','\u0449':'shchcy','\u0429':'SHCHcy','\u044A':'hardcy','\u042A':'HARDcy','\u044B':'ycy','\u042B':'Ycy','\u044C':'softcy','\u042C':'SOFTcy','\u044D':'ecy','\u042D':'Ecy','\u044E':'yucy','\u042E':'YUcy','\u044F':'yacy','\u042F':'YAcy','\u2135':'aleph','\u2136':'beth','\u2137':'gimel','\u2138':'daleth'};
|
|
8094
|
+
|
|
8095
|
+
var regexEscape = /["&'<>`]/g;
|
|
8096
|
+
var escapeMap = {
|
|
8097
|
+
'"': '"',
|
|
8098
|
+
'&': '&',
|
|
8099
|
+
'\'': ''',
|
|
8100
|
+
'<': '<',
|
|
8101
|
+
// See https://mathiasbynens.be/notes/ambiguous-ampersands: in HTML, the
|
|
8102
|
+
// following is not strictly necessary unless it’s part of a tag or an
|
|
8103
|
+
// unquoted attribute value. We’re only escaping it to support those
|
|
8104
|
+
// situations, and for XML support.
|
|
8105
|
+
'>': '>',
|
|
8106
|
+
// In Internet Explorer ≤ 8, the backtick character can be used
|
|
8107
|
+
// to break out of (un)quoted attribute values or HTML comments.
|
|
8108
|
+
// See http://html5sec.org/#102, http://html5sec.org/#108, and
|
|
8109
|
+
// http://html5sec.org/#133.
|
|
8110
|
+
'`': '`'
|
|
8111
|
+
};
|
|
8112
|
+
|
|
8113
|
+
var regexInvalidEntity = /&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/;
|
|
8114
|
+
var regexInvalidRawCodePoint = /[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
8115
|
+
var regexDecode = /&#([0-9]+)(;?)|&#[xX]([a-fA-F0-9]+)(;?)|&([0-9a-zA-Z]+);|&(Aacute|Agrave|Atilde|Ccedil|Eacute|Egrave|Iacute|Igrave|Ntilde|Oacute|Ograve|Oslash|Otilde|Uacute|Ugrave|Yacute|aacute|agrave|atilde|brvbar|ccedil|curren|divide|eacute|egrave|frac12|frac14|frac34|iacute|igrave|iquest|middot|ntilde|oacute|ograve|oslash|otilde|plusmn|uacute|ugrave|yacute|AElig|Acirc|Aring|Ecirc|Icirc|Ocirc|THORN|Ucirc|acirc|acute|aelig|aring|cedil|ecirc|icirc|iexcl|laquo|micro|ocirc|pound|raquo|szlig|thorn|times|ucirc|Auml|COPY|Euml|Iuml|Ouml|QUOT|Uuml|auml|cent|copy|euml|iuml|macr|nbsp|ordf|ordm|ouml|para|quot|sect|sup1|sup2|sup3|uuml|yuml|AMP|ETH|REG|amp|deg|eth|not|reg|shy|uml|yen|GT|LT|gt|lt)([=a-zA-Z0-9])?/g;
|
|
8116
|
+
var decodeMap = {'aacute':'\xE1','Aacute':'\xC1','abreve':'\u0103','Abreve':'\u0102','ac':'\u223E','acd':'\u223F','acE':'\u223E\u0333','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','acy':'\u0430','Acy':'\u0410','aelig':'\xE6','AElig':'\xC6','af':'\u2061','afr':'\uD835\uDD1E','Afr':'\uD835\uDD04','agrave':'\xE0','Agrave':'\xC0','alefsym':'\u2135','aleph':'\u2135','alpha':'\u03B1','Alpha':'\u0391','amacr':'\u0101','Amacr':'\u0100','amalg':'\u2A3F','amp':'&','AMP':'&','and':'\u2227','And':'\u2A53','andand':'\u2A55','andd':'\u2A5C','andslope':'\u2A58','andv':'\u2A5A','ang':'\u2220','ange':'\u29A4','angle':'\u2220','angmsd':'\u2221','angmsdaa':'\u29A8','angmsdab':'\u29A9','angmsdac':'\u29AA','angmsdad':'\u29AB','angmsdae':'\u29AC','angmsdaf':'\u29AD','angmsdag':'\u29AE','angmsdah':'\u29AF','angrt':'\u221F','angrtvb':'\u22BE','angrtvbd':'\u299D','angsph':'\u2222','angst':'\xC5','angzarr':'\u237C','aogon':'\u0105','Aogon':'\u0104','aopf':'\uD835\uDD52','Aopf':'\uD835\uDD38','ap':'\u2248','apacir':'\u2A6F','ape':'\u224A','apE':'\u2A70','apid':'\u224B','apos':'\'','ApplyFunction':'\u2061','approx':'\u2248','approxeq':'\u224A','aring':'\xE5','Aring':'\xC5','ascr':'\uD835\uDCB6','Ascr':'\uD835\uDC9C','Assign':'\u2254','ast':'*','asymp':'\u2248','asympeq':'\u224D','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','awconint':'\u2233','awint':'\u2A11','backcong':'\u224C','backepsilon':'\u03F6','backprime':'\u2035','backsim':'\u223D','backsimeq':'\u22CD','Backslash':'\u2216','Barv':'\u2AE7','barvee':'\u22BD','barwed':'\u2305','Barwed':'\u2306','barwedge':'\u2305','bbrk':'\u23B5','bbrktbrk':'\u23B6','bcong':'\u224C','bcy':'\u0431','Bcy':'\u0411','bdquo':'\u201E','becaus':'\u2235','because':'\u2235','Because':'\u2235','bemptyv':'\u29B0','bepsi':'\u03F6','bernou':'\u212C','Bernoullis':'\u212C','beta':'\u03B2','Beta':'\u0392','beth':'\u2136','between':'\u226C','bfr':'\uD835\uDD1F','Bfr':'\uD835\uDD05','bigcap':'\u22C2','bigcirc':'\u25EF','bigcup':'\u22C3','bigodot':'\u2A00','bigoplus':'\u2A01','bigotimes':'\u2A02','bigsqcup':'\u2A06','bigstar':'\u2605','bigtriangledown':'\u25BD','bigtriangleup':'\u25B3','biguplus':'\u2A04','bigvee':'\u22C1','bigwedge':'\u22C0','bkarow':'\u290D','blacklozenge':'\u29EB','blacksquare':'\u25AA','blacktriangle':'\u25B4','blacktriangledown':'\u25BE','blacktriangleleft':'\u25C2','blacktriangleright':'\u25B8','blank':'\u2423','blk12':'\u2592','blk14':'\u2591','blk34':'\u2593','block':'\u2588','bne':'=\u20E5','bnequiv':'\u2261\u20E5','bnot':'\u2310','bNot':'\u2AED','bopf':'\uD835\uDD53','Bopf':'\uD835\uDD39','bot':'\u22A5','bottom':'\u22A5','bowtie':'\u22C8','boxbox':'\u29C9','boxdl':'\u2510','boxdL':'\u2555','boxDl':'\u2556','boxDL':'\u2557','boxdr':'\u250C','boxdR':'\u2552','boxDr':'\u2553','boxDR':'\u2554','boxh':'\u2500','boxH':'\u2550','boxhd':'\u252C','boxhD':'\u2565','boxHd':'\u2564','boxHD':'\u2566','boxhu':'\u2534','boxhU':'\u2568','boxHu':'\u2567','boxHU':'\u2569','boxminus':'\u229F','boxplus':'\u229E','boxtimes':'\u22A0','boxul':'\u2518','boxuL':'\u255B','boxUl':'\u255C','boxUL':'\u255D','boxur':'\u2514','boxuR':'\u2558','boxUr':'\u2559','boxUR':'\u255A','boxv':'\u2502','boxV':'\u2551','boxvh':'\u253C','boxvH':'\u256A','boxVh':'\u256B','boxVH':'\u256C','boxvl':'\u2524','boxvL':'\u2561','boxVl':'\u2562','boxVL':'\u2563','boxvr':'\u251C','boxvR':'\u255E','boxVr':'\u255F','boxVR':'\u2560','bprime':'\u2035','breve':'\u02D8','Breve':'\u02D8','brvbar':'\xA6','bscr':'\uD835\uDCB7','Bscr':'\u212C','bsemi':'\u204F','bsim':'\u223D','bsime':'\u22CD','bsol':'\\','bsolb':'\u29C5','bsolhsub':'\u27C8','bull':'\u2022','bullet':'\u2022','bump':'\u224E','bumpe':'\u224F','bumpE':'\u2AAE','bumpeq':'\u224F','Bumpeq':'\u224E','cacute':'\u0107','Cacute':'\u0106','cap':'\u2229','Cap':'\u22D2','capand':'\u2A44','capbrcup':'\u2A49','capcap':'\u2A4B','capcup':'\u2A47','capdot':'\u2A40','CapitalDifferentialD':'\u2145','caps':'\u2229\uFE00','caret':'\u2041','caron':'\u02C7','Cayleys':'\u212D','ccaps':'\u2A4D','ccaron':'\u010D','Ccaron':'\u010C','ccedil':'\xE7','Ccedil':'\xC7','ccirc':'\u0109','Ccirc':'\u0108','Cconint':'\u2230','ccups':'\u2A4C','ccupssm':'\u2A50','cdot':'\u010B','Cdot':'\u010A','cedil':'\xB8','Cedilla':'\xB8','cemptyv':'\u29B2','cent':'\xA2','centerdot':'\xB7','CenterDot':'\xB7','cfr':'\uD835\uDD20','Cfr':'\u212D','chcy':'\u0447','CHcy':'\u0427','check':'\u2713','checkmark':'\u2713','chi':'\u03C7','Chi':'\u03A7','cir':'\u25CB','circ':'\u02C6','circeq':'\u2257','circlearrowleft':'\u21BA','circlearrowright':'\u21BB','circledast':'\u229B','circledcirc':'\u229A','circleddash':'\u229D','CircleDot':'\u2299','circledR':'\xAE','circledS':'\u24C8','CircleMinus':'\u2296','CirclePlus':'\u2295','CircleTimes':'\u2297','cire':'\u2257','cirE':'\u29C3','cirfnint':'\u2A10','cirmid':'\u2AEF','cirscir':'\u29C2','ClockwiseContourIntegral':'\u2232','CloseCurlyDoubleQuote':'\u201D','CloseCurlyQuote':'\u2019','clubs':'\u2663','clubsuit':'\u2663','colon':':','Colon':'\u2237','colone':'\u2254','Colone':'\u2A74','coloneq':'\u2254','comma':',','commat':'@','comp':'\u2201','compfn':'\u2218','complement':'\u2201','complexes':'\u2102','cong':'\u2245','congdot':'\u2A6D','Congruent':'\u2261','conint':'\u222E','Conint':'\u222F','ContourIntegral':'\u222E','copf':'\uD835\uDD54','Copf':'\u2102','coprod':'\u2210','Coproduct':'\u2210','copy':'\xA9','COPY':'\xA9','copysr':'\u2117','CounterClockwiseContourIntegral':'\u2233','crarr':'\u21B5','cross':'\u2717','Cross':'\u2A2F','cscr':'\uD835\uDCB8','Cscr':'\uD835\uDC9E','csub':'\u2ACF','csube':'\u2AD1','csup':'\u2AD0','csupe':'\u2AD2','ctdot':'\u22EF','cudarrl':'\u2938','cudarrr':'\u2935','cuepr':'\u22DE','cuesc':'\u22DF','cularr':'\u21B6','cularrp':'\u293D','cup':'\u222A','Cup':'\u22D3','cupbrcap':'\u2A48','cupcap':'\u2A46','CupCap':'\u224D','cupcup':'\u2A4A','cupdot':'\u228D','cupor':'\u2A45','cups':'\u222A\uFE00','curarr':'\u21B7','curarrm':'\u293C','curlyeqprec':'\u22DE','curlyeqsucc':'\u22DF','curlyvee':'\u22CE','curlywedge':'\u22CF','curren':'\xA4','curvearrowleft':'\u21B6','curvearrowright':'\u21B7','cuvee':'\u22CE','cuwed':'\u22CF','cwconint':'\u2232','cwint':'\u2231','cylcty':'\u232D','dagger':'\u2020','Dagger':'\u2021','daleth':'\u2138','darr':'\u2193','dArr':'\u21D3','Darr':'\u21A1','dash':'\u2010','dashv':'\u22A3','Dashv':'\u2AE4','dbkarow':'\u290F','dblac':'\u02DD','dcaron':'\u010F','Dcaron':'\u010E','dcy':'\u0434','Dcy':'\u0414','dd':'\u2146','DD':'\u2145','ddagger':'\u2021','ddarr':'\u21CA','DDotrahd':'\u2911','ddotseq':'\u2A77','deg':'\xB0','Del':'\u2207','delta':'\u03B4','Delta':'\u0394','demptyv':'\u29B1','dfisht':'\u297F','dfr':'\uD835\uDD21','Dfr':'\uD835\uDD07','dHar':'\u2965','dharl':'\u21C3','dharr':'\u21C2','DiacriticalAcute':'\xB4','DiacriticalDot':'\u02D9','DiacriticalDoubleAcute':'\u02DD','DiacriticalGrave':'`','DiacriticalTilde':'\u02DC','diam':'\u22C4','diamond':'\u22C4','Diamond':'\u22C4','diamondsuit':'\u2666','diams':'\u2666','die':'\xA8','DifferentialD':'\u2146','digamma':'\u03DD','disin':'\u22F2','div':'\xF7','divide':'\xF7','divideontimes':'\u22C7','divonx':'\u22C7','djcy':'\u0452','DJcy':'\u0402','dlcorn':'\u231E','dlcrop':'\u230D','dollar':'$','dopf':'\uD835\uDD55','Dopf':'\uD835\uDD3B','dot':'\u02D9','Dot':'\xA8','DotDot':'\u20DC','doteq':'\u2250','doteqdot':'\u2251','DotEqual':'\u2250','dotminus':'\u2238','dotplus':'\u2214','dotsquare':'\u22A1','doublebarwedge':'\u2306','DoubleContourIntegral':'\u222F','DoubleDot':'\xA8','DoubleDownArrow':'\u21D3','DoubleLeftArrow':'\u21D0','DoubleLeftRightArrow':'\u21D4','DoubleLeftTee':'\u2AE4','DoubleLongLeftArrow':'\u27F8','DoubleLongLeftRightArrow':'\u27FA','DoubleLongRightArrow':'\u27F9','DoubleRightArrow':'\u21D2','DoubleRightTee':'\u22A8','DoubleUpArrow':'\u21D1','DoubleUpDownArrow':'\u21D5','DoubleVerticalBar':'\u2225','downarrow':'\u2193','Downarrow':'\u21D3','DownArrow':'\u2193','DownArrowBar':'\u2913','DownArrowUpArrow':'\u21F5','DownBreve':'\u0311','downdownarrows':'\u21CA','downharpoonleft':'\u21C3','downharpoonright':'\u21C2','DownLeftRightVector':'\u2950','DownLeftTeeVector':'\u295E','DownLeftVector':'\u21BD','DownLeftVectorBar':'\u2956','DownRightTeeVector':'\u295F','DownRightVector':'\u21C1','DownRightVectorBar':'\u2957','DownTee':'\u22A4','DownTeeArrow':'\u21A7','drbkarow':'\u2910','drcorn':'\u231F','drcrop':'\u230C','dscr':'\uD835\uDCB9','Dscr':'\uD835\uDC9F','dscy':'\u0455','DScy':'\u0405','dsol':'\u29F6','dstrok':'\u0111','Dstrok':'\u0110','dtdot':'\u22F1','dtri':'\u25BF','dtrif':'\u25BE','duarr':'\u21F5','duhar':'\u296F','dwangle':'\u29A6','dzcy':'\u045F','DZcy':'\u040F','dzigrarr':'\u27FF','eacute':'\xE9','Eacute':'\xC9','easter':'\u2A6E','ecaron':'\u011B','Ecaron':'\u011A','ecir':'\u2256','ecirc':'\xEA','Ecirc':'\xCA','ecolon':'\u2255','ecy':'\u044D','Ecy':'\u042D','eDDot':'\u2A77','edot':'\u0117','eDot':'\u2251','Edot':'\u0116','ee':'\u2147','efDot':'\u2252','efr':'\uD835\uDD22','Efr':'\uD835\uDD08','eg':'\u2A9A','egrave':'\xE8','Egrave':'\xC8','egs':'\u2A96','egsdot':'\u2A98','el':'\u2A99','Element':'\u2208','elinters':'\u23E7','ell':'\u2113','els':'\u2A95','elsdot':'\u2A97','emacr':'\u0113','Emacr':'\u0112','empty':'\u2205','emptyset':'\u2205','EmptySmallSquare':'\u25FB','emptyv':'\u2205','EmptyVerySmallSquare':'\u25AB','emsp':'\u2003','emsp13':'\u2004','emsp14':'\u2005','eng':'\u014B','ENG':'\u014A','ensp':'\u2002','eogon':'\u0119','Eogon':'\u0118','eopf':'\uD835\uDD56','Eopf':'\uD835\uDD3C','epar':'\u22D5','eparsl':'\u29E3','eplus':'\u2A71','epsi':'\u03B5','epsilon':'\u03B5','Epsilon':'\u0395','epsiv':'\u03F5','eqcirc':'\u2256','eqcolon':'\u2255','eqsim':'\u2242','eqslantgtr':'\u2A96','eqslantless':'\u2A95','Equal':'\u2A75','equals':'=','EqualTilde':'\u2242','equest':'\u225F','Equilibrium':'\u21CC','equiv':'\u2261','equivDD':'\u2A78','eqvparsl':'\u29E5','erarr':'\u2971','erDot':'\u2253','escr':'\u212F','Escr':'\u2130','esdot':'\u2250','esim':'\u2242','Esim':'\u2A73','eta':'\u03B7','Eta':'\u0397','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','euro':'\u20AC','excl':'!','exist':'\u2203','Exists':'\u2203','expectation':'\u2130','exponentiale':'\u2147','ExponentialE':'\u2147','fallingdotseq':'\u2252','fcy':'\u0444','Fcy':'\u0424','female':'\u2640','ffilig':'\uFB03','fflig':'\uFB00','ffllig':'\uFB04','ffr':'\uD835\uDD23','Ffr':'\uD835\uDD09','filig':'\uFB01','FilledSmallSquare':'\u25FC','FilledVerySmallSquare':'\u25AA','fjlig':'fj','flat':'\u266D','fllig':'\uFB02','fltns':'\u25B1','fnof':'\u0192','fopf':'\uD835\uDD57','Fopf':'\uD835\uDD3D','forall':'\u2200','ForAll':'\u2200','fork':'\u22D4','forkv':'\u2AD9','Fouriertrf':'\u2131','fpartint':'\u2A0D','frac12':'\xBD','frac13':'\u2153','frac14':'\xBC','frac15':'\u2155','frac16':'\u2159','frac18':'\u215B','frac23':'\u2154','frac25':'\u2156','frac34':'\xBE','frac35':'\u2157','frac38':'\u215C','frac45':'\u2158','frac56':'\u215A','frac58':'\u215D','frac78':'\u215E','frasl':'\u2044','frown':'\u2322','fscr':'\uD835\uDCBB','Fscr':'\u2131','gacute':'\u01F5','gamma':'\u03B3','Gamma':'\u0393','gammad':'\u03DD','Gammad':'\u03DC','gap':'\u2A86','gbreve':'\u011F','Gbreve':'\u011E','Gcedil':'\u0122','gcirc':'\u011D','Gcirc':'\u011C','gcy':'\u0433','Gcy':'\u0413','gdot':'\u0121','Gdot':'\u0120','ge':'\u2265','gE':'\u2267','gel':'\u22DB','gEl':'\u2A8C','geq':'\u2265','geqq':'\u2267','geqslant':'\u2A7E','ges':'\u2A7E','gescc':'\u2AA9','gesdot':'\u2A80','gesdoto':'\u2A82','gesdotol':'\u2A84','gesl':'\u22DB\uFE00','gesles':'\u2A94','gfr':'\uD835\uDD24','Gfr':'\uD835\uDD0A','gg':'\u226B','Gg':'\u22D9','ggg':'\u22D9','gimel':'\u2137','gjcy':'\u0453','GJcy':'\u0403','gl':'\u2277','gla':'\u2AA5','glE':'\u2A92','glj':'\u2AA4','gnap':'\u2A8A','gnapprox':'\u2A8A','gne':'\u2A88','gnE':'\u2269','gneq':'\u2A88','gneqq':'\u2269','gnsim':'\u22E7','gopf':'\uD835\uDD58','Gopf':'\uD835\uDD3E','grave':'`','GreaterEqual':'\u2265','GreaterEqualLess':'\u22DB','GreaterFullEqual':'\u2267','GreaterGreater':'\u2AA2','GreaterLess':'\u2277','GreaterSlantEqual':'\u2A7E','GreaterTilde':'\u2273','gscr':'\u210A','Gscr':'\uD835\uDCA2','gsim':'\u2273','gsime':'\u2A8E','gsiml':'\u2A90','gt':'>','Gt':'\u226B','GT':'>','gtcc':'\u2AA7','gtcir':'\u2A7A','gtdot':'\u22D7','gtlPar':'\u2995','gtquest':'\u2A7C','gtrapprox':'\u2A86','gtrarr':'\u2978','gtrdot':'\u22D7','gtreqless':'\u22DB','gtreqqless':'\u2A8C','gtrless':'\u2277','gtrsim':'\u2273','gvertneqq':'\u2269\uFE00','gvnE':'\u2269\uFE00','Hacek':'\u02C7','hairsp':'\u200A','half':'\xBD','hamilt':'\u210B','hardcy':'\u044A','HARDcy':'\u042A','harr':'\u2194','hArr':'\u21D4','harrcir':'\u2948','harrw':'\u21AD','Hat':'^','hbar':'\u210F','hcirc':'\u0125','Hcirc':'\u0124','hearts':'\u2665','heartsuit':'\u2665','hellip':'\u2026','hercon':'\u22B9','hfr':'\uD835\uDD25','Hfr':'\u210C','HilbertSpace':'\u210B','hksearow':'\u2925','hkswarow':'\u2926','hoarr':'\u21FF','homtht':'\u223B','hookleftarrow':'\u21A9','hookrightarrow':'\u21AA','hopf':'\uD835\uDD59','Hopf':'\u210D','horbar':'\u2015','HorizontalLine':'\u2500','hscr':'\uD835\uDCBD','Hscr':'\u210B','hslash':'\u210F','hstrok':'\u0127','Hstrok':'\u0126','HumpDownHump':'\u224E','HumpEqual':'\u224F','hybull':'\u2043','hyphen':'\u2010','iacute':'\xED','Iacute':'\xCD','ic':'\u2063','icirc':'\xEE','Icirc':'\xCE','icy':'\u0438','Icy':'\u0418','Idot':'\u0130','iecy':'\u0435','IEcy':'\u0415','iexcl':'\xA1','iff':'\u21D4','ifr':'\uD835\uDD26','Ifr':'\u2111','igrave':'\xEC','Igrave':'\xCC','ii':'\u2148','iiiint':'\u2A0C','iiint':'\u222D','iinfin':'\u29DC','iiota':'\u2129','ijlig':'\u0133','IJlig':'\u0132','Im':'\u2111','imacr':'\u012B','Imacr':'\u012A','image':'\u2111','ImaginaryI':'\u2148','imagline':'\u2110','imagpart':'\u2111','imath':'\u0131','imof':'\u22B7','imped':'\u01B5','Implies':'\u21D2','in':'\u2208','incare':'\u2105','infin':'\u221E','infintie':'\u29DD','inodot':'\u0131','int':'\u222B','Int':'\u222C','intcal':'\u22BA','integers':'\u2124','Integral':'\u222B','intercal':'\u22BA','Intersection':'\u22C2','intlarhk':'\u2A17','intprod':'\u2A3C','InvisibleComma':'\u2063','InvisibleTimes':'\u2062','iocy':'\u0451','IOcy':'\u0401','iogon':'\u012F','Iogon':'\u012E','iopf':'\uD835\uDD5A','Iopf':'\uD835\uDD40','iota':'\u03B9','Iota':'\u0399','iprod':'\u2A3C','iquest':'\xBF','iscr':'\uD835\uDCBE','Iscr':'\u2110','isin':'\u2208','isindot':'\u22F5','isinE':'\u22F9','isins':'\u22F4','isinsv':'\u22F3','isinv':'\u2208','it':'\u2062','itilde':'\u0129','Itilde':'\u0128','iukcy':'\u0456','Iukcy':'\u0406','iuml':'\xEF','Iuml':'\xCF','jcirc':'\u0135','Jcirc':'\u0134','jcy':'\u0439','Jcy':'\u0419','jfr':'\uD835\uDD27','Jfr':'\uD835\uDD0D','jmath':'\u0237','jopf':'\uD835\uDD5B','Jopf':'\uD835\uDD41','jscr':'\uD835\uDCBF','Jscr':'\uD835\uDCA5','jsercy':'\u0458','Jsercy':'\u0408','jukcy':'\u0454','Jukcy':'\u0404','kappa':'\u03BA','Kappa':'\u039A','kappav':'\u03F0','kcedil':'\u0137','Kcedil':'\u0136','kcy':'\u043A','Kcy':'\u041A','kfr':'\uD835\uDD28','Kfr':'\uD835\uDD0E','kgreen':'\u0138','khcy':'\u0445','KHcy':'\u0425','kjcy':'\u045C','KJcy':'\u040C','kopf':'\uD835\uDD5C','Kopf':'\uD835\uDD42','kscr':'\uD835\uDCC0','Kscr':'\uD835\uDCA6','lAarr':'\u21DA','lacute':'\u013A','Lacute':'\u0139','laemptyv':'\u29B4','lagran':'\u2112','lambda':'\u03BB','Lambda':'\u039B','lang':'\u27E8','Lang':'\u27EA','langd':'\u2991','langle':'\u27E8','lap':'\u2A85','Laplacetrf':'\u2112','laquo':'\xAB','larr':'\u2190','lArr':'\u21D0','Larr':'\u219E','larrb':'\u21E4','larrbfs':'\u291F','larrfs':'\u291D','larrhk':'\u21A9','larrlp':'\u21AB','larrpl':'\u2939','larrsim':'\u2973','larrtl':'\u21A2','lat':'\u2AAB','latail':'\u2919','lAtail':'\u291B','late':'\u2AAD','lates':'\u2AAD\uFE00','lbarr':'\u290C','lBarr':'\u290E','lbbrk':'\u2772','lbrace':'{','lbrack':'[','lbrke':'\u298B','lbrksld':'\u298F','lbrkslu':'\u298D','lcaron':'\u013E','Lcaron':'\u013D','lcedil':'\u013C','Lcedil':'\u013B','lceil':'\u2308','lcub':'{','lcy':'\u043B','Lcy':'\u041B','ldca':'\u2936','ldquo':'\u201C','ldquor':'\u201E','ldrdhar':'\u2967','ldrushar':'\u294B','ldsh':'\u21B2','le':'\u2264','lE':'\u2266','LeftAngleBracket':'\u27E8','leftarrow':'\u2190','Leftarrow':'\u21D0','LeftArrow':'\u2190','LeftArrowBar':'\u21E4','LeftArrowRightArrow':'\u21C6','leftarrowtail':'\u21A2','LeftCeiling':'\u2308','LeftDoubleBracket':'\u27E6','LeftDownTeeVector':'\u2961','LeftDownVector':'\u21C3','LeftDownVectorBar':'\u2959','LeftFloor':'\u230A','leftharpoondown':'\u21BD','leftharpoonup':'\u21BC','leftleftarrows':'\u21C7','leftrightarrow':'\u2194','Leftrightarrow':'\u21D4','LeftRightArrow':'\u2194','leftrightarrows':'\u21C6','leftrightharpoons':'\u21CB','leftrightsquigarrow':'\u21AD','LeftRightVector':'\u294E','LeftTee':'\u22A3','LeftTeeArrow':'\u21A4','LeftTeeVector':'\u295A','leftthreetimes':'\u22CB','LeftTriangle':'\u22B2','LeftTriangleBar':'\u29CF','LeftTriangleEqual':'\u22B4','LeftUpDownVector':'\u2951','LeftUpTeeVector':'\u2960','LeftUpVector':'\u21BF','LeftUpVectorBar':'\u2958','LeftVector':'\u21BC','LeftVectorBar':'\u2952','leg':'\u22DA','lEg':'\u2A8B','leq':'\u2264','leqq':'\u2266','leqslant':'\u2A7D','les':'\u2A7D','lescc':'\u2AA8','lesdot':'\u2A7F','lesdoto':'\u2A81','lesdotor':'\u2A83','lesg':'\u22DA\uFE00','lesges':'\u2A93','lessapprox':'\u2A85','lessdot':'\u22D6','lesseqgtr':'\u22DA','lesseqqgtr':'\u2A8B','LessEqualGreater':'\u22DA','LessFullEqual':'\u2266','LessGreater':'\u2276','lessgtr':'\u2276','LessLess':'\u2AA1','lesssim':'\u2272','LessSlantEqual':'\u2A7D','LessTilde':'\u2272','lfisht':'\u297C','lfloor':'\u230A','lfr':'\uD835\uDD29','Lfr':'\uD835\uDD0F','lg':'\u2276','lgE':'\u2A91','lHar':'\u2962','lhard':'\u21BD','lharu':'\u21BC','lharul':'\u296A','lhblk':'\u2584','ljcy':'\u0459','LJcy':'\u0409','ll':'\u226A','Ll':'\u22D8','llarr':'\u21C7','llcorner':'\u231E','Lleftarrow':'\u21DA','llhard':'\u296B','lltri':'\u25FA','lmidot':'\u0140','Lmidot':'\u013F','lmoust':'\u23B0','lmoustache':'\u23B0','lnap':'\u2A89','lnapprox':'\u2A89','lne':'\u2A87','lnE':'\u2268','lneq':'\u2A87','lneqq':'\u2268','lnsim':'\u22E6','loang':'\u27EC','loarr':'\u21FD','lobrk':'\u27E6','longleftarrow':'\u27F5','Longleftarrow':'\u27F8','LongLeftArrow':'\u27F5','longleftrightarrow':'\u27F7','Longleftrightarrow':'\u27FA','LongLeftRightArrow':'\u27F7','longmapsto':'\u27FC','longrightarrow':'\u27F6','Longrightarrow':'\u27F9','LongRightArrow':'\u27F6','looparrowleft':'\u21AB','looparrowright':'\u21AC','lopar':'\u2985','lopf':'\uD835\uDD5D','Lopf':'\uD835\uDD43','loplus':'\u2A2D','lotimes':'\u2A34','lowast':'\u2217','lowbar':'_','LowerLeftArrow':'\u2199','LowerRightArrow':'\u2198','loz':'\u25CA','lozenge':'\u25CA','lozf':'\u29EB','lpar':'(','lparlt':'\u2993','lrarr':'\u21C6','lrcorner':'\u231F','lrhar':'\u21CB','lrhard':'\u296D','lrm':'\u200E','lrtri':'\u22BF','lsaquo':'\u2039','lscr':'\uD835\uDCC1','Lscr':'\u2112','lsh':'\u21B0','Lsh':'\u21B0','lsim':'\u2272','lsime':'\u2A8D','lsimg':'\u2A8F','lsqb':'[','lsquo':'\u2018','lsquor':'\u201A','lstrok':'\u0142','Lstrok':'\u0141','lt':'<','Lt':'\u226A','LT':'<','ltcc':'\u2AA6','ltcir':'\u2A79','ltdot':'\u22D6','lthree':'\u22CB','ltimes':'\u22C9','ltlarr':'\u2976','ltquest':'\u2A7B','ltri':'\u25C3','ltrie':'\u22B4','ltrif':'\u25C2','ltrPar':'\u2996','lurdshar':'\u294A','luruhar':'\u2966','lvertneqq':'\u2268\uFE00','lvnE':'\u2268\uFE00','macr':'\xAF','male':'\u2642','malt':'\u2720','maltese':'\u2720','map':'\u21A6','Map':'\u2905','mapsto':'\u21A6','mapstodown':'\u21A7','mapstoleft':'\u21A4','mapstoup':'\u21A5','marker':'\u25AE','mcomma':'\u2A29','mcy':'\u043C','Mcy':'\u041C','mdash':'\u2014','mDDot':'\u223A','measuredangle':'\u2221','MediumSpace':'\u205F','Mellintrf':'\u2133','mfr':'\uD835\uDD2A','Mfr':'\uD835\uDD10','mho':'\u2127','micro':'\xB5','mid':'\u2223','midast':'*','midcir':'\u2AF0','middot':'\xB7','minus':'\u2212','minusb':'\u229F','minusd':'\u2238','minusdu':'\u2A2A','MinusPlus':'\u2213','mlcp':'\u2ADB','mldr':'\u2026','mnplus':'\u2213','models':'\u22A7','mopf':'\uD835\uDD5E','Mopf':'\uD835\uDD44','mp':'\u2213','mscr':'\uD835\uDCC2','Mscr':'\u2133','mstpos':'\u223E','mu':'\u03BC','Mu':'\u039C','multimap':'\u22B8','mumap':'\u22B8','nabla':'\u2207','nacute':'\u0144','Nacute':'\u0143','nang':'\u2220\u20D2','nap':'\u2249','napE':'\u2A70\u0338','napid':'\u224B\u0338','napos':'\u0149','napprox':'\u2249','natur':'\u266E','natural':'\u266E','naturals':'\u2115','nbsp':'\xA0','nbump':'\u224E\u0338','nbumpe':'\u224F\u0338','ncap':'\u2A43','ncaron':'\u0148','Ncaron':'\u0147','ncedil':'\u0146','Ncedil':'\u0145','ncong':'\u2247','ncongdot':'\u2A6D\u0338','ncup':'\u2A42','ncy':'\u043D','Ncy':'\u041D','ndash':'\u2013','ne':'\u2260','nearhk':'\u2924','nearr':'\u2197','neArr':'\u21D7','nearrow':'\u2197','nedot':'\u2250\u0338','NegativeMediumSpace':'\u200B','NegativeThickSpace':'\u200B','NegativeThinSpace':'\u200B','NegativeVeryThinSpace':'\u200B','nequiv':'\u2262','nesear':'\u2928','nesim':'\u2242\u0338','NestedGreaterGreater':'\u226B','NestedLessLess':'\u226A','NewLine':'\n','nexist':'\u2204','nexists':'\u2204','nfr':'\uD835\uDD2B','Nfr':'\uD835\uDD11','nge':'\u2271','ngE':'\u2267\u0338','ngeq':'\u2271','ngeqq':'\u2267\u0338','ngeqslant':'\u2A7E\u0338','nges':'\u2A7E\u0338','nGg':'\u22D9\u0338','ngsim':'\u2275','ngt':'\u226F','nGt':'\u226B\u20D2','ngtr':'\u226F','nGtv':'\u226B\u0338','nharr':'\u21AE','nhArr':'\u21CE','nhpar':'\u2AF2','ni':'\u220B','nis':'\u22FC','nisd':'\u22FA','niv':'\u220B','njcy':'\u045A','NJcy':'\u040A','nlarr':'\u219A','nlArr':'\u21CD','nldr':'\u2025','nle':'\u2270','nlE':'\u2266\u0338','nleftarrow':'\u219A','nLeftarrow':'\u21CD','nleftrightarrow':'\u21AE','nLeftrightarrow':'\u21CE','nleq':'\u2270','nleqq':'\u2266\u0338','nleqslant':'\u2A7D\u0338','nles':'\u2A7D\u0338','nless':'\u226E','nLl':'\u22D8\u0338','nlsim':'\u2274','nlt':'\u226E','nLt':'\u226A\u20D2','nltri':'\u22EA','nltrie':'\u22EC','nLtv':'\u226A\u0338','nmid':'\u2224','NoBreak':'\u2060','NonBreakingSpace':'\xA0','nopf':'\uD835\uDD5F','Nopf':'\u2115','not':'\xAC','Not':'\u2AEC','NotCongruent':'\u2262','NotCupCap':'\u226D','NotDoubleVerticalBar':'\u2226','NotElement':'\u2209','NotEqual':'\u2260','NotEqualTilde':'\u2242\u0338','NotExists':'\u2204','NotGreater':'\u226F','NotGreaterEqual':'\u2271','NotGreaterFullEqual':'\u2267\u0338','NotGreaterGreater':'\u226B\u0338','NotGreaterLess':'\u2279','NotGreaterSlantEqual':'\u2A7E\u0338','NotGreaterTilde':'\u2275','NotHumpDownHump':'\u224E\u0338','NotHumpEqual':'\u224F\u0338','notin':'\u2209','notindot':'\u22F5\u0338','notinE':'\u22F9\u0338','notinva':'\u2209','notinvb':'\u22F7','notinvc':'\u22F6','NotLeftTriangle':'\u22EA','NotLeftTriangleBar':'\u29CF\u0338','NotLeftTriangleEqual':'\u22EC','NotLess':'\u226E','NotLessEqual':'\u2270','NotLessGreater':'\u2278','NotLessLess':'\u226A\u0338','NotLessSlantEqual':'\u2A7D\u0338','NotLessTilde':'\u2274','NotNestedGreaterGreater':'\u2AA2\u0338','NotNestedLessLess':'\u2AA1\u0338','notni':'\u220C','notniva':'\u220C','notnivb':'\u22FE','notnivc':'\u22FD','NotPrecedes':'\u2280','NotPrecedesEqual':'\u2AAF\u0338','NotPrecedesSlantEqual':'\u22E0','NotReverseElement':'\u220C','NotRightTriangle':'\u22EB','NotRightTriangleBar':'\u29D0\u0338','NotRightTriangleEqual':'\u22ED','NotSquareSubset':'\u228F\u0338','NotSquareSubsetEqual':'\u22E2','NotSquareSuperset':'\u2290\u0338','NotSquareSupersetEqual':'\u22E3','NotSubset':'\u2282\u20D2','NotSubsetEqual':'\u2288','NotSucceeds':'\u2281','NotSucceedsEqual':'\u2AB0\u0338','NotSucceedsSlantEqual':'\u22E1','NotSucceedsTilde':'\u227F\u0338','NotSuperset':'\u2283\u20D2','NotSupersetEqual':'\u2289','NotTilde':'\u2241','NotTildeEqual':'\u2244','NotTildeFullEqual':'\u2247','NotTildeTilde':'\u2249','NotVerticalBar':'\u2224','npar':'\u2226','nparallel':'\u2226','nparsl':'\u2AFD\u20E5','npart':'\u2202\u0338','npolint':'\u2A14','npr':'\u2280','nprcue':'\u22E0','npre':'\u2AAF\u0338','nprec':'\u2280','npreceq':'\u2AAF\u0338','nrarr':'\u219B','nrArr':'\u21CF','nrarrc':'\u2933\u0338','nrarrw':'\u219D\u0338','nrightarrow':'\u219B','nRightarrow':'\u21CF','nrtri':'\u22EB','nrtrie':'\u22ED','nsc':'\u2281','nsccue':'\u22E1','nsce':'\u2AB0\u0338','nscr':'\uD835\uDCC3','Nscr':'\uD835\uDCA9','nshortmid':'\u2224','nshortparallel':'\u2226','nsim':'\u2241','nsime':'\u2244','nsimeq':'\u2244','nsmid':'\u2224','nspar':'\u2226','nsqsube':'\u22E2','nsqsupe':'\u22E3','nsub':'\u2284','nsube':'\u2288','nsubE':'\u2AC5\u0338','nsubset':'\u2282\u20D2','nsubseteq':'\u2288','nsubseteqq':'\u2AC5\u0338','nsucc':'\u2281','nsucceq':'\u2AB0\u0338','nsup':'\u2285','nsupe':'\u2289','nsupE':'\u2AC6\u0338','nsupset':'\u2283\u20D2','nsupseteq':'\u2289','nsupseteqq':'\u2AC6\u0338','ntgl':'\u2279','ntilde':'\xF1','Ntilde':'\xD1','ntlg':'\u2278','ntriangleleft':'\u22EA','ntrianglelefteq':'\u22EC','ntriangleright':'\u22EB','ntrianglerighteq':'\u22ED','nu':'\u03BD','Nu':'\u039D','num':'#','numero':'\u2116','numsp':'\u2007','nvap':'\u224D\u20D2','nvdash':'\u22AC','nvDash':'\u22AD','nVdash':'\u22AE','nVDash':'\u22AF','nvge':'\u2265\u20D2','nvgt':'>\u20D2','nvHarr':'\u2904','nvinfin':'\u29DE','nvlArr':'\u2902','nvle':'\u2264\u20D2','nvlt':'<\u20D2','nvltrie':'\u22B4\u20D2','nvrArr':'\u2903','nvrtrie':'\u22B5\u20D2','nvsim':'\u223C\u20D2','nwarhk':'\u2923','nwarr':'\u2196','nwArr':'\u21D6','nwarrow':'\u2196','nwnear':'\u2927','oacute':'\xF3','Oacute':'\xD3','oast':'\u229B','ocir':'\u229A','ocirc':'\xF4','Ocirc':'\xD4','ocy':'\u043E','Ocy':'\u041E','odash':'\u229D','odblac':'\u0151','Odblac':'\u0150','odiv':'\u2A38','odot':'\u2299','odsold':'\u29BC','oelig':'\u0153','OElig':'\u0152','ofcir':'\u29BF','ofr':'\uD835\uDD2C','Ofr':'\uD835\uDD12','ogon':'\u02DB','ograve':'\xF2','Ograve':'\xD2','ogt':'\u29C1','ohbar':'\u29B5','ohm':'\u03A9','oint':'\u222E','olarr':'\u21BA','olcir':'\u29BE','olcross':'\u29BB','oline':'\u203E','olt':'\u29C0','omacr':'\u014D','Omacr':'\u014C','omega':'\u03C9','Omega':'\u03A9','omicron':'\u03BF','Omicron':'\u039F','omid':'\u29B6','ominus':'\u2296','oopf':'\uD835\uDD60','Oopf':'\uD835\uDD46','opar':'\u29B7','OpenCurlyDoubleQuote':'\u201C','OpenCurlyQuote':'\u2018','operp':'\u29B9','oplus':'\u2295','or':'\u2228','Or':'\u2A54','orarr':'\u21BB','ord':'\u2A5D','order':'\u2134','orderof':'\u2134','ordf':'\xAA','ordm':'\xBA','origof':'\u22B6','oror':'\u2A56','orslope':'\u2A57','orv':'\u2A5B','oS':'\u24C8','oscr':'\u2134','Oscr':'\uD835\uDCAA','oslash':'\xF8','Oslash':'\xD8','osol':'\u2298','otilde':'\xF5','Otilde':'\xD5','otimes':'\u2297','Otimes':'\u2A37','otimesas':'\u2A36','ouml':'\xF6','Ouml':'\xD6','ovbar':'\u233D','OverBar':'\u203E','OverBrace':'\u23DE','OverBracket':'\u23B4','OverParenthesis':'\u23DC','par':'\u2225','para':'\xB6','parallel':'\u2225','parsim':'\u2AF3','parsl':'\u2AFD','part':'\u2202','PartialD':'\u2202','pcy':'\u043F','Pcy':'\u041F','percnt':'%','period':'.','permil':'\u2030','perp':'\u22A5','pertenk':'\u2031','pfr':'\uD835\uDD2D','Pfr':'\uD835\uDD13','phi':'\u03C6','Phi':'\u03A6','phiv':'\u03D5','phmmat':'\u2133','phone':'\u260E','pi':'\u03C0','Pi':'\u03A0','pitchfork':'\u22D4','piv':'\u03D6','planck':'\u210F','planckh':'\u210E','plankv':'\u210F','plus':'+','plusacir':'\u2A23','plusb':'\u229E','pluscir':'\u2A22','plusdo':'\u2214','plusdu':'\u2A25','pluse':'\u2A72','PlusMinus':'\xB1','plusmn':'\xB1','plussim':'\u2A26','plustwo':'\u2A27','pm':'\xB1','Poincareplane':'\u210C','pointint':'\u2A15','popf':'\uD835\uDD61','Popf':'\u2119','pound':'\xA3','pr':'\u227A','Pr':'\u2ABB','prap':'\u2AB7','prcue':'\u227C','pre':'\u2AAF','prE':'\u2AB3','prec':'\u227A','precapprox':'\u2AB7','preccurlyeq':'\u227C','Precedes':'\u227A','PrecedesEqual':'\u2AAF','PrecedesSlantEqual':'\u227C','PrecedesTilde':'\u227E','preceq':'\u2AAF','precnapprox':'\u2AB9','precneqq':'\u2AB5','precnsim':'\u22E8','precsim':'\u227E','prime':'\u2032','Prime':'\u2033','primes':'\u2119','prnap':'\u2AB9','prnE':'\u2AB5','prnsim':'\u22E8','prod':'\u220F','Product':'\u220F','profalar':'\u232E','profline':'\u2312','profsurf':'\u2313','prop':'\u221D','Proportion':'\u2237','Proportional':'\u221D','propto':'\u221D','prsim':'\u227E','prurel':'\u22B0','pscr':'\uD835\uDCC5','Pscr':'\uD835\uDCAB','psi':'\u03C8','Psi':'\u03A8','puncsp':'\u2008','qfr':'\uD835\uDD2E','Qfr':'\uD835\uDD14','qint':'\u2A0C','qopf':'\uD835\uDD62','Qopf':'\u211A','qprime':'\u2057','qscr':'\uD835\uDCC6','Qscr':'\uD835\uDCAC','quaternions':'\u210D','quatint':'\u2A16','quest':'?','questeq':'\u225F','quot':'"','QUOT':'"','rAarr':'\u21DB','race':'\u223D\u0331','racute':'\u0155','Racute':'\u0154','radic':'\u221A','raemptyv':'\u29B3','rang':'\u27E9','Rang':'\u27EB','rangd':'\u2992','range':'\u29A5','rangle':'\u27E9','raquo':'\xBB','rarr':'\u2192','rArr':'\u21D2','Rarr':'\u21A0','rarrap':'\u2975','rarrb':'\u21E5','rarrbfs':'\u2920','rarrc':'\u2933','rarrfs':'\u291E','rarrhk':'\u21AA','rarrlp':'\u21AC','rarrpl':'\u2945','rarrsim':'\u2974','rarrtl':'\u21A3','Rarrtl':'\u2916','rarrw':'\u219D','ratail':'\u291A','rAtail':'\u291C','ratio':'\u2236','rationals':'\u211A','rbarr':'\u290D','rBarr':'\u290F','RBarr':'\u2910','rbbrk':'\u2773','rbrace':'}','rbrack':']','rbrke':'\u298C','rbrksld':'\u298E','rbrkslu':'\u2990','rcaron':'\u0159','Rcaron':'\u0158','rcedil':'\u0157','Rcedil':'\u0156','rceil':'\u2309','rcub':'}','rcy':'\u0440','Rcy':'\u0420','rdca':'\u2937','rdldhar':'\u2969','rdquo':'\u201D','rdquor':'\u201D','rdsh':'\u21B3','Re':'\u211C','real':'\u211C','realine':'\u211B','realpart':'\u211C','reals':'\u211D','rect':'\u25AD','reg':'\xAE','REG':'\xAE','ReverseElement':'\u220B','ReverseEquilibrium':'\u21CB','ReverseUpEquilibrium':'\u296F','rfisht':'\u297D','rfloor':'\u230B','rfr':'\uD835\uDD2F','Rfr':'\u211C','rHar':'\u2964','rhard':'\u21C1','rharu':'\u21C0','rharul':'\u296C','rho':'\u03C1','Rho':'\u03A1','rhov':'\u03F1','RightAngleBracket':'\u27E9','rightarrow':'\u2192','Rightarrow':'\u21D2','RightArrow':'\u2192','RightArrowBar':'\u21E5','RightArrowLeftArrow':'\u21C4','rightarrowtail':'\u21A3','RightCeiling':'\u2309','RightDoubleBracket':'\u27E7','RightDownTeeVector':'\u295D','RightDownVector':'\u21C2','RightDownVectorBar':'\u2955','RightFloor':'\u230B','rightharpoondown':'\u21C1','rightharpoonup':'\u21C0','rightleftarrows':'\u21C4','rightleftharpoons':'\u21CC','rightrightarrows':'\u21C9','rightsquigarrow':'\u219D','RightTee':'\u22A2','RightTeeArrow':'\u21A6','RightTeeVector':'\u295B','rightthreetimes':'\u22CC','RightTriangle':'\u22B3','RightTriangleBar':'\u29D0','RightTriangleEqual':'\u22B5','RightUpDownVector':'\u294F','RightUpTeeVector':'\u295C','RightUpVector':'\u21BE','RightUpVectorBar':'\u2954','RightVector':'\u21C0','RightVectorBar':'\u2953','ring':'\u02DA','risingdotseq':'\u2253','rlarr':'\u21C4','rlhar':'\u21CC','rlm':'\u200F','rmoust':'\u23B1','rmoustache':'\u23B1','rnmid':'\u2AEE','roang':'\u27ED','roarr':'\u21FE','robrk':'\u27E7','ropar':'\u2986','ropf':'\uD835\uDD63','Ropf':'\u211D','roplus':'\u2A2E','rotimes':'\u2A35','RoundImplies':'\u2970','rpar':')','rpargt':'\u2994','rppolint':'\u2A12','rrarr':'\u21C9','Rrightarrow':'\u21DB','rsaquo':'\u203A','rscr':'\uD835\uDCC7','Rscr':'\u211B','rsh':'\u21B1','Rsh':'\u21B1','rsqb':']','rsquo':'\u2019','rsquor':'\u2019','rthree':'\u22CC','rtimes':'\u22CA','rtri':'\u25B9','rtrie':'\u22B5','rtrif':'\u25B8','rtriltri':'\u29CE','RuleDelayed':'\u29F4','ruluhar':'\u2968','rx':'\u211E','sacute':'\u015B','Sacute':'\u015A','sbquo':'\u201A','sc':'\u227B','Sc':'\u2ABC','scap':'\u2AB8','scaron':'\u0161','Scaron':'\u0160','sccue':'\u227D','sce':'\u2AB0','scE':'\u2AB4','scedil':'\u015F','Scedil':'\u015E','scirc':'\u015D','Scirc':'\u015C','scnap':'\u2ABA','scnE':'\u2AB6','scnsim':'\u22E9','scpolint':'\u2A13','scsim':'\u227F','scy':'\u0441','Scy':'\u0421','sdot':'\u22C5','sdotb':'\u22A1','sdote':'\u2A66','searhk':'\u2925','searr':'\u2198','seArr':'\u21D8','searrow':'\u2198','sect':'\xA7','semi':';','seswar':'\u2929','setminus':'\u2216','setmn':'\u2216','sext':'\u2736','sfr':'\uD835\uDD30','Sfr':'\uD835\uDD16','sfrown':'\u2322','sharp':'\u266F','shchcy':'\u0449','SHCHcy':'\u0429','shcy':'\u0448','SHcy':'\u0428','ShortDownArrow':'\u2193','ShortLeftArrow':'\u2190','shortmid':'\u2223','shortparallel':'\u2225','ShortRightArrow':'\u2192','ShortUpArrow':'\u2191','shy':'\xAD','sigma':'\u03C3','Sigma':'\u03A3','sigmaf':'\u03C2','sigmav':'\u03C2','sim':'\u223C','simdot':'\u2A6A','sime':'\u2243','simeq':'\u2243','simg':'\u2A9E','simgE':'\u2AA0','siml':'\u2A9D','simlE':'\u2A9F','simne':'\u2246','simplus':'\u2A24','simrarr':'\u2972','slarr':'\u2190','SmallCircle':'\u2218','smallsetminus':'\u2216','smashp':'\u2A33','smeparsl':'\u29E4','smid':'\u2223','smile':'\u2323','smt':'\u2AAA','smte':'\u2AAC','smtes':'\u2AAC\uFE00','softcy':'\u044C','SOFTcy':'\u042C','sol':'/','solb':'\u29C4','solbar':'\u233F','sopf':'\uD835\uDD64','Sopf':'\uD835\uDD4A','spades':'\u2660','spadesuit':'\u2660','spar':'\u2225','sqcap':'\u2293','sqcaps':'\u2293\uFE00','sqcup':'\u2294','sqcups':'\u2294\uFE00','Sqrt':'\u221A','sqsub':'\u228F','sqsube':'\u2291','sqsubset':'\u228F','sqsubseteq':'\u2291','sqsup':'\u2290','sqsupe':'\u2292','sqsupset':'\u2290','sqsupseteq':'\u2292','squ':'\u25A1','square':'\u25A1','Square':'\u25A1','SquareIntersection':'\u2293','SquareSubset':'\u228F','SquareSubsetEqual':'\u2291','SquareSuperset':'\u2290','SquareSupersetEqual':'\u2292','SquareUnion':'\u2294','squarf':'\u25AA','squf':'\u25AA','srarr':'\u2192','sscr':'\uD835\uDCC8','Sscr':'\uD835\uDCAE','ssetmn':'\u2216','ssmile':'\u2323','sstarf':'\u22C6','star':'\u2606','Star':'\u22C6','starf':'\u2605','straightepsilon':'\u03F5','straightphi':'\u03D5','strns':'\xAF','sub':'\u2282','Sub':'\u22D0','subdot':'\u2ABD','sube':'\u2286','subE':'\u2AC5','subedot':'\u2AC3','submult':'\u2AC1','subne':'\u228A','subnE':'\u2ACB','subplus':'\u2ABF','subrarr':'\u2979','subset':'\u2282','Subset':'\u22D0','subseteq':'\u2286','subseteqq':'\u2AC5','SubsetEqual':'\u2286','subsetneq':'\u228A','subsetneqq':'\u2ACB','subsim':'\u2AC7','subsub':'\u2AD5','subsup':'\u2AD3','succ':'\u227B','succapprox':'\u2AB8','succcurlyeq':'\u227D','Succeeds':'\u227B','SucceedsEqual':'\u2AB0','SucceedsSlantEqual':'\u227D','SucceedsTilde':'\u227F','succeq':'\u2AB0','succnapprox':'\u2ABA','succneqq':'\u2AB6','succnsim':'\u22E9','succsim':'\u227F','SuchThat':'\u220B','sum':'\u2211','Sum':'\u2211','sung':'\u266A','sup':'\u2283','Sup':'\u22D1','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','supdot':'\u2ABE','supdsub':'\u2AD8','supe':'\u2287','supE':'\u2AC6','supedot':'\u2AC4','Superset':'\u2283','SupersetEqual':'\u2287','suphsol':'\u27C9','suphsub':'\u2AD7','suplarr':'\u297B','supmult':'\u2AC2','supne':'\u228B','supnE':'\u2ACC','supplus':'\u2AC0','supset':'\u2283','Supset':'\u22D1','supseteq':'\u2287','supseteqq':'\u2AC6','supsetneq':'\u228B','supsetneqq':'\u2ACC','supsim':'\u2AC8','supsub':'\u2AD4','supsup':'\u2AD6','swarhk':'\u2926','swarr':'\u2199','swArr':'\u21D9','swarrow':'\u2199','swnwar':'\u292A','szlig':'\xDF','Tab':'\t','target':'\u2316','tau':'\u03C4','Tau':'\u03A4','tbrk':'\u23B4','tcaron':'\u0165','Tcaron':'\u0164','tcedil':'\u0163','Tcedil':'\u0162','tcy':'\u0442','Tcy':'\u0422','tdot':'\u20DB','telrec':'\u2315','tfr':'\uD835\uDD31','Tfr':'\uD835\uDD17','there4':'\u2234','therefore':'\u2234','Therefore':'\u2234','theta':'\u03B8','Theta':'\u0398','thetasym':'\u03D1','thetav':'\u03D1','thickapprox':'\u2248','thicksim':'\u223C','ThickSpace':'\u205F\u200A','thinsp':'\u2009','ThinSpace':'\u2009','thkap':'\u2248','thksim':'\u223C','thorn':'\xFE','THORN':'\xDE','tilde':'\u02DC','Tilde':'\u223C','TildeEqual':'\u2243','TildeFullEqual':'\u2245','TildeTilde':'\u2248','times':'\xD7','timesb':'\u22A0','timesbar':'\u2A31','timesd':'\u2A30','tint':'\u222D','toea':'\u2928','top':'\u22A4','topbot':'\u2336','topcir':'\u2AF1','topf':'\uD835\uDD65','Topf':'\uD835\uDD4B','topfork':'\u2ADA','tosa':'\u2929','tprime':'\u2034','trade':'\u2122','TRADE':'\u2122','triangle':'\u25B5','triangledown':'\u25BF','triangleleft':'\u25C3','trianglelefteq':'\u22B4','triangleq':'\u225C','triangleright':'\u25B9','trianglerighteq':'\u22B5','tridot':'\u25EC','trie':'\u225C','triminus':'\u2A3A','TripleDot':'\u20DB','triplus':'\u2A39','trisb':'\u29CD','tritime':'\u2A3B','trpezium':'\u23E2','tscr':'\uD835\uDCC9','Tscr':'\uD835\uDCAF','tscy':'\u0446','TScy':'\u0426','tshcy':'\u045B','TSHcy':'\u040B','tstrok':'\u0167','Tstrok':'\u0166','twixt':'\u226C','twoheadleftarrow':'\u219E','twoheadrightarrow':'\u21A0','uacute':'\xFA','Uacute':'\xDA','uarr':'\u2191','uArr':'\u21D1','Uarr':'\u219F','Uarrocir':'\u2949','ubrcy':'\u045E','Ubrcy':'\u040E','ubreve':'\u016D','Ubreve':'\u016C','ucirc':'\xFB','Ucirc':'\xDB','ucy':'\u0443','Ucy':'\u0423','udarr':'\u21C5','udblac':'\u0171','Udblac':'\u0170','udhar':'\u296E','ufisht':'\u297E','ufr':'\uD835\uDD32','Ufr':'\uD835\uDD18','ugrave':'\xF9','Ugrave':'\xD9','uHar':'\u2963','uharl':'\u21BF','uharr':'\u21BE','uhblk':'\u2580','ulcorn':'\u231C','ulcorner':'\u231C','ulcrop':'\u230F','ultri':'\u25F8','umacr':'\u016B','Umacr':'\u016A','uml':'\xA8','UnderBar':'_','UnderBrace':'\u23DF','UnderBracket':'\u23B5','UnderParenthesis':'\u23DD','Union':'\u22C3','UnionPlus':'\u228E','uogon':'\u0173','Uogon':'\u0172','uopf':'\uD835\uDD66','Uopf':'\uD835\uDD4C','uparrow':'\u2191','Uparrow':'\u21D1','UpArrow':'\u2191','UpArrowBar':'\u2912','UpArrowDownArrow':'\u21C5','updownarrow':'\u2195','Updownarrow':'\u21D5','UpDownArrow':'\u2195','UpEquilibrium':'\u296E','upharpoonleft':'\u21BF','upharpoonright':'\u21BE','uplus':'\u228E','UpperLeftArrow':'\u2196','UpperRightArrow':'\u2197','upsi':'\u03C5','Upsi':'\u03D2','upsih':'\u03D2','upsilon':'\u03C5','Upsilon':'\u03A5','UpTee':'\u22A5','UpTeeArrow':'\u21A5','upuparrows':'\u21C8','urcorn':'\u231D','urcorner':'\u231D','urcrop':'\u230E','uring':'\u016F','Uring':'\u016E','urtri':'\u25F9','uscr':'\uD835\uDCCA','Uscr':'\uD835\uDCB0','utdot':'\u22F0','utilde':'\u0169','Utilde':'\u0168','utri':'\u25B5','utrif':'\u25B4','uuarr':'\u21C8','uuml':'\xFC','Uuml':'\xDC','uwangle':'\u29A7','vangrt':'\u299C','varepsilon':'\u03F5','varkappa':'\u03F0','varnothing':'\u2205','varphi':'\u03D5','varpi':'\u03D6','varpropto':'\u221D','varr':'\u2195','vArr':'\u21D5','varrho':'\u03F1','varsigma':'\u03C2','varsubsetneq':'\u228A\uFE00','varsubsetneqq':'\u2ACB\uFE00','varsupsetneq':'\u228B\uFE00','varsupsetneqq':'\u2ACC\uFE00','vartheta':'\u03D1','vartriangleleft':'\u22B2','vartriangleright':'\u22B3','vBar':'\u2AE8','Vbar':'\u2AEB','vBarv':'\u2AE9','vcy':'\u0432','Vcy':'\u0412','vdash':'\u22A2','vDash':'\u22A8','Vdash':'\u22A9','VDash':'\u22AB','Vdashl':'\u2AE6','vee':'\u2228','Vee':'\u22C1','veebar':'\u22BB','veeeq':'\u225A','vellip':'\u22EE','verbar':'|','Verbar':'\u2016','vert':'|','Vert':'\u2016','VerticalBar':'\u2223','VerticalLine':'|','VerticalSeparator':'\u2758','VerticalTilde':'\u2240','VeryThinSpace':'\u200A','vfr':'\uD835\uDD33','Vfr':'\uD835\uDD19','vltri':'\u22B2','vnsub':'\u2282\u20D2','vnsup':'\u2283\u20D2','vopf':'\uD835\uDD67','Vopf':'\uD835\uDD4D','vprop':'\u221D','vrtri':'\u22B3','vscr':'\uD835\uDCCB','Vscr':'\uD835\uDCB1','vsubne':'\u228A\uFE00','vsubnE':'\u2ACB\uFE00','vsupne':'\u228B\uFE00','vsupnE':'\u2ACC\uFE00','Vvdash':'\u22AA','vzigzag':'\u299A','wcirc':'\u0175','Wcirc':'\u0174','wedbar':'\u2A5F','wedge':'\u2227','Wedge':'\u22C0','wedgeq':'\u2259','weierp':'\u2118','wfr':'\uD835\uDD34','Wfr':'\uD835\uDD1A','wopf':'\uD835\uDD68','Wopf':'\uD835\uDD4E','wp':'\u2118','wr':'\u2240','wreath':'\u2240','wscr':'\uD835\uDCCC','Wscr':'\uD835\uDCB2','xcap':'\u22C2','xcirc':'\u25EF','xcup':'\u22C3','xdtri':'\u25BD','xfr':'\uD835\uDD35','Xfr':'\uD835\uDD1B','xharr':'\u27F7','xhArr':'\u27FA','xi':'\u03BE','Xi':'\u039E','xlarr':'\u27F5','xlArr':'\u27F8','xmap':'\u27FC','xnis':'\u22FB','xodot':'\u2A00','xopf':'\uD835\uDD69','Xopf':'\uD835\uDD4F','xoplus':'\u2A01','xotime':'\u2A02','xrarr':'\u27F6','xrArr':'\u27F9','xscr':'\uD835\uDCCD','Xscr':'\uD835\uDCB3','xsqcup':'\u2A06','xuplus':'\u2A04','xutri':'\u25B3','xvee':'\u22C1','xwedge':'\u22C0','yacute':'\xFD','Yacute':'\xDD','yacy':'\u044F','YAcy':'\u042F','ycirc':'\u0177','Ycirc':'\u0176','ycy':'\u044B','Ycy':'\u042B','yen':'\xA5','yfr':'\uD835\uDD36','Yfr':'\uD835\uDD1C','yicy':'\u0457','YIcy':'\u0407','yopf':'\uD835\uDD6A','Yopf':'\uD835\uDD50','yscr':'\uD835\uDCCE','Yscr':'\uD835\uDCB4','yucy':'\u044E','YUcy':'\u042E','yuml':'\xFF','Yuml':'\u0178','zacute':'\u017A','Zacute':'\u0179','zcaron':'\u017E','Zcaron':'\u017D','zcy':'\u0437','Zcy':'\u0417','zdot':'\u017C','Zdot':'\u017B','zeetrf':'\u2128','ZeroWidthSpace':'\u200B','zeta':'\u03B6','Zeta':'\u0396','zfr':'\uD835\uDD37','Zfr':'\u2128','zhcy':'\u0436','ZHcy':'\u0416','zigrarr':'\u21DD','zopf':'\uD835\uDD6B','Zopf':'\u2124','zscr':'\uD835\uDCCF','Zscr':'\uD835\uDCB5','zwj':'\u200D','zwnj':'\u200C'};
|
|
8117
|
+
var decodeMapLegacy = {'aacute':'\xE1','Aacute':'\xC1','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','aelig':'\xE6','AElig':'\xC6','agrave':'\xE0','Agrave':'\xC0','amp':'&','AMP':'&','aring':'\xE5','Aring':'\xC5','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','brvbar':'\xA6','ccedil':'\xE7','Ccedil':'\xC7','cedil':'\xB8','cent':'\xA2','copy':'\xA9','COPY':'\xA9','curren':'\xA4','deg':'\xB0','divide':'\xF7','eacute':'\xE9','Eacute':'\xC9','ecirc':'\xEA','Ecirc':'\xCA','egrave':'\xE8','Egrave':'\xC8','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','frac12':'\xBD','frac14':'\xBC','frac34':'\xBE','gt':'>','GT':'>','iacute':'\xED','Iacute':'\xCD','icirc':'\xEE','Icirc':'\xCE','iexcl':'\xA1','igrave':'\xEC','Igrave':'\xCC','iquest':'\xBF','iuml':'\xEF','Iuml':'\xCF','laquo':'\xAB','lt':'<','LT':'<','macr':'\xAF','micro':'\xB5','middot':'\xB7','nbsp':'\xA0','not':'\xAC','ntilde':'\xF1','Ntilde':'\xD1','oacute':'\xF3','Oacute':'\xD3','ocirc':'\xF4','Ocirc':'\xD4','ograve':'\xF2','Ograve':'\xD2','ordf':'\xAA','ordm':'\xBA','oslash':'\xF8','Oslash':'\xD8','otilde':'\xF5','Otilde':'\xD5','ouml':'\xF6','Ouml':'\xD6','para':'\xB6','plusmn':'\xB1','pound':'\xA3','quot':'"','QUOT':'"','raquo':'\xBB','reg':'\xAE','REG':'\xAE','sect':'\xA7','shy':'\xAD','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','szlig':'\xDF','thorn':'\xFE','THORN':'\xDE','times':'\xD7','uacute':'\xFA','Uacute':'\xDA','ucirc':'\xFB','Ucirc':'\xDB','ugrave':'\xF9','Ugrave':'\xD9','uml':'\xA8','uuml':'\xFC','Uuml':'\xDC','yacute':'\xFD','Yacute':'\xDD','yen':'\xA5','yuml':'\xFF'};
|
|
8118
|
+
var decodeMapNumeric = {'0':'\uFFFD','128':'\u20AC','130':'\u201A','131':'\u0192','132':'\u201E','133':'\u2026','134':'\u2020','135':'\u2021','136':'\u02C6','137':'\u2030','138':'\u0160','139':'\u2039','140':'\u0152','142':'\u017D','145':'\u2018','146':'\u2019','147':'\u201C','148':'\u201D','149':'\u2022','150':'\u2013','151':'\u2014','152':'\u02DC','153':'\u2122','154':'\u0161','155':'\u203A','156':'\u0153','158':'\u017E','159':'\u0178'};
|
|
8119
|
+
var invalidReferenceCodePoints = [1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65000,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];
|
|
8120
|
+
|
|
8121
|
+
/*--------------------------------------------------------------------------*/
|
|
8122
|
+
|
|
8123
|
+
var stringFromCharCode = String.fromCharCode;
|
|
8124
|
+
|
|
8125
|
+
var object = {};
|
|
8126
|
+
var hasOwnProperty = object.hasOwnProperty;
|
|
8127
|
+
var has = function(object, propertyName) {
|
|
8128
|
+
return hasOwnProperty.call(object, propertyName);
|
|
8129
|
+
};
|
|
8130
|
+
|
|
8131
|
+
var contains = function(array, value) {
|
|
8132
|
+
var index = -1;
|
|
8133
|
+
var length = array.length;
|
|
8134
|
+
while (++index < length) {
|
|
8135
|
+
if (array[index] == value) {
|
|
8136
|
+
return true;
|
|
8137
|
+
}
|
|
8138
|
+
}
|
|
8139
|
+
return false;
|
|
8140
|
+
};
|
|
8141
|
+
|
|
8142
|
+
var merge = function(options, defaults) {
|
|
8143
|
+
if (!options) {
|
|
8144
|
+
return defaults;
|
|
8145
|
+
}
|
|
8146
|
+
var result = {};
|
|
8147
|
+
var key;
|
|
8148
|
+
for (key in defaults) {
|
|
8149
|
+
// A `hasOwnProperty` check is not needed here, since only recognized
|
|
8150
|
+
// option names are used anyway. Any others are ignored.
|
|
8151
|
+
result[key] = has(options, key) ? options[key] : defaults[key];
|
|
8152
|
+
}
|
|
8153
|
+
return result;
|
|
8154
|
+
};
|
|
8155
|
+
|
|
8156
|
+
// Modified version of `ucs2encode`; see https://mths.be/punycode.
|
|
8157
|
+
var codePointToSymbol = function(codePoint, strict) {
|
|
8158
|
+
var output = '';
|
|
8159
|
+
if ((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF) {
|
|
8160
|
+
// See issue #4:
|
|
8161
|
+
// “Otherwise, if the number is in the range 0xD800 to 0xDFFF or is
|
|
8162
|
+
// greater than 0x10FFFF, then this is a parse error. Return a U+FFFD
|
|
8163
|
+
// REPLACEMENT CHARACTER.”
|
|
8164
|
+
if (strict) {
|
|
8165
|
+
parseError('character reference outside the permissible Unicode range');
|
|
8166
|
+
}
|
|
8167
|
+
return '\uFFFD';
|
|
8168
|
+
}
|
|
8169
|
+
if (has(decodeMapNumeric, codePoint)) {
|
|
8170
|
+
if (strict) {
|
|
8171
|
+
parseError('disallowed character reference');
|
|
8172
|
+
}
|
|
8173
|
+
return decodeMapNumeric[codePoint];
|
|
8174
|
+
}
|
|
8175
|
+
if (strict && contains(invalidReferenceCodePoints, codePoint)) {
|
|
8176
|
+
parseError('disallowed character reference');
|
|
8177
|
+
}
|
|
8178
|
+
if (codePoint > 0xFFFF) {
|
|
8179
|
+
codePoint -= 0x10000;
|
|
8180
|
+
output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
|
|
8181
|
+
codePoint = 0xDC00 | codePoint & 0x3FF;
|
|
8182
|
+
}
|
|
8183
|
+
output += stringFromCharCode(codePoint);
|
|
8184
|
+
return output;
|
|
8185
|
+
};
|
|
8186
|
+
|
|
8187
|
+
var hexEscape = function(codePoint) {
|
|
8188
|
+
return '&#x' + codePoint.toString(16).toUpperCase() + ';';
|
|
8189
|
+
};
|
|
8190
|
+
|
|
8191
|
+
var decEscape = function(codePoint) {
|
|
8192
|
+
return '&#' + codePoint + ';';
|
|
8193
|
+
};
|
|
8194
|
+
|
|
8195
|
+
var parseError = function(message) {
|
|
8196
|
+
throw Error('Parse error: ' + message);
|
|
8197
|
+
};
|
|
8198
|
+
|
|
8199
|
+
/*--------------------------------------------------------------------------*/
|
|
8200
|
+
|
|
8201
|
+
var encode = function(string, options) {
|
|
8202
|
+
options = merge(options, encode.options);
|
|
8203
|
+
var strict = options.strict;
|
|
8204
|
+
if (strict && regexInvalidRawCodePoint.test(string)) {
|
|
8205
|
+
parseError('forbidden code point');
|
|
8206
|
+
}
|
|
8207
|
+
var encodeEverything = options.encodeEverything;
|
|
8208
|
+
var useNamedReferences = options.useNamedReferences;
|
|
8209
|
+
var allowUnsafeSymbols = options.allowUnsafeSymbols;
|
|
8210
|
+
var escapeCodePoint = options.decimal ? decEscape : hexEscape;
|
|
8211
|
+
|
|
8212
|
+
var escapeBmpSymbol = function(symbol) {
|
|
8213
|
+
return escapeCodePoint(symbol.charCodeAt(0));
|
|
8214
|
+
};
|
|
8215
|
+
|
|
8216
|
+
if (encodeEverything) {
|
|
8217
|
+
// Encode ASCII symbols.
|
|
8218
|
+
string = string.replace(regexAsciiWhitelist, function(symbol) {
|
|
8219
|
+
// Use named references if requested & possible.
|
|
8220
|
+
if (useNamedReferences && has(encodeMap, symbol)) {
|
|
8221
|
+
return '&' + encodeMap[symbol] + ';';
|
|
8222
|
+
}
|
|
8223
|
+
return escapeBmpSymbol(symbol);
|
|
8224
|
+
});
|
|
8225
|
+
// Shorten a few escapes that represent two symbols, of which at least one
|
|
8226
|
+
// is within the ASCII range.
|
|
8227
|
+
if (useNamedReferences) {
|
|
8228
|
+
string = string
|
|
8229
|
+
.replace(/>\u20D2/g, '>⃒')
|
|
8230
|
+
.replace(/<\u20D2/g, '<⃒')
|
|
8231
|
+
.replace(/fj/g, 'fj');
|
|
8232
|
+
}
|
|
8233
|
+
// Encode non-ASCII symbols.
|
|
8234
|
+
if (useNamedReferences) {
|
|
8235
|
+
// Encode non-ASCII symbols that can be replaced with a named reference.
|
|
8236
|
+
string = string.replace(regexEncodeNonAscii, function(string) {
|
|
8237
|
+
// Note: there is no need to check `has(encodeMap, string)` here.
|
|
8238
|
+
return '&' + encodeMap[string] + ';';
|
|
8239
|
+
});
|
|
8240
|
+
}
|
|
8241
|
+
// Note: any remaining non-ASCII symbols are handled outside of the `if`.
|
|
8242
|
+
} else if (useNamedReferences) {
|
|
8243
|
+
// Apply named character references.
|
|
8244
|
+
// Encode `<>"'&` using named character references.
|
|
8245
|
+
if (!allowUnsafeSymbols) {
|
|
8246
|
+
string = string.replace(regexEscape, function(string) {
|
|
8247
|
+
return '&' + encodeMap[string] + ';'; // no need to check `has()` here
|
|
8248
|
+
});
|
|
8249
|
+
}
|
|
8250
|
+
// Shorten escapes that represent two symbols, of which at least one is
|
|
8251
|
+
// `<>"'&`.
|
|
8252
|
+
string = string
|
|
8253
|
+
.replace(/>\u20D2/g, '>⃒')
|
|
8254
|
+
.replace(/<\u20D2/g, '<⃒');
|
|
8255
|
+
// Encode non-ASCII symbols that can be replaced with a named reference.
|
|
8256
|
+
string = string.replace(regexEncodeNonAscii, function(string) {
|
|
8257
|
+
// Note: there is no need to check `has(encodeMap, string)` here.
|
|
8258
|
+
return '&' + encodeMap[string] + ';';
|
|
8259
|
+
});
|
|
8260
|
+
} else if (!allowUnsafeSymbols) {
|
|
8261
|
+
// Encode `<>"'&` using hexadecimal escapes, now that they’re not handled
|
|
8262
|
+
// using named character references.
|
|
8263
|
+
string = string.replace(regexEscape, escapeBmpSymbol);
|
|
8264
|
+
}
|
|
8265
|
+
return string
|
|
8266
|
+
// Encode astral symbols.
|
|
8267
|
+
.replace(regexAstralSymbols, function($0) {
|
|
8268
|
+
// https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
|
8269
|
+
var high = $0.charCodeAt(0);
|
|
8270
|
+
var low = $0.charCodeAt(1);
|
|
8271
|
+
var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
|
|
8272
|
+
return escapeCodePoint(codePoint);
|
|
8273
|
+
})
|
|
8274
|
+
// Encode any remaining BMP symbols that are not printable ASCII symbols
|
|
8275
|
+
// using a hexadecimal escape.
|
|
8276
|
+
.replace(regexBmpWhitelist, escapeBmpSymbol);
|
|
8277
|
+
};
|
|
8278
|
+
// Expose default options (so they can be overridden globally).
|
|
8279
|
+
encode.options = {
|
|
8280
|
+
'allowUnsafeSymbols': false,
|
|
8281
|
+
'encodeEverything': false,
|
|
8282
|
+
'strict': false,
|
|
8283
|
+
'useNamedReferences': false,
|
|
8284
|
+
'decimal' : false
|
|
8285
|
+
};
|
|
8286
|
+
|
|
8287
|
+
var decode = function(html, options) {
|
|
8288
|
+
options = merge(options, decode.options);
|
|
8289
|
+
var strict = options.strict;
|
|
8290
|
+
if (strict && regexInvalidEntity.test(html)) {
|
|
8291
|
+
parseError('malformed character reference');
|
|
8292
|
+
}
|
|
8293
|
+
return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7) {
|
|
8294
|
+
var codePoint;
|
|
8295
|
+
var semicolon;
|
|
8296
|
+
var decDigits;
|
|
8297
|
+
var hexDigits;
|
|
8298
|
+
var reference;
|
|
8299
|
+
var next;
|
|
8300
|
+
if ($1) {
|
|
8301
|
+
// Decode decimal escapes, e.g. `𝌆`.
|
|
8302
|
+
decDigits = $1;
|
|
8303
|
+
semicolon = $2;
|
|
8304
|
+
if (strict && !semicolon) {
|
|
8305
|
+
parseError('character reference was not terminated by a semicolon');
|
|
8306
|
+
}
|
|
8307
|
+
codePoint = parseInt(decDigits, 10);
|
|
8308
|
+
return codePointToSymbol(codePoint, strict);
|
|
8309
|
+
}
|
|
8310
|
+
if ($3) {
|
|
8311
|
+
// Decode hexadecimal escapes, e.g. `𝌆`.
|
|
8312
|
+
hexDigits = $3;
|
|
8313
|
+
semicolon = $4;
|
|
8314
|
+
if (strict && !semicolon) {
|
|
8315
|
+
parseError('character reference was not terminated by a semicolon');
|
|
8316
|
+
}
|
|
8317
|
+
codePoint = parseInt(hexDigits, 16);
|
|
8318
|
+
return codePointToSymbol(codePoint, strict);
|
|
8319
|
+
}
|
|
8320
|
+
if ($5) {
|
|
8321
|
+
// Decode named character references with trailing `;`, e.g. `©`.
|
|
8322
|
+
reference = $5;
|
|
8323
|
+
if (has(decodeMap, reference)) {
|
|
8324
|
+
return decodeMap[reference];
|
|
8325
|
+
} else {
|
|
8326
|
+
// Ambiguous ampersand. https://mths.be/notes/ambiguous-ampersands
|
|
8327
|
+
if (strict) {
|
|
8328
|
+
parseError(
|
|
8329
|
+
'named character reference was not terminated by a semicolon'
|
|
8330
|
+
);
|
|
8331
|
+
}
|
|
8332
|
+
return $0;
|
|
8333
|
+
}
|
|
8334
|
+
}
|
|
8335
|
+
// If we’re still here, it’s a legacy reference for sure. No need for an
|
|
8336
|
+
// extra `if` check.
|
|
8337
|
+
// Decode named character references without trailing `;`, e.g. `&`
|
|
8338
|
+
// This is only a parse error if it gets converted to `&`, or if it is
|
|
8339
|
+
// followed by `=` in an attribute context.
|
|
8340
|
+
reference = $6;
|
|
8341
|
+
next = $7;
|
|
8342
|
+
if (next && options.isAttributeValue) {
|
|
8343
|
+
if (strict && next == '=') {
|
|
8344
|
+
parseError('`&` did not start a character reference');
|
|
8345
|
+
}
|
|
8346
|
+
return $0;
|
|
8347
|
+
} else {
|
|
8348
|
+
if (strict) {
|
|
8349
|
+
parseError(
|
|
8350
|
+
'named character reference was not terminated by a semicolon'
|
|
8351
|
+
);
|
|
8352
|
+
}
|
|
8353
|
+
// Note: there is no need to check `has(decodeMapLegacy, reference)`.
|
|
8354
|
+
return decodeMapLegacy[reference] + (next || '');
|
|
8355
|
+
}
|
|
8356
|
+
});
|
|
8357
|
+
};
|
|
8358
|
+
// Expose default options (so they can be overridden globally).
|
|
8359
|
+
decode.options = {
|
|
8360
|
+
'isAttributeValue': false,
|
|
8361
|
+
'strict': false
|
|
8362
|
+
};
|
|
8363
|
+
|
|
8364
|
+
var escape = function(string) {
|
|
8365
|
+
return string.replace(regexEscape, function($0) {
|
|
8366
|
+
// Note: there is no need to check `has(escapeMap, $0)` here.
|
|
8367
|
+
return escapeMap[$0];
|
|
8368
|
+
});
|
|
8369
|
+
};
|
|
8370
|
+
|
|
8371
|
+
/*--------------------------------------------------------------------------*/
|
|
8372
|
+
|
|
8373
|
+
var he = {
|
|
8374
|
+
'version': '1.1.1',
|
|
8375
|
+
'encode': encode,
|
|
8376
|
+
'decode': decode,
|
|
8377
|
+
'escape': escape,
|
|
8378
|
+
'unescape': decode
|
|
8379
|
+
};
|
|
8380
|
+
|
|
8381
|
+
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
|
8382
|
+
// like the following:
|
|
8383
|
+
if (freeExports && !freeExports.nodeType) {
|
|
8384
|
+
if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+
|
|
8385
|
+
freeModule.exports = he;
|
|
8386
|
+
} else { // in Narwhal or RingoJS v0.7.0-
|
|
8387
|
+
for (var key in he) {
|
|
8388
|
+
has(he, key) && (freeExports[key] = he[key]);
|
|
8389
|
+
}
|
|
8390
|
+
}
|
|
8391
|
+
} else { // in Rhino or a web browser
|
|
8392
|
+
root.he = he;
|
|
8393
|
+
}
|
|
8394
|
+
|
|
8395
|
+
}(commonjsGlobal));
|
|
8396
|
+
});
|
|
8397
|
+
|
|
8398
|
+
var TagType = {"OPENING":1, "CLOSING":2, "SELF":3, "CDATA": 4};
|
|
8399
|
+
|
|
8400
|
+
//var tagsRegx = new RegExp("<(\\/?[\\w:\\-\._]+)([^>]*)>(\\s*"+cdataRegx+")*([^<]+)?","g");
|
|
8401
|
+
//var tagsRegx = new RegExp("<(\\/?)((\\w*:)?([\\w:\\-\._]+))([^>]*)>([^<]*)("+cdataRegx+"([^<]*))*([^<]+)?","g");
|
|
8402
|
+
|
|
8403
|
+
//treat cdata as a tag
|
|
8404
|
+
|
|
8405
|
+
|
|
8406
|
+
var defaultOptions = {
|
|
8407
|
+
attributeNamePrefix : "@_",
|
|
8408
|
+
attrNodeName: false,
|
|
8409
|
+
textNodeName : "#text",
|
|
8410
|
+
ignoreAttributes : true,
|
|
8411
|
+
ignoreNameSpace : false,
|
|
8412
|
+
allowBooleanAttributes : false, //a tag can have attributes without any value
|
|
8413
|
+
//ignoreRootElement : false,
|
|
8414
|
+
parseNodeValue : true,
|
|
8415
|
+
parseAttributeValue : false,
|
|
8416
|
+
arrayMode : false,
|
|
8417
|
+
trimValues: true, //Trim string values of tag and attributes
|
|
8418
|
+
decodeHTMLchar: false,
|
|
8419
|
+
cdataTagName: false,
|
|
8420
|
+
cdataPositionChar: "\\c"
|
|
8421
|
+
//decodeStrict: false,
|
|
8422
|
+
};
|
|
8423
|
+
|
|
8424
|
+
var getTraversalObj =function (xmlData,options){
|
|
8425
|
+
//options = buildOptions(options);
|
|
8426
|
+
options = Object.assign({},defaultOptions,options);
|
|
8427
|
+
//xmlData = xmlData.replace(/\r?\n/g, " ");//make it single line
|
|
8428
|
+
xmlData = xmlData.replace(/<!--[\s\S]*?-->/g, "");//Remove comments
|
|
8429
|
+
|
|
8430
|
+
var xmlObj = new xmlNode('!xml');
|
|
8431
|
+
var currentNode = xmlObj;
|
|
8432
|
+
|
|
8433
|
+
var tagsRegx = new RegExp("<((!\\[CDATA\\[([\\s\\S]*?)(\\]\\]>))|(([\\w:\\-\\._]*:)?([\\w:\\-\\._]+))([^>]*)>|((\\/)(([\\w:\\-\\._]*:)?([\\w:\\-\\._]+))>))([^<]*)","g");
|
|
8434
|
+
var tag = tagsRegx.exec(xmlData);
|
|
8435
|
+
var nextTag = tagsRegx.exec(xmlData);
|
|
8436
|
+
while (tag) {
|
|
8437
|
+
var tagType = checkForTagType(tag);
|
|
8438
|
+
|
|
8439
|
+
if(tagType === TagType.CLOSING){
|
|
8440
|
+
//add parsed data to parent node
|
|
8441
|
+
if(currentNode.parent && tag[14]){
|
|
8442
|
+
currentNode.parent.val = util.getValue(currentNode.parent.val) + "" + processTagValue(tag[14],options);
|
|
8443
|
+
}
|
|
8444
|
+
|
|
8445
|
+
currentNode = currentNode.parent;
|
|
8446
|
+
}else if(tagType === TagType.CDATA){
|
|
8447
|
+
if(options.cdataTagName){
|
|
8448
|
+
//add cdata node
|
|
8449
|
+
var childNode = new xmlNode( options.cdataTagName,currentNode,tag[3]);
|
|
8450
|
+
childNode.attrsMap = buildAttributesMap(tag[8],options);
|
|
8451
|
+
currentNode.addChild(childNode);
|
|
8452
|
+
//for backtracking
|
|
8453
|
+
currentNode.val = util.getValue(currentNode.val) + options.cdataPositionChar;
|
|
8454
|
+
//add rest value to parent node
|
|
8455
|
+
if(tag[14]){
|
|
8456
|
+
currentNode.val += processTagValue(tag[14],options);
|
|
8457
|
+
}
|
|
8458
|
+
}else {
|
|
8459
|
+
currentNode.val = (currentNode.val || "") + (tag[3] || "") + processTagValue(tag[14],options);
|
|
8460
|
+
}
|
|
8461
|
+
}else if(tagType === TagType.SELF){
|
|
8462
|
+
var childNode = new xmlNode( options.ignoreNameSpace ? tag[7] : tag[5],currentNode, "");
|
|
8463
|
+
if(tag[8] && tag[8].length > 1){
|
|
8464
|
+
tag[8] = tag[8].substr(0,tag[8].length -1);
|
|
8465
|
+
}
|
|
8466
|
+
childNode.attrsMap = buildAttributesMap(tag[8],options);
|
|
8467
|
+
currentNode.addChild(childNode);
|
|
8468
|
+
}else {//TagType.OPENING
|
|
8469
|
+
var childNode = new xmlNode( options.ignoreNameSpace ? tag[7] : tag[5],currentNode,processTagValue(tag[14],options));
|
|
8470
|
+
childNode.attrsMap = buildAttributesMap(tag[8],options);
|
|
8471
|
+
currentNode.addChild(childNode);
|
|
8472
|
+
currentNode = childNode;
|
|
8473
|
+
}
|
|
8474
|
+
|
|
8475
|
+
tag = nextTag;
|
|
8476
|
+
nextTag = tagsRegx.exec(xmlData);
|
|
8477
|
+
}
|
|
8478
|
+
|
|
8479
|
+
return xmlObj;
|
|
8480
|
+
};
|
|
8481
|
+
|
|
8482
|
+
function processTagValue(val,options){
|
|
8483
|
+
if(val){
|
|
8484
|
+
if(options.trimValues){
|
|
8485
|
+
val = val.trim();
|
|
8486
|
+
}
|
|
8487
|
+
if(options.decodeHTMLchar){
|
|
8488
|
+
val = he.decode(val);
|
|
8489
|
+
}
|
|
8490
|
+
val = parseValue(val,options.parseNodeValue);
|
|
8491
|
+
}
|
|
8492
|
+
|
|
8493
|
+
return val;
|
|
8494
|
+
}
|
|
8495
|
+
|
|
8496
|
+
function checkForTagType(match){
|
|
8497
|
+
if(match[4] === "]]>"){
|
|
8498
|
+
return TagType.CDATA;
|
|
8499
|
+
}else if(match[10] === "/"){
|
|
8500
|
+
return TagType.CLOSING;
|
|
8501
|
+
}else if(typeof match[8] !== "undefined" && match[8].substr(match[8].length-1) === "/"){
|
|
8502
|
+
return TagType.SELF;
|
|
8503
|
+
}else {
|
|
8504
|
+
return TagType.OPENING;
|
|
8505
|
+
}
|
|
8506
|
+
}
|
|
8507
|
+
|
|
8508
|
+
var xml2json = function (xmlData,options){
|
|
8509
|
+
options = Object.assign({},defaultOptions,options);
|
|
8510
|
+
return convertToJson(getTraversalObj(xmlData,options), options);
|
|
8511
|
+
};
|
|
8512
|
+
|
|
8513
|
+
function resolveNameSpace(tagname,options){
|
|
8514
|
+
if(options.ignoreNameSpace ){
|
|
8515
|
+
var tags = tagname.split(":");
|
|
8516
|
+
var prefix = tagname.charAt(0) === "/" ? "/" : "";
|
|
8517
|
+
if(tags[0] === "xmlns") {
|
|
8518
|
+
return "";
|
|
8519
|
+
}
|
|
8520
|
+
if(tags.length === 2) {
|
|
8521
|
+
tagname = prefix + tags[1];
|
|
8522
|
+
}
|
|
8523
|
+
}
|
|
8524
|
+
return tagname;
|
|
8525
|
+
}
|
|
8526
|
+
|
|
8527
|
+
function parseValue(val,shouldParse){
|
|
8528
|
+
if(shouldParse && typeof val === "string"){
|
|
8529
|
+
if(val.trim() === "" || isNaN(val)){
|
|
8530
|
+
val = val === "true" ? true : val === "false" ? false : val;
|
|
8531
|
+
}else {
|
|
8532
|
+
if(val.indexOf(".") !== -1){
|
|
8533
|
+
val = Number.parseFloat(val);
|
|
8534
|
+
}else {
|
|
8535
|
+
val = Number.parseInt(val,10);
|
|
8536
|
+
}
|
|
8537
|
+
}
|
|
8538
|
+
return val;
|
|
8539
|
+
}else {
|
|
8540
|
+
if(util.isExist(val)) return val;
|
|
8541
|
+
else return "";
|
|
8542
|
+
}
|
|
8543
|
+
}
|
|
8544
|
+
|
|
8545
|
+
//TODO: change regex to capture NS
|
|
8546
|
+
//var attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm");
|
|
8547
|
+
var attrsRegx = new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])(.*?)\\3)?","g");
|
|
8548
|
+
function buildAttributesMap(attrStr,options){
|
|
8549
|
+
if( !options.ignoreAttributes && typeof attrStr === "string" ){
|
|
8550
|
+
attrStr = attrStr.replace(/\r?\n/g, " ");
|
|
8551
|
+
//attrStr = attrStr || attrStr.trim();
|
|
8552
|
+
|
|
8553
|
+
var matches = util.getAllMatches(attrStr,attrsRegx);
|
|
8554
|
+
var len = matches.length; //don't make it inline
|
|
8555
|
+
var attrs = {};
|
|
8556
|
+
for (var i = 0; i < len ; i++) {
|
|
8557
|
+
var attrName = resolveNameSpace(matches[i][1],options);
|
|
8558
|
+
if(attrName.length) {
|
|
8559
|
+
if(matches[i][4] !== undefined){
|
|
8560
|
+
if(options.trimValues){
|
|
8561
|
+
matches[i][4] = matches[i][4].trim();
|
|
8562
|
+
}
|
|
8563
|
+
if(options.decodeHTMLchar){
|
|
8564
|
+
matches[i][4] = he.decode(matches[i][4], {isAttributeValue : true});
|
|
8565
|
+
}
|
|
8566
|
+
attrs[options.attributeNamePrefix + attrName] = parseValue(matches[i][4],options.parseAttributeValue);
|
|
8567
|
+
}else if(options.allowBooleanAttributes){
|
|
8568
|
+
attrs[options.attributeNamePrefix + attrName] = true;
|
|
8569
|
+
}
|
|
8570
|
+
|
|
8571
|
+
}
|
|
8572
|
+
}
|
|
8573
|
+
if(!Object.keys(attrs).length){
|
|
8574
|
+
return;
|
|
8575
|
+
}
|
|
8576
|
+
if(options.attrNodeName){
|
|
8577
|
+
var attrCollection = {};
|
|
8578
|
+
attrCollection[options.attrNodeName] = attrs;
|
|
8579
|
+
return attrCollection;
|
|
8580
|
+
}
|
|
8581
|
+
return attrs;
|
|
8582
|
+
}
|
|
8583
|
+
}
|
|
8584
|
+
|
|
8585
|
+
var convertToJson = function (node, options){
|
|
8586
|
+
var jObj = {};
|
|
8587
|
+
|
|
8588
|
+
//traver through all the children
|
|
8589
|
+
for (var index = 0; index < node.child.length; index++) {
|
|
8590
|
+
var prop = node.child[index].tagname;
|
|
8591
|
+
var obj = convertToJson(node.child[index],options);
|
|
8592
|
+
if(typeof jObj[prop] !== "undefined"){
|
|
8593
|
+
if(!Array.isArray(jObj[prop])){
|
|
8594
|
+
var swap = jObj[prop];
|
|
8595
|
+
jObj[prop] = [];
|
|
8596
|
+
jObj[prop].push(swap);
|
|
8597
|
+
}
|
|
8598
|
+
jObj[prop].push(obj);
|
|
8599
|
+
}else {
|
|
8600
|
+
jObj[prop] = options.arrayMode ? [obj] : obj;
|
|
8601
|
+
}
|
|
8602
|
+
}
|
|
8603
|
+
util.merge(jObj,node.attrsMap);
|
|
8604
|
+
//add attrsMap as new children
|
|
8605
|
+
if(util.isEmptyObject(jObj)){
|
|
8606
|
+
return util.isExist(node.val)? node.val : "";
|
|
8607
|
+
}else {
|
|
8608
|
+
if(util.isExist(node.val)){
|
|
8609
|
+
if(!(typeof node.val === "string" && (node.val === "" || node.val === options.cdataPositionChar))){
|
|
8610
|
+
jObj[options.textNodeName] = node.val;
|
|
8611
|
+
}
|
|
8612
|
+
}
|
|
8613
|
+
}
|
|
8614
|
+
//add value
|
|
8615
|
+
return jObj;
|
|
8616
|
+
};
|
|
8617
|
+
|
|
8618
|
+
var parse$1 = xml2json;
|
|
8619
|
+
var getTraversalObj_1 = getTraversalObj;
|
|
8620
|
+
var convertToJson_1 = convertToJson;
|
|
8621
|
+
|
|
8622
|
+
var x2j = {
|
|
8623
|
+
parse: parse$1,
|
|
8624
|
+
getTraversalObj: getTraversalObj_1,
|
|
8625
|
+
convertToJson: convertToJson_1
|
|
8626
|
+
};
|
|
8627
|
+
|
|
8628
|
+
var parse = x2j.parse;
|
|
8629
|
+
|
|
8630
|
+
function parseMetadataXml(metadataXml) {
|
|
8631
|
+
var opts = {
|
|
8632
|
+
// options for fastXmlParser to read tag attrs
|
|
8633
|
+
ignoreAttributes: false,
|
|
8634
|
+
attributeNamePrefix: "@_",
|
|
8635
|
+
textNodeName: "#value",
|
|
8636
|
+
};
|
|
8637
|
+
return parse(metadataXml, opts);
|
|
8638
|
+
}
|
|
8639
|
+
/**
|
|
8640
|
+
* Fetch an [item's metadata](https://doc.arcgis.com/en/arcgis-online/manage-data/metadata.htm) from a portal
|
|
8641
|
+
* and parse and return it as JSON
|
|
8642
|
+
* @param id item id
|
|
8643
|
+
* @param requestOptions
|
|
8644
|
+
*/
|
|
8645
|
+
function fetchContentMetadata(id, requestOptions) {
|
|
8646
|
+
return getItemMetadata(id, requestOptions)
|
|
8647
|
+
.then(function (metadataXml) { return parseMetadataXml(metadataXml); })
|
|
8648
|
+
.catch(function () {
|
|
8649
|
+
// many items don't have metadata and the request will 404
|
|
8650
|
+
// in these cases we don't want to treat it as an error
|
|
8651
|
+
// content.metadata === null signals to consumers that
|
|
8652
|
+
// we attempted to fetch the metadata, but it doesn't exist
|
|
8653
|
+
// TODO: we should probably still throw the error if it's not a 404
|
|
8654
|
+
return null;
|
|
8655
|
+
});
|
|
8656
|
+
}
|
|
8657
|
+
var enrichGroupIds = function (input) {
|
|
8658
|
+
var data = input.data, stack = input.stack, requestOptions = input.requestOptions;
|
|
8659
|
+
var opId = stack.start("enrichGroupIds");
|
|
8660
|
+
return getItemGroups(data.item.id, requestOptions)
|
|
8661
|
+
.then(function (response) {
|
|
8662
|
+
var admin = response.admin, member = response.member, other = response.other;
|
|
8663
|
+
var groupIds = __spreadArrays(admin, member, other).map(function (group) { return group.id; });
|
|
8664
|
+
stack.finish(opId);
|
|
8665
|
+
return {
|
|
8666
|
+
data: __assign(__assign({}, data), { groupIds: groupIds }),
|
|
8667
|
+
stack: stack,
|
|
8668
|
+
requestOptions: requestOptions,
|
|
8669
|
+
};
|
|
8670
|
+
})
|
|
8671
|
+
.catch(function (error) { return handleEnrichmentError(error, input, opId); });
|
|
8672
|
+
};
|
|
8673
|
+
var enrichMetadata = function (input) {
|
|
8674
|
+
var data = input.data, stack = input.stack, requestOptions = input.requestOptions;
|
|
8675
|
+
var opId = stack.start("enrichMetadata");
|
|
8676
|
+
return fetchContentMetadata(data.item.id, requestOptions).then(function (metadata) {
|
|
8677
|
+
stack.finish(opId);
|
|
8678
|
+
return {
|
|
8679
|
+
data: __assign(__assign({}, data), { metadata: metadata }),
|
|
8680
|
+
stack: stack,
|
|
8681
|
+
requestOptions: requestOptions,
|
|
8682
|
+
};
|
|
8683
|
+
});
|
|
8684
|
+
// TODO: currently fetchContentMetadata will never throw, but
|
|
8685
|
+
// if we update it to throw for non-404 errors, need to uncomment this:
|
|
8686
|
+
// .catch((error) => handleEnrichmentError(error, input, opId));
|
|
8687
|
+
};
|
|
8688
|
+
var enrichOwnerUser = function (input) {
|
|
8689
|
+
var data = input.data, stack = input.stack, requestOptions = input.requestOptions;
|
|
8690
|
+
var opId = stack.start("enrichOwner");
|
|
8691
|
+
// w/o the : any here, I get a compile error about
|
|
8692
|
+
// .authentication being incompatible w/ UserSession
|
|
8693
|
+
var options = __assign({ username: data.item.owner }, requestOptions);
|
|
8694
|
+
return getUser(options)
|
|
8695
|
+
.then(function (ownerUser) {
|
|
8696
|
+
stack.finish(opId);
|
|
8697
|
+
return {
|
|
8698
|
+
data: __assign(__assign({}, data), { ownerUser: ownerUser }),
|
|
8699
|
+
stack: stack,
|
|
8700
|
+
requestOptions: requestOptions,
|
|
8701
|
+
};
|
|
8702
|
+
})
|
|
8703
|
+
.catch(function (error) { return handleEnrichmentError(error, input, opId); });
|
|
8704
|
+
};
|
|
8705
|
+
var enrichData = function (input) {
|
|
8706
|
+
var data = input.data, stack = input.stack, requestOptions = input.requestOptions;
|
|
8707
|
+
var opId = stack.start("enrichData");
|
|
8708
|
+
return getItemData(data.item.id, requestOptions)
|
|
8709
|
+
.then(function (itemData) {
|
|
8710
|
+
stack.finish(opId);
|
|
8711
|
+
return { data: __assign(__assign({}, data), { data: itemData }), stack: stack, requestOptions: requestOptions };
|
|
8712
|
+
})
|
|
8713
|
+
.catch(function (error) { return handleEnrichmentError(error, input, opId); });
|
|
8714
|
+
};
|
|
8715
|
+
var enrichServer = function (input) {
|
|
8716
|
+
var data = input.data, stack = input.stack, requestOptions = input.requestOptions;
|
|
8717
|
+
var opId = stack.start("enrichServer");
|
|
8718
|
+
var url = data.item.url;
|
|
8719
|
+
var options = __assign(__assign({}, requestOptions), { url: url });
|
|
8720
|
+
return getService(options)
|
|
8721
|
+
.then(function (server) {
|
|
8722
|
+
stack.finish(opId);
|
|
8723
|
+
return { data: __assign(__assign({}, data), { server: server }), stack: stack, requestOptions: requestOptions };
|
|
8724
|
+
})
|
|
8725
|
+
.catch(function (error) { return handleEnrichmentError(error, input, opId); });
|
|
8726
|
+
};
|
|
8727
|
+
var enrichLayers = function (input) {
|
|
8728
|
+
var data = input.data, stack = input.stack, requestOptions = input.requestOptions;
|
|
8729
|
+
var opId = stack.start("enrichLayers");
|
|
8730
|
+
var url = data.item.url;
|
|
8731
|
+
var options = __assign(__assign({}, requestOptions), { url: url });
|
|
8732
|
+
return (getAllLayersAndTables(options)
|
|
8733
|
+
// merge layers and tables into a single array
|
|
8734
|
+
// and filter out any group layers
|
|
8735
|
+
.then(function (response) {
|
|
8736
|
+
var merged = __spreadArrays(response.layers, response.tables);
|
|
8737
|
+
return merged.filter(function (layer) { return layer.type !== "Group Layer"; });
|
|
8738
|
+
})
|
|
8739
|
+
.then(function (layers) {
|
|
8740
|
+
stack.finish(opId);
|
|
8741
|
+
return { data: __assign(__assign({}, data), { layers: layers }), stack: stack, requestOptions: requestOptions };
|
|
8742
|
+
})
|
|
8743
|
+
.catch(function (error) { return handleEnrichmentError(error, input, opId); }));
|
|
8744
|
+
};
|
|
8745
|
+
// add the error to the content.errors,
|
|
8746
|
+
// log current stack operation as finished with an error
|
|
8747
|
+
// and return output that can be piped into the next operation
|
|
8748
|
+
var handleEnrichmentError = function (error, input, opId) {
|
|
8749
|
+
var data = input.data, stack = input.stack, requestOptions = input.requestOptions;
|
|
8750
|
+
stack.finish(opId, { error: error });
|
|
8751
|
+
var message = typeof error === "string"
|
|
8752
|
+
? /* istanbul ignore next our tests only throw Error objects */
|
|
8753
|
+
error
|
|
8754
|
+
: error.message;
|
|
8755
|
+
var errors = data.errors || [];
|
|
8756
|
+
errors.push({
|
|
8757
|
+
// NOTE: for now we just return the message and type "Other"
|
|
8758
|
+
// but we could later introspect for HTTP or AGO errors
|
|
8759
|
+
// and/or return the status code if available
|
|
8760
|
+
type: "Other",
|
|
8761
|
+
message: message,
|
|
8762
|
+
});
|
|
8763
|
+
return { data: __assign(__assign({}, data), { errors: errors }), stack: stack, requestOptions: requestOptions };
|
|
8764
|
+
};
|
|
8765
|
+
var enrichmentOperations = {
|
|
8766
|
+
groupIds: enrichGroupIds,
|
|
8767
|
+
metadata: enrichMetadata,
|
|
8768
|
+
ownerUser: enrichOwnerUser,
|
|
8769
|
+
// TOOD: org
|
|
8770
|
+
data: enrichData,
|
|
8771
|
+
server: enrichServer,
|
|
8772
|
+
layers: enrichLayers,
|
|
8773
|
+
};
|
|
8774
|
+
/**
|
|
8775
|
+
* Fetch enrichments for an item
|
|
8776
|
+
* @param item
|
|
8777
|
+
* @param enrichments the list of enrichments to fetch
|
|
8778
|
+
* @param requestOptions
|
|
8779
|
+
* @returns an object with the item and enrichments
|
|
8780
|
+
* @private
|
|
8781
|
+
*/
|
|
8782
|
+
var fetchItemEnrichments = function (item, enrichments, requestOptions) {
|
|
8783
|
+
// create a pipeline of enrichment operations
|
|
8784
|
+
var operations = enrichments.reduce(function (ops, enrichment) {
|
|
8785
|
+
var operation = enrichmentOperations[enrichment];
|
|
8786
|
+
// only include the enrichments that we know how to fetch
|
|
8787
|
+
operation && ops.push(operation);
|
|
8788
|
+
return ops;
|
|
8789
|
+
}, []);
|
|
8790
|
+
var pipeline = createOperationPipeline(operations);
|
|
8791
|
+
// execute pipeline and return the item and enrichments
|
|
8792
|
+
return pipeline({
|
|
8793
|
+
data: { item: item },
|
|
8794
|
+
stack: new OperationStack(),
|
|
8795
|
+
requestOptions: requestOptions,
|
|
8796
|
+
}).then(function (output) { return output.data; });
|
|
8797
|
+
};
|
|
8798
|
+
|
|
8799
|
+
/**
|
|
8800
|
+
* remote server error
|
|
8801
|
+
*/
|
|
8802
|
+
var RemoteServerError = /** @class */ (function (_super) {
|
|
8803
|
+
__extends(RemoteServerError, _super);
|
|
8804
|
+
function RemoteServerError(message, url, status) {
|
|
8805
|
+
var _this = _super.call(this, message) || this;
|
|
8806
|
+
_this.status = status;
|
|
8807
|
+
_this.url = url;
|
|
8808
|
+
return _this;
|
|
8809
|
+
}
|
|
8810
|
+
return RemoteServerError;
|
|
8811
|
+
}(Error));
|
|
8812
|
+
/**
|
|
8813
|
+
* ```js
|
|
8814
|
+
* import { hubApiRequest } from "@esri/hub-common";
|
|
8815
|
+
* //
|
|
8816
|
+
* hubApiRequest(
|
|
8817
|
+
* "/datasets",
|
|
8818
|
+
* requestOptions
|
|
8819
|
+
* })
|
|
8820
|
+
* .then(response);
|
|
8821
|
+
* ```
|
|
8822
|
+
* make a request to the Hub API
|
|
8823
|
+
* @param route API route
|
|
8824
|
+
* @param requestOptions request options
|
|
8825
|
+
*/
|
|
8826
|
+
function hubApiRequest(route, requestOptions) {
|
|
8827
|
+
// merge in default request options
|
|
8828
|
+
var options = __assign({
|
|
8829
|
+
// why do we default to GET w/ our API?
|
|
8830
|
+
httpMethod: "GET" }, requestOptions);
|
|
8831
|
+
// use fetch override if any
|
|
8832
|
+
var _fetch = options.fetch || fetch;
|
|
8833
|
+
// merge in default headers
|
|
8834
|
+
var headers = __assign({ "Content-Type": "application/json" }, options.headers);
|
|
8835
|
+
// build query params/body based on requestOptions.params
|
|
8836
|
+
var query;
|
|
8837
|
+
var body;
|
|
8838
|
+
if (options.httpMethod === "GET") {
|
|
8839
|
+
// pass params in query string
|
|
8840
|
+
query = options.params;
|
|
8841
|
+
}
|
|
8842
|
+
else {
|
|
8843
|
+
// pass params in request body
|
|
8844
|
+
body = JSON.stringify(options.params);
|
|
8845
|
+
}
|
|
8846
|
+
// build Hub API URL
|
|
8847
|
+
var url = buildUrl({
|
|
8848
|
+
host: getHubApiUrl(options),
|
|
8849
|
+
path: ("/api/v3/" + route).replace(/\/\//g, "/"),
|
|
8850
|
+
query: query,
|
|
8851
|
+
});
|
|
8852
|
+
return _fetch(url, {
|
|
8853
|
+
method: options.httpMethod,
|
|
8854
|
+
headers: headers,
|
|
8855
|
+
body: body,
|
|
8856
|
+
}).then(function (resp) {
|
|
8857
|
+
if (resp.ok) {
|
|
8858
|
+
return resp.json();
|
|
8859
|
+
}
|
|
8860
|
+
else {
|
|
8861
|
+
throw new RemoteServerError(resp.statusText, url, resp.status);
|
|
8862
|
+
}
|
|
8863
|
+
});
|
|
8864
|
+
}
|
|
8865
|
+
|
|
8866
|
+
// TODO: need to fetch data for client-side layer views as well
|
|
8867
|
+
// determine if we should fetch data for an item
|
|
8868
|
+
var shouldFetchData = function (item) {
|
|
8869
|
+
var type = normalizeItemType(item);
|
|
8870
|
+
var family = getFamily(type);
|
|
8871
|
+
var dataFamilies = ["template", "solution"];
|
|
8872
|
+
var dataTypes = ["Web Map", "Web Scene"];
|
|
8873
|
+
return includes(dataFamilies, family) || includes(dataTypes, type);
|
|
8874
|
+
};
|
|
8875
|
+
/**
|
|
8876
|
+
* get the default list of enrichments to fetch for content
|
|
8877
|
+
* @param item
|
|
8878
|
+
* @returns the default list of enrichments to fetch for content
|
|
8879
|
+
* @private
|
|
8880
|
+
*/
|
|
8881
|
+
var getContentEnrichments = function (item) {
|
|
8882
|
+
// we fetch these enrichments for all content types
|
|
8883
|
+
var enrichments = [
|
|
8884
|
+
"groupIds",
|
|
8885
|
+
"metadata",
|
|
8886
|
+
"ownerUser",
|
|
8887
|
+
"org",
|
|
8888
|
+
];
|
|
8889
|
+
// we only fetch data for certain content
|
|
8890
|
+
if (shouldFetchData(item)) {
|
|
8891
|
+
enrichments.push("data");
|
|
8892
|
+
}
|
|
8893
|
+
// we fetch server and layers for map and feature services
|
|
8894
|
+
return isMapOrFeatureServerUrl(item.url)
|
|
8895
|
+
? enrichments.concat("server", "layers")
|
|
8896
|
+
: enrichments;
|
|
8897
|
+
};
|
|
8898
|
+
// build up request options to only include the above enrichments
|
|
8899
|
+
// that we fetch from the Hub API, and to optionally filter by slug
|
|
8900
|
+
var getHubEnrichmentsOptions = function (requestOptions, slug) {
|
|
8901
|
+
var opts = cloneObject$1(requestOptions);
|
|
8902
|
+
opts.params = __assign(__assign({}, opts.params), { "fields[datasets]": "slug,boundary,extent,searchDescription,statistics" });
|
|
8903
|
+
if (slug) {
|
|
8904
|
+
opts.params["filter[slug]"] = slug;
|
|
8905
|
+
}
|
|
8906
|
+
return opts;
|
|
8907
|
+
};
|
|
8908
|
+
// extract the ids and enrichments from the Hub API response
|
|
8909
|
+
var getDatasetEnrichments = function (dataset) {
|
|
8910
|
+
var _a = parseDatasetId(dataset.id), itemId = _a.itemId, layerIdString = _a.layerId;
|
|
8911
|
+
var layerId = layerIdString && parseInt(layerIdString, 10);
|
|
8912
|
+
var _b = dataset.attributes, slug = _b.slug, boundary = _b.boundary, extent = _b.extent, searchDescription = _b.searchDescription, statistics = _b.statistics;
|
|
8913
|
+
return {
|
|
8914
|
+
itemId: itemId,
|
|
8915
|
+
layerId: layerId,
|
|
8916
|
+
slug: slug,
|
|
8917
|
+
boundary: boundary,
|
|
8918
|
+
extent: extent,
|
|
8919
|
+
searchDescription: searchDescription,
|
|
8920
|
+
statistics: statistics,
|
|
8921
|
+
};
|
|
8922
|
+
};
|
|
8923
|
+
/**
|
|
8924
|
+
* fetch enrichment from the Hub API by slug
|
|
8925
|
+
* @param slug
|
|
8926
|
+
* @param requestOptions
|
|
8927
|
+
* @returns enrichments from the Hub API (slug, boundary, statistic, etc)
|
|
8928
|
+
* @private
|
|
8929
|
+
*/
|
|
8930
|
+
var fetchHubEnrichmentsBySlug = function (slug, requestOptions) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8931
|
+
var response;
|
|
8932
|
+
return __generator(this, function (_a) {
|
|
8933
|
+
switch (_a.label) {
|
|
8934
|
+
case 0: return [4 /*yield*/, hubApiRequest("/datasets", getHubEnrichmentsOptions(requestOptions, slug))];
|
|
8935
|
+
case 1:
|
|
8936
|
+
response = _a.sent();
|
|
8937
|
+
return [2 /*return*/, getDatasetEnrichments(response.data[0])];
|
|
8938
|
+
}
|
|
8939
|
+
});
|
|
8940
|
+
}); };
|
|
8941
|
+
/**
|
|
8942
|
+
* fetch enrichment from the Hub API by id
|
|
8943
|
+
* @param slug
|
|
8944
|
+
* @param requestOptions
|
|
8945
|
+
* @returns enrichments from the Hub API (slug, boundary, statistic, etc)
|
|
8946
|
+
* @private
|
|
8947
|
+
*/
|
|
8948
|
+
var fetchHubEnrichmentsById = function (hubId, requestOptions) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8949
|
+
var response;
|
|
8950
|
+
return __generator(this, function (_a) {
|
|
8951
|
+
switch (_a.label) {
|
|
8952
|
+
case 0: return [4 /*yield*/, hubApiRequest("/datasets/" + hubId, getHubEnrichmentsOptions(requestOptions))];
|
|
8953
|
+
case 1:
|
|
8954
|
+
response = _a.sent();
|
|
8955
|
+
return [2 /*return*/, getDatasetEnrichments(response.data)];
|
|
8956
|
+
}
|
|
8957
|
+
});
|
|
8958
|
+
}); };
|
|
8959
|
+
|
|
8960
|
+
var maybeFetchLayerEnrichments = function (itemAndEnrichments, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8961
|
+
var item, data, layers, layer, layerEnrichments, _a;
|
|
8962
|
+
return __generator(this, function (_b) {
|
|
8963
|
+
switch (_b.label) {
|
|
8964
|
+
case 0:
|
|
8965
|
+
item = itemAndEnrichments.item, data = itemAndEnrichments.data, layers = itemAndEnrichments.layers;
|
|
8966
|
+
layer = layers && getItemLayer(item, layers, options && options.layerId);
|
|
8967
|
+
if (!(layer && isLayerView(layer) && !data)) return [3 /*break*/, 2];
|
|
8968
|
+
// to store (at least part of) it's view definition in item data
|
|
8969
|
+
// it seems that most do not, but until we have a reliable signal
|
|
8970
|
+
// we just fetch the item data for all layer views
|
|
8971
|
+
return [4 /*yield*/, fetchItemEnrichments(item, ["data"], options)];
|
|
8972
|
+
case 1:
|
|
8973
|
+
// to store (at least part of) it's view definition in item data
|
|
8974
|
+
// it seems that most do not, but until we have a reliable signal
|
|
8975
|
+
// we just fetch the item data for all layer views
|
|
8976
|
+
_a = _b.sent();
|
|
8977
|
+
return [3 /*break*/, 3];
|
|
8978
|
+
case 2:
|
|
8979
|
+
_a = undefined;
|
|
8980
|
+
_b.label = 3;
|
|
8981
|
+
case 3:
|
|
8982
|
+
layerEnrichments = _a;
|
|
8983
|
+
// TODO: merge errors
|
|
8984
|
+
return [2 /*return*/, __assign(__assign({}, itemAndEnrichments), layerEnrichments)];
|
|
8985
|
+
}
|
|
8986
|
+
});
|
|
8987
|
+
}); };
|
|
8988
|
+
var fetchItemAndEnrichments = function (itemId, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8989
|
+
var item, enrichmentsToFetch, enrichments;
|
|
8990
|
+
return __generator(this, function (_a) {
|
|
8991
|
+
switch (_a.label) {
|
|
8992
|
+
case 0: return [4 /*yield*/, getItem(itemId, options)];
|
|
8993
|
+
case 1:
|
|
8994
|
+
item = _a.sent();
|
|
8995
|
+
enrichmentsToFetch = (options === null || options === void 0 ? void 0 : options.enrichments) || getContentEnrichments(item);
|
|
8996
|
+
return [4 /*yield*/, fetchItemEnrichments(item, enrichmentsToFetch, options)];
|
|
8997
|
+
case 2:
|
|
8998
|
+
enrichments = _a.sent();
|
|
8999
|
+
return [2 /*return*/, maybeFetchLayerEnrichments(__assign(__assign({}, enrichments), { item: item }), options)];
|
|
9000
|
+
}
|
|
9001
|
+
});
|
|
9002
|
+
}); };
|
|
9003
|
+
var fetchContentById = function (hubId, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9004
|
+
var itemId, _a, item, itemEnrichments, specifiedLayerId, _b, slug, layerId, boundary, extent, searchDescription, statistics, _c;
|
|
9005
|
+
return __generator(this, function (_d) {
|
|
9006
|
+
switch (_d.label) {
|
|
9007
|
+
case 0:
|
|
9008
|
+
itemId = parseDatasetId(hubId).itemId;
|
|
9009
|
+
return [4 /*yield*/, fetchItemAndEnrichments(itemId, options)];
|
|
9010
|
+
case 1:
|
|
9011
|
+
_a = _d.sent(), item = _a.item, itemEnrichments = __rest(_a, ["item"]);
|
|
9012
|
+
specifiedLayerId = options && options.layerId;
|
|
9013
|
+
if (!canUseHubApiForItem(item, options)) return [3 /*break*/, 3];
|
|
9014
|
+
return [4 /*yield*/, fetchHubEnrichmentsById(hubId, options)];
|
|
9015
|
+
case 2:
|
|
9016
|
+
_c = _d.sent();
|
|
9017
|
+
return [3 /*break*/, 4];
|
|
9018
|
+
case 3:
|
|
9019
|
+
_c = {};
|
|
9020
|
+
_d.label = 4;
|
|
9021
|
+
case 4:
|
|
9022
|
+
_b = _c, slug = _b.slug, layerId = _b.layerId, boundary = _b.boundary, extent = _b.extent, searchDescription = _b.searchDescription, statistics = _b.statistics;
|
|
9023
|
+
// return a new content object composed from the item and enrichments we fetched
|
|
9024
|
+
return [2 /*return*/, composeContent(item, __assign(__assign({ requestOptions: options }, itemEnrichments), { slug: slug, layerId: isNil(specifiedLayerId) ? layerId : specifiedLayerId, boundary: boundary,
|
|
9025
|
+
extent: extent,
|
|
9026
|
+
searchDescription: searchDescription,
|
|
9027
|
+
statistics: statistics }))];
|
|
9028
|
+
}
|
|
9029
|
+
});
|
|
9030
|
+
}); };
|
|
9031
|
+
var fetchContentBySlug = function (fullyQualifiedSlug, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9032
|
+
var hubEnrichments, itemId, layerId, _a, item, itemEnrichments, specifiedLayerId, slug, boundary, extent, searchDescription, statistics;
|
|
9033
|
+
return __generator(this, function (_b) {
|
|
9034
|
+
switch (_b.label) {
|
|
9035
|
+
case 0: return [4 /*yield*/, fetchHubEnrichmentsBySlug(fullyQualifiedSlug, options)];
|
|
9036
|
+
case 1:
|
|
9037
|
+
hubEnrichments = _b.sent();
|
|
9038
|
+
itemId = hubEnrichments.itemId;
|
|
9039
|
+
layerId = hubEnrichments.layerId;
|
|
9040
|
+
return [4 /*yield*/, fetchItemAndEnrichments(itemId, options)];
|
|
9041
|
+
case 2:
|
|
9042
|
+
_a = _b.sent(), item = _a.item, itemEnrichments = __rest(_a, ["item"]);
|
|
9043
|
+
specifiedLayerId = options && options.layerId;
|
|
9044
|
+
if (!(!isNil(specifiedLayerId) && specifiedLayerId !== layerId)) return [3 /*break*/, 4];
|
|
9045
|
+
// we fetched Hub enrichments by slug for another dataset,
|
|
9046
|
+
// most likely for the parent service of this layer,
|
|
9047
|
+
// we need to fetch them for the specified layer instead
|
|
9048
|
+
layerId = specifiedLayerId;
|
|
9049
|
+
return [4 /*yield*/, fetchHubEnrichmentsById(itemId + "_" + layerId, options)];
|
|
9050
|
+
case 3:
|
|
9051
|
+
hubEnrichments = _b.sent();
|
|
9052
|
+
_b.label = 4;
|
|
9053
|
+
case 4:
|
|
9054
|
+
slug = hubEnrichments.slug, boundary = hubEnrichments.boundary, extent = hubEnrichments.extent, searchDescription = hubEnrichments.searchDescription, statistics = hubEnrichments.statistics;
|
|
9055
|
+
// return a new content object composed from the item and enrichments we fetched
|
|
9056
|
+
return [2 /*return*/, composeContent(item, __assign(__assign({ requestOptions: options }, itemEnrichments), { layerId: layerId,
|
|
9057
|
+
slug: slug,
|
|
9058
|
+
boundary: boundary,
|
|
9059
|
+
extent: extent,
|
|
9060
|
+
searchDescription: searchDescription,
|
|
9061
|
+
statistics: statistics }))];
|
|
9062
|
+
}
|
|
9063
|
+
});
|
|
9064
|
+
}); };
|
|
9065
|
+
var fetchContentRecordCount = function (content) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9066
|
+
var url, viewDefinition, where, response;
|
|
9067
|
+
return __generator(this, function (_a) {
|
|
9068
|
+
switch (_a.label) {
|
|
9069
|
+
case 0:
|
|
9070
|
+
url = content.url, viewDefinition = content.viewDefinition;
|
|
9071
|
+
where = viewDefinition === null || viewDefinition === void 0 ? void 0 : viewDefinition.definitionExpression;
|
|
9072
|
+
return [4 /*yield*/, queryFeatures({
|
|
9073
|
+
url: url,
|
|
9074
|
+
where: where,
|
|
9075
|
+
returnCountOnly: true,
|
|
9076
|
+
})];
|
|
9077
|
+
case 1:
|
|
9078
|
+
response = _a.sent();
|
|
9079
|
+
return [2 /*return*/, response.count];
|
|
9080
|
+
}
|
|
9081
|
+
});
|
|
9082
|
+
}); };
|
|
9083
|
+
/**
|
|
9084
|
+
* Fetch enriched content from the Portal and Hub APIs.
|
|
9085
|
+
* @param identifier content slug or id
|
|
9086
|
+
* @param options Request options with additional options to control how the content or enrichments are fetched
|
|
9087
|
+
* @returns A content object composed of the backing item and enrichments
|
|
9088
|
+
*
|
|
9089
|
+
* ```js
|
|
9090
|
+
* import { fetchContent } from '@esri/hub-common'
|
|
9091
|
+
* // fetch content by slug
|
|
9092
|
+
* const content = await fetchContent('my-org::item-name')
|
|
9093
|
+
* ```
|
|
9094
|
+
*/
|
|
9095
|
+
var fetchContent = function (identifier, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9096
|
+
var content, _a, isProxied, layer, _b, _c;
|
|
9097
|
+
return __generator(this, function (_d) {
|
|
9098
|
+
switch (_d.label) {
|
|
9099
|
+
case 0:
|
|
9100
|
+
if (!isSlug(identifier)) return [3 /*break*/, 2];
|
|
9101
|
+
return [4 /*yield*/, fetchContentBySlug(addContextToSlug(identifier, options === null || options === void 0 ? void 0 : options.siteOrgKey), options)];
|
|
9102
|
+
case 1:
|
|
9103
|
+
_a = _d.sent();
|
|
9104
|
+
return [3 /*break*/, 4];
|
|
9105
|
+
case 2: return [4 /*yield*/, fetchContentById(identifier, options)];
|
|
9106
|
+
case 3:
|
|
9107
|
+
_a = _d.sent();
|
|
9108
|
+
_d.label = 4;
|
|
9109
|
+
case 4:
|
|
9110
|
+
content = _a;
|
|
9111
|
+
isProxied = content.isProxied, layer = content.layer;
|
|
9112
|
+
_b = content;
|
|
9113
|
+
if (!(isProxied || !!layer)) return [3 /*break*/, 6];
|
|
9114
|
+
return [4 /*yield*/, fetchContentRecordCount(content)];
|
|
9115
|
+
case 5:
|
|
9116
|
+
_c = _d.sent();
|
|
9117
|
+
return [3 /*break*/, 7];
|
|
9118
|
+
case 6:
|
|
9119
|
+
_c = undefined;
|
|
9120
|
+
_d.label = 7;
|
|
9121
|
+
case 7:
|
|
9122
|
+
_b.recordCount = _c;
|
|
9123
|
+
return [2 /*return*/, content];
|
|
9124
|
+
}
|
|
9125
|
+
});
|
|
9126
|
+
}); };
|
|
9127
|
+
|
|
9128
|
+
// TODO: remove this at next breaking version
|
|
9129
|
+
/**
|
|
9130
|
+
* ```js
|
|
9131
|
+
* import { getCategory } from "@esri/hub-common";
|
|
9132
|
+
* //
|
|
9133
|
+
* getCategory('Feature Layer')
|
|
9134
|
+
* > 'dataset'
|
|
9135
|
+
* ```
|
|
9136
|
+
* **DEPRECATED: Use getCollection() instead**
|
|
9137
|
+
* returns the Hub category for a given item type
|
|
9138
|
+
* @param itemType The ArcGIS [item type](https://developers.arcgis.com/rest/users-groups-and-items/items-and-item-types.htm).
|
|
9139
|
+
* @returns the category of a given item type.
|
|
9140
|
+
*/
|
|
9141
|
+
function getCategory(itemType) {
|
|
9142
|
+
if (itemType === void 0) { itemType = ""; }
|
|
9143
|
+
/* tslint:disable no-console */
|
|
9144
|
+
console.warn("DEPRECATED: Use getCollection() instead. getCategory will be removed at v10.0.0");
|
|
9145
|
+
/* tslint:enable no-console */
|
|
9146
|
+
var collection = getCollection(itemType);
|
|
9147
|
+
// for backwards compatibility
|
|
9148
|
+
return collection === "feedback" ? "app" : collection;
|
|
9149
|
+
}
|
|
9150
|
+
/**
|
|
9151
|
+
* ```js
|
|
9152
|
+
* import { getTypes } from "@esri/hub-common";
|
|
9153
|
+
* //
|
|
9154
|
+
* getTypes('site')
|
|
9155
|
+
* > [ 'hub site application' ]
|
|
9156
|
+
* ```
|
|
9157
|
+
* To do.
|
|
9158
|
+
* @param category The ArcGIS Hub category.
|
|
9159
|
+
* @returns all the item types for the given category.
|
|
9160
|
+
*
|
|
9161
|
+
*/
|
|
9162
|
+
function getTypes(category) {
|
|
9163
|
+
if (category === void 0) { category = ""; }
|
|
9164
|
+
return categories[category.toLowerCase()];
|
|
9165
|
+
}
|
|
9166
|
+
/**
|
|
9167
|
+
* ```js
|
|
9168
|
+
* import { getTypeCategories } from "@esri/hub-common";
|
|
9169
|
+
* //
|
|
9170
|
+
* getTypeCategories(item)
|
|
9171
|
+
* > [ 'Hub Site Application' ]
|
|
9172
|
+
* ```
|
|
9173
|
+
* @param item Item object.
|
|
9174
|
+
* @returns typeCategory of the input item.
|
|
9175
|
+
*
|
|
9176
|
+
*/
|
|
9177
|
+
function getTypeCategories(item) {
|
|
9178
|
+
if (item === void 0) { item = {}; }
|
|
9179
|
+
var type = normalizeItemType(item);
|
|
9180
|
+
var category = getCategory(type);
|
|
9181
|
+
if (category) {
|
|
9182
|
+
// upper case first letter and return as element in array for backwards compatibility
|
|
9183
|
+
var chars = Array.from(category);
|
|
9184
|
+
chars[0] = chars[0].toUpperCase();
|
|
9185
|
+
return [chars.join("")];
|
|
9186
|
+
}
|
|
9187
|
+
else {
|
|
9188
|
+
return ["Other"];
|
|
9189
|
+
}
|
|
9190
|
+
}
|
|
9191
|
+
/**
|
|
9192
|
+
* ```js
|
|
9193
|
+
* import { getContentIdentifier } from "@esri/hub-common";
|
|
9194
|
+
* //
|
|
9195
|
+
* getContentIdentifier(content, site)
|
|
9196
|
+
* > 'f12hhjk32' // id
|
|
9197
|
+
* // OR
|
|
9198
|
+
* > 'content-slug' // human-readable slug
|
|
9199
|
+
* ```
|
|
9200
|
+
* Returns the preferred identifier for a piece of content (determined by content type):
|
|
9201
|
+
* - Content from the 'template' and 'feedback' families return the standard id field
|
|
9202
|
+
* - Pages that are linked to the site parameter will return the slug defined by the site. Otherwise, the page id will be returned
|
|
9203
|
+
* - All other content will return the highest available item in the following hierarchy:
|
|
9204
|
+
* 1. slug - includes org prefix if the site parameter is a portal or has an orgKey different from the slug prefix
|
|
9205
|
+
* 2. hubId
|
|
9206
|
+
* 3. id
|
|
9207
|
+
* @param content The IHubContent item
|
|
9208
|
+
* @param site The site to compare content against
|
|
9209
|
+
* @returns the preferred id for the given content.
|
|
9210
|
+
*/
|
|
9211
|
+
function getContentIdentifier(content, site) {
|
|
9212
|
+
// We don't currently support slugs for hub initiative templates, solutions or surveys
|
|
9213
|
+
if (includes(["template", "feedback"], content.family)) {
|
|
9214
|
+
return content.id;
|
|
9215
|
+
}
|
|
9216
|
+
// If it is a hub page linked to a site, return the page slug at the
|
|
9217
|
+
// site data instead. Because this one is the original one that was used
|
|
9218
|
+
// to create the page url (not mutable once created) and the slug (below)
|
|
9219
|
+
// generated by the hub-indexer could simply change with page name.
|
|
9220
|
+
if (isPageType(content.type)) {
|
|
9221
|
+
// check if the page is linked to the current site
|
|
9222
|
+
var pages = getProp(site, "data.values.pages") || [];
|
|
9223
|
+
// if so, return the page slug otherwise the page id
|
|
9224
|
+
var page = pages.find(function (p) { return p.id === content.id; });
|
|
9225
|
+
return page ? page.slug : content.id;
|
|
9226
|
+
}
|
|
9227
|
+
// If a slug is present, always return it
|
|
9228
|
+
if (content.slug) {
|
|
9229
|
+
var slug = void 0;
|
|
9230
|
+
var orgKey = getProp(site, "domainInfo.orgKey");
|
|
9231
|
+
// Use namespaced slug when on the umbrella site
|
|
9232
|
+
if (getProp(site, "data.values.isUmbrella")) {
|
|
9233
|
+
slug = content.slug;
|
|
9234
|
+
}
|
|
9235
|
+
else {
|
|
9236
|
+
// Use shortened slug if the slug's namespace is the same as the orgKey
|
|
9237
|
+
slug = removeContextFromSlug(content.slug, orgKey);
|
|
9238
|
+
}
|
|
9239
|
+
return slug;
|
|
9240
|
+
}
|
|
9241
|
+
return content.hubId || content.id;
|
|
9242
|
+
}
|
|
9243
|
+
/**
|
|
9244
|
+
* DEPRECATED: Use getFamily() instead.
|
|
9245
|
+
*
|
|
9246
|
+
* get the HubType for a given item or item type
|
|
9247
|
+
*
|
|
9248
|
+
* @param itemOrType an item or item.type
|
|
9249
|
+
*/
|
|
9250
|
+
function getItemHubType(itemOrType) {
|
|
9251
|
+
/* tslint:disable no-console */
|
|
9252
|
+
console.warn("DEPRECATED: Use getFamily() instead. getItemHubType() will be removed at v10.0.0");
|
|
9253
|
+
/* tslint:enable no-console */
|
|
9254
|
+
if (typeof itemOrType === "string") {
|
|
9255
|
+
itemOrType = { type: itemOrType };
|
|
9256
|
+
}
|
|
9257
|
+
var itemType = normalizeItemType(itemOrType);
|
|
9258
|
+
// TODO: not all categories are Hub types, may need to validate
|
|
9259
|
+
return getCollection(itemType);
|
|
9260
|
+
}
|
|
9261
|
+
/**
|
|
9262
|
+
* Convert a Portal item to Hub content
|
|
9263
|
+
*
|
|
9264
|
+
* @param item Portal Item
|
|
9265
|
+
* @returns Hub content
|
|
9266
|
+
* @export
|
|
9267
|
+
*/
|
|
9268
|
+
function itemToContent(item) {
|
|
9269
|
+
return composeContent(item);
|
|
9270
|
+
}
|
|
9271
|
+
/**
|
|
9272
|
+
* Convert a Hub API dataset resource to Hub Content
|
|
9273
|
+
*
|
|
9274
|
+
* @param {DatasetResource} Dataset resource
|
|
9275
|
+
* @returns {IHubContent} Hub content object
|
|
9276
|
+
* @export
|
|
9277
|
+
*/
|
|
9278
|
+
function datasetToContent(dataset) {
|
|
9279
|
+
// extract item from dataset, create content from the item
|
|
9280
|
+
var item = datasetToItem(dataset);
|
|
9281
|
+
// extract enrichments from attributes
|
|
9282
|
+
var _a = dataset.attributes,
|
|
9283
|
+
// item enrichments
|
|
9284
|
+
errors = _a.errors, boundary = _a.boundary, metadata = _a.metadata, slug = _a.slug, groupIds = _a.groupIds, orgId = _a.orgId, orgName = _a.orgName, organization = _a.organization, orgExtent = _a.orgExtent,
|
|
9285
|
+
// map and feature server enrichments
|
|
9286
|
+
server = _a.server, layers = _a.layers, layer = _a.layer, recordCount = _a.recordCount, statistics = _a.statistics,
|
|
9287
|
+
// additional attributes needed
|
|
9288
|
+
extent = _a.extent, searchDescription = _a.searchDescription;
|
|
9289
|
+
// get the layerId from the layer
|
|
9290
|
+
var layerId = layer && layer.id;
|
|
9291
|
+
// re-assemble the org as an enrichment
|
|
9292
|
+
var org = orgId && {
|
|
9293
|
+
id: orgId,
|
|
9294
|
+
name: orgName || organization,
|
|
9295
|
+
extent: orgExtent,
|
|
9296
|
+
};
|
|
9297
|
+
// compose a content out of the above
|
|
9298
|
+
return composeContent(item, {
|
|
9299
|
+
layerId: layerId,
|
|
9300
|
+
slug: slug,
|
|
9301
|
+
errors: errors,
|
|
9302
|
+
// setting this to null signals to enrichMetadata to skip this
|
|
9303
|
+
metadata: metadata || null,
|
|
9304
|
+
groupIds: groupIds,
|
|
9305
|
+
org: org,
|
|
9306
|
+
server: server,
|
|
9307
|
+
layers: layers,
|
|
9308
|
+
recordCount: recordCount,
|
|
9309
|
+
boundary: boundary,
|
|
9310
|
+
extent: extent,
|
|
9311
|
+
searchDescription: searchDescription,
|
|
9312
|
+
statistics: statistics,
|
|
9313
|
+
});
|
|
9314
|
+
}
|
|
9315
|
+
/**
|
|
9316
|
+
* Convert a Hub API dataset resource to a portal item
|
|
9317
|
+
*
|
|
9318
|
+
* @param {DatasetResource} Dataset resource
|
|
9319
|
+
* @returns {IItem} portal item
|
|
9320
|
+
* @export
|
|
9321
|
+
*/
|
|
9322
|
+
function datasetToItem(dataset) {
|
|
9323
|
+
if (!dataset) {
|
|
9324
|
+
return;
|
|
9325
|
+
}
|
|
9326
|
+
var id = dataset.id, attributes = dataset.attributes;
|
|
9327
|
+
if (!attributes) {
|
|
9328
|
+
return;
|
|
9329
|
+
}
|
|
9330
|
+
// parse item id
|
|
9331
|
+
var itemId = parseDatasetId(id).itemId;
|
|
9332
|
+
// read item properties from attributes
|
|
9333
|
+
// NOTE: we attempt to read all item properties
|
|
9334
|
+
// even though some may not be currently returned
|
|
9335
|
+
var
|
|
9336
|
+
// start w/ item properties from
|
|
9337
|
+
// https://developers.arcgis.com/rest/users-groups-and-items/item.htm
|
|
9338
|
+
owner = attributes.owner, orgId = attributes.orgId, created = attributes.created,
|
|
9339
|
+
// the Hub API returns item.modified in attributes.itemModified (below)
|
|
9340
|
+
modified = attributes.modified,
|
|
9341
|
+
// NOTE: we use attributes.name to store the title or the service/layer name
|
|
9342
|
+
// but in Portal name is only used for file types to store the file name (read only)
|
|
9343
|
+
name = attributes.name, title = attributes.title, type = attributes.type, typeKeywords = attributes.typeKeywords, description = attributes.description, snippet = attributes.snippet, tags = attributes.tags, thumbnail = attributes.thumbnail,
|
|
9344
|
+
// the Hub API returns item.extent in attributes.itemExtent (below)
|
|
9345
|
+
// extent,
|
|
9346
|
+
categories = attributes.categories, contentStatus = attributes.contentStatus,
|
|
9347
|
+
// the Hub API doesn't currently return spatialReference
|
|
9348
|
+
spatialReference = attributes.spatialReference,
|
|
9349
|
+
// the Hub API doesn't currently return accessInformation
|
|
9350
|
+
accessInformation = attributes.accessInformation, licenseInfo = attributes.licenseInfo, culture = attributes.culture, url = attributes.url, access = attributes.access,
|
|
9351
|
+
// the Hub API doesn't currently return proxyFilter
|
|
9352
|
+
proxyFilter = attributes.proxyFilter, properties = attributes.properties,
|
|
9353
|
+
// the Hub API doesn't currently return appCategories, industries,
|
|
9354
|
+
// languages, largeThumbnail, banner, screenshots, listed, ownerFolder
|
|
9355
|
+
appCategories = attributes.appCategories, industries = attributes.industries, languages = attributes.languages, largeThumbnail = attributes.largeThumbnail, banner = attributes.banner, screenshots = attributes.screenshots, listed = attributes.listed, ownerFolder = attributes.ownerFolder, size = attributes.size,
|
|
9356
|
+
// the Hub API doesn't currently return protected
|
|
9357
|
+
isProtected = attributes.protected, commentsEnabled = attributes.commentsEnabled,
|
|
9358
|
+
// the Hub API doesn't currently return numComments, numRatings,
|
|
9359
|
+
// avgRating, numViews, itemControl, scoreCompleteness
|
|
9360
|
+
numComments = attributes.numComments, numRatings = attributes.numRatings, avgRating = attributes.avgRating, numViews = attributes.numViews, itemControl = attributes.itemControl, scoreCompleteness = attributes.scoreCompleteness,
|
|
9361
|
+
// additional attributes we'll need
|
|
9362
|
+
// to derive the above values when missing
|
|
9363
|
+
itemExtent = attributes.itemExtent, itemModified = attributes.itemModified, modifiedProvenance = attributes.modifiedProvenance, serviceSpatialReference = attributes.serviceSpatialReference;
|
|
9364
|
+
// layer datasets will get their type from the layer
|
|
9365
|
+
// so we will need to derive the item type from the URL
|
|
9366
|
+
var serviceType = url && getServiceTypeFromUrl(url);
|
|
9367
|
+
// build and return an item from properties
|
|
9368
|
+
// NOTE: we currently do NOT provide default values
|
|
7644
9369
|
// (i.e. null for scalar attributes, [] for arrays, etc)
|
|
7645
9370
|
// for attributes that are not returned by the Hub API
|
|
7646
9371
|
// this helps distinguish an item that comes from the API
|
|
@@ -10262,73 +11987,6 @@
|
|
|
10262
11987
|
return HubProjectManager;
|
|
10263
11988
|
}());
|
|
10264
11989
|
|
|
10265
|
-
/**
|
|
10266
|
-
* remote server error
|
|
10267
|
-
*/
|
|
10268
|
-
var RemoteServerError = /** @class */ (function (_super) {
|
|
10269
|
-
__extends(RemoteServerError, _super);
|
|
10270
|
-
function RemoteServerError(message, url, status) {
|
|
10271
|
-
var _this = _super.call(this, message) || this;
|
|
10272
|
-
_this.status = status;
|
|
10273
|
-
_this.url = url;
|
|
10274
|
-
return _this;
|
|
10275
|
-
}
|
|
10276
|
-
return RemoteServerError;
|
|
10277
|
-
}(Error));
|
|
10278
|
-
/**
|
|
10279
|
-
* ```js
|
|
10280
|
-
* import { hubApiRequest } from "@esri/hub-common";
|
|
10281
|
-
* //
|
|
10282
|
-
* hubApiRequest(
|
|
10283
|
-
* "/datasets",
|
|
10284
|
-
* requestOptions
|
|
10285
|
-
* })
|
|
10286
|
-
* .then(response);
|
|
10287
|
-
* ```
|
|
10288
|
-
* make a request to the Hub API
|
|
10289
|
-
* @param route API route
|
|
10290
|
-
* @param requestOptions request options
|
|
10291
|
-
*/
|
|
10292
|
-
function hubApiRequest(route, requestOptions) {
|
|
10293
|
-
// merge in default request options
|
|
10294
|
-
var options = __assign({
|
|
10295
|
-
// why do we default to GET w/ our API?
|
|
10296
|
-
httpMethod: "GET" }, requestOptions);
|
|
10297
|
-
// use fetch override if any
|
|
10298
|
-
var _fetch = options.fetch || fetch;
|
|
10299
|
-
// merge in default headers
|
|
10300
|
-
var headers = __assign({ "Content-Type": "application/json" }, options.headers);
|
|
10301
|
-
// build query params/body based on requestOptions.params
|
|
10302
|
-
var query;
|
|
10303
|
-
var body;
|
|
10304
|
-
if (options.httpMethod === "GET") {
|
|
10305
|
-
// pass params in query string
|
|
10306
|
-
query = options.params;
|
|
10307
|
-
}
|
|
10308
|
-
else {
|
|
10309
|
-
// pass params in request body
|
|
10310
|
-
body = JSON.stringify(options.params);
|
|
10311
|
-
}
|
|
10312
|
-
// build Hub API URL
|
|
10313
|
-
var url = buildUrl({
|
|
10314
|
-
host: getHubApiUrl(options),
|
|
10315
|
-
path: ("/api/v3/" + route).replace(/\/\//g, "/"),
|
|
10316
|
-
query: query,
|
|
10317
|
-
});
|
|
10318
|
-
return _fetch(url, {
|
|
10319
|
-
method: options.httpMethod,
|
|
10320
|
-
headers: headers,
|
|
10321
|
-
body: body,
|
|
10322
|
-
}).then(function (resp) {
|
|
10323
|
-
if (resp.ok) {
|
|
10324
|
-
return resp.json();
|
|
10325
|
-
}
|
|
10326
|
-
else {
|
|
10327
|
-
throw new RemoteServerError(resp.statusText, url, resp.status);
|
|
10328
|
-
}
|
|
10329
|
-
});
|
|
10330
|
-
}
|
|
10331
|
-
|
|
10332
11990
|
/**
|
|
10333
11991
|
* Add a token to the resource request if the request is to the portal
|
|
10334
11992
|
* @param {string} url Resource Url
|
|
@@ -12586,475 +14244,216 @@
|
|
|
12586
14244
|
/**
|
|
12587
14245
|
* Gets the primary input Feature Service for the given
|
|
12588
14246
|
* Form ID. This will be the Fieldworker view, if it exists,
|
|
12589
|
-
* otherwise the source Feature Service.
|
|
12590
|
-
* @param {string} formId The Form ID
|
|
12591
|
-
* @param requestOptions The request options
|
|
12592
|
-
* @returns {Promise<IModel>}
|
|
12593
|
-
*/
|
|
12594
|
-
var getInputFeatureServiceModel = function (formId, requestOptions) {
|
|
12595
|
-
return getRelatedItems(__assign({ id: formId, relationshipType: "Survey2Service", direction: "forward" }, requestOptions)).then(function (_a) {
|
|
12596
|
-
var featureService = _a.relatedItems[0];
|
|
12597
|
-
var model;
|
|
12598
|
-
if (featureService) {
|
|
12599
|
-
model = { item: featureService };
|
|
12600
|
-
}
|
|
12601
|
-
return model;
|
|
12602
|
-
});
|
|
12603
|
-
};
|
|
12604
|
-
|
|
12605
|
-
/* Copyright (c) 2020 Environmental Systems Research Institute, Inc.
|
|
12606
|
-
* Apache-2.0 */
|
|
12607
|
-
/**
|
|
12608
|
-
* Fetches a Survey's source Feature Service from a given
|
|
12609
|
-
* Fieldworker View ID
|
|
12610
|
-
* @param {string} fieldworkerId The Fieldworker View ID
|
|
12611
|
-
* @param {IRequestOptions} requestOptions The request options
|
|
12612
|
-
* @returns {Promise<IModel>}
|
|
12613
|
-
*/
|
|
12614
|
-
var getSourceFeatureServiceModelFromFieldworker = function (fieldworkerId, requestOptions) {
|
|
12615
|
-
return getRelatedItems(__assign({ id: fieldworkerId, relationshipType: "Service2Data", direction: "forward" }, requestOptions)).then(function (_a) {
|
|
12616
|
-
var featureService = _a.relatedItems[0];
|
|
12617
|
-
var model;
|
|
12618
|
-
if (featureService) {
|
|
12619
|
-
model = { item: featureService };
|
|
12620
|
-
}
|
|
12621
|
-
return model;
|
|
12622
|
-
});
|
|
12623
|
-
};
|
|
12624
|
-
|
|
12625
|
-
/* Copyright (c) 2020 Environmental Systems Research Institute, Inc.
|
|
12626
|
-
* Apache-2.0 */
|
|
12627
|
-
/**
|
|
12628
|
-
* Fetches a Survey's Stakeholder View for a given
|
|
12629
|
-
* Form ID
|
|
12630
|
-
* @param {string} formId A Form ID
|
|
12631
|
-
* @param {IRequestOptions} requestOptions The request options
|
|
12632
|
-
* @returns {Promise<IModel>}
|
|
12633
|
-
*/
|
|
12634
|
-
var getStakeholderModel = function (formId, requestOptions) {
|
|
12635
|
-
return getRelatedItems(__assign({ id: formId, relationshipType: "Survey2Data", direction: "forward" }, requestOptions)).then(function (_a) {
|
|
12636
|
-
var stakeholderView = _a.relatedItems[0];
|
|
12637
|
-
var model;
|
|
12638
|
-
if (stakeholderView) {
|
|
12639
|
-
model = { item: stakeholderView };
|
|
12640
|
-
}
|
|
12641
|
-
return model;
|
|
12642
|
-
});
|
|
12643
|
-
};
|
|
12644
|
-
|
|
12645
|
-
/**
|
|
12646
|
-
* Determines if the provided Feature Service item is a
|
|
12647
|
-
* Fieldworker View
|
|
12648
|
-
* @param {IItem} featureServiceItem
|
|
12649
|
-
* @returns {boolean}
|
|
12650
|
-
*/
|
|
12651
|
-
function isFieldworkerView(featureServiceItem) {
|
|
12652
|
-
var hasTypekeyword = function (typeKeyword) {
|
|
12653
|
-
return featureServiceItem.typeKeywords.indexOf(typeKeyword) > -1;
|
|
12654
|
-
};
|
|
12655
|
-
// Survey123 only recently added the "FieldworkerView" typekeyword
|
|
12656
|
-
var isFieldworker = hasTypekeyword("FieldworkerView");
|
|
12657
|
-
// we should support previously created fieldworkers too
|
|
12658
|
-
if (!isFieldworker) {
|
|
12659
|
-
var hasExpectedTypeKeywords = [
|
|
12660
|
-
"Survey123",
|
|
12661
|
-
"Feature Service",
|
|
12662
|
-
"View Service",
|
|
12663
|
-
].every(hasTypekeyword);
|
|
12664
|
-
isFieldworker =
|
|
12665
|
-
hasExpectedTypeKeywords && !hasTypekeyword("StakeholderView");
|
|
12666
|
-
}
|
|
12667
|
-
return isFieldworker;
|
|
12668
|
-
}
|
|
12669
|
-
|
|
12670
|
-
/* Copyright (c) 2020 Environmental Systems Research Institute, Inc.
|
|
12671
|
-
* Apache-2.0 */
|
|
12672
|
-
/**
|
|
12673
|
-
* Builds a dictionary of Survey items for the given Form model
|
|
12674
|
-
* @param {string} formId The Form ID of the survey
|
|
12675
|
-
* @param {IRequestOptions} requestOptions The request options
|
|
12676
|
-
* @returns {Promise<IGetSurveyModelsResponse>}
|
|
12677
|
-
*/
|
|
12678
|
-
var getSurveyModels = function (formItemOrId, requestOptions) {
|
|
12679
|
-
var fieldworker;
|
|
12680
|
-
var stakeholder;
|
|
12681
|
-
var getForm = function () {
|
|
12682
|
-
return typeof formItemOrId === "string"
|
|
12683
|
-
? getItem(formItemOrId, requestOptions)
|
|
12684
|
-
: Promise.resolve(formItemOrId);
|
|
12685
|
-
};
|
|
12686
|
-
return getForm().then(function (form) {
|
|
12687
|
-
var promises = [
|
|
12688
|
-
// the primary input will be the fieldworker (if it exists), otherwise
|
|
12689
|
-
// the source feature service.
|
|
12690
|
-
getInputFeatureServiceModel(form.id, requestOptions),
|
|
12691
|
-
getStakeholderModel(form.id, requestOptions),
|
|
12692
|
-
];
|
|
12693
|
-
return Promise.all(promises)
|
|
12694
|
-
.then(function (_a) {
|
|
12695
|
-
var featureServiceOrFieldworkerModelResult = _a[0], stakeholderResult = _a[1];
|
|
12696
|
-
stakeholder = stakeholderResult;
|
|
12697
|
-
if (featureServiceOrFieldworkerModelResult &&
|
|
12698
|
-
isFieldworkerView(featureServiceOrFieldworkerModelResult.item)) {
|
|
12699
|
-
fieldworker = featureServiceOrFieldworkerModelResult;
|
|
12700
|
-
// if the primary input is the fieldworker, fetch
|
|
12701
|
-
// the source feature service
|
|
12702
|
-
return getSourceFeatureServiceModelFromFieldworker(fieldworker.item.id, requestOptions);
|
|
12703
|
-
}
|
|
12704
|
-
else {
|
|
12705
|
-
return featureServiceOrFieldworkerModelResult;
|
|
12706
|
-
}
|
|
12707
|
-
})
|
|
12708
|
-
.then(function (featureService) {
|
|
12709
|
-
return {
|
|
12710
|
-
form: { item: form },
|
|
12711
|
-
featureService: featureService,
|
|
12712
|
-
fieldworker: fieldworker,
|
|
12713
|
-
stakeholder: stakeholder,
|
|
12714
|
-
};
|
|
12715
|
-
});
|
|
14247
|
+
* otherwise the source Feature Service.
|
|
14248
|
+
* @param {string} formId The Form ID
|
|
14249
|
+
* @param requestOptions The request options
|
|
14250
|
+
* @returns {Promise<IModel>}
|
|
14251
|
+
*/
|
|
14252
|
+
var getInputFeatureServiceModel = function (formId, requestOptions) {
|
|
14253
|
+
return getRelatedItems(__assign({ id: formId, relationshipType: "Survey2Service", direction: "forward" }, requestOptions)).then(function (_a) {
|
|
14254
|
+
var featureService = _a.relatedItems[0];
|
|
14255
|
+
var model;
|
|
14256
|
+
if (featureService) {
|
|
14257
|
+
model = { item: featureService };
|
|
14258
|
+
}
|
|
14259
|
+
return model;
|
|
12716
14260
|
});
|
|
12717
14261
|
};
|
|
12718
14262
|
|
|
14263
|
+
/* Copyright (c) 2020 Environmental Systems Research Institute, Inc.
|
|
14264
|
+
* Apache-2.0 */
|
|
12719
14265
|
/**
|
|
12720
|
-
*
|
|
12721
|
-
*
|
|
12722
|
-
*
|
|
12723
|
-
*
|
|
12724
|
-
*
|
|
12725
|
-
* // create a Hub instance, authenticating as a specific user
|
|
12726
|
-
* // working against arcgis online
|
|
12727
|
-
* const myHub = await Hub.create({authOptions: {username: "casey", password: "jones"}});
|
|
12728
|
-
*
|
|
12729
|
-
* myHub.context.currentUser //=> {username: "casey", ...} as IUser
|
|
12730
|
-
*
|
|
12731
|
-
* const pavingProject = await myHub.projects.create({name: "12th Street Paving"});
|
|
12732
|
-
* pavingProject.summary = "This is the 2024 planned paving of 12th Street, between 8th and 11th Ave";
|
|
12733
|
-
* await myHub.projects.update(pavingProject);
|
|
12734
|
-
* ```
|
|
12735
|
-
*
|
|
12736
|
-
* This is a convenience class. Hub Managers can be created
|
|
12737
|
-
* directly, or the underlying functions can be imported an used
|
|
12738
|
-
* as need for scenarios where these class structures introduce
|
|
12739
|
-
* unwanted complexity
|
|
14266
|
+
* Fetches a Survey's source Feature Service from a given
|
|
14267
|
+
* Fieldworker View ID
|
|
14268
|
+
* @param {string} fieldworkerId The Fieldworker View ID
|
|
14269
|
+
* @param {IRequestOptions} requestOptions The request options
|
|
14270
|
+
* @returns {Promise<IModel>}
|
|
12740
14271
|
*/
|
|
12741
|
-
var
|
|
12742
|
-
|
|
12743
|
-
|
|
12744
|
-
|
|
12745
|
-
|
|
12746
|
-
|
|
12747
|
-
|
|
12748
|
-
|
|
12749
|
-
}
|
|
12750
|
-
/**
|
|
12751
|
-
* Factory function to construct a new Hub instance.
|
|
12752
|
-
* @param contextManager
|
|
12753
|
-
* @returns
|
|
12754
|
-
*/
|
|
12755
|
-
Hub.create = function (options) {
|
|
12756
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12757
|
-
var opts, mgr;
|
|
12758
|
-
return __generator(this, function (_a) {
|
|
12759
|
-
switch (_a.label) {
|
|
12760
|
-
case 0:
|
|
12761
|
-
if (!options.contextManager) return [3 /*break*/, 1];
|
|
12762
|
-
return [2 /*return*/, new Hub(options.contextManager)];
|
|
12763
|
-
case 1:
|
|
12764
|
-
opts = options.managerOptions || {};
|
|
12765
|
-
return [4 /*yield*/, ArcGISContextManager.create(opts)];
|
|
12766
|
-
case 2:
|
|
12767
|
-
mgr = _a.sent();
|
|
12768
|
-
return [2 /*return*/, new Hub(mgr)];
|
|
12769
|
-
}
|
|
12770
|
-
});
|
|
12771
|
-
});
|
|
12772
|
-
};
|
|
12773
|
-
Object.defineProperty(Hub.prototype, "context", {
|
|
12774
|
-
/**
|
|
12775
|
-
* Getter to abstract the context manager
|
|
12776
|
-
*/
|
|
12777
|
-
get: function () {
|
|
12778
|
-
return this._contextManager.context;
|
|
12779
|
-
},
|
|
12780
|
-
enumerable: false,
|
|
12781
|
-
configurable: true
|
|
12782
|
-
});
|
|
12783
|
-
Object.defineProperty(Hub.prototype, "projects", {
|
|
12784
|
-
/**
|
|
12785
|
-
* HubProjectManager for the current Hub
|
|
12786
|
-
* @returns
|
|
12787
|
-
*/
|
|
12788
|
-
get: function () {
|
|
12789
|
-
if (!this._projectManager) {
|
|
12790
|
-
this._projectManager = HubProjectManager.init(this._contextManager);
|
|
12791
|
-
}
|
|
12792
|
-
return this._projectManager;
|
|
12793
|
-
},
|
|
12794
|
-
enumerable: false,
|
|
12795
|
-
configurable: true
|
|
14272
|
+
var getSourceFeatureServiceModelFromFieldworker = function (fieldworkerId, requestOptions) {
|
|
14273
|
+
return getRelatedItems(__assign({ id: fieldworkerId, relationshipType: "Service2Data", direction: "forward" }, requestOptions)).then(function (_a) {
|
|
14274
|
+
var featureService = _a.relatedItems[0];
|
|
14275
|
+
var model;
|
|
14276
|
+
if (featureService) {
|
|
14277
|
+
model = { item: featureService };
|
|
14278
|
+
}
|
|
14279
|
+
return model;
|
|
12796
14280
|
});
|
|
12797
|
-
|
|
12798
|
-
}());
|
|
14281
|
+
};
|
|
12799
14282
|
|
|
12800
|
-
/* Copyright (c)
|
|
14283
|
+
/* Copyright (c) 2020 Environmental Systems Research Institute, Inc.
|
|
12801
14284
|
* Apache-2.0 */
|
|
12802
14285
|
/**
|
|
12803
|
-
*
|
|
12804
|
-
*
|
|
12805
|
-
*
|
|
12806
|
-
*
|
|
12807
|
-
*
|
|
12808
|
-
*
|
|
12809
|
-
* const stack = new OperationStack();
|
|
12810
|
-
*
|
|
12811
|
-
* // start an operation by type
|
|
12812
|
-
* const id = stack.start('getItem');
|
|
12813
|
-
* //.. work happens...
|
|
12814
|
-
* stack.finish(id);
|
|
12815
|
-
*
|
|
12816
|
-
* // start an operation with an Operation object
|
|
12817
|
-
* stack.start({
|
|
12818
|
-
* id: 'createItem_1',
|
|
12819
|
-
* type: 'createItem',
|
|
12820
|
-
* inputs: {
|
|
12821
|
-
* item: {...truncated...},
|
|
12822
|
-
* portal: 'https://www.arcgis.com',
|
|
12823
|
-
* username: 'jsmith'
|
|
12824
|
-
* },
|
|
12825
|
-
* });
|
|
12826
|
-
* // make the call
|
|
12827
|
-
* stack.finish('createItem_1', {newItemId: '00cf213'});
|
|
12828
|
-
*
|
|
12829
|
-
* // later you can get that information back out of the stack
|
|
12830
|
-
* const prevOp = stack.getOperation('createItem_1);
|
|
12831
|
-
*
|
|
12832
|
-
* // and if you need to roll back you can use the
|
|
12833
|
-
* // .cleanup and .output properties to help orchestrate
|
|
12834
|
-
*
|
|
12835
|
-
* ```
|
|
12836
|
-
*
|
|
12837
|
-
*
|
|
12838
|
-
* Can be used to implement "atomic" operations in an environment that does not
|
|
12839
|
-
* have this as a core feature
|
|
14286
|
+
* Fetches a Survey's Stakeholder View for a given
|
|
14287
|
+
* Form ID
|
|
14288
|
+
* @param {string} formId A Form ID
|
|
14289
|
+
* @param {IRequestOptions} requestOptions The request options
|
|
14290
|
+
* @returns {Promise<IModel>}
|
|
12840
14291
|
*/
|
|
12841
|
-
var
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
this.operations = [];
|
|
12848
|
-
}
|
|
12849
|
-
/**
|
|
12850
|
-
* Start an Operation
|
|
12851
|
-
*
|
|
12852
|
-
* ```js
|
|
12853
|
-
* const stack = new OperationStack();
|
|
12854
|
-
* stack.startOperation({
|
|
12855
|
-
* id: 'get-bc3',
|
|
12856
|
-
* type: 'getItem',
|
|
12857
|
-
* cleanup: 'n/a',
|
|
12858
|
-
* inputs: {
|
|
12859
|
-
* id: 'bc3',
|
|
12860
|
-
* owner: 'vader'
|
|
12861
|
-
* }
|
|
12862
|
-
* });
|
|
12863
|
-
* // do work
|
|
12864
|
-
* stack.finish('get-bc3');
|
|
12865
|
-
* ```
|
|
12866
|
-
*
|
|
12867
|
-
*
|
|
12868
|
-
* @param {IOperation} operation
|
|
12869
|
-
* @memberof OperationStack
|
|
12870
|
-
*/
|
|
12871
|
-
OperationStack.prototype.startOperation = function (operation) {
|
|
12872
|
-
var op = cloneObject$1(operation);
|
|
12873
|
-
op.startedAt = new Date().getTime();
|
|
12874
|
-
op.state = "working";
|
|
12875
|
-
this.operations.push(op);
|
|
12876
|
-
};
|
|
12877
|
-
/**
|
|
12878
|
-
* Start an operation without requiring a full operation
|
|
12879
|
-
*
|
|
12880
|
-
* ```js
|
|
12881
|
-
* const opId = stack.start('getItems');
|
|
12882
|
-
* //...work happens
|
|
12883
|
-
* stack.finish(opId);
|
|
12884
|
-
* ```
|
|
12885
|
-
*
|
|
12886
|
-
* @param {string} type Type of the operation. i.e. getItem
|
|
12887
|
-
* @param {Record<string, unknown>} [params] optionally pass in id, inputs, cleanup
|
|
12888
|
-
* @returns {string} Identifier of the new stack entry
|
|
12889
|
-
* @memberof OperationStack
|
|
12890
|
-
*/
|
|
12891
|
-
OperationStack.prototype.start = function (type, params) {
|
|
12892
|
-
var op = {
|
|
12893
|
-
type: type,
|
|
12894
|
-
id: getWithDefault$1(params, "id", createId(type + "_")),
|
|
12895
|
-
inputs: getWithDefault$1(params, "inputs", {}),
|
|
12896
|
-
cleanup: getWithDefault$1(params, "cleanup", "n/a"),
|
|
12897
|
-
startedAt: new Date().getTime(),
|
|
12898
|
-
state: "working"
|
|
12899
|
-
};
|
|
12900
|
-
this.operations.push(op);
|
|
12901
|
-
return op.id;
|
|
12902
|
-
};
|
|
12903
|
-
/**
|
|
12904
|
-
* Returns a reference to an Operation
|
|
12905
|
-
*
|
|
12906
|
-
* @param {string} id Unique Identifier
|
|
12907
|
-
* @returns {Operation}
|
|
12908
|
-
* @memberof OperationStack
|
|
12909
|
-
*/
|
|
12910
|
-
OperationStack.prototype.getOperation = function (id) {
|
|
12911
|
-
return this.operations.find(function (o) { return o.id === id; });
|
|
12912
|
-
};
|
|
12913
|
-
/**
|
|
12914
|
-
* Returns reference to the operations array
|
|
12915
|
-
*
|
|
12916
|
-
* @returns {Operation[]}
|
|
12917
|
-
* @memberof OperationStack
|
|
12918
|
-
*/
|
|
12919
|
-
OperationStack.prototype.getOperations = function () {
|
|
12920
|
-
return this.operations;
|
|
12921
|
-
};
|
|
12922
|
-
/**
|
|
12923
|
-
* Inform the stack that an operation has finished.
|
|
12924
|
-
*
|
|
12925
|
-
* This will append in a duration property, and mark
|
|
12926
|
-
* the state as 'completed'.
|
|
12927
|
-
*
|
|
12928
|
-
* @param {string} id Unique identifier of the Operation
|
|
12929
|
-
* @param {Record<string, unknown>} [options] outputs
|
|
12930
|
-
* @memberof OperationStack
|
|
12931
|
-
*/
|
|
12932
|
-
OperationStack.prototype.finish = function (id, options) {
|
|
12933
|
-
var op = this.getOperation(id);
|
|
12934
|
-
if (op) {
|
|
12935
|
-
op.duration = new Date().getTime() - op.startedAt;
|
|
12936
|
-
op.state = "completed";
|
|
12937
|
-
if (options) {
|
|
12938
|
-
op.output = cloneObject$1(options);
|
|
12939
|
-
}
|
|
12940
|
-
}
|
|
12941
|
-
else {
|
|
12942
|
-
throw new Error("No operation with id " + id + " present in stack");
|
|
14292
|
+
var getStakeholderModel = function (formId, requestOptions) {
|
|
14293
|
+
return getRelatedItems(__assign({ id: formId, relationshipType: "Survey2Data", direction: "forward" }, requestOptions)).then(function (_a) {
|
|
14294
|
+
var stakeholderView = _a.relatedItems[0];
|
|
14295
|
+
var model;
|
|
14296
|
+
if (stakeholderView) {
|
|
14297
|
+
model = { item: stakeholderView };
|
|
12943
14298
|
}
|
|
14299
|
+
return model;
|
|
14300
|
+
});
|
|
14301
|
+
};
|
|
14302
|
+
|
|
14303
|
+
/**
|
|
14304
|
+
* Determines if the provided Feature Service item is a
|
|
14305
|
+
* Fieldworker View
|
|
14306
|
+
* @param {IItem} featureServiceItem
|
|
14307
|
+
* @returns {boolean}
|
|
14308
|
+
*/
|
|
14309
|
+
function isFieldworkerView(featureServiceItem) {
|
|
14310
|
+
var hasTypekeyword = function (typeKeyword) {
|
|
14311
|
+
return featureServiceItem.typeKeywords.indexOf(typeKeyword) > -1;
|
|
12944
14312
|
};
|
|
12945
|
-
|
|
12946
|
-
|
|
12947
|
-
|
|
12948
|
-
|
|
12949
|
-
|
|
12950
|
-
|
|
12951
|
-
|
|
12952
|
-
|
|
12953
|
-
|
|
12954
|
-
|
|
12955
|
-
|
|
12956
|
-
|
|
12957
|
-
|
|
12958
|
-
|
|
12959
|
-
|
|
12960
|
-
|
|
12961
|
-
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
|
|
12967
|
-
|
|
12968
|
-
|
|
12969
|
-
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
|
|
12973
|
-
|
|
12974
|
-
|
|
12975
|
-
* // make calls to create item etc
|
|
12976
|
-
* otherStack.finish(id, {itemId: newItem.id});
|
|
12977
|
-
* otherStack.start('protectItem', {id: 'protect-00c'});
|
|
12978
|
-
* // make call to protect item...
|
|
12979
|
-
* otherStack.finish('protect-00c');
|
|
12980
|
-
* // all done... return a result with a stack
|
|
12981
|
-
* return Promise.resolve({
|
|
12982
|
-
* success:true,
|
|
12983
|
-
* stack: otherStack.serialize()
|
|
12984
|
-
* });
|
|
12985
|
-
* }
|
|
12986
|
-
* ```
|
|
12987
|
-
*
|
|
12988
|
-
* Typically used to create a comprehensive list of operations
|
|
12989
|
-
* when a function returns a `SerializedOperationStack` as part of
|
|
12990
|
-
* it's response
|
|
12991
|
-
*
|
|
12992
|
-
*
|
|
12993
|
-
* @param {ISerializedOperationStack} stack
|
|
12994
|
-
* @memberof OperationStack
|
|
12995
|
-
*/
|
|
12996
|
-
OperationStack.prototype.merge = function (stack) {
|
|
12997
|
-
this.operations = __spreadArrays(this.operations, stack.operations);
|
|
12998
|
-
};
|
|
12999
|
-
/**
|
|
13000
|
-
* Get a list of the completed operations
|
|
13001
|
-
*
|
|
13002
|
-
* @returns {IOperation[]}
|
|
13003
|
-
* @memberof OperationStack
|
|
13004
|
-
*/
|
|
13005
|
-
OperationStack.prototype.getCompleted = function () {
|
|
13006
|
-
return cloneObject$1(this.operations.filter(function (e) { return e.state === "completed"; }));
|
|
13007
|
-
};
|
|
13008
|
-
/**
|
|
13009
|
-
* Return an array of working operations
|
|
13010
|
-
*
|
|
13011
|
-
* @returns {IOperation[]}
|
|
13012
|
-
* @memberof OperationStack
|
|
13013
|
-
*/
|
|
13014
|
-
OperationStack.prototype.getWorking = function () {
|
|
13015
|
-
return cloneObject$1(this.operations.filter(function (e) { return e.state === "working"; }));
|
|
14313
|
+
// Survey123 only recently added the "FieldworkerView" typekeyword
|
|
14314
|
+
var isFieldworker = hasTypekeyword("FieldworkerView");
|
|
14315
|
+
// we should support previously created fieldworkers too
|
|
14316
|
+
if (!isFieldworker) {
|
|
14317
|
+
var hasExpectedTypeKeywords = [
|
|
14318
|
+
"Survey123",
|
|
14319
|
+
"Feature Service",
|
|
14320
|
+
"View Service",
|
|
14321
|
+
].every(hasTypekeyword);
|
|
14322
|
+
isFieldworker =
|
|
14323
|
+
hasExpectedTypeKeywords && !hasTypekeyword("StakeholderView");
|
|
14324
|
+
}
|
|
14325
|
+
return isFieldworker;
|
|
14326
|
+
}
|
|
14327
|
+
|
|
14328
|
+
/* Copyright (c) 2020 Environmental Systems Research Institute, Inc.
|
|
14329
|
+
* Apache-2.0 */
|
|
14330
|
+
/**
|
|
14331
|
+
* Builds a dictionary of Survey items for the given Form model
|
|
14332
|
+
* @param {string} formId The Form ID of the survey
|
|
14333
|
+
* @param {IRequestOptions} requestOptions The request options
|
|
14334
|
+
* @returns {Promise<IGetSurveyModelsResponse>}
|
|
14335
|
+
*/
|
|
14336
|
+
var getSurveyModels = function (formItemOrId, requestOptions) {
|
|
14337
|
+
var fieldworker;
|
|
14338
|
+
var stakeholder;
|
|
14339
|
+
var getForm = function () {
|
|
14340
|
+
return typeof formItemOrId === "string"
|
|
14341
|
+
? getItem(formItemOrId, requestOptions)
|
|
14342
|
+
: Promise.resolve(formItemOrId);
|
|
13016
14343
|
};
|
|
13017
|
-
|
|
13018
|
-
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
|
|
13023
|
-
|
|
13024
|
-
|
|
13025
|
-
|
|
13026
|
-
|
|
13027
|
-
|
|
13028
|
-
if (
|
|
13029
|
-
|
|
14344
|
+
return getForm().then(function (form) {
|
|
14345
|
+
var promises = [
|
|
14346
|
+
// the primary input will be the fieldworker (if it exists), otherwise
|
|
14347
|
+
// the source feature service.
|
|
14348
|
+
getInputFeatureServiceModel(form.id, requestOptions),
|
|
14349
|
+
getStakeholderModel(form.id, requestOptions),
|
|
14350
|
+
];
|
|
14351
|
+
return Promise.all(promises)
|
|
14352
|
+
.then(function (_a) {
|
|
14353
|
+
var featureServiceOrFieldworkerModelResult = _a[0], stakeholderResult = _a[1];
|
|
14354
|
+
stakeholder = stakeholderResult;
|
|
14355
|
+
if (featureServiceOrFieldworkerModelResult &&
|
|
14356
|
+
isFieldworkerView(featureServiceOrFieldworkerModelResult.item)) {
|
|
14357
|
+
fieldworker = featureServiceOrFieldworkerModelResult;
|
|
14358
|
+
// if the primary input is the fieldworker, fetch
|
|
14359
|
+
// the source feature service
|
|
14360
|
+
return getSourceFeatureServiceModelFromFieldworker(fieldworker.item.id, requestOptions);
|
|
13030
14361
|
}
|
|
13031
|
-
|
|
13032
|
-
return
|
|
14362
|
+
else {
|
|
14363
|
+
return featureServiceOrFieldworkerModelResult;
|
|
13033
14364
|
}
|
|
13034
|
-
|
|
14365
|
+
})
|
|
14366
|
+
.then(function (featureService) {
|
|
14367
|
+
return {
|
|
14368
|
+
form: { item: form },
|
|
14369
|
+
featureService: featureService,
|
|
14370
|
+
fieldworker: fieldworker,
|
|
14371
|
+
stakeholder: stakeholder,
|
|
14372
|
+
};
|
|
13035
14373
|
});
|
|
13036
|
-
|
|
13037
|
-
|
|
14374
|
+
});
|
|
14375
|
+
};
|
|
14376
|
+
|
|
14377
|
+
/**
|
|
14378
|
+
* Hub class can be used as an entry point to managing
|
|
14379
|
+
* content, teams, sites, projects etc, in an organization's Hub.
|
|
14380
|
+
*
|
|
14381
|
+
* ```js
|
|
14382
|
+
* import {Hub} from '@esri/hub-common';
|
|
14383
|
+
* // create a Hub instance, authenticating as a specific user
|
|
14384
|
+
* // working against arcgis online
|
|
14385
|
+
* const myHub = await Hub.create({authOptions: {username: "casey", password: "jones"}});
|
|
14386
|
+
*
|
|
14387
|
+
* myHub.context.currentUser //=> {username: "casey", ...} as IUser
|
|
14388
|
+
*
|
|
14389
|
+
* const pavingProject = await myHub.projects.create({name: "12th Street Paving"});
|
|
14390
|
+
* pavingProject.summary = "This is the 2024 planned paving of 12th Street, between 8th and 11th Ave";
|
|
14391
|
+
* await myHub.projects.update(pavingProject);
|
|
14392
|
+
* ```
|
|
14393
|
+
*
|
|
14394
|
+
* This is a convenience class. Hub Managers can be created
|
|
14395
|
+
* directly, or the underlying functions can be imported an used
|
|
14396
|
+
* as need for scenarios where these class structures introduce
|
|
14397
|
+
* unwanted complexity
|
|
14398
|
+
*/
|
|
14399
|
+
var Hub = /** @class */ (function () {
|
|
13038
14400
|
/**
|
|
13039
|
-
*
|
|
13040
|
-
*
|
|
13041
|
-
* @
|
|
13042
|
-
* @memberof OperationStack
|
|
14401
|
+
* Private so we can employ a factory function to do
|
|
14402
|
+
* async work during creation
|
|
14403
|
+
* @param contextManager
|
|
13043
14404
|
*/
|
|
13044
|
-
|
|
13045
|
-
|
|
13046
|
-
|
|
13047
|
-
|
|
14405
|
+
function Hub(contextManager) {
|
|
14406
|
+
this._contextManager = contextManager;
|
|
14407
|
+
}
|
|
14408
|
+
/**
|
|
14409
|
+
* Factory function to construct a new Hub instance.
|
|
14410
|
+
* @param contextManager
|
|
14411
|
+
* @returns
|
|
14412
|
+
*/
|
|
14413
|
+
Hub.create = function (options) {
|
|
14414
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
14415
|
+
var opts, mgr;
|
|
14416
|
+
return __generator(this, function (_a) {
|
|
14417
|
+
switch (_a.label) {
|
|
14418
|
+
case 0:
|
|
14419
|
+
if (!options.contextManager) return [3 /*break*/, 1];
|
|
14420
|
+
return [2 /*return*/, new Hub(options.contextManager)];
|
|
14421
|
+
case 1:
|
|
14422
|
+
opts = options.managerOptions || {};
|
|
14423
|
+
return [4 /*yield*/, ArcGISContextManager.create(opts)];
|
|
14424
|
+
case 2:
|
|
14425
|
+
mgr = _a.sent();
|
|
14426
|
+
return [2 /*return*/, new Hub(mgr)];
|
|
14427
|
+
}
|
|
14428
|
+
});
|
|
14429
|
+
});
|
|
13048
14430
|
};
|
|
13049
|
-
|
|
14431
|
+
Object.defineProperty(Hub.prototype, "context", {
|
|
14432
|
+
/**
|
|
14433
|
+
* Getter to abstract the context manager
|
|
14434
|
+
*/
|
|
14435
|
+
get: function () {
|
|
14436
|
+
return this._contextManager.context;
|
|
14437
|
+
},
|
|
14438
|
+
enumerable: false,
|
|
14439
|
+
configurable: true
|
|
14440
|
+
});
|
|
14441
|
+
Object.defineProperty(Hub.prototype, "projects", {
|
|
14442
|
+
/**
|
|
14443
|
+
* HubProjectManager for the current Hub
|
|
14444
|
+
* @returns
|
|
14445
|
+
*/
|
|
14446
|
+
get: function () {
|
|
14447
|
+
if (!this._projectManager) {
|
|
14448
|
+
this._projectManager = HubProjectManager.init(this._contextManager);
|
|
14449
|
+
}
|
|
14450
|
+
return this._projectManager;
|
|
14451
|
+
},
|
|
14452
|
+
enumerable: false,
|
|
14453
|
+
configurable: true
|
|
14454
|
+
});
|
|
14455
|
+
return Hub;
|
|
13050
14456
|
}());
|
|
13051
|
-
function getOperationMessage(op) {
|
|
13052
|
-
var msg = op.startedAt + " : Operation " + op.id + " started with inputs " + JSON.stringify(op.inputs) + " but was not completed";
|
|
13053
|
-
if (op.state === "completed") {
|
|
13054
|
-
msg = op.startedAt + " : Operation " + op.id + " took " + op.duration + " ms with inputs " + JSON.stringify(op.inputs) + " and output " + (op.output ? JSON.stringify(op.output) : "n/a");
|
|
13055
|
-
}
|
|
13056
|
-
return msg;
|
|
13057
|
-
}
|
|
13058
14457
|
|
|
13059
14458
|
/**
|
|
13060
14459
|
* Generic Hub Error with an Error stack as well
|
|
@@ -13213,6 +14612,7 @@
|
|
|
13213
14612
|
exports.fetchAllPages = fetchAllPages;
|
|
13214
14613
|
exports.fetchAndUploadResource = fetchAndUploadResource;
|
|
13215
14614
|
exports.fetchAndUploadThumbnail = fetchAndUploadThumbnail;
|
|
14615
|
+
exports.fetchContent = fetchContent;
|
|
13216
14616
|
exports.fetchHubTranslation = fetchHubTranslation;
|
|
13217
14617
|
exports.fetchImageAsBlob = fetchImageAsBlob;
|
|
13218
14618
|
exports.fetchModelFromItem = fetchModelFromItem;
|
|
@@ -13249,6 +14649,7 @@
|
|
|
13249
14649
|
exports.getItemHomeUrl = getItemHomeUrl;
|
|
13250
14650
|
exports.getItemHubId = getItemHubId;
|
|
13251
14651
|
exports.getItemHubType = getItemHubType;
|
|
14652
|
+
exports.getItemLayer = getItemLayer;
|
|
13252
14653
|
exports.getItemLayerId = getItemLayerId;
|
|
13253
14654
|
exports.getItemThumbnailUrl = getItemThumbnailUrl;
|
|
13254
14655
|
exports.getLayerIdFromUrl = getLayerIdFromUrl;
|
|
@@ -13297,6 +14698,7 @@
|
|
|
13297
14698
|
exports.isFeatureService = isFeatureService;
|
|
13298
14699
|
exports.isFieldworkerView = isFieldworkerView;
|
|
13299
14700
|
exports.isGuid = isGuid;
|
|
14701
|
+
exports.isLayerView = isLayerView;
|
|
13300
14702
|
exports.isMapOrFeatureServerUrl = isMapOrFeatureServerUrl;
|
|
13301
14703
|
exports.isNil = isNil;
|
|
13302
14704
|
exports.isSlug = isSlug;
|