@govtechsg/oobee 0.10.20

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.
Files changed (123) hide show
  1. package/.dockerignore +22 -0
  2. package/.github/pull_request_template.md +11 -0
  3. package/.github/workflows/docker-test.yml +54 -0
  4. package/.github/workflows/image.yml +107 -0
  5. package/.github/workflows/publish.yml +18 -0
  6. package/.idea/modules.xml +8 -0
  7. package/.idea/purple-a11y.iml +9 -0
  8. package/.idea/vcs.xml +6 -0
  9. package/.prettierrc.json +12 -0
  10. package/.vscode/extensions.json +5 -0
  11. package/.vscode/settings.json +10 -0
  12. package/CODE_OF_CONDUCT.md +128 -0
  13. package/DETAILS.md +163 -0
  14. package/Dockerfile +60 -0
  15. package/INSTALLATION.md +146 -0
  16. package/INTEGRATION.md +785 -0
  17. package/LICENSE +22 -0
  18. package/README.md +587 -0
  19. package/SECURITY.md +5 -0
  20. package/__mocks__/mock-report.html +1431 -0
  21. package/__mocks__/mockFunctions.ts +32 -0
  22. package/__mocks__/mockIssues.ts +64 -0
  23. package/__mocks__/mock_all_issues/000000001.json +64 -0
  24. package/__mocks__/mock_all_issues/000000002.json +53 -0
  25. package/__mocks__/mock_all_issues/fake-file.txt +0 -0
  26. package/__tests__/logs.test.ts +25 -0
  27. package/__tests__/mergeAxeResults.test.ts +278 -0
  28. package/__tests__/utils.test.ts +118 -0
  29. package/a11y-scan-results.zip +0 -0
  30. package/eslint.config.js +53 -0
  31. package/exclusions.txt +2 -0
  32. package/gitlab-pipeline-template.yml +54 -0
  33. package/jest.config.js +1 -0
  34. package/package.json +96 -0
  35. package/scripts/copyFiles.js +44 -0
  36. package/scripts/install_oobee_dependencies.cmd +13 -0
  37. package/scripts/install_oobee_dependencies.command +101 -0
  38. package/scripts/install_oobee_dependencies.ps1 +110 -0
  39. package/scripts/oobee_shell.cmd +13 -0
  40. package/scripts/oobee_shell.command +11 -0
  41. package/scripts/oobee_shell.sh +55 -0
  42. package/scripts/oobee_shell_ps.ps1 +54 -0
  43. package/src/cli.ts +401 -0
  44. package/src/combine.ts +240 -0
  45. package/src/constants/__tests__/common.test.ts +44 -0
  46. package/src/constants/cliFunctions.ts +305 -0
  47. package/src/constants/common.ts +1840 -0
  48. package/src/constants/constants.ts +443 -0
  49. package/src/constants/errorMeta.json +319 -0
  50. package/src/constants/itemTypeDescription.ts +11 -0
  51. package/src/constants/oobeeAi.ts +141 -0
  52. package/src/constants/questions.ts +181 -0
  53. package/src/constants/sampleData.ts +187 -0
  54. package/src/crawlers/__tests__/commonCrawlerFunc.test.ts +51 -0
  55. package/src/crawlers/commonCrawlerFunc.ts +656 -0
  56. package/src/crawlers/crawlDomain.ts +877 -0
  57. package/src/crawlers/crawlIntelligentSitemap.ts +156 -0
  58. package/src/crawlers/crawlLocalFile.ts +193 -0
  59. package/src/crawlers/crawlSitemap.ts +356 -0
  60. package/src/crawlers/custom/extractAndGradeText.ts +57 -0
  61. package/src/crawlers/custom/flagUnlabelledClickableElements.ts +964 -0
  62. package/src/crawlers/custom/utils.ts +486 -0
  63. package/src/crawlers/customAxeFunctions.ts +82 -0
  64. package/src/crawlers/pdfScanFunc.ts +468 -0
  65. package/src/crawlers/runCustom.ts +117 -0
  66. package/src/index.ts +173 -0
  67. package/src/logs.ts +66 -0
  68. package/src/mergeAxeResults.ts +964 -0
  69. package/src/npmIndex.ts +284 -0
  70. package/src/screenshotFunc/htmlScreenshotFunc.ts +411 -0
  71. package/src/screenshotFunc/pdfScreenshotFunc.ts +762 -0
  72. package/src/static/ejs/partials/components/categorySelector.ejs +4 -0
  73. package/src/static/ejs/partials/components/categorySelectorDropdown.ejs +57 -0
  74. package/src/static/ejs/partials/components/pagesScannedModal.ejs +70 -0
  75. package/src/static/ejs/partials/components/reportSearch.ejs +47 -0
  76. package/src/static/ejs/partials/components/ruleOffcanvas.ejs +105 -0
  77. package/src/static/ejs/partials/components/scanAbout.ejs +263 -0
  78. package/src/static/ejs/partials/components/screenshotLightbox.ejs +13 -0
  79. package/src/static/ejs/partials/components/summaryScanAbout.ejs +141 -0
  80. package/src/static/ejs/partials/components/summaryScanResults.ejs +16 -0
  81. package/src/static/ejs/partials/components/summaryTable.ejs +20 -0
  82. package/src/static/ejs/partials/components/summaryWcagCompliance.ejs +94 -0
  83. package/src/static/ejs/partials/components/topFive.ejs +6 -0
  84. package/src/static/ejs/partials/components/wcagCompliance.ejs +70 -0
  85. package/src/static/ejs/partials/footer.ejs +21 -0
  86. package/src/static/ejs/partials/header.ejs +230 -0
  87. package/src/static/ejs/partials/main.ejs +40 -0
  88. package/src/static/ejs/partials/scripts/bootstrap.ejs +8 -0
  89. package/src/static/ejs/partials/scripts/categorySelectorDropdownScript.ejs +190 -0
  90. package/src/static/ejs/partials/scripts/categorySummary.ejs +141 -0
  91. package/src/static/ejs/partials/scripts/highlightjs.ejs +335 -0
  92. package/src/static/ejs/partials/scripts/popper.ejs +7 -0
  93. package/src/static/ejs/partials/scripts/reportSearch.ejs +248 -0
  94. package/src/static/ejs/partials/scripts/ruleOffcanvas.ejs +801 -0
  95. package/src/static/ejs/partials/scripts/screenshotLightbox.ejs +71 -0
  96. package/src/static/ejs/partials/scripts/summaryScanResults.ejs +14 -0
  97. package/src/static/ejs/partials/scripts/summaryTable.ejs +78 -0
  98. package/src/static/ejs/partials/scripts/utils.ejs +441 -0
  99. package/src/static/ejs/partials/styles/bootstrap.ejs +12375 -0
  100. package/src/static/ejs/partials/styles/highlightjs.ejs +54 -0
  101. package/src/static/ejs/partials/styles/styles.ejs +1843 -0
  102. package/src/static/ejs/partials/styles/summaryBootstrap.ejs +12458 -0
  103. package/src/static/ejs/partials/summaryHeader.ejs +70 -0
  104. package/src/static/ejs/partials/summaryMain.ejs +75 -0
  105. package/src/static/ejs/report.ejs +420 -0
  106. package/src/static/ejs/summary.ejs +47 -0
  107. package/src/static/mustache/.prettierrc +4 -0
  108. package/src/static/mustache/Attention Deficit.mustache +11 -0
  109. package/src/static/mustache/Blind.mustache +11 -0
  110. package/src/static/mustache/Cognitive.mustache +7 -0
  111. package/src/static/mustache/Colorblindness.mustache +20 -0
  112. package/src/static/mustache/Deaf.mustache +12 -0
  113. package/src/static/mustache/Deafblind.mustache +7 -0
  114. package/src/static/mustache/Dyslexia.mustache +14 -0
  115. package/src/static/mustache/Low Vision.mustache +7 -0
  116. package/src/static/mustache/Mobility.mustache +15 -0
  117. package/src/static/mustache/Sighted Keyboard Users.mustache +42 -0
  118. package/src/static/mustache/report.mustache +1709 -0
  119. package/src/types/print-message.d.ts +28 -0
  120. package/src/types/types.ts +46 -0
  121. package/src/types/xpath-to-css.d.ts +3 -0
  122. package/src/utils.ts +332 -0
  123. package/tsconfig.json +15 -0
@@ -0,0 +1,335 @@
1
+ <script>
2
+ /*!
3
+ Highlight.js v11.7.0 (git: 82688fad18)
4
+ (c) 2006-2022 undefined and other contributors
5
+ License: BSD-3-Clause
6
+ */
7
+ var hljs=function(){"use strict";var e={exports:{}};function t(e){
8
+ return e instanceof Map?e.clear=e.delete=e.set=()=>{
9
+ throw Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=()=>{
10
+ throw Error("set is read-only")
11
+ }),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((n=>{var i=e[n]
12
+ ;"object"!=typeof i||Object.isFrozen(i)||t(i)})),e}
13
+ e.exports=t,e.exports.default=t;class n{constructor(e){
14
+ void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}
15
+ ignoreMatch(){this.isMatchIgnored=!0}}function i(e){
16
+ return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")
17
+ }function r(e,...t){const n=Object.create(null);for(const t in e)n[t]=e[t]
18
+ ;return t.forEach((e=>{for(const t in e)n[t]=e[t]})),n}
19
+ const s=e=>!!e.scope||e.sublanguage&&e.language;class o{constructor(e,t){
20
+ this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){
21
+ this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=""
22
+ ;t=e.sublanguage?"language-"+e.language:((e,{prefix:t})=>{if(e.includes(".")){
23
+ const n=e.split(".")
24
+ ;return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ")
25
+ }return`${t}${e}`})(e.scope,{prefix:this.classPrefix}),this.span(t)}
26
+ closeNode(e){s(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){
27
+ this.buffer+=`<span class="${e}">`}}const a=(e={})=>{const t={children:[]}
28
+ ;return Object.assign(t,e),t};class c{constructor(){
29
+ this.rootNode=a(),this.stack=[this.rootNode]}get top(){
30
+ return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){
31
+ this.top.children.push(e)}openNode(e){const t=a({scope:e})
32
+ ;this.add(t),this.stack.push(t)}closeNode(){
33
+ if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){
34
+ for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}
35
+ walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){
36
+ return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),
37
+ t.children.forEach((t=>this._walk(e,t))),e.closeNode(t)),e}static _collapse(e){
38
+ "string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{
39
+ c._collapse(e)})))}}class l extends c{constructor(e){super(),this.options=e}
40
+ addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())}
41
+ addText(e){""!==e&&this.add(e)}addSublanguage(e,t){const n=e.root
42
+ ;n.sublanguage=!0,n.language=t,this.add(n)}toHTML(){
43
+ return new o(this,this.options).value()}finalize(){return!0}}function g(e){
44
+ return e?"string"==typeof e?e:e.source:null}function d(e){return p("(?=",e,")")}
45
+ function u(e){return p("(?:",e,")*")}function h(e){return p("(?:",e,")?")}
46
+ function p(...e){return e.map((e=>g(e))).join("")}function f(...e){const t=(e=>{
47
+ const t=e[e.length-1]
48
+ ;return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}
49
+ })(e);return"("+(t.capture?"":"?:")+e.map((e=>g(e))).join("|")+")"}
50
+ function b(e){return RegExp(e.toString()+"|").exec("").length-1}
51
+ const m=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./
52
+ ;function E(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n
53
+ ;let i=g(e),r="";for(;i.length>0;){const e=m.exec(i);if(!e){r+=i;break}
54
+ r+=i.substring(0,e.index),
55
+ i=i.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?r+="\\"+(Number(e[1])+t):(r+=e[0],
56
+ "("===e[0]&&n++)}return r})).map((e=>`(${e})`)).join(t)}
57
+ const x="[a-zA-Z]\\w*",w="[a-zA-Z_]\\w*",y="\\b\\d+(\\.\\d+)?",_="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",O="\\b(0b[01]+)",v={
58
+ begin:"\\\\[\\s\\S]",relevance:0},N={scope:"string",begin:"'",end:"'",
59
+ illegal:"\\n",contains:[v]},k={scope:"string",begin:'"',end:'"',illegal:"\\n",
60
+ contains:[v]},M=(e,t,n={})=>{const i=r({scope:"comment",begin:e,end:t,
61
+ contains:[]},n);i.contains.push({scope:"doctag",
62
+ begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
63
+ end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0})
64
+ ;const s=f("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/)
65
+ ;return i.contains.push({begin:p(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i
66
+ },S=M("//","$"),R=M("/\\*","\\*/"),j=M("#","$");var A=Object.freeze({
67
+ __proto__:null,MATCH_NOTHING_RE:/\b\B/,IDENT_RE:x,UNDERSCORE_IDENT_RE:w,
68
+ NUMBER_RE:y,C_NUMBER_RE:_,BINARY_NUMBER_RE:O,
69
+ RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",
70
+ SHEBANG:(e={})=>{const t=/^#![ ]*\//
71
+ ;return e.binary&&(e.begin=p(t,/.*\b/,e.binary,/\b.*/)),r({scope:"meta",begin:t,
72
+ end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},
73
+ BACKSLASH_ESCAPE:v,APOS_STRING_MODE:N,QUOTE_STRING_MODE:k,PHRASAL_WORDS_MODE:{
74
+ begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
75
+ },COMMENT:M,C_LINE_COMMENT_MODE:S,C_BLOCK_COMMENT_MODE:R,HASH_COMMENT_MODE:j,
76
+ NUMBER_MODE:{scope:"number",begin:y,relevance:0},C_NUMBER_MODE:{scope:"number",
77
+ begin:_,relevance:0},BINARY_NUMBER_MODE:{scope:"number",begin:O,relevance:0},
78
+ REGEXP_MODE:{begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//,
79
+ end:/\/[gimuy]*/,illegal:/\n/,contains:[v,{begin:/\[/,end:/\]/,relevance:0,
80
+ contains:[v]}]}]},TITLE_MODE:{scope:"title",begin:x,relevance:0},
81
+ UNDERSCORE_TITLE_MODE:{scope:"title",begin:w,relevance:0},METHOD_GUARD:{
82
+ begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0},END_SAME_AS_BEGIN:e=>Object.assign(e,{
83
+ "on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{
84
+ t.data._beginMatch!==e[1]&&t.ignoreMatch()}})});function I(e,t){
85
+ "."===e.input[e.index-1]&&t.ignoreMatch()}function T(e,t){
86
+ void 0!==e.className&&(e.scope=e.className,delete e.className)}function L(e,t){
87
+ t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",
88
+ e.__beforeBegin=I,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,
89
+ void 0===e.relevance&&(e.relevance=0))}function B(e,t){
90
+ Array.isArray(e.illegal)&&(e.illegal=f(...e.illegal))}function D(e,t){
91
+ if(e.match){
92
+ if(e.begin||e.end)throw Error("begin & end are not supported with match")
93
+ ;e.begin=e.match,delete e.match}}function H(e,t){
94
+ void 0===e.relevance&&(e.relevance=1)}const P=(e,t)=>{if(!e.beforeMatch)return
95
+ ;if(e.starts)throw Error("beforeMatch cannot be used with starts")
96
+ ;const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t]
97
+ })),e.keywords=n.keywords,e.begin=p(n.beforeMatch,d(n.begin)),e.starts={
98
+ relevance:0,contains:[Object.assign(n,{endsParent:!0})]
99
+ },e.relevance=0,delete n.beforeMatch
100
+ },C=["of","and","for","in","not","or","if","then","parent","list","value"]
101
+ ;function $(e,t,n="keyword"){const i=Object.create(null)
102
+ ;return"string"==typeof e?r(n,e.split(" ")):Array.isArray(e)?r(n,e):Object.keys(e).forEach((n=>{
103
+ Object.assign(i,$(e[n],t,n))})),i;function r(e,n){
104
+ t&&(n=n.map((e=>e.toLowerCase()))),n.forEach((t=>{const n=t.split("|")
105
+ ;i[n[0]]=[e,U(n[0],n[1])]}))}}function U(e,t){
106
+ return t?Number(t):(e=>C.includes(e.toLowerCase()))(e)?0:1}const z={},K=e=>{
107
+ console.error(e)},W=(e,...t)=>{console.log("WARN: "+e,...t)},X=(e,t)=>{
108
+ z[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),z[`${e}/${t}`]=!0)
109
+ },G=Error();function Z(e,t,{key:n}){let i=0;const r=e[n],s={},o={}
110
+ ;for(let e=1;e<=t.length;e++)o[e+i]=r[e],s[e+i]=!0,i+=b(t[e-1])
111
+ ;e[n]=o,e[n]._emit=s,e[n]._multi=!0}function F(e){(e=>{
112
+ e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,
113
+ delete e.scope)})(e),"string"==typeof e.beginScope&&(e.beginScope={
114
+ _wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope
115
+ }),(e=>{if(Array.isArray(e.begin)){
116
+ if(e.skip||e.excludeBegin||e.returnBegin)throw K("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),
117
+ G
118
+ ;if("object"!=typeof e.beginScope||null===e.beginScope)throw K("beginScope must be object"),
119
+ G;Z(e,e.begin,{key:"beginScope"}),e.begin=E(e.begin,{joinWith:""})}})(e),(e=>{
120
+ if(Array.isArray(e.end)){
121
+ if(e.skip||e.excludeEnd||e.returnEnd)throw K("skip, excludeEnd, returnEnd not compatible with endScope: {}"),
122
+ G
123
+ ;if("object"!=typeof e.endScope||null===e.endScope)throw K("endScope must be object"),
124
+ G;Z(e,e.end,{key:"endScope"}),e.end=E(e.end,{joinWith:""})}})(e)}function V(e){
125
+ function t(t,n){
126
+ return RegExp(g(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))
127
+ }class n{constructor(){
128
+ this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}
129
+ addRule(e,t){
130
+ t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),
131
+ this.matchAt+=b(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null)
132
+ ;const e=this.regexes.map((e=>e[1]));this.matcherRe=t(E(e,{joinWith:"|"
133
+ }),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex
134
+ ;const t=this.matcherRe.exec(e);if(!t)return null
135
+ ;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),i=this.matchIndexes[n]
136
+ ;return t.splice(0,n),Object.assign(t,i)}}class i{constructor(){
137
+ this.rules=[],this.multiRegexes=[],
138
+ this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){
139
+ if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n
140
+ ;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))),
141
+ t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){
142
+ return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){
143
+ this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){
144
+ const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex
145
+ ;let n=t.exec(e)
146
+ ;if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{
147
+ const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}
148
+ return n&&(this.regexIndex+=n.position+1,
149
+ this.regexIndex===this.count&&this.considerAll()),n}}
150
+ if(e.compilerExtensions||(e.compilerExtensions=[]),
151
+ e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.")
152
+ ;return e.classNameAliases=r(e.classNameAliases||{}),function n(s,o){const a=s
153
+ ;if(s.isCompiled)return a
154
+ ;[T,D,F,P].forEach((e=>e(s,o))),e.compilerExtensions.forEach((e=>e(s,o))),
155
+ s.__beforeBegin=null,[L,B,H].forEach((e=>e(s,o))),s.isCompiled=!0;let c=null
156
+ ;return"object"==typeof s.keywords&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),
157
+ c=s.keywords.$pattern,
158
+ delete s.keywords.$pattern),c=c||/\w+/,s.keywords&&(s.keywords=$(s.keywords,e.case_insensitive)),
159
+ a.keywordPatternRe=t(c,!0),
160
+ o&&(s.begin||(s.begin=/\B|\b/),a.beginRe=t(a.begin),s.end||s.endsWithParent||(s.end=/\B|\b/),
161
+ s.end&&(a.endRe=t(a.end)),
162
+ a.terminatorEnd=g(a.end)||"",s.endsWithParent&&o.terminatorEnd&&(a.terminatorEnd+=(s.end?"|":"")+o.terminatorEnd)),
163
+ s.illegal&&(a.illegalRe=t(s.illegal)),
164
+ s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((t=>r(e,{
165
+ variants:null},t)))),e.cachedVariants?e.cachedVariants:q(e)?r(e,{
166
+ starts:e.starts?r(e.starts):null
167
+ }):Object.isFrozen(e)?r(e):e))("self"===e?s:e)))),s.contains.forEach((e=>{n(e,a)
168
+ })),s.starts&&n(s.starts,o),a.matcher=(e=>{const t=new i
169
+ ;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin"
170
+ }))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"
171
+ }),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t})(a),a}(e)}function q(e){
172
+ return!!e&&(e.endsWithParent||q(e.starts))}class J extends Error{
173
+ constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}
174
+ const Y=i,Q=r,ee=Symbol("nomatch");var te=(t=>{
175
+ const i=Object.create(null),r=Object.create(null),s=[];let o=!0
176
+ ;const a="Could not find the language '{}', did you forget to load/include a language module?",c={
177
+ disableAutodetect:!0,name:"Plain text",contains:[]};let g={
178
+ ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,
179
+ languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",
180
+ cssSelector:"pre code",languages:null,__emitter:l};function b(e){
181
+ return g.noHighlightRe.test(e)}function m(e,t,n){let i="",r=""
182
+ ;"object"==typeof t?(i=e,
183
+ n=t.ignoreIllegals,r=t.language):(X("10.7.0","highlight(lang, code, ...args) has been deprecated."),
184
+ X("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),
185
+ r=e,i=t),void 0===n&&(n=!0);const s={code:i,language:r};k("before:highlight",s)
186
+ ;const o=s.result?s.result:E(s.language,s.code,n)
187
+ ;return o.code=s.code,k("after:highlight",o),o}function E(e,t,r,s){
188
+ const c=Object.create(null);function l(){if(!N.keywords)return void M.addText(S)
189
+ ;let e=0;N.keywordPatternRe.lastIndex=0;let t=N.keywordPatternRe.exec(S),n=""
190
+ ;for(;t;){n+=S.substring(e,t.index)
191
+ ;const r=y.case_insensitive?t[0].toLowerCase():t[0],s=(i=r,N.keywords[i]);if(s){
192
+ const[e,i]=s
193
+ ;if(M.addText(n),n="",c[r]=(c[r]||0)+1,c[r]<=7&&(R+=i),e.startsWith("_"))n+=t[0];else{
194
+ const n=y.classNameAliases[e]||e;M.addKeyword(t[0],n)}}else n+=t[0]
195
+ ;e=N.keywordPatternRe.lastIndex,t=N.keywordPatternRe.exec(S)}var i
196
+ ;n+=S.substring(e),M.addText(n)}function d(){null!=N.subLanguage?(()=>{
197
+ if(""===S)return;let e=null;if("string"==typeof N.subLanguage){
198
+ if(!i[N.subLanguage])return void M.addText(S)
199
+ ;e=E(N.subLanguage,S,!0,k[N.subLanguage]),k[N.subLanguage]=e._top
200
+ }else e=x(S,N.subLanguage.length?N.subLanguage:null)
201
+ ;N.relevance>0&&(R+=e.relevance),M.addSublanguage(e._emitter,e.language)
202
+ })():l(),S=""}function u(e,t){let n=1;const i=t.length-1;for(;n<=i;){
203
+ if(!e._emit[n]){n++;continue}const i=y.classNameAliases[e[n]]||e[n],r=t[n]
204
+ ;i?M.addKeyword(r,i):(S=r,l(),S=""),n++}}function h(e,t){
205
+ return e.scope&&"string"==typeof e.scope&&M.openNode(y.classNameAliases[e.scope]||e.scope),
206
+ e.beginScope&&(e.beginScope._wrap?(M.addKeyword(S,y.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),
207
+ S=""):e.beginScope._multi&&(u(e.beginScope,t),S="")),N=Object.create(e,{parent:{
208
+ value:N}}),N}function p(e,t,i){let r=((e,t)=>{const n=e&&e.exec(t)
209
+ ;return n&&0===n.index})(e.endRe,i);if(r){if(e["on:end"]){const i=new n(e)
210
+ ;e["on:end"](t,i),i.isMatchIgnored&&(r=!1)}if(r){
211
+ for(;e.endsParent&&e.parent;)e=e.parent;return e}}
212
+ if(e.endsWithParent)return p(e.parent,t,i)}function f(e){
213
+ return 0===N.matcher.regexIndex?(S+=e[0],1):(I=!0,0)}function b(e){
214
+ const n=e[0],i=t.substring(e.index),r=p(N,e,i);if(!r)return ee;const s=N
215
+ ;N.endScope&&N.endScope._wrap?(d(),
216
+ M.addKeyword(n,N.endScope._wrap)):N.endScope&&N.endScope._multi?(d(),
217
+ u(N.endScope,e)):s.skip?S+=n:(s.returnEnd||s.excludeEnd||(S+=n),
218
+ d(),s.excludeEnd&&(S=n));do{
219
+ N.scope&&M.closeNode(),N.skip||N.subLanguage||(R+=N.relevance),N=N.parent
220
+ }while(N!==r.parent);return r.starts&&h(r.starts,e),s.returnEnd?0:n.length}
221
+ let m={};function w(i,s){const a=s&&s[0];if(S+=i,null==a)return d(),0
222
+ ;if("begin"===m.type&&"end"===s.type&&m.index===s.index&&""===a){
223
+ if(S+=t.slice(s.index,s.index+1),!o){const t=Error(`0 width match regex (${e})`)
224
+ ;throw t.languageName=e,t.badRule=m.rule,t}return 1}
225
+ if(m=s,"begin"===s.type)return(e=>{
226
+ const t=e[0],i=e.rule,r=new n(i),s=[i.__beforeBegin,i["on:begin"]]
227
+ ;for(const n of s)if(n&&(n(e,r),r.isMatchIgnored))return f(t)
228
+ ;return i.skip?S+=t:(i.excludeBegin&&(S+=t),
229
+ d(),i.returnBegin||i.excludeBegin||(S=t)),h(i,e),i.returnBegin?0:t.length})(s)
230
+ ;if("illegal"===s.type&&!r){
231
+ const e=Error('Illegal lexeme "'+a+'" for mode "'+(N.scope||"<unnamed>")+'"')
232
+ ;throw e.mode=N,e}if("end"===s.type){const e=b(s);if(e!==ee)return e}
233
+ if("illegal"===s.type&&""===a)return 1
234
+ ;if(A>1e5&&A>3*s.index)throw Error("potential infinite loop, way more iterations than matches")
235
+ ;return S+=a,a.length}const y=O(e)
236
+ ;if(!y)throw K(a.replace("{}",e)),Error('Unknown language: "'+e+'"')
237
+ ;const _=V(y);let v="",N=s||_;const k={},M=new g.__emitter(g);(()=>{const e=[]
238
+ ;for(let t=N;t!==y;t=t.parent)t.scope&&e.unshift(t.scope)
239
+ ;e.forEach((e=>M.openNode(e)))})();let S="",R=0,j=0,A=0,I=!1;try{
240
+ for(N.matcher.considerAll();;){
241
+ A++,I?I=!1:N.matcher.considerAll(),N.matcher.lastIndex=j
242
+ ;const e=N.matcher.exec(t);if(!e)break;const n=w(t.substring(j,e.index),e)
243
+ ;j=e.index+n}
244
+ return w(t.substring(j)),M.closeAllNodes(),M.finalize(),v=M.toHTML(),{
245
+ language:e,value:v,relevance:R,illegal:!1,_emitter:M,_top:N}}catch(n){
246
+ if(n.message&&n.message.includes("Illegal"))return{language:e,value:Y(t),
247
+ illegal:!0,relevance:0,_illegalBy:{message:n.message,index:j,
248
+ context:t.slice(j-100,j+100),mode:n.mode,resultSoFar:v},_emitter:M};if(o)return{
249
+ language:e,value:Y(t),illegal:!1,relevance:0,errorRaised:n,_emitter:M,_top:N}
250
+ ;throw n}}function x(e,t){t=t||g.languages||Object.keys(i);const n=(e=>{
251
+ const t={value:Y(e),illegal:!1,relevance:0,_top:c,_emitter:new g.__emitter(g)}
252
+ ;return t._emitter.addText(e),t})(e),r=t.filter(O).filter(N).map((t=>E(t,e,!1)))
253
+ ;r.unshift(n);const s=r.sort(((e,t)=>{
254
+ if(e.relevance!==t.relevance)return t.relevance-e.relevance
255
+ ;if(e.language&&t.language){if(O(e.language).supersetOf===t.language)return 1
256
+ ;if(O(t.language).supersetOf===e.language)return-1}return 0})),[o,a]=s,l=o
257
+ ;return l.secondBest=a,l}function w(e){let t=null;const n=(e=>{
258
+ let t=e.className+" ";t+=e.parentNode?e.parentNode.className:""
259
+ ;const n=g.languageDetectRe.exec(t);if(n){const t=O(n[1])
260
+ ;return t||(W(a.replace("{}",n[1])),
261
+ W("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}
262
+ return t.split(/\s+/).find((e=>b(e)||O(e)))})(e);if(b(n))return
263
+ ;if(k("before:highlightElement",{el:e,language:n
264
+ }),e.children.length>0&&(g.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),
265
+ console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),
266
+ console.warn("The element with unescaped HTML:"),
267
+ console.warn(e)),g.throwUnescapedHTML))throw new J("One of your code blocks includes unescaped HTML.",e.innerHTML)
268
+ ;t=e;const i=t.textContent,s=n?m(i,{language:n,ignoreIllegals:!0}):x(i)
269
+ ;e.innerHTML=s.value,((e,t,n)=>{const i=t&&r[t]||n
270
+ ;e.classList.add("hljs"),e.classList.add("language-"+i)
271
+ })(e,n,s.language),e.result={language:s.language,re:s.relevance,
272
+ relevance:s.relevance},s.secondBest&&(e.secondBest={
273
+ language:s.secondBest.language,relevance:s.secondBest.relevance
274
+ }),k("after:highlightElement",{el:e,result:s,text:i})}let y=!1;function _(){
275
+ "loading"!==document.readyState?document.querySelectorAll(g.cssSelector).forEach(w):y=!0
276
+ }function O(e){return e=(e||"").toLowerCase(),i[e]||i[r[e]]}
277
+ function v(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach((e=>{
278
+ r[e.toLowerCase()]=t}))}function N(e){const t=O(e)
279
+ ;return t&&!t.disableAutodetect}function k(e,t){const n=e;s.forEach((e=>{
280
+ e[n]&&e[n](t)}))}
281
+ "undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(()=>{
282
+ y&&_()}),!1),Object.assign(t,{highlight:m,highlightAuto:x,highlightAll:_,
283
+ highlightElement:w,
284
+ highlightBlock:e=>(X("10.7.0","highlightBlock will be removed entirely in v12.0"),
285
+ X("10.7.0","Please use highlightElement now."),w(e)),configure:e=>{g=Q(g,e)},
286
+ initHighlighting:()=>{
287
+ _(),X("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},
288
+ initHighlightingOnLoad:()=>{
289
+ _(),X("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")
290
+ },registerLanguage:(e,n)=>{let r=null;try{r=n(t)}catch(t){
291
+ if(K("Language definition for '{}' could not be registered.".replace("{}",e)),
292
+ !o)throw t;K(t),r=c}
293
+ r.name||(r.name=e),i[e]=r,r.rawDefinition=n.bind(null,t),r.aliases&&v(r.aliases,{
294
+ languageName:e})},unregisterLanguage:e=>{delete i[e]
295
+ ;for(const t of Object.keys(r))r[t]===e&&delete r[t]},
296
+ listLanguages:()=>Object.keys(i),getLanguage:O,registerAliases:v,
297
+ autoDetection:N,inherit:Q,addPlugin:e=>{(e=>{
298
+ e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{
299
+ e["before:highlightBlock"](Object.assign({block:t.el},t))
300
+ }),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{
301
+ e["after:highlightBlock"](Object.assign({block:t.el},t))})})(e),s.push(e)}
302
+ }),t.debugMode=()=>{o=!1},t.safeMode=()=>{o=!0
303
+ },t.versionString="11.7.0",t.regex={concat:p,lookahead:d,either:f,optional:h,
304
+ anyNumberOfTimes:u};for(const t in A)"object"==typeof A[t]&&e.exports(A[t])
305
+ ;return Object.assign(t,A),t})({});return te}()
306
+ ;"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs);/*! `xml` grammar compiled for Highlight.js 11.7.0 */
307
+ (()=>{var e=(()=>{"use strict";return e=>{
308
+ const a=e.regex,n=a.concat(/[\p{L}_]/u,a.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),s={
309
+ className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},t={begin:/\s/,
310
+ contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]
311
+ },i=e.inherit(t,{begin:/\(/,end:/\)/}),c=e.inherit(e.APOS_STRING_MODE,{
312
+ className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),r={
313
+ endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",
314
+ begin:/[\p{L}0-9._:-]+/u,relevance:0},{begin:/=\s*/,relevance:0,contains:[{
315
+ className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{
316
+ begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{
317
+ name:"HTML, XML",
318
+ aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],
319
+ case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,
320
+ end:/>/,relevance:10,contains:[t,l,c,i,{begin:/\[/,end:/\]/,contains:[{
321
+ className:"meta",begin:/<![a-z]/,end:/>/,contains:[t,i,l,c]}]}]
322
+ },e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,
323
+ relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,
324
+ relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",
325
+ begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[r],starts:{
326
+ end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",
327
+ begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[r],starts:{
328
+ end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{
329
+ className:"tag",begin:/<>|<\/>/},{className:"tag",
330
+ begin:a.concat(/</,a.lookahead(a.concat(n,a.either(/\/>/,/>/,/\s/)))),
331
+ end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:r}]},{
332
+ className:"tag",begin:a.concat(/<\//,a.lookahead(a.concat(n,/>/))),contains:[{
333
+ className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}
334
+ })();hljs.registerLanguage("xml",e)})();
335
+ </script>
@@ -0,0 +1,7 @@
1
+ <script>
2
+ /**
3
+ * @popperjs/core v2.9.2 - MIT License
4
+ */
5
+
6
+ "use strict";!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Popper={})}(this,(function(e){function t(e){return{width:(e=e.getBoundingClientRect()).width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left,x:e.left,y:e.top}}function n(e){return null==e?window:"[object Window]"!==e.toString()?(e=e.ownerDocument)&&e.defaultView||window:e}function o(e){return{scrollLeft:(e=n(e)).pageXOffset,scrollTop:e.pageYOffset}}function r(e){return e instanceof n(e).Element||e instanceof Element}function i(e){return e instanceof n(e).HTMLElement||e instanceof HTMLElement}function a(e){return"undefined"!=typeof ShadowRoot&&(e instanceof n(e).ShadowRoot||e instanceof ShadowRoot)}function s(e){return e?(e.nodeName||"").toLowerCase():null}function f(e){return((r(e)?e.ownerDocument:e.document)||window.document).documentElement}function p(e){return t(f(e)).left+o(e).scrollLeft}function c(e){return n(e).getComputedStyle(e)}function l(e){return e=c(e),/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function u(e,r,a){void 0===a&&(a=!1);var c=f(r);e=t(e);var u=i(r),d={scrollLeft:0,scrollTop:0},m={x:0,y:0};return(u||!u&&!a)&&(("body"!==s(r)||l(c))&&(d=r!==n(r)&&i(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:o(r)),i(r)?((m=t(r)).x+=r.clientLeft,m.y+=r.clientTop):c&&(m.x=p(c))),{x:e.left+d.scrollLeft-m.x,y:e.top+d.scrollTop-m.y,width:e.width,height:e.height}}function d(e){var n=t(e),o=e.offsetWidth,r=e.offsetHeight;return 1>=Math.abs(n.width-o)&&(o=n.width),1>=Math.abs(n.height-r)&&(r=n.height),{x:e.offsetLeft,y:e.offsetTop,width:o,height:r}}function m(e){return"html"===s(e)?e:e.assignedSlot||e.parentNode||(a(e)?e.host:null)||f(e)}function h(e){return 0<=["html","body","#document"].indexOf(s(e))?e.ownerDocument.body:i(e)&&l(e)?e:h(m(e))}function v(e,t){var o;void 0===t&&(t=[]);var r=h(e);return e=r===(null==(o=e.ownerDocument)?void 0:o.body),o=n(r),r=e?[o].concat(o.visualViewport||[],l(r)?r:[]):r,t=t.concat(r),e?t:t.concat(v(m(r)))}function g(e){return i(e)&&"fixed"!==c(e).position?e.offsetParent:null}function y(e){for(var t=n(e),o=g(e);o&&0<=["table","td","th"].indexOf(s(o))&&"static"===c(o).position;)o=g(o);if(o&&("html"===s(o)||"body"===s(o)&&"static"===c(o).position))return t;if(!o)e:{if(o=-1!==navigator.userAgent.toLowerCase().indexOf("firefox"),-1===navigator.userAgent.indexOf("Trident")||!i(e)||"fixed"!==c(e).position)for(e=m(e);i(e)&&0>["html","body"].indexOf(s(e));){var r=c(e);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||o&&"filter"===r.willChange||o&&r.filter&&"none"!==r.filter){o=e;break e}e=e.parentNode}o=null}return o||t}function b(e){function t(e){o.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){o.has(e)||(e=n.get(e))&&t(e)})),r.push(e)}var n=new Map,o=new Set,r=[];return e.forEach((function(e){n.set(e.name,e)})),e.forEach((function(e){o.has(e.name)||t(e)})),r}function w(e){var t;return function(){return t||(t=new Promise((function(n){Promise.resolve().then((function(){t=void 0,n(e())}))}))),t}}function x(e){return e.split("-")[0]}function O(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&a(n))do{if(t&&e.isSameNode(t))return!0;t=t.parentNode||t.host}while(t);return!1}function j(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function E(e,r){if("viewport"===r){r=n(e);var a=f(e);r=r.visualViewport;var s=a.clientWidth;a=a.clientHeight;var l=0,u=0;r&&(s=r.width,a=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(l=r.offsetLeft,u=r.offsetTop)),e=j(e={width:s,height:a,x:l+p(e),y:u})}else i(r)?((e=t(r)).top+=r.clientTop,e.left+=r.clientLeft,e.bottom=e.top+r.clientHeight,e.right=e.left+r.clientWidth,e.width=r.clientWidth,e.height=r.clientHeight,e.x=e.left,e.y=e.top):(u=f(e),e=f(u),s=o(u),r=null==(a=u.ownerDocument)?void 0:a.body,a=_(e.scrollWidth,e.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),l=_(e.scrollHeight,e.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),u=-s.scrollLeft+p(u),s=-s.scrollTop,"rtl"===c(r||e).direction&&(u+=_(e.clientWidth,r?r.clientWidth:0)-a),e=j({width:a,height:l,x:u,y:s}));return e}function D(e,t,n){return t="clippingParents"===t?function(e){var t=v(m(e)),n=0<=["absolute","fixed"].indexOf(c(e).position)&&i(e)?y(e):e;return r(n)?t.filter((function(e){return r(e)&&O(e,n)&&"body"!==s(e)})):[]}(e):[].concat(t),(n=(n=[].concat(t,[n])).reduce((function(t,n){return n=E(e,n),t.top=_(n.top,t.top),t.right=U(n.right,t.right),t.bottom=U(n.bottom,t.bottom),t.left=_(n.left,t.left),t}),E(e,n[0]))).width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}function L(e){return 0<=["top","bottom"].indexOf(e)?"x":"y"}function P(e){var t=e.reference,n=e.element,o=(e=e.placement)?x(e):null;e=e?e.split("-")[1]:null;var r=t.x+t.width/2-n.width/2,i=t.y+t.height/2-n.height/2;switch(o){case"top":r={x:r,y:t.y-n.height};break;case"bottom":r={x:r,y:t.y+t.height};break;case"right":r={x:t.x+t.width,y:i};break;case"left":r={x:t.x-n.width,y:i};break;default:r={x:t.x,y:t.y}}if(null!=(o=o?L(o):null))switch(i="y"===o?"height":"width",e){case"start":r[o]-=t[i]/2-n[i]/2;break;case"end":r[o]+=t[i]/2-n[i]/2}return r}function M(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function k(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function A(e,n){void 0===n&&(n={});var o=n;n=void 0===(n=o.placement)?e.placement:n;var i=o.boundary,a=void 0===i?"clippingParents":i,s=void 0===(i=o.rootBoundary)?"viewport":i;i=void 0===(i=o.elementContext)?"popper":i;var p=o.altBoundary,c=void 0!==p&&p;o=M("number"!=typeof(o=void 0===(o=o.padding)?0:o)?o:k(o,C));var l=e.elements.reference;p=e.rects.popper,a=D(r(c=e.elements[c?"popper"===i?"reference":"popper":i])?c:c.contextElement||f(e.elements.popper),a,s),c=P({reference:s=t(l),element:p,strategy:"absolute",placement:n}),p=j(Object.assign({},p,c)),s="popper"===i?p:s;var u={top:a.top-s.top+o.top,bottom:s.bottom-a.bottom+o.bottom,left:a.left-s.left+o.left,right:s.right-a.right+o.right};if(e=e.modifiersData.offset,"popper"===i&&e){var d=e[n];Object.keys(u).forEach((function(e){var t=0<=["right","bottom"].indexOf(e)?1:-1,n=0<=["top","bottom"].indexOf(e)?"y":"x";u[e]+=d[n]*t}))}return u}function W(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function B(e){void 0===e&&(e={});var t=e.defaultModifiers,n=void 0===t?[]:t,o=void 0===(e=e.defaultOptions)?F:e;return function(e,t,i){function a(){f.forEach((function(e){return e()})),f=[]}void 0===i&&(i=o);var s={placement:"bottom",orderedModifiers:[],options:Object.assign({},F,o),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},f=[],p=!1,c={state:s,setOptions:function(i){return a(),s.options=Object.assign({},o,s.options,i),s.scrollParents={reference:r(e)?v(e):e.contextElement?v(e.contextElement):[],popper:v(t)},i=function(e){var t=b(e);return I.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}(function(e){var t=e.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e}),{});return Object.keys(t).map((function(e){return t[e]}))}([].concat(n,s.options.modifiers))),s.orderedModifiers=i.filter((function(e){return e.enabled})),s.orderedModifiers.forEach((function(e){var t=e.name,n=e.options;n=void 0===n?{}:n,"function"==typeof(e=e.effect)&&(t=e({state:s,name:t,instance:c,options:n}),f.push(t||function(){}))})),c.update()},forceUpdate:function(){if(!p){var e=s.elements,t=e.reference;if(W(t,e=e.popper))for(s.rects={reference:u(t,y(e),"fixed"===s.options.strategy),popper:d(e)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach((function(e){return s.modifiersData[e.name]=Object.assign({},e.data)})),t=0;t<s.orderedModifiers.length;t++)if(!0===s.reset)s.reset=!1,t=-1;else{var n=s.orderedModifiers[t];e=n.fn;var o=n.options;o=void 0===o?{}:o,n=n.name,"function"==typeof e&&(s=e({state:s,options:o,name:n,instance:c})||s)}}},update:w((function(){return new Promise((function(e){c.forceUpdate(),e(s)}))})),destroy:function(){a(),p=!0}};return W(e,t)?(c.setOptions(i).then((function(e){!p&&i.onFirstUpdate&&i.onFirstUpdate(e)})),c):c}}function T(e){var t,o=e.popper,r=e.popperRect,i=e.placement,a=e.offsets,s=e.position,p=e.gpuAcceleration,l=e.adaptive;if(!0===(e=e.roundOffsets)){e=a.y;var u=window.devicePixelRatio||1;e={x:z(z(a.x*u)/u)||0,y:z(z(e*u)/u)||0}}else e="function"==typeof e?e(a):a;e=void 0===(e=(u=e).x)?0:e,u=void 0===(u=u.y)?0:u;var d=a.hasOwnProperty("x");a=a.hasOwnProperty("y");var m,h="left",v="top",g=window;if(l){var b=y(o),w="clientHeight",x="clientWidth";b===n(o)&&("static"!==c(b=f(o)).position&&(w="scrollHeight",x="scrollWidth")),"top"===i&&(v="bottom",u-=b[w]-r.height,u*=p?1:-1),"left"===i&&(h="right",e-=b[x]-r.width,e*=p?1:-1)}return o=Object.assign({position:s},l&&J),p?Object.assign({},o,((m={})[v]=a?"0":"",m[h]=d?"0":"",m.transform=2>(g.devicePixelRatio||1)?"translate("+e+"px, "+u+"px)":"translate3d("+e+"px, "+u+"px, 0)",m)):Object.assign({},o,((t={})[v]=a?u+"px":"",t[h]=d?e+"px":"",t.transform="",t))}function H(e){return e.replace(/left|right|bottom|top/g,(function(e){return $[e]}))}function R(e){return e.replace(/start|end/g,(function(e){return ee[e]}))}function S(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function q(e){return["top","right","bottom","left"].some((function(t){return 0<=e[t]}))}var C=["top","bottom","right","left"],N=C.reduce((function(e,t){return e.concat([t+"-start",t+"-end"])}),[]),V=[].concat(C,["auto"]).reduce((function(e,t){return e.concat([t,t+"-start",t+"-end"])}),[]),I="beforeRead read afterRead beforeMain main afterMain beforeWrite write afterWrite".split(" "),_=Math.max,U=Math.min,z=Math.round,F={placement:"bottom",modifiers:[],strategy:"absolute"},X={passive:!0},Y={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,o=e.instance,r=(e=e.options).scroll,i=void 0===r||r,a=void 0===(e=e.resize)||e,s=n(t.elements.popper),f=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&f.forEach((function(e){e.addEventListener("scroll",o.update,X)})),a&&s.addEventListener("resize",o.update,X),function(){i&&f.forEach((function(e){e.removeEventListener("scroll",o.update,X)})),a&&s.removeEventListener("resize",o.update,X)}},data:{}},G={name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state;t.modifiersData[e.name]=P({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},J={top:"auto",right:"auto",bottom:"auto",left:"auto"},K={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options;e=void 0===(e=n.gpuAcceleration)||e;var o=n.adaptive;o=void 0===o||o,n=void 0===(n=n.roundOffsets)||n,e={placement:x(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:e},null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,T(Object.assign({},e,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:n})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,T(Object.assign({},e,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:n})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},Q={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},o=t.attributes[e]||{},r=t.elements[e];i(r)&&s(r)&&(Object.assign(r.style,n),Object.keys(o).forEach((function(e){var t=o[e];!1===t?r.removeAttribute(e):r.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var o=t.elements[e],r=t.attributes[e]||{};e=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{}),i(o)&&s(o)&&(Object.assign(o.style,e),Object.keys(r).forEach((function(e){o.removeAttribute(e)})))}))}},requires:["computeStyles"]},Z={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.name,o=void 0===(e=e.options.offset)?[0,0]:e,r=(e=V.reduce((function(e,n){var r=t.rects,i=x(n),a=0<=["left","top"].indexOf(i)?-1:1,s="function"==typeof o?o(Object.assign({},r,{placement:n})):o;return r=(r=s[0])||0,s=((s=s[1])||0)*a,i=0<=["left","right"].indexOf(i)?{x:s,y:r}:{x:r,y:s},e[n]=i,e}),{}))[t.placement],i=r.x;r=r.y,null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=i,t.modifiersData.popperOffsets.y+=r),t.modifiersData[n]=e}},$={left:"right",right:"left",bottom:"top",top:"bottom"},ee={start:"end",end:"start"},te={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options;if(e=e.name,!t.modifiersData[e]._skip){var o=n.mainAxis;o=void 0===o||o;var r=n.altAxis;r=void 0===r||r;var i=n.fallbackPlacements,a=n.padding,s=n.boundary,f=n.rootBoundary,p=n.altBoundary,c=n.flipVariations,l=void 0===c||c,u=n.allowedAutoPlacements;c=x(n=t.options.placement),i=i||(c!==n&&l?function(e){if("auto"===x(e))return[];var t=H(e);return[R(e),t,R(t)]}(n):[H(n)]);var d=[n].concat(i).reduce((function(e,n){return e.concat("auto"===x(n)?function(e,t){void 0===t&&(t={});var n=t.boundary,o=t.rootBoundary,r=t.padding,i=t.flipVariations,a=t.allowedAutoPlacements,s=void 0===a?V:a,f=t.placement.split("-")[1];0===(i=(t=f?i?N:N.filter((function(e){return e.split("-")[1]===f})):C).filter((function(e){return 0<=s.indexOf(e)}))).length&&(i=t);var p=i.reduce((function(t,i){return t[i]=A(e,{placement:i,boundary:n,rootBoundary:o,padding:r})[x(i)],t}),{});return Object.keys(p).sort((function(e,t){return p[e]-p[t]}))}(t,{placement:n,boundary:s,rootBoundary:f,padding:a,flipVariations:l,allowedAutoPlacements:u}):n)}),[]);n=t.rects.reference,i=t.rects.popper;var m=new Map;c=!0;for(var h=d[0],v=0;v<d.length;v++){var g=d[v],y=x(g),b="start"===g.split("-")[1],w=0<=["top","bottom"].indexOf(y),O=w?"width":"height",j=A(t,{placement:g,boundary:s,rootBoundary:f,altBoundary:p,padding:a});if(b=w?b?"right":"left":b?"bottom":"top",n[O]>i[O]&&(b=H(b)),O=H(b),w=[],o&&w.push(0>=j[y]),r&&w.push(0>=j[b],0>=j[O]),w.every((function(e){return e}))){h=g,c=!1;break}m.set(g,w)}if(c)for(o=function(e){var t=d.find((function(t){if(t=m.get(t))return t.slice(0,e).every((function(e){return e}))}));if(t)return h=t,"break"},r=l?3:1;0<r&&"break"!==o(r);r--);t.placement!==h&&(t.modifiersData[e]._skip=!0,t.placement=h,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},ne={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options;e=e.name;var o=n.mainAxis,r=void 0===o||o,i=void 0!==(o=n.altAxis)&&o;o=void 0===(o=n.tether)||o;var a=n.tetherOffset,s=void 0===a?0:a,f=A(t,{boundary:n.boundary,rootBoundary:n.rootBoundary,padding:n.padding,altBoundary:n.altBoundary});n=x(t.placement);var p=t.placement.split("-")[1],c=!p,l=L(n);n="x"===l?"y":"x",a=t.modifiersData.popperOffsets;var u=t.rects.reference,m=t.rects.popper,h="function"==typeof s?s(Object.assign({},t.rects,{placement:t.placement})):s;if(s={x:0,y:0},a){if(r||i){var v="y"===l?"top":"left",g="y"===l?"bottom":"right",b="y"===l?"height":"width",w=a[l],O=a[l]+f[v],j=a[l]-f[g],E=o?-m[b]/2:0,D="start"===p?u[b]:m[b];p="start"===p?-m[b]:-u[b],m=t.elements.arrow,m=o&&m?d(m):{width:0,height:0};var P=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0};v=P[v],g=P[g],m=_(0,U(u[b],m[b])),D=c?u[b]/2-E-m-v-h:D-m-v-h,u=c?-u[b]/2+E+m+g+h:p+m+g+h,c=t.elements.arrow&&y(t.elements.arrow),h=t.modifiersData.offset?t.modifiersData.offset[t.placement][l]:0,c=a[l]+D-h-(c?"y"===l?c.clientTop||0:c.clientLeft||0:0),u=a[l]+u-h,r&&(r=o?U(O,c):O,j=o?_(j,u):j,r=_(r,U(w,j)),a[l]=r,s[l]=r-w),i&&(r=(i=a[n])+f["x"===l?"top":"left"],f=i-f["x"===l?"bottom":"right"],r=o?U(r,c):r,o=o?_(f,u):f,o=_(r,U(i,o)),a[n]=o,s[n]=o-i)}t.modifiersData[e]=s}},requiresIfExists:["offset"]},oe={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,o=e.name,r=e.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=x(n.placement);if(e=L(s),s=0<=["left","right"].indexOf(s)?"height":"width",i&&a){r=M("number"!=typeof(r="function"==typeof(r=r.padding)?r(Object.assign({},n.rects,{placement:n.placement})):r)?r:k(r,C));var f=d(i),p="y"===e?"top":"left",c="y"===e?"bottom":"right",l=n.rects.reference[s]+n.rects.reference[e]-a[e]-n.rects.popper[s];a=a[e]-n.rects.reference[e],a=(i=(i=y(i))?"y"===e?i.clientHeight||0:i.clientWidth||0:0)/2-f[s]/2+(l/2-a/2),s=_(r[p],U(a,i-f[s]-r[c])),n.modifiersData[o]=((t={})[e]=s,t.centerOffset=s-a,t)}},effect:function(e){var t=e.state;if(null!=(e=void 0===(e=e.options.element)?"[data-popper-arrow]":e)){if("string"==typeof e&&!(e=t.elements.popper.querySelector(e)))return;O(t.elements.popper,e)&&(t.elements.arrow=e)}},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},re={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state;e=e.name;var n=t.rects.reference,o=t.rects.popper,r=t.modifiersData.preventOverflow,i=A(t,{elementContext:"reference"}),a=A(t,{altBoundary:!0});n=S(i,n),o=S(a,o,r),r=q(n),a=q(o),t.modifiersData[e]={referenceClippingOffsets:n,popperEscapeOffsets:o,isReferenceHidden:r,hasPopperEscaped:a},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":r,"data-popper-escaped":a})}},ie=B({defaultModifiers:[Y,G,K,Q]}),ae=[Y,G,K,Q,Z,te,ne,oe,re],se=B({defaultModifiers:ae});e.applyStyles=Q,e.arrow=oe,e.computeStyles=K,e.createPopper=se,e.createPopperLite=ie,e.defaultModifiers=ae,e.detectOverflow=A,e.eventListeners=Y,e.flip=te,e.hide=re,e.offset=Z,e.popperGenerator=B,e.popperOffsets=G,e.preventOverflow=ne,Object.defineProperty(e,"__esModule",{value:!0})}));
7
+ </script>
@@ -0,0 +1,248 @@
1
+ <!-- reportSearch.ejs script -->
2
+ <script>
3
+ let searchInput = '';
4
+ let currentlyClickedButton = null;
5
+
6
+ function handleFilterMouseOver(button) {
7
+ if (button != currentlyClickedButton) {
8
+ button.style.background = '#f2f6ff';
9
+ button.style.border = '1px solid #006b8c';
10
+ }
11
+ }
12
+
13
+ function handleFilterMouseOut(button) {
14
+ if (button != currentlyClickedButton) {
15
+ button.style.background = '#FFF';
16
+ button.style.border = '1px solid var(--A11Y-Grey-400, #c9c8c6)';
17
+ }
18
+ }
19
+
20
+ function showFilter() {
21
+ let searchFilterGroup = document.getElementById('searchFilter');
22
+ let searchBarInput = document.getElementById('searchBarInput');
23
+
24
+ if (searchFilterGroup) {
25
+ if (searchFilterGroup.classList.contains('d-none')) {
26
+ searchFilterGroup.classList.remove('d-none');
27
+ searchFilterGroup.classList.add('search-filter-on');
28
+ searchBarInput.classList.add('rounded-bottom-0');
29
+ }
30
+ }
31
+ }
32
+
33
+ function hideFilter() {
34
+ let searchFilterGroup = document.getElementById('searchFilter');
35
+ let searchBarInput = document.getElementById('searchBarInput');
36
+ if (
37
+ document.getElementById('searchBarInput').value === '' &&
38
+ searchFilterGroup.classList.contains('search-filter-on')
39
+ ) {
40
+ searchFilterGroup.classList.remove('search-filter-on');
41
+ searchFilterGroup.classList.add('d-none');
42
+ searchBarInput.classList.remove('rounded-bottom-0');
43
+ }
44
+ }
45
+
46
+ document.addEventListener('click', function (event) {
47
+ let searchBarDiv = document.getElementById('searchBar');
48
+ let searchFilterDiv = document.getElementById('searchFilter');
49
+ if (!searchBarDiv.contains(event.target) && !searchFilterDiv.contains(event.target)) {
50
+ hideFilter();
51
+ }
52
+ });
53
+
54
+ document.getElementById('issueDescriptionsButton').addEventListener('click', function () {
55
+ currentlyClickedButton = this;
56
+ searchInput = document.getElementById('searchBarInput').value;
57
+ loadRulesSummary(currentCategory, searchInput);
58
+ });
59
+
60
+ document.getElementById('pagesButton').addEventListener('click', function () {
61
+ currentlyClickedButton = this;
62
+ searchInput = document.getElementById('searchBarInput').value;
63
+ loadRulesSummary(currentCategory, searchInput);
64
+ });
65
+
66
+ document.getElementById('htmlButton').addEventListener('click', function () {
67
+ currentlyClickedButton = this;
68
+ searchInput = document.getElementById('searchBarInput').value;
69
+ loadRulesSummary(currentCategory, searchInput);
70
+ });
71
+
72
+ document.getElementById('searchBarInput').addEventListener('input', function (event) {
73
+ searchInput = event.target.value;
74
+ loadRulesSummary(currentCategory, searchInput);
75
+ });
76
+
77
+ // for filtering search
78
+
79
+ function handleSearch(category, searchVal, filteredItems) {
80
+ let normalizedSearchVal = searchVal.trim().toLowerCase();
81
+ let isExactSearch =
82
+ (normalizedSearchVal.startsWith('"') && normalizedSearchVal.endsWith('"')) ||
83
+ (normalizedSearchVal.startsWith("'") && normalizedSearchVal.endsWith("'"));
84
+
85
+ if (currentlyClickedButton.id === 'issueDescriptionsButton') {
86
+ searchIssueDescription(category, filteredItems, isExactSearch, normalizedSearchVal);
87
+ } else if (currentlyClickedButton.id === 'pagesButton') {
88
+ searchPages(category, filteredItems, isExactSearch, normalizedSearchVal);
89
+ } else if (currentlyClickedButton.id === 'htmlButton') {
90
+ searchHtml(category, filteredItems, isExactSearch, normalizedSearchVal);
91
+ }
92
+ updateIssueOccurrence(category, filteredItems);
93
+ }
94
+
95
+ function searchIssueDescription(category, filteredItems, isExactSearch, normalizedSearchVal) {
96
+ filteredItems[category].rules = filteredItems[category].rules.filter(item => {
97
+ let normalizedDescription = item.description.toLowerCase();
98
+ return isExactSearch
99
+ ? normalizedDescription === normalizedSearchVal.slice(1, -1)
100
+ : normalizedDescription.includes(normalizedSearchVal);
101
+ });
102
+ }
103
+
104
+ function searchPages(category, filteredItems, isExactSearch, normalizedSearchVal) {
105
+ // Filter pagesAffected array to only include pages with URLs that match the searchTerm
106
+ filteredItems[category].rules = filteredItems[category].rules
107
+ .map(item => {
108
+ if (Array.isArray(item.pagesAffected)) {
109
+ item.pagesAffected = item.pagesAffected.filter(page => {
110
+ let normalizedPageUrl = page.url.toLowerCase();
111
+ return isExactSearch
112
+ ? normalizedPageUrl === normalizedSearchVal.slice(1, -1)
113
+ : normalizedPageUrl.includes(normalizedSearchVal);
114
+ });
115
+ item.totalItems = item.pagesAffected.reduce(
116
+ (sum, page) => sum + (Array.isArray(page.items) ? page.items.length : 0),
117
+ 0,
118
+ );
119
+ } else {
120
+ item.pagesAffected = [];
121
+ item.totalItems = 0;
122
+ }
123
+ return item;
124
+ })
125
+ .filter(item => item.pagesAffected.length > 0);
126
+ // Update the totalItems value for the category
127
+ filteredItems[category].totalItems = filteredItems[category].rules.reduce(
128
+ (sum, rule) => sum + rule.totalItems,
129
+ 0,
130
+ );
131
+ }
132
+
133
+ function searchHtml(category, filteredItems, isExactSearch, normalizedSearchVal) {
134
+ normalizedSearchVal = normalizedSearchVal.replace(/\s+/g, '');
135
+ filteredItems[category].rules.forEach(item => {
136
+ if (Array.isArray(item.pagesAffected)) {
137
+ item.pagesAffected.forEach(page => {
138
+ // Update items array to only include items with xpath or html starting with searchVal
139
+ page.items = Array.isArray(page.items)
140
+ ? page.items.filter(item => {
141
+ let normalizedHtml = item.html.replace(/\s+/g, '').toLowerCase();
142
+ let normalizedXpath = item.xpath.replace(/\s+/g, '').toLowerCase();
143
+ let filterHtml;
144
+ if (isExactSearch) {
145
+ filterHtml =
146
+ normalizedXpath === normalizedSearchVal.slice(1, -1) ||
147
+ normalizedHtml === normalizedSearchVal.slice(1, -1);
148
+ } else {
149
+ filterHtml =
150
+ normalizedXpath.includes(normalizedSearchVal) ||
151
+ normalizedHtml.includes(normalizedSearchVal);
152
+ }
153
+ return filterHtml;
154
+ })
155
+ : [];
156
+ });
157
+ // Update totalItems to be the sum of the number of elements in the items array
158
+ item.totalItems = item.pagesAffected.reduce(
159
+ (sum, page) => sum + (Array.isArray(page.items) ? page.items.length : 0),
160
+ 0,
161
+ );
162
+ }
163
+ });
164
+ filteredItems[category].rules = filteredItems[category].rules.filter(
165
+ rule => rule.totalItems > 0,
166
+ );
167
+ // Update the totalItems value for the category
168
+ filteredItems[category].totalItems = filteredItems[category].rules.reduce(
169
+ (sum, rule) => sum + rule.totalItems,
170
+ 0,
171
+ );
172
+ }
173
+
174
+ function updateIssueOccurrence(category, filteredItems) {
175
+ //update no. of issues/occurances for each category
176
+ let rules = filteredItems[category].rules;
177
+ let totalItemsSum = rules.reduce((sum, rule) => sum + rule.totalItems, 0);
178
+ filteredItems[category].totalItems = totalItemsSum;
179
+ let updatedIssueOccurrence = '';
180
+
181
+ // Determine the correct singular/plural form for 'issue' and 'occurrence'
182
+ const issueLabel = filteredItems[category].rules.length === 1 ? 'issue' : 'issues';
183
+ const occurrenceLabel = filteredItems[category].totalItems === 1 ? 'occurrence' : 'occurrences';
184
+
185
+ if (category !== 'passed' && filteredItems[category].totalItems !== 0) {
186
+ updatedIssueOccurrence = `<strong style="color: #006b8c;">${filteredItems[category].rules.length}</strong> ${issueLabel} / <strong style="color: #006b8c;">${filteredItems[category].totalItems}</strong> ${occurrenceLabel}`;
187
+ } else if (category !== 'passed' && filteredItems[category].totalItems === 0) {
188
+ updatedIssueOccurrence = `<strong style="color: #006b8c;">0</strong> issues`;
189
+ } else {
190
+ updatedIssueOccurrence = `<strong style="color: #006b8c;">${filteredItems[category].totalItems}</strong> ${occurrenceLabel}`;
191
+ }
192
+ if (category !== 'passed')
193
+ document.getElementById(`${category}ItemsInformation`).innerHTML = updatedIssueOccurrence;
194
+ }
195
+
196
+ function resetIssueOccurrence(filteredItems) {
197
+ for (let category in filteredItems) {
198
+ const issueLabel = filteredItems[category].rules.length === 1 ? 'issue' : 'issues';
199
+ const occurrenceLabel =
200
+ filteredItems[category].totalItems === 1 ? 'occurrence' : 'occurrences';
201
+ let updatedIssueOccurrence = '';
202
+ if (category !== 'passed' && filteredItems[category].totalItems !== 0) {
203
+ updatedIssueOccurrence = `${filteredItems[category].rules.length} ${issueLabel} / ${filteredItems[category].totalItems} ${occurrenceLabel}`;
204
+ } else if (category !== 'passed' && filteredItems[category].totalItems === 0) {
205
+ updatedIssueOccurrence = `0 issues`;
206
+ } else {
207
+ updatedIssueOccurrence = `${filteredItems[category].totalItems} ${occurrenceLabel}`;
208
+ }
209
+ if (category !== 'passed')
210
+ document.getElementById(`${category}ItemsInformation`).innerHTML = updatedIssueOccurrence;
211
+ }
212
+ }
213
+
214
+ function OffCanvasSearchWarning() {
215
+ let expandedRuleSearchWarning = document.getElementById('expandedRuleSearchWarning');
216
+ // Check if the element exists and has child elements
217
+ if (expandedRuleSearchWarning && expandedRuleSearchWarning.hasChildNodes()) {
218
+ // Remove all child elements
219
+ while (expandedRuleSearchWarning.firstChild) {
220
+ expandedRuleSearchWarning.removeChild(expandedRuleSearchWarning.firstChild);
221
+ }
222
+ }
223
+ if (searchInput) {
224
+ let warningDiv = document.createElement('div');
225
+ warningDiv.id = 'search warning';
226
+ warningDiv.className = 'alert text-sm-center search-warning';
227
+ let warningStart = document.createTextNode(
228
+ 'The list below has been filtered according to the search term "',
229
+ );
230
+ let textSearchInput = document.createElement('strong');
231
+ textSearchInput.textContent = searchInput.trim();
232
+ let inWord = document.createTextNode('" in ');
233
+ let filterCategory = document.createElement('strong');
234
+ filterCategory.textContent = document
235
+ .querySelector(`label[for="${currentlyClickedButton.id}"]`)
236
+ .textContent.trim();
237
+ let fullStop = document.createTextNode('.');
238
+ // Append the text nodes and elements to the span element
239
+ warningDiv.innerHTML = '';
240
+ warningDiv.appendChild(warningStart);
241
+ warningDiv.appendChild(textSearchInput);
242
+ warningDiv.appendChild(inWord);
243
+ warningDiv.appendChild(filterCategory);
244
+ warningDiv.appendChild(fullStop);
245
+ document.getElementById('expandedRuleSearchWarning').appendChild(warningDiv);
246
+ }
247
+ }
248
+ </script>