forked from Alarisco/WPlace-AutoBOTV2-GuardBOT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAuto-Guard.js
More file actions
674 lines (651 loc) · 295 KB
/
Auto-Guard.js
File metadata and controls
674 lines (651 loc) · 295 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
/* WPlace AutoBOT — uso bajo tu responsabilidad. Compilado 2025-09-23T20:54:18.163Z */
/* eslint-env browser */
/* eslint-disable no-empty */
(()=>{var er=Object.defineProperty;var _=(o,e)=>()=>(o&&(e=o(o=0)),e);var Kt=(o,e)=>{for(var t in e)er(o,t,{get:e[t],enumerable:!0})};var d,D=_(()=>{d=(...o)=>console.log("[WPA-UI]",...o)});async function ct(o,{timeout:e=1e4,...t}={}){let n=new AbortController,r=setTimeout(()=>n.abort("timeout"),e);try{return await fetch(o,{signal:n.signal,...t})}catch(s){if(s.name==="AbortError"||s.message==="timeout"){let a=new Error(`Request timeout after ${e}ms`);throw a.name="TimeoutError",a.timeout=e,a}throw s}finally{clearTimeout(r)}}var lt=_(()=>{});function pt(o){O.setTurnstileToken(o),Oe=o,Qt=O.tokenExpiryTime}function Jt(){return O.isTokenValid()}function eo(){return O.getCachedToken()}async function Se(o=!1){let e=await O.ensureToken(o);return Oe=e,Qt=O.tokenExpiryTime,tr=O.tokenGenerationInProgress,or=O.currentGenerationPromise,e}function se(){let o=O.getProtectionTokens();return De=o.pawtect,o.pawtect}function ce(){let o=O.getProtectionTokens();return ae=o.fp,o.fp}async function to(o=5e3){return await O.waitForPawtect(o)}var ut,O,Oe,De,ae,dt,Qt,tr,or,Ue=_(()=>{D();ut=class{constructor(){this.turnstileToken=null,this.tokenExpiryTime=0,this.tokenGenerationInProgress=!1,this.currentGenerationPromise=null,this._resolveToken=null,this.tokenPromise=new Promise(e=>{this._resolveToken=e}),this.TOKEN_LIFETIME=24e4,this.MAX_RETRIES=10,this.INITIAL_TIMEOUT=15e3,this.RETRY_INTERVAL=5e3,this._turnstileWidgetId=null,this._turnstileContainer=null,this._turnstileOverlay=null,this._lastSitekey=null,this._cachedSitekey=null,this.turnstileLoaded=!1,this.widgetPool=[],this.poolQueue=[],this.poolSize=2,this.poolInitialized=!1,this.metrics={tokensGenerated:0,avgGenerationTime:0,failures:0,retries:0,poolHits:0,poolMisses:0,cacheHits:0,cacheMisses:0},this._pawtectToken=window.__WPA_PAWTECT_TOKEN__||null,this._fp=window.__WPA_FINGERPRINT__||null,this._fpCandidate=window.__WPA_FP_CANDIDATE__||null,this._pawtectResolve=null,this._pawtectPromise=new Promise(e=>{this._pawtectResolve=e})}setTurnstileToken(e){this._resolveToken&&(this._resolveToken(e),this._resolveToken=null),this.turnstileToken=e,this.tokenExpiryTime=Date.now()+this.TOKEN_LIFETIME,this.metrics.tokensGenerated++,d("\u2705 Turnstile token set successfully");try{typeof window!="undefined"&&typeof window.dispatchEvent=="function"&&typeof window.CustomEvent=="function"&&window.dispatchEvent(new window.CustomEvent("turnstile:token",{detail:{token:e,expiry:this.tokenExpiryTime}}))}catch{}}isTokenValid(){return this.turnstileToken&&Date.now()<this.tokenExpiryTime}getCachedToken(){return this.isTokenValid()?(this.metrics.cacheHits++,this.turnstileToken):(this.metrics.cacheMisses++,null)}invalidateToken(){this.turnstileToken=null,this.tokenExpiryTime=0,d("\u{1F5D1}\uFE0F Token invalidated, will force fresh generation")}async ensureToken(e=!1){let t=Date.now();if(this.isTokenValid()&&!e)return this.turnstileToken;if(e&&this.invalidateToken(),this.tokenGenerationInProgress&&this.currentGenerationPromise){d("\u{1F504} Token generation already in progress, waiting for existing promise...");try{let n=await this.currentGenerationPromise;return n&&n.length>20?n:this.isTokenValid()?this.turnstileToken:null}catch{}}return this.tokenGenerationInProgress=!0,this.currentGenerationPromise=(async()=>{try{d("\u{1F504} Token expired or missing, generating new one...");let n=await this.handleCaptcha();if(n&&n.length>20){this.setTurnstileToken(n);let s=Date.now()-t;return this.metrics.avgGenerationTime=(this.metrics.avgGenerationTime+s)/2,n}d("\u26A0\uFE0F Invisible Turnstile failed, forcing browser automation...");let r=await this.handleCaptchaFallback();if(r&&r.length>20){this.setTurnstileToken(r);let s=Date.now()-t;return this.metrics.avgGenerationTime=(this.metrics.avgGenerationTime+s)/2,r}return this.metrics.failures++,d("\u274C All token generation methods failed"),null}finally{this.tokenGenerationInProgress=!1,this.currentGenerationPromise=null}})(),this.currentGenerationPromise}async handleCaptcha(){let e=Date.now();try{let t=this.detectSitekey();d("\u{1F511} Generating Turnstile token for sitekey:",t),typeof window!="undefined"&&window.navigator&&d("\u{1F9ED} UA:",window.navigator.userAgent,"Platform:",window.navigator.platform);let n=await this.executeTurnstile(t,"paint");if(n&&n.length>20){let r=Math.round(Date.now()-e);return d(`\u2705 Turnstile token generated successfully in ${r}ms`),n}else throw new Error("Invalid or empty token received")}catch(t){let n=Math.round(Date.now()-e);throw d(`\u274C Turnstile token generation failed after ${n}ms:`,t),t}}async loadTurnstile(){return window.turnstile?(this.turnstileLoaded=!0,Promise.resolve()):new Promise((e,t)=>{if(document.querySelector('script[src^="https://challenges.cloudflare.com/turnstile/v0/api.js"]')){let r=()=>{window.turnstile?(this.turnstileLoaded=!0,e()):setTimeout(r,100)};return r()}let n=document.createElement("script");n.src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",n.async=!0,n.defer=!0,n.onload=()=>{this.turnstileLoaded=!0,d("\u2705 Turnstile script loaded successfully"),e()},n.onerror=()=>{d("\u274C Failed to load Turnstile script"),t(new Error("Failed to load Turnstile"))},document.head.appendChild(n)})}ensureTurnstileContainer(){return(!this._turnstileContainer||!document.body.contains(this._turnstileContainer))&&(this._turnstileContainer&&this._turnstileContainer.remove(),this._turnstileContainer=document.createElement("div"),this._turnstileContainer.style.cssText=`
position: fixed !important;
left: -9999px !important;
top: -9999px !important;
width: 300px !important;
height: 65px !important;
pointer-events: none !important;
opacity: 0 !important;
z-index: -1 !important;
`,this._turnstileContainer.setAttribute("aria-hidden","true"),this._turnstileContainer.id="turnstile-widget-container",document.body.appendChild(this._turnstileContainer)),this._turnstileContainer}ensureTurnstileOverlayContainer(){if(this._turnstileOverlay&&document.body.contains(this._turnstileOverlay))return this._turnstileOverlay;let e=document.createElement("div");e.id="turnstile-overlay-container",e.style.cssText=`
position: fixed;
right: 16px;
bottom: 16px;
width: 320px;
min-height: 80px;
background: rgba(0,0,0,0.7);
border: 1px solid rgba(255,255,255,0.2);
border-radius: 10px;
padding: 12px;
z-index: 100000;
backdrop-filter: blur(6px);
color: #fff;
box-shadow: 0 8px 24px rgba(0,0,0,0.4);
`;let t=document.createElement("div");t.textContent="Cloudflare Turnstile \u2014 please complete the check if shown",t.style.cssText='font: 600 12px/1.3 "Segoe UI",sans-serif; margin-bottom: 8px; opacity: 0.9;';let n=document.createElement("div");n.id="turnstile-overlay-host",n.style.cssText="width: 100%; min-height: 70px;";let r=document.createElement("button");return r.textContent="Hide",r.style.cssText="position:absolute; top:6px; right:6px; font-size:11px; background:transparent; color:#fff; border:1px solid rgba(255,255,255,0.2); border-radius:6px; padding:2px 6px; cursor:pointer;",r.addEventListener("click",()=>e.remove()),e.appendChild(t),e.appendChild(n),e.appendChild(r),document.body.appendChild(e),this._turnstileOverlay=e,e}async executeTurnstile(e,t="paint"){var a,l,c,p;if(await this.loadTurnstile(),this._turnstileWidgetId&&this._lastSitekey===e&&((a=window.turnstile)!=null&&a.execute))try{d("\u{1F504} Attempting to reuse existing Turnstile widget..."),(l=window.turnstile)!=null&&l.reset&&window.turnstile.reset(this._turnstileWidgetId);let u=await Promise.race([window.turnstile.execute(this._turnstileWidgetId,{action:t}),new Promise((h,g)=>setTimeout(()=>g(new Error("Execute timeout")),15e3))]);if(u&&u.length>20)return this._lastSitekey=e,d("\u2705 Widget reuse successful, token length:",u.length),u}catch(u){if(d("\u{1F504} Widget reuse failed, will create a fresh widget:",u.message),this._turnstileWidgetId&&((c=window.turnstile)!=null&&c.remove)){try{window.turnstile.remove(this._turnstileWidgetId)}catch{}this._turnstileWidgetId=null}}let n=await this.createNewTurnstileWidgetInvisible(e,t);if(n&&n.length>20)return n;d("\u{1F440} Falling back to interactive Turnstile (visible).");try{this.showUserNotificationTopCenter("\u{1F504} Resolviendo CAPTCHA...","info")}catch{}let r=1,s=!1;for(;;){let u=r===1?this.INITIAL_TIMEOUT:this.RETRY_INTERVAL;d(`\u{1F504} Intento ${r} de resoluci\xF3n del CAPTCHA (timeout: ${u/1e3}s)...`),r>1&&!s?(this.showUserNotification(`\u{1F504} CAPTCHA: Reintentando autom\xE1ticamente cada 5 segundos (intento ${r})`,"info"),s=!0):r>2&&this.showUserNotification(`\u{1F504} CAPTCHA: Intento ${r} - Continuando autom\xE1ticamente`,"info");try{if(this._turnstileWidgetId&&((p=window.turnstile)!=null&&p.remove)){try{window.turnstile.remove(this._turnstileWidgetId)}catch{}this._turnstileWidgetId=null}let h=await this.createNewTurnstileWidgetInteractiveWithRetry(e,t,!0,u);if(h&&h.length>20)return d(`\u2705 CAPTCHA resuelto exitosamente en el intento ${r}`),r>1&&this.showUserNotification("\u2705 CAPTCHA resuelto exitosamente","success"),h;d(`\u26A0\uFE0F Intento ${r} fall\xF3, reintentando en 5 segundos...`),r>1&&this.showUserNotification(`\u26A0\uFE0F Intento ${r} fall\xF3, reintentando en 5 segundos...`,"info"),await this.sleep(5e3)}catch(h){d(`\u274C Error en intento ${r}:`,h.message),r>1&&this.showUserNotification(`\u274C Error en intento ${r}, reintentando en 5 segundos`,"error"),await this.sleep(5e3)}r++,this.metrics.retries++}}async createNewTurnstileWidgetInvisible(e,t){return new Promise(n=>{var r;try{this._turnstileWidgetId&&((r=window.turnstile)!=null&&r.remove)&&window.turnstile.remove(this._turnstileWidgetId);let s=this.ensureTurnstileContainer();s.innerHTML="",this._turnstileWidgetId=window.turnstile.render(s,{sitekey:e,action:t,size:"compact",theme:"light",callback:a=>{this._lastSitekey=e,d("\u{1F3AF} Compact Turnstile callback success, token length:",a==null?void 0:a.length),n(a)},"error-callback":()=>{d("\u274C Compact Turnstile error callback"),n(null)},"timeout-callback":()=>{d("\u23F0 Compact Turnstile timeout callback"),n(null)},"expired-callback":()=>{d("\u{1F480} Compact Turnstile expired callback"),n(null)}}),setTimeout(()=>n(null),1e4)}catch(s){d("\u274C Error creating compact Turnstile widget:",s),n(null)}})}async createNewTurnstileWidgetInteractiveWithRetry(e,t,n=!0,r=3e4){return new Promise((s,a)=>{var l;try{this._turnstileWidgetId&&((l=window.turnstile)!=null&&l.remove)&&window.turnstile.remove(this._turnstileWidgetId);let c=this.ensureTurnstileOverlayContainer(),p=c.querySelector("#turnstile-overlay-host");p.innerHTML="",c.style.display="block",c.classList.remove("wplace-overlay-hidden"),this._turnstileWidgetId=window.turnstile.render(p,{sitekey:e,action:t,theme:"auto",callback:u=>{this._lastSitekey=e,d("\u{1F3AF} Interactive Turnstile callback success, token length:",u==null?void 0:u.length),c.style.display="none",s(u)},"error-callback":()=>{d("\u274C Interactive Turnstile error callback"),c.style.display="none",s(null)},"timeout-callback":()=>{d("\u23F0 Interactive Turnstile timeout callback"),c.style.display="none",s(null)},"expired-callback":()=>{d("\u{1F480} Interactive Turnstile expired callback"),c.style.display="none",s(null)}}),setTimeout(()=>{c.style.display="none",s(null)},r)}catch(c){d("\u274C Error creating interactive Turnstile widget:",c),s(null)}})}detectSitekey(e="0x4AAAAAABpqJe8FO0N84q0F"){var t;if(this._cachedSitekey)return this._cachedSitekey;try{let n=document.querySelector("[data-sitekey]");if(n){let a=n.dataset.sitekey||n.getAttribute("data-sitekey");if(a&&a.length>10)return d("\u{1F50D} Sitekey found in data attribute:",a),this._cachedSitekey=a,a}let r=document.querySelector(".cf-turnstile");if((t=r==null?void 0:r.dataset)!=null&&t.sitekey&&r.dataset.sitekey.length>10)return d("\u{1F50D} Sitekey found in turnstile element:",r.dataset.sitekey),this._cachedSitekey=r.dataset.sitekey,r.dataset.sitekey;if(typeof window!="undefined"&&window.__TURNSTILE_SITEKEY&&window.__TURNSTILE_SITEKEY.length>10)return d("\u{1F50D} Sitekey found in global variable:",window.__TURNSTILE_SITEKEY),this._cachedSitekey=window.__TURNSTILE_SITEKEY,window.__TURNSTILE_SITEKEY;let s=document.querySelectorAll("script");for(let a of s){let c=(a.textContent||a.innerHTML).match(/['"](0x4[A-Za-z0-9_-]{20,})['"]/);if(c&&c[1])return d("\u{1F50D} Sitekey found in script:",c[1]),this._cachedSitekey=c[1],c[1]}}catch(n){d("Error detecting sitekey:",n)}return d("\u{1F50D} Using fallback sitekey:",e),this._cachedSitekey=e,e}async handleCaptchaFallback(){return new Promise((e,t)=>{(async()=>{try{d("\u{1F504} Starting fallback automation flow..."),d("\u26A0\uFE0F Fallback automation not implemented in enhanced version"),e(null)}catch(r){d("\u274C Fallback automation failed:",r),e(null)}})()})}sleep(e){return new Promise(t=>setTimeout(t,e))}showUserNotification(e,t="info"){this.showUserNotificationTopCenter(e,t)}showUserNotificationTopCenter(e,t="info",n=3e3){let r=document.getElementById("wplace-toast-container");r||(r=document.createElement("div"),r.id="wplace-toast-container",r.style.cssText=`
position: fixed;
top: 16px;
left: 50%;
transform: translateX(-50%);
z-index: 2147483647;
display: flex;
flex-direction: column;
gap: 8px;
pointer-events: none;
`,document.body.appendChild(r));let s=t==="success"?"#10b981":t==="error"?"#ef4444":"#3b82f6",a=document.createElement("div");a.className="wplace-toast",a.textContent=e,a.style.cssText=`
min-width: 240px;
max-width: 80vw;
margin: 0 auto;
background: ${s};
color: white;
border-radius: 10px;
box-shadow: 0 8px 24px rgba(0,0,0,0.35);
padding: 10px 14px;
font-weight: 600;
letter-spacing: .2px;
transform: translateY(-10px) scale(0.98);
opacity: 0;
transition: transform .25s cubic-bezier(0.2, 0.8, 0.2, 1), opacity .25s ease;
pointer-events: auto;
`,r.appendChild(a),(p=>typeof window!="undefined"&&window.requestAnimationFrame?window.requestAnimationFrame(p):setTimeout(p,16))(()=>{a.style.transform="translateY(0) scale(1)",a.style.opacity="1"});let c=()=>{a.style.transform="translateY(-10px) scale(0.98)",a.style.opacity="0",setTimeout(()=>a.remove(),250)};n>0&&setTimeout(c,n),a.addEventListener("click",c)}getProtectionTokens(){return this._pawtectToken=window.__WPA_PAWTECT_TOKEN__||this._pawtectToken,this._fp=window.__WPA_FINGERPRINT__||this._fp,this._fpCandidate=window.__WPA_FP_CANDIDATE__||this._fpCandidate,{pawtect:this._pawtectToken,fp:this._fp,fpCandidate:this._fpCandidate}}async waitForPawtect(e=5e3){if(this._pawtectToken&&this._fp)return{pawtect:this._pawtectToken,fp:this._fp};let t=setTimeout(()=>{this._pawtectResolve&&this._pawtectResolve({pawtect:this._pawtectToken,fp:this._fp})},e),n=await this._pawtectPromise.catch(()=>({pawtect:this._pawtectToken,fp:this._fp}));return clearTimeout(t),this._pawtectResolve||(this._pawtectPromise=new Promise(r=>{this._pawtectResolve=r})),n}getMetrics(){let e=this.metrics.cacheHits/Math.max(1,this.metrics.cacheHits+this.metrics.cacheMisses),t=this.metrics.poolHits/Math.max(1,this.metrics.poolHits+this.metrics.poolMisses);return{...this.metrics,cacheHitRate:e,poolHitRate:t,failureRate:this.metrics.failures/Math.max(1,this.metrics.tokensGenerated+this.metrics.failures)}}},O=new ut,Oe=null,De=null,ae=null,dt=null,Qt=0,tr=!1,or=null;window.__WPA_SET_TURNSTILE_TOKEN__=function(o){o&&typeof o=="string"&&o.length>20&&(d("\u2705 Turnstile Token Captured:",o),pt(o))};window.addEventListener("message",o=>{var t;let e=o==null?void 0:o.data;if(e){if(e.source==="turnstile-capture"&&e.token){(!Jt()||Oe!==e.token)&&pt(e.token);return}if(e.__wplace===!0&&e.type==="token_found"){e.token&&(!Jt()||Oe!==e.token)&&pt(e.token),e.xpaw&&(!De||De!==e.xpaw)&&(De=e.xpaw,window.__WPA_PAWTECT_TOKEN__=e.xpaw,O._pawtectToken=e.xpaw,d("[turnstile] pawtect token updated:",e.xpaw.substring(0,20)+"...")),e.fp&&(!ae||ae!==e.fp)&&(ae=e.fp,window.__WPA_FINGERPRINT__=e.fp,O._fp=e.fp,d("[turnstile] fingerprint updated:",e.fp.substring(0,20)+"..."));return}try{let n=typeof e=="object"&&typeof e.fp=="string"&&e.fp.length>10?e.fp:null;n&&(!ae||ae!==n)&&(ae=n,window.__WPA_FINGERPRINT__=n,O._fp=n,d("[turnstile] fingerprint from message:",n.substring(0,20)+"..."))}catch{}try{let n=typeof e=="object"&&(e.pi||(t=e.payload)!=null&&t.pi)?e.pi||e.payload.pi:null;if(n&&typeof n=="object"&&(n.xp||n.pfp||n.ffp)){let r=JSON.stringify(n);(!dt||dt!==r)&&(dt=r,window.__WPA_FP_CANDIDATE__=r,O._fpCandidate=r,d("[turnstile] fp candidate from pi:",r.substring(0,50)+"..."))}}catch{}}})});function rr(){try{let o=document.createElement("canvas"),e=o.getContext("2d");return e?(o.width=200,o.height=40,e.textBaseline="top",e.font='14px "Arial"',e.fillStyle="#f60",e.fillRect(0,0,200,40),e.fillStyle="#069",e.fillText("wplace-fp-canvas",2,2),e.strokeStyle="#ff0",e.beginPath(),e.arc(100,20,18,0,Math.PI*2),e.stroke(),o.toDataURL().slice(0,64)):"nocanvas"}catch{return"nocanvas"}}function nr(){try{let o=document.createElement("canvas"),e=o.getContext("webgl")||o.getContext("experimental-webgl");if(!e)return"nowebgl";let t=e.getExtension("WEBGL_debug_renderer_info"),n=t?e.getParameter(t.UNMASKED_VENDOR_WEBGL):e.getParameter(e.VENDOR),r=t?e.getParameter(t.UNMASKED_RENDERER_WEBGL):e.getParameter(e.RENDERER);return n+"|"+r}catch{return"nowebgl"}}function ir(o){let e=2166136261;for(let t=0;t<o.length;t++)e^=o.charCodeAt(t),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return("00000000"+e.toString(16)).slice(-8)}async function ar(o){var e;if(typeof window!="undefined"&&((e=window.crypto)!=null&&e.subtle))try{let t=typeof window!="undefined"&&window.TextEncoder?window.TextEncoder:null,n=t?new t().encode(o):new Uint8Array([...unescape(encodeURIComponent(o))].map(s=>s.charCodeAt(0))),r=await window.crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(r)).map(s=>s.toString(16).padStart(2,"0")).join("")}catch{}return ir(o)}function sr(){let o=typeof window!="undefined"&&window.navigator?window.navigator:{},e=typeof window!="undefined"&&window.screen?window.screen:{},t=typeof Intl!="undefined"&&Intl.DateTimeFormat&&Intl.DateTimeFormat().resolvedOptions().timeZone||"";return{ua:o.userAgent||"",plat:o.platform||"",lang:(o.languages||[]).join(",")||o.language||"",cores:o.hardwareConcurrency||0,mem:o.deviceMemory||0,width:e.width||0,height:e.height||0,depth:e.colorDepth||0,tz:t,canvas:rr(),webgl:nr()}}async function qe({force:o=!1}={}){return ye&&!o?ye:Ae||(Ae=(async()=>{try{let e=sr(),t=Object.keys(e).sort().map(r=>r+":"+e[r]).join("|");ye="fp:"+(await ar(t)).slice(0,64);try{window.__WPA_FINGERPRINT__=ye}catch{}return d("[fp] generado len="+ye.length),ye}finally{Ae=null}})(),Ae)}var ye,Ae,gt=_(()=>{D();ye=null,Ae=null});async function oo(o,e={}){return await ft.computePawtect(o,e)}async function ro(){return await ft.seedPawtect()}var ht,ft,mt=_(()=>{D();ht=class{constructor(){this._wasmMod=null,this._wasm=null,this._chunkUrl=null,this._initUser=!1,this._busy=!1,this._cache=new Map,this.CACHE_TTL=12e4,this._cacheCleanupInterval=null,this.MAX_RETRIES=3,this.RETRY_DELAY_BASE=1e3,this.CHUNK_DISCOVERY_TIMEOUT=1e4,this.WASM_LOAD_TIMEOUT=15e3,this.metrics={computations:0,cacheHits:0,cacheMisses:0,errors:0,retries:0,avgComputeTime:0,wasmLoadTime:0,chunkDiscoveryTime:0},this.errorHistory=[],this.MAX_ERROR_HISTORY=50,this._initializeCacheCleanup(),d("[pawtect] Enhanced PawtectManager initialized")}_initializeCacheCleanup(){typeof window!="undefined"&&typeof window.setInterval=="function"&&(this._cacheCleanupInterval=window.setInterval(()=>{this._cleanupExpiredCache()},6e4))}_cleanupExpiredCache(){let e=Date.now(),t=0;for(let[n,r]of this._cache.entries())e-r.ts>this.CACHE_TTL&&(this._cache.delete(n),t++);t>0&&d(`[pawtect] Cleaned ${t} expired cache entries`)}_validateAndNormalizeInput(e){if(!e||typeof e!="object")throw new Error("Invalid bodyObj: must be a non-null object");try{return JSON.stringify(e,Object.keys(e).sort())}catch(t){throw d("[pawtect] Error serializing bodyObj:",t),new Error("Failed to serialize bodyObj to JSON")}}async _discoverChunkAdvanced(){if(this._chunkUrl)return this._chunkUrl;let e=Date.now();try{if(typeof document=="undefined")return null;let t=[()=>this._discoverFromScriptTags(),()=>this._discoverFromLinks(),()=>this._discoverFromPerformanceAPI()];for(let n of t)try{let r=await Promise.race([n(),new Promise((s,a)=>setTimeout(()=>a(new Error("Strategy timeout")),3e3))]);if(r)return this._chunkUrl=r,this.metrics.chunkDiscoveryTime=Date.now()-e,d("[pawtect] chunk encontrado con estrategia avanzada:",r),r}catch(r){d("[pawtect] strategy failed:",r.message)}}catch(t){d("[pawtect] chunk discovery failed:",t)}return this.metrics.chunkDiscoveryTime=Date.now()-e,null}async _discoverFromScriptTags(){var t;let e=new Set;try{(t=document.querySelectorAll("script[src]"))==null||t.forEach(n=>{try{typeof window!="undefined"&&window.URL&&window.location&&e.add(new window.URL(n.src,window.location.href).href)}catch{}})}catch{}return this._testUrlCandidates([...e])}async _discoverFromLinks(){var t;let e=new Set;try{(t=document.querySelectorAll('link[rel="modulepreload"][href],link[as="script"][href]'))==null||t.forEach(n=>{try{typeof window!="undefined"&&window.URL&&window.location&&e.add(new window.URL(n.href,window.location.href).href)}catch{}})}catch{}return this._testUrlCandidates([...e])}async _discoverFromPerformanceAPI(){let e=new Set;try{typeof window!="undefined"&&window.performance&&(window.performance.getEntriesByType("resource")||[]).forEach(t=>{t!=null&&t.name&&e.add(t.name)})}catch{}return this._testUrlCandidates([...e])}async _testUrlCandidates(e){let t=e.filter(n=>/\/(_app|assets)\/immutable\/chunks\/.*\.js/i.test(n));for(let n of t)try{let s=await(await Promise.race([fetch(n,{credentials:"omit"}),new Promise((a,l)=>setTimeout(()=>l(new Error("Fetch timeout")),5e3))])).text();if(/get_pawtected_endpoint_payload|pawtect/i.test(s))return n}catch(r){d("[pawtect] failed to test candidate:",n,r.message)}return null}async _loadWasmEnhanced(){if(this._wasm)return this._wasm;let e=Date.now();try{let t=await Promise.race([this._discoverChunkAdvanced(),new Promise((r,s)=>setTimeout(()=>s(new Error("Chunk discovery timeout")),this.CHUNK_DISCOVERY_TIMEOUT))]);if(!t)return d("[pawtect] no se encontr\xF3 chunk despu\xE9s de b\xFAsqueda avanzada"),null;let n=await Promise.race([import(t),new Promise((r,s)=>setTimeout(()=>s(new Error("WASM import timeout")),this.WASM_LOAD_TIMEOUT))]);if(typeof n._=="function")return this._wasmMod=n,this._wasm=await n._(),this.metrics.wasmLoadTime=Date.now()-e,d("[pawtect] wasm cargado exitosamente en",this.metrics.wasmLoadTime,"ms"),this._wasm;throw new Error("WASM module does not have expected interface")}catch(t){return this.metrics.wasmLoadTime=Date.now()-e,this._recordError("WASM load failed",t),d("[pawtect] error cargando wasm:",t.message),null}}_maybeInitUser(e){if(!(!this._wasmMod||this._initUser))try{if(e!=null&&e.id)if(typeof this._wasmMod.i=="function")this._wasmMod.i(e.id),this._initUser=!0,d("[pawtect] user initialized with function:",e.id);else if(typeof this._wasmMod.i=="object"&&this._wasmMod.i.constructor)try{new this._wasmMod.i(e.id),this._initUser=!0,d("[pawtect] user initialized with class:",e.id)}catch(t){d("[pawtect] class instantiation failed, trying alternative methods:",t.message),this._tryAlternativeUserInit(e)}else d("[pawtect] user initialization skipped - no valid method found")}catch(t){d("[pawtect] user initialization failed:",t.message)}}_tryAlternativeUserInit(e){try{this._wasmMod.initUser&&typeof this._wasmMod.initUser=="function"?(this._wasmMod.initUser(e.id),this._initUser=!0,d("[pawtect] user initialized with initUser:",e.id)):this._wasmMod.init&&typeof this._wasmMod.init=="function"?(this._wasmMod.init(e.id),this._initUser=!0,d("[pawtect] user initialized with init:",e.id)):(this._initUser=!0,d("[pawtect] user initialization skipped - marking as done to avoid retries"))}catch(t){this._initUser=!0,d("[pawtect] alternative user initialization failed:",t.message)}}async _getUserWithRetry(){for(let e=0;e<3;e++)try{let t=await Promise.race([fetch("https://backend.wplace.live/me",{credentials:"include"}),new Promise((n,r)=>setTimeout(()=>r(new Error("User fetch timeout")),5e3))]);if(t.ok)return await t.json()}catch(t){d(`[pawtect] user fetch attempt ${e+1} failed:`,t.message),e<2&&await new Promise(n=>setTimeout(n,1e3*(e+1)))}return null}_recordError(e,t){let n={timestamp:Date.now(),context:e,message:t.message,stack:t.stack};this.errorHistory.push(n),this.errorHistory.length>this.MAX_ERROR_HISTORY&&this.errorHistory.shift(),this.metrics.errors++}async computePawtect(e,{force:t=!1}={}){var r;let n=Date.now();try{let s=this._validateAndNormalizeInput(e),a=s,l=Date.now();if(!t&&this._cache.has(a)){let c=this._cache.get(a);if(l-c.ts<this.CACHE_TTL)return this.metrics.cacheHits++,d("[pawtect] cache hit, token length:",((r=c.token)==null?void 0:r.length)||0),c.token;this._cache.delete(a)}if(this.metrics.cacheMisses++,this._busy&&(await new Promise(c=>setTimeout(c,150+Math.random()*100)),!t&&this._cache.has(a))){let c=this._cache.get(a);if(l-c.ts<this.CACHE_TTL)return this.metrics.cacheHits++,c.token}return await this._computeWithRetry(s,a,n)}catch(s){this._recordError("computePawtect",s);let a=Date.now()-n;return d("[pawtect] computation failed after",a,"ms:",s.message),null}}async _computeWithRetry(e,t,n){let r=null;for(let s=0;s<this.MAX_RETRIES;s++){this._busy=!0;try{let a=await this._performComputation(e);if(a){this._cache.set(t,{token:a,ts:Date.now()});try{window.__WPA_PAWTECT_TOKEN__=a}catch{}this.metrics.computations++;let l=Date.now()-n;return this.metrics.avgComputeTime=(this.metrics.avgComputeTime*(this.metrics.computations-1)+l)/this.metrics.computations,d("[pawtect] token calculado exitosamente, len=",a.length,"duration=",l,"ms"),a}throw new Error("No token generated from WASM")}catch(a){if(r=a,this.metrics.retries++,d(`[pawtect] attempt ${s+1} failed:`,a.message),s<this.MAX_RETRIES-1){let l=this.RETRY_DELAY_BASE*Math.pow(2,s);d(`[pawtect] retrying in ${l}ms...`),await new Promise(c=>setTimeout(c,l))}}finally{this._busy=!1}}return this._recordError("All computation attempts failed",r),null}async _performComputation(e){let t=await this._loadWasmEnhanced();if(!t||typeof t.get_pawtected_endpoint_payload!="function")throw new Error("WASM not available or missing function");if(!this._initUser){let c=await this._getUserWithRetry();this._maybeInitUser(c)}let n=typeof window!="undefined"&&window.TextEncoder?new window.TextEncoder:{encode:c=>new Uint8Array([...unescape(encodeURIComponent(c))].map(p=>p.charCodeAt(0)))},r=typeof window!="undefined"&&window.TextDecoder?new window.TextDecoder:{decode:c=>decodeURIComponent(escape(String.fromCharCode(...c)))},s=c=>{if(!c)return null;if(typeof c=="string")return c;if(Array.isArray(c)&&c.length>=2){let[p,u]=c,h=new Uint8Array(t.memory.buffer,p,u),g=r.decode(h);try{t.__wbindgen_free&&(t.__wbindgen_free.length>=2?t.__wbindgen_free(p,u):t.__wbindgen_free(p))}catch{}return g}if(typeof c=="object"&&typeof c.ptr=="number"&&typeof c.len=="number"){let p=new Uint8Array(t.memory.buffer,c.ptr,c.len),u=r.decode(p);try{t.__wbindgen_free&&(t.__wbindgen_free.length>=2?t.__wbindgen_free(c.ptr,c.len):t.__wbindgen_free(c.ptr))}catch{}return u}return null};try{let c=t.get_pawtected_endpoint_payload(e),p=s(c);if(p&&typeof p=="string"&&p.length>0)return p}catch{}let a=n.encode(e),l=null;try{if(typeof t.__wbindgen_malloc=="function")try{l=t.__wbindgen_malloc(a.length)}catch{l=t.__wbindgen_malloc(a.length,1)}if(!l||typeof l!="number"||l<=0)throw new Error("Failed to allocate WASM memory");let c=l+a.length;if(c>t.memory.buffer.byteLength&&typeof t.memory.grow=="function"){let g=c-t.memory.buffer.byteLength,f=Math.ceil(g/65536);if(f>0)try{t.memory.grow(f)}catch{}}new Uint8Array(t.memory.buffer,l,a.length).set(a);let p=t.get_pawtected_endpoint_payload(l,a.length);return s(p)}catch(c){throw new Error(`WASM computation failed: ${c.message}`)}finally{if(l)try{typeof t.__wbindgen_free=="function"&&(t.__wbindgen_free.length>=2?t.__wbindgen_free(l,a.length):t.__wbindgen_free(l))}catch{}}}async seedPawtect(){try{d("[pawtect] seeding computation..."),await this.computePawtect({colors:[0],coords:[1,1],t:"seed",fp:"seed"},{force:!0}),d("[pawtect] seed computation completed")}catch(e){d("[pawtect] seed computation failed:",e)}}getMetrics(){let e=this._cache.size,t=this.metrics.cacheHits/Math.max(1,this.metrics.cacheHits+this.metrics.cacheMisses),n=this.metrics.errors/Math.max(1,this.metrics.computations+this.metrics.errors);return{...this.metrics,cacheSize:e,cacheHitRate:t,errorRate:n,recentErrors:this.errorHistory.slice(-5)}}clearCache(){let e=this._cache.size;this._cache.clear(),d(`[pawtect] cache cleared, removed ${e} entries`)}cleanup(){this._cacheCleanupInterval&&typeof window!="undefined"&&typeof window.clearInterval=="function"&&(window.clearInterval(this._cacheCleanupInterval),this._cacheCleanupInterval=null),this._cache.clear(),this._wasm=null,this._wasmMod=null,this._chunkUrl=null,d("[pawtect] cleanup completed")}},ft=new ht;typeof window!="undefined"&&typeof window.setTimeout=="function"&&window.setTimeout(()=>{ft.seedPawtect()},1e3)});async function Ye(o){if(!o)return{ok:!1,status:0,json:{},text:"",parseError:"no-response"};let e=o.status,t="";try{t=await o.text()}catch(n){return{ok:o.ok,status:e,json:{},text:"",parseError:n.message}}if(!t)return{ok:o.ok,status:e,json:{},text:""};try{let n=JSON.parse(t);return{ok:o.ok,status:e,json:n,text:t}}catch(n){return{ok:o.ok,status:e,json:{},text:t,parseError:n.message}}}var no=_(()=>{});async function ke(){var o,e,t,n;try{let r=await fetch(`${Xe}/me`,{credentials:"include"}).then(p=>p.json()),s=r||null,a=(r==null?void 0:r.charges)||{},l=(o=r==null?void 0:r.droplets)!=null?o:0,c={count:(e=a.count)!=null?e:0,max:(t=a.max)!=null?t:0,cooldownMs:(n=a.cooldownMs)!=null?n:3e4};return{success:!0,data:{user:s,charges:c.count,maxCharges:c.max,chargeRegen:c.cooldownMs,droplets:l}}}catch(r){return{success:!1,error:r.message,data:{user:null,charges:0,maxCharges:0,chargeRegen:3e4,droplets:0}}}}async function io(o,e,t,n,r){var s,a,l;try{let c=y=>{if(!Array.isArray(y))return[];let P=[];if(y.length>0&&typeof y[0]=="number"){for(let v=0;v<y.length;v+=2){let I=Math.trunc(y[v]),S=Math.trunc(y[v+1]);Number.isFinite(I)&&Number.isFinite(S)&&P.push((I%1e3+1e3)%1e3,(S%1e3+1e3)%1e3)}return P}if(typeof y[0]=="object"&&y[0]&&("x"in y[0]||"y"in y[0])){for(let v of y){let I=Math.trunc(v==null?void 0:v.x),S=Math.trunc(v==null?void 0:v.y);Number.isFinite(I)&&Number.isFinite(S)&&P.push((I%1e3+1e3)%1e3,(S%1e3+1e3)%1e3)}return P}if(Array.isArray(y[0])){for(let v of y){let I=Math.trunc(v==null?void 0:v[0]),S=Math.trunc(v==null?void 0:v[1]);Number.isFinite(I)&&Number.isFinite(S)&&P.push((I%1e3+1e3)%1e3,(S%1e3+1e3)%1e3)}return P}return P},p=y=>Array.isArray(y)?y.map(P=>Math.trunc(Number(P))||0):[],u=c(t),h=p(n);if(u.length===0||h.length===0||u.length/2!==h.length)return d(`[API] Invalid coords/colors for tile ${o},${e} \u2192 coordsPairs=${u.length/2} colors=${h.length}`),{status:400,json:{error:"Invalid coords/colors format"},success:!1,painted:0};let g=ce();if(!g)try{g=await qe({})}catch{}let f=null;try{let y={colors:n,coords:t,t:r||"seed",...g?{fp:g}:{fp:"seed"}},P=await oo(y);P?f=P:f=se()}catch{f=se()}if(!g){try{await to(1200)}catch{}g=ce()}let m=JSON.stringify({colors:h,coords:u,t:r,...g?{fp:g}:{}}),x="";try{let y=2166136261;for(let P=0;P<m.length;P++)y^=m.charCodeAt(P),y=Math.imul(y,16777619);x=("00000000"+(y>>>0).toString(16)).slice(-8)}catch{}d(`[API] Sending batch to tile ${o},${e} with ${n.length} pixels, token: ${r?r.substring(0,50)+"...":"null"}`),d(`[API] postPixelBatchImage include: pawtect=${!!f} fp=${!!g} bodyHash=${x}`);let w=await fetch(`${Xe}/s0/pixel/${o}/${e}`,{method:"POST",credentials:"include",headers:{"Content-Type":"text/plain;charset=UTF-8",...f?{"x-pawtect-token":f}:{}},body:m});if(d(`[API] Response: ${w.status} ${w.statusText}`),w.status===403){try{await w.json()}catch{}console.error("\u274C 403 Forbidden. Turnstile token might be invalid or expired.");try{console.log("\u{1F504} Regenerating Turnstile token after 403...");let y=await Se(!0);if(f=se(),g=ce(),!y)return{status:403,json:{error:"Could not generate new token"},success:!1,painted:0};let P=JSON.stringify({colors:h,coords:u,t:y,...g?{fp:g}:{}});d(`[API] Retrying with fresh token: ${y.substring(0,50)}...`);let v=await fetch(`${Xe}/s0/pixel/${o}/${e}`,{method:"POST",credentials:"include",headers:{"Content-Type":"text/plain;charset=UTF-8",...f?{"x-pawtect-token":f}:{}},body:P});if(d(`[API] Retry response: ${v.status} ${v.statusText}`),v.status===403)return{status:403,json:{error:"Fresh token still expired or invalid after retry"},success:!1,painted:0};let I=await Ye(v),S=((s=I.json)==null?void 0:s.painted)||0;return d(`[API] Retry result: ${S} pixels painted`),{status:v.status,json:I.json,success:v.ok,painted:S}}catch(y){return console.error("\u274C Token regeneration failed:",y),{status:403,json:{error:"Token regeneration failed: "+y.message},success:!1,painted:0}}}if(w.status>=500&&w.status<=504)try{let y=await Se(!0);f=se(),g=ce();let P=JSON.stringify({colors:h,coords:u,t:y,...g?{fp:g}:{}});d(`[API] Retrying after ${w.status} with fresh token: ${y.substring(0,50)}...`);let v=await fetch(`${Xe}/s0/pixel/${o}/${e}`,{method:"POST",credentials:"include",headers:{"Content-Type":"text/plain;charset=UTF-8",...f?{"x-pawtect-token":f}:{}},body:P}),I=await Ye(v),S=((a=I.json)==null?void 0:a.painted)||0;return d(`[API] Retry after ${w.status}: ${S} pixels painted`),{status:v.status,json:I.json,success:v.ok,painted:S}}catch{}let b=await Ye(w),C=((l=b.json)==null?void 0:l.painted)||0;return d(`[API] Success: ${C} pixels painted`),{status:w.status,json:b.json,success:w.ok,painted:C}}catch(c){return c.name==="AbortError"||c.name==="TimeoutError"?(d(`[API] Request timeout for tile ${o},${e}`),{status:408,json:{error:"Request timeout"},success:!1,painted:0}):(d(`[API] Network error: ${c.message}`),{status:0,json:{error:c.message},success:!1,painted:0})}}var Xe,je=_(()=>{lt();Ue();gt();mt();D();no();Xe="https://backend.wplace.live"});var E,i,te=_(()=>{E={SITEKEY:"0x4AAAAAABpqJe8FO0N84q0F",COOLDOWN_DEFAULT:31e3,TILE_SIZE:1e3,CHECK_INTERVAL:1e4,MAX_PROTECTION_SIZE:1/0,PIXELS_PER_BATCH:10,MAX_PIXELS_PER_BATCH:9999,MIN_CHARGES_TO_WAIT:20,BACKEND_URL:"https://backend.wplace.live",PROTECTION_PATTERN:"random"},i={running:!1,initialized:!1,protectionArea:null,originalPixels:new Map,changes:new Map,currentCharges:0,maxCharges:50,lastCheck:0,checkInterval:null,availableColors:[],colorsChecked:!1,ui:null,totalRepaired:0,pixelsPerBatch:E.PIXELS_PER_BATCH,minChargesToWait:E.MIN_CHARGES_TO_WAIT,protectionPattern:E.PROTECTION_PATTERN,operationMode:"protect",preferColor:!1,preferredColorId:null,preferredColorIds:[],excludeColor:!1,excludedColorIds:[],spendAllPixelsOnStart:!1,randomWaitTime:!1,randomWaitMin:5,randomWaitMax:15,watchMode:!1,protectTransparentPixels:!0,protectPerimeter:!1,perimeterWidth:1,config:{colorComparisonMethod:"lab",colorThreshold:10}}});var oe,yt=_(()=>{oe=o=>new Promise(e=>setTimeout(e,o))});function cr(o,e){let t=Array.from(o),n=[],r=[...t];for(let s=0;s<Math.min(e,r.length);s++){let a=Math.floor(Math.random()*r.length);n.push(r.splice(a,1)[0])}return n}function lr(o,e){let t=Array.from(o);if(t.length===0)return[];let n=new Map;t.forEach(a=>{let[l,c]=a.split(",").map(Number);n.has(c)||n.set(c,[]),n.get(c).push(a)});let r=[],s=Array.from(n.keys()).sort((a,l)=>a-l);for(let a of s){if(r.length>=e)break;let l=n.get(a).sort((c,p)=>{let[u]=c.split(",").map(Number),[h]=p.split(",").map(Number);return u-h});for(let c of l){if(r.length>=e)break;r.push(c)}}return r.slice(0,e)}function dr(o,e){let t=Array.from(o);if(t.length===0)return[];let n=new Map;t.forEach(a=>{let[l,c]=a.split(",").map(Number);n.has(c)||n.set(c,[]),n.get(c).push(a)});let r=[],s=Array.from(n.keys()).sort((a,l)=>l-a);for(let a of s){if(r.length>=e)break;let l=n.get(a).sort((c,p)=>{let[u]=c.split(",").map(Number),[h]=p.split(",").map(Number);return u-h});for(let c of l){if(r.length>=e)break;r.push(c)}}return r.slice(0,e)}function ur(o,e){let t=Array.from(o);if(t.length===0)return[];let n=new Map;t.forEach(a=>{let[l,c]=a.split(",").map(Number);n.has(l)||n.set(l,[]),n.get(l).push(a)});let r=[],s=Array.from(n.keys()).sort((a,l)=>a-l);for(let a of s){if(r.length>=e)break;let l=n.get(a).sort((c,p)=>{let[,u]=c.split(",").map(Number),[,h]=p.split(",").map(Number);return u-h});for(let c of l){if(r.length>=e)break;r.push(c)}}return r.slice(0,e)}function pr(o,e){let t=Array.from(o);if(t.length===0)return[];let n=new Map;t.forEach(a=>{let[l,c]=a.split(",").map(Number);n.has(l)||n.set(l,[]),n.get(l).push(a)});let r=[],s=Array.from(n.keys()).sort((a,l)=>l-a);for(let a of s){if(r.length>=e)break;let l=n.get(a).sort((c,p)=>{let[,u]=c.split(",").map(Number),[,h]=p.split(",").map(Number);return u-h});for(let c of l){if(r.length>=e)break;r.push(c)}}return r.slice(0,e)}function gr(o,e){let t=Array.from(o);if(t.length===0)return[];let n=1/0,r=-1/0,s=1/0,a=-1/0;t.forEach(u=>{let[h,g]=u.split(",").map(Number);n=Math.min(n,h),r=Math.max(r,h),s=Math.min(s,g),a=Math.max(a,g)});let l=new Map;t.forEach(u=>{let[h,g]=u.split(",").map(Number),f=h-n,m=r-h,x=g-s,w=a-g,b=Math.min(f,m,x,w);l.has(b)||l.set(b,[]),l.get(b).push(u)});let c=[],p=Array.from(l.keys()).sort((u,h)=>u-h);for(let u of p){if(c.length>=e)break;let h=l.get(u);for(let g of h){if(c.length>=e)break;c.push(g)}}return c.slice(0,e)}function hr(o,e){var u;let t=Array.from(o);if(t.length===0)return[];let n=1/0,r=-1/0,s=1/0,a=-1/0;t.forEach(h=>{let[g,f]=h.split(",").map(Number);n=Math.min(n,g),r=Math.max(r,g),s=Math.min(s,f),a=Math.max(a,f)});let l,c;(u=i)!=null&&u.protectionArea&&typeof i.protectionArea.x1=="number"&&typeof i.protectionArea.x2=="number"&&typeof i.protectionArea.y1=="number"&&typeof i.protectionArea.y2=="number"?(l=(i.protectionArea.x1+i.protectionArea.x2)/2,c=(i.protectionArea.y1+i.protectionArea.y2)/2):(l=(n+r)/2,c=(s+a)/2);let p=t.map(h=>{let[g,f]=h.split(",").map(Number),m=Math.sqrt(Math.pow(g-l,2)+Math.pow(f-c,2));return{coord:h,distance:m}});return p.sort((h,g)=>h.distance-g.distance),p.slice(0,e).map(h=>h.coord)}function fr(o,e){let t=Array.from(o);if(t.length===0)return[];let n=1/0,r=-1/0,s=1/0,a=-1/0;t.forEach(y=>{let[P,v]=y.split(",").map(Number);n=Math.min(n,P),r=Math.max(r,P),s=Math.min(s,v),a=Math.max(a,v)});let l=Math.round((n+r)/2),c=Math.round((s+a)/2),p=new Set(t),u=[],h=l,g=c,f=0,m=-1,x=1,w=0,b=0,C=`${l},${c}`;for(p.has(C)&&(u.push(C),p.delete(C));u.length<e&&p.size>0;){h+=f,g+=m;let y=`${h},${g}`;if(p.has(y)&&(u.push(y),p.delete(y)),w++,w===x&&(w=0,f===0&&m===-1?(f=1,m=0):f===1&&m===0?(f=0,m=1):f===0&&m===1?(f=-1,m=0):f===-1&&m===0&&(f=0,m=-1),b=(b+1)%4,b%2===0&&x++),Math.abs(h-l)>100||Math.abs(g-c)>100)break}if(u.length<e&&p.size>0){let y=Array.from(p),P=Math.min(e-u.length,y.length);for(let v=0;v<P;v++){let I=Math.floor(Math.random()*y.length);u.push(y.splice(I,1)[0])}}return u.slice(0,e)}function mr(o,e){let t=Array.from(o);if(t.length===0)return[];let n=new Map;t.forEach(l=>{let[c,p]=l.split(",").map(Number);n.has(p)||n.set(p,[]),n.get(p).push(l)});let r=[],s=Array.from(n.keys()).sort((l,c)=>l-c),a=!0;for(let l of s){if(r.length>=e)break;let c=n.get(l).sort((p,u)=>{let[h]=p.split(",").map(Number),[g]=u.split(",").map(Number);return a?h-g:g-h});for(let p of c){if(r.length>=e)break;r.push(p)}a=!a}return r.slice(0,e)}function yr(o,e){let t=Array.from(o);if(t.length===0)return[];let n=t.map(r=>{let[s,a]=r.split(",").map(Number);return{coord:r,diagonal:s+a,x:s,y:a}});return n.sort((r,s)=>r.diagonal!==s.diagonal?r.diagonal-s.diagonal:r.x-s.x),n.slice(0,e).map(r=>r.coord)}function xr(o,e){let t=Array.from(o);if(t.length===0)return[];let n=[],r=new Set(t);for(;n.length<e&&r.size>0;){let s=Array.from(r),a=s[Math.floor(Math.random()*s.length)],[l,c]=a.split(",").map(Number),p=3+Math.floor(Math.random()*3),u=[];for(let g of r){let[f,m]=g.split(",").map(Number);Math.sqrt(Math.pow(f-l,2)+Math.pow(m-c,2))<=p&&u.push(g)}let h=Math.min(u.length,Math.min(5,e-n.length));for(let g=0;g<h;g++){let f=Math.floor(Math.random()*u.length),m=u.splice(f,1)[0];n.push(m),r.delete(m)}}return n.slice(0,e)}function wr(o,e){let t=Array.from(o);if(t.length===0)return[];let n=1/0,r=-1/0;t.forEach(a=>{let[l]=a.split(",").map(Number);n=Math.min(n,l),r=Math.max(r,l)});let s=t.map(a=>{let[l,c]=a.split(",").map(Number),p=(l-n)/(r-n||1),u=Math.sin(p*Math.PI*2)*10,h=Math.abs(c-u);return{coord:a,distance:h,x:l}});return s.sort((a,l)=>Math.abs(a.distance-l.distance)<2?a.x-l.x:a.distance-l.distance),s.slice(0,e).map(a=>a.coord)}function br(o,e){let t=Array.from(o);if(t.length===0)return[];let n=1/0,r=-1/0,s=1/0,a=-1/0;t.forEach(p=>{let[u,h]=p.split(",").map(Number);n=Math.min(n,u),r=Math.max(r,u),s=Math.min(s,h),a=Math.max(a,h)});let l=[[n,s],[r,s],[n,a],[r,a]],c=t.map(p=>{let[u,h]=p.split(",").map(Number),g=1/0;for(let[f,m]of l){let x=Math.sqrt(Math.pow(u-f,2)+Math.pow(h-m,2));g=Math.min(g,x)}return{coord:p,distance:g}});return c.sort((p,u)=>p.distance-u.distance),c.slice(0,e).map(p=>p.coord)}function Cr(o,e){let t=Array.from(o);if(t.length===0)return[];let n=new Map;t.forEach(a=>{let[l,c]=a.split(",").map(Number),p=Math.floor(l/8),u=Math.floor(c/8),h=`${p},${u}`;n.has(h)||n.set(h,[]),n.get(h).push(a)});let r=[],s=Array.from(n.keys());for(let a of s){if(r.length>=e)break;let l=n.get(a),c=Math.min(l.length,e-r.length);for(let p=0;p<c;p++)r.push(l[p])}return r.slice(0,e)}function vr(o,e){let t=Array.from(o);if(t.length===0)return[];let n=1/0,r=-1/0,s=1/0,a=-1/0;t.forEach(u=>{let[h,g]=u.split(",").map(Number);n=Math.min(n,h),r=Math.max(r,h),s=Math.min(s,g),a=Math.max(a,g)});let l=(n+r)/2,c=(s+a)/2,p=t.map(u=>{let[h,g]=u.split(",").map(Number),f=Math.sqrt(Math.pow(h-l,2)+Math.pow(g-c,2)),m=Math.min(h-n,r-h,g-s,a-g),x=Math.random()*.3,w=f*.4-m*.3+x;return{coord:u,priority:w}});return p.sort((u,h)=>u.priority-h.priority),p.slice(0,e).map(u=>u.coord)}function Pr(o,e){let t=Array.from(o);if(t.length===0)return[];let n=[],r=new Set(t),s=t[Math.floor(Math.random()*t.length)];for(n.push(s),r.delete(s);n.length<e&&r.size>0;){let[a,l]=s.split(",").map(Number),c=null,p=1/0;for(let u of r){let[h,g]=u.split(",").map(Number),f=Math.sqrt(Math.pow(h-a,2)+Math.pow(g-l,2));f<p&&(p=f,c=u)}if(c)n.push(c),r.delete(c),s=c;else break}return n.slice(0,e)}function Er(o,e){let t=Array.from(o);if(t.length===0)return[];let n=1/0,r=-1/0,s=1/0,a=-1/0;t.forEach(f=>{let[m,x]=f.split(",").map(Number);n=Math.min(n,m),r=Math.max(r,m),s=Math.min(s,x),a=Math.max(a,x)});let l=(n+r)/2,c=(s+a)/2,p=[[],[],[],[]];t.forEach(f=>{let[m,x]=f.split(",").map(Number);m<=l&&x<=c?p[0].push(f):m>l&&x<=c?p[1].push(f):m<=l&&x>c?p[2].push(f):p[3].push(f)});let u=[],h=0,g=[0,0,0,0];for(;u.length<e;){let f=p[h],m=g[h];if(m<f.length&&(u.push(f[m]),g[h]++),h=(h+1)%4,g.every((x,w)=>x>=p[w].length))break}return u.slice(0,e)}function Ir(o,e){let t=Array.from(o);if(t.length===0)return[];let n=[],r=[...t];for(;n.length<e&&r.length>0;){let s=null,a=-1,l=-1;for(let c=0;c<r.length;c++){let p=r[c],[u,h]=p.split(",").map(Number),g=1/0;for(let x of n){let[w,b]=x.split(",").map(Number),C=Math.sqrt(Math.pow(u-w,2)+Math.pow(h-b,2));g=Math.min(g,C)}let f=Math.random()*.5,m=g+f;m>a&&(a=m,s=p,l=c)}if(s)n.push(s),r.splice(l,1);else break}return n.slice(0,e)}function Ge(o,e,t,n=!1,r=null,s=null,a=!1,l=null){d(`\u{1F3AF} Aplicando patr\xF3n ${o} para ${t} p\xEDxeles de ${e.size} cambios detectados`);let c,p=e instanceof Map?Array.from(e.keys()):Array.from(e);switch(o){case"lineUp":c=lr(p,t);break;case"lineDown":c=dr(p,t);break;case"lineLeft":c=ur(p,t);break;case"lineRight":c=pr(p,t);break;case"center":c=hr(p,t);break;case"borders":c=gr(p,t);break;case"spiral":c=fr(p,t);break;case"zigzag":c=mr(p,t);break;case"diagonal":c=yr(p,t);break;case"cluster":c=xr(p,t);break;case"wave":c=wr(p,t);break;case"corners":c=br(p,t);break;case"sweep":c=Cr(p,t);break;case"priority":c=vr(p,t);break;case"proximity":c=Pr(p,t);break;case"quadrant":c=Er(p,t);break;case"scattered":c=Ir(p,t);break;case"snake":c=Ar(p,t);break;case"diagonalSweep":c=kr(p,t);break;case"spiralClockwise":c=ao(p,t,!0);break;case"spiralCounterClockwise":c=ao(p,t,!1);break;case"biasedRandom":c=_r(p,t);break;case"anchorPoints":c=Lr(p,t);break;case"random":default:c=cr(p,t);break}if(n&&e instanceof Map){let u=Array.isArray(s)&&s.length>0?s:r!==null?[r]:[];u.length>0&&(c=Tr(c,e,u,t))}if(a&&e instanceof Map){let u=Array.isArray(l)&&l.length>0?l:[];u.length>0&&(c=Sr(c,e,u))}return c}function Tr(o,e,t,n){let r=[],s=[];for(let l of o){let c=e.get(l);c&&c.original&&(Array.isArray(t)?t.includes(c.original.colorId):c.original.colorId===t)?r.push(l):s.push(l)}let a=[];if(r.length>0){let l=r.slice(0,Math.min(n,r.length));a.push(...l)}if(a.length<n&&s.length>0){let l=n-a.length,c=s.slice(0,l);a.push(...c)}return d(`\u{1F3A8} Priorizaci\xF3n de color: ${r.length} preferidos disponibles, rellenando hasta ${n}. Seleccionados: ${a.length}`),a}function Sr(o,e,t){let n=[],r=0;for(let s of o){let a=e.get(s);a&&a.original&&t.includes(a.original.colorId)?r++:n.push(s)}return r>0&&d(`\u{1F6AB} Exclusi\xF3n de colores: ${r} p\xEDxeles excluidos, ${n.length} p\xEDxeles seleccionados`),n}function Ar(o,e){let t=Array.from(o);if(t.length===0)return[];let n={};for(let a of t){let[l,c]=a.split(",").map(Number);n[c]||(n[c]=[]),n[c].push({coord:a,x:l,y:c})}let r=Object.keys(n).map(Number).sort((a,l)=>a-l),s=[];for(let a=0;a<r.length&&s.length<e;a++){let l=r[a],c=n[l];a%2===0?c.sort((p,u)=>p.x-u.x):c.sort((p,u)=>u.x-p.x);for(let p of c){if(s.length>=e)break;s.push(p.coord)}}return s.slice(0,e)}function kr(o,e){let t=Array.from(o);if(t.length===0)return[];let n={};for(let a of t){let[l,c]=a.split(",").map(Number),p=l+c;n[p]||(n[p]=[]),n[p].push({coord:a,x:l,y:c})}let r=Object.keys(n).map(Number).sort((a,l)=>a-l),s=[];for(let a of r){if(s.length>=e)break;let l=n[a];l.sort((c,p)=>c.x-p.x);for(let c of l){if(s.length>=e)break;s.push(c.coord)}}return s.slice(0,e)}function ao(o,e,t=!0){let n=Array.from(o);if(n.length===0)return[];let r=1/0,s=-1/0,a=1/0,l=-1/0,c=n.map(h=>{let[g,f]=h.split(",").map(Number);return r=Math.min(r,g),s=Math.max(s,g),a=Math.min(a,f),l=Math.max(l,f),{coord:h,x:g,y:f}}),p=(r+s)/2,u=(a+l)/2;return c.forEach(h=>{let g=h.x-p,f=h.y-u;h.distance=Math.sqrt(g*g+f*f),h.angle=Math.atan2(f,g),t||(h.angle=-h.angle)}),c.sort((h,g)=>{let f=h.distance-g.distance;return Math.abs(f)<1?h.angle-g.angle:f}),c.slice(0,e).map(h=>h.coord)}function _r(o,e){let t=Array.from(o);if(t.length===0)return[];let n=1/0,r=-1/0,s=1/0,a=-1/0;for(let u of t){let[h,g]=u.split(",").map(Number);n=Math.min(n,h),r=Math.max(r,h),s=Math.min(s,g),a=Math.max(a,g)}let l=t.map(u=>{let[h,g]=u.split(",").map(Number),f=h-n,m=r-h,x=g-s,w=a-g,C=1/(Math.min(f,m,x,w)+1)+Math.random()*.5;return{coord:u,weight:C}});l.sort((u,h)=>h.weight-u.weight);let c=[],p=[...l];for(;c.length<e&&p.length>0;){let u=p.reduce((f,m)=>f+m.weight,0),h=Math.random()*u,g=0;for(let f=0;f<p.length;f++)if(h-=p[f].weight,h<=0){g=f;break}c.push(p[g].coord),p.splice(g,1)}return c.slice(0,e)}function Lr(o,e){let t=Array.from(o);if(t.length===0)return[];let n=1/0,r=-1/0,s=1/0,a=-1/0,l=t.map(h=>{let[g,f]=h.split(",").map(Number);return n=Math.min(n,g),r=Math.max(r,g),s=Math.min(s,f),a=Math.max(a,f),{coord:h,x:g,y:f}}),c=(n+r)/2,p=(s+a)/2,u=[{x:n,y:s,priority:1},{x:r,y:s,priority:1},{x:n,y:a,priority:1},{x:r,y:a,priority:1},{x:c,y:p,priority:2},{x:c,y:s,priority:3},{x:c,y:a,priority:3},{x:n,y:p,priority:3},{x:r,y:p,priority:3}];return l.forEach(h=>{let g=1/0,f=10;for(let m of u){let x=Math.sqrt(Math.pow(h.x-m.x,2)+Math.pow(h.y-m.y,2));x<g&&(g=x,f=m.priority)}h.priority=f,h.distanceToAnchor=g}),l.sort((h,g)=>h.priority!==g.priority?h.priority-g.priority:h.distanceToAnchor-g.distanceToAnchor),l.slice(0,e).map(h=>h.coord)}var so=_(()=>{D();te()});function Mr(){var o;try{if(typeof window=="undefined"||!globalThis.URLSearchParams)return{};let e=new globalThis.URLSearchParams(((o=globalThis.location)==null?void 0:o.search)||""),t=e.get("metricsEnabled"),n=e.get("metricsUrl"),r=e.get("metricsKey"),s=e.get("metricsSalt"),a=e.get("metricsVariant"),l=e.get("metricsTimeoutMs"),c=e.get("metricsRetries"),p=e.get("metricsPingMs"),u={};return t!=null&&(u.ENABLED=t==="true"||t==="1"),n&&(u.BASE_URL=n),r&&(u.API_KEY=r),s&&(u.PUBLIC_SALT=s),a&&(u.VARIANT=a),l&&!Number.isNaN(Number(l))&&(u.TIMEOUT_MS=Number(l)),c&&!Number.isNaN(Number(c))&&(u.RETRIES=Number(c)),p&&!Number.isNaN(Number(p))&&(u.PING_INTERVAL_MS=Number(p)),u}catch{return{}}}function Rr(){var t;let o=typeof window!="undefined"&&(window.__WPLACE_METRICS__||((t=window.__WPLACE_CONFIG__)==null?void 0:t.metrics))||{},e={};return typeof o.ENABLED=="boolean"&&(e.ENABLED=o.ENABLED),typeof o.BASE_URL=="string"&&(e.BASE_URL=o.BASE_URL),typeof o.API_KEY=="string"&&(e.API_KEY=o.API_KEY),typeof o.PUBLIC_SALT=="string"&&(e.PUBLIC_SALT=o.PUBLIC_SALT),typeof o.VARIANT=="string"&&(e.VARIANT=o.VARIANT),Number.isFinite(o.TIMEOUT_MS)&&(e.TIMEOUT_MS=o.TIMEOUT_MS),Number.isFinite(o.RETRIES)&&(e.RETRIES=o.RETRIES),Number.isFinite(o.PING_INTERVAL_MS)&&(e.PING_INTERVAL_MS=o.PING_INTERVAL_MS),e}function $r(o){let e={...o};return typeof e.BASE_URL=="string"&&(e.BASE_URL=e.BASE_URL.replace(/\/$/,"")),["auto-guard","auto-farm","auto-image","launcher"].includes(e.VARIANT)||(e.VARIANT=co.VARIANT),e}function q(o={}){let e={...co,...Rr(),...Mr(),...o};return xt=$r(e),xt}async function zr(o){let e=globalThis.TextEncoder,t=globalThis.crypto;if(!e||!(t!=null&&t.subtle))throw new Error("WebCrypto no disponible");let n=new e,r=await t.subtle.digest("SHA-256",n.encode(o));return Array.from(new Uint8Array(r)).map(s=>s.toString(16).padStart(2,"0")).join("")}async function lo(o,e){let t=xt||q(),n=typeof e=="string"?e:t.PUBLIC_SALT;return!n||!o?null:zr(String(n)+String(o))}function uo(){var o,e,t;try{if(typeof window=="undefined")return null;if((o=window.__WPLACE_METRICS__)!=null&&o.anonId)return String(window.__WPLACE_METRICS__.anonId);let n="wplace_metrics_aid",r=null;try{r=localStorage.getItem(n)}catch{}if(r&&typeof r=="string")return r;let s=new Uint8Array(16);(t=(e=globalThis.crypto||{}).getRandomValues)==null||t.call(e,s);let a=Array.from(s).map(l=>l.toString(16).padStart(2,"0")).join("");try{localStorage.setItem(n,a)}catch{}return window.__WPLACE_METRICS__||(window.__WPLACE_METRICS__={}),window.__WPLACE_METRICS__.anonId=a,a}catch{return null}}var co,xt,He=_(()=>{co=Object.freeze({ENABLED:!0,BASE_URL:"https://metricswplaceapi.alarisco.xyz",API_KEY:"wplace_2c8e4b2b1e0a4f7cb9d3a76f4a1c0b6f",PUBLIC_SALT:"wplace_public_salt_2024",VARIANT:"auto-guard",TIMEOUT_MS:1e4,RETRIES:1,PING_INTERVAL_MS:12e4});xt=null});async function Br(o,e,{timeout:t,apiKey:n}){let r={"Content-Type":"application/json"};return n&&(r["X-API-Key"]=n),await ct(o,{method:"POST",headers:r,body:JSON.stringify(e),timeout:t})}function po(o){return o.text().then(e=>{try{return e?JSON.parse(e):{}}catch{return{}}})}async function Nr(o,e){let t=q(e);if(!t.ENABLED)return{ok:!1,skipped:!0};let n=`${t.BASE_URL}/v1/events`;try{let a=o==null?void 0:o.event_type,l=o==null?void 0:o.bot_variant;(a==="pixel_painted"||a==="pixel_repaired")&&typeof(o==null?void 0:o.pixel_delta)!="undefined"&&d(`[METRICS] ${a} \u2192 \u0394 ${o.pixel_delta} (${l})`)}catch{}let r=0,s=null;for(;r<=t.RETRIES;)try{let a=await Br(n,o,{timeout:t.TIMEOUT_MS,apiKey:t.API_KEY});if(!a.ok){let c=await po(a);return{ok:!1,status:a.status,data:c}}let l=await po(a);try{let c=o==null?void 0:o.event_type,p=o==null?void 0:o.bot_variant;c==="session_start"&&d(`[METRICS] session_start (${p})`)}catch{}return{ok:!0,data:l}}catch(a){if(s=a,r++,r>t.RETRIES)break;await new Promise(l=>setTimeout(l,300*r))}return{ok:!1,error:(s==null?void 0:s.message)||String(s)}}async function xe({botVariant:o,eventType:e,pixelDelta:t,timestamp:n,metadata:r}={},s){let a=q(s);if(!a.ENABLED)return{ok:!1,skipped:!0};let l={};l.bot_variant=o||a.VARIANT,l.event_type=e,typeof t=="number"&&(l.pixel_delta=t),n&&(l.timestamp=n),r&&typeof r=="object"&&(l.event_metadata=r);let c=uo();if(c){let p=await lo(c);p&&(l.user_hash=await p)}return Nr(l,s)}async function go({botVariant:o,metadata:e}={},t){return xe({botVariant:o,eventType:"session_start",metadata:e},t)}async function Ve({botVariant:o,metadata:e}={},t){return xe({botVariant:o,eventType:"session_ping",metadata:e},t)}async function wt({botVariant:o,metadata:e}={},t){return xe({botVariant:o,eventType:"session_end",metadata:e},t)}async function ho(o,{botVariant:e,metadata:t}={},n){return!Number.isFinite(o)||o<=0?{ok:!1,skipped:!0}:xe({botVariant:e,eventType:"pixel_repaired",pixelDelta:Math.trunc(o),metadata:t},n)}async function bt(o,{botVariant:e,metadata:t}={},n){let r={message:o,...t||{}};return xe({botVariant:e,eventType:"error",metadata:r},n)}async function N(o,{botVariant:e,metadata:t,timestamp:n}={},r){return o?xe({botVariant:e,eventType:o,metadata:t,timestamp:n},r):{ok:!1,skipped:!0}}var Ct=_(()=>{lt();He();D()});var Co={};Kt(Co,{analyzeAreaForErasing:()=>bo,analyzeAreaPixels:()=>Q,calculateDeltaE:()=>_e,checkForChanges:()=>pe,detectAvailableColors:()=>ue,findClosestColor:()=>Lt,getTileImage:()=>_t,repairChanges:()=>Qe,rgbToLab:()=>ne,startChargeMonitoring:()=>et,startIndependentChargeMonitoring:()=>At,stopChargeMonitoring:()=>St,stopIndependentChargeMonitoring:()=>kt});function Et(){re&&window.clearInterval(re),re=window.setInterval(()=>{let o=Date.now(),e=Math.max(0,Math.ceil((Ke-o)/1e3));i.ui&&i.ui.updateCountdown(e),e<=0&&(window.clearInterval(re),re=null)},1e3)}function Tt(){re&&(window.clearInterval(re),re=null),i.ui&&i.ui.showCountdown(!1)}function et(){if(le){d("\u{1F504} Monitoreo de cargas ya est\xE1 activo");return}d("\u{1F504} Iniciando monitoreo de cargas cada 30 segundos..."),de&&d("\u23F8\uFE0F Pausando contador independiente - bot iniciado"),le=window.setInterval(async()=>{try{let o=await ke();if(o.success){let e=Math.floor(o.data.charges);i.currentCharges=o.data.charges,i.maxCharges=o.data.maxCharges,H=o.data.charges,we=Date.now(),i.ui&&i.ui.updateStats({charges:e}),i.changes.size>0&&i.running&&!Ze&&e>=i.minChargesToWait&&(d(`\u{1F504} Cargas detectadas: ${e}. Continuando reparaci\xF3n autom\xE1ticamente...`),Tt(),await Qe(i.changes))}}catch(o){d(`Error en monitoreo de cargas: ${o.message}`)}},yo)}function St(){le&&(window.clearInterval(le),le=null,d("\u{1F504} Monitoreo de cargas detenido"),de&&d("\u25B6\uFE0F Reanudando contador independiente - bot detenido")),Tt()}function At(){if(de){d("\u{1F504} Monitoreo independiente de cargas ya est\xE1 activo");return}d("\u{1F504} Iniciando monitoreo independiente de cargas cada 30 segundos...");let o=async()=>{try{if(le){d("\u{1F504} Bot activo detectado, saltando inicializaci\xF3n independiente");return}let t=await ke();if(t.success){H=t.data.charges,i.currentCharges=H,i.maxCharges=t.data.maxCharges,we=Date.now();let n=Math.floor(H);i.ui&&i.ui.updateStats({charges:n}),d(`\u{1F50B} Cargas iniciales obtenidas: ${n}/${i.maxCharges}`)}}catch(t){d(`Error obteniendo cargas iniciales: ${t.message}`)}},e=()=>{try{if(le)return;if(we&&H<i.maxCharges){let t=Date.now(),n=t-we,r=Math.floor(n/3e4);if(r>0){H=Math.min(H+r,i.maxCharges),i.currentCharges=H,we=t;let s=Math.floor(H);i.ui&&i.ui.updateStats({charges:s}),(!vt||t-vt>3e5)&&(d(`\u{1F50B} Cargas calculadas actualizadas: ${s}/${i.maxCharges}`),vt=t)}}}catch(t){d(`Error actualizando cargas calculadas: ${t.message}`)}};o(),de=window.setInterval(e,yo)}function kt(){de&&(window.clearInterval(de),de=null,we=null,H=0,d("\u{1F504} Monitoreo independiente de cargas detenido"))}function Wr(o,e,t){o=o/255,e=e/255,t=t/255,o=o>.04045?Math.pow((o+.055)/1.055,2.4):o/12.92,e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92;let n=o*.4124564+e*.3575761+t*.1804375,r=o*.2126729+e*.7151522+t*.072175,s=o*.0193339+e*.119192+t*.9503041;return{x:n,y:r,z:s}}function Fr(o,e,t){o=o/.95047,e=e/1,t=t/1.08883;let a=o>.008856?Math.pow(o,1/3):7.787*o+16/116,l=e>.008856?Math.pow(e,1/3):7.787*e+16/116,c=t>.008856?Math.pow(t,1/3):7.787*t+16/116,p=116*l-16,u=500*(a-l),h=200*(l-c);return{l:p,a:u,b:h}}function ne(o,e,t){let n=Wr(o,e,t);return Fr(n.x,n.y,n.z)}function _e(o,e){let t=o.l-e.l,n=o.a-e.a,r=o.b-e.b;return Math.sqrt(t*t+n*n+r*r)}function xo(o,e,t="rgb",n=10){if(t==="lab"){let r=ne(o.r,o.g,o.b),s=ne(e.r,e.g,e.b);return _e(r,s)>n/2}else{let r=Math.abs(o.r-e.r),s=Math.abs(o.g-e.g),a=Math.abs(o.b-e.b);return Math.max(r,s,a)>n}}async function _t(o,e){try{let t=`${E.BACKEND_URL}/files/s0/tiles/${o}/${e}.png`,n=await fetch(t);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.blob()}catch(t){return d(`Error obteniendo tile ${o},${e}:`,t),null}}function ue(){d("\u{1F3A8} Detectando colores disponibles...");let o=document.querySelectorAll('[id^="color-"]'),e=[];e.push({id:0,r:0,g:0,b:0,element:null});for(let t of o){if(t.querySelector("svg"))continue;let n=parseInt(t.id.replace("color-",""));if(n===0)continue;let r=t.style.backgroundColor;if(r){let s=r.match(/\d+/g);s&&s.length>=3&&e.push({id:n,r:parseInt(s[0]),g:parseInt(s[1]),b:parseInt(s[2]),element:t})}}return d(`\u2705 ${e.length} colores detectados (incluyendo transparente)`),e}function Lt(o,e,t,n){if(!n||n.length===0)return null;let r=ne(o,e,t),s=1/0,a=null;for(let l of n){let c=ne(l.r,l.g,l.b),p=_e(r,c);p<s&&(s=p,a=l)}return a}async function Q(o,e={}){let{allowVirtual:t=!1}=e,{x1:n,y1:r,x2:s,y2:a}=o,l=s-n+1,c=a-r+1;if(d(`\u{1F50D} Analizando \xE1rea ${l}x${c} desde (${n},${r}) hasta (${s},${a})`),!i.availableColors||i.availableColors.length===0){let m=ue();if(m.length>0)i.availableColors=m,d(`\u{1F3A8} Colores detectados para an\xE1lisis: ${m.length}`);else return d("\u26A0\uFE0F Sin colores disponibles para an\xE1lisis. Omitiendo an\xE1lisis para evitar falsos positivos."),new Map}let p=new Map,u=Math.floor(n/E.TILE_SIZE),h=Math.floor(r/E.TILE_SIZE),g=Math.floor(s/E.TILE_SIZE),f=Math.floor(a/E.TILE_SIZE);for(let m=h;m<=f;m++)for(let x=u;x<=g;x++)try{let w=await _t(x,m);if(!w){d(`\u26A0\uFE0F No se pudo obtener tile ${x},${m}, continuando...`);continue}let b=new wo,C=document.createElement("canvas"),y=C.getContext("2d");await new Promise((W,F)=>{b.onload=W,b.onerror=F,b.src=Je.createObjectURL(w)}),C.width=b.width,C.height=b.height,y.drawImage(b,0,0);let v=y.getImageData(0,0,C.width,C.height).data,I=x*E.TILE_SIZE,S=m*E.TILE_SIZE,L=I+E.TILE_SIZE,A=S+E.TILE_SIZE,$=s+1,M=a+1,k=Math.max(n,I),z=Math.max(r,S),Ie=Math.min($,L),G=Math.min(M,A);for(let W=z;W<G;W++)for(let F=k;F<Ie;F++){let fe=F-I,Fe=W-S,K=(fe%1e3+1e3)%1e3,J=(Fe%1e3+1e3)%1e3;if(K>=0&&K<E.TILE_SIZE&&J>=0&&J<E.TILE_SIZE&&K<C.width&&J<C.height){let Te=(J*C.width+K)*4,me=v[Te],Ht=v[Te+1],Vt=v[Te+2];if(v[Te+3]>0){let Zt=Lt(me,Ht,Vt,i.availableColors);Zt&&p.set(`${F},${W}`,{r:me,g:Ht,b:Vt,colorId:Zt.id,globalX:F,globalY:W,localX:K,localY:J,tileX:x,tileY:m})}else p.set(`${F},${W}`,{r:0,g:0,b:0,colorId:0,globalX:F,globalY:W,localX:K,localY:J,tileX:x,tileY:m})}}Je.revokeObjectURL(b.src)}catch(w){d(`\u274C Error analizando tile ${x},${m}:`,w)}if(d(`\u2705 An\xE1lisis completado: ${p.size} p\xEDxeles protegidos`),p.size===0)if(t){d("\u26A0\uFE0F No se encontraron p\xEDxeles existentes, creando \xE1rea virtual para protecci\xF3n");let m=s+1,x=a+1;for(let w=r;w<x;w++)for(let b=n;b<m;b++){let C=Math.floor(b/E.TILE_SIZE),y=Math.floor(w/E.TILE_SIZE),P=b-C*E.TILE_SIZE,v=w-y*E.TILE_SIZE,I=(P%1e3+1e3)%1e3,S=(v%1e3+1e3)%1e3;p.set(`${b},${w}`,{r:255,g:255,b:255,colorId:5,globalX:b,globalY:w,localX:I,localY:S,tileX:C,tileY:y})}d(`\u2705 \xC1rea virtual creada: ${p.size} p\xEDxeles para proteger`)}else d("\u2139\uFE0F An\xE1lisis vac\xEDo y fallback virtual deshabilitado (modo verificaci\xF3n)");return p}async function bo(o){let{x1:e,y1:t,x2:n,y2:r}=o;d(`\u{1F5D1}\uFE0F Analizando \xE1rea para borrado: (${e},${t}) a (${n},${r})`);let s=new Map,a=Math.floor(e/E.TILE_SIZE),l=Math.floor(t/E.TILE_SIZE),c=Math.floor(n/E.TILE_SIZE),p=Math.floor(r/E.TILE_SIZE);for(let u=l;u<=p;u++)for(let h=a;h<=c;h++)try{let g=await _t(h,u);if(!g){d(`\u26A0\uFE0F No se pudo obtener tile ${h},${u}, continuando...`);continue}let f=new wo,m=document.createElement("canvas"),x=m.getContext("2d");await new Promise((k,z)=>{f.onload=k,f.onerror=z,f.src=Je.createObjectURL(g)}),m.width=f.width,m.height=f.height,x.drawImage(f,0,0);let b=x.getImageData(0,0,m.width,m.height).data,C=h*E.TILE_SIZE,y=u*E.TILE_SIZE,P=C+E.TILE_SIZE,v=y+E.TILE_SIZE,I=n+1,S=r+1,L=Math.max(e,C),A=Math.max(t,y),$=Math.min(I,P),M=Math.min(S,v);for(let k=A;k<M;k++)for(let z=L;z<$;z++){let Ie=z-C,G=k-y,W=(Ie%1e3+1e3)%1e3,F=(G%1e3+1e3)%1e3;if(W>=0&&W<E.TILE_SIZE&&F>=0&&F<E.TILE_SIZE&&W<m.width&&F<m.height){let fe=(F*m.width+W)*4,Fe=b[fe],K=b[fe+1],J=b[fe+2];if(b[fe+3]>0){let me=Lt(Fe,K,J,i.availableColors);me&&me.id!==0&&s.set(`${z},${k}`,{r:Fe,g:K,b:J,colorId:me.id,globalX:z,globalY:k,localX:W,localY:F,tileX:h,tileY:u})}}}Je.revokeObjectURL(f.src)}catch(g){d(`\u274C Error analizando tile ${h},${u} para borrado:`,g)}return d(`\u{1F5D1}\uFE0F An\xE1lisis para borrado completado: ${s.size} p\xEDxeles no transparentes encontrados`),s}async function Dr(o){let e=new Map;if(!i.protectTransparentPixels)return e;let t=await Q(o);for(let[n,r]of i.originalPixels)if(r.colorId===0){let s=t.get(n);s&&s.colorId!==0&&e.set(n,{original:r,current:s,targetColorId:0,type:"transparent_damaged"})}return d(`\u{1FAE5} An\xE1lisis de p\xEDxeles transparentes: ${e.size} p\xEDxeles transparentes da\xF1ados encontrados`),e}function Or(o){if(!i.protectPerimeter||i.perimeterWidth<=0)return null;let e=i.perimeterWidth;return{x1:o.x1-e,y1:o.y1-e,x2:o.x2+e,y2:o.y2+e,tileX:o.tileX,tileY:o.tileY}}async function Ur(o){let e=new Map;if(!i.protectPerimeter)return e;let t=Or(o);if(!t)return e;let n=await Q(t);for(let[r,s]of n){let[a,l]=r.split(",").map(Number);(a<o.x1||a>o.x2||l<o.y1||l>o.y2)&&s.colorId!==0&&e.set(r,{original:null,current:s,targetColorId:0,type:"perimeter_intrusion"})}return d(`\u{1F6E1}\uFE0F An\xE1lisis de per\xEDmetro: ${e.size} intrusiones en per\xEDmetro encontradas`),e}function fo(o,e){var l,c;if(!i.ui||!i.ui.updateAnalysisStats)return;let t=o.size,n=0,r=0,s=0;if(t===0){i.ui.updateAnalysisStats({correct:0,incorrect:0,missing:0,accuracy:0});return}for(let[p,u]of o){let h=e.get(p);if(!h)s++;else{let g=((l=i.config)==null?void 0:l.colorComparisonMethod)||"rgb",f=((c=i.config)==null?void 0:c.colorThreshold)||10;xo(h,u,g,f)?r++:n++}}let a=t>0?(n/t*100).toFixed(1):0;i.ui.updateAnalysisStats({correct:n,incorrect:r,missing:s,accuracy:a})}async function pe(){var o,e;if(!(!i.protectionArea||!i.originalPixels.size))try{if(i.operationMode==="erase"){let s=await bo(i.protectionArea);if(s.size===0){i.lastCheck=Date.now(),i.ui&&(i.ui.updateStatus("\u2705 \xC1rea completamente borrada - todos los p\xEDxeles son transparentes","success"),i.ui.updateProgress(0,i.originalPixels.size,!1));return}let a=new Map;for(let[l,c]of s)a.set(l,{timestamp:Date.now(),type:"erase",original:c,current:c,targetColorId:0});d(`\u{1F5D1}\uFE0F Detectados ${s.size} p\xEDxeles no transparentes para borrar`),i.changes=a,i.ui&&(i.ui.updateStatus(`\u{1F5D1}\uFE0F ${s.size} p\xEDxeles no transparentes detectados`,"warning"),i.ui.updateProgress(s.size,i.originalPixels.size,!1)),i.running&&!i.watchMode&&await Qe(a);return}let t=await Q(i.protectionArea);if(!t||t.size===0)if(i.isVirtualArea){i.lastCheck=Date.now(),i.ui&&i.ui.updateStatus("\u2705 \xC1rea protegida - sin cambios (\xE1rea virtual vac\xEDa)","success");return}else d("\u{1F6A8} P\xEDxeles originales detectados pero an\xE1lisis actual vac\xEDo - p\xEDxeles fueron borrados");let n=new Map,r=0;if(i.isVirtualArea&&t&&t.size>0)for(let[s,a]of t)n.set(s,{timestamp:Date.now(),type:"intrusion",original:null,current:a}),r++;else for(let[s,a]of i.originalPixels){let l=t.get(s);if(!(!i.protectTransparentPixels&&(a==null?void 0:a.colorId)===0))if(!l)n.set(s,{timestamp:Date.now(),type:"deleted",original:a,current:null}),r++;else{let c=!1;if(l.colorId!==a.colorId){let p=((o=i.config)==null?void 0:o.colorComparisonMethod)||"rgb",u=((e=i.config)==null?void 0:e.colorThreshold)||10;c=xo(l,a,p,u)}c&&(n.set(s,{timestamp:Date.now(),type:"changed",original:a,current:l}),r++)}}if(i.protectTransparentPixels||i.protectPerimeter){if(i.protectTransparentPixels){let s=await Dr(i.protectionArea);for(let[a,l]of s)n.has(a)||(n.set(a,{timestamp:Date.now(),type:"transparent_repair",original:l.original,current:l.current,targetColorId:0}),r++)}if(i.protectPerimeter){let s=await Ur(i.protectionArea);for(let[a,l]of s)n.has(a)||(n.set(a,{timestamp:Date.now(),type:"perimeter_clear",original:l.original,current:l.current,targetColorId:0}),r++)}}if(r>0){d(`\u{1F6A8} Detectados ${r} cambios en el \xE1rea protegida`),i.changes=n,i.ui&&(i.ui.updateStatus(`\u{1F6A8} ${r} cambios detectados`,"warning"),i.ui.updateProgress(n.size,i.originalPixels.size,i.isVirtualArea),fo(i.originalPixels,t));try{let s=0,a=0;for(let l of n.values())l.type==="deleted"?a++:s++;mo({total:i.originalPixels.size,incorrect:s,missing:a})}catch{}i.running&&!i.watchMode?await Qe(n):i.watchMode&&(d(`\u{1F441}\uFE0F Modo Vig\xEDa: ${n.size} cambios detectados (sin reparar)`),i.ui&&i.ui.updateStatus(`\u{1F441}\uFE0F Vig\xEDa: ${n.size} cambios detectados`,"warning"))}else{i.lastCheck=Date.now(),i.ui&&(i.ui.updateStatus("\u2705 \xC1rea protegida - sin cambios","success"),i.ui.updateProgress(0,i.originalPixels.size,i.isVirtualArea),fo(i.originalPixels,t));try{mo({total:i.originalPixels.size,incorrect:0,missing:0})}catch{}}}catch(t){d("\u274C Error verificando cambios:",t),i.ui&&i.ui.updateStatus(`\u274C Error verificando: ${t.message}`,"error")}}async function Qe(o){if(o.size!==0){if(Ze){d("\u{1F504} Reparaci\xF3n ya en progreso, omitiendo llamada duplicada");return}Ze=!0;try{let e=Array.from(o.values()),t=Math.floor(i.currentCharges),n;if(i.spendAllPixelsOnStart&&i.totalRepaired===0){let f=Math.min(5,i.minChargesToWait),m=Math.max(0,t-f);n=Math.min(e.length,m,E.MAX_PIXELS_PER_BATCH),d(`\u26A1 Primer batch - gastando ${n} p\xEDxeles de ${m} cargas gastables (${t} total, ${f} m\xEDnimo de seguridad)`)}else{let f=e.length,m=i.pixelsPerBatch;if(f>0&&f<m){let x=Math.max(0,t-i.minChargesToWait);if(x>=f)n=f,d(`\u{1F3AF} P\xEDxeles restantes: gastando solo ${n} p\xEDxeles de ${x} cargas gastables (${t} total, ${i.minChargesToWait} m\xEDnimo)`);else{let w=i.minChargesToWait+f;if(d(`\u26A0\uFE0F Cargas insuficientes para p\xEDxeles restantes: ${t}/${w} (necesita ${f} + ${i.minChargesToWait} m\xEDnimo). Esperando m\xE1s cargas...`),i.ui){i.ui.updateStatus(`\u23F3 Esperando ${w} cargas para p\xEDxeles restantes (${t} actuales, m\xEDnimo ${i.minChargesToWait})`,"warning");let C=(w-t)*Pt;Ke=Date.now()+C,Et()}return}}else{let x=Math.max(0,t-i.minChargesToWait),w=i.pixelsPerBatch;if(x<w){let b=i.minChargesToWait+w;if(d(`\u26A0\uFE0F Cargas insuficientes para lote completo: ${t}/${b} (necesita ${w} + ${i.minChargesToWait} m\xEDnimo). Esperando m\xE1s cargas...`),i.ui){i.ui.updateStatus(`\u23F3 Esperando ${b} cargas para continuar (${t} actuales, m\xEDnimo ${i.minChargesToWait})`,"warning");let y=(b-t)*Pt;Ke=Date.now()+y,Et()}try{N("repair_wait",{botVariant:"auto-guard",metadata:{available:t,minToWait:i.minChargesToWait,required:w}})}catch{}return}n=Math.min(e.length,i.pixelsPerBatch,x)}}d(`\u{1F6E0}\uFE0F Cargas: ${t}, M\xEDnimo: ${i.minChargesToWait}, Reparando: ${n} p\xEDxeles`),i.ui&&i.ui.updateStatus(`\u{1F6E0}\uFE0F Reparando ${n} p\xEDxeles...`,"info");let s=Ge(i.protectionPattern,o,n,i.preferColor,i.preferredColorId,i.preferredColorIds,i.excludeColor,i.excludedColorIds),a=0;for(;s.length<n&&a<3;)a++,s=Ge(i.protectionPattern,o,n,i.preferColor,i.preferredColorId,i.preferredColorIds,i.excludeColor,i.excludedColorIds),s.length<n&&(d(`\u{1F501} Reintentando completar lote (${s.length}/${n}) intento ${a}/3`),await oe(100));if(s.length>0){let f=new Map;for(let m of s){let x=o.get(m),w=(x==null?void 0:x.type)==="intrusion"?x==null?void 0:x.current:x==null?void 0:x.original;if(!w)continue;let b=`${w.tileX},${w.tileY}`;f.has(b)||f.set(b,[]),f.get(b).push(m)}if(f.size>1){let m=null,x=-1;for(let[b,C]of f)C.length>x&&(x=C.length,m=b);let w=f.get(m)||[];if(w.length<n){let[b,C]=m.split(",").map(Number),y=new Map;for(let[P,v]of o){let I=(v==null?void 0:v.type)==="intrusion"?v==null?void 0:v.current:v==null?void 0:v.original;I&&I.tileX===b&&I.tileY===C&&y.set(P,v)}if(y.size>0){let P=Ge(i.protectionPattern,y,n,i.preferColor,i.preferredColorId,i.preferredColorIds,i.excludeColor,i.excludedColorIds),v=new Set(w);for(let I of P)if(!v.has(I)&&(w.push(I),v.add(I),w.length>=n))break}d(`\u{1F4E6} Concentrando lote en tile (${b},${C}): ${w.length}/${n} p\xEDxeles`)}s=w}}let l=s.map(f=>o.get(f)),c=new Map;for(let f of l){let m,x;f.type==="intrusion"?(m=f.current,x=5):f.type==="erase"||f.type==="transparent_repair"?(m=f.original,x=0):f.type==="perimeter_clear"?(m=f.current,x=0):(m=f.original,x=f.original.colorId);let w=Number.isFinite(m==null?void 0:m.tileX)?m.tileX:Math.floor(m.globalX/E.TILE_SIZE),b=Number.isFinite(m==null?void 0:m.tileY)?m.tileY:Math.floor(m.globalY/E.TILE_SIZE),C=Number.isFinite(m==null?void 0:m.localX)?m.localX:m.globalX-w*E.TILE_SIZE,y=Number.isFinite(m==null?void 0:m.localY)?m.localY:m.globalY-b*E.TILE_SIZE,P=(Number(C)%1e3+1e3)%1e3,v=(Number(y)%1e3+1e3)%1e3;d(`\u{1F527} Reparando p\xEDxel en (${m.globalX}, ${m.globalY}) tile(${w}, ${b}) local(${P}, ${v})`);let I=`${w},${b}`;c.has(I)||c.set(I,[]),c.get(I).push({localX:P,localY:v,colorId:x,globalX:m.globalX,globalY:m.globalY,changeType:f.type})}let p=0,u=Array.from(c.entries());u.length>1&&(u.sort((f,m)=>m[1].length-f[1].length),u=[u[0]]);for(let[f,m]of u){let[x,w]=f.split(",").map(Number);try{let b=[],C=[],y=[...m].sort((v,I)=>v.localY-I.localY||v.localX-I.localX);for(let v of y)b.push(v.localX,v.localY),C.push(v.colorId);let P=await qr(x,w,b,C);if(P.success&&P.painted>0){p+=P.painted,i.currentCharges=Math.max(0,i.currentCharges-P.painted),i.totalRepaired+=P.painted;for(let v=0;v<P.painted&&v<m.length;v++){let I=m[v],S=`${I.globalX},${I.globalY}`;i.changes.delete(S)}d(`\u2705 Reparados ${P.painted} p\xEDxeles en tile (${x},${w})`);try{q({VARIANT:"auto-guard"}).ENABLED&&ho(P.painted,{botVariant:"auto-guard",metadata:{tileX:x,tileY:w,batchSize:m.length,pendingAfter:i.changes.size}})}catch{}}else{d(`\u274C Error reparando tile (${x},${w}):`,P.error);try{q().ENABLED&&P.error&&bt(`repair tile ${x},${w}: ${P.error}`,{botVariant:"auto-guard"})}catch{}}}catch(b){d(`\u274C Error reparando tile (${x},${w}):`,b);try{q().ENABLED&&(b!=null&&b.message)&&bt(`exception tile ${x},${w}: ${b.message}`,{botVariant:"auto-guard"})}catch{}}if(c.size>1)if(i.randomWaitTime){let b=Math.random()*(i.randomWaitMax-i.randomWaitMin)+i.randomWaitMin;d(`\u23F0 Esperando ${b.toFixed(1)} segundos (aleatorio) antes del siguiente lote`),await oe(b*1e3)}else await oe(500)}let h=Math.floor(i.currentCharges),g=i.changes.size;if(d(`\u{1F6E0}\uFE0F Reparaci\xF3n completada: ${p} p\xEDxeles reparados, ${h} cargas restantes`),i.ui){if(g>0&&h<i.minChargesToWait){i.ui.updateStatus(`\u23F3 Esperando ${i.minChargesToWait} cargas para continuar (${h} actuales)`,"warning");let m=(i.minChargesToWait-h)*Pt;Ke=Date.now()+m,Et()}else i.ui.updateStatus(`\u2705 Reparados ${p} p\xEDxeles correctamente`,"success"),Tt();i.ui.updateStats({charges:h,repaired:i.totalRepaired,pending:g})}if(i.randomWaitTime&&g>0&&h>=i.minChargesToWait){let f=Math.random()*(i.randomWaitMax-i.randomWaitMin)+i.randomWaitMin;d(`\u23F0 Esperando ${f.toFixed(1)} segundos (aleatorio) antes del siguiente batch`),await oe(f*1e3)}}catch(e){d(`\u274C Error en reparaci\xF3n: ${e.message}`)}finally{Ze=!1}}}function mo({total:o,incorrect:e,missing:t}){It&&clearTimeout(It),It=setTimeout(()=>{try{N("analysis_summary",{botVariant:"auto-guard",metadata:{total:o,incorrect:e,missing:t}})}catch{}},1500)}async function qr(o,e,t,n){var r,s;try{let a=eo();a||(a=await Se());let l=[];for(let u=0;u<t.length;u+=2){let h=(Number(t[u])%1e3+1e3)%1e3,g=(Number(t[u+1])%1e3+1e3)%1e3;Number.isFinite(h)&&Number.isFinite(g)&&l.push(h,g)}let c=l.slice(0,6).join(",");d(`[API] Enviando lote a tile ${o},${e} con ${n.length} p\xEDxeles. Ejemplo coords: ${c}`);let p=await io(o,e,l,n,a);return{success:p.success,painted:p.painted||0,status:p.status,error:p.success?null:((r=p.json)==null?void 0:r.error)||((s=p.json)==null?void 0:s.message)||`HTTP ${p.status}`}}catch(a){return{success:!1,painted:0,error:a.message}}}var le,de,we,H,vt,Ze,re,Ke,yo,Pt,wo,Je,It,tt=_(()=>{D();je();je();Ue();te();yt();so();Ct();He();le=null,de=null,we=null,H=0,vt=0,Ze=!1,re=null,Ke=0,yo=3e4,Pt=31e3;({Image:wo,URL:Je}=window);It=null});function en(o){Mt=o}function R(o,e=null){Mt&&(e?console.log(`[ModalManager] ${o}`,e):console.log(`[ModalManager] ${o}`))}function rt(){return document.querySelectorAll("dialog.modal[open], dialog[open], .modal[open], .modal.show").length>0}function Ce(){let o=rt();R(`Modal state changed. Open: ${o}`),R(`Windows registered: ${ie.size}`),R(`Windows currently hidden by modal: ${ee.size}`),ie.forEach(e=>{if(o){if(!ee.has(e)){R("Hiding window due to modal",e),ee.add(e),e.style.transition="all 0.3s ease-out",e.style.opacity="0",e.style.pointerEvents="none";let t=e.getRootNode&&e.getRootNode();t&&t.host&&t.host.style&&(R("Also hiding Shadow DOM host",t.host),t.host.style.transition="all 0.3s ease-out",t.host.style.opacity="0",t.host.style.pointerEvents="none")}}else if(ee.has(e)){R("Showing window, no modals detected",e),ee.delete(e),e.style.transition="all 0.3s ease-in",e.style.opacity="1",e.style.pointerEvents="auto";let t=e.getRootNode&&e.getRootNode();t&&t.host&&t.host.style&&(R("Also showing Shadow DOM host",t.host),t.host.style.transition="all 0.3s ease-in",t.host.style.opacity="1",t.host.style.pointerEvents="auto")}})}function tn(){if(ot)return;R("Setting up modal observers");let o=new MutationObserver(r=>{R(`Attribute mutations detected: ${r.length}`),r.forEach(s=>{s.type==="attributes"&&(s.attributeName==="open"||s.attributeName==="class")&&(R(`Attribute changed: ${s.attributeName} on`,s.target),R(`Old value: ${s.oldValue}`),R(`New value: ${s.target.getAttribute(s.attributeName)}`),Ce())})}),e=new MutationObserver(r=>{R(`DOM mutations detected: ${r.length}`),r.forEach(s=>{s.type==="childList"&&(s.addedNodes.forEach(a=>{if(a.nodeType===Node.ELEMENT_NODE){let l='dialog.modal, dialog, .modal, [role="dialog"], .overlay, .popup';a.matches&&a.matches(l)&&(R("New modal element detected",a),o.observe(a,{attributes:!0,attributeFilter:["open","class","aria-hidden"],attributeOldValue:!0}),Ce());let c=a.querySelectorAll?a.querySelectorAll(l):[];c.length>0&&R(`Found ${c.length} nested modals`),c.forEach(p=>{R("Observing nested modal",p),o.observe(p,{attributes:!0,attributeFilter:["open","class","aria-hidden"],attributeOldValue:!0})}),c.length>0&&Ce()}}),s.removedNodes.length>0&&(R(`${s.removedNodes.length} nodes removed`),Ce()))})}),n=document.querySelectorAll('dialog.modal, dialog, .modal, [role="dialog"], .overlay, .popup');R(`Found ${n.length} existing modals`),n.forEach(r=>{R("Observing existing modal",r),o.observe(r,{attributes:!0,attributeFilter:["open","class","aria-hidden"],attributeOldValue:!0})}),e.observe(document.body,{childList:!0,subtree:!0}),ot=!0,R("Modal observers setup complete")}function V(o){if(!o)return;ie.add(o),ot||setTimeout(()=>{tn()},100);let e=t=>{(t.target===o||o.contains(t.target))&&Rt(o)};if(o.addEventListener("mousedown",e),o._bringToFrontHandler=e,!o.style.zIndex){o.style.zIndex=Le++;let t=o.getRootNode&&o.getRootNode();t&&t.host&&t.host.style&&(t.host.style.zIndex=o.style.zIndex)}Ce(),R("Window registered successfully",o)}function Z(o){o&&(ie.delete(o),ee.delete(o),o._bringToFrontHandler&&(o.removeEventListener("mousedown",o._bringToFrontHandler),delete o._bringToFrontHandler))}function Rt(o){if(!o||!ie.has(o)||rt())return;Le++,o.style.zIndex=Le;let e=o.getRootNode&&o.getRootNode();e&&e.host&&e.host.style&&(e.host.style.zIndex=Le)}function on(){Ce()}function rn(){console.log("=== MODAL MANAGER DEBUG STATE ==="),console.log("Debug enabled:",Mt),console.log("Observers setup:",ot),console.log("Windows registered:",ie.size),console.log("Windows hidden by modal:",ee.size),console.log("Current max Z-Index:",Le),console.log("Any modal open:",rt()),console.log(`
--- Registered Windows ---`),ie.forEach((e,t)=>{console.log(`Window ${t}:`,{element:e,zIndex:e.style.zIndex,opacity:e.style.opacity,isHidden:ee.has(e)})}),console.log(`
--- Current Modals ---`),document.querySelectorAll('dialog.modal[open], dialog[open], .modal[open], .modal.show, [role="dialog"]').forEach((e,t)=>{console.log(`Modal ${t}:`,{element:e,isOpen:e.hasAttribute("open")||e.classList.contains("show"),display:window.getComputedStyle(e).display,visibility:window.getComputedStyle(e).visibility})})}var Le,ie,ot,ee,Mt,Me=_(()=>{Le=1e5,ie=new Set,ot=!1,ee=new Set,Mt=!1;typeof window!="undefined"&&(window.setModalDebug=en,window.debugModalState=rn,window.registerWindow=V,window.unregisterWindow=Z,window.__modalManagerDebug={windowElements:ie,hiddenWindowsByModal:ee,isAnyModalOpen:rt,refreshWindowsVisibility:on},console.log("[WindowManager] Funciones expuestas globalmente autom\xE1ticamente"))});var Io,To=_(()=>{Io={launcher:{title:"WPlace AutoBOT",autoFarm:"\u{1F33E} Auto-Farm",autoImage:"\u{1F3A8} Auto-Image",autoGuard:"\u{1F6E1}\uFE0F Auto-Guard",selection:"Selecci\xF3n",user:"Usuario",charges:"Cargas",backend:"Backend",database:"Database",uptime:"Uptime",close:"Cerrar",launch:"Lanzar",loading:"Cargando\u2026",executing:"Ejecutando\u2026",downloading:"Descargando script\u2026",chooseBot:"Elige un bot y presiona Lanzar",readyToLaunch:"Listo para lanzar",loadError:"Error al cargar",loadErrorMsg:"No se pudo cargar el bot seleccionado. Revisa tu conexi\xF3n o int\xE9ntalo de nuevo.",checking:"\u{1F504} Verificando...",online:"\u{1F7E2} Online",offline:"\u{1F534} Offline",ok:"\u{1F7E2} OK",error:"\u{1F534} Error",unknown:"-",logWindow:"Logs",logWindowTitle:"Logs - {botName}",downloadLogs:"Descargar Logs",clearLogs:"Limpiar Logs",closeLogs:"Cerrar",localExecution:"Ejecuci\xF3n local con acceso completo al sistema de tokens",botStarting:"Bot iniciando..."},image:{title:"WPlace Auto-Image",initBot:"Iniciar Auto-BOT",uploadImage:"Subir Imagen",resizeImage:"Redimensionar Imagen",selectPosition:"Seleccionar Posici\xF3n",startPainting:"Iniciar Pintura",stopPainting:"Detener Pintura",saveProgress:"Guardar Progreso",loadProgress:"Cargar Progreso",checkingColors:"\u{1F50D} Verificando colores disponibles...",noColorsFound:"\u274C \xA1Abre la paleta de colores en el sitio e int\xE9ntalo de nuevo!",colorsFound:"\u2705 {count} colores disponibles encontrados",loadingImage:"\u{1F5BC}\uFE0F Cargando imagen...",imageLoaded:"\u2705 Imagen cargada con {count} p\xEDxeles v\xE1lidos",imageError:"\u274C Error al cargar la imagen",selectPositionAlert:"\xA1Pinta el primer p\xEDxel en la ubicaci\xF3n donde quieres que comience el arte!",waitingPosition:"\u{1F446} Esperando que pintes el p\xEDxel de referencia...",positionSet:"\u2705 \xA1Posici\xF3n establecida con \xE9xito!",positionTimeout:"\u274C Tiempo agotado para seleccionar posici\xF3n",positionDetected:"\u{1F3AF} Posici\xF3n detectada, procesando...",positionError:"\u274C Error detectando posici\xF3n, int\xE9ntalo de nuevo",startPaintingMsg:"\u{1F3A8} Iniciando pintura...",paintingProgress:"\u{1F9F1} Progreso: {painted}/{total} p\xEDxeles...",noCharges:"\u231B Sin cargas. Esperando {time}...",paintingStopped:"\u23F9\uFE0F Pintura detenida por el usuario",paintingComplete:"\u2705 \xA1Pintura completada! {count} p\xEDxeles pintados.",paintingError:"\u274C Error durante la pintura",missingRequirements:"\u274C Carga una imagen y selecciona una posici\xF3n primero",progress:"Progreso",userName:"Usuario",pixels:"P\xEDxeles",charges:"Cargas",estimatedTime:"Tiempo estimado",initMessage:"Haz clic en 'Iniciar Auto-BOT' para comenzar",waitingInit:"Esperando inicializaci\xF3n...",resizeSuccess:"\u2705 Imagen redimensionada a {width}x{height}",paintingPaused:"\u23F8\uFE0F Pintura pausada en la posici\xF3n X: {x}, Y: {y}",pixelsPerBatch:"P\xEDxeles por lote",batchSize:"Tama\xF1o del lote",nextBatchTime:"Siguiente lote en",useAllCharges:"Usar todas las cargas disponibles",showOverlay:"Mostrar overlay",maxCharges:"Cargas m\xE1ximas por lote",waitingForCharges:"\u23F3 Esperando cargas: {current}/{needed}",timeRemaining:"Tiempo restante",cooldownWaiting:"\u23F3 Esperando {time} para continuar...",progressSaved:"\u2705 Progreso guardado como {filename}",progressLoaded:"\u2705 Progreso cargado: {painted}/{total} p\xEDxeles pintados",progressLoadError:"\u274C Error al cargar progreso: {error}",progressSaveError:"\u274C Error al guardar progreso: {error}",confirmSaveProgress:"\xBFDeseas guardar el progreso actual antes de detener?",saveProgressTitle:"Guardar Progreso",discardProgress:"Descartar",cancel:"Cancelar",minimize:"Minimizar",width:"Ancho",height:"Alto",keepAspect:"Mantener proporci\xF3n",apply:"Aplicar",overlayOn:"Overlay: ON",overlayOff:"Overlay: OFF",passCompleted:"\u2705 Pasada completada: {painted} p\xEDxeles pintados | Progreso: {percent}% ({current}/{total})",waitingChargesRegen:"\u23F3 Esperando regeneraci\xF3n de cargas: {current}/{needed} - Tiempo: {time}",waitingChargesCountdown:"\u23F3 Esperando cargas: {current}/{needed} - Quedan: {time}",autoInitializing:"\u{1F916} Inicializando autom\xE1ticamente...",autoInitSuccess:"\u2705 Bot iniciado autom\xE1ticamente",autoInitFailed:"\u26A0\uFE0F No se pudo iniciar autom\xE1ticamente. Usa el bot\xF3n manual.",paletteDetected:"\u{1F3A8} Paleta de colores detectada",paletteNotFound:"\u{1F50D} Buscando paleta de colores...",clickingPaintButton:"\u{1F446} Haciendo clic en el bot\xF3n Paint...",paintButtonNotFound:"\u274C Bot\xF3n Paint no encontrado",manualInitRequired:"\u{1F527} Inicio manual requerido",retryAttempt:"\u{1F504} Reintento {attempt}/{maxAttempts} en {delay}s...",retryError:"\u{1F4A5} Error en intento {attempt}/{maxAttempts}, reintentando en {delay}s...",retryFailed:"\u274C Fall\xF3 despu\xE9s de {maxAttempts} intentos. Continuando con siguiente lote...",networkError:"\u{1F310} Error de red. Reintentando...",serverError:"\u{1F525} Error del servidor. Reintentando...",timeoutError:"\u23F0 Timeout del servidor. Reintentando...",paintPattern:"\u{1F4D0} Patr\xF3n de pintado",patternLinearStart:"Lineal (Inicio)",patternLinearEnd:"Lineal (Final)",patternRandom:"Aleatorio",patternCenterOut:"Centro hacia afuera",patternCornersFirst:"Esquinas primero",patternSpiral:"Espiral",logWindow:"Logs",logWindowTitle:"Logs - {botName}",downloadLogs:"Descargar Logs",clearLogs:"Limpiar Logs",closeLogs:"Cerrar",userInfo:"Informaci\xF3n del Usuario",imageProgress:"Progreso de la Imagen",availableColors:"Colores Disponibles",noImageLoaded:"No hay imagen cargada",cooldown:"Tiempo de espera",totalColors:"Total de Colores",colorPalette:"Paleta de Colores",showAllColors:"Mostrar Todos los Colores (incluyendo no disponibles)",selectAllColors:"Seleccionar Todos",unselectAllColors:"Deseleccionar Todos",noAvailable:"No disponible",colorSelected:"Color seleccionado",statsUpdated:"\u2705 Estad\xEDsticas actualizadas: {count} colores disponibles"},farm:{title:"WPlace Farm Bot",start:"Iniciar",stop:"Detener",stopped:"Bot detenido",calibrate:"Calibrar",paintOnce:"Una vez",checkingStatus:"Verificando estado...",configuration:"Configuraci\xF3n",delay:"Delay (ms)",pixelsPerBatch:"P\xEDxeles/lote",minCharges:"Cargas m\xEDn",colorMode:"Modo color",random:"Aleatorio",fixed:"Fijo",range:"Rango",fixedColor:"Color fijo",advanced:"Avanzado",tileX:"Tile X",tileY:"Tile Y",customPalette:"Paleta personalizada",paletteExample:"ej: #FF0000,#00FF00,#0000FF",capture:"Capturar",painted:"Pintados",charges:"Cargas",retries:"Fallos",position:"Posici\xF3n",tile:"Tile",configSaved:"Configuraci\xF3n guardada",configLoaded:"Configuraci\xF3n cargada",configReset:"Configuraci\xF3n reiniciada",captureInstructions:"Pinta un p\xEDxel manualmente para capturar coordenadas...",backendOnline:"Backend Online",backendOffline:"Backend Offline",startingBot:"Iniciando bot...",stoppingBot:"Deteniendo bot...",calibrating:"Calibrando...",alreadyRunning:"Auto-Farm ya est\xE1 corriendo.",imageRunningWarning:"Auto-Image est\xE1 ejecut\xE1ndose. Ci\xE9rralo antes de iniciar Auto-Farm.",selectPosition:"Seleccionar Zona",selectPositionAlert:"\u{1F3AF} Pinta un p\xEDxel en una zona DESPOBLADA del mapa para establecer el \xE1rea de farming",waitingPosition:"\u{1F446} Esperando que pintes el p\xEDxel de referencia...",positionSet:"\u2705 \xA1Zona establecida!",positionTimeout:"\u274C Tiempo agotado para seleccionar zona",missingPosition:"\u274C Selecciona una zona primero usando 'Seleccionar Zona'",farmRadius:"Radio farm",positionInfo:"Zona actual",farmingInRadius:"\u{1F33E} Farming en radio {radius}px desde ({x},{y})",selectEmptyArea:"\u26A0\uFE0F IMPORTANTE: Selecciona una zona DESPOBLADA para evitar conflictos",noPosition:"Sin zona",currentZone:"Zona: ({x},{y})",autoSelectPosition:"\u{1F3AF} Selecciona una zona primero. Pinta un p\xEDxel en el mapa para establecer la zona de farming",logWindow:"Logs",logWindowTitle:"Logs - {botName}",downloadLogs:"Descargar Logs",clearLogs:"Limpiar Logs",closeLogs:"Cerrar",ready:"Listo",once:"Una vez",recapture:"Re-capturar",stats:{painted:"Pintados",charges:"Cargas",droplets:"Gotas",user:"Usuario",retries:"Reintentos"},config:{minCharges:"Cargas m\xEDnimas",delay:"Espera (seg)",pixelsPerBatch:"P\xEDxeles por lote"},color:{fixed:"Fijo",range:"Rango",random:"Aleatorio",selected:"Color seleccionado",min:"M\xEDn",max:"M\xE1x"},autobuy:{title:"Auto-compra (+5 cargas)",hint:"Se activar\xE1 autom\xE1ticamente cuando tengas \u2265 500 gotas"},buyCharges:"Comprar +5 cargas",buying:"Comprando...",buyOk:"Compra realizada. Actualiza sesi\xF3n.",buyFail:"No se pudo comprar"},common:{yes:"S\xED",no:"No",ok:"Aceptar",cancel:"Cancelar",close:"Cerrar",save:"Guardar",load:"Cargar",delete:"Eliminar",edit:"Editar",start:"Iniciar",stop:"Detener",pause:"Pausar",resume:"Reanudar",reset:"Reiniciar",settings:"Configuraci\xF3n",help:"Ayuda",about:"Acerca de",language:"Idioma",loading:"Cargando...",error:"Error",success:"\xC9xito",warning:"Advertencia",info:"Informaci\xF3n",languageChanged:"Idioma cambiado a {language}"},guard:{title:"WPlace Auto-Guard",initBot:"Inicializar Guard-BOT",selectArea:"Seleccionar \xC1rea",save:"Guardar",captureArea:"Capturar \xC1rea",startProtection:"Iniciar",stopProtection:"Detener",protectedPixels:"P\xEDxeles Protegidos",upperLeft:"Esquina Superior Izquierda",lowerRight:"Esquina Inferior Derecha",detectedChanges:"Cambios Detectados",repairedPixels:"P\xEDxeles Reparados",charges:"Cargas",waitingInit:"Esperando inicializaci\xF3n...",checkingColors:"\u{1F3A8} Verificando colores disponibles...",noColorsFound:"\u274C No se encontraron colores. Abre la paleta de colores en el sitio.",colorsFound:"\u2705 {count} colores disponibles encontrados",initSuccess:"\u2705 Guard-BOT inicializado correctamente",initError:"\u274C Error inicializando Guard-BOT",invalidCoords:"\u274C Coordenadas inv\xE1lidas",invalidArea:"\u274C El \xE1rea debe tener esquina superior izquierda menor que inferior derecha",areaTooLarge:"\u274C \xC1rea demasiado grande: {size} p\xEDxeles (m\xE1ximo: {max})",capturingArea:"\u{1F4F8} Capturando \xE1rea...",areaCaptured:"\u2705 \xC1rea capturada: {count} p\xEDxeles",captureError:"\u274C Error capturando \xE1rea: {error}",captureFirst:"\u274C Primero captura un \xE1rea",noChanges:"\u2705 \xC1rea - sin cambios detectados",changesDetected:"\u{1F6A8} {count} cambios detectados en el \xE1rea",repairing:"\u{1F6E0}\uFE0F Reparando {count} p\xEDxeles alterados...",repairedSuccess:"\u2705 Reparados {count} p\xEDxeles correctamente",repairError:"\u274C Error reparando p\xEDxeles: {error}",noCharges:"\u26A0\uFE0F Sin cargas suficientes para reparar cambios",checkingChanges:"\u{1F50D} Verificando cambios en \xE1rea...",errorChecking:"\u274C Error verificando cambios: {error}",guardActive:"\u{1F6E1}\uFE0F Guardi\xE1n activo - \xE1rea monitoreada",lastCheck:"\xDAltima verificaci\xF3n: {time}",nextCheck:"Pr\xF3xima verificaci\xF3n en: {time}s",autoInitializing:"\u{1F916} Inicializando autom\xE1ticamente...",autoInitSuccess:"\u2705 Guard-BOT iniciado autom\xE1ticamente",autoInitFailed:"\u26A0\uFE0F No se pudo iniciar autom\xE1ticamente. Usa el bot\xF3n manual.",manualInitRequired:"\u{1F527} Inicio manual requerido",paletteDetected:"\u{1F3A8} Paleta de colores detectada",paletteNotFound:"\u{1F50D} Buscando paleta de colores...",clickingPaintButton:"\u{1F446} Haciendo clic en el bot\xF3n Paint...",paintButtonNotFound:"\u274C Bot\xF3n Paint no encontrado",protectionStopped:"\u23F9\uFE0F Protecci\xF3n detenida",selectUpperLeft:"\u{1F3AF} Pinta un p\xEDxel en la esquina SUPERIOR IZQUIERDA del \xE1rea a monitorear",selectLowerRight:"\u{1F3AF} Ahora pinta un p\xEDxel en la esquina INFERIOR DERECHA del \xE1rea",waitingUpperLeft:"\u{1F446} Esperando selecci\xF3n de esquina superior izquierda...",waitingLowerRight:"\u{1F446} Esperando selecci\xF3n de esquina inferior derecha...",upperLeftCaptured:"\u2705 Esquina superior izquierda capturada: ({x}, {y})",lowerRightCaptured:"\u2705 Esquina inferior derecha capturada: ({x}, {y})",selectionTimeout:"\u274C Tiempo agotado para selecci\xF3n",selectionError:"\u274C Error en selecci\xF3n, int\xE9ntalo de nuevo",logWindow:"Logs",logWindowTitle:"Logs - {botName}",downloadLogs:"Descargar Logs",clearLogs:"Limpiar Logs",closeLogs:"Cerrar",analysisTitle:"An\xE1lisis de Diferencias - JSON vs Canvas Actual",correctPixels:"P\xEDxeles Correctos",incorrectPixels:"P\xEDxeles Incorrectos",missingPixels:"P\xEDxeles Faltantes",showCorrect:"Mostrar Correctos",showIncorrect:"Mostrar Incorrectos",showMissing:"Mostrar Faltantes",autoRefresh:"Auto-refresco",zoomAdjusted:"Zoom ajustado autom\xE1ticamente a",autoRefreshEnabled:"Auto-refresco activado cada",autoRefreshDisabled:"Auto-refresco desactivado",autoRefreshIntervalUpdated:"Intervalo de auto-refresco actualizado a",visualizationUpdated:"Visualizaci\xF3n actualizada",configTitle:"Configuraci\xF3n del Guard",protectionPatterns:"Patrones de Protecci\xF3n",preferSpecificColor:"Priorizar color espec\xEDfico",excludeSpecificColors:"No reparar colores espec\xEDficos",loadManagement:"Gesti\xF3n de Cargas",minLoadsToWait:"M\xEDnimo de cargas:",pixelsPerBatch:"P\xEDxeles por lote",spendAllPixelsOnStart:"Gastar todos los p\xEDxeles al iniciar",waitTimes:"Tiempos de Espera",useRandomTimes:"Usar tiempos aleatorios entre lotes",minTime:"Tiempo m\xEDnimo (s)",maxTime:"Tiempo m\xE1ximo (s)"},slave:{title:"WPlace Slave",masterServer:"Servidor Maestro",ipAddress:"Direcci\xF3n IP",connect:"Conectar",disconnect:"Desconectar",status:"Estado",slaveId:"ID Slave",mode:"Modo",running:"Ejecutando",idle:"Inactivo",connected:"Conectado",connecting:"Conectando...",disconnected:"Desconectado",error:"Error",close:"Cerrar",telemetry:"Telemetr\xEDa",repairedPixels:"P\xEDxeles Reparados",missingPixels:"P\xEDxeles Faltantes",absentPixels:"P\xEDxeles Ausentes",remainingCharges:"Cargas Restantes",connectionError:"Error de conexi\xF3n. Verifica la URL y que el servidor est\xE9 ejecut\xE1ndose.",invalidUrl:"Por favor ingresa una URL v\xE1lida",slaveRunning:"Slave ya est\xE1 ejecut\xE1ndose.",slaveInitialized:"Slave inicializado correctamente",slaveError:"Error inicializando Slave",masterConnected:"Conectado al servidor maestro",masterDisconnected:"Desconectado del servidor maestro",reconnecting:"Reintentando conexi\xF3n",maxReconnectAttempts:"M\xE1ximo de intentos de reconexi\xF3n alcanzado",modeSet:"Modo configurado",projectLoaded:"Configuraci\xF3n del proyecto cargada",botStarted:"Bot iniciado",botStopped:"Bot detenido",botPaused:"Bot pausado"}}});var So,Ao=_(()=>{So={launcher:{title:"WPlace AutoBOT",autoFarm:"\u{1F33E} Auto-Farm",autoImage:"\u{1F3A8} Auto-Image",autoGuard:"\u{1F6E1}\uFE0F Auto-Guard",selection:"Selection",user:"User",charges:"Charges",backend:"Backend",database:"Database",uptime:"Uptime",close:"Close",launch:"Launch",loading:"Loading\u2026",executing:"Executing\u2026",downloading:"Downloading script\u2026",chooseBot:"Choose a bot and press Launch",readyToLaunch:"Ready to launch",loadError:"Load error",loadErrorMsg:"Could not load the selected bot. Check your connection or try again.",checking:"\u{1F504} Checking...",online:"\u{1F7E2} Online",offline:"\u{1F534} Offline",ok:"\u{1F7E2} OK",error:"\u{1F534} Error",unknown:"-",logWindow:"Logs",logWindowTitle:"Logs - {botName}",downloadLogs:"Download Logs",clearLogs:"Clear Logs",closeLogs:"Close",localExecution:"Local execution with full access to token system",botStarting:"Bot starting..."},image:{title:"WPlace Auto-Image",initBot:"Initialize Auto-BOT",uploadImage:"Upload Image",resizeImage:"Resize Image",selectPosition:"Select Position",startPainting:"Start Painting",stopPainting:"Stop Painting",saveProgress:"Save Progress",loadProgress:"Load Progress",checkingColors:"\u{1F50D} Checking available colors...",noColorsFound:"\u274C Open the color palette on the site and try again!",colorsFound:"\u2705 Found {count} available colors",loadingImage:"\u{1F5BC}\uFE0F Loading image...",imageLoaded:"\u2705 Image loaded with {count} valid pixels",imageError:"\u274C Error loading image",selectPositionAlert:"Paint the first pixel at the location where you want the art to start!",waitingPosition:"\u{1F446} Waiting for you to paint the reference pixel...",positionSet:"\u2705 Position set successfully!",positionTimeout:"\u274C Timeout for position selection",positionDetected:"\u{1F3AF} Position detected, processing...",positionError:"\u274C Error detecting position, please try again",startPaintingMsg:"\u{1F3A8} Starting painting...",paintingProgress:"\u{1F9F1} Progress: {painted}/{total} pixels...",noCharges:"\u231B No charges. Waiting {time}...",paintingStopped:"\u23F9\uFE0F Painting stopped by user",paintingComplete:"\u2705 Painting completed! {count} pixels painted.",paintingError:"\u274C Error during painting",missingRequirements:"\u274C Load an image and select a position first",progress:"Progress",userName:"User",pixels:"Pixels",charges:"Charges",estimatedTime:"Estimated time",initMessage:"Click 'Initialize Auto-BOT' to begin",waitingInit:"Waiting for initialization...",resizeSuccess:"\u2705 Image resized to {width}x{height}",paintingPaused:"\u23F8\uFE0F Painting paused at position X: {x}, Y: {y}",pixelsPerBatch:"Pixels per batch",batchSize:"Batch size",nextBatchTime:"Next batch in",useAllCharges:"Use all available charges",showOverlay:"Show overlay",maxCharges:"Max charges per batch",waitingForCharges:"\u23F3 Waiting for charges: {current}/{needed}",timeRemaining:"Time remaining",cooldownWaiting:"\u23F3 Waiting {time} to continue...",progressSaved:"\u2705 Progress saved as {filename}",progressLoaded:"\u2705 Progress loaded: {painted}/{total} pixels painted",progressLoadError:"\u274C Error loading progress: {error}",progressSaveError:"\u274C Error saving progress: {error}",confirmSaveProgress:"Do you want to save the current progress before stopping?",saveProgressTitle:"Save Progress",discardProgress:"Discard",cancel:"Cancel",minimize:"Minimize",width:"Width",height:"Height",keepAspect:"Keep aspect ratio",apply:"Apply",overlayOn:"Overlay: ON",overlayOff:"Overlay: OFF",passCompleted:"\u2705 Pass completed: {painted} pixels painted | Progress: {percent}% ({current}/{total})",waitingChargesRegen:"\u23F3 Waiting for charge regeneration: {current}/{needed} - Time: {time}",waitingChargesCountdown:"\u23F3 Waiting for charges: {current}/{needed} - Remaining: {time}",autoInitializing:"\u{1F916} Auto-initializing...",autoInitSuccess:"\u2705 Bot auto-started successfully",autoInitFailed:"\u26A0\uFE0F Could not auto-start. Use manual button.",paletteDetected:"\u{1F3A8} Color palette detected",paletteNotFound:"\u{1F50D} Searching for color palette...",clickingPaintButton:"\u{1F446} Clicking Paint button...",paintButtonNotFound:"\u274C Paint button not found",manualInitRequired:"\u{1F527} Manual initialization required",retryAttempt:"\u{1F504} Retry {attempt}/{maxAttempts} in {delay}s...",retryError:"\u{1F4A5} Error in attempt {attempt}/{maxAttempts}, retrying in {delay}s...",retryFailed:"\u274C Failed after {maxAttempts} attempts. Continuing with next batch...",networkError:"\u{1F310} Network error. Retrying...",serverError:"\u{1F525} Server error. Retrying...",timeoutError:"\u23F0 Server timeout, retrying...",protectionEnabled:"Protection enabled",protectionDisabled:"Protection disabled",paintPattern:"Paint pattern",patternLinearStart:"Linear (Start)",patternLinearEnd:"Linear (End)",patternRandom:"Random",patternCenterOut:"Center outward",patternCornersFirst:"Corners first",patternSpiral:"Spiral",solid:"Solid",stripes:"Stripes",checkerboard:"Checkerboard",gradient:"Gradient",dots:"Dots",waves:"Waves",spiral:"Spiral",mosaic:"Mosaic",bricks:"Bricks",zigzag:"Zigzag",protectingDrawing:"Protecting drawing...",changesDetected:"\u{1F6A8} {count} changes detected in drawing",repairing:"\u{1F527} Repairing {count} altered pixels...",repairCompleted:"\u2705 Repair completed: {count} pixels",noChargesForRepair:"\u26A1 No charges for repair, waiting...",protectionPriority:"\u{1F6E1}\uFE0F Protection priority activated",patternApplied:"Pattern applied",customPattern:"Custom pattern",logWindow:"Logs",logWindowTitle:"Logs - {botName}",downloadLogs:"Download Logs",clearLogs:"Clear Logs",closeLogs:"Close"},farm:{title:"WPlace Farm Bot",start:"Start",stop:"Stop",stopped:"Bot stopped",calibrate:"Calibrate",paintOnce:"Once",checkingStatus:"Checking status...",configuration:"Configuration",delay:"Delay (ms)",pixelsPerBatch:"Pixels/batch",minCharges:"Min charges",colorMode:"Color mode",random:"Random",fixed:"Fixed",range:"Range",fixedColor:"Fixed color",advanced:"Advanced",tileX:"Tile X",tileY:"Tile Y",customPalette:"Custom palette",paletteExample:"e.g: #FF0000,#00FF00,#0000FF",capture:"Capture",painted:"Painted",charges:"Charges",retries:"Retries",tile:"Tile",configSaved:"Configuration saved",configLoaded:"Configuration loaded",configReset:"Configuration reset",captureInstructions:"Paint a pixel manually to capture coordinates...",backendOnline:"Backend Online",backendOffline:"Backend Offline",startingBot:"Starting bot...",stoppingBot:"Stopping bot...",calibrating:"Calibrating...",alreadyRunning:"Auto-Farm is already running.",imageRunningWarning:"Auto-Image is running. Close it before starting Auto-Farm.",selectPosition:"Select Area",selectPositionAlert:"\u{1F3AF} Paint a pixel in an EMPTY area of the map to set the farming zone",waitingPosition:"\u{1F446} Waiting for you to paint the reference pixel...",positionSet:"\u2705 Area set! Radius: 500px",positionTimeout:"\u274C Timeout for area selection",missingPosition:"\u274C Select an area first using 'Select Area'",farmRadius:"Farm radius",positionInfo:"Current area",farmingInRadius:"\u{1F33E} Farming in {radius}px radius from ({x},{y})",selectEmptyArea:"\u26A0\uFE0F IMPORTANT: Select an EMPTY area to avoid conflicts",noPosition:"No area",currentZone:"Zone: ({x},{y})",autoSelectPosition:"\u{1F3AF} Select an area first. Paint a pixel on the map to set the farming zone",logWindow:"Logs",logWindowTitle:"Logs - {botName}",downloadLogs:"Download Logs",clearLogs:"Clear Logs",closeLogs:"Close"},common:{yes:"Yes",no:"No",ok:"OK",cancel:"Cancel",close:"Close",save:"Save",load:"Load",delete:"Delete",edit:"Edit",start:"Start",stop:"Stop",pause:"Pause",resume:"Resume",reset:"Reset",settings:"Settings",help:"Help",about:"About",language:"Language",loading:"Loading...",error:"Error",success:"Success",warning:"Warning",info:"Information",languageChanged:"Language changed to {language}"},guard:{title:"WPlace Auto-Guard",initBot:"Initialize Guard-BOT",selectArea:"Select Area",captureArea:"Capture Area",startProtection:"Start Protection",stopProtection:"Stop Protection",upperLeft:"Upper Left Corner",lowerRight:"Lower Right Corner",protectedPixels:"Protected Pixels",detectedChanges:"Detected Changes",repairedPixels:"Repaired Pixels",charges:"Charges",waitingInit:"Waiting for initialization...",checkingColors:"\u{1F3A8} Checking available colors...",noColorsFound:"\u274C No colors found. Open the color palette on the site.",colorsFound:"\u2705 Found {count} available colors",initSuccess:"\u2705 Guard-BOT initialized successfully",initError:"\u274C Error initializing Guard-BOT",invalidCoords:"\u274C Invalid coordinates",invalidArea:"\u274C Area must have upper left corner less than lower right corner",areaTooLarge:"\u274C Area too large: {size} pixels (maximum: {max})",capturingArea:"\u{1F4F8} Capturing protection area...",areaCaptured:"\u2705 Area captured: {count} pixels under protection",captureError:"\u274C Error capturing area: {error}",captureFirst:"\u274C First capture a protection area",protectionStarted:"\u{1F6E1}\uFE0F Protection started - monitoring area",protectionStopped:"\u23F9\uFE0F Protection stopped",noChanges:"\u2705 Protected area - no changes detected",changesDetected:"\u{1F6A8} {count} changes detected in protected area",repairing:"\u{1F6E0}\uFE0F Repairing {count} altered pixels...",repairedSuccess:"\u2705 Successfully repaired {count} pixels",repairError:"\u274C Error repairing pixels: {error}",noCharges:"\u26A0\uFE0F Insufficient charges to repair changes",checkingChanges:"\u{1F50D} Checking changes in protected area...",errorChecking:"\u274C Error checking changes: {error}",guardActive:"\u{1F6E1}\uFE0F Guardian active - area under protection",lastCheck:"Last check: {time}",nextCheck:"Next check in: {time}s",autoInitializing:"\u{1F916} Auto-initializing...",autoInitSuccess:"\u2705 Guard-BOT auto-started successfully",autoInitFailed:"\u26A0\uFE0F Could not auto-start. Use manual button.",manualInitRequired:"\u{1F527} Manual initialization required",paletteDetected:"\u{1F3A8} Color palette detected",paletteNotFound:"\u{1F50D} Searching for color palette...",clickingPaintButton:"\u{1F446} Clicking Paint button...",paintButtonNotFound:"\u274C Paint button not found",selectUpperLeft:"\u{1F3AF} Paint a pixel at the UPPER LEFT corner of the area to protect",selectLowerRight:"\u{1F3AF} Now paint a pixel at the LOWER RIGHT corner of the area",waitingUpperLeft:"\u{1F446} Waiting for upper left corner selection...",waitingLowerRight:"\u{1F446} Waiting for lower right corner selection...",upperLeftCaptured:"\u2705 Upper left corner captured: ({x}, {y})",lowerRightCaptured:"\u2705 Lower right corner captured: ({x}, {y})",selectionTimeout:"\u274C Selection timeout",selectionError:"\u274C Selection error, please try again",logWindow:"Logs",logWindowTitle:"Logs - {botName}",downloadLogs:"Download Logs",clearLogs:"Clear Logs",closeLogs:"Close",analysisTitle:"Difference Analysis - JSON vs Current Canvas",correctPixels:"Correct Pixels",incorrectPixels:"Incorrect Pixels",missingPixels:"Missing Pixels",showCorrect:"Show Correct",showIncorrect:"Show Incorrect",showMissing:"Show Missing",autoRefresh:"Auto-refresh",zoomAdjusted:"Zoom automatically adjusted to",autoRefreshEnabled:"Auto-refresh enabled every",autoRefreshDisabled:"Auto-refresh disabled",autoRefreshIntervalUpdated:"Auto-refresh interval updated to",visualizationUpdated:"Visualization updated",configTitle:"Guard Configuration",protectionPatterns:"Protection Patterns",preferSpecificColor:"Prioritize specific color",excludeSpecificColors:"Don't repair specific colors",loadManagement:"Load Management",minLoadsToWait:"Minimum loads to wait",pixelsPerBatch:"Pixels per batch",spendAllPixelsOnStart:"Spend all pixels on start",waitTimes:"Wait Times",useRandomTimes:"Use random times between batches",minTime:"Minimum time (s)",maxTime:"Maximum time (s)"}}});var ko,_o=_(()=>{ko={launcher:{title:"WPlace AutoBOT",autoFarm:"\u{1F33E} Auto-Farm",autoImage:"\u{1F3A8} Auto-Image",autoGuard:"\u{1F6E1}\uFE0F Auto-Guard",selection:"S\xE9lection",user:"Utilisateur",charges:"Charges",backend:"Backend",database:"Base de donn\xE9es",uptime:"Temps actif",close:"Fermer",launch:"Lancer",loading:"Chargement\u2026",executing:"Ex\xE9cution\u2026",downloading:"T\xE9l\xE9chargement du script\u2026",chooseBot:"Choisissez un bot et appuyez sur Lancer",readyToLaunch:"Pr\xEAt \xE0 lancer",loadError:"Erreur de chargement",loadErrorMsg:"Impossible de charger le bot s\xE9lectionn\xE9. V\xE9rifiez votre connexion ou r\xE9essayez.",checking:"\u{1F504} V\xE9rification...",online:"\u{1F7E2} En ligne",offline:"\u{1F534} Hors ligne",ok:"\u{1F7E2} OK",error:"\u{1F534} Erreur",unknown:"-",logWindow:"Logs",logWindowTitle:"Logs - {botName}",downloadLogs:"T\xE9l\xE9charger Logs",clearLogs:"Effacer Logs",closeLogs:"Fermer"},image:{title:"WPlace Auto-Image",initBot:"Initialiser Auto-BOT",uploadImage:"T\xE9l\xE9charger Image",resizeImage:"Redimensionner Image",selectPosition:"S\xE9lectionner Position",startPainting:"Commencer Peinture",stopPainting:"Arr\xEAter Peinture",saveProgress:"Sauvegarder Progr\xE8s",loadProgress:"Charger Progr\xE8s",checkingColors:"\u{1F50D} V\xE9rification des couleurs disponibles...",noColorsFound:"\u274C Ouvrez la palette de couleurs sur le site et r\xE9essayez!",colorsFound:"\u2705 {count} couleurs disponibles trouv\xE9es",loadingImage:"\u{1F5BC}\uFE0F Chargement de l'image...",imageLoaded:"\u2705 Image charg\xE9e avec {count} pixels valides",imageError:"\u274C Erreur lors du chargement de l'image",selectPositionAlert:"Peignez le premier pixel \xE0 l'emplacement o\xF9 vous voulez que l'art commence!",waitingPosition:"\u{1F446} En attente que vous peigniez le pixel de r\xE9f\xE9rence...",positionSet:"\u2705 Position d\xE9finie avec succ\xE8s!",positionTimeout:"\u274C D\xE9lai d\xE9pass\xE9 pour la s\xE9lection de position",positionDetected:"\u{1F3AF} Position d\xE9tect\xE9e, traitement...",positionError:"\u274C Erreur d\xE9tectant la position, essayez \xE0 nouveau",startPaintingMsg:"\u{1F3A8} D\xE9but de la peinture...",paintingProgress:"\u{1F9F1} Progr\xE8s: {painted}/{total} pixels...",noCharges:"\u231B Aucune charge. Attendre {time}...",paintingStopped:"\u23F9\uFE0F Peinture arr\xEAt\xE9e par l'utilisateur",paintingComplete:"\u2705 Peinture termin\xE9e! {count} pixels peints.",paintingError:"\u274C Erreur pendant la peinture",missingRequirements:"\u274C Chargez une image et s\xE9lectionnez une position d'abord",progress:"Progr\xE8s",userName:"Usager",pixels:"Pixels",charges:"Charges",estimatedTime:"Temps estim\xE9",initMessage:"Cliquez sur 'Initialiser Auto-BOT' pour commencer",waitingInit:"En attente d'initialisation...",resizeSuccess:"\u2705 Image redimensionn\xE9e \xE0 {width}x{height}",paintingPaused:"\u23F8\uFE0F Peinture mise en pause \xE0 la position X: {x}, Y: {y}",pixelsPerBatch:"Pixels par lot",batchSize:"Taille du lot",nextBatchTime:"Prochain lot dans",useAllCharges:"Utiliser toutes les charges disponibles",showOverlay:"Afficher l'overlay",maxCharges:"Charges max par lot",waitingForCharges:"\u23F3 En attente de charges: {current}/{needed}",timeRemaining:"Temps restant",cooldownWaiting:"\u23F3 Attendre {time} pour continuer...",progressSaved:"\u2705 Progr\xE8s sauvegard\xE9 sous {filename}",progressLoaded:"\u2705 Progr\xE8s charg\xE9: {painted}/{total} pixels peints",progressLoadError:"\u274C Erreur lors du chargement du progr\xE8s: {error}",progressSaveError:"\u274C Erreur lors de la sauvegarde du progr\xE8s: {error}",confirmSaveProgress:"Voulez-vous sauvegarder le progr\xE8s actuel avant d'arr\xEAter?",saveProgressTitle:"Sauvegarder Progr\xE8s",discardProgress:"Abandonner",cancel:"Annuler",minimize:"Minimiser",width:"Largeur",height:"Hauteur",keepAspect:"Garder les proportions",apply:"Appliquer",overlayOn:"Overlay : ON",overlayOff:"Overlay : OFF",passCompleted:"\u2705 Passage termin\xE9: {painted} pixels peints | Progr\xE8s: {percent}% ({current}/{total})",waitingChargesRegen:"\u23F3 Attente de r\xE9g\xE9n\xE9ration des charges: {current}/{needed} - Temps: {time}",waitingChargesCountdown:"\u23F3 Attente des charges: {current}/{needed} - Restant: {time}",autoInitializing:"\u{1F916} Initialisation automatique...",autoInitSuccess:"\u2705 Bot d\xE9marr\xE9 automatiquement",autoInitFailed:"\u26A0\uFE0F Impossible de d\xE9marrer automatiquement. Utilisez le bouton manuel.",paletteDetected:"\u{1F3A8} Palette de couleurs d\xE9tect\xE9e",paletteNotFound:"\u{1F50D} Recherche de la palette de couleurs...",clickingPaintButton:"\u{1F446} Clic sur le bouton Paint...",paintButtonNotFound:"\u274C Bouton Paint introuvable",manualInitRequired:"\u{1F527} Initialisation manuelle requise",retryAttempt:"\u{1F504} Tentative {attempt}/{maxAttempts} dans {delay}s...",retryError:"\u{1F4A5} Erreur dans tentative {attempt}/{maxAttempts}, nouvel essai dans {delay}s...",retryFailed:"\u274C \xC9chec apr\xE8s {maxAttempts} tentatives. Continuant avec le lot suivant...",networkError:"\u{1F310} Erreur r\xE9seau. Nouvel essai...",serverError:"\u{1F525} Erreur serveur. Nouvel essai...",timeoutError:"\u23F0 D\xE9lai d\u2019attente du serveur, nouvelle tentative...",protectionEnabled:"Protection activ\xE9e",protectionDisabled:"Protection d\xE9sactiv\xE9e",paintPattern:"Motif de peinture",patternLinearStart:"Lin\xE9aire (D\xE9but)",patternLinearEnd:"Lin\xE9aire (Fin)",patternRandom:"Al\xE9atoire",patternCenterOut:"Centre vers l\u2019ext\xE9rieur",patternCornersFirst:"Coins d\u2019abord",patternSpiral:"Spirale",solid:"Plein",stripes:"Rayures",checkerboard:"Damier",gradient:"D\xE9grad\xE9",dots:"Points",waves:"Vagues",spiral:"Spirale",mosaic:"Mosa\xEFque",bricks:"Briques",zigzag:"Zigzag",protectingDrawing:"Protection du dessin...",changesDetected:"\u{1F6A8} {count} changements d\xE9tect\xE9s dans le dessin",repairing:"\u{1F527} R\xE9paration de {count} pixels modifi\xE9s...",repairCompleted:"\u2705 R\xE9paration termin\xE9e : {count} pixels",noChargesForRepair:"\u26A1 Pas de frais pour la r\xE9paration, en attente...",protectionPriority:"\u{1F6E1}\uFE0F Priorit\xE9 \xE0 la protection activ\xE9e",patternApplied:"Motif appliqu\xE9",customPattern:"Motif personnalis\xE9",logWindow:"Logs",logWindowTitle:"Logs - {botName}",downloadLogs:"T\xE9l\xE9charger Logs",clearLogs:"Effacer Logs",closeLogs:"Fermer"},farm:{title:"WPlace Farm Bot",start:"D\xE9marrer",stop:"Arr\xEAter",stopped:"Bot arr\xEAt\xE9",calibrate:"Calibrer",paintOnce:"Une fois",checkingStatus:"V\xE9rification du statut...",configuration:"Configuration",delay:"D\xE9lai (ms)",pixelsPerBatch:"Pixels/lot",minCharges:"Charges min",colorMode:"Mode couleur",random:"Al\xE9atoire",fixed:"Fixe",range:"Plage",fixedColor:"Couleur fixe",advanced:"Avanc\xE9",tileX:"Tuile X",tileY:"Tuile Y",customPalette:"Palette personnalis\xE9e",paletteExample:"ex: #FF0000,#00FF00,#0000FF",capture:"Capturer",painted:"Peints",charges:"Charges",retries:"\xC9checs",tile:"Tuile",configSaved:"Configuration sauvegard\xE9e",configLoaded:"Configuration charg\xE9e",configReset:"Configuration r\xE9initialis\xE9e",captureInstructions:"Peindre un pixel manuellement pour capturer les coordonn\xE9es...",backendOnline:"Backend En ligne",backendOffline:"Backend Hors ligne",startingBot:"D\xE9marrage du bot...",stoppingBot:"Arr\xEAt du bot...",calibrating:"Calibrage...",alreadyRunning:"Auto-Farm est d\xE9j\xE0 en cours d'ex\xE9cution.",imageRunningWarning:"Auto-Image est en cours d'ex\xE9cution. Fermez-le avant de d\xE9marrer Auto-Farm.",selectPosition:"S\xE9lectionner Zone",selectPositionAlert:"\u{1F3AF} Peignez un pixel dans une zone VIDE de la carte pour d\xE9finir la zone de farming",waitingPosition:"\u{1F446} En attente que vous peigniez le pixel de r\xE9f\xE9rence...",positionSet:"\u2705 Zone d\xE9finie! Rayon: 500px",positionTimeout:"\u274C D\xE9lai d\xE9pass\xE9 pour la s\xE9lection de zone",missingPosition:"\u274C S\xE9lectionnez une zone d'abord en utilisant 'S\xE9lectionner Zone'",farmRadius:"Rayon farm",positionInfo:"Zone actuelle",farmingInRadius:"\u{1F33E} Farming dans un rayon de {radius}px depuis ({x},{y})",selectEmptyArea:"\u26A0\uFE0F IMPORTANT: S\xE9lectionnez une zone VIDE pour \xE9viter les conflits",noPosition:"Aucune zone",currentZone:"Zone: ({x},{y})",autoSelectPosition:"\u{1F3AF} S\xE9lectionnez une zone d'abord. Peignez un pixel sur la carte pour d\xE9finir la zone de farming",logWindow:"Logs",logWindowTitle:"Logs - {botName}",downloadLogs:"T\xE9l\xE9charger Logs",clearLogs:"Effacer Logs",closeLogs:"Fermer"},common:{yes:"Oui",no:"Non",ok:"OK",cancel:"Annuler",close:"Fermer",save:"Sauvegarder",load:"Charger",delete:"Supprimer",edit:"Modifier",start:"D\xE9marrer",stop:"Arr\xEAter",pause:"Pause",resume:"Reprendre",reset:"R\xE9initialiser",settings:"Param\xE8tres",help:"Aide",about:"\xC0 propos",language:"Langue",loading:"Chargement...",error:"Erreur",success:"Succ\xE8s",warning:"Avertissement",info:"Information",languageChanged:"Langue chang\xE9e en {language}"},guard:{title:"WPlace Auto-Guard",initBot:"Initialiser Guard-BOT",selectArea:"S\xE9lectionner Zone",captureArea:"Capturer Zone",startProtection:"D\xE9marrer Protection",stopProtection:"Arr\xEAter Protection",upperLeft:"Coin Sup\xE9rieur Gauche",lowerRight:"Coin Inf\xE9rieur Droit",protectedPixels:"Pixels Prot\xE9g\xE9s",detectedChanges:"Changements D\xE9tect\xE9s",repairedPixels:"Pixels R\xE9par\xE9s",charges:"Charges",waitingInit:"En attente d'initialisation...",checkingColors:"\u{1F3A8} V\xE9rification des couleurs disponibles...",noColorsFound:"\u274C Aucune couleur trouv\xE9e. Ouvrez la palette de couleurs sur le site.",colorsFound:"\u2705 {count} couleurs disponibles trouv\xE9es",initSuccess:"\u2705 Guard-BOT initialis\xE9 avec succ\xE8s",initError:"\u274C Erreur lors de l'initialisation de Guard-BOT",invalidCoords:"\u274C Coordonn\xE9es invalides",invalidArea:"\u274C La zone doit avoir le coin sup\xE9rieur gauche inf\xE9rieur au coin inf\xE9rieur droit",areaTooLarge:"\u274C Zone trop grande: {size} pixels (maximum: {max})",capturingArea:"\u{1F4F8} Capture de la zone de protection...",areaCaptured:"\u2705 Zone captur\xE9e: {count} pixels sous protection",captureError:"\u274C Erreur lors de la capture de zone: {error}",captureFirst:"\u274C Capturez d'abord une zone de protection",protectionStarted:"\u{1F6E1}\uFE0F Protection d\xE9marr\xE9e - surveillance de la zone",protectionStopped:"\u23F9\uFE0F Protection arr\xEAt\xE9e",noChanges:"\u2705 Zone prot\xE9g\xE9e - aucun changement d\xE9tect\xE9",changesDetected:"\u{1F6A8} {count} changements d\xE9tect\xE9s dans la zone prot\xE9g\xE9e",repairing:"\u{1F6E0}\uFE0F R\xE9paration de {count} pixels alt\xE9r\xE9s...",repairedSuccess:"\u2705 {count} pixels r\xE9par\xE9s avec succ\xE8s",repairError:"\u274C Erreur lors de la r\xE9paration des pixels: {error}",noCharges:"\u26A0\uFE0F Charges insuffisantes pour r\xE9parer les changements",checkingChanges:"\u{1F50D} V\xE9rification des changements dans la zone prot\xE9g\xE9e...",errorChecking:"\u274C Erreur lors de la v\xE9rification des changements: {error}",guardActive:"\u{1F6E1}\uFE0F Gardien actif - zone sous protection",lastCheck:"Derni\xE8re v\xE9rification: {time}",nextCheck:"Prochaine v\xE9rification dans: {time}s",autoInitializing:"\u{1F916} Initialisation automatique...",autoInitSuccess:"\u2705 Guard-BOT d\xE9marr\xE9 automatiquement",autoInitFailed:"\u26A0\uFE0F Impossible de d\xE9marrer automatiquement. Utilisez le bouton manuel.",manualInitRequired:"\u{1F527} Initialisation manuelle requise",paletteDetected:"\u{1F3A8} Palette de couleurs d\xE9tect\xE9e",paletteNotFound:"\u{1F50D} Recherche de la palette de couleurs...",clickingPaintButton:"\u{1F446} Clic sur le bouton Paint...",paintButtonNotFound:"\u274C Bouton Paint introuvable",selectUpperLeft:"\u{1F3AF} Peignez un pixel au coin SUP\xC9RIEUR GAUCHE de la zone \xE0 prot\xE9ger",selectLowerRight:"\u{1F3AF} Maintenant peignez un pixel au coin INF\xC9RIEUR DROIT de la zone",waitingUpperLeft:"\u{1F446} En attente de la s\xE9lection du coin sup\xE9rieur gauche...",waitingLowerRight:"\u{1F446} En attente de la s\xE9lection du coin inf\xE9rieur droit...",upperLeftCaptured:"\u2705 Coin sup\xE9rieur gauche captur\xE9: ({x}, {y})",lowerRightCaptured:"\u2705 Coin inf\xE9rieur droit captur\xE9: ({x}, {y})",selectionTimeout:"\u274C D\xE9lai de s\xE9lection d\xE9pass\xE9",selectionError:"\u274C Erreur de s\xE9lection, veuillez r\xE9essayer",logWindow:"Logs",logWindowTitle:"Logs - {botName}",downloadLogs:"T\xE9l\xE9charger Logs",clearLogs:"Effacer Logs",closeLogs:"Fermer",analysisTitle:"Analyse des Diff\xE9rences - JSON vs Canvas Actuel",correctPixels:"Pixels Corrects",incorrectPixels:"Pixels Incorrects",missingPixels:"Pixels Manquants",showCorrect:"Afficher Corrects",showIncorrect:"Afficher Incorrects",showMissing:"Afficher Manquants",autoRefresh:"Actualisation automatique",zoomAdjusted:"Zoom ajust\xE9 automatiquement \xE0",autoRefreshEnabled:"Actualisation automatique activ\xE9e toutes les",autoRefreshDisabled:"Actualisation automatique d\xE9sactiv\xE9e",autoRefreshIntervalUpdated:"Intervalle d'actualisation automatique mis \xE0 jour \xE0",visualizationUpdated:"Visualisation mise \xE0 jour",configTitle:"Configuration du Guard",protectionPatterns:"Mod\xE8les de Protection",preferSpecificColor:"Prioriser une couleur sp\xE9cifique",excludeSpecificColors:"Ne pas r\xE9parer les couleurs sp\xE9cifiques",loadManagement:"Gestion des Charges",minLoadsToWait:"Minimum de charges \xE0 attendre",pixelsPerBatch:"Pixels par lot",spendAllPixelsOnStart:"D\xE9penser tous les pixels au d\xE9marrage",waitTimes:"Temps d'Attente",useRandomTimes:"Utiliser des temps al\xE9atoires entre les lots",minTime:"Temps minimum (s)",maxTime:"Temps maximum (s)"}}});var Lo,Mo=_(()=>{Lo={launcher:{title:"WPlace AutoBOT",autoFarm:"\u{1F33E} \u0410\u0432\u0442\u043E-\u0424\u0430\u0440\u043C",autoImage:"\u{1F3A8} \u0410\u0432\u0442\u043E-\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435",autoGuard:"\u{1F6E1}\uFE0F \u0410\u0432\u0442\u043E-\u0417\u0430\u0449\u0438\u0442\u0430",selection:"\u0412\u044B\u0431\u0440\u0430\u043D\u043E",user:"\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C",charges:"\u0418\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F",backend:"\u0411\u044D\u043A\u0435\u043D\u0434",database:"\u0411\u0430\u0437\u0430 \u0434\u0430\u043D\u043D\u044B\u0445",uptime:"\u0412\u0440\u0435\u043C\u044F \u0440\u0430\u0431\u043E\u0442\u044B",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",launch:"\u0417\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C",loading:"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430",executing:"\u0412\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0435",downloading:"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0441\u043A\u0440\u0438\u043F\u0442\u0430...",chooseBot:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0431\u043E\u0442\u0430 \u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \u0417\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C",readyToLaunch:"\u0413\u043E\u0442\u043E\u0432\u043E \u043A \u0437\u0430\u043F\u0443\u0441\u043A\u0443",loadError:"\u041E\u0448\u0438\u0431\u043A\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438",loadErrorMsg:"\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0431\u043E\u0442\u0430. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u0438\u043B\u0438 \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437.",checking:"\u{1F504} \u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430...",online:"\u{1F7E2} \u041E\u043D\u043B\u0430\u0439\u043D",offline:"\u{1F534} \u041E\u0444\u043B\u0430\u0439\u043D",ok:"\u{1F7E2} \u041E\u041A",error:"\u{1F534} \u041E\u0448\u0438\u0431\u043A\u0430",unknown:"-",logWindow:"Logs",logWindowTitle:"\u041B\u043E\u0433\u0438 - {botName}",downloadLogs:"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u041B\u043E\u0433\u0438",clearLogs:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u041B\u043E\u0433\u0438",closeLogs:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C"},image:{title:"WPlace \u0410\u0432\u0442\u043E-\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435",initBot:"\u0418\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C Auto-BOT",uploadImage:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435",resizeImage:"\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u0440\u0430\u0437\u043C\u0435\u0440 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",selectPosition:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u043C\u0435\u0441\u0442\u043E \u043D\u0430\u0447\u0430\u043B\u0430",startPainting:"\u041D\u0430\u0447\u0430\u0442\u044C \u0440\u0438\u0441\u043E\u0432\u0430\u0442\u044C",stopPainting:"\u041E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0440\u0438\u0441\u043E\u0432\u0430\u043D\u0438\u0435",saveProgress:"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u043F\u0440\u043E\u0433\u0440\u0435\u0441\u0441",loadProgress:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u043F\u0440\u043E\u0433\u0440\u0435\u0441\u0441",checkingColors:"\u{1F50D} \u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u0446\u0432\u0435\u0442\u043E\u0432...",noColorsFound:"\u274C \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u043F\u0430\u043B\u0438\u0442\u0440\u0443 \u0446\u0432\u0435\u0442\u043E\u0432 \u043D\u0430 \u0441\u0430\u0439\u0442\u0435 \u0438 \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0441\u043D\u043E\u0432\u0430!",colorsFound:"\u2705 \u041D\u0430\u0439\u0434\u0435\u043D\u043E {count} \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u0446\u0432\u0435\u0442\u043E\u0432",loadingImage:"\u{1F5BC}\uFE0F \u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F...",imageLoaded:"\u2705 \u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043E \u0441 {count} \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u043C\u0438 \u043F\u0438\u043A\u0441\u0435\u043B\u044F\u043C\u0438",imageError:"\u274C \u041E\u0448\u0438\u0431\u043A\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",selectPositionAlert:"\u041D\u0430\u0440\u0438\u0441\u0443\u0439\u0442\u0435 \u0441\u0442\u0430\u0440\u0442\u043E\u0432\u044B\u0439 \u043F\u0438\u043A\u0441\u0435\u043B\u044C \u0432 \u0442\u043E\u043C \u043C\u0435\u0441\u0442\u0435, \u0433\u0434\u0435 \u0432\u044B \u0445\u043E\u0442\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u0440\u0438\u0441\u0443\u043D\u043E\u043A \u043D\u0430\u0447\u0438\u043D\u0430\u043B\u0441\u044F!",waitingPosition:"\u{1F446} \u041E\u0436\u0438\u0434\u0430\u043D\u0438\u0435 \u0441\u0442\u0430\u0440\u0442\u043E\u0432\u043E\u0433\u043E \u043F\u0438\u043A\u0441\u0435\u043B\u044F....",positionSet:"\u2705 \u041F\u043E\u0437\u0438\u0446\u0438\u044F \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0430 \u0443\u0441\u043F\u0435\u0448\u043D\u043E!",positionTimeout:"\u274C \u0422\u0430\u0439\u043C\u0430\u0443\u0442 \u0432\u044B\u0431\u043E\u0440\u0430 \u043F\u043E\u0437\u0438\u0446\u0438\u0438",positionDetected:"\u{1F3AF} \u041F\u043E\u0437\u0438\u0446\u0438\u044F \u0432\u044B\u0431\u0440\u0430\u043D\u0430, \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430...",positionError:"\u274C \u041E\u0448\u0438\u0431\u043A\u0430 \u0432\u044B\u0431\u043E\u0440\u0430 \u043F\u043E\u0437\u0438\u0446\u0438\u0438, \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437",startPaintingMsg:"\u{1F3A8} \u041D\u0430\u0447\u0430\u043B\u043E \u0440\u0438\u0441\u043E\u0432\u0430\u043D\u0438\u044F...",paintingProgress:"\u{1F9F1} \u041F\u0440\u043E\u0433\u0440\u0435\u0441\u0441: {painted} \u0438\u0437 {total} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439...",noCharges:"\u231B \u041D\u0435\u0442 \u0437\u0430\u0440\u044F\u0434\u043E\u0432. \u041E\u0436\u0438\u0434\u0430\u043D\u0438\u0435 {time}...",paintingStopped:"\u23F9\uFE0F \u0420\u0438\u0441\u043E\u0432\u0430\u043D\u0438\u0435 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0435\u043C",paintingComplete:"\u2705 \u0420\u0438\u0441\u043E\u0432\u0430\u043D\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E! {count} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439 \u043D\u0430\u0440\u0438\u0441\u043E\u0432\u0430\u043D\u043E.",paintingError:"\u274C \u041E\u0448\u0438\u0431\u043A\u0430 \u0432 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0435 \u0440\u0438\u0441\u043E\u0432\u0430\u043D\u0438\u044F",missingRequirements:"\u274C \u0421\u043F\u0435\u0440\u0432\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0438 \u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043C\u0435\u0441\u0442\u043E \u043D\u0430\u0447\u0430\u043B\u0430",progress:"\u041F\u0440\u043E\u0433\u0440\u0435\u0441\u0441",userName:"\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C",pixels:"\u041F\u0438\u043A\u0441\u0435\u043B\u0438",charges:"\u0417\u0430\u0440\u044F\u0434\u044B",estimatedTime:"\u041F\u0440\u0435\u0434\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u0432\u0440\u0435\u043C\u044F",initMessage:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \xAB\u0417\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C Auto-BOT\xBB, \u0447\u0442\u043E\u0431\u044B \u043D\u0430\u0447\u0430\u0442\u044C",waitingInit:"\u041E\u0436\u0438\u0434\u0430\u043D\u0438\u0435 \u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u0438...",resizeSuccess:"\u2705 \u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u043E \u0434\u043E {width}x{height}",paintingPaused:"\u23F8\uFE0F \u0420\u0438\u0441\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u0440\u0438\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E \u043D\u0430 \u043F\u043E\u0437\u0438\u0446\u0438\u0438 X: {x}, Y: {y}",pixelsPerBatch:"\u041F\u0438\u043A\u0441\u0435\u043B\u0435\u0439 \u0432 \u043F\u0440\u043E\u0445\u043E\u0434\u0435",batchSize:"\u0420\u0430\u0437\u043C\u0435\u0440 \u043F\u0440\u043E\u0445\u043E\u0434\u0430",nextBatchTime:"\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439 \u043F\u0440\u043E\u0445\u043E\u0434 \u0447\u0435\u0440\u0435\u0437",useAllCharges:"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u0441\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0435 \u0437\u0430\u0440\u044F\u0434\u044B",showOverlay:"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043D\u0430\u043B\u043E\u0436\u0435\u043D\u0438\u0435",maxCharges:"\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u043A\u043E\u043B-\u0432\u043E \u0437\u0430\u0440\u044F\u0434\u043E\u0432 \u0437\u0430 \u043F\u0440\u043E\u0445\u043E\u0434",waitingForCharges:"\u23F3 \u041E\u0436\u0438\u0434\u0430\u043D\u0438\u0435 \u0437\u0430\u0440\u044F\u0434\u043E\u0432: {current} \u0438\u0437 {needed}",timeRemaining:"\u0412\u0440\u0435\u043C\u0435\u043D\u0438 \u043E\u0441\u0442\u0430\u043B\u043E\u0441\u044C",cooldownWaiting:"\u23F3 \u041E\u0436\u0438\u0434\u0430\u043D\u0438\u0435 {time} \u0434\u043B\u044F \u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0435\u043D\u0438\u044F...",progressSaved:"\u2705 \u041F\u0440\u043E\u0433\u0440\u0435\u0441\u0441 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D \u043A\u0430\u043A {filename}",progressLoaded:"\u2705 \u041F\u0440\u043E\u0433\u0440\u0435\u0441\u0441 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D: {painted} \u0438\u0437 {total} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439 \u043D\u0430\u0440\u0438\u0441\u043E\u0432\u0430\u043D\u043E",progressLoadError:"\u274C \u041E\u0448\u0438\u0431\u043A\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u043F\u0440\u043E\u0433\u0440\u0435\u0441\u0441\u0430: {error}",progressSaveError:"\u274C \u041E\u0448\u0438\u0431\u043A\u0430 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F \u043F\u0440\u043E\u0433\u0440\u0435\u0441\u0441\u0430: {error}",confirmSaveProgress:"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0442\u0435\u043A\u0443\u0449\u0438\u0439 \u043F\u0440\u043E\u0433\u0440\u0435\u0441\u0441 \u043F\u0435\u0440\u0435\u0434 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u043E\u0439?",saveProgressTitle:"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u043F\u0440\u043E\u0433\u0440\u0435\u0441\u0441",discardProgress:"\u041D\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u044F\u0442\u044C \u043F\u0440\u043E\u0433\u0440\u0435\u0441\u0441",cancel:"\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C",minimize:"\u0421\u0432\u0435\u0440\u043D\u0443\u0442\u044C",width:"\u0428\u0438\u0440\u0438\u043D\u0430",height:"\u0412\u044B\u0441\u043E\u0442\u0430",keepAspect:"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0441\u043E\u043E\u0442\u043D\u043E\u0448\u0435\u043D\u0438\u0435 \u0441\u0442\u043E\u0440\u043E\u043D",apply:"\u041F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C",overlayOn:"\u041D\u0430\u043B\u043E\u0436\u0435\u043D\u0438\u0435: \u0412\u041A\u041B",overlayOff:"\u041D\u0430\u043B\u043E\u0436\u0435\u043D\u0438\u0435: \u0412\u042B\u041A\u041B",passCompleted:"\u2705 \u041F\u0440\u043E\u0446\u0435\u0441\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D: {painted} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439 \u043D\u0430\u0440\u0438\u0441\u043E\u0432\u0430\u043D\u043E | \u041F\u0440\u043E\u0433\u0440\u0435\u0441\u0441: {percent}% ({current} \u0438\u0437 {total})",waitingChargesRegen:"\u23F3 \u041E\u0436\u0438\u0434\u0430\u043D\u0438\u0435 \u0432\u043E\u0441\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F \u0437\u0430\u0440\u044F\u0434\u0430: {current} \u0438\u0437 {needed} - \u0412\u0440\u0435\u043C\u044F: {time}",waitingChargesCountdown:"\u23F3 \u041E\u0436\u0438\u0434\u0430\u043D\u0438\u0435 \u0437\u0430\u0440\u044F\u0434\u043E\u0432: {current} \u0438\u0437 {needed} - \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F: {time}",autoInitializing:"\u{1F916} \u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F...",autoInitSuccess:"\u2705 \u0411\u043E\u0442 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u043B\u0441\u044F \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438",autoInitFailed:"\u26A0\uFE0F \u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0432\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u0430\u0432\u0442\u043E\u0437\u0430\u043F\u0443\u0441\u043A. \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \u043A\u043D\u043E\u043F\u043A\u0443 \u0440\u0443\u0447\u043D\u043E\u0433\u043E \u0437\u0430\u043F\u0443\u0441\u043A\u0430.",paletteDetected:"\u{1F3A8} \u0426\u0432\u0435\u0442\u043E\u0432\u0430\u044F \u043F\u0430\u043B\u0438\u0442\u0440\u0430 \u043E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D\u0430",paletteNotFound:"\u{1F50D} \u041F\u043E\u0438\u0441\u043A \u0446\u0432\u0435\u0442\u043E\u0432\u043E\u0439 \u043F\u0430\u043B\u0438\u0442\u0440\u044B...",clickingPaintButton:"\u{1F446} \u041D\u0430\u0436\u0430\u0442\u0438\u0435 \u043A\u043D\u043E\u043F\u043A\u0438 \xABPaint\xBB...",paintButtonNotFound:"\u274C \u041A\u043D\u043E\u043F\u043A\u0430 \xABPaint\xBB \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430",manualInitRequired:"\u{1F527} \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u0440\u0443\u0447\u043D\u0430\u044F \u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F",retryAttempt:"\u{1F504} \u041F\u043E\u0432\u0442\u043E\u0440\u043D\u0430\u044F \u043F\u043E\u043F\u044B\u0442\u043A\u0430 {attempt} \u0438\u0437 {maxAttempts} \u0447\u0435\u0440\u0435\u0437 {delay}s...",retryError:"\u{1F4A5} \u041E\u0448\u0438\u0431\u043A\u0430 \u0432 \u043F\u043E\u043F\u044B\u0442\u043A\u0435 {attempt} \u0438\u0437 {maxAttempts}, \u043F\u043E\u0432\u0442\u043E\u0440\u0435\u043D\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 {delay}s...",retryFailed:"\u274C \u041F\u0440\u043E\u0432\u0430\u043B\u0435\u043D\u043E \u0441\u043F\u0443\u0441\u0442\u044F {maxAttempts} \u043F\u043E\u043F\u044B\u0442\u043E\u043A. \u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0435\u043D\u0438\u0435 \u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C \u043F\u0440\u043E\u0445\u043E\u0434\u0435...",networkError:"\u{1F310} \u041E\u0448\u0438\u0431\u043A\u0430 \u0441\u0435\u0442\u0438. \u041F\u043E\u0432\u0442\u043E\u0440\u043D\u0430\u044F \u043F\u043E\u043F\u044B\u0442\u043A\u0430...",serverError:"\u{1F525} \u041E\u0448\u0438\u0431\u043A\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041F\u043E\u0432\u0442\u043E\u0440\u043D\u0430\u044F \u043F\u043E\u043F\u044B\u0442\u043A\u0430...",timeoutError:"\u23F0 \u0422\u0430\u0439\u043C-\u0430\u0443\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u0430\u044F \u043F\u043E\u043F\u044B\u0442\u043A\u0430...",protectionEnabled:"\u0417\u0430\u0449\u0438\u0442\u0430 \u0432\u043A\u043B\u044E\u0447\u0435\u043D\u0430",protectionDisabled:"\u0417\u0430\u0449\u0438\u0442\u0430 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0430",paintPattern:"\u0428\u0430\u0431\u043B\u043E\u043D \u0440\u0438\u0441\u043E\u0432\u0430\u043D\u0438\u044F",patternLinearStart:"\u041B\u0438\u043D\u0435\u0439\u043D\u044B\u0439 (\u043D\u0430\u0447\u0430\u043B\u043E)",patternLinearEnd:"\u041B\u0438\u043D\u0435\u0439\u043D\u044B\u0439 (\u043A\u043E\u043D\u0435\u0446)",patternRandom:"\u0421\u043B\u0443\u0447\u0430\u0439\u043D\u044B\u0439",patternCenterOut:"\u0418\u0437 \u0446\u0435\u043D\u0442\u0440\u0430 \u043D\u0430\u0440\u0443\u0436\u0443",patternCornersFirst:"\u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0443\u0433\u043B\u044B",patternSpiral:"\u0421\u043F\u0438\u0440\u0430\u043B\u044C",solid:"\u0421\u043F\u043B\u043E\u0448\u043D\u043E\u0439",stripes:"\u041F\u043E\u043B\u043E\u0441\u044B",checkerboard:"\u0428\u0430\u0445\u043C\u0430\u0442\u043D\u0430\u044F \u0434\u043E\u0441\u043A\u0430",gradient:"\u0413\u0440\u0430\u0434\u0438\u0435\u043D\u0442",dots:"\u0422\u043E\u0447\u043A\u0438",waves:"\u0412\u043E\u043B\u043D\u044B",spiral:"\u0421\u043F\u0438\u0440\u0430\u043B\u044C",mosaic:"\u041C\u043E\u0437\u0430\u0438\u043A\u0430",bricks:"\u041A\u0438\u0440\u043F\u0438\u0447\u0438",zigzag:"\u0417\u0438\u0433\u0437\u0430\u0433",protectingDrawing:"\u0417\u0430\u0449\u0438\u0442\u0430 \u0440\u0438\u0441\u0443\u043D\u043A\u0430...",changesDetected:"\u{1F6A8} \u041E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D\u043E \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439: {count}",repairing:"\u{1F527} \u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 {count} \u0438\u0437\u043C\u0435\u043D\u0451\u043D\u043D\u044B\u0445 \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439...",repairCompleted:"\u2705 \u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E: {count} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439",noChargesForRepair:"\u26A1 \u041A\u043E\u043C\u0438\u0441\u0441\u0438\u0439 \u0437\u0430 \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u043D\u0435\u0442, \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u0435...",protectionPriority:"\u{1F6E1}\uFE0F \u041F\u0440\u0438\u043E\u0440\u0438\u0442\u0435\u0442 \u0437\u0430\u0449\u0438\u0442\u044B \u0430\u043A\u0442\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D",patternApplied:"\u0428\u0430\u0431\u043B\u043E\u043D \u043F\u0440\u0438\u043C\u0435\u043D\u0451\u043D",customPattern:"\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0439 \u0448\u0430\u0431\u043B\u043E\u043D",logWindow:"Logs",logWindowTitle:"\u041B\u043E\u0433\u0438 - {botName}",downloadLogs:"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u041B\u043E\u0433\u0438",clearLogs:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u041B\u043E\u0433\u0438",closeLogs:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C"},farm:{title:"WPlace \u0410\u0432\u0442\u043E-\u0424\u0430\u0440\u043C",start:"\u041D\u0430\u0447\u0430\u0442\u044C",stop:"\u041E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C",stopped:"\u0411\u043E\u0442 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D",calibrate:"\u041A\u0430\u043B\u0438\u0431\u0440\u043E\u0432\u0430\u0442\u044C",paintOnce:"\u0415\u0434\u0438\u043D\u043E\u0440\u0430\u0437\u043E\u0432\u043E",checkingStatus:"\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0441\u0442\u0430\u0442\u0443\u0441\u0430...",configuration:"\u041A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044F",delay:"\u0417\u0430\u0434\u0435\u0440\u0436\u043A\u0430 (\u043C\u0441)",pixelsPerBatch:"\u041F\u0438\u043A\u0441\u0435\u043B\u0435\u0439 \u0437\u0430 \u043F\u0440\u043E\u0445\u043E\u0434",minCharges:"\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u043A\u043E\u043B-\u0432\u043E",colorMode:"\u0420\u0435\u0436\u0438\u043C \u0446\u0432\u0435\u0442\u043E\u0432",random:"\u0421\u043B\u0443\u0447\u0430\u0439\u043D\u044B\u0439",fixed:"\u0424\u0438\u043A\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439",range:"\u0414\u0438\u0430\u043F\u0430\u0437\u043E\u043D",fixedColor:"\u0424\u0438\u043A\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0446\u0432\u0435\u0442",advanced:"\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u044B\u0435",tileX:"\u041F\u043B\u0438\u0442\u043A\u0430 X",tileY:"\u041F\u043B\u0438\u0442\u043A\u0430 Y",customPalette:"\u0421\u0432\u043E\u044F \u043F\u0430\u043B\u0438\u0442\u0440\u0430",paletteExample:"\u043F\u0440\u0438\u043C\u0435\u0440: #FF0000,#00FF00,#0000FF",capture:"\u0417\u0430\u0445\u0432\u0430\u0442",painted:"\u0417\u0430\u043A\u0440\u0430\u0448\u0435\u043D\u043E",charges:"\u0417\u0430\u0440\u044F\u0434\u044B",retries:"\u041F\u043E\u0432\u0442\u043E\u0440\u043D\u044B\u0435 \u043F\u043E\u043F\u044B\u0442\u043A\u0438",tile:"\u041F\u043B\u0438\u0442\u043A\u0430",configSaved:"\u041A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044F \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0430",configLoaded:"\u041A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044F \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u0430",configReset:"\u0421\u0431\u0440\u043E\u0441 \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438",captureInstructions:"\u041D\u0430\u0440\u0438\u0441\u0443\u0439\u0442\u0435 \u043F\u0438\u043A\u0441\u0435\u043B\u044C \u0432\u0440\u0443\u0447\u043D\u0443\u044E \u0434\u043B\u044F \u0437\u0430\u0445\u0432\u0430\u0442\u0430 \u043A\u043E\u043E\u0440\u0434\u0438\u043D\u0430\u0442...",backendOnline:"\u0411\u044D\u043A\u044D\u043D\u0434 \u041E\u043D\u043B\u0430\u0439\u043D",backendOffline:"\u0411\u044D\u043A\u044D\u043D\u0434 \u041E\u0444\u043B\u0430\u0439\u043D",startingBot:"\u0417\u0430\u043F\u0443\u0441\u043A \u0431\u043E\u0442\u0430...",stoppingBot:"\u041E\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0430 \u0431\u043E\u0442\u0430...",calibrating:"\u041A\u0430\u043B\u0438\u0431\u0440\u043E\u0432\u043A\u0430...",alreadyRunning:"\u0410\u0432\u0442\u043E-\u0424\u0430\u0440\u043C \u0443\u0436\u0435 \u0437\u0430\u043F\u0443\u0449\u0435\u043D",imageRunningWarning:"\u0410\u0432\u0442\u043E-\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0437\u0430\u043F\u0443\u0449\u0435\u043D\u043E. \u0417\u0430\u043A\u0440\u043E\u0439\u0442\u0435 \u0435\u0433\u043E \u043F\u0435\u0440\u0435\u0434 \u0437\u0430\u043F\u0443\u0441\u043A\u043E\u043C \u0410\u0432\u0442\u043E-\u0424\u0430\u0440\u043C\u0430.",selectPosition:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C",selectPositionAlert:"\u{1F3AF} \u041D\u0430\u0440\u0438\u0441\u0443\u0439\u0442\u0435 \u043F\u0438\u043A\u0441\u0435\u043B\u044C \u0432 \u041F\u0423\u0421\u0422\u041E\u0419 \u043E\u0431\u043B\u0430\u0441\u0442\u0438 \u043A\u0430\u0440\u0442\u044B, \u0447\u0442\u043E\u0431\u044B \u043E\u0431\u043E\u0437\u043D\u0430\u0447\u0438\u0442\u044C \u043E\u0431\u043B\u0430\u0441\u0442\u044C \u0444\u0430\u0440\u043C\u0430.",waitingPosition:"\u{1F446} \u041E\u0436\u0438\u0434\u0430\u043D\u0438\u0435 \u0441\u0442\u0430\u0440\u0442\u043E\u0432\u043E\u0433\u043E \u043F\u0438\u043A\u0441\u0435\u043B\u044F....",positionSet:"\u2705 \u041E\u0431\u043B\u0430\u0441\u0442\u044C \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0430! \u0420\u0430\u0434\u0438\u0443\u0441: 500px",positionTimeout:"\u274C \u0422\u0430\u0439\u043C\u0430\u0443\u0442 \u0432\u044B\u0431\u043E\u0440\u0430 \u043E\u0431\u043B\u0430\u0441\u0442\u0438",missingPosition:"\u274C \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0431\u043B\u0430\u0441\u0442\u044C \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \xAB\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u043E\u0431\u043B\u0430\u0441\u0442\u044C\xBB",farmRadius:"\u0420\u0430\u0434\u0438\u0443\u0441 \u0444\u0430\u0440\u043C\u0430",positionInfo:"\u0422\u0435\u043A\u0443\u0449\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C",farmingInRadius:"\u{1F33E} \u0424\u0430\u0440\u043C \u0432 \u0440\u0430\u0434\u0438\u0443\u0441\u0435 {radius}px \u043E\u0442 ({x},{y})",selectEmptyArea:"\u26A0\uFE0F \u0412\u0410\u0416\u041D\u041E: \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u041F\u0423\u0421\u0422\u0423\u042E \u043E\u0431\u043B\u0430\u0441\u0442\u044C, \u0447\u0442\u043E\u0431\u044B \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044C \u043A\u043E\u043D\u0444\u043B\u0438\u043A\u0442\u043E\u0432.",noPosition:"\u041D\u0435\u0442 \u043E\u0431\u043B\u0430\u0441\u0442\u0438",currentZone:"\u041E\u0431\u043B\u0430\u0441\u0442\u044C: ({x},{y})",autoSelectPosition:"\u{1F3AF} \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0431\u043B\u0430\u0441\u0442\u044C. \u041D\u0430\u0440\u0438\u0441\u0443\u0439\u0442\u0435 \u043F\u0438\u043A\u0441\u0435\u043B\u044C \u043D\u0430 \u043A\u0430\u0440\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u043E\u0431\u043E\u0437\u043D\u0430\u0447\u0438\u0442\u044C \u043E\u0431\u043B\u0430\u0441\u0442\u044C \u0444\u0430\u0440\u043C\u0430.",logWindow:"Logs",logWindowTitle:"\u041B\u043E\u0433\u0438 - {botName}",downloadLogs:"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u041B\u043E\u0433\u0438",clearLogs:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u041B\u043E\u0433\u0438",closeLogs:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C"},common:{yes:"\u0414\u0430",no:"\u041D\u0435\u0442",ok:"\u041E\u041A",cancel:"\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",save:"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C",load:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C",delete:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C",edit:"\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C",start:"\u041D\u0430\u0447\u0430\u0442\u044C",stop:"\u0417\u0430\u043A\u043E\u043D\u0447\u0438\u0442\u044C",pause:"\u041F\u0440\u0438\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C",resume:"\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C",reset:"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C",settings:"\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438",help:"\u041F\u043E\u043C\u043E\u0449\u044C",about:"\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F",language:"\u042F\u0437\u044B\u043A",loading:"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430...",error:"\u041E\u0448\u0438\u0431\u043A\u0430",success:"\u0423\u0441\u043F\u0435\u0445",warning:"\u041F\u0440\u0435\u0434\u0443\u043F\u0440\u0435\u0436\u0434\u0435\u043D\u0438\u0435",info:"\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F",languageChanged:"\u042F\u0437\u044B\u043A \u0438\u0437\u043C\u0435\u043D\u0435\u043D \u043D\u0430 {language}"},guard:{title:"WPlace \u0410\u0432\u0442\u043E-\u0417\u0430\u0449\u0438\u0442\u0430",initBot:"\u0418\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C Guard-BOT",selectArea:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u041E\u0431\u043B\u0430\u0441\u0442\u044C",captureArea:"\u0417\u0430\u0445\u0432\u0430\u0442\u0438\u0442\u044C \u041E\u0431\u043B\u0430\u0441\u0442\u044C",startProtection:"\u041D\u0430\u0447\u0430\u0442\u044C \u0417\u0430\u0449\u0438\u0442\u0443",stopProtection:"\u041E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0417\u0430\u0449\u0438\u0442\u0443",upperLeft:"\u0412\u0435\u0440\u0445\u043D\u0438\u0439 \u041B\u0435\u0432\u044B\u0439 \u0423\u0433\u043E\u043B",lowerRight:"\u041D\u0438\u0436\u043D\u0438\u0439 \u041F\u0440\u0430\u0432\u044B\u0439 \u0423\u0433\u043E\u043B",protectedPixels:"\u0417\u0430\u0449\u0438\u0449\u0435\u043D\u043D\u044B\u0435 \u041F\u0438\u043A\u0441\u0435\u043B\u0438",detectedChanges:"\u041E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0435 \u0418\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F",repairedPixels:"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u044B\u0435 \u041F\u0438\u043A\u0441\u0435\u043B\u0438",charges:"\u0417\u0430\u0440\u044F\u0434\u044B",waitingInit:"\u041E\u0436\u0438\u0434\u0430\u043D\u0438\u0435 \u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u0438...",checkingColors:"\u{1F3A8} \u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u0446\u0432\u0435\u0442\u043E\u0432...",noColorsFound:"\u274C \u0426\u0432\u0435\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u043F\u0430\u043B\u0438\u0442\u0440\u0443 \u0446\u0432\u0435\u0442\u043E\u0432 \u043D\u0430 \u0441\u0430\u0439\u0442\u0435.",colorsFound:"\u2705 \u041D\u0430\u0439\u0434\u0435\u043D\u043E {count} \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u0446\u0432\u0435\u0442\u043E\u0432",initSuccess:"\u2705 Guard-BOT \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u043D",initError:"\u274C \u041E\u0448\u0438\u0431\u043A\u0430 \u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u0438 Guard-BOT",invalidCoords:"\u274C \u041D\u0435\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043A\u043E\u043E\u0440\u0434\u0438\u043D\u0430\u0442\u044B",invalidArea:"\u274C \u041E\u0431\u043B\u0430\u0441\u0442\u044C \u0434\u043E\u043B\u0436\u043D\u0430 \u0438\u043C\u0435\u0442\u044C \u0432\u0435\u0440\u0445\u043D\u0438\u0439 \u043B\u0435\u0432\u044B\u0439 \u0443\u0433\u043E\u043B \u043C\u0435\u043D\u044C\u0448\u0435 \u043D\u0438\u0436\u043D\u0435\u0433\u043E \u043F\u0440\u0430\u0432\u043E\u0433\u043E \u0443\u0433\u043B\u0430",areaTooLarge:"\u274C \u041E\u0431\u043B\u0430\u0441\u0442\u044C \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u0430\u044F: {size} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439 (\u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C: {max})",capturingArea:"\u{1F4F8} \u0417\u0430\u0445\u0432\u0430\u0442 \u043E\u0431\u043B\u0430\u0441\u0442\u0438 \u0437\u0430\u0449\u0438\u0442\u044B...",areaCaptured:"\u2705 \u041E\u0431\u043B\u0430\u0441\u0442\u044C \u0437\u0430\u0445\u0432\u0430\u0447\u0435\u043D\u0430: {count} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439 \u043F\u043E\u0434 \u0437\u0430\u0449\u0438\u0442\u043E\u0439",captureError:"\u274C \u041E\u0448\u0438\u0431\u043A\u0430 \u0437\u0430\u0445\u0432\u0430\u0442\u0430 \u043E\u0431\u043B\u0430\u0441\u0442\u0438: {error}",captureFirst:"\u274C \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0437\u0430\u0445\u0432\u0430\u0442\u0438\u0442\u0435 \u043E\u0431\u043B\u0430\u0441\u0442\u044C \u0437\u0430\u0449\u0438\u0442\u044B",protectionStarted:"\u{1F6E1}\uFE0F \u0417\u0430\u0449\u0438\u0442\u0430 \u0437\u0430\u043F\u0443\u0449\u0435\u043D\u0430 - \u043C\u043E\u043D\u0438\u0442\u043E\u0440\u0438\u043D\u0433 \u043E\u0431\u043B\u0430\u0441\u0442\u0438",protectionStopped:"\u23F9\uFE0F \u0417\u0430\u0449\u0438\u0442\u0430 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0430",noChanges:"\u2705 \u0417\u0430\u0449\u0438\u0449\u0435\u043D\u043D\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C - \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439 \u043D\u0435 \u043E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D\u043E",changesDetected:"\u{1F6A8} {count} \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439 \u043E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D\u043E \u0432 \u0437\u0430\u0449\u0438\u0449\u0435\u043D\u043D\u043E\u0439 \u043E\u0431\u043B\u0430\u0441\u0442\u0438",repairing:"\u{1F6E0}\uFE0F \u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 {count} \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u043D\u044B\u0445 \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439...",repairedSuccess:"\u2705 \u0423\u0441\u043F\u0435\u0448\u043D\u043E \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E {count} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439",repairError:"\u274C \u041E\u0448\u0438\u0431\u043A\u0430 \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439: {error}",noCharges:"\u26A0\uFE0F \u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u0437\u0430\u0440\u044F\u0434\u043E\u0432 \u0434\u043B\u044F \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439",checkingChanges:"\u{1F50D} \u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439 \u0432 \u0437\u0430\u0449\u0438\u0449\u0435\u043D\u043D\u043E\u0439 \u043E\u0431\u043B\u0430\u0441\u0442\u0438...",errorChecking:"\u274C \u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439: {error}",guardActive:"\u{1F6E1}\uFE0F \u0421\u0442\u0440\u0430\u0436 \u0430\u043A\u0442\u0438\u0432\u0435\u043D - \u043E\u0431\u043B\u0430\u0441\u0442\u044C \u043F\u043E\u0434 \u0437\u0430\u0449\u0438\u0442\u043E\u0439",lastCheck:"\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430: {time}",nextCheck:"\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0447\u0435\u0440\u0435\u0437: {time}\u0441",autoInitializing:"\u{1F916} \u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F...",autoInitSuccess:"\u2705 Guard-BOT \u0437\u0430\u043F\u0443\u0449\u0435\u043D \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438",autoInitFailed:"\u26A0\uFE0F \u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438. \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \u043A\u043D\u043E\u043F\u043A\u0443 \u0440\u0443\u0447\u043D\u043E\u0433\u043E \u0437\u0430\u043F\u0443\u0441\u043A\u0430.",manualInitRequired:"\u{1F527} \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u0440\u0443\u0447\u043D\u0430\u044F \u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F",paletteDetected:"\u{1F3A8} \u0426\u0432\u0435\u0442\u043E\u0432\u0430\u044F \u043F\u0430\u043B\u0438\u0442\u0440\u0430 \u043E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D\u0430",paletteNotFound:"\u{1F50D} \u041F\u043E\u0438\u0441\u043A \u0446\u0432\u0435\u0442\u043E\u0432\u043E\u0439 \u043F\u0430\u043B\u0438\u0442\u0440\u044B...",clickingPaintButton:"\u{1F446} \u041D\u0430\u0436\u0430\u0442\u0438\u0435 \u043A\u043D\u043E\u043F\u043A\u0438 \xABPaint\xBB...",paintButtonNotFound:"\u274C \u041A\u043D\u043E\u043F\u043A\u0430 \xABPaint\xBB \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430",selectUpperLeft:"\u{1F3AF} \u041D\u0430\u0440\u0438\u0441\u0443\u0439\u0442\u0435 \u043F\u0438\u043A\u0441\u0435\u043B\u044C \u0432 \u0412\u0415\u0420\u0425\u041D\u0415\u041C \u041B\u0415\u0412\u041E\u041C \u0443\u0433\u043B\u0443 \u043E\u0431\u043B\u0430\u0441\u0442\u0438 \u0434\u043B\u044F \u0437\u0430\u0449\u0438\u0442\u044B",selectLowerRight:"\u{1F3AF} \u0422\u0435\u043F\u0435\u0440\u044C \u043D\u0430\u0440\u0438\u0441\u0443\u0439\u0442\u0435 \u043F\u0438\u043A\u0441\u0435\u043B\u044C \u0432 \u041D\u0418\u0416\u041D\u0415\u041C \u041F\u0420\u0410\u0412\u041E\u041C \u0443\u0433\u043B\u0443 \u043E\u0431\u043B\u0430\u0441\u0442\u0438",waitingUpperLeft:"\u{1F446} \u041E\u0436\u0438\u0434\u0430\u043D\u0438\u0435 \u0432\u044B\u0431\u043E\u0440\u0430 \u0432\u0435\u0440\u0445\u043D\u0435\u0433\u043E \u043B\u0435\u0432\u043E\u0433\u043E \u0443\u0433\u043B\u0430...",waitingLowerRight:"\u{1F446} \u041E\u0436\u0438\u0434\u0430\u043D\u0438\u0435 \u0432\u044B\u0431\u043E\u0440\u0430 \u043D\u0438\u0436\u043D\u0435\u0433\u043E \u043F\u0440\u0430\u0432\u043E\u0433\u043E \u0443\u0433\u043B\u0430...",upperLeftCaptured:"\u2705 \u0412\u0435\u0440\u0445\u043D\u0438\u0439 \u043B\u0435\u0432\u044B\u0439 \u0443\u0433\u043E\u043B \u0437\u0430\u0445\u0432\u0430\u0447\u0435\u043D: ({x}, {y})",lowerRightCaptured:"\u2705 \u041D\u0438\u0436\u043D\u0438\u0439 \u043F\u0440\u0430\u0432\u044B\u0439 \u0443\u0433\u043E\u043B \u0437\u0430\u0445\u0432\u0430\u0447\u0435\u043D: ({x}, {y})",selectionTimeout:"\u274C \u0422\u0430\u0439\u043C-\u0430\u0443\u0442 \u0432\u044B\u0431\u043E\u0440\u0430",selectionError:"\u274C \u041E\u0448\u0438\u0431\u043A\u0430 \u0432\u044B\u0431\u043E\u0440\u0430, \u043F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0441\u043D\u043E\u0432\u0430",logWindow:"Logs",logWindowTitle:"\u041B\u043E\u0433\u0438 - {botName}",downloadLogs:"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u041B\u043E\u0433\u0438",clearLogs:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u041B\u043E\u0433\u0438",closeLogs:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",analysisTitle:"\u0410\u043D\u0430\u043B\u0438\u0437 \u0420\u0430\u0437\u043B\u0438\u0447\u0438\u0439 - JSON vs \u0422\u0435\u043A\u0443\u0449\u0438\u0439 Canvas",correctPixels:"\u041F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u044B\u0435 \u041F\u0438\u043A\u0441\u0435\u043B\u0438",incorrectPixels:"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u044B\u0435 \u041F\u0438\u043A\u0441\u0435\u043B\u0438",missingPixels:"\u041E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0435 \u041F\u0438\u043A\u0441\u0435\u043B\u0438",showCorrect:"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u041F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u044B\u0435",showIncorrect:"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u044B\u0435",showMissing:"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u041E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0435",autoRefresh:"\u0410\u0432\u0442\u043E-\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435",zoomAdjusted:"\u041C\u0430\u0441\u0448\u0442\u0430\u0431 \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043D \u043D\u0430",autoRefreshEnabled:"\u0410\u0432\u0442\u043E-\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u0432\u043A\u043B\u044E\u0447\u0435\u043D\u043E \u043A\u0430\u0436\u0434\u044B\u0435",autoRefreshDisabled:"\u0410\u0432\u0442\u043E-\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E",autoRefreshIntervalUpdated:"\u0418\u043D\u0442\u0435\u0440\u0432\u0430\u043B \u0430\u0432\u0442\u043E-\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D \u0434\u043E",visualizationUpdated:"\u0412\u0438\u0437\u0443\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0430",configTitle:"\u041A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044F Guard",protectionPatterns:"\u0428\u0430\u0431\u043B\u043E\u043D\u044B \u0417\u0430\u0449\u0438\u0442\u044B",preferSpecificColor:"\u041F\u0440\u0438\u043E\u0440\u0438\u0442\u0435\u0442 \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u043D\u043E\u0433\u043E \u0446\u0432\u0435\u0442\u0430",excludeSpecificColors:"\u041D\u0435 \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0442\u044C \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u043D\u044B\u0435 \u0446\u0432\u0435\u0442\u0430",loadManagement:"\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u041D\u0430\u0433\u0440\u0443\u0437\u043A\u043E\u0439",minLoadsToWait:"\u041C\u0438\u043D\u0438\u043C\u0443\u043C \u0437\u0430\u0433\u0440\u0443\u0437\u043E\u043A \u0434\u043B\u044F \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F",pixelsPerBatch:"\u041F\u0438\u043A\u0441\u0435\u043B\u0435\u0439 \u0437\u0430 \u043F\u0430\u0440\u0442\u0438\u044E",spendAllPixelsOnStart:"\u041F\u043E\u0442\u0440\u0430\u0442\u0438\u0442\u044C \u0432\u0441\u0435 \u043F\u0438\u043A\u0441\u0435\u043B\u0438 \u043F\u0440\u0438 \u0437\u0430\u043F\u0443\u0441\u043A\u0435",waitTimes:"\u0412\u0440\u0435\u043C\u044F \u041E\u0436\u0438\u0434\u0430\u043D\u0438\u044F",useRandomTimes:"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0441\u043B\u0443\u0447\u0430\u0439\u043D\u043E\u0435 \u0432\u0440\u0435\u043C\u044F \u043C\u0435\u0436\u0434\u0443 \u043F\u0430\u0440\u0442\u0438\u044F\u043C\u0438",minTime:"\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0432\u0440\u0435\u043C\u044F (\u0441)",maxTime:"\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0432\u0440\u0435\u043C\u044F (\u0441)"}}});var Ro,$o=_(()=>{Ro={launcher:{title:"WPlace \u81EA\u52A8\u673A\u5668\u4EBA",autoFarm:"\u{1F33E} \u81EA\u52A8\u519C\u573A",autoImage:"\u{1F3A8} \u81EA\u52A8\u7ED8\u56FE",autoGuard:"\u{1F6E1}\uFE0F \u81EA\u52A8\u5B88\u62A4",selection:"\u9009\u62E9",user:"\u7528\u6237",charges:"\u6B21\u6570",backend:"\u540E\u7AEF",database:"\u6570\u636E\u5E93",uptime:"\u8FD0\u884C\u65F6\u95F4",close:"\u5173\u95ED",launch:"\u542F\u52A8",loading:"\u52A0\u8F7D\u4E2D\u2026",executing:"\u6267\u884C\u4E2D\u2026",downloading:"\u6B63\u5728\u4E0B\u8F7D\u811A\u672C\u2026",chooseBot:"\u9009\u62E9\u4E00\u4E2A\u673A\u5668\u4EBA\u5E76\u70B9\u51FB\u542F\u52A8",readyToLaunch:"\u51C6\u5907\u542F\u52A8",loadError:"\u52A0\u8F7D\u9519\u8BEF",loadErrorMsg:"\u65E0\u6CD5\u52A0\u8F7D\u6240\u9009\u673A\u5668\u4EBA\u3002\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u6216\u91CD\u8BD5\u3002",checking:"\u{1F504} \u68C0\u67E5\u4E2D...",online:"\u{1F7E2} \u5728\u7EBF",offline:"\u{1F534} \u79BB\u7EBF",ok:"\u{1F7E2} \u6B63\u5E38",error:"\u{1F534} \u9519\u8BEF",unknown:"-",logWindow:"\u{1F4CB} Logs",logWindowTitle:"\u65E5\u5FD7\u7A97\u53E3",downloadLogs:"\u4E0B\u8F7D\u65E5\u5FD7",clearLogs:"\u6E05\u9664\u65E5\u5FD7",closeLogs:"\u5173\u95ED"},image:{title:"WPlace \u81EA\u52A8\u7ED8\u56FE",initBot:"\u521D\u59CB\u5316\u81EA\u52A8\u673A\u5668\u4EBA",uploadImage:"\u4E0A\u4F20\u56FE\u7247",resizeImage:"\u8C03\u6574\u56FE\u7247\u5927\u5C0F",selectPosition:"\u9009\u62E9\u4F4D\u7F6E",startPainting:"\u5F00\u59CB\u7ED8\u5236",stopPainting:"\u505C\u6B62\u7ED8\u5236",saveProgress:"\u4FDD\u5B58\u8FDB\u5EA6",loadProgress:"\u52A0\u8F7D\u8FDB\u5EA6",checkingColors:"\u{1F50D} \u68C0\u67E5\u53EF\u7528\u989C\u8272...",noColorsFound:"\u274C \u8BF7\u5728\u7F51\u7AD9\u4E0A\u6253\u5F00\u8C03\u8272\u677F\u540E\u91CD\u8BD5\uFF01",colorsFound:"\u2705 \u627E\u5230 {count} \u79CD\u53EF\u7528\u989C\u8272",loadingImage:"\u{1F5BC}\uFE0F \u6B63\u5728\u52A0\u8F7D\u56FE\u7247...",imageLoaded:"\u2705 \u56FE\u7247\u5DF2\u52A0\u8F7D\uFF0C\u6709\u6548\u50CF\u7D20 {count} \u4E2A",imageError:"\u274C \u56FE\u7247\u52A0\u8F7D\u5931\u8D25",selectPositionAlert:"\u8BF7\u5728\u4F60\u60F3\u5F00\u59CB\u7ED8\u5236\u7684\u5730\u65B9\u6D82\u7B2C\u4E00\u4E2A\u50CF\u7D20\uFF01",waitingPosition:"\u{1F446} \u7B49\u5F85\u4F60\u6D82\u53C2\u8003\u50CF\u7D20...",positionSet:"\u2705 \u4F4D\u7F6E\u8BBE\u7F6E\u6210\u529F\uFF01",positionTimeout:"\u274C \u4F4D\u7F6E\u9009\u62E9\u8D85\u65F6",positionDetected:"\u{1F3AF} \u5DF2\u68C0\u6D4B\u5230\u4F4D\u7F6E\uFF0C\u5904\u7406\u4E2D...",positionError:"\u274C \u4F4D\u7F6E\u68C0\u6D4B\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",startPaintingMsg:"\u{1F3A8} \u5F00\u59CB\u7ED8\u5236...",paintingProgress:"\u{1F9F1} \u8FDB\u5EA6: {painted}/{total} \u50CF\u7D20...",noCharges:"\u231B \u6CA1\u6709\u6B21\u6570\u3002\u7B49\u5F85 {time}...",paintingStopped:"\u23F9\uFE0F \u7528\u6237\u5DF2\u505C\u6B62\u7ED8\u5236",paintingComplete:"\u2705 \u7ED8\u5236\u5B8C\u6210\uFF01\u5171\u7ED8\u5236 {count} \u4E2A\u50CF\u7D20\u3002",paintingError:"\u274C \u7ED8\u5236\u8FC7\u7A0B\u4E2D\u51FA\u9519",missingRequirements:"\u274C \u8BF7\u5148\u52A0\u8F7D\u56FE\u7247\u5E76\u9009\u62E9\u4F4D\u7F6E",progress:"\u8FDB\u5EA6",userName:"\u7528\u6237",pixels:"\u50CF\u7D20",charges:"\u6B21\u6570",estimatedTime:"\u9884\u8BA1\u65F6\u95F4",initMessage:"\u70B9\u51FB\u201C\u521D\u59CB\u5316\u81EA\u52A8\u673A\u5668\u4EBA\u201D\u5F00\u59CB",waitingInit:"\u7B49\u5F85\u521D\u59CB\u5316...",resizeSuccess:"\u2705 \u56FE\u7247\u5DF2\u8C03\u6574\u4E3A {width}x{height}",paintingPaused:"\u23F8\uFE0F \u7ED8\u5236\u6682\u505C\u4E8E\u4F4D\u7F6E X: {x}, Y: {y}",pixelsPerBatch:"\u6BCF\u6279\u50CF\u7D20\u6570",batchSize:"\u6279\u6B21\u5927\u5C0F",nextBatchTime:"\u4E0B\u6B21\u6279\u6B21\u65F6\u95F4",useAllCharges:"\u4F7F\u7528\u6240\u6709\u53EF\u7528\u6B21\u6570",showOverlay:"\u663E\u793A\u8986\u76D6\u5C42",maxCharges:"\u6BCF\u6279\u6700\u5927\u6B21\u6570",waitingForCharges:"\u23F3 \u7B49\u5F85\u6B21\u6570: {current}/{needed}",timeRemaining:"\u5269\u4F59\u65F6\u95F4",cooldownWaiting:"\u23F3 \u7B49\u5F85 {time} \u540E\u7EE7\u7EED...",progressSaved:"\u2705 \u8FDB\u5EA6\u5DF2\u4FDD\u5B58\u4E3A {filename}",progressLoaded:"\u2705 \u5DF2\u52A0\u8F7D\u8FDB\u5EA6: {painted}/{total} \u50CF\u7D20\u5DF2\u7ED8\u5236",progressLoadError:"\u274C \u52A0\u8F7D\u8FDB\u5EA6\u5931\u8D25: {error}",progressSaveError:"\u274C \u4FDD\u5B58\u8FDB\u5EA6\u5931\u8D25: {error}",confirmSaveProgress:"\u5728\u505C\u6B62\u4E4B\u524D\u8981\u4FDD\u5B58\u5F53\u524D\u8FDB\u5EA6\u5417\uFF1F",saveProgressTitle:"\u4FDD\u5B58\u8FDB\u5EA6",discardProgress:"\u653E\u5F03",cancel:"\u53D6\u6D88",minimize:"\u6700\u5C0F\u5316",width:"\u5BBD\u5EA6",height:"\u9AD8\u5EA6",keepAspect:"\u4FDD\u6301\u7EB5\u6A2A\u6BD4",apply:"\u5E94\u7528",overlayOn:"\u8986\u76D6\u5C42: \u5F00\u542F",overlayOff:"\u8986\u76D6\u5C42: \u5173\u95ED",passCompleted:"\u2705 \u6279\u6B21\u5B8C\u6210: \u5DF2\u7ED8\u5236 {painted} \u50CF\u7D20 | \u8FDB\u5EA6: {percent}% ({current}/{total})",waitingChargesRegen:"\u23F3 \u7B49\u5F85\u6B21\u6570\u6062\u590D: {current}/{needed} - \u65F6\u95F4: {time}",waitingChargesCountdown:"\u23F3 \u7B49\u5F85\u6B21\u6570: {current}/{needed} - \u5269\u4F59: {time}",autoInitializing:"\u{1F916} \u6B63\u5728\u81EA\u52A8\u521D\u59CB\u5316...",autoInitSuccess:"\u2705 \u81EA\u52A8\u542F\u52A8\u6210\u529F",autoInitFailed:"\u26A0\uFE0F \u65E0\u6CD5\u81EA\u52A8\u542F\u52A8\uFF0C\u8BF7\u624B\u52A8\u64CD\u4F5C\u3002",paletteDetected:"\u{1F3A8} \u5DF2\u68C0\u6D4B\u5230\u8C03\u8272\u677F",paletteNotFound:"\u{1F50D} \u6B63\u5728\u641C\u7D22\u8C03\u8272\u677F...",clickingPaintButton:"\u{1F446} \u6B63\u5728\u70B9\u51FB\u7ED8\u5236\u6309\u94AE...",paintButtonNotFound:"\u274C \u672A\u627E\u5230\u7ED8\u5236\u6309\u94AE",manualInitRequired:"\u{1F527} \u9700\u8981\u624B\u52A8\u521D\u59CB\u5316",retryAttempt:"\u{1F504} \u91CD\u8BD5 {attempt}/{maxAttempts}\uFF0C\u7B49\u5F85 {delay} \u79D2...",retryError:"\u{1F4A5} \u7B2C {attempt}/{maxAttempts} \u6B21\u5C1D\u8BD5\u51FA\u9519\uFF0C\u5C06\u5728 {delay} \u79D2\u540E\u91CD\u8BD5...",retryFailed:"\u274C \u8D85\u8FC7 {maxAttempts} \u6B21\u5C1D\u8BD5\u5931\u8D25\u3002\u7EE7\u7EED\u4E0B\u4E00\u6279...",networkError:"\u{1F310} \u7F51\u7EDC\u9519\u8BEF\uFF0C\u6B63\u5728\u91CD\u8BD5...",serverError:"\u{1F525} \u670D\u52A1\u5668\u9519\u8BEF\uFF0C\u6B63\u5728\u91CD\u8BD5...",timeoutError:"\u23F0 \u670D\u52A1\u5668\u8D85\u65F6\uFF0C\u6B63\u5728\u91CD\u8BD5...",protectionEnabled:"\u5DF2\u5F00\u542F\u4FDD\u62A4",protectionDisabled:"\u5DF2\u5173\u95ED\u4FDD\u62A4",paintPattern:"\u7ED8\u5236\u6A21\u5F0F",patternLinearStart:"\u7EBF\u6027\uFF08\u8D77\u70B9\uFF09",patternLinearEnd:"\u7EBF\u6027\uFF08\u7EC8\u70B9\uFF09",patternRandom:"\u968F\u673A",patternCenterOut:"\u4ECE\u4E2D\u5FC3\u5411\u5916",patternCornersFirst:"\u5148\u89D2\u843D",patternSpiral:"\u87BA\u65CB",solid:"\u5B9E\u5FC3",stripes:"\u6761\u7EB9",checkerboard:"\u68CB\u76D8\u683C",gradient:"\u6E10\u53D8",dots:"\u70B9\u72B6",waves:"\u6CE2\u6D6A",spiral:"\u87BA\u65CB",mosaic:"\u9A6C\u8D5B\u514B",bricks:"\u7816\u5757",zigzag:"\u4E4B\u5B57\u5F62",protectingDrawing:"\u6B63\u5728\u4FDD\u62A4\u56FE\u7A3F...",changesDetected:"\u{1F6A8} \u68C0\u6D4B\u5230 {count} \u5904\u66F4\u6539",repairing:"\u{1F527} \u6B63\u5728\u4FEE\u590D {count} \u4E2A\u66F4\u6539\u7684\u50CF\u7D20...",repairCompleted:"\u2705 \u4FEE\u590D\u5B8C\u6210\uFF1A{count} \u4E2A\u50CF\u7D20",noChargesForRepair:"\u26A1 \u4FEE\u590D\u4E0D\u6D88\u8017\u70B9\u6570\uFF0C\u7B49\u5F85\u4E2D...",protectionPriority:"\u{1F6E1}\uFE0F \u5DF2\u542F\u7528\u4FDD\u62A4\u4F18\u5148",patternApplied:"\u5DF2\u5E94\u7528\u6A21\u5F0F",customPattern:"\u81EA\u5B9A\u4E49\u6A21\u5F0F",logWindow:"\u{1F4CB} Logs",logWindowTitle:"\u65E5\u5FD7\u7A97\u53E3",downloadLogs:"\u4E0B\u8F7D\u65E5\u5FD7",clearLogs:"\u6E05\u9664\u65E5\u5FD7",closeLogs:"\u5173\u95ED"},farm:{title:"WPlace \u519C\u573A\u673A\u5668\u4EBA",start:"\u5F00\u59CB",stop:"\u505C\u6B62",stopped:"\u673A\u5668\u4EBA\u5DF2\u505C\u6B62",calibrate:"\u6821\u51C6",paintOnce:"\u4E00\u6B21",checkingStatus:"\u68C0\u67E5\u72B6\u6001\u4E2D...",configuration:"\u914D\u7F6E",delay:"\u5EF6\u8FDF (\u6BEB\u79D2)",pixelsPerBatch:"\u6BCF\u6279\u50CF\u7D20",minCharges:"\u6700\u5C11\u6B21\u6570",colorMode:"\u989C\u8272\u6A21\u5F0F",random:"\u968F\u673A",fixed:"\u56FA\u5B9A",range:"\u8303\u56F4",fixedColor:"\u56FA\u5B9A\u989C\u8272",advanced:"\u9AD8\u7EA7",tileX:"\u74E6\u7247 X",tileY:"\u74E6\u7247 Y",customPalette:"\u81EA\u5B9A\u4E49\u8C03\u8272\u677F",paletteExample:"\u4F8B\u5982: #FF0000,#00FF00,#0000FF",capture:"\u6355\u83B7",painted:"\u5DF2\u7ED8\u5236",charges:"\u6B21\u6570",retries:"\u91CD\u8BD5",tile:"\u74E6\u7247",configSaved:"\u914D\u7F6E\u5DF2\u4FDD\u5B58",configLoaded:"\u914D\u7F6E\u5DF2\u52A0\u8F7D",configReset:"\u914D\u7F6E\u5DF2\u91CD\u7F6E",captureInstructions:"\u8BF7\u624B\u52A8\u7ED8\u5236\u4E00\u4E2A\u50CF\u7D20\u4EE5\u6355\u83B7\u5750\u6807...",backendOnline:"\u540E\u7AEF\u5728\u7EBF",backendOffline:"\u540E\u7AEF\u79BB\u7EBF",startingBot:"\u6B63\u5728\u542F\u52A8\u673A\u5668\u4EBA...",stoppingBot:"\u6B63\u5728\u505C\u6B62\u673A\u5668\u4EBA...",calibrating:"\u6821\u51C6\u4E2D...",alreadyRunning:"\u81EA\u52A8\u519C\u573A\u5DF2\u5728\u8FD0\u884C\u3002",imageRunningWarning:"\u81EA\u52A8\u7ED8\u56FE\u6B63\u5728\u8FD0\u884C\uFF0C\u8BF7\u5148\u5173\u95ED\u518D\u542F\u52A8\u81EA\u52A8\u519C\u573A\u3002",selectPosition:"\u9009\u62E9\u533A\u57DF",selectPositionAlert:"\u{1F3AF} \u5728\u5730\u56FE\u7684\u7A7A\u767D\u533A\u57DF\u6D82\u4E00\u4E2A\u50CF\u7D20\u4EE5\u8BBE\u7F6E\u519C\u573A\u533A\u57DF",waitingPosition:"\u{1F446} \u7B49\u5F85\u4F60\u6D82\u53C2\u8003\u50CF\u7D20...",positionSet:"\u2705 \u533A\u57DF\u8BBE\u7F6E\u6210\u529F\uFF01\u534A\u5F84: 500px",positionTimeout:"\u274C \u533A\u57DF\u9009\u62E9\u8D85\u65F6",missingPosition:"\u274C \u8BF7\u5148\u9009\u62E9\u533A\u57DF\uFF08\u4F7F\u7528\u201C\u9009\u62E9\u533A\u57DF\u201D\u6309\u94AE\uFF09",farmRadius:"\u519C\u573A\u534A\u5F84",positionInfo:"\u5F53\u524D\u533A\u57DF",farmingInRadius:"\u{1F33E} \u6B63\u5728\u4EE5\u534A\u5F84 {radius}px \u5728 ({x},{y}) \u519C\u573A",selectEmptyArea:"\u26A0\uFE0F \u91CD\u8981: \u8BF7\u9009\u62E9\u7A7A\u767D\u533A\u57DF\u4EE5\u907F\u514D\u51B2\u7A81",noPosition:"\u672A\u9009\u62E9\u533A\u57DF",currentZone:"\u533A\u57DF: ({x},{y})",autoSelectPosition:"\u{1F3AF} \u8BF7\u5148\u9009\u62E9\u533A\u57DF\uFF0C\u5728\u5730\u56FE\u4E0A\u6D82\u4E00\u4E2A\u50CF\u7D20\u4EE5\u8BBE\u7F6E\u519C\u573A\u533A\u57DF",logWindow:"\u{1F4CB} Logs",logWindowTitle:"\u65E5\u5FD7\u7A97\u53E3",downloadLogs:"\u4E0B\u8F7D\u65E5\u5FD7",clearLogs:"\u6E05\u9664\u65E5\u5FD7",closeLogs:"\u5173\u95ED"},common:{yes:"\u662F",no:"\u5426",ok:"\u786E\u8BA4",cancel:"\u53D6\u6D88",close:"\u5173\u95ED",save:"\u4FDD\u5B58",load:"\u52A0\u8F7D",delete:"\u5220\u9664",edit:"\u7F16\u8F91",start:"\u5F00\u59CB",stop:"\u505C\u6B62",pause:"\u6682\u505C",resume:"\u7EE7\u7EED",reset:"\u91CD\u7F6E",settings:"\u8BBE\u7F6E",help:"\u5E2E\u52A9",about:"\u5173\u4E8E",language:"\u8BED\u8A00",loading:"\u52A0\u8F7D\u4E2D...",error:"\u9519\u8BEF",success:"\u6210\u529F",warning:"\u8B66\u544A",info:"\u4FE1\u606F",languageChanged:"\u8BED\u8A00\u5DF2\u5207\u6362\u4E3A {language}"},guard:{title:"WPlace \u81EA\u52A8\u5B88\u62A4",initBot:"\u521D\u59CB\u5316\u5B88\u62A4\u673A\u5668\u4EBA",selectArea:"\u9009\u62E9\u533A\u57DF",captureArea:"\u6355\u83B7\u533A\u57DF",startProtection:"\u5F00\u59CB\u5B88\u62A4",stopProtection:"\u505C\u6B62\u5B88\u62A4",upperLeft:"\u5DE6\u4E0A\u89D2",lowerRight:"\u53F3\u4E0B\u89D2",protectedPixels:"\u53D7\u4FDD\u62A4\u50CF\u7D20",detectedChanges:"\u68C0\u6D4B\u5230\u7684\u53D8\u5316",repairedPixels:"\u4FEE\u590D\u7684\u50CF\u7D20",charges:"\u6B21\u6570",waitingInit:"\u7B49\u5F85\u521D\u59CB\u5316...",checkingColors:"\u{1F3A8} \u68C0\u67E5\u53EF\u7528\u989C\u8272...",noColorsFound:"\u274C \u672A\u627E\u5230\u989C\u8272\uFF0C\u8BF7\u5728\u7F51\u7AD9\u4E0A\u6253\u5F00\u8C03\u8272\u677F\u3002",colorsFound:"\u2705 \u627E\u5230 {count} \u79CD\u53EF\u7528\u989C\u8272",initSuccess:"\u2705 \u5B88\u62A4\u673A\u5668\u4EBA\u521D\u59CB\u5316\u6210\u529F",initError:"\u274C \u5B88\u62A4\u673A\u5668\u4EBA\u521D\u59CB\u5316\u5931\u8D25",invalidCoords:"\u274C \u5750\u6807\u65E0\u6548",invalidArea:"\u274C \u533A\u57DF\u65E0\u6548\uFF0C\u5DE6\u4E0A\u89D2\u5FC5\u987B\u5C0F\u4E8E\u53F3\u4E0B\u89D2",areaTooLarge:"\u274C \u533A\u57DF\u8FC7\u5927: {size} \u50CF\u7D20 (\u6700\u5927: {max})",capturingArea:"\u{1F4F8} \u6355\u83B7\u5B88\u62A4\u533A\u57DF\u4E2D...",areaCaptured:"\u2705 \u533A\u57DF\u6355\u83B7\u6210\u529F: {count} \u50CF\u7D20\u53D7\u4FDD\u62A4",captureError:"\u274C \u6355\u83B7\u533A\u57DF\u51FA\u9519: {error}",captureFirst:"\u274C \u8BF7\u5148\u6355\u83B7\u4E00\u4E2A\u5B88\u62A4\u533A\u57DF",protectionStarted:"\u{1F6E1}\uFE0F \u5B88\u62A4\u5DF2\u542F\u52A8 - \u533A\u57DF\u76D1\u63A7\u4E2D",protectionStopped:"\u23F9\uFE0F \u5B88\u62A4\u5DF2\u505C\u6B62",noChanges:"\u2705 \u533A\u57DF\u5B89\u5168 - \u672A\u68C0\u6D4B\u5230\u53D8\u5316",changesDetected:"\u{1F6A8} \u68C0\u6D4B\u5230 {count} \u4E2A\u53D8\u5316",repairing:"\u{1F6E0}\uFE0F \u6B63\u5728\u4FEE\u590D {count} \u4E2A\u50CF\u7D20...",repairedSuccess:"\u2705 \u5DF2\u6210\u529F\u4FEE\u590D {count} \u4E2A\u50CF\u7D20",repairError:"\u274C \u4FEE\u590D\u51FA\u9519: {error}",noCharges:"\u26A0\uFE0F \u6B21\u6570\u4E0D\u8DB3\uFF0C\u65E0\u6CD5\u4FEE\u590D",checkingChanges:"\u{1F50D} \u6B63\u5728\u68C0\u67E5\u533A\u57DF\u53D8\u5316...",errorChecking:"\u274C \u68C0\u67E5\u51FA\u9519: {error}",guardActive:"\u{1F6E1}\uFE0F \u5B88\u62A4\u4E2D - \u533A\u57DF\u53D7\u4FDD\u62A4",lastCheck:"\u4E0A\u6B21\u68C0\u67E5: {time}",nextCheck:"\u4E0B\u6B21\u68C0\u67E5: {time} \u79D2\u540E",autoInitializing:"\u{1F916} \u6B63\u5728\u81EA\u52A8\u521D\u59CB\u5316...",autoInitSuccess:"\u2705 \u81EA\u52A8\u542F\u52A8\u6210\u529F",autoInitFailed:"\u26A0\uFE0F \u65E0\u6CD5\u81EA\u52A8\u542F\u52A8\uFF0C\u8BF7\u624B\u52A8\u64CD\u4F5C\u3002",manualInitRequired:"\u{1F527} \u9700\u8981\u624B\u52A8\u521D\u59CB\u5316",paletteDetected:"\u{1F3A8} \u5DF2\u68C0\u6D4B\u5230\u8C03\u8272\u677F",paletteNotFound:"\u{1F50D} \u6B63\u5728\u641C\u7D22\u8C03\u8272\u677F...",clickingPaintButton:"\u{1F446} \u6B63\u5728\u70B9\u51FB\u7ED8\u5236\u6309\u94AE...",paintButtonNotFound:"\u274C \u672A\u627E\u5230\u7ED8\u5236\u6309\u94AE",selectUpperLeft:"\u{1F3AF} \u5728\u9700\u8981\u4FDD\u62A4\u533A\u57DF\u7684\u5DE6\u4E0A\u89D2\u6D82\u4E00\u4E2A\u50CF\u7D20",selectLowerRight:"\u{1F3AF} \u73B0\u5728\u5728\u53F3\u4E0B\u89D2\u6D82\u4E00\u4E2A\u50CF\u7D20",waitingUpperLeft:"\u{1F446} \u7B49\u5F85\u9009\u62E9\u5DE6\u4E0A\u89D2...",waitingLowerRight:"\u{1F446} \u7B49\u5F85\u9009\u62E9\u53F3\u4E0B\u89D2...",upperLeftCaptured:"\u2705 \u5DF2\u6355\u83B7\u5DE6\u4E0A\u89D2: ({x}, {y})",lowerRightCaptured:"\u2705 \u5DF2\u6355\u83B7\u53F3\u4E0B\u89D2: ({x}, {y})",selectionTimeout:"\u274C \u9009\u62E9\u8D85\u65F6",selectionError:"\u274C \u9009\u62E9\u51FA\u9519\uFF0C\u8BF7\u91CD\u8BD5",logWindow:"\u{1F4CB} Logs",logWindowTitle:"\u65E5\u5FD7\u7A97\u53E3",downloadLogs:"\u4E0B\u8F7D\u65E5\u5FD7",clearLogs:"\u6E05\u9664\u65E5\u5FD7",closeLogs:"\u5173\u95ED",analysisTitle:"\u5DEE\u5F02\u5206\u6790 - JSON vs \u5F53\u524D\u753B\u5E03",correctPixels:"\u6B63\u786E\u50CF\u7D20",incorrectPixels:"\u9519\u8BEF\u50CF\u7D20",missingPixels:"\u7F3A\u5931\u50CF\u7D20",showCorrect:"\u663E\u793A\u6B63\u786E",showIncorrect:"\u663E\u793A\u9519\u8BEF",showMissing:"\u663E\u793A\u7F3A\u5931",autoRefresh:"\u81EA\u52A8\u5237\u65B0",zoomAdjusted:"\u7F29\u653E\u81EA\u52A8\u8C03\u6574\u4E3A",autoRefreshEnabled:"\u81EA\u52A8\u5237\u65B0\u5DF2\u542F\u7528\uFF0C\u95F4\u9694",autoRefreshDisabled:"\u81EA\u52A8\u5237\u65B0\u5DF2\u7981\u7528",autoRefreshIntervalUpdated:"\u81EA\u52A8\u5237\u65B0\u95F4\u9694\u5DF2\u66F4\u65B0\u4E3A",visualizationUpdated:"\u53EF\u89C6\u5316\u5DF2\u66F4\u65B0",configTitle:"Guard\u914D\u7F6E",protectionPatterns:"\u4FDD\u62A4\u6A21\u5F0F",preferSpecificColor:"\u4F18\u5148\u7279\u5B9A\u989C\u8272",excludeSpecificColors:"\u4E0D\u4FEE\u590D\u7279\u5B9A\u989C\u8272",loadManagement:"\u8D1F\u8F7D\u7BA1\u7406",minLoadsToWait:"\u7B49\u5F85\u7684\u6700\u5C0F\u8D1F\u8F7D\u6570",pixelsPerBatch:"\u6BCF\u6279\u50CF\u7D20\u6570",spendAllPixelsOnStart:"\u542F\u52A8\u65F6\u6D88\u8017\u6240\u6709\u50CF\u7D20",waitTimes:"\u7B49\u5F85\u65F6\u95F4",useRandomTimes:"\u6279\u6B21\u95F4\u4F7F\u7528\u968F\u673A\u65F6\u95F4",minTime:"\u6700\u5C0F\u65F6\u95F4 (\u79D2)",maxTime:"\u6700\u5927\u65F6\u95F4 (\u79D2)"}}});var zo,Bo=_(()=>{zo={launcher:{title:"WPlace \u81EA\u52D5\u6A5F\u5668\u4EBA",autoFarm:"\u{1F33E} \u81EA\u52D5\u8FB2\u5834",autoImage:"\u{1F3A8} \u81EA\u52D5\u7E6A\u5716",autoGuard:"\u{1F6E1}\uFE0F \u81EA\u52D5\u5B88\u8B77",selection:"\u9078\u64C7",user:"\u7528\u6237",charges:"\u6B21\u6578",backend:"\u5F8C\u7AEF",database:"\u6578\u64DA\u5EAB",uptime:"\u904B\u884C\u6642\u9593",close:"\u95DC\u9589",launch:"\u5553\u52D5",loading:"\u52A0\u8F09\u4E2D\u2026",executing:"\u57F7\u884C\u4E2D\u2026",downloading:"\u6B63\u5728\u4E0B\u8F09\u8173\u672C\u2026",chooseBot:"\u9078\u64C7\u4E00\u500B\u6A5F\u5668\u4EBA\u4E26\u9EDE\u64CA\u5553\u52D5",readyToLaunch:"\u6E96\u5099\u5553\u52D5",loadError:"\u52A0\u8F09\u932F\u8AA4",loadErrorMsg:"\u7121\u6CD5\u52A0\u8F09\u6240\u9078\u6A5F\u5668\u4EBA\u3002\u8ACB\u6AA2\u67E5\u7DB2\u7D61\u9023\u63A5\u6216\u91CD\u8A66\u3002",checking:"\u{1F504} \u6AA2\u67E5\u4E2D...",online:"\u{1F7E2} \u5728\u7DDA",offline:"\u{1F534} \u96E2\u7DDA",ok:"\u{1F7E2} \u6B63\u5E38",error:"\u{1F534} \u932F\u8AA4",unknown:"-",logWindow:"\u{1F4CB} Logs",logWindowTitle:"\u65E5\u8A8C\u8996\u7A97",downloadLogs:"\u4E0B\u8F09\u65E5\u8A8C",clearLogs:"\u6E05\u9664\u65E5\u8A8C",closeLogs:"\u95DC\u9589"},image:{title:"WPlace \u81EA\u52D5\u7E6A\u5716",initBot:"\u521D\u59CB\u5316\u81EA\u52D5\u6A5F\u5668\u4EBA",uploadImage:"\u4E0A\u50B3\u5716\u7247",resizeImage:"\u8ABF\u6574\u5716\u7247\u5927\u5C0F",selectPosition:"\u9078\u64C7\u4F4D\u7F6E",startPainting:"\u958B\u59CB\u7E6A\u88FD",stopPainting:"\u505C\u6B62\u7E6A\u88FD",saveProgress:"\u4FDD\u5B58\u9032\u5EA6",loadProgress:"\u52A0\u8F09\u9032\u5EA6",checkingColors:"\u{1F50D} \u6AA2\u67E5\u53EF\u7528\u984F\u8272...",noColorsFound:"\u274C \u8ACB\u5728\u7DB2\u7AD9\u4E0A\u6253\u958B\u8ABF\u8272\u677F\u5F8C\u91CD\u8A66\uFF01",colorsFound:"\u2705 \u627E\u5230 {count} \u7A2E\u53EF\u7528\u984F\u8272",loadingImage:"\u{1F5BC}\uFE0F \u6B63\u5728\u52A0\u8F09\u5716\u7247...",imageLoaded:"\u2705 \u5716\u7247\u5DF2\u52A0\u8F09\uFF0C\u6709\u6548\u50CF\u7D20 {count} \u500B",imageError:"\u274C \u5716\u7247\u52A0\u8F09\u5931\u6557",selectPositionAlert:"\u8ACB\u5728\u4F60\u60F3\u958B\u59CB\u7E6A\u88FD\u7684\u5730\u65B9\u5857\u7B2C\u4E00\u500B\u50CF\u7D20\uFF01",waitingPosition:"\u{1F446} \u7B49\u5F85\u4F60\u5857\u53C3\u8003\u50CF\u7D20...",positionSet:"\u2705 \u4F4D\u7F6E\u8A2D\u7F6E\u6210\u529F\uFF01",positionTimeout:"\u274C \u4F4D\u7F6E\u9078\u64C7\u8D85\u6642",positionDetected:"\u{1F3AF} \u5DF2\u6AA2\u6E2C\u5230\u4F4D\u7F6E\uFF0C\u8655\u7406\u4E2D...",positionError:"\u274C \u4F4D\u7F6E\u6AA2\u6E2C\u5931\u6557\uFF0C\u8ACB\u91CD\u8A66",startPaintingMsg:"\u{1F3A8} \u958B\u59CB\u7E6A\u88FD...",paintingProgress:"\u{1F9F1} \u9032\u5EA6: {painted}/{total} \u50CF\u7D20...",noCharges:"\u231B \u6C92\u6709\u6B21\u6578\u3002\u7B49\u5F85 {time}...",paintingStopped:"\u23F9\uFE0F \u7528\u6237\u5DF2\u505C\u6B62\u7E6A\u88FD",paintingComplete:"\u2705 \u7E6A\u88FD\u5B8C\u6210\uFF01\u5171\u7E6A\u88FD {count} \u500B\u50CF\u7D20\u3002",paintingError:"\u274C \u7E6A\u88FD\u904E\u7A0B\u4E2D\u51FA\u932F",missingRequirements:"\u274C \u8ACB\u5148\u52A0\u8F09\u5716\u7247\u4E26\u9078\u64C7\u4F4D\u7F6E",progress:"\u9032\u5EA6",userName:"\u7528\u6237",pixels:"\u50CF\u7D20",charges:"\u6B21\u6578",estimatedTime:"\u9810\u8A08\u6642\u9593",initMessage:"\u9EDE\u64CA\u201C\u521D\u59CB\u5316\u81EA\u52D5\u6A5F\u5668\u4EBA\u201D\u958B\u59CB",waitingInit:"\u7B49\u5F85\u521D\u59CB\u5316...",resizeSuccess:"\u2705 \u5716\u7247\u5DF2\u8ABF\u6574\u70BA {width}x{height}",paintingPaused:"\u23F8\uFE0F \u7E6A\u88FD\u66AB\u505C\u65BC\u4F4D\u7F6E X: {x}, Y: {y}",pixelsPerBatch:"\u6BCF\u6279\u50CF\u7D20\u6578",batchSize:"\u6279\u6B21\u5927\u5C0F",nextBatchTime:"\u4E0B\u6B21\u6279\u6B21\u6642\u9593",useAllCharges:"\u4F7F\u7528\u6240\u6709\u53EF\u7528\u6B21\u6578",showOverlay:"\u986F\u793A\u8986\u84CB\u5C64",maxCharges:"\u6BCF\u6279\u6700\u5927\u6B21\u6578",waitingForCharges:"\u23F3 \u7B49\u5F85\u6B21\u6578: {current}/{needed}",timeRemaining:"\u5269\u9918\u6642\u9593",cooldownWaiting:"\u23F3 \u7B49\u5F85 {time} \u5F8C\u7E7C\u7E8C...",progressSaved:"\u2705 \u9032\u5EA6\u5DF2\u4FDD\u5B58\u70BA {filename}",progressLoaded:"\u2705 \u5DF2\u52A0\u8F09\u9032\u5EA6: {painted}/{total} \u50CF\u7D20\u5DF2\u7E6A\u88FD",progressLoadError:"\u274C \u52A0\u8F09\u9032\u5EA6\u5931\u6557: {error}",progressSaveError:"\u274C \u4FDD\u5B58\u9032\u5EA6\u5931\u6557: {error}",confirmSaveProgress:"\u5728\u505C\u6B62\u4E4B\u524D\u8981\u4FDD\u5B58\u7576\u524D\u9032\u5EA6\u55CE\uFF1F",saveProgressTitle:"\u4FDD\u5B58\u9032\u5EA6",discardProgress:"\u653E\u68C4",cancel:"\u53D6\u6D88",minimize:"\u6700\u5C0F\u5316",width:"\u5BEC\u5EA6",height:"\u9AD8\u5EA6",keepAspect:"\u4FDD\u6301\u7E31\u6A6B\u6BD4",apply:"\u61C9\u7528",overlayOn:"\u8986\u84CB\u5C64: \u958B\u5553",overlayOff:"\u8986\u84CB\u5C64: \u95DC\u9589",passCompleted:"\u2705 \u6279\u6B21\u5B8C\u6210: \u5DF2\u7E6A\u88FD {painted} \u50CF\u7D20 | \u9032\u5EA6: {percent}% ({current}/{total})",waitingChargesRegen:"\u23F3 \u7B49\u5F85\u6B21\u6578\u6062\u5FA9: {current}/{needed} - \u6642\u9593: {time}",waitingChargesCountdown:"\u23F3 \u7B49\u5F85\u6B21\u6578: {current}/{needed} - \u5269\u9918: {time}",autoInitializing:"\u{1F916} \u6B63\u5728\u81EA\u52D5\u521D\u59CB\u5316...",autoInitSuccess:"\u2705 \u81EA\u52D5\u5553\u52D5\u6210\u529F",autoInitFailed:"\u26A0\uFE0F \u7121\u6CD5\u81EA\u52D5\u5553\u52D5\uFF0C\u8ACB\u624B\u52D5\u64CD\u4F5C\u3002",paletteDetected:"\u{1F3A8} \u5DF2\u6AA2\u6E2C\u5230\u8ABF\u8272\u677F",paletteNotFound:"\u{1F50D} \u6B63\u5728\u641C\u7D22\u8ABF\u8272\u677F...",clickingPaintButton:"\u{1F446} \u6B63\u5728\u9EDE\u64CA\u7E6A\u88FD\u6309\u9215...",paintButtonNotFound:"\u274C \u672A\u627E\u5230\u7E6A\u88FD\u6309\u9215",manualInitRequired:"\u{1F527} \u9700\u8981\u624B\u52D5\u521D\u59CB\u5316",retryAttempt:"\u{1F504} \u91CD\u8A66 {attempt}/{maxAttempts}\uFF0C\u7B49\u5F85 {delay} \u79D2...",retryError:"\u{1F4A5} \u7B2C {attempt}/{maxAttempts} \u6B21\u5617\u8A66\u51FA\u932F\uFF0C\u5C07\u5728 {delay} \u79D2\u5F8C\u91CD\u8A66...",retryFailed:"\u274C \u8D85\u904E {maxAttempts} \u6B21\u5617\u8A66\u5931\u6557\u3002\u7E7C\u7E8C\u4E0B\u4E00\u6279...",networkError:"\u{1F310} \u7DB2\u7D61\u932F\u8AA4\uFF0C\u6B63\u5728\u91CD\u8A66...",serverError:"\u{1F525} \u670D\u52D9\u5668\u932F\u8AA4\uFF0C\u6B63\u5728\u91CD\u8A66...",timeoutError:"\u23F0 \u4F3A\u670D\u5668\u903E\u6642\uFF0C\u6B63\u5728\u91CD\u8A66...",protectionEnabled:"\u5DF2\u555F\u7528\u4FDD\u8B77",protectionDisabled:"\u5DF2\u505C\u7528\u4FDD\u8B77",paintPattern:"\u7E6A\u88FD\u6A21\u5F0F",patternLinearStart:"\u7DDA\u6027\uFF08\u8D77\u9EDE\uFF09",patternLinearEnd:"\u7DDA\u6027\uFF08\u7D42\u9EDE\uFF09",patternRandom:"\u96A8\u6A5F",patternCenterOut:"\u7531\u4E2D\u5FC3\u5411\u5916",patternCornersFirst:"\u5148\u89D2\u843D",patternSpiral:"\u87BA\u65CB",solid:"\u5BE6\u5FC3",stripes:"\u689D\u7D0B",checkerboard:"\u68CB\u76E4\u683C",gradient:"\u6F38\u5C64",dots:"\u9EDE\u72C0",waves:"\u6CE2\u6D6A",spiral:"\u87BA\u65CB",mosaic:"\u99AC\u8CFD\u514B",bricks:"\u78DA\u584A",zigzag:"\u4E4B\u5B57\u5F62",protectingDrawing:"\u6B63\u5728\u4FDD\u8B77\u7E6A\u5716...",changesDetected:"\u{1F6A8} \u5075\u6E2C\u5230 {count} \u8655\u8B8A\u66F4",repairing:"\u{1F527} \u6B63\u5728\u4FEE\u5FA9 {count} \u500B\u8B8A\u66F4\u7684\u50CF\u7D20...",repairCompleted:"\u2705 \u4FEE\u5FA9\u5B8C\u6210\uFF1A{count} \u500B\u50CF\u7D20",noChargesForRepair:"\u26A1 \u4FEE\u5FA9\u4E0D\u6D88\u8017\u9EDE\u6578\uFF0C\u7B49\u5F85\u4E2D...",protectionPriority:"\u{1F6E1}\uFE0F \u5DF2\u555F\u7528\u4FDD\u8B77\u512A\u5148",patternApplied:"\u5DF2\u5957\u7528\u6A21\u5F0F",customPattern:"\u81EA\u8A02\u6A21\u5F0F",logWindow:"\u{1F4CB} Logs",logWindowTitle:"\u65E5\u8A8C\u8996\u7A97",downloadLogs:"\u4E0B\u8F09\u65E5\u8A8C",clearLogs:"\u6E05\u9664\u65E5\u8A8C",closeLogs:"\u95DC\u9589"},farm:{title:"WPlace \u8FB2\u5834\u6A5F\u5668\u4EBA",start:"\u958B\u59CB",stop:"\u505C\u6B62",stopped:"\u6A5F\u5668\u4EBA\u5DF2\u505C\u6B62",calibrate:"\u6821\u6E96",paintOnce:"\u4E00\u6B21",checkingStatus:"\u6AA2\u67E5\u72C0\u614B\u4E2D...",configuration:"\u914D\u7F6E",delay:"\u5EF6\u9072 (\u6BEB\u79D2)",pixelsPerBatch:"\u6BCF\u6279\u50CF\u7D20",minCharges:"\u6700\u5C11\u6B21\u6578",colorMode:"\u984F\u8272\u6A21\u5F0F",random:"\u96A8\u6A5F",fixed:"\u56FA\u5B9A",range:"\u7BC4\u570D",fixedColor:"\u56FA\u5B9A\u984F\u8272",advanced:"\u9AD8\u7D1A",tileX:"\u74E6\u7247 X",tileY:"\u74E6\u7247 Y",customPalette:"\u81EA\u5B9A\u7FA9\u8ABF\u8272\u677F",paletteExample:"\u4F8B\u5982: #FF0000,#00FF00,#0000FF",capture:"\u6355\u7372",painted:"\u5DF2\u7E6A\u88FD",charges:"\u6B21\u6578",retries:"\u91CD\u8A66",tile:"\u74E6\u7247",configSaved:"\u914D\u7F6E\u5DF2\u4FDD\u5B58",configLoaded:"\u914D\u7F6E\u5DF2\u52A0\u8F09",configReset:"\u914D\u7F6E\u5DF2\u91CD\u7F6E",captureInstructions:"\u8ACB\u624B\u52D5\u7E6A\u88FD\u4E00\u500B\u50CF\u7D20\u4EE5\u6355\u7372\u5EA7\u6A19...",backendOnline:"\u5F8C\u7AEF\u5728\u7DDA",backendOffline:"\u5F8C\u7AEF\u96E2\u7DDA",startingBot:"\u6B63\u5728\u5553\u52D5\u6A5F\u5668\u4EBA...",stoppingBot:"\u6B63\u5728\u505C\u6B62\u6A5F\u5668\u4EBA...",calibrating:"\u6821\u6E96\u4E2D...",alreadyRunning:"\u81EA\u52D5\u8FB2\u5834\u5DF2\u5728\u904B\u884C\u3002",imageRunningWarning:"\u81EA\u52D5\u7E6A\u5716\u6B63\u5728\u904B\u884C\uFF0C\u8ACB\u5148\u95DC\u9589\u518D\u5553\u52D5\u81EA\u52D5\u8FB2\u5834\u3002",selectPosition:"\u9078\u64C7\u5340\u57DF",selectPositionAlert:"\u{1F3AF} \u5728\u5730\u5716\u7684\u7A7A\u767D\u5340\u57DF\u5857\u4E00\u500B\u50CF\u7D20\u4EE5\u8A2D\u7F6E\u8FB2\u5834\u5340\u57DF",waitingPosition:"\u{1F446} \u7B49\u5F85\u4F60\u5857\u53C3\u8003\u50CF\u7D20...",positionSet:"\u2705 \u5340\u57DF\u8A2D\u7F6E\u6210\u529F\uFF01\u534A\u5F91: 500px",positionTimeout:"\u274C \u5340\u57DF\u9078\u64C7\u8D85\u6642",missingPosition:"\u274C \u8ACB\u5148\u9078\u64C7\u5340\u57DF\uFF08\u4F7F\u7528\u201C\u9078\u64C7\u5340\u57DF\u201D\u6309\u9215\uFF09",farmRadius:"\u8FB2\u5834\u534A\u5F91",positionInfo:"\u7576\u524D\u5340\u57DF",farmingInRadius:"\u{1F33E} \u6B63\u5728\u4EE5\u534A\u5F91 {radius}px \u5728 ({x},{y}) \u8FB2\u5834",selectEmptyArea:"\u26A0\uFE0F \u91CD\u8981: \u8ACB\u9078\u64C7\u7A7A\u767D\u5340\u57DF\u4EE5\u907F\u514D\u885D\u7A81",noPosition:"\u672A\u9078\u64C7\u5340\u57DF",currentZone:"\u5340\u57DF: ({x},{y})",autoSelectPosition:"\u{1F3AF} \u8ACB\u5148\u9078\u64C7\u5340\u57DF\uFF0C\u5728\u5730\u5716\u4E0A\u5857\u4E00\u500B\u50CF\u7D20\u4EE5\u8A2D\u7F6E\u8FB2\u5834\u5340\u57DF",logWindow:"\u{1F4CB} Logs",logWindowTitle:"\u65E5\u8A8C\u8996\u7A97",downloadLogs:"\u4E0B\u8F09\u65E5\u8A8C",clearLogs:"\u6E05\u9664\u65E5\u8A8C",closeLogs:"\u95DC\u9589"},common:{yes:"\u662F",no:"\u5426",ok:"\u78BA\u8A8D",cancel:"\u53D6\u6D88",close:"\u95DC\u9589",save:"\u4FDD\u5B58",load:"\u52A0\u8F09",delete:"\u522A\u9664",edit:"\u7DE8\u8F2F",start:"\u958B\u59CB",stop:"\u505C\u6B62",pause:"\u66AB\u505C",resume:"\u7E7C\u7E8C",reset:"\u91CD\u7F6E",settings:"\u8A2D\u7F6E",help:"\u5E6B\u52A9",about:"\u95DC\u65BC",language:"\u8A9E\u8A00",loading:"\u52A0\u8F09\u4E2D...",error:"\u932F\u8AA4",success:"\u6210\u529F",warning:"\u8B66\u544A",info:"\u4FE1\u606F",languageChanged:"\u8A9E\u8A00\u5DF2\u5207\u63DB\u70BA {language}"},guard:{title:"WPlace \u81EA\u52D5\u5B88\u8B77",initBot:"\u521D\u59CB\u5316\u5B88\u8B77\u6A5F\u5668\u4EBA",selectArea:"\u9078\u64C7\u5340\u57DF",captureArea:"\u6355\u7372\u5340\u57DF",startProtection:"\u958B\u59CB\u5B88\u8B77",stopProtection:"\u505C\u6B62\u5B88\u8B77",upperLeft:"\u5DE6\u4E0A\u89D2",lowerRight:"\u53F3\u4E0B\u89D2",protectedPixels:"\u53D7\u4FDD\u8B77\u50CF\u7D20",detectedChanges:"\u6AA2\u6E2C\u5230\u7684\u8B8A\u5316",repairedPixels:"\u4FEE\u5FA9\u7684\u50CF\u7D20",charges:"\u6B21\u6578",waitingInit:"\u7B49\u5F85\u521D\u59CB\u5316...",checkingColors:"\u{1F3A8} \u6AA2\u67E5\u53EF\u7528\u984F\u8272...",noColorsFound:"\u274C \u672A\u627E\u5230\u984F\u8272\uFF0C\u8ACB\u5728\u7DB2\u7AD9\u4E0A\u6253\u958B\u8ABF\u8272\u677F\u3002",colorsFound:"\u2705 \u627E\u5230 {count} \u7A2E\u53EF\u7528\u984F\u8272",initSuccess:"\u2705 \u5B88\u8B77\u6A5F\u5668\u4EBA\u521D\u59CB\u5316\u6210\u529F",initError:"\u274C \u5B88\u8B77\u6A5F\u5668\u4EBA\u521D\u59CB\u5316\u5931\u6557",invalidCoords:"\u274C \u5EA7\u6A19\u7121\u6548",invalidArea:"\u274C \u5340\u57DF\u7121\u6548\uFF0C\u5DE6\u4E0A\u89D2\u5FC5\u9808\u5C0F\u65BC\u53F3\u4E0B\u89D2",areaTooLarge:"\u274C \u5340\u57DF\u904E\u5927: {size} \u50CF\u7D20 (\u6700\u5927: {max})",capturingArea:"\u{1F4F8} \u6355\u7372\u5B88\u8B77\u5340\u57DF\u4E2D...",areaCaptured:"\u2705 \u5340\u57DF\u6355\u7372\u6210\u529F: {count} \u50CF\u7D20\u53D7\u4FDD\u8B77",captureError:"\u274C \u6355\u7372\u5340\u57DF\u51FA\u932F: {error}",captureFirst:"\u274C \u8ACB\u5148\u6355\u7372\u4E00\u500B\u5B88\u8B77\u5340\u57DF",protectionStarted:"\u{1F6E1}\uFE0F \u5B88\u8B77\u5DF2\u5553\u52D5 - \u5340\u57DF\u76E3\u63A7\u4E2D",protectionStopped:"\u23F9\uFE0F \u5B88\u8B77\u5DF2\u505C\u6B62",noChanges:"\u2705 \u5340\u57DF\u5B89\u5168 - \u672A\u6AA2\u6E2C\u5230\u8B8A\u5316",changesDetected:"\u{1F6A8} \u6AA2\u6E2C\u5230 {count} \u500B\u8B8A\u5316",repairing:"\u{1F6E0}\uFE0F \u6B63\u5728\u4FEE\u5FA9 {count} \u500B\u50CF\u7D20...",repairedSuccess:"\u2705 \u5DF2\u6210\u529F\u4FEE\u5FA9 {count} \u500B\u50CF\u7D20",repairError:"\u274C \u4FEE\u5FA9\u51FA\u932F: {error}",noCharges:"\u26A0\uFE0F \u6B21\u6578\u4E0D\u8DB3\uFF0C\u7121\u6CD5\u4FEE\u5FA9",checkingChanges:"\u{1F50D} \u6B63\u5728\u6AA2\u67E5\u5340\u57DF\u8B8A\u5316...",errorChecking:"\u274C \u6AA2\u67E5\u51FA\u932F: {error}",guardActive:"\u{1F6E1}\uFE0F \u5B88\u8B77\u4E2D - \u5340\u57DF\u53D7\u4FDD\u8B77",lastCheck:"\u4E0A\u6B21\u6AA2\u67E5: {time}",nextCheck:"\u4E0B\u6B21\u6AA2\u67E5: {time} \u79D2\u5F8C",autoInitializing:"\u{1F916} \u6B63\u5728\u81EA\u52D5\u521D\u59CB\u5316...",autoInitSuccess:"\u2705 \u81EA\u52D5\u5553\u52D5\u6210\u529F",autoInitFailed:"\u26A0\uFE0F \u7121\u6CD5\u81EA\u52D5\u5553\u52D5\uFF0C\u8ACB\u624B\u52D5\u64CD\u4F5C\u3002",manualInitRequired:"\u{1F527} \u9700\u8981\u624B\u52D5\u521D\u59CB\u5316",paletteDetected:"\u{1F3A8} \u5DF2\u6AA2\u6E2C\u5230\u8ABF\u8272\u677F",paletteNotFound:"\u{1F50D} \u6B63\u5728\u641C\u7D22\u8ABF\u8272\u677F...",clickingPaintButton:"\u{1F446} \u6B63\u5728\u9EDE\u64CA\u7E6A\u88FD\u6309\u9215...",paintButtonNotFound:"\u274C \u672A\u627E\u5230\u7E6A\u88FD\u6309\u9215",selectUpperLeft:"\u{1F3AF} \u5728\u9700\u8981\u4FDD\u8B77\u5340\u57DF\u7684\u5DE6\u4E0A\u89D2\u5857\u4E00\u500B\u50CF\u7D20",selectLowerRight:"\u{1F3AF} \u73FE\u5728\u5728\u53F3\u4E0B\u89D2\u5857\u4E00\u500B\u50CF\u7D20",waitingUpperLeft:"\u{1F446} \u7B49\u5F85\u9078\u64C7\u5DE6\u4E0A\u89D2...",waitingLowerRight:"\u{1F446} \u7B49\u5F85\u9078\u64C7\u53F3\u4E0B\u89D2...",upperLeftCaptured:"\u2705 \u5DF2\u6355\u7372\u5DE6\u4E0A\u89D2: ({x}, {y})",lowerRightCaptured:"\u2705 \u5DF2\u6355\u7372\u53F3\u4E0B\u89D2: ({x}, {y})",selectionTimeout:"\u274C \u9078\u64C7\u8D85\u6642",selectionError:"\u274C \u9078\u64C7\u51FA\u932F\uFF0C\u8ACB\u91CD\u8A66",logWindow:"\u{1F4CB} Logs",logWindowTitle:"\u65E5\u8A8C\u8996\u7A97",downloadLogs:"\u4E0B\u8F09\u65E5\u8A8C",clearLogs:"\u6E05\u9664\u65E5\u8A8C",closeLogs:"\u95DC\u9589",analysisTitle:"\u5DEE\u7570\u5206\u6790 - JSON vs \u7576\u524D\u756B\u5E03",correctPixels:"\u6B63\u78BA\u50CF\u7D20",incorrectPixels:"\u932F\u8AA4\u50CF\u7D20",missingPixels:"\u7F3A\u5931\u50CF\u7D20",showCorrect:"\u986F\u793A\u6B63\u78BA",showIncorrect:"\u986F\u793A\u932F\u8AA4",showMissing:"\u986F\u793A\u7F3A\u5931",autoRefresh:"\u81EA\u52D5\u5237\u65B0",zoomAdjusted:"\u7E2E\u653E\u81EA\u52D5\u8ABF\u6574\u70BA",autoRefreshEnabled:"\u81EA\u52D5\u5237\u65B0\u5DF2\u555F\u7528\uFF0C\u9593\u9694",autoRefreshDisabled:"\u81EA\u52D5\u5237\u65B0\u5DF2\u7981\u7528",autoRefreshIntervalUpdated:"\u81EA\u52D5\u5237\u65B0\u9593\u9694\u5DF2\u66F4\u65B0\u70BA",visualizationUpdated:"\u8996\u89BA\u5316\u5DF2\u66F4\u65B0",configTitle:"Guard\u914D\u7F6E",protectionPatterns:"\u4FDD\u8B77\u6A21\u5F0F",preferSpecificColor:"\u512A\u5148\u7279\u5B9A\u984F\u8272",excludeSpecificColors:"\u4E0D\u4FEE\u5FA9\u7279\u5B9A\u984F\u8272",loadManagement:"\u8CA0\u8F09\u7BA1\u7406",minLoadsToWait:"\u7B49\u5F85\u7684\u6700\u5C0F\u8CA0\u8F09\u6578",pixelsPerBatch:"\u6BCF\u6279\u50CF\u7D20\u6578",spendAllPixelsOnStart:"\u555F\u52D5\u6642\u6D88\u8017\u6240\u6709\u50CF\u7D20",waitTimes:"\u7B49\u5F85\u6642\u9593",useRandomTimes:"\u6279\u6B21\u9593\u4F7F\u7528\u96A8\u6A5F\u6642\u9593",minTime:"\u6700\u5C0F\u6642\u9593 (\u79D2)",maxTime:"\u6700\u5927\u6642\u9593 (\u79D2)"}}});function nn(){let e=(window.navigator.language||window.navigator.userLanguage||"es").split("-")[0].toLowerCase();return ve[e]?e:"es"}function an(){return null}function zt(){let o=an(),e=nn(),t="es";return o&&ve[o]?t=o:e&&ve[e]&&(t=e),sn(t),t}function sn(o){if(!ve[o]){console.warn(`Idioma '${o}' no disponible. Usando '${$t}'`);return}$t=o,Re=ve[o],typeof window!="undefined"&&window.CustomEvent&&window.dispatchEvent(new window.CustomEvent("languageChanged",{detail:{language:o,translations:Re}}))}function T(o,e={}){let t=o.split("."),n=Re;for(let r of t)if(n&&typeof n=="object"&&r in n)n=n[r];else return console.warn(`Clave de traducci\xF3n no encontrada: '${o}'`),o;return typeof n!="string"?(console.warn(`Clave de traducci\xF3n no es string: '${o}'`),o):cn(n,e)}function cn(o,e){return!e||Object.keys(e).length===0?o:o.replace(/\{(\w+)\}/g,(t,n)=>e[n]!==void 0?e[n]:t)}function No(o){return Re[o]?Re[o]:(console.warn(`Secci\xF3n de traducci\xF3n no encontrada: '${o}'`),{})}var ve,$t,Re,nt=_(()=>{To();Ao();_o();Mo();$o();Bo();ve={es:Io,en:So,fr:ko,ru:Lo,zhHans:Ro,zhHant:zo},$t="es",Re=ve[$t];zt()});var Yo={};Kt(Yo,{closeAnalysisWindow:()=>Wt,createAnalysisWindow:()=>gn});function $e(o,e,t=!1){return`
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; padding: 8px 0;">
<span style="color: #eee; font-size: 14px; flex: 1;">${e}</span>
<label class="toggle-switch" style="position: relative; display: inline-block; width: 50px; height: 26px; margin-left: 10px;">
<input type="checkbox" id="${o}" ${t?"checked":""} style="opacity: 0; width: 0; height: 0;">
<span class="toggle-slider" style="
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: ${t?"#22c55e":"#ef4444"};
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
border-radius: 13px;
border: 1px solid ${t?"#16a34a":"#dc2626"};
"></span>
<span class="toggle-knob" style="
position: absolute;
height: 20px;
width: 20px;
left: ${t?"27px":"3px"};
top: 3px;
background-color: white;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
border-radius: 50%;
box-shadow: 0 2px 6px rgba(0,0,0,0.3);
"></span>
</label>
</div>
`}function Be(o,e){let t=document.getElementById(o);if(!t)return;let n=t.parentElement.querySelector(".toggle-slider"),r=t.parentElement.querySelector(".toggle-knob");n&&r&&(n.style.backgroundColor=e?"#22c55e":"#ef4444",n.style.borderColor=e?"#16a34a":"#dc2626",r.style.left=e?"27px":"3px")}function Wt(){if(ze){let o=ze.analysisWindow;o.style.transition="opacity 0.3s ease, transform 0.3s ease",o.style.opacity="0",o.style.transform="scale(0.95) translateY(-20px)",setTimeout(()=>{Z(o),j&&(window.clearInterval(j),j=null),o&&o.parentNode&&document.body.removeChild(o),ze=null,d("\u{1F50D} Ventana de an\xE1lisis cerrada")},300)}}function gn(){if(!i.protectionArea||!i.originalPixels.size){alert("\u274C No hay \xE1rea protegida o p\xEDxeles cargados para analizar");return}ze&&Wt();let o=document.createElement("div");o.style.cssText=`
position: fixed;
left: 50px;
top: 50px;
width: 1200px;
height: 800px;
background: #1a1a1a;
border: 2px solid #333;
border-radius: 12px;
display: flex;
flex-direction: column;
overflow: hidden;
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
z-index: 100002;
backdrop-filter: blur(10px);
opacity: 0;
transform: scale(0.95) translateY(-20px);
transition: opacity 0.3s ease, transform 0.3s ease;
`;let e=document.createElement("div");e.style.cssText=`
padding: 15px 20px;
background: #2d3748;
color: #60a5fa;
font-size: 18px;
font-weight: 600;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #333;
cursor: move;
user-select: none;
`,e.innerHTML=`
<div style="display: flex; align-items: center; gap: 10px;">
\u{1F50D} <span>${T("guard.analysisTitle")}</span>
</div>
<div style="display: flex; align-items: center; gap: 5px;">
<button id="minimizeAnalysisBtn" style="background: none; border: none; color: #eee; cursor: pointer; font-size: 16px; padding: 5px; opacity: 0.7; transition: opacity 0.2s ease;">\u2796</button>
<button id="closeAnalysisBtn" style="background: none; border: none; color: #eee; cursor: pointer; font-size: 20px; padding: 5px;">\u274C</button>
</div>
`;let t=document.createElement("div");t.style.cssText=`
flex: 1;
display: flex;
overflow: hidden;
`;let n=document.createElement("div");n.style.cssText=`
width: 300px;
background: #2d3748;
padding: 20px;
border-right: 1px solid #333;
overflow-y: auto;
color: #eee;
font-family: 'Segoe UI', Roboto, sans-serif;
`,n.innerHTML=`
<h3 style="margin: 0 0 15px 0; color: #60a5fa;">\u{1F4CA} Estad\xEDsticas</h3>
<div style="background: #374151; padding: 15px; border-radius: 8px; margin-bottom: 20px;">
<div style="margin-bottom: 10px;">
<span style="color: #10b981;">\u2705 ${T("guard.correctPixels")}:</span>
<span id="correctPixels" style="float: right; font-weight: bold;">-</span>
</div>
<div style="margin-bottom: 10px;">
<span style="color: #ef4444;">\u274C ${T("guard.incorrectPixels")}:</span>
<span id="incorrectPixels" style="float: right; font-weight: bold;">-</span>
</div>
<div style="margin-bottom: 10px;">
<span style="color: #f59e0b;">\u26AA ${T("guard.missingPixels")}:</span>
<span id="missingPixels" style="float: right; font-weight: bold;">-</span>
</div>
<div>
<span style="color: #8b5cf6;">\u{1F3AF} Precisi\xF3n:</span>
<span id="accuracy" style="float: right; font-weight: bold;">-</span>
</div>
</div>
<h3 style="margin: 0 0 15px 0; color: #60a5fa;">\u{1F3A8} Visualizaci\xF3n</h3>
<div style="background: #374151; padding: 15px; border-radius: 8px; margin-bottom: 20px;">
${$e("showCorrect",`\u2705 ${T("guard.showCorrect")}`,!1)}
${$e("showIncorrect",`\u274C ${T("guard.showIncorrect")}`,!0)}
${$e("showMissing",`\u26AA ${T("guard.showMissing")}`,!0)}
</div>
<h3 style="margin: 0 0 15px 0; color: #60a5fa;">\u{1F4F9} Grabaci\xF3n</h3>
<div style="background: #374151; padding: 15px; border-radius: 8px; margin-bottom: 20px;">
${$e("recordSession","\u{1F4F9} Record Session",!1)}
<button id="snapshotBtn" style="width: 100%; padding: 10px; background: #f59e0b; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; margin-top: 10px;">
\u{1F4F8} Snapshot
</button>
<div id="sessionControls" style="margin-top: 10px; opacity: 0; max-height: 0; overflow: hidden; transition: all 0.3s ease;">
<button id="downloadSession" style="width: 100%; padding: 8px; background: #8b5cf6; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 12px;">
\u{1F4BE} Descargar Datos
</button>
</div>
</div>
<h3 style="margin: 0 0 15px 0; color: #60a5fa;">\u2699\uFE0F Configuraci\xF3n</h3>
<div style="background: #374151; padding: 15px; border-radius: 8px;">
<div style="margin-bottom: 15px;">
<label style="display: block; margin-bottom: 5px; font-size: 14px;">\u{1F50D} Zoom:</label>
<input type="range" id="zoomSlider" min="0.5" max="5" step="0.1" value="1" style="width: 100%;">
<span id="zoomValue" style="font-size: 12px; color: #cbd5e0;">100%</span>
</div>
<div style="margin-bottom: 15px;">
${$e("autoRefresh",`\u{1F504} ${T("guard.autoRefresh")}`,!0)}
<div style="display: flex; align-items: center; gap: 10px; margin-top: 10px;">
<label style="font-size: 12px; color: #cbd5e0;">Intervalo (s):</label>
<input type="number" id="refreshInterval" min="1" max="60" value="5" style="width: 60px; padding: 4px; background: #4b5563; color: white; border: 1px solid #6b7280; border-radius: 4px;">
</div>
</div>
<button id="refreshAnalysis" style="width: 100%; padding: 10px; background: #60a5fa; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer;">
\u{1F504} Actualizar An\xE1lisis
</button>
<button id="autoFitZoom" style="width: 100%; padding: 8px; background: #10b981; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; margin-top: 8px;">
\u{1F4D0} Ajustar Zoom
</button>
<!-- Coordenadas del \xE1rea -->
<div style="margin-top: 15px; padding-top: 10px; border-top: 1px solid #4b5563;">
<div style="font-size: 10px; color: #9ca3af; margin-bottom: 5px;">
<div style="display: flex; justify-content: space-between; margin-bottom: 2px;">
<span>Superior Izq.:</span>
<span id="coordsUpperLeft">--</span>
</div>
<div style="display: flex; justify-content: space-between;">
<span>Inferior Der.:</span>
<span id="coordsLowerRight">--</span>
</div>
</div>
</div>
</div>
`;let r=document.createElement("div");r.style.cssText=`
flex: 1;
position: relative;
overflow: auto;
background: #111;
`;let s=document.createElement("canvas");s.style.cssText=`
display: block;
margin: 0;
border: 1px solid #333;
cursor: grab;
`;let a=document.createElement("div");a.style.cssText=`
position: absolute;
bottom: 0;
right: 0;
width: 20px;
height: 20px;
cursor: se-resize;
background: linear-gradient(-45deg, transparent 30%, rgba(255,255,255,0.3) 30%, rgba(255,255,255,0.3) 70%, transparent 70%);
border-radius: 0 0 12px 0;
z-index: 1;
`,t.appendChild(n),t.appendChild(r),r.appendChild(s),o.appendChild(e),o.appendChild(t),o.appendChild(a),document.body.appendChild(o),setTimeout(()=>{o.style.opacity="1",o.style.transform="scale(1) translateY(0)"},10),V(o),hn(s,n),ze={analysisWindow:o,canvas:s,controlPanel:n};let l=e.querySelector("#minimizeAnalysisBtn");l.addEventListener("click",()=>{t.style.display==="none"?(t.style.display="flex",l.textContent="\u2796",o.style.height="800px"):(t.style.display="none",o.style.height="auto",l.textContent="\u{1F53C}",o.style.height="auto")}),e.querySelector("#closeAnalysisBtn").addEventListener("click",Wt);let c=!1,p={x:0,y:0};e.addEventListener("mousedown",y=>{if(y.target.id!=="closeAnalysisBtn"){c=!0;let P=o.getBoundingClientRect();p.x=y.clientX-P.left,p.y=y.clientY-P.top,document.addEventListener("mousemove",u),document.addEventListener("mouseup",h)}});function u(y){if(c){let P=y.clientX-p.x,v=y.clientY-p.y;o.style.position="absolute",o.style.left=`${Math.max(0,Math.min(P,window.innerWidth-o.offsetWidth))}px`,o.style.top=`${Math.max(0,Math.min(v,window.innerHeight-o.offsetHeight))}px`}}function h(){c=!1,document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",h)}let g=!1,f,m,x,w;a.addEventListener("mousedown",y=>{g=!0,f=y.clientX,m=y.clientY,x=parseInt(document.defaultView.getComputedStyle(o).width,10),w=parseInt(document.defaultView.getComputedStyle(o).height,10),document.addEventListener("mousemove",b),document.addEventListener("mouseup",C),y.preventDefault()});function b(y){if(g){let P=Math.max(600,x+y.clientX-f),v=Math.max(400,w+y.clientY-m);o.style.width=P+"px",o.style.height=v+"px"}}function C(){g=!1,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",C)}return{analysisWindow:o,canvas:s,controlPanel:n}}async function it(o,e){try{let t=await Q(i.protectionArea),n=Oo(i.originalPixels,t||new Map);Uo(e,n),Ot(n),Dt(o,n)}catch(t){d("\u274C Error en refresco de an\xE1lisis:",t)}}async function hn(o,e){var t,n;try{if(d("\u{1F50D} Iniciando an\xE1lisis de diferencias..."),d("\u{1F4CD} \xC1rea de protecci\xF3n:",i.protectionArea),d(`\u{1F4CA} P\xEDxeles originales en guardState: ${((t=i.originalPixels)==null?void 0:t.size)||0}`),d(`\u{1F3A8} Colores disponibles: ${((n=i.availableColors)==null?void 0:n.length)||0}`),!i.availableColors||i.availableColors.length===0){d("\u26A0\uFE0F No hay colores disponibles, intentando detectar...");let{detectAvailableColors:a}=await Promise.resolve().then(()=>(tt(),Co)),l=a();if(l.length>0)i.availableColors=l,d(`\u{1F3A8} Colores detectados: ${l.length}`);else{d("\u274C No se pudieron detectar colores para el an\xE1lisis"),alert("\u274C No se pueden detectar colores. Aseg\xFArate de que la paleta est\xE9 abierta.");return}}d("\u{1F50D} Obteniendo p\xEDxeles actuales del canvas...");let r=await Q(i.protectionArea);d(`\u{1F5BC}\uFE0F P\xEDxeles actuales obtenidos: ${(r==null?void 0:r.size)||0}`),d("\u{1F50D} Comparando p\xEDxeles...");let s=Oo(i.originalPixels,r||new Map);Uo(e,s),Ot(s),Dt(o,s),fn(e,o,s),yn(e,s),mn(e),d("\u2705 An\xE1lisis completado")}catch(r){d("\u274C Error en an\xE1lisis:",r),console.error("Error detallado:",r)}}function Oo(o,e){var c,p;let t=new Map,n=new Map,r=new Map,s=((c=i.config)==null?void 0:c.colorComparisonMethod)||"rgb",a=((p=i.config)==null?void 0:p.colorThreshold)||10,l=(u,h)=>{if(s==="lab"){let g=ne(u.r,u.g,u.b),f=ne(h.r,h.g,h.b);return _e(g,f)<=a/2}else{let g=Math.abs(u.r-h.r),f=Math.abs(u.g-h.g),m=Math.abs(u.b-h.b);return Math.max(g,f,m)<=a}};for(let[u,h]of o){let g=e.get(u);g?l(h,g)?t.set(u,{original:h,current:g}):n.set(u,{original:h,current:g}):r.set(u,h)}return{correct:t,incorrect:n,missing:r,originalPixels:o,currentPixels:e}}function Uo(o,e){let t=e.originalPixels.size,n=e.correct.size,r=e.incorrect.size,s=e.missing.size,a=t>0?(n/t*100).toFixed(1):0;o.querySelector("#correctPixels").textContent=n,o.querySelector("#incorrectPixels").textContent=r,o.querySelector("#missingPixels").textContent=s,o.querySelector("#accuracy").textContent=`${a}%`}function Dt(o,e){var v,I,S,L;let t=i.protectionArea,n=t.x2-t.x1+1,r=t.y2-t.y1+1;d(`\u{1F5BC}\uFE0F Renderizando visualizaci\xF3n: ${n}x${r} p\xEDxeles`),d(`\u{1F4CA} P\xEDxeles originales: ${((v=e.originalPixels)==null?void 0:v.size)||0}`),d(`\u2705 P\xEDxeles correctos: ${((I=e.correct)==null?void 0:I.size)||0}`),d(`\u274C P\xEDxeles incorrectos: ${((S=e.incorrect)==null?void 0:S.size)||0}`),d(`\u26A0\uFE0F P\xEDxeles faltantes: ${((L=e.missing)==null?void 0:L.size)||0}`),o.width=n,o.height=r;let a=o.parentElement.getBoundingClientRect(),l=a.width-20,c=a.height-20,p=l/n,u=c/r,h=Math.min(p,u,3);o.style.width=`${n*h}px`,o.style.height=`${r*h}px`;let g=o.getContext("2d"),f=g.createImageData(n,r);for(let A=0;A<f.data.length;A+=4)f.data[A]=240,f.data[A+1]=240,f.data[A+2]=240,f.data[A+3]=255;let m=document.querySelector("#showCorrect"),x=document.querySelector("#showIncorrect"),w=document.querySelector("#showMissing"),b=m?m.checked:!0,C=x?x.checked:!0,y=w?w.checked:!0;d(`\u{1F39B}\uFE0F Estados de visualizaci\xF3n - Correctos: ${b}, Incorrectos: ${C}, Faltantes: ${y}`);for(let[A,$]of e.originalPixels||new Map){let[M,k]=A.split(",").map(Number),z=((k-t.y1)*n+(M-t.x1))*4;z>=0&&z<f.data.length-3&&(f.data[z]=$.r,f.data[z+1]=$.g,f.data[z+2]=$.b,f.data[z+3]=255)}let P=(A,$,M,k,z,Ie=255)=>{let G=(($-t.y1)*n+(A-t.x1))*4;G>=0&&G<f.data.length-3&&(f.data[G]=M,f.data[G+1]=k,f.data[G+2]=z,f.data[G+3]=Ie)};if(b)for(let[A,$]of e.correct){let[M,k]=A.split(",").map(Number);P(M,k,0,255,0,128)}if(C)for(let[A,$]of e.incorrect){let[M,k]=A.split(",").map(Number);P(M,k,255,0,0,200)}if(y)for(let[A,$]of e.missing){let[M,k]=A.split(",").map(Number);P(M,k,255,255,0,150)}g.putImageData(f,0,0)}function fn(o,e,t){let n=o.querySelector("#zoomSlider"),r=o.querySelector("#zoomValue"),s=o.querySelector("#refreshAnalysis"),a=o.querySelector("#autoRefresh"),l=o.querySelector("#refreshInterval"),c=o.querySelector("#autoFitZoom"),p=o.querySelector("#repositionArea");n.addEventListener("input",y=>{let P=parseFloat(y.target.value);r.textContent=`${Math.round(P*100)}%`,e.style.transform=`scale(${P})`,e.style.transformOrigin="top left"}),c.addEventListener("click",()=>{let P=e.parentElement.getBoundingClientRect(),v=parseFloat(e.style.width)||e.width,I=parseFloat(e.style.height)||e.height,S=(P.width-20)/v,L=(P.height-20)/I,A=Math.min(S,L,3);n.value=A,r.textContent=`${Math.round(A*100)}%`,e.style.transform=`scale(${A})`,e.style.transformOrigin="top left",d(`\u{1F50D} ${T("guard.zoomAdjusted")} ${Math.round(A*100)}%`)}),a.addEventListener("change",()=>{if(Be("autoRefresh",a.checked),a.checked){let y=parseInt(l.value)*1e3;j=window.setInterval(async()=>{await it(e,o)},y),d(`\u{1F504} ${T("guard.autoRefreshEnabled")} ${l.value} segundos`)}else j&&(window.clearInterval(j),j=null),d(`\u{1F504} ${T("guard.autoRefreshDisabled")}`)}),l.addEventListener("change",()=>{if(a.checked){j&&window.clearInterval(j);let y=parseInt(l.value)*1e3;j=window.setInterval(async()=>{await it(e,o)},y),d(`\u{1F504} ${T("guard.autoRefreshIntervalUpdated")} ${l.value} segundos`)}}),s.addEventListener("click",async()=>{await it(e,o)}),o.querySelector("#snapshotBtn").addEventListener("click",()=>{bn(e,o)}),["showCorrect","showIncorrect","showMissing"].forEach(y=>{let P=o.querySelector(`#${y}`);P.addEventListener("change",()=>{Be(y,P.checked);let v=parseFloat(n.value);Dt(e,t),e.style.transform=`scale(${v})`,e.style.transformOrigin="top left",d(`\u{1F441}\uFE0F ${T("guard.visualizationUpdated")}: ${y} = ${P.checked}`)})});let g=e.parentElement;g.style.overflow="auto";let f=(y,P,v)=>Math.max(P,Math.min(v,y));g.addEventListener("wheel",y=>{y.preventDefault();let P=1.1,v=parseFloat(n.value),I=f(v*(y.deltaY<0?P:1/P),.5,5),S=g.getBoundingClientRect(),L=y.clientX-S.left,A=y.clientY-S.top,$=g.scrollLeft+L,M=g.scrollTop+A;n.value=I,r.textContent=`${Math.round(I*100)}%`,e.style.transform=`scale(${I})`,e.style.transformOrigin="top left";let k=I/v;g.scrollLeft=$*k-L,g.scrollTop=M*k-A},{passive:!1});let m=!1,x=0,w=0,b=0,C=0;if(g.addEventListener("mousedown",y=>{if(y.button!==0)return;m=!0,g.style.cursor="grabbing";let P=g.getBoundingClientRect();x=y.clientX-P.left,w=y.clientY-P.top,b=g.scrollLeft,C=g.scrollTop}),window.addEventListener("mousemove",y=>{if(!m)return;let P=g.getBoundingClientRect(),v=y.clientX-P.left,I=y.clientY-P.top,S=v-x,L=I-w;g.scrollLeft=b-S,g.scrollTop=C-L}),window.addEventListener("mouseup",()=>{m&&(m=!1,g.style.cursor="grab")}),setTimeout(()=>{c.click()},100),Be("autoRefresh",a.checked),a.checked){let y=parseInt(l.value)*1e3;j=window.setInterval(async()=>{await it(e,o)},y)}}function mn(o){let e=o.querySelector("#coordsUpperLeft"),t=o.querySelector("#coordsLowerRight");if(i.protectionArea){let{x1:n,y1:r,x2:s,y2:a}=i.protectionArea;e.textContent=`(${n}, ${r})`,t.textContent=`(${s}, ${a})`}else e.textContent="--",t.textContent="--"}function yn(o,e){let t=o.querySelector("#recordSession"),n=o.querySelector("#sessionControls"),r=o.querySelector("#downloadSession");t.addEventListener("change",()=>{Be("recordSession",t.checked),t.checked?(xn(e),n.style.maxHeight="50px",n.style.opacity="1"):(wn(),n.style.maxHeight="0",n.style.opacity="0")}),r.addEventListener("click",()=>{qo()})}function xn(o){Ft=!0,U=[],ge=new Date;let e=document.querySelector("#autoRefresh");e&&!e.checked&&(e.checked=!0,Be("autoRefresh",!0),e.dispatchEvent(new Event("change"))),Ot(o),console.log("\u{1F4F9} Grabaci\xF3n de sesi\xF3n iniciada con autorefresh activado")}function wn(){Ft=!1,U.length>0&&qo(),console.log("\u23F9\uFE0F Grabaci\xF3n de sesi\xF3n detenida")}function Ot(o){var c,p,u,h;if(!Ft||!o)return;let e=new Date,t=((c=o.originalPixels)==null?void 0:c.size)||0,n=((p=o.correct)==null?void 0:p.size)||0,r=((u=o.incorrect)==null?void 0:u.size)||0,s=((h=o.missing)==null?void 0:h.size)||0,a=t>0?n/t*100:0,l={timestamp:e.toISOString(),timeFromStart:e-ge,correct:n,incorrect:r,missing:s,total:t,precision:parseFloat(a.toFixed(1))};U.push(l)}function qo(){var r,s,a,l;if(U.length===0){alert("No hay datos de sesi\xF3n para descargar");return}let o={sessionStart:ge==null?void 0:ge.toISOString(),sessionEnd:new Date().toISOString(),totalDuration:ge?new Date-ge:0,totalEntries:U.length,data:U,summary:{finalCorrect:((r=U[U.length-1])==null?void 0:r.correct)||0,finalIncorrect:((s=U[U.length-1])==null?void 0:s.incorrect)||0,finalMissing:((a=U[U.length-1])==null?void 0:a.missing)||0,finalPrecision:((l=U[U.length-1])==null?void 0:l.precision)||0}},e=new Blob([JSON.stringify(o,null,2)],{type:"application/json"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=`session-data-${new Date().toISOString().slice(0,19).replace(/:/g,"-")}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t),console.log("\u{1F4BE} Datos de sesi\xF3n descargados")}function bn(o,e){try{let t=e.querySelector("#accuracy"),n=t?t.textContent.replace("%",""):"0",r=document.createElement("canvas"),s=r.getContext("2d");r.width=o.width,r.height=o.height,s.drawImage(o,0,0),r.toBlob(a=>{let l=document.createElement("a");l.href=URL.createObjectURL(a);let c=new Date().toISOString().slice(0,19).replace(/:/g,"-");l.download=`snapshot-${c}-precision-${n}%.png`,document.body.appendChild(l),l.click(),document.body.removeChild(l),d(`\u{1F4F8} Snapshot capturado: precisi\xF3n ${n}%`)},"image/png")}catch(t){d("\u274C Error al capturar snapshot:",t),alert("\u274C Error al capturar la imagen")}}var ze,j,Ft,U,ge,Xo=_(()=>{D();te();tt();Me();nt();ze=null,j=null,Ft=!1,U=[],ge=null});D();je();te();tt();te();D();function Yr(o,e,t){if(!o||!e||!t)return null;if(!window||!window.btoa)return console.warn("btoa no disponible, usando compresi\xF3n alternativa"),null;let n=e*t,r=Math.ceil(n/8),s=new Uint8Array(r),a=0;for(let p=0;p<t;p++){let u=o[p];for(let h=0;h<e;h++){let g=u&&u[h]?1:0,f=a>>3,m=a&7;g&&(s[f]|=1<<m),a++}}let l="",c=32768;for(let p=0;p<s.length;p+=c)l+=String.fromCharCode.apply(null,s.subarray(p,Math.min(p+c,s.length)));return window.btoa(l)}function Xr(o,e,t){if(!o||!e||!t)return null;if(!window||!window.atob)return console.warn("atob no disponible, usando descompresi\xF3n alternativa"),null;let n=window.atob(o),r=new Uint8Array(n.length);for(let l=0;l<n.length;l++)r[l]=n.charCodeAt(l);let s=Array(t).fill().map(()=>Array(e).fill(!1)),a=0;for(let l=0;l<t;l++)for(let c=0;c<e;c++){let p=a>>3,u=a&7;s[l][c]=(r[p]>>u&1)===1,a++}return s}function jr(o,e){if(!o||o.size===0)return null;let t=[];for(let[n,r]of o)t.push({x:r.globalX,y:r.globalY,color:r.colorId});return t}function Gr(o,e){if(!o||!e)return null;let t=e.x2-e.x1,n=e.y2-e.y1,r=Array(n).fill().map(()=>Array(t).fill(!1));for(let[s,a]of o){let l=a.globalX-e.x1,c=a.globalY-e.y1;l>=0&&l<t&&c>=0&&c<n&&(r[c][l]=!0)}return r}function Hr(o,e,t){if(!o||!e)return null;let n=e.x2-e.x1,r=e.y2-e.y1,s=n*r,a=o.size,c=a*50,u=a*12,h=t?t.length:0,g=u+h,f=c>0?(c-g)/c:0;return{totalAreaPixels:s,protectedPixels:a,legacyEstimatedSize:Math.round(c/1024/1024*100)/100,compressedEstimatedSize:Math.round(g/1024/1024*100)/100,compressionRatio:Math.round(f*100),spaceSaved:Math.round((c-g)/1024/1024*100)/100}}function Vr(o,e){try{let t=JSON.stringify(o,null,2),n=new window.Blob([t],{type:"application/json"}),r=window.URL.createObjectURL(n),s=document.createElement("a");return s.href=r,s.download=e,s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(r),!0}catch(t){return d("\u274C Error en descarga con Blob:",t),!1}}function vo(o){let t=["protectionData","originalPixels"].filter(n=>!(n in o));if(t.length>0)throw new Error(`Campos requeridos faltantes: ${t.join(", ")}`);if(!o.protectionData.area)throw new Error("\xC1rea de protecci\xF3n no definida");if(!Array.isArray(o.originalPixels)||o.originalPixels.length===0)throw new Error("No hay p\xEDxeles para exportar");return!0}function Zr(o=null,e=null,t="GUARD"){let n;if(o&&o.trim()!=="")n=o.trim().endsWith(".json")?o.trim():o.trim()+".json";else{let r=new Date().toISOString().slice(0,19).replace(/:/g,"-");n=`wplace_${t}_${r}.json`}return e&&e.total>1&&(n=`${n.replace(".json","")}_parte${e.current}de${e.total}.json`),n}function Kr(o){if(!o||typeof o!="string")return!1;let e=o.trim();return!(e.length===0||e===".json"||/[<>:"/\\|?*]/.test(e))}function Jr(o,e){let{x1:t,y1:n,x2:r,y2:s}=o,a=r-t,l=s-n,c=[];if(e<=1)return[o];if(a>=l){let u=Math.floor(a/e);for(let h=0;h<e;h++){let g=t+h*u,f=h===e-1?r:g+u;c.push({x1:g,y1:n,x2:f,y2:s})}}else{let u=Math.floor(l/e);for(let h=0;h<e;h++){let g=n+h*u,f=h===e-1?s:g+u;c.push({x1:t,y1:g,x2:r,y2:f})}}return c}function Qr(o,e){let t=[],{x1:n,y1:r,x2:s,y2:a}=o;for(let[l,c]of e.entries()){let[p,u]=l.split(",").map(Number);p>=n&&p<=s&&u>=r&&u<=a&&t.push({key:l,...c})}return t}function Po(o=null,e=null){try{if(!i.protectionArea||!i.originalPixels.size)throw new Error("No hay progreso para guardar");if(o&&!Kr(o))throw new Error("Nombre de archivo inv\xE1lido");let t=e&&e>1?Jr(i.protectionArea,e):[i.protectionArea],n=[];for(let r=0;r<t.length;r++){let s=t[r],a=Qr(s,i.originalPixels),l=s.x2-s.x1,c=s.y2-s.y1,p=Gr(i.originalPixels,s),u=jr(i.originalPixels,s),h=Yr(p,l,c),g={version:"1.2",timestamp:Date.now(),protectionData:{area:{...s},protectedPixels:a.length,splitInfo:e>1?{total:e,current:r+1,originalArea:{...i.protectionArea}}:null,areaSize:{width:l,height:c,totalPixels:l*c},exportMethod:"enhanced_blob_download_compressed"},progress:{totalRepaired:i.totalRepaired,lastCheck:i.lastCheck,repairRate:i.totalRepaired>0?(i.totalRepaired/a.length*100).toFixed(2)+"%":"0%"},config:{maxProtectionSize:1e5,pixelsPerBatch:i.pixelsPerBatch,checkInterval:1e4},colors:i.availableColors.map(b=>({id:b.id,r:b.r,g:b.g,b:b.b})),originalPixels:u,paintedMapPacked:h,legacyPixels:a.length<1e4?a:null};vo(g);let f=e>1?{total:e,current:r+1}:null,m=Zr(o,f,"GUARD");if(!Vr(g,m))throw new Error(`Error descargando archivo: ${m}`);let w=Hr(i.originalPixels,s,h);n.push({success:!0,filename:m,compressionStats:w}),w?(d(`\u2705 Progreso guardado con compresi\xF3n optimizada: ${m}`),d(`\u{1F4CA} Compresi\xF3n: ${w.legacyEstimatedSize}MB \u2192 ${w.compressedEstimatedSize}MB (${w.compressionRatio}% reducci\xF3n, ${w.spaceSaved}MB ahorrados)`)):d(`\u2705 Progreso guardado con compresi\xF3n optimizada: ${m}`)}return{success:!0,filename:n.length===1?n[0].filename:`${n.length} archivos`,files:n,enhanced:!0,compressed:!0}}catch(t){return d("\u274C Error guardando progreso:",t),{success:!1,error:t.message}}}async function Eo(o){var e;try{let t=await o.text(),n=JSON.parse(t);d("\u{1F4C1} Archivo cargado correctamente");let s=["protectionData","originalPixels"].filter(u=>!(u in n));if(s.length>0)throw new Error(`Campos requeridos faltantes: ${s.join(", ")}`);vo(n);let a=n.version||"1.0",l=a==="1.1"||a==="1.2"||((e=n.protectionData)==null?void 0:e.exportMethod)==="enhanced_blob_download",c=a==="1.2";if(d(`\u{1F4CB} Versi\xF3n del archivo: ${a}${l?" (mejorado)":" (cl\xE1sico)"}${c?" (comprimido)":""}`),i.availableColors.length>0){let u=n.colors.map(f=>f.id),h=i.availableColors.map(f=>f.id);u.filter(f=>h.includes(f)).length<u.length*.8&&d("\u26A0\uFE0F Los colores guardados no coinciden completamente con los actuales")}if((!i.availableColors||i.availableColors.length===0)&&(i.availableColors=Array.isArray(n.colors)?n.colors.map(u=>({id:u.id,r:u.r,g:u.g,b:u.b})):[],d(`\u{1F3A8} Colores cargados desde archivo: ${i.availableColors.length}`)),n.protectionData?(i.protectionArea=n.protectionData.area,i.isVirtualArea=n.protectionData.virtualArea||!1):n.protectionArea&&(i.protectionArea=n.protectionArea,i.isVirtualArea=!1),i.originalPixels=new Map,c&&n.originalPixels&&Array.isArray(n.originalPixels)){d("\u{1F4E6} Cargando datos comprimidos v1.2");for(let u of n.originalPixels){let h=`${u.x},${u.y}`,g=i.availableColors.find(I=>I.id===u.color),f=g?g.r:0,m=g?g.g:0,x=g?g.b:0,w=Math.floor(u.x/E.TILE_SIZE),b=Math.floor(u.y/E.TILE_SIZE),C=u.x-w*E.TILE_SIZE,y=u.y-b*E.TILE_SIZE,P=(C%1e3+1e3)%1e3,v=(y%1e3+1e3)%1e3;i.originalPixels.set(h,{globalX:u.x,globalY:u.y,tileX:w,tileY:b,localX:P,localY:v,colorId:u.color,r:f,g:m,b:x,timestamp:u.timestamp||Date.now()})}if(n.paintedMapPacked&&n.protectionData.areaSize){let{width:u,height:h}=n.protectionData.areaSize;Xr(n.paintedMapPacked,u,h)&&d("\u2705 Mapa pintado descomprimido correctamente")}}else if(n.originalPixels&&Array.isArray(n.originalPixels)){d("\u{1F4E6} Cargando datos legacy v1.1/v1.0");for(let u of n.originalPixels)if(u.key){let{key:h,...g}=u,[f,m]=h.split(",").map(Number),x=Number.isFinite(g.globalX)?g.globalX:Number.isFinite(g.x)?g.x:f,w=Number.isFinite(g.globalY)?g.globalY:Number.isFinite(g.y)?g.y:m,b=Number.isFinite(g.colorId)?g.colorId:Number.isFinite(g.color)?g.color:0,C=i.availableColors.find(k=>k.id===b),y=C?C.r:Number.isFinite(g.r)?g.r:0,P=C?C.g:Number.isFinite(g.g)?g.g:0,v=C?C.b:Number.isFinite(g.b)?g.b:0,I=Math.floor(x/E.TILE_SIZE),S=Math.floor(w/E.TILE_SIZE),L=x-I*E.TILE_SIZE,A=w-S*E.TILE_SIZE,$=(L%1e3+1e3)%1e3,M=(A%1e3+1e3)%1e3;i.originalPixels.set(h,{globalX:x,globalY:w,tileX:I,tileY:S,localX:$,localY:M,colorId:b,r:y,g:P,b:v,timestamp:g.timestamp||Date.now()})}else{let h=`${u.x},${u.y}`,g=u.x,f=u.y,m=Number.isFinite(u.colorId)?u.colorId:Number.isFinite(u.color)?u.color:0,x=i.availableColors.find(A=>A.id===m),w=x?x.r:Number.isFinite(u.r)?u.r:0,b=x?x.g:Number.isFinite(u.g)?u.g:0,C=x?x.b:Number.isFinite(u.b)?u.b:0,y=Math.floor(g/E.TILE_SIZE),P=Math.floor(f/E.TILE_SIZE),v=g-y*E.TILE_SIZE,I=f-P*E.TILE_SIZE,S=(v%1e3+1e3)%1e3,L=(I%1e3+1e3)%1e3;i.originalPixels.set(h,{globalX:g,globalY:f,tileX:y,tileY:P,localX:S,localY:L,colorId:m,r:w,g:b,b:C,timestamp:u.timestamp||Date.now()})}}else if(n.legacyPixels&&Array.isArray(n.legacyPixels)){d("\u{1F4E6} Usando datos de fallback legacy");for(let u of n.legacyPixels){let{key:h,...g}=u,[f,m]=h.split(",").map(Number),x=Number.isFinite(g.globalX)?g.globalX:Number.isFinite(g.x)?g.x:f,w=Number.isFinite(g.globalY)?g.globalY:Number.isFinite(g.y)?g.y:m,b=Number.isFinite(g.colorId)?g.colorId:Number.isFinite(g.color)?g.color:0,C=i.availableColors.find(k=>k.id===b),y=C?C.r:Number.isFinite(g.r)?g.r:0,P=C?C.g:Number.isFinite(g.g)?g.g:0,v=C?C.b:Number.isFinite(g.b)?g.b:0,I=Math.floor(x/E.TILE_SIZE),S=Math.floor(w/E.TILE_SIZE),L=x-I*E.TILE_SIZE,A=w-S*E.TILE_SIZE,$=(L%1e3+1e3)%1e3,M=(A%1e3+1e3)%1e3;i.originalPixels.set(h,{globalX:x,globalY:w,tileX:I,tileY:S,localX:$,localY:M,colorId:b,r:y,g:P,b:v,timestamp:g.timestamp||Date.now()})}}else throw new Error("No se encontraron datos de p\xEDxeles v\xE1lidos");if(n.progress?(i.totalRepaired=n.progress.totalRepaired||0,i.lastCheck=n.progress.lastCheck||0):n.statistics&&(i.totalRepaired=n.statistics.totalRepaired||0,i.lastCheck=n.statistics.lastCheck||0),i.changes.clear(),i.ui&&(i.ui.updateCoordinates({x1:i.protectionArea.x1,y1:i.protectionArea.y1,x2:i.protectionArea.x2,y2:i.protectionArea.y2}),i.ui.updateProgress(i.originalPixels.size,0),i.ui.updateStats({repaired:i.totalRepaired}),i.ui.enableStartBtn()),d(`\u2705 Progreso cargado: ${i.originalPixels.size} p\xEDxeles protegidos`),window.wplaceSlave&&window.wplaceSlave.isFavorite)try{let u={protectedArea:{x:i.protectionArea.x1,y:i.protectionArea.y1,width:i.protectionArea.x2-i.protectionArea.x1,height:i.protectionArea.y2-i.protectionArea.y1},totalPixels:i.originalPixels.size,changes:Array.from(i.changes.values()),lastCheck:i.lastCheck,isVirtualArea:i.isVirtualArea||!1};window.wplaceSlave.sendToMaster({type:"preview_data",data:u}),d("\u{1F4E1} Datos de preview enviados al servidor")}catch(u){d("\u274C Error enviando datos de preview:",u)}let p=i.originalPixels.size;return{success:!0,data:n,protectedPixels:p,area:i.protectionArea,version:a,enhanced:l,compressed:c}}catch(t){return d("\u274C Error cargando progreso:",t),{success:!1,error:t.message}}}function be(){return i.protectionArea&&i.originalPixels.size>0}te();D();Me();nt();function Pe(o,e,t=!1){return`
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; padding: 8px 0;">
<span style="color: #eee; font-size: 14px; flex: 1;">${e}</span>
<label class="toggle-switch" style="position: relative; display: inline-block; width: 50px; height: 26px; margin-left: 10px;">
<input type="checkbox" id="${o}" ${t?"checked":""} style="opacity: 0; width: 0; height: 0;">
<span class="toggle-slider" style="
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: ${t?"#22c55e":"#ef4444"};
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
border-radius: 13px;
border: 1px solid ${t?"#16a34a":"#dc2626"};
"></span>
<span class="toggle-knob" style="
position: absolute;
height: 20px;
width: 20px;
left: ${t?"27px":"3px"};
top: 3px;
background-color: white;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
border-radius: 50%;
box-shadow: 0 2px 6px rgba(0,0,0,0.3);
"></span>
</label>
</div>
`}function X(o,e){let t=document.getElementById(o);if(!t)return;let n=t.parentElement.querySelector(".toggle-slider"),r=t.parentElement.querySelector(".toggle-knob");n&&r&&(n.style.backgroundColor=e?"#22c55e":"#ef4444",n.style.borderColor=e?"#16a34a":"#dc2626",r.style.left=e?"27px":"3px")}function Ee(o,e){let t=document.getElementById(o);t&&(e?(t.style.maxHeight="200px",t.style.opacity="1"):(t.style.maxHeight="0",t.style.opacity="0"))}function Wo(){return Fo()}function Fo(){let o=document.getElementById("guardConfigWindow");if(o){o.style.display="flex",o.style.opacity="1";let c=o.querySelector("div");c&&(c.style.opacity="1",c.style.transform="scale(1) translateY(0)");return}let e=document.createElement("div");e.id="guardConfigWindow",e.style.cssText="position:fixed;inset:0;width:100%;height:100%;background:transparent;z-index:10002;display:flex;align-items:flex-start;justify-content:flex-start;pointer-events:none;opacity:0;transition:opacity 0.3s ease;";let t=document.createElement("div");t.style.cssText="background:#1a1a1a;border:2px solid #333;border-radius:12px;width:460px;max-width:90vw;max-height:80vh;color:#eee;font-family:Segoe UI,Roboto,sans-serif;box-shadow:0 10px 30px rgba(0,0,0,0.5);display:flex;flex-direction:column;overflow:auto;position:relative;resize:both;pointer-events:auto;opacity:0;transform:scale(0.95) translateY(-20px);transition:opacity 0.3s ease, transform 0.3s ease;";let n=document.createElement("div");n.style.cssText="background:#2d3748;padding:12px 16px;border-bottom:1px solid #4a5568;display:flex;align-items:center;justify-content:space-between;cursor:move;user-select:none;",n.innerHTML=`<h2 style="margin:0;font-size:16px;color:#e2e8f0;">\u2699\uFE0F ${T("guard.configTitle")}</h2>`;let r=document.createElement("button");r.textContent="\u2715",r.style.cssText="background:none;border:none;color:#cbd5e0;font-size:18px;cursor:pointer;padding:0;width:24px;height:24px;",n.appendChild(r);let s=document.createElement("div");s.style.cssText="padding:16px;overflow:auto;flex:1;",s.innerHTML=`
<div id="configGrid" style="display:grid;grid-template-columns:1fr;gap:16px;transition:grid-template-columns 0.3s ease;">
<div style="background:#2d3748;padding:12px;border-radius:8px;border:1px solid #4a5568;">
<h3 style="margin:0 0 8px 0;font-size:14px;color:#e2e8f0;"> Modo de Operaci\xF3n</h3>
<select id="operationModeSelect" style="width:100%;padding:8px;background:#374151;border:1px solid #6b7280;color:#e5e7eb;border-radius:6px;font-family:'Segoe UI Emoji',Arial,sans-serif;">
<option value="protect">\u{1F6E1}\uFE0F Proteger - Reparar p\xEDxeles cambiados</option>
<option value="erase">\u{1F5D1}\uFE0F Borrar - Convertir p\xEDxeles a transparente</option>
</select>
</div>
<div style="background:#2d3748;padding:12px;border-radius:8px;border:1px solid #4a5568;">
<h3 style="margin:0 0 8px 0;font-size:14px;color:#e2e8f0;"\u{1F6E1}\uFE0F Patrones de Protecci\xF3n</h3>
<select id="protectionPatternSelect" style="width:100%;padding:8px;background:#374151;border:1px solid #6b7280;color:#e5e7eb;border-radius:6px;font-family:'Segoe UI Emoji',Arial,sans-serif;">
<option value="random">\u{1F3B2} Aleatorio</option>
<option value="lineUp">\u2B06\uFE0F Lineal (Arriba)</option>
<option value="lineDown">\u2B07\uFE0F Lineal (Abajo)</option>
<option value="lineLeft">\u2B05\uFE0F Lineal (Izquierda)</option>
<option value="lineRight">\u27A1\uFE0F Lineal (Derecha)</option>
<option value="center">\u{1F3AF} Centro</option>
<option value="borders">\u{1F7E7} Bordes</option>
<option value="spiral">\u{1F300} Espiral</option>
<option value="zigzag">\u3030\uFE0F Zigzag (Escritura)</option>
<option value="diagonal">\u{1F4D0} Diagonal (Lectura)</option>
<option value="cluster">\u{1F517} Clusters (Agrupado)</option>
<option value="wave">\u{1F30A} Ondas (Natural)</option>
<option value="corners">\u{1F4CD} Esquinas (Referencia)</option>
<option value="sweep">\u{1F9F9} Barrido (Sistem\xE1tico)</option>
<option value="priority">\u2B50 Prioridad (Inteligente)</option>
<option value="proximity">\u{1F91D} Proximidad (Cercano)</option>
<option value="quadrant">\u2B1C Cuadrantes (Rotativo)</option>
<option value="scattered">\u{1F4AB} Disperso (Espaciado)</option>
<option value="snake">\u{1F40D} Serpiente (Zigzag Filas)</option>
<option value="diagonalSweep">\u2197\uFE0F Barrido Diagonal</option>
<option value="spiralClockwise">\u{1F504} Espiral Horaria</option>
<option value="spiralCounterClockwise">\u{1F503} Espiral Antihoraria</option>
<option value="biasedRandom">\u{1F3B2} Aleatorio Sesgado</option>
<option value="anchorPoints">\u2693 Puntos de Anclaje</option>
</select>
</div>
<div style="background:#2d3748;padding:12px;border-radius:8px;border:1px solid #4a5568;">
<h3 style="margin:0 0 8px 0;font-size:14px;color:#e2e8f0;">\u{1F3A8} ${T("guard.preferSpecificColor")}</h3>
${Pe("preferColorCheckbox",T("guard.preferSpecificColor"),!1)}
<div id="colorSelectorContainer" style="max-height:0;overflow:hidden;margin-top:8px;transition:max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);opacity:0;">
<div id="colorSelector" style="display:flex;flex-wrap:wrap;gap:8px;padding-top:8px;"></div>
<button id="clearPreferredColors" style="display:none;margin-top:8px;padding:4px 12px;font-size:12px;background:#ef4444;color:white;border:none;border-radius:4px;cursor:pointer;">Clear</button>
</div>
</div>
<div style="background:#2d3748;padding:12px;border-radius:8px;border:1px solid #4a5568;">
<h3 style="margin:0 0 8px 0;font-size:14px;color:#e2e8f0;">\u{1F6AB} Excluir Color</h3>
${Pe("excludeColorCheckbox",T("guard.excludeSpecificColors"),!1)}
<div id="excludeColorSelectorContainer" style="max-height:0;overflow:hidden;margin-top:8px;transition:max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);opacity:0;">
<div id="excludeColorSelector" style="display:flex;flex-wrap:wrap;gap:8px;padding-top:8px;"></div>
<button id="clearExcludedColors" style="display:none;margin-top:8px;padding:4px 12px;font-size:12px;background:#ef4444;color:white;border:none;border-radius:4px;cursor:pointer;">Clear</button>
</div>
</div>
<div style="background:#2d3748;padding:12px;border-radius:8px;border:1px solid #4a5568;">
<h3 style="margin:0 0 8px 0;font-size:14px;color:#e2e8f0;">\u26A1 ${T("guard.loadManagement")}</h3>
<label style="display:block;margin-bottom:6px;color:#e5e7eb;">${T("guard.minLoadsToWait")}:</label>
<input type="number" id="minChargesToWaitInput" min="1" max="10" style="width:100%;padding:8px;background:#374151;border:1px solid #6b7280;color:#e5e7eb;border-radius:6px;">
<label style="display:block;margin:10px 0 6px;color:#e5e7eb;">${T("guard.pixelsPerBatch")}:</label>
<input type="number" id="pixelsPerBatchInput" min="1" max="20" style="width:100%;padding:8px;background:#374151;border:1px solid #6b7280;color:#e5e7eb;border-radius:6px;">
<div style="margin-top:10px;">
${Pe("spendAllPixelsCheckbox",T("guard.spendAllPixelsOnStart"),!1)}
</div>
</div>
<div style="background:#2d3748;padding:12px;border-radius:8px;border:1px solid #4a5568;">
<h3 style="margin:0 0 8px 0;font-size:14px;color:#e2e8f0;">\u23F0 ${T("guard.waitTimes")}</h3>
<div style="margin-bottom:8px;">
${Pe("randomWaitCheckbox",T("guard.useRandomTimes"),!1)}
</div>
<div id="randomWaitContainer" style="display:none;">
<div style="display:grid;grid-template-columns:1fr 1fr;gap:8px;">
<div>
<label style="display:block;margin-bottom:4px;color:#e5e7eb;">${T("guard.minTime")}:</label>
<input type="number" id="randomWaitMinInput" min="0.5" max="10" step="0.1" style="width:100%;padding:8px;background:#374151;border:1px solid #6b7280;color:#e5e7eb;border-radius:6px;">
</div>
<div>
<label style="display:block;margin-bottom:4px;color:#e5e7eb;">${T("guard.maxTime")}:</label>
<input type="number" id="randomWaitMaxInput" min="1" max="30" step="0.1" style="width:100%;padding:8px;background:#374151;border:1px solid #6b7280;color:#e5e7eb;border-radius:6px;">
</div>
</div>
</div>
</div>
<div style="background:#2d3748;padding:12px;border-radius:8px;border:1px solid #4a5568;">
<h3 style="margin:0 0 8px 0;font-size:14px;color:#e2e8f0;">\u{1FAE5} Protecci\xF3n de Transparencias</h3>
<div style="margin-bottom:12px;">
${Pe("protectTransparentPixelsCheckbox","Proteger p\xEDxeles transparentes",!0)}
</div>
<div style="margin-bottom:8px;">
${Pe("protectPerimeterCheckbox","Proteger per\xEDmetro",!1)}
</div>
<div id="perimeterContainer" style="max-height:0;overflow:hidden;transition:max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);opacity:0;">
<label style="display:block;margin-bottom:6px;color:#e5e7eb;font-size:13px;">Ancho del per\xEDmetro (p\xEDxeles):</label>
<input type="number" id="perimeterWidthInput" min="1" max="10" style="width:100%;padding:8px;background:#374151;border:1px solid #6b7280;color:#e5e7eb;border-radius:6px;">
<small style="color:#9ca3af;font-size:12px;display:block;margin-top:4px;">
Crea una zona buffer transparente alrededor del \xE1rea protegida
</small>
</div>
</div>
</div>`;let a=document.createElement("div");a.style.cssText="background:#2d3748;padding:12px 16px;border-top:1px solid #4a5568;display:flex;justify-content:flex-end;gap:10px;";let l=document.createElement("button");l.id="guardResetBtn",l.textContent="\u{1F504}",l.style.cssText="padding:8px 16px;border:none;border-radius:6px;background:#6b7280;color:white;font-weight:600;cursor:pointer;",a.appendChild(l),t.appendChild(n),t.appendChild(s),t.appendChild(a),e.appendChild(t),document.body.appendChild(e),setTimeout(()=>{e.style.opacity="1",t.style.opacity="1",t.style.transform="scale(1) translateY(0)"},10),ln(t,n),dn(t),V(e),r.addEventListener("click",()=>{e.style.transition="opacity 0.3s ease",t.style.transition="opacity 0.3s ease, transform 0.3s ease",e.style.opacity="0",t.style.opacity="0",t.style.transform="scale(0.95) translateY(-20px)",setTimeout(()=>{Z(e),e.style.display="none",e.style.transition="",t.style.transition=""},300)}),un(e),Do(e),d("\u{1F527} Ventana de configuraci\xF3n abierta")}function ln(o,e){let t=!1,n=0,r=0,s=0,a=0;e.addEventListener("mousedown",l=>{t=!0,n=l.clientX,r=l.clientY;let c=o.getBoundingClientRect();s=c.left,a=c.top,o.style.position="fixed",o.style.left=s+"px",o.style.top=a+"px";let p=h=>{t&&(o.style.left=s+h.clientX-n+"px",o.style.top=a+h.clientY-r+"px")},u=()=>{t=!1,document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",p),document.addEventListener("mouseup",u)})}function dn(o){let e=o.querySelector("#configGrid");if(!e)return;let t=0,n=()=>{let l=o.offsetWidth;Math.abs(l-t)<10||(t=l,l>=900?e.style.gridTemplateColumns="repeat(3, 1fr)":l>=650?e.style.gridTemplateColumns="repeat(2, 1fr)":e.style.gridTemplateColumns="1fr")},r=window.setInterval(n,200),s=()=>window.setTimeout(n,50);window.addEventListener("resize",s),n();let a=o.remove;o.remove=function(){window.clearInterval(r),window.removeEventListener("resize",s),a.call(this)}}function un(o){let e=o.querySelector("#operationModeSelect");e&&e.addEventListener("change",()=>{let C=e.value;i.operationMode=C,i.ui&&i.ui.elements&&(C==="erase"?i.ui.elements.startBtn.innerHTML="\u{1F5D1}\uFE0F Iniciar Borrado":i.ui.elements.startBtn.innerHTML="\u25B6\uFE0F Iniciar Protecci\xF3n"),d(`\u{1F527} Modo de operaci\xF3n cambiado a: ${C}`),B()});let t=o.querySelector("#protectionPatternSelect");t&&t.addEventListener("change",()=>{i.protectionPattern=t.value,B()});let n=o.querySelector("#preferColorCheckbox"),r=o.querySelector("#clearPreferredColors");n&&n.addEventListener("change",C=>{let y=C.target.checked;X("preferColorCheckbox",y),Ee("colorSelectorContainer",y),i.preferColor=!!y,y&&Bt(o),B()}),r&&r.addEventListener("click",()=>{i.preferredColorIds=[],i.preferredColorId=null,Bt(o),B()});let s=o.querySelector("#excludeColorCheckbox"),a=o.querySelector("#clearExcludedColors");s&&s.addEventListener("change",C=>{let y=C.target.checked;X("excludeColorCheckbox",y),Ee("excludeColorSelectorContainer",y),i.excludeColor=!!y,y&&Nt(o),B()}),a&&a.addEventListener("click",()=>{i.excludedColorIds=[],Nt(o),B()});let l=o.querySelector("#randomWaitCheckbox"),c=o.querySelector("#randomWaitContainer");l&&l.addEventListener("change",C=>{let y=C.target.checked;X("randomWaitCheckbox",y),c&&(c.style.display=y?"block":"none"),i.randomWaitTime=!!y,B()});let p=o.querySelector("#randomWaitMinInput"),u=o.querySelector("#randomWaitMaxInput");p&&p.addEventListener("change",()=>{let C=parseFloat(p.value),y=u?parseFloat(u.value):0;C>=y&&u&&(u.value=(C+.5).toString()),i.randomWaitMin=parseFloat(p.value),B()}),u&&u.addEventListener("change",()=>{let C=p?parseFloat(p.value):0,y=parseFloat(u.value);y<=C&&p&&(p.value=(y-.5).toString()),i.randomWaitMax=parseFloat(u.value),B()});let h=o.querySelector("#minChargesToWaitInput"),g=o.querySelector("#pixelsPerBatchInput"),f=o.querySelector("#spendAllPixelsCheckbox");h&&h.addEventListener("change",()=>{i.minChargesToWait=parseInt(h.value),B()}),g&&g.addEventListener("change",()=>{i.pixelsPerBatch=parseInt(g.value),B()}),f&&f.addEventListener("change",C=>{let y=C.target.checked;X("spendAllPixelsCheckbox",y),i.spendAllPixelsOnStart=!!y,B()});let m=o.querySelector("#protectTransparentPixelsCheckbox"),x=o.querySelector("#protectPerimeterCheckbox"),w=o.querySelector("#perimeterWidthInput");m&&m.addEventListener("change",C=>{let y=C.target.checked;X("protectTransparentPixelsCheckbox",y),i.protectTransparentPixels=!!y,B()}),x&&x.addEventListener("change",C=>{let y=C.target.checked;X("protectPerimeterCheckbox",y),Ee("perimeterContainer",y),i.protectPerimeter=!!y,B()}),w&&w.addEventListener("change",()=>{let C=parseInt(w.value);C>=1&&C<=10&&(i.perimeterWidth=C,B())});let b=o.querySelector("#guardResetBtn");b&&b.addEventListener("click",()=>pn(o)),document.addEventListener("keydown",C=>{C.key==="Escape"&&o.style.display!=="none"&&(o.style.display="none")})}function Bt(o){let e=o.querySelector("#colorSelector");if(!e||!i.availableColors)return;Array.isArray(i.preferredColorIds)||(i.preferredColorIds=[],typeof i.preferredColorId=="number"&&(i.preferredColorIds=[i.preferredColorId])),d(`\u{1F50D} Cargando selector de colores preferidos. Colores preferidos actuales: [${i.preferredColorIds.join(", ")}]`),e.innerHTML="",i.availableColors.forEach(r=>{let s=document.createElement("div");s.style.cssText=`width:28px;height:28px;border-radius:6px;cursor:pointer;border:2px solid transparent;background-color: rgb(${r.r},${r.g},${r.b});position:relative;`,s.title=`Color ${r.id}: RGB(${r.r}, ${r.g}, ${r.b})`,s.dataset.colorId=r.id;let a=document.createElement("div");a.style.cssText=`
position: absolute;
top: -2px;
right: -2px;
width: 16px;
height: 16px;
background: #10b981;
border-radius: 50%;
display: none;
align-items: center;
justify-content: center;
color: white;
font-size: 10px;
font-weight: bold;
border: 2px solid white;
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
`,a.innerHTML="\u2713",s.appendChild(a),s.addEventListener("click",()=>{let l=Array.isArray(i.preferredColorIds)?i.preferredColorIds:[],c=l.indexOf(r.id);c>=0?(l.splice(c,1),s.style.borderColor="transparent",a.style.display="none"):(l.push(r.id),s.style.borderColor="#10b981",a.style.display="flex"),i.preferredColorIds=l,i.preferredColorId=l.length>0?l[0]:null;let p=o.querySelector("#clearPreferredColors");p.style.display=l.length>0?"block":"none",d(`\u{1F3A8} Colores preferidos: [${l.join(", ")}]`),B()}),Array.isArray(i.preferredColorIds)&&i.preferredColorIds.includes(r.id)&&(s.style.borderColor="#10b981",a.style.display="flex"),e.appendChild(s)});let t=o.querySelector("#clearPreferredColors"),n=Array.isArray(i.preferredColorIds)&&i.preferredColorIds.length>0;t.style.display=n?"block":"none"}function Nt(o){let e=o.querySelector("#excludeColorSelector");if(!e||!i.availableColors)return;Array.isArray(i.excludedColorIds)||(i.excludedColorIds=[]),d(`\u{1F50D} Cargando selector de colores excluidos. Colores excluidos actuales: [${i.excludedColorIds.join(", ")}]`),e.innerHTML="",i.availableColors.forEach(r=>{let s=document.createElement("div");s.style.cssText=`width:28px;height:28px;border-radius:6px;cursor:pointer;border:2px solid transparent;background-color: rgb(${r.r},${r.g},${r.b});position:relative;`,s.title=`Color ${r.id}: RGB(${r.r}, ${r.g}, ${r.b})`,s.dataset.colorId=r.id;let a=document.createElement("div");a.style.cssText=`
position: absolute;
top: -2px;
right: -2px;
width: 16px;
height: 16px;
background: #ef4444;
border-radius: 50%;
display: none;
align-items: center;
justify-content: center;
color: white;
font-size: 10px;
font-weight: bold;
border: 2px solid white;
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
`,a.innerHTML="\u2715",s.appendChild(a),s.addEventListener("click",()=>{let l=Array.isArray(i.excludedColorIds)?i.excludedColorIds:[],c=l.indexOf(r.id);c>=0?(l.splice(c,1),s.style.borderColor="transparent",a.style.display="none"):(l.push(r.id),s.style.borderColor="#ef4444",a.style.display="flex"),i.excludedColorIds=l;let p=o.querySelector("#clearExcludedColors");p.style.display=l.length>0?"block":"none",d(`\u{1F6AB} Colores excluidos: [${l.join(", ")}]`),B()}),Array.isArray(i.excludedColorIds)&&i.excludedColorIds.includes(r.id)&&(s.style.borderColor="#ef4444",a.style.display="flex"),e.appendChild(s)});let t=o.querySelector("#clearExcludedColors"),n=Array.isArray(i.excludedColorIds)&&i.excludedColorIds.length>0;t.style.display=n?"block":"none"}function Do(o){o.querySelector("#operationModeSelect").value=i.operationMode||"protect",o.querySelector("#protectionPatternSelect").value=i.protectionPattern;let e=o.querySelector("#preferColorCheckbox");e.checked=i.preferColor,X("preferColorCheckbox",i.preferColor),Ee("colorSelectorContainer",i.preferColor),i.preferColor&&Bt(o);let t=o.querySelector("#excludeColorCheckbox");t.checked=i.excludeColor,X("excludeColorCheckbox",i.excludeColor),Ee("excludeColorSelectorContainer",i.excludeColor),i.excludeColor&&Nt(o);let n=o.querySelector("#clearPreferredColors"),r=o.querySelector("#clearExcludedColors"),s=Array.isArray(i.preferredColorIds)&&i.preferredColorIds.length>0,a=Array.isArray(i.excludedColorIds)&&i.excludedColorIds.length>0;n.style.display=s?"block":"none",r.style.display=a?"block":"none";let l=o.querySelector("#spendAllPixelsCheckbox");l.checked=i.spendAllPixelsOnStart,X("spendAllPixelsCheckbox",i.spendAllPixelsOnStart),o.querySelector("#minChargesToWaitInput").value=i.minChargesToWait,o.querySelector("#pixelsPerBatchInput").value=i.pixelsPerBatch;let c=o.querySelector("#randomWaitCheckbox"),p=o.querySelector("#randomWaitContainer"),u=o.querySelector("#randomWaitMinInput"),h=o.querySelector("#randomWaitMaxInput");c.checked=i.randomWaitTime,X("randomWaitCheckbox",i.randomWaitTime),p.style.display=i.randomWaitTime?"block":"none",u.value=i.randomWaitMin,h.value=i.randomWaitMax;let g=o.querySelector("#protectTransparentPixelsCheckbox"),f=o.querySelector("#protectPerimeterCheckbox"),m=o.querySelector("#perimeterWidthInput");g&&(g.checked=i.protectTransparentPixels,X("protectTransparentPixelsCheckbox",i.protectTransparentPixels)),f&&(f.checked=i.protectPerimeter,X("protectPerimeterCheckbox",i.protectPerimeter),Ee("perimeterContainer",i.protectPerimeter)),m&&(m.value=i.perimeterWidth)}function B(){try{let o={operationMode:i.operationMode,protectionPattern:i.protectionPattern,preferColor:i.preferColor,preferredColorId:i.preferredColorId,preferredColorIds:Array.isArray(i.preferredColorIds)?i.preferredColorIds:[],excludeColor:i.excludeColor,excludedColorIds:Array.isArray(i.excludedColorIds)?i.excludedColorIds:[],spendAllPixelsOnStart:i.spendAllPixelsOnStart,minChargesToWait:i.minChargesToWait,pixelsPerBatch:i.pixelsPerBatch,randomWaitTime:i.randomWaitTime,randomWaitMin:i.randomWaitMin,randomWaitMax:i.randomWaitMax,protectTransparentPixels:i.protectTransparentPixels,protectPerimeter:i.protectPerimeter,perimeterWidth:i.perimeterWidth};localStorage.setItem("wplace-guard-config",JSON.stringify(o)),d("\u{1F4BE} Configuraci\xF3n actualizada")}catch(o){d("\u274C Error guardando configuraci\xF3n:",o)}}function pn(o){window.confirm("\xBFRestablecer configuraci\xF3n por defecto?")&&(i.operationMode="protect",i.protectionPattern="random",i.preferColor=!1,i.preferredColorIds=[],i.preferredColorId=5,i.excludeColor=!1,i.excludedColorIds=[],i.spendAllPixelsOnStart=!1,i.minChargesToWait=20,i.pixelsPerBatch=10,i.randomWaitTime=!1,i.randomWaitMin=1,i.randomWaitMax=5,i.protectTransparentPixels=!0,i.protectPerimeter=!1,i.perimeterWidth=1,Do(o),B(),d("\u{1F504} Configuraci\xF3n restablecida"))}Me();function jo(o){let e=document.createElement("div");e.style.cssText=`
position: fixed;
top: 20px;
right: 70px;
width: 350px;
min-width: 280px;
max-width: 500px;
min-height: 200px;
max-height: 80vh;
background: #1a1a1a;
border: 1px solid #333;
border-radius: 8px;
color: #eee;
font-family: 'Segoe UI', Roboto, sans-serif;
z-index: 9999;
box-shadow: 0 5px 15px rgba(0,0,0,0.5);
resize: both;
overflow: auto;
display: flex;
flex-direction: column;
`,e.classList.add("guard-container");let t=document.createElement("style");t.textContent=`
.guard-container.minimized { min-height: 0 !important; height: auto !important; }
.guard-content { max-height: 1000px; transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.25s ease; }
.guard-content.collapsed { max-height: 0; opacity: 0; overflow: hidden; padding: 0; flex: 0 0 auto !important; }
`,e.innerHTML=`
<div style="padding: 12px 15px; background: #2d3748; color: #60a5fa; font-size: 16px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; cursor: move; flex-shrink: 0;" class="guard-header">
<div style="display: flex; align-items: center; gap: 8px;">
\u{1F6E1}\uFE0F <span>${o.title}</span>
</div>
<button id="minimizeBtn" style="background: none; border: none; color: #eee; cursor: pointer; opacity: 0.7; padding: 5px; transition: opacity 0.2s ease;">\u2796</button>
</div>
<div class="guard-content" style="padding: 15px; flex: 1; overflow-y: auto;">
<!-- Estado de inicializaci\xF3n -->
<div id="initSection">
<button id="initBtn" style="width: 100%; padding: 10px; background: #60a5fa; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; margin-bottom: 10px;">
\u{1F916} ${o.initBot}
</button>
</div>
<!-- Selecci\xF3n de \xE1rea -->
<div id="areaSection" style="display: none;">
<!-- Botones de \xE1rea - en dos columnas con transici\xF3n -->
<div id="areaActionsRow" style="display: flex; gap: 10px; margin-bottom: 15px; overflow: hidden; transition: max-height 0.3s ease, opacity 0.3s ease; max-height: 200px; opacity: 1;">
<button id="selectAreaBtn" style="flex: 1; padding: 10px; background: #8b5cf6; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer;">
\u{1F3AF} ${o.selectArea}
</button>
<button id="loadAreaBtn" style="flex: 1; padding: 10px; background: #f59e0b; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer;">
\u{1F4C1} Cargar Archivo
</button>
</div>
<div style="display: flex; gap: 10px; margin-bottom: 10px;">
<button id="startBtn" style="flex: 1; padding: 10px; background: #10b981; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; opacity: 0.5;" disabled>
\u25B6\uFE0F ${o.startProtection}
</button>
<button id="stopBtn" style="flex: 1; padding: 10px; background: #ef4444; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; opacity: 0.5;" disabled>
\u23F9\uFE0F ${o.stopProtection}
</button>
</div>
<!-- Fila 2: Reposicionar / Guardar -->
<div style="display: flex; gap: 10px; margin-bottom: 10px;">
<button id="repositionBtn" style="flex: 1; padding: 8px; background: #8b5cf6; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 13px; transition: all 0.3s ease; opacity: 0.5;" disabled>
\u{1F4CD} Reposicionar
</button>
<button id="saveBtn" style="flex: 1; padding: 8px; background: #10b981; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 13px; transition: all 0.3s ease; opacity: 0.5;" disabled>
\u{1F4BE} ${o.save||"Guardar"}
</button>
</div>
<!-- Fila 3: Analizar \xC1rea / Logs -->
<div style="display: flex; gap: 10px; margin-bottom: 10px;">
<button id="analyzeBtn" style="flex: 1; padding: 8px; background: #3b82f6; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; opacity: 0.5;" disabled>
<svg width="14" height="14" viewBox="0 0 24 24" aria-hidden="true" focusable="false" style="margin-right: 6px; flex-shrink: 0;" fill="none">
<circle cx="11" cy="11" r="7" stroke="currentColor" stroke-width="2"></circle>
<line x1="16.65" y1="16.65" x2="21" y2="21" stroke="currentColor" stroke-width="2" stroke-linecap="round"></line>
</svg>
Analizar \xC1rea
</button>
<button id="logWindowBtn" style="flex: 1; padding: 8px; background: #6b7280; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center;">
<svg width="14" height="14" viewBox="0 0 24 24" aria-hidden="true" focusable="false" style="margin-right: 6px; flex-shrink: 0;" fill="none">
<rect x="4" y="3" width="16" height="18" rx="2" ry="2" stroke="currentColor" stroke-width="2"></rect>
<line x1="8" y1="7" x2="16" y2="7" stroke="currentColor" stroke-width="2" stroke-linecap="round"></line>
<line x1="8" y1="11" x2="16" y2="11" stroke="currentColor" stroke-width="2" stroke-linecap="round"></line>
<line x1="8" y1="15" x2="13" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"></line>
</svg>
${o.logWindow||"Logs"}
</button>
</div>
<!-- Fila 4: Vig\xEDa / Configuraci\xF3n -->
<div style="display: flex; gap: 10px; margin-bottom: 15px;">
<button id="watchBtn" style="flex: 1; padding: 8px; background: #f59e0b; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 13px; transition: all 0.3s ease; opacity: 0.5;" disabled>
\u{1F441}\uFE0F Vig\xEDa
</button>
<button id="configBtn" style="flex: 1; padding: 8px; background: #8b5cf6; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 13px;">
\u2699\uFE0F Configuraci\xF3n
</button>
</div>
</div>
<!-- Estad\xEDsticas -->
<div id="statsSection" style="background: #2d3748; padding: 10px; border-radius: 6px; margin-top: 10px;">
<div style="font-size: 13px; margin-bottom: 5px;">
<span>\u{1F4CA} ${o.protectedPixels}: </span><span id="protectedCount">0</span>
</div>
<div style="font-size: 13px; margin-bottom: 5px;">
<span>\u{1F6A8} ${o.detectedChanges}: </span><span id="changesCount">0</span>
</div>
<div style="font-size: 13px; margin-bottom: 5px;">
<span>\u26A1 ${o.charges}: </span><span id="chargesCount">0</span>
</div>
<div style="font-size: 13px; margin-bottom: 5px;">
<span>\u{1F6E0}\uFE0F ${o.repairedPixels}: </span><span id="repairedCount">0</span>
</div>
<div id="countdownSection" style="font-size: 13px; margin-bottom: 5px; display: none;">
<span>\u23F0 Pr\xF3ximo lote en: </span><span id="countdownTimer">--</span>
</div>
<!-- Estad\xEDsticas de An\xE1lisis -->
<hr style="border: none; border-top: 1px solid #4a5568; margin: 10px 0;">
<div style="font-size: 13px; margin-bottom: 5px;">
<span style="color: #10b981;">\u2705 P\xEDxeles Correctos: </span><span id="correctPixelsCount">-</span>
</div>
<div style="font-size: 13px; margin-bottom: 5px;">
<span style="color: #ef4444;">\u274C P\xEDxeles Incorrectos: </span><span id="incorrectPixelsCount">-</span>
</div>
<div style="font-size: 13px; margin-bottom: 5px;">
<span style="color: #f59e0b;">\u26AA P\xEDxeles Faltantes: </span><span id="missingPixelsCount">-</span>
</div>
<div style="font-size: 13px;">
<span style="color: #8b5cf6;">\u{1F3AF} Precisi\xF3n: </span><span id="accuracyCount">-</span>
</div>
</div>
</div>
<!-- Estado (siempre visible aunque se minimice) -->
<div id="statusBar" style="background: #2d3748; padding: 8px; border-radius: 4px; text-align: center; font-size: 13px; margin-top: 10px;">
\u23F3 ${o.waitingInit}
</div>
<!-- Indicador de redimensionamiento -->
<div style="
position: absolute;
bottom: 0;
right: 0;
width: 20px;
height: 20px;
background: linear-gradient(-45deg, transparent 30%, #666 30%, #666 40%, transparent 40%, transparent 60%, #666 60%, #666 70%, transparent 70%);
cursor: nw-resize;
border-bottom-right-radius: 15px;
"></div>
`,document.body.appendChild(e),e.appendChild(t),V(e);let n=document.createElement("input");n.type="file",n.accept=".json",n.style.display="none",document.body.appendChild(n),Cn(e);let r={initBtn:e.querySelector("#initBtn"),selectAreaBtn:e.querySelector("#selectAreaBtn"),loadAreaBtn:e.querySelector("#loadAreaBtn"),x1Input:e.querySelector("#x1Input"),y1Input:e.querySelector("#y1Input"),x2Input:e.querySelector("#x2Input"),y2Input:e.querySelector("#y2Input"),startBtn:e.querySelector("#startBtn"),stopBtn:e.querySelector("#stopBtn"),watchBtn:e.querySelector("#watchBtn"),logWindowBtn:e.querySelector("#logWindowBtn"),configBtn:e.querySelector("#configBtn"),repositionBtn:e.querySelector("#repositionBtn"),minimizeBtn:e.querySelector("#minimizeBtn"),initSection:e.querySelector("#initSection"),areaSection:e.querySelector("#areaSection"),protectedCount:e.querySelector("#protectedCount"),changesCount:e.querySelector("#changesCount"),chargesCount:e.querySelector("#chargesCount"),repairedCount:e.querySelector("#repairedCount"),countdownSection:e.querySelector("#countdownSection"),countdownTimer:e.querySelector("#countdownTimer"),correctPixelsCount:e.querySelector("#correctPixelsCount"),incorrectPixelsCount:e.querySelector("#incorrectPixelsCount"),missingPixelsCount:e.querySelector("#missingPixelsCount"),accuracyCount:e.querySelector("#accuracyCount"),statusBar:e.querySelector("#statusBar"),areaFileInput:n,saveBtn:e.querySelector("#saveBtn"),analyzeBtn:e.querySelector("#analyzeBtn"),areaActionsRow:e.querySelector("#areaActionsRow")},s={container:e,elements:r,updateStatus:(a,l="info")=>{r.statusBar.textContent=a;let c={info:"#60a5fa",success:"#10b981",warning:"#f59e0b",error:"#ef4444"};r.statusBar.style.color=c[l]||c.info},updateProgress:(a,l,c=!1)=>{r.changesCount.textContent=a,c&&l>0?r.protectedCount.textContent=`${l} (\xE1rea vac\xEDa)`:r.protectedCount.textContent=l},updateStats:a=>{a.charges!==void 0&&(r.chargesCount.textContent=a.charges),a.repaired!==void 0&&(r.repairedCount.textContent=a.repaired),a.pending!==void 0&&(r.changesCount.textContent=a.pending)},showCountdown:(a=!0)=>{r.countdownSection.style.display=a?"block":"none"},updateCountdown:a=>{if(a<=0){r.countdownTimer.textContent="--",s.showCountdown(!1);return}let l=Math.floor(a/60),c=a%60,p=l>0?`${l}m ${c}s`:`${c}s`;r.countdownTimer.textContent=p,s.showCountdown(!0)},updateAnalysisStats:a=>{a.correct!==void 0&&(r.correctPixelsCount.textContent=a.correct),a.incorrect!==void 0&&(r.incorrectPixelsCount.textContent=a.incorrect),a.missing!==void 0&&(r.missingPixelsCount.textContent=a.missing),a.accuracy!==void 0&&(r.accuracyCount.textContent=`${a.accuracy}%`)},showAreaSection:()=>{r.initSection.style.display="none",r.areaSection.style.display="block";let{guardState:a}=window;a&&a.operationMode&&(a.operationMode==="erase"?r.startBtn.innerHTML="\u{1F5D1}\uFE0F Iniciar Borrado":r.startBtn.innerHTML="\u25B6\uFE0F Iniciar")},setInitButtonVisible:a=>{r.initSection.style.display=a?"block":"none"},setInitialized:a=>{r.initBtn.disabled=a,a&&(r.initBtn.style.opacity="0.5",r.initBtn.style.cursor="not-allowed")},enableStartBtn:()=>{r.startBtn.disabled=!1,r.startBtn.style.opacity="1",r.startBtn.style.cursor="pointer",s.updateButtonsState()},updateRepositionBtn:()=>{let a=be();r.repositionBtn.disabled=!a,a?(r.repositionBtn.style.opacity="1",r.repositionBtn.style.cursor="pointer"):(r.repositionBtn.style.opacity="0.5",r.repositionBtn.style.cursor="not-allowed")},updateWatchButton:a=>{a?(r.watchBtn.innerHTML="\u23F9\uFE0F Detener Vig\xEDa",r.watchBtn.style.background="#ef4444"):(r.watchBtn.innerHTML="\u{1F441}\uFE0F Vig\xEDa",r.watchBtn.style.background="#f59e0b")},updateButtonsState:()=>{let a=be()||window.guardState&&window.guardState.protectionArea;r.analyzeBtn.disabled=!a,a?(r.analyzeBtn.style.opacity="1",r.analyzeBtn.style.cursor="pointer"):(r.analyzeBtn.style.opacity="0.5",r.analyzeBtn.style.cursor="not-allowed"),r.watchBtn.disabled=!a,a?(r.watchBtn.style.opacity="1",r.watchBtn.style.cursor="pointer"):(r.watchBtn.style.opacity="0.5",r.watchBtn.style.cursor="not-allowed"),r.saveBtn.disabled=!a,a?(r.saveBtn.style.opacity="1",r.saveBtn.style.cursor="pointer"):(r.saveBtn.style.opacity="0.5",r.saveBtn.style.cursor="not-allowed"),s.updateRepositionBtn()},setRunningState:a=>{a?(r.startBtn.disabled=!0,r.startBtn.style.opacity="0.5",r.startBtn.style.cursor="not-allowed",r.stopBtn.disabled=!1,r.stopBtn.style.opacity="1",r.stopBtn.style.cursor="pointer",r.selectAreaBtn.disabled=!0,r.repositionBtn.disabled=!0,r.areaActionsRow&&(r.areaActionsRow.style.maxHeight="0px",r.areaActionsRow.style.opacity="0",setTimeout(()=>{r.areaActionsRow.style.display="none"},300))):(r.stopBtn.disabled=!0,r.stopBtn.style.opacity="0.5",r.stopBtn.style.cursor="not-allowed",s.updateStartButtonState(),r.selectAreaBtn.disabled=!1,s.updateButtonsState(),r.areaActionsRow&&(r.areaActionsRow.style.display="flex",window.requestAnimationFrame(()=>{r.areaActionsRow.style.maxHeight="200px",r.areaActionsRow.style.opacity="1"})))},updateCoordinates:a=>{a.x1!==void 0&&a.y1!==void 0&&a.x2!==void 0&&a.y2!==void 0&&(s.updateStartButtonState(),s.updateButtonsState())},updateStartButtonState:()=>{let a=be()||window.guardState&&window.guardState.protectionArea;a&&!r.startBtn.disabled||(a?(r.startBtn.disabled=!1,r.startBtn.style.opacity="1",r.startBtn.style.cursor="pointer"):(r.startBtn.disabled=!0,r.startBtn.style.opacity="0.5",r.startBtn.style.cursor="not-allowed"))},destroy:()=>{e.style.transition="opacity 0.3s ease, transform 0.3s ease",e.style.opacity="0",e.style.transform="scale(0.95) translateY(-20px)",setTimeout(()=>{Z(e),e.remove(),n.remove()},300)}};return r.minimizeBtn.addEventListener("click",()=>{let a=e.querySelector(".guard-content");a&&(a.classList.contains("collapsed")?(a.classList.remove("collapsed"),e.classList.remove("minimized"),r.minimizeBtn.textContent="\u2796"):(a.classList.add("collapsed"),e.classList.add("minimized"),r.minimizeBtn.textContent="\u{1F53C}"))}),r.configBtn.addEventListener("click",async()=>{r.configBtn.style.transform="scale(0.95)",setTimeout(()=>{r.configBtn.style.transform="scale(1)"},150),Wo()}),r.analyzeBtn.addEventListener("click",async()=>{r.analyzeBtn.style.transform="scale(0.95)",setTimeout(()=>{r.analyzeBtn.style.transform="scale(1)"},150);let{createAnalysisWindow:a}=await Promise.resolve().then(()=>(Xo(),Yo));a()}),s.updateButtonsState(),s}function Go(o,e,t={}){return new Promise(n=>{let r=document.createElement("div");r.className="modal-overlay",r.style.position="fixed",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.height="100%",r.style.background="rgba(0,0,0,0.7)",r.style.zIndex="10001",r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="center";let s=document.createElement("div");s.style.background="#1a1a1a",s.style.border="2px solid #333",s.style.borderRadius="15px",s.style.padding="25px",s.style.color="#eee",s.style.minWidth="350px",s.style.maxWidth="400px",s.style.boxShadow="0 10px 30px rgba(0,0,0,0.5)",s.style.fontFamily="'Segoe UI', Roboto, sans-serif",s.innerHTML=`
<h3 style="margin: 0 0 15px 0; text-align: center; font-size: 18px;">${e}</h3>
<p style="margin: 0 0 20px 0; text-align: center; line-height: 1.4;">${o}</p>
<div style="display: flex; gap: 10px; justify-content: center;">
${t.save?`<button class="save-btn" style="padding: 10px 20px; border: none; border-radius: 8px; font-size: 14px; font-weight: bold; cursor: pointer; min-width: 100px; background: #10b981; color: white;">${t.save}</button>`:""}
${t.discard?`<button class="discard-btn" style="padding: 10px 20px; border: none; border-radius: 8px; font-size: 14px; font-weight: bold; cursor: pointer; min-width: 100px; background: #ef4444; color: white;">${t.discard}</button>`:""}
${t.cancel?`<button class="cancel-btn" style="padding: 10px 20px; border: none; border-radius: 8px; font-size: 14px; font-weight: bold; cursor: pointer; min-width: 100px; background: #2d3748; color: white;">${t.cancel}</button>`:""}
</div>
`,r.appendChild(s),document.body.appendChild(r),V(s);let a=s.querySelector(".save-btn"),l=s.querySelector(".discard-btn"),c=s.querySelector(".cancel-btn"),p=()=>{Z(s),document.body.removeChild(r)};a&&a.addEventListener("click",()=>{p(),n("save")}),l&&l.addEventListener("click",()=>{p(),n("discard")}),c&&c.addEventListener("click",()=>{p(),n("cancel")}),r.addEventListener("click",u=>{u.target===r&&(p(),n("cancel"))})})}function Cn(o){let e=o.querySelector(".guard-header");if(!e)return;let t,n,r,s;e.addEventListener("mousedown",a=>{a.preventDefault(),t=a.clientX,n=a.clientY,r=parseInt(window.getComputedStyle(o).left,10),s=parseInt(window.getComputedStyle(o).top,10);let l=p=>{let u=p.clientX-t,h=p.clientY-n;o.style.left=`${r+u}px`,o.style.top=`${s+h}px`},c=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)})}D();Me();var at=class{constructor(e="Bot"){this.botName=e,this.isVisible=!1,this.logs=[],this.maxLogs=1e3,this.container=null,this.logContent=null,this.isResizing=!1,this.resizeHandle=null,this.originalConsole={},this.config={width:600,height:400,x:window.innerWidth-620,y:20,visible:!1},this.loadConfig(),this.createWindow(),this.setupLogInterception(),this.setupEventListeners()}loadConfig(){try{let e=localStorage.getItem(`wplace-log-window-${this.botName}`);e&&(this.config={...this.config,...JSON.parse(e)})}catch(e){d("Error cargando configuraci\xF3n de ventana de logs:",e)}}saveConfig(){try{localStorage.setItem(`wplace-log-window-${this.botName}`,JSON.stringify(this.config))}catch(e){d("Error guardando configuraci\xF3n de ventana de logs:",e)}}createWindow(){this.container=document.createElement("div"),this.container.className="wplace-log-window",this.container.style.cssText=`
position: fixed;
left: ${this.config.x}px;
top: ${this.config.y}px;
width: ${this.config.width}px;
height: ${this.config.height}px;
background: rgba(0, 0, 0, 0.9);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 8px;
z-index: 100001;
display: ${this.config.visible?"flex":"none"};
flex-direction: column;
backdrop-filter: blur(10px);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
color: #fff;
resize: none;
overflow: hidden;
`;let e=document.createElement("div");e.className="log-window-header",e.style.cssText=`
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
background: rgba(255, 255, 255, 0.1);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
cursor: move;
user-select: none;
border-radius: 7px 7px 0 0;
`;let t=document.createElement("div");t.textContent=`\u{1F4CB} Logs - ${this.botName}`,t.style.cssText=`
font-weight: bold;
font-size: 14px;
color: #e2e8f0;
`;let n=document.createElement("div");n.style.cssText=`
display: flex;
gap: 8px;
`;let r=document.createElement("button");r.innerHTML="\u{1F4BE}",r.title="Descargar logs",r.style.cssText=`
background: rgba(34, 197, 94, 0.8);
border: none;
border-radius: 4px;
color: white;
width: 24px;
height: 24px;
cursor: pointer;
font-size: 12px;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.2s;
`,r.addEventListener("mouseenter",()=>{r.style.background="rgba(34, 197, 94, 1)"}),r.addEventListener("mouseleave",()=>{r.style.background="rgba(34, 197, 94, 0.8)"}),r.addEventListener("click",()=>this.downloadLogs());let s=document.createElement("button");s.innerHTML="\u2715",s.title="Cerrar ventana",s.style.cssText=`
background: rgba(239, 68, 68, 0.8);
border: none;
border-radius: 4px;
color: white;
width: 24px;
height: 24px;
cursor: pointer;
font-size: 12px;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.2s;
`,s.addEventListener("mouseenter",()=>{s.style.background="rgba(239, 68, 68, 1)"}),s.addEventListener("mouseleave",()=>{s.style.background="rgba(239, 68, 68, 0.8)"}),s.addEventListener("click",()=>this.hide()),n.appendChild(r),n.appendChild(s),e.appendChild(t),e.appendChild(n),this.logContent=document.createElement("div"),this.logContent.className="log-window-content",this.logContent.style.cssText=`
flex: 1;
padding: 8px;
overflow-y: auto;
font-size: 12px;
line-height: 1.4;
white-space: pre-wrap;
word-break: break-word;
`,this.resizeHandle=document.createElement("div"),this.resizeHandle.className="log-window-resize-handle",this.resizeHandle.style.cssText=`
position: absolute;
bottom: 0;
right: 0;
width: 20px;
height: 20px;
cursor: se-resize;
background: linear-gradient(-45deg, transparent 30%, rgba(255,255,255,0.3) 30%, rgba(255,255,255,0.3) 70%, transparent 70%);
border-radius: 0 0 8px 0;
`,this.container.appendChild(e),this.container.appendChild(this.logContent),this.container.appendChild(this.resizeHandle),document.body.appendChild(this.container),V(this.container),this.setupDragging(e),this.setupResizing(),this.isVisible=this.config.visible}setupDragging(e){let t=!1,n={x:0,y:0};e.addEventListener("mousedown",a=>{a.target.tagName!=="BUTTON"&&(t=!0,n.x=a.clientX-this.container.offsetLeft,n.y=a.clientY-this.container.offsetTop,document.addEventListener("mousemove",r),document.addEventListener("mouseup",s),a.preventDefault())});let r=a=>{if(!t)return;let l=Math.max(0,Math.min(window.innerWidth-this.container.offsetWidth,a.clientX-n.x)),c=Math.max(0,Math.min(window.innerHeight-this.container.offsetHeight,a.clientY-n.y));this.container.style.left=l+"px",this.container.style.top=c+"px",this.config.x=l,this.config.y=c},s=()=>{t=!1,document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s),this.saveConfig()}}setupResizing(){let e=!1,t,n,r,s;this.resizeHandle.addEventListener("mousedown",c=>{e=!0,t=c.clientX,n=c.clientY,r=parseInt(document.defaultView.getComputedStyle(this.container).width,10),s=parseInt(document.defaultView.getComputedStyle(this.container).height,10),document.addEventListener("mousemove",a),document.addEventListener("mouseup",l),c.preventDefault()});let a=c=>{if(!e)return;let p=Math.max(300,r+c.clientX-t),u=Math.max(200,s+c.clientY-n);this.container.style.width=p+"px",this.container.style.height=u+"px",this.config.width=p,this.config.height=u},l=()=>{e=!1,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l),this.saveConfig()}}setupLogInterception(){this.originalConsole={log:console.log,info:console.info,warn:console.warn,error:console.error,debug:console.debug},console.log=(...e)=>{this.originalConsole.log.apply(console,e),this.addLog("log",e)},console.info=(...e)=>{this.originalConsole.info.apply(console,e),this.addLog("info",e)},console.warn=(...e)=>{this.originalConsole.warn.apply(console,e),this.addLog("warn",e)},console.error=(...e)=>{this.originalConsole.error.apply(console,e),this.addLog("error",e)},console.debug=(...e)=>{this.originalConsole.debug.apply(console,e),this.addLog("debug",e)}}addLog(e,t){let n=new Date().toLocaleTimeString(),r=t.map(a=>typeof a=="object"?JSON.stringify(a,null,2):String(a)).join(" "),s={timestamp:n,type:e,message:r,raw:t};this.logs.push(s),this.logs.length>this.maxLogs&&this.logs.shift(),this.isVisible&&this.updateLogDisplay()}updateLogDisplay(){if(!this.logContent)return;let e=this.logs.map(t=>`<div style="color: ${this.getLogColor(t.type)}; margin-bottom: 2px;">[${t.timestamp}] ${t.message}</div>`).join("");this.logContent.innerHTML=e,this.logContent.scrollTop=this.logContent.scrollHeight}getLogColor(e){let t={log:"#e2e8f0",info:"#60a5fa",warn:"#fbbf24",error:"#f87171",debug:"#a78bfa"};return t[e]||t.log}downloadLogs(){let e=new Date,t=e.toISOString().split("T")[0],n=e.toTimeString().split(" ")[0].replace(/:/g,"-"),r=`log_${this.botName}_${t}_${n}.log`,s=this.logs.map(p=>`[${p.timestamp}] [${p.type.toUpperCase()}] ${p.message}`).join(`
`),a=new Blob([s],{type:"text/plain"}),l=URL.createObjectURL(a),c=document.createElement("a");c.href=l,c.download=r,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(l),d(`\u{1F4E5} Logs descargados como: ${r}`)}show(){this.container&&(this.container.style.display="flex",Rt(this.container),this.isVisible=!0,this.config.visible=!0,this.updateLogDisplay(),this.saveConfig())}hide(){this.container&&(this.container.style.display="none",this.isVisible=!1,this.config.visible=!1,this.saveConfig())}toggle(){this.isVisible?this.hide():this.show()}clear(){this.logs=[],this.logContent&&(this.logContent.innerHTML="")}setupEventListeners(){window.addEventListener("resize",()=>{if(this.container){let e=window.innerWidth-this.container.offsetWidth,t=window.innerHeight-this.container.offsetHeight;this.config.x>e&&(this.config.x=Math.max(0,e),this.container.style.left=this.config.x+"px"),this.config.y>t&&(this.config.y=Math.max(0,t),this.container.style.top=this.config.y+"px"),this.saveConfig()}})}destroy(){this.originalConsole.log&&(console.log=this.originalConsole.log,console.info=this.originalConsole.info,console.warn=this.originalConsole.warn,console.error=this.originalConsole.error,console.debug=this.originalConsole.debug),this.container&&this.container.parentNode&&(Z(this.container),this.container.parentNode.removeChild(this.container)),this.container=null,this.logContent=null,this.logs=[]}};window.__wplaceLogWindows=window.__wplaceLogWindows||{};function Ut(o){return window.__wplaceLogWindows[o]||(window.__wplaceLogWindows[o]=new at(o)),window.__wplaceLogWindows[o]}nt();function Ne(o=!1){let e=['[data-testid="color-picker"]',".color-picker",".palette",'[class*="color"][class*="picker"]','[class*="palette"]'];for(let r of e){let s=document.querySelector(r);if(s&&s.offsetParent!==null)return o&&console.log(`[WPA-UI] \u{1F3A8} Paleta detectada por selector: ${r}`),!0}let t=document.querySelectorAll('[style*="background-color"], [style*="background:"], .color, [class*="color"]'),n=0;for(let r of t)if(r.offsetParent!==null&&r.offsetWidth>10&&r.offsetHeight>10&&(n++,n>=5))return o&&console.log(`[WPA-UI] \u{1F3A8} Paleta detectada por colores visibles: ${n}`),!0;return o&&console.log(`[WPA-UI] \u{1F50D} Paleta no detectada. Colores visibles: ${n}`),!1}function st(o=!1,e=!1){let t=document.querySelector("button.btn.btn-primary.btn-lg, button.btn.btn-primary.sm\\:btn-xl");if(t){let r=t.textContent.toLowerCase(),s=r.includes("paint")||r.includes("pintar"),a=t.querySelector('svg path[d*="240-120"]')||t.querySelector('svg path[d*="M15"]');if(s||a)return o&&console.log(`[WPA-UI] \u{1F3AF} Bot\xF3n Paint encontrado por selector espec\xEDfico: "${r}"`),t.click(),e&&setTimeout(()=>{o&&console.log("[WPA-UI] \u{1F3AF} Segundo clic en bot\xF3n Paint"),t.click()},500),!0}let n=document.querySelectorAll("button");for(let r of n){let s=r.textContent.toLowerCase();if((s.includes("paint")||s.includes("pintar"))&&r.offsetParent!==null&&!r.disabled)return o&&console.log(`[WPA-UI] \u{1F3AF} Bot\xF3n Paint encontrado por texto: "${r.textContent.trim()}"`),r.click(),e&&setTimeout(()=>{o&&console.log("[WPA-UI] \u{1F3AF} Segundo clic en bot\xF3n Paint"),r.click()},500),!0}return o&&console.log("[WPA-UI] \u274C Bot\xF3n Paint no encontrado"),!1}async function Ho(o=3,e=!0){e&&console.log(`[WPA-UI] \u{1F916} Iniciando auto-click del bot\xF3n Paint (m\xE1ximo ${o} intentos)`);for(let t=1;t<=o;t++){if(e&&console.log(`[WPA-UI] \u{1F3AF} Intento ${t}/${o} - Buscando bot\xF3n Paint...`),Ne())return e&&console.log("[WPA-UI] \u2705 Paleta ya est\xE1 abierta, auto-click completado"),!0;if(st(e,!1)){if(e&&console.log("[WPA-UI] \u{1F446} Clic en bot\xF3n Paint realizado (sin segundo clic)"),await new Promise(n=>setTimeout(n,1500)),Ne())return e&&console.log(`[WPA-UI] \u2705 Paleta abierta exitosamente despu\xE9s del intento ${t}`),!0;e&&console.log(`[WPA-UI] \u26A0\uFE0F Paleta no detectada tras el clic en intento ${t}. Reintentar\xE1.`)}else e&&console.log(`[WPA-UI] \u274C Bot\xF3n Paint no encontrado para clic en intento ${t}`);t<o&&await new Promise(n=>setTimeout(n,1e3))}return e&&console.log(`[WPA-UI] \u274C Auto-click fall\xF3 despu\xE9s de ${o} intentos`),!1}D();Ue();mt();gt();async function Vo(o="Bot"){d(`\u{1F680} [${o}] Preparando tokens (modo simplificado)`);try{qe({})}catch{}try{ro()}catch{}return{success:!0,fingerprint:ce(),pawtectToken:se(),skipped:!0}}yt();D();te();var{setTimeout:Zo,Request:vn,Response:Pn,createImageBitmap:En,OffscreenCanvas:In}=window,qt=class{constructor(){this.isEnabled=!1,this.displayEnabled=!1,this.protectionArea=null,this.originalFetch=null,this.isIntercepting=!1,this.TILE_SIZE=1e3}initialize(){try{return d("\u2705 Overlay de protecci\xF3n inicializado"),!0}catch(e){return d("\u274C Error inicializando overlay:",e),!1}}showProtectionArea(e){this.protectionArea=e,this.isEnabled=!0,this.startFetchInterception(),d(`\u{1F6E1}\uFE0F Mostrando \xE1rea de protecci\xF3n: (${e.x1},${e.y1}) a (${e.x2},${e.y2})`)}hideProtectionArea(){this.isEnabled=!1,this.stopFetchInterception(),d("\u{1F50D} Ocultando \xE1rea de protecci\xF3n")}showDisplay(e){this.displayEnabled=!0,this.showProtectionArea(e),d("\u{1F5BC}\uFE0F Display activado")}hideDisplay(){this.displayEnabled=!1,this.hideProtectionArea(),d("\u{1F5BC}\uFE0F Display desactivado")}startFetchInterception(){this.isIntercepting||(this.originalFetch=window.fetch,this.isIntercepting=!0,window.fetch=async(...e)=>{var a;let t=await this.originalFetch.apply(window,e),n=t.clone(),r=(e[0]instanceof vn?(a=e[0])==null?void 0:a.url:e[0])||"ignore",s=n.headers.get("content-type")||"";if((r.includes("tiles")||r.includes("tile"))&&d(`\u{1F50D} TILE REQUEST: ${r} | ContentType: ${s}`),s.includes("image/")&&(r.includes("/tiles/")||r.includes("/tile/"))&&!r.includes("openfreemap")&&!r.includes("maps")){d(`\u{1F4E1} Interceptando tile: ${r}`);try{let l=await n.blob(),c=await this.drawProtectionOnTile(l,r);return new Pn(c,{headers:n.headers,status:n.status,statusText:n.statusText})}catch(l){return d("\u274C Error procesando tile:",l),t}}return t},d("\u{1F50D} Intercepci\xF3n de tiles iniciada para overlay de protecci\xF3n"))}stopFetchInterception(){!this.isIntercepting||!this.originalFetch||(window.fetch=this.originalFetch,this.isIntercepting=!1,d("\u23F9\uFE0F Intercepci\xF3n de tiles detenida"))}async drawProtectionOnTile(e,t){if(!this.isEnabled||!this.protectionArea)return e;d(`\u{1F527} Procesando tile: ${t}`);let n,r,s=t.split("/"),a=s[s.length-1].replace(/\.(png|jpg|jpeg|webp).*$/i,""),l=s[s.length-2];if(r=parseInt(a),n=parseInt(l),isNaN(n)||isNaN(r)){let g=t.match(/\/(\d+)\/(\d+)(?:\/\d+)?\.(?:png|jpg|jpeg|webp)/i);g&&(n=parseInt(g[1]),r=parseInt(g[2]))}if(isNaN(n)||isNaN(r))return d(`\u274C No se pudieron extraer coordenadas de: ${t}`),e;if(d(`\u{1F4CD} Coordenadas extra\xEDdas: tile(${n}, ${r})`),!this.tileIntersectsProtectionArea(n,r))return d(`\u27A1\uFE0F Tile ${n},${r} no intersecta con \xE1rea de protecci\xF3n`),e;d(`\u{1F3AF} Tile ${n},${r} INTERSECTA con \xE1rea de protecci\xF3n - aplicando overlay`);let c=await En(e),p=new In(c.width,c.height),u=p.getContext("2d");u.imageSmoothingEnabled=!1,u.drawImage(c,0,0),this.drawProtectionOverlay(u,n,r,c.width,c.height);let h=await p.convertToBlob({type:"image/png"});return d(`\u2705 Tile ${n},${r} procesado con overlay`),h}tileIntersectsProtectionArea(e,t){if(!this.protectionArea)return!1;let{x1:n,y1:r,x2:s,y2:a}=this.protectionArea,l=e*this.TILE_SIZE,c=l+this.TILE_SIZE,p=t*this.TILE_SIZE,u=p+this.TILE_SIZE;d("\u{1F50D} Verificando intersecci\xF3n:"),d(` Tile ${e},${t}: (${l}-${c}, ${p}-${u})`),d(` \xC1rea protecci\xF3n: (${n}-${s}, ${r}-${a})`);let h=!(s<l||n>c||a<p||r>u);return d(` \u{1F3AF} Intersecta: ${h}`),h}drawProtectionOverlay(e,t,n,r,s){var I;if(!this.protectionArea)return;let{x1:a,y1:l,x2:c,y2:p}=this.protectionArea,u=t*this.TILE_SIZE,h=n*this.TILE_SIZE,g=Math.max(0,a-u),f=Math.max(0,l-h),m=Math.min(this.TILE_SIZE,c-u),x=Math.min(this.TILE_SIZE,p-h);if(g>=m||f>=x)return;let w=r/this.TILE_SIZE,b=s/this.TILE_SIZE,C=g*w,y=f*b,P=(m-g)*w,v=(x-f)*b;if(d(`\u{1F3A8} Dibujando overlay en tile ${t},${n}:`),d(` Local: (${g},${f}) a (${m},${x})`),d(` Render: (${C},${y}) tama\xF1o: ${P}x${v}`),d(` Scale: ${w} x ${b}, TileSize: ${r}x${s}`),e.save(),this.displayEnabled){if(e.globalCompositeOperation="difference",e.fillStyle="white",e.fillRect(C,y,P,v),e.globalCompositeOperation="source-over",(I=i)!=null&&I.changes&&i.changes.size>0){e.fillStyle="rgba(255, 0, 0, 0.9)";for(let[S,L]of i.changes){let A=L.original;if(!A||A.tileX!==t||A.tileY!==n||A.localX<g||A.localX>=m||A.localY<f||A.localY>=x)continue;let $=A.localX*w,M=A.localY*b;e.fillRect($,M,Math.max(1,w),Math.max(1,b))}}e.strokeStyle="rgba(255, 255, 255, 0.9)",e.lineWidth=Math.max(1,1.5*Math.max(w,b)),e.strokeRect(C,y,P,v)}else{e.fillStyle="rgba(255, 0, 0, 0.5)",e.fillRect(C,y,P,v),e.strokeStyle="rgba(255, 0, 0, 1.0)",e.lineWidth=Math.max(1,1.5*Math.max(w,b)),e.strokeRect(C,y,P,v),e.strokeStyle="rgba(255, 255, 0, 0.8)",e.lineWidth=Math.max(.5,1*Math.max(w,b));for(let S=0;S<=P;S+=10*w)e.beginPath(),e.moveTo(C+S,y),e.lineTo(C+S,y+v),e.stroke();for(let S=0;S<=v;S+=10*b)e.beginPath(),e.moveTo(C,y+S),e.lineTo(C+P,y+S),e.stroke()}e.restore(),d(`\u2705 Overlay dibujado en tile ${t},${n}`)}updateArea(e){this.protectionArea=e}toggle(){this.isEnabled?this.hideProtectionArea():this.protectionArea&&this.showProtectionArea(this.protectionArea)}destroy(){this.stopFetchInterception(),this.protectionArea=null,this.isEnabled=!1,this.displayEnabled=!1,d("\u{1F5D1}\uFE0F Overlay destruido")}handleViewportChange(){}},he=new qt;document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Zo(()=>he.initialize(),1e3)}):Zo(()=>he.initialize(),1e3);Ct();He();var{setInterval:jt,clearInterval:Yt}=window;async function Ko(){d("\u{1F6E1}\uFE0F Iniciando WPlace Auto-Guard"),zt();try{(await Vo("Auto-Guard")).success||d("\u26A0\uFE0F [guard] Tokens no preparados, continuando con interceptor activo")}catch(o){d("\u274C [guard] Error preparando tokens:",o)}try{let o=localStorage.getItem("wplace-guard-config");if(o){let e=JSON.parse(o);e&&typeof e=="object"&&(typeof e.protectionPattern=="string"&&(i.protectionPattern=e.protectionPattern),typeof e.operationMode=="string"&&(i.operationMode=e.operationMode),typeof e.preferColor=="boolean"&&(i.preferColor=e.preferColor),Array.isArray(e.preferredColorIds)?(i.preferredColorIds=e.preferredColorIds,i.preferredColorId=e.preferredColorIds.length>0?e.preferredColorIds[0]:null):typeof e.preferredColorId=="number"&&(i.preferredColorIds=[e.preferredColorId],i.preferredColorId=e.preferredColorId),typeof e.excludeColor=="boolean"&&(i.excludeColor=e.excludeColor),Array.isArray(e.excludedColorIds)&&(i.excludedColorIds=e.excludedColorIds),typeof e.spendAllPixelsOnStart=="boolean"&&(i.spendAllPixelsOnStart=e.spendAllPixelsOnStart),Number.isFinite(e.minChargesToWait)&&(i.minChargesToWait=e.minChargesToWait),Number.isFinite(e.pixelsPerBatch)&&(i.pixelsPerBatch=e.pixelsPerBatch),typeof e.randomWaitTime=="boolean"&&(i.randomWaitTime=e.randomWaitTime),Number.isFinite(e.randomWaitMin)&&(i.randomWaitMin=e.randomWaitMin),Number.isFinite(e.randomWaitMax)&&(i.randomWaitMax=e.randomWaitMax),typeof e.protectTransparentPixels=="boolean"&&(i.protectTransparentPixels=e.protectTransparentPixels),typeof e.protectPerimeter=="boolean"&&(i.protectPerimeter=e.protectPerimeter),Number.isFinite(e.perimeterWidth)&&e.perimeterWidth>=1&&e.perimeterWidth<=10&&(i.perimeterWidth=e.perimeterWidth))}}catch(o){d("\u26A0\uFE0F No se pudo cargar configuraci\xF3n previa:",o)}if(Tn()){window.__wplaceBot={...window.__wplaceBot,guardRunning:!0},window.guardState=i;try{let o=No("guard");i.ui=jo(o),Sn(),(async()=>{try{let t=q({VARIANT:"auto-guard"});if(!t.ENABLED)return;window.__wplaceMetrics||(window.__wplaceMetrics={}),d(`[METRICS] enabled \u2192 ${t.BASE_URL}`),window.__wplaceMetrics.guardSessionActive=!0,go({botVariant:"auto-guard",metadata:{source:"guard"}});let n=Math.max(6e4,t.PING_INTERVAL_MS||3e5);window.__wplaceMetrics.guardPingInterval=jt(()=>{Ve({botVariant:"auto-guard"})},n)}catch{}})();async function e(){if(d("\u{1F916} Intentando auto-inicio del Guard..."),i.ui.updateStatus(T("guard.paletteNotFound"),"info"),Ne()){if(d("\u{1F3A8} Paleta parece abierta. Validando colores..."),ue().length>0)return i.ui.updateStatus(T("guard.paletteDetected"),"success"),!0;d('\u26A0\uFE0F Paleta "abierta" pero sin colores detectados. Intentando presionar Paint...')}if(d("\u{1F50D} Buscando bot\xF3n Paint..."),i.ui.updateStatus(T("guard.clickingPaintButton"),"info"),st()){if(d("\u{1F446} Bot\xF3n Paint encontrado y presionado"),await oe(3e3),ue().length>0)return d("\u2705 Colores detectados tras presionar Paint"),i.ui.updateStatus(T("guard.paletteDetected"),"success"),!0;Ne()?d("\u2705 Paleta abierta, pero sin colores accesibles a\xFAn"):d("\u274C La paleta no se abri\xF3 despu\xE9s de hacer clic")}else d("\u274C Bot\xF3n Paint no encontrado");return i.ui.updateStatus(T("guard.autoInitFailed"),"warning"),!1}setTimeout(async()=>{try{i.ui.updateStatus(T("guard.autoInitializing"),"info"),d("\u{1F916} Intentando auto-inicio...");try{N("auto_init_attempt",{botVariant:"auto-guard"})}catch{}if(await e()){i.ui.updateStatus(T("guard.autoInitSuccess"),"success"),d("\u2705 Auto-inicio exitoso");try{N("auto_init_result",{botVariant:"auto-guard",metadata:{success:!0}})}catch{}i.ui.setInitButtonVisible(!1),await Jo(!0)&&d("\u{1F680} Guard-BOT auto-iniciado completamente")}else{i.ui.updateStatus(T("guard.autoInitFailed"),"warning"),d("\u26A0\uFE0F Auto-inicio fall\xF3, se requiere inicio manual");try{N("auto_init_result",{botVariant:"auto-guard",metadata:{success:!1}})}catch{}i.ui.setInitButtonVisible(!0)}}catch(t){d("\u274C Error en auto-inicio:",t),i.ui.updateStatus(T("guard.manualInitRequired"),"warning");try{N("auto_init_result",{botVariant:"auto-guard",metadata:{success:!1,error:String((t==null?void 0:t.message)||t)}})}catch{}}},1e3),window.addEventListener("beforeunload",()=>{var t,n;Xt(),window.__wplaceBot&&(window.__wplaceBot.guardRunning=!1);try{q().ENABLED&&((t=window.__wplaceMetrics)!=null&&t.guardPingInterval&&(Yt(window.__wplaceMetrics.guardPingInterval),window.__wplaceMetrics.guardPingInterval=null),(n=window.__wplaceMetrics)!=null&&n.guardSessionActive&&(wt({botVariant:"auto-guard"}),window.__wplaceMetrics.guardSessionActive=!1))}catch{}});try{if(q().ENABLED){let n=()=>{if(!document.hidden)try{Ve({botVariant:"auto-guard",metadata:{reason:"visibility"}})}catch{}},r=()=>{try{Ve({botVariant:"auto-guard",metadata:{reason:"focus"}})}catch{}};document.addEventListener("visibilitychange",n),window.addEventListener("focus",r),window.__wplaceMetrics=window.__wplaceMetrics||{},window.__wplaceMetrics.guardVisibilityHandler=n,window.__wplaceMetrics.guardFocusHandler=r}}catch{}At(),d("\u2705 Auto-Guard cargado correctamente")}catch(o){throw d("\u274C Error inicializando Auto-Guard:",o),window.__wplaceBot&&(window.__wplaceBot.guardRunning=!1),o}}}function Tn(){var o,e;return(o=window.__wplaceBot)!=null&&o.imageRunning?(alert("Auto-Image est\xE1 ejecut\xE1ndose. Ci\xE9rralo antes de iniciar Auto-Guard."),!1):(e=window.__wplaceBot)!=null&&e.farmRunning?(alert("Auto-Farm est\xE1 ejecut\xE1ndose. Ci\xE9rralo antes de iniciar Auto-Guard."),!1):!0}function Sn(){let{elements:o}=i.ui;o.initBtn.addEventListener("click",()=>Jo()),o.selectAreaBtn.addEventListener("click",An),o.loadAreaBtn.addEventListener("click",()=>{o.areaFileInput.click()}),o.areaFileInput.addEventListener("change",async()=>{if(o.areaFileInput.files.length>0){let t=await Eo(o.areaFileInput.files[0]);t.success?(i.ui.updateStatus(`\u2705 Protecci\xF3n cargada: ${t.protectedPixels} p\xEDxeles protegidos`,"success"),d("\u2705 \xC1rea de protecci\xF3n cargada desde archivo")):(i.ui.updateStatus(`\u274C Error al cargar protecci\xF3n: ${t.error}`,"error"),d(`\u274C Error cargando archivo: ${t.error}`))}}),o.startBtn.addEventListener("click",_n),o.stopBtn.addEventListener("click",async()=>{Xt()}),o.watchBtn.addEventListener("click",()=>{if(i.running&&i.watchMode)Xt();else{Ln();try{N("mode_change",{botVariant:"auto-guard",metadata:{mode:"watch"}})}catch{}}});let e=null;o.logWindowBtn.addEventListener("click",()=>{e?e.toggle():(e=Ut("guard"),e.show())}),o.repositionBtn.addEventListener("click",()=>Qo()),o.saveBtn.addEventListener("click",async()=>{if(!be()){i.ui.updateStatus("\u274C No hay \xE1rea protegida para guardar","error");return}if(await Go('\xBFDeseas dividir el \xE1rea protegida en partes para m\xFAltiples usuarios?<br><br><label for="splitCountInput">N\xFAmero de partes (1 = sin dividir):</label><br><input type="number" id="splitCountInput" min="1" max="20" value="1" style="margin: 5px 0; padding: 5px; width: 100px; background: #374151; border: 1px solid #4b5563; border-radius: 4px; color: #d1d5db;">',"Opciones de Guardado",{save:"Guardar",cancel:"Cancelar"})==="save"){let n=document.querySelector("#splitCountInput"),r=parseInt(n==null?void 0:n.value)||1,s=await Po(null,r);s.success?i.ui.updateStatus(`\u2705 Protecci\xF3n guardada${r>1?` (dividida en ${r} partes)`:""}`,"success"):i.ui.updateStatus(`\u274C Error al guardar: ${s.error}`,"error")}})}async function Jo(o=!1){var e;try{i.ui.updateStatus(T("guard.checkingColors"),"info");let t=ue();if(t.length===0&&(d("\u26A0\uFE0F 0 colores detectados. Intentando abrir paleta (fallback)..."),i.ui.updateStatus(T("guard.clickingPaintButton"),"info"),st()&&(await oe(2500),t=ue())),t.length===0)return i.ui.updateStatus(T("guard.noColorsFound"),"error"),!1;i.availableColors=t,i.colorsChecked=!0;let n=await ke();return n.success&&(i.currentCharges=n.data.charges,i.maxCharges=n.data.maxCharges,i.ui.updateStats({charges:Math.floor(i.currentCharges)}),d(`\u{1F464} Usuario: ${((e=n.data.user)==null?void 0:e.name)||"An\xF3nimo"} - Cargas: ${i.currentCharges}`)),i.initialized=!0,i.ui.updateStatus(T("guard.colorsFound",{count:t.length}),"success"),i.ui.showAreaSection(),o||d(`\u2705 ${t.length} colores disponibles detectados`),i.ui.setInitialized(!0),!0}catch(t){return d("\u274C Error inicializando:",t),i.ui.updateStatus(T("guard.initError"),"error"),!1}}var We=window.fetch;async function An(){d("\u{1F3AF} Iniciando selecci\xF3n paso a paso del \xE1rea");let o=null,e=null,t="upperLeft",n=!1,r=()=>{window.fetch!==We&&(window.fetch=We,d("\u{1F504} Fetch original restaurado"))};(()=>{window.fetch=async(a,l)=>{if(!n&&typeof a=="string"&&a.includes("/s0/pixel/")&&l&&l.method==="POST")try{d(`\u{1F3AF} Interceptando request de pintado: ${a}`);let c=await We(a,l);if(c.ok&&l.body){let p;try{p=JSON.parse(l.body)}catch(u){return d("Error parseando body del request:",u),c}if(p.coords&&Array.isArray(p.coords)&&p.coords.length>=2){let u=p.coords[0],h=p.coords[1],g=a.match(/\/s0\/pixel\/(-?\d+)\/(-?\d+)/);if(g){let f=parseInt(g[1]),m=parseInt(g[2]),x=f*E.TILE_SIZE+u,w=m*E.TILE_SIZE+h;if(t==="upperLeft")o={x,y:w},i.ui.updateCoordinates({x1:x,y1:w}),i.ui.updateStatus(T("guard.upperLeftCaptured",{x,y:w}),"success"),d(`\u2705 Esquina superior izquierda capturada: (${x}, ${w})`),t="lowerRight",setTimeout(()=>{t==="lowerRight"&&i.ui.updateStatus(T("guard.selectLowerRight"),"info")},1500);else if(t==="lowerRight"){if(e={x,y:w},i.ui.updateCoordinates({x2:x,y2:w}),i.ui.updateStatus(T("guard.lowerRightCaptured",{x,y:w}),"success"),d(`\u2705 Esquina inferior derecha capturada: (${x}, ${w})`),n=!0,r(),o.x>=e.x||o.y>=e.y)return i.ui.updateStatus(T("guard.invalidArea"),"error"),c;setTimeout(async()=>{await kn(o,e)},1e3)}}}}return c}catch(c){return d("\u274C Error interceptando pixel:",c),r(),We(a,l)}return We(a,l)}})(),i.ui.updateStatus(T("guard.selectUpperLeft"),"info"),setTimeout(()=>{n||(r(),i.ui.updateStatus(T("guard.selectionTimeout"),"error"),d("\u23F0 Timeout en selecci\xF3n de \xE1rea"))},12e4)}async function kn(o,e){try{let t={x1:o.x,y1:o.y,x2:e.x,y2:e.y};i.ui.updateStatus(T("guard.capturingArea"),"info");let n=await Q(t,{allowVirtual:!0});i.protectionArea=t,i.originalPixels=n,i.changes.clear();let r=n.size>0&&Array.from(n.values()).every(s=>s.colorId===5&&s.r===255&&s.g===255&&s.b===255);i.ui.updateProgress(n.size,0,r),i.ui.updateStatus(T("guard.areaCaptured",{count:n.size}),"success"),i.ui.enableStartBtn(),d(`\u2705 \xC1rea capturada: ${n.size} p\xEDxeles protegidos`);try{N("area_captured",{botVariant:"auto-guard",metadata:{count:n.size,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}})}catch{}}catch(t){d("\u274C Error capturando \xE1rea:",t),i.ui.updateStatus(T("guard.captureError",{error:t.message}),"error")}}async function _n(){if(!i.protectionArea||!i.originalPixels.size){i.ui.updateStatus(T("guard.captureFirst"),"error");return}if(i.running=!0,i.watchMode=!1,i.totalRepaired=0,i.ui.setRunningState(!0),i.operationMode==="erase"){i.ui.updateStatus("\u{1F5D1}\uFE0F Protecci\xF3n de borrado iniciada","success"),d("\u{1F5D1}\uFE0F Iniciando protecci\xF3n de borrado del \xE1rea");try{N("mode_change",{botVariant:"auto-guard",metadata:{mode:"erase"}})}catch{}}else{i.ui.updateStatus(T("guard.protectionStarted"),"success"),d("\u{1F6E1}\uFE0F Iniciando protecci\xF3n del \xE1rea");try{N("mode_change",{botVariant:"auto-guard",metadata:{mode:"protect"}})}catch{}}i.checkInterval=jt(pe,E.CHECK_INTERVAL),et(),await pe()}async function Ln(){if(!i.protectionArea||!i.originalPixels.size){i.ui.updateStatus(T("guard.captureFirst"),"error");return}i.running=!0,i.watchMode=!0,i.totalRepaired=0,i.ui.setRunningState(!0),i.ui.updateWatchButton(!0),i.ui.updateStatus("\u{1F441}\uFE0F Modo Vig\xEDa iniciado - solo monitorizaci\xF3n","success"),d("\u{1F441}\uFE0F Iniciando modo Vig\xEDa del \xE1rea"),i.checkInterval=jt(pe,E.CHECK_INTERVAL),et(),await pe()}function Xt(){var e,t;let o=i.watchMode;i.running=!1,i.watchMode=!1,i.checkInterval&&(Yt(i.checkInterval),i.checkInterval=null),St(),kt();try{q().ENABLED&&((e=window.__wplaceMetrics)!=null&&e.guardPingInterval&&(Yt(window.__wplaceMetrics.guardPingInterval),window.__wplaceMetrics.guardPingInterval=null),(t=window.__wplaceMetrics)!=null&&t.guardSessionActive&&(wt({botVariant:"auto-guard"}),window.__wplaceMetrics.guardSessionActive=!1))}catch{}if(i.ui){i.ui.setRunningState(!1),i.ui.updateWatchButton(!1);let n=o?"\u23F9\uFE0F Vig\xEDa detenido":T("guard.protectionStopped");i.ui.updateStatus(n,"warning")}d(o?"\u23F9\uFE0F Vig\xEDa detenido":"\u23F9\uFE0F Protecci\xF3n detenida");try{N("mode_change",{botVariant:"auto-guard",metadata:{mode:"stopped"}})}catch{}}var Y={isRepositioning:!1,originalPixels:null,originalArea:null,overlayEnabled:!1};async function Qo(){if(!i.protectionArea||!i.originalPixels||i.originalPixels.size===0){i.ui.updateStatus("\u274C No hay \xE1rea protegida para reposicionar","error"),d("\u274C No hay \xE1rea capturada para reposicionar");return}d("\u{1F4CD} Iniciando reposicionamiento del \xE1rea protegida..."),Y.originalPixels=new Map(i.originalPixels),Y.originalArea={...i.protectionArea},Y.isRepositioning=!0;let o=document.createElement("div");o.id="repositionStatus",o.style.cssText=`
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%);
background: #1f2937;
color: #fff;
padding: 15px 20px;
border-radius: 8px;
border: 2px solid #8b5cf6;
z-index: 100003;
font-family: 'Segoe UI', Roboto, sans-serif;
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
`,o.innerHTML=`
<div style="text-align: center;">
<div style="font-weight: bold; margin-bottom: 8px;">\u{1F4CD} Reposicionamiento Activo</div>
<div style="font-size: 14px; color: #cbd5e0;">Pinta un p\xEDxel en la nueva esquina superior izquierda</div>
</div>
`,document.body.appendChild(o),await Mn(o)}async function Mn(o){return new Promise(e=>{let t=!1,n=window.fetch;window.fetch=async function(...r){var l,c,p;let s=await n.apply(this,r);if(!Y.isRepositioning||t)return s;let a=((l=r[0])==null?void 0:l.url)||r[0];if(a&&a.includes("/s0/pixel/")&&((c=r[1])==null?void 0:c.method)==="POST")try{d("\u{1F50D} Request interceptado:",a);let u=a.match(/\/s0\/pixel\/(-?\d+)\/(-?\d+)/);if(u){let h=parseInt(u[1]),g=parseInt(u[2]);d(`\u{1F50D} Tile extra\xEDdo de URL: (${h}, ${g})`);let f=(p=r[1])==null?void 0:p.body;if(d("\u{1F50D} Request body:",f),f){let m=JSON.parse(f);d("\u{1F50D} Body data:",m);let x=m.coords;if(x&&x.length>0){t=!0,d("\u{1F50D} Coords array structure:",x,"Length:",x.length);let w,b;if(x.length>=2&&typeof x[0]=="number"&&typeof x[1]=="number")w=x[0],b=x[1],d("\u{1F50D} Coordenadas como n\xFAmeros separados:",w,b);else if(Array.isArray(x[0]))w=x[0][0],b=x[0][1],d("\u{1F50D} Coordenadas como array anidado:",w,b);else if(typeof x[0]=="object"&&x[0].x!==void 0)w=x[0].x,b=x[0].y,d("\u{1F50D} Coordenadas como objeto:",w,b);else return d("\u274C Formato de coordenadas no reconocido:",x),s;(w<0||w>=1e3||b<0||b>=1e3)&&d(`\u26A0\uFE0F Coordenadas relativas fuera de rango: (${w}, ${b})`);let C=h*1e3+w,y=g*1e3+b;d(`\u{1F4CD} Nueva posici\xF3n capturada: (${C}, ${y})`),d(`\u{1F4D0} C\xE1lculo: Tile(${h}, ${g}) * 1000 + Relativa(${w}, ${b}) = Global(${C}, ${y})`),window.fetch=n,await Rn(C,y,o),e()}}}else d("\u274C No se pudo extraer tile de URL:",a)}catch(u){d("\u274C Error capturando nueva posici\xF3n:",u)}return s},setTimeout(()=>{t||(window.fetch=n,Y.isRepositioning=!1,o.remove(),d("\u23F0 Timeout en captura de nueva posici\xF3n"),e())},3e4)})}async function Rn(o,e,t){let n=Y.originalArea,r=o-n.x1,s=e-n.y1;d(`\u{1F4D0} Calculando offset para trasladar patr\xF3n: (${r}, ${s})`),d(`\u{1F4CB} Trasladando ${Y.originalPixels.size} p\xEDxeles con sus colores originales`);let a={x1:n.x1+r,y1:n.y1+s,x2:n.x2+r,y2:n.y2+s,tileX:Math.floor((n.x1+r)/E.TILE_SIZE),tileY:Math.floor((n.y1+s)/E.TILE_SIZE)},l=new Map;Y.originalPixels.forEach((c,p)=>{let[u,h]=p.split(",").map(Number),g=u+r,f=h+s,m=`${g},${f}`,x=Math.floor(g/E.TILE_SIZE),w=Math.floor(f/E.TILE_SIZE),b=(g%E.TILE_SIZE+E.TILE_SIZE)%E.TILE_SIZE,C=(f%E.TILE_SIZE+E.TILE_SIZE)%E.TILE_SIZE,y=x*E.TILE_SIZE+b,P=w*E.TILE_SIZE+C;(y!==g||P!==f)&&d(`\u26A0\uFE0F Error en c\xE1lculo de coordenadas: Global(${g},${f}) vs Esperado(${y},${P})`);let v={r:c.r,g:c.g,b:c.b,colorId:c.colorId,globalX:g,globalY:f,localX:b,localY:C,tileX:x,tileY:w};l.set(m,v),l.size<=5&&(d(`\u{1F3A8} P\xEDxel trasladado #${l.size}:`),d(` Original: (${u},${h}) color(${c.r},${c.g},${c.b}) ID:${c.colorId}`),d(` Nuevo: Global(${g},${f}) Tile(${x},${w}) Local(${b},${C})`),d(` Verificaci\xF3n: ${x}*1000 + ${b} = ${x*1e3+b} (debe ser ${g})`))}),d(`\u2705 Patr\xF3n de colores trasladado: ${l.size} p\xEDxeles con coordenadas actualizadas`),await $n(a,l,t)}async function $n(o,e,t){Y.overlayEnabled=!0,he.showProtectionArea(o),d("\u{1F3AF} Overlay visual activado para vista previa de reposicionamiento"),t.innerHTML=`
<div style="text-align: center;">
<div style="font-weight: bold; margin-bottom: 8px;">\u{1F4CD} Vista Previa de Reposicionamiento</div>
<div style="font-size: 14px; color: #cbd5e0; margin-bottom: 8px;">Nueva \xE1rea: (${o.x1}, ${o.y1}) \u2192 (${o.x2}, ${o.y2})</div>
<div style="font-size: 14px; color: #cbd5e0; margin-bottom: 15px;">\xBFConfirmar nueva posici\xF3n?</div>
<div style="display: flex; gap: 10px; justify-content: center;">
<button id="confirmReposition" style="padding: 8px 16px; background: #10b981; color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: 600;">
\u2705 Aceptar
</button>
<button id="retryReposition" style="padding: 8px 16px; background: #f59e0b; color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: 600;">
\u{1F504} Repetir
</button>
<button id="cancelReposition" style="padding: 8px 16px; background: #ef4444; color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: 600;">
\u274C Cancelar
</button>
</div>
</div>
`,t.querySelector("#confirmReposition").addEventListener("click",()=>{zn(o,e,t)}),t.querySelector("#retryReposition").addEventListener("click",()=>{Bn(t)}),t.querySelector("#cancelReposition").addEventListener("click",()=>{Nn(t)})}async function zn(o,e,t){i.protectionArea=o,i.originalPixels=e,i.changes.clear(),i.totalRepaired=0,i.ui.updateCoordinates({x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2}),i.ui.updateProgress(0,e.size),he.hideProtectionArea(),d("\u{1F3AF} Overlay visual desactivado tras confirmar reposicionamiento"),Gt(t),i.ui.updateStatus("\u2705 \xC1rea reposicionada correctamente","success"),d("\u2705 Reposicionamiento confirmado - patr\xF3n de colores trasladado a nueva ubicaci\xF3n");try{N("reposition_confirm",{botVariant:"auto-guard",metadata:{size:e.size,x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2}})}catch{}d(`\u{1F4CB} Protegiendo ${e.size} p\xEDxeles con los colores originales en coordenadas (${o.x1},${o.y1}) \u2192 (${o.x2},${o.y2})`),i.running&&(d("\u{1F50D} Ejecutando verificaci\xF3n inmediata tras reposicionamiento..."),setTimeout(async()=>{await pe()},2e3))}function Bn(o){he.hideProtectionArea(),d("\u{1F3AF} Overlay visual desactivado para reintentar reposicionamiento"),Gt(o),Qo();try{N("reposition_retry",{botVariant:"auto-guard"})}catch{}}function Nn(o){he.hideProtectionArea(),d("\u{1F3AF} Overlay visual desactivado tras cancelar reposicionamiento"),Gt(o),i.ui.updateStatus("\u274C Reposicionamiento cancelado","warning"),d("\u274C Reposicionamiento cancelado");try{N("reposition_cancel",{botVariant:"auto-guard"})}catch{}}function Gt(o){Y.isRepositioning=!1,Y.originalPixels=null,Y.originalArea=null,Y.overlayEnabled=!1,o.remove()}(async function(){var o;try{console.log("[WPA-Guard] \u{1F916} Iniciando auto-click del bot\xF3n Paint..."),await Ho(3,!0)}catch(e){console.log("[WPA-Guard] \u26A0\uFE0F Error en auto-click del bot\xF3n Paint:",e)}(o=window.__wplaceBot)!=null&&o.guardRunning?alert("Auto-Guard ya est\xE1 corriendo."):Ko().catch(e=>{console.error("[WPA-GUARD] Error en Auto-Guard:",e),window.__wplaceBot&&(window.__wplaceBot.guardRunning=!1),alert("Auto-Guard: error inesperado. Revisa consola.")})})();})();