@alan-ai/alan-sdk-web 1.8.138 → 1.8.140
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 +1458 -500
- 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) {
|
|
@@ -85830,9 +86659,9 @@
|
|
|
85830
86659
|
return line.replace(/[ \t]+/g, " ").trim();
|
|
85831
86660
|
});
|
|
85832
86661
|
plainText = processedLines.join("\n");
|
|
85833
|
-
codeBlocks.forEach((
|
|
86662
|
+
codeBlocks.forEach((code, index2) => {
|
|
85834
86663
|
const placeholder = `<<<CODE_BLOCK_${index2}>>>`;
|
|
85835
|
-
plainText = plainText.replace(placeholder, "\n\n" +
|
|
86664
|
+
plainText = plainText.replace(placeholder, "\n\n" + code);
|
|
85836
86665
|
});
|
|
85837
86666
|
plainText = plainText.replace(/\n{3,}/g, "\n\n").trim();
|
|
85838
86667
|
const blobText = new Blob([plainText], { type: "text/plain" });
|
|
@@ -86711,8 +87540,8 @@
|
|
|
86711
87540
|
function parseSvgSize(svgString) {
|
|
86712
87541
|
const defaultSize = uiState6.textChat.defaults.defaultSvgIconSize;
|
|
86713
87542
|
if (!svgString) return [defaultSize, defaultSize];
|
|
86714
|
-
const
|
|
86715
|
-
const svgDoc =
|
|
87543
|
+
const parser = new DOMParser();
|
|
87544
|
+
const svgDoc = parser.parseFromString(svgString, "image/svg+xml");
|
|
86716
87545
|
const svgElement = svgDoc.querySelector("svg");
|
|
86717
87546
|
const width = svgElement.getAttribute("width");
|
|
86718
87547
|
const height = svgElement.getAttribute("height");
|
|
@@ -90038,18 +90867,18 @@
|
|
|
90038
90867
|
}
|
|
90039
90868
|
var hljsTheme = false;
|
|
90040
90869
|
function initHighlightJs(theme, customDocument) {
|
|
90041
|
-
const
|
|
90870
|
+
const doc = customDocument || document;
|
|
90042
90871
|
const hljsStylesId = `alan-hljs-styles-${theme}`;
|
|
90043
|
-
if (hljsTheme === theme &&
|
|
90872
|
+
if (hljsTheme === theme && doc.getElementById(hljsStylesId)) return;
|
|
90044
90873
|
hljsTheme = theme;
|
|
90045
|
-
var style =
|
|
90874
|
+
var style = doc.createElement("style");
|
|
90046
90875
|
style.textContent = highlightJsCss(theme);
|
|
90047
90876
|
style.id = hljsStylesId;
|
|
90048
|
-
|
|
90049
|
-
var lightHLJSOnlyStyle =
|
|
90877
|
+
doc.getElementsByTagName("head")[0].appendChild(style);
|
|
90878
|
+
var lightHLJSOnlyStyle = doc.createElement("style");
|
|
90050
90879
|
lightHLJSOnlyStyle.textContent = highlightJsCssForOnlyLightTheme();
|
|
90051
90880
|
lightHLJSOnlyStyle.id = `alan-hljs-styles-light-only`;
|
|
90052
|
-
|
|
90881
|
+
doc.getElementsByTagName("head")[0].appendChild(lightHLJSOnlyStyle);
|
|
90053
90882
|
}
|
|
90054
90883
|
function highlightCode(msgsHolder) {
|
|
90055
90884
|
if (window.hljs) {
|
|
@@ -90532,17 +91361,17 @@ code.hljs {
|
|
|
90532
91361
|
}
|
|
90533
91362
|
return pathSegments.join(" > ");
|
|
90534
91363
|
}
|
|
90535
|
-
function collectScrollableElementStates(
|
|
90536
|
-
if (typeof
|
|
91364
|
+
function collectScrollableElementStates(doc = document) {
|
|
91365
|
+
if (typeof doc === "undefined") {
|
|
90537
91366
|
return [];
|
|
90538
91367
|
}
|
|
90539
|
-
const win =
|
|
91368
|
+
const win = doc.defaultView || window;
|
|
90540
91369
|
const HTMLElementClass = win.HTMLElement;
|
|
90541
91370
|
const elements = /* @__PURE__ */ new Set();
|
|
90542
|
-
|
|
90543
|
-
if (
|
|
90544
|
-
if (
|
|
90545
|
-
if (
|
|
91371
|
+
doc.querySelectorAll("*").forEach((el) => elements.add(el));
|
|
91372
|
+
if (doc.body) elements.add(doc.body);
|
|
91373
|
+
if (doc.documentElement) elements.add(doc.documentElement);
|
|
91374
|
+
if (doc.scrollingElement) elements.add(doc.scrollingElement);
|
|
90546
91375
|
const scrollableStates = [];
|
|
90547
91376
|
const overflowRegex = /(auto|scroll|overlay)/i;
|
|
90548
91377
|
elements.forEach((element) => {
|
|
@@ -90559,7 +91388,7 @@ code.hljs {
|
|
|
90559
91388
|
const computedStyle = win.getComputedStyle(element);
|
|
90560
91389
|
const overflowY = computedStyle.overflowY;
|
|
90561
91390
|
const overflowX = computedStyle.overflowX;
|
|
90562
|
-
const isRootElement = element ===
|
|
91391
|
+
const isRootElement = element === doc.body || element === doc.documentElement || element === doc.scrollingElement;
|
|
90563
91392
|
const canScrollVertically = scrollHeight - clientHeight > 1;
|
|
90564
91393
|
const canScrollHorizontally = scrollWidth - clientWidth > 1;
|
|
90565
91394
|
const allowsVerticalScroll = isRootElement || overflowRegex.test(overflowY);
|
|
@@ -90590,9 +91419,9 @@ code.hljs {
|
|
|
90590
91419
|
const crossOriginIframes = [];
|
|
90591
91420
|
for (const iframe of iframes) {
|
|
90592
91421
|
try {
|
|
90593
|
-
const
|
|
90594
|
-
if (
|
|
90595
|
-
const clone2 =
|
|
91422
|
+
const doc = iframe.contentDocument;
|
|
91423
|
+
if (doc && doc.documentElement) {
|
|
91424
|
+
const clone2 = doc.documentElement.cloneNode(true);
|
|
90596
91425
|
clone2.querySelectorAll("script").forEach((s) => s.remove());
|
|
90597
91426
|
directResults.push({ id: iframe.id, html: clone2.outerHTML });
|
|
90598
91427
|
} else {
|
|
@@ -90979,67 +91808,67 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
90979
91808
|
var keywordRelationalOperator = /^in(stanceof)?$/;
|
|
90980
91809
|
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
90981
91810
|
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
90982
|
-
function isInAstralSet(
|
|
91811
|
+
function isInAstralSet(code, set) {
|
|
90983
91812
|
var pos = 65536;
|
|
90984
91813
|
for (var i = 0; i < set.length; i += 2) {
|
|
90985
91814
|
pos += set[i];
|
|
90986
|
-
if (pos >
|
|
91815
|
+
if (pos > code) {
|
|
90987
91816
|
return false;
|
|
90988
91817
|
}
|
|
90989
91818
|
pos += set[i + 1];
|
|
90990
|
-
if (pos >=
|
|
91819
|
+
if (pos >= code) {
|
|
90991
91820
|
return true;
|
|
90992
91821
|
}
|
|
90993
91822
|
}
|
|
90994
91823
|
return false;
|
|
90995
91824
|
}
|
|
90996
|
-
function isIdentifierStart(
|
|
90997
|
-
if (
|
|
90998
|
-
return
|
|
91825
|
+
function isIdentifierStart(code, astral) {
|
|
91826
|
+
if (code < 65) {
|
|
91827
|
+
return code === 36;
|
|
90999
91828
|
}
|
|
91000
|
-
if (
|
|
91829
|
+
if (code < 91) {
|
|
91001
91830
|
return true;
|
|
91002
91831
|
}
|
|
91003
|
-
if (
|
|
91004
|
-
return
|
|
91832
|
+
if (code < 97) {
|
|
91833
|
+
return code === 95;
|
|
91005
91834
|
}
|
|
91006
|
-
if (
|
|
91835
|
+
if (code < 123) {
|
|
91007
91836
|
return true;
|
|
91008
91837
|
}
|
|
91009
|
-
if (
|
|
91010
|
-
return
|
|
91838
|
+
if (code <= 65535) {
|
|
91839
|
+
return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
|
91011
91840
|
}
|
|
91012
91841
|
if (astral === false) {
|
|
91013
91842
|
return false;
|
|
91014
91843
|
}
|
|
91015
|
-
return isInAstralSet(
|
|
91844
|
+
return isInAstralSet(code, astralIdentifierStartCodes);
|
|
91016
91845
|
}
|
|
91017
|
-
function isIdentifierChar(
|
|
91018
|
-
if (
|
|
91019
|
-
return
|
|
91846
|
+
function isIdentifierChar(code, astral) {
|
|
91847
|
+
if (code < 48) {
|
|
91848
|
+
return code === 36;
|
|
91020
91849
|
}
|
|
91021
|
-
if (
|
|
91850
|
+
if (code < 58) {
|
|
91022
91851
|
return true;
|
|
91023
91852
|
}
|
|
91024
|
-
if (
|
|
91853
|
+
if (code < 65) {
|
|
91025
91854
|
return false;
|
|
91026
91855
|
}
|
|
91027
|
-
if (
|
|
91856
|
+
if (code < 91) {
|
|
91028
91857
|
return true;
|
|
91029
91858
|
}
|
|
91030
|
-
if (
|
|
91031
|
-
return
|
|
91859
|
+
if (code < 97) {
|
|
91860
|
+
return code === 95;
|
|
91032
91861
|
}
|
|
91033
|
-
if (
|
|
91862
|
+
if (code < 123) {
|
|
91034
91863
|
return true;
|
|
91035
91864
|
}
|
|
91036
|
-
if (
|
|
91037
|
-
return
|
|
91865
|
+
if (code <= 65535) {
|
|
91866
|
+
return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
|
|
91038
91867
|
}
|
|
91039
91868
|
if (astral === false) {
|
|
91040
91869
|
return false;
|
|
91041
91870
|
}
|
|
91042
|
-
return isInAstralSet(
|
|
91871
|
+
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
|
91043
91872
|
}
|
|
91044
91873
|
var TokenType3 = function TokenType4(label, conf) {
|
|
91045
91874
|
if (conf === void 0) conf = {};
|
|
@@ -91161,15 +91990,15 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
91161
91990
|
};
|
|
91162
91991
|
var lineBreak = /\r\n?|\n|\u2028|\u2029/;
|
|
91163
91992
|
var lineBreakG = new RegExp(lineBreak.source, "g");
|
|
91164
|
-
function isNewLine(
|
|
91165
|
-
return
|
|
91993
|
+
function isNewLine(code) {
|
|
91994
|
+
return code === 10 || code === 13 || code === 8232 || code === 8233;
|
|
91166
91995
|
}
|
|
91167
|
-
function nextLineBreak(
|
|
91168
|
-
if (end2 === void 0) end2 =
|
|
91996
|
+
function nextLineBreak(code, from, end2) {
|
|
91997
|
+
if (end2 === void 0) end2 = code.length;
|
|
91169
91998
|
for (var i = from; i < end2; i++) {
|
|
91170
|
-
var next2 =
|
|
91999
|
+
var next2 = code.charCodeAt(i);
|
|
91171
92000
|
if (isNewLine(next2)) {
|
|
91172
|
-
return i < end2 - 1 && next2 === 13 &&
|
|
92001
|
+
return i < end2 - 1 && next2 === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1;
|
|
91173
92002
|
}
|
|
91174
92003
|
}
|
|
91175
92004
|
return -1;
|
|
@@ -91189,12 +92018,12 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
91189
92018
|
function wordsRegexp(words) {
|
|
91190
92019
|
return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
|
|
91191
92020
|
}
|
|
91192
|
-
function codePointToString(
|
|
91193
|
-
if (
|
|
91194
|
-
return String.fromCharCode(
|
|
92021
|
+
function codePointToString(code) {
|
|
92022
|
+
if (code <= 65535) {
|
|
92023
|
+
return String.fromCharCode(code);
|
|
91195
92024
|
}
|
|
91196
|
-
|
|
91197
|
-
return String.fromCharCode((
|
|
92025
|
+
code -= 65536;
|
|
92026
|
+
return String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320);
|
|
91198
92027
|
}
|
|
91199
92028
|
var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
|
|
91200
92029
|
var Position = function Position2(line, col) {
|
|
@@ -91502,9 +92331,9 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
91502
92331
|
return new this(options, input).parse();
|
|
91503
92332
|
};
|
|
91504
92333
|
Parser4.parseExpressionAt = function parseExpressionAt(input, pos, options) {
|
|
91505
|
-
var
|
|
91506
|
-
|
|
91507
|
-
return
|
|
92334
|
+
var parser = new this(options, input, pos);
|
|
92335
|
+
parser.nextToken();
|
|
92336
|
+
return parser.parseExpression();
|
|
91508
92337
|
};
|
|
91509
92338
|
Parser4.tokenizer = function tokenizer(input, options) {
|
|
91510
92339
|
return new this(options, input);
|
|
@@ -94301,17 +95130,17 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
94301
95130
|
}
|
|
94302
95131
|
}
|
|
94303
95132
|
};
|
|
94304
|
-
var Node3 = function Node4(
|
|
95133
|
+
var Node3 = function Node4(parser, pos, loc) {
|
|
94305
95134
|
this.type = "";
|
|
94306
95135
|
this.start = pos;
|
|
94307
95136
|
this.end = 0;
|
|
94308
|
-
if (
|
|
94309
|
-
this.loc = new SourceLocation(
|
|
95137
|
+
if (parser.options.locations) {
|
|
95138
|
+
this.loc = new SourceLocation(parser, loc);
|
|
94310
95139
|
}
|
|
94311
|
-
if (
|
|
94312
|
-
this.sourceFile =
|
|
95140
|
+
if (parser.options.directSourceFile) {
|
|
95141
|
+
this.sourceFile = parser.options.directSourceFile;
|
|
94313
95142
|
}
|
|
94314
|
-
if (
|
|
95143
|
+
if (parser.options.ranges) {
|
|
94315
95144
|
this.range = [pos, 0];
|
|
94316
95145
|
}
|
|
94317
95146
|
};
|
|
@@ -94425,10 +95254,10 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
94425
95254
|
BranchID.prototype.sibling = function sibling() {
|
|
94426
95255
|
return new BranchID(this.parent, this.base);
|
|
94427
95256
|
};
|
|
94428
|
-
var RegExpValidationState = function RegExpValidationState2(
|
|
94429
|
-
this.parser =
|
|
94430
|
-
this.validFlags = "gim" + (
|
|
94431
|
-
this.unicodeProperties = data2[
|
|
95257
|
+
var RegExpValidationState = function RegExpValidationState2(parser) {
|
|
95258
|
+
this.parser = parser;
|
|
95259
|
+
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
|
|
95260
|
+
this.unicodeProperties = data2[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
|
|
94432
95261
|
this.source = "";
|
|
94433
95262
|
this.flags = "";
|
|
94434
95263
|
this.start = 0;
|
|
@@ -95761,19 +96590,19 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
95761
96590
|
this.readToken(this.fullCharCodeAtPos());
|
|
95762
96591
|
}
|
|
95763
96592
|
};
|
|
95764
|
-
pp.readToken = function(
|
|
95765
|
-
if (isIdentifierStart(
|
|
96593
|
+
pp.readToken = function(code) {
|
|
96594
|
+
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92) {
|
|
95766
96595
|
return this.readWord();
|
|
95767
96596
|
}
|
|
95768
|
-
return this.getTokenFromCode(
|
|
96597
|
+
return this.getTokenFromCode(code);
|
|
95769
96598
|
};
|
|
95770
96599
|
pp.fullCharCodeAtPos = function() {
|
|
95771
|
-
var
|
|
95772
|
-
if (
|
|
95773
|
-
return
|
|
96600
|
+
var code = this.input.charCodeAt(this.pos);
|
|
96601
|
+
if (code <= 55295 || code >= 56320) {
|
|
96602
|
+
return code;
|
|
95774
96603
|
}
|
|
95775
96604
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
95776
|
-
return next2 <= 56319 || next2 >= 57344 ?
|
|
96605
|
+
return next2 <= 56319 || next2 >= 57344 ? code : (code << 10) + next2 - 56613888;
|
|
95777
96606
|
};
|
|
95778
96607
|
pp.skipBlockComment = function() {
|
|
95779
96608
|
var startLoc = this.options.onComment && this.curPosition();
|
|
@@ -95894,11 +96723,11 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
95894
96723
|
}
|
|
95895
96724
|
return this.finishOp(types$1.slash, 1);
|
|
95896
96725
|
};
|
|
95897
|
-
pp.readToken_mult_modulo_exp = function(
|
|
96726
|
+
pp.readToken_mult_modulo_exp = function(code) {
|
|
95898
96727
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
95899
96728
|
var size = 1;
|
|
95900
|
-
var tokentype =
|
|
95901
|
-
if (this.options.ecmaVersion >= 7 &&
|
|
96729
|
+
var tokentype = code === 42 ? types$1.star : types$1.modulo;
|
|
96730
|
+
if (this.options.ecmaVersion >= 7 && code === 42 && next2 === 42) {
|
|
95902
96731
|
++size;
|
|
95903
96732
|
tokentype = types$1.starstar;
|
|
95904
96733
|
next2 = this.input.charCodeAt(this.pos + 2);
|
|
@@ -95908,21 +96737,21 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
95908
96737
|
}
|
|
95909
96738
|
return this.finishOp(tokentype, size);
|
|
95910
96739
|
};
|
|
95911
|
-
pp.readToken_pipe_amp = function(
|
|
96740
|
+
pp.readToken_pipe_amp = function(code) {
|
|
95912
96741
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
95913
|
-
if (next2 ===
|
|
96742
|
+
if (next2 === code) {
|
|
95914
96743
|
if (this.options.ecmaVersion >= 12) {
|
|
95915
96744
|
var next22 = this.input.charCodeAt(this.pos + 2);
|
|
95916
96745
|
if (next22 === 61) {
|
|
95917
96746
|
return this.finishOp(types$1.assign, 3);
|
|
95918
96747
|
}
|
|
95919
96748
|
}
|
|
95920
|
-
return this.finishOp(
|
|
96749
|
+
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2);
|
|
95921
96750
|
}
|
|
95922
96751
|
if (next2 === 61) {
|
|
95923
96752
|
return this.finishOp(types$1.assign, 2);
|
|
95924
96753
|
}
|
|
95925
|
-
return this.finishOp(
|
|
96754
|
+
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1);
|
|
95926
96755
|
};
|
|
95927
96756
|
pp.readToken_caret = function() {
|
|
95928
96757
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
@@ -95931,9 +96760,9 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
95931
96760
|
}
|
|
95932
96761
|
return this.finishOp(types$1.bitwiseXOR, 1);
|
|
95933
96762
|
};
|
|
95934
|
-
pp.readToken_plus_min = function(
|
|
96763
|
+
pp.readToken_plus_min = function(code) {
|
|
95935
96764
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
95936
|
-
if (next2 ===
|
|
96765
|
+
if (next2 === code) {
|
|
95937
96766
|
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
96767
|
this.skipLineComment(3);
|
|
95939
96768
|
this.skipSpace();
|
|
@@ -95946,17 +96775,17 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
95946
96775
|
}
|
|
95947
96776
|
return this.finishOp(types$1.plusMin, 1);
|
|
95948
96777
|
};
|
|
95949
|
-
pp.readToken_lt_gt = function(
|
|
96778
|
+
pp.readToken_lt_gt = function(code) {
|
|
95950
96779
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
95951
96780
|
var size = 1;
|
|
95952
|
-
if (next2 ===
|
|
95953
|
-
size =
|
|
96781
|
+
if (next2 === code) {
|
|
96782
|
+
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
|
|
95954
96783
|
if (this.input.charCodeAt(this.pos + size) === 61) {
|
|
95955
96784
|
return this.finishOp(types$1.assign, size + 1);
|
|
95956
96785
|
}
|
|
95957
96786
|
return this.finishOp(types$1.bitShift, size);
|
|
95958
96787
|
}
|
|
95959
|
-
if (next2 === 33 &&
|
|
96788
|
+
if (next2 === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45) {
|
|
95960
96789
|
this.skipLineComment(4);
|
|
95961
96790
|
this.skipSpace();
|
|
95962
96791
|
return this.nextToken();
|
|
@@ -95966,16 +96795,16 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
95966
96795
|
}
|
|
95967
96796
|
return this.finishOp(types$1.relational, size);
|
|
95968
96797
|
};
|
|
95969
|
-
pp.readToken_eq_excl = function(
|
|
96798
|
+
pp.readToken_eq_excl = function(code) {
|
|
95970
96799
|
var next2 = this.input.charCodeAt(this.pos + 1);
|
|
95971
96800
|
if (next2 === 61) {
|
|
95972
96801
|
return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2);
|
|
95973
96802
|
}
|
|
95974
|
-
if (
|
|
96803
|
+
if (code === 61 && next2 === 62 && this.options.ecmaVersion >= 6) {
|
|
95975
96804
|
this.pos += 2;
|
|
95976
96805
|
return this.finishToken(types$1.arrow);
|
|
95977
96806
|
}
|
|
95978
|
-
return this.finishOp(
|
|
96807
|
+
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1);
|
|
95979
96808
|
};
|
|
95980
96809
|
pp.readToken_question = function() {
|
|
95981
96810
|
var ecmaVersion = this.options.ecmaVersion;
|
|
@@ -96001,18 +96830,18 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96001
96830
|
};
|
|
96002
96831
|
pp.readToken_numberSign = function() {
|
|
96003
96832
|
var ecmaVersion = this.options.ecmaVersion;
|
|
96004
|
-
var
|
|
96833
|
+
var code = 35;
|
|
96005
96834
|
if (ecmaVersion >= 13) {
|
|
96006
96835
|
++this.pos;
|
|
96007
|
-
|
|
96008
|
-
if (isIdentifierStart(
|
|
96836
|
+
code = this.fullCharCodeAtPos();
|
|
96837
|
+
if (isIdentifierStart(code, true) || code === 92) {
|
|
96009
96838
|
return this.finishToken(types$1.privateId, this.readWord1());
|
|
96010
96839
|
}
|
|
96011
96840
|
}
|
|
96012
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString(
|
|
96841
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
96013
96842
|
};
|
|
96014
|
-
pp.getTokenFromCode = function(
|
|
96015
|
-
switch (
|
|
96843
|
+
pp.getTokenFromCode = function(code) {
|
|
96844
|
+
switch (code) {
|
|
96016
96845
|
// The interpretation of a dot depends on whether it is followed
|
|
96017
96846
|
// by a digit or another two dots.
|
|
96018
96847
|
case 46:
|
|
@@ -96079,7 +96908,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96079
96908
|
// Quotes produce strings.
|
|
96080
96909
|
case 34:
|
|
96081
96910
|
case 39:
|
|
96082
|
-
return this.readString(
|
|
96911
|
+
return this.readString(code);
|
|
96083
96912
|
// Operators are parsed inline in tiny state machines. '=' (61) is
|
|
96084
96913
|
// often referred to. `finishOp` simply skips the amount of
|
|
96085
96914
|
// characters it is given as second argument, and returns a token
|
|
@@ -96088,21 +96917,21 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96088
96917
|
return this.readToken_slash();
|
|
96089
96918
|
case 37:
|
|
96090
96919
|
case 42:
|
|
96091
|
-
return this.readToken_mult_modulo_exp(
|
|
96920
|
+
return this.readToken_mult_modulo_exp(code);
|
|
96092
96921
|
case 124:
|
|
96093
96922
|
case 38:
|
|
96094
|
-
return this.readToken_pipe_amp(
|
|
96923
|
+
return this.readToken_pipe_amp(code);
|
|
96095
96924
|
case 94:
|
|
96096
96925
|
return this.readToken_caret();
|
|
96097
96926
|
case 43:
|
|
96098
96927
|
case 45:
|
|
96099
|
-
return this.readToken_plus_min(
|
|
96928
|
+
return this.readToken_plus_min(code);
|
|
96100
96929
|
case 60:
|
|
96101
96930
|
case 62:
|
|
96102
|
-
return this.readToken_lt_gt(
|
|
96931
|
+
return this.readToken_lt_gt(code);
|
|
96103
96932
|
case 61:
|
|
96104
96933
|
case 33:
|
|
96105
|
-
return this.readToken_eq_excl(
|
|
96934
|
+
return this.readToken_eq_excl(code);
|
|
96106
96935
|
case 63:
|
|
96107
96936
|
return this.readToken_question();
|
|
96108
96937
|
case 126:
|
|
@@ -96110,7 +96939,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96110
96939
|
case 35:
|
|
96111
96940
|
return this.readToken_numberSign();
|
|
96112
96941
|
}
|
|
96113
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString(
|
|
96942
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
96114
96943
|
};
|
|
96115
96944
|
pp.finishOp = function(type, size) {
|
|
96116
96945
|
var str = this.input.slice(this.pos, this.pos + size);
|
|
@@ -96164,8 +96993,8 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96164
96993
|
var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
|
|
96165
96994
|
var start = this.pos, total = 0, lastCode = 0;
|
|
96166
96995
|
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
|
|
96167
|
-
var
|
|
96168
|
-
if (allowSeparators &&
|
|
96996
|
+
var code = this.input.charCodeAt(this.pos), val2 = void 0;
|
|
96997
|
+
if (allowSeparators && code === 95) {
|
|
96169
96998
|
if (isLegacyOctalNumericLiteral) {
|
|
96170
96999
|
this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals");
|
|
96171
97000
|
}
|
|
@@ -96175,22 +97004,22 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96175
97004
|
if (i === 0) {
|
|
96176
97005
|
this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits");
|
|
96177
97006
|
}
|
|
96178
|
-
lastCode =
|
|
97007
|
+
lastCode = code;
|
|
96179
97008
|
continue;
|
|
96180
97009
|
}
|
|
96181
|
-
if (
|
|
96182
|
-
val2 =
|
|
96183
|
-
} else if (
|
|
96184
|
-
val2 =
|
|
96185
|
-
} else if (
|
|
96186
|
-
val2 =
|
|
97010
|
+
if (code >= 97) {
|
|
97011
|
+
val2 = code - 97 + 10;
|
|
97012
|
+
} else if (code >= 65) {
|
|
97013
|
+
val2 = code - 65 + 10;
|
|
97014
|
+
} else if (code >= 48 && code <= 57) {
|
|
97015
|
+
val2 = code - 48;
|
|
96187
97016
|
} else {
|
|
96188
97017
|
val2 = Infinity;
|
|
96189
97018
|
}
|
|
96190
97019
|
if (val2 >= radix) {
|
|
96191
97020
|
break;
|
|
96192
97021
|
}
|
|
96193
|
-
lastCode =
|
|
97022
|
+
lastCode = code;
|
|
96194
97023
|
total = total * radix + val2;
|
|
96195
97024
|
}
|
|
96196
97025
|
if (allowSeparators && lastCode === 95) {
|
|
@@ -96270,21 +97099,21 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
96270
97099
|
return this.finishToken(types$1.num, val2);
|
|
96271
97100
|
};
|
|
96272
97101
|
pp.readCodePoint = function() {
|
|
96273
|
-
var ch = this.input.charCodeAt(this.pos),
|
|
97102
|
+
var ch = this.input.charCodeAt(this.pos), code;
|
|
96274
97103
|
if (ch === 123) {
|
|
96275
97104
|
if (this.options.ecmaVersion < 6) {
|
|
96276
97105
|
this.unexpected();
|
|
96277
97106
|
}
|
|
96278
97107
|
var codePos = ++this.pos;
|
|
96279
|
-
|
|
97108
|
+
code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
|
|
96280
97109
|
++this.pos;
|
|
96281
|
-
if (
|
|
97110
|
+
if (code > 1114111) {
|
|
96282
97111
|
this.invalidStringToken(codePos, "Code point out of bounds");
|
|
96283
97112
|
}
|
|
96284
97113
|
} else {
|
|
96285
|
-
|
|
97114
|
+
code = this.readHexChar(4);
|
|
96286
97115
|
}
|
|
96287
|
-
return
|
|
97116
|
+
return code;
|
|
96288
97117
|
};
|
|
96289
97118
|
pp.readString = function(quote) {
|
|
96290
97119
|
var out = "", chunkStart = ++this.pos;
|
|
@@ -97549,21 +98378,21 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97549
98378
|
};
|
|
97550
98379
|
}
|
|
97551
98380
|
}
|
|
97552
|
-
write(
|
|
97553
|
-
this.output +=
|
|
98381
|
+
write(code) {
|
|
98382
|
+
this.output += code;
|
|
97554
98383
|
}
|
|
97555
|
-
writeToStream(
|
|
97556
|
-
this.output.write(
|
|
98384
|
+
writeToStream(code) {
|
|
98385
|
+
this.output.write(code);
|
|
97557
98386
|
}
|
|
97558
|
-
writeAndMap(
|
|
97559
|
-
this.output +=
|
|
97560
|
-
this.map(
|
|
98387
|
+
writeAndMap(code, node) {
|
|
98388
|
+
this.output += code;
|
|
98389
|
+
this.map(code, node);
|
|
97561
98390
|
}
|
|
97562
|
-
writeToStreamAndMap(
|
|
97563
|
-
this.output.write(
|
|
97564
|
-
this.map(
|
|
98391
|
+
writeToStreamAndMap(code, node) {
|
|
98392
|
+
this.output.write(code);
|
|
98393
|
+
this.map(code, node);
|
|
97565
98394
|
}
|
|
97566
|
-
map(
|
|
98395
|
+
map(code, node) {
|
|
97567
98396
|
if (node != null) {
|
|
97568
98397
|
const { type } = node;
|
|
97569
98398
|
if (type[0] === "L" && type[2] === "n") {
|
|
@@ -97578,10 +98407,10 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97578
98407
|
this.sourceMap.addMapping(mapping);
|
|
97579
98408
|
}
|
|
97580
98409
|
if (type[0] === "T" && type[8] === "E" || type[0] === "L" && type[1] === "i" && typeof node.value === "string") {
|
|
97581
|
-
const { length: length2 } =
|
|
98410
|
+
const { length: length2 } = code;
|
|
97582
98411
|
let { column, line } = this;
|
|
97583
98412
|
for (let i = 0; i < length2; i++) {
|
|
97584
|
-
if (
|
|
98413
|
+
if (code[i] === "\n") {
|
|
97585
98414
|
column = 0;
|
|
97586
98415
|
line++;
|
|
97587
98416
|
} else {
|
|
@@ -97593,10 +98422,10 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97593
98422
|
return;
|
|
97594
98423
|
}
|
|
97595
98424
|
}
|
|
97596
|
-
const { length } =
|
|
98425
|
+
const { length } = code;
|
|
97597
98426
|
const { lineEnd } = this;
|
|
97598
98427
|
if (length > 0) {
|
|
97599
|
-
if (this.lineEndSize > 0 && (lineEnd.length === 1 ?
|
|
98428
|
+
if (this.lineEndSize > 0 && (lineEnd.length === 1 ? code[length - 1] === lineEnd : code.endsWith(lineEnd))) {
|
|
97600
98429
|
this.line += this.lineEndSize;
|
|
97601
98430
|
this.column = 0;
|
|
97602
98431
|
} else {
|
|
@@ -97615,96 +98444,109 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97615
98444
|
}
|
|
97616
98445
|
|
|
97617
98446
|
// alan_btn/src/textChat/saveChatStateToFile.ts
|
|
97618
|
-
|
|
98447
|
+
var import_jsonlint = __toESM(require_jsonlint());
|
|
98448
|
+
function smartJSONParse(str, errorLogger) {
|
|
98449
|
+
try {
|
|
98450
|
+
return (0, import_jsonlint.parse)(str, {
|
|
98451
|
+
mode: "json5"
|
|
98452
|
+
});
|
|
98453
|
+
} catch (e) {
|
|
98454
|
+
errorLogger("JSON parse error:", e);
|
|
98455
|
+
}
|
|
98456
|
+
}
|
|
98457
|
+
function extractFunctionWithRegex(code, functionName) {
|
|
97619
98458
|
const regex = new RegExp(`(?:async\\s+)?function\\s+${functionName}\\s*\\([^)]*\\)\\s*{(?:[^{}]*|{(?:[^{}]*|{[^{}]*})*})*};?`, "gs");
|
|
97620
|
-
const match =
|
|
98459
|
+
const match = code.match(regex);
|
|
97621
98460
|
return match ? match[0] : null;
|
|
97622
98461
|
}
|
|
97623
|
-
function extractFunction(
|
|
98462
|
+
function extractFunction(code, functionName, errorLogger) {
|
|
97624
98463
|
try {
|
|
97625
|
-
const ast = parse8(
|
|
98464
|
+
const ast = parse8(code, { ecmaVersion: 2022, allowImportExportEverywhere: true });
|
|
97626
98465
|
for (const node of ast.body) {
|
|
97627
98466
|
if (node.type === "FunctionDeclaration" && node.id.name === functionName) {
|
|
97628
98467
|
return generate2(node);
|
|
97629
98468
|
}
|
|
97630
98469
|
}
|
|
97631
98470
|
} catch (err) {
|
|
97632
|
-
|
|
98471
|
+
const msg = `Failed to parse code for function "${functionName}":`;
|
|
98472
|
+
errorLogger(msg, err);
|
|
97633
98473
|
}
|
|
97634
98474
|
return null;
|
|
97635
98475
|
}
|
|
97636
|
-
function stripComments(
|
|
97637
|
-
return
|
|
98476
|
+
function stripComments(code) {
|
|
98477
|
+
return code.replace(/("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')|\/\/.*|\/\*[\s\S]*?\*\//g, (match, quoted) => {
|
|
97638
98478
|
return quoted ? quoted : "";
|
|
97639
98479
|
});
|
|
97640
98480
|
}
|
|
97641
|
-
function commentInitIframeFnInSourceCode(html3,
|
|
98481
|
+
function commentInitIframeFnInSourceCode(html3, initIframeFn) {
|
|
97642
98482
|
const explanationComment = `// The initIframe function body was commented out because resources were inlined in the iframe.
|
|
97643
98483
|
`;
|
|
97644
|
-
const fnStart =
|
|
97645
|
-
const fnEnd =
|
|
98484
|
+
const fnStart = initIframeFn.indexOf("{");
|
|
98485
|
+
const fnEnd = initIframeFn.lastIndexOf("}");
|
|
97646
98486
|
if (fnStart === -1 || fnEnd === -1 || fnEnd <= fnStart) return html3;
|
|
97647
|
-
const beforeBody =
|
|
97648
|
-
const body =
|
|
97649
|
-
const afterBody =
|
|
98487
|
+
const beforeBody = initIframeFn.slice(0, fnStart + 1);
|
|
98488
|
+
const body = initIframeFn.slice(fnStart + 1, fnEnd);
|
|
98489
|
+
const afterBody = initIframeFn.slice(fnEnd);
|
|
97650
98490
|
const commentedBody = explanationComment + body.split("\n").map((line) => "// " + line).join("\n");
|
|
97651
98491
|
const commentedFn = beforeBody + "\n" + commentedBody + "\n" + afterBody;
|
|
97652
|
-
return html3.replace(
|
|
98492
|
+
return html3.replace(initIframeFn, commentedFn);
|
|
97653
98493
|
}
|
|
97654
|
-
function extractAddDefaultStylesParams(
|
|
98494
|
+
function extractAddDefaultStylesParams(code, errorLogger) {
|
|
97655
98495
|
const regex = /(?:iframe\.)?addDefaultStyles\s*\(\s*([\s\S]*?)\s*\)/g;
|
|
97656
98496
|
let match;
|
|
97657
98497
|
let merged = {};
|
|
97658
98498
|
let found = false;
|
|
97659
|
-
while ((match = regex.exec(
|
|
98499
|
+
while ((match = regex.exec(code)) !== null) {
|
|
97660
98500
|
found = true;
|
|
97661
98501
|
let rawParam = match[1].trim();
|
|
97662
98502
|
if (rawParam === "" || rawParam === "null" || rawParam === "{}") {
|
|
97663
98503
|
continue;
|
|
97664
98504
|
}
|
|
97665
98505
|
try {
|
|
97666
|
-
const obj =
|
|
98506
|
+
const obj = smartJSONParse(rawParam, errorLogger);
|
|
97667
98507
|
if (obj && typeof obj === "object") {
|
|
97668
98508
|
merged = { ...merged, ...obj };
|
|
97669
98509
|
}
|
|
97670
98510
|
} catch (err) {
|
|
97671
|
-
|
|
98511
|
+
const msg = "Failed to parse addDefaultStyles parameter:";
|
|
98512
|
+
errorLogger(msg, err);
|
|
97672
98513
|
return null;
|
|
97673
98514
|
}
|
|
97674
98515
|
}
|
|
97675
98516
|
if (!found) return null;
|
|
97676
98517
|
return merged;
|
|
97677
98518
|
}
|
|
97678
|
-
function safelyParseScriptOptions(optionsString) {
|
|
98519
|
+
function safelyParseScriptOptions(optionsString, errorLogger) {
|
|
97679
98520
|
if (!optionsString || optionsString === "null" || optionsString === "{}") {
|
|
97680
98521
|
return null;
|
|
97681
98522
|
}
|
|
97682
98523
|
try {
|
|
97683
98524
|
const cleanOptionsString = optionsString.trim();
|
|
97684
|
-
return
|
|
98525
|
+
return smartJSONParse(cleanOptionsString, errorLogger);
|
|
97685
98526
|
} catch (error) {
|
|
97686
|
-
|
|
98527
|
+
const msg = "Failed to parse script options:";
|
|
98528
|
+
errorLogger(msg, error);
|
|
97687
98529
|
return null;
|
|
97688
98530
|
}
|
|
97689
98531
|
}
|
|
97690
|
-
function applyThemeToHtmlContent(
|
|
98532
|
+
function applyThemeToHtmlContent(htmlContent, theme) {
|
|
97691
98533
|
if (!theme || theme !== "light" && theme !== "dark") {
|
|
97692
|
-
return
|
|
98534
|
+
return htmlContent;
|
|
97693
98535
|
}
|
|
97694
|
-
const
|
|
97695
|
-
const
|
|
97696
|
-
const htmlElement =
|
|
98536
|
+
const parser = new DOMParser();
|
|
98537
|
+
const doc = parser.parseFromString(htmlContent, "text/html");
|
|
98538
|
+
const htmlElement = doc.documentElement;
|
|
97697
98539
|
if (htmlElement) {
|
|
97698
98540
|
const themeClass = theme === "light" ? "light-theme" : "dark-theme";
|
|
97699
98541
|
htmlElement.classList.add(themeClass);
|
|
97700
98542
|
}
|
|
97701
|
-
return
|
|
98543
|
+
return doc.documentElement.outerHTML;
|
|
97702
98544
|
}
|
|
97703
98545
|
function extractScriptContents(html3) {
|
|
97704
98546
|
const scriptContents = [];
|
|
97705
|
-
const
|
|
97706
|
-
const
|
|
97707
|
-
const scripts =
|
|
98547
|
+
const parser = new DOMParser();
|
|
98548
|
+
const doc = parser.parseFromString(html3, "text/html");
|
|
98549
|
+
const scripts = doc.querySelectorAll("script");
|
|
97708
98550
|
scripts.forEach((script) => {
|
|
97709
98551
|
if (!script.src) {
|
|
97710
98552
|
scriptContents.push(script.textContent.trim());
|
|
@@ -97728,6 +98570,73 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97728
98570
|
}
|
|
97729
98571
|
return result + '<pre style="margin:0!important;"><code style="overflow:auto!important;">' + otherCode + "</code></pre>";
|
|
97730
98572
|
}
|
|
98573
|
+
function isValidUrl2(url) {
|
|
98574
|
+
try {
|
|
98575
|
+
new URL(url);
|
|
98576
|
+
return true;
|
|
98577
|
+
} catch (e) {
|
|
98578
|
+
return false;
|
|
98579
|
+
}
|
|
98580
|
+
}
|
|
98581
|
+
var iframeFn = {
|
|
98582
|
+
getPublicUrl(resourceBaseUrl) {
|
|
98583
|
+
return `${resourceBaseUrl.substring(0, resourceBaseUrl.indexOf("/project_resource"))}`;
|
|
98584
|
+
},
|
|
98585
|
+
getProjectResourceUrl(resourcePath, resourceBaseUrl) {
|
|
98586
|
+
return `${resourceBaseUrl}/` + resourcePath;
|
|
98587
|
+
},
|
|
98588
|
+
getResourceUrl(resourceUrl, resourceBaseUrl) {
|
|
98589
|
+
const projectResPrefix = "resource://";
|
|
98590
|
+
const studioResPrefix = "studio-resource://";
|
|
98591
|
+
const withPublicUrl = isValidUrl2(resourceUrl);
|
|
98592
|
+
if (!resourceUrl) {
|
|
98593
|
+
return `${resourceBaseUrl}`;
|
|
98594
|
+
}
|
|
98595
|
+
if (resourceUrl.startsWith(studioResPrefix)) {
|
|
98596
|
+
return iframeFn.getStudioResourceUrl(resourceUrl.slice(studioResPrefix.length), resourceBaseUrl);
|
|
98597
|
+
}
|
|
98598
|
+
if (!withPublicUrl || resourceUrl.startsWith(projectResPrefix)) {
|
|
98599
|
+
const cleanResource = resourceUrl.startsWith(projectResPrefix) ? resourceUrl.slice(projectResPrefix.length) : resourceUrl;
|
|
98600
|
+
return iframeFn.getProjectResourceUrl(cleanResource, resourceBaseUrl);
|
|
98601
|
+
}
|
|
98602
|
+
return resourceUrl;
|
|
98603
|
+
},
|
|
98604
|
+
getStudioResourceUrl(resourceUrl, resourceBaseUrl) {
|
|
98605
|
+
const projectResPrefix = "resource://";
|
|
98606
|
+
const studioResPrefix = "studio-resource://";
|
|
98607
|
+
if (!resourceUrl) {
|
|
98608
|
+
return `${iframeFn.getPublicUrl(resourceBaseUrl)}/web/lib`;
|
|
98609
|
+
}
|
|
98610
|
+
if (resourceUrl.startsWith(projectResPrefix)) {
|
|
98611
|
+
throw new Error("Invalid resource URL: getStudioResourceUrl does not handle project resources.");
|
|
98612
|
+
}
|
|
98613
|
+
const cleanResource = resourceUrl.startsWith(studioResPrefix) ? resourceUrl.slice(studioResPrefix.length) : resourceUrl;
|
|
98614
|
+
return `${iframeFn.getPublicUrl(resourceBaseUrl)}/web/lib/` + cleanResource;
|
|
98615
|
+
},
|
|
98616
|
+
getDefaultResources(options = {}) {
|
|
98617
|
+
const {
|
|
98618
|
+
excludeHtmlElementsStyles = false,
|
|
98619
|
+
excludeTabulatorStyles = false,
|
|
98620
|
+
excludeScrollbarStyles = false
|
|
98621
|
+
} = options;
|
|
98622
|
+
const CSS_PATHS = {
|
|
98623
|
+
htmlElements: "studio-resource://iframe/iframe.html-elements.css",
|
|
98624
|
+
scrollbar: "studio-resource://iframe/scrollbar.css",
|
|
98625
|
+
tabulator: "studio-resource://tabulator-tables/6.3.1/tabulator.themed.css"
|
|
98626
|
+
};
|
|
98627
|
+
const resources = [];
|
|
98628
|
+
if (!excludeHtmlElementsStyles) {
|
|
98629
|
+
resources.push({ type: "stylesheet", href: CSS_PATHS.htmlElements });
|
|
98630
|
+
}
|
|
98631
|
+
if (!excludeTabulatorStyles) {
|
|
98632
|
+
resources.push({ type: "stylesheet", href: CSS_PATHS.tabulator });
|
|
98633
|
+
}
|
|
98634
|
+
if (!excludeScrollbarStyles) {
|
|
98635
|
+
resources.push({ type: "stylesheet", href: CSS_PATHS.scrollbar });
|
|
98636
|
+
}
|
|
98637
|
+
return resources;
|
|
98638
|
+
}
|
|
98639
|
+
};
|
|
97731
98640
|
async function saveChatState({
|
|
97732
98641
|
chatName,
|
|
97733
98642
|
chatEl,
|
|
@@ -97739,13 +98648,23 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97739
98648
|
data: data3,
|
|
97740
98649
|
options = {}
|
|
97741
98650
|
}) {
|
|
98651
|
+
const exportErrors = [];
|
|
98652
|
+
const exportLogs = [];
|
|
98653
|
+
function logError(msg, err) {
|
|
98654
|
+
console.error(msg, err);
|
|
98655
|
+
exportErrors.push({ msg, err, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
98656
|
+
}
|
|
98657
|
+
function logInfo(msg, details) {
|
|
98658
|
+
console.log(msg, details || "");
|
|
98659
|
+
exportLogs.push({ msg, details, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
98660
|
+
}
|
|
97742
98661
|
const chatConteiner = chatEl.cloneNode(true);
|
|
97743
98662
|
const images = Array.from(chatConteiner.querySelectorAll("img"));
|
|
97744
98663
|
let imgData;
|
|
97745
98664
|
try {
|
|
97746
|
-
imgData = await replaceImagesToBase64(images);
|
|
98665
|
+
imgData = await replaceImagesToBase64(images, logError);
|
|
97747
98666
|
} catch (error) {
|
|
97748
|
-
|
|
98667
|
+
logError("Some images from the chat cannot be converter to base64 for export", null);
|
|
97749
98668
|
}
|
|
97750
98669
|
const iframes = Array.from(chatConteiner.querySelectorAll("iframe"));
|
|
97751
98670
|
const fetchWithTimeout = async (url, timeoutMs = 3e4) => {
|
|
@@ -97771,31 +98690,50 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97771
98690
|
try {
|
|
97772
98691
|
response = await fetchWithTimeout(srcUrl, options?.iframeLoadTimeoutMs);
|
|
97773
98692
|
if (!response.ok) {
|
|
97774
|
-
|
|
98693
|
+
logError(`Error fetching content from ${srcUrl}: ${response.statusText}`, null);
|
|
97775
98694
|
return;
|
|
97776
98695
|
}
|
|
97777
98696
|
initHtmlContent = await response.text();
|
|
97778
98697
|
} catch (err) {
|
|
97779
|
-
|
|
98698
|
+
logError(`Iframe content not available from ${srcUrl} (treated as Not Found):`, err.message || err);
|
|
97780
98699
|
initHtmlContent = "Not Found!";
|
|
97781
98700
|
}
|
|
97782
98701
|
initHtmlContent = applyThemeToHtmlContent(initHtmlContent, data3?.theme);
|
|
97783
|
-
let { htmlContent
|
|
97784
|
-
const
|
|
97785
|
-
if (
|
|
97786
|
-
|
|
97787
|
-
|
|
98702
|
+
let { htmlContent } = await inlineExternalResources(initHtmlContent, logError, logInfo);
|
|
98703
|
+
const initIframeFn = extractFunctionWithRegex(htmlContent, "initIframe");
|
|
98704
|
+
if (initIframeFn) {
|
|
98705
|
+
htmlContent = commentInitIframeFnInSourceCode(htmlContent, initIframeFn);
|
|
98706
|
+
logInfo("Replaced initIframe function with commented version as resources were successfully inlined.");
|
|
98707
|
+
}
|
|
98708
|
+
const helperScript = `
|
|
98709
|
+
<script>
|
|
98710
|
+
// Helper: access showAlanDebugInfo from parent when browser console is focused on iframe
|
|
98711
|
+
if (window.parent && window.parent !== window && !window.showAlanDebugInfo) {
|
|
98712
|
+
window.showAlanDebugInfo = function() {
|
|
98713
|
+
if (typeof window.parent.showAlanDebugInfo === 'function') {
|
|
98714
|
+
window.parent.showAlanDebugInfo();
|
|
98715
|
+
} else {
|
|
98716
|
+
console.warn('showAlanDebugInfo not available in parent window');
|
|
98717
|
+
}
|
|
98718
|
+
};
|
|
98719
|
+
}
|
|
98720
|
+
<\/script>`;
|
|
98721
|
+
const headMatch = htmlContent.match(/(<head[^>]*>)/i);
|
|
98722
|
+
if (headMatch) {
|
|
98723
|
+
htmlContent = htmlContent.replace(headMatch[0], headMatch[0] + helperScript);
|
|
98724
|
+
} else {
|
|
98725
|
+
htmlContent = helperScript + htmlContent;
|
|
97788
98726
|
}
|
|
97789
98727
|
const frameSrc = iframe.getAttribute("src");
|
|
97790
98728
|
iframe.removeAttribute("src");
|
|
97791
|
-
iframe.setAttribute("srcdoc",
|
|
98729
|
+
iframe.setAttribute("srcdoc", htmlContent);
|
|
97792
98730
|
iframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups allow-downloads");
|
|
97793
98731
|
if (!options?.isGraphInfoDisabled && (frameSrc.indexOf("alan.") > -1 || frameSrc.indexOf("alan-"))) {
|
|
97794
98732
|
const parent2 = iframe.parentNode;
|
|
97795
98733
|
let controlsDiv = document.createElement("div");
|
|
97796
98734
|
controlsDiv.classList.add("alan-iframe-controls");
|
|
97797
98735
|
let hiddenIframe = document.createElement("iframe");
|
|
97798
|
-
hiddenIframe.srcdoc = `<!--${
|
|
98736
|
+
hiddenIframe.srcdoc = `<!--${htmlContent}-->`;
|
|
97799
98737
|
hiddenIframe.setAttribute("style", "display: none;");
|
|
97800
98738
|
hiddenIframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups allow-downloads");
|
|
97801
98739
|
controlsDiv.appendChild(hiddenIframe);
|
|
@@ -97811,7 +98749,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97811
98749
|
parent2.insertBefore(controlsDiv, iframe);
|
|
97812
98750
|
}
|
|
97813
98751
|
} catch (error) {
|
|
97814
|
-
|
|
98752
|
+
logError(`Failed to fetch or process iframe from ${srcUrl}:`, error);
|
|
97815
98753
|
const errorMessage = error?.message || error?.toString() || "Unknown error";
|
|
97816
98754
|
const errorHtml = `
|
|
97817
98755
|
<!DOCTYPE html>
|
|
@@ -97862,7 +98800,6 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97862
98800
|
iframe.setAttribute("sandbox", "allow-scripts allow-same-origin");
|
|
97863
98801
|
}
|
|
97864
98802
|
}));
|
|
97865
|
-
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};';
|
|
97866
98803
|
const functionsToInsert = iFrameSizeListenerFunctions.map((fn) => fn.toString()).join("\n\n");
|
|
97867
98804
|
const onIFrameSizeListenerString = onIFrameSizeListener.toString();
|
|
97868
98805
|
const prepareJavascriptCodeString = prepareJavascriptCode.toString();
|
|
@@ -97876,10 +98813,10 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
97876
98813
|
});
|
|
97877
98814
|
}
|
|
97878
98815
|
} catch (error) {
|
|
97879
|
-
|
|
98816
|
+
logError("Chat will be exported without output graphs", error);
|
|
97880
98817
|
}
|
|
97881
98818
|
const alanMainClass = "alan-" + projectId;
|
|
97882
|
-
const
|
|
98819
|
+
const code = `
|
|
97883
98820
|
<script type="text/javascript">
|
|
97884
98821
|
|
|
97885
98822
|
${functionsToInsert}
|
|
@@ -98300,9 +99237,9 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98300
99237
|
let inlinedLibraries = "";
|
|
98301
99238
|
try {
|
|
98302
99239
|
inlinedLibraries = getInlineLibrariesHtml();
|
|
98303
|
-
|
|
99240
|
+
logInfo("Successfully prepared inline libraries for saved HTML");
|
|
98304
99241
|
} catch (error) {
|
|
98305
|
-
|
|
99242
|
+
logError("Failed to prepare inline libraries:", error);
|
|
98306
99243
|
}
|
|
98307
99244
|
const newHtmlContent = `
|
|
98308
99245
|
<!DOCTYPE html>
|
|
@@ -98314,10 +99251,31 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98314
99251
|
${headContent ? headContent : ""}
|
|
98315
99252
|
|
|
98316
99253
|
<script>
|
|
98317
|
-
console.info('Alan lib v: ${window.alanLib?.version || "-"}, exporter v: 1.0.
|
|
98318
|
-
|
|
98319
|
-
|
|
98320
|
-
|
|
99254
|
+
console.info('Alan lib v: ${window.alanLib?.version || "-"}, exporter v: 1.0.3');
|
|
99255
|
+
|
|
99256
|
+
// Define debug function globally - separated from data to prevent syntax errors in data from breaking the function
|
|
99257
|
+
window.showAlanDebugInfo = function() {
|
|
99258
|
+
try {
|
|
99259
|
+
console.info('Messages in chat:', window.__alanDebugData?.txtMessages || 'not available');
|
|
99260
|
+
console.info('Messages in socket:', window.__alanDebugData?.socketMessages || 'not available');
|
|
99261
|
+
console.info('Errors in export:', window.__alanDebugData?.exportErrors || []);
|
|
99262
|
+
console.info('Logs in export:', window.__alanDebugData?.exportLogs || []);
|
|
99263
|
+
} catch (error) {
|
|
99264
|
+
console.error('Error displaying debug info:', error);
|
|
99265
|
+
}
|
|
99266
|
+
};
|
|
99267
|
+
|
|
99268
|
+
// Store debug data separately - if this fails, the function above is still defined
|
|
99269
|
+
try {
|
|
99270
|
+
window.__alanDebugData = {
|
|
99271
|
+
txtMessages: ${txtMessages},
|
|
99272
|
+
socketMessages: ${socketMessages},
|
|
99273
|
+
exportErrors: ${escapeJsonForScriptTag(JSON.stringify(exportErrors, null, 2))},
|
|
99274
|
+
exportLogs: ${escapeJsonForScriptTag(JSON.stringify(exportLogs, null, 2))}
|
|
99275
|
+
};
|
|
99276
|
+
} catch (error) {
|
|
99277
|
+
console.error('Failed to load debug data:', error);
|
|
99278
|
+
window.__alanDebugData = { error: 'Failed to load debug data' };
|
|
98321
99279
|
}
|
|
98322
99280
|
<\/script>
|
|
98323
99281
|
|
|
@@ -98616,22 +99574,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98616
99574
|
${chatConteiner.outerHTML}
|
|
98617
99575
|
</div>
|
|
98618
99576
|
</div>
|
|
98619
|
-
${
|
|
98620
|
-
|
|
98621
|
-
<script type="module">
|
|
98622
|
-
// Inline iframe resizer library
|
|
98623
|
-
${iframeResizerCode}
|
|
98624
|
-
|
|
98625
|
-
// Use the exports directly
|
|
98626
|
-
const { initialize } = window.iframeResizer;
|
|
98627
|
-
|
|
98628
|
-
// Find all iframes with class 'act-embed' that have an id
|
|
98629
|
-
const iframes = document.querySelectorAll('iframe.act-embed[id]');
|
|
98630
|
-
iframes.forEach(iframe => {
|
|
98631
|
-
iframe.removeAttribute('data-iframe-resizer-initialized');
|
|
98632
|
-
initialize({}, '#' + iframe.id);
|
|
98633
|
-
});
|
|
98634
|
-
<\/script>
|
|
99577
|
+
${code}
|
|
98635
99578
|
</body>
|
|
98636
99579
|
</html>
|
|
98637
99580
|
`;
|
|
@@ -98650,7 +99593,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98650
99593
|
link.click();
|
|
98651
99594
|
URL.revokeObjectURL(link.href);
|
|
98652
99595
|
}
|
|
98653
|
-
async function replaceImagesToBase64(images) {
|
|
99596
|
+
async function replaceImagesToBase64(images, errorLogger) {
|
|
98654
99597
|
const result = {};
|
|
98655
99598
|
for (let img of images) {
|
|
98656
99599
|
try {
|
|
@@ -98669,7 +99612,8 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98669
99612
|
}
|
|
98670
99613
|
img.src = await fetchImageAsBase64(img.src);
|
|
98671
99614
|
} catch (error) {
|
|
98672
|
-
|
|
99615
|
+
const msg = `Error converting images for msgId ${img.getAttribute("msgInd")}:`;
|
|
99616
|
+
errorLogger(msg, error);
|
|
98673
99617
|
}
|
|
98674
99618
|
}
|
|
98675
99619
|
return result;
|
|
@@ -98726,7 +99670,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98726
99670
|
resourceCache.set(url, fetchPromise);
|
|
98727
99671
|
return fetchPromise;
|
|
98728
99672
|
}
|
|
98729
|
-
async function inlineExternalResources(htmlContent) {
|
|
99673
|
+
async function inlineExternalResources(htmlContent, errorLogger, infoLogger) {
|
|
98730
99674
|
const parser = new DOMParser();
|
|
98731
99675
|
const doc = parser.parseFromString(htmlContent, "text/html");
|
|
98732
99676
|
const scriptTags = Array.from(doc.querySelectorAll("script[src]"));
|
|
@@ -98743,9 +99687,10 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98743
99687
|
inlineScript.setAttribute("inlined-resource-name", src);
|
|
98744
99688
|
inlineScript.textContent = scriptContent;
|
|
98745
99689
|
scriptTag.parentNode.replaceChild(inlineScript, scriptTag);
|
|
98746
|
-
|
|
99690
|
+
infoLogger(`Inlined external script:`, src);
|
|
98747
99691
|
} catch (error) {
|
|
98748
|
-
|
|
99692
|
+
const msg = `Failed to inline script from ${src}:`;
|
|
99693
|
+
errorLogger(msg, error);
|
|
98749
99694
|
}
|
|
98750
99695
|
}));
|
|
98751
99696
|
const linkTags = Array.from(doc.querySelectorAll('link[rel="stylesheet"][href]'));
|
|
@@ -98757,14 +99702,34 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98757
99702
|
inlineStyle.setAttribute("inlined-resource-name", href);
|
|
98758
99703
|
inlineStyle.textContent = cssContent;
|
|
98759
99704
|
linkTag.parentNode.replaceChild(inlineStyle, linkTag);
|
|
98760
|
-
|
|
99705
|
+
infoLogger(`Inlined external stylesheet:`, href);
|
|
98761
99706
|
} catch (error) {
|
|
98762
|
-
|
|
99707
|
+
const msg = `Failed to inline stylesheet from ${href}:`;
|
|
99708
|
+
errorLogger(msg, error);
|
|
98763
99709
|
}
|
|
98764
99710
|
}));
|
|
98765
99711
|
const htmlContentWithInlinedScripts = doc.documentElement.outerHTML;
|
|
98766
99712
|
const code = extractScriptContents(htmlContentWithInlinedScripts);
|
|
98767
|
-
const initIframeFn = extractFunction(code, "initIframe");
|
|
99713
|
+
const initIframeFn = extractFunction(code, "initIframe", errorLogger);
|
|
99714
|
+
const getProjectResourceUrlFn = extractFunction(code, "getProjectResourceUrl", errorLogger);
|
|
99715
|
+
let resourceBaseUrl = null;
|
|
99716
|
+
const metaTag = doc.querySelector('meta[name="resource-urls"]');
|
|
99717
|
+
if (metaTag) {
|
|
99718
|
+
resourceBaseUrl = metaTag.getAttribute("data-resource-base-url");
|
|
99719
|
+
if (resourceBaseUrl) {
|
|
99720
|
+
infoLogger("Extracted resourceBaseUrl from meta tag:", resourceBaseUrl);
|
|
99721
|
+
}
|
|
99722
|
+
}
|
|
99723
|
+
if (!resourceBaseUrl) {
|
|
99724
|
+
const resourceBaseUrlMatch = getProjectResourceUrlFn?.match(/'([^']*)'/);
|
|
99725
|
+
resourceBaseUrl = resourceBaseUrlMatch ? resourceBaseUrlMatch[1] : null;
|
|
99726
|
+
if (resourceBaseUrl) {
|
|
99727
|
+
infoLogger("Extracted resourceBaseUrl from getProjectResourceUrl function:", resourceBaseUrl);
|
|
99728
|
+
}
|
|
99729
|
+
}
|
|
99730
|
+
if (resourceBaseUrl === null) {
|
|
99731
|
+
errorLogger("Failed to extract resourceBaseUrl", null);
|
|
99732
|
+
}
|
|
98768
99733
|
let allInitIframeResourcesInlined = false;
|
|
98769
99734
|
if (initIframeFn) {
|
|
98770
99735
|
let initIframeBody = stripComments(initIframeFn);
|
|
@@ -98786,133 +99751,99 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
98786
99751
|
url: resourceFnMatch[1]
|
|
98787
99752
|
});
|
|
98788
99753
|
}
|
|
98789
|
-
|
|
98790
|
-
|
|
98791
|
-
|
|
98792
|
-
|
|
98793
|
-
|
|
98794
|
-
|
|
98795
|
-
|
|
98796
|
-
let iframeGetProjectResourceUrl = null;
|
|
98797
|
-
let iframeIsValidUrl = null;
|
|
98798
|
-
let iframeGetDefaultResources = null;
|
|
98799
|
-
try {
|
|
98800
|
-
const extracted = eval(`
|
|
98801
|
-
(function() {
|
|
98802
|
-
const isValidUrl = ${isValidUrlFn || "null"};
|
|
98803
|
-
const getResourceUrl = ${getResourceUrlFn || "null"};
|
|
98804
|
-
const getStudioResourceUrl = ${getStudioResourceUrlFn || "null"};
|
|
98805
|
-
const getProjectResourceUrl = ${getProjectResourceUrlFn || "null"};
|
|
98806
|
-
const getDefaultResources = ${getDefaultResourcesFn || "null"};
|
|
98807
|
-
|
|
98808
|
-
return {
|
|
98809
|
-
isValidUrl,
|
|
98810
|
-
getResourceUrl,
|
|
98811
|
-
getStudioResourceUrl,
|
|
98812
|
-
getProjectResourceUrl,
|
|
98813
|
-
getDefaultResources
|
|
98814
|
-
};
|
|
98815
|
-
})()
|
|
98816
|
-
`);
|
|
98817
|
-
if (extracted) {
|
|
98818
|
-
iframeIsValidUrl = extracted.isValidUrl;
|
|
98819
|
-
iframeGetResourceUrl = extracted.getResourceUrl;
|
|
98820
|
-
iframeGetStudioResourceUrl = extracted.getStudioResourceUrl;
|
|
98821
|
-
iframeGetProjectResourceUrl = extracted.getProjectResourceUrl;
|
|
98822
|
-
iframeGetDefaultResources = extracted.getDefaultResources;
|
|
98823
|
-
}
|
|
98824
|
-
} catch (error) {
|
|
98825
|
-
console.error("Failed to parse resource-related functions using eval:", error);
|
|
98826
|
-
}
|
|
98827
|
-
let hasInternalFunctions = true;
|
|
98828
|
-
if (!iframeGetResourceUrl || !iframeGetStudioResourceUrl || !iframeGetProjectResourceUrl || !iframeIsValidUrl || !iframeGetDefaultResources) {
|
|
98829
|
-
hasInternalFunctions = false;
|
|
98830
|
-
console.error("Unable to parse resource-related functions from the iframe code. Some iframes may appear without content.");
|
|
99754
|
+
if (resourceUrls.length === 0) {
|
|
99755
|
+
errorLogger("Regex found ZERO resources in initIframe function.", {
|
|
99756
|
+
initIframeFnLength: initIframeFn.length,
|
|
99757
|
+
initIframeBodyPreview: initIframeBody.substring(0, 500)
|
|
99758
|
+
});
|
|
99759
|
+
} else {
|
|
99760
|
+
infoLogger(`Detected ${resourceUrls.length} resources in initIframe:`, resourceUrls.map((r) => r.url));
|
|
98831
99761
|
}
|
|
98832
|
-
|
|
98833
|
-
if (
|
|
98834
|
-
|
|
98835
|
-
|
|
98836
|
-
|
|
98837
|
-
|
|
98838
|
-
|
|
98839
|
-
|
|
98840
|
-
const
|
|
98841
|
-
|
|
98842
|
-
|
|
98843
|
-
|
|
98844
|
-
|
|
98845
|
-
|
|
98846
|
-
|
|
98847
|
-
doc.head.appendChild(inlineStyle);
|
|
98848
|
-
console.log(`Inlined basic style from getDefaultResources: ${resourceUrl}`);
|
|
98849
|
-
}
|
|
98850
|
-
} catch (error) {
|
|
98851
|
-
console.error(`Failed to inline basic resource from ${resource?.href}:`, error);
|
|
99762
|
+
const addDefaultStylesOptions = extractAddDefaultStylesParams(initIframeBody, errorLogger);
|
|
99763
|
+
if (addDefaultStylesOptions) {
|
|
99764
|
+
try {
|
|
99765
|
+
const basicResources = iframeFn.getDefaultResources(addDefaultStylesOptions);
|
|
99766
|
+
await Promise.all(basicResources.map(async (resource) => {
|
|
99767
|
+
try {
|
|
99768
|
+
const resourceType = resource.type;
|
|
99769
|
+
if (resourceType === "stylesheet" && resource.href) {
|
|
99770
|
+
const resourceUrl = iframeFn.getResourceUrl(resource.href, resourceBaseUrl);
|
|
99771
|
+
const resourceContent = await fetchResourceWithCache(resourceUrl);
|
|
99772
|
+
const inlineStyle = doc.createElement("style");
|
|
99773
|
+
inlineStyle.setAttribute("inlined-resource-name", resource.href);
|
|
99774
|
+
inlineStyle.textContent = resourceContent;
|
|
99775
|
+
doc.head.appendChild(inlineStyle);
|
|
99776
|
+
infoLogger(`Inlined default stylesheet:`, { name: resource.href, url: resourceUrl });
|
|
98852
99777
|
}
|
|
98853
|
-
})
|
|
98854
|
-
|
|
98855
|
-
|
|
98856
|
-
|
|
99778
|
+
} catch (error) {
|
|
99779
|
+
const msg = `Failed to inline basic resource from ${resource?.href}:`;
|
|
99780
|
+
errorLogger(msg, error);
|
|
99781
|
+
}
|
|
99782
|
+
}));
|
|
99783
|
+
} catch (error) {
|
|
99784
|
+
const msg = "Failed to get or inline basic resources:";
|
|
99785
|
+
errorLogger(msg, error);
|
|
98857
99786
|
}
|
|
98858
|
-
|
|
98859
|
-
|
|
98860
|
-
|
|
98861
|
-
|
|
98862
|
-
|
|
98863
|
-
|
|
98864
|
-
|
|
98865
|
-
|
|
98866
|
-
|
|
98867
|
-
|
|
98868
|
-
}
|
|
98869
|
-
|
|
98870
|
-
|
|
98871
|
-
|
|
98872
|
-
|
|
98873
|
-
|
|
98874
|
-
|
|
98875
|
-
|
|
98876
|
-
|
|
98877
|
-
|
|
98878
|
-
|
|
98879
|
-
|
|
98880
|
-
|
|
98881
|
-
|
|
98882
|
-
|
|
98883
|
-
|
|
98884
|
-
|
|
98885
|
-
|
|
98886
|
-
|
|
98887
|
-
|
|
98888
|
-
|
|
98889
|
-
|
|
98890
|
-
|
|
98891
|
-
|
|
98892
|
-
|
|
98893
|
-
|
|
98894
|
-
|
|
98895
|
-
|
|
98896
|
-
if (optionsObj.async) inlineScript.setAttribute("async", "");
|
|
98897
|
-
if (optionsObj.nomodule) inlineScript.setAttribute("nomodule", "");
|
|
98898
|
-
if (optionsObj.crossOrigin) inlineScript.setAttribute("crossorigin", optionsObj.crossOrigin);
|
|
99787
|
+
}
|
|
99788
|
+
const resourceResults = await Promise.all(resourceUrls.map(async (resource) => {
|
|
99789
|
+
try {
|
|
99790
|
+
const resourceUrl = iframeFn.getResourceUrl(resource.url, resourceBaseUrl);
|
|
99791
|
+
const resourceContent = await fetchResourceWithCache(resourceUrl);
|
|
99792
|
+
return {
|
|
99793
|
+
success: true,
|
|
99794
|
+
resource,
|
|
99795
|
+
resourceUrl,
|
|
99796
|
+
resourceContent
|
|
99797
|
+
};
|
|
99798
|
+
} catch (error) {
|
|
99799
|
+
const msg = `Failed to fetch resource from ${resource.url}:`;
|
|
99800
|
+
errorLogger(msg, error);
|
|
99801
|
+
return {
|
|
99802
|
+
success: false,
|
|
99803
|
+
resource,
|
|
99804
|
+
error
|
|
99805
|
+
};
|
|
99806
|
+
}
|
|
99807
|
+
}));
|
|
99808
|
+
let insertionPoint = doc.head.firstChild;
|
|
99809
|
+
for (const result of resourceResults) {
|
|
99810
|
+
if (!result.success) {
|
|
99811
|
+
allInitIframeResourcesInlined = false;
|
|
99812
|
+
continue;
|
|
99813
|
+
}
|
|
99814
|
+
const { resource, resourceUrl, resourceContent } = result;
|
|
99815
|
+
try {
|
|
99816
|
+
if (resource.type === "addScript" || resource.url.endsWith(".js")) {
|
|
99817
|
+
const inlineScript = doc.createElement("script");
|
|
99818
|
+
inlineScript.setAttribute("inlined-resource-name", resource.url);
|
|
99819
|
+
inlineScript.textContent = resourceContent;
|
|
99820
|
+
if (resource.options) {
|
|
99821
|
+
const optionsObj = safelyParseScriptOptions(resource.options, errorLogger);
|
|
99822
|
+
if (optionsObj && typeof optionsObj === "object") {
|
|
99823
|
+
if (optionsObj.type) {
|
|
99824
|
+
inlineScript.setAttribute("type", optionsObj.type);
|
|
98899
99825
|
}
|
|
98900
|
-
|
|
98901
|
-
|
|
98902
|
-
|
|
98903
|
-
|
|
98904
|
-
|
|
98905
|
-
|
|
98906
|
-
|
|
98907
|
-
|
|
98908
|
-
|
|
98909
|
-
|
|
98910
|
-
|
|
98911
|
-
|
|
98912
|
-
|
|
98913
|
-
|
|
98914
|
-
|
|
99826
|
+
if (optionsObj.defer) inlineScript.setAttribute("defer", "");
|
|
99827
|
+
if (optionsObj.async) inlineScript.setAttribute("async", "");
|
|
99828
|
+
if (optionsObj.nomodule) inlineScript.setAttribute("nomodule", "");
|
|
99829
|
+
if (optionsObj.crossOrigin) inlineScript.setAttribute("crossorigin", optionsObj.crossOrigin);
|
|
99830
|
+
}
|
|
99831
|
+
}
|
|
99832
|
+
doc.head.insertBefore(inlineScript, insertionPoint);
|
|
99833
|
+
insertionPoint = inlineScript.nextSibling;
|
|
99834
|
+
infoLogger(`Inlined initIframe script:`, { name: resource.url, url: resourceUrl, type: inlineScript.type || "text/javascript" });
|
|
99835
|
+
} else if (resource.type === "addStyleSheet" || resource.url.endsWith(".css")) {
|
|
99836
|
+
const inlineStyle = doc.createElement("style");
|
|
99837
|
+
inlineStyle.setAttribute("inlined-resource-name", resource.url);
|
|
99838
|
+
inlineStyle.textContent = resourceContent;
|
|
99839
|
+
doc.head.insertBefore(inlineStyle, insertionPoint);
|
|
99840
|
+
insertionPoint = inlineStyle.nextSibling;
|
|
99841
|
+
infoLogger(`Inlined initIframe stylesheet:`, { name: resource.url, url: resourceUrl });
|
|
98915
99842
|
}
|
|
99843
|
+
} catch (error) {
|
|
99844
|
+
const msg = `Failed to inline resource from ${resource.url}:`;
|
|
99845
|
+
errorLogger(msg, error);
|
|
99846
|
+
allInitIframeResourcesInlined = false;
|
|
98916
99847
|
}
|
|
98917
99848
|
}
|
|
98918
99849
|
}
|
|
@@ -99092,7 +100023,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
99092
100023
|
}
|
|
99093
100024
|
|
|
99094
100025
|
// alan_btn/src/textChat/helpers/resources.ts
|
|
99095
|
-
function
|
|
100026
|
+
function isValidUrl3(url) {
|
|
99096
100027
|
try {
|
|
99097
100028
|
new URL(url);
|
|
99098
100029
|
return true;
|
|
@@ -99108,7 +100039,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
99108
100039
|
const resourceBaseUrl = uiState.resourceBaseUrl;
|
|
99109
100040
|
const projectResPrefix = "resource://";
|
|
99110
100041
|
const studioResPrefix = "studio-resource://";
|
|
99111
|
-
const withPublicUrl =
|
|
100042
|
+
const withPublicUrl = isValidUrl3(resourceUrl);
|
|
99112
100043
|
if (!resourceUrl) {
|
|
99113
100044
|
return `${resourceBaseUrl}`;
|
|
99114
100045
|
}
|
|
@@ -99179,7 +100110,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
|
|
|
99179
100110
|
// alan_btn/alan_btn.ts
|
|
99180
100111
|
(function(ns) {
|
|
99181
100112
|
const uiState10 = getUIState();
|
|
99182
|
-
const version2 = "alan-version.1.8.
|
|
100113
|
+
const version2 = "alan-version.1.8.140".replace("alan-version.", "");
|
|
99183
100114
|
uiState10.lib.version = version2;
|
|
99184
100115
|
window.alanLib = { version: version2 };
|
|
99185
100116
|
if (window.alanBtn) {
|
|
@@ -102323,19 +103254,31 @@ ${reason}` : reason,
|
|
|
102323
103254
|
var maxQuestions = uiState10.textChat.maxQuestionsCount || 5;
|
|
102324
103255
|
if (text3?.length > maxChars) {
|
|
102325
103256
|
console.warn("Alan: message cannot be sent: maximum message limit exceeded.");
|
|
103257
|
+
if (options.onEvent) {
|
|
103258
|
+
options.onEvent({ name: "textChatMessageLimitExceeded" });
|
|
103259
|
+
}
|
|
102326
103260
|
return;
|
|
102327
103261
|
}
|
|
102328
103262
|
if (getActiveQuestionsCount() >= maxQuestions) {
|
|
102329
103263
|
console.warn("Alan: message cannot be sent: maximum concurrent questions limit exceeded.");
|
|
103264
|
+
if (options.onEvent) {
|
|
103265
|
+
options.onEvent({ name: "textChatConcurrentQuestionsLimitExceeded" });
|
|
103266
|
+
}
|
|
102330
103267
|
return;
|
|
102331
103268
|
}
|
|
102332
103269
|
if (!canMsgBeSent()) {
|
|
102333
103270
|
console.warn("Alan: message cannot be sent. Model is not ready or connection is not established.");
|
|
103271
|
+
if (options.onEvent) {
|
|
103272
|
+
options.onEvent({ name: "textChatModelNotReady" });
|
|
103273
|
+
}
|
|
102334
103274
|
return;
|
|
102335
103275
|
}
|
|
102336
103276
|
if (getActiveQuestionsCount() >= maxQuestions) {
|
|
102337
103277
|
disableTextareaInTheChat();
|
|
102338
103278
|
}
|
|
103279
|
+
if (options.onEvent) {
|
|
103280
|
+
options.onEvent({ name: "textChatMessageSubmitted" });
|
|
103281
|
+
}
|
|
102339
103282
|
var msg = { text: text3, type: "request", name: "text", tsInit: Date.now() };
|
|
102340
103283
|
sentMessageInd = null;
|
|
102341
103284
|
clearMessageProgressStatusInterval();
|
|
@@ -102397,17 +103340,29 @@ ${reason}` : reason,
|
|
|
102397
103340
|
var maxQuestions = uiState10.textChat.maxQuestionsCount || 5;
|
|
102398
103341
|
if (lastSendMsgTs) {
|
|
102399
103342
|
console.warn("Alan: message cannot be sent: you are sending messages too fast. Please wait a moment before sending another message.");
|
|
103343
|
+
if (options.onEvent) {
|
|
103344
|
+
options.onEvent({ name: "textChatMessageTooFast" });
|
|
103345
|
+
}
|
|
102400
103346
|
return;
|
|
102401
103347
|
}
|
|
102402
103348
|
if (text3?.length > maxChars) {
|
|
102403
103349
|
console.warn("Alan: message cannot be sent: maximum message limit exceeded.");
|
|
103350
|
+
if (options.onEvent) {
|
|
103351
|
+
options.onEvent({ name: "textChatMessageLimitExceeded" });
|
|
103352
|
+
}
|
|
102404
103353
|
return;
|
|
102405
103354
|
}
|
|
102406
103355
|
if (getActiveQuestionsCount() >= maxQuestions) {
|
|
102407
103356
|
console.warn("Alan: message cannot be sent: maximum concurrent questions limit exceeded.");
|
|
103357
|
+
if (options.onEvent) {
|
|
103358
|
+
options.onEvent({ name: "textChatConcurrentQuestionsLimitExceeded" });
|
|
103359
|
+
}
|
|
102408
103360
|
return;
|
|
102409
103361
|
}
|
|
102410
103362
|
if (!canMsgBeSent()) {
|
|
103363
|
+
if (options.onEvent) {
|
|
103364
|
+
options.onEvent({ name: "textChatModelNotReady" });
|
|
103365
|
+
}
|
|
102411
103366
|
return;
|
|
102412
103367
|
}
|
|
102413
103368
|
lastSendMsgTs = setTimeout(() => {
|
|
@@ -103292,6 +104247,9 @@ ${reason}` : reason,
|
|
|
103292
104247
|
exitFullScreenModeForTextChat();
|
|
103293
104248
|
}
|
|
103294
104249
|
broadcastReloadIframeToIframes();
|
|
104250
|
+
if (options.onEvent) {
|
|
104251
|
+
options.onEvent({ name: uiState10.textChat.expanded ? "textChatExpanded" : "textChatCollapsed" });
|
|
104252
|
+
}
|
|
103295
104253
|
}
|
|
103296
104254
|
async function exportChatHistory() {
|
|
103297
104255
|
const saveChatStateBtnImg = document.getElementById("alan-btn-save-chat-state-btn");
|