@esri/hub-common 9.30.1 → 9.31.2
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/get-family.js +3 -1
- package/dist/es2017/content/get-family.js.map +1 -1
- package/dist/es2017/items/create-item-from-file.js +6 -5
- package/dist/es2017/items/create-item-from-file.js.map +1 -1
- package/dist/es2017/items/index.js +3 -0
- package/dist/es2017/items/index.js.map +1 -1
- package/dist/esm/content/get-family.js +3 -1
- package/dist/esm/content/get-family.js.map +1 -1
- package/dist/esm/items/create-item-from-file.js +5 -4
- package/dist/esm/items/create-item-from-file.js.map +1 -1
- package/dist/esm/items/index.js +3 -0
- package/dist/esm/items/index.js.map +1 -1
- package/dist/node/content/get-family.js +3 -1
- package/dist/node/content/get-family.js.map +1 -1
- package/dist/node/items/create-item-from-file.js +6 -5
- package/dist/node/items/create-item-from-file.js.map +1 -1
- package/dist/node/items/index.js +3 -0
- package/dist/node/items/index.js.map +1 -1
- package/dist/types/content/get-family.d.ts +1 -1
- package/dist/types/items/index.d.ts +3 -0
- package/dist/umd/common.umd.js +1890 -572
- package/dist/umd/common.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/umd/common.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/hub-common - v9.
|
|
2
|
+
* @esri/hub-common - v9.31.1 - Thu May 12 2022 18:43:36 GMT+0000 (Coordinated Universal Time)
|
|
3
3
|
* Copyright (c) 2022 Environmental Systems Research Institute, Inc.
|
|
4
4
|
* Apache-2.0
|
|
5
5
|
*/
|
|
@@ -3509,6 +3509,29 @@
|
|
|
3509
3509
|
var url = getItemBaseUrl(id, requestOptions) + "/groups";
|
|
3510
3510
|
return request(url, requestOptions);
|
|
3511
3511
|
}
|
|
3512
|
+
/**
|
|
3513
|
+
* ```js
|
|
3514
|
+
* import { getItemStatus } from "@esri/arcgis-rest-portal";
|
|
3515
|
+
* //
|
|
3516
|
+
* getItemStatus({
|
|
3517
|
+
* id: "30e5fe3149c34df1ba922e6f5bbf808f",
|
|
3518
|
+
* authentication
|
|
3519
|
+
* })
|
|
3520
|
+
* .then(response)
|
|
3521
|
+
* ```
|
|
3522
|
+
* Inquire about status when publishing an item, adding an item in async mode, or adding with a multipart upload. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/status.htm) for more information.
|
|
3523
|
+
*
|
|
3524
|
+
* @param id - The Id of the item to get status for.
|
|
3525
|
+
* @param requestOptions - Options for the request
|
|
3526
|
+
* @returns A Promise to get the item status.
|
|
3527
|
+
*/
|
|
3528
|
+
function getItemStatus(requestOptions) {
|
|
3529
|
+
return determineOwner(requestOptions).then(function (owner) {
|
|
3530
|
+
var url = getPortalUrl$1(requestOptions) + "/content/users/" + owner + "/items/" + requestOptions.id + "/status";
|
|
3531
|
+
var options = appendCustomParams(requestOptions, ["jobId", "jobType"], { params: __assign({}, requestOptions.params) });
|
|
3532
|
+
return request(url, options);
|
|
3533
|
+
});
|
|
3534
|
+
}
|
|
3512
3535
|
/**
|
|
3513
3536
|
* ```
|
|
3514
3537
|
* import { getItemInfo } from "@esri/arcgis-rest-portal";
|
|
@@ -3611,6 +3634,27 @@
|
|
|
3611
3634
|
|
|
3612
3635
|
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
|
|
3613
3636
|
* Apache-2.0 */
|
|
3637
|
+
function getSharingUrl(requestOptions) {
|
|
3638
|
+
var username = requestOptions.authentication.username;
|
|
3639
|
+
var owner = requestOptions.owner || username;
|
|
3640
|
+
return getPortalUrl$1(requestOptions) + "/content/users/" + encodeURIComponent(owner) + "/items/" + requestOptions.id + "/share";
|
|
3641
|
+
}
|
|
3642
|
+
function isItemOwner(requestOptions) {
|
|
3643
|
+
var username = requestOptions.authentication.username;
|
|
3644
|
+
var owner = requestOptions.owner || username;
|
|
3645
|
+
return owner === username;
|
|
3646
|
+
}
|
|
3647
|
+
/**
|
|
3648
|
+
* Check it the user is a full org_admin
|
|
3649
|
+
* @param requestOptions
|
|
3650
|
+
* @returns Promise resolving in a boolean indicating if the user is an ArcGIS Organization administrator
|
|
3651
|
+
*/
|
|
3652
|
+
function isOrgAdmin(requestOptions) {
|
|
3653
|
+
var session = requestOptions.authentication;
|
|
3654
|
+
return session.getUser(requestOptions).then(function (user) {
|
|
3655
|
+
return user && user.role === "org_admin" && !user.roleId;
|
|
3656
|
+
});
|
|
3657
|
+
}
|
|
3614
3658
|
/**
|
|
3615
3659
|
* Get the User Membership for a particular group. Use this if all you have is the groupId.
|
|
3616
3660
|
* If you have the group object, check the `userMembership.memberType` property instead of calling this method.
|
|
@@ -4105,6 +4149,83 @@
|
|
|
4105
4149
|
return genericSearch(search, "item");
|
|
4106
4150
|
}
|
|
4107
4151
|
|
|
4152
|
+
/* Copyright (c) 2017-2019 Environmental Systems Research Institute, Inc.
|
|
4153
|
+
* Apache-2.0 */
|
|
4154
|
+
/**
|
|
4155
|
+
* ```js
|
|
4156
|
+
* import { addItemPart } from "@esri/arcgis-rest-portal";
|
|
4157
|
+
* //
|
|
4158
|
+
* addItemPart({
|
|
4159
|
+
* id: "30e5fe3149c34df1ba922e6f5bbf808f",
|
|
4160
|
+
* file: data,
|
|
4161
|
+
* partNum: 1,
|
|
4162
|
+
* authentication
|
|
4163
|
+
* })
|
|
4164
|
+
* .then(response)
|
|
4165
|
+
* ```
|
|
4166
|
+
* Add Item Part allows the caller to upload a file part when doing an add or update item operation in multipart mode. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/add-item-part.htm) for more information.
|
|
4167
|
+
*
|
|
4168
|
+
* @param requestOptions - Options for the request
|
|
4169
|
+
* @returns A Promise to add the item part status.
|
|
4170
|
+
*/
|
|
4171
|
+
function addItemPart(requestOptions) {
|
|
4172
|
+
var partNum = requestOptions.partNum;
|
|
4173
|
+
if (!Number.isInteger(partNum) || partNum < 1 || partNum > 10000) {
|
|
4174
|
+
return Promise.reject(new Error('The part number must be an integer between 1 to 10000, inclusive.'));
|
|
4175
|
+
}
|
|
4176
|
+
return determineOwner(requestOptions).then(function (owner) {
|
|
4177
|
+
// AGO adds the "partNum" parameter in the query string, not in the body
|
|
4178
|
+
var url = getPortalUrl$1(requestOptions) + "/content/users/" + owner + "/items/" + requestOptions.id + "/addPart?partNum=" + partNum;
|
|
4179
|
+
var options = appendCustomParams(requestOptions, ["file"], { params: __assign({}, requestOptions.params) });
|
|
4180
|
+
return request(url, options);
|
|
4181
|
+
});
|
|
4182
|
+
}
|
|
4183
|
+
/**
|
|
4184
|
+
* ```js
|
|
4185
|
+
* import { commitItemUpload } from "@esri/arcgis-rest-portal";
|
|
4186
|
+
* //
|
|
4187
|
+
* commitItemUpload({
|
|
4188
|
+
* id: "30e5fe3149c34df1ba922e6f5bbf808f",
|
|
4189
|
+
* authentication
|
|
4190
|
+
* })
|
|
4191
|
+
* .then(response)
|
|
4192
|
+
* ```
|
|
4193
|
+
* Commit is called once all parts are uploaded during a multipart Add Item or Update Item operation. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/commit.htm) for more information.
|
|
4194
|
+
*
|
|
4195
|
+
* @param requestOptions - Options for the request
|
|
4196
|
+
* @returns A Promise to get the commit result.
|
|
4197
|
+
*/
|
|
4198
|
+
function commitItemUpload(requestOptions) {
|
|
4199
|
+
return determineOwner(requestOptions).then(function (owner) {
|
|
4200
|
+
var url = getPortalUrl$1(requestOptions) + "/content/users/" + owner + "/items/" + requestOptions.id + "/commit";
|
|
4201
|
+
var options = appendCustomParams(requestOptions, [], {
|
|
4202
|
+
params: __assign(__assign({}, requestOptions.params), serializeItem(requestOptions.item))
|
|
4203
|
+
});
|
|
4204
|
+
return request(url, options);
|
|
4205
|
+
});
|
|
4206
|
+
}
|
|
4207
|
+
/**
|
|
4208
|
+
* ```js
|
|
4209
|
+
* import { cancelItemUpload } from "@esri/arcgis-rest-portal";
|
|
4210
|
+
* //
|
|
4211
|
+
* cancelItemUpload({
|
|
4212
|
+
* id: "30e5fe3149c34df1ba922e6f5bbf808f",
|
|
4213
|
+
* authentication
|
|
4214
|
+
* })
|
|
4215
|
+
* .then(response)
|
|
4216
|
+
* ```
|
|
4217
|
+
* Cancels a multipart upload on an item. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/cancel.htm) for more information.
|
|
4218
|
+
*
|
|
4219
|
+
* @param requestOptions - Options for the request
|
|
4220
|
+
* @returns A Promise to get the commit result.
|
|
4221
|
+
*/
|
|
4222
|
+
function cancelItemUpload(requestOptions) {
|
|
4223
|
+
return determineOwner(requestOptions).then(function (owner) {
|
|
4224
|
+
var url = getPortalUrl$1(requestOptions) + "/content/users/" + owner + "/items/" + requestOptions.id + "/cancel";
|
|
4225
|
+
return request(url, requestOptions);
|
|
4226
|
+
});
|
|
4227
|
+
}
|
|
4228
|
+
|
|
4108
4229
|
/* Copyright (c) 2019 Environmental Systems Research Institute, Inc.
|
|
4109
4230
|
* Apache-2.0 */
|
|
4110
4231
|
function chunk(array, size) {
|
|
@@ -4520,6 +4641,61 @@
|
|
|
4520
4641
|
return genericSearch(search, "user");
|
|
4521
4642
|
}
|
|
4522
4643
|
|
|
4644
|
+
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
|
|
4645
|
+
* Apache-2.0 */
|
|
4646
|
+
/**
|
|
4647
|
+
* ```js
|
|
4648
|
+
* import { setItemAccess } from "@esri/arcgis-rest-portal";
|
|
4649
|
+
* //
|
|
4650
|
+
* setItemAccess({
|
|
4651
|
+
* id: "abc123",
|
|
4652
|
+
* access: "public", // 'org' || 'private'
|
|
4653
|
+
* authentication: session
|
|
4654
|
+
* })
|
|
4655
|
+
* ```
|
|
4656
|
+
* Change who is able to access an item.
|
|
4657
|
+
*
|
|
4658
|
+
* @param requestOptions - Options for the request.
|
|
4659
|
+
* @returns A Promise that will resolve with the data from the response.
|
|
4660
|
+
*/
|
|
4661
|
+
function setItemAccess(requestOptions) {
|
|
4662
|
+
var url = getSharingUrl(requestOptions);
|
|
4663
|
+
if (isItemOwner(requestOptions)) {
|
|
4664
|
+
// if the user owns the item, proceed
|
|
4665
|
+
return updateItemAccess(url, requestOptions);
|
|
4666
|
+
}
|
|
4667
|
+
else {
|
|
4668
|
+
// otherwise we need to check to see if they are an organization admin
|
|
4669
|
+
return isOrgAdmin(requestOptions).then(function (admin) {
|
|
4670
|
+
if (admin) {
|
|
4671
|
+
return updateItemAccess(url, requestOptions);
|
|
4672
|
+
}
|
|
4673
|
+
else {
|
|
4674
|
+
// if neither, updating the sharing isnt possible
|
|
4675
|
+
throw Error("This item can not be shared by " + requestOptions.authentication.username + ". They are neither the item owner nor an organization admin.");
|
|
4676
|
+
}
|
|
4677
|
+
});
|
|
4678
|
+
}
|
|
4679
|
+
}
|
|
4680
|
+
function updateItemAccess(url, requestOptions) {
|
|
4681
|
+
requestOptions.params = __assign({ org: false, everyone: false }, requestOptions.params);
|
|
4682
|
+
// if the user wants to make the item private, it needs to be unshared from any/all groups as well
|
|
4683
|
+
if (requestOptions.access === "private") {
|
|
4684
|
+
requestOptions.params.groups = " ";
|
|
4685
|
+
}
|
|
4686
|
+
if (requestOptions.access === "org") {
|
|
4687
|
+
requestOptions.params.org = true;
|
|
4688
|
+
}
|
|
4689
|
+
// if sharing with everyone, share with the entire organization as well.
|
|
4690
|
+
if (requestOptions.access === "public") {
|
|
4691
|
+
// this is how the ArcGIS Online Home app sets public access
|
|
4692
|
+
// setting org = true instead of account = true will cancel out all sharing
|
|
4693
|
+
requestOptions.params.account = true;
|
|
4694
|
+
requestOptions.params.everyone = true;
|
|
4695
|
+
}
|
|
4696
|
+
return request(url, requestOptions);
|
|
4697
|
+
}
|
|
4698
|
+
|
|
4523
4699
|
/**
|
|
4524
4700
|
* ```js
|
|
4525
4701
|
* import { isItemSharedWithGroup } from "@esri/arcgis-rest-portal";
|
|
@@ -6371,7 +6547,9 @@
|
|
|
6371
6547
|
var family;
|
|
6372
6548
|
// override default behavior for the rows that are highlighted in yellow here:
|
|
6373
6549
|
// https://esriis.sharepoint.com/:x:/r/sites/ArcGISHub/_layouts/15/Doc.aspx?sourcedoc=%7BADA1C9DC-4F6C-4DE4-92C6-693EF9571CFA%7D&file=Hub%20Routes.xlsx&nav=MTBfe0VENEREQzI4LUZFMDctNEI0Ri04NjcyLThCQUE2MTA0MEZGRn1fezIwMTIwMEJFLTA4MEQtNEExRC05QzA4LTE5MTAzOUQwMEE1RH0&action=default&mobileredirect=true&cid=df1c874b-c367-4cea-bc13-7bebfad3f2ac
|
|
6374
|
-
|
|
6550
|
+
// DEPRECATED: we should make type a required parameter
|
|
6551
|
+
// and just do type.toLowerCase() at the next breaking change
|
|
6552
|
+
switch ((type || "").toLowerCase()) {
|
|
6375
6553
|
case "image service":
|
|
6376
6554
|
family = "dataset";
|
|
6377
6555
|
break;
|
|
@@ -8046,8 +8224,6 @@
|
|
|
8046
8224
|
return msg;
|
|
8047
8225
|
}
|
|
8048
8226
|
|
|
8049
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
8050
|
-
|
|
8051
8227
|
function createCommonjsModule(fn, basedir, module) {
|
|
8052
8228
|
return module = {
|
|
8053
8229
|
path: basedir,
|
|
@@ -8063,52 +8239,56 @@
|
|
|
8063
8239
|
}
|
|
8064
8240
|
|
|
8065
8241
|
var util = createCommonjsModule(function (module, exports) {
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8242
|
+
|
|
8243
|
+
const nameStartChar = ':A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
|
|
8244
|
+
const nameChar = nameStartChar + '\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
|
|
8245
|
+
const nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*';
|
|
8246
|
+
const regexName = new RegExp('^' + nameRegexp + '$');
|
|
8247
|
+
|
|
8248
|
+
const getAllMatches = function(string, regex) {
|
|
8249
|
+
const matches = [];
|
|
8250
|
+
let match = regex.exec(string);
|
|
8069
8251
|
while (match) {
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8252
|
+
const allmatches = [];
|
|
8253
|
+
allmatches.startIndex = regex.lastIndex - match[0].length;
|
|
8254
|
+
const len = match.length;
|
|
8255
|
+
for (let index = 0; index < len; index++) {
|
|
8256
|
+
allmatches.push(match[index]);
|
|
8257
|
+
}
|
|
8075
8258
|
matches.push(allmatches);
|
|
8076
8259
|
match = regex.exec(string);
|
|
8077
8260
|
}
|
|
8078
8261
|
return matches;
|
|
8079
8262
|
};
|
|
8080
8263
|
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
if(match === null || typeof match === "undefined") return false;
|
|
8085
|
-
else return true;
|
|
8086
|
-
};
|
|
8087
|
-
|
|
8088
|
-
var doesNotMatch = function(string,regex){
|
|
8089
|
-
return !doesMatch(string,regex);
|
|
8264
|
+
const isName = function(string) {
|
|
8265
|
+
const match = regexName.exec(string);
|
|
8266
|
+
return !(match === null || typeof match === 'undefined');
|
|
8090
8267
|
};
|
|
8091
8268
|
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
return typeof v !== "undefined";
|
|
8269
|
+
exports.isExist = function(v) {
|
|
8270
|
+
return typeof v !== 'undefined';
|
|
8095
8271
|
};
|
|
8096
8272
|
|
|
8097
|
-
exports.isEmptyObject= function(obj) {
|
|
8098
|
-
return Object.keys(obj).length === 0
|
|
8273
|
+
exports.isEmptyObject = function(obj) {
|
|
8274
|
+
return Object.keys(obj).length === 0;
|
|
8099
8275
|
};
|
|
8100
8276
|
|
|
8101
8277
|
/**
|
|
8102
8278
|
* Copy all the properties of a into b.
|
|
8103
8279
|
* @param {*} target
|
|
8104
|
-
* @param {*} a
|
|
8105
|
-
*/
|
|
8106
|
-
exports.merge =function
|
|
8107
|
-
if(a){
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
for(
|
|
8111
|
-
|
|
8280
|
+
* @param {*} a
|
|
8281
|
+
*/
|
|
8282
|
+
exports.merge = function(target, a, arrayMode) {
|
|
8283
|
+
if (a) {
|
|
8284
|
+
const keys = Object.keys(a); // will return an array of own properties
|
|
8285
|
+
const len = keys.length; //don't make it inline
|
|
8286
|
+
for (let i = 0; i < len; i++) {
|
|
8287
|
+
if (arrayMode === 'strict') {
|
|
8288
|
+
target[keys[i]] = [ a[keys[i]] ];
|
|
8289
|
+
} else {
|
|
8290
|
+
target[keys[i]] = a[keys[i]];
|
|
8291
|
+
}
|
|
8112
8292
|
}
|
|
8113
8293
|
}
|
|
8114
8294
|
};
|
|
@@ -8116,597 +8296,1520 @@
|
|
|
8116
8296
|
return Object.assign(b,a);
|
|
8117
8297
|
} */
|
|
8118
8298
|
|
|
8119
|
-
exports.getValue = function
|
|
8120
|
-
if(exports.isExist(v)){
|
|
8121
|
-
|
|
8122
|
-
}else {
|
|
8123
|
-
|
|
8299
|
+
exports.getValue = function(v) {
|
|
8300
|
+
if (exports.isExist(v)) {
|
|
8301
|
+
return v;
|
|
8302
|
+
} else {
|
|
8303
|
+
return '';
|
|
8304
|
+
}
|
|
8305
|
+
};
|
|
8306
|
+
|
|
8307
|
+
// const fakeCall = function(a) {return a;};
|
|
8308
|
+
// const fakeCallNoReturn = function() {};
|
|
8309
|
+
|
|
8310
|
+
exports.buildOptions = function(options, defaultOptions, props) {
|
|
8311
|
+
let newOptions = {};
|
|
8312
|
+
if (!options) {
|
|
8313
|
+
return defaultOptions; //if there are not options
|
|
8314
|
+
}
|
|
8315
|
+
|
|
8316
|
+
for (let i = 0; i < props.length; i++) {
|
|
8317
|
+
if (options[props[i]] !== undefined) {
|
|
8318
|
+
newOptions[props[i]] = options[props[i]];
|
|
8319
|
+
} else {
|
|
8320
|
+
newOptions[props[i]] = defaultOptions[props[i]];
|
|
8321
|
+
}
|
|
8322
|
+
}
|
|
8323
|
+
return newOptions;
|
|
8324
|
+
};
|
|
8325
|
+
|
|
8326
|
+
/**
|
|
8327
|
+
* Check if a tag name should be treated as array
|
|
8328
|
+
*
|
|
8329
|
+
* @param tagName the node tagname
|
|
8330
|
+
* @param arrayMode the array mode option
|
|
8331
|
+
* @param parentTagName the parent tag name
|
|
8332
|
+
* @returns {boolean} true if node should be parsed as array
|
|
8333
|
+
*/
|
|
8334
|
+
exports.isTagNameInArrayMode = function (tagName, arrayMode, parentTagName) {
|
|
8335
|
+
if (arrayMode === false) {
|
|
8336
|
+
return false;
|
|
8337
|
+
} else if (arrayMode instanceof RegExp) {
|
|
8338
|
+
return arrayMode.test(tagName);
|
|
8339
|
+
} else if (typeof arrayMode === 'function') {
|
|
8340
|
+
return !!arrayMode(tagName, parentTagName);
|
|
8124
8341
|
}
|
|
8342
|
+
|
|
8343
|
+
return arrayMode === "strict";
|
|
8125
8344
|
};
|
|
8126
8345
|
|
|
8127
|
-
exports.
|
|
8128
|
-
exports.doesNotMatch = doesNotMatch;
|
|
8346
|
+
exports.isName = isName;
|
|
8129
8347
|
exports.getAllMatches = getAllMatches;
|
|
8348
|
+
exports.nameRegexp = nameRegexp;
|
|
8130
8349
|
});
|
|
8131
8350
|
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
this.parent = parent;
|
|
8135
|
-
this.child = [];//child tags
|
|
8136
|
-
this.attrsMap;//attributes map
|
|
8137
|
-
this.val = val;//text only
|
|
8138
|
-
this.addChild = function (child){
|
|
8139
|
-
this.child.push(child);
|
|
8140
|
-
};
|
|
8141
|
-
};
|
|
8351
|
+
const convertToJson = function(node, options, parentTagName) {
|
|
8352
|
+
const jObj = {};
|
|
8142
8353
|
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
var freeExports = exports;
|
|
8148
|
-
|
|
8149
|
-
// Detect free variable `module`.
|
|
8150
|
-
var freeModule = module &&
|
|
8151
|
-
module.exports == freeExports && module;
|
|
8152
|
-
|
|
8153
|
-
// Detect free variable `global`, from Node.js or Browserified code,
|
|
8154
|
-
// and use it as `root`.
|
|
8155
|
-
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal;
|
|
8156
|
-
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
|
|
8157
|
-
root = freeGlobal;
|
|
8158
|
-
}
|
|
8159
|
-
|
|
8160
|
-
/*--------------------------------------------------------------------------*/
|
|
8161
|
-
|
|
8162
|
-
// All astral symbols.
|
|
8163
|
-
var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
8164
|
-
// All ASCII symbols (not just printable ASCII) except those listed in the
|
|
8165
|
-
// first column of the overrides table.
|
|
8166
|
-
// https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides
|
|
8167
|
-
var regexAsciiWhitelist = /[\x01-\x7F]/g;
|
|
8168
|
-
// All BMP symbols that are not ASCII newlines, printable ASCII symbols, or
|
|
8169
|
-
// code points listed in the first column of the overrides table on
|
|
8170
|
-
// https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides.
|
|
8171
|
-
var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;
|
|
8172
|
-
|
|
8173
|
-
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;
|
|
8174
|
-
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'};
|
|
8175
|
-
|
|
8176
|
-
var regexEscape = /["&'<>`]/g;
|
|
8177
|
-
var escapeMap = {
|
|
8178
|
-
'"': '"',
|
|
8179
|
-
'&': '&',
|
|
8180
|
-
'\'': ''',
|
|
8181
|
-
'<': '<',
|
|
8182
|
-
// See https://mathiasbynens.be/notes/ambiguous-ampersands: in HTML, the
|
|
8183
|
-
// following is not strictly necessary unless it’s part of a tag or an
|
|
8184
|
-
// unquoted attribute value. We’re only escaping it to support those
|
|
8185
|
-
// situations, and for XML support.
|
|
8186
|
-
'>': '>',
|
|
8187
|
-
// In Internet Explorer ≤ 8, the backtick character can be used
|
|
8188
|
-
// to break out of (un)quoted attribute values or HTML comments.
|
|
8189
|
-
// See http://html5sec.org/#102, http://html5sec.org/#108, and
|
|
8190
|
-
// http://html5sec.org/#133.
|
|
8191
|
-
'`': '`'
|
|
8192
|
-
};
|
|
8193
|
-
|
|
8194
|
-
var regexInvalidEntity = /&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/;
|
|
8195
|
-
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]/;
|
|
8196
|
-
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;
|
|
8197
|
-
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'};
|
|
8198
|
-
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'};
|
|
8199
|
-
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'};
|
|
8200
|
-
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];
|
|
8201
|
-
|
|
8202
|
-
/*--------------------------------------------------------------------------*/
|
|
8203
|
-
|
|
8204
|
-
var stringFromCharCode = String.fromCharCode;
|
|
8205
|
-
|
|
8206
|
-
var object = {};
|
|
8207
|
-
var hasOwnProperty = object.hasOwnProperty;
|
|
8208
|
-
var has = function(object, propertyName) {
|
|
8209
|
-
return hasOwnProperty.call(object, propertyName);
|
|
8210
|
-
};
|
|
8211
|
-
|
|
8212
|
-
var contains = function(array, value) {
|
|
8213
|
-
var index = -1;
|
|
8214
|
-
var length = array.length;
|
|
8215
|
-
while (++index < length) {
|
|
8216
|
-
if (array[index] == value) {
|
|
8217
|
-
return true;
|
|
8218
|
-
}
|
|
8219
|
-
}
|
|
8220
|
-
return false;
|
|
8221
|
-
};
|
|
8354
|
+
// when no child node or attr is present
|
|
8355
|
+
if (!options.alwaysCreateTextNode && (!node.child || util.isEmptyObject(node.child)) && (!node.attrsMap || util.isEmptyObject(node.attrsMap))) {
|
|
8356
|
+
return util.isExist(node.val) ? node.val : '';
|
|
8357
|
+
}
|
|
8222
8358
|
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
}
|
|
8248
|
-
return '\uFFFD';
|
|
8249
|
-
}
|
|
8250
|
-
if (has(decodeMapNumeric, codePoint)) {
|
|
8251
|
-
if (strict) {
|
|
8252
|
-
parseError('disallowed character reference');
|
|
8253
|
-
}
|
|
8254
|
-
return decodeMapNumeric[codePoint];
|
|
8255
|
-
}
|
|
8256
|
-
if (strict && contains(invalidReferenceCodePoints, codePoint)) {
|
|
8257
|
-
parseError('disallowed character reference');
|
|
8258
|
-
}
|
|
8259
|
-
if (codePoint > 0xFFFF) {
|
|
8260
|
-
codePoint -= 0x10000;
|
|
8261
|
-
output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
|
|
8262
|
-
codePoint = 0xDC00 | codePoint & 0x3FF;
|
|
8263
|
-
}
|
|
8264
|
-
output += stringFromCharCode(codePoint);
|
|
8265
|
-
return output;
|
|
8266
|
-
};
|
|
8359
|
+
// otherwise create a textnode if node has some text
|
|
8360
|
+
if (util.isExist(node.val) && !(typeof node.val === 'string' && (node.val === '' || node.val === options.cdataPositionChar))) {
|
|
8361
|
+
const asArray = util.isTagNameInArrayMode(node.tagname, options.arrayMode, parentTagName);
|
|
8362
|
+
jObj[options.textNodeName] = asArray ? [node.val] : node.val;
|
|
8363
|
+
}
|
|
8364
|
+
|
|
8365
|
+
util.merge(jObj, node.attrsMap, options.arrayMode);
|
|
8366
|
+
|
|
8367
|
+
const keys = Object.keys(node.child);
|
|
8368
|
+
for (let index = 0; index < keys.length; index++) {
|
|
8369
|
+
const tagName = keys[index];
|
|
8370
|
+
if (node.child[tagName] && node.child[tagName].length > 1) {
|
|
8371
|
+
jObj[tagName] = [];
|
|
8372
|
+
for (let tag in node.child[tagName]) {
|
|
8373
|
+
if (node.child[tagName].hasOwnProperty(tag)) {
|
|
8374
|
+
jObj[tagName].push(convertToJson(node.child[tagName][tag], options, tagName));
|
|
8375
|
+
}
|
|
8376
|
+
}
|
|
8377
|
+
} else {
|
|
8378
|
+
const result = convertToJson(node.child[tagName][0], options, tagName);
|
|
8379
|
+
const asArray = (options.arrayMode === true && typeof result === 'object') || util.isTagNameInArrayMode(tagName, options.arrayMode, parentTagName);
|
|
8380
|
+
jObj[tagName] = asArray ? [result] : result;
|
|
8381
|
+
}
|
|
8382
|
+
}
|
|
8267
8383
|
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8384
|
+
//add value
|
|
8385
|
+
return jObj;
|
|
8386
|
+
};
|
|
8271
8387
|
|
|
8272
|
-
|
|
8273
|
-
return '&#' + codePoint + ';';
|
|
8274
|
-
};
|
|
8388
|
+
var convertToJson_1 = convertToJson;
|
|
8275
8389
|
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8390
|
+
var node2json = {
|
|
8391
|
+
convertToJson: convertToJson_1
|
|
8392
|
+
};
|
|
8279
8393
|
|
|
8280
|
-
|
|
8394
|
+
var xmlNode = function(tagname, parent, val) {
|
|
8395
|
+
this.tagname = tagname;
|
|
8396
|
+
this.parent = parent;
|
|
8397
|
+
this.child = {}; //child tags
|
|
8398
|
+
this.attrsMap = {}; //attributes map
|
|
8399
|
+
this.val = val; //text only
|
|
8400
|
+
this.addChild = function(child) {
|
|
8401
|
+
if (Array.isArray(this.child[child.tagname])) {
|
|
8402
|
+
//already presents
|
|
8403
|
+
this.child[child.tagname].push(child);
|
|
8404
|
+
} else {
|
|
8405
|
+
this.child[child.tagname] = [child];
|
|
8406
|
+
}
|
|
8407
|
+
};
|
|
8408
|
+
};
|
|
8281
8409
|
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
parseError('forbidden code point');
|
|
8287
|
-
}
|
|
8288
|
-
var encodeEverything = options.encodeEverything;
|
|
8289
|
-
var useNamedReferences = options.useNamedReferences;
|
|
8290
|
-
var allowUnsafeSymbols = options.allowUnsafeSymbols;
|
|
8291
|
-
var escapeCodePoint = options.decimal ? decEscape : hexEscape;
|
|
8292
|
-
|
|
8293
|
-
var escapeBmpSymbol = function(symbol) {
|
|
8294
|
-
return escapeCodePoint(symbol.charCodeAt(0));
|
|
8295
|
-
};
|
|
8296
|
-
|
|
8297
|
-
if (encodeEverything) {
|
|
8298
|
-
// Encode ASCII symbols.
|
|
8299
|
-
string = string.replace(regexAsciiWhitelist, function(symbol) {
|
|
8300
|
-
// Use named references if requested & possible.
|
|
8301
|
-
if (useNamedReferences && has(encodeMap, symbol)) {
|
|
8302
|
-
return '&' + encodeMap[symbol] + ';';
|
|
8303
|
-
}
|
|
8304
|
-
return escapeBmpSymbol(symbol);
|
|
8305
|
-
});
|
|
8306
|
-
// Shorten a few escapes that represent two symbols, of which at least one
|
|
8307
|
-
// is within the ASCII range.
|
|
8308
|
-
if (useNamedReferences) {
|
|
8309
|
-
string = string
|
|
8310
|
-
.replace(/>\u20D2/g, '>⃒')
|
|
8311
|
-
.replace(/<\u20D2/g, '<⃒')
|
|
8312
|
-
.replace(/fj/g, 'fj');
|
|
8313
|
-
}
|
|
8314
|
-
// Encode non-ASCII symbols.
|
|
8315
|
-
if (useNamedReferences) {
|
|
8316
|
-
// Encode non-ASCII symbols that can be replaced with a named reference.
|
|
8317
|
-
string = string.replace(regexEncodeNonAscii, function(string) {
|
|
8318
|
-
// Note: there is no need to check `has(encodeMap, string)` here.
|
|
8319
|
-
return '&' + encodeMap[string] + ';';
|
|
8320
|
-
});
|
|
8321
|
-
}
|
|
8322
|
-
// Note: any remaining non-ASCII symbols are handled outside of the `if`.
|
|
8323
|
-
} else if (useNamedReferences) {
|
|
8324
|
-
// Apply named character references.
|
|
8325
|
-
// Encode `<>"'&` using named character references.
|
|
8326
|
-
if (!allowUnsafeSymbols) {
|
|
8327
|
-
string = string.replace(regexEscape, function(string) {
|
|
8328
|
-
return '&' + encodeMap[string] + ';'; // no need to check `has()` here
|
|
8329
|
-
});
|
|
8330
|
-
}
|
|
8331
|
-
// Shorten escapes that represent two symbols, of which at least one is
|
|
8332
|
-
// `<>"'&`.
|
|
8333
|
-
string = string
|
|
8334
|
-
.replace(/>\u20D2/g, '>⃒')
|
|
8335
|
-
.replace(/<\u20D2/g, '<⃒');
|
|
8336
|
-
// Encode non-ASCII symbols that can be replaced with a named reference.
|
|
8337
|
-
string = string.replace(regexEncodeNonAscii, function(string) {
|
|
8338
|
-
// Note: there is no need to check `has(encodeMap, string)` here.
|
|
8339
|
-
return '&' + encodeMap[string] + ';';
|
|
8340
|
-
});
|
|
8341
|
-
} else if (!allowUnsafeSymbols) {
|
|
8342
|
-
// Encode `<>"'&` using hexadecimal escapes, now that they’re not handled
|
|
8343
|
-
// using named character references.
|
|
8344
|
-
string = string.replace(regexEscape, escapeBmpSymbol);
|
|
8345
|
-
}
|
|
8346
|
-
return string
|
|
8347
|
-
// Encode astral symbols.
|
|
8348
|
-
.replace(regexAstralSymbols, function($0) {
|
|
8349
|
-
// https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
|
8350
|
-
var high = $0.charCodeAt(0);
|
|
8351
|
-
var low = $0.charCodeAt(1);
|
|
8352
|
-
var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
|
|
8353
|
-
return escapeCodePoint(codePoint);
|
|
8354
|
-
})
|
|
8355
|
-
// Encode any remaining BMP symbols that are not printable ASCII symbols
|
|
8356
|
-
// using a hexadecimal escape.
|
|
8357
|
-
.replace(regexBmpWhitelist, escapeBmpSymbol);
|
|
8358
|
-
};
|
|
8359
|
-
// Expose default options (so they can be overridden globally).
|
|
8360
|
-
encode.options = {
|
|
8361
|
-
'allowUnsafeSymbols': false,
|
|
8362
|
-
'encodeEverything': false,
|
|
8363
|
-
'strict': false,
|
|
8364
|
-
'useNamedReferences': false,
|
|
8365
|
-
'decimal' : false
|
|
8366
|
-
};
|
|
8367
|
-
|
|
8368
|
-
var decode = function(html, options) {
|
|
8369
|
-
options = merge(options, decode.options);
|
|
8370
|
-
var strict = options.strict;
|
|
8371
|
-
if (strict && regexInvalidEntity.test(html)) {
|
|
8372
|
-
parseError('malformed character reference');
|
|
8373
|
-
}
|
|
8374
|
-
return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7) {
|
|
8375
|
-
var codePoint;
|
|
8376
|
-
var semicolon;
|
|
8377
|
-
var decDigits;
|
|
8378
|
-
var hexDigits;
|
|
8379
|
-
var reference;
|
|
8380
|
-
var next;
|
|
8381
|
-
if ($1) {
|
|
8382
|
-
// Decode decimal escapes, e.g. `𝌆`.
|
|
8383
|
-
decDigits = $1;
|
|
8384
|
-
semicolon = $2;
|
|
8385
|
-
if (strict && !semicolon) {
|
|
8386
|
-
parseError('character reference was not terminated by a semicolon');
|
|
8387
|
-
}
|
|
8388
|
-
codePoint = parseInt(decDigits, 10);
|
|
8389
|
-
return codePointToSymbol(codePoint, strict);
|
|
8390
|
-
}
|
|
8391
|
-
if ($3) {
|
|
8392
|
-
// Decode hexadecimal escapes, e.g. `𝌆`.
|
|
8393
|
-
hexDigits = $3;
|
|
8394
|
-
semicolon = $4;
|
|
8395
|
-
if (strict && !semicolon) {
|
|
8396
|
-
parseError('character reference was not terminated by a semicolon');
|
|
8397
|
-
}
|
|
8398
|
-
codePoint = parseInt(hexDigits, 16);
|
|
8399
|
-
return codePointToSymbol(codePoint, strict);
|
|
8400
|
-
}
|
|
8401
|
-
if ($5) {
|
|
8402
|
-
// Decode named character references with trailing `;`, e.g. `©`.
|
|
8403
|
-
reference = $5;
|
|
8404
|
-
if (has(decodeMap, reference)) {
|
|
8405
|
-
return decodeMap[reference];
|
|
8406
|
-
} else {
|
|
8407
|
-
// Ambiguous ampersand. https://mths.be/notes/ambiguous-ampersands
|
|
8408
|
-
if (strict) {
|
|
8409
|
-
parseError(
|
|
8410
|
-
'named character reference was not terminated by a semicolon'
|
|
8411
|
-
);
|
|
8412
|
-
}
|
|
8413
|
-
return $0;
|
|
8414
|
-
}
|
|
8415
|
-
}
|
|
8416
|
-
// If we’re still here, it’s a legacy reference for sure. No need for an
|
|
8417
|
-
// extra `if` check.
|
|
8418
|
-
// Decode named character references without trailing `;`, e.g. `&`
|
|
8419
|
-
// This is only a parse error if it gets converted to `&`, or if it is
|
|
8420
|
-
// followed by `=` in an attribute context.
|
|
8421
|
-
reference = $6;
|
|
8422
|
-
next = $7;
|
|
8423
|
-
if (next && options.isAttributeValue) {
|
|
8424
|
-
if (strict && next == '=') {
|
|
8425
|
-
parseError('`&` did not start a character reference');
|
|
8426
|
-
}
|
|
8427
|
-
return $0;
|
|
8428
|
-
} else {
|
|
8429
|
-
if (strict) {
|
|
8430
|
-
parseError(
|
|
8431
|
-
'named character reference was not terminated by a semicolon'
|
|
8432
|
-
);
|
|
8433
|
-
}
|
|
8434
|
-
// Note: there is no need to check `has(decodeMapLegacy, reference)`.
|
|
8435
|
-
return decodeMapLegacy[reference] + (next || '');
|
|
8436
|
-
}
|
|
8437
|
-
});
|
|
8438
|
-
};
|
|
8439
|
-
// Expose default options (so they can be overridden globally).
|
|
8440
|
-
decode.options = {
|
|
8441
|
-
'isAttributeValue': false,
|
|
8442
|
-
'strict': false
|
|
8443
|
-
};
|
|
8444
|
-
|
|
8445
|
-
var escape = function(string) {
|
|
8446
|
-
return string.replace(regexEscape, function($0) {
|
|
8447
|
-
// Note: there is no need to check `has(escapeMap, $0)` here.
|
|
8448
|
-
return escapeMap[$0];
|
|
8449
|
-
});
|
|
8450
|
-
};
|
|
8451
|
-
|
|
8452
|
-
/*--------------------------------------------------------------------------*/
|
|
8453
|
-
|
|
8454
|
-
var he = {
|
|
8455
|
-
'version': '1.1.1',
|
|
8456
|
-
'encode': encode,
|
|
8457
|
-
'decode': decode,
|
|
8458
|
-
'escape': escape,
|
|
8459
|
-
'unescape': decode
|
|
8460
|
-
};
|
|
8461
|
-
|
|
8462
|
-
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
|
8463
|
-
// like the following:
|
|
8464
|
-
if (freeExports && !freeExports.nodeType) {
|
|
8465
|
-
if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+
|
|
8466
|
-
freeModule.exports = he;
|
|
8467
|
-
} else { // in Narwhal or RingoJS v0.7.0-
|
|
8468
|
-
for (var key in he) {
|
|
8469
|
-
has(he, key) && (freeExports[key] = he[key]);
|
|
8470
|
-
}
|
|
8471
|
-
}
|
|
8472
|
-
} else { // in Rhino or a web browser
|
|
8473
|
-
root.he = he;
|
|
8474
|
-
}
|
|
8410
|
+
const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
|
|
8411
|
+
const numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
|
|
8412
|
+
// const octRegex = /0x[a-z0-9]+/;
|
|
8413
|
+
// const binRegex = /0x[a-z0-9]+/;
|
|
8475
8414
|
|
|
8476
|
-
}(commonjsGlobal));
|
|
8477
|
-
});
|
|
8478
8415
|
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
//ignoreRootElement : false,
|
|
8495
|
-
parseNodeValue : true,
|
|
8496
|
-
parseAttributeValue : false,
|
|
8497
|
-
arrayMode : false,
|
|
8498
|
-
trimValues: true, //Trim string values of tag and attributes
|
|
8499
|
-
decodeHTMLchar: false,
|
|
8500
|
-
cdataTagName: false,
|
|
8501
|
-
cdataPositionChar: "\\c"
|
|
8502
|
-
//decodeStrict: false,
|
|
8416
|
+
//polyfill
|
|
8417
|
+
if (!Number.parseInt && window.parseInt) {
|
|
8418
|
+
Number.parseInt = window.parseInt;
|
|
8419
|
+
}
|
|
8420
|
+
if (!Number.parseFloat && window.parseFloat) {
|
|
8421
|
+
Number.parseFloat = window.parseFloat;
|
|
8422
|
+
}
|
|
8423
|
+
|
|
8424
|
+
|
|
8425
|
+
const consider = {
|
|
8426
|
+
hex : true,
|
|
8427
|
+
leadingZeros: true,
|
|
8428
|
+
decimalPoint: "\.",
|
|
8429
|
+
eNotation: true
|
|
8430
|
+
//skipLike: /regex/
|
|
8503
8431
|
};
|
|
8504
8432
|
|
|
8505
|
-
|
|
8506
|
-
//options =
|
|
8507
|
-
|
|
8508
|
-
//
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
var currentNode = xmlObj;
|
|
8513
|
-
|
|
8514
|
-
var tagsRegx = new RegExp("<((!\\[CDATA\\[([\\s\\S]*?)(\\]\\]>))|(([\\w:\\-\\._]*:)?([\\w:\\-\\._]+))([^>]*)>|((\\/)(([\\w:\\-\\._]*:)?([\\w:\\-\\._]+))>))([^<]*)","g");
|
|
8515
|
-
var tag = tagsRegx.exec(xmlData);
|
|
8516
|
-
var nextTag = tagsRegx.exec(xmlData);
|
|
8517
|
-
while (tag) {
|
|
8518
|
-
var tagType = checkForTagType(tag);
|
|
8519
|
-
|
|
8520
|
-
if(tagType === TagType.CLOSING){
|
|
8521
|
-
//add parsed data to parent node
|
|
8522
|
-
if(currentNode.parent && tag[14]){
|
|
8523
|
-
currentNode.parent.val = util.getValue(currentNode.parent.val) + "" + processTagValue(tag[14],options);
|
|
8524
|
-
}
|
|
8433
|
+
function toNumber(str, options = {}){
|
|
8434
|
+
// const options = Object.assign({}, consider);
|
|
8435
|
+
// if(opt.leadingZeros === false){
|
|
8436
|
+
// options.leadingZeros = false;
|
|
8437
|
+
// }else if(opt.hex === false){
|
|
8438
|
+
// options.hex = false;
|
|
8439
|
+
// }
|
|
8525
8440
|
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
|
|
8536
|
-
|
|
8537
|
-
|
|
8441
|
+
options = Object.assign({}, consider, options );
|
|
8442
|
+
if(!str || typeof str !== "string" ) return str;
|
|
8443
|
+
|
|
8444
|
+
let trimmedStr = str.trim();
|
|
8445
|
+
// if(trimmedStr === "0.0") return 0;
|
|
8446
|
+
// else if(trimmedStr === "+0.0") return 0;
|
|
8447
|
+
// else if(trimmedStr === "-0.0") return -0;
|
|
8448
|
+
|
|
8449
|
+
if(options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str;
|
|
8450
|
+
else if (options.hex && hexRegex.test(trimmedStr)) {
|
|
8451
|
+
return Number.parseInt(trimmedStr, 16);
|
|
8452
|
+
// } else if (options.parseOct && octRegex.test(str)) {
|
|
8453
|
+
// return Number.parseInt(val, 8);
|
|
8454
|
+
// }else if (options.parseBin && binRegex.test(str)) {
|
|
8455
|
+
// return Number.parseInt(val, 2);
|
|
8456
|
+
}else {
|
|
8457
|
+
//separate negative sign, leading zeros, and rest number
|
|
8458
|
+
const match = numRegex.exec(trimmedStr);
|
|
8459
|
+
if(match){
|
|
8460
|
+
const sign = match[1];
|
|
8461
|
+
const leadingZeros = match[2];
|
|
8462
|
+
let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros
|
|
8463
|
+
//trim ending zeros for floating number
|
|
8464
|
+
|
|
8465
|
+
const eNotation = match[4] || match[6];
|
|
8466
|
+
if(!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; //-0123
|
|
8467
|
+
else if(!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; //0123
|
|
8468
|
+
else {//no leading zeros or leading zeros are allowed
|
|
8469
|
+
const num = Number(trimmedStr);
|
|
8470
|
+
const numStr = "" + num;
|
|
8471
|
+
if(numStr.search(/[eE]/) !== -1){ //given number is long and parsed to eNotation
|
|
8472
|
+
if(options.eNotation) return num;
|
|
8473
|
+
else return str;
|
|
8474
|
+
}else if(eNotation){ //given number has enotation
|
|
8475
|
+
if(options.eNotation) return num;
|
|
8476
|
+
else return str;
|
|
8477
|
+
}else if(trimmedStr.indexOf(".") !== -1){ //floating number
|
|
8478
|
+
// const decimalPart = match[5].substr(1);
|
|
8479
|
+
// const intPart = trimmedStr.substr(0,trimmedStr.indexOf("."));
|
|
8480
|
+
|
|
8481
|
+
|
|
8482
|
+
// const p = numStr.indexOf(".");
|
|
8483
|
+
// const givenIntPart = numStr.substr(0,p);
|
|
8484
|
+
// const givenDecPart = numStr.substr(p+1);
|
|
8485
|
+
if(numStr === "0" && (numTrimmedByZeros === "") ) return num; //0.0
|
|
8486
|
+
else if(numStr === numTrimmedByZeros) return num; //0.456. 0.79000
|
|
8487
|
+
else if( sign && numStr === "-"+numTrimmedByZeros) return num;
|
|
8488
|
+
else return str;
|
|
8538
8489
|
}
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8490
|
+
|
|
8491
|
+
if(leadingZeros){
|
|
8492
|
+
// if(numTrimmedByZeros === numStr){
|
|
8493
|
+
// if(options.leadingZeros) return num;
|
|
8494
|
+
// else return str;
|
|
8495
|
+
// }else return str;
|
|
8496
|
+
if(numTrimmedByZeros === numStr) return num;
|
|
8497
|
+
else if(sign+numTrimmedByZeros === numStr) return num;
|
|
8498
|
+
else return str;
|
|
8499
|
+
}
|
|
8500
|
+
|
|
8501
|
+
if(trimmedStr === numStr) return num;
|
|
8502
|
+
else if(trimmedStr === sign+numStr) return num;
|
|
8503
|
+
// else{
|
|
8504
|
+
// //number with +/- sign
|
|
8505
|
+
// trimmedStr.test(/[-+][0-9]);
|
|
8506
|
+
|
|
8507
|
+
// }
|
|
8508
|
+
return str;
|
|
8546
8509
|
}
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
}else {//
|
|
8550
|
-
|
|
8551
|
-
childNode.attrsMap = buildAttributesMap(tag[8],options);
|
|
8552
|
-
currentNode.addChild(childNode);
|
|
8553
|
-
currentNode = childNode;
|
|
8510
|
+
// else if(!eNotation && trimmedStr && trimmedStr !== Number(trimmedStr) ) return str;
|
|
8511
|
+
|
|
8512
|
+
}else { //non-numeric string
|
|
8513
|
+
return str;
|
|
8554
8514
|
}
|
|
8515
|
+
}
|
|
8516
|
+
}
|
|
8555
8517
|
|
|
8556
|
-
|
|
8557
|
-
|
|
8518
|
+
/**
|
|
8519
|
+
*
|
|
8520
|
+
* @param {string} numStr without leading zeros
|
|
8521
|
+
* @returns
|
|
8522
|
+
*/
|
|
8523
|
+
function trimZeros(numStr){
|
|
8524
|
+
if(numStr && numStr.indexOf(".") !== -1){//float
|
|
8525
|
+
numStr = numStr.replace(/0+$/, ""); //remove ending zeros
|
|
8526
|
+
if(numStr === ".") numStr = "0";
|
|
8527
|
+
else if(numStr[0] === ".") numStr = "0"+numStr;
|
|
8528
|
+
else if(numStr[numStr.length-1] === ".") numStr = numStr.substr(0,numStr.length-1);
|
|
8529
|
+
return numStr;
|
|
8558
8530
|
}
|
|
8531
|
+
return numStr;
|
|
8532
|
+
}
|
|
8533
|
+
var strnum = toNumber;
|
|
8534
|
+
|
|
8535
|
+
const buildOptions$3 = util.buildOptions;
|
|
8536
|
+
|
|
8559
8537
|
|
|
8560
|
-
|
|
8538
|
+
|
|
8539
|
+
'<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)'
|
|
8540
|
+
.replace(/NAME/g, util.nameRegexp);
|
|
8541
|
+
|
|
8542
|
+
//const tagsRegx = new RegExp("<(\\/?[\\w:\\-\._]+)([^>]*)>(\\s*"+cdataRegx+")*([^<]+)?","g");
|
|
8543
|
+
//const tagsRegx = new RegExp("<(\\/?)((\\w*:)?([\\w:\\-\._]+))([^>]*)>([^<]*)("+cdataRegx+"([^<]*))*([^<]+)?","g");
|
|
8544
|
+
|
|
8545
|
+
//polyfill
|
|
8546
|
+
if (!Number.parseInt && window.parseInt) {
|
|
8547
|
+
Number.parseInt = window.parseInt;
|
|
8548
|
+
}
|
|
8549
|
+
if (!Number.parseFloat && window.parseFloat) {
|
|
8550
|
+
Number.parseFloat = window.parseFloat;
|
|
8551
|
+
}
|
|
8552
|
+
|
|
8553
|
+
const defaultOptions$2 = {
|
|
8554
|
+
attributeNamePrefix: '@_',
|
|
8555
|
+
attrNodeName: false,
|
|
8556
|
+
textNodeName: '#text',
|
|
8557
|
+
ignoreAttributes: true,
|
|
8558
|
+
ignoreNameSpace: false,
|
|
8559
|
+
allowBooleanAttributes: false, //a tag can have attributes without any value
|
|
8560
|
+
//ignoreRootElement : false,
|
|
8561
|
+
parseNodeValue: true,
|
|
8562
|
+
parseAttributeValue: false,
|
|
8563
|
+
arrayMode: false,
|
|
8564
|
+
trimValues: true, //Trim string values of tag and attributes
|
|
8565
|
+
cdataTagName: false,
|
|
8566
|
+
cdataPositionChar: '\\c',
|
|
8567
|
+
numParseOptions: {
|
|
8568
|
+
hex: true,
|
|
8569
|
+
leadingZeros: true
|
|
8570
|
+
},
|
|
8571
|
+
tagValueProcessor: function(a, tagName) {
|
|
8572
|
+
return a;
|
|
8573
|
+
},
|
|
8574
|
+
attrValueProcessor: function(a, attrName) {
|
|
8575
|
+
return a;
|
|
8576
|
+
},
|
|
8577
|
+
stopNodes: [],
|
|
8578
|
+
alwaysCreateTextNode: false
|
|
8579
|
+
//decodeStrict: false,
|
|
8561
8580
|
};
|
|
8562
8581
|
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8582
|
+
var defaultOptions_1 = defaultOptions$2;
|
|
8583
|
+
|
|
8584
|
+
const props$2 = [
|
|
8585
|
+
'attributeNamePrefix',
|
|
8586
|
+
'attrNodeName',
|
|
8587
|
+
'textNodeName',
|
|
8588
|
+
'ignoreAttributes',
|
|
8589
|
+
'ignoreNameSpace',
|
|
8590
|
+
'allowBooleanAttributes',
|
|
8591
|
+
'parseNodeValue',
|
|
8592
|
+
'parseAttributeValue',
|
|
8593
|
+
'arrayMode',
|
|
8594
|
+
'trimValues',
|
|
8595
|
+
'cdataTagName',
|
|
8596
|
+
'cdataPositionChar',
|
|
8597
|
+
'tagValueProcessor',
|
|
8598
|
+
'attrValueProcessor',
|
|
8599
|
+
'parseTrueNumberOnly',
|
|
8600
|
+
'numParseOptions',
|
|
8601
|
+
'stopNodes',
|
|
8602
|
+
'alwaysCreateTextNode'
|
|
8603
|
+
];
|
|
8604
|
+
var props_1 = props$2;
|
|
8605
|
+
|
|
8606
|
+
/**
|
|
8607
|
+
* Trim -> valueProcessor -> parse value
|
|
8608
|
+
* @param {string} tagName
|
|
8609
|
+
* @param {string} val
|
|
8610
|
+
* @param {object} options
|
|
8611
|
+
*/
|
|
8612
|
+
function processTagValue(tagName, val, options) {
|
|
8613
|
+
if (val) {
|
|
8614
|
+
if (options.trimValues) {
|
|
8615
|
+
val = val.trim();
|
|
8572
8616
|
}
|
|
8617
|
+
val = options.tagValueProcessor(val, tagName);
|
|
8618
|
+
val = parseValue(val, options.parseNodeValue, options.numParseOptions);
|
|
8619
|
+
}
|
|
8573
8620
|
|
|
8574
|
-
|
|
8621
|
+
return val;
|
|
8575
8622
|
}
|
|
8576
8623
|
|
|
8577
|
-
function
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
return TagType.SELF;
|
|
8584
|
-
}else {
|
|
8585
|
-
return TagType.OPENING;
|
|
8624
|
+
function resolveNameSpace(tagname, options) {
|
|
8625
|
+
if (options.ignoreNameSpace) {
|
|
8626
|
+
const tags = tagname.split(':');
|
|
8627
|
+
const prefix = tagname.charAt(0) === '/' ? '/' : '';
|
|
8628
|
+
if (tags[0] === 'xmlns') {
|
|
8629
|
+
return '';
|
|
8586
8630
|
}
|
|
8631
|
+
if (tags.length === 2) {
|
|
8632
|
+
tagname = prefix + tags[1];
|
|
8633
|
+
}
|
|
8634
|
+
}
|
|
8635
|
+
return tagname;
|
|
8587
8636
|
}
|
|
8588
8637
|
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8638
|
+
function parseValue(val, shouldParse, options) {
|
|
8639
|
+
if (shouldParse && typeof val === 'string') {
|
|
8640
|
+
//console.log(options)
|
|
8641
|
+
const newval = val.trim();
|
|
8642
|
+
if(newval === 'true' ) return true;
|
|
8643
|
+
else if(newval === 'false' ) return false;
|
|
8644
|
+
else return strnum(val, options);
|
|
8645
|
+
} else {
|
|
8646
|
+
if (util.isExist(val)) {
|
|
8647
|
+
return val;
|
|
8648
|
+
} else {
|
|
8649
|
+
return '';
|
|
8650
|
+
}
|
|
8651
|
+
}
|
|
8652
|
+
}
|
|
8593
8653
|
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8654
|
+
//TODO: change regex to capture NS
|
|
8655
|
+
//const attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm");
|
|
8656
|
+
const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])(.*?)\\3)?', 'g');
|
|
8657
|
+
|
|
8658
|
+
function buildAttributesMap(attrStr, options) {
|
|
8659
|
+
if (!options.ignoreAttributes && typeof attrStr === 'string') {
|
|
8660
|
+
attrStr = attrStr.replace(/\r?\n/g, ' ');
|
|
8661
|
+
//attrStr = attrStr || attrStr.trim();
|
|
8662
|
+
|
|
8663
|
+
const matches = util.getAllMatches(attrStr, attrsRegx);
|
|
8664
|
+
const len = matches.length; //don't make it inline
|
|
8665
|
+
const attrs = {};
|
|
8666
|
+
for (let i = 0; i < len; i++) {
|
|
8667
|
+
const attrName = resolveNameSpace(matches[i][1], options);
|
|
8668
|
+
if (attrName.length) {
|
|
8669
|
+
if (matches[i][4] !== undefined) {
|
|
8670
|
+
if (options.trimValues) {
|
|
8671
|
+
matches[i][4] = matches[i][4].trim();
|
|
8672
|
+
}
|
|
8673
|
+
matches[i][4] = options.attrValueProcessor(matches[i][4], attrName);
|
|
8674
|
+
attrs[options.attributeNamePrefix + attrName] = parseValue(
|
|
8675
|
+
matches[i][4],
|
|
8676
|
+
options.parseAttributeValue,
|
|
8677
|
+
options.numParseOptions
|
|
8678
|
+
);
|
|
8679
|
+
} else if (options.allowBooleanAttributes) {
|
|
8680
|
+
attrs[options.attributeNamePrefix + attrName] = true;
|
|
8603
8681
|
}
|
|
8682
|
+
}
|
|
8604
8683
|
}
|
|
8605
|
-
|
|
8684
|
+
if (!Object.keys(attrs).length) {
|
|
8685
|
+
return;
|
|
8686
|
+
}
|
|
8687
|
+
if (options.attrNodeName) {
|
|
8688
|
+
const attrCollection = {};
|
|
8689
|
+
attrCollection[options.attrNodeName] = attrs;
|
|
8690
|
+
return attrCollection;
|
|
8691
|
+
}
|
|
8692
|
+
return attrs;
|
|
8693
|
+
}
|
|
8606
8694
|
}
|
|
8607
8695
|
|
|
8608
|
-
function
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8696
|
+
const getTraversalObj = function(xmlData, options) {
|
|
8697
|
+
xmlData = xmlData.replace(/\r\n?/g, "\n");
|
|
8698
|
+
options = buildOptions$3(options, defaultOptions$2, props$2);
|
|
8699
|
+
const xmlObj = new xmlNode('!xml');
|
|
8700
|
+
let currentNode = xmlObj;
|
|
8701
|
+
let textData = "";
|
|
8702
|
+
|
|
8703
|
+
//function match(xmlData){
|
|
8704
|
+
for(let i=0; i< xmlData.length; i++){
|
|
8705
|
+
const ch = xmlData[i];
|
|
8706
|
+
if(ch === '<'){
|
|
8707
|
+
if( xmlData[i+1] === '/') {//Closing Tag
|
|
8708
|
+
const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.");
|
|
8709
|
+
let tagName = xmlData.substring(i+2,closeIndex).trim();
|
|
8710
|
+
|
|
8711
|
+
if(options.ignoreNameSpace){
|
|
8712
|
+
const colonIndex = tagName.indexOf(":");
|
|
8713
|
+
if(colonIndex !== -1){
|
|
8714
|
+
tagName = tagName.substr(colonIndex+1);
|
|
8715
|
+
}
|
|
8716
|
+
}
|
|
8717
|
+
|
|
8718
|
+
/* if (currentNode.parent) {
|
|
8719
|
+
currentNode.parent.val = util.getValue(currentNode.parent.val) + '' + processTagValue2(tagName, textData , options);
|
|
8720
|
+
} */
|
|
8721
|
+
if(currentNode){
|
|
8722
|
+
if(currentNode.val){
|
|
8723
|
+
currentNode.val = util.getValue(currentNode.val) + '' + processTagValue(tagName, textData , options);
|
|
8724
|
+
}else {
|
|
8725
|
+
currentNode.val = processTagValue(tagName, textData , options);
|
|
8726
|
+
}
|
|
8727
|
+
}
|
|
8728
|
+
|
|
8729
|
+
if (options.stopNodes.length && options.stopNodes.includes(currentNode.tagname)) {
|
|
8730
|
+
currentNode.child = [];
|
|
8731
|
+
if (currentNode.attrsMap == undefined) { currentNode.attrsMap = {};}
|
|
8732
|
+
currentNode.val = xmlData.substr(currentNode.startIndex + 1, i - currentNode.startIndex - 1);
|
|
8733
|
+
}
|
|
8734
|
+
currentNode = currentNode.parent;
|
|
8735
|
+
textData = "";
|
|
8736
|
+
i = closeIndex;
|
|
8737
|
+
} else if( xmlData[i+1] === '?') {
|
|
8738
|
+
i = findClosingIndex(xmlData, "?>", i, "Pi Tag is not closed.");
|
|
8739
|
+
} else if(xmlData.substr(i + 1, 3) === '!--') {
|
|
8740
|
+
i = findClosingIndex(xmlData, "-->", i, "Comment is not closed.");
|
|
8741
|
+
} else if( xmlData.substr(i + 1, 2) === '!D') {
|
|
8742
|
+
const closeIndex = findClosingIndex(xmlData, ">", i, "DOCTYPE is not closed.");
|
|
8743
|
+
const tagExp = xmlData.substring(i, closeIndex);
|
|
8744
|
+
if(tagExp.indexOf("[") >= 0){
|
|
8745
|
+
i = xmlData.indexOf("]>", i) + 1;
|
|
8612
8746
|
}else {
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8747
|
+
i = closeIndex;
|
|
8748
|
+
}
|
|
8749
|
+
}else if(xmlData.substr(i + 1, 2) === '![') {
|
|
8750
|
+
const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
|
|
8751
|
+
const tagExp = xmlData.substring(i + 9,closeIndex);
|
|
8752
|
+
|
|
8753
|
+
//considerations
|
|
8754
|
+
//1. CDATA will always have parent node
|
|
8755
|
+
//2. A tag with CDATA is not a leaf node so it's value would be string type.
|
|
8756
|
+
if(textData){
|
|
8757
|
+
currentNode.val = util.getValue(currentNode.val) + '' + processTagValue(currentNode.tagname, textData , options);
|
|
8758
|
+
textData = "";
|
|
8618
8759
|
}
|
|
8619
|
-
return val;
|
|
8620
|
-
}else {
|
|
8621
|
-
if(util.isExist(val)) return val;
|
|
8622
|
-
else return "";
|
|
8623
|
-
}
|
|
8624
|
-
}
|
|
8625
8760
|
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
var attrName = resolveNameSpace(matches[i][1],options);
|
|
8639
|
-
if(attrName.length) {
|
|
8640
|
-
if(matches[i][4] !== undefined){
|
|
8641
|
-
if(options.trimValues){
|
|
8642
|
-
matches[i][4] = matches[i][4].trim();
|
|
8643
|
-
}
|
|
8644
|
-
if(options.decodeHTMLchar){
|
|
8645
|
-
matches[i][4] = he.decode(matches[i][4], {isAttributeValue : true});
|
|
8646
|
-
}
|
|
8647
|
-
attrs[options.attributeNamePrefix + attrName] = parseValue(matches[i][4],options.parseAttributeValue);
|
|
8648
|
-
}else if(options.allowBooleanAttributes){
|
|
8649
|
-
attrs[options.attributeNamePrefix + attrName] = true;
|
|
8650
|
-
}
|
|
8651
|
-
|
|
8652
|
-
}
|
|
8761
|
+
if (options.cdataTagName) {
|
|
8762
|
+
//add cdata node
|
|
8763
|
+
const childNode = new xmlNode(options.cdataTagName, currentNode, tagExp);
|
|
8764
|
+
currentNode.addChild(childNode);
|
|
8765
|
+
//for backtracking
|
|
8766
|
+
currentNode.val = util.getValue(currentNode.val) + options.cdataPositionChar;
|
|
8767
|
+
//add rest value to parent node
|
|
8768
|
+
if (tagExp) {
|
|
8769
|
+
childNode.val = tagExp;
|
|
8770
|
+
}
|
|
8771
|
+
} else {
|
|
8772
|
+
currentNode.val = (currentNode.val || '') + (tagExp || '');
|
|
8653
8773
|
}
|
|
8654
|
-
|
|
8655
|
-
|
|
8774
|
+
|
|
8775
|
+
i = closeIndex + 2;
|
|
8776
|
+
}else {//Opening tag
|
|
8777
|
+
const result = closingIndexForOpeningTag(xmlData, i+1);
|
|
8778
|
+
let tagExp = result.data;
|
|
8779
|
+
const closeIndex = result.index;
|
|
8780
|
+
const separatorIndex = tagExp.indexOf(" ");
|
|
8781
|
+
let tagName = tagExp;
|
|
8782
|
+
let shouldBuildAttributesMap = true;
|
|
8783
|
+
if(separatorIndex !== -1){
|
|
8784
|
+
tagName = tagExp.substr(0, separatorIndex).replace(/\s\s*$/, '');
|
|
8785
|
+
tagExp = tagExp.substr(separatorIndex + 1);
|
|
8656
8786
|
}
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8787
|
+
|
|
8788
|
+
if(options.ignoreNameSpace){
|
|
8789
|
+
const colonIndex = tagName.indexOf(":");
|
|
8790
|
+
if(colonIndex !== -1){
|
|
8791
|
+
tagName = tagName.substr(colonIndex+1);
|
|
8792
|
+
shouldBuildAttributesMap = tagName !== result.data.substr(colonIndex + 1);
|
|
8793
|
+
}
|
|
8661
8794
|
}
|
|
8662
|
-
return attrs;
|
|
8663
|
-
}
|
|
8664
|
-
}
|
|
8665
8795
|
|
|
8666
|
-
|
|
8667
|
-
|
|
8796
|
+
//save text to parent node
|
|
8797
|
+
if (currentNode && textData) {
|
|
8798
|
+
if(currentNode.tagname !== '!xml'){
|
|
8799
|
+
currentNode.val = util.getValue(currentNode.val) + '' + processTagValue( currentNode.tagname, textData, options);
|
|
8800
|
+
}
|
|
8801
|
+
}
|
|
8668
8802
|
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8803
|
+
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){//selfClosing tag
|
|
8804
|
+
|
|
8805
|
+
if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
|
|
8806
|
+
tagName = tagName.substr(0, tagName.length - 1);
|
|
8807
|
+
tagExp = tagName;
|
|
8808
|
+
}else {
|
|
8809
|
+
tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
8810
|
+
}
|
|
8811
|
+
|
|
8812
|
+
const childNode = new xmlNode(tagName, currentNode, '');
|
|
8813
|
+
if(tagName !== tagExp){
|
|
8814
|
+
childNode.attrsMap = buildAttributesMap(tagExp, options);
|
|
8815
|
+
}
|
|
8816
|
+
currentNode.addChild(childNode);
|
|
8817
|
+
}else {//opening tag
|
|
8818
|
+
|
|
8819
|
+
const childNode = new xmlNode( tagName, currentNode );
|
|
8820
|
+
if (options.stopNodes.length && options.stopNodes.includes(childNode.tagname)) {
|
|
8821
|
+
childNode.startIndex=closeIndex;
|
|
8822
|
+
}
|
|
8823
|
+
if(tagName !== tagExp && shouldBuildAttributesMap){
|
|
8824
|
+
childNode.attrsMap = buildAttributesMap(tagExp, options);
|
|
8825
|
+
}
|
|
8826
|
+
currentNode.addChild(childNode);
|
|
8827
|
+
currentNode = childNode;
|
|
8682
8828
|
}
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
if(util.isEmptyObject(jObj)){
|
|
8687
|
-
return util.isExist(node.val)? node.val : "";
|
|
8829
|
+
textData = "";
|
|
8830
|
+
i = closeIndex;
|
|
8831
|
+
}
|
|
8688
8832
|
}else {
|
|
8689
|
-
|
|
8690
|
-
if(!(typeof node.val === "string" && (node.val === "" || node.val === options.cdataPositionChar))){
|
|
8691
|
-
jObj[options.textNodeName] = node.val;
|
|
8692
|
-
}
|
|
8693
|
-
}
|
|
8833
|
+
textData += xmlData[i];
|
|
8694
8834
|
}
|
|
8695
|
-
|
|
8696
|
-
|
|
8835
|
+
}
|
|
8836
|
+
return xmlObj;
|
|
8697
8837
|
};
|
|
8698
8838
|
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8839
|
+
function closingIndexForOpeningTag(data, i){
|
|
8840
|
+
let attrBoundary;
|
|
8841
|
+
let tagExp = "";
|
|
8842
|
+
for (let index = i; index < data.length; index++) {
|
|
8843
|
+
let ch = data[index];
|
|
8844
|
+
if (attrBoundary) {
|
|
8845
|
+
if (ch === attrBoundary) attrBoundary = "";//reset
|
|
8846
|
+
} else if (ch === '"' || ch === "'") {
|
|
8847
|
+
attrBoundary = ch;
|
|
8848
|
+
} else if (ch === '>') {
|
|
8849
|
+
return {
|
|
8850
|
+
data: tagExp,
|
|
8851
|
+
index: index
|
|
8852
|
+
}
|
|
8853
|
+
} else if (ch === '\t') {
|
|
8854
|
+
ch = " ";
|
|
8855
|
+
}
|
|
8856
|
+
tagExp += ch;
|
|
8857
|
+
}
|
|
8858
|
+
}
|
|
8702
8859
|
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8860
|
+
function findClosingIndex(xmlData, str, i, errMsg){
|
|
8861
|
+
const closingIndex = xmlData.indexOf(str, i);
|
|
8862
|
+
if(closingIndex === -1){
|
|
8863
|
+
throw new Error(errMsg)
|
|
8864
|
+
}else {
|
|
8865
|
+
return closingIndex + str.length - 1;
|
|
8866
|
+
}
|
|
8867
|
+
}
|
|
8868
|
+
|
|
8869
|
+
var getTraversalObj_1 = getTraversalObj;
|
|
8870
|
+
|
|
8871
|
+
var xmlstr2xmlnode = {
|
|
8872
|
+
defaultOptions: defaultOptions_1,
|
|
8873
|
+
props: props_1,
|
|
8874
|
+
getTraversalObj: getTraversalObj_1
|
|
8875
|
+
};
|
|
8876
|
+
|
|
8877
|
+
const defaultOptions$1 = {
|
|
8878
|
+
allowBooleanAttributes: false, //A tag can have attributes without any value
|
|
8879
|
+
};
|
|
8880
|
+
|
|
8881
|
+
const props$1 = ['allowBooleanAttributes'];
|
|
8882
|
+
|
|
8883
|
+
//const tagsPattern = new RegExp("<\\/?([\\w:\\-_\.]+)\\s*\/?>","g");
|
|
8884
|
+
var validate = function (xmlData, options) {
|
|
8885
|
+
options = util.buildOptions(options, defaultOptions$1, props$1);
|
|
8886
|
+
|
|
8887
|
+
//xmlData = xmlData.replace(/(\r\n|\n|\r)/gm,"");//make it single line
|
|
8888
|
+
//xmlData = xmlData.replace(/(^\s*<\?xml.*?\?>)/g,"");//Remove XML starting tag
|
|
8889
|
+
//xmlData = xmlData.replace(/(<!DOCTYPE[\s\w\"\.\/\-\:]+(\[.*\])*\s*>)/g,"");//Remove DOCTYPE
|
|
8890
|
+
const tags = [];
|
|
8891
|
+
let tagFound = false;
|
|
8892
|
+
|
|
8893
|
+
//indicates that the root tag has been closed (aka. depth 0 has been reached)
|
|
8894
|
+
let reachedRoot = false;
|
|
8895
|
+
|
|
8896
|
+
if (xmlData[0] === '\ufeff') {
|
|
8897
|
+
// check for byte order mark (BOM)
|
|
8898
|
+
xmlData = xmlData.substr(1);
|
|
8899
|
+
}
|
|
8900
|
+
|
|
8901
|
+
for (let i = 0; i < xmlData.length; i++) {
|
|
8902
|
+
|
|
8903
|
+
if (xmlData[i] === '<' && xmlData[i+1] === '?') {
|
|
8904
|
+
i+=2;
|
|
8905
|
+
i = readPI(xmlData,i);
|
|
8906
|
+
if (i.err) return i;
|
|
8907
|
+
}else if (xmlData[i] === '<') {
|
|
8908
|
+
//starting of tag
|
|
8909
|
+
//read until you reach to '>' avoiding any '>' in attribute value
|
|
8910
|
+
let tagStartPos = i;
|
|
8911
|
+
i++;
|
|
8912
|
+
|
|
8913
|
+
if (xmlData[i] === '!') {
|
|
8914
|
+
i = readCommentAndCDATA(xmlData, i);
|
|
8915
|
+
continue;
|
|
8916
|
+
} else {
|
|
8917
|
+
let closingTag = false;
|
|
8918
|
+
if (xmlData[i] === '/') {
|
|
8919
|
+
//closing tag
|
|
8920
|
+
closingTag = true;
|
|
8921
|
+
i++;
|
|
8922
|
+
}
|
|
8923
|
+
//read tagname
|
|
8924
|
+
let tagName = '';
|
|
8925
|
+
for (; i < xmlData.length &&
|
|
8926
|
+
xmlData[i] !== '>' &&
|
|
8927
|
+
xmlData[i] !== ' ' &&
|
|
8928
|
+
xmlData[i] !== '\t' &&
|
|
8929
|
+
xmlData[i] !== '\n' &&
|
|
8930
|
+
xmlData[i] !== '\r'; i++
|
|
8931
|
+
) {
|
|
8932
|
+
tagName += xmlData[i];
|
|
8933
|
+
}
|
|
8934
|
+
tagName = tagName.trim();
|
|
8935
|
+
//console.log(tagName);
|
|
8936
|
+
|
|
8937
|
+
if (tagName[tagName.length - 1] === '/') {
|
|
8938
|
+
//self closing tag without attributes
|
|
8939
|
+
tagName = tagName.substring(0, tagName.length - 1);
|
|
8940
|
+
//continue;
|
|
8941
|
+
i--;
|
|
8942
|
+
}
|
|
8943
|
+
if (!validateTagName(tagName)) {
|
|
8944
|
+
let msg;
|
|
8945
|
+
if (tagName.trim().length === 0) {
|
|
8946
|
+
msg = "Invalid space after '<'.";
|
|
8947
|
+
} else {
|
|
8948
|
+
msg = "Tag '"+tagName+"' is an invalid name.";
|
|
8949
|
+
}
|
|
8950
|
+
return getErrorObject('InvalidTag', msg, getLineNumberForPosition(xmlData, i));
|
|
8951
|
+
}
|
|
8952
|
+
|
|
8953
|
+
const result = readAttributeStr(xmlData, i);
|
|
8954
|
+
if (result === false) {
|
|
8955
|
+
return getErrorObject('InvalidAttr', "Attributes for '"+tagName+"' have open quote.", getLineNumberForPosition(xmlData, i));
|
|
8956
|
+
}
|
|
8957
|
+
let attrStr = result.value;
|
|
8958
|
+
i = result.index;
|
|
8959
|
+
|
|
8960
|
+
if (attrStr[attrStr.length - 1] === '/') {
|
|
8961
|
+
//self closing tag
|
|
8962
|
+
const attrStrStart = i - attrStr.length;
|
|
8963
|
+
attrStr = attrStr.substring(0, attrStr.length - 1);
|
|
8964
|
+
const isValid = validateAttributeString(attrStr, options);
|
|
8965
|
+
if (isValid === true) {
|
|
8966
|
+
tagFound = true;
|
|
8967
|
+
//continue; //text may presents after self closing tag
|
|
8968
|
+
} else {
|
|
8969
|
+
//the result from the nested function returns the position of the error within the attribute
|
|
8970
|
+
//in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
|
|
8971
|
+
//this gives us the absolute index in the entire xml, which we can use to find the line at last
|
|
8972
|
+
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));
|
|
8973
|
+
}
|
|
8974
|
+
} else if (closingTag) {
|
|
8975
|
+
if (!result.tagClosed) {
|
|
8976
|
+
return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
|
|
8977
|
+
} else if (attrStr.trim().length > 0) {
|
|
8978
|
+
return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
|
|
8979
|
+
} else {
|
|
8980
|
+
const otg = tags.pop();
|
|
8981
|
+
if (tagName !== otg.tagName) {
|
|
8982
|
+
let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);
|
|
8983
|
+
return getErrorObject('InvalidTag',
|
|
8984
|
+
"Expected closing tag '"+otg.tagName+"' (opened in line "+openPos.line+", col "+openPos.col+") instead of closing tag '"+tagName+"'.",
|
|
8985
|
+
getLineNumberForPosition(xmlData, tagStartPos));
|
|
8986
|
+
}
|
|
8987
|
+
|
|
8988
|
+
//when there are no more tags, we reached the root level.
|
|
8989
|
+
if (tags.length == 0) {
|
|
8990
|
+
reachedRoot = true;
|
|
8991
|
+
}
|
|
8992
|
+
}
|
|
8993
|
+
} else {
|
|
8994
|
+
const isValid = validateAttributeString(attrStr, options);
|
|
8995
|
+
if (isValid !== true) {
|
|
8996
|
+
//the result from the nested function returns the position of the error within the attribute
|
|
8997
|
+
//in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
|
|
8998
|
+
//this gives us the absolute index in the entire xml, which we can use to find the line at last
|
|
8999
|
+
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));
|
|
9000
|
+
}
|
|
9001
|
+
|
|
9002
|
+
//if the root level has been reached before ...
|
|
9003
|
+
if (reachedRoot === true) {
|
|
9004
|
+
return getErrorObject('InvalidXml', 'Multiple possible root nodes found.', getLineNumberForPosition(xmlData, i));
|
|
9005
|
+
} else {
|
|
9006
|
+
tags.push({tagName, tagStartPos});
|
|
9007
|
+
}
|
|
9008
|
+
tagFound = true;
|
|
9009
|
+
}
|
|
9010
|
+
|
|
9011
|
+
//skip tag text value
|
|
9012
|
+
//It may include comments and CDATA value
|
|
9013
|
+
for (i++; i < xmlData.length; i++) {
|
|
9014
|
+
if (xmlData[i] === '<') {
|
|
9015
|
+
if (xmlData[i + 1] === '!') {
|
|
9016
|
+
//comment or CADATA
|
|
9017
|
+
i++;
|
|
9018
|
+
i = readCommentAndCDATA(xmlData, i);
|
|
9019
|
+
continue;
|
|
9020
|
+
} else if (xmlData[i+1] === '?') {
|
|
9021
|
+
i = readPI(xmlData, ++i);
|
|
9022
|
+
if (i.err) return i;
|
|
9023
|
+
} else {
|
|
9024
|
+
break;
|
|
9025
|
+
}
|
|
9026
|
+
} else if (xmlData[i] === '&') {
|
|
9027
|
+
const afterAmp = validateAmpersand(xmlData, i);
|
|
9028
|
+
if (afterAmp == -1)
|
|
9029
|
+
return getErrorObject('InvalidChar', "char '&' is not expected.", getLineNumberForPosition(xmlData, i));
|
|
9030
|
+
i = afterAmp;
|
|
9031
|
+
}
|
|
9032
|
+
} //end of reading tag text value
|
|
9033
|
+
if (xmlData[i] === '<') {
|
|
9034
|
+
i--;
|
|
9035
|
+
}
|
|
9036
|
+
}
|
|
9037
|
+
} else {
|
|
9038
|
+
if (xmlData[i] === ' ' || xmlData[i] === '\t' || xmlData[i] === '\n' || xmlData[i] === '\r') {
|
|
9039
|
+
continue;
|
|
9040
|
+
}
|
|
9041
|
+
return getErrorObject('InvalidChar', "char '"+xmlData[i]+"' is not expected.", getLineNumberForPosition(xmlData, i));
|
|
9042
|
+
}
|
|
9043
|
+
}
|
|
9044
|
+
|
|
9045
|
+
if (!tagFound) {
|
|
9046
|
+
return getErrorObject('InvalidXml', 'Start tag expected.', 1);
|
|
9047
|
+
}else if (tags.length == 1) {
|
|
9048
|
+
return getErrorObject('InvalidTag', "Unclosed tag '"+tags[0].tagName+"'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos));
|
|
9049
|
+
}else if (tags.length > 0) {
|
|
9050
|
+
return getErrorObject('InvalidXml', "Invalid '"+
|
|
9051
|
+
JSON.stringify(tags.map(t => t.tagName), null, 4).replace(/\r?\n/g, '')+
|
|
9052
|
+
"' found.", {line: 1, col: 1});
|
|
9053
|
+
}
|
|
9054
|
+
|
|
9055
|
+
return true;
|
|
9056
|
+
};
|
|
9057
|
+
|
|
9058
|
+
/**
|
|
9059
|
+
* Read Processing insstructions and skip
|
|
9060
|
+
* @param {*} xmlData
|
|
9061
|
+
* @param {*} i
|
|
9062
|
+
*/
|
|
9063
|
+
function readPI(xmlData, i) {
|
|
9064
|
+
const start = i;
|
|
9065
|
+
for (; i < xmlData.length; i++) {
|
|
9066
|
+
if (xmlData[i] == '?' || xmlData[i] == ' ') {
|
|
9067
|
+
//tagname
|
|
9068
|
+
const tagname = xmlData.substr(start, i - start);
|
|
9069
|
+
if (i > 5 && tagname === 'xml') {
|
|
9070
|
+
return getErrorObject('InvalidXml', 'XML declaration allowed only at the start of the document.', getLineNumberForPosition(xmlData, i));
|
|
9071
|
+
} else if (xmlData[i] == '?' && xmlData[i + 1] == '>') {
|
|
9072
|
+
//check if valid attribut string
|
|
9073
|
+
i++;
|
|
9074
|
+
break;
|
|
9075
|
+
} else {
|
|
9076
|
+
continue;
|
|
9077
|
+
}
|
|
9078
|
+
}
|
|
9079
|
+
}
|
|
9080
|
+
return i;
|
|
9081
|
+
}
|
|
9082
|
+
|
|
9083
|
+
function readCommentAndCDATA(xmlData, i) {
|
|
9084
|
+
if (xmlData.length > i + 5 && xmlData[i + 1] === '-' && xmlData[i + 2] === '-') {
|
|
9085
|
+
//comment
|
|
9086
|
+
for (i += 3; i < xmlData.length; i++) {
|
|
9087
|
+
if (xmlData[i] === '-' && xmlData[i + 1] === '-' && xmlData[i + 2] === '>') {
|
|
9088
|
+
i += 2;
|
|
9089
|
+
break;
|
|
9090
|
+
}
|
|
9091
|
+
}
|
|
9092
|
+
} else if (
|
|
9093
|
+
xmlData.length > i + 8 &&
|
|
9094
|
+
xmlData[i + 1] === 'D' &&
|
|
9095
|
+
xmlData[i + 2] === 'O' &&
|
|
9096
|
+
xmlData[i + 3] === 'C' &&
|
|
9097
|
+
xmlData[i + 4] === 'T' &&
|
|
9098
|
+
xmlData[i + 5] === 'Y' &&
|
|
9099
|
+
xmlData[i + 6] === 'P' &&
|
|
9100
|
+
xmlData[i + 7] === 'E'
|
|
9101
|
+
) {
|
|
9102
|
+
let angleBracketsCount = 1;
|
|
9103
|
+
for (i += 8; i < xmlData.length; i++) {
|
|
9104
|
+
if (xmlData[i] === '<') {
|
|
9105
|
+
angleBracketsCount++;
|
|
9106
|
+
} else if (xmlData[i] === '>') {
|
|
9107
|
+
angleBracketsCount--;
|
|
9108
|
+
if (angleBracketsCount === 0) {
|
|
9109
|
+
break;
|
|
9110
|
+
}
|
|
9111
|
+
}
|
|
9112
|
+
}
|
|
9113
|
+
} else if (
|
|
9114
|
+
xmlData.length > i + 9 &&
|
|
9115
|
+
xmlData[i + 1] === '[' &&
|
|
9116
|
+
xmlData[i + 2] === 'C' &&
|
|
9117
|
+
xmlData[i + 3] === 'D' &&
|
|
9118
|
+
xmlData[i + 4] === 'A' &&
|
|
9119
|
+
xmlData[i + 5] === 'T' &&
|
|
9120
|
+
xmlData[i + 6] === 'A' &&
|
|
9121
|
+
xmlData[i + 7] === '['
|
|
9122
|
+
) {
|
|
9123
|
+
for (i += 8; i < xmlData.length; i++) {
|
|
9124
|
+
if (xmlData[i] === ']' && xmlData[i + 1] === ']' && xmlData[i + 2] === '>') {
|
|
9125
|
+
i += 2;
|
|
9126
|
+
break;
|
|
9127
|
+
}
|
|
9128
|
+
}
|
|
9129
|
+
}
|
|
9130
|
+
|
|
9131
|
+
return i;
|
|
9132
|
+
}
|
|
9133
|
+
|
|
9134
|
+
const doubleQuote = '"';
|
|
9135
|
+
const singleQuote = "'";
|
|
9136
|
+
|
|
9137
|
+
/**
|
|
9138
|
+
* Keep reading xmlData until '<' is found outside the attribute value.
|
|
9139
|
+
* @param {string} xmlData
|
|
9140
|
+
* @param {number} i
|
|
9141
|
+
*/
|
|
9142
|
+
function readAttributeStr(xmlData, i) {
|
|
9143
|
+
let attrStr = '';
|
|
9144
|
+
let startChar = '';
|
|
9145
|
+
let tagClosed = false;
|
|
9146
|
+
for (; i < xmlData.length; i++) {
|
|
9147
|
+
if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {
|
|
9148
|
+
if (startChar === '') {
|
|
9149
|
+
startChar = xmlData[i];
|
|
9150
|
+
} else if (startChar !== xmlData[i]) ; else {
|
|
9151
|
+
startChar = '';
|
|
9152
|
+
}
|
|
9153
|
+
} else if (xmlData[i] === '>') {
|
|
9154
|
+
if (startChar === '') {
|
|
9155
|
+
tagClosed = true;
|
|
9156
|
+
break;
|
|
9157
|
+
}
|
|
9158
|
+
}
|
|
9159
|
+
attrStr += xmlData[i];
|
|
9160
|
+
}
|
|
9161
|
+
if (startChar !== '') {
|
|
9162
|
+
return false;
|
|
9163
|
+
}
|
|
9164
|
+
|
|
9165
|
+
return {
|
|
9166
|
+
value: attrStr,
|
|
9167
|
+
index: i,
|
|
9168
|
+
tagClosed: tagClosed
|
|
9169
|
+
};
|
|
9170
|
+
}
|
|
9171
|
+
|
|
9172
|
+
/**
|
|
9173
|
+
* Select all the attributes whether valid or invalid.
|
|
9174
|
+
*/
|
|
9175
|
+
const validAttrStrRegxp = new RegExp('(\\s*)([^\\s=]+)(\\s*=)?(\\s*([\'"])(([\\s\\S])*?)\\5)?', 'g');
|
|
9176
|
+
|
|
9177
|
+
//attr, ="sd", a="amit's", a="sd"b="saf", ab cd=""
|
|
9178
|
+
|
|
9179
|
+
function validateAttributeString(attrStr, options) {
|
|
9180
|
+
//console.log("start:"+attrStr+":end");
|
|
9181
|
+
|
|
9182
|
+
//if(attrStr.trim().length === 0) return true; //empty string
|
|
9183
|
+
|
|
9184
|
+
const matches = util.getAllMatches(attrStr, validAttrStrRegxp);
|
|
9185
|
+
const attrNames = {};
|
|
9186
|
+
|
|
9187
|
+
for (let i = 0; i < matches.length; i++) {
|
|
9188
|
+
if (matches[i][1].length === 0) {
|
|
9189
|
+
//nospace before attribute name: a="sd"b="saf"
|
|
9190
|
+
return getErrorObject('InvalidAttr', "Attribute '"+matches[i][2]+"' has no space in starting.", getPositionFromMatch(matches[i]))
|
|
9191
|
+
} else if (matches[i][3] === undefined && !options.allowBooleanAttributes) {
|
|
9192
|
+
//independent attribute: ab
|
|
9193
|
+
return getErrorObject('InvalidAttr', "boolean attribute '"+matches[i][2]+"' is not allowed.", getPositionFromMatch(matches[i]));
|
|
9194
|
+
}
|
|
9195
|
+
/* else if(matches[i][6] === undefined){//attribute without value: ab=
|
|
9196
|
+
return { err: { code:"InvalidAttr",msg:"attribute " + matches[i][2] + " has no value assigned."}};
|
|
9197
|
+
} */
|
|
9198
|
+
const attrName = matches[i][2];
|
|
9199
|
+
if (!validateAttrName(attrName)) {
|
|
9200
|
+
return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is an invalid name.", getPositionFromMatch(matches[i]));
|
|
9201
|
+
}
|
|
9202
|
+
if (!attrNames.hasOwnProperty(attrName)) {
|
|
9203
|
+
//check for duplicate attribute.
|
|
9204
|
+
attrNames[attrName] = 1;
|
|
9205
|
+
} else {
|
|
9206
|
+
return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is repeated.", getPositionFromMatch(matches[i]));
|
|
9207
|
+
}
|
|
9208
|
+
}
|
|
9209
|
+
|
|
9210
|
+
return true;
|
|
9211
|
+
}
|
|
9212
|
+
|
|
9213
|
+
function validateNumberAmpersand(xmlData, i) {
|
|
9214
|
+
let re = /\d/;
|
|
9215
|
+
if (xmlData[i] === 'x') {
|
|
9216
|
+
i++;
|
|
9217
|
+
re = /[\da-fA-F]/;
|
|
9218
|
+
}
|
|
9219
|
+
for (; i < xmlData.length; i++) {
|
|
9220
|
+
if (xmlData[i] === ';')
|
|
9221
|
+
return i;
|
|
9222
|
+
if (!xmlData[i].match(re))
|
|
9223
|
+
break;
|
|
9224
|
+
}
|
|
9225
|
+
return -1;
|
|
9226
|
+
}
|
|
9227
|
+
|
|
9228
|
+
function validateAmpersand(xmlData, i) {
|
|
9229
|
+
// https://www.w3.org/TR/xml/#dt-charref
|
|
9230
|
+
i++;
|
|
9231
|
+
if (xmlData[i] === ';')
|
|
9232
|
+
return -1;
|
|
9233
|
+
if (xmlData[i] === '#') {
|
|
9234
|
+
i++;
|
|
9235
|
+
return validateNumberAmpersand(xmlData, i);
|
|
9236
|
+
}
|
|
9237
|
+
let count = 0;
|
|
9238
|
+
for (; i < xmlData.length; i++, count++) {
|
|
9239
|
+
if (xmlData[i].match(/\w/) && count < 20)
|
|
9240
|
+
continue;
|
|
9241
|
+
if (xmlData[i] === ';')
|
|
9242
|
+
break;
|
|
9243
|
+
return -1;
|
|
9244
|
+
}
|
|
9245
|
+
return i;
|
|
9246
|
+
}
|
|
9247
|
+
|
|
9248
|
+
function getErrorObject(code, message, lineNumber) {
|
|
9249
|
+
return {
|
|
9250
|
+
err: {
|
|
9251
|
+
code: code,
|
|
9252
|
+
msg: message,
|
|
9253
|
+
line: lineNumber.line || lineNumber,
|
|
9254
|
+
col: lineNumber.col,
|
|
9255
|
+
},
|
|
9256
|
+
};
|
|
9257
|
+
}
|
|
9258
|
+
|
|
9259
|
+
function validateAttrName(attrName) {
|
|
9260
|
+
return util.isName(attrName);
|
|
9261
|
+
}
|
|
9262
|
+
|
|
9263
|
+
// const startsWithXML = /^xml/i;
|
|
9264
|
+
|
|
9265
|
+
function validateTagName(tagname) {
|
|
9266
|
+
return util.isName(tagname) /* && !tagname.match(startsWithXML) */;
|
|
9267
|
+
}
|
|
9268
|
+
|
|
9269
|
+
//this function returns the line number for the character at the given index
|
|
9270
|
+
function getLineNumberForPosition(xmlData, index) {
|
|
9271
|
+
const lines = xmlData.substring(0, index).split(/\r?\n/);
|
|
9272
|
+
return {
|
|
9273
|
+
line: lines.length,
|
|
9274
|
+
|
|
9275
|
+
// column number is last line's length + 1, because column numbering starts at 1:
|
|
9276
|
+
col: lines[lines.length - 1].length + 1
|
|
9277
|
+
};
|
|
9278
|
+
}
|
|
9279
|
+
|
|
9280
|
+
//this function returns the position of the first character of match within attrStr
|
|
9281
|
+
function getPositionFromMatch(match) {
|
|
9282
|
+
return match.startIndex + match[1].length;
|
|
9283
|
+
}
|
|
9284
|
+
|
|
9285
|
+
var validator = {
|
|
9286
|
+
validate: validate
|
|
9287
|
+
};
|
|
9288
|
+
|
|
9289
|
+
const char = function(a) {
|
|
9290
|
+
return String.fromCharCode(a);
|
|
9291
|
+
};
|
|
9292
|
+
|
|
9293
|
+
const chars = {
|
|
9294
|
+
nilChar: char(176),
|
|
9295
|
+
missingChar: char(201),
|
|
9296
|
+
nilPremitive: char(175),
|
|
9297
|
+
missingPremitive: char(200),
|
|
9298
|
+
|
|
9299
|
+
emptyChar: char(178),
|
|
9300
|
+
emptyValue: char(177), //empty Premitive
|
|
9301
|
+
|
|
9302
|
+
boundryChar: char(179),
|
|
9303
|
+
|
|
9304
|
+
objStart: char(198),
|
|
9305
|
+
arrStart: char(204),
|
|
9306
|
+
arrayEnd: char(185),
|
|
9307
|
+
};
|
|
9308
|
+
|
|
9309
|
+
const charsArr = [
|
|
9310
|
+
chars.nilChar,
|
|
9311
|
+
chars.nilPremitive,
|
|
9312
|
+
chars.missingChar,
|
|
9313
|
+
chars.missingPremitive,
|
|
9314
|
+
chars.boundryChar,
|
|
9315
|
+
chars.emptyChar,
|
|
9316
|
+
chars.emptyValue,
|
|
9317
|
+
chars.arrayEnd,
|
|
9318
|
+
chars.objStart,
|
|
9319
|
+
chars.arrStart,
|
|
9320
|
+
];
|
|
9321
|
+
|
|
9322
|
+
const _e = function(node, e_schema, options) {
|
|
9323
|
+
if (typeof e_schema === 'string') {
|
|
9324
|
+
//premitive
|
|
9325
|
+
if (node && node[0] && node[0].val !== undefined) {
|
|
9326
|
+
return getValue(node[0].val);
|
|
9327
|
+
} else {
|
|
9328
|
+
return getValue(node);
|
|
9329
|
+
}
|
|
9330
|
+
} else {
|
|
9331
|
+
const hasValidData = hasData(node);
|
|
9332
|
+
if (hasValidData === true) {
|
|
9333
|
+
let str = '';
|
|
9334
|
+
if (Array.isArray(e_schema)) {
|
|
9335
|
+
//attributes can't be repeated. hence check in children tags only
|
|
9336
|
+
str += chars.arrStart;
|
|
9337
|
+
const itemSchema = e_schema[0];
|
|
9338
|
+
//const itemSchemaType = itemSchema;
|
|
9339
|
+
const arr_len = node.length;
|
|
9340
|
+
|
|
9341
|
+
if (typeof itemSchema === 'string') {
|
|
9342
|
+
for (let arr_i = 0; arr_i < arr_len; arr_i++) {
|
|
9343
|
+
const r = getValue(node[arr_i].val);
|
|
9344
|
+
str = processValue(str, r);
|
|
9345
|
+
}
|
|
9346
|
+
} else {
|
|
9347
|
+
for (let arr_i = 0; arr_i < arr_len; arr_i++) {
|
|
9348
|
+
const r = _e(node[arr_i], itemSchema, options);
|
|
9349
|
+
str = processValue(str, r);
|
|
9350
|
+
}
|
|
9351
|
+
}
|
|
9352
|
+
str += chars.arrayEnd; //indicates that next item is not array item
|
|
9353
|
+
} else {
|
|
9354
|
+
//object
|
|
9355
|
+
str += chars.objStart;
|
|
9356
|
+
const keys = Object.keys(e_schema);
|
|
9357
|
+
if (Array.isArray(node)) {
|
|
9358
|
+
node = node[0];
|
|
9359
|
+
}
|
|
9360
|
+
for (let i in keys) {
|
|
9361
|
+
const key = keys[i];
|
|
9362
|
+
//a property defined in schema can be present either in attrsMap or children tags
|
|
9363
|
+
//options.textNodeName will not present in both maps, take it's value from val
|
|
9364
|
+
//options.attrNodeName will be present in attrsMap
|
|
9365
|
+
let r;
|
|
9366
|
+
if (!options.ignoreAttributes && node.attrsMap && node.attrsMap[key]) {
|
|
9367
|
+
r = _e(node.attrsMap[key], e_schema[key], options);
|
|
9368
|
+
} else if (key === options.textNodeName) {
|
|
9369
|
+
r = _e(node.val, e_schema[key], options);
|
|
9370
|
+
} else {
|
|
9371
|
+
r = _e(node.child[key], e_schema[key], options);
|
|
9372
|
+
}
|
|
9373
|
+
str = processValue(str, r);
|
|
9374
|
+
}
|
|
9375
|
+
}
|
|
9376
|
+
return str;
|
|
9377
|
+
} else {
|
|
9378
|
+
return hasValidData;
|
|
9379
|
+
}
|
|
9380
|
+
}
|
|
9381
|
+
};
|
|
9382
|
+
|
|
9383
|
+
const getValue = function(a /*, type*/) {
|
|
9384
|
+
switch (a) {
|
|
9385
|
+
case undefined:
|
|
9386
|
+
return chars.missingPremitive;
|
|
9387
|
+
case null:
|
|
9388
|
+
return chars.nilPremitive;
|
|
9389
|
+
case '':
|
|
9390
|
+
return chars.emptyValue;
|
|
9391
|
+
default:
|
|
9392
|
+
return a;
|
|
9393
|
+
}
|
|
9394
|
+
};
|
|
9395
|
+
|
|
9396
|
+
const processValue = function(str, r) {
|
|
9397
|
+
if (!isAppChar(r[0]) && !isAppChar(str[str.length - 1])) {
|
|
9398
|
+
str += chars.boundryChar;
|
|
9399
|
+
}
|
|
9400
|
+
return str + r;
|
|
9401
|
+
};
|
|
9402
|
+
|
|
9403
|
+
const isAppChar = function(ch) {
|
|
9404
|
+
return charsArr.indexOf(ch) !== -1;
|
|
9405
|
+
};
|
|
9406
|
+
|
|
9407
|
+
function hasData(jObj) {
|
|
9408
|
+
if (jObj === undefined) {
|
|
9409
|
+
return chars.missingChar;
|
|
9410
|
+
} else if (jObj === null) {
|
|
9411
|
+
return chars.nilChar;
|
|
9412
|
+
} else if (
|
|
9413
|
+
jObj.child &&
|
|
9414
|
+
Object.keys(jObj.child).length === 0 &&
|
|
9415
|
+
(!jObj.attrsMap || Object.keys(jObj.attrsMap).length === 0)
|
|
9416
|
+
) {
|
|
9417
|
+
return chars.emptyChar;
|
|
9418
|
+
} else {
|
|
9419
|
+
return true;
|
|
9420
|
+
}
|
|
9421
|
+
}
|
|
9422
|
+
|
|
9423
|
+
|
|
9424
|
+
const buildOptions$2 = util.buildOptions;
|
|
9425
|
+
|
|
9426
|
+
const convert2nimn = function(node, e_schema, options) {
|
|
9427
|
+
options = buildOptions$2(options, xmlstr2xmlnode.defaultOptions, xmlstr2xmlnode.props);
|
|
9428
|
+
return _e(node, e_schema, options);
|
|
9429
|
+
};
|
|
9430
|
+
|
|
9431
|
+
var convert2nimn_1 = convert2nimn;
|
|
9432
|
+
|
|
9433
|
+
var nimndata = {
|
|
9434
|
+
convert2nimn: convert2nimn_1
|
|
9435
|
+
};
|
|
9436
|
+
|
|
9437
|
+
const buildOptions$1 = util.buildOptions;
|
|
9438
|
+
|
|
9439
|
+
|
|
9440
|
+
//TODO: do it later
|
|
9441
|
+
const convertToJsonString = function(node, options) {
|
|
9442
|
+
options = buildOptions$1(options, xmlstr2xmlnode.defaultOptions, xmlstr2xmlnode.props);
|
|
9443
|
+
|
|
9444
|
+
options.indentBy = options.indentBy || '';
|
|
9445
|
+
return _cToJsonStr(node, options);
|
|
9446
|
+
};
|
|
9447
|
+
|
|
9448
|
+
const _cToJsonStr = function(node, options, level) {
|
|
9449
|
+
let jObj = '{';
|
|
9450
|
+
|
|
9451
|
+
//traver through all the children
|
|
9452
|
+
const keys = Object.keys(node.child);
|
|
9453
|
+
|
|
9454
|
+
for (let index = 0; index < keys.length; index++) {
|
|
9455
|
+
const tagname = keys[index];
|
|
9456
|
+
if (node.child[tagname] && node.child[tagname].length > 1) {
|
|
9457
|
+
jObj += '"' + tagname + '" : [ ';
|
|
9458
|
+
for (let tag in node.child[tagname]) {
|
|
9459
|
+
jObj += _cToJsonStr(node.child[tagname][tag], options) + ' , ';
|
|
9460
|
+
}
|
|
9461
|
+
jObj = jObj.substr(0, jObj.length - 1) + ' ] '; //remove extra comma in last
|
|
9462
|
+
} else {
|
|
9463
|
+
jObj += '"' + tagname + '" : ' + _cToJsonStr(node.child[tagname][0], options) + ' ,';
|
|
9464
|
+
}
|
|
9465
|
+
}
|
|
9466
|
+
util.merge(jObj, node.attrsMap);
|
|
9467
|
+
//add attrsMap as new children
|
|
9468
|
+
if (util.isEmptyObject(jObj)) {
|
|
9469
|
+
return util.isExist(node.val) ? node.val : '';
|
|
9470
|
+
} else {
|
|
9471
|
+
if (util.isExist(node.val)) {
|
|
9472
|
+
if (!(typeof node.val === 'string' && (node.val === '' || node.val === options.cdataPositionChar))) {
|
|
9473
|
+
jObj += '"' + options.textNodeName + '" : ' + stringval(node.val);
|
|
9474
|
+
}
|
|
9475
|
+
}
|
|
9476
|
+
}
|
|
9477
|
+
//add value
|
|
9478
|
+
if (jObj[jObj.length - 1] === ',') {
|
|
9479
|
+
jObj = jObj.substr(0, jObj.length - 2);
|
|
9480
|
+
}
|
|
9481
|
+
return jObj + '}';
|
|
9482
|
+
};
|
|
9483
|
+
|
|
9484
|
+
function stringval(v) {
|
|
9485
|
+
if (v === true || v === false || !isNaN(v)) {
|
|
9486
|
+
return v;
|
|
9487
|
+
} else {
|
|
9488
|
+
return '"' + v + '"';
|
|
9489
|
+
}
|
|
9490
|
+
}
|
|
9491
|
+
|
|
9492
|
+
var convertToJsonString_1 = convertToJsonString;
|
|
9493
|
+
|
|
9494
|
+
var node2json_str = {
|
|
9495
|
+
convertToJsonString: convertToJsonString_1
|
|
9496
|
+
};
|
|
9497
|
+
|
|
9498
|
+
//parse Empty Node as self closing node
|
|
9499
|
+
const buildOptions = util.buildOptions;
|
|
9500
|
+
|
|
9501
|
+
const defaultOptions = {
|
|
9502
|
+
attributeNamePrefix: '@_',
|
|
9503
|
+
attrNodeName: false,
|
|
9504
|
+
textNodeName: '#text',
|
|
9505
|
+
ignoreAttributes: true,
|
|
9506
|
+
cdataTagName: false,
|
|
9507
|
+
cdataPositionChar: '\\c',
|
|
9508
|
+
format: false,
|
|
9509
|
+
indentBy: ' ',
|
|
9510
|
+
supressEmptyNode: false,
|
|
9511
|
+
tagValueProcessor: function(a) {
|
|
9512
|
+
return a;
|
|
9513
|
+
},
|
|
9514
|
+
attrValueProcessor: function(a) {
|
|
9515
|
+
return a;
|
|
9516
|
+
},
|
|
9517
|
+
};
|
|
9518
|
+
|
|
9519
|
+
const props = [
|
|
9520
|
+
'attributeNamePrefix',
|
|
9521
|
+
'attrNodeName',
|
|
9522
|
+
'textNodeName',
|
|
9523
|
+
'ignoreAttributes',
|
|
9524
|
+
'cdataTagName',
|
|
9525
|
+
'cdataPositionChar',
|
|
9526
|
+
'format',
|
|
9527
|
+
'indentBy',
|
|
9528
|
+
'supressEmptyNode',
|
|
9529
|
+
'tagValueProcessor',
|
|
9530
|
+
'attrValueProcessor',
|
|
9531
|
+
'rootNodeName', //when array as root
|
|
9532
|
+
];
|
|
9533
|
+
|
|
9534
|
+
function Parser(options) {
|
|
9535
|
+
this.options = buildOptions(options, defaultOptions, props);
|
|
9536
|
+
if (this.options.ignoreAttributes || this.options.attrNodeName) {
|
|
9537
|
+
this.isAttribute = function(/*a*/) {
|
|
9538
|
+
return false;
|
|
9539
|
+
};
|
|
9540
|
+
} else {
|
|
9541
|
+
this.attrPrefixLen = this.options.attributeNamePrefix.length;
|
|
9542
|
+
this.isAttribute = isAttribute;
|
|
9543
|
+
}
|
|
9544
|
+
if (this.options.cdataTagName) {
|
|
9545
|
+
this.isCDATA = isCDATA;
|
|
9546
|
+
} else {
|
|
9547
|
+
this.isCDATA = function(/*a*/) {
|
|
9548
|
+
return false;
|
|
9549
|
+
};
|
|
9550
|
+
}
|
|
9551
|
+
this.replaceCDATAstr = replaceCDATAstr;
|
|
9552
|
+
this.replaceCDATAarr = replaceCDATAarr;
|
|
9553
|
+
|
|
9554
|
+
this.processTextOrObjNode = processTextOrObjNode;
|
|
9555
|
+
|
|
9556
|
+
if (this.options.format) {
|
|
9557
|
+
this.indentate = indentate;
|
|
9558
|
+
this.tagEndChar = '>\n';
|
|
9559
|
+
this.newLine = '\n';
|
|
9560
|
+
} else {
|
|
9561
|
+
this.indentate = function() {
|
|
9562
|
+
return '';
|
|
9563
|
+
};
|
|
9564
|
+
this.tagEndChar = '>';
|
|
9565
|
+
this.newLine = '';
|
|
9566
|
+
}
|
|
9567
|
+
|
|
9568
|
+
if (this.options.supressEmptyNode) {
|
|
9569
|
+
this.buildTextNode = buildEmptyTextNode;
|
|
9570
|
+
this.buildObjNode = buildEmptyObjNode;
|
|
9571
|
+
} else {
|
|
9572
|
+
this.buildTextNode = buildTextValNode;
|
|
9573
|
+
this.buildObjNode = buildObjectNode;
|
|
9574
|
+
}
|
|
9575
|
+
|
|
9576
|
+
this.buildTextValNode = buildTextValNode;
|
|
9577
|
+
this.buildObjectNode = buildObjectNode;
|
|
9578
|
+
}
|
|
9579
|
+
|
|
9580
|
+
Parser.prototype.parse = function(jObj) {
|
|
9581
|
+
if(Array.isArray(jObj) && this.options.rootNodeName && this.options.rootNodeName.length > 1){
|
|
9582
|
+
jObj = {
|
|
9583
|
+
[this.options.rootNodeName] : jObj
|
|
9584
|
+
};
|
|
9585
|
+
}
|
|
9586
|
+
return this.j2x(jObj, 0).val;
|
|
8707
9587
|
};
|
|
8708
9588
|
|
|
8709
|
-
|
|
9589
|
+
Parser.prototype.j2x = function(jObj, level) {
|
|
9590
|
+
let attrStr = '';
|
|
9591
|
+
let val = '';
|
|
9592
|
+
for (let key in jObj) {
|
|
9593
|
+
if (typeof jObj[key] === 'undefined') ; else if (jObj[key] === null) {
|
|
9594
|
+
val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
|
9595
|
+
} else if (jObj[key] instanceof Date) {
|
|
9596
|
+
val += this.buildTextNode(jObj[key], key, '', level);
|
|
9597
|
+
} else if (typeof jObj[key] !== 'object') {
|
|
9598
|
+
//premitive type
|
|
9599
|
+
const attr = this.isAttribute(key);
|
|
9600
|
+
if (attr) {
|
|
9601
|
+
attrStr += ' ' + attr + '="' + this.options.attrValueProcessor('' + jObj[key]) + '"';
|
|
9602
|
+
} else if (this.isCDATA(key)) {
|
|
9603
|
+
if (jObj[this.options.textNodeName]) {
|
|
9604
|
+
val += this.replaceCDATAstr(jObj[this.options.textNodeName], jObj[key]);
|
|
9605
|
+
} else {
|
|
9606
|
+
val += this.replaceCDATAstr('', jObj[key]);
|
|
9607
|
+
}
|
|
9608
|
+
} else {
|
|
9609
|
+
//tag value
|
|
9610
|
+
if (key === this.options.textNodeName) {
|
|
9611
|
+
if (jObj[this.options.cdataTagName]) ; else {
|
|
9612
|
+
val += this.options.tagValueProcessor('' + jObj[key]);
|
|
9613
|
+
}
|
|
9614
|
+
} else {
|
|
9615
|
+
val += this.buildTextNode(jObj[key], key, '', level);
|
|
9616
|
+
}
|
|
9617
|
+
}
|
|
9618
|
+
} else if (Array.isArray(jObj[key])) {
|
|
9619
|
+
//repeated nodes
|
|
9620
|
+
if (this.isCDATA(key)) {
|
|
9621
|
+
val += this.indentate(level);
|
|
9622
|
+
if (jObj[this.options.textNodeName]) {
|
|
9623
|
+
val += this.replaceCDATAarr(jObj[this.options.textNodeName], jObj[key]);
|
|
9624
|
+
} else {
|
|
9625
|
+
val += this.replaceCDATAarr('', jObj[key]);
|
|
9626
|
+
}
|
|
9627
|
+
} else {
|
|
9628
|
+
//nested nodes
|
|
9629
|
+
const arrLen = jObj[key].length;
|
|
9630
|
+
for (let j = 0; j < arrLen; j++) {
|
|
9631
|
+
const item = jObj[key][j];
|
|
9632
|
+
if (typeof item === 'undefined') ; else if (item === null) {
|
|
9633
|
+
val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
|
9634
|
+
} else if (typeof item === 'object') {
|
|
9635
|
+
val += this.processTextOrObjNode(item, key, level);
|
|
9636
|
+
} else {
|
|
9637
|
+
val += this.buildTextNode(item, key, '', level);
|
|
9638
|
+
}
|
|
9639
|
+
}
|
|
9640
|
+
}
|
|
9641
|
+
} else {
|
|
9642
|
+
//nested node
|
|
9643
|
+
if (this.options.attrNodeName && key === this.options.attrNodeName) {
|
|
9644
|
+
const Ks = Object.keys(jObj[key]);
|
|
9645
|
+
const L = Ks.length;
|
|
9646
|
+
for (let j = 0; j < L; j++) {
|
|
9647
|
+
attrStr += ' ' + Ks[j] + '="' + this.options.attrValueProcessor('' + jObj[key][Ks[j]]) + '"';
|
|
9648
|
+
}
|
|
9649
|
+
} else {
|
|
9650
|
+
val += this.processTextOrObjNode(jObj[key], key, level);
|
|
9651
|
+
}
|
|
9652
|
+
}
|
|
9653
|
+
}
|
|
9654
|
+
return {attrStr: attrStr, val: val};
|
|
9655
|
+
};
|
|
9656
|
+
|
|
9657
|
+
function processTextOrObjNode (object, key, level) {
|
|
9658
|
+
const result = this.j2x(object, level + 1);
|
|
9659
|
+
if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) {
|
|
9660
|
+
return this.buildTextNode(result.val, key, result.attrStr, level);
|
|
9661
|
+
} else {
|
|
9662
|
+
return this.buildObjNode(result.val, key, result.attrStr, level);
|
|
9663
|
+
}
|
|
9664
|
+
}
|
|
9665
|
+
|
|
9666
|
+
function replaceCDATAstr(str, cdata) {
|
|
9667
|
+
str = this.options.tagValueProcessor('' + str);
|
|
9668
|
+
if (this.options.cdataPositionChar === '' || str === '') {
|
|
9669
|
+
return str + '<![CDATA[' + cdata + ']]' + this.tagEndChar;
|
|
9670
|
+
} else {
|
|
9671
|
+
return str.replace(this.options.cdataPositionChar, '<![CDATA[' + cdata + ']]' + this.tagEndChar);
|
|
9672
|
+
}
|
|
9673
|
+
}
|
|
9674
|
+
|
|
9675
|
+
function replaceCDATAarr(str, cdata) {
|
|
9676
|
+
str = this.options.tagValueProcessor('' + str);
|
|
9677
|
+
if (this.options.cdataPositionChar === '' || str === '') {
|
|
9678
|
+
return str + '<![CDATA[' + cdata.join(']]><![CDATA[') + ']]' + this.tagEndChar;
|
|
9679
|
+
} else {
|
|
9680
|
+
for (let v in cdata) {
|
|
9681
|
+
str = str.replace(this.options.cdataPositionChar, '<![CDATA[' + cdata[v] + ']]>');
|
|
9682
|
+
}
|
|
9683
|
+
return str + this.newLine;
|
|
9684
|
+
}
|
|
9685
|
+
}
|
|
9686
|
+
|
|
9687
|
+
function buildObjectNode(val, key, attrStr, level) {
|
|
9688
|
+
if (attrStr && val.indexOf('<') === -1) {
|
|
9689
|
+
return (
|
|
9690
|
+
this.indentate(level) +
|
|
9691
|
+
'<' +
|
|
9692
|
+
key +
|
|
9693
|
+
attrStr +
|
|
9694
|
+
'>' +
|
|
9695
|
+
val +
|
|
9696
|
+
//+ this.newLine
|
|
9697
|
+
// + this.indentate(level)
|
|
9698
|
+
'</' +
|
|
9699
|
+
key +
|
|
9700
|
+
this.tagEndChar
|
|
9701
|
+
);
|
|
9702
|
+
} else {
|
|
9703
|
+
return (
|
|
9704
|
+
this.indentate(level) +
|
|
9705
|
+
'<' +
|
|
9706
|
+
key +
|
|
9707
|
+
attrStr +
|
|
9708
|
+
this.tagEndChar +
|
|
9709
|
+
val +
|
|
9710
|
+
//+ this.newLine
|
|
9711
|
+
this.indentate(level) +
|
|
9712
|
+
'</' +
|
|
9713
|
+
key +
|
|
9714
|
+
this.tagEndChar
|
|
9715
|
+
);
|
|
9716
|
+
}
|
|
9717
|
+
}
|
|
9718
|
+
|
|
9719
|
+
function buildEmptyObjNode(val, key, attrStr, level) {
|
|
9720
|
+
if (val !== '') {
|
|
9721
|
+
return this.buildObjectNode(val, key, attrStr, level);
|
|
9722
|
+
} else {
|
|
9723
|
+
return this.indentate(level) + '<' + key + attrStr + '/' + this.tagEndChar;
|
|
9724
|
+
//+ this.newLine
|
|
9725
|
+
}
|
|
9726
|
+
}
|
|
9727
|
+
|
|
9728
|
+
function buildTextValNode(val, key, attrStr, level) {
|
|
9729
|
+
return (
|
|
9730
|
+
this.indentate(level) +
|
|
9731
|
+
'<' +
|
|
9732
|
+
key +
|
|
9733
|
+
attrStr +
|
|
9734
|
+
'>' +
|
|
9735
|
+
this.options.tagValueProcessor(val) +
|
|
9736
|
+
'</' +
|
|
9737
|
+
key +
|
|
9738
|
+
this.tagEndChar
|
|
9739
|
+
);
|
|
9740
|
+
}
|
|
9741
|
+
|
|
9742
|
+
function buildEmptyTextNode(val, key, attrStr, level) {
|
|
9743
|
+
if (val !== '') {
|
|
9744
|
+
return this.buildTextValNode(val, key, attrStr, level);
|
|
9745
|
+
} else {
|
|
9746
|
+
return this.indentate(level) + '<' + key + attrStr + '/' + this.tagEndChar;
|
|
9747
|
+
}
|
|
9748
|
+
}
|
|
9749
|
+
|
|
9750
|
+
function indentate(level) {
|
|
9751
|
+
return this.options.indentBy.repeat(level);
|
|
9752
|
+
}
|
|
9753
|
+
|
|
9754
|
+
function isAttribute(name /*, options*/) {
|
|
9755
|
+
if (name.startsWith(this.options.attributeNamePrefix)) {
|
|
9756
|
+
return name.substr(this.attrPrefixLen);
|
|
9757
|
+
} else {
|
|
9758
|
+
return false;
|
|
9759
|
+
}
|
|
9760
|
+
}
|
|
9761
|
+
|
|
9762
|
+
function isCDATA(name) {
|
|
9763
|
+
return name === this.options.cdataTagName;
|
|
9764
|
+
}
|
|
9765
|
+
|
|
9766
|
+
//formatting
|
|
9767
|
+
//indentation
|
|
9768
|
+
//\n after each closing or self closing tag
|
|
9769
|
+
|
|
9770
|
+
var json2xml = Parser;
|
|
9771
|
+
|
|
9772
|
+
var parser = createCommonjsModule(function (module, exports) {
|
|
9773
|
+
|
|
9774
|
+
|
|
9775
|
+
|
|
9776
|
+
const x2xmlnode = xmlstr2xmlnode;
|
|
9777
|
+
const buildOptions = util.buildOptions;
|
|
9778
|
+
|
|
9779
|
+
|
|
9780
|
+
exports.parse = function(xmlData, givenOptions = {}, validationOption) {
|
|
9781
|
+
if( validationOption){
|
|
9782
|
+
if(validationOption === true) validationOption = {};
|
|
9783
|
+
|
|
9784
|
+
const result = validator.validate(xmlData, validationOption);
|
|
9785
|
+
if (result !== true) {
|
|
9786
|
+
throw Error( result.err.msg)
|
|
9787
|
+
}
|
|
9788
|
+
}
|
|
9789
|
+
if(givenOptions.parseTrueNumberOnly
|
|
9790
|
+
&& givenOptions.parseNodeValue !== false
|
|
9791
|
+
&& !givenOptions.numParseOptions){
|
|
9792
|
+
|
|
9793
|
+
givenOptions.numParseOptions = {
|
|
9794
|
+
leadingZeros: false,
|
|
9795
|
+
};
|
|
9796
|
+
}
|
|
9797
|
+
let options = buildOptions(givenOptions, x2xmlnode.defaultOptions, x2xmlnode.props);
|
|
9798
|
+
|
|
9799
|
+
const traversableObj = xmlstr2xmlnode.getTraversalObj(xmlData, options);
|
|
9800
|
+
//print(traversableObj, " ");
|
|
9801
|
+
return node2json.convertToJson(traversableObj, options);
|
|
9802
|
+
};
|
|
9803
|
+
exports.convertTonimn = nimndata.convert2nimn;
|
|
9804
|
+
exports.getTraversalObj = xmlstr2xmlnode.getTraversalObj;
|
|
9805
|
+
exports.convertToJson = node2json.convertToJson;
|
|
9806
|
+
exports.convertToJsonString = node2json_str.convertToJsonString;
|
|
9807
|
+
exports.validate = validator.validate;
|
|
9808
|
+
exports.j2xParser = json2xml;
|
|
9809
|
+
exports.parseToNimn = function(xmlData, schema, options) {
|
|
9810
|
+
return exports.convertTonimn(exports.getTraversalObj(xmlData, options), schema, options);
|
|
9811
|
+
};
|
|
9812
|
+
});
|
|
8710
9813
|
|
|
8711
9814
|
function parseMetadataXml(metadataXml) {
|
|
8712
9815
|
var opts = {
|
|
@@ -8715,7 +9818,7 @@
|
|
|
8715
9818
|
attributeNamePrefix: "@_",
|
|
8716
9819
|
textNodeName: "#value",
|
|
8717
9820
|
};
|
|
8718
|
-
return parse(metadataXml, opts);
|
|
9821
|
+
return parser.parse(metadataXml, opts);
|
|
8719
9822
|
}
|
|
8720
9823
|
/**
|
|
8721
9824
|
* Fetch an [item's metadata](https://doc.arcgis.com/en/arcgis-online/manage-data/metadata.htm) from a portal
|
|
@@ -11603,6 +12706,218 @@
|
|
|
11603
12706
|
return request(url, options);
|
|
11604
12707
|
}
|
|
11605
12708
|
|
|
12709
|
+
/**
|
|
12710
|
+
* Takes a file, file owner, and file AGO item id along with a size limit
|
|
12711
|
+
* Then chunks the file up based on that file limit.
|
|
12712
|
+
* The chunks are added to addItemPart calls and added to a queue array.
|
|
12713
|
+
*
|
|
12714
|
+
* @export
|
|
12715
|
+
* @param {*} file File to be uploaded
|
|
12716
|
+
* @param {string} owner file owner
|
|
12717
|
+
* @param {string} id file ID from AGO
|
|
12718
|
+
* @param {number} sizeLimit How large should the chunks be?
|
|
12719
|
+
* @param {IUserRequestOptions} requestOptions
|
|
12720
|
+
* @return {*} {IBatch}
|
|
12721
|
+
*/
|
|
12722
|
+
function _prepareUploadRequests(file, owner, id, sizeLimit, requestOptions) {
|
|
12723
|
+
var queue = [];
|
|
12724
|
+
// part number starts from 1
|
|
12725
|
+
var partIndex = 1;
|
|
12726
|
+
var sizeIndex = 0;
|
|
12727
|
+
// Slice the file data and create an upload request for each part
|
|
12728
|
+
while (sizeIndex < file.size) {
|
|
12729
|
+
queue.push(__assign({ file: file.slice(sizeIndex, sizeIndex + sizeLimit, file.type), owner: owner,
|
|
12730
|
+
id: id, partNum: partIndex }, requestOptions));
|
|
12731
|
+
partIndex += 1;
|
|
12732
|
+
sizeIndex += sizeLimit;
|
|
12733
|
+
}
|
|
12734
|
+
return queue.reverse();
|
|
12735
|
+
}
|
|
12736
|
+
|
|
12737
|
+
/**
|
|
12738
|
+
* Creates an item in online from a local file/item.
|
|
12739
|
+
* Upload is multithreaded as the item is chunked up.
|
|
12740
|
+
*
|
|
12741
|
+
* @export
|
|
12742
|
+
* @param {IItemAdd} item Item to be uploaded into online.
|
|
12743
|
+
* @param {IUserRequestOptions} requestOptions
|
|
12744
|
+
* @return {*} {Promise<string>} Newly created item id
|
|
12745
|
+
*/
|
|
12746
|
+
function createItemFromFile(item, requestOptions) {
|
|
12747
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12748
|
+
var file, createResult, itemId, sizeLimit, uploadQueue, e_1;
|
|
12749
|
+
var _this = this;
|
|
12750
|
+
return __generator(this, function (_a) {
|
|
12751
|
+
switch (_a.label) {
|
|
12752
|
+
case 0:
|
|
12753
|
+
file = item.file;
|
|
12754
|
+
// make a shadow copy of the item parameter and remove the file object
|
|
12755
|
+
// so that it won't trigger the direct upload at the createContent
|
|
12756
|
+
// request
|
|
12757
|
+
item = Object.assign({}, item);
|
|
12758
|
+
delete item.file;
|
|
12759
|
+
return [4 /*yield*/, createItem(__assign({ item: item, filename: file.name, async: true, multipart: true, overwrite: true }, requestOptions))];
|
|
12760
|
+
case 1:
|
|
12761
|
+
createResult = _a.sent();
|
|
12762
|
+
itemId = createResult.id;
|
|
12763
|
+
_a.label = 2;
|
|
12764
|
+
case 2:
|
|
12765
|
+
_a.trys.push([2, 5, , 7]);
|
|
12766
|
+
sizeLimit = 6 * 1000 * 1000;
|
|
12767
|
+
uploadQueue = _prepareUploadRequests(file, item.owner, itemId, sizeLimit, requestOptions);
|
|
12768
|
+
// execute up to 5 concurrent requests
|
|
12769
|
+
return [4 /*yield*/, batch(uploadQueue,
|
|
12770
|
+
// We are doing this to catch individual response failures
|
|
12771
|
+
// and throwing them to stop further xhr's
|
|
12772
|
+
function (opts) { return __awaiter(_this, void 0, void 0, function () {
|
|
12773
|
+
var resp;
|
|
12774
|
+
return __generator(this, function (_a) {
|
|
12775
|
+
switch (_a.label) {
|
|
12776
|
+
case 0: return [4 /*yield*/, addItemPart(opts)];
|
|
12777
|
+
case 1:
|
|
12778
|
+
resp = _a.sent();
|
|
12779
|
+
// If the response did not return with success then throw an error
|
|
12780
|
+
if (!resp.success) {
|
|
12781
|
+
throw new Error("addItemPart failed");
|
|
12782
|
+
}
|
|
12783
|
+
return [2 /*return*/];
|
|
12784
|
+
}
|
|
12785
|
+
});
|
|
12786
|
+
}); }, 5)];
|
|
12787
|
+
case 3:
|
|
12788
|
+
// execute up to 5 concurrent requests
|
|
12789
|
+
_a.sent();
|
|
12790
|
+
// Commit is called once all parts are uploaded during a multipart add item or update item operation.
|
|
12791
|
+
return [4 /*yield*/, commitItemUpload(__assign({ id: itemId, item: item, owner: item.owner }, requestOptions))];
|
|
12792
|
+
case 4:
|
|
12793
|
+
// Commit is called once all parts are uploaded during a multipart add item or update item operation.
|
|
12794
|
+
_a.sent();
|
|
12795
|
+
return [3 /*break*/, 7];
|
|
12796
|
+
case 5:
|
|
12797
|
+
e_1 = _a.sent();
|
|
12798
|
+
// If an error is thrown then cancel item upload
|
|
12799
|
+
return [4 /*yield*/, cancelItemUpload(__assign({ id: itemId, owner: item.owner }, requestOptions))];
|
|
12800
|
+
case 6:
|
|
12801
|
+
// If an error is thrown then cancel item upload
|
|
12802
|
+
_a.sent();
|
|
12803
|
+
throw e_1;
|
|
12804
|
+
case 7: return [2 /*return*/, createResult];
|
|
12805
|
+
}
|
|
12806
|
+
});
|
|
12807
|
+
});
|
|
12808
|
+
}
|
|
12809
|
+
|
|
12810
|
+
/**
|
|
12811
|
+
* Create AGO item from a URL
|
|
12812
|
+
*
|
|
12813
|
+
* @export
|
|
12814
|
+
* @param {IItemAdd} item Item to be uploaded into online.
|
|
12815
|
+
* @param {IUserRequestOptions} requestOptions
|
|
12816
|
+
* @return {*} {Promise<string>} Newly created item ID
|
|
12817
|
+
*/
|
|
12818
|
+
function createItemFromUrl(item, requestOptions) {
|
|
12819
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12820
|
+
var createResult;
|
|
12821
|
+
return __generator(this, function (_a) {
|
|
12822
|
+
switch (_a.label) {
|
|
12823
|
+
case 0: return [4 /*yield*/, createItem(__assign({ item: item, owner: item.owner, file: item.file, dataUrl: item.dataUrl, text: item.text, multipart: item.multipart, async: item.async }, requestOptions))];
|
|
12824
|
+
case 1:
|
|
12825
|
+
createResult = _a.sent();
|
|
12826
|
+
// return the newly created item id
|
|
12827
|
+
return [2 /*return*/, createResult];
|
|
12828
|
+
}
|
|
12829
|
+
});
|
|
12830
|
+
});
|
|
12831
|
+
}
|
|
12832
|
+
|
|
12833
|
+
function delay(milliseconds) {
|
|
12834
|
+
return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
|
|
12835
|
+
}
|
|
12836
|
+
/**
|
|
12837
|
+
* Helper function which takes an itemId and checks the status
|
|
12838
|
+
* of the item every 2 seconds until it is either complete or failed.
|
|
12839
|
+
*
|
|
12840
|
+
* @export
|
|
12841
|
+
* @param {string} itemId AGO item id
|
|
12842
|
+
* @param {IUserRequestOptions} requestOptions
|
|
12843
|
+
*/
|
|
12844
|
+
function _waitForItemReady(itemId, requestOptions) {
|
|
12845
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12846
|
+
var statusResult;
|
|
12847
|
+
return __generator(this, function (_a) {
|
|
12848
|
+
switch (_a.label) {
|
|
12849
|
+
case 0: return [4 /*yield*/, delay(2000)];
|
|
12850
|
+
case 1:
|
|
12851
|
+
_a.sent();
|
|
12852
|
+
return [4 /*yield*/, getItemStatus(__assign({ id: itemId }, requestOptions))];
|
|
12853
|
+
case 2:
|
|
12854
|
+
statusResult = _a.sent();
|
|
12855
|
+
if (statusResult.status === "failed") {
|
|
12856
|
+
throw new Error(statusResult.statusMessage);
|
|
12857
|
+
}
|
|
12858
|
+
_a.label = 3;
|
|
12859
|
+
case 3:
|
|
12860
|
+
if (statusResult.status !== "completed") return [3 /*break*/, 0];
|
|
12861
|
+
_a.label = 4;
|
|
12862
|
+
case 4: return [2 /*return*/];
|
|
12863
|
+
}
|
|
12864
|
+
});
|
|
12865
|
+
});
|
|
12866
|
+
}
|
|
12867
|
+
|
|
12868
|
+
/**
|
|
12869
|
+
* Creates an item in online from either url or file.
|
|
12870
|
+
* Once created we wait for the item to be ready (or throw an error if creation failed)
|
|
12871
|
+
* If access is not private then we make a call to update that.
|
|
12872
|
+
*
|
|
12873
|
+
* @export
|
|
12874
|
+
* @param {ICreateItemFromUrlOrFileOptions} createItemFromUrlOrFileOptions Input params (item, groups?, requestoptions)
|
|
12875
|
+
* @return {*} {Promise<string>} AGO item id
|
|
12876
|
+
*/
|
|
12877
|
+
function createItemFromUrlOrFile(createItemFromUrlOrFileOptions) {
|
|
12878
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12879
|
+
var item, groups, userRequestOptions, shouldWaitForItemReady, createdItem, failSafeShare_1;
|
|
12880
|
+
return __generator(this, function (_a) {
|
|
12881
|
+
switch (_a.label) {
|
|
12882
|
+
case 0:
|
|
12883
|
+
item = createItemFromUrlOrFileOptions.item, groups = createItemFromUrlOrFileOptions.groups, userRequestOptions = __rest(createItemFromUrlOrFileOptions, ["item", "groups"]);
|
|
12884
|
+
shouldWaitForItemReady = item.dataUrl || item.file;
|
|
12885
|
+
if (!item.file) return [3 /*break*/, 2];
|
|
12886
|
+
return [4 /*yield*/, createItemFromFile(item, userRequestOptions)];
|
|
12887
|
+
case 1:
|
|
12888
|
+
createdItem = _a.sent();
|
|
12889
|
+
return [3 /*break*/, 4];
|
|
12890
|
+
case 2: return [4 /*yield*/, createItemFromUrl(item, userRequestOptions)];
|
|
12891
|
+
case 3:
|
|
12892
|
+
createdItem = _a.sent();
|
|
12893
|
+
_a.label = 4;
|
|
12894
|
+
case 4:
|
|
12895
|
+
if (!shouldWaitForItemReady) return [3 /*break*/, 6];
|
|
12896
|
+
return [4 /*yield*/, _waitForItemReady(createdItem.id, userRequestOptions)];
|
|
12897
|
+
case 5:
|
|
12898
|
+
_a.sent();
|
|
12899
|
+
_a.label = 6;
|
|
12900
|
+
case 6:
|
|
12901
|
+
if (!(item.access !== "private")) return [3 /*break*/, 8];
|
|
12902
|
+
return [4 /*yield*/, setItemAccess(__assign({ id: createdItem.id, owner: item.owner, access: item.access }, userRequestOptions))];
|
|
12903
|
+
case 7:
|
|
12904
|
+
_a.sent();
|
|
12905
|
+
_a.label = 8;
|
|
12906
|
+
case 8:
|
|
12907
|
+
if (!(groups === null || groups === void 0 ? void 0 : groups.length)) return [3 /*break*/, 10];
|
|
12908
|
+
failSafeShare_1 = failSafe(shareItemWithGroup);
|
|
12909
|
+
return [4 /*yield*/, Promise.all(groups.map(function (group) {
|
|
12910
|
+
return failSafeShare_1(__assign({ id: createdItem.id, owner: item.owner, groupId: group.id, confirmItemControl: isUpdateGroup(group) }, userRequestOptions));
|
|
12911
|
+
}))];
|
|
12912
|
+
case 9:
|
|
12913
|
+
_a.sent();
|
|
12914
|
+
_a.label = 10;
|
|
12915
|
+
case 10: return [2 /*return*/, createdItem];
|
|
12916
|
+
}
|
|
12917
|
+
});
|
|
12918
|
+
});
|
|
12919
|
+
}
|
|
12920
|
+
|
|
11606
12921
|
/* Copyright (c) 2018-2021 Environmental Systems Research Institute, Inc.
|
|
11607
12922
|
* Apache-2.0 */
|
|
11608
12923
|
/**
|
|
@@ -17145,6 +18460,9 @@
|
|
|
17145
18460
|
exports.convertUrlsToAnchorTags = convertUrlsToAnchorTags;
|
|
17146
18461
|
exports.createExtent = createExtent;
|
|
17147
18462
|
exports.createId = createId;
|
|
18463
|
+
exports.createItemFromFile = createItemFromFile;
|
|
18464
|
+
exports.createItemFromUrl = createItemFromUrl;
|
|
18465
|
+
exports.createItemFromUrlOrFile = createItemFromUrlOrFile;
|
|
17148
18466
|
exports.createModel = createModel;
|
|
17149
18467
|
exports.createOperationPipeline = createOperationPipeline;
|
|
17150
18468
|
exports.createProject = createProject;
|