libphonenumber-js 1.13.1 → 1.13.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/CHANGELOG.md +15 -2
- package/README.md +8 -13
- package/build/isPossible.js +16 -15
- package/build/isPossible.js.map +1 -1
- package/bundle/libphonenumber-js.min.js +1 -1
- package/bundle/libphonenumber-js.min.js.map +1 -1
- package/bundle/libphonenumber-max.js +1 -1
- package/bundle/libphonenumber-max.js.map +1 -1
- package/bundle/libphonenumber-min.js +1 -1
- package/bundle/libphonenumber-min.js.map +1 -1
- package/bundle/libphonenumber-mobile.js +1 -1
- package/bundle/libphonenumber-mobile.js.map +1 -1
- package/es6/isPossible.js +16 -15
- package/es6/isPossible.js.map +1 -1
- package/es6-modern/isPossible.js +16 -15
- package/es6-modern/isPossible.js.map +1 -1
- package/max/metadata/metadata.max.json +1 -1
- package/max/metadata/metadata.max.json.js +1 -1
- package/metadata.full.json +1 -1
- package/metadata.full.json.js +1 -1
- package/metadata.max.json +1 -1
- package/metadata.max.json.js +1 -1
- package/metadata.min.json +1 -1
- package/metadata.min.json.js +1 -1
- package/metadata.mobile.json +1 -1
- package/metadata.mobile.json.js +1 -1
- package/min/metadata/metadata.min.json +1 -1
- package/min/metadata/metadata.min.json.js +1 -1
- package/mobile/metadata/metadata.mobile.json +1 -1
- package/mobile/metadata/metadata.mobile.json.js +1 -1
- package/package.json +1 -1
- package/source/isPossible.js +16 -15
package/es6/isPossible.js
CHANGED
|
@@ -42,24 +42,25 @@ export default function isPossiblePhoneNumber(input, options, metadata) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
// Old metadata (< 1.0.18) had no "possible length" data.
|
|
45
|
+
// Old (legacy) metadata (< 1.0.18) had no "possible length" data.
|
|
46
|
+
// So `isPossibleNumber()` function is supported only for non-legacy metadata.
|
|
46
47
|
if (metadata.possibleLengths()) {
|
|
47
48
|
return isPossibleNumber(input.phone || input.nationalNumber, input.country, metadata);
|
|
48
|
-
} else {
|
|
49
|
-
// There was a bug between `1.7.35` and `1.7.37` where "possible_lengths"
|
|
50
|
-
// were missing for "non-geographical" numbering plans.
|
|
51
|
-
// Just assume the number is possible in such cases:
|
|
52
|
-
// it's unlikely that anyone generated their custom metadata
|
|
53
|
-
// in that short period of time (one day).
|
|
54
|
-
// This code can be removed in some future major version update.
|
|
55
|
-
if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {
|
|
56
|
-
// "Non-geographic entities" did't have `possibleLengths`
|
|
57
|
-
// due to a bug in metadata generation process.
|
|
58
|
-
return true;
|
|
59
|
-
} else {
|
|
60
|
-
throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
|
|
61
|
-
}
|
|
62
49
|
}
|
|
50
|
+
|
|
51
|
+
// There was a bug in versions from `1.7.35` to `1.7.37` of `libphonenumber-js`
|
|
52
|
+
// where "possible_lengths" property was missing from "non-geographical" numbering plans' metadata.
|
|
53
|
+
// After that, the bug was noticed and fixed.
|
|
54
|
+
// So for versions from `1.7.35` to `1.7.37`, just assume that all "non=geotraphical" numbers are possible.
|
|
55
|
+
// The reason is that the bug was noticed relatively quickly (within a day or so)
|
|
56
|
+
// and it's unlikely that anyone generated their custom metadata in that short time span.
|
|
57
|
+
// And if they didn't generate any custom metadata then a follow-up package update would've silently fixed the bug.
|
|
58
|
+
if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// `isPossibleNumber()` function is not supported.
|
|
63
|
+
throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
|
|
63
64
|
}
|
|
64
65
|
export function isPossibleNumber(nationalNumber, country, metadata) {
|
|
65
66
|
//, isInternational) {
|
package/es6/isPossible.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPossible.js","names":["Metadata","checkNumberLength","isPossiblePhoneNumber","input","options","metadata","undefined","v2","countryCallingCode","Error","selectNumberingPlan","phone","country","hasCountry","concat","possibleLengths","isPossibleNumber","nationalNumber","isNonGeographicCallingCode"],"sources":["../source/isPossible.js"],"sourcesContent":["import Metadata from './metadata.js'\r\nimport checkNumberLength from './helpers/checkNumberLength.js'\r\n\r\n/**\r\n * Checks if a phone number is \"possible\" (basically just checks its length).\r\n *\r\n * isPossible(phoneNumberInstance, { ..., v2: true }, metadata)\r\n *\r\n * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)\r\n * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)\r\n *\r\n * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.\r\n * @param {object} [options]\r\n * @param {object} metadata\r\n * @return {string}\r\n */\r\nexport default function isPossiblePhoneNumber(input, options, metadata) {\r\n\t/* istanbul ignore if */\r\n\tif (options === undefined) {\r\n\t\toptions = {}\r\n\t}\r\n\r\n\tmetadata = new Metadata(metadata)\r\n\r\n\tif (options.v2) {\r\n\t\tif (!input.countryCallingCode) {\r\n\t\t\tthrow new Error('Invalid phone number object passed')\r\n\t\t}\r\n\t\tmetadata.selectNumberingPlan(input.countryCallingCode)\r\n\t} else {\r\n\t\tif (!input.phone) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\tif (input.country) {\r\n\t\t\tif (!metadata.hasCountry(input.country)) {\r\n\t\t\t\tthrow new Error(`Unknown country: ${input.country}`)\r\n\t\t\t}\r\n\t\t\tmetadata.selectNumberingPlan(input.country)\r\n\t\t} else {\r\n\t\t\tif (!input.countryCallingCode) {\r\n\t\t\t\tthrow new Error('Invalid phone number object passed')\r\n\t\t\t}\r\n\t\t\tmetadata.selectNumberingPlan(input.countryCallingCode)\r\n\t\t}\r\n\t}\r\n\r\n\t// Old metadata (< 1.0.18) had no \"possible length\" data.\r\n\tif (metadata.possibleLengths()) {\r\n\t\treturn isPossibleNumber(input.phone || input.nationalNumber, input.country, metadata)\r\n\t}
|
|
1
|
+
{"version":3,"file":"isPossible.js","names":["Metadata","checkNumberLength","isPossiblePhoneNumber","input","options","metadata","undefined","v2","countryCallingCode","Error","selectNumberingPlan","phone","country","hasCountry","concat","possibleLengths","isPossibleNumber","nationalNumber","isNonGeographicCallingCode"],"sources":["../source/isPossible.js"],"sourcesContent":["import Metadata from './metadata.js'\r\nimport checkNumberLength from './helpers/checkNumberLength.js'\r\n\r\n/**\r\n * Checks if a phone number is \"possible\" (basically just checks its length).\r\n *\r\n * isPossible(phoneNumberInstance, { ..., v2: true }, metadata)\r\n *\r\n * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)\r\n * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)\r\n *\r\n * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.\r\n * @param {object} [options]\r\n * @param {object} metadata\r\n * @return {string}\r\n */\r\nexport default function isPossiblePhoneNumber(input, options, metadata) {\r\n\t/* istanbul ignore if */\r\n\tif (options === undefined) {\r\n\t\toptions = {}\r\n\t}\r\n\r\n\tmetadata = new Metadata(metadata)\r\n\r\n\tif (options.v2) {\r\n\t\tif (!input.countryCallingCode) {\r\n\t\t\tthrow new Error('Invalid phone number object passed')\r\n\t\t}\r\n\t\tmetadata.selectNumberingPlan(input.countryCallingCode)\r\n\t} else {\r\n\t\tif (!input.phone) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\tif (input.country) {\r\n\t\t\tif (!metadata.hasCountry(input.country)) {\r\n\t\t\t\tthrow new Error(`Unknown country: ${input.country}`)\r\n\t\t\t}\r\n\t\t\tmetadata.selectNumberingPlan(input.country)\r\n\t\t} else {\r\n\t\t\tif (!input.countryCallingCode) {\r\n\t\t\t\tthrow new Error('Invalid phone number object passed')\r\n\t\t\t}\r\n\t\t\tmetadata.selectNumberingPlan(input.countryCallingCode)\r\n\t\t}\r\n\t}\r\n\r\n\t// Old (legacy) metadata (< 1.0.18) had no \"possible length\" data.\r\n\t// So `isPossibleNumber()` function is supported only for non-legacy metadata.\r\n\tif (metadata.possibleLengths()) {\r\n\t\treturn isPossibleNumber(input.phone || input.nationalNumber, input.country, metadata)\r\n\t}\r\n\r\n\t// There was a bug in versions from `1.7.35` to `1.7.37` of `libphonenumber-js`\r\n\t// where \"possible_lengths\" property was missing from \"non-geographical\" numbering plans' metadata.\r\n\t// After that, the bug was noticed and fixed.\r\n\t// So for versions from `1.7.35` to `1.7.37`, just assume that all \"non=geotraphical\" numbers are possible.\r\n\t// The reason is that the bug was noticed relatively quickly (within a day or so)\r\n\t// and it's unlikely that anyone generated their custom metadata in that short time span.\r\n\t// And if they didn't generate any custom metadata then a follow-up package update would've silently fixed the bug.\r\n\tif (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {\r\n\t\treturn true\r\n\t}\r\n\r\n\t// `isPossibleNumber()` function is not supported.\r\n\tthrow new Error('Missing \"possibleLengths\" in metadata. Perhaps the metadata has been generated before v1.0.18.');\r\n}\r\n\r\nexport function isPossibleNumber(nationalNumber, country, metadata) { //, isInternational) {\r\n\tswitch (checkNumberLength(nationalNumber, country, metadata)) {\r\n\t\tcase 'IS_POSSIBLE':\r\n\t\t\treturn true\r\n\t\t// This library ignores \"local-only\" phone numbers (for simplicity).\r\n\t\t// See the readme for more info on what are \"local-only\" phone numbers.\r\n\t\t// case 'IS_POSSIBLE_LOCAL_ONLY':\r\n\t\t// \treturn !isInternational\r\n\t\tdefault:\r\n\t\t\treturn false\r\n\t}\r\n}"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,eAAe;AACpC,OAAOC,iBAAiB,MAAM,gCAAgC;;AAE9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,qBAAqBA,CAACC,KAAK,E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;;EAEA;EACA,MAAM,IAAIC,KAAK,CAAC,gGAAgG,CAAC;AAClH;AAEA,OAAO,SAASO,gBAAgBA,CAACC,cAAc,EAAEL,OAAO,EAAEP,QAAQ,EAAE;EAAE;EACrE,QAAQJ,iBAAiB,CAACgB,cAAc,EAAEL,OAAO,EAAEP,QAAQ,CAAC;IAC3D,KAAK,aAAa;MACjB,OAAO,IAAI;IACZ;IACA;IACA;IACA;IACA;MACC,OAAO,KAAK;EACd;AACD","ignoreList":[]}
|
package/es6-modern/isPossible.js
CHANGED
|
@@ -42,24 +42,25 @@ export default function isPossiblePhoneNumber(input, options, metadata) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
// Old metadata (< 1.0.18) had no "possible length" data.
|
|
45
|
+
// Old (legacy) metadata (< 1.0.18) had no "possible length" data.
|
|
46
|
+
// So `isPossibleNumber()` function is supported only for non-legacy metadata.
|
|
46
47
|
if (metadata.possibleLengths()) {
|
|
47
48
|
return isPossibleNumber(input.phone || input.nationalNumber, input.country, metadata);
|
|
48
|
-
} else {
|
|
49
|
-
// There was a bug between `1.7.35` and `1.7.37` where "possible_lengths"
|
|
50
|
-
// were missing for "non-geographical" numbering plans.
|
|
51
|
-
// Just assume the number is possible in such cases:
|
|
52
|
-
// it's unlikely that anyone generated their custom metadata
|
|
53
|
-
// in that short period of time (one day).
|
|
54
|
-
// This code can be removed in some future major version update.
|
|
55
|
-
if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {
|
|
56
|
-
// "Non-geographic entities" did't have `possibleLengths`
|
|
57
|
-
// due to a bug in metadata generation process.
|
|
58
|
-
return true;
|
|
59
|
-
} else {
|
|
60
|
-
throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
|
|
61
|
-
}
|
|
62
49
|
}
|
|
50
|
+
|
|
51
|
+
// There was a bug in versions from `1.7.35` to `1.7.37` of `libphonenumber-js`
|
|
52
|
+
// where "possible_lengths" property was missing from "non-geographical" numbering plans' metadata.
|
|
53
|
+
// After that, the bug was noticed and fixed.
|
|
54
|
+
// So for versions from `1.7.35` to `1.7.37`, just assume that all "non=geotraphical" numbers are possible.
|
|
55
|
+
// The reason is that the bug was noticed relatively quickly (within a day or so)
|
|
56
|
+
// and it's unlikely that anyone generated their custom metadata in that short time span.
|
|
57
|
+
// And if they didn't generate any custom metadata then a follow-up package update would've silently fixed the bug.
|
|
58
|
+
if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// `isPossibleNumber()` function is not supported.
|
|
63
|
+
throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
|
|
63
64
|
}
|
|
64
65
|
export function isPossibleNumber(nationalNumber, country, metadata) {
|
|
65
66
|
//, isInternational) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPossible.js","names":["Metadata","checkNumberLength","isPossiblePhoneNumber","input","options","metadata","undefined","v2","countryCallingCode","Error","selectNumberingPlan","phone","country","hasCountry","possibleLengths","isPossibleNumber","nationalNumber","isNonGeographicCallingCode"],"sources":["../source/isPossible.js"],"sourcesContent":["import Metadata from './metadata.js'\r\nimport checkNumberLength from './helpers/checkNumberLength.js'\r\n\r\n/**\r\n * Checks if a phone number is \"possible\" (basically just checks its length).\r\n *\r\n * isPossible(phoneNumberInstance, { ..., v2: true }, metadata)\r\n *\r\n * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)\r\n * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)\r\n *\r\n * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.\r\n * @param {object} [options]\r\n * @param {object} metadata\r\n * @return {string}\r\n */\r\nexport default function isPossiblePhoneNumber(input, options, metadata) {\r\n\t/* istanbul ignore if */\r\n\tif (options === undefined) {\r\n\t\toptions = {}\r\n\t}\r\n\r\n\tmetadata = new Metadata(metadata)\r\n\r\n\tif (options.v2) {\r\n\t\tif (!input.countryCallingCode) {\r\n\t\t\tthrow new Error('Invalid phone number object passed')\r\n\t\t}\r\n\t\tmetadata.selectNumberingPlan(input.countryCallingCode)\r\n\t} else {\r\n\t\tif (!input.phone) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\tif (input.country) {\r\n\t\t\tif (!metadata.hasCountry(input.country)) {\r\n\t\t\t\tthrow new Error(`Unknown country: ${input.country}`)\r\n\t\t\t}\r\n\t\t\tmetadata.selectNumberingPlan(input.country)\r\n\t\t} else {\r\n\t\t\tif (!input.countryCallingCode) {\r\n\t\t\t\tthrow new Error('Invalid phone number object passed')\r\n\t\t\t}\r\n\t\t\tmetadata.selectNumberingPlan(input.countryCallingCode)\r\n\t\t}\r\n\t}\r\n\r\n\t// Old metadata (< 1.0.18) had no \"possible length\" data.\r\n\tif (metadata.possibleLengths()) {\r\n\t\treturn isPossibleNumber(input.phone || input.nationalNumber, input.country, metadata)\r\n\t}
|
|
1
|
+
{"version":3,"file":"isPossible.js","names":["Metadata","checkNumberLength","isPossiblePhoneNumber","input","options","metadata","undefined","v2","countryCallingCode","Error","selectNumberingPlan","phone","country","hasCountry","possibleLengths","isPossibleNumber","nationalNumber","isNonGeographicCallingCode"],"sources":["../source/isPossible.js"],"sourcesContent":["import Metadata from './metadata.js'\r\nimport checkNumberLength from './helpers/checkNumberLength.js'\r\n\r\n/**\r\n * Checks if a phone number is \"possible\" (basically just checks its length).\r\n *\r\n * isPossible(phoneNumberInstance, { ..., v2: true }, metadata)\r\n *\r\n * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)\r\n * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)\r\n *\r\n * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.\r\n * @param {object} [options]\r\n * @param {object} metadata\r\n * @return {string}\r\n */\r\nexport default function isPossiblePhoneNumber(input, options, metadata) {\r\n\t/* istanbul ignore if */\r\n\tif (options === undefined) {\r\n\t\toptions = {}\r\n\t}\r\n\r\n\tmetadata = new Metadata(metadata)\r\n\r\n\tif (options.v2) {\r\n\t\tif (!input.countryCallingCode) {\r\n\t\t\tthrow new Error('Invalid phone number object passed')\r\n\t\t}\r\n\t\tmetadata.selectNumberingPlan(input.countryCallingCode)\r\n\t} else {\r\n\t\tif (!input.phone) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\tif (input.country) {\r\n\t\t\tif (!metadata.hasCountry(input.country)) {\r\n\t\t\t\tthrow new Error(`Unknown country: ${input.country}`)\r\n\t\t\t}\r\n\t\t\tmetadata.selectNumberingPlan(input.country)\r\n\t\t} else {\r\n\t\t\tif (!input.countryCallingCode) {\r\n\t\t\t\tthrow new Error('Invalid phone number object passed')\r\n\t\t\t}\r\n\t\t\tmetadata.selectNumberingPlan(input.countryCallingCode)\r\n\t\t}\r\n\t}\r\n\r\n\t// Old (legacy) metadata (< 1.0.18) had no \"possible length\" data.\r\n\t// So `isPossibleNumber()` function is supported only for non-legacy metadata.\r\n\tif (metadata.possibleLengths()) {\r\n\t\treturn isPossibleNumber(input.phone || input.nationalNumber, input.country, metadata)\r\n\t}\r\n\r\n\t// There was a bug in versions from `1.7.35` to `1.7.37` of `libphonenumber-js`\r\n\t// where \"possible_lengths\" property was missing from \"non-geographical\" numbering plans' metadata.\r\n\t// After that, the bug was noticed and fixed.\r\n\t// So for versions from `1.7.35` to `1.7.37`, just assume that all \"non=geotraphical\" numbers are possible.\r\n\t// The reason is that the bug was noticed relatively quickly (within a day or so)\r\n\t// and it's unlikely that anyone generated their custom metadata in that short time span.\r\n\t// And if they didn't generate any custom metadata then a follow-up package update would've silently fixed the bug.\r\n\tif (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {\r\n\t\treturn true\r\n\t}\r\n\r\n\t// `isPossibleNumber()` function is not supported.\r\n\tthrow new Error('Missing \"possibleLengths\" in metadata. Perhaps the metadata has been generated before v1.0.18.');\r\n}\r\n\r\nexport function isPossibleNumber(nationalNumber, country, metadata) { //, isInternational) {\r\n\tswitch (checkNumberLength(nationalNumber, country, metadata)) {\r\n\t\tcase 'IS_POSSIBLE':\r\n\t\t\treturn true\r\n\t\t// This library ignores \"local-only\" phone numbers (for simplicity).\r\n\t\t// See the readme for more info on what are \"local-only\" phone numbers.\r\n\t\t// case 'IS_POSSIBLE_LOCAL_ONLY':\r\n\t\t// \treturn !isInternational\r\n\t\tdefault:\r\n\t\t\treturn false\r\n\t}\r\n}"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,eAAe;AACpC,OAAOC,iBAAiB,MAAM,gCAAgC;;AAE9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,qBAAqBA,CAACC,KAAK,EAAEC,OAAO,EAAEC,QAAQ,EAAE;EACvE;EACA,IAAID,OAAO,KAAKE,SAAS,EAAE;IAC1BF,OAAO,GAAG,CAAC,CAAC;EACb;EAEAC,QAAQ,GAAG,IAAIL,QAAQ,CAACK,QAAQ,CAAC;EAEjC,IAAID,OAAO,CAACG,EAAE,EAAE;IACf,IAAI,CAACJ,KAAK,CAACK,kBAAkB,EAAE;MAC9B,MAAM,IAAIC,KAAK,CAAC,oCAAoC,CAAC;IACtD;IACAJ,QAAQ,CAACK,mBAAmB,CAACP,KAAK,CAACK,kBAAkB,CAAC;EACvD,CAAC,MAAM;IACN,IAAI,CAACL,KAAK,CAACQ,KAAK,EAAE;MACjB,OAAO,KAAK;IACb;IACA,IAAIR,KAAK,CAACS,OAAO,EAAE;MAClB,IAAI,CAACP,QAAQ,CAACQ,UAAU,CAACV,KAAK,CAACS,OAAO,CAAC,EAAE;QACxC,MAAM,IAAIH,KAAK,CAAC,oBAAoBN,KAAK,CAACS,OAAO,EAAE,CAA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