@alan-ai/alan-sdk-web 1.8.139 → 1.8.141
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/alan_lib.js +1516 -503
- package/dist/alan_lib.min.js +1 -1
- package/package.json +1 -1
package/dist/alan_lib.js
CHANGED
|
@@ -6896,8 +6896,8 @@
|
|
|
6896
6896
|
this.options = options !== null && options !== void 0 ? options : defaultOpts;
|
|
6897
6897
|
this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null;
|
|
6898
6898
|
}
|
|
6899
|
-
onparserinit(
|
|
6900
|
-
this.parser =
|
|
6899
|
+
onparserinit(parser) {
|
|
6900
|
+
this.parser = parser;
|
|
6901
6901
|
}
|
|
6902
6902
|
// Resets the handler back to starting state
|
|
6903
6903
|
onreset() {
|
|
@@ -7080,17 +7080,17 @@
|
|
|
7080
7080
|
});
|
|
7081
7081
|
|
|
7082
7082
|
// node_modules/entities/lib/esm/decode.js
|
|
7083
|
-
function isNumber(
|
|
7084
|
-
return
|
|
7083
|
+
function isNumber(code) {
|
|
7084
|
+
return code >= CharCodes.ZERO && code <= CharCodes.NINE;
|
|
7085
7085
|
}
|
|
7086
|
-
function isHexadecimalCharacter(
|
|
7087
|
-
return
|
|
7086
|
+
function isHexadecimalCharacter(code) {
|
|
7087
|
+
return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F;
|
|
7088
7088
|
}
|
|
7089
|
-
function isAsciiAlphaNumeric(
|
|
7090
|
-
return
|
|
7089
|
+
function isAsciiAlphaNumeric(code) {
|
|
7090
|
+
return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z || isNumber(code);
|
|
7091
7091
|
}
|
|
7092
|
-
function isEntityInAttributeInvalidEnd(
|
|
7093
|
-
return
|
|
7092
|
+
function isEntityInAttributeInvalidEnd(code) {
|
|
7093
|
+
return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code);
|
|
7094
7094
|
}
|
|
7095
7095
|
function getDecoder(decodeTree) {
|
|
7096
7096
|
let ret = "";
|
|
@@ -8246,8 +8246,8 @@
|
|
|
8246
8246
|
});
|
|
8247
8247
|
|
|
8248
8248
|
// node_modules/domutils/lib/esm/feeds.js
|
|
8249
|
-
function getFeed(
|
|
8250
|
-
const feedRoot = getOneElement(isValidFeed,
|
|
8249
|
+
function getFeed(doc) {
|
|
8250
|
+
const feedRoot = getOneElement(isValidFeed, doc);
|
|
8251
8251
|
return !feedRoot ? null : feedRoot.name === "feed" ? getAtomFeed(feedRoot) : getRssFeed(feedRoot);
|
|
8252
8252
|
}
|
|
8253
8253
|
function getAtomFeed(feedRoot) {
|
|
@@ -10975,20 +10975,20 @@
|
|
|
10975
10975
|
});
|
|
10976
10976
|
|
|
10977
10977
|
// node_modules/cheerio/dist/browser/parse.js
|
|
10978
|
-
function getParse(
|
|
10979
|
-
return function
|
|
10978
|
+
function getParse(parser) {
|
|
10979
|
+
return function parse10(content, options, isDocument2, context) {
|
|
10980
10980
|
if (typeof Buffer !== "undefined" && Buffer.isBuffer(content)) {
|
|
10981
10981
|
content = content.toString();
|
|
10982
10982
|
}
|
|
10983
10983
|
if (typeof content === "string") {
|
|
10984
|
-
return
|
|
10984
|
+
return parser(content, options, isDocument2, context);
|
|
10985
10985
|
}
|
|
10986
|
-
const
|
|
10987
|
-
if (!Array.isArray(
|
|
10988
|
-
return
|
|
10986
|
+
const doc = content;
|
|
10987
|
+
if (!Array.isArray(doc) && isDocument(doc)) {
|
|
10988
|
+
return doc;
|
|
10989
10989
|
}
|
|
10990
10990
|
const root2 = new Document([]);
|
|
10991
|
-
update(
|
|
10991
|
+
update(doc, root2);
|
|
10992
10992
|
return root2;
|
|
10993
10993
|
};
|
|
10994
10994
|
}
|
|
@@ -11583,13 +11583,13 @@
|
|
|
11583
11583
|
});
|
|
11584
11584
|
|
|
11585
11585
|
// node_modules/cheerio/dist/browser/load.js
|
|
11586
|
-
function getLoad(
|
|
11586
|
+
function getLoad(parse10, render3) {
|
|
11587
11587
|
return function load2(content, options, isDocument2 = true) {
|
|
11588
11588
|
if (content == null) {
|
|
11589
11589
|
throw new Error("cheerio.load() expects a string");
|
|
11590
11590
|
}
|
|
11591
11591
|
const internalOpts = flattenOptions(options);
|
|
11592
|
-
const initialRoot =
|
|
11592
|
+
const initialRoot = parse10(content, internalOpts, isDocument2, null);
|
|
11593
11593
|
class LoadedCheerio extends Cheerio {
|
|
11594
11594
|
_make(selector, context) {
|
|
11595
11595
|
const cheerio = initialize(selector, context);
|
|
@@ -11597,7 +11597,7 @@
|
|
|
11597
11597
|
return cheerio;
|
|
11598
11598
|
}
|
|
11599
11599
|
_parse(content2, options2, isDocument3, context) {
|
|
11600
|
-
return
|
|
11600
|
+
return parse10(content2, options2, isDocument3, context);
|
|
11601
11601
|
}
|
|
11602
11602
|
_render(dom) {
|
|
11603
11603
|
return render3(dom, this.options);
|
|
@@ -11607,7 +11607,7 @@
|
|
|
11607
11607
|
if (selector && isCheerio(selector))
|
|
11608
11608
|
return selector;
|
|
11609
11609
|
const options2 = flattenOptions(opts, internalOpts);
|
|
11610
|
-
const r = typeof root2 === "string" ? [
|
|
11610
|
+
const r = typeof root2 === "string" ? [parse10(root2, options2, false, null)] : "length" in root2 ? root2 : [root2];
|
|
11611
11611
|
const rootInstance = isCheerio(r) ? r : new LoadedCheerio(r, null, options2);
|
|
11612
11612
|
rootInstance._root = rootInstance;
|
|
11613
11613
|
if (!selector) {
|
|
@@ -11615,7 +11615,7 @@
|
|
|
11615
11615
|
}
|
|
11616
11616
|
const elements = typeof selector === "string" && isHtml(selector) ? (
|
|
11617
11617
|
// $(<html>)
|
|
11618
|
-
|
|
11618
|
+
parse10(selector, options2, false, null).children
|
|
11619
11619
|
) : isNode(selector) ? (
|
|
11620
11620
|
// $(dom)
|
|
11621
11621
|
[selector]
|
|
@@ -11635,7 +11635,7 @@
|
|
|
11635
11635
|
// If we don't have a context, maybe we have a root, from loading
|
|
11636
11636
|
typeof context === "string" ? isHtml(context) ? (
|
|
11637
11637
|
// $('li', '<ul>...</ul>')
|
|
11638
|
-
new LoadedCheerio([
|
|
11638
|
+
new LoadedCheerio([parse10(context, options2, false, null)], rootInstance, options2)
|
|
11639
11639
|
) : (
|
|
11640
11640
|
// $('li', 'ul')
|
|
11641
11641
|
(search = `${context} ${search}`, rootInstance)
|
|
@@ -11871,12 +11871,12 @@
|
|
|
11871
11871
|
get offset() {
|
|
11872
11872
|
return this.droppedBufferSize + this.pos;
|
|
11873
11873
|
}
|
|
11874
|
-
getError(
|
|
11874
|
+
getError(code, cpOffset) {
|
|
11875
11875
|
const { line, col, offset: offset2 } = this;
|
|
11876
11876
|
const startCol = col + cpOffset;
|
|
11877
11877
|
const startOffset = offset2 + cpOffset;
|
|
11878
11878
|
return {
|
|
11879
|
-
code
|
|
11879
|
+
code,
|
|
11880
11880
|
startLine: line,
|
|
11881
11881
|
endLine: line,
|
|
11882
11882
|
startCol,
|
|
@@ -11885,10 +11885,10 @@
|
|
|
11885
11885
|
endOffset: startOffset
|
|
11886
11886
|
};
|
|
11887
11887
|
}
|
|
11888
|
-
_err(
|
|
11888
|
+
_err(code) {
|
|
11889
11889
|
if (this.handler.onParseError && this.lastErrOffset !== this.offset) {
|
|
11890
11890
|
this.lastErrOffset = this.offset;
|
|
11891
|
-
this.handler.onParseError(this.getError(
|
|
11891
|
+
this.handler.onParseError(this.getError(code, 0));
|
|
11892
11892
|
}
|
|
11893
11893
|
}
|
|
11894
11894
|
_addGap() {
|
|
@@ -11958,8 +11958,8 @@
|
|
|
11958
11958
|
this.endOfChunkHit = !this.lastChunkWritten;
|
|
11959
11959
|
return CODE_POINTS.EOF;
|
|
11960
11960
|
}
|
|
11961
|
-
const
|
|
11962
|
-
return
|
|
11961
|
+
const code = this.html.charCodeAt(pos);
|
|
11962
|
+
return code === CODE_POINTS.CARRIAGE_RETURN ? CODE_POINTS.LINE_FEED : code;
|
|
11963
11963
|
}
|
|
11964
11964
|
advance() {
|
|
11965
11965
|
this.pos++;
|
|
@@ -12116,17 +12116,17 @@
|
|
|
12116
12116
|
});
|
|
12117
12117
|
|
|
12118
12118
|
// node_modules/cheerio/node_modules/parse5/node_modules/entities/dist/esm/decode.js
|
|
12119
|
-
function isNumber2(
|
|
12120
|
-
return
|
|
12119
|
+
function isNumber2(code) {
|
|
12120
|
+
return code >= CharCodes2.ZERO && code <= CharCodes2.NINE;
|
|
12121
12121
|
}
|
|
12122
|
-
function isHexadecimalCharacter2(
|
|
12123
|
-
return
|
|
12122
|
+
function isHexadecimalCharacter2(code) {
|
|
12123
|
+
return code >= CharCodes2.UPPER_A && code <= CharCodes2.UPPER_F || code >= CharCodes2.LOWER_A && code <= CharCodes2.LOWER_F;
|
|
12124
12124
|
}
|
|
12125
|
-
function isAsciiAlphaNumeric2(
|
|
12126
|
-
return
|
|
12125
|
+
function isAsciiAlphaNumeric2(code) {
|
|
12126
|
+
return code >= CharCodes2.UPPER_A && code <= CharCodes2.UPPER_Z || code >= CharCodes2.LOWER_A && code <= CharCodes2.LOWER_Z || isNumber2(code);
|
|
12127
12127
|
}
|
|
12128
|
-
function isEntityInAttributeInvalidEnd2(
|
|
12129
|
-
return
|
|
12128
|
+
function isEntityInAttributeInvalidEnd2(code) {
|
|
12129
|
+
return code === CharCodes2.EQUALS || isAsciiAlphaNumeric2(code);
|
|
12130
12130
|
}
|
|
12131
12131
|
function determineBranch2(decodeTree, current2, nodeIndex, char) {
|
|
12132
12132
|
const branchCount = (current2 & BinTrieFlags2.BRANCH_LENGTH) >> 7;
|
|
@@ -12997,16 +12997,16 @@
|
|
|
12997
12997
|
function isScriptDataDoubleEscapeSequenceEnd(cp) {
|
|
12998
12998
|
return isWhitespace2(cp) || cp === CODE_POINTS.SOLIDUS || cp === CODE_POINTS.GREATER_THAN_SIGN;
|
|
12999
12999
|
}
|
|
13000
|
-
function getErrorForNumericCharacterReference(
|
|
13001
|
-
if (
|
|
13000
|
+
function getErrorForNumericCharacterReference(code) {
|
|
13001
|
+
if (code === CODE_POINTS.NULL) {
|
|
13002
13002
|
return ERR.nullCharacterReference;
|
|
13003
|
-
} else if (
|
|
13003
|
+
} else if (code > 1114111) {
|
|
13004
13004
|
return ERR.characterReferenceOutsideUnicodeRange;
|
|
13005
|
-
} else if (isSurrogate(
|
|
13005
|
+
} else if (isSurrogate(code)) {
|
|
13006
13006
|
return ERR.surrogateCharacterReference;
|
|
13007
|
-
} else if (isUndefinedCodePoint(
|
|
13007
|
+
} else if (isUndefinedCodePoint(code)) {
|
|
13008
13008
|
return ERR.noncharacterCharacterReference;
|
|
13009
|
-
} else if (isControlCodePoint(
|
|
13009
|
+
} else if (isControlCodePoint(code) || code === CODE_POINTS.CARRIAGE_RETURN) {
|
|
13010
13010
|
return ERR.controlCharacterReference;
|
|
13011
13011
|
}
|
|
13012
13012
|
return null;
|
|
@@ -13131,17 +13131,17 @@
|
|
|
13131
13131
|
absenceOfDigitsInNumericCharacterReference: (consumed) => {
|
|
13132
13132
|
this._err(ERR.absenceOfDigitsInNumericCharacterReference, this.entityStartPos - this.preprocessor.pos + consumed);
|
|
13133
13133
|
},
|
|
13134
|
-
validateNumericCharacterReference: (
|
|
13135
|
-
const error = getErrorForNumericCharacterReference(
|
|
13134
|
+
validateNumericCharacterReference: (code) => {
|
|
13135
|
+
const error = getErrorForNumericCharacterReference(code);
|
|
13136
13136
|
if (error)
|
|
13137
13137
|
this._err(error, 1);
|
|
13138
13138
|
}
|
|
13139
13139
|
} : void 0);
|
|
13140
13140
|
}
|
|
13141
13141
|
//Errors
|
|
13142
|
-
_err(
|
|
13142
|
+
_err(code, cpOffset = 0) {
|
|
13143
13143
|
var _a4, _b;
|
|
13144
|
-
(_b = (_a4 = this.handler).onParseError) === null || _b === void 0 ? void 0 : _b.call(_a4, this.preprocessor.getError(
|
|
13144
|
+
(_b = (_a4 = this.handler).onParseError) === null || _b === void 0 ? void 0 : _b.call(_a4, this.preprocessor.getError(code, cpOffset));
|
|
13145
13145
|
}
|
|
13146
13146
|
// NOTE: `offset` may never run across line boundaries.
|
|
13147
13147
|
getCurrentLocation(offset2) {
|
|
@@ -18560,9 +18560,9 @@
|
|
|
18560
18560
|
}
|
|
18561
18561
|
// API
|
|
18562
18562
|
static parse(html3, options) {
|
|
18563
|
-
const
|
|
18564
|
-
|
|
18565
|
-
return
|
|
18563
|
+
const parser = new this(options);
|
|
18564
|
+
parser.tokenizer.write(html3, true);
|
|
18565
|
+
return parser.document;
|
|
18566
18566
|
}
|
|
18567
18567
|
static getFragmentParser(fragmentContext, options) {
|
|
18568
18568
|
const opts = {
|
|
@@ -18571,15 +18571,15 @@
|
|
|
18571
18571
|
};
|
|
18572
18572
|
fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : fragmentContext = opts.treeAdapter.createElement(TAG_NAMES.TEMPLATE, NS.HTML, []);
|
|
18573
18573
|
const documentMock = opts.treeAdapter.createElement("documentmock", NS.HTML, []);
|
|
18574
|
-
const
|
|
18575
|
-
if (
|
|
18576
|
-
|
|
18574
|
+
const parser = new this(opts, documentMock, fragmentContext);
|
|
18575
|
+
if (parser.fragmentContextID === TAG_ID.TEMPLATE) {
|
|
18576
|
+
parser.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);
|
|
18577
18577
|
}
|
|
18578
|
-
|
|
18579
|
-
|
|
18580
|
-
|
|
18581
|
-
|
|
18582
|
-
return
|
|
18578
|
+
parser._initTokenizerForFragmentParsing();
|
|
18579
|
+
parser._insertFakeRootElement();
|
|
18580
|
+
parser._resetInsertionMode();
|
|
18581
|
+
parser._findFormInFragmentContext();
|
|
18582
|
+
return parser;
|
|
18583
18583
|
}
|
|
18584
18584
|
getFragment() {
|
|
18585
18585
|
const rootElement = this.treeAdapter.getFirstChild(this.document);
|
|
@@ -18589,13 +18589,13 @@
|
|
|
18589
18589
|
}
|
|
18590
18590
|
//Errors
|
|
18591
18591
|
/** @internal */
|
|
18592
|
-
_err(token,
|
|
18592
|
+
_err(token, code, beforeToken) {
|
|
18593
18593
|
var _a4;
|
|
18594
18594
|
if (!this.onParseError)
|
|
18595
18595
|
return;
|
|
18596
18596
|
const loc = (_a4 = token.location) !== null && _a4 !== void 0 ? _a4 : BASE_LOC;
|
|
18597
18597
|
const err = {
|
|
18598
|
-
code
|
|
18598
|
+
code,
|
|
18599
18599
|
startLine: loc.startLine,
|
|
18600
18600
|
startCol: loc.startCol,
|
|
18601
18601
|
startOffset: loc.startOffset,
|
|
@@ -19749,9 +19749,9 @@
|
|
|
19749
19749
|
html3 = fragmentContext;
|
|
19750
19750
|
fragmentContext = null;
|
|
19751
19751
|
}
|
|
19752
|
-
const
|
|
19753
|
-
|
|
19754
|
-
return
|
|
19752
|
+
const parser = Parser.getFragmentParser(fragmentContext, options);
|
|
19753
|
+
parser.tokenizer.write(html3, true);
|
|
19754
|
+
return parser.getFragment();
|
|
19755
19755
|
}
|
|
19756
19756
|
var init_dist = __esm({
|
|
19757
19757
|
"node_modules/cheerio/node_modules/parse5/dist/index.js"() {
|
|
@@ -22933,12 +22933,12 @@
|
|
|
22933
22933
|
var TIMER = false;
|
|
22934
22934
|
var debug = require_debug()("parse");
|
|
22935
22935
|
var lex = require_lexer();
|
|
22936
|
-
exports = module.exports =
|
|
22936
|
+
exports = module.exports = parse10;
|
|
22937
22937
|
var _comments;
|
|
22938
22938
|
var _depth;
|
|
22939
22939
|
var _position;
|
|
22940
22940
|
var _tokens;
|
|
22941
|
-
function
|
|
22941
|
+
function parse10(css2, options) {
|
|
22942
22942
|
var start;
|
|
22943
22943
|
options || (options = {});
|
|
22944
22944
|
_comments = !!options.comments;
|
|
@@ -23386,12 +23386,12 @@
|
|
|
23386
23386
|
return this.raw;
|
|
23387
23387
|
};
|
|
23388
23388
|
var cache = {};
|
|
23389
|
-
var
|
|
23389
|
+
var parse10 = function(expression) {
|
|
23390
23390
|
if (expression == null) return null;
|
|
23391
23391
|
expression = ("" + expression).replace(/^\s+|\s+$/g, "");
|
|
23392
23392
|
return cache[expression] || (cache[expression] = new Expressions(expression));
|
|
23393
23393
|
};
|
|
23394
|
-
module.exports =
|
|
23394
|
+
module.exports = parse10;
|
|
23395
23395
|
}
|
|
23396
23396
|
});
|
|
23397
23397
|
|
|
@@ -23399,7 +23399,7 @@
|
|
|
23399
23399
|
var require_selector = __commonJS({
|
|
23400
23400
|
"node_modules/juice/lib/selector.js"(exports, module) {
|
|
23401
23401
|
"use strict";
|
|
23402
|
-
var
|
|
23402
|
+
var parser = require_parser2();
|
|
23403
23403
|
module.exports = exports = Selector;
|
|
23404
23404
|
function Selector(text3, styleAttribute) {
|
|
23405
23405
|
this.text = text3;
|
|
@@ -23408,7 +23408,7 @@
|
|
|
23408
23408
|
}
|
|
23409
23409
|
Selector.prototype.parsed = function() {
|
|
23410
23410
|
if (!this.tokens) {
|
|
23411
|
-
this.tokens =
|
|
23411
|
+
this.tokens = parse10(this.text);
|
|
23412
23412
|
}
|
|
23413
23413
|
return this.tokens;
|
|
23414
23414
|
};
|
|
@@ -23419,7 +23419,7 @@
|
|
|
23419
23419
|
}
|
|
23420
23420
|
return this.spec;
|
|
23421
23421
|
function specificity(text3, parsed) {
|
|
23422
|
-
var expressions = parsed ||
|
|
23422
|
+
var expressions = parsed || parse10(text3);
|
|
23423
23423
|
var spec = [styleAttribute ? 1 : 0, 0, 0, 0];
|
|
23424
23424
|
var nots = [];
|
|
23425
23425
|
for (var i = 0; i < expressions.length; i++) {
|
|
@@ -23456,9 +23456,9 @@
|
|
|
23456
23456
|
return spec;
|
|
23457
23457
|
}
|
|
23458
23458
|
};
|
|
23459
|
-
function
|
|
23459
|
+
function parse10(text3) {
|
|
23460
23460
|
try {
|
|
23461
|
-
return
|
|
23461
|
+
return parser(text3)[0];
|
|
23462
23462
|
} catch (e) {
|
|
23463
23463
|
return [];
|
|
23464
23464
|
}
|
|
@@ -23844,11 +23844,11 @@
|
|
|
23844
23844
|
var $3 = cheerioLoad(html3, options, entityConverters.encodeEntities);
|
|
23845
23845
|
var args = [$3];
|
|
23846
23846
|
args.push.apply(args, callbackExtraArguments);
|
|
23847
|
-
var
|
|
23847
|
+
var doc = callback.apply(void 0, args) || $3;
|
|
23848
23848
|
if (options && options.xmlMode) {
|
|
23849
|
-
return entityConverters.decodeEntities(
|
|
23849
|
+
return entityConverters.decodeEntities(doc.xml());
|
|
23850
23850
|
}
|
|
23851
|
-
return entityConverters.decodeEntities(
|
|
23851
|
+
return entityConverters.decodeEntities(doc.html());
|
|
23852
23852
|
};
|
|
23853
23853
|
module.exports.codeBlocks = {
|
|
23854
23854
|
EJS: { start: "<%", end: "%>" },
|
|
@@ -24027,17 +24027,17 @@
|
|
|
24027
24027
|
CharCodes6[CharCodes6["UPPER_Z"] = 90] = "UPPER_Z";
|
|
24028
24028
|
})(CharCodes5 || (CharCodes5 = {}));
|
|
24029
24029
|
var TO_LOWER_BIT3 = 32;
|
|
24030
|
-
function isNumber3(
|
|
24031
|
-
return
|
|
24030
|
+
function isNumber3(code) {
|
|
24031
|
+
return code >= CharCodes5.ZERO && code <= CharCodes5.NINE;
|
|
24032
24032
|
}
|
|
24033
|
-
function isHexadecimalCharacter3(
|
|
24034
|
-
return
|
|
24033
|
+
function isHexadecimalCharacter3(code) {
|
|
24034
|
+
return code >= CharCodes5.UPPER_A && code <= CharCodes5.UPPER_F || code >= CharCodes5.LOWER_A && code <= CharCodes5.LOWER_F;
|
|
24035
24035
|
}
|
|
24036
|
-
function isAsciiAlphaNumeric4(
|
|
24037
|
-
return
|
|
24036
|
+
function isAsciiAlphaNumeric4(code) {
|
|
24037
|
+
return code >= CharCodes5.UPPER_A && code <= CharCodes5.UPPER_Z || code >= CharCodes5.LOWER_A && code <= CharCodes5.LOWER_Z || isNumber3(code);
|
|
24038
24038
|
}
|
|
24039
|
-
function isEntityInAttributeInvalidEnd3(
|
|
24040
|
-
return
|
|
24039
|
+
function isEntityInAttributeInvalidEnd3(code) {
|
|
24040
|
+
return code === CharCodes5.EQUALS || isAsciiAlphaNumeric4(code);
|
|
24041
24041
|
}
|
|
24042
24042
|
var EntityDecoderState4;
|
|
24043
24043
|
(function(EntityDecoderState5) {
|
|
@@ -26077,7 +26077,7 @@
|
|
|
26077
26077
|
}
|
|
26078
26078
|
};
|
|
26079
26079
|
const _initDocument = function _initDocument2(dirty) {
|
|
26080
|
-
let
|
|
26080
|
+
let doc = null;
|
|
26081
26081
|
let leadingWhitespace = null;
|
|
26082
26082
|
if (FORCE_BODY) {
|
|
26083
26083
|
dirty = "<remove></remove>" + dirty;
|
|
@@ -26091,25 +26091,25 @@
|
|
|
26091
26091
|
const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
26092
26092
|
if (NAMESPACE === HTML_NAMESPACE) {
|
|
26093
26093
|
try {
|
|
26094
|
-
|
|
26094
|
+
doc = new DOMParser2().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
26095
26095
|
} catch (_) {
|
|
26096
26096
|
}
|
|
26097
26097
|
}
|
|
26098
|
-
if (!
|
|
26099
|
-
|
|
26098
|
+
if (!doc || !doc.documentElement) {
|
|
26099
|
+
doc = implementation.createDocument(NAMESPACE, "template", null);
|
|
26100
26100
|
try {
|
|
26101
|
-
|
|
26101
|
+
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
|
26102
26102
|
} catch (_) {
|
|
26103
26103
|
}
|
|
26104
26104
|
}
|
|
26105
|
-
const body =
|
|
26105
|
+
const body = doc.body || doc.documentElement;
|
|
26106
26106
|
if (dirty && leadingWhitespace) {
|
|
26107
26107
|
body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
26108
26108
|
}
|
|
26109
26109
|
if (NAMESPACE === HTML_NAMESPACE) {
|
|
26110
|
-
return getElementsByTagName2.call(
|
|
26110
|
+
return getElementsByTagName2.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
|
|
26111
26111
|
}
|
|
26112
|
-
return WHOLE_DOCUMENT ?
|
|
26112
|
+
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
26113
26113
|
};
|
|
26114
26114
|
const _createNodeIterator = function _createNodeIterator2(root2) {
|
|
26115
26115
|
return createNodeIterator.call(
|
|
@@ -26675,20 +26675,20 @@
|
|
|
26675
26675
|
const cache = getEncodeCache(exclude);
|
|
26676
26676
|
let result = "";
|
|
26677
26677
|
for (let i = 0, l = string.length; i < l; i++) {
|
|
26678
|
-
const
|
|
26679
|
-
if (keepEscaped &&
|
|
26678
|
+
const code = string.charCodeAt(i);
|
|
26679
|
+
if (keepEscaped && code === 37 && i + 2 < l) {
|
|
26680
26680
|
if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {
|
|
26681
26681
|
result += string.slice(i, i + 3);
|
|
26682
26682
|
i += 2;
|
|
26683
26683
|
continue;
|
|
26684
26684
|
}
|
|
26685
26685
|
}
|
|
26686
|
-
if (
|
|
26687
|
-
result += cache[
|
|
26686
|
+
if (code < 128) {
|
|
26687
|
+
result += cache[code];
|
|
26688
26688
|
continue;
|
|
26689
26689
|
}
|
|
26690
|
-
if (
|
|
26691
|
-
if (
|
|
26690
|
+
if (code >= 55296 && code <= 57343) {
|
|
26691
|
+
if (code >= 55296 && code <= 56319 && i + 1 < l) {
|
|
26692
26692
|
const nextCode = string.charCodeAt(i + 1);
|
|
26693
26693
|
if (nextCode >= 56320 && nextCode <= 57343) {
|
|
26694
26694
|
result += encodeURIComponent(string[i] + string[i + 1]);
|
|
@@ -27089,17 +27089,17 @@
|
|
|
27089
27089
|
BinTrieFlags5[BinTrieFlags5["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH";
|
|
27090
27090
|
BinTrieFlags5[BinTrieFlags5["JUMP_TABLE"] = 127] = "JUMP_TABLE";
|
|
27091
27091
|
})(BinTrieFlags4 = exports.BinTrieFlags || (exports.BinTrieFlags = {}));
|
|
27092
|
-
function isNumber3(
|
|
27093
|
-
return
|
|
27092
|
+
function isNumber3(code) {
|
|
27093
|
+
return code >= CharCodes5.ZERO && code <= CharCodes5.NINE;
|
|
27094
27094
|
}
|
|
27095
|
-
function isHexadecimalCharacter3(
|
|
27096
|
-
return
|
|
27095
|
+
function isHexadecimalCharacter3(code) {
|
|
27096
|
+
return code >= CharCodes5.UPPER_A && code <= CharCodes5.UPPER_F || code >= CharCodes5.LOWER_A && code <= CharCodes5.LOWER_F;
|
|
27097
27097
|
}
|
|
27098
|
-
function isAsciiAlphaNumeric4(
|
|
27099
|
-
return
|
|
27098
|
+
function isAsciiAlphaNumeric4(code) {
|
|
27099
|
+
return code >= CharCodes5.UPPER_A && code <= CharCodes5.UPPER_Z || code >= CharCodes5.LOWER_A && code <= CharCodes5.LOWER_Z || isNumber3(code);
|
|
27100
27100
|
}
|
|
27101
|
-
function isEntityInAttributeInvalidEnd3(
|
|
27102
|
-
return
|
|
27101
|
+
function isEntityInAttributeInvalidEnd3(code) {
|
|
27102
|
+
return code === CharCodes5.EQUALS || isAsciiAlphaNumeric4(code);
|
|
27103
27103
|
}
|
|
27104
27104
|
var EntityDecoderState4;
|
|
27105
27105
|
(function(EntityDecoderState5) {
|
|
@@ -28421,9 +28421,9 @@
|
|
|
28421
28421
|
var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;
|
|
28422
28422
|
function replaceEntityPattern(match, name) {
|
|
28423
28423
|
if (name.charCodeAt(0) === 35 && DIGITAL_ENTITY_TEST_RE.test(name)) {
|
|
28424
|
-
const
|
|
28425
|
-
if (isValidEntityCode(
|
|
28426
|
-
return fromCodePoint4(
|
|
28424
|
+
const code2 = name[1].toLowerCase() === "x" ? parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);
|
|
28425
|
+
if (isValidEntityCode(code2)) {
|
|
28426
|
+
return fromCodePoint4(code2);
|
|
28427
28427
|
}
|
|
28428
28428
|
return match;
|
|
28429
28429
|
}
|
|
@@ -28471,19 +28471,19 @@
|
|
|
28471
28471
|
function escapeRE(str) {
|
|
28472
28472
|
return str.replace(REGEXP_ESCAPE_RE, "\\$&");
|
|
28473
28473
|
}
|
|
28474
|
-
function isSpace(
|
|
28475
|
-
switch (
|
|
28474
|
+
function isSpace(code2) {
|
|
28475
|
+
switch (code2) {
|
|
28476
28476
|
case 9:
|
|
28477
28477
|
case 32:
|
|
28478
28478
|
return true;
|
|
28479
28479
|
}
|
|
28480
28480
|
return false;
|
|
28481
28481
|
}
|
|
28482
|
-
function isWhiteSpace(
|
|
28483
|
-
if (
|
|
28482
|
+
function isWhiteSpace(code2) {
|
|
28483
|
+
if (code2 >= 8192 && code2 <= 8202) {
|
|
28484
28484
|
return true;
|
|
28485
28485
|
}
|
|
28486
|
-
switch (
|
|
28486
|
+
switch (code2) {
|
|
28487
28487
|
case 9:
|
|
28488
28488
|
// \t
|
|
28489
28489
|
case 10:
|
|
@@ -28610,7 +28610,7 @@
|
|
|
28610
28610
|
return labelEnd;
|
|
28611
28611
|
}
|
|
28612
28612
|
function parseLinkDestination(str, start, max) {
|
|
28613
|
-
let
|
|
28613
|
+
let code2;
|
|
28614
28614
|
let pos = start;
|
|
28615
28615
|
const result = {
|
|
28616
28616
|
ok: false,
|
|
@@ -28620,20 +28620,20 @@
|
|
|
28620
28620
|
if (str.charCodeAt(pos) === 60) {
|
|
28621
28621
|
pos++;
|
|
28622
28622
|
while (pos < max) {
|
|
28623
|
-
|
|
28624
|
-
if (
|
|
28623
|
+
code2 = str.charCodeAt(pos);
|
|
28624
|
+
if (code2 === 10) {
|
|
28625
28625
|
return result;
|
|
28626
28626
|
}
|
|
28627
|
-
if (
|
|
28627
|
+
if (code2 === 60) {
|
|
28628
28628
|
return result;
|
|
28629
28629
|
}
|
|
28630
|
-
if (
|
|
28630
|
+
if (code2 === 62) {
|
|
28631
28631
|
result.pos = pos + 1;
|
|
28632
28632
|
result.str = unescapeAll(str.slice(start + 1, pos));
|
|
28633
28633
|
result.ok = true;
|
|
28634
28634
|
return result;
|
|
28635
28635
|
}
|
|
28636
|
-
if (
|
|
28636
|
+
if (code2 === 92 && pos + 1 < max) {
|
|
28637
28637
|
pos += 2;
|
|
28638
28638
|
continue;
|
|
28639
28639
|
}
|
|
@@ -28643,27 +28643,27 @@
|
|
|
28643
28643
|
}
|
|
28644
28644
|
let level = 0;
|
|
28645
28645
|
while (pos < max) {
|
|
28646
|
-
|
|
28647
|
-
if (
|
|
28646
|
+
code2 = str.charCodeAt(pos);
|
|
28647
|
+
if (code2 === 32) {
|
|
28648
28648
|
break;
|
|
28649
28649
|
}
|
|
28650
|
-
if (
|
|
28650
|
+
if (code2 < 32 || code2 === 127) {
|
|
28651
28651
|
break;
|
|
28652
28652
|
}
|
|
28653
|
-
if (
|
|
28653
|
+
if (code2 === 92 && pos + 1 < max) {
|
|
28654
28654
|
if (str.charCodeAt(pos + 1) === 32) {
|
|
28655
28655
|
break;
|
|
28656
28656
|
}
|
|
28657
28657
|
pos += 2;
|
|
28658
28658
|
continue;
|
|
28659
28659
|
}
|
|
28660
|
-
if (
|
|
28660
|
+
if (code2 === 40) {
|
|
28661
28661
|
level++;
|
|
28662
28662
|
if (level > 32) {
|
|
28663
28663
|
return result;
|
|
28664
28664
|
}
|
|
28665
28665
|
}
|
|
28666
|
-
if (
|
|
28666
|
+
if (code2 === 41) {
|
|
28667
28667
|
if (level === 0) {
|
|
28668
28668
|
break;
|
|
28669
28669
|
}
|
|
@@ -28683,7 +28683,7 @@
|
|
|
28683
28683
|
return result;
|
|
28684
28684
|
}
|
|
28685
28685
|
function parseLinkTitle(str, start, max, prev_state) {
|
|
28686
|
-
let
|
|
28686
|
+
let code2;
|
|
28687
28687
|
let pos = start;
|
|
28688
28688
|
const state = {
|
|
28689
28689
|
// if `true`, this is a valid link title
|
|
@@ -28716,15 +28716,15 @@
|
|
|
28716
28716
|
state.marker = marker;
|
|
28717
28717
|
}
|
|
28718
28718
|
while (pos < max) {
|
|
28719
|
-
|
|
28720
|
-
if (
|
|
28719
|
+
code2 = str.charCodeAt(pos);
|
|
28720
|
+
if (code2 === state.marker) {
|
|
28721
28721
|
state.pos = pos + 1;
|
|
28722
28722
|
state.str += unescapeAll(str.slice(start, pos));
|
|
28723
28723
|
state.ok = true;
|
|
28724
28724
|
return state;
|
|
28725
|
-
} else if (
|
|
28725
|
+
} else if (code2 === 40 && state.marker === 41) {
|
|
28726
28726
|
return state;
|
|
28727
|
-
} else if (
|
|
28727
|
+
} else if (code2 === 92 && pos + 1 < max) {
|
|
28728
28728
|
pos++;
|
|
28729
28729
|
}
|
|
28730
28730
|
pos++;
|
|
@@ -29582,20 +29582,20 @@
|
|
|
29582
29582
|
}
|
|
29583
29583
|
return pos;
|
|
29584
29584
|
};
|
|
29585
|
-
StateBlock.prototype.skipChars = function skipChars(pos,
|
|
29585
|
+
StateBlock.prototype.skipChars = function skipChars(pos, code2) {
|
|
29586
29586
|
for (let max = this.src.length; pos < max; pos++) {
|
|
29587
|
-
if (this.src.charCodeAt(pos) !==
|
|
29587
|
+
if (this.src.charCodeAt(pos) !== code2) {
|
|
29588
29588
|
break;
|
|
29589
29589
|
}
|
|
29590
29590
|
}
|
|
29591
29591
|
return pos;
|
|
29592
29592
|
};
|
|
29593
|
-
StateBlock.prototype.skipCharsBack = function skipCharsBack(pos,
|
|
29593
|
+
StateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code2, min) {
|
|
29594
29594
|
if (pos <= min) {
|
|
29595
29595
|
return pos;
|
|
29596
29596
|
}
|
|
29597
29597
|
while (pos > min) {
|
|
29598
|
-
if (
|
|
29598
|
+
if (code2 !== this.src.charCodeAt(--pos)) {
|
|
29599
29599
|
return pos + 1;
|
|
29600
29600
|
}
|
|
29601
29601
|
}
|
|
@@ -29828,7 +29828,7 @@
|
|
|
29828
29828
|
state.line = nextLine;
|
|
29829
29829
|
return true;
|
|
29830
29830
|
}
|
|
29831
|
-
function
|
|
29831
|
+
function code(state, startLine, endLine) {
|
|
29832
29832
|
if (state.sCount[startLine] - state.blkIndent < 4) {
|
|
29833
29833
|
return false;
|
|
29834
29834
|
}
|
|
@@ -30674,7 +30674,7 @@
|
|
|
30674
30674
|
// First 2 params - rule name & source. Secondary array - list of rules,
|
|
30675
30675
|
// which can be terminated by this one.
|
|
30676
30676
|
["table", table, ["paragraph", "reference"]],
|
|
30677
|
-
["code",
|
|
30677
|
+
["code", code],
|
|
30678
30678
|
["fence", fence, ["paragraph", "reference", "blockquote", "list"]],
|
|
30679
30679
|
["blockquote", blockquote, ["paragraph", "reference", "blockquote", "list"]],
|
|
30680
30680
|
["hr", hr, ["paragraph", "reference", "blockquote", "list"]],
|
|
@@ -31198,7 +31198,7 @@
|
|
|
31198
31198
|
postProcess: emphasis_post_process
|
|
31199
31199
|
};
|
|
31200
31200
|
function link(state, silent) {
|
|
31201
|
-
let
|
|
31201
|
+
let code2, label, res, ref2;
|
|
31202
31202
|
let href = "";
|
|
31203
31203
|
let title = "";
|
|
31204
31204
|
let start = state.pos;
|
|
@@ -31218,8 +31218,8 @@
|
|
|
31218
31218
|
parseReference = false;
|
|
31219
31219
|
pos++;
|
|
31220
31220
|
for (; pos < max; pos++) {
|
|
31221
|
-
|
|
31222
|
-
if (!isSpace(
|
|
31221
|
+
code2 = state.src.charCodeAt(pos);
|
|
31222
|
+
if (!isSpace(code2) && code2 !== 10) {
|
|
31223
31223
|
break;
|
|
31224
31224
|
}
|
|
31225
31225
|
}
|
|
@@ -31237,8 +31237,8 @@
|
|
|
31237
31237
|
}
|
|
31238
31238
|
start = pos;
|
|
31239
31239
|
for (; pos < max; pos++) {
|
|
31240
|
-
|
|
31241
|
-
if (!isSpace(
|
|
31240
|
+
code2 = state.src.charCodeAt(pos);
|
|
31241
|
+
if (!isSpace(code2) && code2 !== 10) {
|
|
31242
31242
|
break;
|
|
31243
31243
|
}
|
|
31244
31244
|
}
|
|
@@ -31247,8 +31247,8 @@
|
|
|
31247
31247
|
title = res.str;
|
|
31248
31248
|
pos = res.pos;
|
|
31249
31249
|
for (; pos < max; pos++) {
|
|
31250
|
-
|
|
31251
|
-
if (!isSpace(
|
|
31250
|
+
code2 = state.src.charCodeAt(pos);
|
|
31251
|
+
if (!isSpace(code2) && code2 !== 10) {
|
|
31252
31252
|
break;
|
|
31253
31253
|
}
|
|
31254
31254
|
}
|
|
@@ -31304,7 +31304,7 @@
|
|
|
31304
31304
|
return true;
|
|
31305
31305
|
}
|
|
31306
31306
|
function image(state, silent) {
|
|
31307
|
-
let
|
|
31307
|
+
let code2, content, label, pos, ref2, res, title, start;
|
|
31308
31308
|
let href = "";
|
|
31309
31309
|
const oldPos = state.pos;
|
|
31310
31310
|
const max = state.posMax;
|
|
@@ -31323,8 +31323,8 @@
|
|
|
31323
31323
|
if (pos < max && state.src.charCodeAt(pos) === 40) {
|
|
31324
31324
|
pos++;
|
|
31325
31325
|
for (; pos < max; pos++) {
|
|
31326
|
-
|
|
31327
|
-
if (!isSpace(
|
|
31326
|
+
code2 = state.src.charCodeAt(pos);
|
|
31327
|
+
if (!isSpace(code2) && code2 !== 10) {
|
|
31328
31328
|
break;
|
|
31329
31329
|
}
|
|
31330
31330
|
}
|
|
@@ -31343,8 +31343,8 @@
|
|
|
31343
31343
|
}
|
|
31344
31344
|
start = pos;
|
|
31345
31345
|
for (; pos < max; pos++) {
|
|
31346
|
-
|
|
31347
|
-
if (!isSpace(
|
|
31346
|
+
code2 = state.src.charCodeAt(pos);
|
|
31347
|
+
if (!isSpace(code2) && code2 !== 10) {
|
|
31348
31348
|
break;
|
|
31349
31349
|
}
|
|
31350
31350
|
}
|
|
@@ -31353,8 +31353,8 @@
|
|
|
31353
31353
|
title = res.str;
|
|
31354
31354
|
pos = res.pos;
|
|
31355
31355
|
for (; pos < max; pos++) {
|
|
31356
|
-
|
|
31357
|
-
if (!isSpace(
|
|
31356
|
+
code2 = state.src.charCodeAt(pos);
|
|
31357
|
+
if (!isSpace(code2) && code2 !== 10) {
|
|
31358
31358
|
break;
|
|
31359
31359
|
}
|
|
31360
31360
|
}
|
|
@@ -31513,9 +31513,9 @@
|
|
|
31513
31513
|
const match = state.src.slice(pos).match(DIGITAL_RE);
|
|
31514
31514
|
if (match) {
|
|
31515
31515
|
if (!silent) {
|
|
31516
|
-
const
|
|
31516
|
+
const code2 = match[1][0].toLowerCase() === "x" ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
|
|
31517
31517
|
const token = state.push("text_special", "", 0);
|
|
31518
|
-
token.content = isValidEntityCode(
|
|
31518
|
+
token.content = isValidEntityCode(code2) ? fromCodePoint4(code2) : fromCodePoint4(65533);
|
|
31519
31519
|
token.markup = match[0];
|
|
31520
31520
|
token.info = "entity";
|
|
31521
31521
|
}
|
|
@@ -33215,23 +33215,23 @@
|
|
|
33215
33215
|
return classes.split(/\s+/).find((_class) => shouldNotHighlight(_class) || getLanguage(_class));
|
|
33216
33216
|
}
|
|
33217
33217
|
function highlight2(codeOrLanguageName, optionsOrCode, ignoreIllegals) {
|
|
33218
|
-
let
|
|
33218
|
+
let code = "";
|
|
33219
33219
|
let languageName = "";
|
|
33220
33220
|
if (typeof optionsOrCode === "object") {
|
|
33221
|
-
|
|
33221
|
+
code = codeOrLanguageName;
|
|
33222
33222
|
ignoreIllegals = optionsOrCode.ignoreIllegals;
|
|
33223
33223
|
languageName = optionsOrCode.language;
|
|
33224
33224
|
} else {
|
|
33225
33225
|
deprecated("10.7.0", "highlight(lang, code, ...args) has been deprecated.");
|
|
33226
33226
|
deprecated("10.7.0", "Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277");
|
|
33227
33227
|
languageName = codeOrLanguageName;
|
|
33228
|
-
|
|
33228
|
+
code = optionsOrCode;
|
|
33229
33229
|
}
|
|
33230
33230
|
if (ignoreIllegals === void 0) {
|
|
33231
33231
|
ignoreIllegals = true;
|
|
33232
33232
|
}
|
|
33233
33233
|
const context = {
|
|
33234
|
-
code
|
|
33234
|
+
code,
|
|
33235
33235
|
language: languageName
|
|
33236
33236
|
};
|
|
33237
33237
|
fire("before:highlight", context);
|
|
@@ -33568,22 +33568,22 @@
|
|
|
33568
33568
|
}
|
|
33569
33569
|
}
|
|
33570
33570
|
}
|
|
33571
|
-
function justTextHighlightResult(
|
|
33571
|
+
function justTextHighlightResult(code) {
|
|
33572
33572
|
const result = {
|
|
33573
|
-
value: escape3(
|
|
33573
|
+
value: escape3(code),
|
|
33574
33574
|
illegal: false,
|
|
33575
33575
|
relevance: 0,
|
|
33576
33576
|
_top: PLAINTEXT_LANGUAGE,
|
|
33577
33577
|
_emitter: new options.__emitter(options)
|
|
33578
33578
|
};
|
|
33579
|
-
result._emitter.addText(
|
|
33579
|
+
result._emitter.addText(code);
|
|
33580
33580
|
return result;
|
|
33581
33581
|
}
|
|
33582
|
-
function highlightAuto(
|
|
33582
|
+
function highlightAuto(code, languageSubset) {
|
|
33583
33583
|
languageSubset = languageSubset || options.languages || Object.keys(languages);
|
|
33584
|
-
const plaintext = justTextHighlightResult(
|
|
33584
|
+
const plaintext = justTextHighlightResult(code);
|
|
33585
33585
|
const results = languageSubset.filter(getLanguage).filter(autoDetection).map(
|
|
33586
|
-
(name) => _highlight(name,
|
|
33586
|
+
(name) => _highlight(name, code, false)
|
|
33587
33587
|
);
|
|
33588
33588
|
results.unshift(plaintext);
|
|
33589
33589
|
const sorted = results.sort((a, b) => {
|
|
@@ -84050,6 +84050,835 @@
|
|
|
84050
84050
|
}
|
|
84051
84051
|
});
|
|
84052
84052
|
|
|
84053
|
+
// node_modules/@prantlf/jsonlint/lib/jsonlint.js
|
|
84054
|
+
var require_jsonlint = __commonJS({
|
|
84055
|
+
"node_modules/@prantlf/jsonlint/lib/jsonlint.js"(exports, module) {
|
|
84056
|
+
(function(global2, factory) {
|
|
84057
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define("jsonlint", ["exports"], factory) : (global2 = global2 || self, factory(global2.jsonlint = {}));
|
|
84058
|
+
})(exports, function(exports2) {
|
|
84059
|
+
"use strict";
|
|
84060
|
+
const Uni = {
|
|
84061
|
+
isWhiteSpace: function isWhiteSpace(x) {
|
|
84062
|
+
return x === " " || x === "\xA0" || x === "\uFEFF" || // <-- this is not a Unicode WS, only a JS one
|
|
84063
|
+
x >= " " && x <= "\r" || // 9 A B C D
|
|
84064
|
+
// + whitespace characters from unicode, category Zs
|
|
84065
|
+
x === "\u1680" || x >= "\u2000" && x <= "\u200A" || // 0 1 2 3 4 5 6 7 8 9 A
|
|
84066
|
+
x === "\u2028" || x === "\u2029" || x === "\u202F" || x === "\u205F" || x === "\u3000";
|
|
84067
|
+
},
|
|
84068
|
+
isWhiteSpaceJSON: function isWhiteSpaceJSON(x) {
|
|
84069
|
+
return x === " " || x === " " || x === "\n" || x === "\r";
|
|
84070
|
+
},
|
|
84071
|
+
isLineTerminator: function isLineTerminator(x) {
|
|
84072
|
+
return x === "\n" || x === "\r" || x === "\u2028" || x === "\u2029";
|
|
84073
|
+
},
|
|
84074
|
+
isLineTerminatorJSON: function isLineTerminatorJSON(x) {
|
|
84075
|
+
return x === "\n" || x === "\r";
|
|
84076
|
+
},
|
|
84077
|
+
isIdentifierStart: function isIdentifierStart2(x) {
|
|
84078
|
+
return x === "$" || x === "_" || x >= "A" && x <= "Z" || x >= "a" && x <= "z" || x >= "\x80" && Uni.NonAsciiIdentifierStart.test(x);
|
|
84079
|
+
},
|
|
84080
|
+
isIdentifierPart: function isIdentifierPart(x) {
|
|
84081
|
+
return x === "$" || x === "_" || x >= "A" && x <= "Z" || x >= "a" && x <= "z" || x >= "0" && x <= "9" || // <-- addition to Start
|
|
84082
|
+
x >= "\x80" && Uni.NonAsciiIdentifierPart.test(x);
|
|
84083
|
+
},
|
|
84084
|
+
// ECMAScript 5.1/Unicode v6.3.0 NonAsciiIdentifierStart:
|
|
84085
|
+
NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
|
|
84086
|
+
// ECMAScript 5.1/Unicode v6.3.0 NonAsciiIdentifierPart:
|
|
84087
|
+
/* eslint-disable-next-line no-misleading-character-class */
|
|
84088
|
+
NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0\u08A2-\u08AC\u08E4-\u08FE\u0900-\u0963\u0966-\u096F\u0971-\u0977\u0979-\u097F\u0981-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C82\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191C\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1D00-\u1DE6\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA697\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7B\uAA80-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE26\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/
|
|
84089
|
+
};
|
|
84090
|
+
function isHexDigit2(x) {
|
|
84091
|
+
return x >= "0" && x <= "9" || x >= "A" && x <= "F" || x >= "a" && x <= "f";
|
|
84092
|
+
}
|
|
84093
|
+
function isOctDigit(x) {
|
|
84094
|
+
return x >= "0" && x <= "7";
|
|
84095
|
+
}
|
|
84096
|
+
function isDecDigit(x) {
|
|
84097
|
+
return x >= "0" && x <= "9";
|
|
84098
|
+
}
|
|
84099
|
+
function isBOM(x) {
|
|
84100
|
+
return x.charCodeAt(0) === 65279;
|
|
84101
|
+
}
|
|
84102
|
+
const unescapeMap = {
|
|
84103
|
+
"'": "'",
|
|
84104
|
+
'"': '"',
|
|
84105
|
+
"\\": "\\",
|
|
84106
|
+
b: "\b",
|
|
84107
|
+
f: "\f",
|
|
84108
|
+
n: "\n",
|
|
84109
|
+
r: "\r",
|
|
84110
|
+
t: " ",
|
|
84111
|
+
v: "\v",
|
|
84112
|
+
"/": "/"
|
|
84113
|
+
};
|
|
84114
|
+
const ownsProperty = Object.hasOwn;
|
|
84115
|
+
const emptyObject = {};
|
|
84116
|
+
function parseInternal(input, options) {
|
|
84117
|
+
if (typeof input !== "string" || !(input instanceof String)) {
|
|
84118
|
+
input = String(input);
|
|
84119
|
+
}
|
|
84120
|
+
const json5 = options.mode === "json5";
|
|
84121
|
+
const ignoreBOM = options.ignoreBOM;
|
|
84122
|
+
const ignoreComments = options.ignoreComments || options.mode === "cjson" || json5;
|
|
84123
|
+
const ignoreTrailingCommas = options.ignoreTrailingCommas || json5;
|
|
84124
|
+
const ignoreProtoKey = options.ignoreProtoKey;
|
|
84125
|
+
const ignorePrototypeKeys = options.ignorePrototypeKeys;
|
|
84126
|
+
const allowSingleQuotedStrings = options.allowSingleQuotedStrings || json5;
|
|
84127
|
+
const allowDuplicateObjectKeys = options.allowDuplicateObjectKeys;
|
|
84128
|
+
const reviver = options.reviver;
|
|
84129
|
+
const tokenize2 = options.tokenize;
|
|
84130
|
+
const rawTokens = options.rawTokens;
|
|
84131
|
+
const tokenLocations = options.tokenLocations;
|
|
84132
|
+
const tokenPaths = options.tokenPaths;
|
|
84133
|
+
const isLineTerminator = json5 ? Uni.isLineTerminator : Uni.isLineTerminatorJSON;
|
|
84134
|
+
const isWhiteSpace = json5 ? Uni.isWhiteSpace : Uni.isWhiteSpaceJSON;
|
|
84135
|
+
const inputLength = input.length;
|
|
84136
|
+
let lineNumber = 0;
|
|
84137
|
+
let lineStart = 0;
|
|
84138
|
+
let position = 0;
|
|
84139
|
+
const tokens = [];
|
|
84140
|
+
let startToken;
|
|
84141
|
+
let endToken;
|
|
84142
|
+
let tokenPath;
|
|
84143
|
+
if (tokenize2) {
|
|
84144
|
+
let tokenOffset = null;
|
|
84145
|
+
let tokenLine;
|
|
84146
|
+
let tokenColumn;
|
|
84147
|
+
startToken = function() {
|
|
84148
|
+
if (tokenOffset !== null) throw Error("internal error, token overlap");
|
|
84149
|
+
tokenLine = lineNumber + 1;
|
|
84150
|
+
tokenColumn = position - lineStart + 1;
|
|
84151
|
+
tokenOffset = position;
|
|
84152
|
+
};
|
|
84153
|
+
endToken = function(type, value) {
|
|
84154
|
+
if (tokenOffset !== position) {
|
|
84155
|
+
const token = { type };
|
|
84156
|
+
if (rawTokens) {
|
|
84157
|
+
token.raw = input.substr(tokenOffset, position - tokenOffset);
|
|
84158
|
+
}
|
|
84159
|
+
if (value !== void 0) {
|
|
84160
|
+
token.value = value;
|
|
84161
|
+
}
|
|
84162
|
+
if (tokenLocations) {
|
|
84163
|
+
token.location = {
|
|
84164
|
+
start: {
|
|
84165
|
+
column: tokenColumn,
|
|
84166
|
+
line: tokenLine,
|
|
84167
|
+
offset: tokenOffset
|
|
84168
|
+
}
|
|
84169
|
+
};
|
|
84170
|
+
}
|
|
84171
|
+
if (tokenPaths) {
|
|
84172
|
+
token.path = tokenPath.slice();
|
|
84173
|
+
}
|
|
84174
|
+
tokens.push(token);
|
|
84175
|
+
}
|
|
84176
|
+
tokenOffset = null;
|
|
84177
|
+
return value;
|
|
84178
|
+
};
|
|
84179
|
+
tokenPaths && (tokenPath = []);
|
|
84180
|
+
}
|
|
84181
|
+
function generateMessage() {
|
|
84182
|
+
let message;
|
|
84183
|
+
if (position < inputLength) {
|
|
84184
|
+
const token = JSON.stringify(input[position]);
|
|
84185
|
+
message = `Unexpected token ${token}`;
|
|
84186
|
+
} else {
|
|
84187
|
+
message = "Unexpected end of input";
|
|
84188
|
+
}
|
|
84189
|
+
return message;
|
|
84190
|
+
}
|
|
84191
|
+
function createError(message) {
|
|
84192
|
+
const column = position - lineStart + 1;
|
|
84193
|
+
++lineNumber;
|
|
84194
|
+
const texts = getTexts(message, input, position, lineNumber, column);
|
|
84195
|
+
const error = SyntaxError(texts.message);
|
|
84196
|
+
error.reason = message;
|
|
84197
|
+
error.excerpt = texts.excerpt;
|
|
84198
|
+
error.pointer = texts.pointer;
|
|
84199
|
+
error.location = {
|
|
84200
|
+
start: {
|
|
84201
|
+
column,
|
|
84202
|
+
line: lineNumber,
|
|
84203
|
+
offset: position
|
|
84204
|
+
}
|
|
84205
|
+
};
|
|
84206
|
+
return error;
|
|
84207
|
+
}
|
|
84208
|
+
function fail(message) {
|
|
84209
|
+
if (!message) {
|
|
84210
|
+
message = generateMessage();
|
|
84211
|
+
}
|
|
84212
|
+
const error = createError(message);
|
|
84213
|
+
throw error;
|
|
84214
|
+
}
|
|
84215
|
+
function newLine(char) {
|
|
84216
|
+
if (char === "\r" && input[position] === "\n") {
|
|
84217
|
+
++position;
|
|
84218
|
+
}
|
|
84219
|
+
lineStart = position;
|
|
84220
|
+
++lineNumber;
|
|
84221
|
+
}
|
|
84222
|
+
function parseGeneric() {
|
|
84223
|
+
if (position < inputLength) {
|
|
84224
|
+
startToken?.();
|
|
84225
|
+
const char = input[position++];
|
|
84226
|
+
if (char === '"' || char === "'" && allowSingleQuotedStrings) {
|
|
84227
|
+
const string = parseString(char);
|
|
84228
|
+
endToken?.("literal", string);
|
|
84229
|
+
return string;
|
|
84230
|
+
}
|
|
84231
|
+
if (char === "{") {
|
|
84232
|
+
endToken?.("symbol", "{");
|
|
84233
|
+
return parseObject();
|
|
84234
|
+
}
|
|
84235
|
+
if (char === "[") {
|
|
84236
|
+
endToken?.("symbol", "[");
|
|
84237
|
+
return parseArray();
|
|
84238
|
+
}
|
|
84239
|
+
if (char === "-" || char === "." || isDecDigit(char) || json5 && (char === "+" || char === "I" || char === "N")) {
|
|
84240
|
+
const number = parseNumber();
|
|
84241
|
+
endToken?.("literal", number);
|
|
84242
|
+
return number;
|
|
84243
|
+
}
|
|
84244
|
+
if (char === "n") {
|
|
84245
|
+
parseKeyword("null");
|
|
84246
|
+
endToken?.("literal", null);
|
|
84247
|
+
return null;
|
|
84248
|
+
}
|
|
84249
|
+
if (char === "t") {
|
|
84250
|
+
parseKeyword("true");
|
|
84251
|
+
endToken?.("literal", true);
|
|
84252
|
+
return true;
|
|
84253
|
+
}
|
|
84254
|
+
if (char === "f") {
|
|
84255
|
+
parseKeyword("false");
|
|
84256
|
+
endToken?.("literal", false);
|
|
84257
|
+
return false;
|
|
84258
|
+
}
|
|
84259
|
+
--position;
|
|
84260
|
+
endToken?.();
|
|
84261
|
+
return void 0;
|
|
84262
|
+
}
|
|
84263
|
+
}
|
|
84264
|
+
function parseKey() {
|
|
84265
|
+
let result;
|
|
84266
|
+
if (position < inputLength) {
|
|
84267
|
+
startToken?.();
|
|
84268
|
+
const char = input[position++];
|
|
84269
|
+
if (char === '"' || char === "'" && allowSingleQuotedStrings) {
|
|
84270
|
+
const string = parseString(char);
|
|
84271
|
+
endToken?.("literal", string);
|
|
84272
|
+
return string;
|
|
84273
|
+
}
|
|
84274
|
+
if (char === "{") {
|
|
84275
|
+
endToken?.("symbol", "{");
|
|
84276
|
+
return parseObject();
|
|
84277
|
+
}
|
|
84278
|
+
if (char === "[") {
|
|
84279
|
+
endToken?.("symbol", "[");
|
|
84280
|
+
return parseArray();
|
|
84281
|
+
}
|
|
84282
|
+
if (char === "." || isDecDigit(char)) {
|
|
84283
|
+
const number = parseNumber(true);
|
|
84284
|
+
endToken?.("literal", number);
|
|
84285
|
+
return number;
|
|
84286
|
+
}
|
|
84287
|
+
if (json5 && Uni.isIdentifierStart(char) || char === "\\" && input[position] === "u") {
|
|
84288
|
+
const rollback = position - 1;
|
|
84289
|
+
result = parseIdentifier();
|
|
84290
|
+
if (result === void 0) {
|
|
84291
|
+
position = rollback;
|
|
84292
|
+
endToken?.();
|
|
84293
|
+
return void 0;
|
|
84294
|
+
}
|
|
84295
|
+
endToken?.("literal", result);
|
|
84296
|
+
return result;
|
|
84297
|
+
}
|
|
84298
|
+
--position;
|
|
84299
|
+
endToken?.();
|
|
84300
|
+
return void 0;
|
|
84301
|
+
}
|
|
84302
|
+
}
|
|
84303
|
+
function skipBOM() {
|
|
84304
|
+
if (isBOM(input)) {
|
|
84305
|
+
startToken?.();
|
|
84306
|
+
++position;
|
|
84307
|
+
endToken?.("bom");
|
|
84308
|
+
}
|
|
84309
|
+
}
|
|
84310
|
+
function skipWhiteSpace2() {
|
|
84311
|
+
let insideWhiteSpace;
|
|
84312
|
+
function startWhiteSpace() {
|
|
84313
|
+
if (!insideWhiteSpace) {
|
|
84314
|
+
insideWhiteSpace = true;
|
|
84315
|
+
--position;
|
|
84316
|
+
startToken();
|
|
84317
|
+
++position;
|
|
84318
|
+
}
|
|
84319
|
+
}
|
|
84320
|
+
function endWhiteSpace() {
|
|
84321
|
+
if (insideWhiteSpace) {
|
|
84322
|
+
insideWhiteSpace = false;
|
|
84323
|
+
endToken("whitespace");
|
|
84324
|
+
}
|
|
84325
|
+
}
|
|
84326
|
+
while (position < inputLength) {
|
|
84327
|
+
const char = input[position++];
|
|
84328
|
+
if (isLineTerminator(char)) {
|
|
84329
|
+
startToken && startWhiteSpace();
|
|
84330
|
+
newLine(char);
|
|
84331
|
+
} else if (isWhiteSpace(char)) {
|
|
84332
|
+
startToken && startWhiteSpace();
|
|
84333
|
+
} else if (char === "/" && ignoreComments && (input[position] === "/" || input[position] === "*")) {
|
|
84334
|
+
if (startToken) {
|
|
84335
|
+
--position;
|
|
84336
|
+
endWhiteSpace();
|
|
84337
|
+
startToken();
|
|
84338
|
+
++position;
|
|
84339
|
+
}
|
|
84340
|
+
skipComment(input[position++] === "*");
|
|
84341
|
+
endToken?.("comment");
|
|
84342
|
+
} else {
|
|
84343
|
+
--position;
|
|
84344
|
+
break;
|
|
84345
|
+
}
|
|
84346
|
+
}
|
|
84347
|
+
endToken && endWhiteSpace();
|
|
84348
|
+
}
|
|
84349
|
+
function skipComment(multiLine) {
|
|
84350
|
+
while (position < inputLength) {
|
|
84351
|
+
const char = input[position++];
|
|
84352
|
+
if (isLineTerminator(char)) {
|
|
84353
|
+
if (!multiLine) {
|
|
84354
|
+
--position;
|
|
84355
|
+
return;
|
|
84356
|
+
}
|
|
84357
|
+
newLine(char);
|
|
84358
|
+
} else if (char === "*" && multiLine) {
|
|
84359
|
+
if (input[position] === "/") {
|
|
84360
|
+
++position;
|
|
84361
|
+
return;
|
|
84362
|
+
}
|
|
84363
|
+
} else {
|
|
84364
|
+
}
|
|
84365
|
+
}
|
|
84366
|
+
if (multiLine) {
|
|
84367
|
+
fail("Unclosed multiline comment");
|
|
84368
|
+
}
|
|
84369
|
+
}
|
|
84370
|
+
function parseKeyword(keyword) {
|
|
84371
|
+
const startPosition = position;
|
|
84372
|
+
for (let i = 1, keywordLength = keyword.length; i < keywordLength; ++i) {
|
|
84373
|
+
if (position >= inputLength || keyword[i] !== input[position]) {
|
|
84374
|
+
position = startPosition - 1;
|
|
84375
|
+
fail();
|
|
84376
|
+
}
|
|
84377
|
+
++position;
|
|
84378
|
+
}
|
|
84379
|
+
}
|
|
84380
|
+
function parseObject() {
|
|
84381
|
+
let result = {};
|
|
84382
|
+
let isNotEmpty = false;
|
|
84383
|
+
while (position < inputLength) {
|
|
84384
|
+
skipWhiteSpace2();
|
|
84385
|
+
const key = parseKey();
|
|
84386
|
+
if (allowDuplicateObjectKeys === false && ownsProperty(result, key)) {
|
|
84387
|
+
fail(`Duplicate key: "${key}"`);
|
|
84388
|
+
}
|
|
84389
|
+
skipWhiteSpace2();
|
|
84390
|
+
startToken?.();
|
|
84391
|
+
let char = input[position++];
|
|
84392
|
+
endToken?.("symbol", char);
|
|
84393
|
+
if (char === "}" && key === void 0) {
|
|
84394
|
+
if (!ignoreTrailingCommas && isNotEmpty) {
|
|
84395
|
+
--position;
|
|
84396
|
+
fail("Trailing comma in object");
|
|
84397
|
+
}
|
|
84398
|
+
return result;
|
|
84399
|
+
}
|
|
84400
|
+
if (char === ":" && key !== void 0) {
|
|
84401
|
+
skipWhiteSpace2();
|
|
84402
|
+
tokenPath?.push(key);
|
|
84403
|
+
let value = parseGeneric();
|
|
84404
|
+
tokenPath?.pop();
|
|
84405
|
+
if (value === void 0) fail(`No value found for key "${key}"`);
|
|
84406
|
+
if (typeof key !== "string") {
|
|
84407
|
+
if (!json5 || typeof key !== "number") {
|
|
84408
|
+
fail(`Wrong key type: "${key}"`);
|
|
84409
|
+
}
|
|
84410
|
+
}
|
|
84411
|
+
if (ignorePrototypeKeys && (key in emptyObject || emptyObject[key] != null) || ignoreProtoKey && key === "__proto__") {
|
|
84412
|
+
} else {
|
|
84413
|
+
if (reviver) {
|
|
84414
|
+
value = reviver(key, value);
|
|
84415
|
+
}
|
|
84416
|
+
if (value !== void 0) {
|
|
84417
|
+
isNotEmpty = true;
|
|
84418
|
+
if (key === "__proto__") {
|
|
84419
|
+
result = Object.assign(JSON.parse(`{"__proto__":${JSON.stringify(value)}}`), result);
|
|
84420
|
+
} else {
|
|
84421
|
+
result[key] = value;
|
|
84422
|
+
}
|
|
84423
|
+
}
|
|
84424
|
+
}
|
|
84425
|
+
skipWhiteSpace2();
|
|
84426
|
+
startToken?.();
|
|
84427
|
+
char = input[position++];
|
|
84428
|
+
endToken?.("symbol", char);
|
|
84429
|
+
if (char === ",") {
|
|
84430
|
+
} else if (char === "}") {
|
|
84431
|
+
return result;
|
|
84432
|
+
} else {
|
|
84433
|
+
fail();
|
|
84434
|
+
}
|
|
84435
|
+
} else {
|
|
84436
|
+
--position;
|
|
84437
|
+
fail();
|
|
84438
|
+
}
|
|
84439
|
+
}
|
|
84440
|
+
fail();
|
|
84441
|
+
}
|
|
84442
|
+
function parseArray() {
|
|
84443
|
+
const result = [];
|
|
84444
|
+
while (position < inputLength) {
|
|
84445
|
+
skipWhiteSpace2();
|
|
84446
|
+
tokenPath?.push(result.length);
|
|
84447
|
+
let item = parseGeneric();
|
|
84448
|
+
tokenPath?.pop();
|
|
84449
|
+
skipWhiteSpace2();
|
|
84450
|
+
startToken?.();
|
|
84451
|
+
const char = input[position++];
|
|
84452
|
+
endToken?.("symbol", char);
|
|
84453
|
+
if (item !== void 0) {
|
|
84454
|
+
if (reviver) {
|
|
84455
|
+
item = reviver(String(result.length), item);
|
|
84456
|
+
}
|
|
84457
|
+
if (item === void 0) {
|
|
84458
|
+
++result.length;
|
|
84459
|
+
item = true;
|
|
84460
|
+
} else {
|
|
84461
|
+
result.push(item);
|
|
84462
|
+
}
|
|
84463
|
+
}
|
|
84464
|
+
if (char === ",") {
|
|
84465
|
+
if (item === void 0) {
|
|
84466
|
+
fail("Elisions are not supported");
|
|
84467
|
+
}
|
|
84468
|
+
} else if (char === "]") {
|
|
84469
|
+
if (!ignoreTrailingCommas && item === void 0 && result.length) {
|
|
84470
|
+
--position;
|
|
84471
|
+
fail("Trailing comma in array");
|
|
84472
|
+
}
|
|
84473
|
+
return result;
|
|
84474
|
+
} else {
|
|
84475
|
+
--position;
|
|
84476
|
+
fail();
|
|
84477
|
+
}
|
|
84478
|
+
}
|
|
84479
|
+
}
|
|
84480
|
+
function parseNumber() {
|
|
84481
|
+
--position;
|
|
84482
|
+
let start = position;
|
|
84483
|
+
let char = input[position++];
|
|
84484
|
+
const toNumber = function(isOctal) {
|
|
84485
|
+
const string = input.substr(start, position - start);
|
|
84486
|
+
let result;
|
|
84487
|
+
if (isOctal) {
|
|
84488
|
+
result = Number.parseInt(string.replace(/^0o?/, ""), 8);
|
|
84489
|
+
} else {
|
|
84490
|
+
result = Number(string);
|
|
84491
|
+
}
|
|
84492
|
+
if (Number.isNaN(result)) {
|
|
84493
|
+
--position;
|
|
84494
|
+
fail(`Bad numeric literal - "${input.substr(start, position - start + 1)}"`);
|
|
84495
|
+
} else if (!json5 && !string.match(/^-?(0|[1-9][0-9]*)(\.[0-9]+)?(e[+-]?[0-9]+)?$/i)) {
|
|
84496
|
+
--position;
|
|
84497
|
+
fail(`Non-json numeric literal - "${input.substr(start, position - start + 1)}"`);
|
|
84498
|
+
} else {
|
|
84499
|
+
return result;
|
|
84500
|
+
}
|
|
84501
|
+
};
|
|
84502
|
+
if (char === "-" || char === "+" && json5) {
|
|
84503
|
+
char = input[position++];
|
|
84504
|
+
}
|
|
84505
|
+
if (char === "N" && json5) {
|
|
84506
|
+
parseKeyword("NaN");
|
|
84507
|
+
return Number.NaN;
|
|
84508
|
+
}
|
|
84509
|
+
if (char === "I" && json5) {
|
|
84510
|
+
parseKeyword("Infinity");
|
|
84511
|
+
return toNumber();
|
|
84512
|
+
}
|
|
84513
|
+
if (char >= "1" && char <= "9") {
|
|
84514
|
+
while (position < inputLength && isDecDigit(input[position])) {
|
|
84515
|
+
++position;
|
|
84516
|
+
}
|
|
84517
|
+
char = input[position++];
|
|
84518
|
+
}
|
|
84519
|
+
if (char === "0") {
|
|
84520
|
+
char = input[position++];
|
|
84521
|
+
const isOctal = char === "o" || char === "O" || isOctDigit(char);
|
|
84522
|
+
const isHex = char === "x" || char === "X";
|
|
84523
|
+
if (json5 && (isOctal || isHex)) {
|
|
84524
|
+
while (position < inputLength && (isHex ? isHexDigit2 : isOctDigit)(input[position])) {
|
|
84525
|
+
++position;
|
|
84526
|
+
}
|
|
84527
|
+
let sign = 1;
|
|
84528
|
+
if (input[start] === "-") {
|
|
84529
|
+
sign = -1;
|
|
84530
|
+
++start;
|
|
84531
|
+
} else if (input[start] === "+") {
|
|
84532
|
+
++start;
|
|
84533
|
+
}
|
|
84534
|
+
return sign * toNumber(isOctal);
|
|
84535
|
+
}
|
|
84536
|
+
}
|
|
84537
|
+
if (char === ".") {
|
|
84538
|
+
while (position < inputLength && isDecDigit(input[position])) {
|
|
84539
|
+
++position;
|
|
84540
|
+
}
|
|
84541
|
+
char = input[position++];
|
|
84542
|
+
}
|
|
84543
|
+
if (char === "e" || char === "E") {
|
|
84544
|
+
char = input[position++];
|
|
84545
|
+
if (char === "-" || char === "+") {
|
|
84546
|
+
++position;
|
|
84547
|
+
}
|
|
84548
|
+
while (position < inputLength && isDecDigit(input[position])) {
|
|
84549
|
+
++position;
|
|
84550
|
+
}
|
|
84551
|
+
char = input[position++];
|
|
84552
|
+
}
|
|
84553
|
+
--position;
|
|
84554
|
+
return toNumber();
|
|
84555
|
+
}
|
|
84556
|
+
function parseIdentifier() {
|
|
84557
|
+
--position;
|
|
84558
|
+
let result = "";
|
|
84559
|
+
while (position < inputLength) {
|
|
84560
|
+
let char = input[position++];
|
|
84561
|
+
if (char === "\\" && input[position] === "u" && isHexDigit2(input[position + 1]) && isHexDigit2(input[position + 2]) && isHexDigit2(input[position + 3]) && isHexDigit2(input[position + 4])) {
|
|
84562
|
+
char = String.fromCharCode(Number.parseInt(input.substr(position + 1, 4), 16));
|
|
84563
|
+
position += 5;
|
|
84564
|
+
}
|
|
84565
|
+
if (result.length) {
|
|
84566
|
+
if (Uni.isIdentifierPart(char)) {
|
|
84567
|
+
result += char;
|
|
84568
|
+
} else {
|
|
84569
|
+
--position;
|
|
84570
|
+
return result;
|
|
84571
|
+
}
|
|
84572
|
+
} else {
|
|
84573
|
+
if (Uni.isIdentifierStart(char)) {
|
|
84574
|
+
result += char;
|
|
84575
|
+
} else {
|
|
84576
|
+
return void 0;
|
|
84577
|
+
}
|
|
84578
|
+
}
|
|
84579
|
+
}
|
|
84580
|
+
fail();
|
|
84581
|
+
}
|
|
84582
|
+
function parseString(endChar) {
|
|
84583
|
+
let result = "";
|
|
84584
|
+
while (position < inputLength) {
|
|
84585
|
+
let char = input[position++];
|
|
84586
|
+
if (char === endChar) {
|
|
84587
|
+
return result;
|
|
84588
|
+
}
|
|
84589
|
+
if (char === "\\") {
|
|
84590
|
+
if (position >= inputLength) {
|
|
84591
|
+
fail();
|
|
84592
|
+
}
|
|
84593
|
+
char = input[position++];
|
|
84594
|
+
if (unescapeMap[char] && (json5 || char !== "v" && (char !== "'" || allowSingleQuotedStrings))) {
|
|
84595
|
+
result += unescapeMap[char];
|
|
84596
|
+
} else if (json5 && isLineTerminator(char)) {
|
|
84597
|
+
newLine(char);
|
|
84598
|
+
} else if (char === "u" || char === "x" && json5) {
|
|
84599
|
+
const count = char === "u" ? 4 : 2;
|
|
84600
|
+
for (let i = 0; i < count; ++i) {
|
|
84601
|
+
if (position >= inputLength) {
|
|
84602
|
+
fail();
|
|
84603
|
+
}
|
|
84604
|
+
if (!isHexDigit2(input[position])) {
|
|
84605
|
+
fail("Bad escape sequence");
|
|
84606
|
+
}
|
|
84607
|
+
position++;
|
|
84608
|
+
}
|
|
84609
|
+
result += String.fromCharCode(Number.parseInt(input.substr(position - count, count), 16));
|
|
84610
|
+
} else if (json5 && isOctDigit(char)) {
|
|
84611
|
+
let digits;
|
|
84612
|
+
if (char < "4" && isOctDigit(input[position]) && isOctDigit(input[position + 1])) {
|
|
84613
|
+
digits = 3;
|
|
84614
|
+
} else if (isOctDigit(input[position])) {
|
|
84615
|
+
digits = 2;
|
|
84616
|
+
} else {
|
|
84617
|
+
digits = 1;
|
|
84618
|
+
}
|
|
84619
|
+
position += digits - 1;
|
|
84620
|
+
result += String.fromCharCode(Number.parseInt(input.substr(position - digits, digits), 8));
|
|
84621
|
+
} else if (json5) {
|
|
84622
|
+
result += char;
|
|
84623
|
+
} else {
|
|
84624
|
+
--position;
|
|
84625
|
+
fail();
|
|
84626
|
+
}
|
|
84627
|
+
} else if (isLineTerminator(char)) {
|
|
84628
|
+
fail();
|
|
84629
|
+
} else {
|
|
84630
|
+
if (!json5 && char.charCodeAt(0) < 32) {
|
|
84631
|
+
--position;
|
|
84632
|
+
fail("Unexpected control character");
|
|
84633
|
+
}
|
|
84634
|
+
result += char;
|
|
84635
|
+
}
|
|
84636
|
+
}
|
|
84637
|
+
fail();
|
|
84638
|
+
}
|
|
84639
|
+
if (ignoreBOM) {
|
|
84640
|
+
skipBOM();
|
|
84641
|
+
}
|
|
84642
|
+
skipWhiteSpace2();
|
|
84643
|
+
let returnValue = parseGeneric();
|
|
84644
|
+
if (returnValue !== void 0 || position < inputLength) {
|
|
84645
|
+
skipWhiteSpace2();
|
|
84646
|
+
if (position >= inputLength) {
|
|
84647
|
+
if (reviver) {
|
|
84648
|
+
returnValue = reviver("", returnValue);
|
|
84649
|
+
}
|
|
84650
|
+
return tokenize2 ? tokens : returnValue;
|
|
84651
|
+
}
|
|
84652
|
+
fail();
|
|
84653
|
+
} else {
|
|
84654
|
+
if (position) {
|
|
84655
|
+
fail("No data, only a whitespace");
|
|
84656
|
+
} else {
|
|
84657
|
+
fail("No data, empty input");
|
|
84658
|
+
}
|
|
84659
|
+
}
|
|
84660
|
+
}
|
|
84661
|
+
function parseCustom(input, options) {
|
|
84662
|
+
if (typeof options === "function") {
|
|
84663
|
+
options = {
|
|
84664
|
+
reviver: options
|
|
84665
|
+
};
|
|
84666
|
+
} else if (!options) {
|
|
84667
|
+
options = {};
|
|
84668
|
+
}
|
|
84669
|
+
return parseInternal(input, options);
|
|
84670
|
+
}
|
|
84671
|
+
function tokenize(input, options) {
|
|
84672
|
+
if (!options) {
|
|
84673
|
+
options = {};
|
|
84674
|
+
}
|
|
84675
|
+
const oldTokenize = options.tokenize;
|
|
84676
|
+
options.tokenize = true;
|
|
84677
|
+
const tokens = parseInternal(input, options);
|
|
84678
|
+
options.tokenize = oldTokenize;
|
|
84679
|
+
return tokens;
|
|
84680
|
+
}
|
|
84681
|
+
function escapePointerToken(token) {
|
|
84682
|
+
return token.toString().replace(/~/g, "~0").replace(/\//g, "~1");
|
|
84683
|
+
}
|
|
84684
|
+
function pathToPointer(tokens) {
|
|
84685
|
+
if (tokens.length === 0) {
|
|
84686
|
+
return "";
|
|
84687
|
+
}
|
|
84688
|
+
return `/${tokens.map(escapePointerToken).join("/")}`;
|
|
84689
|
+
}
|
|
84690
|
+
function unescapePointerToken(token) {
|
|
84691
|
+
return token.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
84692
|
+
}
|
|
84693
|
+
function pointerToPath(pointer) {
|
|
84694
|
+
if (pointer === "") {
|
|
84695
|
+
return [];
|
|
84696
|
+
}
|
|
84697
|
+
if (pointer[0] !== "/") {
|
|
84698
|
+
throw new Error('Missing initial "/" in the reference');
|
|
84699
|
+
}
|
|
84700
|
+
return pointer.substr(1).split("/").map(unescapePointerToken);
|
|
84701
|
+
}
|
|
84702
|
+
function getLineAndColumn(input, offset2) {
|
|
84703
|
+
const lines = input.substr(0, offset2).split(/\r?\n/);
|
|
84704
|
+
const line = lines.length;
|
|
84705
|
+
const column = lines[line - 1].length + 1;
|
|
84706
|
+
return {
|
|
84707
|
+
line,
|
|
84708
|
+
column
|
|
84709
|
+
};
|
|
84710
|
+
}
|
|
84711
|
+
function getOffset(input, line, column) {
|
|
84712
|
+
if (line > 1) {
|
|
84713
|
+
const breaks = /\r?\n/g;
|
|
84714
|
+
let match;
|
|
84715
|
+
while (match = breaks.exec(input)) {
|
|
84716
|
+
if (--line === 1) {
|
|
84717
|
+
return match.index + column;
|
|
84718
|
+
}
|
|
84719
|
+
}
|
|
84720
|
+
}
|
|
84721
|
+
return column - 1;
|
|
84722
|
+
}
|
|
84723
|
+
function pastInput(input, offset2) {
|
|
84724
|
+
const start = Math.max(0, offset2 - 20);
|
|
84725
|
+
const previous = input.substr(start, offset2 - start);
|
|
84726
|
+
return (offset2 > 20 ? "..." : "") + previous.replace(/\r?\n/g, "");
|
|
84727
|
+
}
|
|
84728
|
+
function upcomingInput(input, offset2) {
|
|
84729
|
+
let start = Math.max(0, offset2 - 20);
|
|
84730
|
+
start += offset2 - start;
|
|
84731
|
+
const rest = input.length - start;
|
|
84732
|
+
const next2 = input.substr(start, Math.min(20, rest));
|
|
84733
|
+
return next2.replace(/\r?\n/g, "") + (rest > 20 ? "..." : "");
|
|
84734
|
+
}
|
|
84735
|
+
function getPositionContext(input, offset2) {
|
|
84736
|
+
const past = pastInput(input, offset2);
|
|
84737
|
+
const upcoming = upcomingInput(input, offset2);
|
|
84738
|
+
const pointer = `${new Array(past.length + 1).join("-")}^`;
|
|
84739
|
+
return {
|
|
84740
|
+
excerpt: past + upcoming,
|
|
84741
|
+
pointer
|
|
84742
|
+
};
|
|
84743
|
+
}
|
|
84744
|
+
function getReason(error) {
|
|
84745
|
+
let message = error.message.replace("JSON.parse: ", "").replace("JSON Parse error: ", "");
|
|
84746
|
+
const firstCharacter = message.charAt(0);
|
|
84747
|
+
if (firstCharacter >= "a") {
|
|
84748
|
+
message = firstCharacter.toUpperCase() + message.substr(1);
|
|
84749
|
+
}
|
|
84750
|
+
return message;
|
|
84751
|
+
}
|
|
84752
|
+
function getLocationOnV8(input, reason) {
|
|
84753
|
+
const match = / in JSON at position (\d+)$/.exec(reason);
|
|
84754
|
+
if (match) {
|
|
84755
|
+
const offset2 = +match[1];
|
|
84756
|
+
const location = getLineAndColumn(input, offset2);
|
|
84757
|
+
return {
|
|
84758
|
+
offset: offset2,
|
|
84759
|
+
line: location.line,
|
|
84760
|
+
column: location.column,
|
|
84761
|
+
reason: reason.substr(0, match.index)
|
|
84762
|
+
};
|
|
84763
|
+
}
|
|
84764
|
+
}
|
|
84765
|
+
function checkUnexpectedEndOnV8(input, reason) {
|
|
84766
|
+
const match = / end of JSON input$/.exec(reason);
|
|
84767
|
+
if (match) {
|
|
84768
|
+
const offset2 = input.length;
|
|
84769
|
+
const location = getLineAndColumn(input, offset2);
|
|
84770
|
+
return {
|
|
84771
|
+
offset: offset2,
|
|
84772
|
+
line: location.line,
|
|
84773
|
+
column: location.column,
|
|
84774
|
+
reason: reason.substr(0, match.index + 4)
|
|
84775
|
+
};
|
|
84776
|
+
}
|
|
84777
|
+
}
|
|
84778
|
+
function getLocationOnSpiderMonkey(input, reason) {
|
|
84779
|
+
const match = / at line (\d+) column (\d+) of the JSON data$/.exec(reason);
|
|
84780
|
+
if (match) {
|
|
84781
|
+
const line = +match[1];
|
|
84782
|
+
const column = +match[2];
|
|
84783
|
+
const offset2 = getOffset(input, line, column);
|
|
84784
|
+
return {
|
|
84785
|
+
offset: offset2,
|
|
84786
|
+
line,
|
|
84787
|
+
column,
|
|
84788
|
+
reason: reason.substr(0, match.index)
|
|
84789
|
+
};
|
|
84790
|
+
}
|
|
84791
|
+
}
|
|
84792
|
+
function getTexts(reason, input, offset2, line, column) {
|
|
84793
|
+
const position = getPositionContext(input, offset2);
|
|
84794
|
+
const excerpt = position.excerpt;
|
|
84795
|
+
let message;
|
|
84796
|
+
let pointer;
|
|
84797
|
+
if (typeof line === "number") {
|
|
84798
|
+
pointer = position.pointer;
|
|
84799
|
+
message = `Parse error on line ${line}, column ${column}:
|
|
84800
|
+
${excerpt}
|
|
84801
|
+
${pointer}
|
|
84802
|
+
${reason}`;
|
|
84803
|
+
} else {
|
|
84804
|
+
message = `Parse error in JSON input:
|
|
84805
|
+
${excerpt}
|
|
84806
|
+
${reason}`;
|
|
84807
|
+
}
|
|
84808
|
+
return {
|
|
84809
|
+
message,
|
|
84810
|
+
excerpt,
|
|
84811
|
+
pointer
|
|
84812
|
+
};
|
|
84813
|
+
}
|
|
84814
|
+
function improveNativeError(input, error) {
|
|
84815
|
+
let reason = getReason(error);
|
|
84816
|
+
const location = getLocationOnV8(input, reason) || checkUnexpectedEndOnV8(input, reason) || getLocationOnSpiderMonkey(input, reason);
|
|
84817
|
+
let offset2;
|
|
84818
|
+
let line;
|
|
84819
|
+
let column;
|
|
84820
|
+
if (location) {
|
|
84821
|
+
offset2 = location.offset;
|
|
84822
|
+
line = location.line;
|
|
84823
|
+
column = location.column;
|
|
84824
|
+
reason = location.reason;
|
|
84825
|
+
} else {
|
|
84826
|
+
offset2 = 0;
|
|
84827
|
+
}
|
|
84828
|
+
error.reason = reason;
|
|
84829
|
+
const texts = getTexts(reason, input, offset2, line, column);
|
|
84830
|
+
error.message = texts.message;
|
|
84831
|
+
error.excerpt = texts.excerpt;
|
|
84832
|
+
if (texts.pointer) {
|
|
84833
|
+
error.pointer = texts.pointer;
|
|
84834
|
+
error.location = {
|
|
84835
|
+
start: {
|
|
84836
|
+
column,
|
|
84837
|
+
line,
|
|
84838
|
+
offset: offset2
|
|
84839
|
+
}
|
|
84840
|
+
};
|
|
84841
|
+
}
|
|
84842
|
+
return error;
|
|
84843
|
+
}
|
|
84844
|
+
function parseNative(input, reviver) {
|
|
84845
|
+
try {
|
|
84846
|
+
return JSON.parse(input, reviver);
|
|
84847
|
+
} catch (error) {
|
|
84848
|
+
const newError = improveNativeError(input, error);
|
|
84849
|
+
if (error.location) throw newError;
|
|
84850
|
+
return parseCustom(input, reviver);
|
|
84851
|
+
}
|
|
84852
|
+
}
|
|
84853
|
+
const isSafari2 = typeof navigator !== "undefined" && /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
|
|
84854
|
+
const oldNode = typeof process !== "undefined" && process.version.startsWith("v4.");
|
|
84855
|
+
function needsCustomParser(options) {
|
|
84856
|
+
return options.ignoreBOM || options.ignoreComments || options.ignoreTrailingCommas || options.allowSingleQuotedStrings || options.allowDuplicateObjectKeys === false || options.ignoreProtoKey || options.ignorePrototypeKeys || options.mode === "cjson" || options.mode === "json5" || isSafari2 || oldNode;
|
|
84857
|
+
}
|
|
84858
|
+
function getReviver(options) {
|
|
84859
|
+
if (typeof options === "function") {
|
|
84860
|
+
return options;
|
|
84861
|
+
}
|
|
84862
|
+
if (options) {
|
|
84863
|
+
return options.reviver;
|
|
84864
|
+
}
|
|
84865
|
+
}
|
|
84866
|
+
function parse10(input, options) {
|
|
84867
|
+
options || (options = {});
|
|
84868
|
+
return needsCustomParser(options) ? parseCustom(input, options) : parseNative(input, getReviver(options));
|
|
84869
|
+
}
|
|
84870
|
+
exports2.parse = parse10;
|
|
84871
|
+
exports2.tokenize = tokenize;
|
|
84872
|
+
exports2.pathToPointer = pathToPointer;
|
|
84873
|
+
exports2.pointerToPath = pointerToPath;
|
|
84874
|
+
exports2.parseNative = parseNative;
|
|
84875
|
+
exports2.parseCustom = parseCustom;
|
|
84876
|
+
exports2.getErrorTexts = getTexts;
|
|
84877
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
84878
|
+
});
|
|
84879
|
+
}
|
|
84880
|
+
});
|
|
84881
|
+
|
|
84053
84882
|
// node_modules/sjcl/sjcl.js
|
|
84054
84883
|
var require_sjcl = __commonJS({
|
|
84055
84884
|
"node_modules/sjcl/sjcl.js"(exports, module) {
|
|
@@ -85647,9 +86476,11 @@
|
|
|
85647
86476
|
if (lastRequestWithoutResIdIndex > -1) {
|
|
85648
86477
|
messages[lastRequestWithoutResIdIndex] = {
|
|
85649
86478
|
...messages[lastRequestWithoutResIdIndex],
|
|
85650
|
-
ctx: {
|
|
86479
|
+
ctx: msg?.ctx?.tsFinal ? {
|
|
85651
86480
|
...messages[lastRequestWithoutResIdIndex].ctx,
|
|
85652
86481
|
tsFinal: msg?.ctx?.tsFinal
|
|
86482
|
+
} : {
|
|
86483
|
+
...messages[lastRequestWithoutResIdIndex].ctx
|
|
85653
86484
|
}
|
|
85654
86485
|
};
|
|
85655
86486
|
}
|
|
@@ -85830,9 +86661,9 @@
|
|
|
85830
86661
|
return line.replace(/[ \t]+/g, " ").trim();
|
|
85831
86662
|
});
|
|
85832
86663
|
plainText = processedLines.join("\n");
|
|
85833
|
-
codeBlocks.forEach((
|
|
86664
|
+
codeBlocks.forEach((code, index2) => {
|
|
85834
86665
|
const placeholder = `<<<CODE_BLOCK_${index2}>>>`;
|
|
85835
|
-
plainText = plainText.replace(placeholder, "\n\n" +
|
|
86666
|
+
plainText = plainText.replace(placeholder, "\n\n" + code);
|
|
85836
86667
|
});
|
|
85837
86668
|
plainText = plainText.replace(/\n{3,}/g, "\n\n").trim();
|
|
85838
86669
|
const blobText = new Blob([plainText], { type: "text/plain" });
|
|
@@ -86711,8 +87542,8 @@
|
|
|
86711
87542
|
function parseSvgSize(svgString) {
|
|
86712
87543
|
const defaultSize = uiState6.textChat.defaults.defaultSvgIconSize;
|
|
86713
87544
|
if (!svgString) return [defaultSize, defaultSize];
|
|
86714
|
-
const
|
|
86715
|
-
const svgDoc =
|
|
87545
|
+
const parser = new DOMParser();
|
|
87546
|
+
const svgDoc = parser.parseFromString(svgString, "image/svg+xml");
|
|
86716
87547
|
const svgElement = svgDoc.querySelector("svg");
|
|
86717
87548
|
const width = svgElement.getAttribute("width");
|
|
86718
87549
|
const height = svgElement.getAttribute("height");
|
|
@@ -90038,18 +90869,18 @@
|
|
|
90038
90869
|
}
|
|
90039
90870
|
var hljsTheme = false;
|
|
90040
90871
|
function initHighlightJs(theme, customDocument) {
|
|
90041
|
-
const
|
|
90872
|
+
const doc = customDocument || document;
|
|
90042
90873
|
const hljsStylesId = `alan-hljs-styles-${theme}`;
|
|
90043
|
-
if (hljsTheme === theme &&
|
|
90874
|
+
if (hljsTheme === theme && doc.getElementById(hljsStylesId)) return;
|
|
90044
90875
|
hljsTheme = theme;
|
|
90045
|
-
var style =
|
|
90876
|
+
var style = doc.createElement("style");
|
|
90046
90877
|
style.textContent = highlightJsCss(theme);
|
|
90047
90878
|
style.id = hljsStylesId;
|
|
90048
|
-
|
|
90049
|
-
var lightHLJSOnlyStyle =
|
|
90879
|
+
doc.getElementsByTagName("head")[0].appendChild(style);
|
|
90880
|
+
var lightHLJSOnlyStyle = doc.createElement("style");
|
|
90050
90881
|
lightHLJSOnlyStyle.textContent = highlightJsCssForOnlyLightTheme();
|
|
90051
90882
|
lightHLJSOnlyStyle.id = `alan-hljs-styles-light-only`;
|
|
90052
|
-
|
|
90883
|
+
doc.getElementsByTagName("head")[0].appendChild(lightHLJSOnlyStyle);
|
|
90053
90884
|
}
|
|
90054
90885
|
function highlightCode(msgsHolder) {
|
|
90055
90886
|
if (window.hljs) {
|
|
@@ -90532,17 +91363,17 @@ code.hljs {
|
|
|
90532
91363
|
}
|
|
90533
91364
|
return pathSegments.join(" > ");
|
|
90534
91365
|
}
|
|
90535
|
-
function collectScrollableElementStates(
|
|
90536
|
-
if (typeof
|
|
91366
|
+
function collectScrollableElementStates(doc = document) {
|
|
91367
|
+
if (typeof doc === "undefined") {
|
|
90537
91368
|
return [];
|
|
90538
91369
|
}
|
|
90539
|
-
const win =
|
|
91370
|
+
const win = doc.defaultView || window;
|
|
90540
91371
|
const HTMLElementClass = win.HTMLElement;
|
|
90541
91372
|
const elements = /* @__PURE__ */ new Set();
|
|
90542
|
-
|
|
90543
|
-
if (
|
|
90544
|
-
if (
|
|
90545
|
-
if (
|
|
91373
|
+
doc.querySelectorAll("*").forEach((el) => elements.add(el));
|
|
91374
|
+
if (doc.body) elements.add(doc.body);
|
|
91375
|
+
if (doc.documentElement) elements.add(doc.documentElement);
|
|
91376
|
+
if (doc.scrollingElement) elements.add(doc.scrollingElement);
|
|
90546
91377
|
const scrollableStates = [];
|
|
90547
91378
|
const overflowRegex = /(auto|scroll|overlay)/i;
|
|
90548
91379
|
elements.forEach((element) => {
|
|
@@ -90559,7 +91390,7 @@ code.hljs {
|
|
|
90559
91390
|
const computedStyle = win.getComputedStyle(element);
|
|
90560
91391
|
const overflowY = computedStyle.overflowY;
|
|
90561
91392
|
const overflowX = computedStyle.overflowX;
|
|
90562
|
-
const isRootElement = element ===
|
|
91393
|
+
const isRootElement = element === doc.body || element === doc.documentElement || element === doc.scrollingElement;
|
|
90563
91394
|
const canScrollVertically = scrollHeight - clientHeight > 1;
|
|
90564
91395
|
const canScrollHorizontally = scrollWidth - clientWidth > 1;
|
|
90565
91396
|
const allowsVerticalScroll = isRootElement || overflowRegex.test(overflowY);
|
|
@@ -90590,9 +91421,9 @@ code.hljs {
|
|
|
90590
91421
|
const crossOriginIframes = [];
|
|
90591
91422
|
for (const iframe of iframes) {
|
|
90592
91423
|
try {
|
|
90593
|
-
const
|
|
90594
|
-
if (
|
|
90595
|
-
const clone2 =
|
|
91424
|
+
const doc = iframe.contentDocument;
|
|
91425
|
+
if (doc && doc.documentElement) {
|
|
91426
|
+
const clone2 = doc.documentElement.cloneNode(true);
|
|
90596
91427
|
clone2.querySelectorAll("script").forEach((s) => s.remove());
|
|
90597
91428
|
directResults.push({ id: iframe.id, html: clone2.outerHTML });
|
|
90598
91429
|
} else {
|
|
@@ -90979,67 +91810,67 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
90979
91810
|
var keywordRelationalOperator = /^in(stanceof)?$/;
|
|
90980
91811
|
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
90981
91812
|
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
90982
|
-
function isInAstralSet(
|
|
91813
|
+
function isInAstralSet(code, set) {
|
|
90983
91814
|
var pos = 65536;
|
|
90984
91815
|
for (var i = 0; i < set.length; i += 2) {
|
|
90985
91816
|
pos += set[i];
|
|
90986
|
-
if (pos >
|
|
91817
|
+
if (pos > code) {
|
|
90987
91818
|
return false;
|
|
90988
91819
|
}
|
|
90989
91820
|
pos += set[i + 1];
|
|
90990
|
-
if (pos >=
|
|
91821
|
+
if (pos >= code) {
|
|
90991
91822
|
return true;
|
|
90992
91823
|
}
|
|
90993
91824
|
}
|
|
90994
91825
|
return false;
|
|
90995
91826
|
}
|
|
90996
|
-
function isIdentifierStart(
|
|
90997
|
-
if (
|
|
90998
|
-
return
|
|
91827
|
+
function isIdentifierStart(code, astral) {
|
|
91828
|
+
if (code < 65) {
|
|
91829
|
+
return code === 36;
|
|
90999
91830
|
}
|
|
91000
|
-
if (
|
|
91831
|
+
if (code < 91) {
|
|
91001
91832
|
return true;
|
|
91002
91833
|
}
|
|
91003
|
-
if (
|
|
91004
|
-
return
|
|
91834
|
+
if (code < 97) {
|
|
91835
|
+
return code === 95;
|
|
91005
91836
|
}
|
|
91006
|
-
if (
|
|
91837
|
+
if (code < 123) {
|
|
91007
91838
|
return true;
|
|
91008
91839
|
}
|
|
91009
|
-
if (
|
|
91010
|
-
return
|
|
91840
|
+
if (code <= 65535) {
|
|
91841
|
+
return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
|
91011
91842
|
}
|
|
91012
91843
|
if (astral === false) {
|
|
91013
91844
|
return false;
|
|
91014
91845
|
}
|
|
91015
|
-
return isInAstralSet(
|
|
91846
|
+
return isInAstralSet(code, astralIdentifierStartCodes);
|
|
91016
91847
|
}
|
|
91017
|
-
function isIdentifierChar(
|
|
91018
|
-
if (
|
|
91019
|
-
return
|
|
91848
|
+
function isIdentifierChar(code, astral) {
|
|
91849
|
+
if (code < 48) {
|
|
91850
|
+
return code === 36;
|
|
91020
91851
|
}
|
|
91021
|
-
if (
|
|
91852
|
+
if (code < 58) {
|
|
91022
91853
|
return true;
|
|
91023
91854
|
}
|
|
91024
|
-
if (
|
|
91855
|
+
if (code < 65) {
|
|
91025
91856
|
return false;
|
|
91026
91857
|
}
|
|
91027
|
-
if (
|
|
91858
|
+
if (code < 91) {
|
|
91028
91859
|
return true;
|
|
91029
91860
|
}
|
|
91030
|
-
if (
|
|
91031
|
-
return
|
|
91861
|
+
if (code < 97) {
|
|
91862
|
+
return code === 95;
|
|
91032
91863
|
}
|
|
91033
|
-
if (
|
|
91864
|
+
if (code < 123) {
|
|
91034
91865
|
return true;
|
|
91035
91866
|
}
|
|
91036
|
-
if (
|
|
91037
|
-
return
|
|
91867
|
+
if (code <= 65535) {
|
|
91868
|
+
return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
|
|
91038
91869
|
}
|
|
91039
91870
|
if (astral === false) {
|
|
91040
91871
|
return false;
|
|
91041
91872
|
}
|
|
91042
|
-
return isInAstralSet(
|
|
91873
|
+
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
|
91043
91874
|
}
|
|
91044
91875
|
var TokenType3 = function TokenType4(label, conf) {
|
|
91045
91876
|
if (conf === void 0) conf = {};
|
|
@@ -91161,15 +91992,15 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
91161
91992
|
};
|
|
91162
91993
|
var lineBreak = /\r\n?|\n|\u2028|\u2029/;
|
|
91163
91994
|
var lineBreakG = new RegExp(lineBreak.source, "g");
|
|
91164
|
-
function isNewLine(
|
|
91165
|
-
return
|
|
91995
|
+
function isNewLine(code) {
|
|
91996
|
+
return code === 10 || code === 13 || code === 8232 || code === 8233;
|
|
91166
91997
|
}
|
|
91167
|
-
function nextLineBreak(
|
|
91168
|
-
if (end2 === void 0) end2 =
|
|
91998
|
+
function nextLineBreak(code, from, end2) {
|
|
91999
|
+
if (end2 === void 0) end2 = code.length;
|
|
91169
92000
|
for (var i = from; i < end2; i++) {
|
|
91170
|
-
var next2 =
|
|
92001
|
+
var next2 = code.charCodeAt(i);
|
|
91171
92002
|
if (isNewLine(next2)) {
|
|
91172
|
-
return i < end2 - 1 && next2 === 13 &&
|
|
92003
|
+
return i < end2 - 1 && next2 === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1;
|
|
91173
92004
|
}
|
|
91174
92005
|
}
|
|
91175
92006
|
return -1;
|
|
@@ -91189,12 +92020,12 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
91189
92020
|
function wordsRegexp(words) {
|
|
91190
92021
|
return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
|
|
91191
92022
|
}
|
|
91192
|
-
function codePointToString(
|
|
91193
|
-
if (
|
|
91194
|
-
return String.fromCharCode(
|
|
92023
|
+
function codePointToString(code) {
|
|
92024
|
+
if (code <= 65535) {
|
|
92025
|
+
return String.fromCharCode(code);
|
|
91195
92026
|
}
|
|
91196
|
-
|
|
91197
|
-
return String.fromCharCode((
|
|
92027
|
+
code -= 65536;
|
|
92028
|
+
return String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320);
|
|
91198
92029
|
}
|
|
91199
92030
|
var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
|
|
91200
92031
|
var Position = function Position2(line, col) {
|
|
@@ -91502,9 +92333,9 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
91502
92333
|
return new this(options, input).parse();
|
|
91503
92334
|
};
|
|
91504
92335
|
Parser4.parseExpressionAt = function parseExpressionAt(input, pos, options) {
|
|
91505
|
-
var
|
|
91506
|
-
|
|
91507
|
-
return
|
|
92336
|
+
var parser = new this(options, input, pos);
|
|
92337
|
+
parser.nextToken();
|
|
92338
|
+
return parser.parseExpression();
|
|
91508
92339
|
};
|
|
91509
92340
|
Parser4.tokenizer = function tokenizer(input, options) {
|
|
91510
92341
|
return new this(options, input);
|
|
@@ -94301,17 +95132,17 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
94301
95132
|
}
|
|
94302
95133
|
}
|
|
94303
95134
|
};
|
|
94304
|
-
var Node3 = function Node4(
|
|
95135
|
+
var Node3 = function Node4(parser, pos, loc) {
|
|
94305
95136
|
this.type = "";
|
|
94306
95137
|
this.start = pos;
|
|
94307
95138
|
this.end = 0;
|
|
94308
|
-
if (
|
|
94309
|
-
this.loc = new SourceLocation(
|
|
95139
|
+
if (parser.options.locations) {
|
|
95140
|
+
this.loc = new SourceLocation(parser, loc);
|
|
94310
95141
|
}
|
|
94311
|
-
if (
|
|
94312
|
-
this.sourceFile =
|
|
95142
|
+
if (parser.options.directSourceFile) {
|
|
95143
|
+
this.sourceFile = parser.options.directSourceFile;
|
|
94313
95144
|
}
|
|
94314
|
-
if (
|
|
95145
|
+
if (parser.options.ranges) {
|
|
94315
95146
|
this.range = [pos, 0];
|
|
94316
95147
|
}
|
|
94317
95148
|
};
|
|
@@ -94425,10 +95256,10 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
94425
95256
|
BranchID.prototype.sibling = function sibling() {
|
|
94426
95257
|
return new BranchID(this.parent, this.base);
|
|
94427
95258
|
};
|
|
94428
|
-
var RegExpValidationState = function RegExpValidationState2(
|
|
94429
|
-
this.parser =
|
|
94430
|
-
this.validFlags = "gim" + (
|
|
94431
|
-
this.unicodeProperties = data2[
|
|
95259
|
+
var RegExpValidationState = function RegExpValidationState2(parser) {
|
|
95260
|
+
this.parser = parser;
|
|
95261
|
+
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
|
|
95262
|
+
this.unicodeProperties = data2[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
|
|
94432
95263
|
this.source = "";
|
|
94433
95264
|
this.flags = "";
|
|
94434
95265
|
this.start = 0;
|
|
@@ -95761,19 +96592,19 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
95761
96592
|
this.readToken(this.fullCharCodeAtPos());
|
|
95762
96593
|
}
|
|
95763
96594
|
};
|
|
95764
|
-
pp.readToken = function(
|
|
95765
|
-
if (isIdentifierStart(
|
|
96595
|
+
pp.readToken = function(code) {
|
|
96596
|
+
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92) {
|
|
95766
96597
|
return this.readWord();
|
|
95767
96598
|
}
|
|
95768
|
-
return this.getTokenFromCode(
|
|
96599
|
+
return this.getTokenFromCode(code);
|
|
95769
96600
|
};
|
|
95770
96601
|
pp.fullCharCodeAtPos = function() {
|
|
95771
|
-
var
|
|
95772
|
-
if (
|
|
95773
|
-
return
|
|
96602
|
+
var code = this.input.charCodeAt(this.pos);
|
|
96603
|
+
if (code <= 55295 || code >= 56320) {
|
|
96604
|
+
return code;
|
|
95774
96605
|
}
|
|
95775
96606
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
95776
|
-
return next2 <= 56319 || next2 >= 57344 ?
|
|
96607
|
+
return next2 <= 56319 || next2 >= 57344 ? code : (code << 10) + next2 - 56613888;
|
|
95777
96608
|
};
|
|
95778
96609
|
pp.skipBlockComment = function() {
|
|
95779
96610
|
var startLoc = this.options.onComment && this.curPosition();
|
|
@@ -95894,11 +96725,11 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
95894
96725
|
}
|
|
95895
96726
|
return this.finishOp(types$1.slash, 1);
|
|
95896
96727
|
};
|
|
95897
|
-
pp.readToken_mult_modulo_exp = function(
|
|
96728
|
+
pp.readToken_mult_modulo_exp = function(code) {
|
|
95898
96729
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
95899
96730
|
var size = 1;
|
|
95900
|
-
var tokentype =
|
|
95901
|
-
if (this.options.ecmaVersion >= 7 &&
|
|
96731
|
+
var tokentype = code === 42 ? types$1.star : types$1.modulo;
|
|
96732
|
+
if (this.options.ecmaVersion >= 7 && code === 42 && next2 === 42) {
|
|
95902
96733
|
++size;
|
|
95903
96734
|
tokentype = types$1.starstar;
|
|
95904
96735
|
next2 = this.input.charCodeAt(this.pos + 2);
|
|
@@ -95908,21 +96739,21 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
95908
96739
|
}
|
|
95909
96740
|
return this.finishOp(tokentype, size);
|
|
95910
96741
|
};
|
|
95911
|
-
pp.readToken_pipe_amp = function(
|
|
96742
|
+
pp.readToken_pipe_amp = function(code) {
|
|
95912
96743
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
95913
|
-
if (next2 ===
|
|
96744
|
+
if (next2 === code) {
|
|
95914
96745
|
if (this.options.ecmaVersion >= 12) {
|
|
95915
96746
|
var next22 = this.input.charCodeAt(this.pos + 2);
|
|
95916
96747
|
if (next22 === 61) {
|
|
95917
96748
|
return this.finishOp(types$1.assign, 3);
|
|
95918
96749
|
}
|
|
95919
96750
|
}
|
|
95920
|
-
return this.finishOp(
|
|
96751
|
+
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2);
|
|
95921
96752
|
}
|
|
95922
96753
|
if (next2 === 61) {
|
|
95923
96754
|
return this.finishOp(types$1.assign, 2);
|
|
95924
96755
|
}
|
|
95925
|
-
return this.finishOp(
|
|
96756
|
+
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1);
|
|
95926
96757
|
};
|
|
95927
96758
|
pp.readToken_caret = function() {
|
|
95928
96759
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
@@ -95931,9 +96762,9 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
95931
96762
|
}
|
|
95932
96763
|
return this.finishOp(types$1.bitwiseXOR, 1);
|
|
95933
96764
|
};
|
|
95934
|
-
pp.readToken_plus_min = function(
|
|
96765
|
+
pp.readToken_plus_min = function(code) {
|
|
95935
96766
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
95936
|
-
if (next2 ===
|
|
96767
|
+
if (next2 === code) {
|
|
95937
96768
|
if (next2 === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
|
|
95938
96769
|
this.skipLineComment(3);
|
|
95939
96770
|
this.skipSpace();
|
|
@@ -95946,17 +96777,17 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
95946
96777
|
}
|
|
95947
96778
|
return this.finishOp(types$1.plusMin, 1);
|
|
95948
96779
|
};
|
|
95949
|
-
pp.readToken_lt_gt = function(
|
|
96780
|
+
pp.readToken_lt_gt = function(code) {
|
|
95950
96781
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
95951
96782
|
var size = 1;
|
|
95952
|
-
if (next2 ===
|
|
95953
|
-
size =
|
|
96783
|
+
if (next2 === code) {
|
|
96784
|
+
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
|
|
95954
96785
|
if (this.input.charCodeAt(this.pos + size) === 61) {
|
|
95955
96786
|
return this.finishOp(types$1.assign, size + 1);
|
|
95956
96787
|
}
|
|
95957
96788
|
return this.finishOp(types$1.bitShift, size);
|
|
95958
96789
|
}
|
|
95959
|
-
if (next2 === 33 &&
|
|
96790
|
+
if (next2 === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45) {
|
|
95960
96791
|
this.skipLineComment(4);
|
|
95961
96792
|
this.skipSpace();
|
|
95962
96793
|
return this.nextToken();
|
|
@@ -95966,16 +96797,16 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
95966
96797
|
}
|
|
95967
96798
|
return this.finishOp(types$1.relational, size);
|
|
95968
96799
|
};
|
|
95969
|
-
pp.readToken_eq_excl = function(
|
|
96800
|
+
pp.readToken_eq_excl = function(code) {
|
|
95970
96801
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
95971
96802
|
if (next2 === 61) {
|
|
95972
96803
|
return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2);
|
|
95973
96804
|
}
|
|
95974
|
-
if (
|
|
96805
|
+
if (code === 61 && next2 === 62 && this.options.ecmaVersion >= 6) {
|
|
95975
96806
|
this.pos += 2;
|
|
95976
96807
|
return this.finishToken(types$1.arrow);
|
|
95977
96808
|
}
|
|
95978
|
-
return this.finishOp(
|
|
96809
|
+
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1);
|
|
95979
96810
|
};
|
|
95980
96811
|
pp.readToken_question = function() {
|
|
95981
96812
|
var ecmaVersion = this.options.ecmaVersion;
|
|
@@ -96001,18 +96832,18 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96001
96832
|
};
|
|
96002
96833
|
pp.readToken_numberSign = function() {
|
|
96003
96834
|
var ecmaVersion = this.options.ecmaVersion;
|
|
96004
|
-
var
|
|
96835
|
+
var code = 35;
|
|
96005
96836
|
if (ecmaVersion >= 13) {
|
|
96006
96837
|
++this.pos;
|
|
96007
|
-
|
|
96008
|
-
if (isIdentifierStart(
|
|
96838
|
+
code = this.fullCharCodeAtPos();
|
|
96839
|
+
if (isIdentifierStart(code, true) || code === 92) {
|
|
96009
96840
|
return this.finishToken(types$1.privateId, this.readWord1());
|
|
96010
96841
|
}
|
|
96011
96842
|
}
|
|
96012
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString(
|
|
96843
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
96013
96844
|
};
|
|
96014
|
-
pp.getTokenFromCode = function(
|
|
96015
|
-
switch (
|
|
96845
|
+
pp.getTokenFromCode = function(code) {
|
|
96846
|
+
switch (code) {
|
|
96016
96847
|
// The interpretation of a dot depends on whether it is followed
|
|
96017
96848
|
// by a digit or another two dots.
|
|
96018
96849
|
case 46:
|
|
@@ -96079,7 +96910,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96079
96910
|
// Quotes produce strings.
|
|
96080
96911
|
case 34:
|
|
96081
96912
|
case 39:
|
|
96082
|
-
return this.readString(
|
|
96913
|
+
return this.readString(code);
|
|
96083
96914
|
// Operators are parsed inline in tiny state machines. '=' (61) is
|
|
96084
96915
|
// often referred to. `finishOp` simply skips the amount of
|
|
96085
96916
|
// characters it is given as second argument, and returns a token
|
|
@@ -96088,21 +96919,21 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96088
96919
|
return this.readToken_slash();
|
|
96089
96920
|
case 37:
|
|
96090
96921
|
case 42:
|
|
96091
|
-
return this.readToken_mult_modulo_exp(
|
|
96922
|
+
return this.readToken_mult_modulo_exp(code);
|
|
96092
96923
|
case 124:
|
|
96093
96924
|
case 38:
|
|
96094
|
-
return this.readToken_pipe_amp(
|
|
96925
|
+
return this.readToken_pipe_amp(code);
|
|
96095
96926
|
case 94:
|
|
96096
96927
|
return this.readToken_caret();
|
|
96097
96928
|
case 43:
|
|
96098
96929
|
case 45:
|
|
96099
|
-
return this.readToken_plus_min(
|
|
96930
|
+
return this.readToken_plus_min(code);
|
|
96100
96931
|
case 60:
|
|
96101
96932
|
case 62:
|
|
96102
|
-
return this.readToken_lt_gt(
|
|
96933
|
+
return this.readToken_lt_gt(code);
|
|
96103
96934
|
case 61:
|
|
96104
96935
|
case 33:
|
|
96105
|
-
return this.readToken_eq_excl(
|
|
96936
|
+
return this.readToken_eq_excl(code);
|
|
96106
96937
|
case 63:
|
|
96107
96938
|
return this.readToken_question();
|
|
96108
96939
|
case 126:
|
|
@@ -96110,7 +96941,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96110
96941
|
case 35:
|
|
96111
96942
|
return this.readToken_numberSign();
|
|
96112
96943
|
}
|
|
96113
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString(
|
|
96944
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
96114
96945
|
};
|
|
96115
96946
|
pp.finishOp = function(type, size) {
|
|
96116
96947
|
var str = this.input.slice(this.pos, this.pos + size);
|
|
@@ -96164,8 +96995,8 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96164
96995
|
var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
|
|
96165
96996
|
var start = this.pos, total = 0, lastCode = 0;
|
|
96166
96997
|
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
|
|
96167
|
-
var
|
|
96168
|
-
if (allowSeparators &&
|
|
96998
|
+
var code = this.input.charCodeAt(this.pos), val2 = void 0;
|
|
96999
|
+
if (allowSeparators && code === 95) {
|
|
96169
97000
|
if (isLegacyOctalNumericLiteral) {
|
|
96170
97001
|
this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals");
|
|
96171
97002
|
}
|
|
@@ -96175,22 +97006,22 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96175
97006
|
if (i === 0) {
|
|
96176
97007
|
this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits");
|
|
96177
97008
|
}
|
|
96178
|
-
lastCode =
|
|
97009
|
+
lastCode = code;
|
|
96179
97010
|
continue;
|
|
96180
97011
|
}
|
|
96181
|
-
if (
|
|
96182
|
-
val2 =
|
|
96183
|
-
} else if (
|
|
96184
|
-
val2 =
|
|
96185
|
-
} else if (
|
|
96186
|
-
val2 =
|
|
97012
|
+
if (code >= 97) {
|
|
97013
|
+
val2 = code - 97 + 10;
|
|
97014
|
+
} else if (code >= 65) {
|
|
97015
|
+
val2 = code - 65 + 10;
|
|
97016
|
+
} else if (code >= 48 && code <= 57) {
|
|
97017
|
+
val2 = code - 48;
|
|
96187
97018
|
} else {
|
|
96188
97019
|
val2 = Infinity;
|
|
96189
97020
|
}
|
|
96190
97021
|
if (val2 >= radix) {
|
|
96191
97022
|
break;
|
|
96192
97023
|
}
|
|
96193
|
-
lastCode =
|
|
97024
|
+
lastCode = code;
|
|
96194
97025
|
total = total * radix + val2;
|
|
96195
97026
|
}
|
|
96196
97027
|
if (allowSeparators && lastCode === 95) {
|
|
@@ -96270,21 +97101,21 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96270
97101
|
return this.finishToken(types$1.num, val2);
|
|
96271
97102
|
};
|
|
96272
97103
|
pp.readCodePoint = function() {
|
|
96273
|
-
var ch = this.input.charCodeAt(this.pos),
|
|
97104
|
+
var ch = this.input.charCodeAt(this.pos), code;
|
|
96274
97105
|
if (ch === 123) {
|
|
96275
97106
|
if (this.options.ecmaVersion < 6) {
|
|
96276
97107
|
this.unexpected();
|
|
96277
97108
|
}
|
|
96278
97109
|
var codePos = ++this.pos;
|
|
96279
|
-
|
|
97110
|
+
code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
|
|
96280
97111
|
++this.pos;
|
|
96281
|
-
if (
|
|
97112
|
+
if (code > 1114111) {
|
|
96282
97113
|
this.invalidStringToken(codePos, "Code point out of bounds");
|
|
96283
97114
|
}
|
|
96284
97115
|
} else {
|
|
96285
|
-
|
|
97116
|
+
code = this.readHexChar(4);
|
|
96286
97117
|
}
|
|
96287
|
-
return
|
|
97118
|
+
return code;
|
|
96288
97119
|
};
|
|
96289
97120
|
pp.readString = function(quote) {
|
|
96290
97121
|
var out = "", chunkStart = ++this.pos;
|
|
@@ -97549,21 +98380,21 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97549
98380
|
};
|
|
97550
98381
|
}
|
|
97551
98382
|
}
|
|
97552
|
-
write(
|
|
97553
|
-
this.output +=
|
|
98383
|
+
write(code) {
|
|
98384
|
+
this.output += code;
|
|
97554
98385
|
}
|
|
97555
|
-
writeToStream(
|
|
97556
|
-
this.output.write(
|
|
98386
|
+
writeToStream(code) {
|
|
98387
|
+
this.output.write(code);
|
|
97557
98388
|
}
|
|
97558
|
-
writeAndMap(
|
|
97559
|
-
this.output +=
|
|
97560
|
-
this.map(
|
|
98389
|
+
writeAndMap(code, node) {
|
|
98390
|
+
this.output += code;
|
|
98391
|
+
this.map(code, node);
|
|
97561
98392
|
}
|
|
97562
|
-
writeToStreamAndMap(
|
|
97563
|
-
this.output.write(
|
|
97564
|
-
this.map(
|
|
98393
|
+
writeToStreamAndMap(code, node) {
|
|
98394
|
+
this.output.write(code);
|
|
98395
|
+
this.map(code, node);
|
|
97565
98396
|
}
|
|
97566
|
-
map(
|
|
98397
|
+
map(code, node) {
|
|
97567
98398
|
if (node != null) {
|
|
97568
98399
|
const { type } = node;
|
|
97569
98400
|
if (type[0] === "L" && type[2] === "n") {
|
|
@@ -97578,10 +98409,10 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97578
98409
|
this.sourceMap.addMapping(mapping);
|
|
97579
98410
|
}
|
|
97580
98411
|
if (type[0] === "T" && type[8] === "E" || type[0] === "L" && type[1] === "i" && typeof node.value === "string") {
|
|
97581
|
-
const { length: length2 } =
|
|
98412
|
+
const { length: length2 } = code;
|
|
97582
98413
|
let { column, line } = this;
|
|
97583
98414
|
for (let i = 0; i < length2; i++) {
|
|
97584
|
-
if (
|
|
98415
|
+
if (code[i] === "\n") {
|
|
97585
98416
|
column = 0;
|
|
97586
98417
|
line++;
|
|
97587
98418
|
} else {
|
|
@@ -97593,10 +98424,10 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97593
98424
|
return;
|
|
97594
98425
|
}
|
|
97595
98426
|
}
|
|
97596
|
-
const { length } =
|
|
98427
|
+
const { length } = code;
|
|
97597
98428
|
const { lineEnd } = this;
|
|
97598
98429
|
if (length > 0) {
|
|
97599
|
-
if (this.lineEndSize > 0 && (lineEnd.length === 1 ?
|
|
98430
|
+
if (this.lineEndSize > 0 && (lineEnd.length === 1 ? code[length - 1] === lineEnd : code.endsWith(lineEnd))) {
|
|
97600
98431
|
this.line += this.lineEndSize;
|
|
97601
98432
|
this.column = 0;
|
|
97602
98433
|
} else {
|
|
@@ -97615,14 +98446,24 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97615
98446
|
}
|
|
97616
98447
|
|
|
97617
98448
|
// alan_btn/src/textChat/saveChatStateToFile.ts
|
|
97618
|
-
|
|
98449
|
+
var import_jsonlint = __toESM(require_jsonlint());
|
|
98450
|
+
function smartJSONParse(str, errorLogger) {
|
|
98451
|
+
try {
|
|
98452
|
+
return (0, import_jsonlint.parse)(str, {
|
|
98453
|
+
mode: "json5"
|
|
98454
|
+
});
|
|
98455
|
+
} catch (e) {
|
|
98456
|
+
errorLogger("JSON parse error:", e);
|
|
98457
|
+
}
|
|
98458
|
+
}
|
|
98459
|
+
function extractFunctionWithRegex(code, functionName) {
|
|
97619
98460
|
const regex = new RegExp(`(?:async\\s+)?function\\s+${functionName}\\s*\\([^)]*\\)\\s*{(?:[^{}]*|{(?:[^{}]*|{[^{}]*})*})*};?`, "gs");
|
|
97620
|
-
const match =
|
|
98461
|
+
const match = code.match(regex);
|
|
97621
98462
|
return match ? match[0] : null;
|
|
97622
98463
|
}
|
|
97623
|
-
function extractFunction(
|
|
98464
|
+
function extractFunction(code, functionName, errorLogger) {
|
|
97624
98465
|
try {
|
|
97625
|
-
const ast = parse8(
|
|
98466
|
+
const ast = parse8(code, { ecmaVersion: 2022, allowImportExportEverywhere: true });
|
|
97626
98467
|
for (const node of ast.body) {
|
|
97627
98468
|
if (node.type === "FunctionDeclaration" && node.id.name === functionName) {
|
|
97628
98469
|
return generate2(node);
|
|
@@ -97630,84 +98471,84 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97630
98471
|
}
|
|
97631
98472
|
} catch (err) {
|
|
97632
98473
|
const msg = `Failed to parse code for function "${functionName}":`;
|
|
97633
|
-
|
|
98474
|
+
errorLogger(msg, err);
|
|
97634
98475
|
}
|
|
97635
98476
|
return null;
|
|
97636
98477
|
}
|
|
97637
|
-
function stripComments(
|
|
97638
|
-
return
|
|
98478
|
+
function stripComments(code) {
|
|
98479
|
+
return code.replace(/("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')|\/\/.*|\/\*[\s\S]*?\*\//g, (match, quoted) => {
|
|
97639
98480
|
return quoted ? quoted : "";
|
|
97640
98481
|
});
|
|
97641
98482
|
}
|
|
97642
|
-
function commentInitIframeFnInSourceCode(html3,
|
|
98483
|
+
function commentInitIframeFnInSourceCode(html3, initIframeFn) {
|
|
97643
98484
|
const explanationComment = `// The initIframe function body was commented out because resources were inlined in the iframe.
|
|
97644
98485
|
`;
|
|
97645
|
-
const fnStart =
|
|
97646
|
-
const fnEnd =
|
|
98486
|
+
const fnStart = initIframeFn.indexOf("{");
|
|
98487
|
+
const fnEnd = initIframeFn.lastIndexOf("}");
|
|
97647
98488
|
if (fnStart === -1 || fnEnd === -1 || fnEnd <= fnStart) return html3;
|
|
97648
|
-
const beforeBody =
|
|
97649
|
-
const body =
|
|
97650
|
-
const afterBody =
|
|
98489
|
+
const beforeBody = initIframeFn.slice(0, fnStart + 1);
|
|
98490
|
+
const body = initIframeFn.slice(fnStart + 1, fnEnd);
|
|
98491
|
+
const afterBody = initIframeFn.slice(fnEnd);
|
|
97651
98492
|
const commentedBody = explanationComment + body.split("\n").map((line) => "// " + line).join("\n");
|
|
97652
98493
|
const commentedFn = beforeBody + "\n" + commentedBody + "\n" + afterBody;
|
|
97653
|
-
return html3.replace(
|
|
98494
|
+
return html3.replace(initIframeFn, commentedFn);
|
|
97654
98495
|
}
|
|
97655
|
-
function extractAddDefaultStylesParams(
|
|
98496
|
+
function extractAddDefaultStylesParams(code, errorLogger) {
|
|
97656
98497
|
const regex = /(?:iframe\.)?addDefaultStyles\s*\(\s*([\s\S]*?)\s*\)/g;
|
|
97657
98498
|
let match;
|
|
97658
98499
|
let merged = {};
|
|
97659
98500
|
let found = false;
|
|
97660
|
-
while ((match = regex.exec(
|
|
98501
|
+
while ((match = regex.exec(code)) !== null) {
|
|
97661
98502
|
found = true;
|
|
97662
98503
|
let rawParam = match[1].trim();
|
|
97663
98504
|
if (rawParam === "" || rawParam === "null" || rawParam === "{}") {
|
|
97664
98505
|
continue;
|
|
97665
98506
|
}
|
|
97666
98507
|
try {
|
|
97667
|
-
const obj =
|
|
98508
|
+
const obj = smartJSONParse(rawParam, errorLogger);
|
|
97668
98509
|
if (obj && typeof obj === "object") {
|
|
97669
98510
|
merged = { ...merged, ...obj };
|
|
97670
98511
|
}
|
|
97671
98512
|
} catch (err) {
|
|
97672
98513
|
const msg = "Failed to parse addDefaultStyles parameter:";
|
|
97673
|
-
|
|
98514
|
+
errorLogger(msg, err);
|
|
97674
98515
|
return null;
|
|
97675
98516
|
}
|
|
97676
98517
|
}
|
|
97677
98518
|
if (!found) return null;
|
|
97678
98519
|
return merged;
|
|
97679
98520
|
}
|
|
97680
|
-
function safelyParseScriptOptions(optionsString,
|
|
98521
|
+
function safelyParseScriptOptions(optionsString, errorLogger) {
|
|
97681
98522
|
if (!optionsString || optionsString === "null" || optionsString === "{}") {
|
|
97682
98523
|
return null;
|
|
97683
98524
|
}
|
|
97684
98525
|
try {
|
|
97685
98526
|
const cleanOptionsString = optionsString.trim();
|
|
97686
|
-
return
|
|
98527
|
+
return smartJSONParse(cleanOptionsString, errorLogger);
|
|
97687
98528
|
} catch (error) {
|
|
97688
98529
|
const msg = "Failed to parse script options:";
|
|
97689
|
-
|
|
98530
|
+
errorLogger(msg, error);
|
|
97690
98531
|
return null;
|
|
97691
98532
|
}
|
|
97692
98533
|
}
|
|
97693
|
-
function applyThemeToHtmlContent(
|
|
98534
|
+
function applyThemeToHtmlContent(htmlContent, theme) {
|
|
97694
98535
|
if (!theme || theme !== "light" && theme !== "dark") {
|
|
97695
|
-
return
|
|
98536
|
+
return htmlContent;
|
|
97696
98537
|
}
|
|
97697
|
-
const
|
|
97698
|
-
const
|
|
97699
|
-
const htmlElement =
|
|
98538
|
+
const parser = new DOMParser();
|
|
98539
|
+
const doc = parser.parseFromString(htmlContent, "text/html");
|
|
98540
|
+
const htmlElement = doc.documentElement;
|
|
97700
98541
|
if (htmlElement) {
|
|
97701
98542
|
const themeClass = theme === "light" ? "light-theme" : "dark-theme";
|
|
97702
98543
|
htmlElement.classList.add(themeClass);
|
|
97703
98544
|
}
|
|
97704
|
-
return
|
|
98545
|
+
return doc.documentElement.outerHTML;
|
|
97705
98546
|
}
|
|
97706
98547
|
function extractScriptContents(html3) {
|
|
97707
98548
|
const scriptContents = [];
|
|
97708
|
-
const
|
|
97709
|
-
const
|
|
97710
|
-
const scripts =
|
|
98549
|
+
const parser = new DOMParser();
|
|
98550
|
+
const doc = parser.parseFromString(html3, "text/html");
|
|
98551
|
+
const scripts = doc.querySelectorAll("script");
|
|
97711
98552
|
scripts.forEach((script) => {
|
|
97712
98553
|
if (!script.src) {
|
|
97713
98554
|
scriptContents.push(script.textContent.trim());
|
|
@@ -97731,6 +98572,73 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97731
98572
|
}
|
|
97732
98573
|
return result + '<pre style="margin:0!important;"><code style="overflow:auto!important;">' + otherCode + "</code></pre>";
|
|
97733
98574
|
}
|
|
98575
|
+
function isValidUrl2(url) {
|
|
98576
|
+
try {
|
|
98577
|
+
new URL(url);
|
|
98578
|
+
return true;
|
|
98579
|
+
} catch (e) {
|
|
98580
|
+
return false;
|
|
98581
|
+
}
|
|
98582
|
+
}
|
|
98583
|
+
var iframeFn = {
|
|
98584
|
+
getPublicUrl(resourceBaseUrl) {
|
|
98585
|
+
return `${resourceBaseUrl.substring(0, resourceBaseUrl.indexOf("/project_resource"))}`;
|
|
98586
|
+
},
|
|
98587
|
+
getProjectResourceUrl(resourcePath, resourceBaseUrl) {
|
|
98588
|
+
return `${resourceBaseUrl}/` + resourcePath;
|
|
98589
|
+
},
|
|
98590
|
+
getResourceUrl(resourceUrl, resourceBaseUrl) {
|
|
98591
|
+
const projectResPrefix = "resource://";
|
|
98592
|
+
const studioResPrefix = "studio-resource://";
|
|
98593
|
+
const withPublicUrl = isValidUrl2(resourceUrl);
|
|
98594
|
+
if (!resourceUrl) {
|
|
98595
|
+
return `${resourceBaseUrl}`;
|
|
98596
|
+
}
|
|
98597
|
+
if (resourceUrl.startsWith(studioResPrefix)) {
|
|
98598
|
+
return iframeFn.getStudioResourceUrl(resourceUrl.slice(studioResPrefix.length), resourceBaseUrl);
|
|
98599
|
+
}
|
|
98600
|
+
if (!withPublicUrl || resourceUrl.startsWith(projectResPrefix)) {
|
|
98601
|
+
const cleanResource = resourceUrl.startsWith(projectResPrefix) ? resourceUrl.slice(projectResPrefix.length) : resourceUrl;
|
|
98602
|
+
return iframeFn.getProjectResourceUrl(cleanResource, resourceBaseUrl);
|
|
98603
|
+
}
|
|
98604
|
+
return resourceUrl;
|
|
98605
|
+
},
|
|
98606
|
+
getStudioResourceUrl(resourceUrl, resourceBaseUrl) {
|
|
98607
|
+
const projectResPrefix = "resource://";
|
|
98608
|
+
const studioResPrefix = "studio-resource://";
|
|
98609
|
+
if (!resourceUrl) {
|
|
98610
|
+
return `${iframeFn.getPublicUrl(resourceBaseUrl)}/web/lib`;
|
|
98611
|
+
}
|
|
98612
|
+
if (resourceUrl.startsWith(projectResPrefix)) {
|
|
98613
|
+
throw new Error("Invalid resource URL: getStudioResourceUrl does not handle project resources.");
|
|
98614
|
+
}
|
|
98615
|
+
const cleanResource = resourceUrl.startsWith(studioResPrefix) ? resourceUrl.slice(studioResPrefix.length) : resourceUrl;
|
|
98616
|
+
return `${iframeFn.getPublicUrl(resourceBaseUrl)}/web/lib/` + cleanResource;
|
|
98617
|
+
},
|
|
98618
|
+
getDefaultResources(options = {}) {
|
|
98619
|
+
const {
|
|
98620
|
+
excludeHtmlElementsStyles = false,
|
|
98621
|
+
excludeTabulatorStyles = false,
|
|
98622
|
+
excludeScrollbarStyles = false
|
|
98623
|
+
} = options;
|
|
98624
|
+
const CSS_PATHS = {
|
|
98625
|
+
htmlElements: "studio-resource://iframe/iframe.html-elements.css",
|
|
98626
|
+
scrollbar: "studio-resource://iframe/scrollbar.css",
|
|
98627
|
+
tabulator: "studio-resource://tabulator-tables/6.3.1/tabulator.themed.css"
|
|
98628
|
+
};
|
|
98629
|
+
const resources = [];
|
|
98630
|
+
if (!excludeHtmlElementsStyles) {
|
|
98631
|
+
resources.push({ type: "stylesheet", href: CSS_PATHS.htmlElements });
|
|
98632
|
+
}
|
|
98633
|
+
if (!excludeTabulatorStyles) {
|
|
98634
|
+
resources.push({ type: "stylesheet", href: CSS_PATHS.tabulator });
|
|
98635
|
+
}
|
|
98636
|
+
if (!excludeScrollbarStyles) {
|
|
98637
|
+
resources.push({ type: "stylesheet", href: CSS_PATHS.scrollbar });
|
|
98638
|
+
}
|
|
98639
|
+
return resources;
|
|
98640
|
+
}
|
|
98641
|
+
};
|
|
97734
98642
|
async function saveChatState({
|
|
97735
98643
|
chatName,
|
|
97736
98644
|
chatEl,
|
|
@@ -97793,22 +98701,41 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97793
98701
|
initHtmlContent = "Not Found!";
|
|
97794
98702
|
}
|
|
97795
98703
|
initHtmlContent = applyThemeToHtmlContent(initHtmlContent, data3?.theme);
|
|
97796
|
-
let { htmlContent
|
|
97797
|
-
const
|
|
97798
|
-
if (
|
|
97799
|
-
|
|
98704
|
+
let { htmlContent } = await inlineExternalResources(initHtmlContent, logError, logInfo);
|
|
98705
|
+
const initIframeFn = extractFunctionWithRegex(htmlContent, "initIframe");
|
|
98706
|
+
if (initIframeFn) {
|
|
98707
|
+
htmlContent = commentInitIframeFnInSourceCode(htmlContent, initIframeFn);
|
|
97800
98708
|
logInfo("Replaced initIframe function with commented version as resources were successfully inlined.");
|
|
97801
98709
|
}
|
|
98710
|
+
const helperScript = `
|
|
98711
|
+
<script>
|
|
98712
|
+
// Helper: access showAlanDebugInfo from parent when browser console is focused on iframe
|
|
98713
|
+
if (window.parent && window.parent !== window && !window.showAlanDebugInfo) {
|
|
98714
|
+
window.showAlanDebugInfo = function() {
|
|
98715
|
+
if (typeof window.parent.showAlanDebugInfo === 'function') {
|
|
98716
|
+
window.parent.showAlanDebugInfo();
|
|
98717
|
+
} else {
|
|
98718
|
+
console.warn('showAlanDebugInfo not available in parent window');
|
|
98719
|
+
}
|
|
98720
|
+
};
|
|
98721
|
+
}
|
|
98722
|
+
<\/script>`;
|
|
98723
|
+
const headMatch = htmlContent.match(/(<head[^>]*>)/i);
|
|
98724
|
+
if (headMatch) {
|
|
98725
|
+
htmlContent = htmlContent.replace(headMatch[0], headMatch[0] + helperScript);
|
|
98726
|
+
} else {
|
|
98727
|
+
htmlContent = helperScript + htmlContent;
|
|
98728
|
+
}
|
|
97802
98729
|
const frameSrc = iframe.getAttribute("src");
|
|
97803
98730
|
iframe.removeAttribute("src");
|
|
97804
|
-
iframe.setAttribute("srcdoc",
|
|
98731
|
+
iframe.setAttribute("srcdoc", htmlContent);
|
|
97805
98732
|
iframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups allow-downloads");
|
|
97806
98733
|
if (!options?.isGraphInfoDisabled && (frameSrc.indexOf("alan.") > -1 || frameSrc.indexOf("alan-"))) {
|
|
97807
98734
|
const parent2 = iframe.parentNode;
|
|
97808
98735
|
let controlsDiv = document.createElement("div");
|
|
97809
98736
|
controlsDiv.classList.add("alan-iframe-controls");
|
|
97810
98737
|
let hiddenIframe = document.createElement("iframe");
|
|
97811
|
-
hiddenIframe.srcdoc = `<!--${
|
|
98738
|
+
hiddenIframe.srcdoc = `<!--${htmlContent}-->`;
|
|
97812
98739
|
hiddenIframe.setAttribute("style", "display: none;");
|
|
97813
98740
|
hiddenIframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups allow-downloads");
|
|
97814
98741
|
controlsDiv.appendChild(hiddenIframe);
|
|
@@ -97875,7 +98802,6 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97875
98802
|
iframe.setAttribute("sandbox", "allow-scripts allow-same-origin");
|
|
97876
98803
|
}
|
|
97877
98804
|
}));
|
|
97878
|
-
const iframeResizerCode = 'const v=()=>typeof window<"u",C=()=>{try{return window.self!==window.top}catch{return!0}},w=e=>e instanceof HTMLIFrameElement,z=e=>{"complete"===window.document.readyState?e():window.addEventListener("load",e,{once:!0})},B=(e,t)=>{t(),e.addEventListener("load",t,{once:!0})},k=(e,t)=>{const n="complete"===e.contentWindow?.document.readyState;return"about:blank"!==e.src&&"about:blank"!==e.contentWindow?.location.href&&n?t():e.addEventListener("load",t,{once:!0})},W=()=>({offsetSize:0,checkOrigin:!0,enableLegacyLibSupport:!1});async function A(e){try{return"about:blank"===e.contentDocument?.URL?new Promise((t=>{e.addEventListener("load",(()=>t(null!==e.contentDocument)),{once:!0})})):null!==e.contentDocument}catch{return!1}}const P=e=>{try{const t=new URL(e.src).origin;if("about:blank"!==t)return t}catch{}return null},H=e=>(Object.keys(e).forEach((t=>{void 0===e[t]&&delete e[t]})),e),I=e=>{const{height:t,width:n}=e.getBoundingClientRect();return{height:Math.ceil(t),width:Math.ceil(n)}},l=(e,t)=>e?t?e.querySelector(t):e.documentElement:null,O=(e,t)=>{e&&(t.bodyPadding&&(e.body.style.padding=t.bodyPadding),t.bodyMargin&&(e.body.style.margin=t.bodyMargin))},b=e=>e<=100?100:e<=120?1e3:1e4,x=()=>"[iFrameSizer]ID:0:false:false:32:true:true::auto:::0:false:child:auto:true:::true:::false";function F(e){if("string"!=typeof e.data||!e.data.startsWith("[iFrameSizer]")||!e.data.endsWith("mutationObserver")&&!e.data.endsWith("resizeObserver"))return null;const[t,n]=e.data.split(":"),i=+n;return i>0?i:null}const p=V();let m=[];const Z=async(e,t)=>{if(!v())return[];const n={...W(),...H(e??{})},i=N(t),r=U(n,i);return Promise.all(i.map((async e=>{const t={iframe:e,settings:n,interactionState:{isHovered:!1},initContext:{isInitialized:!1,retryAttempts:0}},{unsubscribe:i,resize:o}=await $(t,r);return m.push(t),{unsubscribe:()=>{i(),m=m.filter((t=>t.iframe!==e))},resize:o}})))};function N(e){return"string"==typeof e?Array.from(document.querySelectorAll(e)).filter(w):e?w(e)?[e]:[]:Array.from(document.getElementsByTagName("iframe"))}function U(e,t){if(Array.isArray(e.checkOrigin))return e.checkOrigin;if(!e.checkOrigin)return[];const n=[];for(const e of t){const t=P(e);t&&n.push(t)}return n}async function $(e,t){const n=await A(e.iframe),{unsubscribe:i,resize:r}=n?_(e):q(e,t),o=G(e);return{unsubscribe:()=>{i(),o()},resize:r}}function q(e,t){const{iframe:n,initContext:i,settings:{checkOrigin:r,enableLegacyLibSupport:o,targetElementSelector:s,bodyPadding:a,bodyMargin:c}}=e,d=i=>{const s="null"===i.origin,a=!r||s||t.includes(i.origin);if(n.contentWindow===i.source&&a){if("iframe-resized"===i.data?.type){const{height:t}=i.data;return void(t&&g({newHeight:t,registeredElement:e}))}if(o){const t=F(i);return void(null!==t&&g({newHeight:t,registeredElement:e}))}}};window.addEventListener("message",d);const u=o?x():{type:"iframe-child-init",targetElementSelector:s,bodyPadding:a,bodyMargin:c},l=()=>{B(n,(()=>n.contentWindow?.postMessage(u,"*"))),i.retryAttempts++,i.retryTimeoutId=window.setTimeout(l,b(i.retryAttempts))};return l(),{unsubscribe:()=>window.removeEventListener("message",d),resize:()=>{n.contentWindow?.postMessage({type:"iframe-get-child-dimensions"},"*")}}}function _(e){const{iframe:t,settings:n}=e,{targetElementSelector:i}=n;let r=0;const o=()=>{const e=l(t.contentDocument,i);if(!t.contentDocument||!e)return r++,setTimeout(o,b(r));O(t.contentDocument,n),p().observe(e)};return k(t,o),{unsubscribe:()=>{const e=l(t.contentDocument,i);e&&p().unobserve(e)},resize:()=>L(e)}}function G({iframe:e,interactionState:t,settings:n}){if(!n.onBeforeIframeResize&&!n.onIframeResize)return()=>{};const i=()=>{t.isHovered=!0},r=()=>{t.isHovered=!1};return e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",r),()=>{e.removeEventListener("mouseenter",i),e.removeEventListener("mouseleave",r)}}function V(){let e=null;return()=>{if(!e){const t=({target:e})=>{const t=m.find((({iframe:t})=>t.contentDocument===e.ownerDocument));t&&L(t)};e=new ResizeObserver((e=>e.forEach(t)))}return e}}function L(e){const{iframe:t,settings:n}=e,i=l(t.contentDocument,n.targetElementSelector);if(!i)return;const{height:r}=I(i);r&&g({newHeight:r,registeredElement:e})}function g({registeredElement:e,newHeight:t}){const{iframe:n,settings:i,interactionState:r,initContext:o}=e;if(o.isInitialized||(o.isInitialized=!0,clearTimeout(o.retryTimeoutId)),!1===i.onBeforeIframeResize?.({iframe:n,interactionState:{...r},settings:{...i},observedHeight:t}))return;const s=n.getBoundingClientRect(),a=t+i.offsetSize;if(n.style.height=`${a}px`,!i.onIframeResize)return;const c={iframe:n,settings:{...i},interactionState:{...r},previousRenderState:{rect:s},nextRenderState:{rect:n.getBoundingClientRect()}};i.onIframeResize(c)}const J=X();let R,h=!1;function K(){!v()||!C()||window.addEventListener("message",(e=>"iframe-child-init"===e.data?.type?z((()=>S(e))):"iframe-get-child-dimensions"===e.data?.type?z((()=>Q(e))):void 0))}function S(e,t=0){const{targetElementSelector:n,bodyPadding:i,bodyMargin:r}=e.data,o=l(document,n);if(h||window.parent!==e.source)return;if(!o)return setTimeout((()=>S(e,t+1)),b(t));O(document,{bodyMargin:r,bodyPadding:i}),R=n;const s=J();s.disconnect(),s.observe(o),h=!0}function Q(e){const t=l(document,R);!h||window.parent!==e.source||!t||E(t)}function X(){let e=null;return()=>(e||(e=new ResizeObserver((e=>{e[0].target&&E(e[0].target)}))),e)}K();const E=e=>{const{width:t,height:n}=I(e),i={type:"iframe-resized",width:t,height:n};window.parent.postMessage(i,"*")},j=({previousRenderState:e,nextRenderState:t,iframe:n})=>{document.activeElement===n&&window.scrollBy(0,t.rect.bottom-e.rect.bottom)}; window.iframeResizer={initialize :Z ,initializeChildListener:K,updateParentScrollOnResize:j};';
|
|
97879
98805
|
const functionsToInsert = iFrameSizeListenerFunctions.map((fn) => fn.toString()).join("\n\n");
|
|
97880
98806
|
const onIFrameSizeListenerString = onIFrameSizeListener.toString();
|
|
97881
98807
|
const prepareJavascriptCodeString = prepareJavascriptCode.toString();
|
|
@@ -97892,7 +98818,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97892
98818
|
logError("Chat will be exported without output graphs", error);
|
|
97893
98819
|
}
|
|
97894
98820
|
const alanMainClass = "alan-" + projectId;
|
|
97895
|
-
const
|
|
98821
|
+
const code = `
|
|
97896
98822
|
<script type="text/javascript">
|
|
97897
98823
|
|
|
97898
98824
|
${functionsToInsert}
|
|
@@ -98327,12 +99253,31 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98327
99253
|
${headContent ? headContent : ""}
|
|
98328
99254
|
|
|
98329
99255
|
<script>
|
|
98330
|
-
console.info('Alan lib v: ${window.alanLib?.version || "-"}, exporter v: 1.0.
|
|
98331
|
-
|
|
98332
|
-
|
|
98333
|
-
|
|
98334
|
-
|
|
98335
|
-
|
|
99256
|
+
console.info('Alan lib v: ${window.alanLib?.version || "-"}, exporter v: 1.0.3');
|
|
99257
|
+
|
|
99258
|
+
// Define debug function globally - separated from data to prevent syntax errors in data from breaking the function
|
|
99259
|
+
window.showAlanDebugInfo = function() {
|
|
99260
|
+
try {
|
|
99261
|
+
console.info('Messages in chat:', window.__alanDebugData?.txtMessages || 'not available');
|
|
99262
|
+
console.info('Messages in socket:', window.__alanDebugData?.socketMessages || 'not available');
|
|
99263
|
+
console.info('Errors in export:', window.__alanDebugData?.exportErrors || []);
|
|
99264
|
+
console.info('Logs in export:', window.__alanDebugData?.exportLogs || []);
|
|
99265
|
+
} catch (error) {
|
|
99266
|
+
console.error('Error displaying debug info:', error);
|
|
99267
|
+
}
|
|
99268
|
+
};
|
|
99269
|
+
|
|
99270
|
+
// Store debug data separately - if this fails, the function above is still defined
|
|
99271
|
+
try {
|
|
99272
|
+
window.__alanDebugData = {
|
|
99273
|
+
txtMessages: ${txtMessages},
|
|
99274
|
+
socketMessages: ${socketMessages},
|
|
99275
|
+
exportErrors: ${escapeJsonForScriptTag(JSON.stringify(exportErrors, null, 2))},
|
|
99276
|
+
exportLogs: ${escapeJsonForScriptTag(JSON.stringify(exportLogs, null, 2))}
|
|
99277
|
+
};
|
|
99278
|
+
} catch (error) {
|
|
99279
|
+
console.error('Failed to load debug data:', error);
|
|
99280
|
+
window.__alanDebugData = { error: 'Failed to load debug data' };
|
|
98336
99281
|
}
|
|
98337
99282
|
<\/script>
|
|
98338
99283
|
|
|
@@ -98631,22 +99576,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98631
99576
|
${chatConteiner.outerHTML}
|
|
98632
99577
|
</div>
|
|
98633
99578
|
</div>
|
|
98634
|
-
${
|
|
98635
|
-
|
|
98636
|
-
<script type="module">
|
|
98637
|
-
// Inline iframe resizer library
|
|
98638
|
-
${iframeResizerCode}
|
|
98639
|
-
|
|
98640
|
-
// Use the exports directly
|
|
98641
|
-
const { initialize } = window.iframeResizer;
|
|
98642
|
-
|
|
98643
|
-
// Find all iframes with class 'act-embed' that have an id
|
|
98644
|
-
const iframes = document.querySelectorAll('iframe.act-embed[id]');
|
|
98645
|
-
iframes.forEach(iframe => {
|
|
98646
|
-
iframe.removeAttribute('data-iframe-resizer-initialized');
|
|
98647
|
-
initialize({}, '#' + iframe.id);
|
|
98648
|
-
});
|
|
98649
|
-
<\/script>
|
|
99579
|
+
${code}
|
|
98650
99580
|
</body>
|
|
98651
99581
|
</html>
|
|
98652
99582
|
`;
|
|
@@ -98665,7 +99595,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98665
99595
|
link.click();
|
|
98666
99596
|
URL.revokeObjectURL(link.href);
|
|
98667
99597
|
}
|
|
98668
|
-
async function replaceImagesToBase64(images,
|
|
99598
|
+
async function replaceImagesToBase64(images, errorLogger) {
|
|
98669
99599
|
const result = {};
|
|
98670
99600
|
for (let img of images) {
|
|
98671
99601
|
try {
|
|
@@ -98685,7 +99615,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98685
99615
|
img.src = await fetchImageAsBase64(img.src);
|
|
98686
99616
|
} catch (error) {
|
|
98687
99617
|
const msg = `Error converting images for msgId ${img.getAttribute("msgInd")}:`;
|
|
98688
|
-
|
|
99618
|
+
errorLogger(msg, error);
|
|
98689
99619
|
}
|
|
98690
99620
|
}
|
|
98691
99621
|
return result;
|
|
@@ -98783,6 +99713,25 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98783
99713
|
const htmlContentWithInlinedScripts = doc.documentElement.outerHTML;
|
|
98784
99714
|
const code = extractScriptContents(htmlContentWithInlinedScripts);
|
|
98785
99715
|
const initIframeFn = extractFunction(code, "initIframe", errorLogger);
|
|
99716
|
+
const getProjectResourceUrlFn = extractFunction(code, "getProjectResourceUrl", errorLogger);
|
|
99717
|
+
let resourceBaseUrl = null;
|
|
99718
|
+
const metaTag = doc.querySelector('meta[name="resource-urls"]');
|
|
99719
|
+
if (metaTag) {
|
|
99720
|
+
resourceBaseUrl = metaTag.getAttribute("data-resource-base-url");
|
|
99721
|
+
if (resourceBaseUrl) {
|
|
99722
|
+
infoLogger("Extracted resourceBaseUrl from meta tag:", resourceBaseUrl);
|
|
99723
|
+
}
|
|
99724
|
+
}
|
|
99725
|
+
if (!resourceBaseUrl) {
|
|
99726
|
+
const resourceBaseUrlMatch = getProjectResourceUrlFn?.match(/'([^']*)'/);
|
|
99727
|
+
resourceBaseUrl = resourceBaseUrlMatch ? resourceBaseUrlMatch[1] : null;
|
|
99728
|
+
if (resourceBaseUrl) {
|
|
99729
|
+
infoLogger("Extracted resourceBaseUrl from getProjectResourceUrl function:", resourceBaseUrl);
|
|
99730
|
+
}
|
|
99731
|
+
}
|
|
99732
|
+
if (resourceBaseUrl === null) {
|
|
99733
|
+
errorLogger("Failed to extract resourceBaseUrl", null);
|
|
99734
|
+
}
|
|
98786
99735
|
let allInitIframeResourcesInlined = false;
|
|
98787
99736
|
if (initIframeFn) {
|
|
98788
99737
|
let initIframeBody = stripComments(initIframeFn);
|
|
@@ -98812,139 +99761,91 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98812
99761
|
} else {
|
|
98813
99762
|
infoLogger(`Detected ${resourceUrls.length} resources in initIframe:`, resourceUrls.map((r) => r.url));
|
|
98814
99763
|
}
|
|
98815
|
-
const
|
|
98816
|
-
|
|
98817
|
-
|
|
98818
|
-
|
|
98819
|
-
|
|
98820
|
-
|
|
98821
|
-
|
|
98822
|
-
|
|
98823
|
-
|
|
98824
|
-
|
|
98825
|
-
|
|
98826
|
-
|
|
98827
|
-
|
|
98828
|
-
|
|
98829
|
-
|
|
98830
|
-
|
|
98831
|
-
|
|
98832
|
-
|
|
98833
|
-
|
|
98834
|
-
|
|
98835
|
-
|
|
98836
|
-
|
|
98837
|
-
|
|
98838
|
-
|
|
98839
|
-
getDefaultResources
|
|
98840
|
-
};
|
|
98841
|
-
})()
|
|
98842
|
-
`);
|
|
98843
|
-
if (extracted) {
|
|
98844
|
-
iframeIsValidUrl = extracted.isValidUrl;
|
|
98845
|
-
iframeGetResourceUrl = extracted.getResourceUrl;
|
|
98846
|
-
iframeGetStudioResourceUrl = extracted.getStudioResourceUrl;
|
|
98847
|
-
iframeGetProjectResourceUrl = extracted.getProjectResourceUrl;
|
|
98848
|
-
iframeGetDefaultResources = extracted.getDefaultResources;
|
|
99764
|
+
const addDefaultStylesOptions = extractAddDefaultStylesParams(initIframeBody, errorLogger);
|
|
99765
|
+
if (addDefaultStylesOptions) {
|
|
99766
|
+
try {
|
|
99767
|
+
const basicResources = iframeFn.getDefaultResources(addDefaultStylesOptions);
|
|
99768
|
+
await Promise.all(basicResources.map(async (resource) => {
|
|
99769
|
+
try {
|
|
99770
|
+
const resourceType = resource.type;
|
|
99771
|
+
if (resourceType === "stylesheet" && resource.href) {
|
|
99772
|
+
const resourceUrl = iframeFn.getResourceUrl(resource.href, resourceBaseUrl);
|
|
99773
|
+
const resourceContent = await fetchResourceWithCache(resourceUrl);
|
|
99774
|
+
const inlineStyle = doc.createElement("style");
|
|
99775
|
+
inlineStyle.setAttribute("inlined-resource-name", resource.href);
|
|
99776
|
+
inlineStyle.textContent = resourceContent;
|
|
99777
|
+
doc.head.appendChild(inlineStyle);
|
|
99778
|
+
infoLogger(`Inlined default stylesheet:`, { name: resource.href, url: resourceUrl });
|
|
99779
|
+
}
|
|
99780
|
+
} catch (error) {
|
|
99781
|
+
const msg = `Failed to inline basic resource from ${resource?.href}:`;
|
|
99782
|
+
errorLogger(msg, error);
|
|
99783
|
+
}
|
|
99784
|
+
}));
|
|
99785
|
+
} catch (error) {
|
|
99786
|
+
const msg = "Failed to get or inline basic resources:";
|
|
99787
|
+
errorLogger(msg, error);
|
|
98849
99788
|
}
|
|
98850
|
-
} catch (error) {
|
|
98851
|
-
const msg = "Failed to parse resource-related functions using eval:";
|
|
98852
|
-
errorLogger(msg, error);
|
|
98853
|
-
}
|
|
98854
|
-
let hasInternalFunctions = true;
|
|
98855
|
-
if (!iframeGetResourceUrl || !iframeGetStudioResourceUrl || !iframeGetProjectResourceUrl || !iframeIsValidUrl || !iframeGetDefaultResources) {
|
|
98856
|
-
hasInternalFunctions = false;
|
|
98857
|
-
const msg = "Unable to parse resource-related functions from the iframe code. Some iframes may appear without content.";
|
|
98858
|
-
errorLogger(msg, null);
|
|
98859
99789
|
}
|
|
98860
|
-
|
|
98861
|
-
|
|
98862
|
-
|
|
98863
|
-
|
|
98864
|
-
|
|
98865
|
-
|
|
98866
|
-
|
|
98867
|
-
|
|
98868
|
-
|
|
98869
|
-
|
|
98870
|
-
|
|
98871
|
-
|
|
98872
|
-
|
|
98873
|
-
|
|
98874
|
-
|
|
98875
|
-
|
|
98876
|
-
|
|
98877
|
-
|
|
98878
|
-
} catch (error) {
|
|
98879
|
-
const msg = `Failed to inline basic resource from ${resource?.href}:`;
|
|
98880
|
-
errorLogger(msg, error);
|
|
98881
|
-
}
|
|
98882
|
-
}));
|
|
98883
|
-
} catch (error) {
|
|
98884
|
-
const msg = "Failed to get or inline basic resources:";
|
|
98885
|
-
errorLogger(msg, error);
|
|
98886
|
-
}
|
|
99790
|
+
const resourceResults = await Promise.all(resourceUrls.map(async (resource) => {
|
|
99791
|
+
try {
|
|
99792
|
+
const resourceUrl = iframeFn.getResourceUrl(resource.url, resourceBaseUrl);
|
|
99793
|
+
const resourceContent = await fetchResourceWithCache(resourceUrl);
|
|
99794
|
+
return {
|
|
99795
|
+
success: true,
|
|
99796
|
+
resource,
|
|
99797
|
+
resourceUrl,
|
|
99798
|
+
resourceContent
|
|
99799
|
+
};
|
|
99800
|
+
} catch (error) {
|
|
99801
|
+
const msg = `Failed to fetch resource from ${resource.url}:`;
|
|
99802
|
+
errorLogger(msg, error);
|
|
99803
|
+
return {
|
|
99804
|
+
success: false,
|
|
99805
|
+
resource,
|
|
99806
|
+
error
|
|
99807
|
+
};
|
|
98887
99808
|
}
|
|
98888
|
-
|
|
98889
|
-
|
|
98890
|
-
|
|
98891
|
-
|
|
98892
|
-
|
|
98893
|
-
|
|
98894
|
-
|
|
98895
|
-
|
|
98896
|
-
|
|
98897
|
-
|
|
98898
|
-
|
|
98899
|
-
|
|
98900
|
-
|
|
98901
|
-
|
|
98902
|
-
|
|
98903
|
-
|
|
98904
|
-
|
|
98905
|
-
|
|
98906
|
-
}
|
|
98907
|
-
}));
|
|
98908
|
-
let insertionPoint = doc.head.firstChild;
|
|
98909
|
-
for (const result of resourceResults) {
|
|
98910
|
-
if (!result.success) {
|
|
98911
|
-
allInitIframeResourcesInlined = false;
|
|
98912
|
-
continue;
|
|
98913
|
-
}
|
|
98914
|
-
const { resource, resourceUrl, resourceContent } = result;
|
|
98915
|
-
try {
|
|
98916
|
-
if (resource.type === "addScript" || resource.url.endsWith(".js")) {
|
|
98917
|
-
const inlineScript = doc.createElement("script");
|
|
98918
|
-
inlineScript.setAttribute("inlined-resource-name", resource.url);
|
|
98919
|
-
inlineScript.textContent = resourceContent;
|
|
98920
|
-
if (resource.options) {
|
|
98921
|
-
const optionsObj = safelyParseScriptOptions(resource.options, errorLogger);
|
|
98922
|
-
if (optionsObj && typeof optionsObj === "object") {
|
|
98923
|
-
if (optionsObj.type) {
|
|
98924
|
-
inlineScript.setAttribute("type", optionsObj.type);
|
|
98925
|
-
}
|
|
98926
|
-
if (optionsObj.defer) inlineScript.setAttribute("defer", "");
|
|
98927
|
-
if (optionsObj.async) inlineScript.setAttribute("async", "");
|
|
98928
|
-
if (optionsObj.nomodule) inlineScript.setAttribute("nomodule", "");
|
|
98929
|
-
if (optionsObj.crossOrigin) inlineScript.setAttribute("crossorigin", optionsObj.crossOrigin);
|
|
99809
|
+
}));
|
|
99810
|
+
let insertionPoint = doc.head.firstChild;
|
|
99811
|
+
for (const result of resourceResults) {
|
|
99812
|
+
if (!result.success) {
|
|
99813
|
+
allInitIframeResourcesInlined = false;
|
|
99814
|
+
continue;
|
|
99815
|
+
}
|
|
99816
|
+
const { resource, resourceUrl, resourceContent } = result;
|
|
99817
|
+
try {
|
|
99818
|
+
if (resource.type === "addScript" || resource.url.endsWith(".js")) {
|
|
99819
|
+
const inlineScript = doc.createElement("script");
|
|
99820
|
+
inlineScript.setAttribute("inlined-resource-name", resource.url);
|
|
99821
|
+
inlineScript.textContent = resourceContent;
|
|
99822
|
+
if (resource.options) {
|
|
99823
|
+
const optionsObj = safelyParseScriptOptions(resource.options, errorLogger);
|
|
99824
|
+
if (optionsObj && typeof optionsObj === "object") {
|
|
99825
|
+
if (optionsObj.type) {
|
|
99826
|
+
inlineScript.setAttribute("type", optionsObj.type);
|
|
98930
99827
|
}
|
|
98931
|
-
|
|
98932
|
-
|
|
98933
|
-
|
|
98934
|
-
|
|
98935
|
-
|
|
98936
|
-
|
|
98937
|
-
|
|
98938
|
-
|
|
98939
|
-
|
|
98940
|
-
|
|
98941
|
-
|
|
98942
|
-
|
|
98943
|
-
|
|
98944
|
-
|
|
98945
|
-
|
|
98946
|
-
|
|
99828
|
+
if (optionsObj.defer) inlineScript.setAttribute("defer", "");
|
|
99829
|
+
if (optionsObj.async) inlineScript.setAttribute("async", "");
|
|
99830
|
+
if (optionsObj.nomodule) inlineScript.setAttribute("nomodule", "");
|
|
99831
|
+
if (optionsObj.crossOrigin) inlineScript.setAttribute("crossorigin", optionsObj.crossOrigin);
|
|
99832
|
+
}
|
|
99833
|
+
}
|
|
99834
|
+
doc.head.insertBefore(inlineScript, insertionPoint);
|
|
99835
|
+
insertionPoint = inlineScript.nextSibling;
|
|
99836
|
+
infoLogger(`Inlined initIframe script:`, { name: resource.url, url: resourceUrl, type: inlineScript.type || "text/javascript" });
|
|
99837
|
+
} else if (resource.type === "addStyleSheet" || resource.url.endsWith(".css")) {
|
|
99838
|
+
const inlineStyle = doc.createElement("style");
|
|
99839
|
+
inlineStyle.setAttribute("inlined-resource-name", resource.url);
|
|
99840
|
+
inlineStyle.textContent = resourceContent;
|
|
99841
|
+
doc.head.insertBefore(inlineStyle, insertionPoint);
|
|
99842
|
+
insertionPoint = inlineStyle.nextSibling;
|
|
99843
|
+
infoLogger(`Inlined initIframe stylesheet:`, { name: resource.url, url: resourceUrl });
|
|
98947
99844
|
}
|
|
99845
|
+
} catch (error) {
|
|
99846
|
+
const msg = `Failed to inline resource from ${resource.url}:`;
|
|
99847
|
+
errorLogger(msg, error);
|
|
99848
|
+
allInitIframeResourcesInlined = false;
|
|
98948
99849
|
}
|
|
98949
99850
|
}
|
|
98950
99851
|
}
|
|
@@ -99124,7 +100025,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
99124
100025
|
}
|
|
99125
100026
|
|
|
99126
100027
|
// alan_btn/src/textChat/helpers/resources.ts
|
|
99127
|
-
function
|
|
100028
|
+
function isValidUrl3(url) {
|
|
99128
100029
|
try {
|
|
99129
100030
|
new URL(url);
|
|
99130
100031
|
return true;
|
|
@@ -99140,7 +100041,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
99140
100041
|
const resourceBaseUrl = uiState.resourceBaseUrl;
|
|
99141
100042
|
const projectResPrefix = "resource://";
|
|
99142
100043
|
const studioResPrefix = "studio-resource://";
|
|
99143
|
-
const withPublicUrl =
|
|
100044
|
+
const withPublicUrl = isValidUrl3(resourceUrl);
|
|
99144
100045
|
if (!resourceUrl) {
|
|
99145
100046
|
return `${resourceBaseUrl}`;
|
|
99146
100047
|
}
|
|
@@ -99211,7 +100112,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
99211
100112
|
// alan_btn/alan_btn.ts
|
|
99212
100113
|
(function(ns) {
|
|
99213
100114
|
const uiState10 = getUIState();
|
|
99214
|
-
const version2 = "alan-version.1.8.
|
|
100115
|
+
const version2 = "alan-version.1.8.141".replace("alan-version.", "");
|
|
99215
100116
|
uiState10.lib.version = version2;
|
|
99216
100117
|
window.alanLib = { version: version2 };
|
|
99217
100118
|
if (window.alanBtn) {
|
|
@@ -101820,6 +102721,7 @@ ${reason}` : reason,
|
|
|
101820
102721
|
ctx: {
|
|
101821
102722
|
...msg.ctx,
|
|
101822
102723
|
final: true,
|
|
102724
|
+
cancelled: true,
|
|
101823
102725
|
tsFinal: msg.ctx?.tsFinal || Date.now()
|
|
101824
102726
|
}
|
|
101825
102727
|
}, true);
|
|
@@ -102290,6 +103192,25 @@ ${reason}` : reason,
|
|
|
102290
103192
|
localStorage.setItem(LOCAL_STORAGE_KEYS.getTabIdKey(), tabId);
|
|
102291
103193
|
}
|
|
102292
103194
|
}
|
|
103195
|
+
function normalizeMessage(msg) {
|
|
103196
|
+
const normalized = { ...msg };
|
|
103197
|
+
if (normalized.queryProgress && Array.isArray(normalized.queryProgress)) {
|
|
103198
|
+
normalized.queryProgress = normalized.queryProgress.map((progress) => {
|
|
103199
|
+
const { isShown, ...rest } = progress;
|
|
103200
|
+
return rest;
|
|
103201
|
+
});
|
|
103202
|
+
}
|
|
103203
|
+
if (normalized.ctx) {
|
|
103204
|
+
const { cancelled, ...restCtx } = normalized.ctx;
|
|
103205
|
+
normalized.ctx = restCtx;
|
|
103206
|
+
}
|
|
103207
|
+
delete normalized.initLoad;
|
|
103208
|
+
return normalized;
|
|
103209
|
+
}
|
|
103210
|
+
function normalizeMessagesForComparison(messages) {
|
|
103211
|
+
if (!Array.isArray(messages)) return messages;
|
|
103212
|
+
return messages.map((msg) => normalizeMessage(msg));
|
|
103213
|
+
}
|
|
102293
103214
|
function restoreMessagesInChat(initLoad) {
|
|
102294
103215
|
var savedMsgs;
|
|
102295
103216
|
if (isTutorMode()) {
|
|
@@ -102302,17 +103223,17 @@ ${reason}` : reason,
|
|
|
102302
103223
|
if (savedMsgs) {
|
|
102303
103224
|
savedMsgs = decryptMessage(savedMsgs);
|
|
102304
103225
|
}
|
|
102305
|
-
|
|
103226
|
+
const parsedSavedMsgs = savedMsgs ? JSON.parse(savedMsgs) : [];
|
|
103227
|
+
const normalizedSaved = JSON.stringify(normalizeMessagesForComparison(parsedSavedMsgs));
|
|
103228
|
+
const normalizedCurrent = JSON.stringify(normalizeMessagesForComparison(textChatMessages));
|
|
103229
|
+
if (normalizedSaved === normalizedCurrent) {
|
|
102306
103230
|
return;
|
|
102307
103231
|
}
|
|
102308
|
-
savedMsgs =
|
|
103232
|
+
savedMsgs = parsedSavedMsgs;
|
|
102309
103233
|
if (Array.isArray(savedMsgs)) {
|
|
102310
|
-
if (savedMsgs?.length > 0) {
|
|
102311
|
-
clearDOMChat();
|
|
102312
|
-
}
|
|
102313
103234
|
canceledRequests = [];
|
|
102314
|
-
|
|
102315
|
-
|
|
103235
|
+
if (initLoad === true) {
|
|
103236
|
+
for (let i2 = 0; i2 < savedMsgs.length; i2++) {
|
|
102316
103237
|
savedMsgs[i2].initLoad = true;
|
|
102317
103238
|
if (savedMsgs[i2].name === "loading") {
|
|
102318
103239
|
savedMsgs[i2].name = "text";
|
|
@@ -102321,10 +103242,64 @@ ${reason}` : reason,
|
|
|
102321
103242
|
} else {
|
|
102322
103243
|
renderMessageInTextChat(savedMsgs[i2], true, true);
|
|
102323
103244
|
}
|
|
102324
|
-
} else {
|
|
102325
|
-
renderMessageInTextChat(savedMsgs[i2], true, true);
|
|
102326
103245
|
}
|
|
103246
|
+
refillCancelMessages(savedMsgs);
|
|
103247
|
+
return;
|
|
103248
|
+
}
|
|
103249
|
+
const chatChildren = document.getElementById("chatMessages");
|
|
103250
|
+
if (!chatChildren) {
|
|
103251
|
+
return;
|
|
103252
|
+
}
|
|
103253
|
+
const messagesInTheDom = chatChildren.querySelectorAll('[id^="msg-"]');
|
|
103254
|
+
const firstMsgInTheDom = messagesInTheDom[0];
|
|
103255
|
+
if (!firstMsgInTheDom) {
|
|
103256
|
+
return;
|
|
103257
|
+
}
|
|
103258
|
+
const firstMsgReqId = firstMsgInTheDom.getAttribute("data-request-id");
|
|
103259
|
+
let canUseSmartRestore = false;
|
|
103260
|
+
if (firstMsgReqId === getMsgReqId(savedMsgs[0])) {
|
|
103261
|
+
canUseSmartRestore = true;
|
|
103262
|
+
}
|
|
103263
|
+
if (canUseSmartRestore) {
|
|
103264
|
+
let desyncIndex = -1;
|
|
103265
|
+
for (let i2 = 0; i2 < messagesInTheDom.length; i2++) {
|
|
103266
|
+
const curRenderedMsgReqId = messagesInTheDom[i2].getAttribute("data-request-id");
|
|
103267
|
+
const curSavedMsgReqId = savedMsgs[i2] ? getMsgReqId(savedMsgs[i2]) : null;
|
|
103268
|
+
if (curSavedMsgReqId === curRenderedMsgReqId) {
|
|
103269
|
+
const existingInTextChatMsgs = textChatMessages[i2];
|
|
103270
|
+
if (existingInTextChatMsgs && JSON.stringify(normalizeMessage(existingInTextChatMsgs)) === JSON.stringify(normalizeMessage(savedMsgs[i2]))) {
|
|
103271
|
+
savedMsgs[i2].processed = true;
|
|
103272
|
+
} else {
|
|
103273
|
+
desyncIndex = i2;
|
|
103274
|
+
break;
|
|
103275
|
+
}
|
|
103276
|
+
}
|
|
103277
|
+
}
|
|
103278
|
+
const newSavedMsgs = savedMsgs.filter((m) => m.processed !== true);
|
|
103279
|
+
if (newSavedMsgs.length > 0 && desyncIndex === -1) {
|
|
103280
|
+
for (let i2 = 0; i2 < newSavedMsgs.length; i2++) {
|
|
103281
|
+
renderMessageInTextChat(newSavedMsgs[i2], true, true);
|
|
103282
|
+
}
|
|
103283
|
+
}
|
|
103284
|
+
if (desyncIndex > -1) {
|
|
103285
|
+
for (let i2 = desyncIndex; i2 < messagesInTheDom.length; i2++) {
|
|
103286
|
+
messagesInTheDom[i2].remove();
|
|
103287
|
+
}
|
|
103288
|
+
textChatMessages = textChatMessages.slice(0, desyncIndex);
|
|
103289
|
+
for (let i2 = desyncIndex; i2 < savedMsgs.length; i2++) {
|
|
103290
|
+
renderMessageInTextChat(savedMsgs[i2], true, true);
|
|
103291
|
+
}
|
|
103292
|
+
}
|
|
103293
|
+
refillCancelMessages(savedMsgs);
|
|
103294
|
+
return;
|
|
102327
103295
|
}
|
|
103296
|
+
if (savedMsgs?.length > 0) {
|
|
103297
|
+
clearDOMChat();
|
|
103298
|
+
}
|
|
103299
|
+
for (let i2 = 0; i2 < savedMsgs.length; i2++) {
|
|
103300
|
+
renderMessageInTextChat(savedMsgs[i2], true, true);
|
|
103301
|
+
}
|
|
103302
|
+
refillCancelMessages(savedMsgs);
|
|
102328
103303
|
}
|
|
102329
103304
|
} catch (e) {
|
|
102330
103305
|
console.warn("Alan: unable to restore text chat history");
|
|
@@ -102332,6 +103307,16 @@ ${reason}` : reason,
|
|
|
102332
103307
|
}
|
|
102333
103308
|
}
|
|
102334
103309
|
}
|
|
103310
|
+
function refillCancelMessages(savedMsgs) {
|
|
103311
|
+
for (let i2 = 0; i2 < savedMsgs.length; i2++) {
|
|
103312
|
+
if (savedMsgs[i2].ctx?.cancelled === true) {
|
|
103313
|
+
const reqId = getMsgReqId(savedMsgs[i2]);
|
|
103314
|
+
if (!canceledRequests.includes(reqId)) {
|
|
103315
|
+
canceledRequests.push(reqId);
|
|
103316
|
+
}
|
|
103317
|
+
}
|
|
103318
|
+
}
|
|
103319
|
+
}
|
|
102335
103320
|
function clearChatHistoryStorage() {
|
|
102336
103321
|
if (isTutorMode()) {
|
|
102337
103322
|
return;
|
|
@@ -102355,19 +103340,31 @@ ${reason}` : reason,
|
|
|
102355
103340
|
var maxQuestions = uiState10.textChat.maxQuestionsCount || 5;
|
|
102356
103341
|
if (text3?.length > maxChars) {
|
|
102357
103342
|
console.warn("Alan: message cannot be sent: maximum message limit exceeded.");
|
|
103343
|
+
if (options.onEvent) {
|
|
103344
|
+
options.onEvent({ name: "textChatMessageLimitExceeded" });
|
|
103345
|
+
}
|
|
102358
103346
|
return;
|
|
102359
103347
|
}
|
|
102360
103348
|
if (getActiveQuestionsCount() >= maxQuestions) {
|
|
102361
103349
|
console.warn("Alan: message cannot be sent: maximum concurrent questions limit exceeded.");
|
|
103350
|
+
if (options.onEvent) {
|
|
103351
|
+
options.onEvent({ name: "textChatConcurrentQuestionsLimitExceeded" });
|
|
103352
|
+
}
|
|
102362
103353
|
return;
|
|
102363
103354
|
}
|
|
102364
103355
|
if (!canMsgBeSent()) {
|
|
102365
103356
|
console.warn("Alan: message cannot be sent. Model is not ready or connection is not established.");
|
|
103357
|
+
if (options.onEvent) {
|
|
103358
|
+
options.onEvent({ name: "textChatModelNotReady" });
|
|
103359
|
+
}
|
|
102366
103360
|
return;
|
|
102367
103361
|
}
|
|
102368
103362
|
if (getActiveQuestionsCount() >= maxQuestions) {
|
|
102369
103363
|
disableTextareaInTheChat();
|
|
102370
103364
|
}
|
|
103365
|
+
if (options.onEvent) {
|
|
103366
|
+
options.onEvent({ name: "textChatMessageSubmitted" });
|
|
103367
|
+
}
|
|
102371
103368
|
var msg = { text: text3, type: "request", name: "text", tsInit: Date.now() };
|
|
102372
103369
|
sentMessageInd = null;
|
|
102373
103370
|
clearMessageProgressStatusInterval();
|
|
@@ -102429,17 +103426,29 @@ ${reason}` : reason,
|
|
|
102429
103426
|
var maxQuestions = uiState10.textChat.maxQuestionsCount || 5;
|
|
102430
103427
|
if (lastSendMsgTs) {
|
|
102431
103428
|
console.warn("Alan: message cannot be sent: you are sending messages too fast. Please wait a moment before sending another message.");
|
|
103429
|
+
if (options.onEvent) {
|
|
103430
|
+
options.onEvent({ name: "textChatMessageTooFast" });
|
|
103431
|
+
}
|
|
102432
103432
|
return;
|
|
102433
103433
|
}
|
|
102434
103434
|
if (text3?.length > maxChars) {
|
|
102435
103435
|
console.warn("Alan: message cannot be sent: maximum message limit exceeded.");
|
|
103436
|
+
if (options.onEvent) {
|
|
103437
|
+
options.onEvent({ name: "textChatMessageLimitExceeded" });
|
|
103438
|
+
}
|
|
102436
103439
|
return;
|
|
102437
103440
|
}
|
|
102438
103441
|
if (getActiveQuestionsCount() >= maxQuestions) {
|
|
102439
103442
|
console.warn("Alan: message cannot be sent: maximum concurrent questions limit exceeded.");
|
|
103443
|
+
if (options.onEvent) {
|
|
103444
|
+
options.onEvent({ name: "textChatConcurrentQuestionsLimitExceeded" });
|
|
103445
|
+
}
|
|
102440
103446
|
return;
|
|
102441
103447
|
}
|
|
102442
103448
|
if (!canMsgBeSent()) {
|
|
103449
|
+
if (options.onEvent) {
|
|
103450
|
+
options.onEvent({ name: "textChatModelNotReady" });
|
|
103451
|
+
}
|
|
102443
103452
|
return;
|
|
102444
103453
|
}
|
|
102445
103454
|
lastSendMsgTs = setTimeout(() => {
|
|
@@ -102742,6 +103751,7 @@ ${reason}` : reason,
|
|
|
102742
103751
|
const textareaEl = getChatTextareaEl();
|
|
102743
103752
|
textareaEl.value = messages[sentMessageInd];
|
|
102744
103753
|
moveCursorToEnd(textareaEl);
|
|
103754
|
+
manageSendButtonAvailability();
|
|
102745
103755
|
}
|
|
102746
103756
|
function moveCursorToEnd(el) {
|
|
102747
103757
|
el.focus();
|
|
@@ -103324,6 +104334,9 @@ ${reason}` : reason,
|
|
|
103324
104334
|
exitFullScreenModeForTextChat();
|
|
103325
104335
|
}
|
|
103326
104336
|
broadcastReloadIframeToIframes();
|
|
104337
|
+
if (options.onEvent) {
|
|
104338
|
+
options.onEvent({ name: uiState10.textChat.expanded ? "textChatExpanded" : "textChatCollapsed" });
|
|
104339
|
+
}
|
|
103327
104340
|
}
|
|
103328
104341
|
async function exportChatHistory() {
|
|
103329
104342
|
const saveChatStateBtnImg = document.getElementById("alan-btn-save-chat-state-btn");
|