axyseo 2.0.0-alpha.0.0.20 → 2.0.0-alpha.0.0.22
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/build/index.js +1 -4
- package/build/index.js.map +1 -1
- package/build/languageProcessing/helpers/html/normalizeHTML.js +3 -3
- package/build/languageProcessing/helpers/html/normalizeHTML.js.map +1 -1
- package/build/languageProcessing/languages/en/config/abbreviations.js +2 -2
- package/build/languageProcessing/languages/en/config/abbreviations.js.map +1 -1
- package/build/languageProcessing/languages/it/helpers/calculateFleschReadingScore.js +2 -2
- package/build/languageProcessing/languages/it/helpers/calculateFleschReadingScore.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/calculateFleschReadingScore.js +2 -2
- package/build/languageProcessing/languages/nl/helpers/calculateFleschReadingScore.js.map +1 -1
- package/build/languageProcessing/languages/pt/helpers/calculateFleschReadingScore.js +2 -2
- package/build/languageProcessing/languages/pt/helpers/calculateFleschReadingScore.js.map +1 -1
- package/build/languageProcessing/languages/ru/helpers/calculateFleschReadingScore.js +2 -2
- package/build/languageProcessing/languages/ru/helpers/calculateFleschReadingScore.js.map +1 -1
- package/package.json +1 -1
- package/build/bundledPlugins/index.js +0 -14
- package/build/bundledPlugins/index.js.map +0 -1
- package/build/bundledPlugins/previouslyUsedKeywords.js +0 -171
- package/build/bundledPlugins/previouslyUsedKeywords.js.map +0 -1
package/build/index.js
CHANGED
|
@@ -57,11 +57,9 @@ Object.defineProperty(exports, "SeoAssessor", {
|
|
|
57
57
|
return _seoAssessor.default;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
exports.values = exports.markers = exports.languageProcessing = exports.interpreters = exports.helpers = exports.default = exports.
|
|
60
|
+
exports.values = exports.markers = exports.languageProcessing = exports.interpreters = exports.helpers = exports.default = exports.assessors = exports.assessments = void 0;
|
|
61
61
|
var assessments = _interopRequireWildcard(require("./scoring/assessments"));
|
|
62
62
|
exports.assessments = assessments;
|
|
63
|
-
var bundledPlugins = _interopRequireWildcard(require("./bundledPlugins"));
|
|
64
|
-
exports.bundledPlugins = bundledPlugins;
|
|
65
63
|
var helpers = _interopRequireWildcard(require("./helpers"));
|
|
66
64
|
exports.helpers = helpers;
|
|
67
65
|
var markers = _interopRequireWildcard(require("./markers"));
|
|
@@ -101,7 +99,6 @@ var _default = exports.default = {
|
|
|
101
99
|
Paper: _Paper.default,
|
|
102
100
|
AssessmentResult: _AssessmentResult.default,
|
|
103
101
|
assessments,
|
|
104
|
-
bundledPlugins,
|
|
105
102
|
helpers,
|
|
106
103
|
markers,
|
|
107
104
|
interpreters,
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["assessments","_interopRequireWildcard","require","exports","
|
|
1
|
+
{"version":3,"file":"index.js","names":["assessments","_interopRequireWildcard","require","exports","helpers","markers","interpreters","languageProcessing","values","assessors","_assessor","_interopRequireDefault","_avadaAssessor","_contentAssessor","_seoAssessor","_Paper","_AssessmentResult","_assessment","_getFleschReadingScore","_factory","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_default","Assessor","ContentAssessor","SeoAssessor","AvadaAssessor","Paper","AssessmentResult"],"sources":["../src/index.js"],"sourcesContent":["import * as assessments from './scoring/assessments';\nimport * as helpers from './helpers';\nimport * as markers from './markers';\nimport * as interpreters from './scoring/interpreters';\nimport * as languageProcessing from './languageProcessing';\nimport * as values from './values';\nimport * as assessors from './scoring/assessors';\nimport Assessor from './scoring/assessors/assessor';\nimport AvadaAssessor from './scoring/assessors/avadaAssessor';\nimport ContentAssessor from './scoring/assessors/contentAssessor';\nimport SeoAssessor from './scoring/assessors/seoAssessor';\nimport Paper from './values/Paper';\nimport AssessmentResult from './values/AssessmentResult';\nimport Assessment from './scoring/assessments/assessment';\nimport {DIFFICULTY} from './languageProcessing/researches/getFleschReadingScore';\n\nimport Factory from './helpers/factory';\n\n/*\n * Everything exported here is put on the `yoast.analysis` global in the plugin.\n */\nexport {\n Assessor,\n ContentAssessor,\n SeoAssessor,\n AvadaAssessor,\n Paper,\n AssessmentResult,\n Assessment,\n assessments,\n assessors,\n helpers,\n markers,\n interpreters,\n languageProcessing,\n values,\n DIFFICULTY,\n Factory\n};\n\n/*\n * Used for backwards compatibility reasons.\n * For new exports, please add it as a named dependency above instead.\n */\nexport default {\n Assessor,\n ContentAssessor,\n SeoAssessor,\n AvadaAssessor,\n\n Paper,\n AssessmentResult,\n\n assessments,\n helpers,\n markers,\n interpreters,\n languageProcessing,\n values\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAqDC,OAAA,CAAAH,WAAA,GAAAA,WAAA;AACrD,IAAAI,OAAA,GAAAH,uBAAA,CAAAC,OAAA;AAAqCC,OAAA,CAAAC,OAAA,GAAAA,OAAA;AACrC,IAAAC,OAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAAqCC,OAAA,CAAAE,OAAA,GAAAA,OAAA;AACrC,IAAAC,YAAA,GAAAL,uBAAA,CAAAC,OAAA;AAAuDC,OAAA,CAAAG,YAAA,GAAAA,YAAA;AACvD,IAAAC,kBAAA,GAAAN,uBAAA,CAAAC,OAAA;AAA2DC,OAAA,CAAAI,kBAAA,GAAAA,kBAAA;AAC3D,IAAAC,MAAA,GAAAP,uBAAA,CAAAC,OAAA;AAAmCC,OAAA,CAAAK,MAAA,GAAAA,MAAA;AACnC,IAAAC,SAAA,GAAAR,uBAAA,CAAAC,OAAA;AAAiDC,OAAA,CAAAM,SAAA,GAAAA,SAAA;AACjD,IAAAC,SAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,cAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,gBAAA,GAAAF,sBAAA,CA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CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAf,CAAA,CAAAe,CAAA,YAAAN,CAAA,CAAAP,OAAA,GAAAF,CAAA,EAAAM,CAAA,IAAAA,CAAA,CAAAa,GAAA,CAAAnB,CAAA,EAAAS,CAAA,GAAAA,CAAA;AAExC;AACA;AACA;AAoBA;AACA;AACA;AACA;AAHA,IAAAW,QAAA,GAAArC,OAAA,CAAAmB,OAAA,GAIe;EACbmB,QAAQ,EAARA,iBAAQ;EACRC,eAAe,EAAfA,wBAAe;EACfC,WAAW,EAAXA,oBAAW;EACXC,aAAa,EAAbA,sBAAa;EAEbC,KAAK,EAALA,cAAK;EACLC,gBAAgB,EAAhBA,yBAAgB;EAEhB9C,WAAW;EACXI,OAAO;EACPC,OAAO;EACPC,YAAY;EACZC,kBAAkB;EAClBC;AACF,CAAC","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = _default;
|
|
7
7
|
/**
|
|
8
8
|
* Replaces single quotes around HTML attribute values with double quotes.
|
|
9
|
-
* Double quotes are the standard, but we convert these to single quotes when parsing the HTML in `
|
|
9
|
+
* Double quotes are the standard, but we convert these to single quotes when parsing the HTML in `@axyseo` package.
|
|
10
10
|
* Here, we change them back to double quotes so by parsing the HTML and then outputting it again.
|
|
11
11
|
* Note that this function does more than just replacing single quotes with double quotes. It also restores corrupted HTML.
|
|
12
12
|
* @param {string} str The input string.
|
|
@@ -14,10 +14,10 @@ exports.default = _default;
|
|
|
14
14
|
* @returns {string} The string with single quotes around HTML attributes replaced with double quotes.
|
|
15
15
|
*/
|
|
16
16
|
function _default(str) {
|
|
17
|
-
const doc = new DOMParser().parseFromString(str,
|
|
17
|
+
const doc = new DOMParser().parseFromString(str, 'text/html');
|
|
18
18
|
const normalizedHTML = doc.body.innerHTML;
|
|
19
19
|
|
|
20
20
|
// Replace ` ` with an actual non breaking space (U+00A0).
|
|
21
|
-
return normalizedHTML.replace(/ /g,
|
|
21
|
+
return normalizedHTML.replace(/ /g, '\u00A0');
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=normalizeHTML.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeHTML.js","names":["_default","str","doc","DOMParser","parseFromString","normalizedHTML","body","innerHTML","replace"],"sources":["../../../../src/languageProcessing/helpers/html/normalizeHTML.js"],"sourcesContent":["/**\n * Replaces single quotes around HTML attribute values with double quotes.\n * Double quotes are the standard, but we convert these to single quotes when parsing the HTML in `
|
|
1
|
+
{"version":3,"file":"normalizeHTML.js","names":["_default","str","doc","DOMParser","parseFromString","normalizedHTML","body","innerHTML","replace"],"sources":["../../../../src/languageProcessing/helpers/html/normalizeHTML.js"],"sourcesContent":["/**\n * Replaces single quotes around HTML attribute values with double quotes.\n * Double quotes are the standard, but we convert these to single quotes when parsing the HTML in `@axyseo` package.\n * Here, we change them back to double quotes so by parsing the HTML and then outputting it again.\n * Note that this function does more than just replacing single quotes with double quotes. It also restores corrupted HTML.\n * @param {string} str The input string.\n *\n * @returns {string} The string with single quotes around HTML attributes replaced with double quotes.\n */\nexport default function(str) {\n const doc = new DOMParser().parseFromString(str, 'text/html');\n const normalizedHTML = doc.body.innerHTML;\n\n // Replace ` ` with an actual non breaking space (U+00A0).\n return normalizedHTML.replace(/ /g, '\\u00A0');\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAAA,SAASC,GAAG,EAAE;EAC3B,MAAMC,GAAG,GAAG,IAAIC,SAAS,CAAC,CAAC,CAACC,eAAe,CAACH,GAAG,EAAE,WAAW,CAAC;EAC7D,MAAMI,cAAc,GAAGH,GAAG,CAACI,IAAI,CAACC,SAAS;;EAEzC;EACA,OAAOF,cAAc,CAACG,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC;AACpD","ignoreList":[]}
|
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
/**
|
|
8
|
-
* Returns a list with abbreviations. Originally created for use in
|
|
8
|
+
* Returns a list with abbreviations. Originally created for use in @axyseo/src/languageProcessing/helpers/sentence/SentenceTokenizer.js
|
|
9
9
|
* Abbreviations were originally sourced from: https://github.com/Yoast/YoastSEO.js/issues/698
|
|
10
10
|
* IMPORTANT! For the use in the SentenceTokenizer it is important that:
|
|
11
11
|
* - all abbreviations end in a full stop.
|
|
12
12
|
* - all abbreviations should contain more than one letter to prevent clashes with the check for initials.
|
|
13
13
|
* @type {Array} The list with abbreviations.
|
|
14
14
|
*/
|
|
15
|
-
var _default = exports.default = [
|
|
15
|
+
var _default = exports.default = ['A.D.', 'Adm.', 'Adv.', 'B.C.', 'Br.', 'Brig.', 'Cmrd.', 'Col.', 'Cpl.', 'Cpt.', 'Dr.', 'Esq.', 'Fr.', 'Gen.', 'Gov.', 'Hon.', 'Jr.', 'Lieut.', 'Lt.', 'Maj.', 'Mr.', 'Mrs.', 'Ms.', 'Msgr.', 'Mx.', 'No.', 'Pfc.', 'Pr.', 'Prof.', 'Pvt.', 'Rep.', 'Reps.', 'Rev.', 'Rt. Hon.', 'Sen.', 'Sens.', 'Sgt.', 'Sps.', 'Sr.', 'St.', 'vs.', 'i.e.', 'e.g.', 'viz.', 'Mt.'];
|
|
16
16
|
//# sourceMappingURL=abbreviations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abbreviations.js","names":["_default","exports","default"],"sources":["../../../../../src/languageProcessing/languages/en/config/abbreviations.js"],"sourcesContent":["/**\n * Returns a list with abbreviations. Originally created for use in
|
|
1
|
+
{"version":3,"file":"abbreviations.js","names":["_default","exports","default"],"sources":["../../../../../src/languageProcessing/languages/en/config/abbreviations.js"],"sourcesContent":["/**\n * Returns a list with abbreviations. Originally created for use in @axyseo/src/languageProcessing/helpers/sentence/SentenceTokenizer.js\n * Abbreviations were originally sourced from: https://github.com/Yoast/YoastSEO.js/issues/698\n * IMPORTANT! For the use in the SentenceTokenizer it is important that:\n * - all abbreviations end in a full stop.\n * - all abbreviations should contain more than one letter to prevent clashes with the check for initials.\n * @type {Array} The list with abbreviations.\n */\nexport default [\n 'A.D.',\n 'Adm.',\n 'Adv.',\n 'B.C.',\n 'Br.',\n 'Brig.',\n 'Cmrd.',\n 'Col.',\n 'Cpl.',\n 'Cpt.',\n 'Dr.',\n 'Esq.',\n 'Fr.',\n 'Gen.',\n 'Gov.',\n 'Hon.',\n 'Jr.',\n 'Lieut.',\n 'Lt.',\n 'Maj.',\n 'Mr.',\n 'Mrs.',\n 'Ms.',\n 'Msgr.',\n 'Mx.',\n 'No.',\n 'Pfc.',\n 'Pr.',\n 'Prof.',\n 'Pvt.',\n 'Rep.',\n 'Reps.',\n 'Rev.',\n 'Rt. Hon.',\n 'Sen.',\n 'Sens.',\n 'Sgt.',\n 'Sps.',\n 'Sr.',\n 'St.',\n 'vs.',\n 'i.e.',\n 'e.g.',\n 'viz.',\n 'Mt.'\n];\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAAAA,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAQe,CACb,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACL,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,KAAK,EACL,OAAO,EACP,KAAK,EACL,KAAK,EACL,MAAM,EACN,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,UAAU,EACV,MAAM,EACN,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,CACN","ignoreList":[]}
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = calculateScore;
|
|
7
|
-
var
|
|
7
|
+
var _index = require("../../../../index.js");
|
|
8
8
|
const {
|
|
9
9
|
formatNumber
|
|
10
|
-
} =
|
|
10
|
+
} = _index.helpers;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Returns the Flesch reading score for Italian.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateFleschReadingScore.js","names":["
|
|
1
|
+
{"version":3,"file":"calculateFleschReadingScore.js","names":["_index","require","formatNumber","helpers","calculateScore","statistics","score","averageWordsPerSentence","syllablesPer100Words"],"sources":["../../../../../src/languageProcessing/languages/it/helpers/calculateFleschReadingScore.js"],"sourcesContent":["import {helpers} from '@axyseo/index.js';\nconst {formatNumber} = helpers;\n\n/**\n * Returns the Flesch reading score for Italian.\n *\n * @param {Object} statistics The Flesch reading statistics.\n *\n * @returns {number} The Flesch reading score for Italian.\n */\nexport default function calculateScore(statistics) {\n const score =\n 217 - 1.3 * statistics.averageWordsPerSentence - 0.6 * statistics.syllablesPer100Words;\n\n return formatNumber(score);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,MAAM;EAACC;AAAY,CAAC,GAAGC,cAAO;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,cAAcA,CAACC,UAAU,EAAE;EACjD,MAAMC,KAAK,GACT,GAAG,GAAG,GAAG,GAAGD,UAAU,CAACE,uBAAuB,GAAG,GAAG,GAAGF,UAAU,CAACG,oBAAoB;EAExF,OAAON,YAAY,CAACI,KAAK,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = calculateScore;
|
|
7
|
-
var
|
|
7
|
+
var _index = require("../../../../index.js");
|
|
8
8
|
const {
|
|
9
9
|
formatNumber
|
|
10
|
-
} =
|
|
10
|
+
} = _index.helpers;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Returns the Flesch reading score for Dutch.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateFleschReadingScore.js","names":["
|
|
1
|
+
{"version":3,"file":"calculateFleschReadingScore.js","names":["_index","require","formatNumber","helpers","calculateScore","statistics","score","syllablesPer100Words","averageWordsPerSentence"],"sources":["../../../../../src/languageProcessing/languages/nl/helpers/calculateFleschReadingScore.js"],"sourcesContent":["import {helpers} from '@axyseo/index.js';\nconst {formatNumber} = helpers;\n\n/**\n * Returns the Flesch reading score for Dutch.\n *\n * @param {Object} statistics The Flesch reading statistics.\n *\n * @returns {number} The Flesch reading score for Dutch.\n */\nexport default function calculateScore(statistics) {\n const score =\n 206.84 - 0.77 * statistics.syllablesPer100Words - 0.93 * statistics.averageWordsPerSentence;\n\n return formatNumber(score);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,MAAM;EAACC;AAAY,CAAC,GAAGC,cAAO;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,cAAcA,CAACC,UAAU,EAAE;EACjD,MAAMC,KAAK,GACT,MAAM,GAAG,IAAI,GAAGD,UAAU,CAACE,oBAAoB,GAAG,IAAI,GAAGF,UAAU,CAACG,uBAAuB;EAE7F,OAAON,YAAY,CAACI,KAAK,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = calculateScore;
|
|
7
|
-
var
|
|
7
|
+
var _index = require("../../../../index.js");
|
|
8
8
|
const {
|
|
9
9
|
formatNumber
|
|
10
|
-
} =
|
|
10
|
+
} = _index.helpers;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Returns the Flesch reading score for Portuguese.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateFleschReadingScore.js","names":["
|
|
1
|
+
{"version":3,"file":"calculateFleschReadingScore.js","names":["_index","require","formatNumber","helpers","calculateScore","statistics","score","averageWordsPerSentence","numberOfSyllables","numberOfWords"],"sources":["../../../../../src/languageProcessing/languages/pt/helpers/calculateFleschReadingScore.js"],"sourcesContent":["import {helpers} from '@axyseo/index.js';\nconst {formatNumber} = helpers;\n\n/**\n * Returns the Flesch reading score for Portuguese.\n *\n * @param {Object} statistics The Flesch reading statistics.\n *\n * @returns {number} The Flesch reading score for Portuguese.\n */\nexport default function calculateScore(statistics) {\n const score =\n 248.835 -\n 1.015 * statistics.averageWordsPerSentence -\n (84.6 * statistics.numberOfSyllables) / statistics.numberOfWords;\n\n return formatNumber(score);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,MAAM;EAACC;AAAY,CAAC,GAAGC,cAAO;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,cAAcA,CAACC,UAAU,EAAE;EACjD,MAAMC,KAAK,GACT,OAAO,GACP,KAAK,GAAGD,UAAU,CAACE,uBAAuB,GACzC,IAAI,GAAGF,UAAU,CAACG,iBAAiB,GAAIH,UAAU,CAACI,aAAa;EAElE,OAAOP,YAAY,CAACI,KAAK,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = calculateScore;
|
|
7
|
-
var
|
|
7
|
+
var _index = require("../../../../index.js");
|
|
8
8
|
const {
|
|
9
9
|
formatNumber
|
|
10
|
-
} =
|
|
10
|
+
} = _index.helpers;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Returns the Flesch reading score for Russian.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateFleschReadingScore.js","names":["
|
|
1
|
+
{"version":3,"file":"calculateFleschReadingScore.js","names":["_index","require","formatNumber","helpers","calculateScore","statistics","score","numberOfWords","numberOfSentences","numberOfSyllables"],"sources":["../../../../../src/languageProcessing/languages/ru/helpers/calculateFleschReadingScore.js"],"sourcesContent":["import {helpers} from '@axyseo/index.js';\nconst {formatNumber} = helpers;\n\n/**\n * Returns the Flesch reading score for Russian.\n *\n * @param {Object} statistics The Flesch reading statistics.\n *\n * @returns {number} The Flesch reading score for Russian.\n */\nexport default function calculateScore(statistics) {\n const score =\n 206.835 -\n (1.3 * statistics.numberOfWords) / statistics.numberOfSentences -\n (60.1 * statistics.numberOfSyllables) / statistics.numberOfWords;\n\n return formatNumber(score);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,MAAM;EAACC;AAAY,CAAC,GAAGC,cAAO;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,cAAcA,CAACC,UAAU,EAAE;EACjD,MAAMC,KAAK,GACT,OAAO,GACN,GAAG,GAAGD,UAAU,CAACE,aAAa,GAAIF,UAAU,CAACG,iBAAiB,GAC9D,IAAI,GAAGH,UAAU,CAACI,iBAAiB,GAAIJ,UAAU,CAACE,aAAa;EAElE,OAAOL,YAAY,CAACI,KAAK,CAAC;AAC5B","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "usedKeywords", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _previouslyUsedKeywords.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _previouslyUsedKeywords = _interopRequireDefault(require("./previouslyUsedKeywords"));
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_previouslyUsedKeywords","_interopRequireDefault","require","e","__esModule","default"],"sources":["../../src/bundledPlugins/index.js"],"sourcesContent":["import usedKeywords from \"./previouslyUsedKeywords\";\n\nexport {\n\tusedKeywords,\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoD,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _i18n = require("@wordpress/i18n");
|
|
8
|
-
var _lodash = require("lodash");
|
|
9
|
-
var _missingArgument = _interopRequireDefault(require("../errors/missingArgument"));
|
|
10
|
-
var _helpers = require("../helpers");
|
|
11
|
-
var _AssessmentResult = _interopRequireDefault(require("../values/AssessmentResult.js"));
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
/**
|
|
14
|
-
* The PreviouslyUsedKeyword plugin allows to check for previously used keywords.
|
|
15
|
-
*/
|
|
16
|
-
class PreviouslyUsedKeyword {
|
|
17
|
-
/**
|
|
18
|
-
* Constructs a new PreviouslyUsedKeyword plugin.
|
|
19
|
-
*
|
|
20
|
-
* @param {object} app The app.
|
|
21
|
-
* @param {object} args An arguments object.
|
|
22
|
-
* @param {object} args.usedKeywords An object with keywords and ids where they are used.
|
|
23
|
-
* @param {object} args.usedKeywordsPostTypes An object with the post types of the post ids from usedKeywords.
|
|
24
|
-
* @param {string} args.searchUrl The url used to link to a search page when multiple usages of the keyword are found.
|
|
25
|
-
* @param {string} args.postUrl The url used to link to a post when 1 usage of the keyword is found.
|
|
26
|
-
*
|
|
27
|
-
* @constructor
|
|
28
|
-
*/
|
|
29
|
-
constructor(app, args) {
|
|
30
|
-
if ((0, _lodash.isUndefined)(app)) {
|
|
31
|
-
throw new _missingArgument.default("The previously keyword plugin requires the YoastSEO app");
|
|
32
|
-
}
|
|
33
|
-
if ((0, _lodash.isUndefined)(args)) {
|
|
34
|
-
args = {
|
|
35
|
-
usedKeywords: {},
|
|
36
|
-
usedKeywordsPostTypes: {},
|
|
37
|
-
searchUrl: "",
|
|
38
|
-
postUrl: ""
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
this.app = app;
|
|
42
|
-
this.usedKeywords = args.usedKeywords;
|
|
43
|
-
this.usedKeywordsPostTypes = args.usedKeywordsPostTypes;
|
|
44
|
-
this.searchUrl = args.searchUrl;
|
|
45
|
-
this.postUrl = args.postUrl;
|
|
46
|
-
this.urlTitle = (0, _helpers.createAnchorOpeningTag)("https://yoa.st/33x");
|
|
47
|
-
this.urlCallToAction = (0, _helpers.createAnchorOpeningTag)("https://yoa.st/33y");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Registers the assessment with the assessor.
|
|
52
|
-
*
|
|
53
|
-
* @returns {void}
|
|
54
|
-
*/
|
|
55
|
-
registerPlugin() {
|
|
56
|
-
this.app.registerAssessment("usedKeywords", {
|
|
57
|
-
getResult: this.assess.bind(this),
|
|
58
|
-
/**
|
|
59
|
-
* Checks if the paper has a keyphrase, which is a prerequisite for the assessment to run.
|
|
60
|
-
*
|
|
61
|
-
* @param {Paper} paper The paper.
|
|
62
|
-
*
|
|
63
|
-
* @returns {boolean} Whether the paper has a keyphrase.
|
|
64
|
-
*/
|
|
65
|
-
isApplicable: function (paper) {
|
|
66
|
-
return paper.hasKeyword();
|
|
67
|
-
}
|
|
68
|
-
}, "previouslyUsedKeywords");
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Updates the usedKeywords.
|
|
73
|
-
*
|
|
74
|
-
* @param {object} usedKeywords An object with keywords and ids where they are used.
|
|
75
|
-
* @param {object} usedKeywordsPostTypes An object with keywords and in which post types they are used.
|
|
76
|
-
* The post types correspond with the ids in the usedKeywords parameter.
|
|
77
|
-
* @returns {void}
|
|
78
|
-
*/
|
|
79
|
-
updateKeywordUsage(usedKeywords, usedKeywordsPostTypes) {
|
|
80
|
-
this.usedKeywords = usedKeywords;
|
|
81
|
-
this.usedKeywordsPostTypes = usedKeywordsPostTypes;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Scores the previously used keyword assessment based on the count.
|
|
86
|
-
*
|
|
87
|
-
* @param {object} previouslyUsedKeywords The result of the previously used keywords research
|
|
88
|
-
* @param {Paper} paper The paper object to research.
|
|
89
|
-
* @returns {{text: string, score: number}} The result object with a feedback text and a score.
|
|
90
|
-
*/
|
|
91
|
-
scoreAssessment(previouslyUsedKeywords, paper) {
|
|
92
|
-
const count = previouslyUsedKeywords.count;
|
|
93
|
-
const id = previouslyUsedKeywords.id;
|
|
94
|
-
const postTypeToDisplay = previouslyUsedKeywords.postTypeToDisplay;
|
|
95
|
-
let url;
|
|
96
|
-
if (count === 0) {
|
|
97
|
-
return {
|
|
98
|
-
text: (0, _i18n.sprintf)(
|
|
99
|
-
/* translators:
|
|
100
|
-
%1$s expands to a link to an article on yoast.com,
|
|
101
|
-
%2$s expands to an anchor end tag. */
|
|
102
|
-
(0, _i18n.__)("%1$sPreviously used keyphrase%2$s: You've not used this keyphrase before, very good.", "wordpress-seo"), this.urlTitle, "</a>"),
|
|
103
|
-
score: 9
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
if (count === 1) {
|
|
107
|
-
url = `<a href='${this.postUrl.replace("{id}", id)}' target='_blank'>`;
|
|
108
|
-
return {
|
|
109
|
-
/* translators: %1$s expands to an admin link where the keyphrase is already used,
|
|
110
|
-
%2$s expands to the anchor end tag, %3$s and %4$s expand to links on yoast.com. */
|
|
111
|
-
text: (0, _i18n.sprintf)((0, _i18n.__)("%3$sPreviously used keyphrase%2$s: You've used this keyphrase %1$sonce before%2$s. %4$sDo not use your keyphrase more than once%2$s.", "wordpress-seo"), url, "</a>", this.urlTitle, this.urlCallToAction),
|
|
112
|
-
score: 6
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
if (count > 1) {
|
|
116
|
-
if (postTypeToDisplay) {
|
|
117
|
-
url = `<a href='${this.searchUrl.replace("{keyword}", encodeURIComponent(paper.getKeyword()))}&post_type=${postTypeToDisplay}' target='_blank'>`;
|
|
118
|
-
} else {
|
|
119
|
-
url = `<a href='${this.searchUrl.replace("{keyword}", encodeURIComponent(paper.getKeyword()))}' target='_blank'>`;
|
|
120
|
-
}
|
|
121
|
-
return {
|
|
122
|
-
/* translators: %1$s expands to a link to the admin search page for the keyphrase,
|
|
123
|
-
%2$s expands to the anchor end tag, %3$s and %4$s expand to links to yoast.com */
|
|
124
|
-
text: (0, _i18n.sprintf)((0, _i18n.__)("%3$sPreviously used keyphrase%2$s: You've used this keyphrase %1$smultiple times before%2$s. %4$sDo not use your keyphrase more than once%2$s.", "wordpress-seo"), url, "</a>", this.urlTitle, this.urlCallToAction),
|
|
125
|
-
score: 1
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Researches the previously used keywords, based on the used keywords and the keyword in the paper.
|
|
132
|
-
*
|
|
133
|
-
* @param {Paper} paper The paper object to research.
|
|
134
|
-
* @returns {{id: number, count: number}} The object with the count and the id of the previously used keyword
|
|
135
|
-
*/
|
|
136
|
-
researchPreviouslyUsedKeywords(paper) {
|
|
137
|
-
const keyword = paper.getKeyword();
|
|
138
|
-
let count = 0;
|
|
139
|
-
let postTypeToDisplay = "";
|
|
140
|
-
let id = 0;
|
|
141
|
-
if (!(0, _lodash.isUndefined)(this.usedKeywords[keyword]) && this.usedKeywords[keyword].length > 0) {
|
|
142
|
-
count = this.usedKeywords[keyword].length;
|
|
143
|
-
if (keyword in this.usedKeywordsPostTypes) {
|
|
144
|
-
postTypeToDisplay = this.usedKeywordsPostTypes[keyword][0];
|
|
145
|
-
}
|
|
146
|
-
id = this.usedKeywords[keyword][0];
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
id: id,
|
|
150
|
-
count: count,
|
|
151
|
-
postTypeToDisplay: postTypeToDisplay
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Executes the assessment that checks whether a text uses previously used keywords.
|
|
157
|
-
*
|
|
158
|
-
* @param {Paper} paper The Paper object to assess.
|
|
159
|
-
* @returns {AssessmentResult} The assessment result containing both a score and a descriptive text.
|
|
160
|
-
*/
|
|
161
|
-
assess(paper) {
|
|
162
|
-
const previouslyUsedKeywords = this.researchPreviouslyUsedKeywords(paper);
|
|
163
|
-
const previouslyUsedKeywordsResult = this.scoreAssessment(previouslyUsedKeywords, paper);
|
|
164
|
-
const assessmentResult = new _AssessmentResult.default();
|
|
165
|
-
assessmentResult.setScore(previouslyUsedKeywordsResult.score);
|
|
166
|
-
assessmentResult.setText(previouslyUsedKeywordsResult.text);
|
|
167
|
-
return assessmentResult;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
exports.default = PreviouslyUsedKeyword;
|
|
171
|
-
//# sourceMappingURL=previouslyUsedKeywords.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"previouslyUsedKeywords.js","names":["_i18n","require","_lodash","_missingArgument","_interopRequireDefault","_helpers","_AssessmentResult","e","__esModule","default","PreviouslyUsedKeyword","constructor","app","args","isUndefined","MissingArgument","usedKeywords","usedKeywordsPostTypes","searchUrl","postUrl","urlTitle","createAnchorOpeningTag","urlCallToAction","registerPlugin","registerAssessment","getResult","assess","bind","isApplicable","paper","hasKeyword","updateKeywordUsage","scoreAssessment","previouslyUsedKeywords","count","id","postTypeToDisplay","url","text","sprintf","__","score","replace","encodeURIComponent","getKeyword","researchPreviouslyUsedKeywords","keyword","length","previouslyUsedKeywordsResult","assessmentResult","AssessmentResult","setScore","setText","exports"],"sources":["../../src/bundledPlugins/previouslyUsedKeywords.js"],"sourcesContent":["import { __, sprintf } from \"@wordpress/i18n\";\nimport { isUndefined } from \"lodash\";\n\nimport MissingArgument from \"../errors/missingArgument\";\nimport { createAnchorOpeningTag } from \"../helpers\";\nimport AssessmentResult from \"../values/AssessmentResult.js\";\n\n/**\n * The PreviouslyUsedKeyword plugin allows to check for previously used keywords.\n */\nexport default class PreviouslyUsedKeyword {\n\t/**\n\t * Constructs a new PreviouslyUsedKeyword plugin.\n\t *\n\t * @param {object} app The app.\n\t * @param {object} args An arguments object.\n\t * @param {object} args.usedKeywords An object with keywords and ids where they are used.\n\t * @param {object} args.usedKeywordsPostTypes An object with the post types of the post ids from usedKeywords.\n\t * @param {string} args.searchUrl The url used to link to a search page when multiple usages of the keyword are found.\n\t * @param {string} args.postUrl The url used to link to a post when 1 usage of the keyword is found.\n\t *\n\t * @constructor\n\t */\n\tconstructor( app, args ) {\n\t\tif ( isUndefined( app ) ) {\n\t\t\tthrow new MissingArgument( \"The previously keyword plugin requires the YoastSEO app\" );\n\t\t}\n\n\t\tif ( isUndefined( args ) ) {\n\t\t\targs = {\n\t\t\t\tusedKeywords: {},\n\t\t\t\tusedKeywordsPostTypes: {},\n\t\t\t\tsearchUrl: \"\",\n\t\t\t\tpostUrl: \"\",\n\t\t\t};\n\t\t}\n\n\t\tthis.app = app;\n\t\tthis.usedKeywords = args.usedKeywords;\n\t\tthis.usedKeywordsPostTypes = args.usedKeywordsPostTypes;\n\t\tthis.searchUrl = args.searchUrl;\n\t\tthis.postUrl = args.postUrl;\n\t\tthis.urlTitle = createAnchorOpeningTag( \"https://yoa.st/33x\" );\n\t\tthis.urlCallToAction = createAnchorOpeningTag( \"https://yoa.st/33y\" );\n\t}\n\n\t/**\n\t * Registers the assessment with the assessor.\n\t *\n\t * @returns {void}\n\t */\n\tregisterPlugin() {\n\t\tthis.app.registerAssessment( \"usedKeywords\", {\n\t\t\tgetResult: this.assess.bind( this ),\n\t\t\t/**\n\t\t\t * Checks if the paper has a keyphrase, which is a prerequisite for the assessment to run.\n\t\t\t *\n\t\t\t * @param {Paper} paper The paper.\n\t\t\t *\n\t\t\t * @returns {boolean} Whether the paper has a keyphrase.\n\t\t\t */\n\t\t\tisApplicable: function( paper ) {\n\t\t\t\treturn paper.hasKeyword();\n\t\t\t},\n\t\t}, \"previouslyUsedKeywords\" );\n\t}\n\n\t/**\n\t * Updates the usedKeywords.\n\t *\n\t * @param {object} usedKeywords An object with keywords and ids where they are used.\n\t * @param {object} usedKeywordsPostTypes An object with keywords and in which post types they are used.\n\t * The post types correspond with the ids in the usedKeywords parameter.\n\t * @returns {void}\n\t */\n\tupdateKeywordUsage( usedKeywords, usedKeywordsPostTypes ) {\n\t\tthis.usedKeywords = usedKeywords;\n\t\tthis.usedKeywordsPostTypes = usedKeywordsPostTypes;\n\t}\n\n\t/**\n\t * Scores the previously used keyword assessment based on the count.\n\t *\n\t * @param {object} previouslyUsedKeywords The result of the previously used keywords research\n\t * @param {Paper} paper The paper object to research.\n\t * @returns {{text: string, score: number}} The result object with a feedback text and a score.\n\t */\n\tscoreAssessment( previouslyUsedKeywords, paper ) {\n\t\tconst count = previouslyUsedKeywords.count;\n\t\tconst id = previouslyUsedKeywords.id;\n\t\tconst postTypeToDisplay = previouslyUsedKeywords.postTypeToDisplay;\n\t\tlet url;\n\n\t\tif ( count === 0 ) {\n\t\t\treturn {\n\t\t\t\ttext: sprintf(\n\t\t\t\t\t/* translators:\n\t\t\t\t\t%1$s expands to a link to an article on yoast.com,\n\t\t\t\t\t%2$s expands to an anchor end tag. */\n\t\t\t\t\t__( \"%1$sPreviously used keyphrase%2$s: You've not used this keyphrase before, very good.\", \"wordpress-seo\" ),\n\t\t\t\t\tthis.urlTitle,\n\t\t\t\t\t\"</a>\"\n\t\t\t\t),\n\t\t\t\tscore: 9,\n\t\t\t};\n\t\t}\n\t\tif ( count === 1 ) {\n\t\t\turl = `<a href='${this.postUrl.replace( \"{id}\", id )}' target='_blank'>`;\n\t\t\treturn {\n\t\t\t\t/* translators: %1$s expands to an admin link where the keyphrase is already used,\n\t\t\t\t %2$s expands to the anchor end tag, %3$s and %4$s expand to links on yoast.com. */\n\t\t\t\ttext: sprintf( __(\n\t\t\t\t\t\"%3$sPreviously used keyphrase%2$s: You've used this keyphrase %1$sonce before%2$s. %4$sDo not use your keyphrase more than once%2$s.\",\n\t\t\t\t\t\"wordpress-seo\"\n\t\t\t\t),\n\t\t\t\turl,\n\t\t\t\t\"</a>\",\n\t\t\t\tthis.urlTitle,\n\t\t\t\tthis.urlCallToAction\n\t\t\t\t),\n\t\t\t\tscore: 6,\n\t\t\t};\n\t\t}\n\n\t\tif ( count > 1 ) {\n\t\t\tif ( postTypeToDisplay ) {\n\t\t\t\turl = `<a href='${this.searchUrl.replace( \"{keyword}\", encodeURIComponent( paper.getKeyword() ) )}&post_type=${postTypeToDisplay}' target='_blank'>`;\n\t\t\t} else {\n\t\t\t\turl = `<a href='${this.searchUrl.replace( \"{keyword}\", encodeURIComponent( paper.getKeyword() ) )}' target='_blank'>`;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t/* translators: %1$s expands to a link to the admin search page for the keyphrase,\n\t\t\t\t %2$s expands to the anchor end tag, %3$s and %4$s expand to links to yoast.com */\n\t\t\t\ttext: sprintf( __(\n\t\t\t\t\t\"%3$sPreviously used keyphrase%2$s: You've used this keyphrase %1$smultiple times before%2$s. %4$sDo not use your keyphrase more than once%2$s.\",\n\t\t\t\t\t\"wordpress-seo\"\n\t\t\t\t),\n\t\t\t\turl,\n\t\t\t\t\"</a>\",\n\t\t\t\tthis.urlTitle,\n\t\t\t\tthis.urlCallToAction\n\t\t\t\t),\n\t\t\t\tscore: 1,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Researches the previously used keywords, based on the used keywords and the keyword in the paper.\n\t *\n\t * @param {Paper} paper The paper object to research.\n\t * @returns {{id: number, count: number}} The object with the count and the id of the previously used keyword\n\t */\n\tresearchPreviouslyUsedKeywords( paper ) {\n\t\tconst keyword = paper.getKeyword();\n\t\tlet count = 0;\n\t\tlet postTypeToDisplay = \"\";\n\t\tlet id = 0;\n\n\t\tif ( ! isUndefined( this.usedKeywords[ keyword ] ) && this.usedKeywords[ keyword ].length > 0 ) {\n\t\t\tcount = this.usedKeywords[ keyword ].length;\n\t\t\tif ( keyword in this.usedKeywordsPostTypes ) {\n\t\t\t\tpostTypeToDisplay = this.usedKeywordsPostTypes[ keyword ][ 0 ];\n\t\t\t}\n\t\t\tid = this.usedKeywords[ keyword ][ 0 ];\n\t\t}\n\n\t\treturn {\n\t\t\tid: id,\n\t\t\tcount: count,\n\t\t\tpostTypeToDisplay: postTypeToDisplay,\n\t\t};\n\t}\n\n\t/**\n\t * Executes the assessment that checks whether a text uses previously used keywords.\n\t *\n\t * @param {Paper} paper The Paper object to assess.\n\t * @returns {AssessmentResult} The assessment result containing both a score and a descriptive text.\n\t */\n\tassess( paper ) {\n\t\tconst previouslyUsedKeywords = this.researchPreviouslyUsedKeywords( paper );\n\t\tconst previouslyUsedKeywordsResult = this.scoreAssessment( previouslyUsedKeywords, paper );\n\n\t\tconst assessmentResult = new AssessmentResult();\n\t\tassessmentResult.setScore( previouslyUsedKeywordsResult.score );\n\t\tassessmentResult.setText( previouslyUsedKeywordsResult.text );\n\n\t\treturn assessmentResult;\n\t}\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAF,sBAAA,CAAAH,OA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