@zeesoft/i18n-verify 3.2.1 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/executor.cjs DELETED
@@ -1,3612 +0,0 @@
1
- "use strict";const v=require("fs"),Z=require("path"),ye=require("console-table-printer"),he=require("chrome-remote-interface"),Q=require("globalize"),X=require("cldr-data"),b=require("chrono-node"),E=require("luxon"),Ie=require("@isdk/detect-text-language"),J=require("jimp"),z={NIGHT_WATCH:"nightwatch",WEB_DRIVER_IO:"webio",CYPRESS:"cypress",SELENIUMJS:"seleniumJS"},d={GRB_GREEN:"rgb(0, 154, 61)",GRB_RED:"rgb(255, 0, 0)",GRB_YELLOW:"rgb(255, 255, 0)",GRB_BLUE:"rgb(0, 0, 255)",ANSI_GREEN:"\x1B[32m",ANSI_RED:"\x1B[31m",ANSI_YELLOW:"\x1B[33m"},r={STRING_LOCALIZED:"STRING_LOCALIZED",STRING_PARTIALLY_LOCALIZED:"STRING_PARTIALLY_LOCALIZED",NUMBER_LOCALIZED:"NUMBER_LOCALIZED",CURRENCY_LOCALIZED:"CURRENCY_LOCALIZED",PERCENTAGE_LOCALIZED:"PERCENTAGE_LOCALIZED",DATE_LOCALIZED:"DATE_LOCALIZED",TIME_LOCALIZED:"TIME_LOCALIZED",DATE_TIME_LOCALIZED:"DATE_TIME_LOCALIZED",STRING_NOT_LOCALIZED:"STRING_NOT_LOCALIZED",NUMBER_NOT_LOCALIZED:"NUMBER_NOT_LOCALIZED",CURRENCY_NOT_LOCALIZED:"CURRENCY_NOT_LOCALIZED",PERCENTAGE_NOT_LOCALIZED:"PERCENTAGE_NOT_LOCALIZED",DATE_NOT_LOCALIZED:"DATE_NOT_LOCALIZED",TIME_NOT_LOCALIZED:"TIME_NOT_LOCALIZED",DATE_TIME_NOT_LOCALIZED:"DATE_TIME_NOT_LOCALIZED",TRUNCATION_ISSUE:"TRUNCATION_ISSUE",OVERLAPPING_ISSUE:"OVERLAPPING_ISSUE",ENCODING_ISSUE:"ENCODING_ISSUE",DNT:"DNT",IGNORE:"IGNORE",UNTRANSLATED:"UNTRANSLATED",AUTO_IGNORE:"AUTO_IGNORE",USER_INPUT:"USER_INPUT",REVIEWED:"REVIEWED"},R={[r.STRING_LOCALIZED]:0,[r.STRING_NOT_LOCALIZED]:0,[r.STRING_PARTIALLY_LOCALIZED]:0,[r.NUMBER_LOCALIZED]:0,[r.NUMBER_NOT_LOCALIZED]:0,[r.DATE_LOCALIZED]:0,[r.DATE_NOT_LOCALIZED]:0,[r.DATE_TIME_LOCALIZED]:0,[r.DATE_TIME_NOT_LOCALIZED]:0,[r.TIME_LOCALIZED]:0,[r.TIME_NOT_LOCALIZED]:0,[r.CURRENCY_LOCALIZED]:0,[r.CURRENCY_NOT_LOCALIZED]:0,[r.PERCENTAGE_LOCALIZED]:0,[r.PERCENTAGE_NOT_LOCALIZED]:0,[r.TRUNCATION_ISSUE]:0,[r.OVERLAPPING_ISSUE]:0,[r.ENCODING_ISSUE]:0,[r.DNT]:0,[r.IGNORE]:0,[r.UNTRANSLATED]:0,[r.AUTO_IGNORE]:0,[r.USER_INPUT]:0,[r.REVIEWED]:0},de={[r.STRING_LOCALIZED]:[d.GRB_GREEN,d.ANSI_GREEN],[r.STRING_PARTIALLY_LOCALIZED]:[d.GRB_YELLOW,d.ANSI_YELLOW],[r.NUMBER_LOCALIZED]:[d.GRB_GREEN,d.ANSI_GREEN],[r.DATE_LOCALIZED]:[d.GRB_GREEN,d.ANSI_GREEN],[r.TIME_LOCALIZED]:[d.GRB_GREEN,d.ANSI_GREEN],[r.DATE_TIME_LOCALIZED]:[d.GRB_GREEN,d.ANSI_GREEN],[r.CURRENCY_LOCALIZED]:[d.GRB_GREEN,d.ANSI_GREEN],[r.PERCENTAGE_LOCALIZED]:[d.GRB_GREEN,d.ANSI_GREEN],[r.STRING_NOT_LOCALIZED]:[d.GRB_RED,d.ANSI_RED],[r.DATE_NOT_LOCALIZED]:[d.GRB_RED,d.ANSI_RED],[r.DATE_TIME_NOT_LOCALIZED]:[d.GRB_RED,d.ANSI_RED],[r.TIME_NOT_LOCALIZED]:[d.GRB_RED,d.ANSI_RED],[r.NUMBER_NOT_LOCALIZED]:[d.GRB_RED,d.ANSI_RED],[r.CURRENCY_NOT_LOCALIZED]:[d.GRB_RED,d.ANSI_RED],[r.PERCENTAGE_NOT_LOCALIZED]:[d.GRB_RED,d.ANSI_RED],[r.TRUNCATION_ISSUE]:[d.GRB_RED,d.ANSI_RED],[r.OVERLAPPING_ISSUE]:[d.GRB_RED,d.ANSI_RED],[r.ENCODING_ISSUE]:[d.GRB_RED,d.ANSI_RED],[r.DNT]:[d.GRB_GREEN,d.ANSI_GREEN],[r.IGNORE]:[d.GRB_GREEN,d.ANSI_GREEN],[r.UNTRANSLATED]:[d.GRB_GREEN,d.ANSI_GREEN],[r.AUTO_IGNORE]:[d.GRB_GREEN,d.ANSI_GREEN],[r.USER_INPUT]:[d.GRB_GREEN,d.ANSI_GREEN],[r.REVIEWED]:[d.GRB_GREEN,d.ANSI_GREEN]},be={[r.STRING_LOCALIZED]:"string is localized",[r.STRING_PARTIALLY_LOCALIZED]:"string is partially localized",[r.NUMBER_LOCALIZED]:"number is localized",[r.DATE_LOCALIZED]:"date is localized",[r.DATE_TIME_LOCALIZED]:"dateTime is localized",[r.TIME_LOCALIZED]:"time is localized",[r.CURRENCY_LOCALIZED]:"currency is localized",[r.PERCENTAGE_LOCALIZED]:"percentage is localized",[r.STRING_NOT_LOCALIZED]:"string is not localized",[r.DATE_NOT_LOCALIZED]:"date is not localized",[r.DATE_TIME_NOT_LOCALIZED]:"dateTime is not localized",[r.TIME_NOT_LOCALIZED]:"time is not localized",[r.NUMBER_NOT_LOCALIZED]:"number is not localized",[r.CURRENCY_NOT_LOCALIZED]:"currency is not localized",[r.PERCENTAGE_NOT_LOCALIZED]:"percentage is not localized",[r.TRUNCATION_ISSUE]:"truncation issue detected",[r.OVERLAPPING_ISSUE]:"overlapping issue detected",[r.ENCODING_ISSUE]:"encoding issue detected",[r.DNT]:"do not translate",[r.IGNORE]:"ignored this issue",[r.UNTRANSLATED]:"string is untranslated",[r.AUTO_IGNORE]:"automatically ignored issue",[r.USER_INPUT]:"user input field",[r.REVIEWED]:"string has been reviewed"},ue={EMAIL:/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}\b/gi,URL:/^(https?:\/\/)?(www\.)?[a-zA-Z0-9-]+\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/},Se="zqa_",De=[".txt",".json"],K=`//*[not(self::script or self::style or self::noscript)]
2
- [string-length(normalize-space(.)) > 0]
3
- [not(*)]
4
- [not(ancestor::*[
5
- translate(@style, ' ', '') = 'display:none;'
6
- or contains(@style, 'display:none')
7
- or contains(@style, 'visibility:hidden')
8
- or contains(@aria-hidden, 'true')
9
- or @hidden
10
- ])]
11
- |
12
- //*[@placeholder or @title or @alt]
13
- [not(ancestor::*[
14
- translate(@style, ' ', '') = 'display:none;'
15
- or contains(@style, 'display:none')
16
- or contains(@style, 'visibility:hidden')
17
- or contains(@aria-hidden, 'true')
18
- or @hidden
19
- ])]
20
- |
21
- //input[@type='checkbox' or @type='radio']
22
- /following-sibling::*[string-length(normalize-space(.)) > 0]
23
- [not(ancestor::*[
24
- translate(@style, ' ', '') = 'display:none;'
25
- or contains(@style, 'display:none')
26
- or contains(@style, 'visibility:hidden')
27
- or contains(@aria-hidden, 'true')
28
- or @hidden
29
- ])]
30
- |
31
- //input[@type='text'][@value][string-length(normalize-space(@value)) > 0]
32
- [not(ancestor::*[
33
- translate(@style, ' ', '') = 'display:none;'
34
- or contains(@style, 'display:none')
35
- or contains(@style, 'visibility:hidden')
36
- or contains(@aria-hidden, 'true')
37
- or @hidden
38
- ])]
39
- `,V=!0,Te=["☐","�","퟿","â€","î","ÃÂ","í","ü","é","é","æ•°","据","ラã"],C=".i18n-verify.rc",k={HTML:"html",ASCII_TABLE:"ascii_table"},ee="metrics.cache",Ce="report",N={SANITY:"sanity",I18N:"i18n",CONTEXT:"context"},G={BOOKMARK:"bookmark",CATEGORY:"category",FILE_NAME:"fileName",SCREENSHOT:"screenshot",STRINGS:"strings"};class H{constructor(e){this.$driver=e}checkIfNullOrEmpty(e){return![null,"",void 0].includes(e)}getElement(){throw new Error("implementation is missing")}getElements(){throw new Error("implementation is missing")}getText(){throw new Error("implementation is missing")}getTitle(){throw new Error("implementation is missing")}getPlaceholderText(){throw new Error("implementation is missing")}getAltText(){throw new Error("implementation is missing")}getWidth(){throw new Error("implementation is missing")}getHeight(){throw new Error("implementation is missing")}getTagName(){throw new Error("implementation is missing")}getValue(){throw new Error("implementation is missing")}getLocation(){throw new Error("implementation is missing")}getElementDimension(){throw new Error("implementation is missing")}getElementID(){throw new Error("implementation is missing")}isElementDisplayed(){throw new Error("implementation is missing")}isElementPresent(){throw new Error("implementation is missing")}getElementString(){throw new Error("implementation is missing")}getElementStrings(){throw new Error("implementation is missing")}captureScreenshot(){throw new Error("implementation is missing")}getElementsCount(){throw new Error("implementation is missing")}switchToIFrame(){throw new Error("implementation is missing")}switchToParentFrame(){throw new Error("implementation is missing")}pause(){throw new Error("implementation is missing")}onScreenStringHighlight(){throw new Error("implementation is missing")}checkIfIframeIsPresent(){throw new Error("implementation is missing")}checkIfIframeBodyIsEmpty(){throw new Error("implementation is missing")}printOnConsole(e){console.log(e)}}const te=i=>F(i)&&v.statSync(i).isDirectory(),x=i=>F(i)&&v.statSync(i).isFile(),F=i=>v.existsSync(i),Ne=i=>!F(i)&&v.mkdirSync(i,{recursive:!0}),j=(i,e=!0)=>{(!F(i)||!te(i))&&(e&&f.debug(`Folder doesn't exists, creating \x1B[34m${i}\x1B[0m`),Ne(i))},M=i=>x(i)?v.readFileSync(i,{encoding:"utf-8"}):"",ae=i=>te(i)?v.readdirSync(i):[],xe=i=>x(i)?Z.extname(i):"",g=(...i)=>i?.every(e=>typeof e=="string")?Z.join(...i):"",q=(i,e,t="utf-8")=>v.writeFileSync(i,e,{encoding:t}),Ae=(i,e,t="utf-8")=>{if(!(!i||!e))try{v.appendFileSync(i,e+`
40
- `,{encoding:t,flag:"a"})}catch(a){f.error(a)}},Oe=i=>Z.dirname(i),O=i=>i.replace(/[^a-zA-Z0-9]+/g,"_"),_e=i=>v.readFileSync(i).toString("base64");class Re{#e;#t;#r;#a;#i;#n;constructor({appName:e,reportTime:t,isContext:a,isSanity:n,defaultLocale:s,reportFolderTimestamp:o}){this.#e=e,this.#r=t,this.#a=a,this.#i=n,this.#t=s,this.#n=o}getAppName(){return this.#e}getReportTime(){return this.#r}isSanityRun(){return this.#i}isContextRun(){return this.#a}getDefaultLocale(){return this.#t}getDefaultLocale(){return this.#t}getReportFolderTimestamp(){return this.#n}}class Ee{#e;$generatedContent;$type;constructor(e){this.$type=e}generate(e){this.#e=e,this.$generatedContent=this.buildContent()}export(e,t=Ce){this.write(e,t,this.$generatedContent),f.info(`Exported consolidated I18n Verification ${this.$type} report in ${e}`)}write(e,t,a){throw new Error("should be implemented by child report classes")}buildContent(){throw new Error("should be implemented by child report classes")}getMetaInfo(){return{defaultLocale:this.#e.getDefaultLocale(),appName:this.#e.getAppName(),reportTime:this.#e.getReportTime(),isSanity:this.#e.isSanityRun(),isContext:this.#e.isContextRun(),reportFolderTimestamp:this.#e.getReportFolderTimestamp()}}}function ze(){return`<header><div class="logo">zAutomate.AI</div><div class="report-timestamp"><span class="info"></span></div></header>
41
- <main>
42
- <div class="sidebar">
43
- <ul class="menu" id="menu">
44
- <li class="menu-item" data-page="overview">
45
- <a href="#">Overview</a>
46
- </li>
47
- <li class="menu-item" data-page="log">
48
- <a href="#">View Log</a>
49
- </li>
50
- <li class="menu-item has-submenu" data-page="insights">
51
- <a href="#" data-page="insights">Insights</a>
52
- <ul class="submenu"></ul>
53
- </li>
54
- </ul>
55
- <div class="footer"></div>
56
- </div>
57
- <div class="content-wrapper">
58
- <div class="container">
59
- <div id="overview" class="content">
60
- <div class="common-info card">
61
- <span class="title"></span>
62
- <p class="info"></p>
63
- <div class="section"></div>
64
- </div>
65
- <div class="overall-quality card">
66
- <span class="title">Overall I18n Coverage</span>
67
- <div class="section">
68
- <div class="block">
69
- <article>
70
- <p class="desc">
71
- zI18n-Verify report provides a comprehensive information
72
- about the I18n and L10n quailty of your application.
73
- </p>
74
- <ul class="items">
75
- <li>
76
- <h4>Reviewed:</h4>
77
- <p class="detail">
78
- Total strings which are captured and processed by
79
- zI18n-Verify.
80
- </p>
81
- </li>
82
- <li>
83
- <h4>Internationlized:</h4>
84
- <p class="detail">
85
- Different types of value like string, number, date-time
86
- which are properly Internationalized.
87
- </p>
88
- </li>
89
- <li>
90
- <h4>Not Internationalized:</h4>
91
- <p class="detail">
92
- Values which are not Internationalized. Also includes
93
- Partially Localized strings and Encoding Issues.
94
- </p>
95
- </li>
96
- <li>
97
- <h4>Skipped:</h4>
98
- <p class="detail">
99
- Values which are skipped from processing because they
100
- are listed in DNT / Ignored lists or contains Auto
101
- Ignored pattern / User input pattern.
102
- </p>
103
- </li>
104
- </ul>
105
- </article>
106
- </div>
107
- <div class="block">
108
- <div class="graph"></div>
109
- </div>
110
- </div>
111
- </div>
112
- <div class="string-quality card">
113
- <span class="title">String Coverage</span>
114
- <div class="graph"></div>
115
- </div>
116
- <div class="skipped-items card">
117
- <span class="title">Skipped Items</span>
118
- <div class="graph"></div>
119
- </div>
120
- <div class="number-quality card">
121
- <span class="title">Number Coverage</span>
122
- <div class="graph"></div>
123
- </div>
124
- <div class="datetime-quality card">
125
- <span class="title">DateTime Coverage</span>
126
- <div class="graph"></div>
127
- </div>
128
- </div>
129
- <div id="page" class="content">
130
- <span class="title">Pages</span>
131
- <div class="section">
132
- <div class="desc"></div>
133
- </div>
134
- </div>
135
- <div id="log" class="content">
136
- <span class="title">Runtime log</span>
137
- <div class="log-content"><pre></pre></div>
138
- </div>
139
- <div id="insights" class="content">
140
- <div class="cards">
141
- <span class="title">Locale Quality</span>
142
- <div class="holder"></div>
143
- </div>
144
- </div>
145
- <div id="locale" class="content">
146
- <span class="title">Locale Quality</span>
147
- <div class="coverage-info">
148
- <table class="row-border hover order-column stripe"></table>
149
- </div>
150
- <div id="imageViewer" class="image-viewer">
151
- <span class="close-button" onclick="closeImageViewer()" title="close"
152
- >&times;</span
153
- >
154
- <div class="image-container">
155
- <img id="imageView" src="" alt="Image" />
156
- </div>
157
- </div>
158
- </div>
159
- </div>
160
- </div>
161
- </main>`}function Me(){return`html {
162
- width: 100vw;
163
- height: 100vh;
164
- }
165
-
166
- * {
167
- user-select: none;
168
- box-sizing: border-box;
169
- scrollbar-width: thin;
170
- scroll-behavior: smooth;
171
- }
172
-
173
- body {
174
- width: 100%;
175
- height: 100%;
176
- margin: 0;
177
- display: flex;
178
- flex-direction: column;
179
- font-family: Arial, sans-serif;
180
- font-family: 'Helvetica Neue', Arial, sans-serif;
181
- -webkit-font-smoothing: antialiased; /* Webkit-based browsers */
182
- -moz-osx-font-smoothing: grayscale; /* Firefox on OS X */
183
- font-smooth: always; /* Non-standard, some browsers */
184
- }
185
-
186
- header {
187
- background-color: #333;
188
- height: 8%;
189
- display: flex;
190
- }
191
-
192
- main {
193
- display: flex;
194
- flex-direction: row;
195
- width: 100%;
196
- height: 92%
197
- }
198
-
199
- .sidebar {
200
- width: 16%;
201
- height: 100%;
202
- background-color: #333;
203
- color: #fff;
204
- padding: 20px;
205
- box-sizing: border-box;
206
- float: left;
207
- }
208
-
209
- .logo {
210
- flex-grow: 1;
211
- align-content: center;
212
- margin-left: 2%;
213
- color: #14cf96;
214
- font-weight: bold;
215
- font-size: 1.4em;
216
- }
217
-
218
- .report-timestamp {
219
- flex-grow: 1;
220
- height: 100%;
221
- align-content: center;
222
- margin-right: 2%;
223
- }
224
-
225
- .report-timestamp .info {
226
- float: right;
227
- font-size: 0.9em;
228
- color: #90a3a9;
229
- }
230
-
231
- .menu {
232
- list-style-type: none;
233
- padding: 0;
234
- margin: 0;
235
- }
236
-
237
- .menu-item {
238
- margin-bottom: 10px;
239
- }
240
-
241
- .menu-item a {
242
- color: #fff;
243
- text-decoration: none;
244
- display: block;
245
- padding: 10px;
246
- border-radius: 5px;
247
- font-size: 1.05rem;
248
- }
249
-
250
- .menu-item a:hover {
251
- background-color: #555;
252
- }
253
-
254
- .submenu {
255
- display: none;
256
- list-style-type: none;
257
- padding-left: 20px;
258
- }
259
-
260
- .menu-item.has-submenu > a::after {
261
- content: '⯆';
262
- float: right;
263
- margin-left: 5px;
264
- }
265
-
266
- .menu-item.has-submenu.selected > a::after {
267
- content: '⯅';
268
- float: right;
269
- margin-left: 5px;
270
- }
271
-
272
- .menu-item.selected > a {
273
- background-color: #555;
274
- }
275
-
276
- .submenu .sub-menu-item {
277
- margin: 3px auto;
278
- }
279
-
280
- .submenu .sub-menu-item a:hover {
281
- background-color: #777;
282
- }
283
-
284
- .submenu .sub-menu-item.selected a {
285
- background-color: #555 !important;
286
- }
287
-
288
- .submenu.active {
289
- display: block !important;
290
- }
291
-
292
- .view-screenshot-image {
293
- width: 100px;
294
- height: 30px;
295
- content: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBVcGxvYWRlZCB0bzogU1ZHIFJlcG8sIHd3dy5zdmdyZXBvLmNvbSwgR2VuZXJhdG9yOiBTVkcgUmVwbyBNaXhlciBUb29scyAtLT4NCjxzdmcgZmlsbD0iIzAwMDAwMCIgaGVpZ2h0PSI4MDBweCIgd2lkdGg9IjgwMHB4IiB2ZXJzaW9uPSIxLjEiIGlkPSJDYXBhXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIA0KCSB2aWV3Qm94PSIwIDAgNDkwIDQ5MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8cGF0aCBkPSJNMjQ1LjIwNCwxMDEuMjY3QzY3LjE3MSwxMDEuMjY3LDAsMjQ1LDAsMjQ1czY2Ljc2MywxNDMuNzMzLDI0NC43OTYsMTQzLjczM0M0MjIuODI5LDM4OC43MzMsNDkwLDI0NSw0OTAsMjQ1DQoJCVM0MjMuMjM4LDEwMS4yNjcsMjQ1LjIwNCwxMDEuMjY3eiBNMjQ0Ljc5NiwzNzMuNDIxYy0xNDYuMzkzLDAtMjEyLjM2Ny0xMDEuMDUzLTIyNy41MDYtMTI4LjMzMw0KCQljMTUuMjQ5LTI2Ljc5Niw4Mi43MzMtMTI4LjUwOCwyMjcuOTE0LTEyOC41MDhjMTQ2LjUxNCwwLDIxMi40NzUsMTAxLjIyLDIyNy41NDMsMTI4LjQNCgkJQzQ1Ny41NzgsMjcyLjIwMywzOTEuMzEzLDM3My40MjEsMjQ0Ljc5NiwzNzMuNDIxeiIvPg0KCTxwYXRoIGQ9Ik0yNDUuMDAzLDE0Ni4xMjRjLTU0LjUyMSwwLTk4Ljg4MSw0NC4zNTItOTguODgxLDk4Ljg3M2MwLDU0LjUyMSw0NC4zNiw5OC44ODEsOTguODgxLDk4Ljg4MXM5OC44NzMtNDQuMzYsOTguODczLTk4Ljg4MQ0KCQlDMzQzLjg3NiwxOTAuNDc3LDI5OS41MjQsMTQ2LjEyNCwyNDUuMDAzLDE0Ni4xMjR6IE0yNDUuMDAzLDMyOC41NjZjLTQ2LjA4LDAtODMuNTY4LTM3LjQ4OS04My41NjgtODMuNTY4DQoJCWMwLTQ2LjA3MiwzNy40ODktODMuNTYxLDgzLjU2OC04My41NjFjNDYuMDcyLDAsODMuNTYxLDM3LjQ4OSw4My41NjEsODMuNTYxQzMyOC41NjQsMjkxLjA3NywyOTEuMDc1LDMyOC41NjYsMjQ1LjAwMywzMjguNTY2eiIvPg0KCTxwYXRoIGQ9Ik0yNDUuMDAzLDE3NS41ODNjLTM4LjI4MSwwLTY5LjQyMiwzMS4xNDEtNjkuNDIyLDY5LjQxNWMwLDM4LjI3NCwzMS4xNDEsNjkuNDE1LDY5LjQyMiw2OS40MTUNCgkJYzM4LjI3NCwwLDY5LjQxNS0zMS4xNDEsNjkuNDE1LTY5LjQxNUMzMTQuNDE3LDIwNi43MjQsMjgzLjI3NywxNzUuNTgzLDI0NS4wMDMsMTc1LjU4M3ogTTI0NS4wMDMsMjk5LjENCgkJYy0yOS44MzMsMC01NC4xMS0yNC4yNy01NC4xMS01NC4xMDJjMC0yOS44MzIsMjQuMjc3LTU0LjEwMiw1NC4xMS01NC4xMDJzNTQuMTAyLDI0LjI3LDU0LjEwMiw1NC4xMDINCgkJQzI5OS4xMDUsMjc0LjgzLDI3NC44MzUsMjk5LjEsMjQ1LjAwMywyOTkuMXoiLz4NCgk8cGF0aCBkPSJNMjQ1LjAwMywyMDYuNjc5Yy0yMS4xMywwLTM4LjMyNiwxNy4xODktMzguMzI2LDM4LjMxOWMwLDIxLjEyOSwxNy4xOTcsMzguMzI2LDM4LjMyNiwzOC4zMjZzMzguMzE5LTE3LjE5NywzOC4zMTktMzguMzI2DQoJCUMyODMuMzIxLDIyMy44NjgsMjY2LjEzMiwyMDYuNjc5LDI0NS4wMDMsMjA2LjY3OXogTTI0NS4wMDMsMjY4LjAxMWMtMTIuNjg4LDAtMjMuMDE0LTEwLjMyNi0yMy4wMTQtMjMuMDE0DQoJCWMwLTEyLjY4OCwxMC4zMjUtMjMuMDA2LDIzLjAxNC0yMy4wMDZjMTIuNjg4LDAsMjMuMDA2LDEwLjMxOCwyMy4wMDYsMjMuMDA2QzI2OC4wMDksMjU3LjY4NiwyNTcuNjkxLDI2OC4wMTEsMjQ1LjAwMywyNjguMDExeiIvPg0KPC9nPg0KPC9zdmc+);
296
- }
297
-
298
- .content-wrapper {
299
- padding: 1%;
300
- float: left;
301
- width: 84%;
302
- background-color: #f4f4f4;
303
- overflow: hidden;
304
- height: 100%;
305
- }
306
-
307
- .content {
308
- display: none !important;
309
- height: 100%;
310
- }
311
-
312
- .content .title {
313
- font-size: 1rem;
314
- color: #080404e2;
315
- font-weight: 600;
316
- }
317
-
318
- .content .title::after {
319
- content: ':';
320
- }
321
-
322
- .content.active {
323
- display: flex !important;
324
- flex-direction: column;
325
- gap: 0.9rem;
326
- flex-wrap: wrap;
327
- transition: all 2s ease-in-out;
328
- }
329
-
330
- .container {
331
- height: 99%;
332
- overflow: hidden;
333
- overflow-y: auto;
334
- }
335
-
336
- .sidebar .footer {
337
- bottom: 1.5%;
338
- position: absolute;
339
- font-size: 0.75rem;
340
- color: #14cf96;
341
- font-family: system-ui;
342
- width: inherit;
343
- }
344
-
345
- #overview {
346
- flex-direction: row;
347
- justify-content: space-between;
348
- }
349
-
350
- #overview .card {
351
- display: flex;
352
- flex-direction: column;
353
- width: 25rem;
354
- border: 1px solid #ddd;
355
- box-shadow: 0 22px 35px -16px rgba(0, 0, 0, 0.3);
356
- border-radius: 5px;
357
- background: white;
358
- padding: 1rem;
359
- }
360
-
361
- #overview .overall-quality {
362
- flex-basis: 100%;
363
- line-height: 14px;
364
- }
365
-
366
- #overview .overall-quality .section {
367
- display: flex;
368
- flex-direction: row;
369
- }
370
-
371
- #overview .overall-quality .section .block {
372
- width: 50%;
373
- }
374
-
375
- #overview .overall-quality .section .block article p.desc {
376
- font-size: 0.85em;
377
- }
378
-
379
- #overview .overall-quality .section .block article .items li {
380
- font-size: 0.8em;
381
- }
382
-
383
- #overview .overall-quality .section .block article .items li .detail {
384
- margin-top: -2%;
385
- }
386
-
387
- #overview .overall-quality .section .block .graph {
388
- margin-top: 1.5em;
389
- }
390
-
391
- #overview .string-quality,
392
- #overview .number-quality,
393
- #overview .datetime-quality,
394
- #overview .skipped-items {
395
- flex-basis: 48.5%;
396
- }
397
-
398
- #overview .string-quality .graph,
399
- #overview .number-quality .graph,
400
- #overview .datetime-quality .graph,
401
- #overview .skipped-items .graph {
402
- align-self: center;
403
- }
404
-
405
- #overview .string-quality .graph {
406
- margin-left: 4rem;
407
- }
408
-
409
- #overview .number-quality .graph,
410
- #overview .datetime-quality .graph {
411
- margin-top: -0.9rem;
412
- margin-left: 4.5rem;
413
- }
414
-
415
- #overview .common-info {
416
- width: 100%;
417
- height: 100%;
418
- }
419
-
420
- #overview .common-info .info {
421
- font-size: 0.9em;
422
- margin-top: 0.8%;
423
- }
424
-
425
- #overview .common-info .title {
426
- font-size: 1.1em;
427
- }
428
-
429
- #overview .common-info .section {
430
- width: 100%;
431
- height: 100%;
432
- overflow: hidden;
433
- padding-top: 3%;
434
- }
435
-
436
- #overview .common-info .section .page-tiles .title-section .locale-filter-wrapper {
437
- margin-right: 1%;
438
- font-size: 0.8em;
439
- font-weight: 600;
440
- }
441
-
442
- #overview .common-info .section .page-tiles .title-section .locale-filter-wrapper #locale-filter {
443
- font-size: 0.9em;
444
- height: 1.7em;
445
- border-radius: 3px
446
- }
447
-
448
- #overview .common-info .section .page-tiles .title-section {
449
- display: flex;
450
- align-items: center;
451
- }
452
-
453
- #overview .common-info .section .page-tiles .title-section .title-wrapper {
454
- flex: 1;
455
- }
456
-
457
- #overview .common-info .section .page-tiles .title-section .search-field-wrapper {
458
- flex: 0.7;
459
- font-size: 0.8em;
460
- font-weight: 600;
461
- }
462
-
463
- #overview .common-info .section .page-tiles {
464
- display: flex;
465
- flex-direction: column;
466
- gap: 1%;
467
- width: 100%;
468
- height: 92%;
469
- }
470
-
471
- #overview .common-info .section .page-tiles .title {
472
- flex: 1;
473
- }
474
-
475
- #overview .common-info .section .page-tiles .tiles-list-wrapper {
476
- width: 100%;
477
- height: 100%;
478
- border: 0.5px solid #00000008;
479
- border-radius: 5px;
480
- padding: 0;
481
- margin: 0;
482
- }
483
-
484
- #overview .common-info .section .page-tiles .tiles-list {
485
- width: 100%;
486
- height: 100%;
487
- overflow: hidden;
488
- overflow-y: auto;
489
- padding: 10px;
490
- display: flex;
491
- flex-wrap: wrap;
492
- gap: 2.2%;
493
- justify-content: start;
494
- }
495
-
496
- #overview .common-info .section .page-tiles .tiles-list .empty-context {
497
- background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAA7AAAAOwBeShxvQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAALnSURBVFiFxddNiFZlFAfw3zjvSGUfWjRCgdmiTV8IGjlFhBJotQmjdraqqBbZtAjBFoYVBH0tGiQUFCJKDQqpNpW0sJosIvowyEW1s4a+7UOsuS3OubzPvL133hmbefvD5d7nPOd5zsfzP+feS2AEb+MYqnm+jqWtkbTtKvzVB8Od1wmslt5UeAKLzD8W4am0+S7ttPfDeI3T0+bxVmH4hj46UGPhQHryv6FVPO/rs+1boMzAQJ8dqGBBn43+C60G+TW4B4NzZOdvjOFgt8m6MZR40dw3nhe62W3KQH00T2K8d4DTYjXu15DNJgdqjPvv1fEh1uH1k3FgLvAVLm2anC8HlmE5luA7fIZfO3ROzMSBUdkwuuAQHi/GLdyOu3F5h+5xvIlH8F7KbpPk71YFO/Rm9Q+F/nJ8XMx9L96yr+B9EW09N4ahemFTJ1yMtabvA5/jcBofx1IcwWbsF98YNc7GvXgAp6ZjN2OyKQMzRUs78jdwZg/9VZhI/QdpzsAVmmv3MLbm813YLiJfhV9m4PRawYc/cBHdM/Co5rP/XfsMP0nZhmLtQXyA4RyvE5wYLXT25LotTVXwsGD5UJe5LwSpluEyQcb9xfwpWIm3cp/dKSv32o1bcSMnz4E1ue5Ah/xc7cxM5v1ZU494OOXfNmWgiQMVdgrCnZGyzgYzgW0izQP4CQ+ZGuTPeT+r3nQ2HHguda7M8aGOtesFwep+UIlOOFzoXJjyr2n/E5TRnoabRBcsrw2ipomS+1Pw4ZxibW30GdEbPs3x9kLnjpS9LL2rcL3Z49Vcu7WQjYqGU5/5cBq/OseDhc2NA9iEp0W/PiD+E6ZDhecF80fwjsjEtaL8emGbaEJHcAnx8fGY2f2evVZsOJayCdFkmjCYxifFsa1hamlcgBVY2COCSjSbozkewl7BmQovYRc+wo84H9fhPlycgd6ZOnOGBSKtv5k+c1/KyOcL52GLeOcfFbz6RrB9oy6d9R/3ey953ywo7QAAAABJRU5ErkJggg==);
498
- width: 100%;
499
- background-repeat: no-repeat;
500
- height: 100%;
501
- background-size: 2.5em;
502
- background-position-x: 50%;
503
- background-position-y: 43%;
504
- display: flex;
505
- justify-content: center;
506
- align-content: center;
507
- flex-wrap: wrap;
508
- }
509
-
510
- #overview .common-info .section .page-tiles .tiles-list .tile-container {
511
- width: 23%;
512
- height: 35%;
513
- text-align: center;
514
- display: flex;
515
- flex-direction: column;
516
- border: 1px solid #80808030;
517
- border-radius: 5px;
518
- }
519
-
520
- #overview .common-info .section .page-tiles .tiles-list .tile-container:hover {
521
- transform: scale(1.03);
522
- box-shadow: 0 22px 35px -16px #00000033;
523
- cursor: pointer;
524
- transition: all 0.2s ease-in-out;
525
- }
526
-
527
- #overview .common-info .section .page-tiles .tiles-list .tile-container .image {
528
- width: 100%;
529
- height: 85%;
530
- object-fit: contain;
531
- }
532
-
533
- #overview .common-info .section .page-tiles .tiles-list .tile-container .name span {
534
- width: 75%;
535
- display: inline-block;
536
- white-space: nowrap;
537
- overflow: hidden;
538
- text-overflow: ellipsis;
539
- }
540
-
541
- #overview .common-info .section .page-tiles .tiles-list .tile-container .name {
542
- width: 100%;
543
- display: block;
544
- height: 15%;
545
- align-content: center;
546
- background-color: rgb(0 0 0 / 7%);
547
- border-top: 1px solid #80808030;
548
- color: #2cb2c1e6;
549
- -webkit-font-smoothing: antialiased;
550
- font-variant: all-small-caps;
551
- font-weight: 600;
552
- font-size: 0.87em;
553
- }
554
-
555
- #insights .cards {
556
- display: flex;
557
- flex-direction: column;
558
- gap: 1.5rem;
559
- }
560
-
561
- #insights .cards .holder {
562
- display: flex;
563
- flex-direction: row;
564
- gap: 1.5rem;
565
- flex-wrap: wrap;
566
- }
567
-
568
- #insights .cards .card {
569
- display: flex;
570
- flex-direction: column;
571
- width: 20rem;
572
- min-height: 10rem;
573
- border: 1px solid #ddd;
574
- box-shadow: 0 22px 35px -16px rgba(0, 0, 0, 0.3);
575
- border-radius: 5px;
576
- background: white;
577
- }
578
-
579
- #insights .cards .card:hover {
580
- transform: scale(1.05);
581
- box-shadow: 0 22px 35px -16px #07ff7d33;
582
- cursor: pointer;
583
- transition: all 0.2s ease-in-out;
584
- }
585
-
586
- #insights .cards .card .title {
587
- height: 2.5rem;
588
- font-size: 1rem;
589
- padding-top: 1rem;
590
- font-weight: 500;
591
- background: #0c5ad9d6;
592
- border-top-left-radius: 5px;
593
- border-top-right-radius: 5px;
594
- padding-left: 1rem;
595
- color: white;
596
- }
597
-
598
- #insights .cards .card .title::after {
599
- content: '';
600
- }
601
-
602
- #insights .cards .card .card-content {
603
- display: flex;
604
- flex-direction: column;
605
- gap: 1rem;
606
- padding: 1rem;
607
- }
608
-
609
- #insights .cards .card .status-bar {
610
- display: flex;
611
- flex-direction: column;
612
- gap: 0.8rem;
613
- }
614
-
615
- #insights .cards .card .status-bar .bar-container .name {
616
- font-size: 0.78rem;
617
- -webkit-font-smoothing: antialiased;
618
- -moz-osx-font-smoothing: grayscale;
619
- }
620
-
621
- #insights .cards .card .status-bar .bar-container .name::after {
622
- content: ':';
623
- }
624
-
625
- #insights .cards .card .status-bar .bar-container .bar-holder {
626
- width: 100%;
627
- height: 10px;
628
- border: 1px solid #00000038;
629
- border-radius: 2px;
630
- }
631
-
632
- #insights .cards .card .status-bar .bar-container .bar-holder .bar {
633
- height: 100%;
634
- font-size: 0.63rem;
635
- text-align: right;
636
- color: rgb(0, 0, 0);
637
- }
638
-
639
- .bar.--green {
640
- background-color: #1dedaf;
641
- }
642
-
643
- .bar.--red {
644
- background-color: #fe3e3e;
645
- }
646
-
647
- .bar.--yellow {
648
- background-color: #faef1f;
649
- }
650
-
651
- .bar.--blue {
652
- background-color: #77c2ff;
653
- }
654
-
655
- #insights .cards .card .stat {
656
- display: flex;
657
- flex-direction: column;
658
- gap: 0.3rem;
659
- border: 0.5px solid #00000012;
660
- border-radius: 6px;
661
- }
662
-
663
- #insights .cards .card .stat table td {
664
- font-size: 0.78rem;
665
- -webkit-font-smoothing: antialiased;
666
- -moz-osx-font-smoothing: grayscale;
667
- }
668
-
669
- #insights .cards .card .stat table td.name {
670
- width: 70%;
671
- }
672
-
673
- #insights .cards .card .stat table td.value::before {
674
- content: ': ';
675
- }
676
-
677
- #locale {
678
- display: flex;
679
- gap: 0.2em;
680
- background: white;
681
- padding: 1em;
682
- border-radius: 5px;
683
- flex-wrap: nowrap;
684
- }
685
-
686
- #locale .title {
687
- content: ':';
688
- }
689
-
690
- #locale .coverage-info {
691
- width: 100%;
692
- }
693
-
694
- #locale table thead th select.filter {
695
- margin-left: 1rem;
696
- max-width: 8rem;
697
- text-overflow: ellipsis;
698
- }
699
-
700
- #locale .image-viewer {
701
- display: none;
702
- position: fixed;
703
- z-index: 9998;
704
- top: 0;
705
- left: 0;
706
- width: 100%;
707
- height: 100%;
708
- background-color: rgba(0, 0, 0, 0.8);
709
- text-align: center;
710
- }
711
-
712
- #locale .image-container {
713
- position: relative;
714
- top: 50%;
715
- transform: translateY(-50%);
716
- display: inline-block;
717
- width: 98vw;
718
- height: 94vh;
719
- overflow: hidden;
720
- overflow-y: auto;
721
- }
722
-
723
- #locale .image-viewer img {
724
- width: 100%;
725
- }
726
-
727
- #locale .close-button {
728
- position: absolute;
729
- top: -0.6rem;
730
- right: 0.1rem;
731
- color: #ffffffbf;
732
- font-size: 2.4rem;
733
- cursor: pointer;
734
- z-index: 9999;
735
- }
736
-
737
- #locale .close-button:hover {
738
- color: white;
739
- }
740
-
741
- #locale table tbody td {
742
- font-size: 0.9em;
743
- }
744
-
745
- #locale table td .view-screenshot-btn {
746
- color: blue;
747
- }
748
-
749
- @media (max-width: 768px) {
750
- .sidebar {
751
- width: 16rem;
752
- padding: 10px;
753
- }
754
- }
755
-
756
- .--hidden {
757
- display: none !important;
758
- visibility: hidden !important;
759
- }
760
-
761
- #log {
762
- display: flex;
763
- }
764
-
765
- #log .title {
766
- display: block;
767
- flex: 1;
768
- }
769
-
770
- #log .log-content {
771
- flex: 99;
772
- background: white;
773
- border-radius: 3px;
774
- overflow: hidden;
775
- padding: 1em;
776
- }
777
-
778
- #log .log-content pre {
779
- height: 100%;
780
- white-space: pre-line;
781
- word-break: break-all;
782
- padding: 0;
783
- margin: 0;
784
- width: 100%;
785
- overflow: hidden;
786
- overflow-y: auto;
787
- user-select: all;
788
- }
789
-
790
- body .context-image-viewer {
791
- z-index: 9999;
792
- width: 100vw;
793
- height: 100vh;
794
- display: flex;
795
- flex-direction: column;
796
- position: fixed;
797
- top: 0;
798
- left: 0;
799
- background: #0000009c;
800
- }
801
-
802
- body .context-image-viewer .close-btn {
803
- position: absolute;
804
- right: 1.2%;
805
- top: 0.65%;
806
- color: #a7a5a5;
807
- font-size: 2.8em;
808
- cursor: pointer;
809
- z-index: 1;
810
- }
811
-
812
- body .context-image-viewer .close-btn:hover {
813
- color: #000000a6;
814
- transform: scale(1.04);
815
- transition: all 0.15s ease-in-out;
816
- }
817
-
818
- body .context-image-viewer .loader {
819
- width: 100vw;
820
- height: 100vh;
821
- z-index: 9999;
822
- top: 0;
823
- left: 0;
824
- position: absolute;
825
- background: #0000009c;
826
- color: white;
827
- text-align: center;
828
- padding-top: 50vh;
829
- }
830
-
831
- body .context-image-viewer .viewer {
832
- width: 98%;
833
- height: 96%;
834
- background-color: white;
835
- margin: auto;
836
- position: relative;
837
- }
838
-
839
- body .context-image-viewer .viewer .zoom-in-btn,
840
- body .context-image-viewer .viewer .zoom-out-btn {
841
- position: absolute;
842
- bottom: 10%;
843
- width: 35px;
844
- height: 35px;
845
- border-radius: 50%;
846
- text-align: center;
847
- background: #0000001a;
848
- cursor: pointer;
849
- }
850
-
851
- body .context-image-viewer .viewer .zoom-in-btn {
852
- left: 51%;
853
- }
854
-
855
- body .context-image-viewer .viewer .zoom-out-btn {
856
- left: 47%;
857
- }
858
-
859
- body .context-image-viewer .viewer .next-btn,
860
- body .context-image-viewer .viewer .prev-btn {
861
- width: 35px;
862
- height: 35px;
863
- border-radius: 50%;
864
- text-align: center;
865
- background: #0000001a;
866
- cursor: pointer;
867
- position: absolute;
868
- top: 50%;
869
- }
870
-
871
- body .context-image-viewer .viewer .zoom-in-btn:hover,
872
- body .context-image-viewer .viewer .zoom-out-btn:hover {
873
- transform: scale(1.04);
874
- transition: all 0.15s ease-in-out;
875
- }
876
-
877
- body .context-image-viewer .viewer .zoom-in-btn span,
878
- body .context-image-viewer .viewer .zoom-out-btn span {
879
- display: inline-block;
880
- margin-top: 12%;
881
- font-size: 1.5em;
882
- }
883
-
884
- body .context-image-viewer .viewer .next-btn:hover,
885
- body .context-image-viewer .viewer .prev-btn:hover {
886
- transform: scale(1.04);
887
- transition: all 0.15s ease-in-out;
888
- }
889
-
890
- body .context-image-viewer .viewer .next-btn span,
891
- body .context-image-viewer .viewer .prev-btn span {
892
- display: inline-block;
893
- margin-top: 15%;
894
- font-size: 1.5em;
895
- }
896
-
897
- body .context-image-viewer .viewer .prev-btn {
898
- left: 1%;
899
- }
900
-
901
- body .context-image-viewer .viewer .next-btn {
902
- right: 1%;
903
- }
904
-
905
- body .context-image-viewer .viewer .wrapper {
906
- display: flex;
907
- flex-direction: column;
908
- width: 100%;
909
- height: 100%;
910
- padding: 1.8%;
911
- }
912
-
913
- body .context-image-viewer .viewer .wrapper .toolbar .page-title-wrapper .page-title {
914
- font-weight: 600;
915
- max-width: 75%;
916
- white-space: nowrap;
917
- overflow: hidden;
918
- text-overflow: ellipsis;
919
- }
920
-
921
- body .context-image-viewer .viewer .wrapper .toolbar .page-title-wrapper .page-count {
922
- font-size: 0.7em;
923
- }
924
-
925
- body #overview .section .page-tiles .search-field-wrapper #search-input {
926
- width: 55%;
927
- height: 1.5em;
928
- margin-left: 0.5%;
929
- white-space: nowrap;
930
- text-overflow: ellipsis;
931
- border-radius: 3px;
932
- border: 0.1px solid;
933
- }
934
-
935
- body #overview .section .page-tiles .search-field-wrapper #operator-filter {
936
- width: fit-content;
937
- height: 1.5em;
938
- border-radius: 3px;
939
- }
940
-
941
- body #overview .section .page-tiles .search-field-wrapper {
942
- flex: 33;
943
- display: flex;
944
- align-items: center;
945
- gap: 1%;
946
- }
947
-
948
- body .context-image-viewer .viewer .wrapper .toolbar .smart-compare-wrapper .switch-wrapper .switch-knob {
949
- position: absolute;
950
- width: 40%;
951
- height: 86%;
952
- border-radius: 50%;
953
- background-color: white;
954
- top: 50%;
955
- left: 3%;
956
- transform: translateY(-50%);
957
- transition: left 0.3s;
958
- }
959
-
960
- body .context-image-viewer .viewer .wrapper .toolbar .smart-compare-wrapper .switch-wrapper {
961
- position: relative;
962
- width: 2.5em;
963
- height: 1.3em;
964
- border-radius: 2em;
965
- background-color: gray;
966
- cursor: pointer;
967
- }
968
-
969
- body .context-image-viewer .viewer .wrapper .toolbar .smart-compare-wrapper {
970
- display: flex;
971
- align-items: center;
972
- gap: 1%;
973
- flex: 33;
974
- justify-content: end;
975
- }
976
-
977
- body .context-image-viewer .viewer .wrapper .toolbar .page-title-wrapper {
978
- display: flex;
979
- flex-direction: column;
980
- overflow: hidden;
981
- flex: 33;
982
- }
983
-
984
- body .context-image-viewer .viewer .wrapper .image-section .split-view .source-image-wrapper .locale-name-bar span,
985
- body .context-image-viewer .viewer .wrapper .image-section .split-view .target-image-wrapper .locale-name-bar span {
986
- opacity: 0.6;
987
- }
988
-
989
- body .context-image-viewer .viewer .wrapper .image-section .split-view .source-image-wrapper .locale-name-bar,
990
- body .context-image-viewer .viewer .wrapper .image-section .split-view .target-image-wrapper .locale-name-bar {
991
- position: absolute;
992
- background-color: #8080801f;
993
- width: 9%;
994
- height: 3.5%;
995
- text-align: center;
996
- margin: auto;
997
- overflow: hidden;
998
- text-overflow: ellipsis;
999
- white-space: nowrap;
1000
- padding: 0.5em;
1001
- bottom: 2.1rem;
1002
- left: 2rem;
1003
- border-radius: 3em;
1004
- color: #00000099;
1005
- font: status-bar;
1006
- font-weight: 500;
1007
- }
1008
-
1009
- body .context-image-viewer .viewer .wrapper .image-section .split-view .source-image-wrapper,
1010
- body .context-image-viewer .viewer .wrapper .image-section .split-view .target-image-wrapper {
1011
- width: 100%;
1012
- height: 100%;
1013
- overflow: hidden;
1014
- flex: 1;
1015
- display: flex;
1016
- justify-content: center;
1017
- align-items: center;
1018
- border: 0.1px solid #00000021;
1019
- border-radius: 5px;
1020
- }
1021
-
1022
- body .context-image-viewer .viewer .wrapper .image-section .split-view .source-image-wrapper img,
1023
- body .context-image-viewer .viewer .wrapper .image-section .split-view .target-image-wrapper img {
1024
- max-width: 100%;
1025
- max-height: 100%;
1026
- object-fit: contain;
1027
- transform: translate(0, 0) scale(1);
1028
- transition: transform 0.1s ease-out;
1029
- pointer-events: none;
1030
- }
1031
-
1032
- body .context-image-viewer .viewer .wrapper .image-section .split-view {
1033
- width: 100%;
1034
- height: 100%;
1035
- display: flex;
1036
- gap: 0.5%;
1037
- }
1038
-
1039
- body .context-image-viewer .viewer .wrapper .image-section {
1040
- display: flex;
1041
- flex: 95;
1042
- overflow: hidden;
1043
- width: 100%;
1044
- height: 100%;
1045
- }
1046
-
1047
- body .context-image-viewer .viewer .wrapper .toolbar {
1048
- border: 0.1px solid #00000021;
1049
- border-bottom: 0;
1050
- height: 7%;
1051
- border-radius: 5px;
1052
- padding: 0.5%;
1053
- padding-left: 1%;
1054
- padding-right: 1%;
1055
- display: flex;
1056
- flex-direction: row;
1057
- align-items: center;
1058
- justify-content: stretch;
1059
- flex: 4;
1060
- }
1061
-
1062
- body .dt-layout-row:first-of-type .dt-layout-cell {
1063
- display: table-cell;
1064
- width: 33.33%;
1065
- vertical-align: middle;
1066
- text-align: center;
1067
- padding: 8px;
1068
- }
1069
-
1070
- body .dt-layout-row:first-of-type .dt-layout-cell.dt-middle {
1071
- text-align: right;
1072
- }
1073
-
1074
- body .dt-layout-row:first-of-type .reset-filters-btn {
1075
- background-color: #555;
1076
- color: white;
1077
- border: none;
1078
- padding: 8px 16px;
1079
- font-size: 14px;
1080
- cursor: pointer;
1081
- border-radius: 4px;
1082
- transition: background-color 0.3s ease;
1083
- }
1084
-
1085
- .--reduced-zoom {
1086
- zoom: 0.9123;
1087
- }
1088
-
1089
- .--hide-overflow {
1090
- overflow: hidden;
1091
- }
1092
-
1093
- .--disabled {
1094
- color: #00000014 !important;
1095
- background: #00000014 !important;
1096
- cursor: not-allowed !important;
1097
- transform: none !important;
1098
- transition: none !important;
1099
- }
1100
-
1101
- .--disabled:hover {
1102
- color: #00000014 !important;
1103
- background: #00000014 !important;
1104
- transform: none !important;
1105
- transition: none !important;
1106
- }`}function Pe({appName:i,reportTime:e,script:t,style:a,body:n,dataFilePaths:s=[],logData:o}){return`<!DOCTYPE html>
1107
- <html lang="en">
1108
- <head>
1109
- <meta charset="UTF-8" />
1110
- <meta name="charset" content="charset='UTF-8'" />
1111
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
1112
- <meta name="company" content="Zeesoft" />
1113
- <meta name="product" content="zAutomate.AI" />
1114
- <meta name="author" content="Jitendra Maheshwari" />
1115
- <meta name="email" content="jm@zeesoft.com" />
1116
- <meta
1117
- name="description"
1118
- content="zAutomate.AI report"
1119
- />
1120
- <title>${i} - zAutomate.AI report | ${e}</title>
1121
- <!-- 3rd party dependencies -->
1122
- <link
1123
- rel="stylesheet"
1124
- href="https://cdn.datatables.net/2.0.3/css/dataTables.dataTables.min.css"
1125
- />
1126
- ${s.map(u=>`<script
1127
- src="${u}"
1128
- type="text/javascript">
1129
- <\/script>`).join("")}
1130
- ${o?`<script type="text/javascript" async/>window.logData = \`${o}\`;<\/script>`:""}
1131
- <script
1132
- src="https://code.jquery.com/jquery-3.7.1.slim.min.js"
1133
- integrity="sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8="
1134
- crossorigin="anonymous"
1135
- defer
1136
- ><\/script>
1137
- <script src="https://cdn.jsdelivr.net/npm/apexcharts" defer><\/script>
1138
- <script
1139
- src="https://cdn.datatables.net/2.0.3/js/dataTables.min.js"
1140
- defer
1141
- ><\/script>
1142
- <style>
1143
- ${a}
1144
- </style>
1145
- </head>
1146
- <body>
1147
- ${n}
1148
- </body>
1149
- <script type="text/javascript" defer>
1150
- ${t}
1151
- <\/script>
1152
- </html>
1153
- `}const Be=()=>`(() => {
1154
- // for sidebar menu
1155
- // hide insights tab
1156
- if(DataStore.hasRuntimeError() || !DataStore.ranSuccessfully() || DataStore.isContextRun()) {
1157
- document.querySelector('.menu-item[data-page="insights"]')?.remove();
1158
- }
1159
-
1160
- const loadContent = (section, highlightMenu = false) => {
1161
- if (highlightMenu) {
1162
- document
1163
- .querySelector('li[data-page="overview"]')
1164
- ?.classList.add('selected');
1165
- }
1166
-
1167
- const contents = document.querySelectorAll('.content');
1168
- const wrapper = document.querySelector('.content-wrapper');
1169
-
1170
- contents.forEach((content) => {
1171
- content.id !== section
1172
- ? content.classList.remove('active')
1173
- : content.classList.add('active');
1174
-
1175
- section === 'overview' &&
1176
- window.persistOverviewCharts &&
1177
- window.persistOverviewCharts();
1178
-
1179
- ['log', 'locale'].includes(section) ? wrapper.classList.add('--hide-overflow') : !DataStore.isContextRun() && !DataStore.isSanityRun() && wrapper.classList.remove('--hide-overflow');
1180
- window.currentPage = section;
1181
- });
1182
- };
1183
-
1184
- document.addEventListener('DOMContentLoaded', function () {
1185
- const createMenuItems = (() => {
1186
- if(DataStore.isContextRun()) {
1187
- return;
1188
- }
1189
- const ul = document.querySelector('.sidebar .submenu');
1190
- const createListItems = (locale) => {
1191
- const li = document.createElement('li');
1192
- li.classList.add('sub-menu-item');
1193
- li.dataset.locale = locale;
1194
-
1195
- const a = document.createElement('a');
1196
- a.href = '#';
1197
- a.textContent = locale;
1198
-
1199
- li.appendChild(a);
1200
- return li;
1201
- };
1202
-
1203
- for (const locale of DataStore.getLocales()) {
1204
- ul.appendChild(createListItems(locale));
1205
- }
1206
- })();
1207
-
1208
- const menuItems = document.querySelectorAll('.menu-item'),
1209
- submenuItems = document.querySelectorAll('.sub-menu-item');
1210
-
1211
- menuItems.forEach((item) => {
1212
- item.addEventListener('click', function (event) {
1213
- const selectedMenuItem = document.querySelector(
1214
- '.menu-item.selected'
1215
- ),
1216
- selectedSubmenu = document.querySelector('.submenu.active'),
1217
- page = item.dataset.page;
1218
-
1219
- if (selectedMenuItem) {
1220
- selectedMenuItem.classList.remove('selected');
1221
- }
1222
-
1223
- if (selectedSubmenu) {
1224
- selectedSubmenu.classList.remove('active');
1225
- }
1226
-
1227
- if (item.classList.contains('has-submenu')) {
1228
- event.preventDefault();
1229
- item.classList.add('selected');
1230
- const submenu = item.querySelector('.submenu');
1231
- submenu.classList.add('active');
1232
- } else {
1233
- item.classList.add('selected');
1234
- }
1235
-
1236
- if (selectedSubmenu) {
1237
- selectedSubmenu
1238
- .querySelectorAll('.sub-menu-item')
1239
- .forEach((submenuItem) => {
1240
- submenuItem.textContent !== item.textContent &&
1241
- submenuItem.classList.remove('selected');
1242
- });
1243
- }
1244
-
1245
- loadContent(page);
1246
- });
1247
-
1248
- loadContent('overview', true);
1249
- });
1250
-
1251
- submenuItems.forEach((sItem) => {
1252
- sItem.addEventListener('click', function (event) {
1253
- const selectedSubMenuItem = document.querySelector(
1254
- '.sub-menu-item.selected'
1255
- );
1256
- event.preventDefault();
1257
- event.stopPropagation();
1258
-
1259
- if (selectedSubMenuItem) {
1260
- selectedSubMenuItem.classList.remove('selected');
1261
- window.previousSelectedLocale =
1262
- selectedSubMenuItem.dataset.locale;
1263
- }
1264
-
1265
- sItem.classList.add('selected');
1266
- loadContent('locale');
1267
- });
1268
- });
1269
-
1270
- // update footer info
1271
- const footer = document.querySelector('.sidebar .footer');
1272
- footer.textContent = \`\${new Date().getFullYear()} @ Zeesoft. All rights reserved.\`;
1273
-
1274
- // update project info
1275
- document.querySelector(
1276
- 'header .logo'
1277
- ).innerHTML = \`zAutomate.AI | \${DataStore.getAppName()} [\${DataStore.isSanityRun() ? 'Quick Sanity' : DataStore.isContextRun() ? 'Context Creation' : 'I18n Verification'}]\`;
1278
- document.querySelector(
1279
- 'header .report-timestamp .info'
1280
- ).innerHTML = \`Report generated at: \${toLocaleString(Datastore.getTimestamp())}\`;
1281
- });
1282
- })();`,$e=()=>`//overview content
1283
- (() => {
1284
- if (DataStore.hasRuntimeError()) {
1285
- document.getElementById('overview').innerHtml =
1286
- 'zAutomate.AI was unable to perform the operation. Please check the logs for more information.';
1287
- return;
1288
- }
1289
-
1290
- document.addEventListener('DOMContentLoaded', function () {
1291
- // don't render overview contents for sanity and context run
1292
- if(DataStore.isContextRun() || DataStore.isSanityRun()) {
1293
- document.querySelector('.content-wrapper')?.classList.add('--hide-overflow');
1294
- document.querySelectorAll('#overview .card')?.forEach((el) => {
1295
- if(!el.classList.contains('common-info')) {
1296
- el.remove();
1297
- }
1298
- });
1299
-
1300
- const titleEl = document.querySelector('#overview .common-info .title');
1301
- const infoEl = document.querySelector('#overview .common-info .info');
1302
-
1303
- if(titleEl && infoEl) {
1304
- let title, info;
1305
-
1306
- const renderPagesSection = () => {
1307
- let tilesEl, searchEl, searchOpEl, pages, entries, hasPages, emptyEl, currentLocale = DataStore.getDefaultLocale();
1308
- const operatorOpts = [
1309
- {
1310
- name: 'Contains',
1311
- value: '~'
1312
- },
1313
- {
1314
- name: 'Starts with',
1315
- value: '^'
1316
- },
1317
- {
1318
- name: 'Ends with',
1319
- value: '$'
1320
- },
1321
- {
1322
- name: 'Equals',
1323
- value: '='
1324
- },
1325
- ];
1326
- const valueStates = {locale: DataStore.getLocales()[0], search: {op: operatorOpts[0].value, value: ''}};
1327
- const getImagePath = (imagePath, locale = valueStates.locale) => \`\${window.getProductUrl()}/\${locale}/screenshots/reviewed/\${imagePath}\`;
1328
- const renderEmptyContext = (container) => {
1329
- emptyEl = document.createElement('div');
1330
- emptyEl.classList.add('empty-context');
1331
- emptyEl.innerHTML = 'No contexts available.';
1332
- container.appendChild(emptyEl);
1333
- };
1334
- const removeEmptyContext = () => {
1335
- if(emptyEl) {
1336
- emptyEl.remove();
1337
- }
1338
- };
1339
-
1340
- const loadData = () => {
1341
- pages = DataStore.getPages(valueStates.locale);
1342
-
1343
- if (valueStates.search.value.trim().length) {
1344
- const value = valueStates.search.value.trim().toLowerCase();
1345
- const op = valueStates.search.op;
1346
- const predicate = (string) => {
1347
- string = String(string).toLowerCase();
1348
- switch(op) {
1349
- case '~':
1350
- return string.includes(value);
1351
- case '^':
1352
- return string.startsWith(value);
1353
- case '$':
1354
- return string.endsWith(value);
1355
- case '=':
1356
- return string === value;
1357
- default:
1358
- return false;
1359
- }
1360
- };
1361
- const matchedPages = [];
1362
- const matchedEntries = Object.entries(DataStore.getDataByLocale(valueStates.locale)).filter((e) => predicate(e[0]));
1363
- matchedEntries.forEach((e) => e[1].flat().forEach(pages => !matchedPages.includes(pages.imagePath) & matchedPages.push(pages.imagePath)));
1364
- if(matchedPages.length) {
1365
- if(Object.keys(pages).length) {
1366
- for (const name in pages) {
1367
- if(!matchedPages.includes(pages[name])) {
1368
- delete pages[name];
1369
- }
1370
- }
1371
- }
1372
- }
1373
- else {
1374
- pages = {};
1375
- }
1376
- }
1377
-
1378
- entries = Object.entries(pages).sort((a, b) => a[1].localeCompare(b[1]));
1379
- hasPages = entries.length > 0;
1380
- };
1381
-
1382
- const renderContextTiles = () => {
1383
- loadData();
1384
-
1385
- if(!tilesEl) {
1386
- tilesEl = createTilesSection();
1387
- }
1388
- else {
1389
- tilesEl.innerHTML = '';
1390
- }
1391
-
1392
- if(!hasPages) {
1393
- renderEmptyContext(tilesEl);
1394
- return;
1395
- }
1396
-
1397
- removeEmptyContext();
1398
- createPageTiles(tilesEl);
1399
- };
1400
-
1401
- const createTilesSection = () => {
1402
- const wrapperEl = document.createElement('div');
1403
- wrapperEl.classList.add('page-tiles');
1404
- const titleSection = document.createElement('div');
1405
- titleSection.classList.add('title-section');
1406
- const tilesListWrapper = document.createElement('div');
1407
- const tilesEl = document.createElement('div');
1408
- tilesListWrapper.classList.add('tiles-list-wrapper');
1409
- tilesListWrapper.appendChild(tilesEl);
1410
- tilesEl.classList.add('tiles-list');
1411
- wrapperEl.appendChild(titleSection);
1412
- wrapperEl.appendChild(tilesListWrapper);
1413
-
1414
- const createTitle = () => {
1415
- const titleWrapper = document.createElement('div');
1416
- titleWrapper.classList.add('title-wrapper');
1417
- const titleEl = document.createElement('span');
1418
- titleEl.classList.add('title');
1419
- titleEl.innerHTML = 'Context Pages'
1420
- titleWrapper.appendChild(titleEl);
1421
- titleSection.appendChild(titleWrapper);
1422
- };
1423
-
1424
- const createSearchField = () => {
1425
- const searchWrapperEl = document.createElement('div');
1426
- searchWrapperEl.classList.add('search-field-wrapper');
1427
-
1428
- const createLabel = () => {
1429
- const label = document.createElement("label");
1430
- label.textContent = "Search string: ";
1431
- label.setAttribute("for", "operator-filter");
1432
-
1433
- searchWrapperEl.appendChild(label);
1434
- };
1435
-
1436
- const createOperatorFilter = () => {
1437
- searchOpEl = document.createElement("select");
1438
- searchOpEl.id = "operator-filter";
1439
- if(valueStates.search.op) {
1440
- searchOpEl.title = operatorOpts.find((op) => op.value === valueStates.search.op).name;
1441
- }
1442
- searchOpEl.addEventListener("change", function () {
1443
- if (valueStates.search.op !== this.value) {
1444
- valueStates.search.op = this.value;
1445
- renderContextTiles();
1446
- }
1447
- });
1448
-
1449
- operatorOpts.forEach((op) => {
1450
- const option = document.createElement("option");
1451
- option.value = op.value;
1452
- option.textContent = op.name;
1453
- if(valueStates.search.op === op.value) {
1454
- option.selected = true;
1455
- }
1456
- searchOpEl.appendChild(option);
1457
- });
1458
-
1459
- searchWrapperEl.appendChild(searchOpEl);
1460
- };
1461
-
1462
- const createSearchField = () => {
1463
- searchEl = document.createElement('input');
1464
- searchEl.type = 'text';
1465
- searchEl.id = 'search-input';
1466
- searchEl.placeholder = 'Search strings...'
1467
-
1468
- searchEl.addEventListener('input', function () {
1469
- if(valueStates.search.value !== this.value) {
1470
- valueStates.search.value = this.value;
1471
- renderContextTiles();
1472
- }
1473
- });
1474
-
1475
- searchWrapperEl.appendChild(searchEl);
1476
- };
1477
-
1478
- createLabel();
1479
- createOperatorFilter();
1480
- createSearchField();
1481
- titleSection.appendChild(searchWrapperEl);
1482
- };
1483
-
1484
- const createLocaleFilter = () => {
1485
- const localeFilterWrapper = document.createElement('div');
1486
- localeFilterWrapper.classList.add('locale-filter-wrapper');
1487
- const label = document.createElement("label");
1488
- label.textContent = "Locale: ";
1489
- label.setAttribute("for", "locale-filter");
1490
-
1491
- const select = document.createElement("select");
1492
- select.id = "locale-filter";
1493
- select.addEventListener("change", function () {
1494
- currentLocale = this.value;
1495
- if (valueStates.locale !== this.value) {
1496
- valueStates.locale = this.value;
1497
- valueStates.search.op = operatorOpts[0].value;
1498
- valueStates.search.value = '';
1499
- if(searchEl) {
1500
- searchEl.value = '';
1501
- }
1502
- if(searchOpEl) {
1503
- searchOpEl.value = operatorOpts[0].value;
1504
- }
1505
- renderContextTiles();
1506
- }
1507
- });
1508
-
1509
- const options = [...DataStore.getLocales()];
1510
- options.forEach((locale) => {
1511
- const option = document.createElement("option");
1512
- option.value = locale;
1513
- option.textContent = locale;
1514
- if(valueStates.locale === locale) {
1515
- option.selected = true;
1516
- }
1517
- select.appendChild(option);
1518
- });
1519
-
1520
- localeFilterWrapper.appendChild(label);
1521
- localeFilterWrapper.appendChild(select);
1522
- titleSection.appendChild(localeFilterWrapper);
1523
- };
1524
-
1525
- createTitle();
1526
- createSearchField();
1527
- createLocaleFilter();
1528
-
1529
- document.querySelector('#overview .common-info .section').appendChild(wrapperEl);
1530
- return tilesEl;
1531
- };
1532
-
1533
- const createTile = (idx, page, imagePath) => {
1534
- const wrapperEl = document.createElement('div');
1535
- wrapperEl.classList.add('tile-container');
1536
-
1537
- const imageEl = document.createElement('img');
1538
- imageEl.classList.add('image');
1539
- imageEl.src = getImagePath(imagePath);
1540
-
1541
- const nameWrapper = document.createElement('div');
1542
- const name = page;
1543
- nameWrapper.classList.add('name');
1544
- nameWrapper.title = name
1545
-
1546
- const nameEl = document.createElement('span');
1547
- nameEl.innerHTML = name;
1548
- nameWrapper.appendChild(nameEl);
1549
-
1550
- wrapperEl.appendChild(imageEl);
1551
- wrapperEl.appendChild(nameWrapper);
1552
- wrapperEl.addEventListener('click', () => openContextViewer(idx, valueStates.locale));
1553
- return wrapperEl;
1554
- };
1555
- const createPageTiles = (container) => {
1556
- let counter = 0;
1557
- for(const [page, imagePath] of entries) {
1558
- container.appendChild(createTile(counter, page, imagePath));
1559
- counter++;
1560
- }
1561
- };
1562
-
1563
- const openContextViewer = (idx, locale) => {
1564
- let loaderEl, imageViewerEl, imageViewerMainWrapperEl, imagesSplitViewEl, sourceImageEl, targetImageEl, smartCompareSwitchEl, smartCompareKnobEl, pageCountEl, pageNameEl, zoomInEl, zoomOutEl, disableSmartCompare = false;
1565
- const data = [...entries];
1566
- const pageOpts = [...data.map(d => d[0])];
1567
- const anchorEl = document.createElement('div');
1568
- anchorEl.classList.add('context-image-viewer');
1569
- const fieldStates = {search: {op: operatorOpts[0].value, value: ''}, filters: {page: ''}, smartCompare: false, highlightStrings: false, zoomLevel: 1, offsets: {x: 0, y: 0, moveX: 0, moveY: 0}, dragging: {isActive: false, isSource: false, isTarget: false}};
1570
- const valueStates = {page: '', currentIndex: idx, imagePath: ''};
1571
- const getTotalSize = () => data.length;
1572
-
1573
-
1574
- const updateContextSwitcher = () => {
1575
- const selectEl = document.getElementById("context-switcher");
1576
- if (!selectEl) return;
1577
- selectEl.value = valueStates.page;
1578
- };
1579
-
1580
- const createCloseBtn = () => {
1581
- const closeBtnEl = document.createElement('span');
1582
- closeBtnEl.innerHTML = '&times;';
1583
- closeBtnEl.classList.add('close-btn');
1584
- closeBtnEl.title = 'Close image viewer'
1585
-
1586
- const closeViewer = () => anchorEl.remove();
1587
-
1588
- closeBtnEl.addEventListener('click', closeViewer);
1589
- anchorEl.appendChild(closeBtnEl);
1590
- keyAction('Escape', closeViewer);
1591
- };
1592
-
1593
- const keyAction = (key, action) => {
1594
- document.addEventListener('keydown', (event) => {
1595
- if (event.key === key) {
1596
- action();
1597
- }
1598
- });
1599
- };
1600
-
1601
- const createLoader = () => {
1602
- loaderEl = document.createElement('div');
1603
- loaderEl.classList.add('loader');
1604
- loaderEl.classList.add('--hidden');
1605
- loaderEl.innerHTML = 'Loading...';
1606
- anchorEl.appendChild(loaderEl);
1607
- };
1608
-
1609
- const showLoader = (show, time = 1) => show ? loaderEl.classList.remove('--hidden') : time > 0 ? setTimeout(()=> loaderEl.classList.add('--hidden'), time) : loaderEl.classList.add('--hidden');
1610
-
1611
- const loadData = () => {
1612
- const updateDependencies = () => {
1613
- if(DataStore.isDefaultLocale(locale)) {
1614
- disableSmartCompare = true;
1615
- }
1616
- else if(!DataStore.hasDefaultLocaleData()) {
1617
- disableSmartCompare = true;
1618
- }
1619
- else {
1620
- const defaultLocaleData = DataStore.getPages(DataStore.getDefaultLocale());
1621
- const defaultLocalePages = Object.keys(defaultLocaleData);
1622
- if(defaultLocalePages.length === 0) {
1623
- disableSmartCompare = true;
1624
- }
1625
- else if(!defaultLocalePages.includes(data[valueStates.currentIndex][0])) {
1626
- disableSmartCompare = true;
1627
- }
1628
- else {
1629
- disableSmartCompare = false;
1630
- }
1631
- }
1632
- };
1633
- const setPageName = () => {
1634
- valueStates.page = data[valueStates.currentIndex][0];
1635
- };
1636
-
1637
- updateDependencies();
1638
- setPageName();
1639
-
1640
- };
1641
-
1642
- const renderData = (loadingMaskRemovalDelay = 0, resetZoom = false, showLoadingMask = true) => {
1643
- const renderPageTitle = () => {
1644
- const renderPageCount = () => {
1645
- pageCountEl.innerHTML = \`#\${valueStates.currentIndex + 1}/\${getTotalSize()}\`;
1646
- };
1647
- const renderPageName = () => {
1648
- pageNameEl.innerHTML = valueStates.page;
1649
- pageNameEl.title = valueStates.page;
1650
- };
1651
-
1652
- renderPageCount();
1653
- renderPageName();
1654
- };
1655
-
1656
- const renderSmartCompareValue = () => {
1657
- if(disableSmartCompare) {
1658
- !smartCompareSwitchEl.parentElement.classList.contains('--hidden') && smartCompareSwitchEl.parentElement.classList.add('--hidden');
1659
- }
1660
- else {
1661
- smartCompareSwitchEl.parentElement.classList.contains('--disabled') && smartCompareSwitchEl.parentElement.classList.remove('--hidden');
1662
- smartCompareSwitchEl.style.backgroundColor = fieldStates.smartCompare ? "green" : "gray";
1663
- smartCompareKnobEl.style.left = fieldStates.smartCompare ? "55%" : "5%";
1664
- }
1665
- };
1666
-
1667
- const renderImages = (loadingMaskDelay) => {
1668
- let hasSourceLoaded, hasTargetLoaded;
1669
- const entry = data[valueStates.currentIndex];
1670
- const cursor = fieldStates.zoomLevel > 1 ? fieldStates.dragging.isActive ? 'grabbing' : 'grab' : 'default';
1671
- const css = fieldStates.zoomLevel === 1 ? 'translate(0, 0) scale(1)'
1672
- : \`translate(\${fieldStates.offsets.moveX}px, \${fieldStates.offsets.moveY}px) scale(\${fieldStates.zoomLevel})\`;
1673
-
1674
- if(fieldStates.smartCompare) {
1675
- sourceImageEl.parentElement.classList.remove('--hidden');
1676
- sourceImageEl.src = getImagePath(entry[1], DataStore.getDefaultLocale());
1677
- sourceImageEl.alt = entry[0];
1678
- sourceImageEl.style.transform = css;
1679
- targetImageEl.parentElement.querySelector('.locale-name-bar').style.left = '50.9rem';
1680
-
1681
- if(showLoadingMask) {
1682
- sourceImageEl.onload = () => {
1683
- let interval;
1684
- interval = setInterval(() => {
1685
- if(hasTargetLoaded) {
1686
- clearInterval(interval);
1687
- showLoader(false, loadingMaskDelay);
1688
- }
1689
- }, 10);
1690
- };
1691
- targetImageEl.onload = () => {
1692
- hasTargetLoaded = true;
1693
- };
1694
- }
1695
- }
1696
- else {
1697
- sourceImageEl.parentElement.classList.add('--hidden');
1698
- targetImageEl.parentElement.querySelector('.locale-name-bar').style.left = '2rem';
1699
-
1700
- if(showLoadingMask) {
1701
- targetImageEl.onload = () => {
1702
- showLoader(false, loadingMaskDelay);
1703
- };
1704
- }
1705
- }
1706
-
1707
- targetImageEl.src = getImagePath(entry[1]);
1708
- targetImageEl.alt = entry[0];
1709
- targetImageEl.style.transform = css;
1710
-
1711
- sourceImageEl.parentElement.style.cursor = cursor;
1712
- targetImageEl.parentElement.style.cursor = cursor;
1713
- };
1714
-
1715
- const resetZoomBtns = () => {
1716
- const zoomOutBtn = document.querySelector('.viewer .zoom-out-btn');
1717
- const zoomInBtn = document.querySelector('.viewer .zoom-in-btn');
1718
- if (!zoomOutBtn.classList.contains('--disbaled')) {
1719
- zoomOutBtn.classList.add('--disabled');
1720
- }
1721
- if (zoomInBtn.classList.contains('--disabled')) {
1722
- zoomInBtn.classList.remove('--disabled');
1723
- }
1724
- fieldStates.zoomLevel = 1;
1725
- fieldStates.offsets.x = 0;
1726
- fieldStates.offsets.y = 0;
1727
- fieldStates.offsets.moveX = 0;
1728
- fieldStates.offsets.moveY = 0;
1729
- };
1730
-
1731
- showLoadingMask && showLoader(true);
1732
- resetZoom && resetZoomBtns();
1733
- loadData();
1734
- renderPageTitle();
1735
- renderSmartCompareValue();
1736
- renderImages(loadingMaskRemovalDelay);
1737
- };
1738
-
1739
- const createImageViewer = () => {
1740
- imageViewerEl = document.createElement('div');
1741
- imageViewerEl.classList.add('viewer');
1742
-
1743
- imageViewerMainWrapperEl = document.createElement('div');
1744
- imageViewerMainWrapperEl.classList.add('wrapper');
1745
- imageViewerEl.appendChild(imageViewerMainWrapperEl);
1746
- anchorEl.appendChild(imageViewerEl);
1747
-
1748
- createNavigationButtons();
1749
- createZoomButtons();
1750
- createToolbar();
1751
- createSplitView();
1752
- renderData(300);
1753
- document.body.appendChild(anchorEl);
1754
- };
1755
-
1756
- const createNavigationButtons = () => {
1757
- let prevBtn, nextBtn;
1758
-
1759
- const createPrevBtn = () => {
1760
- prevBtn = document.createElement('div');
1761
- prevBtn.classList.add('prev-btn');
1762
- prevBtn.title = 'Show previous context';
1763
-
1764
- const prevIconEl = document.createElement('span');
1765
- prevIconEl.innerHTML = '<';
1766
- prevBtn.appendChild(prevIconEl);
1767
- imageViewerEl.appendChild(prevBtn);
1768
-
1769
- const movePrevAction = () => canMovePrev() && movePrev();
1770
- prevBtn.addEventListener('click', movePrevAction);
1771
- keyAction("ArrowLeft", () => {
1772
- if (valueStates.currentIndex > 0) {
1773
- movePrev();
1774
- updateContextSwitcher();
1775
- }
1776
- });
1777
- };
1778
- const createNextBtn = () => {
1779
- nextBtn = document.createElement('div');
1780
- nextBtn.classList.add('next-btn');
1781
- nextBtn.title = 'Show next context';
1782
-
1783
- const nextIconEl = document.createElement('span');
1784
- nextIconEl.innerHTML = '>';
1785
- nextBtn.appendChild(nextIconEl);
1786
- imageViewerEl.appendChild(nextBtn);
1787
-
1788
- const moveNextAction = () => canMoveNext() && moveNext();
1789
- nextBtn.addEventListener('click', moveNextAction);
1790
- keyAction("ArrowRight", () => {
1791
- if (valueStates.currentIndex < pageOpts.length - 1) {
1792
- moveNext();
1793
- updateContextSwitcher();
1794
- }
1795
- });
1796
- };
1797
- const canMoveNext = () => valueStates.currentIndex < getTotalSize() - 1;
1798
- const canMovePrev = () => valueStates.currentIndex > 0;
1799
- const moveNext = () => {
1800
- valueStates.currentIndex++;
1801
- determineBtnsAccessibility();
1802
- renderData(0, true, true);
1803
- updateContextSwitcher();
1804
- };
1805
- const movePrev = () => {
1806
- valueStates.currentIndex--;
1807
- determineBtnsAccessibility();
1808
- renderData(0, true, true);
1809
- updateContextSwitcher();
1810
- };
1811
- const disableBtn = (btn) => btn === 'prev' ? prevBtn.classList.add('--disabled') : nextBtn.classList.add('--disabled');
1812
- const enableBtn = (btn) => btn === 'prev' ? prevBtn.classList.remove('--disabled') : nextBtn.classList.remove('--disabled');
1813
- const isBtnDisabled = (btn) => btn === 'prev' ? prevBtn.classList.contains('--disabled') : nextBtn.classList.contains('--disabled');
1814
- const determineNextBtnAccessibility = () => {
1815
- if(!canMoveNext()) {
1816
- !isBtnDisabled('next') && disableBtn('next');
1817
- }
1818
- else if(isBtnDisabled('next')) {
1819
- enableBtn('next');
1820
- }
1821
- };
1822
- const determinePrevBtnAccessibility = () => {
1823
- if(!canMovePrev()) {
1824
- !isBtnDisabled('prev') && disableBtn('prev');
1825
- }
1826
- else if(isBtnDisabled('prev')) {
1827
- enableBtn('prev');
1828
- }
1829
- };
1830
- const determineBtnsAccessibility = () => {
1831
- determinePrevBtnAccessibility();
1832
- determineNextBtnAccessibility();
1833
- };
1834
-
1835
- createPrevBtn();
1836
- createNextBtn();
1837
- determineBtnsAccessibility();
1838
- };
1839
-
1840
- const createZoomButtons = () => {
1841
- const maxLevel = 10;
1842
- const baseLevel = 1;
1843
- const levelStep = 1;
1844
- let zoomInBtn, zoomOutBtn;
1845
-
1846
- const canZoomIn = () => fieldStates.zoomLevel + 0.5 <= maxLevel;
1847
- const canZoomOut = () => fieldStates.zoomLevel - 0.5 >= baseLevel;
1848
- const isBtnDisabled = (btn) => btn === 'zoom-in' ? zoomInBtn.classList.contains('--disabled') : zoomOutBtn.classList.contains('--disabled');
1849
- const disableBtn = (btn) => btn === 'zoom-in' ? zoomInBtn.classList.add('--disabled') : zoomOutBtn.classList.add('--disabled');
1850
- const enableBtn = (btn) => btn === 'zoom-in' ? zoomInBtn.classList.remove('--disabled') : zoomOutBtn.classList.remove('--disabled');
1851
- const determineZoomInBtnAccessibility = () => {
1852
- if(!canZoomIn()) {
1853
- !isBtnDisabled('zoom-in') && disableBtn('zoom-in');
1854
- }
1855
- else if(isBtnDisabled('zoom-in')) {
1856
- enableBtn('zoom-in');
1857
- }
1858
- };
1859
- const determineZoomOutBtnAccessibility = () => {
1860
- if(!canZoomOut()) {
1861
- !isBtnDisabled('zoom-out') && disableBtn('zoom-out');
1862
- }
1863
- else if(isBtnDisabled('zoom-out')) {
1864
- enableBtn('zoom-out');
1865
- }
1866
- };
1867
- const determineBtnsAccessibility = () => {
1868
- determineZoomInBtnAccessibility();
1869
- determineZoomOutBtnAccessibility();
1870
- };
1871
- const zoomIn = () => {
1872
- fieldStates.zoomLevel += 0.5;
1873
- determineBtnsAccessibility();
1874
- renderData(0, false, false);
1875
- };
1876
- const zoomOut = () => {
1877
- fieldStates.zoomLevel -= 0.5;
1878
- determineBtnsAccessibility();
1879
- renderData(0, false, false);
1880
- }
1881
- const resetZoomLevel = () => {
1882
- fieldStates.zoomLevel = 1;
1883
- determineBtnsAccessibility();
1884
- };
1885
- const createZoomInBtn =() => {
1886
- zoomInBtn = document.createElement('div');
1887
- zoomInBtn.classList.add('zoom-in-btn');
1888
- zoomInBtn.title = 'Zoom In';
1889
-
1890
- const zoomInIconEl = document.createElement('span');
1891
- zoomInIconEl.innerHTML = '+';
1892
- zoomInBtn.appendChild(zoomInIconEl);
1893
- imageViewerEl.appendChild(zoomInBtn);
1894
-
1895
- const zoomInAction = () => canZoomIn() && zoomIn();
1896
- zoomInBtn.addEventListener('click', zoomInAction);
1897
- keyAction('=', zoomInAction);
1898
- };
1899
-
1900
- const createZoomOutBtn = () => {
1901
- zoomOutBtn = document.createElement('div');
1902
- zoomOutBtn.classList.add('zoom-out-btn');
1903
- zoomOutBtn.title = 'Zoom Out';
1904
-
1905
- const zoomOutIconEl = document.createElement('span');
1906
- zoomOutIconEl.innerHTML = '-';
1907
- zoomOutBtn.appendChild(zoomOutIconEl);
1908
- imageViewerEl.appendChild(zoomOutBtn);
1909
-
1910
- const performZoomOut = () => canZoomOut() && zoomOut();
1911
- zoomOutBtn.addEventListener('click', performZoomOut);
1912
- keyAction('-', performZoomOut);
1913
-
1914
- };
1915
-
1916
- createZoomInBtn();
1917
- createZoomOutBtn();
1918
- resetZoomLevel();
1919
- };
1920
-
1921
- const createToolbar = () => {
1922
- const toolbarEl = document.createElement('div');
1923
- toolbarEl.classList.add('toolbar');
1924
-
1925
- const createPageTitle = () => {
1926
- const wrapperEl = document.createElement('div');
1927
- wrapperEl.classList.add('page-title-wrapper');
1928
-
1929
- pageCountEl = document.createElement('div');
1930
- pageCountEl.classList.add('page-count');
1931
-
1932
- const pageNameWrapperEl = document.createElement('div');
1933
- pageNameWrapperEl.classList.add('page-title');
1934
-
1935
- pageNameEl = document.createElement('span');
1936
- pageNameWrapperEl.appendChild(pageNameEl);
1937
-
1938
- wrapperEl.appendChild(pageCountEl);
1939
- wrapperEl.appendChild(pageNameWrapperEl);
1940
-
1941
- toolbarEl.appendChild(wrapperEl);
1942
- };
1943
-
1944
- const createContextSwitcher = () => {
1945
- const wrapperEl = document.createElement('div');
1946
- wrapperEl.classList.add('context-switcher-wrapper');
1947
-
1948
- const label = document.createElement("label");
1949
- label.textContent = "Context Switcher: ";
1950
- label.setAttribute("for", "context-switcher");
1951
-
1952
- const selectEl = document.createElement("select");
1953
- selectEl.id = "context-switcher";
1954
- selectEl.classList.add("context-dropdown");
1955
-
1956
- const isTextClipped = (element) => {
1957
- return element.offsetWidth < element.scrollWidth;
1958
- };
1959
-
1960
- pageOpts.forEach(page => {
1961
- const optionEl = document.createElement("option");
1962
- optionEl.value = page;
1963
- optionEl.textContent = page;
1964
-
1965
- if (page === valueStates.page) {
1966
- optionEl.selected = true;
1967
- }
1968
-
1969
- optionEl.addEventListener("mouseover", function () {
1970
- if (isTextClipped(optionEl)) {
1971
- optionEl.setAttribute("title", page);
1972
- } else {
1973
- optionEl.removeAttribute("title");
1974
- }
1975
- });
1976
- selectEl.appendChild(optionEl);
1977
- });
1978
-
1979
- selectEl.addEventListener("change", (event) => {
1980
- const selectedPage = event.target.value;
1981
- valueStates.page = selectedPage;
1982
- valueStates.currentIndex = pageOpts.indexOf(selectedPage);
1983
- renderData(0, true);
1984
- });
1985
-
1986
- wrapperEl.appendChild(label);
1987
- wrapperEl.appendChild(selectEl);
1988
- toolbarEl.appendChild(wrapperEl);
1989
- };
1990
-
1991
- const createSmartCompateBtn = () => {
1992
- const wrapperEl = document.createElement("div");
1993
- wrapperEl.classList.add('smart-compare-wrapper');
1994
-
1995
- const label = document.createElement("span");
1996
- label.textContent = "Smart compare: ";
1997
-
1998
- smartCompareSwitchEl = document.createElement("div");
1999
- smartCompareSwitchEl.classList.add('switch-wrapper');
2000
- wrapperEl.title = 'Compare with source locale context image';
2001
-
2002
- smartCompareKnobEl = document.createElement("div");
2003
- smartCompareKnobEl.classList.add('switch-knob');
2004
-
2005
- smartCompareSwitchEl.addEventListener("click", function () {
2006
- if(disableSmartCompare) {
2007
- return;
2008
- }
2009
- fieldStates.smartCompare = !fieldStates.smartCompare;
2010
- renderData(300, true, true);
2011
- });
2012
-
2013
- wrapperEl.appendChild(label);
2014
- smartCompareSwitchEl.appendChild(smartCompareKnobEl);
2015
- wrapperEl.appendChild(smartCompareSwitchEl);
2016
- toolbarEl.appendChild(wrapperEl);
2017
- };
2018
-
2019
- createPageTitle();
2020
- createContextSwitcher();
2021
- createSmartCompateBtn();
2022
-
2023
- imageViewerMainWrapperEl.appendChild(toolbarEl);
2024
- };
2025
-
2026
- const createSplitView = (enableSplitView = false) => {
2027
- const clampImage = (value, min, max) => {
2028
- return Math.max(min, Math.min(value, max));
2029
- };
2030
-
2031
- const startDrag = (event, img) => {
2032
- if(fieldStates.zoomLevel === 1) {
2033
- return;
2034
- }
2035
-
2036
- fieldStates.dragging.isActive = true;
2037
- fieldStates.dragging.isSource = img === 'source';
2038
- fieldStates.dragging.isTarget = img === 'target';
2039
- fieldStates.offsets.x = event.clientX;
2040
- fieldStates.offsets.y = event.clientY;
2041
- sourceImageWrapper.style.cursor = "grabbing";
2042
- targetImageWrapper.style.cursor = "grabbing";
2043
- };
2044
-
2045
- const stopDrag = () => {
2046
- const cursor = fieldStates.zoomLevel === 1 ? 'default' : 'grab';
2047
- fieldStates.dragging.isActive = false;
2048
- fieldStates.dragging.isSource = false;
2049
- fieldStates.dragging.isTarget = false;
2050
- sourceImageWrapper.style.cursor = cursor;
2051
- targetImageWrapper.style.cursor = cursor;
2052
- };
2053
-
2054
- const dragMove = (event) => {
2055
- if (!fieldStates.dragging.isActive || fieldStates.zoomLevel === 1) {
2056
- return;
2057
- }
2058
-
2059
- const dx = (event.clientX - fieldStates.offsets.x) * fieldStates.zoomLevel;
2060
- const dy = (event.clientY - fieldStates.offsets.y) * fieldStates.zoomLevel;
2061
- fieldStates.offsets.moveX += dx;
2062
- fieldStates.offsets.moveY += dy;
2063
-
2064
- const wrapper = fieldStates.dragging.isSource ? sourceImageWrapper : targetImageWrapper;
2065
- const image = fieldStates.dragging.isSource ? sourceImageEl : targetImageEl;
2066
- const viewerWidth = wrapper.clientWidth;
2067
- const viewerHeight = wrapper.clientHeight;
2068
- const imgWidth = image.width * fieldStates.zoomLevel;
2069
- const imgHeight = image.height * fieldStates.zoomLevel;
2070
-
2071
- const minX = -(imgWidth - viewerWidth) / 2;
2072
- const maxX = (imgWidth - viewerWidth) / 2;
2073
- const minY = -(imgHeight - viewerHeight) / 2;
2074
- const maxY = (imgHeight - viewerHeight) / 2;
2075
-
2076
- fieldStates.offsets.moveX = clampImage(fieldStates.offsets.moveX, minX, maxX);
2077
- fieldStates.offsets.moveY = clampImage(fieldStates.offsets.moveY, minY, maxY);
2078
-
2079
- fieldStates.offsets.x = event.clientX;
2080
- fieldStates.offsets.y = event.clientY;
2081
-
2082
- renderData(0, false, false);
2083
- };
2084
-
2085
- const imageSectionEl = document.createElement('div');
2086
- imageSectionEl.classList.add('image-section');
2087
-
2088
- imagesSplitViewEl = document.createElement('div');
2089
- imagesSplitViewEl.classList.add('split-view');
2090
-
2091
- const sourceImageWrapper = document.createElement('div');
2092
- const targetImageWrapper = document.createElement('div');
2093
- const sourceLocaleNameBar = document.createElement('div');
2094
- const sourceLocaleNameEl = document.createElement('span');
2095
- const targetLocaleNameBar = document.createElement('div');
2096
- const targetLocaleNameEl = document.createElement('span');
2097
- sourceLocaleNameBar.classList.add('locale-name-bar');
2098
- targetLocaleNameBar.classList.add('locale-name-bar');
2099
- sourceLocaleNameEl.innerHTML = \`\${DataStore.getDefaultLocale()} Image\`;
2100
- targetLocaleNameEl.innerHTML = \`\${locale} Image\`;
2101
-
2102
- sourceImageWrapper.classList.add('source-image-wrapper');
2103
- targetImageWrapper.classList.add('target-image-wrapper');
2104
-
2105
-
2106
- sourceImageEl = document.createElement('img');
2107
- sourceImageEl.classList.add('source-image');
2108
- sourceImageWrapper.classList.add('--hidden');
2109
-
2110
- targetImageEl = document.createElement('img');
2111
- targetImageEl.classList.add('target-image');
2112
-
2113
- sourceImageWrapper.addEventListener("mousedown", (e) => startDrag(e, 'source'));
2114
- targetImageWrapper.addEventListener("mousedown", (e) => startDrag(e, 'target'));
2115
- sourceImageWrapper.addEventListener("mouseup", (e) => stopDrag(e, 'source'));
2116
- targetImageWrapper.addEventListener("mouseup", (e) => stopDrag(e, 'target'));
2117
- document.addEventListener("mousemove", dragMove);
2118
-
2119
- sourceImageWrapper.appendChild(sourceImageEl);
2120
- targetImageWrapper.appendChild(targetImageEl);
2121
- sourceLocaleNameBar.appendChild(sourceLocaleNameEl);
2122
- sourceImageWrapper.appendChild(sourceLocaleNameBar);
2123
- targetLocaleNameBar.appendChild(targetLocaleNameEl);
2124
- targetImageWrapper.appendChild(targetLocaleNameBar);
2125
-
2126
- imagesSplitViewEl.appendChild(sourceImageWrapper);
2127
- imagesSplitViewEl.appendChild(targetImageWrapper);
2128
-
2129
- imageSectionEl.appendChild(imagesSplitViewEl);
2130
- imageViewerMainWrapperEl.appendChild(imageSectionEl);
2131
- };
2132
-
2133
- loadData();
2134
- createCloseBtn();
2135
- createLoader();
2136
- createImageViewer();
2137
- };
2138
-
2139
- renderContextTiles();
2140
- };
2141
-
2142
- if(DataStore.isContextRun()) {
2143
- title = 'Context Creation Details';
2144
- info = \`\${window.isStandaloneReport ? 'Created' : 'Imported'} context screenshots for the locales \${DataStore.getLocales().map(locale => {
2145
- const localeStats = DataStore.getStatByLocale(locale);
2146
- return \`<strong>\${locale}</strong>(<em>\${localeStats?.context || 0} contexts</em>, <em>\${localeStats?.reviewed || 0} strings</em>)\`;
2147
- }).join(', ')}\${!window.isStandaloneReport ? \` with version <strong>\${DataStore.getReportFolderTimestamp()}</strong>\` : ''}.\`;
2148
- renderPagesSection();
2149
- }
2150
- else {
2151
- const locales = DataStore.getLocales();
2152
- title = 'Sanity run details';
2153
- info = \`Sanity run has successfully covered \${DataStore.getStatByLocale(locales[0])?.reviewed || 0} pages for the locales \${locales.map(locale => {
2154
- return \`<strong>\${locale}</em>\`;
2155
- }).join(', ')}.\`;
2156
- }
2157
-
2158
- titleEl.textContent = title;
2159
- infoEl.innerHTML = info;
2160
- }
2161
-
2162
- return;
2163
- }
2164
- else {
2165
- document.querySelector('#overview .common-info')?.remove();
2166
-
2167
- let overviewChart,
2168
- stringChart,
2169
- dateTimeChart,
2170
- numberChart,
2171
- ignoredChart;
2172
-
2173
- window.persistOverviewCharts = () => {
2174
- if(DataStore.isContextRun() || DataStore.isSanityRun()) {
2175
- return;
2176
- }
2177
-
2178
- const reset = (chart) => {
2179
- chart.resetSeries(true, true);
2180
- };
2181
-
2182
- reset(overviewChart);
2183
- reset(stringChart);
2184
- reset(dateTimeChart);
2185
- reset(numberChart);
2186
- reset(ignoredChart);
2187
- };
2188
-
2189
- renderOverallChart();
2190
- renderStringChart();
2191
- renderIgnoredChart();
2192
- renderNumberChart();
2193
- renderDatetimeChart();
2194
-
2195
- function renderOverallChart() {
2196
- const overallStats = DataStore.getOverallStats();
2197
- const reviewed = overallStats.reviewed;
2198
- const locales = DataStore.getLocales().length;
2199
- const type = {
2200
- I18NED: 'Internationalized',
2201
- NOT_I18NED: 'Not Internationalized',
2202
- SKIPPED: 'Skipped'
2203
- },
2204
- valueMap = {
2205
- [type.I18NED]:
2206
- overallStats.localizedStrings +
2207
- overallStats.partialStrings +
2208
- overallStats.untranslatedStrings +
2209
- overallStats.localizedDateTime +
2210
- overallStats.localizedDate +
2211
- overallStats.localizedTime +
2212
- overallStats.localizedNumber +
2213
- overallStats.localizedCurrency +
2214
- overallStats.localizedPercentage,
2215
- [type.NOT_I18NED]:
2216
- overallStats.notLocalizedStrings +
2217
- overallStats.notLocalizedDateTime +
2218
- overallStats.notLocalizedDate +
2219
- overallStats.notLocalizedTime +
2220
- overallStats.notLocalizedNumber +
2221
- overallStats.notLocalizedCurrency +
2222
- overallStats.notLocalizedPercentage,
2223
- [type.SKIPPED]:
2224
- overallStats.dnt +
2225
- overallStats.ignored +
2226
- overallStats.autoIgnored +
2227
- overallStats.userInput
2228
- },
2229
- percentageCalc = (value) => {
2230
- const val = ((value / reviewed) * 100).toFixed(0);
2231
- return isNaN(val) || !isFinite(val) ? 0 : val;
2232
- };
2233
-
2234
- var options = {
2235
- series: [
2236
- {
2237
- name: '',
2238
- data: [
2239
- percentageCalc(valueMap[type.I18NED]),
2240
- percentageCalc(valueMap[type.NOT_I18NED]),
2241
- percentageCalc(valueMap[type.SKIPPED])
2242
- ]
2243
- }
2244
- ],
2245
- chart: {
2246
- type: 'bar',
2247
- height: 200,
2248
- toolbar: {
2249
- show: false
2250
- },
2251
- animations: {
2252
- enabled: true,
2253
- easing: 'easeinout',
2254
- speed: 800,
2255
- animateGradually: {
2256
- enabled: true,
2257
- delay: 150
2258
- },
2259
- dynamicAnimation: {
2260
- enabled: true,
2261
- speed: 350
2262
- }
2263
- }
2264
- },
2265
- plotOptions: {
2266
- bar: {
2267
- horizontal: true,
2268
- borderRadius: 3,
2269
- dataLabels: {
2270
- position: 'right'
2271
- }
2272
- }
2273
- },
2274
- title: {
2275
- text: \`Total Reviewed strings in \${locales} locales: \${reviewed}\`,
2276
- align: 'center',
2277
- floating: true,
2278
- style: {
2279
- fontSize: '14px',
2280
- fontWeight: 'bold'
2281
- }
2282
- },
2283
- dataLabels: {
2284
- enabled: true,
2285
- style: {
2286
- colors: ['#080404b0']
2287
- },
2288
- formatter: (val) => {
2289
- return \`\${val}%\`;
2290
- }
2291
- },
2292
- xaxis: {
2293
- categories: [type.I18NED, type.NOT_I18NED, type.SKIPPED],
2294
- min: 0,
2295
- max: 100,
2296
- labels: {
2297
- formatter: (v) => \`\${v}%\`
2298
- }
2299
- },
2300
- yaxis: {
2301
- labels: {
2302
- style: {
2303
- fontSize: '13px'
2304
- }
2305
- }
2306
- },
2307
- colors: [
2308
- (v) => {
2309
- switch (v.dataPointIndex) {
2310
- case 0:
2311
- return '#31E994'; //green
2312
- case 1:
2313
- return '#ff8173'; //red
2314
- case 2:
2315
- return '#f5eb5f'; //yellow
2316
- }
2317
- }
2318
- ],
2319
- tooltip: {
2320
- theme: 'dark',
2321
- x: {
2322
- formatter: (v) => \`Total Number of \${v} instances:\`
2323
- },
2324
- y: {
2325
- formatter: function (v, { dataPointIndex }) {
2326
- let count = 0;
2327
- switch (dataPointIndex) {
2328
- case 0:
2329
- count = valueMap[type.I18NED];
2330
- break;
2331
- case 1:
2332
- count = valueMap[type.NOT_I18NED];
2333
- break;
2334
- case 2:
2335
- count = valueMap[type.SKIPPED];
2336
- break;
2337
- }
2338
- return \`\${v}% (\${count} strings)\`;
2339
- }
2340
- }
2341
- }
2342
- };
2343
-
2344
- (overviewChart = new ApexCharts(
2345
- document.querySelector('.overall-quality .graph'),
2346
- options
2347
- )).render();
2348
- }
2349
-
2350
- function renderStringChart() {
2351
- const overallStats = DataStore.getOverallStats();
2352
- const type = {
2353
- LOCALIZED: 'Localized',
2354
- PARTIAL: 'Partially Localized',
2355
- NOT_LOCALIZED: 'Not Localized',
2356
- UNTRANSLATED: 'Untranslated',
2357
- ENCODING: 'Encoding Issue',
2358
- IGNORED: 'Ignored'
2359
- },
2360
- valueMap = {
2361
- [type.LOCALIZED]: overallStats.localizedStrings,
2362
- [type.PARTIAL]: overallStats.partialStrings,
2363
- [type.NOT_LOCALIZED]: overallStats.notLocalizedStrings,
2364
- [type.UNTRANSLATED]: overallStats.untranslatedStrings,
2365
- [type.ENCODING]: overallStats.encoding,
2366
- [type.IGNORED]:
2367
- overallStats.dnt +
2368
- overallStats.ignored +
2369
- overallStats.autoIgnored +
2370
- overallStats.userInput
2371
- },
2372
- total = Object.values(valueMap).reduce(
2373
- (acc, curr) => acc + curr,
2374
- 0
2375
- ),
2376
- data = [
2377
- valueMap[type.LOCALIZED],
2378
- valueMap[type.PARTIAL],
2379
- valueMap[type.NOT_LOCALIZED],
2380
- valueMap[type.IGNORED],
2381
- valueMap[type.ENCODING],
2382
- valueMap[type.UNTRANSLATED]
2383
- ],
2384
- options = {
2385
- series:
2386
- data.reduce((acc, curr) => acc + curr, 0) === 0 ? [] : data,
2387
- chart: {
2388
- width: 430,
2389
- type: 'pie',
2390
- animations: {
2391
- enabled: true,
2392
- easing: 'easeinout',
2393
- speed: 800,
2394
- animateGradually: {
2395
- enabled: true,
2396
- delay: 150
2397
- },
2398
- dynamicAnimation: {
2399
- enabled: true,
2400
- speed: 350
2401
- }
2402
- }
2403
- },
2404
- noData: {
2405
- text: 'No metrics available',
2406
- align: 'left',
2407
- verticalAlign: 'middle',
2408
- offsetX: 0,
2409
- offsetY: -50,
2410
- style: {
2411
- fontSize: '14px'
2412
- }
2413
- },
2414
- labels: [
2415
- type.LOCALIZED,
2416
- type.PARTIAL,
2417
- type.NOT_LOCALIZED,
2418
- type.IGNORED,
2419
- type.ENCODING,
2420
- type.UNTRANSLATED
2421
- ],
2422
- tooltip: {
2423
- theme: 'dark',
2424
- y: {
2425
- formatter: function (v, { config, dataPointIndex }) {
2426
- let count = 0,
2427
- value = Number(
2428
- (v /
2429
- config.series.reduce((acc, curr) => acc + curr, 0)) *
2430
- 100
2431
- ).toFixed(0);
2432
- value = isNaN(value) || !isFinite(value) ? 0 : value;
2433
-
2434
- switch (dataPointIndex) {
2435
- case 0:
2436
- count = valueMap[type.LOCALIZED];
2437
- break;
2438
- case 1:
2439
- count = valueMap[type.PARTIAL];
2440
- break;
2441
- case 2:
2442
- count = valueMap[type.NOT_LOCALIZED];
2443
- break;
2444
- case 3:
2445
- count = valueMap[type.IGNORED];
2446
- break;
2447
- case 4:
2448
- count = valueMap[type.ENCODING];
2449
- break;
2450
- case 5:
2451
- count = valueMap[type.UNTRANSLATED];
2452
- break;
2453
- }
2454
-
2455
- return \`\${value}% (\${count} strings)\`;
2456
- },
2457
- title: {
2458
- formatter: function (a) {
2459
- return \`Total Number of \${a} strings:\`;
2460
- }
2461
- }
2462
- }
2463
- },
2464
- colors: [
2465
- ({ seriesIndex, w }) => {
2466
- const currType = w.config.labels[seriesIndex];
2467
-
2468
- switch (currType) {
2469
- case type.LOCALIZED:
2470
- return '#31E994';
2471
- case type.NOT_LOCALIZED:
2472
- return '#E44242';
2473
- case type.PARTIAL:
2474
- return '#DADF40';
2475
- case type.UNTRANSLATED:
2476
- return '#F44E9E';
2477
- case type.IGNORED:
2478
- return '#AFA6AB';
2479
- case type.ENCODING:
2480
- return '#3AD1F3';
2481
-
2482
- default:
2483
- return '';
2484
- }
2485
- }
2486
- ],
2487
- legend: {
2488
- offsetX: -50,
2489
- width: 170,
2490
- formatter: (seriesName, a, b, c) => {
2491
- let value = ((valueMap[seriesName] / total) * 100).toFixed(0);
2492
- value = isNaN(value) || !isFinite(value) ? 0 : value;
2493
- return \`\${seriesName} (\${value}%)\`;
2494
- }
2495
- },
2496
- dataLabels: {
2497
- formatter: (v) => \`\${Number(v).toFixed(0)}%\`,
2498
- dropShadow: { enabled: false },
2499
- style: {
2500
- colors: ['#080404b0']
2501
- }
2502
- }
2503
- };
2504
-
2505
- (stringChart = new ApexCharts(
2506
- document.querySelector('.string-quality .graph'),
2507
- options
2508
- )).render();
2509
- }
2510
-
2511
- function renderIgnoredChart() {
2512
- const overallStats = DataStore.getOverallStats();
2513
- const type = {
2514
- DNT: 'DNT',
2515
- IGNORED: 'Ignored',
2516
- USER_INPUTS: 'User Inputs'
2517
- },
2518
- valueMap = {
2519
- [type.DNT]: overallStats.dnt,
2520
- [type.IGNORED]: overallStats.ignored + overallStats.autoIgnored,
2521
- [type.USER_INPUTS]: overallStats.userInput
2522
- },
2523
- total = Object.values(valueMap).reduce(
2524
- (acc, curr) => acc + curr,
2525
- 0
2526
- ),
2527
- data = [
2528
- valueMap[type.DNT],
2529
- valueMap[type.IGNORED],
2530
- valueMap[type.USER_INPUTS]
2531
- ],
2532
- options = {
2533
- series:
2534
- data.reduce((acc, curr) => acc + curr, 0) === 0 ? [] : data,
2535
- chart: {
2536
- width: 400,
2537
- type: 'pie',
2538
- animations: {
2539
- enabled: true,
2540
- easing: 'easeinout',
2541
- speed: 800,
2542
- animateGradually: {
2543
- enabled: true,
2544
- delay: 150
2545
- },
2546
- dynamicAnimation: {
2547
- enabled: true,
2548
- speed: 350
2549
- }
2550
- }
2551
- },
2552
- labels: [type.DNT, type.IGNORED, type.USER_INPUTS],
2553
- tooltip: {
2554
- theme: 'dark',
2555
- y: {
2556
- formatter: function (v, { config, dataPointIndex }) {
2557
- let count = 0,
2558
- value = Number(
2559
- (v /
2560
- config.series.reduce((acc, curr) => acc + curr, 0)) *
2561
- 100
2562
- ).toFixed(0);
2563
- value = isNaN(value) || !isFinite(value) ? 0 : value;
2564
-
2565
- switch (dataPointIndex) {
2566
- case 0:
2567
- count = valueMap[type.DNT];
2568
- break;
2569
- case 1:
2570
- count = valueMap[type.IGNORED];
2571
- break;
2572
- case 2:
2573
- count = valueMap[type.USER_INPUTS];
2574
- break;
2575
- }
2576
-
2577
- return \`\${value}% (\${count} strings)\`;
2578
- },
2579
- title: {
2580
- formatter: function (a) {
2581
- return \`Total Number of \${a} strings:\`;
2582
- }
2583
- }
2584
- }
2585
- },
2586
- colors: [
2587
- ({ seriesIndex, w }) => {
2588
- const currType = w.config.labels[seriesIndex];
2589
-
2590
- switch (currType) {
2591
- case type.DNT:
2592
- return '#31E994';
2593
- case type.IGNORED:
2594
- return '#3AD1F3';
2595
- case type.USER_INPUTS:
2596
- return '#DADF40';
2597
-
2598
- default:
2599
- return '';
2600
- }
2601
- }
2602
- ],
2603
- noData: {
2604
- text: 'No metrics available',
2605
- align: 'center',
2606
- verticalAlign: 'middle',
2607
- offsetX: -70,
2608
- offsetY: -25,
2609
- style: {
2610
- fontSize: '14px'
2611
- }
2612
- },
2613
- legend: {
2614
- offsetX: -40,
2615
- formatter: (seriesName) => {
2616
- let value = ((valueMap[seriesName] / total) * 100).toFixed(0);
2617
- value = isNaN(value) || !isFinite(value) ? 0 : value;
2618
- return \`\${seriesName} (\${value}%)\`;
2619
- }
2620
- },
2621
- dataLabels: {
2622
- formatter: (v) => \`\${Number(v).toFixed(0)}%\`,
2623
- style: {
2624
- colors: ['#080404b0']
2625
- },
2626
- dropShadow: { enabled: false }
2627
- }
2628
- };
2629
-
2630
- (ignoredChart = new ApexCharts(
2631
- document.querySelector('.skipped-items .graph'),
2632
- options
2633
- )).render();
2634
- }
2635
-
2636
- function renderNumberChart() {
2637
- const overallStats = DataStore.getOverallStats();
2638
- const types = ['Number', 'Currency', 'Percentage'],
2639
- data = {
2640
- number_i18n: overallStats.localizedNumber,
2641
- currency_i18n: overallStats.localizedCurrency,
2642
- percentage_i18n: overallStats.localizedPercentage,
2643
- number_not_i18n: overallStats.notLocalizedNumber,
2644
- currency_not_i18n: overallStats.notLocalizedCurrency,
2645
- percentage_not_i18n: overallStats.notLocalizedPercentage
2646
- },
2647
- total = Object.values(data).reduce((acc, curr) => acc + curr, 0),
2648
- percentageCalc = (v, t) => {
2649
- const val = ((v / t) * 100).toFixed(0);
2650
- return isNaN(val) || !isFinite(val) ? 0 : val;
2651
- },
2652
- i18nPercentage = percentageCalc(
2653
- data.number_i18n + data.percentage_i18n + data.currency_i18n,
2654
- total
2655
- ),
2656
- nonI18nPercentage = percentageCalc(
2657
- data.number_not_i18n +
2658
- data.percentage_not_i18n +
2659
- data.currency_not_i18n,
2660
- total
2661
- ),
2662
- numberTotal = data.number_i18n + data.number_not_i18n,
2663
- currencyTotal = data.currency_i18n + data.currency_not_i18n,
2664
- percentageTotal = data.percentage_i18n + data.percentage_not_i18n,
2665
- numberI18n = percentageCalc(data.number_i18n, numberTotal),
2666
- currencyI18n = percentageCalc(data.currency_i18n, currencyTotal),
2667
- percentageI18n = percentageCalc(
2668
- data.percentage_i18n,
2669
- currencyTotal
2670
- ),
2671
- numberNotI18n = percentageCalc(data.number_not_i18n, numberTotal),
2672
- currencyNotI18n = percentageCalc(
2673
- data.currency_not_i18n,
2674
- currencyTotal
2675
- ),
2676
- percentageNotI18n = percentageCalc(
2677
- data.percentage_not_i18n,
2678
- currencyTotal
2679
- ),
2680
- options = {
2681
- series: [
2682
- {
2683
- name: 'Internationalized',
2684
- data: [numberI18n, currencyI18n, percentageI18n]
2685
- },
2686
- {
2687
- name: 'Not Internationalized',
2688
- data: [numberNotI18n, currencyNotI18n, percentageNotI18n]
2689
- }
2690
- ],
2691
- chart: {
2692
- type: 'bar',
2693
- height: 250,
2694
- width: 550,
2695
- toolbar: {
2696
- show: false
2697
- },
2698
- animations: {
2699
- enabled: true,
2700
- easing: 'easeinout',
2701
- speed: 800,
2702
- animateGradually: {
2703
- enabled: true,
2704
- delay: 150
2705
- },
2706
- dynamicAnimation: {
2707
- enabled: true,
2708
- speed: 350
2709
- }
2710
- }
2711
- },
2712
- dataLabels: {
2713
- enabled: true,
2714
- dropShadow: { enabled: false },
2715
- style: {
2716
- colors: ['#080404b0']
2717
- },
2718
- formatter: (val) => {
2719
- return \`\${val}%\`;
2720
- }
2721
- },
2722
- stroke: {
2723
- show: true,
2724
- width: 1,
2725
- colors: ['#fff']
2726
- },
2727
- tooltip: {
2728
- theme: 'dark',
2729
- shared: true,
2730
- intersect: false,
2731
- x: {
2732
- formatter: (type) => \`\${type} instances:\`
2733
- },
2734
- y: {
2735
- formatter: (v, { seriesIndex, dataPointIndex }) => {
2736
- const getI18nCount = (type) => {
2737
- switch (type) {
2738
- case 'number':
2739
- return data.number_i18n;
2740
- case 'currency':
2741
- return data.currency_i18n;
2742
- case 'percentage':
2743
- return data.percentage_i18n;
2744
- }
2745
- },
2746
- getNonI18nCount = (type) => {
2747
- switch (type) {
2748
- case 'number':
2749
- return data.number_not_i18n;
2750
- case 'currency':
2751
- return data.currency_not_i18n;
2752
- case 'percentage':
2753
- return data.percentage_not_i18n;
2754
- }
2755
- },
2756
- getCount = (type) => {
2757
- return seriesIndex === 0
2758
- ? getI18nCount(type)
2759
- : getNonI18nCount(type);
2760
- };
2761
-
2762
- switch (dataPointIndex) {
2763
- case 0:
2764
- return getCount('number');
2765
- case 1:
2766
- return getCount('currency');
2767
- case 2:
2768
- return getCount('percentage');
2769
- }
2770
- }
2771
- }
2772
- },
2773
- xaxis: {
2774
- categories: types
2775
- },
2776
- yaxis: {
2777
- min: 0,
2778
- max: 100,
2779
- labels: {
2780
- formatter: (v) => \`\${v}%\`
2781
- }
2782
- },
2783
- colors: ['#31E994', '#ff8173'],
2784
- legend: {
2785
- offsetX: -13,
2786
- position: 'right',
2787
- formatter: (seriesName) => {
2788
- if (seriesName === 'Internationalized') {
2789
- return \`\${seriesName} (\${i18nPercentage}%)\`;
2790
- }
2791
- return \`\${seriesName} (\${nonI18nPercentage}%)\`;
2792
- }
2793
- },
2794
- plotOptions: {
2795
- bar: {
2796
- borderRadius: 3,
2797
- columnWidth: '85%'
2798
- }
2799
- }
2800
- };
2801
-
2802
- (numberChart = new ApexCharts(
2803
- document.querySelector('.number-quality .graph'),
2804
- options
2805
- )).render();
2806
- }
2807
-
2808
- function renderDatetimeChart() {
2809
- const overallStats = DataStore.getOverallStats();
2810
- const types = ['Date', 'Time', 'DateTime'],
2811
- data = {
2812
- date_i18n: overallStats.localizedDate,
2813
- time_i18n: overallStats.localizedTime,
2814
- date_time_i18n: overallStats.localizedDateTime,
2815
- date_not_i18n: overallStats.notLocalizedDate,
2816
- time_not_i18n: overallStats.notLocalizedTime,
2817
- date_time_not_i18n: overallStats.notLocalizedDateTime
2818
- },
2819
- total = Object.values(data).reduce((acc, curr) => acc + curr, 0),
2820
- percentageCalc = (v, t) => {
2821
- const val = ((v / t) * 100).toFixed(0);
2822
- return isNaN(val) || !isFinite(val) ? 0 : val;
2823
- },
2824
- i18nPercentage = percentageCalc(
2825
- data.date_i18n + data.time_i18n + data.date_time_i18n,
2826
- total
2827
- ),
2828
- nonI18nPercentage = percentageCalc(
2829
- data.date_not_i18n + data.time_not_i18n + data.date_time_not_i18n,
2830
- total
2831
- ),
2832
- dateTotal = data.date_i18n + data.date_not_i18n,
2833
- timeTotal = data.time_i18n + data.time_not_i18n,
2834
- dateTimeTotal = data.date_time_i18n + data.date_time_not_i18n,
2835
- dateI18n = percentageCalc(data.date_i18n, dateTotal),
2836
- timeI18n = percentageCalc(data.time_i18n, timeTotal),
2837
- dateTimeI18n = percentageCalc(data.date_time_i18n, dateTimeTotal),
2838
- dateNotI18n = percentageCalc(data.date_not_i18n, dateTotal),
2839
- timeNotI18n = percentageCalc(data.time_not_i18n, timeTotal),
2840
- dateTimeNotI18n = percentageCalc(
2841
- data.date_time_not_i18n,
2842
- dateTimeTotal
2843
- ),
2844
- options = {
2845
- series: [
2846
- {
2847
- name: 'Internationalized',
2848
- data: [dateI18n, timeI18n, dateTimeI18n]
2849
- },
2850
- {
2851
- name: 'Not Internationalized',
2852
- data: [dateNotI18n, timeNotI18n, dateTimeNotI18n]
2853
- }
2854
- ],
2855
- chart: {
2856
- type: 'bar',
2857
- height: 250,
2858
- width: 550,
2859
- toolbar: {
2860
- show: false
2861
- },
2862
- animations: {
2863
- enabled: true,
2864
- easing: 'easeinout',
2865
- speed: 800,
2866
- animateGradually: {
2867
- enabled: true,
2868
- delay: 150
2869
- },
2870
- dynamicAnimation: {
2871
- enabled: true,
2872
- speed: 350
2873
- }
2874
- }
2875
- },
2876
- dataLabels: {
2877
- enabled: true,
2878
- dropShadow: { enabled: false },
2879
- style: {
2880
- colors: ['#080404b0']
2881
- },
2882
- formatter: (val) => {
2883
- return \`\${val}%\`;
2884
- }
2885
- },
2886
- stroke: {
2887
- show: true,
2888
- width: 1,
2889
- colors: ['#fff']
2890
- },
2891
- tooltip: {
2892
- theme: 'dark',
2893
- shared: true,
2894
- intersect: false,
2895
- x: {
2896
- formatter: (type) => \`\${type} instances:\`
2897
- },
2898
- y: {
2899
- formatter: (v, { seriesIndex, dataPointIndex }) => {
2900
- const getI18nCount = (type) => {
2901
- switch (type) {
2902
- case 'date':
2903
- return data.date_i18n;
2904
- case 'time':
2905
- return data.time_i18n;
2906
- case 'date_time':
2907
- return data.date_time_i18n;
2908
- }
2909
- },
2910
- getNonI18nCount = (type) => {
2911
- switch (type) {
2912
- case 'date':
2913
- return data.date_not_i18n;
2914
- case 'time':
2915
- return data.time_not_i18n;
2916
- case 'date_time':
2917
- return data.date_time_not_i18n;
2918
- }
2919
- },
2920
- getCount = (type) => {
2921
- return seriesIndex === 0
2922
- ? getI18nCount(type)
2923
- : getNonI18nCount(type);
2924
- };
2925
-
2926
- switch (dataPointIndex) {
2927
- case 0:
2928
- return getCount('date');
2929
- case 1:
2930
- return getCount('time');
2931
- case 2:
2932
- return getCount('date_time');
2933
- }
2934
- }
2935
- }
2936
- },
2937
- xaxis: {
2938
- categories: types
2939
- },
2940
- yaxis: {
2941
- min: 0,
2942
- max: 100,
2943
- labels: {
2944
- formatter: (v) => \`\${v}%\`
2945
- }
2946
- },
2947
- colors: ['#31E994', '#ff8173'],
2948
- legend: {
2949
- offsetX: 4,
2950
- position: 'right',
2951
- formatter: (seriesName) => {
2952
- if (seriesName === 'Internationalized') {
2953
- return \`\${seriesName} (\${i18nPercentage}%)\`;
2954
- }
2955
- return \`\${seriesName} (\${nonI18nPercentage}%)\`;
2956
- }
2957
- },
2958
- plotOptions: {
2959
- bar: {
2960
- borderRadius: 3,
2961
- columnWidth: '85%'
2962
- }
2963
- }
2964
- };
2965
-
2966
- (dateTimeChart = new ApexCharts(
2967
- document.querySelector('.datetime-quality .graph'),
2968
- options
2969
- )).render();
2970
- }
2971
- }
2972
- });
2973
- })();`,ke=()=>`// insights content
2974
- (() => {
2975
- if (!DataStore.ranSuccessfully()) {
2976
- document.getElementById('overview').innerHTML =
2977
- 'Unable to prepare zQA automation report for the project.';
2978
- return;
2979
- }
2980
-
2981
- document.addEventListener('DOMContentLoaded', function () {
2982
- renderCards();
2983
-
2984
- // helper methods to generate cards and its sections
2985
- function createStatSection(locale, data) {
2986
- const holder = document.createElement('div');
2987
- const table = document.createElement('table');
2988
- const tbody = document.createElement('tbody');
2989
- const name = document.createElement('div');
2990
- const addRow = (name, value) => {
2991
- const row = document.createElement('tr');
2992
-
2993
- const col1 = document.createElement('td');
2994
- col1.classList.add('name');
2995
- col1.textContent = name;
2996
-
2997
- const col2 = document.createElement('td');
2998
- col2.classList.add('value');
2999
- col2.textContent = value;
3000
-
3001
- row.appendChild(col1);
3002
- row.appendChild(col2);
3003
- return row;
3004
- };
3005
-
3006
- if (DataStore.isSanityRun()) {
3007
- tbody.appendChild(addRow('Pages viewed', data.reviewed));
3008
- }
3009
- else {
3010
- const tableData = {
3011
- 'Internationlized Strings':
3012
- data.localizedStrings +
3013
- data.untranslatedStrings +
3014
- data.partialStrings,
3015
- 'Not Internationlized Strings': data.notLocalizedStrings,
3016
- 'Internationlized Numbers': data.localizedNumber,
3017
- 'Not Internationlized Numbers': data.notLocalizedNumber,
3018
- 'Internationlized Currency': data.localizedCurrency,
3019
- 'Not Internationlized Currency': data.notLocalizedCurrency,
3020
- 'Internationlized Percentage': data.localizedPercentage,
3021
- 'Not Internationlized Percentage': data.notLocalizedPercentage,
3022
- 'Internationlized Date': data.localizedDate,
3023
- 'Not Internationlized Date': data.notLocalizedDate,
3024
- 'Internationlized Time': data.localizedTime,
3025
- 'Not Internationlized Time': data.notLocalizedTime,
3026
- 'Internationlized DateTime': data.localizedDate,
3027
- 'Not Internationlized DateTime': data.notLocalizedDateTime,
3028
- 'Encoding Issue Strings': data.encoding,
3029
- 'DNT Strings': data.dnt,
3030
- 'Ignored Strings': data.ignored,
3031
- 'Untranslated Strings': data.untranslatedStrings,
3032
- 'Auto Ignored Strings': data.autoIgnored,
3033
- 'User Input Strings': data.userInput,
3034
- 'Total Reviewed': data.reviewed
3035
- };
3036
-
3037
- for (const rowData of Object.entries(tableData)) {
3038
- if (!DataStore.isSanityRun() || !DataStore.isDefaultLocale(locale) || rowData[0] !== 'Untranslated Strings') {
3039
- tbody.appendChild(addRow(rowData[0], rowData[1]));
3040
- }
3041
- }
3042
- }
3043
-
3044
- holder.classList.add('stat');
3045
- name.classList.add('name');
3046
- name.textContent = 'Summary';
3047
- holder.append(name);
3048
-
3049
- table.appendChild(tbody);
3050
- holder.appendChild(table);
3051
- return holder;
3052
- }
3053
-
3054
- function createStatusBarSection(locale, data) {
3055
- const holder = document.createElement('div');
3056
- holder.classList.add('status-bar');
3057
-
3058
- const generateBarEl = (name, total, current) => {
3059
- const getColorClass = (value) => {
3060
- if (value <= 25) {
3061
- return 'red';
3062
- } else if (value <= 50) {
3063
- return 'yellow';
3064
- } else if (value <= 75) {
3065
- return 'blue';
3066
- } else if (value <= 100) {
3067
- return 'green';
3068
- }
3069
- };
3070
- current = (current / total) * 100;
3071
- current = isNaN(current) || !isFinite(current) ? 0 : current;
3072
- const holder = document.createElement('div');
3073
- holder.classList.add('bar-container');
3074
-
3075
- const nameHolder = document.createElement('div');
3076
- nameHolder.classList.add('name');
3077
- nameHolder.textContent = name;
3078
-
3079
- const barHolder = document.createElement('div');
3080
- barHolder.classList.add('bar-holder');
3081
-
3082
- const bar = document.createElement('div');
3083
- bar.classList.add('bar');
3084
- bar.classList.add(\`--\${getColorClass(current)}\`);
3085
- bar.style.width = \`\${current}%\`;
3086
- bar.textContent = \`\${current.toFixed(0)}%\`;
3087
-
3088
- barHolder.appendChild(bar);
3089
- holder.appendChild(nameHolder);
3090
- holder.appendChild(barHolder);
3091
-
3092
- return holder;
3093
- };
3094
-
3095
- const showFull = DataStore.isSanityRun() || DataStore.isDefaultLocale(locale),
3096
- totalI18nCount = showFull
3097
- ? 100
3098
- : data.localizedStrings +
3099
- data.untranslatedStrings +
3100
- data.partialStrings +
3101
- data.notLocalizedStrings,
3102
- i18nStrings = showFull
3103
- ? 100
3104
- : data.localizedStrings +
3105
- data.untranslatedStrings +
3106
- data.partialStrings,
3107
- totalLocCount = showFull
3108
- ? 100
3109
- : totalI18nCount -
3110
- data.untranslatedStrings -
3111
- data.notLocalizedStrings,
3112
- totalNumberCount = showFull
3113
- ? 100
3114
- : data.localizedNumber +
3115
- data.localizedCurrency +
3116
- data.localizedPercentage +
3117
- data.notLocalizedPercentage +
3118
- data.notLocalizedCurrency +
3119
- data.notLocalizedNumber,
3120
- i18nNumbers = showFull
3121
- ? 100
3122
- : totalNumberCount -
3123
- data.notLocalizedPercentage -
3124
- data.notLocalizedCurrency -
3125
- data.notLocalizedNumber,
3126
- totalI18nDateTimeCount = showFull
3127
- ? 100
3128
- : data.localizedDate +
3129
- data.localizedDateTime +
3130
- data.localizedTime +
3131
- data.notLocalizedDate +
3132
- data.notLocalizedDateTime +
3133
- data.notLocalizedTime,
3134
- i18nDateTime = showFull
3135
- ? 100
3136
- : totalI18nDateTimeCount -
3137
- data.notLocalizedDate -
3138
- data.notLocalizedDateTime -
3139
- data.notLocalizedTime;
3140
-
3141
- holder.appendChild(
3142
- generateBarEl('String I18n level', totalI18nCount, i18nStrings)
3143
- );
3144
-
3145
- holder.appendChild(
3146
- generateBarEl('String L10n level', totalI18nCount, totalLocCount)
3147
- );
3148
-
3149
- holder.appendChild(
3150
- generateBarEl('Number I18n level', totalNumberCount, i18nNumbers)
3151
- );
3152
-
3153
- holder.appendChild(
3154
- generateBarEl(
3155
- 'DateTime I18n level',
3156
- totalI18nDateTimeCount,
3157
- i18nDateTime
3158
- )
3159
- );
3160
- return holder;
3161
- }
3162
-
3163
- function generateCardContents(locale, data) {
3164
- const cardContent = document.createElement('div');
3165
- cardContent.classList.add('card-content');
3166
-
3167
- cardContent.appendChild(createStatusBarSection(locale, data));
3168
- cardContent.appendChild(createStatSection(locale, data));
3169
- return cardContent;
3170
- }
3171
-
3172
- function createCardEl(locale, data) {
3173
- const card = document.createElement('div');
3174
- const title = document.createElement('div');
3175
- card.classList.add('card');
3176
- card.dataset.locale = locale;
3177
-
3178
- if(!window.isStandaloneReport) {
3179
- card.classList.add('--reduced-zoom');
3180
- }
3181
-
3182
- title.classList.add('title');
3183
- title.textContent = \`\${locale} details\`;
3184
-
3185
- // fire menu selection event on clicking the card
3186
- card.addEventListener('click', () => {
3187
- const previousSelectedSubMenu = document.querySelector(
3188
- '.sub-menu-item.selected'
3189
- );
3190
- if (previousSelectedSubMenu) {
3191
- window.previousSelectedLocale =
3192
- previousSelectedSubMenu.dataset.locale;
3193
- }
3194
-
3195
- document
3196
- .querySelector(\`.sub-menu-item[data-locale="\${locale}"]\`)
3197
- .click();
3198
- });
3199
-
3200
- card.appendChild(title);
3201
- card.appendChild(generateCardContents(locale, data));
3202
- return card;
3203
- }
3204
-
3205
- function renderCards() {
3206
- // read from global variable appData;
3207
- const localeInfo = DataStore.getLocalesData();
3208
-
3209
- if (Object.keys(localeInfo).length) {
3210
- const cardHolder = document.querySelector(
3211
- '#insights .cards .holder'
3212
- );
3213
- for (const locale in localeInfo) {
3214
- const cardEl = createCardEl(
3215
- locale,
3216
- DataStore.getStatByLocale(locale)
3217
- );
3218
- cardHolder.appendChild(cardEl);
3219
- }
3220
- }
3221
- }
3222
- });
3223
- })();`,Ue=()=>`// locale grid
3224
- (() => {
3225
- if (!DataStore.ranSuccessfully()) {
3226
- return;
3227
- }
3228
-
3229
- document.addEventListener('DOMContentLoaded', function () {
3230
- let table;
3231
- document.querySelectorAll('.sub-menu-item').forEach((menu) => {
3232
- menu.addEventListener('click', (e) => {
3233
- render(e.currentTarget.dataset.locale);
3234
- });
3235
- });
3236
-
3237
- const updateTitle = (locale) => {
3238
- document.querySelector(
3239
- '#locale .title'
3240
- ).textContent = \`\${locale} \${DataStore.isSanityRun() ? 'Sanity Result' : 'I18n Coverage Details'}\`;
3241
- };
3242
-
3243
- const buildGrid = (locale) => {
3244
- const data = DataStore.getDataByLocale(locale) || {};
3245
- $.fn.dataTable.ext.errMode = 'none';
3246
- const dataSet = [];
3247
- if(DataStore.isSanityRun()) {
3248
- Object.entries(data).map((entry) =>
3249
- entry[1].forEach(
3250
- (v) =>
3251
- dataSet.push([v.description, v.imagePath])
3252
- )
3253
- );
3254
- }
3255
- else {
3256
- Object.entries(data).map((entry) =>
3257
- entry[1].forEach(
3258
- (v) =>
3259
- (v.type !== 'REVIEWED') &&
3260
- dataSet.push([entry[0], v.type, v.description, v.imagePath])
3261
- )
3262
- );
3263
- }
3264
- const containerHeight = document
3265
- .querySelector('#locale')
3266
- .getBoundingClientRect().height;
3267
- const scrollHeight = (75 / 100) * containerHeight;
3268
- table = new DataTable('#locale .coverage-info table', {
3269
- language: {
3270
- lengthMenu: "Show _MENU_ entries per page"
3271
- },
3272
- columns: DataStore.isSanityRun() ?
3273
- [
3274
- { title: 'Page' },
3275
- { title: 'Screenshot' },
3276
- ] : [
3277
- { title: 'String' },
3278
- { title: 'Status' },
3279
- { title: 'Page' },
3280
- { title: 'Screenshot' }
3281
- ],
3282
- columnDefs: DataStore.isSanityRun() ?
3283
- [
3284
- {
3285
- width: '80%',
3286
- targets: 0
3287
- },
3288
- {
3289
- width: '20%',
3290
- targets: 1,
3291
- orderable: false,
3292
- searchable: false,
3293
- data: null,
3294
- render: function (data) {
3295
- return \`<a href="#" class="view-screenshot-btn" onclick="openImageViewer('\${data[1]}')"><img title="View screenshot for '\${data[0]}'" class="view-screenshot-image"></img></a\`;
3296
- },
3297
- className: 'dt-head-center dt-body-center'
3298
- }
3299
- ] :
3300
- [
3301
- {
3302
- width: '45%',
3303
- targets: 0
3304
- },
3305
- {
3306
- width: '22.5%',
3307
- targets: 1
3308
- },
3309
- {
3310
- width: '22.5%',
3311
- targets: 2
3312
- },
3313
- {
3314
- width: '10%',
3315
- targets: 3,
3316
- orderable: false,
3317
- searchable: false,
3318
- data: null,
3319
- render: function (data) {
3320
- return \`<a href="#" class="view-screenshot-btn" onclick="openImageViewer('\${data[3]}')"><img title="View screenshot for '\${data[2]}'" class="view-screenshot-image"></img></a>\`;
3321
- },
3322
- className: 'dt-head-center dt-body-center'
3323
- }
3324
- ],
3325
- data: dataSet,
3326
- initComplete: function () {
3327
- const tableApi = this.api();
3328
- const updateFilters = () => {
3329
- tableApi.columns().every(function () {
3330
- const column = this;
3331
- const columnIdx = column.index();
3332
-
3333
- if ((DataStore.isSanityRun() && columnIdx === 1) || columnIdx === 3 || columnIdx === 0) {
3334
- return;
3335
- }
3336
-
3337
- const select = $(\`select.filter[data-column="\${columnIdx}"]\`);
3338
- const selectedValue = select.val();
3339
-
3340
- select.empty().append('<option value="">Filter By</option>');
3341
-
3342
- const uniqueValues = new Set();
3343
- tableApi.column(columnIdx, { search: 'applied' }).data().each((d) => uniqueValues.add(d));
3344
-
3345
- uniqueValues.forEach((value) => {
3346
- select.append(\`<option value="\${value}">\${value}</option>\`);
3347
- });
3348
-
3349
- if (selectedValue && uniqueValues.has(selectedValue)) {
3350
- select.val(selectedValue);
3351
- }
3352
- });
3353
- };
3354
-
3355
- tableApi.columns().every(function () {
3356
- const column = this;
3357
- const columnIdx = column.index();
3358
-
3359
- if ((DataStore.isSanityRun() && columnIdx === 1) || columnIdx === 3 || columnIdx === 0) {
3360
- return;
3361
- }
3362
-
3363
- const header = $(column.header());
3364
- let wrapper = header.find('.header-wrapper');
3365
-
3366
- if (!wrapper.length) {
3367
- wrapper = $('<div class="header-wrapper"></div>');
3368
- header.contents().appendTo(wrapper);
3369
- header.append(wrapper);
3370
- }
3371
-
3372
- let select = wrapper.find('select.filter');
3373
- if (!select.length) {
3374
- select = $(\`<select class="filter dt-input" data-column="\${columnIdx}"><option value="">Filter By</option></select>\`)
3375
- .appendTo(wrapper)
3376
- .on('change', function () {
3377
- const val = $.fn.dataTable.util.escapeRegex($(this).val());
3378
- column.search(val ? \`^\${val}$\` : '', true, false).draw();
3379
- updateFilters();
3380
- });
3381
-
3382
- column.data().unique().sort().each((d) => {
3383
- select.append(\`<option value="\${d}">\${d}</option>\`);
3384
- });
3385
- }
3386
- });
3387
-
3388
- $('select.filter').on('click', function (event) {
3389
- event.stopPropagation();
3390
- });
3391
-
3392
- tableApi.on('draw', updateFilters);
3393
-
3394
- const firstParent = document.querySelector('.dt-layout-row');
3395
- if (firstParent) {
3396
- const startCell = firstParent.querySelector('.dt-layout-cell.dt-start');
3397
- const endCell = firstParent.querySelector('.dt-layout-cell.dt-end');
3398
- if (startCell && endCell) {
3399
- let middleCell = firstParent.querySelector('.dt-layout-cell.dt-middle');
3400
- if (!middleCell) {
3401
- middleCell = document.createElement('div');
3402
- middleCell.classList.add('dt-layout-cell', 'dt-middle');
3403
- startCell.insertAdjacentElement('afterend', middleCell);
3404
- }
3405
- const resetButton = document.createElement('button');
3406
- resetButton.textContent = 'Reset All';
3407
- resetButton.classList.add('reset-filters-btn');
3408
- resetButton.setAttribute('title', 'Resets all applied filters and clears search results');
3409
-
3410
- resetButton.addEventListener('click', function () {
3411
- $('select.filter').val('');
3412
- const tableApi = $('.dataTable').DataTable();
3413
- tableApi.search('').columns().search('').draw();
3414
- });
3415
- middleCell.appendChild(resetButton);
3416
- }
3417
- }
3418
- },
3419
- sScrollY: scrollHeight,
3420
- pageLength: 25,
3421
- lengthMenu: [10, 25, 50, 100]
3422
- });
3423
- };
3424
-
3425
- const render = (locale) => {
3426
- if (table) {
3427
- table.destroy();
3428
- }
3429
- updateTitle(locale);
3430
- buildGrid(locale);
3431
- };
3432
- });
3433
- })();
3434
- `,Ge=i=>`// DataStore
3435
- (() => {
3436
- // prepare appData and set DataStore
3437
- var appData = {
3438
- appName: '${i.appName}',
3439
- defaultLocale: '${i.defaultLocale}',
3440
- sanityRun: ${i.isSanity},
3441
- contextRun: ${i.isContext},
3442
- timeStamp: '${i.reportTime}',
3443
- reportFolderTimestamp: '${i.reportFolderTimestamp}',
3444
- pagesByLocale: {},
3445
- metaData: {
3446
- stats: {},
3447
- statsByLocale: {}
3448
- },
3449
- stringsData: {},
3450
- locales: [],
3451
- hasRuntimeError: false
3452
- };
3453
-
3454
- if (window.rawData) {
3455
- for (const entry of Object.entries(window.rawData)) {
3456
- const locale = entry[0];
3457
- const stats = entry[1].metaData.stats;
3458
- const stringsData = entry[1].stringsData;
3459
-
3460
- if (Object.keys(appData.metaData.stats).length) {
3461
- for (const prop in stats) {
3462
- appData.metaData.stats[prop] += stats[prop];
3463
- }
3464
- } else {
3465
- appData.metaData.stats = {...stats};
3466
- }
3467
-
3468
- appData.metaData.statsByLocale[locale] = stats;
3469
- appData.stringsData[locale] = stringsData;
3470
-
3471
- if (Object.keys(stringsData).length) {
3472
- Object.values(stringsData).forEach(values => {
3473
- values.flat().forEach(value => {
3474
- if(!appData.pagesByLocale[locale]) {
3475
- appData.pagesByLocale[locale] = {};
3476
- }
3477
- if(!(value.description in appData.pagesByLocale[locale])) {
3478
- appData.pagesByLocale[locale][value.description] = value.imagePath;
3479
- }
3480
- });
3481
- });
3482
- }
3483
- }
3484
-
3485
- appData.locales = Object.keys(window.rawData);
3486
- }
3487
- else {
3488
- appData.hasRuntimeError = true;
3489
- }
3490
-
3491
- function SimpleDataStore() {
3492
- this._getData = () => appData;
3493
-
3494
- this.ranSuccessfully = () => this.getLocales().length > 0;
3495
-
3496
- this.getTimestamp = () => this._getData().timeStamp;
3497
-
3498
- this.getAppName = () => this._getData().appName;
3499
-
3500
- this.isDefaultLocale = (locale) =>
3501
- locale === this._getData().defaultLocale;
3502
-
3503
- this.getLocalesData = () => this._getData().stringsData || {};
3504
-
3505
- this.getLocales = () => this._getData().locales || [];
3506
-
3507
- this.getStatByLocale = (locale) =>
3508
- this._getData().metaData.statsByLocale[locale] || {};
3509
-
3510
- this.getOverallStats = () => this._getData().metaData.stats || {};
3511
-
3512
- this.getDataByLocale = (locale) =>
3513
- this._getData().stringsData[locale] || {};
3514
-
3515
- this.isSanityRun = () => this._getData().sanityRun;
3516
-
3517
- this.isContextRun = () => this._getData().contextRun;
3518
-
3519
- this.getReportFolderTimestamp = () => this._getData().reportFolderTimestamp;
3520
-
3521
- this.hasRuntimeError = () => this._getData().hasRuntimeError;
3522
-
3523
- this.getPages = (locale) => locale ? {...(this._getData().pagesByLocale[locale] || {})} : {...this._getData().pagesByLocale};
3524
-
3525
- this.hasDefaultLocaleData = () => Object.keys(this.getDataByLocale(this._getData().defaultLocale)).length > 0;
3526
-
3527
- this.getDefaultLocale = () => this._getData().defaultLocale;
3528
- }
3529
-
3530
- DataStore = new SimpleDataStore();
3531
- })();`,je=()=>`var DataStore;
3532
- // global functions
3533
- function openImageViewer(imageSrc) {
3534
- var imageView = document.getElementById('imageView');
3535
- imageView.src = \`\${window.getProductUrl()}/\${imageSrc}\`;
3536
- document.getElementById('imageViewer').style.display = 'block';
3537
- }
3538
-
3539
- function closeImageViewer() {
3540
- delete document.getElementById('imageView').src;
3541
- document.getElementById('imageViewer').style.display = 'none';
3542
- }
3543
-
3544
- document.addEventListener('DOMContentLoaded', () => {
3545
- document.addEventListener('keydown', (e) => {
3546
- const viewer = document.getElementById('imageViewer');
3547
- if (e.key === 'Escape' && viewer && viewer.style.display === 'block') {
3548
- closeImageViewer();
3549
- }
3550
- });
3551
- });
3552
-
3553
- //to dynamically show/hide header based upon query param: ?standalone=<true|false>
3554
- window.getProductUrl = () => {
3555
- if (window.productUrl) {
3556
- return window.productUrl;
3557
- } else {
3558
- window.productUrl = \`\${window.location.protocol}//\${
3559
- window.location.host
3560
- }\${window.location.pathname.match(/^.+[^\\/report\\.html]/g)?.[0]}\`;
3561
- return window.productUrl;
3562
- }
3563
- };
3564
- const params = new URLSearchParams(location.href.match(/(\\?.*$)/g)?.[0]);
3565
- if (params.size) {
3566
- window.isStandaloneReport = params.get('standalone') === 'true';
3567
- if(!window.isStandaloneReport) {
3568
- const overview = document.getElementById('overview');
3569
- if(overview) {
3570
- overview.classList.add('--reduced-zoom');
3571
- }
3572
- }
3573
- } else {
3574
- window.isStandaloneReport = true;
3575
- }`,Ze=()=>`// log content
3576
- (() => {
3577
- document.addEventListener('DOMContentLoaded', function () {
3578
- const pre = document.querySelector('#log .log-content pre');
3579
- pre.textContent = 'Loading...';
3580
- document
3581
- .querySelector('li[data-page="log"]')
3582
- ?.addEventListener('click', (e) => {
3583
- pre.textContent = window.logData || (DataStore.hasRuntimeError() ? 'We are facing internal issue. Please try again after sometime.' : 'No log data found!');
3584
- });
3585
- });
3586
- })();`,Fe=i=>`${je()}
3587
- ${Ge(i)}
3588
- ${Be()}
3589
- ${$e()}
3590
- ${ke()}
3591
- ${Ue()}
3592
- ${Ze()}`;class Ve extends Ee{constructor(){super(k.HTML)}buildContent(){const e=this.getMetaInfo(),t=Fe(e),a=Me(),n=ze(),s=[],o=g(l.getReportPath(),"logs","log"),u=c.isSanityRun()||c.isContextRun(),h=[c.getQALocale(),...c.getOptions()?.supportedLocales||[]].filter(Boolean).map(L=>O(L)),p=ae(l.getReportPath()).filter(L=>h.includes(L)),U=p.length===1&&p[0]===O(c.getDefaultLocale());let T="";if(p.forEach(L=>(u||L!==e.defaultLocale||L===e.defaultLocale&&U)&&x(g(l.getReportPath(),L,ee))&&s.push(g(L,ee).replace(/\\/g,"/"))),x(o)){const L=[e.appName,...c.getL10nReportsPath().split(/[\\/]+/g),c.getMode()];L.push(l.getReportTimeStamp()),T=M(o).replace(new RegExp(l.getReportPath().replace(/\\/g,"\\\\"),"g"),g(...L)).replace(/\\/g,"\\\\").replace(/`/g,"\\`")}return Pe({appName:e.appName,reportTime:e.reportTime,body:n,script:t,style:a,dataFilePaths:s,logData:T})}write(e,t,a){q(g(e,`${t}.html`),a,"utf-8")}}class W extends Ee{#e;#t=!1;static#r="STATUS";static#a="COUNTS";constructor(){super(k.ASCII_TABLE),this.#i()}#i(){this.#e=new ye.Table({style:{headerTop:{left:"\x1B[94m╔\x1B[0m",mid:"\x1B[94m╦\x1B[0m",right:"\x1B[94m╗\x1B[0m",other:"\x1B[94m═"},headerBottom:{left:"\x1B[94m╟\x1B[0m",mid:"\x1B[94m╬\x1B[0m",right:"\x1B[94m╢\x1B[0m",other:"\x1B[94m═"},tableBottom:{left:"\x1B[94m╚\x1B[0m",mid:"\x1B[94m╩\x1B[0m",right:"\x1B[94m╝\x1B[0m",other:"\x1B[94m═\x1B[0m"},vertical:"\x1B[94m║\x1B[0m"},columns:[{name:W.#r,alignment:"left"},{name:W.#a,alignment:"center"}]})}buildContent(){if(R[r.REVIEWED]>0){this.#t=!0;for(const e in R)e!==r.REVIEWED?R.hasOwnProperty(e)&&this.#e.addRows([{STATUS:e,COUNTS:`${R[e]}`}]):(this.#e.addRows([{STATUS:"\x1B[94m"+"═".repeat(28)+"\x1B[0m",COUNTS:"\x1B[94m"+"═".repeat(8)+"\x1B[0m"}]),this.#e.addRows([{STATUS:"OVERALL_REVIEWED",COUNTS:`${R[e]}`}]))}}export(){this.#t?this.#e.printTable():f.info("There are no visbile elements with UI strings")}}class re{static#e(e){switch(e){case k.HTML:return new Ve;case k.ASCII_TABLE:return new W;default:throw new Error("unsupported report type requested")}}static export(e,t,a){const n=re.#e(e),s=new Re({appName:c.getAppName(),reportTime:new Date().toLocaleString(),isContext:c.isContextRun(),isSanity:c.isSanityRun(),defaultLocale:c.getDefaultLocale(),reportFolderTimestamp:l.getReportTimeStamp()});n.generate(s),n.export(t,a)}}class S{static#e;static#t;static init(){S.#t=g(l.getReportPath(),O(c.getLocale())),S.#e=g(S.#t,ee),this.#r()}static exists(){return x(S.#e)}static save(e){this.#r();const t=`!window.rawData && (window.rawData={'${c.getLocale()}':{}});window.rawData['${c.getLocale()}']=${JSON.stringify(e)};`;q(S.#e,t)}static getData(){if(this.exists())try{return JSON.parse(M(S.#e).replace(new RegExp(`(\\!window.rawData && \\(window\\.rawData=\\{'${c.getLocale()}':\\{\\}\\}\\);window\\.rawData\\['${c.getLocale()}'\\]=)|(;$)`,"g"),""))}catch{return{}}else return{}}static#r(){j(S.#t)}static getCacheDirPath(){return S.#t}}class We{#e;#t;#r;#a;#i;#n;#s;#o;#l;#c;#d;#m;#p;#g;#h;#E;#f;#v;#w;#L;#u;#y;#I;#b;#S;constructor(e={}){this.#e=e?.localizedStrings||0,this.#t=e?.notLocalizedStrings||0,this.#r=e?.untranslatedStrings||0,this.#a=e?.partialStrings||0,this.#i=e?.localizedDateTime||0,this.#n=e?.localizedDate||0,this.#s=e?.localizedTime||0,this.#o=e?.notLocalizedDateTime||0,this.#l=e?.notLocalizedDate||0,this.#c=e?.notLocalizedTime||0,this.#d=e?.localizedNumber||0,this.#m=e?.notLocalizedNumber||0,this.#p=e?.localizedCurrency||0,this.#g=e?.notLocalizedCurrency||0,this.#h=e?.localizedPercentage||0,this.#E=e?.notLocalizedPercentage||0,this.#f=e?.ignored||0,this.#v=e?.dnt||0,this.#w=e?.autoIgnored||0,this.#L=e?.userInput||0,this.#u=e?.encoding||0,this.#y=e?.truncation||0,this.#I=e?.overlapping||0,this.#b=e?.reviewed||0,this.#S=e?.context||0}getLocalizedStrings(){return this.#e}setLocalizedStrings(e){this.#e=e}getUntranslatedStrings(){return this.#r}setUntranslatedStrings(e){this.#r=e}getNotLocalizedStrings(){return this.#t}setNotLocalizedStrings(e){this.#t=e}getPartialStrings(){return this.#a}setPartialStrings(e){this.#a=e}getLocalizedDateTime(){return this.#i}setLocalizedDateTime(e){this.#i=e}getLocalizedDate(){return this.#n}setLocalizedDate(e){this.#n=e}getLocalizedTime(){return this.#s}setLocalizedTime(e){this.#s=e}getNotLocalizedDateTime(){return this.#o}setNotLocalizedDateTime(e){this.#o=e}getNotLocalizedDate(){return this.#l}setNotLocalizedDate(e){this.#l=e}getNotLocalizedTime(){return this.#c}setNotLocalizedTime(e){this.#c=e}getLocalizedNumber(){return this.#d}setLocalizedNumber(e){this.#d=e}getNotLocalizeNumber(){return this.#m}setNotLocalizeNumber(e){this.#m=e}getCurrency(){return this.#p}setCurrency(e){this.#p=e}getNotLocalizeCurrency(){return this.#g}setNotLocalizeCurrency(e){this.#g=e}getPercentage(){return this.#h}setPercentage(e){this.#h=e}getNotLocalizePercentage(){return this.#E}setNotLocalizePercentage(e){this.#E=e}getIgnored(){return this.#f}setIgnored(e){this.#f=e}getUserInput(){return this.#L}setUserInput(e){this.#L=e}getDnt(){return this.#v}setDnt(e){this.#v=e}getAutoIgnored(){return this.#w}setAutoIgnored(e){this.#w=e}getEncoding(){return this.#u}setEncoding(e){this.#u=e}getTruncation(){return this.#y}setTruncation(e){this.#y=e}getOverlapping(){return this.#I}setOverlapping(e){this.#I=e}getReviewed(){return this.#b}setReviewed(e){this.#b=e}getContext(){return this.#S}setContext(e){this.#S=e}incrementByType(e){switch(e){case r.STRING_LOCALIZED:++this.#e;break;case r.STRING_NOT_LOCALIZED:++this.#t;break;case r.UNTRANSLATED:++this.#r;break;case r.STRING_PARTIALLY_LOCALIZED:++this.#a;break;case r.AUTO_IGNORE:++this.#w;break;case r.IGNORE:++this.#f;break;case r.DNT:++this.#v;break;case r.ENCODING_ISSUE:++this.#u;break;case r.DATE_LOCALIZED:++this.#n;break;case r.TIME_LOCALIZED:++this.#s;break;case r.DATE_TIME_LOCALIZED:++this.#i;break;case r.DATE_NOT_LOCALIZED:++this.#l;break;case r.TIME_NOT_LOCALIZED:++this.#c;break;case r.DATE_TIME_NOT_LOCALIZED:++this.#o;break;case r.NUMBER_LOCALIZED:++this.#d;break;case r.NUMBER_NOT_LOCALIZED:++this.#m;break;case r.CURRENCY_LOCALIZED:++this.#p;break;case r.CURRENCY_NOT_LOCALIZED:++this.#g;break;case r.PERCENTAGE_LOCALIZED:++this.#h;break;case r.PERCENTAGE_NOT_LOCALIZED:++this.#E;break;case r.TRUNCATION_ISSUE:++this.#y;break;case r.OVERLAPPING_ISSUE:++this.#I;break;case r.REVIEWED:++this.#b;break;case r.USER_INPUT:++this.#L;break;case"context":++this.#S;break}}toJSON(){return{localizedStrings:this.#e,notLocalizedStrings:this.#t,untranslatedStrings:this.#r,partialStrings:this.#a,localizedDateTime:this.#i,localizedDate:this.#n,localizedTime:this.#s,notLocalizedDateTime:this.#o,notLocalizedDate:this.#l,notLocalizedTime:this.#c,localizedNumber:this.#d,notLocalizedNumber:this.#m,localizedCurrency:this.#p,notLocalizedCurrency:this.#g,localizedPercentage:this.#h,notLocalizedPercentage:this.#E,ignored:this.#f,dnt:this.#v,autoIgnored:this.#w,userInput:this.#L,encoding:this.#u,truncation:this.#y,overlapping:this.#I,reviewed:this.#b,context:this.#S}}}class Ye{#e;constructor(e={}){this.#e=new We(e.stats)}getStats(){return this.#e}setStats(e){this.#e=e}toJSON(){return{stats:this.#e}}}class me{#e;#t;#r;constructor(e){this.#e=e?.type||"",this.#t=e?.imagePath||"",this.#r=e?.description||""}getType(){return this.#e}setType(e){this.#e=e}getImagePath(){return this.#t}setImagePath(e){this.#t=e}getDescription(){return this.#r}setDescription(e){this.#r=e}toJSON(){return{type:this.#e,description:this.#r,imagePath:this.#t}}}class ie{#e={};constructor(e){if(e)for(const t in e)e[t].forEach(a=>{this.#e[t]||(this.#e[t]=[]),this.#e[t].push(new me(a))})}getStringData(e){return this.#e[e]||[]}setStringData(e,t){return!this.#e[e]&&(this.#e[e]=[]),this.#e[e].push(new me(t)),!0}checkAndAdd(e,t){!this.#e[e]&&(this.#e[e]=[]);const a=this.getStringData(e).some(n=>n.getDescription()!==t.description||n.getImagePath()!==t.imagePath||n.getType()!==n.type);return a&&this.setStringData(e,t),a}hasStringData(e){return e in this.#e}static createNew(e,t){return t=Array.isArray(t)?t:[t],new ie({data:{[e]:t}})}toJSON(){return this.#e}}class B{#e;#t;constructor(e={}){this.#e=new Ye(e.metaData),this.#t=new ie(e.stringsData)}getMetaData(){return this.#e}setMetaData(e){this.#e=e}getStringEntry(e){return this.#t.getStringData(e)}static addString(e,t,a,n){const s=B.getInstance(),o=s.#r(e,t,a,n.replace(/\\/g,"/"));return o&&s.save(),o}#r(e,t,a,n){let s=!1;const o={type:t,description:a,imagePath:n};return this.#t.hasStringData(e)?s=this.#t.checkAndAdd(e,o):s=this.#t.setStringData(e,o),s&&this.#e.getStats().incrementByType(t),s}static incrementCountByType(e){const t=B.getInstance();t.#e.getStats().incrementByType(e),t.save()}toJSON(){return{metaData:this.#e,stringsData:this.#t}}save(){S.save(this)}remove(){S.delete()}static getInstance(){return new B(S.getData())}}class l{static#e;static#t;static setup(){l.#t||(l.#t=l.#r());const e=Z.resolve();l.#e=g(e,c.getL10nReportsPath(),c.getMode(),l.#t)}static getReportTimeStamp(){return l.#t}static getReportPath(){return l.#e}static reviewedReports(e=null,t=null){return l.#a(r.REVIEWED,e,t)}static getContextPath(){return this.#i()}static[r.STRING_LOCALIZED](e,t){return l.#a(r.STRING_LOCALIZED,e,t)}static[r.STRING_NOT_LOCALIZED](e,t){return l.#a(r.STRING_NOT_LOCALIZED,e,t)}static[r.STRING_PARTIALLY_LOCALIZED](e,t){return l.#a(r.STRING_PARTIALLY_LOCALIZED,e,t)}static[r.DNT](e,t){return l.#a(r.DNT,e,t)}static[r.IGNORE](e,t){return l.#a(r.IGNORE,e,t)}static[r.AUTO_IGNORE](e,t){return l.#a(r.AUTO_IGNORE,e,t)}static[r.UNTRANSLATED](e,t){return l.#a(r.UNTRANSLATED,e,t)}static[r.ENCODING_ISSUE](e,t){return l.#a(r.ENCODING_ISSUE,e,t)}static[r.DATE_TIME_LOCALIZED](e,t){return l.#a(r.DATE_TIME_LOCALIZED,e,t)}static[r.DATE_TIME_NOT_LOCALIZED](e,t){return l.#a(r.DATE_TIME_NOT_LOCALIZED,e,t)}static[r.DATE_LOCALIZED](e,t){return l.#a(r.DATE_LOCALIZED,e,t)}static[r.DATE_NOT_LOCALIZED](e,t){return l.#a(r.DATE_NOT_LOCALIZED,e,t)}static[r.TIME_LOCALIZED](e,t){return l.#a(r.TIME_LOCALIZED,e,t)}static[r.TIME_NOT_LOCALIZED](e,t){return l.#a(r.TIME_NOT_LOCALIZED,e,t)}static[r.CURRENCY_LOCALIZED](e,t){return l.#a(r.CURRENCY_LOCALIZED,e,t)}static[r.CURRENCY_NOT_LOCALIZED](e,t){return l.#a(r.CURRENCY_NOT_LOCALIZED,e,t)}static[r.PERCENTAGE_LOCALIZED](e,t){return l.#a(r.PERCENTAGE_LOCALIZED,e,t)}static[r.PERCENTAGE_NOT_LOCALIZED](e,t){return l.#a(r.PERCENTAGE_NOT_LOCALIZED,e,t)}static[r.NUMBER_LOCALIZED](e,t){return l.#a(r.NUMBER_LOCALIZED,e,t)}static[r.NUMBER_NOT_LOCALIZED](e,t){return l.#a(r.NUMBER_NOT_LOCALIZED,e,t)}static incrementCount(e,t,a,n){R.hasOwnProperty(e)&&(R[e]++,B.addString(t,e,n,a.replace(l.#e,"")))}static#r(){const e=new Date,t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");return`${t}-${a}-${n}-${s}-${o}`}static#a=(e,t,a)=>{const n=g(l.#e,O(c.getLocale()),"screenshots",String(e).toLowerCase());if(j(n,V),t!=null){const s=g(l.#e,O(c.getLocale()),"strings");j(s,V);let o="";const u=g(s,e+".txt");F(u)?(M(u).includes(a)||(o+=`
3593
- |<<<<<<<<<<<<<------${a}------>>>>>>>>>>>>>|
3594
- `),o+=t):(o+=`
3595
- |<<<<<<<<<<<<<------${a}------>>>>>>>>>>>>>|
3596
- `,o+=t),Ae(u,o)}return n};static#i=()=>{const e=g(l.#e,O(c.getLocale()),"contexts");return j(e,V),e};static#n(e){re.export(e,l.#e)}static generateHtml(){l.#n(k.HTML)}static generateAsciiTable(){l.#n(k.ASCII_TABLE)}}let f=class w{static#e=!1;static#t;static#r=[];static info(e){w.#a("info",e)}static warn(e){w.#a("warn",e)}static error(e,t){w.#a("errr",e,t)}static debug(e){w.#a("dbug",e)}static#a(e,t,a=""){const n={INFO:"\x1B[37m",WARN:"\x1B[33m",ERRR:"\x1B[31m",DBUG:"\x1B[34m"};e=e.toUpperCase();let s=n[e]||n.DEFAULT;a=a?` reason: ${a.toString()}`:"";let o=`[${new Date().toLocaleString()}] [${s}${e}\x1B[0m] [${c.getLocale()}] - ${t}${a}`;switch(e){case"INFO":console.info(o);break;case"WARN":console.warn(o);break;case"ERRR":console.error(o);break;case"DBUG":console.debug(o);break;default:console.log(o)}o=o.replace(/\x1b\[\d+m/g,""),w.#i(`${o}
3597
- `)}static#i=e=>{if(w.#e)w.#r.push(e),w.#t=setInterval(()=>{w.#e||(clearInterval(w.#t),e=w.#r.join(`
3598
- `),w.#r=[],e&&w.#i(e))},10);else{w.#e=!0;const t=g(l.getReportPath(),"logs"),a=g(t,"log");j(t,V),v.appendFileSync(a,e),w.#e=!1}}};class He extends H{constructor(e){super(e)}async getElement(e,t=!1){return await this.$driver.element.find({selector:e,locateStrategy:e.startsWith("/")?"xpath":"css selector",suppressNotFoundErrors:t})}async getElements(e,t=!1){return await this.$driver.element.findAll({selector:e,locateStrategy:e.startsWith("/")?"xpath":"css selector",suppressNotFoundErrors:t})}async getText(e){return await e.getText()}async getTitle(e){return await e.getAttribute("title")}async getPlaceholderText(e){return await e.getAttribute("placeholder")}async getAltText(e){return await e.getAttribute("alt")}async getTagName(e){return await e.getTagName()}async getValue(e){return await e.getAttribute("value")}async getElementID(e){return await e.getAttribute("id")}async getElementDimension(e){const t=await e.getRect();if(![null,"",void 0].includes(t))return[t.x,t.y,t.height,t.width]}async isElementDisplayed(e){return await this.$driver.isVisible(e)}async isElementPresent(e){return await this.$driver.isPresent(e)}async getElementStrings(e){const t=[];return this.isElementDisplayed(e)&&[{type:"eleTxt",value:await this.getText(e)},{type:"altTxt",value:await this.getAltText(e)},{type:"titleTxt",value:await this.getTitle(e)},{type:"placeTxt",value:await this.getPlaceholderText(e)},{type:"valueTxt",value:await this.getValue(e)}].forEach(({value:n})=>{this.checkIfNullOrEmpty(n)&&t.push(n)}),t}async getElementString(e){let t=null;const a=[this.getText,this.getAltText,this.getTitle,this.getPlaceholderText,this.getValue];for(const n of a)if(t=await n(e),t!==null)return t;return t}async captureScreenshot(e){await qe(this.$driver,e)}async getElementsCount(e){return e.length}async switchToIFrame(e,t){return new Promise(a=>{this.$driver.frame(e,function(){a(!0)})})}async switchToParentFrame(){return new Promise(e=>this.$driver.frame(null,function(){e(!0)}))}pause(e){this.$driver.pause(e*1e3)}async onScreenStringHighlight(e,t){await this.$driver.execute((a,n)=>{const s=window.getComputedStyle(a).border;a.style.border=`3px solid ${n}`,setTimeout(()=>{a.style.border=s},40)},[e,t])}async checkIfIframeIsPresent(){return new Promise(e=>{this.$driver.isPresent({selector:"//iframe",locateStrategy:"xpath",suppressNotFoundErrors:!0},t=>{e(t.value)})})}async checkIfIframeBodyIsEmpty(){return(await this.$driver.executeScript(function(){return document.body.innerHTML})).trim()===""}}const qe=async(i,e)=>{const t=await he({host:"localhost",port:Qe(i)}),{Page:a}=t;await a.enable();const{data:n}=await a.captureScreenshot({format:"png",captureBeyondViewport:!0}),s=Buffer.from(n,"base64");v.writeFileSync(e,s),f.debug(`Screenshot saved as: ${e}`),await t.close()},Qe=i=>{const e=i?.capabilities?.["goog:chromeOptions"]?.debuggerAddress;return e&&e.split(":")?.[1]||9229};class Xe extends H{constructor(e){super(e)}async getElement(e){return await this.$driver.$(e)}async getElements(e){return await this.$driver.$$(e)}async getText(e){return await $(e).getText()}async getTitle(e){return await $(e).getAttribute("title")}async getPlaceholderText(e){return await $(e).getAttribute("placeholder")}async getAltText(e){return await $(e).getAttribute("alt")}async getTagName(e){return await $(e).getTagName()}async getValue(e){return await $(e).getValue()}async getElementID(e){return await $(e).getAttribute("id")}async getElementDimension(e){if(!e)return null;try{const t=await e.getLocation(),a=await e.getSize();return!t||!a?null:[t.x,t.y,a.height,a.width]}catch(t){return console.error("Error getting element dimensions:",t),null}}async isElementDisplayed(e){return await $(e).isDisplayed()}async isElementPresent(e){return await $(e).isExisting()}async getElementStrings(e){const t=[];return[{type:"elTxt",value:await this.getText(e)},{type:"altTxt",value:await this.getAltText(e)},{type:"titleTxt",value:await this.getTitle(e)},{type:"placeTxt",value:await this.getPlaceholderText(e)},{type:"valueTxt",value:await this.getValue(e)}].forEach(({value:n})=>{this.checkIfNullOrEmpty(n)&&t.push(n)}),t}async getElementString(e){let t=null;const a=[this.getText,this.getAltText,this.getTitle,this.getPlaceholderText,this.getValue];for(const n of a)if(t=await n(e),t!==null)return t;return t}async captureScreenshot(e){await Je(this.$driver,e)}async getElementsCount(e){return e.length}async switchToIFrame(e,t){await this.$driver.switchFrame(t)}async switchToParentFrame(){await this.$driver.switchToParentFrame()}pause(e){this.$driver.pause(e*1e3)}async onScreenStringHighlight(e,t){await this.$driver.execute((a,n)=>{const s=window.getComputedStyle(a).border;a.style.border=`3px solid ${n}`,setTimeout(()=>{a.style.border=s},40)},e,t)}async checkIfIframeIsPresent(){return new Promise(e=>{this.$driver.$("//iframe").isExisting().then(()=>{e(!0)})})}async checkIfIframeBodyIsEmpty(){return(await this.$driver.executeScript("return document.body.innerHTML;",[])).trim()===""}}const Je=async(i,e)=>{const t=Ke(i),a=await he({host:"localhost",port:t}),{Page:n}=a;await n.enable();const{data:s}=await n.captureScreenshot({format:"png",captureBeyondViewport:!0});v.writeFileSync(e,Buffer.from(s,"base64")),await a.close()},Ke=i=>{const e=i.capabilities?.["goog:chromeOptions"]?.debuggerAddress;return e&&e.split(":")[1]||9229},et=({subject:i,selector:e,options:t={},driver:a})=>{if(!Cypress){a.printOnConsole("Cypress object is inaccessible");return}const n=m=>m.resultType===XPathResult.NUMBER_TYPE,s=m=>m.numberValue,o=m=>m.resultType===XPathResult.STRING_TYPE,u=m=>m.stringValue,h=m=>m.resultType===XPathResult.BOOLEAN_TYPE,p=m=>m.booleanValue,U=m=>Cypress._.isNumber(m)||Cypress._.isString(m)||Cypress._.isBoolean(m),T={name:"xpath",message:e};if(Cypress.dom.isElement(i)&&i.length>1)throw new Error("xpath() can only be called on a single element. Your subject contained "+i.length+" elements.");const L=()=>{let m=[],_,ce=cy.state("withinSubject");Cypress.dom.isElement(i)?_=i[0]:Cypress.dom.isDocument(i)?_=i:ce?_=ce[0]:_=cy.state("window").document;let A=(_.ownerDocument||_).evaluate(e,_);if(n(A)){const I=s(A);return T.consoleProps=()=>({XPath:e,type:"number",result:I}),I}if(o(A)){const I=u(A);return T.consoleProps=()=>({XPath:e,type:"string",result:I}),I}if(h(A)){const I=p(A);return T.consoleProps=()=>({XPath:e,type:"boolean",result:I}),I}try{let I=A.iterateNext();for(;I;)m.push(I),I=A.iterateNext();return T.consoleProps=()=>({XPath:e,result:m.length===1?m[0]:m}),m}catch(I){return console.error("Document tree modified during iteration",I),null}},le=()=>Cypress.Promise.try(L).then(m=>(U(m)||(m=Cypress.$(m),m.selector=e),cy.verifyUpcomingAssertions(m,t,{onRetry:le})));return le().then(m=>(t.log!==!1&&Cypress.log(T),m)).catch(m=>console.log(m))};class tt extends H{constructor(e){super(e)}async getElement(e){return typeof e!="string"?this.$driver.wrap(e):e.startsWith("//")?await this.xpath(e).first():await this.$driver.get(e).first()}async getElements(e){return typeof e!="string"?this.$driver.wrap(e):e.startsWith("//")?await this.xpath(e):await this.$driver.get(e)}async getText(e){return typeof e=="string"?await this.$driver.get(e).invoke("text"):await this.$driver.wrap(e).invoke("text")}async getTitle(e){return typeof e=="string"?await this.$driver.get(e).title():this.$driver.wrap().title()}async getPlaceholderText(e){return typeof e=="string"?this.$driver.get(e).filter("input").invoke("attr","placeholder").then(t=>t):this.$driver.$$(e).attr("placeholder")}async getAltText(e){return this.$driver.get(e).invoke("attr","alt")}async getWidth(e){return typeof e=="string"?this.$driver.get(e).invoke("width"):this.$driver.$$(e).width()}async getHeight(e){return typeof e=="string"?this.$driver.get(e).invoke("height"):this.$driver.$$(e).height()}async getTagName(e){return typeof e=="string"?this.$driver.get(e).invoke("prop","tagName").then(t=>t.toLowerCase()):this.$driver.$$(e).tagName}async getValue(e){return typeof e=="string"?this.$driver.get(e).invoke("val"):this.$driver.wrap(e).invoke("val")}async getLocation(e){if(typeof e=="string")return this.$driver.get(e).invoke("offset").then(t=>({x:t.left,y:t.top}));{const t=this.$driver.$$(e).offset();return{x:t.left,y:t.top}}}async isElementDisplayed(e){return typeof e=="string"?this.$driver.get(e).then(t=>t.is(":visible")):this.$driver.$$(e).is(":visible")}async captureScreenshot(e){this.$driver.screenshot(e)}async getElementsCount(e){return new Promise(t=>typeof e=="string"?this.$driver.get(e).its("length").then(a=>t(a)):this.$driver.wrap(e,{timeout:8e3}).its("length").then(a=>t(a)))}async getElementStrings(e){const t=[];try{[{type:"elTxt",value:await this.getText(e)},{type:"altTxt",value:await this.getAltText(e)},{type:"placetxt",value:await this.getPlaceholderText(e)}].forEach(({value:n})=>{this.checkIfNullOrEmpty(n)&&t.push(n)})}catch(a){f.error("Error getting text of element:",a)}return t}printOnConsole(e){this.$driver.log(e)}xpath(e,t,a={}){return et({subject:e,selector:t,options:a,driver:this.$driver})}}class at extends H{constructor(e){super(e)}async getElement(e){return await this.driver.findElement(e)}async getElements(e){return await this.driver.findElements(e)}async getText(e){return await e.getText()}async getTitle(){return await this.driver.getTitle()}async getAttribute(e,t){return await e.getAttribute(t)}async getTagName(e){return await e.getTagName()}async getElementDimension(e){const t=await e.getRect();if(![null,"",void 0].includes(t))return[t.x,t.y,t.height,t.width]}async isElementDisplayed(e){return await e.isDisplayed()}async getElementStrings(e){const t=[];return[{type:"elTxt",value:await this.getText(e)},{type:"altTxt",value:await this.getAttribute(e,"alt")},{type:"titleTxt",value:await this.getAttribute(e,"title")},{type:"placeTxt",value:await this.getAttribute(e,"placeholder")},{type:"valueTxt",value:await this.getAttribute(e,"value")}].forEach(({value:n})=>{this.checkIfNullOrEmpty(n)&&t.push(n)}),t}async getElementsCount(e){return e.length}}const rt=(i,e)=>{switch(i){case z.NIGHT_WATCH:return new He(e);case z.WEB_DRIVER_IO:return new Xe(e);case z.CYPRESS:return new tt(e);case z.SELENIUMJS:return new at(e);default:throw new Error("Unsupported framework")}},it=(i,e)=>i in e,nt=(i,e,t=[])=>i.every(a=>(it(a,e)||t.push(a),!0)),fe=(i,e=", ")=>i.join(e),D=(i=!0)=>i?"(?:\\s|\\t|(?:&nbsp;))":/(?:\s|\t|(?:&nbsp;))/g;class P{#e={};#t;constructor(e){this.#t=e,this.#r(),this.buildConfig(),this.#a()}#r(){this.addToConfig("supportedLocales",c.getOptions()?.supportedLocales,[]),this.addToConfig("defaultLocale",c.getDefaultLocale()),this.addToConfig("defaultLanguage",c.getDefaultLocale()?.split(/[-_ ]/g)[0]),this.addToConfig("language",c.getLocale()?.split(/[-_ ]/g)[0]),this.addToConfig("locale",c.getLocale()),this.addToConfig("qaLocale",c.getQALocale())}buildConfig(){throw new Error(`{{${this.#t}}} buildConfig should be implemented by child class`)}#a(){Q.load(X.entireSupplemental()),Q.load(X.entireMainFor(this.#i(this.#e.defaultLocale),this.#i(this.#e.locale)))}#i(e){if(this.isQaLocale())return"en";e=e.replace(/[-_ ]/g,"-");const t=X.availableLocales;let a;if(t.find(n=>n===e))a=e;else{const n=e.split("-")[0];t.find(s=>s===n)?a=n:a=e}return a}validate(e){throw new Error(`{{${this.#t}}} validate should be implemented by child class`)}isInternationalized(e){throw new Error(`{{${this.#t}}} isInternationalized should be implemented by child class`)}setConfig(e){this.#e=e}addToConfig(e,t,a){this.#e[e]=t??a}getConfig(){return this.#e}isSupportedLocale(){return this.#e.supportedLocales.includes(this.currentLocale())}isQaLocale(){return this.currentLocale()===this.#e?.qaLocale}isDefaultLocale(){return this.currentLocale()===this.defaultLocale()}defaultLocale(){return this.#e?.defaultLocale}defaultLanguage(){return this.#e?.defaultLanguage}currentLocale(){return this.#e?.locale}currentLanguage(){return this.#e.language}getGlobalize(e){return Q(this.#i(e))}}class st extends P{constructor(){super("currency")}validate(e){return this.#s(e)||this.isInternationalized(e)}isInternationalized(e){return this.#e(this.currentLocale(),e)}buildConfig(){}#e(e,t){const a=this.#i(e),n=this.#n(e,a);if(!this.#t(a,n,t))return!1;const o=this.#r(a,n,t);return!isNaN(this.getGlobalize(e).numberParser()(o))}#t(e,t,a){return new RegExp(`^(?:-)?(?:${e}|\\${t})(?:${D()})?(?:-)?[0-9,. ]+$`,"gi").test(a)||new RegExp(`^(?:[- ]?)[0-9,. ]+(?:${D()})?(?:${e}|\\${t})$`,"gi").test(a)}#r(e,t,a){return a.replace(new RegExp(`^(?:-)(?:${D()})?`,"gi"),"").replace(new RegExp(`^(?:${D()})?(?:${e}|\\${t})`,"gi"),"").replace(new RegExp(`^(?:-)(?:${D()})?`,"gi"),"").replace(new RegExp(`(?:${D()})?(?:${e}|\\${t})$`,"gi"),"").trim()}#a(e){return(this.getGlobalize(e).cldr.supplemental(["likelySubtags",e])||e).split(/[-_ ]/).pop()}#i(e){const t=this.#a(e),n=this.getGlobalize(e).cldr.supplemental("currencyData").region[t];if(n){const s=n.find(o=>{const u=Object.values(o)[0];return!u._tender&&(!u._to||new Date(u._to)>=new Date)});return s?Object.keys(s)[0]:"USD"}return"USD"}#n(e,t){return this.getGlobalize(e).cldr.main(`numbers/currencies/${t}`)?.symbol||"$"}#s(e){return this.#e(this.defaultLocale(),e)}}const ot=i=>{let[e="en",t="us"]=i.split(/[-_ ]/g);switch(t=String(t).toLowerCase(),e){case"en":return t==="gb"?b.en.GB:b.en;case"de":return b.de;case"es":return b.es;case"fr":return b.fr;case"pt":return b.pt;case"ja":return b.ja;case"zh":return["hans","cn","sg","hans-cn"].includes(t)?b.zh.hans:["hant","tw","hk","mo","hant-tw"].includes(t)?b.zh.hant:b.zh;case"ru":return b.ru;case"nl":return b.nl;case"uk":return b.uk;default:return b.en}},ne=(i,e)=>(e=String(e),ot(i).parse(String(e).trim()).forEach(a=>{e=e.replace(a.text,"")}),e.replace(/[^\p{L}\p{N}]+/gu,"").trim().length===0),pe=i=>{try{return i=i.replace("_","-"),Intl.DateTimeFormat.supportedLocalesOf(i)[0]}catch{return Logger.warn(`${i} is unsupported by Intl`),!1}},se=(i,e,t)=>(i=pe(i),!!(i!==!1&&E.DateTime.fromFormat(t,e,{locale:pe(i)}).isValid));class lt extends P{constructor(){super("date")}validate(e){return this.#t(e)||this.isInternationalized(e)}isInternationalized(e){return this.#e(this.isQaLocale()?this.defaultLocale():this.currentLocale(),e)}buildConfig(){}#e(e,t){return this.#r(e,t)||this.#a(e,t)||this.#i(e,t)}#t(e){return this.#e(this.defaultLocale(),e)}#r(e,t){const a=["short","medium","long","full"];for(let n of a)if(this.getGlobalize(e).dateParser({date:n})(t))return!0;return!1}#a(e,t){const a=[E.DateTime.DATE_SHORT,E.DateTime.DATE_MED,E.DateTime.DATE_FULL,E.DateTime.DATE_HUGE,E.DateTime.DATE_MED_WITH_WEEKDAY,"D","DD","DDD","DDDD"];for(let n of a)if(se(e,n,t))return!0;return!1}#i(e,t){return ne(this.isQaLocale()?this.defaultLocale():e,t)}}class ct extends P{constructor(){super("dateTime")}validate(e){return this.#t(e)||this.isInternationalized(e)}isInternationalized(e){return this.#e(this.isQaLocale()?this.defaultLocale():this.currentLocale(),e)}buildConfig(){}#e(e,t){return this.#r(e,t)||this.#a(e,t)||this.#i(e,t)}#t(e){return this.#e(this.defaultLocale(),e)}#r(e,t){const a=["short","medium","long","full"];for(let n of a)if(this.getGlobalize(e).dateParser({datetime:n})(t))return!0;return!1}#a(e,t){const a=[E.DateTime.DATETIME_SHORT,E.DateTime.DATETIME_SHORT_WITH_SECONDS,E.DateTime.DATETIME_MED,E.DateTime.DATETIME_MED_WITH_SECONDS,E.DateTime.DATETIME_MED_WITH_WEEKDAY,E.DateTime.DATETIME_FULL,E.DateTime.DATETIME_FULL_WITH_SECONDS,E.DateTime.DATETIME_HUGE,E.DateTime.DATETIME_HUGE_WITH_SECONDS,"f","F","ff","FF"];for(let n of a)if(se(e,n,t))return!0;return!1}#i(e,t){return ne(this.isQaLocale()?this.defaultLocale():e,t)}}class dt extends P{constructor(){super("number")}validate(e){return this.#t(e)||this.isInternationalized(e)}isInternationalized(e){return this.#e(this.currentLocale(),e)}buildConfig(){}#e(e,t){const a=this.getGlobalize(e).numberParser();return!isNaN(a(t))}#t(e){return this.#e(this.defaultLocale(),e)}}class ut extends P{constructor(){super("percentage")}validate(e){return this.#a(e)||this.isInternationalized(e)}isInternationalized(e){return this.#e(this.currentLocale(),e)}buildConfig(){}#e(e,t){if(!this.#r(e,t))return!1;const n=this.#t(t);return!isNaN(this.getGlobalize(e).numberParser()(n))}#t(e=""){return e.replace(new RegExp(`(^(?:${D()})*|(?:${D()})*$)`,"g"),"").replace(/^-/,"").replace(/٪|%/g,"").trim()}#r(e,t){const a="[0-9,. ]+";let n;return["fa-IR","fa-ir"].includes(e)||e.startsWith("ar")?n=new RegExp(`(?:-)?(?:${D()})?(?:٪|%)(?:${D()})?${a}`,"g"):n=new RegExp(`(?:-)?(?:${D()})?${a}(?:${D()})?(?:٪|%)`,"g"),n.test(t)}#a(e){return this.#e(this.defaultLocale(),e)}}class mt extends P{constructor(){super("string")}buildConfig(){const e=c.getOptions();this.addToConfig("mockChars",e?.qaMock),this.addToConfig("resource",c.getResourceBundle(),{}),this.addToConfig("garbledChars",c.getGarbledChars()?.filter(t=>String(t).trim()).filter(Boolean),[])}isInternationalized(e){const t=e.trim().replace(/\s*:\s*$/,""),a=this.getConfig()?.resource?.[this.defaultLocale()];return a?.includes(e)||a?.includes(t)}validate(e){return typeof e=="string"}isDntText(e){return this.getConfig()?.resource?.dnt?.includes(e)}isAutoIgnoredText(e){return this.isDefaultLocale()||this.isUserInputText(e)||this.isEmailText(e)||this.isUrlText(e)}isIgnoredText(e){return this.getConfig()?.resource?.ignore?.includes(e)}isUserInputText(e){return e.startsWith(Se)}isEmailText(e){return ue.EMAIL.test(e)}isUrlText(e){return ue.URL.test(e)}isFullQaLanguageText(e){const t=this.getConfig();return(e.slice(0,2)===t?.mockChars?.prefix||e.slice(0,2)===t?.mockChars?.prefix.toUpperCase())&&e.slice(-2)===t?.mockChars.suffix}isPartialQaLanguageText(e){const t=this.getConfig();return e.slice(0,2)===t?.mockChars.prefix||e.slice(0,2)===t?.mockChars.prefix.toUpperCase()||e.slice(-2)===t?.mockChars.suffix}hasEncodingIssue(e){return this.getConfig()?.garbledChars?.length>0&&this.getConfig().garbledChars.some(t=>e.includes(t))}isPartiallyLocalizedText(e){return this.#e(e)===this.currentLanguage()}#e(e){const t=Object.keys(Ie.detectTextLangEx(e)?.scores||{}).filter(Boolean)||[],a=this.currentLanguage();return t.length?t.includes(a)?a:t[0]:this.defaultLanguage()}isLocalized(e){const t=e.trim().replace(/\s*:\s*$/,""),a=this.getConfig()?.resource?.[this.currentLocale()];return a?.includes(e)||a?.includes(t)}}class pt extends P{constructor(){super("time")}validate(e){return this.#t(e)||this.isInternationalized(e)}isInternationalized(e){return this.#e(this.isQaLocale()?this.defaultLocale():this.currentLocale(),e)}buildConfig(){}#e(e,t){return this.#r(e,t)||this.#a(e,t)||this.#i(e,t)}#t(e){return this.#e(this.defaultLocale(),e)}#r(e,t){const a=["short","medium","long","full"];for(let n of a)if(this.getGlobalize(e).dateParser({time:n})(t))return!0;return!1}#a(e,t){const a=[E.DateTime.TIME_SIMPLE,E.DateTime.TIME_WITH_SECONDS,E.DateTime.TIME_WITH_SHORT_OFFSET,E.DateTime.TIME_WITH_LONG_OFFSET,E.DateTime.TIME_24_SIMPLE,E.DateTime.TIME_24_WITH_LONG_OFFSET,E.DateTime.TIME_24_WITH_SECONDS,E.DateTime.TIME_24_WITH_SHORT_OFFSET,"t","T","tt","TT"];for(let n of a)if(se(e,n,t))return!0;return!1}#i(e,t){return ne(this.isQaLocale()?this.defaultLocale():e,t)}}class y{static#e={};static#t;static#r;static#a;static#i;static#n;static#s;static#o;static load(){y.#t=new mt,y.#r=new dt,y.#a=new lt,y.#i=new pt,y.#n=new ct,y.#s=new st,y.#o=new ut}static getIssueType(e){const t=c.getLocale();if(t){let a=r.UNTRANSLATED;return y.#e[t]||(y.#e[t]={}),y.#e[t][e]?y.#e[t][e]:(this.#t.isAutoIgnoredText(e)?a=r.AUTO_IGNORE:this.#t.isDntText(e)?a=r.DNT:this.#t.isIgnoredText(e)?a=r.IGNORE:this.#t.hasEncodingIssue(e)?a=r.ENCODING_ISSUE:this.#s.validate(e)?a=this.#s.isInternationalized(e)?r.CURRENCY_LOCALIZED:r.CURRENCY_NOT_LOCALIZED:this.#o.validate(e)?a=this.#o.isInternationalized(e)?r.PERCENTAGE_LOCALIZED:r.PERCENTAGE_NOT_LOCALIZED:this.#r.validate(e)?a=this.#r.isInternationalized(e)?r.NUMBER_LOCALIZED:r.NUMBER_NOT_LOCALIZED:this.#a.validate(e)?a=this.#a.isInternationalized(e)?r.DATE_LOCALIZED:r.DATE_NOT_LOCALIZED:this.#i.validate(e)?a=this.#i.isInternationalized(e)?r.TIME_LOCALIZED:r.TIME_NOT_LOCALIZED:this.#n.validate(e)?a=this.#n.isInternationalized(e)?r.DATE_TIME_LOCALIZED:r.DATE_TIME_NOT_LOCALIZED:this.#t.validate(e)?this.#t.isQaLocale()?this.#t.isFullQaLanguageText(e)?a=r.STRING_LOCALIZED:this.#t.isPartialQaLanguageText(e)?a=r.STRING_PARTIALLY_LOCALIZED:a=r.STRING_NOT_LOCALIZED:!this.#t.isDefaultLocale()&&this.#t.isSupportedLocale()&&(this.#t.isLocalized(e)?a=r.STRING_LOCALIZED:this.#t.isPartiallyLocalizedText(e)?a=r.STRING_PARTIALLY_LOCALIZED:this.#t.isInternationalized(e)?a=r.UNTRANSLATED:a=r.STRING_NOT_LOCALIZED):this.#t.isDefaultLocale()&&(a=r.AUTO_IGNORE),y.#e[t][e]=a,a)}return r.UNTRANSLATED}}class Y{static load(){const e={};if(c.getOptions()?.l10nResourcePath){const t=g(process.cwd(),c.getOptions()?.l10nResourcePath);if(x(t))Y.#e(t,e);else if(te(t))for(const a of ae(t)){const n=g(t,a);Y.#e(n,e)}else{console.error(`${t} invalid resource path`);return}c.setResourceBundle(e)}}static#e(e,t){const a=c.getLocale(),n=c.getDefaultLocale(),s=M(e),o=xe(e);if(De.includes(o)){if(!s){console.error(`${e} is empty or invalid`);return}if(e.toLowerCase().includes("dnt"))t.dnt=s.split(/\r?\n/);else if(e.toLowerCase().includes("ignore"))t.ignore=s.split(/\r?\n/);else if(e.includes(a)){const u=s.split(/\r?\n/);t[a]=u.map(gt)}else e.includes(n)&&(t[n]=s.split(/\r?\n/))}}}function gt(i){const e=/<\/?[^>]+>/gi;return i.replace(e,"")}const ht=()=>{c.getDriver()&&!c.isLoaded()&&c.getLocale()&&(c.build(),Y.load(),y.load(),l.setup(),S.init(),c.setIsLoaded(!0))},ve=()=>{let e=process.cwd(),t=0;for(;t<10;){const a=g(e,"package.json");if(x(a)){const n=M(a),s=JSON.parse(n),o={...s?.dependencies||{},...s?.devDependencies||{},...s?.peerDependencies||{}};if(s.name!=="@zeesoft/i18n-verify"&&JSON.stringify(o).includes('"@zeesoft/i18n-verify"'))break}e=Oe(e),t++}return e},we=(i=ve())=>M(g(i,"package.json")),Et=()=>we()?.match(/"name": "([^"]+)",/)?.[1]||"",ft=()=>g(process.cwd(),C),vt=(i="")=>`{
3599
- "appName": "${Et()}",
3600
- "type": "${i}", // set automation framework type ${fe(Object.values(z))}
3601
- "qaLocale": "", // set the qa locale used in your project
3602
- "l10nResourcePath": "./l10nResources", // set the dir path of l10n resources
3603
- "l10nReportsPath": "./l10nReports/", // set the dir path of l10n reports
3604
- "supportedLocales": ["en_US", "fr_FR", "ja_JP"], // set the list of supported locales
3605
- "defaultLocale": "en_US", // set default locale of the application
3606
- "qaMock": { // set the prefix and suffix characters of qa locale
3607
- "prefix": "à_",
3608
- "suffix": "_海"
3609
- },
3610
- "mode": "${N.I18N}", // should be one of the following: ${Object.values(N).join(", ")}
3611
- "garbledChars": [""]
3612
- }`,wt=()=>{const i=ft();if(!x(i))throw new Error(`${C} file is missing. Please add the file in your project root dir`);let e=M(i);if(!e)throw new Error(`invalid ${C} file. Please add valid file in your project root dir`);e=e.replace(/\/\/.+$/gm,"");try{e=JSON.parse(e)}catch{throw new Error(`invalid ${C} file. Please add valid file in your project root dir`)}return e},Lt=i=>{if(typeof i!="object"||Object.keys(i).length<1)throw new Error(`empty ${C} file`);const e=[];if(!nt(["l10nResourcePath","l10nReportsPath","supportedLocales","defaultLocale","type","mode"],i,e))throw new Error(`following properties are missing in ${C} file: ${fe(e)}`);if(!Object.values(z).includes(i?.type||""))throw new Error(`${C} has invalid system type`);if(!Object.values(N).includes(i?.mode||""))throw new Error(`${C} has invalid mode option`)},yt=(i,e="")=>{i&&!x(i)&&q(i,vt(e))};class c{static#e;static#t;static#r;static#a;static#i;static#n;static#s;static#o;static#l;static#c;static#d;static init(){try{const e=wt();Lt(e),this.#r=e?.type,this.#a=e?.mode,this.#n=e?.qaLocale,this.#c=e?.appName,this.#s=e,this.#l=0,this.getGarbledChars()}catch(e){throw f.error(e.message),e}}static build(){this.#e=rt(this.#r,this.#e),this.resetCounter()}static getGarbledChars(){return[...this.#s.garbledChars||[],...Te]}static getL10nReportsPath(){return this.#s.l10nReportsPath}static setDriver(e){this.#e=e}static setType(e){this.#r=e}static setLocale(e){this.#i=e}static setOptions(e){this.#s=e}static getExecutor(){if(c.#t)return c.#t;if(!c.#e)throw new Error("Unable to initialize process executor, driver is missing");return this.#t=new Le(this.#e),this.#t}static getDriver(){return this.#e}static getLocale(){return this.#i}static getDefaultLocale(){return this.#s.defaultLocale}static getType(){return this.#r}static getOptions(){return this.#s}static setQALocale(e){this.#n=e}static getQALocale(){return this.#n}static setResourceBundle(e){this.#o=e}static getResourceBundle(e){return this.#o?.[e]||this.#o||[]}static incrementCounter(){this.#l++}static resetCounter(){this.#l=0}static getSSCount(e=!1){return e?++this.#l:this.#l}static getMode(){return this.#a}static isSanityRun(){return this.#a===N.SANITY}static isI18nVerificationRun(){return this.#a===N.I18N}static isContextRun(){return this.#a===N.CONTEXT}static getAppName(){return this.#c}static isLoaded(){return this.#d}static setIsLoaded(e){this.#d=e}}class oe{#e;#t;#r;#a;#i=[];#n;#s;#o;#l;#c;constructor(e,t,a,n,s){this.#e=e,this.#t=t,this.#r=a,this.#c=n,this.#a=s}async run(){try{await this.#p(),this.shouldCollectStrings()?await this.#d():await this.#m()}catch(e){f.error("unable to run the process",e)}finally{await this.#g()}}async process(e,t,a,n){throw new Error("should be implemeneted by the child class")}shouldCollectStrings(){return!0}async preProcess(){}async postProcess(){}async captureScreen(e){try{return await this.#e.captureScreenshot(e),f.debug("reviewed image has been saved"),!0}catch{return f.error("unable to capture screenshot"),!1}}getBaseImageName(){return this.#s}getDescription(){return this.#a}getVerificationArea(){return this.#t}getVerificationAreaEl(){return this.#o}getVerificationAreaOffsets(){return this.#l}getDriver(){return this.#e}async getElementOffsets(e){const t=await this.#e.getElementDimension(e);return{x:t[0],y:t[1],height:t[2],width:t[3]}}async#d(){this.#i.length?(await this.#w(),await this.#L()):f.debug("No locators provided")}async#m(){await this.process(this.#a)}async#p(){this.#h(),this.#E(),await this.#v(),await this.#f(),await this.preProcess()}async#g(){await this.postProcess()}#h(){const e=this.#t||"";if(this.#r?.length>0)for(const t of this.#r)this.#i.push(e+t);this.#c&&(this.#n=e!==""?e+K:K,this.#i.push(this.#n.toString()))}#E(){this.#s=`${c.getSSCount(!0).toString().padStart(3,"0")}_${this.#a.replace(/[^\w\s]/gi,"").replace(/\s+/g,"")}.png`}async#f(){const e=g(l.reviewedReports(),this.#s);await this.captureScreen(e)}async#v(){if(this.#o=await this.#e.getElement(this.#t),this.#o)this.#l=await this.getElementOffsets(this.#o);else throw new Error("invalid verification area selector is supplied")}async#w(){let e=!1;for(const t of this.#i){const a=await this.#e.getElements(t,!0);if(a?.length){!e&&(e=!0);for(const n of a)await this.#u(n,!0)}}e||f.debug("No UI elements found from the provided locators")}async#L(){if(await this.#e.checkIfIframeIsPresent()){const e=await this.#e.getElements("//iframe");f.debug(`Total ${e.length} iframes are located on the ${this.#a}`);for(let t=0;t<e.length;t++){const a=e[t],n=await this.getElementOffsets(a);f.debug(`Switching to iFrame: ${t}`),await this.#e.switchToIFrame(t,a),this.#e.pause(1);const s=await this.#e.getElement("//body");await this.#e.isElementPresent(s);let o=!1;if(!await this.#e.checkIfIframeBodyIsEmpty()){const u=await this.#e.getElements(K,!0);if(u?.length)for(const h of u){const p=await this.#u(h,!0,n,t);!o&&p&&(o=!0)}}!o&&f.debug("No valid UI elements found in the iFrame"),await this.#e.switchToParentFrame()}}}async#u(e,t=!1,a,n){if(await this.#y(e)){const s=t?await this.#e.getElementStrings(e):[await this.#e.getElementString(e)];if(s?.length){for(const o of s)try{await this.process(o,e,a,n)}catch(u){f.error(`unable to process the ${n?`iframe-[${n}] `:""}string "${o}"`,u)}return!0}else return!1}else return!1}async#y(e){return e&&await this.#e.isElementDisplayed(e)}}class It extends oe{#e={screenshot:"",category:"",fileName:"",bookmark:!0,pageTitle:"",strings:{}};#t=0;#r="";constructor(...e){super(...e)}async preProcess(){this.#a(),this.#i(),this.#n(),this.#s(),this.#o()}async process(e,t,a){l.incrementCount(r.REVIEWED,e,this.getBaseImageName(),this.getDescription()),f.debug(`context creation for "${e}"`),await this.#d(e,t,a)}async postProcess(){this.#l();const e=this.#c();q(g(l.getContextPath(),`${this.#e.fileName}.json`),JSON.stringify(e)),B.incrementCountByType("context")}#a(){this.#t=ae(l.getContextPath()).length+1}#i(){this.#e.category=this.getDescription()}#n(){this.#e.pageTitle=`TC-${c.getAppName()}-${this.getDescription().trim().slice(0,2).toUpperCase()}-${`${this.#t}`.padStart(3,"0")}`}#s(){this.#e.fileName=`${O(c.getAppName())}-${`${this.#t}`.padStart(3,"0")}`}#o(){this.#r=`${O(c.getAppName())}_${`${this.#t}`.padStart(3,"0")}`}#l(){this.#e.screenshot=`data:image/png;base64,${_e(g(l.reviewedReports(),this.getBaseImageName()))}`}#c(){return{[G.BOOKMARK]:this.#e.bookmark,[G.CATEGORY]:this.#e.category,[G.FILE_NAME]:this.#e.fileName,[G.SCREENSHOT]:this.#e.screenshot,[G.STRINGS]:JSON.stringify(this.#e.strings)}}async#d(e,t,a){const n=await this.getElementOffsets(t),s=`${this.#r}_${`${Object.keys(this.#e.strings).length+1}`.padStart(3,"0")}`;if(a&&Object.keys(a||{}).length){const o=a,u=["x","y"];for(const h of u)h in n&&h in o&&(n[h]+=o[h])}this.#e.strings[s]={text:e,coordinates:{...n}}}}class ge{static async drawRectangle(e,t,a){const n=e?.x-2,s=e?.y-2,o=e?.width+2,u=e?.height+2,h=2;try{const p=await J.read(a),U=J.cssColorToHex(t);this.drawRectangleOutline(p,n,s,o,u,U,h);const T=Z.dirname(a),L=await p.getBufferAsync(J.MIME_PNG);v.existsSync(T)||(f.debug("folder not found"),v.mkdirSync(T,{recursive:!0})),v.writeFileSync(a,L)}catch(p){f.error(`Error: ${p}`)}}static async drawRectangleOutline(e,t,a,n,s,o,u){for(let h=t;h<t+n;h++)for(let p=0;p<u;p++)e.setPixelColor(o,h,a+p),e.setPixelColor(o,h,a+s-1-p);for(let h=a;h<a+s;h++)for(let p=0;p<u;p++)e.setPixelColor(o,t+p,h),e.setPixelColor(o,t+n-1-p,h)}}class bt extends oe{constructor(...e){super(...e)}async process(e,t,a){if(typeof e!="string"||!e||Number(e)===0)return;const n=g(l.reviewedReports(e,this.getBaseImageName()),this.getBaseImageName()),s=y.getIssueType(e),o=g(l[s](e,this.getBaseImageName()),this.getBaseImageName());l.incrementCount(r.REVIEWED,e,this.getBaseImageName(),this.getDescription()),v.existsSync(n)||v.copyFileSync(g(l.reviewedReports(),this.getBaseImageName()),n),v.existsSync(n)&&!v.existsSync(o)&&v.copyFileSync(n,o);const u=this.#a(s,e);l.incrementCount(s,e,o,this.getDescription()),await this.#e(t,u,o,a)}async#e(e,t,a,n){await this.#t(e,t),await this.#r(e,t,a,n)}async#t(e,t){await this.getDriver().onScreenStringHighlight(e,t)}async#r(e,t,a,n){let s;const o=await this.getElementOffsets(e),u=d.GRB_BLUE;if(n){s=n;const h=["x","y"];for(const p of h)p in o&&p in s&&(o[p]=s[p]+o[p])}else s=this.getVerificationAreaOffsets();await ge.drawRectangle(s,u,a),await ge.drawRectangle(o,t,a)}#a(e,t){return f.debug(`"${t}" - ${de[e][1]}${be[e]}\x1B[0m`),de[e][0]}}class St extends oe{constructor(...e){super(...e)}shouldCollectStrings(){return!1}async process(e){f.info(`${e} loaded`);const t=g(l.reviewedReports(e,this.getBaseImageName()),this.getBaseImageName());l.incrementCount(r.REVIEWED,e,t,this.getDescription()),v.existsSync(t)||v.copyFileSync(g(l.reviewedReports(),this.getBaseImageName()),t)}}const Dt=(i,e,t,a,n)=>{switch(c.getMode()){case N.I18N:return new bt(i,e,t,a,n);case N.CONTEXT:return new It(i,e,t,a,n);case N.SANITY:return new St(i,e,t,a,n);default:throw new Error("unsupported runner type")}};class Le{#e;constructor(e){this.#e=e}async start({verificationArea:e,staticLocators:t,useSmartSelector:a,description:n}){await Dt(this.#e,e,t,a,n).run()}}exports.CONFIG_FILE_NAME=C;exports.Config=c;exports.Executor=Le;exports.Logger=f;exports.Reports=l;exports.SYSTEM_TYPES=z;exports.checkAndExportConfig=yt;exports.getRootProjectMainDir=ve;exports.getRootProjectPackageJson=we;exports.joinPaths=g;exports.loadDependencies=ht;