@scrabble-solver/scrabble-solver 2.12.2 → 2.12.3
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +6 -6
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_8dgz12 +1 -1
- package/.next/cache/next-server.js.nft.json +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/131.js +478 -106
- package/.next/server/chunks/277.js +1132 -976
- package/.next/server/chunks/44.js +36 -6
- package/.next/server/chunks/865.js +478 -106
- package/.next/server/chunks/911.js +894 -773
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/_app.js +3 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/api/dictionary/[locale]/[word].js +4 -2
- package/.next/server/pages/api/solve.js +23 -19
- package/.next/server/pages/api/verify.js +8 -5
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/index.js +42 -55
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/index.json +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/static/chunks/pages/_app-e7f3d1c9c09c8f91.js +32 -0
- package/.next/static/chunks/pages/index-82b2939158c7729f.js +1 -0
- package/.next/static/css/4e8b47fe382a8a8f.css +2 -0
- package/.next/static/css/cfae5256f1689f57.css +1 -0
- package/.next/static/{9dmPfnTc_AQTHBPvL7xQe → wNIKOJJzkMSJYb2nOL21o}/_buildManifest.js +1 -1
- package/.next/trace +51 -52
- package/package.json +9 -9
- package/src/components/Board/components/Cell/Cell.module.scss +4 -12
- package/src/components/Board/components/Cell/Cell.tsx +4 -0
- package/src/components/Board/hooks/useBackgroundImage.tsx +23 -0
- package/src/components/PlainTiles/lib/createPlainTile.ts +4 -4
- package/src/components/Radio/Radio.module.scss +4 -0
- package/src/components/Radio/Radio.tsx +1 -0
- package/src/components/SeoMessage/SeoMessage.tsx +3 -3
- package/src/hooks/useAppLayout.ts +1 -2
- package/src/hooks/useLocalStorage.ts +5 -5
- package/src/i18n/constants.ts +31 -61
- package/src/lib/extractCharacters.test.ts +3 -3
- package/src/lib/extractCharactersByCase.test.ts +3 -3
- package/src/lib/getCellSize.ts +2 -2
- package/src/modals/MenuModal/MenuModal.module.scss +0 -1
- package/src/modals/MenuModal/MenuModal.tsx +3 -3
- package/src/modals/SettingsModal/components/ConfigSetting/ConfigSetting.tsx +16 -7
- package/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.module.scss +1 -4
- package/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.tsx +8 -8
- package/src/pages/_app.tsx +3 -1
- package/src/pages/api/dictionary/[locale]/[word].ts +6 -3
- package/src/pages/api/solve.ts +11 -7
- package/src/pages/api/verify.ts +11 -7
- package/src/pages/index.module.scss +0 -1
- package/src/parameters/index.ts +4 -6
- package/src/sdk/solve.ts +3 -3
- package/src/sdk/verify.ts +3 -3
- package/src/service-worker/routeSolveRequests.ts +3 -3
- package/src/state/localStorage.ts +6 -6
- package/src/state/sagas.ts +18 -7
- package/src/state/selectors.ts +3 -3
- package/src/state/slices/boardInitialState.ts +3 -3
- package/src/state/slices/boardSlice.ts +20 -6
- package/src/state/slices/settingsInitialState.ts +3 -4
- package/src/state/slices/settingsSlice.ts +5 -5
- package/src/styles/variables.scss +0 -9
- package/.next/static/chunks/pages/_app-02851b06b95b19cb.js +0 -32
- package/.next/static/chunks/pages/index-0ba5607d1aad8a09.js +0 -1
- package/.next/static/css/09dfdea53eba31a9.css +0 -2
- package/.next/static/css/60e8258da7362a1a.css +0 -1
- package/src/i18n/i18n.module.scss +0 -27
- package/src/modals/SettingsModal/components/ConfigSetting/options.ts +0 -19
- package/src/modals/SettingsModal/components/ConfigSetting/types.ts +0 -9
- package/src/modals/SettingsModal/components/InputModeSetting/types.ts +0 -7
- package/src/modals/SettingsModal/components/LocaleSetting/types.ts +0 -9
- /package/.next/static/{9dmPfnTc_AQTHBPvL7xQe → wNIKOJJzkMSJYb2nOL21o}/_ssgManifest.js +0 -0
|
@@ -18564,16 +18564,39 @@ module.exports.DuplexWrapper = DuplexWrapper;
|
|
|
18564
18564
|
|
|
18565
18565
|
"use strict";
|
|
18566
18566
|
|
|
18567
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18568
|
+
if (k2 === undefined) k2 = k;
|
|
18569
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18570
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18571
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18572
|
+
}
|
|
18573
|
+
Object.defineProperty(o, k2, desc);
|
|
18574
|
+
}) : (function(o, m, k, k2) {
|
|
18575
|
+
if (k2 === undefined) k2 = k;
|
|
18576
|
+
o[k2] = m[k];
|
|
18577
|
+
}));
|
|
18578
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18579
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18580
|
+
}) : function(o, v) {
|
|
18581
|
+
o["default"] = v;
|
|
18582
|
+
});
|
|
18583
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18584
|
+
if (mod && mod.__esModule) return mod;
|
|
18585
|
+
var result = {};
|
|
18586
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18587
|
+
__setModuleDefault(result, mod);
|
|
18588
|
+
return result;
|
|
18589
|
+
};
|
|
18567
18590
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18568
18591
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18569
18592
|
};
|
|
18570
18593
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
18571
|
-
exports.decodeXML = exports.decodeHTMLStrict = exports.decodeHTML = exports.determineBranch = exports.BinTrieFlags = exports.fromCodePoint = exports.replaceCodePoint = exports.decodeCodePoint = exports.xmlDecodeTree = exports.htmlDecodeTree = void 0;
|
|
18594
|
+
exports.decodeXML = exports.decodeHTMLStrict = exports.decodeHTMLAttribute = exports.decodeHTML = exports.determineBranch = exports.EntityDecoder = exports.DecodingMode = exports.BinTrieFlags = exports.fromCodePoint = exports.replaceCodePoint = exports.decodeCodePoint = exports.xmlDecodeTree = exports.htmlDecodeTree = void 0;
|
|
18572
18595
|
var decode_data_html_js_1 = __importDefault(__webpack_require__(25827));
|
|
18573
18596
|
exports.htmlDecodeTree = decode_data_html_js_1.default;
|
|
18574
18597
|
var decode_data_xml_js_1 = __importDefault(__webpack_require__(27075));
|
|
18575
18598
|
exports.xmlDecodeTree = decode_data_xml_js_1.default;
|
|
18576
|
-
var decode_codepoint_js_1 =
|
|
18599
|
+
var decode_codepoint_js_1 = __importStar(__webpack_require__(17387));
|
|
18577
18600
|
exports.decodeCodePoint = decode_codepoint_js_1.default;
|
|
18578
18601
|
var decode_codepoint_js_2 = __webpack_require__(17387);
|
|
18579
18602
|
Object.defineProperty(exports, "replaceCodePoint", ({ enumerable: true, get: function () { return decode_codepoint_js_2.replaceCodePoint; } }));
|
|
@@ -18582,99 +18605,421 @@ var CharCodes;
|
|
|
18582
18605
|
(function (CharCodes) {
|
|
18583
18606
|
CharCodes[CharCodes["NUM"] = 35] = "NUM";
|
|
18584
18607
|
CharCodes[CharCodes["SEMI"] = 59] = "SEMI";
|
|
18608
|
+
CharCodes[CharCodes["EQUALS"] = 61] = "EQUALS";
|
|
18585
18609
|
CharCodes[CharCodes["ZERO"] = 48] = "ZERO";
|
|
18586
18610
|
CharCodes[CharCodes["NINE"] = 57] = "NINE";
|
|
18587
18611
|
CharCodes[CharCodes["LOWER_A"] = 97] = "LOWER_A";
|
|
18588
18612
|
CharCodes[CharCodes["LOWER_F"] = 102] = "LOWER_F";
|
|
18589
18613
|
CharCodes[CharCodes["LOWER_X"] = 120] = "LOWER_X";
|
|
18590
|
-
|
|
18591
|
-
CharCodes[CharCodes["
|
|
18614
|
+
CharCodes[CharCodes["LOWER_Z"] = 122] = "LOWER_Z";
|
|
18615
|
+
CharCodes[CharCodes["UPPER_A"] = 65] = "UPPER_A";
|
|
18616
|
+
CharCodes[CharCodes["UPPER_F"] = 70] = "UPPER_F";
|
|
18617
|
+
CharCodes[CharCodes["UPPER_Z"] = 90] = "UPPER_Z";
|
|
18592
18618
|
})(CharCodes || (CharCodes = {}));
|
|
18619
|
+
/** Bit that needs to be set to convert an upper case ASCII character to lower case */
|
|
18620
|
+
var TO_LOWER_BIT = 32;
|
|
18593
18621
|
var BinTrieFlags;
|
|
18594
18622
|
(function (BinTrieFlags) {
|
|
18595
18623
|
BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
|
|
18596
18624
|
BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH";
|
|
18597
18625
|
BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE";
|
|
18598
18626
|
})(BinTrieFlags = exports.BinTrieFlags || (exports.BinTrieFlags = {}));
|
|
18599
|
-
function
|
|
18600
|
-
return
|
|
18601
|
-
|
|
18602
|
-
|
|
18603
|
-
|
|
18604
|
-
|
|
18605
|
-
|
|
18606
|
-
|
|
18607
|
-
|
|
18608
|
-
|
|
18609
|
-
|
|
18610
|
-
|
|
18611
|
-
|
|
18612
|
-
|
|
18613
|
-
|
|
18614
|
-
|
|
18615
|
-
|
|
18616
|
-
|
|
18617
|
-
|
|
18618
|
-
|
|
18619
|
-
|
|
18620
|
-
|
|
18621
|
-
|
|
18622
|
-
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
|
|
18627
|
-
|
|
18628
|
-
|
|
18629
|
-
|
|
18630
|
-
|
|
18631
|
-
|
|
18632
|
-
|
|
18633
|
-
|
|
18634
|
-
|
|
18635
|
-
|
|
18636
|
-
|
|
18627
|
+
function isNumber(code) {
|
|
18628
|
+
return code >= CharCodes.ZERO && code <= CharCodes.NINE;
|
|
18629
|
+
}
|
|
18630
|
+
function isHexadecimalCharacter(code) {
|
|
18631
|
+
return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F) ||
|
|
18632
|
+
(code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F));
|
|
18633
|
+
}
|
|
18634
|
+
function isAsciiAlphaNumeric(code) {
|
|
18635
|
+
return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z) ||
|
|
18636
|
+
(code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z) ||
|
|
18637
|
+
isNumber(code));
|
|
18638
|
+
}
|
|
18639
|
+
/**
|
|
18640
|
+
* Checks if the given character is a valid end character for an entity in an attribute.
|
|
18641
|
+
*
|
|
18642
|
+
* Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.
|
|
18643
|
+
* See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
|
|
18644
|
+
*/
|
|
18645
|
+
function isEntityInAttributeInvalidEnd(code) {
|
|
18646
|
+
return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code);
|
|
18647
|
+
}
|
|
18648
|
+
var EntityDecoderState;
|
|
18649
|
+
(function (EntityDecoderState) {
|
|
18650
|
+
EntityDecoderState[EntityDecoderState["EntityStart"] = 0] = "EntityStart";
|
|
18651
|
+
EntityDecoderState[EntityDecoderState["NumericStart"] = 1] = "NumericStart";
|
|
18652
|
+
EntityDecoderState[EntityDecoderState["NumericDecimal"] = 2] = "NumericDecimal";
|
|
18653
|
+
EntityDecoderState[EntityDecoderState["NumericHex"] = 3] = "NumericHex";
|
|
18654
|
+
EntityDecoderState[EntityDecoderState["NamedEntity"] = 4] = "NamedEntity";
|
|
18655
|
+
})(EntityDecoderState || (EntityDecoderState = {}));
|
|
18656
|
+
var DecodingMode;
|
|
18657
|
+
(function (DecodingMode) {
|
|
18658
|
+
/** Entities in text nodes that can end with any character. */
|
|
18659
|
+
DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy";
|
|
18660
|
+
/** Only allow entities terminated with a semicolon. */
|
|
18661
|
+
DecodingMode[DecodingMode["Strict"] = 1] = "Strict";
|
|
18662
|
+
/** Entities in attributes have limitations on ending characters. */
|
|
18663
|
+
DecodingMode[DecodingMode["Attribute"] = 2] = "Attribute";
|
|
18664
|
+
})(DecodingMode = exports.DecodingMode || (exports.DecodingMode = {}));
|
|
18665
|
+
/**
|
|
18666
|
+
* Token decoder with support of writing partial entities.
|
|
18667
|
+
*/
|
|
18668
|
+
var EntityDecoder = /** @class */ (function () {
|
|
18669
|
+
function EntityDecoder(
|
|
18670
|
+
/** The tree used to decode entities. */
|
|
18671
|
+
decodeTree,
|
|
18672
|
+
/**
|
|
18673
|
+
* The function that is called when a codepoint is decoded.
|
|
18674
|
+
*
|
|
18675
|
+
* For multi-byte named entities, this will be called multiple times,
|
|
18676
|
+
* with the second codepoint, and the same `consumed` value.
|
|
18677
|
+
*
|
|
18678
|
+
* @param codepoint The decoded codepoint.
|
|
18679
|
+
* @param consumed The number of bytes consumed by the decoder.
|
|
18680
|
+
*/
|
|
18681
|
+
emitCodePoint,
|
|
18682
|
+
/** An object that is used to produce errors. */
|
|
18683
|
+
errors) {
|
|
18684
|
+
this.decodeTree = decodeTree;
|
|
18685
|
+
this.emitCodePoint = emitCodePoint;
|
|
18686
|
+
this.errors = errors;
|
|
18687
|
+
/** The current state of the decoder. */
|
|
18688
|
+
this.state = EntityDecoderState.EntityStart;
|
|
18689
|
+
/** Characters that were consumed while parsing an entity. */
|
|
18690
|
+
this.consumed = 1;
|
|
18691
|
+
/**
|
|
18692
|
+
* The result of the entity.
|
|
18693
|
+
*
|
|
18694
|
+
* Either the result index of a numeric entity, or the codepoint of a
|
|
18695
|
+
* numeric entity.
|
|
18696
|
+
*/
|
|
18697
|
+
this.result = 0;
|
|
18698
|
+
/** The current index in the decode tree. */
|
|
18699
|
+
this.treeIndex = 0;
|
|
18700
|
+
/** The number of characters that were consumed in excess. */
|
|
18701
|
+
this.excess = 1;
|
|
18702
|
+
/** The mode in which the decoder is operating. */
|
|
18703
|
+
this.decodeMode = DecodingMode.Strict;
|
|
18704
|
+
}
|
|
18705
|
+
/** Resets the instance to make it reusable. */
|
|
18706
|
+
EntityDecoder.prototype.startEntity = function (decodeMode) {
|
|
18707
|
+
this.decodeMode = decodeMode;
|
|
18708
|
+
this.state = EntityDecoderState.EntityStart;
|
|
18709
|
+
this.result = 0;
|
|
18710
|
+
this.treeIndex = 0;
|
|
18711
|
+
this.excess = 1;
|
|
18712
|
+
this.consumed = 1;
|
|
18713
|
+
};
|
|
18714
|
+
/**
|
|
18715
|
+
* Write an entity to the decoder. This can be called multiple times with partial entities.
|
|
18716
|
+
* If the entity is incomplete, the decoder will return -1.
|
|
18717
|
+
*
|
|
18718
|
+
* Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
|
|
18719
|
+
* entity is incomplete, and resume when the next string is written.
|
|
18720
|
+
*
|
|
18721
|
+
* @param string The string containing the entity (or a continuation of the entity).
|
|
18722
|
+
* @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
|
|
18723
|
+
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
18724
|
+
*/
|
|
18725
|
+
EntityDecoder.prototype.write = function (str, offset) {
|
|
18726
|
+
switch (this.state) {
|
|
18727
|
+
case EntityDecoderState.EntityStart: {
|
|
18728
|
+
if (str.charCodeAt(offset) === CharCodes.NUM) {
|
|
18729
|
+
this.state = EntityDecoderState.NumericStart;
|
|
18730
|
+
this.consumed += 1;
|
|
18731
|
+
return this.stateNumericStart(str, offset + 1);
|
|
18637
18732
|
}
|
|
18638
|
-
|
|
18733
|
+
this.state = EntityDecoderState.NamedEntity;
|
|
18734
|
+
return this.stateNamedEntity(str, offset);
|
|
18639
18735
|
}
|
|
18640
|
-
|
|
18641
|
-
|
|
18642
|
-
|
|
18643
|
-
|
|
18644
|
-
|
|
18645
|
-
|
|
18646
|
-
|
|
18647
|
-
|
|
18648
|
-
|
|
18649
|
-
|
|
18650
|
-
|
|
18651
|
-
|
|
18652
|
-
|
|
18653
|
-
|
|
18654
|
-
|
|
18655
|
-
|
|
18656
|
-
|
|
18657
|
-
|
|
18658
|
-
|
|
18659
|
-
|
|
18660
|
-
|
|
18661
|
-
|
|
18736
|
+
case EntityDecoderState.NumericStart: {
|
|
18737
|
+
return this.stateNumericStart(str, offset);
|
|
18738
|
+
}
|
|
18739
|
+
case EntityDecoderState.NumericDecimal: {
|
|
18740
|
+
return this.stateNumericDecimal(str, offset);
|
|
18741
|
+
}
|
|
18742
|
+
case EntityDecoderState.NumericHex: {
|
|
18743
|
+
return this.stateNumericHex(str, offset);
|
|
18744
|
+
}
|
|
18745
|
+
case EntityDecoderState.NamedEntity: {
|
|
18746
|
+
return this.stateNamedEntity(str, offset);
|
|
18747
|
+
}
|
|
18748
|
+
}
|
|
18749
|
+
};
|
|
18750
|
+
/**
|
|
18751
|
+
* Switches between the numeric decimal and hexadecimal states.
|
|
18752
|
+
*
|
|
18753
|
+
* Equivalent to the `Numeric character reference state` in the HTML spec.
|
|
18754
|
+
*
|
|
18755
|
+
* @param str The string containing the entity (or a continuation of the entity).
|
|
18756
|
+
* @param offset The current offset.
|
|
18757
|
+
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
18758
|
+
*/
|
|
18759
|
+
EntityDecoder.prototype.stateNumericStart = function (str, offset) {
|
|
18760
|
+
if (offset >= str.length) {
|
|
18761
|
+
return -1;
|
|
18762
|
+
}
|
|
18763
|
+
if ((str.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
|
|
18764
|
+
this.state = EntityDecoderState.NumericHex;
|
|
18765
|
+
this.consumed += 1;
|
|
18766
|
+
return this.stateNumericHex(str, offset + 1);
|
|
18767
|
+
}
|
|
18768
|
+
this.state = EntityDecoderState.NumericDecimal;
|
|
18769
|
+
return this.stateNumericDecimal(str, offset);
|
|
18770
|
+
};
|
|
18771
|
+
EntityDecoder.prototype.addToNumericResult = function (str, start, end, base) {
|
|
18772
|
+
if (start !== end) {
|
|
18773
|
+
var digitCount = end - start;
|
|
18774
|
+
this.result =
|
|
18775
|
+
this.result * Math.pow(base, digitCount) +
|
|
18776
|
+
parseInt(str.substr(start, digitCount), base);
|
|
18777
|
+
this.consumed += digitCount;
|
|
18778
|
+
}
|
|
18779
|
+
};
|
|
18780
|
+
/**
|
|
18781
|
+
* Parses a hexadecimal numeric entity.
|
|
18782
|
+
*
|
|
18783
|
+
* Equivalent to the `Hexademical character reference state` in the HTML spec.
|
|
18784
|
+
*
|
|
18785
|
+
* @param str The string containing the entity (or a continuation of the entity).
|
|
18786
|
+
* @param offset The current offset.
|
|
18787
|
+
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
18788
|
+
*/
|
|
18789
|
+
EntityDecoder.prototype.stateNumericHex = function (str, offset) {
|
|
18790
|
+
var startIdx = offset;
|
|
18791
|
+
while (offset < str.length) {
|
|
18792
|
+
var char = str.charCodeAt(offset);
|
|
18793
|
+
if (isNumber(char) || isHexadecimalCharacter(char)) {
|
|
18794
|
+
offset += 1;
|
|
18795
|
+
}
|
|
18796
|
+
else {
|
|
18797
|
+
this.addToNumericResult(str, startIdx, offset, 16);
|
|
18798
|
+
return this.emitNumericEntity(char, 3);
|
|
18799
|
+
}
|
|
18800
|
+
}
|
|
18801
|
+
this.addToNumericResult(str, startIdx, offset, 16);
|
|
18802
|
+
return -1;
|
|
18803
|
+
};
|
|
18804
|
+
/**
|
|
18805
|
+
* Parses a decimal numeric entity.
|
|
18806
|
+
*
|
|
18807
|
+
* Equivalent to the `Decimal character reference state` in the HTML spec.
|
|
18808
|
+
*
|
|
18809
|
+
* @param str The string containing the entity (or a continuation of the entity).
|
|
18810
|
+
* @param offset The current offset.
|
|
18811
|
+
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
18812
|
+
*/
|
|
18813
|
+
EntityDecoder.prototype.stateNumericDecimal = function (str, offset) {
|
|
18814
|
+
var startIdx = offset;
|
|
18815
|
+
while (offset < str.length) {
|
|
18816
|
+
var char = str.charCodeAt(offset);
|
|
18817
|
+
if (isNumber(char)) {
|
|
18818
|
+
offset += 1;
|
|
18819
|
+
}
|
|
18820
|
+
else {
|
|
18821
|
+
this.addToNumericResult(str, startIdx, offset, 10);
|
|
18822
|
+
return this.emitNumericEntity(char, 2);
|
|
18823
|
+
}
|
|
18824
|
+
}
|
|
18825
|
+
this.addToNumericResult(str, startIdx, offset, 10);
|
|
18826
|
+
return -1;
|
|
18827
|
+
};
|
|
18828
|
+
/**
|
|
18829
|
+
* Validate and emit a numeric entity.
|
|
18830
|
+
*
|
|
18831
|
+
* Implements the logic from the `Hexademical character reference start
|
|
18832
|
+
* state` and `Numeric character reference end state` in the HTML spec.
|
|
18833
|
+
*
|
|
18834
|
+
* @param lastCp The last code point of the entity. Used to see if the
|
|
18835
|
+
* entity was terminated with a semicolon.
|
|
18836
|
+
* @param expectedLength The minimum number of characters that should be
|
|
18837
|
+
* consumed. Used to validate that at least one digit
|
|
18838
|
+
* was consumed.
|
|
18839
|
+
* @returns The number of characters that were consumed.
|
|
18840
|
+
*/
|
|
18841
|
+
EntityDecoder.prototype.emitNumericEntity = function (lastCp, expectedLength) {
|
|
18842
|
+
var _a;
|
|
18843
|
+
// Ensure we consumed at least one digit.
|
|
18844
|
+
if (this.consumed <= expectedLength) {
|
|
18845
|
+
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
|
|
18846
|
+
return 0;
|
|
18847
|
+
}
|
|
18848
|
+
// Figure out if this is a legit end of the entity
|
|
18849
|
+
if (lastCp === CharCodes.SEMI) {
|
|
18850
|
+
this.consumed += 1;
|
|
18851
|
+
}
|
|
18852
|
+
else if (this.decodeMode === DecodingMode.Strict) {
|
|
18853
|
+
return 0;
|
|
18854
|
+
}
|
|
18855
|
+
this.emitCodePoint((0, decode_codepoint_js_1.replaceCodePoint)(this.result), this.consumed);
|
|
18856
|
+
if (this.errors) {
|
|
18857
|
+
if (lastCp !== CharCodes.SEMI) {
|
|
18858
|
+
this.errors.missingSemicolonAfterCharacterReference();
|
|
18859
|
+
}
|
|
18860
|
+
this.errors.validateNumericCharacterReference(this.result);
|
|
18861
|
+
}
|
|
18862
|
+
return this.consumed;
|
|
18863
|
+
};
|
|
18864
|
+
/**
|
|
18865
|
+
* Parses a named entity.
|
|
18866
|
+
*
|
|
18867
|
+
* Equivalent to the `Named character reference state` in the HTML spec.
|
|
18868
|
+
*
|
|
18869
|
+
* @param str The string containing the entity (or a continuation of the entity).
|
|
18870
|
+
* @param offset The current offset.
|
|
18871
|
+
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
18872
|
+
*/
|
|
18873
|
+
EntityDecoder.prototype.stateNamedEntity = function (str, offset) {
|
|
18874
|
+
var decodeTree = this.decodeTree;
|
|
18875
|
+
var current = decodeTree[this.treeIndex];
|
|
18876
|
+
// The mask is the number of bytes of the value, including the current byte.
|
|
18877
|
+
var valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
|
|
18878
|
+
for (; offset < str.length; offset++, this.excess++) {
|
|
18879
|
+
var char = str.charCodeAt(offset);
|
|
18880
|
+
this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
|
|
18881
|
+
if (this.treeIndex < 0) {
|
|
18882
|
+
return this.result === 0 ||
|
|
18883
|
+
// If we are parsing an attribute
|
|
18884
|
+
(this.decodeMode === DecodingMode.Attribute &&
|
|
18885
|
+
// We shouldn't have consumed any characters after the entity,
|
|
18886
|
+
(valueLength === 0 ||
|
|
18887
|
+
// And there should be no invalid characters.
|
|
18888
|
+
isEntityInAttributeInvalidEnd(char)))
|
|
18889
|
+
? 0
|
|
18890
|
+
: this.emitNotTerminatedNamedEntity();
|
|
18891
|
+
}
|
|
18892
|
+
current = decodeTree[this.treeIndex];
|
|
18893
|
+
valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
|
|
18894
|
+
// If the branch is a value, store it and continue
|
|
18895
|
+
if (valueLength !== 0) {
|
|
18896
|
+
// If the entity is terminated by a semicolon, we are done.
|
|
18897
|
+
if (char === CharCodes.SEMI) {
|
|
18898
|
+
return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
|
|
18899
|
+
}
|
|
18900
|
+
// If we encounter a non-terminated (legacy) entity while parsing strictly, then ignore it.
|
|
18901
|
+
if (this.decodeMode !== DecodingMode.Strict) {
|
|
18902
|
+
this.result = this.treeIndex;
|
|
18903
|
+
this.consumed += this.excess;
|
|
18904
|
+
this.excess = 0;
|
|
18662
18905
|
}
|
|
18663
18906
|
}
|
|
18664
|
-
|
|
18665
|
-
|
|
18666
|
-
|
|
18667
|
-
|
|
18668
|
-
|
|
18669
|
-
|
|
18670
|
-
|
|
18671
|
-
|
|
18672
|
-
|
|
18907
|
+
}
|
|
18908
|
+
return -1;
|
|
18909
|
+
};
|
|
18910
|
+
/**
|
|
18911
|
+
* Emit a named entity that was not terminated with a semicolon.
|
|
18912
|
+
*
|
|
18913
|
+
* @returns The number of characters consumed.
|
|
18914
|
+
*/
|
|
18915
|
+
EntityDecoder.prototype.emitNotTerminatedNamedEntity = function () {
|
|
18916
|
+
var _a;
|
|
18917
|
+
var _b = this, result = _b.result, decodeTree = _b.decodeTree;
|
|
18918
|
+
var valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;
|
|
18919
|
+
this.emitNamedEntityData(result, valueLength, this.consumed);
|
|
18920
|
+
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.missingSemicolonAfterCharacterReference();
|
|
18921
|
+
return this.consumed;
|
|
18922
|
+
};
|
|
18923
|
+
/**
|
|
18924
|
+
* Emit a named entity.
|
|
18925
|
+
*
|
|
18926
|
+
* @param result The index of the entity in the decode tree.
|
|
18927
|
+
* @param valueLength The number of bytes in the entity.
|
|
18928
|
+
* @param consumed The number of characters consumed.
|
|
18929
|
+
*
|
|
18930
|
+
* @returns The number of characters consumed.
|
|
18931
|
+
*/
|
|
18932
|
+
EntityDecoder.prototype.emitNamedEntityData = function (result, valueLength, consumed) {
|
|
18933
|
+
var decodeTree = this.decodeTree;
|
|
18934
|
+
this.emitCodePoint(valueLength === 1
|
|
18935
|
+
? decodeTree[result] & ~BinTrieFlags.VALUE_LENGTH
|
|
18936
|
+
: decodeTree[result + 1], consumed);
|
|
18937
|
+
if (valueLength === 3) {
|
|
18938
|
+
// For multi-byte values, we need to emit the second byte.
|
|
18939
|
+
this.emitCodePoint(decodeTree[result + 2], consumed);
|
|
18940
|
+
}
|
|
18941
|
+
return consumed;
|
|
18942
|
+
};
|
|
18943
|
+
/**
|
|
18944
|
+
* Signal to the parser that the end of the input was reached.
|
|
18945
|
+
*
|
|
18946
|
+
* Remaining data will be emitted and relevant errors will be produced.
|
|
18947
|
+
*
|
|
18948
|
+
* @returns The number of characters consumed.
|
|
18949
|
+
*/
|
|
18950
|
+
EntityDecoder.prototype.end = function () {
|
|
18951
|
+
var _a;
|
|
18952
|
+
switch (this.state) {
|
|
18953
|
+
case EntityDecoderState.NamedEntity: {
|
|
18954
|
+
// Emit a named entity if we have one.
|
|
18955
|
+
return this.result !== 0 &&
|
|
18956
|
+
(this.decodeMode !== DecodingMode.Attribute ||
|
|
18957
|
+
this.result === this.treeIndex)
|
|
18958
|
+
? this.emitNotTerminatedNamedEntity()
|
|
18959
|
+
: 0;
|
|
18960
|
+
}
|
|
18961
|
+
// Otherwise, emit a numeric entity if we have one.
|
|
18962
|
+
case EntityDecoderState.NumericDecimal: {
|
|
18963
|
+
return this.emitNumericEntity(0, 2);
|
|
18964
|
+
}
|
|
18965
|
+
case EntityDecoderState.NumericHex: {
|
|
18966
|
+
return this.emitNumericEntity(0, 3);
|
|
18967
|
+
}
|
|
18968
|
+
case EntityDecoderState.NumericStart: {
|
|
18969
|
+
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
|
|
18970
|
+
return 0;
|
|
18971
|
+
}
|
|
18972
|
+
case EntityDecoderState.EntityStart: {
|
|
18973
|
+
// Return 0 if we have no entity.
|
|
18974
|
+
return 0;
|
|
18673
18975
|
}
|
|
18674
18976
|
}
|
|
18675
|
-
|
|
18977
|
+
};
|
|
18978
|
+
return EntityDecoder;
|
|
18979
|
+
}());
|
|
18980
|
+
exports.EntityDecoder = EntityDecoder;
|
|
18981
|
+
/**
|
|
18982
|
+
* Creates a function that decodes entities in a string.
|
|
18983
|
+
*
|
|
18984
|
+
* @param decodeTree The decode tree.
|
|
18985
|
+
* @returns A function that decodes entities in a string.
|
|
18986
|
+
*/
|
|
18987
|
+
function getDecoder(decodeTree) {
|
|
18988
|
+
var ret = "";
|
|
18989
|
+
var decoder = new EntityDecoder(decodeTree, function (str) { return (ret += (0, decode_codepoint_js_1.fromCodePoint)(str)); });
|
|
18990
|
+
return function decodeWithTrie(str, decodeMode) {
|
|
18991
|
+
var lastIndex = 0;
|
|
18992
|
+
var offset = 0;
|
|
18993
|
+
while ((offset = str.indexOf("&", offset)) >= 0) {
|
|
18994
|
+
ret += str.slice(lastIndex, offset);
|
|
18995
|
+
decoder.startEntity(decodeMode);
|
|
18996
|
+
var len = decoder.write(str,
|
|
18997
|
+
// Skip the "&"
|
|
18998
|
+
offset + 1);
|
|
18999
|
+
if (len < 0) {
|
|
19000
|
+
lastIndex = offset + decoder.end();
|
|
19001
|
+
break;
|
|
19002
|
+
}
|
|
19003
|
+
lastIndex = offset + len;
|
|
19004
|
+
// If `len` is 0, skip the current `&` and continue.
|
|
19005
|
+
offset = len === 0 ? lastIndex + 1 : lastIndex;
|
|
19006
|
+
}
|
|
19007
|
+
var result = ret + str.slice(lastIndex);
|
|
19008
|
+
// Make sure we don't keep a reference to the final string.
|
|
19009
|
+
ret = "";
|
|
19010
|
+
return result;
|
|
18676
19011
|
};
|
|
18677
19012
|
}
|
|
19013
|
+
/**
|
|
19014
|
+
* Determines the branch of the current node that is taken given the current
|
|
19015
|
+
* character. This function is used to traverse the trie.
|
|
19016
|
+
*
|
|
19017
|
+
* @param decodeTree The trie.
|
|
19018
|
+
* @param current The current node.
|
|
19019
|
+
* @param nodeIdx The index right after the current node and its value.
|
|
19020
|
+
* @param char The current character.
|
|
19021
|
+
* @returns The index of the next node, or -1 if no branch is taken.
|
|
19022
|
+
*/
|
|
18678
19023
|
function determineBranch(decodeTree, current, nodeIdx, char) {
|
|
18679
19024
|
var branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
|
|
18680
19025
|
var jumpOffset = current & BinTrieFlags.JUMP_TABLE;
|
|
@@ -18712,33 +19057,45 @@ exports.determineBranch = determineBranch;
|
|
|
18712
19057
|
var htmlDecoder = getDecoder(decode_data_html_js_1.default);
|
|
18713
19058
|
var xmlDecoder = getDecoder(decode_data_xml_js_1.default);
|
|
18714
19059
|
/**
|
|
18715
|
-
* Decodes an HTML string
|
|
19060
|
+
* Decodes an HTML string.
|
|
18716
19061
|
*
|
|
18717
19062
|
* @param str The string to decode.
|
|
19063
|
+
* @param mode The decoding mode.
|
|
18718
19064
|
* @returns The decoded string.
|
|
18719
19065
|
*/
|
|
18720
|
-
function decodeHTML(str) {
|
|
18721
|
-
|
|
19066
|
+
function decodeHTML(str, mode) {
|
|
19067
|
+
if (mode === void 0) { mode = DecodingMode.Legacy; }
|
|
19068
|
+
return htmlDecoder(str, mode);
|
|
18722
19069
|
}
|
|
18723
19070
|
exports.decodeHTML = decodeHTML;
|
|
18724
19071
|
/**
|
|
18725
|
-
* Decodes an HTML string
|
|
19072
|
+
* Decodes an HTML string in an attribute.
|
|
19073
|
+
*
|
|
19074
|
+
* @param str The string to decode.
|
|
19075
|
+
* @returns The decoded string.
|
|
19076
|
+
*/
|
|
19077
|
+
function decodeHTMLAttribute(str) {
|
|
19078
|
+
return htmlDecoder(str, DecodingMode.Attribute);
|
|
19079
|
+
}
|
|
19080
|
+
exports.decodeHTMLAttribute = decodeHTMLAttribute;
|
|
19081
|
+
/**
|
|
19082
|
+
* Decodes an HTML string, requiring all entities to be terminated by a semicolon.
|
|
18726
19083
|
*
|
|
18727
19084
|
* @param str The string to decode.
|
|
18728
19085
|
* @returns The decoded string.
|
|
18729
19086
|
*/
|
|
18730
19087
|
function decodeHTMLStrict(str) {
|
|
18731
|
-
return htmlDecoder(str,
|
|
19088
|
+
return htmlDecoder(str, DecodingMode.Strict);
|
|
18732
19089
|
}
|
|
18733
19090
|
exports.decodeHTMLStrict = decodeHTMLStrict;
|
|
18734
19091
|
/**
|
|
18735
|
-
* Decodes an XML string, requiring all entities to be terminated by a
|
|
19092
|
+
* Decodes an XML string, requiring all entities to be terminated by a semicolon.
|
|
18736
19093
|
*
|
|
18737
19094
|
* @param str The string to decode.
|
|
18738
19095
|
* @returns The decoded string.
|
|
18739
19096
|
*/
|
|
18740
19097
|
function decodeXML(str) {
|
|
18741
|
-
return xmlDecoder(str,
|
|
19098
|
+
return xmlDecoder(str, DecodingMode.Strict);
|
|
18742
19099
|
}
|
|
18743
19100
|
exports.decodeXML = decodeXML;
|
|
18744
19101
|
//# sourceMappingURL=decode.js.map
|
|
@@ -18756,6 +19113,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
18756
19113
|
exports.replaceCodePoint = exports.fromCodePoint = void 0;
|
|
18757
19114
|
var decodeMap = new Map([
|
|
18758
19115
|
[0, 65533],
|
|
19116
|
+
// C1 Unicode control character reference replacements
|
|
18759
19117
|
[128, 8364],
|
|
18760
19118
|
[130, 8218],
|
|
18761
19119
|
[131, 402],
|
|
@@ -18784,6 +19142,9 @@ var decodeMap = new Map([
|
|
|
18784
19142
|
[158, 382],
|
|
18785
19143
|
[159, 376],
|
|
18786
19144
|
]);
|
|
19145
|
+
/**
|
|
19146
|
+
* Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
|
|
19147
|
+
*/
|
|
18787
19148
|
exports.fromCodePoint =
|
|
18788
19149
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
|
|
18789
19150
|
(_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function (codePoint) {
|
|
@@ -18796,6 +19157,11 @@ exports.fromCodePoint =
|
|
|
18796
19157
|
output += String.fromCharCode(codePoint);
|
|
18797
19158
|
return output;
|
|
18798
19159
|
};
|
|
19160
|
+
/**
|
|
19161
|
+
* Replace the given code point with a replacement character if it is a
|
|
19162
|
+
* surrogate or is outside the valid range. Otherwise return the code
|
|
19163
|
+
* point unchanged.
|
|
19164
|
+
*/
|
|
18799
19165
|
function replaceCodePoint(codePoint) {
|
|
18800
19166
|
var _a;
|
|
18801
19167
|
if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
|
|
@@ -18804,6 +19170,13 @@ function replaceCodePoint(codePoint) {
|
|
|
18804
19170
|
return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;
|
|
18805
19171
|
}
|
|
18806
19172
|
exports.replaceCodePoint = replaceCodePoint;
|
|
19173
|
+
/**
|
|
19174
|
+
* Replace the code point if relevant, then convert it to a string.
|
|
19175
|
+
*
|
|
19176
|
+
* @deprecated Use `fromCodePoint(replaceCodePoint(codePoint))` instead.
|
|
19177
|
+
* @param codePoint The code point to decode.
|
|
19178
|
+
* @returns The decoded code point.
|
|
19179
|
+
*/
|
|
18807
19180
|
function decodeCodePoint(codePoint) {
|
|
18808
19181
|
return (0, exports.fromCodePoint)(replaceCodePoint(codePoint));
|
|
18809
19182
|
}
|
|
@@ -18878,7 +19251,7 @@ function encodeHTMLTrieRe(regExp, str) {
|
|
|
18878
19251
|
}
|
|
18879
19252
|
next = next.v;
|
|
18880
19253
|
}
|
|
18881
|
-
// We might have a tree node without a value; skip and use a numeric
|
|
19254
|
+
// We might have a tree node without a value; skip and use a numeric entity.
|
|
18882
19255
|
if (next !== undefined) {
|
|
18883
19256
|
ret += next;
|
|
18884
19257
|
lastIdx = i + 1;
|
|
@@ -18963,6 +19336,16 @@ exports.encodeXML = encodeXML;
|
|
|
18963
19336
|
* @param data String to escape.
|
|
18964
19337
|
*/
|
|
18965
19338
|
exports.escape = encodeXML;
|
|
19339
|
+
/**
|
|
19340
|
+
* Creates a function that escapes all characters matched by the given regular
|
|
19341
|
+
* expression using the given map of characters to escape to their entities.
|
|
19342
|
+
*
|
|
19343
|
+
* @param regex Regular expression to match characters to escape.
|
|
19344
|
+
* @param map Map of characters to escape to their entities.
|
|
19345
|
+
*
|
|
19346
|
+
* @returns Function that escapes all characters matched by the given regular
|
|
19347
|
+
* expression using the given map of characters to escape to their entities.
|
|
19348
|
+
*/
|
|
18966
19349
|
function getEscaper(regex, map) {
|
|
18967
19350
|
return function escape(data) {
|
|
18968
19351
|
var match;
|
|
@@ -18972,7 +19355,7 @@ function getEscaper(regex, map) {
|
|
|
18972
19355
|
if (lastIdx !== match.index) {
|
|
18973
19356
|
result += data.substring(lastIdx, match.index);
|
|
18974
19357
|
}
|
|
18975
|
-
// We know that this
|
|
19358
|
+
// We know that this character will be in the map.
|
|
18976
19359
|
result += map.get(match[0].charCodeAt(0));
|
|
18977
19360
|
// Every match will be of length 1
|
|
18978
19361
|
lastIdx = match.index + 1;
|
|
@@ -19072,7 +19455,7 @@ exports["default"] = new Map(/* #__PURE__ */ restoreDiff([[9, "	"], [0, "&Ne
|
|
|
19072
19455
|
"use strict";
|
|
19073
19456
|
|
|
19074
19457
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
19075
|
-
exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.encodeHTML5 = exports.encodeHTML4 = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.escapeText = exports.escapeAttribute = exports.escapeUTF8 = exports.escape = exports.encodeXML = exports.encode = exports.decodeStrict = exports.decode = exports.EncodingMode = exports.
|
|
19458
|
+
exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLAttribute = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.DecodingMode = exports.EntityDecoder = exports.encodeHTML5 = exports.encodeHTML4 = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.escapeText = exports.escapeAttribute = exports.escapeUTF8 = exports.escape = exports.encodeXML = exports.encode = exports.decodeStrict = exports.decode = exports.EncodingMode = exports.EntityLevel = void 0;
|
|
19076
19459
|
var decode_js_1 = __webpack_require__(96800);
|
|
19077
19460
|
var encode_js_1 = __webpack_require__(22400);
|
|
19078
19461
|
var escape_js_1 = __webpack_require__(88338);
|
|
@@ -19084,14 +19467,6 @@ var EntityLevel;
|
|
|
19084
19467
|
/** Support HTML entities, which are a superset of XML entities. */
|
|
19085
19468
|
EntityLevel[EntityLevel["HTML"] = 1] = "HTML";
|
|
19086
19469
|
})(EntityLevel = exports.EntityLevel || (exports.EntityLevel = {}));
|
|
19087
|
-
/** Determines whether some entities are allowed to be written without a trailing `;`. */
|
|
19088
|
-
var DecodingMode;
|
|
19089
|
-
(function (DecodingMode) {
|
|
19090
|
-
/** Support legacy HTML entities. */
|
|
19091
|
-
DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy";
|
|
19092
|
-
/** Do not support legacy HTML entities. */
|
|
19093
|
-
DecodingMode[DecodingMode["Strict"] = 1] = "Strict";
|
|
19094
|
-
})(DecodingMode = exports.DecodingMode || (exports.DecodingMode = {}));
|
|
19095
19470
|
var EncodingMode;
|
|
19096
19471
|
(function (EncodingMode) {
|
|
19097
19472
|
/**
|
|
@@ -19129,12 +19504,10 @@ var EncodingMode;
|
|
|
19129
19504
|
*/
|
|
19130
19505
|
function decode(data, options) {
|
|
19131
19506
|
if (options === void 0) { options = EntityLevel.XML; }
|
|
19132
|
-
var
|
|
19133
|
-
if (
|
|
19134
|
-
|
|
19135
|
-
|
|
19136
|
-
}
|
|
19137
|
-
return (0, decode_js_1.decodeHTML)(data);
|
|
19507
|
+
var level = typeof options === "number" ? options : options.level;
|
|
19508
|
+
if (level === EntityLevel.HTML) {
|
|
19509
|
+
var mode = typeof options === "object" ? options.mode : undefined;
|
|
19510
|
+
return (0, decode_js_1.decodeHTML)(data, mode);
|
|
19138
19511
|
}
|
|
19139
19512
|
return (0, decode_js_1.decodeXML)(data);
|
|
19140
19513
|
}
|
|
@@ -19147,15 +19520,11 @@ exports.decode = decode;
|
|
|
19147
19520
|
* @deprecated Use `decode` with the `mode` set to `Strict`.
|
|
19148
19521
|
*/
|
|
19149
19522
|
function decodeStrict(data, options) {
|
|
19523
|
+
var _a;
|
|
19150
19524
|
if (options === void 0) { options = EntityLevel.XML; }
|
|
19151
19525
|
var opts = typeof options === "number" ? { level: options } : options;
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
return (0, decode_js_1.decodeHTML)(data);
|
|
19155
|
-
}
|
|
19156
|
-
return (0, decode_js_1.decodeHTMLStrict)(data);
|
|
19157
|
-
}
|
|
19158
|
-
return (0, decode_js_1.decodeXML)(data);
|
|
19526
|
+
(_a = opts.mode) !== null && _a !== void 0 ? _a : (opts.mode = decode_js_1.DecodingMode.Strict);
|
|
19527
|
+
return decode(data, opts);
|
|
19159
19528
|
}
|
|
19160
19529
|
exports.decodeStrict = decodeStrict;
|
|
19161
19530
|
/**
|
|
@@ -19197,9 +19566,12 @@ Object.defineProperty(exports, "encodeNonAsciiHTML", ({ enumerable: true, get: f
|
|
|
19197
19566
|
Object.defineProperty(exports, "encodeHTML4", ({ enumerable: true, get: function () { return encode_js_2.encodeHTML; } }));
|
|
19198
19567
|
Object.defineProperty(exports, "encodeHTML5", ({ enumerable: true, get: function () { return encode_js_2.encodeHTML; } }));
|
|
19199
19568
|
var decode_js_2 = __webpack_require__(96800);
|
|
19569
|
+
Object.defineProperty(exports, "EntityDecoder", ({ enumerable: true, get: function () { return decode_js_2.EntityDecoder; } }));
|
|
19570
|
+
Object.defineProperty(exports, "DecodingMode", ({ enumerable: true, get: function () { return decode_js_2.DecodingMode; } }));
|
|
19200
19571
|
Object.defineProperty(exports, "decodeXML", ({ enumerable: true, get: function () { return decode_js_2.decodeXML; } }));
|
|
19201
19572
|
Object.defineProperty(exports, "decodeHTML", ({ enumerable: true, get: function () { return decode_js_2.decodeHTML; } }));
|
|
19202
19573
|
Object.defineProperty(exports, "decodeHTMLStrict", ({ enumerable: true, get: function () { return decode_js_2.decodeHTMLStrict; } }));
|
|
19574
|
+
Object.defineProperty(exports, "decodeHTMLAttribute", ({ enumerable: true, get: function () { return decode_js_2.decodeHTMLAttribute; } }));
|
|
19203
19575
|
// Legacy aliases (deprecated)
|
|
19204
19576
|
Object.defineProperty(exports, "decodeHTML4", ({ enumerable: true, get: function () { return decode_js_2.decodeHTML; } }));
|
|
19205
19577
|
Object.defineProperty(exports, "decodeHTML5", ({ enumerable: true, get: function () { return decode_js_2.decodeHTML; } }));
|