prettier 2.1.1 → 2.3.0
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/LICENSE +0 -0
- package/README.md +3 -3
- package/bin-prettier.js +12178 -10699
- package/doc.js +1230 -1003
- package/esm/parser-angular.mjs +46 -0
- package/esm/parser-babel.mjs +1 -0
- package/esm/parser-espree.mjs +1 -0
- package/esm/parser-flow.mjs +1 -0
- package/esm/parser-glimmer.mjs +1 -0
- package/esm/parser-graphql.mjs +1 -0
- package/esm/parser-html.mjs +111 -0
- package/esm/parser-markdown.mjs +13 -0
- package/esm/parser-meriyah.mjs +1 -0
- package/esm/parser-postcss.mjs +1 -0
- package/esm/parser-typescript.mjs +1 -0
- package/esm/parser-yaml.mjs +15 -0
- package/esm/standalone.mjs +55 -0
- package/index.js +23217 -16968
- package/package.json +3 -2
- package/parser-angular.js +40 -40
- package/parser-babel.js +1 -1
- package/parser-espree.js +1 -0
- package/parser-flow.js +1 -1
- package/parser-glimmer.js +1 -1
- package/parser-graphql.js +1 -1
- package/parser-html.js +61 -63
- package/parser-markdown.js +3 -9
- package/parser-meriyah.js +1 -0
- package/parser-postcss.js +1 -8
- package/parser-typescript.js +1 -14
- package/parser-yaml.js +2 -2
- package/standalone.js +42 -2
- package/third-party.js +1042 -962
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var e=e=>"string"==typeof e?e.replace((({onlyFirst:e=!1}={})=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")})(),""):e;const t=e=>!Number.isNaN(e)&&(e>=4352&&(e<=4447||9001===e||9002===e||11904<=e&&e<=12871&&12351!==e||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141));var n=t,r=t;n.default=r;const s=t=>{if("string"!=typeof t||0===t.length)return 0;if(0===(t=e(t)).length)return 0;t=t.replace(/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g," ");let r=0;for(let e=0;e<t.length;e++){const s=t.codePointAt(e);s<=31||s>=127&&s<=159||(s>=768&&s<=879||(s>65535&&e++,r+=n(s)?2:1))}return r};var i=s,u=s;i.default=u;var a=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};var o=e=>e[e.length-1];function D(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var c=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var s=e[t];r[s[0]]=s[1]}return r},p=void 0!==p?p:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function h(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}var d=h,E=l;function f(e){if(d===setTimeout)return setTimeout(e,0);if((d===h||!d)&&setTimeout)return d=setTimeout,setTimeout(e,0);try{return d(e,0)}catch(t){try{return d.call(null,e,0)}catch(t){return d.call(this,e,0)}}}"function"==typeof p.setTimeout&&(d=setTimeout),"function"==typeof p.clearTimeout&&(E=clearTimeout);var C,F=[],v=!1,g=-1;function m(){v&&C&&(v=!1,C.length?F=C.concat(F):g=-1,F.length&&x())}function x(){if(!v){var e=f(m);v=!0;for(var t=F.length;t;){for(C=F,F=[];++g<t;)C&&C[g].run();g=-1,t=F.length}C=null,v=!1,function(e){if(E===clearTimeout)return clearTimeout(e);if((E===l||!E)&&clearTimeout)return E=clearTimeout,clearTimeout(e);try{E(e)}catch(t){try{return E.call(null,e)}catch(t){return E.call(this,e)}}}(e)}}function A(e,t){this.fun=e,this.array=t}A.prototype.run=function(){this.fun.apply(null,this.array)};function y(){}var S=y,w=y,I=y,N=y,B=y,O=y,P=y;var b=p.performance||{},T=b.now||b.mozNow||b.msNow||b.oNow||b.webkitNow||function(){return(new Date).getTime()};var L=new Date;var R={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];F.push(new A(e,t)),1!==F.length||v||f(x)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:S,addListener:w,once:I,off:N,removeListener:B,removeAllListeners:O,emit:P,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*T.call(b),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-L)/1e3}};var k="object"==typeof R&&R.env&&R.env.NODE_DEBUG&&/\bsemver\b/i.test(R.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var M={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16};function _(e){var t={exports:{}};return e(t,t.exports),t.exports}var G=_((function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n}=M,r=(t=e.exports={}).re=[],s=t.src=[],i=t.t={};let u=0;const a=(e,t,n)=>{const a=u++;k(a,t),i[e]=a,s[a]=t,r[a]=new RegExp(t,n?"g":void 0)};a("NUMERICIDENTIFIER","0|[1-9]\\d*"),a("NUMERICIDENTIFIERLOOSE","[0-9]+"),a("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),a("MAINVERSION","(".concat(s[i.NUMERICIDENTIFIER],")\\.")+"(".concat(s[i.NUMERICIDENTIFIER],")\\.")+"(".concat(s[i.NUMERICIDENTIFIER],")")),a("MAINVERSIONLOOSE","(".concat(s[i.NUMERICIDENTIFIERLOOSE],")\\.")+"(".concat(s[i.NUMERICIDENTIFIERLOOSE],")\\.")+"(".concat(s[i.NUMERICIDENTIFIERLOOSE],")")),a("PRERELEASEIDENTIFIER","(?:".concat(s[i.NUMERICIDENTIFIER],"|").concat(s[i.NONNUMERICIDENTIFIER],")")),a("PRERELEASEIDENTIFIERLOOSE","(?:".concat(s[i.NUMERICIDENTIFIERLOOSE],"|").concat(s[i.NONNUMERICIDENTIFIER],")")),a("PRERELEASE","(?:-(".concat(s[i.PRERELEASEIDENTIFIER],"(?:\\.").concat(s[i.PRERELEASEIDENTIFIER],")*))")),a("PRERELEASELOOSE","(?:-?(".concat(s[i.PRERELEASEIDENTIFIERLOOSE],"(?:\\.").concat(s[i.PRERELEASEIDENTIFIERLOOSE],")*))")),a("BUILDIDENTIFIER","[0-9A-Za-z-]+"),a("BUILD","(?:\\+(".concat(s[i.BUILDIDENTIFIER],"(?:\\.").concat(s[i.BUILDIDENTIFIER],")*))")),a("FULLPLAIN","v?".concat(s[i.MAINVERSION]).concat(s[i.PRERELEASE],"?").concat(s[i.BUILD],"?")),a("FULL","^".concat(s[i.FULLPLAIN],"$")),a("LOOSEPLAIN","[v=\\s]*".concat(s[i.MAINVERSIONLOOSE]).concat(s[i.PRERELEASELOOSE],"?").concat(s[i.BUILD],"?")),a("LOOSE","^".concat(s[i.LOOSEPLAIN],"$")),a("GTLT","((?:<|>)?=?)"),a("XRANGEIDENTIFIERLOOSE","".concat(s[i.NUMERICIDENTIFIERLOOSE],"|x|X|\\*")),a("XRANGEIDENTIFIER","".concat(s[i.NUMERICIDENTIFIER],"|x|X|\\*")),a("XRANGEPLAIN","[v=\\s]*(".concat(s[i.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(s[i.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(s[i.XRANGEIDENTIFIER],")")+"(?:".concat(s[i.PRERELEASE],")?").concat(s[i.BUILD],"?")+")?)?"),a("XRANGEPLAINLOOSE","[v=\\s]*(".concat(s[i.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(s[i.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(s[i.XRANGEIDENTIFIERLOOSE],")")+"(?:".concat(s[i.PRERELEASELOOSE],")?").concat(s[i.BUILD],"?")+")?)?"),a("XRANGE","^".concat(s[i.GTLT],"\\s*").concat(s[i.XRANGEPLAIN],"$")),a("XRANGELOOSE","^".concat(s[i.GTLT],"\\s*").concat(s[i.XRANGEPLAINLOOSE],"$")),a("COERCE","".concat("(^|[^\\d])(\\d{1,").concat(n,"})")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:$|[^\\d])"),a("COERCERTL",s[i.COERCE],!0),a("LONETILDE","(?:~>?)"),a("TILDETRIM","(\\s*)".concat(s[i.LONETILDE],"\\s+"),!0),t.tildeTrimReplace="$1~",a("TILDE","^".concat(s[i.LONETILDE]).concat(s[i.XRANGEPLAIN],"$")),a("TILDELOOSE","^".concat(s[i.LONETILDE]).concat(s[i.XRANGEPLAINLOOSE],"$")),a("LONECARET","(?:\\^)"),a("CARETTRIM","(\\s*)".concat(s[i.LONECARET],"\\s+"),!0),t.caretTrimReplace="$1^",a("CARET","^".concat(s[i.LONECARET]).concat(s[i.XRANGEPLAIN],"$")),a("CARETLOOSE","^".concat(s[i.LONECARET]).concat(s[i.XRANGEPLAINLOOSE],"$")),a("COMPARATORLOOSE","^".concat(s[i.GTLT],"\\s*(").concat(s[i.LOOSEPLAIN],")$|^$")),a("COMPARATOR","^".concat(s[i.GTLT],"\\s*(").concat(s[i.FULLPLAIN],")$|^$")),a("COMPARATORTRIM","(\\s*)".concat(s[i.GTLT],"\\s*(").concat(s[i.LOOSEPLAIN],"|").concat(s[i.XRANGEPLAIN],")"),!0),t.comparatorTrimReplace="$1$2$3",a("HYPHENRANGE","^\\s*(".concat(s[i.XRANGEPLAIN],")")+"\\s+-\\s+"+"(".concat(s[i.XRANGEPLAIN],")")+"\\s*$"),a("HYPHENRANGELOOSE","^\\s*(".concat(s[i.XRANGEPLAINLOOSE],")")+"\\s+-\\s+"+"(".concat(s[i.XRANGEPLAINLOOSE],")")+"\\s*$"),a("STAR","(<|>)?=?\\s*\\*"),a("GTE0","^\\s*>=\\s*0.0.0\\s*$"),a("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}));const j=["includePrerelease","loose","rtl"];var K=e=>e?"object"!=typeof e?{loose:!0}:j.filter((t=>e[t])).reduce(((e,t)=>(e[t]=!0,e)),{}):{};const U=/^[0-9]+$/,$=(e,t)=>{const n=U.test(e),r=U.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e<t?-1:1};var W={compareIdentifiers:$,rcompareIdentifiers:(e,t)=>$(t,e)};const{MAX_LENGTH:V,MAX_SAFE_INTEGER:X}=M,{re:q,t:z}=G,{compareIdentifiers:Q}=W;class Y{constructor(e,t){if(t=K(t),e instanceof Y){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: ".concat(e));if(e.length>V)throw new TypeError("version is longer than ".concat(V," characters"));k("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?q[z.LOOSE]:q[z.FULL]);if(!n)throw new TypeError("Invalid Version: ".concat(e));if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>X||this.major<0)throw new TypeError("Invalid major version");if(this.minor>X||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>X||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<X)return t}return e})):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version="".concat(this.major,".").concat(this.minor,".").concat(this.patch),this.prerelease.length&&(this.version+="-".concat(this.prerelease.join("."))),this.version}toString(){return this.version}compare(e){if(k("SemVer.compare",this.version,this.options,e),!(e instanceof Y)){if("string"==typeof e&&e===this.version)return 0;e=new Y(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof Y||(e=new Y(e,this.options)),Q(this.major,e.major)||Q(this.minor,e.minor)||Q(this.patch,e.patch)}comparePre(e){if(e instanceof Y||(e=new Y(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const n=this.prerelease[t],r=e.prerelease[t];if(k("prerelease compare",t,n,r),void 0===n&&void 0===r)return 0;if(void 0===r)return 1;if(void 0===n)return-1;if(n!==r)return Q(n,r)}while(++t)}compareBuild(e){e instanceof Y||(e=new Y(e,this.options));let t=0;do{const n=this.build[t],r=e.build[t];if(k("prerelease compare",t,n,r),void 0===n&&void 0===r)return 0;if(void 0===r)return 1;if(void 0===n)return-1;if(n!==r)return Q(n,r)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: ".concat(e))}return this.format(),this.raw=this.version,this}}var H=Y;var J=(e,t,n)=>new H(e,n).compare(new H(t,n));var Z=(e,t,n)=>J(e,t,n)<0;var ee,te,ne,re,se,ie,ue=(e,t,n)=>J(e,t,n)>=0,ae="2.3.0",oe=_((function(e,t){function n(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]}function r(){return"undefined"!=typeof WeakMap?new WeakMap:{add:n,delete:n,get:n,set:n,has:function(e){return!1}}}Object.defineProperty(t,"__esModule",{value:!0}),t.outdent=void 0;var s=Object.prototype.hasOwnProperty,i=function(e,t){return s.call(e,t)};function u(e,t){for(var n in t)i(t,n)&&(e[n]=t[n]);return e}var a=/^[ \t]*(?:\r\n|\r|\n)/,o=/(?:\r\n|\r|\n)[ \t]*$/,D=/^(?:[\r\n]|$)/,c=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,p=/^[ \t]*[\r\n][ \t\r\n]*$/;function h(e,t,n){var r=0,s=e[0].match(c);s&&(r=s[1].length);var i=new RegExp("(\\r\\n|\\r|\\n).{0,"+r+"}","g");t&&(e=e.slice(1));var u=n.newline,D=n.trimLeadingNewline,p=n.trimTrailingNewline,h="string"==typeof u,l=e.length;return e.map((function(e,t){return e=e.replace(i,"$1"),0===t&&D&&(e=e.replace(a,"")),t===l-1&&p&&(e=e.replace(o,"")),h&&(e=e.replace(/\r\n|\n|\r/g,(function(e){return u}))),e}))}function l(e,t){for(var n="",r=0,s=e.length;r<s;r++)n+=e[r],r<s-1&&(n+=t[r]);return n}function d(e){return i(e,"raw")&&i(e,"length")}var E=function e(t){var n=r(),s=r();return u((function r(i){for(var a=[],o=1;o<arguments.length;o++)a[o-1]=arguments[o];if(d(i)){var c=i,f=(a[0]===r||a[0]===E)&&p.test(c[0])&&D.test(c[1]),C=f?s:n,F=C.get(c);if(F||(F=h(c,f,t),C.set(c,F)),0===a.length)return F[0];var v=l(F,f?a.slice(1):a);return v}return e(u(u({},t),i||{}))}),{string:function(e){return h([e],!1,t)[0]}})}({trimLeadingNewline:!0,trimTrailingNewline:!0});t.outdent=E,t.default=E;try{e.exports=E,Object.defineProperty(E,"__esModule",{value:!0}),E.default=E,E.outdent=E}catch(e){}}));const{outdent:De}=oe,ce={cursorOffset:{since:"1.4.0",category:"Special",type:"int",default:-1,range:{start:-1,end:Number.POSITIVE_INFINITY,step:1},description:De(ee||(ee=D(["\n Print (to stderr) where a cursor at the given position would move to after formatting.\n This option cannot be used with --range-start and --range-end.\n "]))),cliCategory:"Editor"},endOfLine:{since:"1.15.0",category:"Global",type:"choice",default:[{since:"1.15.0",value:"auto"},{since:"2.0.0",value:"lf"}],description:"Which end of line characters to apply.",choices:[{value:"lf",description:"Line Feed only (\\n), common on Linux and macOS as well as inside git repos"},{value:"crlf",description:"Carriage Return + Line Feed characters (\\r\\n), common on Windows"},{value:"cr",description:"Carriage Return character only (\\r), used very rarely"},{value:"auto",description:De(te||(te=D(["\n Maintain existing\n (mixed values within one file are normalised by looking at what's used after the first line)\n "])))}]},filepath:{since:"1.4.0",category:"Special",type:"path",description:"Specify the input filepath. This will be used to do parser inference.",cliName:"stdin-filepath",cliCategory:"Other",cliDescription:"Path to the file to pretend that stdin comes from."},insertPragma:{since:"1.8.0",category:"Special",type:"boolean",default:!1,description:"Insert @format pragma into file's first docblock comment.",cliCategory:"Other"},parser:{since:"0.0.10",category:"Global",type:"choice",default:[{since:"0.0.10",value:"babylon"},{since:"1.13.0",value:void 0}],description:"Which parser to use.",exception:e=>"string"==typeof e||"function"==typeof e,choices:[{value:"flow",description:"Flow"},{value:"babel",since:"1.16.0",description:"JavaScript"},{value:"babel-flow",since:"1.16.0",description:"Flow"},{value:"babel-ts",since:"2.0.0",description:"TypeScript"},{value:"typescript",since:"1.4.0",description:"TypeScript"},{value:"espree",since:"2.2.0",description:"JavaScript"},{value:"meriyah",since:"2.2.0",description:"JavaScript"},{value:"css",since:"1.7.1",description:"CSS"},{value:"less",since:"1.7.1",description:"Less"},{value:"scss",since:"1.7.1",description:"SCSS"},{value:"json",since:"1.5.0",description:"JSON"},{value:"json5",since:"1.13.0",description:"JSON5"},{value:"json-stringify",since:"1.13.0",description:"JSON.stringify"},{value:"graphql",since:"1.5.0",description:"GraphQL"},{value:"markdown",since:"1.8.0",description:"Markdown"},{value:"mdx",since:"1.15.0",description:"MDX"},{value:"vue",since:"1.10.0",description:"Vue"},{value:"yaml",since:"1.14.0",description:"YAML"},{value:"glimmer",since:"2.3.0",description:"Ember / Handlebars"},{value:"html",since:"1.15.0",description:"HTML"},{value:"angular",since:"1.15.0",description:"Angular"},{value:"lwc",since:"1.17.0",description:"Lightning Web Components"}]},plugins:{since:"1.10.0",type:"path",array:!0,default:[{value:[]}],category:"Global",description:"Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",exception:e=>"string"==typeof e||"object"==typeof e,cliName:"plugin",cliCategory:"Config"},pluginSearchDirs:{since:"1.13.0",type:"path",array:!0,default:[{value:[]}],category:"Global",description:De(ne||(ne=D(["\n Custom directory that contains prettier plugins in node_modules subdirectory.\n Overrides default behavior when plugins are searched relatively to the location of Prettier.\n Multiple values are accepted.\n "]))),exception:e=>"string"==typeof e||"object"==typeof e,cliName:"plugin-search-dir",cliCategory:"Config"},printWidth:{since:"0.0.0",category:"Global",type:"int",default:80,description:"The line length where Prettier will try wrap.",range:{start:0,end:Number.POSITIVE_INFINITY,step:1}},rangeEnd:{since:"1.4.0",category:"Special",type:"int",default:Number.POSITIVE_INFINITY,range:{start:0,end:Number.POSITIVE_INFINITY,step:1},description:De(re||(re=D(["\n Format code ending at a given character offset (exclusive).\n The range will extend forwards to the end of the selected statement.\n This option cannot be used with --cursor-offset.\n "]))),cliCategory:"Editor"},rangeStart:{since:"1.4.0",category:"Special",type:"int",default:0,range:{start:0,end:Number.POSITIVE_INFINITY,step:1},description:De(se||(se=D(["\n Format code starting at a given character offset.\n The range will extend backwards to the start of the first line containing the selected statement.\n This option cannot be used with --cursor-offset.\n "]))),cliCategory:"Editor"},requirePragma:{since:"1.7.0",category:"Special",type:"boolean",default:!1,description:De(ie||(ie=D(["\n Require either '@prettier' or '@format' to be present in the file's first docblock comment\n in order for it to be formatted.\n "]))),cliCategory:"Other"},tabWidth:{type:"int",category:"Global",default:2,description:"Number of spaces per indentation level.",range:{start:0,end:Number.POSITIVE_INFINITY,step:1}},useTabs:{since:"1.0.0",category:"Global",type:"boolean",default:!1,description:"Indent with tabs instead of spaces."},embeddedLanguageFormatting:{since:"2.1.0",category:"Global",type:"choice",default:[{since:"2.1.0",value:"auto"}],description:"Control how Prettier formats quoted code embedded in the file.",choices:[{value:"auto",description:"Format embedded code if Prettier can automatically identify it."},{value:"off",description:"Never automatically format embedded code."}]}};const pe={compare:J,lt:Z,gte:ue},he=ae,le={CATEGORY_CONFIG:"Config",CATEGORY_EDITOR:"Editor",CATEGORY_FORMAT:"Format",CATEGORY_OTHER:"Other",CATEGORY_OUTPUT:"Output",CATEGORY_GLOBAL:"Global",CATEGORY_SPECIAL:"Special",options:ce}.options;var de={getSupportInfo:function({plugins:e=[],showUnreleased:t=!1,showDeprecated:n=!1,showInternal:r=!1}={}){const s=he.split("-",1)[0],i=e.reduce(((e,t)=>[...e,...t.languages||[]]),[]).filter(D),u=(a=Object.assign({},...e.map((({options:e})=>e)),le),o="name",Object.entries(a).map((([e,t])=>Object.assign({[o]:e},t)))).filter((e=>D(e)&&p(e))).sort(((e,t)=>e.name===t.name?0:e.name<t.name?-1:1)).map((function(e){if(r)return e;return function(e,t){if(null==e)return{};var n,r,s={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(s[n]=e[n]);return s}(e,["cliName","cliCategory","cliDescription"])})).map((t=>{t=Object.assign({},t),Array.isArray(t.default)&&(t.default=1===t.default.length?t.default[0].value:t.default.filter(D).sort(((e,t)=>pe.compare(t.since,e.since)))[0].value),Array.isArray(t.choices)&&(t.choices=t.choices.filter((e=>D(e)&&p(e))),"parser"===t.name&&function(e,t,n){const r=new Set(e.choices.map((e=>e.value)));for(const s of t)if(s.parsers)for(const t of s.parsers)if(!r.has(t)){r.add(t);const i=n.find((e=>e.parsers&&e.parsers[t]));let u=s.name;i&&i.name&&(u+=" (plugin: ".concat(i.name,")")),e.choices.push({value:t,description:u})}}(t,i,e));const n=c(e.filter((e=>e.defaultOptions&&void 0!==e.defaultOptions[t.name])).map((e=>[e.name,e.defaultOptions[t.name]])));return Object.assign({},t,{pluginDefaults:n})}));var a,o;return{languages:i,options:u};function D(e){return t||!("since"in e)||e.since&&pe.gte(s,e.since)}function p(e){return n||!("deprecated"in e)||e.deprecated&&pe.lt(s,e.deprecated)}}};const{getSupportInfo:Ee}=de,fe=/[^\x20-\x7F]/;function Ce(e){return(t,n,r)=>{const s=r&&r.backwards;if(!1===n)return!1;const{length:i}=t;let u=n;for(;u>=0&&u<i;){const n=t.charAt(u);if(e instanceof RegExp){if(!e.test(n))return u}else if(!e.includes(n))return u;s?u--:u++}return(-1===u||u===i)&&u}}const Fe=Ce(/\s/),ve=Ce(" \t"),ge=Ce(",; \t"),me=Ce(/[^\n\r]/);function xe(e,t){if(!1===t)return!1;if("/"===e.charAt(t)&&"*"===e.charAt(t+1))for(let n=t+2;n<e.length;++n)if("*"===e.charAt(n)&&"/"===e.charAt(n+1))return n+2;return t}function Ae(e,t){return!1!==t&&("/"===e.charAt(t)&&"/"===e.charAt(t+1)?me(e,t):t)}function ye(e,t,n){const r=n&&n.backwards;if(!1===t)return!1;const s=e.charAt(t);if(r){if("\r"===e.charAt(t-1)&&"\n"===s)return t-2;if("\n"===s||"\r"===s||"\u2028"===s||"\u2029"===s)return t-1}else{if("\r"===s&&"\n"===e.charAt(t+1))return t+2;if("\n"===s||"\r"===s||"\u2028"===s||"\u2029"===s)return t+1}return t}function Se(e,t,n={}){const r=ve(e,n.backwards?t-1:t,n);return r!==ye(e,r,n)}function we(e,t){let n=null,r=t;for(;r!==n;)n=r,r=ge(e,r),r=xe(e,r),r=ve(e,r);return r=Ae(e,r),r=ye(e,r),!1!==r&&Se(e,r)}function Ie(e,t){let n=null,r=t;for(;r!==n;)n=r,r=ve(e,r),r=xe(e,r),r=Ae(e,r),r=ye(e,r);return r}function Ne(e,t,n){return Ie(e,n(t))}function Be(e,t,n=0){let r=0;for(let s=n;s<e.length;++s)"\t"===e[s]?r=r+t-r%t:r++;return r}function Oe(e,t){const n=e.slice(1,-1),r={quote:'"',regex:/"/g},s={quote:"'",regex:/'/g},i="'"===t?s:r,u=i===s?r:s;let a=i.quote;if(n.includes(i.quote)||n.includes(u.quote)){a=(n.match(i.regex)||[]).length>(n.match(u.regex)||[]).length?u.quote:i.quote}return a}function Pe(e,t,n){const r='"'===t?"'":'"',s=e.replace(/\\([\S\s])|(["'])/g,((e,s,i)=>s===r?s:i===t?"\\"+i:i||(n&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(s)?s:"\\"+s)));return t+s+t}function be(e,t){(e.comments||(e.comments=[])).push(t),t.printed=!1,t.nodeDescription=function(e){const t=e.type||e.kind||"(unknown type)";let n=String(e.name||e.id&&("object"==typeof e.id?e.id.name:e.id)||e.key&&("object"==typeof e.key?e.key.name:e.key)||e.value&&("object"==typeof e.value?"":String(e.value))||e.operator||"");n.length>20&&(n=n.slice(0,19)+"\u2026");return t+(n?" "+n:"")}(e)}var Te={inferParserByLanguage:function(e,t){const{languages:n}=Ee({plugins:t.plugins}),r=n.find((({name:t})=>t.toLowerCase()===e))||n.find((({aliases:t})=>Array.isArray(t)&&t.includes(e)))||n.find((({extensions:t})=>Array.isArray(t)&&t.includes(".".concat(e))));return r&&r.parsers[0]},replaceEndOfLineWith:function(e,t){const n=[];for(const r of e.split("\n"))n.length>0&&n.push(t),n.push(r);return n},getStringWidth:function(e){return e?fe.test(e)?i(e):e.length:0},getMaxContinuousCount:function(e,t){const n=e.match(new RegExp("(".concat(a(t),")+"),"g"));return null===n?0:n.reduce(((e,n)=>Math.max(e,n.length/t.length)),0)},getMinNotPresentContinuousCount:function(e,t){const n=e.match(new RegExp("(".concat(a(t),")+"),"g"));if(null===n)return 0;const r=new Map;let s=0;for(const e of n){const n=e.length/t.length;r.set(n,!0),n>s&&(s=n)}for(let e=1;e<s;e++)if(!r.get(e))return e;return s+1},getPenultimate:e=>e[e.length-2],getLast:o,getNextNonSpaceNonCommentCharacterIndexWithStartIndex:Ie,getNextNonSpaceNonCommentCharacterIndex:Ne,getNextNonSpaceNonCommentCharacter:function(e,t,n){return e.charAt(Ne(e,t,n))},skip:Ce,skipWhitespace:Fe,skipSpaces:ve,skipToLineEnd:ge,skipEverythingButNewLine:me,skipInlineComment:xe,skipTrailingComment:Ae,skipNewline:ye,isNextLineEmptyAfterIndex:we,isNextLineEmpty:function(e,t,n){return we(e,n(t))},isPreviousLineEmpty:function(e,t,n){let r=n(t)-1;return r=ve(e,r,{backwards:!0}),r=ye(e,r,{backwards:!0}),r=ve(e,r,{backwards:!0}),r!==ye(e,r,{backwards:!0})},hasNewline:Se,hasNewlineInRange:function(e,t,n){for(let r=t;r<n;++r)if("\n"===e.charAt(r))return!0;return!1},hasSpaces:function(e,t,n={}){return ve(e,n.backwards?t-1:t,n)!==t},getAlignmentSize:Be,getIndentSize:function(e,t){const n=e.lastIndexOf("\n");return-1===n?0:Be(e.slice(n+1).match(/^[\t ]*/)[0],t)},getPreferredQuote:Oe,printString:function(e,t){return Pe(e.slice(1,-1),"json"===t.parser||"json5"===t.parser&&"preserve"===t.quoteProps&&!t.singleQuote?'"':t.__isInHtmlAttribute?"'":Oe(e,t.singleQuote?"'":'"'),!("css"===t.parser||"less"===t.parser||"scss"===t.parser||t.__embeddedInHtml))},printNumber:function(e){return e.toLowerCase().replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(\d)/,"$1$2$3").replace(/^([+-]?[\d.]+)e[+-]?0+$/,"$1").replace(/^([+-])?\./,"$10.").replace(/(\.\d+?)0+(?=e|$)/,"$1").replace(/\.(?=e|$)/,"")},makeString:Pe,addLeadingComment:function(e,t){t.leading=!0,t.trailing=!1,be(e,t)},addDanglingComment:function(e,t,n){t.leading=!1,t.trailing=!1,n&&(t.marker=n),be(e,t)},addTrailingComment:function(e,t){t.leading=!1,t.trailing=!0,be(e,t)},isFrontMatterNode:function(e){return e&&"front-matter"===e.type},getShebang:function(e){if(!e.startsWith("#!"))return"";const t=e.indexOf("\n");return-1===t?e:e.slice(0,t)},isNonEmptyArray:function(e){return Array.isArray(e)&&e.length>0},createGroupIdMapper:function(e){const t=new WeakMap;return function(n){return t.has(n)||t.set(n,Symbol(e)),t.get(n)}}};const{isNonEmptyArray:Le}=Te;function Re(e,t){const{ignoreDecorators:n}=t||{};if(!n){const t=e.declaration&&e.declaration.decorators||e.decorators;if(Le(t))return Re(t[0])}return e.range?e.range[0]:e.start}function ke(e){return e.range?e.range[1]:e.end}function Me(e,t){return Re(e)===Re(t)}var _e,Ge={locStart:Re,locEnd:ke,hasSameLocStart:Me,hasSameLoc:function(e,t){return Me(e,t)&&function(e,t){return ke(e)===ke(t)}(e,t)}},je=_((function(e,t){var n="\n",r=function(){function e(e){this.string=e;for(var t=[0],r=0;r<e.length;)switch(e[r]){case n:r+=n.length,t.push(r);break;case"\r":e[r+="\r".length]===n&&(r+=n.length),t.push(r);break;default:r++}this.offsets=t}return e.prototype.locationForIndex=function(e){if(e<0||e>this.string.length)return null;for(var t=0,n=this.offsets;n[t+1]<=e;)t++;return{line:t,column:e-n[t]}},e.prototype.indexForLocation=function(e){var t=e.line,n=e.column;return t<0||t>=this.offsets.length||n<0||n>this.lengthOfLine(t)?null:this.offsets[t]+n},e.prototype.lengthOfLine=function(e){var t=this.offsets[e];return(e===this.offsets.length-1?this.string.length:this.offsets[e+1])-t},e}();t.__esModule=!0,t.default=r})),Ke=_((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Context=void 0;t.Context=class{constructor(e){this.text=e,this.locator=new n(this.text)}};class n{constructor(e){this._lineAndColumn=new je.default(e)}locationForIndex(e){const{line:t,column:n}=this._lineAndColumn.locationForIndex(e);return{line:t+1,column:n}}}}));
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
class Ue{constructor(e,t,n,r){this.input=t,this.errLocation=n,this.ctxLocation=r,this.message="Parser Error: ".concat(e," ").concat(n," [").concat(t,"] in ").concat(r)}}class $e{constructor(e,t){this.start=e,this.end=t}toAbsolute(e){return new Et(e+this.start,e+this.end)}}class We{constructor(e,t){this.span=e,this.sourceSpan=t}visit(e,t=null){return null}toString(){return"AST"}}class Ve extends We{constructor(e,t,n){super(e,t),this.nameSpan=n}}class Xe extends We{constructor(e,t,n,r,s){super(e,t),this.prefix=n,this.uninterpretedExpression=r,this.location=s}visit(e,t=null){return e.visitQuote(this,t)}toString(){return"Quote"}}class qe extends We{visit(e,t=null){}}class ze extends We{visit(e,t=null){return e.visitImplicitReceiver(this,t)}}class Qe extends ze{visit(e,t=null){var n;return null===(n=e.visitThisReceiver)||void 0===n?void 0:n.call(e,this,t)}}class Ye extends We{constructor(e,t,n){super(e,t),this.expressions=n}visit(e,t=null){return e.visitChain(this,t)}}class He extends We{constructor(e,t,n,r,s){super(e,t),this.condition=n,this.trueExp=r,this.falseExp=s}visit(e,t=null){return e.visitConditional(this,t)}}class Je extends Ve{constructor(e,t,n,r,s){super(e,t,n),this.receiver=r,this.name=s}visit(e,t=null){return e.visitPropertyRead(this,t)}}class Ze extends Ve{constructor(e,t,n,r,s,i){super(e,t,n),this.receiver=r,this.name=s,this.value=i}visit(e,t=null){return e.visitPropertyWrite(this,t)}}class et extends Ve{constructor(e,t,n,r,s){super(e,t,n),this.receiver=r,this.name=s}visit(e,t=null){return e.visitSafePropertyRead(this,t)}}class tt extends We{constructor(e,t,n,r){super(e,t),this.obj=n,this.key=r}visit(e,t=null){return e.visitKeyedRead(this,t)}}class nt extends We{constructor(e,t,n,r,s){super(e,t),this.obj=n,this.key=r,this.value=s}visit(e,t=null){return e.visitKeyedWrite(this,t)}}class rt extends Ve{constructor(e,t,n,r,s,i){super(e,t,i),this.exp=n,this.name=r,this.args=s}visit(e,t=null){return e.visitPipe(this,t)}}class st extends We{constructor(e,t,n){super(e,t),this.value=n}visit(e,t=null){return e.visitLiteralPrimitive(this,t)}}class it extends We{constructor(e,t,n){super(e,t),this.expressions=n}visit(e,t=null){return e.visitLiteralArray(this,t)}}class ut extends We{constructor(e,t,n,r){super(e,t),this.keys=n,this.values=r}visit(e,t=null){return e.visitLiteralMap(this,t)}}class at extends We{constructor(e,t,n,r){super(e,t),this.strings=n,this.expressions=r}visit(e,t=null){return e.visitInterpolation(this,t)}}class ot extends We{constructor(e,t,n,r,s){super(e,t),this.operation=n,this.left=r,this.right=s}visit(e,t=null){return e.visitBinary(this,t)}}class Dt extends ot{constructor(e,t,n,r,s,i,u){super(e,t,s,i,u),this.operator=n,this.expr=r}static createMinus(e,t,n){return new Dt(e,t,"-",n,"-",new st(e,t,0),n)}static createPlus(e,t,n){return new Dt(e,t,"+",n,"-",n,new st(e,t,0))}visit(e,t=null){return void 0!==e.visitUnary?e.visitUnary(this,t):e.visitBinary(this,t)}}class ct extends We{constructor(e,t,n){super(e,t),this.expression=n}visit(e,t=null){return e.visitPrefixNot(this,t)}}class pt extends We{constructor(e,t,n){super(e,t),this.expression=n}visit(e,t=null){return e.visitNonNullAssert(this,t)}}class ht extends Ve{constructor(e,t,n,r,s,i){super(e,t,n),this.receiver=r,this.name=s,this.args=i}visit(e,t=null){return e.visitMethodCall(this,t)}}class lt extends Ve{constructor(e,t,n,r,s,i){super(e,t,n),this.receiver=r,this.name=s,this.args=i}visit(e,t=null){return e.visitSafeMethodCall(this,t)}}class dt extends We{constructor(e,t,n,r){super(e,t),this.target=n,this.args=r}visit(e,t=null){return e.visitFunctionCall(this,t)}}class Et{constructor(e,t){this.start=e,this.end=t}}class ft extends We{constructor(e,t,n,r,s){super(new $e(0,null===t?0:t.length),new Et(r,null===t?r:r+t.length)),this.ast=e,this.source=t,this.location=n,this.errors=s}visit(e,t=null){return e.visitASTWithSource?e.visitASTWithSource(this,t):this.ast.visit(e,t)}toString(){return"".concat(this.source," in ").concat(this.location)}}class Ct{constructor(e,t,n){this.sourceSpan=e,this.key=t,this.value=n}}class Ft{constructor(e,t,n){this.sourceSpan=e,this.key=t,this.value=n}}class vt{visit(e,t){e.visit(this,t)}visitUnary(e,t){this.visit(e.expr,t)}visitBinary(e,t){this.visit(e.left,t),this.visit(e.right,t)}visitChain(e,t){this.visitAll(e.expressions,t)}visitConditional(e,t){this.visit(e.condition,t),this.visit(e.trueExp,t),this.visit(e.falseExp,t)}visitPipe(e,t){this.visit(e.exp,t),this.visitAll(e.args,t)}visitFunctionCall(e,t){e.target&&this.visit(e.target,t),this.visitAll(e.args,t)}visitImplicitReceiver(e,t){}visitThisReceiver(e,t){}visitInterpolation(e,t){this.visitAll(e.expressions,t)}visitKeyedRead(e,t){this.visit(e.obj,t),this.visit(e.key,t)}visitKeyedWrite(e,t){this.visit(e.obj,t),this.visit(e.key,t),this.visit(e.value,t)}visitLiteralArray(e,t){this.visitAll(e.expressions,t)}visitLiteralMap(e,t){this.visitAll(e.values,t)}visitLiteralPrimitive(e,t){}visitMethodCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitPrefixNot(e,t){this.visit(e.expression,t)}visitNonNullAssert(e,t){this.visit(e.expression,t)}visitPropertyRead(e,t){this.visit(e.receiver,t)}visitPropertyWrite(e,t){this.visit(e.receiver,t),this.visit(e.value,t)}visitSafePropertyRead(e,t){this.visit(e.receiver,t)}visitSafeMethodCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitQuote(e,t){}visitAll(e,t){for(const n of e)this.visit(n,t)}}!function(e){e[e.DEFAULT=0]="DEFAULT",e[e.LITERAL_ATTR=1]="LITERAL_ATTR",e[e.ANIMATION=2]="ANIMATION"}(_e||(_e={}));var gt=Object.freeze({__proto__:null,ParserError:Ue,ParseSpan:$e,AST:We,ASTWithName:Ve,Quote:Xe,EmptyExpr:qe,ImplicitReceiver:ze,ThisReceiver:Qe,Chain:Ye,Conditional:He,PropertyRead:Je,PropertyWrite:Ze,SafePropertyRead:et,KeyedRead:tt,KeyedWrite:nt,BindingPipe:rt,LiteralPrimitive:st,LiteralArray:it,LiteralMap:ut,Interpolation:at,Binary:ot,Unary:Dt,PrefixNot:ct,NonNullAssert:pt,MethodCall:ht,SafeMethodCall:lt,FunctionCall:dt,AbsoluteSourceSpan:Et,ASTWithSource:ft,VariableBinding:Ct,ExpressionBinding:Ft,RecursiveAstVisitor:vt,AstTransformer:class{visitImplicitReceiver(e,t){return e}visitThisReceiver(e,t){return e}visitInterpolation(e,t){return new at(e.span,e.sourceSpan,e.strings,this.visitAll(e.expressions))}visitLiteralPrimitive(e,t){return new st(e.span,e.sourceSpan,e.value)}visitPropertyRead(e,t){return new Je(e.span,e.sourceSpan,e.nameSpan,e.receiver.visit(this),e.name)}visitPropertyWrite(e,t){return new Ze(e.span,e.sourceSpan,e.nameSpan,e.receiver.visit(this),e.name,e.value.visit(this))}visitSafePropertyRead(e,t){return new et(e.span,e.sourceSpan,e.nameSpan,e.receiver.visit(this),e.name)}visitMethodCall(e,t){return new ht(e.span,e.sourceSpan,e.nameSpan,e.receiver.visit(this),e.name,this.visitAll(e.args))}visitSafeMethodCall(e,t){return new lt(e.span,e.sourceSpan,e.nameSpan,e.receiver.visit(this),e.name,this.visitAll(e.args))}visitFunctionCall(e,t){return new dt(e.span,e.sourceSpan,e.target.visit(this),this.visitAll(e.args))}visitLiteralArray(e,t){return new it(e.span,e.sourceSpan,this.visitAll(e.expressions))}visitLiteralMap(e,t){return new ut(e.span,e.sourceSpan,e.keys,this.visitAll(e.values))}visitUnary(e,t){switch(e.operator){case"+":return Dt.createPlus(e.span,e.sourceSpan,e.expr.visit(this));case"-":return Dt.createMinus(e.span,e.sourceSpan,e.expr.visit(this));default:throw new Error("Unknown unary operator ".concat(e.operator))}}visitBinary(e,t){return new ot(e.span,e.sourceSpan,e.operation,e.left.visit(this),e.right.visit(this))}visitPrefixNot(e,t){return new ct(e.span,e.sourceSpan,e.expression.visit(this))}visitNonNullAssert(e,t){return new pt(e.span,e.sourceSpan,e.expression.visit(this))}visitConditional(e,t){return new He(e.span,e.sourceSpan,e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this))}visitPipe(e,t){return new rt(e.span,e.sourceSpan,e.exp.visit(this),e.name,this.visitAll(e.args),e.nameSpan)}visitKeyedRead(e,t){return new tt(e.span,e.sourceSpan,e.obj.visit(this),e.key.visit(this))}visitKeyedWrite(e,t){return new nt(e.span,e.sourceSpan,e.obj.visit(this),e.key.visit(this),e.value.visit(this))}visitAll(e){const t=[];for(let n=0;n<e.length;++n)t[n]=e[n].visit(this);return t}visitChain(e,t){return new Ye(e.span,e.sourceSpan,this.visitAll(e.expressions))}visitQuote(e,t){return new Xe(e.span,e.sourceSpan,e.prefix,e.uninterpretedExpression,e.location)}},AstMemoryEfficientTransformer:class{visitImplicitReceiver(e,t){return e}visitThisReceiver(e,t){return e}visitInterpolation(e,t){const n=this.visitAll(e.expressions);return n!==e.expressions?new at(e.span,e.sourceSpan,e.strings,n):e}visitLiteralPrimitive(e,t){return e}visitPropertyRead(e,t){const n=e.receiver.visit(this);return n!==e.receiver?new Je(e.span,e.sourceSpan,e.nameSpan,n,e.name):e}visitPropertyWrite(e,t){const n=e.receiver.visit(this),r=e.value.visit(this);return n!==e.receiver||r!==e.value?new Ze(e.span,e.sourceSpan,e.nameSpan,n,e.name,r):e}visitSafePropertyRead(e,t){const n=e.receiver.visit(this);return n!==e.receiver?new et(e.span,e.sourceSpan,e.nameSpan,n,e.name):e}visitMethodCall(e,t){const n=e.receiver.visit(this),r=this.visitAll(e.args);return n!==e.receiver||r!==e.args?new ht(e.span,e.sourceSpan,e.nameSpan,n,e.name,r):e}visitSafeMethodCall(e,t){const n=e.receiver.visit(this),r=this.visitAll(e.args);return n!==e.receiver||r!==e.args?new lt(e.span,e.sourceSpan,e.nameSpan,n,e.name,r):e}visitFunctionCall(e,t){const n=e.target&&e.target.visit(this),r=this.visitAll(e.args);return n!==e.target||r!==e.args?new dt(e.span,e.sourceSpan,n,r):e}visitLiteralArray(e,t){const n=this.visitAll(e.expressions);return n!==e.expressions?new it(e.span,e.sourceSpan,n):e}visitLiteralMap(e,t){const n=this.visitAll(e.values);return n!==e.values?new ut(e.span,e.sourceSpan,e.keys,n):e}visitUnary(e,t){const n=e.expr.visit(this);if(n!==e.expr)switch(e.operator){case"+":return Dt.createPlus(e.span,e.sourceSpan,n);case"-":return Dt.createMinus(e.span,e.sourceSpan,n);default:throw new Error("Unknown unary operator ".concat(e.operator))}return e}visitBinary(e,t){const n=e.left.visit(this),r=e.right.visit(this);return n!==e.left||r!==e.right?new ot(e.span,e.sourceSpan,e.operation,n,r):e}visitPrefixNot(e,t){const n=e.expression.visit(this);return n!==e.expression?new ct(e.span,e.sourceSpan,n):e}visitNonNullAssert(e,t){const n=e.expression.visit(this);return n!==e.expression?new pt(e.span,e.sourceSpan,n):e}visitConditional(e,t){const n=e.condition.visit(this),r=e.trueExp.visit(this),s=e.falseExp.visit(this);return n!==e.condition||r!==e.trueExp||s!==e.falseExp?new He(e.span,e.sourceSpan,n,r,s):e}visitPipe(e,t){const n=e.exp.visit(this),r=this.visitAll(e.args);return n!==e.exp||r!==e.args?new rt(e.span,e.sourceSpan,n,e.name,r,e.nameSpan):e}visitKeyedRead(e,t){const n=e.obj.visit(this),r=e.key.visit(this);return n!==e.obj||r!==e.key?new tt(e.span,e.sourceSpan,n,r):e}visitKeyedWrite(e,t){const n=e.obj.visit(this),r=e.key.visit(this),s=e.value.visit(this);return n!==e.obj||r!==e.key||s!==e.value?new nt(e.span,e.sourceSpan,n,r,s):e}visitAll(e){const t=[];let n=!1;for(let r=0;r<e.length;++r){const s=e[r],i=s.visit(this);t[r]=i,n=n||i!==s}return n?t:e}visitChain(e,t){const n=this.visitAll(e.expressions);return n!==e.expressions?new Ye(e.span,e.sourceSpan,n):e}visitQuote(e,t){return e}},ParsedProperty:class{constructor(e,t,n,r,s,i){this.name=e,this.expression=t,this.type=n,this.sourceSpan=r,this.keySpan=s,this.valueSpan=i,this.isLiteral=this.type===_e.LITERAL_ATTR,this.isAnimation=this.type===_e.ANIMATION}},get ParsedPropertyType(){return _e},ParsedEvent:class{constructor(e,t,n,r,s,i,u){this.name=e,this.targetOrPhase=t,this.type=n,this.handler=r,this.sourceSpan=s,this.handlerSpan=i,this.keySpan=u}},ParsedVariable:class{constructor(e,t,n,r,s){this.name=e,this.value=t,this.sourceSpan=n,this.keySpan=r,this.valueSpan=s}},BoundElementProperty:class{constructor(e,t,n,r,s,i,u,a){this.name=e,this.type=t,this.securityContext=n,this.value=r,this.unit=s,this.sourceSpan=i,this.keySpan=u,this.valueSpan=a}}});
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright Google LLC All Rights Reserved.
|
|
13
|
+
*
|
|
14
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
15
|
+
* found in the LICENSE file at https://angular.io/license
|
|
16
|
+
*/function mt(e){return 48<=e&&e<=57}
|
|
17
|
+
/**
|
|
18
|
+
* @license
|
|
19
|
+
* Copyright Google LLC All Rights Reserved.
|
|
20
|
+
*
|
|
21
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
22
|
+
* found in the LICENSE file at https://angular.io/license
|
|
23
|
+
*/
|
|
24
|
+
var xt;!function(e){e[e.Character=0]="Character",e[e.Identifier=1]="Identifier",e[e.Keyword=2]="Keyword",e[e.String=3]="String",e[e.Operator=4]="Operator",e[e.Number=5]="Number",e[e.Error=6]="Error"}(xt||(xt={}));const At=["var","let","as","null","undefined","true","false","if","else","this"];class yt{constructor(e,t,n,r,s){this.index=e,this.end=t,this.type=n,this.numValue=r,this.strValue=s}isCharacter(e){return this.type==xt.Character&&this.numValue==e}isNumber(){return this.type==xt.Number}isString(){return this.type==xt.String}isOperator(e){return this.type==xt.Operator&&this.strValue==e}isIdentifier(){return this.type==xt.Identifier}isKeyword(){return this.type==xt.Keyword}isKeywordLet(){return this.type==xt.Keyword&&"let"==this.strValue}isKeywordAs(){return this.type==xt.Keyword&&"as"==this.strValue}isKeywordNull(){return this.type==xt.Keyword&&"null"==this.strValue}isKeywordUndefined(){return this.type==xt.Keyword&&"undefined"==this.strValue}isKeywordTrue(){return this.type==xt.Keyword&&"true"==this.strValue}isKeywordFalse(){return this.type==xt.Keyword&&"false"==this.strValue}isKeywordThis(){return this.type==xt.Keyword&&"this"==this.strValue}isError(){return this.type==xt.Error}toNumber(){return this.type==xt.Number?this.numValue:-1}toString(){switch(this.type){case xt.Character:case xt.Identifier:case xt.Keyword:case xt.Operator:case xt.String:case xt.Error:return this.strValue;case xt.Number:return this.numValue.toString();default:return null}}}function St(e,t,n){return new yt(e,t,xt.Character,n,String.fromCharCode(n))}function wt(e,t,n){return new yt(e,t,xt.Operator,0,n)}const It=new yt(-1,-1,xt.Character,0,"");class Nt{constructor(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}advance(){this.peek=++this.index>=this.length?0:this.input.charCodeAt(this.index)}scanToken(){const e=this.input,t=this.length;let n=this.peek,r=this.index;for(;n<=32;){if(++r>=t){n=0;break}n=e.charCodeAt(r)}if(this.peek=n,this.index=r,r>=t)return null;if(Bt(n))return this.scanIdentifier();if(mt(n))return this.scanNumber(r);const s=r;switch(n){case 46:return this.advance(),mt(this.peek)?this.scanNumber(s):St(s,this.index,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(s,n);case 39:case 34:return this.scanString();case 35:case 43:case 45:case 42:case 47:case 37:case 94:return this.scanOperator(s,String.fromCharCode(n));case 63:return this.scanComplexOperator(s,"?",46,".");case 60:case 62:return this.scanComplexOperator(s,String.fromCharCode(n),61,"=");case 33:case 61:return this.scanComplexOperator(s,String.fromCharCode(n),61,"=",61,"=");case 38:return this.scanComplexOperator(s,"&",38,"&");case 124:return this.scanComplexOperator(s,"|",124,"|");case 160:for(;(i=this.peek)>=9&&i<=32||160==i;)this.advance();return this.scanToken()}var i;return this.advance(),this.error("Unexpected character [".concat(String.fromCharCode(n),"]"),0)}scanCharacter(e,t){return this.advance(),St(e,this.index,t)}scanOperator(e,t){return this.advance(),wt(e,this.index,t)}scanComplexOperator(e,t,n,r,s,i){this.advance();let u=t;return this.peek==n&&(this.advance(),u+=r),null!=s&&this.peek==s&&(this.advance(),u+=i),wt(e,this.index,u)}scanIdentifier(){const e=this.index;for(this.advance();Pt(this.peek);)this.advance();const t=this.input.substring(e,this.index);return At.indexOf(t)>-1?(n=e,r=this.index,s=t,new yt(n,r,xt.Keyword,0,s)):function(e,t,n){return new yt(e,t,xt.Identifier,0,n)}(e,this.index,t);var n,r,s}scanNumber(e){let t=this.index===e;for(this.advance();;){if(mt(this.peek));else if(46==this.peek)t=!1;else{if(101!=(n=this.peek)&&69!=n)break;if(this.advance(),bt(this.peek)&&this.advance(),!mt(this.peek))return this.error("Invalid exponent",-1);t=!1}this.advance()}var n;const r=this.input.substring(e,this.index),s=t?function(e){const t=parseInt(e);if(isNaN(t))throw new Error("Invalid integer literal when parsing "+e);return t}(r):parseFloat(r);return i=e,u=this.index,a=s,new yt(i,u,xt.Number,a,"");var i,u,a}scanString(){const e=this.index,t=this.peek;this.advance();let n="",r=this.index;const s=this.input;for(;this.peek!=t;)if(92==this.peek){let e;if(n+=s.substring(r,this.index),this.advance(),this.peek=this.peek,117==this.peek){const t=s.substring(this.index+1,this.index+5);if(!/^[0-9a-f]+$/i.test(t))return this.error("Invalid unicode escape [\\u".concat(t,"]"),0);e=parseInt(t,16);for(let e=0;e<5;e++)this.advance()}else e=Lt(this.peek),this.advance();n+=String.fromCharCode(e),r=this.index}else{if(0==this.peek)return this.error("Unterminated quote",0);this.advance()}const i=s.substring(r,this.index);return this.advance(),u=e,a=this.index,o=n+i,new yt(u,a,xt.String,0,o);var u,a,o}error(e,t){const n=this.index+t;return function(e,t,n){return new yt(e,t,xt.Error,0,n)}(n,this.index,"Lexer Error: ".concat(e," at column ").concat(n," in expression [").concat(this.input,"]"))}}function Bt(e){return 97<=e&&e<=122||65<=e&&e<=90||95==e||36==e}function Ot(e){if(0==e.length)return!1;const t=new Nt(e);if(!Bt(t.peek))return!1;for(t.advance();0!==t.peek;){if(!Pt(t.peek))return!1;t.advance()}return!0}function Pt(e){return function(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||mt(e)||95==e||36==e}function bt(e){return 45==e||43==e}function Tt(e){return 39===e||34===e||96===e}function Lt(e){switch(e){case 110:return 10;case 102:return 12;case 114:return 13;case 116:return 9;case 118:return 11;default:return e}}var Rt=Object.freeze({__proto__:null,get TokenType(){return xt},Lexer:class{tokenize(e){const t=new Nt(e),n=[];let r=t.scanToken();for(;null!=r;)n.push(r),r=t.scanToken();return n}},Token:yt,EOF:It,isIdentifier:Ot,isQuote:Tt});
|
|
25
|
+
/**
|
|
26
|
+
* @license
|
|
27
|
+
* Copyright Google LLC All Rights Reserved.
|
|
28
|
+
*
|
|
29
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
30
|
+
* found in the LICENSE file at https://angular.io/license
|
|
31
|
+
*/const kt=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];
|
|
32
|
+
/**
|
|
33
|
+
* @license
|
|
34
|
+
* Copyright Google LLC All Rights Reserved.
|
|
35
|
+
*
|
|
36
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
37
|
+
* found in the LICENSE file at https://angular.io/license
|
|
38
|
+
*/
|
|
39
|
+
class Mt{constructor(e,t){this.start=e,this.end=t}static fromArray(e){return e?(function(e,t){if(!(null==t||Array.isArray(t)&&2==t.length))throw new Error("Expected '".concat(e,"' to be an array, [start, end]."));if(null!=t){const e=t[0],n=t[1];kt.forEach((t=>{if(t.test(e)||t.test(n))throw new Error("['".concat(e,"', '").concat(n,"'] contains unusable interpolation symbol."))}))}}("interpolation",e),new Mt(e[0],e[1])):_t}}const _t=new Mt("{{","}}");
|
|
40
|
+
/**
|
|
41
|
+
* @license
|
|
42
|
+
* Copyright Google LLC All Rights Reserved.
|
|
43
|
+
*
|
|
44
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
45
|
+
* found in the LICENSE file at https://angular.io/license
|
|
46
|
+
*/class Gt{constructor(e,t,n){this.strings=e,this.expressions=t,this.offsets=n}}class jt{constructor(e,t,n){this.templateBindings=e,this.warnings=t,this.errors=n}}class Kt{constructor(e){this._lexer=e,this.errors=[],this.simpleExpressionChecker=Wt}parseAction(e,t,n,r=_t){this._checkNoInterpolation(e,t,r);const s=this._stripComments(e),i=this._lexer.tokenize(this._stripComments(e)),u=new $t(e,t,n,i,s.length,!0,this.errors,e.length-s.length).parseChain();return new ft(u,e,t,n,this.errors)}parseBinding(e,t,n,r=_t){const s=this._parseBindingAst(e,t,n,r);return new ft(s,e,t,n,this.errors)}checkSimpleExpression(e){const t=new this.simpleExpressionChecker;return e.visit(t),t.errors}parseSimpleBinding(e,t,n,r=_t){const s=this._parseBindingAst(e,t,n,r),i=this.checkSimpleExpression(s);return i.length>0&&this._reportError("Host binding expression cannot contain ".concat(i.join(" ")),e,t),new ft(s,e,t,n,this.errors)}_reportError(e,t,n,r){this.errors.push(new Ue(e,t,n,r))}_parseBindingAst(e,t,n,r){const s=this._parseQuote(e,t,n);if(null!=s)return s;this._checkNoInterpolation(e,t,r);const i=this._stripComments(e),u=this._lexer.tokenize(i);return new $t(e,t,n,u,i.length,!1,this.errors,e.length-i.length).parseChain()}_parseQuote(e,t,n){if(null==e)return null;const r=e.indexOf(":");if(-1==r)return null;const s=e.substring(0,r).trim();if(!Ot(s))return null;const i=e.substring(r+1),u=new $e(0,e.length);return new Xe(u,u.toAbsolute(n),s,i,t)}parseTemplateBindings(e,t,n,r,s){const i=this._lexer.tokenize(t);return new $t(t,n,s,i,t.length,!1,this.errors,0).parseTemplateBindings({source:e,span:new Et(r,r+e.length)})}parseInterpolation(e,t,n,r=_t){const{strings:s,expressions:i,offsets:u}=this.splitInterpolation(e,t,r);if(0===i.length)return null;const a=[];for(let r=0;r<i.length;++r){const s=i[r].text,o=this._stripComments(s),D=this._lexer.tokenize(o),c=new $t(e,t,n,D,o.length,!1,this.errors,u[r]+(s.length-o.length)).parseChain();a.push(c)}return this.createInterpolationAst(s.map((e=>e.text)),a,e,t,n)}parseInterpolationExpression(e,t,n){const r=this._stripComments(e),s=this._lexer.tokenize(r),i=new $t(e,t,n,s,r.length,!1,this.errors,0).parseChain();return this.createInterpolationAst(["",""],[i],e,t,n)}createInterpolationAst(e,t,n,r,s){const i=new $e(0,n.length),u=new at(i,i.toAbsolute(s),e,t);return new ft(u,n,r,s,this.errors)}splitInterpolation(e,t,n=_t){const r=[],s=[],i=[];let u=0,a=!1,o=!1,{start:D,end:c}=n;for(;u<e.length;)if(a){const n=u,r=n+D.length,p=this._getInterpolationEndIndex(e,c,r);if(-1===p){a=!1,o=!0;break}const h=p+c.length,l=e.substring(r,p);0===l.trim().length&&this._reportError("Blank expressions are not allowed in interpolated strings",e,"at column ".concat(u," in"),t),s.push({text:l,start:n,end:h}),i.push(r),u=h,a=!1}else{const t=u;u=e.indexOf(D,u),-1===u&&(u=e.length);const n=e.substring(t,u);r.push({text:n,start:t,end:u}),a=!0}if(!a)if(o){const t=r[r.length-1];t.text+=e.substring(u),t.end=e.length}else r.push({text:e.substring(u),start:u,end:e.length});return new Gt(r,s,i)}wrapLiteralPrimitive(e,t,n){const r=new $e(0,null==e?0:e.length);return new ft(new st(r,r.toAbsolute(n),e),e,t,n,this.errors)}_stripComments(e){const t=this._commentStart(e);return null!=t?e.substring(0,t).trim():e}_commentStart(e){let t=null;for(let n=0;n<e.length-1;n++){const r=e.charCodeAt(n),s=e.charCodeAt(n+1);if(47===r&&47==s&&null==t)return n;t===r?t=null:null==t&&Tt(r)&&(t=r)}return null}_checkNoInterpolation(e,t,{start:n,end:r}){let s=-1,i=-1;for(const t of this._forEachUnquotedChar(e,0))if(-1===s)e.startsWith(n)&&(s=t);else if(i=this._getInterpolationEndIndex(e,r,t),i>-1)break;s>-1&&i>-1&&this._reportError("Got interpolation (".concat(n).concat(r,") where expression was expected"),e,"at column ".concat(s," in"),t)}_getInterpolationEndIndex(e,t,n){for(const r of this._forEachUnquotedChar(e,n)){if(e.startsWith(t,r))return r;if(e.startsWith("//",r))return e.indexOf(t,r)}return-1}*_forEachUnquotedChar(e,t){let n=null,r=0;for(let s=t;s<e.length;s++){const t=e[s];!Tt(e.charCodeAt(s))||null!==n&&n!==t||r%2!=0?null===n&&(yield s):n=null===n?t:null,r="\\"===t?r+1:0}}}var Ut;!function(e){e[e.None=0]="None",e[e.Writable=1]="Writable"}(Ut||(Ut={}));class $t{constructor(e,t,n,r,s,i,u,a){this.input=e,this.location=t,this.absoluteOffset=n,this.tokens=r,this.inputLength=s,this.parseAction=i,this.errors=u,this.offset=a,this.rparensExpected=0,this.rbracketsExpected=0,this.rbracesExpected=0,this.context=Ut.None,this.sourceSpanCache=new Map,this.index=0}peek(e){const t=this.index+e;return t<this.tokens.length?this.tokens[t]:It}get next(){return this.peek(0)}get atEOF(){return this.index>=this.tokens.length}get inputIndex(){return this.atEOF?this.currentEndIndex:this.next.index+this.offset}get currentEndIndex(){if(this.index>0){return this.peek(-1).end+this.offset}return 0===this.tokens.length?this.inputLength+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(e,t){let n=this.currentEndIndex;return void 0!==t&&t>this.currentEndIndex&&(n=t),new $e(e,n)}sourceSpan(e,t){const n="".concat(e,"@").concat(this.inputIndex,":").concat(t);return this.sourceSpanCache.has(n)||this.sourceSpanCache.set(n,this.span(e,t).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(n)}advance(){this.index++}withContext(e,t){this.context|=e;const n=t();return this.context^=e,n}consumeOptionalCharacter(e){return!!this.next.isCharacter(e)&&(this.advance(),!0)}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(e){this.consumeOptionalCharacter(e)||this.error("Missing expected ".concat(String.fromCharCode(e)))}consumeOptionalOperator(e){return!!this.next.isOperator(e)&&(this.advance(),!0)}expectOperator(e){this.consumeOptionalOperator(e)||this.error("Missing expected operator ".concat(e))}prettyPrintToken(e){return e===It?"end of input":"token ".concat(e)}expectIdentifierOrKeyword(){const e=this.next;return e.isIdentifier()||e.isKeyword()?(this.advance(),e.toString()):(this.error("Unexpected ".concat(this.prettyPrintToken(e),", expected identifier or keyword")),null)}expectIdentifierOrKeywordOrString(){const e=this.next;return e.isIdentifier()||e.isKeyword()||e.isString()?(this.advance(),e.toString()):(this.error("Unexpected ".concat(this.prettyPrintToken(e),", expected identifier, keyword, or string")),"")}parseChain(){const e=[],t=this.inputIndex;for(;this.index<this.tokens.length;){const t=this.parsePipe();if(e.push(t),this.consumeOptionalCharacter(59))for(this.parseAction||this.error("Binding expression cannot contain chained expression");this.consumeOptionalCharacter(59););else this.index<this.tokens.length&&this.error("Unexpected token '".concat(this.next,"'"))}if(0==e.length){const e=this.offset,t=this.offset+this.inputLength;return new qe(this.span(e,t),this.sourceSpan(e,t))}return 1==e.length?e[0]:new Ye(this.span(t),this.sourceSpan(t),e)}parsePipe(){const e=this.inputIndex;let t=this.parseExpression();if(this.consumeOptionalOperator("|")){this.parseAction&&this.error("Cannot have a pipe in an action expression");do{const n=this.inputIndex;let r,s,i=this.expectIdentifierOrKeyword();null!==i?r=this.sourceSpan(n):(i="",s=-1!==this.next.index?this.next.index:this.inputLength+this.offset,r=new $e(s,s).toAbsolute(this.absoluteOffset));const u=[];for(;this.consumeOptionalCharacter(58);)u.push(this.parseExpression());t=new rt(this.span(e),this.sourceSpan(e,s),t,i,u,r)}while(this.consumeOptionalOperator("|"))}return t}parseExpression(){return this.parseConditional()}parseConditional(){const e=this.inputIndex,t=this.parseLogicalOr();if(this.consumeOptionalOperator("?")){const n=this.parsePipe();let r;if(this.consumeOptionalCharacter(58))r=this.parsePipe();else{const t=this.inputIndex,n=this.input.substring(e,t);this.error("Conditional expression ".concat(n," requires all 3 expressions")),r=new qe(this.span(e),this.sourceSpan(e))}return new He(this.span(e),this.sourceSpan(e),t,n,r)}return t}parseLogicalOr(){const e=this.inputIndex;let t=this.parseLogicalAnd();for(;this.consumeOptionalOperator("||");){const n=this.parseLogicalAnd();t=new ot(this.span(e),this.sourceSpan(e),"||",t,n)}return t}parseLogicalAnd(){const e=this.inputIndex;let t=this.parseEquality();for(;this.consumeOptionalOperator("&&");){const n=this.parseEquality();t=new ot(this.span(e),this.sourceSpan(e),"&&",t,n)}return t}parseEquality(){const e=this.inputIndex;let t=this.parseRelational();for(;this.next.type==xt.Operator;){const n=this.next.strValue;switch(n){case"==":case"===":case"!=":case"!==":this.advance();const r=this.parseRelational();t=new ot(this.span(e),this.sourceSpan(e),n,t,r);continue}break}return t}parseRelational(){const e=this.inputIndex;let t=this.parseAdditive();for(;this.next.type==xt.Operator;){const n=this.next.strValue;switch(n){case"<":case">":case"<=":case">=":this.advance();const r=this.parseAdditive();t=new ot(this.span(e),this.sourceSpan(e),n,t,r);continue}break}return t}parseAdditive(){const e=this.inputIndex;let t=this.parseMultiplicative();for(;this.next.type==xt.Operator;){const n=this.next.strValue;switch(n){case"+":case"-":this.advance();let r=this.parseMultiplicative();t=new ot(this.span(e),this.sourceSpan(e),n,t,r);continue}break}return t}parseMultiplicative(){const e=this.inputIndex;let t=this.parsePrefix();for(;this.next.type==xt.Operator;){const n=this.next.strValue;switch(n){case"*":case"%":case"/":this.advance();let r=this.parsePrefix();t=new ot(this.span(e),this.sourceSpan(e),n,t,r);continue}break}return t}parsePrefix(){if(this.next.type==xt.Operator){const e=this.inputIndex;let t;switch(this.next.strValue){case"+":return this.advance(),t=this.parsePrefix(),Dt.createPlus(this.span(e),this.sourceSpan(e),t);case"-":return this.advance(),t=this.parsePrefix(),Dt.createMinus(this.span(e),this.sourceSpan(e),t);case"!":return this.advance(),t=this.parsePrefix(),new ct(this.span(e),this.sourceSpan(e),t)}}return this.parseCallChain()}parseCallChain(){const e=this.inputIndex;let t=this.parsePrimary();for(;;)if(this.consumeOptionalCharacter(46))t=this.parseAccessMemberOrMethodCall(t,e,!1);else if(this.consumeOptionalOperator("?."))t=this.parseAccessMemberOrMethodCall(t,e,!0);else if(this.consumeOptionalCharacter(91))this.withContext(Ut.Writable,(()=>{this.rbracketsExpected++;const n=this.parsePipe();if(n instanceof qe&&this.error("Key access cannot be empty"),this.rbracketsExpected--,this.expectCharacter(93),this.consumeOptionalOperator("=")){const r=this.parseConditional();t=new nt(this.span(e),this.sourceSpan(e),t,n,r)}else t=new tt(this.span(e),this.sourceSpan(e),t,n)}));else if(this.consumeOptionalCharacter(40)){this.rparensExpected++;const n=this.parseCallArguments();this.rparensExpected--,this.expectCharacter(41),t=new dt(this.span(e),this.sourceSpan(e),t,n)}else{if(!this.consumeOptionalOperator("!"))return t;t=new pt(this.span(e),this.sourceSpan(e),t)}}parsePrimary(){const e=this.inputIndex;if(this.consumeOptionalCharacter(40)){this.rparensExpected++;const e=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),e}if(this.next.isKeywordNull())return this.advance(),new st(this.span(e),this.sourceSpan(e),null);if(this.next.isKeywordUndefined())return this.advance(),new st(this.span(e),this.sourceSpan(e),void 0);if(this.next.isKeywordTrue())return this.advance(),new st(this.span(e),this.sourceSpan(e),!0);if(this.next.isKeywordFalse())return this.advance(),new st(this.span(e),this.sourceSpan(e),!1);if(this.next.isKeywordThis())return this.advance(),new Qe(this.span(e),this.sourceSpan(e));if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;const t=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new it(this.span(e),this.sourceSpan(e),t)}if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMemberOrMethodCall(new ze(this.span(e),this.sourceSpan(e)),e,!1);if(this.next.isNumber()){const t=this.next.toNumber();return this.advance(),new st(this.span(e),this.sourceSpan(e),t)}if(this.next.isString()){const t=this.next.toString();return this.advance(),new st(this.span(e),this.sourceSpan(e),t)}return this.index>=this.tokens.length?(this.error("Unexpected end of expression: ".concat(this.input)),new qe(this.span(e),this.sourceSpan(e))):(this.error("Unexpected token ".concat(this.next)),new qe(this.span(e),this.sourceSpan(e)))}parseExpressionList(e){const t=[];do{if(this.next.isCharacter(e))break;t.push(this.parsePipe())}while(this.consumeOptionalCharacter(44));return t}parseLiteralMap(){const e=[],t=[],n=this.inputIndex;if(this.expectCharacter(123),!this.consumeOptionalCharacter(125)){this.rbracesExpected++;do{const n=this.next.isString(),r=this.expectIdentifierOrKeywordOrString();e.push({key:r,quoted:n}),this.expectCharacter(58),t.push(this.parsePipe())}while(this.consumeOptionalCharacter(44));this.rbracesExpected--,this.expectCharacter(125)}return new ut(this.span(n),this.sourceSpan(n),e,t)}parseAccessMemberOrMethodCall(e,t,n=!1){const r=this.inputIndex,s=this.withContext(Ut.Writable,(()=>{var t;const n=null!==(t=this.expectIdentifierOrKeyword())&&void 0!==t?t:"";return 0===n.length&&this.error("Expected identifier for property access",e.span.end),n})),i=this.sourceSpan(r);if(this.consumeOptionalCharacter(40)){this.rparensExpected++;const r=this.parseCallArguments();this.expectCharacter(41),this.rparensExpected--;const u=this.span(t),a=this.sourceSpan(t);return n?new lt(u,a,i,e,s,r):new ht(u,a,i,e,s,r)}if(n)return this.consumeOptionalOperator("=")?(this.error("The '?.' operator cannot be used in the assignment"),new qe(this.span(t),this.sourceSpan(t))):new et(this.span(t),this.sourceSpan(t),i,e,s);if(this.consumeOptionalOperator("=")){if(!this.parseAction)return this.error("Bindings cannot contain assignments"),new qe(this.span(t),this.sourceSpan(t));const n=this.parseConditional();return new Ze(this.span(t),this.sourceSpan(t),i,e,s,n)}return new Je(this.span(t),this.sourceSpan(t),i,e,s)}parseCallArguments(){if(this.next.isCharacter(41))return[];const e=[];do{e.push(this.parsePipe())}while(this.consumeOptionalCharacter(44));return e}expectTemplateBindingKey(){let e="",t=!1;const n=this.currentAbsoluteOffset;do{e+=this.expectIdentifierOrKeywordOrString(),t=this.consumeOptionalOperator("-"),t&&(e+="-")}while(t);return{source:e,span:new Et(n,n+e.length)}}parseTemplateBindings(e){const t=[];for(t.push(...this.parseDirectiveKeywordBindings(e));this.index<this.tokens.length;){const n=this.parseLetBinding();if(n)t.push(n);else{const n=this.expectTemplateBindingKey(),r=this.parseAsBinding(n);r?t.push(r):(n.source=e.source+n.source.charAt(0).toUpperCase()+n.source.substring(1),t.push(...this.parseDirectiveKeywordBindings(n)))}this.consumeStatementTerminator()}return new jt(t,[],this.errors)}parseDirectiveKeywordBindings(e){const t=[];this.consumeOptionalCharacter(58);const n=this.getDirectiveBoundTarget();let r=this.currentAbsoluteOffset;const s=this.parseAsBinding(e);s||(this.consumeStatementTerminator(),r=this.currentAbsoluteOffset);const i=new Et(e.span.start,r);return t.push(new Ft(i,e,n)),s&&t.push(s),t}getDirectiveBoundTarget(){if(this.next===It||this.peekKeywordAs()||this.peekKeywordLet())return null;const e=this.parsePipe(),{start:t,end:n}=e.span,r=this.input.substring(t,n);return new ft(e,r,this.location,this.absoluteOffset+t,this.errors)}parseAsBinding(e){if(!this.peekKeywordAs())return null;this.advance();const t=this.expectTemplateBindingKey();this.consumeStatementTerminator();const n=new Et(e.span.start,this.currentAbsoluteOffset);return new Ct(n,t,e)}parseLetBinding(){if(!this.peekKeywordLet())return null;const e=this.currentAbsoluteOffset;this.advance();const t=this.expectTemplateBindingKey();let n=null;this.consumeOptionalOperator("=")&&(n=this.expectTemplateBindingKey()),this.consumeStatementTerminator();const r=new Et(e,this.currentAbsoluteOffset);return new Ct(r,t,n)}consumeStatementTerminator(){this.consumeOptionalCharacter(59)||this.consumeOptionalCharacter(44)}error(e,t=null){this.errors.push(new Ue(e,this.input,this.locationText(t),this.location)),this.skip()}locationText(e=null){return null==e&&(e=this.index),e<this.tokens.length?"at column ".concat(this.tokens[e].index+1," in"):"at the end of the expression"}skip(){let e=this.next;for(;!(!(this.index<this.tokens.length)||e.isCharacter(59)||e.isOperator("|")||!(this.rparensExpected<=0)&&e.isCharacter(41)||!(this.rbracesExpected<=0)&&e.isCharacter(125)||!(this.rbracketsExpected<=0)&&e.isCharacter(93)||this.context&Ut.Writable&&e.isOperator("="));)this.next.isError()&&this.errors.push(new Ue(this.next.toString(),this.input,this.locationText(),this.location)),this.advance(),e=this.next}}class Wt{constructor(){this.errors=[]}visitImplicitReceiver(e,t){}visitThisReceiver(e,t){}visitInterpolation(e,t){}visitLiteralPrimitive(e,t){}visitPropertyRead(e,t){}visitPropertyWrite(e,t){}visitSafePropertyRead(e,t){}visitMethodCall(e,t){}visitSafeMethodCall(e,t){}visitFunctionCall(e,t){}visitLiteralArray(e,t){this.visitAll(e.expressions,t)}visitLiteralMap(e,t){this.visitAll(e.values,t)}visitUnary(e,t){}visitBinary(e,t){}visitPrefixNot(e,t){}visitNonNullAssert(e,t){}visitConditional(e,t){}visitPipe(e,t){this.errors.push("pipes")}visitKeyedRead(e,t){}visitKeyedWrite(e,t){}visitAll(e,t){return e.map((e=>e.visit(this,t)))}visitChain(e,t){}visitQuote(e,t){}}class Vt extends vt{constructor(){super(...arguments),this.errors=[]}visitPipe(){this.errors.push("pipes")}}var Xt=Object.freeze({__proto__:null,SplitInterpolation:Gt,TemplateBindingParseResult:jt,Parser:Kt,IvyParser:class extends Kt{constructor(){super(...arguments),this.simpleExpressionChecker=Vt}},_ParseAST:$t}),qt=_((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getLast=t.toLowerCamelCase=t.findBackChar=t.findFrontChar=t.fitSpans=t.getNgType=t.parseNgInterpolation=t.parseNgTemplateBindings=t.parseNgAction=t.parseNgSimpleBinding=t.parseNgBinding=t.NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX=void 0;const n="angular-estree-parser";t.NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX="NgEstreeParser";const r=[n,0];function s(){return new Xt.Parser(new Rt.Lexer)}function i(e,t){const n=s(),{astInput:r,comments:i}=o(e,n),{ast:u,errors:D}=t(r,n);return a(D),{ast:u,comments:i}}function u(e,t){if(e&&"object"==typeof e){if(Array.isArray(e))return e.forEach((e=>u(e,t)));for(const n of Object.keys(e)){const r=e[n];"span"===n?t(r):u(r,t)}}}function a(e){if(0!==e.length){const[{message:t}]=e;throw new SyntaxError(t.replace(/^Parser Error: | at column \d+ in [^]*$/g,""))}}function o(e,t){const n=t._commentStart(e);return null===n?{astInput:e,comments:[]}:{astInput:e.slice(0,n),comments:[{type:"Comment",value:e.slice(n+"//".length),span:{start:n,end:e.length}}]}}function D({start:e,end:t},n){let r=e,s=t;for(;s!==r&&/\s/.test(n[s-1]);)s--;for(;r!==s&&/\s/.test(n[r]);)r++;return{start:r,end:s}}function c({start:e,end:t},n){let r=e,s=t;for(;s!==n.length&&/\s/.test(n[s]);)s++;for(;0!==r&&/\s/.test(n[r-1]);)r--;return{start:r,end:s}}function p(e,t){return"("===t[e.start-1]&&")"===t[e.end]?{start:e.start-1,end:e.end+1}:e}t.parseNgBinding=function(e){return i(e,((e,t)=>t.parseBinding(e,...r)))},t.parseNgSimpleBinding=function(e){return i(e,((e,t)=>t.parseSimpleBinding(e,...r)))},t.parseNgAction=function(e){return i(e,((e,t)=>t.parseAction(e,...r)))},t.parseNgTemplateBindings=function(e){const r=s(),{templateBindings:i,errors:u}=r.parseTemplateBindings(t.NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX,e,n,0,0);return a(u),i},t.parseNgInterpolation=function(e){const t=s(),{astInput:n,comments:i}=o(e,t),D="{{",{ast:c,errors:p}=t.parseInterpolation(D+n+"}}",...r);a(p);const h=c.expressions[0],l=new Set;return u(h,(e=>{l.has(e)||(e.start-=D.length,e.end-=D.length,l.add(e))})),{ast:h,comments:i}},t.getNgType=function(e){return gt.Unary&&e instanceof gt.Unary?"Unary":e instanceof gt.Binary?"Binary":e instanceof gt.BindingPipe?"BindingPipe":e instanceof gt.Chain?"Chain":e instanceof gt.Conditional?"Conditional":e instanceof gt.EmptyExpr?"EmptyExpr":e instanceof gt.FunctionCall?"FunctionCall":e instanceof gt.ImplicitReceiver?"ImplicitReceiver":e instanceof gt.KeyedRead?"KeyedRead":e instanceof gt.KeyedWrite?"KeyedWrite":e instanceof gt.LiteralArray?"LiteralArray":e instanceof gt.LiteralMap?"LiteralMap":e instanceof gt.LiteralPrimitive?"LiteralPrimitive":e instanceof gt.MethodCall?"MethodCall":e instanceof gt.NonNullAssert?"NonNullAssert":e instanceof gt.PrefixNot?"PrefixNot":e instanceof gt.PropertyRead?"PropertyRead":e instanceof gt.PropertyWrite?"PropertyWrite":e instanceof gt.Quote?"Quote":e instanceof gt.SafeMethodCall?"SafeMethodCall":e instanceof gt.SafePropertyRead?"SafePropertyRead":e.type},t.fitSpans=function(e,t,n){let r=0;const s={start:e.start,end:e.end};for(;;){const e=c(s,t),n=p(e,t);if(e.start===n.start&&e.end===n.end)break;s.start=n.start,s.end=n.end,r++}return{hasParens:0!==(n?r-1:r),outerSpan:D(n?{start:s.start+1,end:s.end-1}:s,t),innerSpan:D(e,t)}},t.findFrontChar=function(e,t,n){let r=t;for(;!e.test(n[r]);)if(--r<0)throw new Error("Cannot find front char ".concat(e," from index ").concat(t," in ").concat(JSON.stringify(n)));return r},t.findBackChar=function(e,t,n){let r=t;for(;!e.test(n[r]);)if(++r>=n.length)throw new Error("Cannot find back char ".concat(e," from index ").concat(t," in ").concat(JSON.stringify(n)));return r},t.toLowerCamelCase=function(e){return e.slice(0,1).toLowerCase()+e.slice(1)},t.getLast=function(e){return 0===e.length?void 0:e[e.length-1]}})),zt=_((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.transformSpan=t.transform=void 0;function n(e,t,n=!1,r=!1){if(!n){const{start:n,end:r}=e;return{start:n,end:r,loc:{start:t.locator.locationForIndex(n),end:t.locator.locationForIndex(r)}}}const{outerSpan:s,innerSpan:i,hasParens:u}=qt.fitSpans(e,t.text,r);return Object.assign({start:i.start,end:i.end,loc:{start:t.locator.locationForIndex(i.start),end:t.locator.locationForIndex(i.end)}},u&&{extra:{parenthesized:!0,parenStart:s.start,parenEnd:s.end}})}t.transform=(e,r,s=!1)=>{const i=qt.getNgType(e);switch(i){case"Unary":{const{operator:t,expr:n}=e;return o("UnaryExpression",{prefix:!0,argument:u(n),operator:t},e.span,{hasParentParens:s})}case"Binary":{const{left:t,operation:n,right:r}=e,i=r.span.start===r.span.end,a=t.span.start===t.span.end;if(i||a){const n=t.span.start===t.span.end?u(r):u(t);return o("UnaryExpression",{prefix:!0,argument:n,operator:i?"+":"-"},{start:e.span.start,end:f(n)},{hasParentParens:s})}const D=u(t),c=u(r);return o("&&"===n||"||"===n?"LogicalExpression":"BinaryExpression",{left:D,right:c,operator:n},{start:E(D),end:f(c)},{hasParentParens:s})}case"BindingPipe":{const{exp:t,name:n,args:r}=e,i=u(t),a=p(/\S/,p(/\|/,f(i))+1),D=o("Identifier",{name:n},{start:a,end:a+n.length}),c=r.map(u);return o("NGPipeExpression",{left:i,right:D,arguments:c},{start:E(i),end:f(0===c.length?D:qt.getLast(c))},{hasParentParens:s})}case"Chain":{const{expressions:t}=e;return o("NGChainedExpression",{expressions:t.map(u)},e.span,{hasParentParens:s})}case"Comment":{const{value:t}=e;return o("CommentLine",{value:t},e.span,{processSpan:!1})}case"Conditional":{const{condition:t,trueExp:n,falseExp:r}=e,i=u(t),a=u(n),D=u(r);return o("ConditionalExpression",{test:i,consequent:a,alternate:D},{start:E(i),end:f(D)},{hasParentParens:s})}case"EmptyExpr":return o("NGEmptyExpression",{},e.span,{hasParentParens:s});case"FunctionCall":{const{target:t,args:n}=e,r=1===n.length?[a(n[0])]:n.map(u),i=u(t);return o("CallExpression",{callee:i,arguments:r},{start:E(i),end:e.span.end},{hasParentParens:s})}case"ImplicitReceiver":return o("ThisExpression",{},e.span,{hasParentParens:s});case"KeyedRead":{const{obj:t,key:n}=e;return D(t,u(n),{computed:!0,optional:!1},{end:e.span.end,hasParentParens:s})}case"LiteralArray":{const{expressions:t}=e;return o("ArrayExpression",{elements:t.map(u)},e.span,{hasParentParens:s})}case"LiteralMap":{const{keys:t,values:n}=e,r=n.map((e=>u(e))),i=t.map((({key:t,quoted:n},s)=>{const i=r[s],u={start:p(/\S/,0===s?e.span.start+1:p(/,/,f(r[s-1]))+1),end:c(/\S/,c(/:/,E(i)-1)-1)+1},a=n?o("StringLiteral",{value:t},u):o("Identifier",{name:t},u);return o("ObjectProperty",{key:a,value:i,method:!1,shorthand:!1,computed:!1},{start:E(a),end:f(i)})}));return o("ObjectExpression",{properties:i},e.span,{hasParentParens:s})}case"LiteralPrimitive":{const{value:t}=e;switch(typeof t){case"boolean":return o("BooleanLiteral",{value:t},e.span,{hasParentParens:s});case"number":return o("NumericLiteral",{value:t},e.span,{hasParentParens:s});case"object":return o("NullLiteral",{},e.span,{hasParentParens:s});case"string":return o("StringLiteral",{value:t},e.span,{hasParentParens:s});case"undefined":return o("Identifier",{name:"undefined"},e.span,{hasParentParens:s});default:throw new Error("Unexpected LiteralPrimitive value type ".concat(typeof t))}}case"MethodCall":case"SafeMethodCall":{const t="SafeMethodCall"===i,{receiver:n,name:r,args:p}=e,h=1===p.length?[a(p[0])]:p.map(u),d=c(/\S/,c(/\(/,(0===h.length?c(/\)/,e.span.end-1):E(h[0]))-1)-1)+1,f=D(n,o("Identifier",{name:r},{start:d-r.length,end:d}),{computed:!1,optional:t}),C=l(f);return o(t||C?"OptionalCallExpression":"CallExpression",{callee:f,arguments:h},{start:E(f),end:e.span.end},{hasParentParens:s})}case"NonNullAssert":{const{expression:t}=e,n=u(t);return o("TSNonNullExpression",{expression:n},{start:E(n),end:e.span.end},{hasParentParens:s})}case"PrefixNot":{const{expression:t}=e,n=u(t);return o("UnaryExpression",{prefix:!0,operator:"!",argument:n},{start:e.span.start,end:f(n)},{hasParentParens:s})}case"PropertyRead":case"SafePropertyRead":{const t="SafePropertyRead"===i,{receiver:n,name:r}=e,u=c(/\S/,e.span.end-1)+1;return D(n,o("Identifier",{name:r},{start:u-r.length,end:u},h(n)?{hasParentParens:s}:{}),{computed:!1,optional:t},{hasParentParens:s})}case"KeyedWrite":{const{obj:t,key:n,value:r}=e,i=u(n),a=u(r),c=D(t,i,{computed:!0,optional:!1},{end:p(/\]/,f(i))+1});return o("AssignmentExpression",{left:c,operator:"=",right:a},{start:E(c),end:f(a)},{hasParentParens:s})}case"PropertyWrite":{const{receiver:t,name:n,value:r}=e,i=u(r),a=c(/\S/,c(/=/,E(i)-1)-1)+1,p=D(t,o("Identifier",{name:n},{start:a-n.length,end:a}),{computed:!1,optional:!1});return o("AssignmentExpression",{left:p,operator:"=",right:i},{start:E(p),end:f(i)},{hasParentParens:s})}case"Quote":{const{prefix:t,uninterpretedExpression:n}=e;return o("NGQuotedExpression",{prefix:t,value:n},e.span,{hasParentParens:s})}default:throw new Error("Unexpected node ".concat(i))}function u(e){return t.transform(e,r)}function a(e){return t.transform(e,r,!0)}function o(e,t,s,{processSpan:i=!0,hasParentParens:u=!1}={}){const a=Object.assign(Object.assign({type:e},n(s,r,i,u)),t);switch(e){case"Identifier":{const e=a;e.loc.identifierName=e.name;break}case"NumericLiteral":{const e=a;e.extra=Object.assign(Object.assign({},e.extra),{raw:r.text.slice(e.start,e.end),rawValue:e.value});break}case"StringLiteral":{const e=a;e.extra=Object.assign(Object.assign({},e.extra),{raw:r.text.slice(e.start,e.end),rawValue:e.value});break}}return a}function D(e,t,n,{end:r=f(t),hasParentParens:s=!1}={}){if(h(e))return t;const i=u(e),a=l(i);return o(n.optional||a?"OptionalMemberExpression":"MemberExpression",Object.assign({object:i,property:t,computed:n.computed},n.optional?{optional:!0}:a?{optional:!1}:null),{start:E(i),end:r},{hasParentParens:s})}function c(e,t){return qt.findFrontChar(e,t,r.text)}function p(e,t){return qt.findBackChar(e,t,r.text)}function h(e){return e.span.start>=e.span.end}function l(e){return("OptionalCallExpression"===e.type||"OptionalMemberExpression"===e.type)&&!d(e)}function d(e){return e.extra&&e.extra.parenthesized}function E(e){return d(e)?e.extra.parenStart:e.start}function f(e){return d(e)?e.extra.parenEnd:e.end}},t.transformSpan=n})),Qt=_((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.transformTemplateBindings=void 0,t.transformTemplateBindings=function(e,t){e.forEach((function(e){l(e.key.span),h(e)&&e.value&&l(e.value.span)}));const[n]=e,{key:r}=n,s=0===t.text.slice(n.sourceSpan.start,n.sourceSpan.end).trim().length?e.slice(1):e,i=[];let u=null;for(let e=0;e<s.length;e++){const n=s[e];if(u&&p(u)&&h(n)&&n.value&&n.value.source===u.key.source){const e=D("NGMicrosyntaxKey",{name:n.key.source},n.key.span),r=(e,n)=>Object.assign(Object.assign({},e),zt.transformSpan({start:e.start,end:n},t)),s=t=>Object.assign(Object.assign({},r(t,e.end)),{alias:e}),u=i.pop();if("NGMicrosyntaxExpression"===u.type)i.push(s(u));else{if("NGMicrosyntaxKeyedExpression"!==u.type)throw new Error("Unexpected type ".concat(u.type));{const e=s(u.expression);i.push(r(Object.assign(Object.assign({},u),{expression:e}),e.end))}}}else i.push(a(n,e));u=n}return D("NGMicrosyntax",{body:i},0===i.length?e[0].sourceSpan:{start:i[0].start,end:i[i.length-1].end});function a(e,n){if(p(e)){const{key:t,value:r}=e;return r?0===n?D("NGMicrosyntaxExpression",{expression:o(r.ast),alias:null},r.sourceSpan):D("NGMicrosyntaxKeyedExpression",{key:D("NGMicrosyntaxKey",{name:c(t.source)},t.span),expression:D("NGMicrosyntaxExpression",{expression:o(r.ast),alias:null},r.sourceSpan)},{start:t.span.start,end:r.sourceSpan.end}):D("NGMicrosyntaxKey",{name:c(t.source)},t.span)}{const{key:n,sourceSpan:r}=e;if(/^let\s$/.test(t.text.slice(r.start,r.start+4))){const{value:t}=e;return D("NGMicrosyntaxLet",{key:D("NGMicrosyntaxKey",{name:n.source},n.span),value:t?D("NGMicrosyntaxKey",{name:t.source},t.span):null},{start:r.start,end:t?t.span.end:n.span.end})}{const r=function(e){if(!e.value||e.value.source!==qt.NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX)return e.value;const n=qt.findBackChar(/\S/,e.sourceSpan.start,t.text);return{source:"$implicit",span:{start:n,end:n}}}(e);return D("NGMicrosyntaxAs",{key:D("NGMicrosyntaxKey",{name:r.source},r.span),alias:D("NGMicrosyntaxKey",{name:n.source},n.span)},{start:r.span.start,end:n.span.end})}}}function o(e){return zt.transform(e,t)}function D(e,n,r,s=!0){return Object.assign(Object.assign({type:e},zt.transformSpan(r,t,s)),n)}function c(e){return qt.toLowerCamelCase(e.slice(r.source.length))}function p(e){return e instanceof gt.ExpressionBinding}function h(e){return e instanceof gt.VariableBinding}function l(e){if('"'!==t.text[e.start]&&"'"!==t.text[e.start])return;const n=t.text[e.start];let r=!1;for(let s=e.start+1;s<t.text.length;s++)switch(t.text[s]){case n:if(!r)return void(e.end=s+1);default:r=!1;break;case"\\":r=!r}}}})),Yt=_((function(e,t){function n(e,t){const{ast:n,comments:r}=t(e),s=new Ke.Context(e),i=e=>zt.transform(e,s),u=i(n);return u.comments=r.map(i),u}Object.defineProperty(t,"__esModule",{value:!0}),t.parseTemplateBindings=t.parseAction=t.parseInterpolation=t.parseSimpleBinding=t.parseBinding=void 0,t.parseBinding=function(e){return n(e,qt.parseNgBinding)},t.parseSimpleBinding=function(e){return n(e,qt.parseNgSimpleBinding)},t.parseInterpolation=function(e){return n(e,qt.parseNgInterpolation)},t.parseAction=function(e){return n(e,qt.parseNgAction)},t.parseTemplateBindings=function(e){return Qt.transformTemplateBindings(qt.parseNgTemplateBindings(e),new Ke.Context(e))}}));const{locStart:Ht,locEnd:Jt}=Ge;function Zt(e){return{astFormat:"estree",parse:(t,n,r)=>{const s=e(t,Yt);return{type:"NGRoot",node:"__ng_action"===r.parser&&"NGChainedExpression"!==s.type?Object.assign({},s,{type:"NGChainedExpression",expressions:[s]}):s}},locStart:Ht,locEnd:Jt}}var en={parsers:{__ng_action:Zt(((e,t)=>t.parseAction(e))),__ng_binding:Zt(((e,t)=>t.parseBinding(e))),__ng_interpolation:Zt(((e,t)=>t.parseInterpolation(e))),__ng_directive:Zt(((e,t)=>t.parseTemplateBindings(e)))}};export default en;
|