js.foresight-devtools 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e,t)=>{for(var i=t>1?void 0:t?ze(s,e):s,a=o.length-1,r;a>=0;a--)(r=o[a])&&(i=(t?r(s,e,i):r(i))||i);return t&&i&&je(s,e,i),i};import{LitElement as Vn,css as An,html as Ae}from"lit";import{customElement as jn,state as zn}from"lit/decorators.js";import{LitElement as un,css as bn,html as vn}from"lit";import{customElement as fn,state as Fe}from"lit/decorators.js";import{classMap as ne}from"lit/directives/class-map.js";import{css as Et,html as R,LitElement as Ct}from"lit";import{customElement as St,state as M}from"lit/decorators.js";import{map as Ce}from"lit/directives/map.js";import{ForesightManager as L}from"js.foresight";import{html as c}from"lit";var oe=c`
1
+ var ze=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var n=(o,r,e,t)=>{for(var i=t>1?void 0:t?He(r,e):r,a=o.length-1,s;a>=0;a--)(s=o[a])&&(i=(t?s(r,e,i):s(i))||i);return t&&i&&ze(r,e,i),i};import{LitElement as zn,css as Hn,html as Fe}from"lit";import{customElement as Bn,state as Gn}from"lit/decorators.js";import{LitElement as yn,css as wn,html as xn}from"lit";import{customElement as kn,state as Q}from"lit/decorators.js";import{classMap as re}from"lit/directives/class-map.js";import{ForesightManager as Ae}from"js.foresight";import{css as St,html as B,LitElement as Tt}from"lit";import{customElement as Dt,state as L}from"lit/decorators.js";import{map as Me}from"lit/directives/map.js";import{ForesightManager as $}from"js.foresight";import{html as c}from"lit";var le=c`
2
2
  <svg
3
3
  xmlns="http://www.w3.org/2000/svg"
4
4
  width="16"
@@ -15,7 +15,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
15
15
  <line x1="7" y1="21" x2="17" y2="21"></line>
16
16
  <line x1="12" y1="17" x2="12" y2="21"></line>
17
17
  </svg>
18
- `,ae=c`
18
+ `,ce=c`
19
19
  <svg
20
20
  xmlns="http://www.w3.org/2000/svg"
21
21
  width="16"
@@ -30,7 +30,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
30
30
  <polyline points="4 17 10 11 4 5"></polyline>
31
31
  <line x1="12" y1="19" x2="20" y2="19"></line>
32
32
  </svg>
33
- `,se=c`
33
+ `,de=c`
34
34
  <svg
35
35
  xmlns="http://www.w3.org/2000/svg"
36
36
  width="16"
@@ -46,7 +46,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
46
46
  <path d="M13.73 21a2 2 0 0 1-3.46 0"></path>
47
47
  <line x1="1" y1="1" x2="23" y2="23"></line>
48
48
  </svg>
49
- `,re=c`
49
+ `,ge=c`
50
50
  <svg
51
51
  xmlns="http://www.w3.org/2000/svg"
52
52
  width="16"
@@ -64,7 +64,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
64
64
  <circle cx="6" cy="18" r="2" />
65
65
  <circle cx="18" cy="18" r="2" />
66
66
  </svg>
67
- `,le=c`
67
+ `,pe=c`
68
68
  <svg
69
69
  xmlns="http://www.w3.org/2000/svg"
70
70
  width="16"
@@ -79,7 +79,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
79
79
  <path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" />
80
80
  <circle cx="12" cy="12" r="3" />
81
81
  </svg>
82
- `,ce=c`
82
+ `,he=c`
83
83
  <svg
84
84
  xmlns="http://www.w3.org/2000/svg"
85
85
  width="16"
@@ -97,7 +97,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
97
97
  <line x1="16" y1="17" x2="8" y2="17" />
98
98
  <line x1="10" y1="9" x2="8" y2="9" />
99
99
  </svg>
100
- `,de=c`
100
+ `,me=c`
101
101
  <svg
102
102
  xmlns="http://www.w3.org/2000/svg"
103
103
  width="16"
@@ -111,7 +111,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
111
111
  >
112
112
  <path d="M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" />
113
113
  </svg>
114
- `,u=c`
114
+ `,h=c`
115
115
  <svg
116
116
  xmlns="http://www.w3.org/2000/svg"
117
117
  width="16"
@@ -125,7 +125,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
125
125
  >
126
126
  <polygon points="22,3 2,3 10,12.46 10,19 14,21 14,12.46" />
127
127
  </svg>
128
- `,pe=c`
128
+ `,ue=c`
129
129
  <svg
130
130
  xmlns="http://www.w3.org/2000/svg"
131
131
  width="16"
@@ -140,7 +140,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
140
140
  <circle cx="12" cy="12" r="10" />
141
141
  <line x1="4.93" y1="4.93" x2="19.07" y2="19.07" />
142
142
  </svg>
143
- `,ge=c`
143
+ `,be=c`
144
144
  <svg
145
145
  xmlns="http://www.w3.org/2000/svg"
146
146
  width="24"
@@ -155,7 +155,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
155
155
  <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
156
156
  <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
157
157
  </svg>
158
- `,he=c`
158
+ `,ve=c`
159
159
  <svg
160
160
  xmlns="http://www.w3.org/2000/svg"
161
161
  width="24"
@@ -169,7 +169,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
169
169
  >
170
170
  <polyline points="20 6 9 17 4 12"></polyline>
171
171
  </svg>
172
- `,me=c`
172
+ `,fe=c`
173
173
  <svg
174
174
  xmlns="http://www.w3.org/2000/svg"
175
175
  width="16"
@@ -187,7 +187,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
187
187
  <line x1="12" y1="9" x2="12" y2="13"></line>
188
188
  <line x1="12" y1="17" x2="12.01" y2="17"></line>
189
189
  </svg>
190
- `,ue=c`
190
+ `,ye=c`
191
191
  <svg
192
192
  xmlns="http://www.w3.org/2000/svg"
193
193
  width="16"
@@ -208,7 +208,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
208
208
  <path d="M10 8l2-2 2 2"></path>
209
209
  <path d="M14 16l-2 2-2-2"></path>
210
210
  </svg>
211
- `,be=c`
211
+ `,we=c`
212
212
  <svg
213
213
  xmlns="http://www.w3.org/2000/svg"
214
214
  width="12"
@@ -225,11 +225,58 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
225
225
  <line x1="10" y1="11" x2="10" y2="17"></line>
226
226
  <line x1="14" y1="11" x2="14" y2="17"></line>
227
227
  </svg>
228
- `;import{LitElement as Re,html as He,css as Be}from"lit";import{customElement as Ge,property as Ke}from"lit/decorators.js";var P=class extends Re{constructor(){super(...arguments);this.title=""}render(){return He`
228
+ `,Yn=c`
229
+ <svg
230
+ xmlns="http://www.w3.org/2000/svg"
231
+ width="16"
232
+ height="16"
233
+ viewBox="0 0 24 24"
234
+ fill="none"
235
+ stroke="currentColor"
236
+ stroke-width="2"
237
+ stroke-linecap="round"
238
+ stroke-linejoin="round"
239
+ >
240
+ <path d="M18 8a6 6 0 0 0-12 0c0 2 3 4 6 6 3-2 6-4 6-6z"/>
241
+ <circle cx="12" cy="8" r="3"/>
242
+ </svg>
243
+ `,Jn=c`
244
+ <svg
245
+ xmlns="http://www.w3.org/2000/svg"
246
+ width="16"
247
+ height="16"
248
+ viewBox="0 0 24 24"
249
+ fill="none"
250
+ stroke="currentColor"
251
+ stroke-width="2"
252
+ stroke-linecap="round"
253
+ stroke-linejoin="round"
254
+ >
255
+ <rect x="2" y="3" width="20" height="14" rx="2" ry="2"/>
256
+ <line x1="8" y1="21" x2="16" y2="21"/>
257
+ <line x1="12" y1="17" x2="12" y2="21"/>
258
+ <circle cx="12" cy="10" r="2"/>
259
+ </svg>
260
+ `,Xn=c`
261
+ <svg
262
+ xmlns="http://www.w3.org/2000/svg"
263
+ width="16"
264
+ height="16"
265
+ viewBox="0 0 24 24"
266
+ fill="none"
267
+ stroke="currentColor"
268
+ stroke-width="2"
269
+ stroke-linecap="round"
270
+ stroke-linejoin="round"
271
+ >
272
+ <circle cx="12" cy="12" r="10"/>
273
+ <line x1="4.93" y1="4.93" x2="19.07" y2="19.07"/>
274
+ </svg>
275
+ `;import{LitElement as Be,html as Ge,css as We}from"lit";import{customElement as Ke,property as qe}from"lit/decorators.js";var U=class extends Be{constructor(){super(...arguments);this.title=""}render(){return Ge`
229
276
  <span class="chip" title="${this.title}">
230
277
  <slot></slot>
231
278
  </span>
232
- `}};P.styles=[Be`
279
+ `}};U.styles=[We`
233
280
  :host {
234
281
  display: inline-block;
235
282
  }
@@ -249,11 +296,11 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
249
296
  line-height: 1.2;
250
297
  transition: all 0.2s ease;
251
298
  }
252
- `],n([Ke({type:String})],P.prototype,"title",2),P=n([Ge("chip-element")],P);import{LitElement as We,html as Q,css as qe}from"lit";import{customElement as Ye,property as ve}from"lit/decorators.js";var T=class extends We{constructor(){super(...arguments);this.noContentMessage="No content available.";this.hasContent=!0}render(){return Q`
299
+ `],n([qe({type:String})],U.prototype,"title",2),U=n([Ke("chip-element")],U);import{LitElement as Ye,html as te,css as Je}from"lit";import{customElement as Xe,property as xe}from"lit/decorators.js";var D=class extends Ye{constructor(){super(...arguments);this.noContentMessage="No content available.";this.hasContent=!0}render(){return te`
253
300
  <div class="content-container">
254
- ${this.hasContent?Q`<slot></slot>`:Q`<div class="no-content-message">${this.noContentMessage}</div>`}
301
+ ${this.hasContent?te`<slot></slot>`:te`<div class="no-content-message">${this.noContentMessage}</div>`}
255
302
  </div>
256
- `}};T.styles=[qe`
303
+ `}};D.styles=[Je`
257
304
  :host {
258
305
  overflow: hidden;
259
306
  }
@@ -293,7 +340,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
293
340
  font-style: italic;
294
341
  font-family: "Courier New", monospace;
295
342
  }
296
- `],n([ve({type:String,attribute:"no-content-message"})],T.prototype,"noContentMessage",2),n([ve({type:Boolean})],T.prototype,"hasContent",2),T=n([Ye("tab-content")],T);import{LitElement as Je,html as Xe,css as Ze}from"lit";import{customElement as Qe}from"lit/decorators.js";var j=class extends Je{render(){return Xe`
343
+ `],n([xe({type:String,attribute:"no-content-message"})],D.prototype,"noContentMessage",2),n([xe({type:Boolean})],D.prototype,"hasContent",2),D=n([Xe("tab-content")],D);import{LitElement as Ze,html as Qe,css as et}from"lit";import{customElement as tt}from"lit/decorators.js";var z=class extends Ze{render(){return Qe`
297
344
  <div class="tab-bar-elements">
298
345
  <div class="tab-bar-info">
299
346
  <div class="stats-chips">
@@ -304,7 +351,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
304
351
  <slot name="actions"></slot>
305
352
  </div>
306
353
  </div>
307
- `}};j.styles=[Ze`
354
+ `}};z.styles=[et`
308
355
  :host {
309
356
  }
310
357
  .tab-bar-info {
@@ -348,7 +395,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
348
395
  z-index: 5;
349
396
  min-height: 36px;
350
397
  }
351
- `],j=n([Qe("tab-header")],j);import{html as ot}from"lit";import{customElement as at,property as ye}from"lit/decorators.js";import{LitElement as et,html as fe,css as tt}from"lit";import{property as nt,state as it}from"lit/decorators.js";var d=class d extends et{constructor(){super(...arguments);this.isDropdownOpen=!1;this.dropdownOptions=[];this._toggleDropdown=e=>{e.stopPropagation(),this.isDropdownOpen?this._closeDropdown():(d.currentlyOpen&&d.currentlyOpen!==this&&d.currentlyOpen._closeDropdown(),this.isDropdownOpen=!0,d.currentlyOpen=this,requestAnimationFrame(()=>{this._positionDropdown()}))};this._handleOutsideClick=e=>{this.isDropdownOpen&&(e.composedPath().includes(this)||this._closeDropdown())}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick),d.currentlyOpen===this&&(d.currentlyOpen=null)}_closeDropdown(){this.isDropdownOpen=!1,d.currentlyOpen===this&&(d.currentlyOpen=null)}_positionDropdown(){let e=this.shadowRoot?.querySelector(".trigger-button"),t=this.shadowRoot?.querySelector(".dropdown-menu");if(e&&t){let i=e.getBoundingClientRect(),a=t.offsetHeight||200,r=i.bottom+5,p=window.innerWidth-i.right;window.innerHeight-i.bottom<a&&i.top>a?t.style.top=`${i.top-a-5}px`:t.style.top=`${r}px`,t.style.right=`${p}px`}}render(){let e=`trigger-button ${this.isDropdownOpen?"active":""}`,t=`dropdown-menu ${this.isDropdownOpen?"active":""}`;return fe`
398
+ `],z=n([tt("tab-header")],z);import{html as rt}from"lit";import{customElement as st,property as Ee}from"lit/decorators.js";import{LitElement as nt,html as ke,css as it}from"lit";import{property as ot,state as at}from"lit/decorators.js";var g=class g extends nt{constructor(){super(...arguments);this.isDropdownOpen=!1;this.dropdownOptions=[];this._toggleDropdown=e=>{e.stopPropagation(),this.isDropdownOpen?this._closeDropdown():(g.currentlyOpen&&g.currentlyOpen!==this&&g.currentlyOpen._closeDropdown(),this.isDropdownOpen=!0,g.currentlyOpen=this,requestAnimationFrame(()=>{this._positionDropdown()}))};this._handleOutsideClick=e=>{this.isDropdownOpen&&(e.composedPath().includes(this)||this._closeDropdown())}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick),g.currentlyOpen===this&&(g.currentlyOpen=null)}_closeDropdown(){this.isDropdownOpen=!1,g.currentlyOpen===this&&(g.currentlyOpen=null)}_positionDropdown(){let e=this.shadowRoot?.querySelector(".trigger-button"),t=this.shadowRoot?.querySelector(".dropdown-menu");if(e&&t){let i=e.getBoundingClientRect(),a=t.offsetHeight||200,s=i.bottom+5,d=window.innerWidth-i.right;window.innerHeight-i.bottom<a&&i.top>a?t.style.top=`${i.top-a-5}px`:t.style.top=`${s}px`,t.style.right=`${d}px`}}render(){let e=`trigger-button ${this.isDropdownOpen?"active":""}`,t=`dropdown-menu ${this.isDropdownOpen?"active":""}`;return ke`
352
399
  <div class="dropdown-container">
353
400
  <button
354
401
  class="${e}"
@@ -374,7 +421,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
374
421
  </button>
375
422
 
376
423
  <div class="${t}" id="dropdown-menu" role="menu">
377
- ${this.dropdownOptions.map(i=>fe`
424
+ ${this.dropdownOptions.map(i=>ke`
378
425
  <button
379
426
  value="${i.value}"
380
427
  title="${i.title}"
@@ -387,7 +434,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
387
434
  `)}
388
435
  </div>
389
436
  </div>
390
- `}};d.currentlyOpen=null,d.styles=[tt`
437
+ `}};g.currentlyOpen=null,g.styles=[it`
391
438
  :host {
392
439
  display: inline-block;
393
440
  }
@@ -502,15 +549,15 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
502
549
  color: #b0c4de;
503
550
  font-weight: bold;
504
551
  }
505
- `],n([it()],d.prototype,"isDropdownOpen",2),n([nt({type:Array})],d.prototype,"dropdownOptions",2);var D=d;var U=class extends D{constructor(){super(...arguments);this.selectedOptionValue=""}connectedCallback(){super.connectedCallback(),this.dropdownOptions.length>0&&!this.selectedOptionValue&&(this.selectedOptionValue=this.dropdownOptions[0].value)}willUpdate(e){e.has("dropdownOptions")&&this.dropdownOptions.length>0&&!this.selectedOptionValue&&(this.selectedOptionValue=this.dropdownOptions[0].value)}_handleOptionClick(e){e.value!==this.selectedOptionValue&&(this.selectedOptionValue=e.value,this.onSelectionChange?.(e.value)),this._closeDropdown()}_getTriggerIcon(){let e=this._getSelectedOption();return e?e.icon:ot``}_isOptionSelected(e){return e.value===this.selectedOptionValue}_getTriggerTitle(){let e=this._getSelectedOption();return e?e.title:"Change selection"}_getTriggerLabel(){let e=this._getSelectedOption();return e?`Current selection: ${e.label}`:"No selection"}_getSelectedOption(){return this.dropdownOptions.find(e=>e.value===this.selectedOptionValue)}};n([ye({type:String})],U.prototype,"selectedOptionValue",2),n([ye({type:Function})],U.prototype,"onSelectionChange",2),U=n([at("single-select-dropdown")],U);import{LitElement as ft,html as yt,css as xt}from"lit";import{customElement as wt,property as q}from"lit/decorators.js";import{LitElement as dt,html as ke,css as pt}from"lit";import{customElement as gt,property as z}from"lit/decorators.js";import{LitElement as st,html as rt,css as lt}from"lit";import{customElement as ct,property as xe,state as we}from"lit/decorators.js";var v=class extends st{constructor(){super(...arguments);this.title="Copy to clipboard";this.isCopied=!1;this.copyTimeout=null}async handleClick(e){if(!this.isCopied){if(this.onCopy)try{await this.onCopy(e)}catch(t){console.error("Error in onCopy function:",t)}this.isCopied=!0,this.copyTimeout&&clearTimeout(this.copyTimeout),this.copyTimeout=setTimeout(()=>{this.isCopied=!1,this.copyTimeout=null},2e3)}}disconnectedCallback(){super.disconnectedCallback(),this.copyTimeout&&(clearTimeout(this.copyTimeout),this.copyTimeout=null)}render(){return rt`
552
+ `],n([at()],g.prototype,"isDropdownOpen",2),n([ot({type:Array})],g.prototype,"dropdownOptions",2);var M=g;var N=class extends M{constructor(){super(...arguments);this.selectedOptionValue=""}connectedCallback(){super.connectedCallback(),this.dropdownOptions.length>0&&!this.selectedOptionValue&&(this.selectedOptionValue=this.dropdownOptions[0].value)}willUpdate(e){e.has("dropdownOptions")&&this.dropdownOptions.length>0&&!this.selectedOptionValue&&(this.selectedOptionValue=this.dropdownOptions[0].value)}_handleOptionClick(e){e.value!==this.selectedOptionValue&&(this.selectedOptionValue=e.value,this.onSelectionChange?.(e.value)),this._closeDropdown()}_getTriggerIcon(){let e=this._getSelectedOption();return e?e.icon:rt``}_isOptionSelected(e){return e.value===this.selectedOptionValue}_getTriggerTitle(){let e=this._getSelectedOption();return e?e.title:"Change selection"}_getTriggerLabel(){let e=this._getSelectedOption();return e?`Current selection: ${e.label}`:"No selection"}_getSelectedOption(){return this.dropdownOptions.find(e=>e.value===this.selectedOptionValue)}};n([Ee({type:String})],N.prototype,"selectedOptionValue",2),n([Ee({type:Function})],N.prototype,"onSelectionChange",2),N=n([st("single-select-dropdown")],N);import{LitElement as wt,html as xt,css as kt}from"lit";import{customElement as Et,property as J,state as Ct}from"lit/decorators.js";import{LitElement as pt,html as Te,css as ht}from"lit";import{customElement as mt,property as H}from"lit/decorators.js";import{LitElement as lt,html as ct,css as dt}from"lit";import{customElement as gt,property as Ce,state as Se}from"lit/decorators.js";var y=class extends lt{constructor(){super(...arguments);this.title="Copy to clipboard";this.isCopied=!1;this.copyTimeout=null}async handleClick(e){if(!this.isCopied){if(this.onCopy)try{await this.onCopy(e)}catch(t){console.error("Error in onCopy function:",t)}this.isCopied=!0,this.copyTimeout&&clearTimeout(this.copyTimeout),this.copyTimeout=setTimeout(()=>{this.isCopied=!1,this.copyTimeout=null},2e3)}}disconnectedCallback(){super.disconnectedCallback(),this.copyTimeout&&(clearTimeout(this.copyTimeout),this.copyTimeout=null)}render(){return ct`
506
553
  <button
507
554
  class="copy-button ${this.isCopied?"copied":""}"
508
555
  title="${this.title}"
509
556
  @click=${this.handleClick}
510
557
  >
511
- ${this.isCopied?he:ge}
558
+ ${this.isCopied?ve:be}
512
559
  </button>
513
- `}};v.styles=lt`
560
+ `}};y.styles=dt`
514
561
  .copy-button {
515
562
  background: transparent;
516
563
  border: 0px;
@@ -549,7 +596,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
549
596
  .copy-button.copied svg {
550
597
  stroke: #4caf50;
551
598
  }
552
- `,n([xe({type:String})],v.prototype,"title",2),n([xe({type:Function})],v.prototype,"onCopy",2),n([we()],v.prototype,"isCopied",2),n([we()],v.prototype,"copyTimeout",2),v=n([ct("copy-icon")],v);var b=class extends dt{constructor(){super(...arguments);this.borderColor="#555";this.showCopyButton=!1;this.itemId="";this.isExpanded=!1}toggleExpand(){this.onToggle&&this.onToggle(this.itemId)}async handleCopy(e){e.stopPropagation();let t=this.shadowRoot?.querySelector('slot[name="details"]');if(t){let a=t.assignedNodes().map(r=>r.textContent).join("");try{await navigator.clipboard.writeText(a)}catch(r){console.error("Failed to copy text: ",r)}}}render(){return this.style.setProperty("--border-color",this.borderColor),ke`
599
+ `,n([Ce({type:String})],y.prototype,"title",2),n([Ce({type:Function})],y.prototype,"onCopy",2),n([Se()],y.prototype,"isCopied",2),n([Se()],y.prototype,"copyTimeout",2),y=n([gt("copy-icon")],y);var b=class extends pt{constructor(){super(...arguments);this.borderColor="#555";this.showCopyButton=!1;this.itemId="";this.isExpanded=!1}toggleExpand(){this.onToggle&&this.onToggle(this.itemId)}async handleCopy(e){e.stopPropagation();let t=this.shadowRoot?.querySelector('slot[name="details"]');if(t){let a=t.assignedNodes().map(s=>s.textContent).join("");try{await navigator.clipboard.writeText(a)}catch(s){console.error("Failed to copy text: ",s)}}}render(){return this.style.setProperty("--border-color",this.borderColor),Te`
553
600
  <div class="item-entry ${this.isExpanded?"expanded":""}">
554
601
  <div class="item-header ${this.isExpanded?"expanded":""}" @click="${this.toggleExpand}">
555
602
  <div class="item-content">
@@ -561,7 +608,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
561
608
  </svg>
562
609
  </span>
563
610
  </div>
564
- ${this.isExpanded?ke`
611
+ ${this.isExpanded?Te`
565
612
  <div class="item-details">
566
613
  <copy-icon
567
614
  positioned
@@ -574,7 +621,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
574
621
  </div>
575
622
  `:""}
576
623
  </div>
577
- `}};b.styles=[pt`
624
+ `}};b.styles=[ht`
578
625
  :host {
579
626
  display: block;
580
627
  }
@@ -671,7 +718,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
671
718
  display: block;
672
719
  overflow-x: auto;
673
720
  }
674
- `],n([z()],b.prototype,"borderColor",2),n([z()],b.prototype,"showCopyButton",2),n([z()],b.prototype,"itemId",2),n([z()],b.prototype,"isExpanded",2),n([z()],b.prototype,"onToggle",2),b=n([gt("expandable-item")],b);import{ForesightManager as ht}from"js.foresight";import{LitElement as mt,css as ut,html as W}from"lit";import{customElement as bt,property as vt,state as Ee}from"lit/decorators.js";var k=class extends mt{constructor(){super(...arguments);this.remainingTime=0;this.isCountdownActive=!1;this.intervalId=null;this.startTime=0;this.handleTimerClick=e=>{e.stopPropagation(),ht.instance.reactivate(this.elementData.element)}}connectedCallback(){super.connectedCallback(),this.checkAndStartCountdown()}disconnectedCallback(){super.disconnectedCallback(),this.clearCountdown()}updated(e){super.updated(e),e.has("elementData")&&this.checkAndStartCountdown()}checkAndStartCountdown(){let e=this.elementData?.callbackInfo;if(!e){this.clearCountdown();return}let t=e.lastCallbackCompletedAt||e.lastCallbackInvokedAt;!e.isCallbackActive&&t&&e.reactivateAfter>0?this.startCountdown():this.clearCountdown()}startCountdown(){this.clearCountdown();let e=this.elementData?.callbackInfo;if(!e)return;if(this.isCountdownActive=!0,e.reactivateAfter===1/0){this.remainingTime=1/0;return}let t=e.reactivateAfter,i=e.lastCallbackCompletedAt||e.lastCallbackInvokedAt;if(!i){this.clearCountdown();return}this.startTime=i;let a=()=>{let r=Date.now()-this.startTime,p=Math.max(0,t-r);this.remainingTime=p,this.requestUpdate(),(p<=0||this.elementData.callbackInfo.isCallbackActive)&&this.clearCountdown()};a(),this.remainingTime>0&&(this.intervalId=window.setInterval(a,100))}clearCountdown(){this.intervalId!==null&&(clearInterval(this.intervalId),this.intervalId=null),this.isCountdownActive=!1,this.remainingTime=0}formatTime(e){if(e===1/0)return"\u221E";let t=Math.ceil(e/1e3);if(t<60)return`${t}s`;let i=Math.floor(t/60),a=t%60;if(i<60)return a>0?`${i}m ${a}s`:`${i}m`;let r=Math.floor(i/60),p=i%60;return p>0?`${r}h ${p}m`:`${r}h`}render(){return this.isCountdownActive?this.remainingTime===1/0?W`
721
+ `],n([H()],b.prototype,"borderColor",2),n([H()],b.prototype,"showCopyButton",2),n([H()],b.prototype,"itemId",2),n([H()],b.prototype,"isExpanded",2),n([H()],b.prototype,"onToggle",2),b=n([mt("expandable-item")],b);import{ForesightManager as ut}from"js.foresight";import{LitElement as bt,css as vt,html as Y}from"lit";import{customElement as ft,property as yt,state as De}from"lit/decorators.js";var E=class extends bt{constructor(){super(...arguments);this.remainingTime=0;this.isCountdownActive=!1;this.intervalId=null;this.startTime=0;this.handleTimerClick=e=>{e.stopPropagation(),ut.instance.reactivate(this.elementData.element)}}connectedCallback(){super.connectedCallback(),this.checkAndStartCountdown()}disconnectedCallback(){super.disconnectedCallback(),this.clearCountdown()}updated(e){super.updated(e),e.has("elementData")&&this.checkAndStartCountdown()}checkAndStartCountdown(){let e=this.elementData?.callbackInfo;if(!e){this.clearCountdown();return}let t=e.lastCallbackCompletedAt||e.lastCallbackInvokedAt;!e.isCallbackActive&&t&&e.reactivateAfter>0?this.startCountdown():this.clearCountdown()}startCountdown(){this.clearCountdown();let e=this.elementData?.callbackInfo;if(!e)return;if(this.isCountdownActive=!0,e.reactivateAfter===1/0){this.remainingTime=1/0;return}let t=e.reactivateAfter,i=e.lastCallbackCompletedAt||e.lastCallbackInvokedAt;if(!i){this.clearCountdown();return}this.startTime=i;let a=()=>{let s=Date.now()-this.startTime,d=Math.max(0,t-s);this.remainingTime=d,this.requestUpdate(),(d<=0||this.elementData.callbackInfo.isCallbackActive)&&this.clearCountdown()};a(),this.remainingTime>0&&(this.intervalId=window.setInterval(a,100))}clearCountdown(){this.intervalId!==null&&(clearInterval(this.intervalId),this.intervalId=null),this.isCountdownActive=!1,this.remainingTime=0}formatTime(e){if(e===1/0)return"\u221E";let t=Math.ceil(e/1e3);if(t<60)return`${t}s`;let i=Math.floor(t/60),a=t%60;if(i<60)return a>0?`${i}m ${a}s`:`${i}m`;let s=Math.floor(i/60),d=i%60;return d>0?`${s}h ${d}m`:`${s}h`}render(){return this.isCountdownActive?this.remainingTime===1/0?Y`
675
722
  <button
676
723
  class="reactivate-button"
677
724
  @click="${this.handleTimerClick}"
@@ -679,7 +726,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
679
726
  >
680
727
  <span class="countdown-time infinity">∞</span>
681
728
  </button>
682
- `:this.remainingTime<=0?W``:W`
729
+ `:this.remainingTime<=0?Y``:Y`
683
730
  <button
684
731
  class="reactivate-button"
685
732
  @click="${this.handleTimerClick}"
@@ -687,7 +734,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
687
734
  >
688
735
  <span class="countdown-time clickable">${this.formatTime(this.remainingTime)}</span>
689
736
  </button>
690
- `:W``}};k.styles=[ut`
737
+ `:Y``}};E.styles=[vt`
691
738
  :host {
692
739
  display: inline-block;
693
740
  }
@@ -717,7 +764,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
717
764
  .countdown-time.clickable {
718
765
  cursor: pointer;
719
766
  }
720
- `],n([vt({hasChanged:()=>!0})],k.prototype,"elementData",2),n([Ee()],k.prototype,"remainingTime",2),n([Ee()],k.prototype,"isCountdownActive",2),k=n([bt("reactivate-countdown")],k);import{ForesightManager as kt}from"js.foresight";var f=class extends ft{constructor(){super(...arguments);this.isActive=!1;this.isExpanded=!1;this.handleUnregister=e=>{e.stopPropagation(),kt.instance.unregister(this.elementData.element,"devtools")}}getBorderColor(){return this.isActive?"#ffeb3b":this.elementData.callbackInfo.isCallbackActive?this.elementData.isIntersectingWithViewport?"#4caf50":"#666":"#999"}getStatusIndicatorClass(){return this.isActive?"prefetching":this.elementData.callbackInfo.isCallbackActive?this.elementData.isIntersectingWithViewport?"visible":"hidden":"inactive"}getStatusText(){return this.isActive?"callback active":this.elementData.callbackInfo.isCallbackActive?this.elementData.isIntersectingWithViewport?"in viewport":"not in viewport":"callback inactive"}formatElementDetails(){let e=this.elementData,t={status:this.getStatusText(),tagName:e.element.tagName.toLowerCase(),isIntersecting:e.isIntersectingWithViewport,registerCount:e.registerCount,hitSlop:{top:e.elementBounds.hitSlop.top,right:e.elementBounds.hitSlop.right,bottom:e.elementBounds.hitSlop.bottom,left:e.elementBounds.hitSlop.left},callbackInfo:e.callbackInfo,meta:this.elementData.meta};return JSON.stringify(t,null,2)}render(){let e=!this.elementData.isIntersectingWithViewport;return yt`
767
+ `],n([yt({hasChanged:()=>!0})],E.prototype,"elementData",2),n([De()],E.prototype,"remainingTime",2),n([De()],E.prototype,"isCountdownActive",2),E=n([ft("reactivate-countdown")],E);import{ForesightManager as ne}from"js.foresight";var v=class extends wt{constructor(){super(...arguments);this.isActive=!1;this.isExpanded=!1;this.currentDeviceStrategy="mouse";this._abortController=null;this.handleUnregister=e=>{e.stopPropagation(),ne.instance.unregister(this.elementData.element,"devtools")}}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;this.currentDeviceStrategy=ne.instance.getManagerData.currentDeviceStrategy,ne.instance.addEventListener("deviceStrategyChanged",t=>{this.currentDeviceStrategy=t.newStrategy},{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}getBorderColor(){return this.isActive?"#ffeb3b":this.elementData.callbackInfo.isCallbackActive?this.currentDeviceStrategy==="touch"?"#ba68c8":this.elementData.isIntersectingWithViewport?"#4caf50":"#666":"#999"}getStatusIndicatorClass(){return this.isActive?"prefetching":this.elementData.callbackInfo.isCallbackActive?this.currentDeviceStrategy==="touch"?"touch-device":this.elementData.isIntersectingWithViewport?"visible":"hidden":"inactive"}getStatusText(){if(this.isActive)return"callback active";if(!this.elementData.callbackInfo.isCallbackActive)return"callback inactive";let e=this.elementData.isIntersectingWithViewport?"in viewport":"not in viewport",t=this.currentDeviceStrategy==="touch"?" (touch device)":"";return e+t}formatElementDetails(){let e=this.elementData,t={status:this.getStatusText(),isIntersecting:e.isIntersectingWithViewport,registerCount:e.registerCount,hitSlop:{top:e.elementBounds.hitSlop.top,right:e.elementBounds.hitSlop.right,bottom:e.elementBounds.hitSlop.bottom,left:e.elementBounds.hitSlop.left},callbackInfo:e.callbackInfo,meta:this.elementData.meta};return JSON.stringify(t,null,2)}render(){let e=!this.elementData.isIntersectingWithViewport&&this.currentDeviceStrategy!=="touch";return xt`
721
768
  <div class="element-wrapper ${e?"not-visible":""}">
722
769
  <expandable-item
723
770
  .borderColor=${this.getBorderColor()}
@@ -739,13 +786,13 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
739
786
  @click="${this.handleUnregister}"
740
787
  title="Unregister element"
741
788
  >
742
- ${be}
789
+ ${we}
743
790
  </button>
744
791
  </div>
745
792
  <div slot="details">${this.formatElementDetails()}</div>
746
793
  </expandable-item>
747
794
  </div>
748
- `}};f.styles=[xt`
795
+ `}};v.styles=[kt`
749
796
  :host {
750
797
  display: block;
751
798
  }
@@ -789,6 +836,11 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
789
836
  box-shadow: 0 0 0 2px rgba(153, 153, 153, 0.3);
790
837
  }
791
838
 
839
+ .status-indicator.touch-device {
840
+ background-color: #ba68c8;
841
+ box-shadow: 0 0 0 2px rgba(186, 104, 200, 0.4);
842
+ }
843
+
792
844
  .unregister-button {
793
845
  all: unset;
794
846
  display: flex;
@@ -845,8 +897,8 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
845
897
  .element-wrapper.not-visible {
846
898
  opacity: 0.5;
847
899
  }
848
- `],n([q({hasChanged:()=>!0})],f.prototype,"elementData",2),n([q()],f.prototype,"isActive",2),n([q()],f.prototype,"isExpanded",2),n([q()],f.prototype,"onToggle",2),f=n([wt("single-element")],f);var h=class extends Ct{constructor(){super();this.hitCount={mouse:{hover:0,trajectory:0},scroll:{down:0,left:0,right:0,up:0},tab:{forwards:0,reverse:0},total:0};this.elementListItems=new Map;this.noContentMessage="No Elements Registered To The Foresight Manager";this.runningCallbacks=new Set;this.expandedElementIds=new Set;this._abortController=null;this.handleSortChange=e=>{this.sortOrder=e};this.handleElementToggle=e=>{let t=new Set(this.expandedElementIds);t.has(e)?t.delete(e):t.add(e),this.expandedElementIds=t};this.sortByDocumentPosition=(e,t)=>{let i=e.element.compareDocumentPosition(t.element);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0};this.sortOrder=l.instance.devtoolsSettings.sortElementList,this.sortDropdown=[{value:"visibility",label:"Visibility",title:"Sort by Visibility",icon:le},{value:"documentOrder",label:"Document Order",title:"Sort by Document Order",icon:ce},{value:"insertionOrder",label:"Insertion Order",title:"Sort by Insertion Order",icon:de}]}_generateHitsChipTitle(e){let t=[];return t.push(`Total Hits: ${e.total}`),t.push(""),t.push(`Mouse: Trajectory: ${e.mouse.trajectory}, Hover: ${e.mouse.hover}`),t.push(`Scroll: Up: ${e.scroll.up}, Down: ${e.scroll.down}, Left: ${e.scroll.left}, Right: ${e.scroll.right}`),t.push(`Tab: Forwards: ${e.tab.forwards}, Reverse: ${e.tab.reverse}`),t.join(`
849
- `)}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;this.updateElementListFromManager(),L.instance.addEventListener("elementRegistered",t=>{this.elementListItems.set(t.elementData.element,t.elementData)},{signal:e}),L.instance.addEventListener("elementDataUpdated",t=>{this.elementListItems.get(t.elementData.element)&&(this.elementListItems.set(t.elementData.element,t.elementData),this.requestUpdate())},{signal:e}),L.instance.addEventListener("elementReactivated",t=>{this.elementListItems.get(t.elementData.element)&&(this.elementListItems.set(t.elementData.element,t.elementData),this.requestUpdate())},{signal:e}),L.instance.addEventListener("elementUnregistered",t=>{this.elementListItems.delete(t.elementData.element),this.elementListItems.size||(this.noContentMessage="No Elements Registered To The Foresight Manager"),this.runningCallbacks.delete(t.elementData.element),this.requestUpdate()},{signal:e}),L.instance.addEventListener("callbackInvoked",t=>{this.elementListItems.get(t.elementData.element)&&this.elementListItems.set(t.elementData.element,t.elementData),this.runningCallbacks.add(t.elementData.element),this.requestUpdate()},{signal:e}),L.instance.addEventListener("callbackCompleted",t=>{this.elementListItems.get(t.elementData.element)&&this.elementListItems.set(t.elementData.element,t.elementData),this.handleCallbackCompleted(t.hitType),this.runningCallbacks.delete(t.elementData.element),this.requestUpdate()},{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}updateElementListFromManager(){this.elementListItems=new Map(L.instance.registeredElements)}handleCallbackCompleted(e){switch(e.kind){case"mouse":this.hitCount.mouse[e.subType]++;break;case"tab":this.hitCount.tab[e.subType]++;break;case"scroll":this.hitCount.scroll[e.subType]++;break;default:}this.hitCount.total++,this.requestUpdate()}getSortedElements(){let e=Array.from(this.elementListItems.values());switch(this.sortOrder){case"insertionOrder":return e;case"documentOrder":return e.sort(this.sortByDocumentPosition);case"visibility":return e.sort((t,i)=>t.isIntersectingWithViewport!==i.isIntersectingWithViewport?t.isIntersectingWithViewport?-1:1:this.sortByDocumentPosition(t,i));default:return this.sortOrder,e}}getActiveElements(){return this.getSortedElements().filter(e=>e.callbackInfo.isCallbackActive)}getInactiveElements(){return this.getSortedElements().filter(e=>!e.callbackInfo.isCallbackActive)}render(){return R`
900
+ `],n([J({hasChanged:()=>!0})],v.prototype,"elementData",2),n([J()],v.prototype,"isActive",2),n([J()],v.prototype,"isExpanded",2),n([J()],v.prototype,"onToggle",2),n([Ct()],v.prototype,"currentDeviceStrategy",2),v=n([Et("single-element")],v);var m=class extends Tt{constructor(){super();this.hitCount={mouse:{hover:0,trajectory:0},scroll:{down:0,left:0,right:0,up:0},tab:{forwards:0,reverse:0},touch:0,viewport:0,total:0};this.elementListItems=new Map;this.noContentMessage="No Elements Registered To The Foresight Manager";this.runningCallbacks=new Set;this.expandedElementIds=new Set;this._abortController=null;this.handleSortChange=e=>{this.sortOrder=e};this.handleElementToggle=e=>{let t=new Set(this.expandedElementIds);t.has(e)?t.delete(e):t.add(e),this.expandedElementIds=t};this.sortByDocumentPosition=(e,t)=>{let i=e.element.compareDocumentPosition(t.element);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0};this.sortOrder=l.instance.devtoolsSettings.sortElementList,this.sortDropdown=[{value:"visibility",label:"Visibility",title:"Sort by Visibility",icon:pe},{value:"documentOrder",label:"Document Order",title:"Sort by Document Order",icon:he},{value:"insertionOrder",label:"Insertion Order",title:"Sort by Insertion Order",icon:me}]}_generateHitsChipTitle(e){let t=[];t.push(`Total Callback Hits: ${e.total}`),t.push("");let i=e.mouse.trajectory+e.mouse.hover,a=e.scroll.up+e.scroll.down+e.scroll.left+e.scroll.right,s=e.tab.forwards+e.tab.reverse;t.push("Desktop Strategy"),i>0?t.push(` Mouse (${i}): ${e.mouse.trajectory} trajectory, ${e.mouse.hover} hover`):t.push(" Mouse: No hits"),a>0?t.push(` Scroll (${a}): Up ${e.scroll.up}, Down ${e.scroll.down}, Left ${e.scroll.left}, Right ${e.scroll.right}`):t.push(" Scroll: No hits"),s>0?t.push(` Tab (${s}): ${e.tab.forwards} forward, ${e.tab.reverse} reverse`):t.push(" Tab: No hits"),t.push("");let d=e.touch+e.viewport;return t.push("Touch Strategy"),e.touch>0?t.push(` Touch Start: ${e.touch}`):t.push(" Touch Start: No hits"),e.viewport>0?t.push(` Viewport Enter: ${e.viewport}`):t.push(" Viewport Enter: No hits"),d===0&&i+a+s===0&&(t.push(""),t.push("Interact with registered elements to see callback statistics")),t.join(`
901
+ `)}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;this.updateElementListFromManager(),$.instance.addEventListener("elementRegistered",t=>{this.elementListItems.set(t.elementData.element,t.elementData)},{signal:e}),$.instance.addEventListener("elementDataUpdated",t=>{this.elementListItems.get(t.elementData.element)&&(this.elementListItems.set(t.elementData.element,t.elementData),this.requestUpdate())},{signal:e}),$.instance.addEventListener("elementReactivated",t=>{this.elementListItems.get(t.elementData.element)&&(this.elementListItems.set(t.elementData.element,t.elementData),this.requestUpdate())},{signal:e}),$.instance.addEventListener("elementUnregistered",t=>{this.elementListItems.delete(t.elementData.element),this.elementListItems.size||(this.noContentMessage="No Elements Registered To The Foresight Manager"),this.runningCallbacks.delete(t.elementData.element),this.requestUpdate()},{signal:e}),$.instance.addEventListener("callbackInvoked",t=>{this.elementListItems.get(t.elementData.element)&&this.elementListItems.set(t.elementData.element,t.elementData),this.runningCallbacks.add(t.elementData.element),this.requestUpdate()},{signal:e}),$.instance.addEventListener("callbackCompleted",t=>{this.elementListItems.get(t.elementData.element)&&this.elementListItems.set(t.elementData.element,t.elementData),this.handleCallbackCompleted(t.hitType),this.runningCallbacks.delete(t.elementData.element),this.requestUpdate()},{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}updateElementListFromManager(){this.elementListItems=new Map($.instance.registeredElements)}handleCallbackCompleted(e){switch(e.kind){case"mouse":this.hitCount.mouse[e.subType]++;break;case"tab":this.hitCount.tab[e.subType]++;break;case"scroll":this.hitCount.scroll[e.subType]++;break;case"touch":this.hitCount.touch++;break;case"viewport":this.hitCount.viewport++;break;default:}this.hitCount.total++,this.requestUpdate()}getSortedElements(){let e=Array.from(this.elementListItems.values());switch(this.sortOrder){case"insertionOrder":return e;case"documentOrder":return e.sort(this.sortByDocumentPosition);case"visibility":return e.sort((t,i)=>t.isIntersectingWithViewport!==i.isIntersectingWithViewport?t.isIntersectingWithViewport?-1:1:this.sortByDocumentPosition(t,i));default:return this.sortOrder,e}}getActiveElements(){return this.getSortedElements().filter(e=>e.callbackInfo.isCallbackActive)}getInactiveElements(){return this.getSortedElements().filter(e=>!e.callbackInfo.isCallbackActive)}render(){return B`
850
902
  <tab-header>
851
903
  <div slot="chips" class="chips-container">
852
904
  <chip-element title="${this._generateHitsChipTitle(this.hitCount)}">
@@ -865,12 +917,12 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
865
917
  .noContentMessage=${this.noContentMessage}
866
918
  .hasContent=${!!this.elementListItems.size}
867
919
  >
868
- ${this.getActiveElements().length>0?R`
920
+ ${this.getActiveElements().length>0?B`
869
921
  <div class="element-section">
870
922
  <h3 class="section-header active">
871
923
  Active Elements (${this.getActiveElements().length})
872
924
  </h3>
873
- ${Ce(this.getActiveElements(),e=>R`
925
+ ${Me(this.getActiveElements(),e=>B`
874
926
  <single-element
875
927
  .elementData=${e}
876
928
  .isActive=${this.runningCallbacks.has(e.element)}
@@ -881,12 +933,12 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
881
933
  `)}
882
934
  </div>
883
935
  `:""}
884
- ${this.getInactiveElements().length>0?R`
936
+ ${this.getInactiveElements().length>0?B`
885
937
  <div class="element-section">
886
938
  <h3 class="section-header inactive">
887
939
  Inactive Elements (${this.getInactiveElements().length})
888
940
  </h3>
889
- ${Ce(this.getInactiveElements(),e=>R`
941
+ ${Me(this.getInactiveElements(),e=>B`
890
942
  <single-element
891
943
  .elementData=${e}
892
944
  .isActive=${this.runningCallbacks.has(e.element)}
@@ -898,7 +950,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
898
950
  </div>
899
951
  `:""}
900
952
  </tab-content>
901
- `}};h.styles=Et`
953
+ `}};m.styles=St`
902
954
  :host {
903
955
  display: flex;
904
956
  flex-direction: column;
@@ -931,9 +983,9 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
931
983
  .section-header.inactive {
932
984
  color: #999;
933
985
  }
934
- `,n([M()],h.prototype,"hitCount",2),n([M()],h.prototype,"sortDropdown",2),n([M()],h.prototype,"sortOrder",2),n([M()],h.prototype,"elementListItems",2),n([M()],h.prototype,"noContentMessage",2),n([M()],h.prototype,"runningCallbacks",2),n([M()],h.prototype,"expandedElementIds",2),h=n([St("element-tab")],h);import{css as Tt,html as Se,LitElement as Dt}from"lit";import{customElement as Mt,property as Lt}from"lit/decorators.js";var N=class extends Dt{constructor(){super(...arguments);this.activeTab="settings";this.tabs=["settings","elements","logs"]}_handleTabClick(e){this.dispatchEvent(new CustomEvent("tab-change",{detail:{tab:e},bubbles:!0,composed:!0}))}render(){return Se`
986
+ `,n([L()],m.prototype,"hitCount",2),n([L()],m.prototype,"sortDropdown",2),n([L()],m.prototype,"sortOrder",2),n([L()],m.prototype,"elementListItems",2),n([L()],m.prototype,"noContentMessage",2),n([L()],m.prototype,"runningCallbacks",2),n([L()],m.prototype,"expandedElementIds",2),m=n([Dt("element-tab")],m);import{css as Mt,html as Le,LitElement as Lt}from"lit";import{customElement as $t,property as _t}from"lit/decorators.js";var A=class extends Lt{constructor(){super(...arguments);this.activeTab="settings";this.tabs=["settings","elements","logs"]}_handleTabClick(e){this.dispatchEvent(new CustomEvent("tab-change",{detail:{tab:e},bubbles:!0,composed:!0}))}render(){return Le`
935
987
  <div class="tab-selector-wrapper">
936
- ${this.tabs.map(e=>Se`
988
+ ${this.tabs.map(e=>Le`
937
989
  <button
938
990
  class="tab-button ${this.activeTab===e?"active":""}"
939
991
  @click="${()=>this._handleTabClick(e)}"
@@ -943,7 +995,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
943
995
  </button>
944
996
  `)}
945
997
  </div>
946
- `}};N.styles=Tt`
998
+ `}};A.styles=Mt`
947
999
  .tab-selector-wrapper {
948
1000
  border-bottom: 2px solid #444;
949
1001
  margin-top: 12px;
@@ -974,8 +1026,8 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
974
1026
  color: #b0c4de;
975
1027
  border-bottom-color: #b0c4de;
976
1028
  }
977
- `,n([Lt({type:String})],N.prototype,"activeTab",2),N=n([Mt("tab-selector")],N);import{ForesightManager as H}from"js.foresight";import{LitElement as Ft,css as Vt,html as Y}from"lit";import{customElement as At,property as jt,state as F}from"lit/decorators.js";import{map as zt}from"lit/directives/map.js";function De(o,s){let e={};o.eventListeners.forEach((i,a)=>{e[a]=i.length});let t=[];return o.registeredElements.forEach((i,a)=>{let{element:r,...p}=i;t.push({...p,elementInfo:`${a.tagName.toLowerCase()}${a.id?`#${a.id}`:""}${a.className?`.${a.className.replace(/\s+/g,".")}`:""}`})}),{type:"managerDataPayload",warning:"this is a lot easier to view in the console",logId:s,globalCallbackHits:o.globalCallbackHits,localizedTimestamp:new Date().toLocaleTimeString(),eventListenerCount:e,managerSettings:o.globalSettings,registeredElements:t,summary:`${t.length} elements, ${Object.values(e).flat().length} listeners,
978
- ${o.globalCallbackHits.total} hits`}}function Me(o,s){try{switch(o.type){case"elementRegistered":return{type:"elementRegistered",name:o.elementData.name,id:o.elementData.element.id||"",callbackInfo:o.elementData.callbackInfo,hitslop:o.elementData.elementBounds.hitSlop,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),meta:o.elementData.meta,logId:s,summary:o.elementData.registerCount===1?o.elementData.name:`${o.elementData.name} - ${Te(o.elementData.registerCount)} time`};case"elementReactivated":return{type:"elementReactivated",name:o.elementData.name,id:o.elementData.element.id||"",callbackInfo:o.elementData.callbackInfo,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),meta:o.elementData.meta,logId:s,summary:o.elementData.registerCount===1?o.elementData.name:`${o.elementData.name} - ${Te(o.elementData.registerCount)} time`};case"elementUnregistered":return{type:"elementUnregistered",localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:s,summary:`${o.elementData.name} - ${o.unregisterReason}`};case"elementDataUpdated":return{type:"elementDataUpdated",name:o.elementData.name,updatedProps:o.updatedProps||[],callbackInfo:o.elementData.callbackInfo,isIntersecting:o.elementData.isIntersectingWithViewport,meta:o.elementData.meta,localizedTimestamp:new Date().toLocaleTimeString(),logId:s,summary:`${o.elementData.name} - ${o.updatedProps.toString()}`};case"callbackInvoked":return{type:"callbackInvoked",name:o.elementData.name,hitType:o.hitType,callbackInfo:o.elementData.callbackInfo,meta:o.elementData.meta,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:s,summary:`${o.elementData.name} - ${o.hitType.kind}`};case"callbackCompleted":{let e=$t(o.elapsed);return{type:"callbackCompleted",name:o.elementData.name,hitType:o.hitType,callbackInfo:o.elementData.callbackInfo,meta:o.elementData.meta,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:s,status:o.elementData.callbackInfo.lastCallbackStatus,errorMessage:o.elementData.callbackInfo.lastCallbackErrorMessage,summary:`${o.elementData.name} - ${e}`}}case"mouseTrajectoryUpdate":return{type:"mouseTrajectoryUpdate",currentPoint:o.trajectoryPositions?.currentPoint,predictedPoint:o.trajectoryPositions?.predictedPoint,positionCount:o.trajectoryPositions?.positions?.length||0,mousePredictionEnabled:o.predictionEnabled,localizedTimestamp:new Date().toLocaleTimeString(),logId:s,summary:""};case"scrollTrajectoryUpdate":return{type:"scrollTrajectoryUpdate",currentPoint:o.currentPoint,predictedPoint:o.predictedPoint,scrollDirection:o.scrollDirection,localizedTimestamp:new Date().toLocaleTimeString(),logId:s,summary:o.scrollDirection};case"managerSettingsChanged":return{type:"managerSettingsChanged",globalSettings:o.managerData?.globalSettings||{},settingsChanged:o.updatedSettings,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:s,summary:o.updatedSettings.map(e=>e.setting).join(", ")};default:return{type:"serializationError",error:"Failed to serialize event data",errorMessage:JSON.stringify(o),localizedTimestamp:new Date().toLocaleTimeString(),logId:s,summary:""}}}catch(e){return{type:"serializationError",error:"Failed to serialize event data",localizedTimestamp:new Date().toLocaleTimeString(),errorMessage:e instanceof Error?e.message:String(e),logId:s,summary:""}}}function $t(o){return`${(o/1e3).toFixed(4)} s`}function Te(o){let s=["th","st","nd","rd"],e=o%100;return o+(s[(e-20)%10]||s[e]||s[0])}import{html as Le,css as It}from"lit";import{customElement as _t,property as $e}from"lit/decorators.js";var $=class extends D{constructor(){super(...arguments);this.selectedValues=[]}_handleOptionClick(e){let t=this.selectedValues.includes(e.value);t?this.selectedValues=this.selectedValues.filter(a=>a!==e.value):this.selectedValues=[...this.selectedValues,e.value];let i=!t;this.onSelectionChange?.(e.value,i)}_getTriggerIcon(){return u}_isOptionSelected(e){return this.selectedValues.includes(e.value)}_getTriggerTitle(){let e=this.selectedValues.length;return e===0?"No items selected":e===1?"1 item selected":`${e} items selected`}_getTriggerLabel(){return`Filter options: ${this.selectedValues.length} selected`}render(){let e=`trigger-button ${this.isDropdownOpen?"active":""}`,t=`dropdown-menu ${this.isDropdownOpen?"active":""}`;return Le`
1029
+ `,n([_t({type:String})],A.prototype,"activeTab",2),A=n([$t("tab-selector")],A);import{ForesightManager as G}from"js.foresight";import{LitElement as Vt,css as Rt,html as X}from"lit";import{customElement as Ft,property as zt,state as j}from"lit/decorators.js";import{map as Ht}from"lit/directives/map.js";function _e(o,r){let e={};o.eventListeners.forEach((i,a)=>{e[a]=i.length});let t=[];return o.registeredElements.forEach((i,a)=>{let{element:s,...d}=i;t.push({...d,elementInfo:`${a.id?`#${a.id}`:""}${a.className?`.${a.className.replace(/\s+/g,".")}`:""}`})}),{type:"managerDataPayload",warning:"this is a lot easier to view in the console",logId:r,globalCallbackHits:o.globalCallbackHits,localizedTimestamp:new Date().toLocaleTimeString(),eventListenerCount:e,managerSettings:o.globalSettings,registeredElements:t,summary:`${t.length} elements, ${Object.values(e).flat().length} listeners,
1030
+ ${o.globalCallbackHits.total} hits`}}function Ie(o,r){try{switch(o.type){case"elementRegistered":return{type:"elementRegistered",name:o.elementData.name,id:o.elementData.element.id||"",callbackInfo:o.elementData.callbackInfo,hitslop:o.elementData.elementBounds.hitSlop,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),meta:o.elementData.meta,logId:r,summary:o.elementData.registerCount===1?o.elementData.name:`${o.elementData.name} - ${$e(o.elementData.registerCount)} time`};case"elementReactivated":return{type:"elementReactivated",name:o.elementData.name,id:o.elementData.element.id||"",callbackInfo:o.elementData.callbackInfo,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),meta:o.elementData.meta,logId:r,summary:o.elementData.registerCount===1?o.elementData.name:`${o.elementData.name} - ${$e(o.elementData.registerCount)} time`};case"elementUnregistered":return{type:"elementUnregistered",name:o.elementData.name,id:o.elementData.element.id||"",meta:o.elementData.meta,callbackInfo:o.elementData.callbackInfo,wasLastRegisteredElement:o.wasLastRegisteredElement,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:r,summary:`${o.elementData.name} - ${o.unregisterReason}`};case"elementDataUpdated":return{type:"elementDataUpdated",name:o.elementData.name,updatedProps:o.updatedProps||[],callbackInfo:o.elementData.callbackInfo,isIntersecting:o.elementData.isIntersectingWithViewport,meta:o.elementData.meta,localizedTimestamp:new Date().toLocaleTimeString(),logId:r,summary:`${o.elementData.name} - ${o.updatedProps.toString()}`};case"callbackInvoked":return{type:"callbackInvoked",name:o.elementData.name,hitType:o.hitType,callbackInfo:o.elementData.callbackInfo,meta:o.elementData.meta,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:r,summary:`${o.elementData.name} - ${o.hitType.kind}`};case"callbackCompleted":{let e=It(o.elementData.callbackInfo.lastCallbackRuntime||0);return{type:"callbackCompleted",name:o.elementData.name,hitType:o.hitType,callbackInfo:o.elementData.callbackInfo,meta:o.elementData.meta,wasLastActiveElement:o.wasLastActiveElement,elapsed:e,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:r,status:o.elementData.callbackInfo.lastCallbackStatus,errorMessage:o.elementData.callbackInfo.lastCallbackErrorMessage,summary:`${o.elementData.name} - ${e}`}}case"mouseTrajectoryUpdate":return{type:"mouseTrajectoryUpdate",currentPoint:o.trajectoryPositions?.currentPoint,predictedPoint:o.trajectoryPositions?.predictedPoint,positionCount:o.trajectoryPositions?.positions?.length||0,mousePredictionEnabled:o.predictionEnabled,localizedTimestamp:new Date().toLocaleTimeString(),logId:r,summary:""};case"scrollTrajectoryUpdate":return{type:"scrollTrajectoryUpdate",currentPoint:o.currentPoint,predictedPoint:o.predictedPoint,scrollDirection:o.scrollDirection,localizedTimestamp:new Date().toLocaleTimeString(),logId:r,summary:o.scrollDirection};case"managerSettingsChanged":return{type:"managerSettingsChanged",globalSettings:o.managerData?.globalSettings||{},settingsChanged:o.updatedSettings,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:r,summary:o.updatedSettings.map(e=>e.setting).join(", ")};case"deviceStrategyChanged":return{type:"deviceStrategyChanged",oldStrategy:o.oldStrategy,newStrategy:o.newStrategy,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:r,summary:`${o.oldStrategy} \u2192 ${o.newStrategy}`};default:return{type:"serializationError",error:"Failed to serialize event data",errorMessage:JSON.stringify(o),localizedTimestamp:new Date().toLocaleTimeString(),logId:r,summary:""}}}catch(e){return{type:"serializationError",error:"Failed to serialize event data",localizedTimestamp:new Date().toLocaleTimeString(),errorMessage:e instanceof Error?e.message:String(e),logId:r,summary:""}}}function It(o){return`${(o/1e3).toFixed(4)} s`}function $e(o){let r=["th","st","nd","rd"],e=o%100;return o+(r[(e-20)%10]||r[e]||r[0])}import{html as Oe,css as Ot}from"lit";import{customElement as Pt,property as Pe}from"lit/decorators.js";var _=class extends M{constructor(){super(...arguments);this.selectedValues=[]}_handleOptionClick(e){let t=this.selectedValues.includes(e.value);t?this.selectedValues=this.selectedValues.filter(a=>a!==e.value):this.selectedValues=[...this.selectedValues,e.value];let i=!t;this.onSelectionChange?.(e.value,i)}_getTriggerIcon(){return h}_isOptionSelected(e){return this.selectedValues.includes(e.value)}_getTriggerTitle(){let e=this.selectedValues.length;return e===0?"No items selected":e===1?"1 item selected":`${e} items selected`}_getTriggerLabel(){return`Filter options: ${this.selectedValues.length} selected`}render(){let e=`trigger-button ${this.isDropdownOpen?"active":""}`,t=`dropdown-menu ${this.isDropdownOpen?"active":""}`;return Oe`
979
1031
  <div class="dropdown-container">
980
1032
  <button
981
1033
  class="${e}"
@@ -1002,7 +1054,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
1002
1054
  </button>
1003
1055
 
1004
1056
  <div class="${t}" id="dropdown-menu" role="menu">
1005
- ${this.dropdownOptions.map(i=>Le`
1057
+ ${this.dropdownOptions.map(i=>Oe`
1006
1058
  <button
1007
1059
  value="${i.value}"
1008
1060
  title="${i.title}"
@@ -1015,7 +1067,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
1015
1067
  `)}
1016
1068
  </div>
1017
1069
  </div>
1018
- `}};$.styles=[...D.styles,It`
1070
+ `}};_.styles=[...M.styles,Ot`
1019
1071
  .dropdown-menu button.active::after {
1020
1072
  content: "✓";
1021
1073
  position: absolute;
@@ -1031,7 +1083,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
1031
1083
  color: #b0c4de;
1032
1084
  margin-left: 2px;
1033
1085
  }
1034
- `],n([$e({type:Array})],$.prototype,"selectedValues",2),n([$e()],$.prototype,"onSelectionChange",2),$=n([_t("multi-select-dropdown")],$);import{LitElement as Ot,html as Pt,css as Ut}from"lit";import{customElement as Nt,property as ee}from"lit/decorators.js";var E=class extends Ot{constructor(e){super();this.isExpanded=!1;this.log=e}updated(e){if(e.has("log")&&this.log){let t=this.log,i=t.type==="callbackCompleted"&&"status"in t&&t.status==="error",a=i?"#f44336":this.getLogTypeColor(t.type),r=i?"rgba(244, 67, 54, 0.1)":"transparent";this.style.setProperty("--log-color",a),this.style.setProperty("--log-background-color",r)}}serializeLogDataWithoutSummary(e){let{summary:t,...i}=e;return JSON.stringify(i,null,2)}getLogTypeColor(e){return{elementRegistered:"#2196f3",elementReactivated:"#ff9800",callbackInvoked:"#00bcd4",callbackCompleted:"#4caf50",elementDataUpdated:"#ffc107",elementUnregistered:"#ff9800",managerSettingsChanged:"#f44336",mouseTrajectoryUpdate:"#78909c",scrollTrajectoryUpdate:"#607d8b"}[e]||"#555"}getEventDisplayName(e){return{elementRegistered:"Registered",elementReactivated:"Reactivated",elementUnregistered:"Unregistered",elementDataUpdated:"Data Updated",callbackInvoked:"Invoked",callbackCompleted:"Completed",mouseTrajectoryUpdate:"Mouse",scrollTrajectoryUpdate:"Scroll",managerSettingsChanged:"Settings",managerDataPayload:"ManagerData"}[e]||e}truncateLogSummary(e,t=50){return e.length<=t?e:e.substring(0,t)+"..."}render(){let e=this.log,i=e.type==="callbackCompleted"&&"status"in e&&e.status==="error"?"#f44336":this.getLogTypeColor(e.type);return Pt`
1086
+ `],n([Pe({type:Array})],_.prototype,"selectedValues",2),n([Pe()],_.prototype,"onSelectionChange",2),_=n([Pt("multi-select-dropdown")],_);import{LitElement as Ut,html as Nt,css as At}from"lit";import{customElement as jt,property as ie}from"lit/decorators.js";var C=class extends Ut{constructor(e){super();this.isExpanded=!1;this.log=e}updated(e){if(e.has("log")&&this.log){let t=this.log,i=t.type==="callbackCompleted"&&"status"in t&&t.status==="error",a=i?"#f44336":this.getLogTypeColor(t.type),s=i?"rgba(244, 67, 54, 0.1)":"transparent";this.style.setProperty("--log-color",a),this.style.setProperty("--log-background-color",s)}}serializeLogDataWithoutSummary(e){let{summary:t,...i}=e;return JSON.stringify(i,null,2)}getLogTypeColor(e){return{elementRegistered:"#2196f3",elementReactivated:"#ff9800",callbackInvoked:"#00bcd4",callbackCompleted:"#4caf50",elementDataUpdated:"#ffc107",elementUnregistered:"#ff9800",managerSettingsChanged:"#f44336",mouseTrajectoryUpdate:"#78909c",scrollTrajectoryUpdate:"#607d8b",deviceStrategyChanged:"#9c27b0"}[e]||"#555"}getEventDisplayName(e){return{elementRegistered:"Registered",elementReactivated:"Reactivated",elementUnregistered:"Unregistered",elementDataUpdated:"Data Updated",callbackInvoked:"Invoked",callbackCompleted:"Completed",mouseTrajectoryUpdate:"Mouse",scrollTrajectoryUpdate:"Scroll",managerSettingsChanged:"Settings",managerDataPayload:"ManagerData",deviceStrategyChanged:"Strategy"}[e]||e}truncateLogSummary(e,t=50){return e.length<=t?e:e.substring(0,t)+"..."}render(){let e=this.log,i=e.type==="callbackCompleted"&&"status"in e&&e.status==="error"?"#f44336":this.getLogTypeColor(e.type);return Nt`
1035
1087
  <expandable-item
1036
1088
  .borderColor=${i}
1037
1089
  .itemId=${e.logId}
@@ -1047,7 +1099,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
1047
1099
  </div>
1048
1100
  <div slot="details">${this.serializeLogDataWithoutSummary(e)}</div>
1049
1101
  </expandable-item>
1050
- `}};E.styles=[Ut`
1102
+ `}};C.styles=[At`
1051
1103
  :host {
1052
1104
  display: block;
1053
1105
  /*
@@ -1111,7 +1163,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
1111
1163
  * as all styling is now handled by setting CSS variables below.
1112
1164
  * This makes the component's styling more self-contained.
1113
1165
  */
1114
- `],n([ee({attribute:!1})],E.prototype,"log",2),n([ee({type:Boolean})],E.prototype,"isExpanded",2),n([ee()],E.prototype,"onToggle",2),E=n([Nt("single-log")],E);var m=class extends Ft{constructor(){super();this.logs=[];this.expandedLogIds=new Set;this.MAX_LOGS=100;this.logIdCounter=0;this.noContentMessage="No logs available";this._abortController=null;this._eventListeners=new Map;this.handleLogLocationChange=e=>{this.logLocation=e};this.handleFilterChange=(e,t)=>{this.eventsEnabled={...this.eventsEnabled,[e]:t},t?this.addForesightEventListener(e):this.removeForesightEventListener(e)};this.handleLogToggle=e=>{let t=new Set(this.expandedLogIds);t.has(e)?t.delete(e):t.add(e),this.expandedLogIds=t};let{logging:{logLocation:e,...t}}=l.instance.devtoolsSettings;this.eventsEnabled=t,this.logLocation=e,this.logDropdown=[{value:"controlPanel",label:"Control Panel",title:"Log only to the control panel",icon:oe},{value:"console",label:"Console",title:"Log only to the console",icon:ae},{value:"both",label:"Both",title:"Log to both the control panel and the console",icon:re},{value:"none",label:"None",title:"Dont log anywhere",icon:se}],this.filterDropdown=[{value:"elementRegistered",label:"Element Registered",title:"Show element registration events",icon:u},{value:"elementUnregistered",label:"Element Unregistered",title:"Show element unregistration events",icon:u},{value:"elementReactivated",label:"Element Reactivated",title:"Show when element gets reactivated after stale time has passed",icon:u},{value:"callbackInvoked",label:"Callback Invoked",title:"Show callback invoked events",icon:u},{value:"callbackCompleted",label:"Callback Completed",title:"Show callback completed events",icon:u},{value:"mouseTrajectoryUpdate",label:"Mouse Trajectory Update",title:"Show mouse trajectory update events",icon:u},{value:"scrollTrajectoryUpdate",label:"Scroll Trajectory Update",title:"Show scroll trajectory update events",icon:u},{value:"managerSettingsChanged",label:"Manager Settings Changed",title:"Show manager settings change events",icon:u}]}getSelectedEventFilters(){return Object.entries(this.eventsEnabled).filter(([,e])=>e).map(([e])=>e)}shouldShowPerformanceWarning(){let e=this.logLocation==="console"||this.logLocation==="both",t=this.eventsEnabled.mouseTrajectoryUpdate||this.eventsEnabled.scrollTrajectoryUpdate||this.eventsEnabled.elementDataUpdated;return e&&t}getNoLogsMessage(){return Object.values(this.eventsEnabled).filter(Boolean).length===0?"Logging for all events is turned off":this.logLocation==="console"?"No logs to display. Logging location is set to console - check browser console for events.":this.logLocation==="none"?"No logs to display. Logging location is set to none":"Interact with Foresight to generate events."}clearLogs(){this.logs=[],this.expandedLogIds.clear(),this.noContentMessage="Logs cleared"}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController,this.setupDynamicEventListeners()}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this.removeAllEventListeners()}setupDynamicEventListeners(){Object.entries(this.eventsEnabled).forEach(([e,t])=>{t&&this.addForesightEventListener(e)})}addForesightEventListener(e){if(this._eventListeners.has(e))return;let t=i=>{this.handleEvent(e,i)};this._eventListeners.set(e,t),H.instance.addEventListener(e,t,{signal:this._abortController?.signal})}removeForesightEventListener(e){let t=this._eventListeners.get(e);t&&(H.instance.removeEventListener(e,t),this._eventListeners.delete(e))}removeAllEventListeners(){this._eventListeners.forEach((e,t)=>{H.instance.removeEventListener(t,e)}),this._eventListeners.clear()}getEventColor(e){return{elementRegistered:"#2196f3",elementReactivated:"#ff9800",callbackInvoked:"#00bcd4",callbackCompleted:"#4caf50",elementDataUpdated:"#ffc107",elementUnregistered:"#ff9800",managerSettingsChanged:"#f44336",mouseTrajectoryUpdate:"#78909c",scrollTrajectoryUpdate:"#607d8b"}[e]||"#ffffff"}handleEvent(e,t){if(this.logLocation!=="none"){if(this.logLocation==="console"||this.logLocation==="both"){let i=this.getEventColor(e);console.log(`%c[ForesightJS] ${e}`,`color: ${i}; font-weight: bold;`,t)}(this.logLocation==="controlPanel"||this.logLocation==="both")&&this.addEventLog(t)}}addLog(e){this.logs.unshift(e),this.logs.length>this.MAX_LOGS&&this.logs.pop(),this.requestUpdate()}logManagerData(){this.logLocation!=="none"&&((this.logLocation==="console"||this.logLocation==="both")&&console.log(H.instance.getManagerData),(this.logLocation==="controlPanel"||this.logLocation==="both")&&this.addManagerLog())}addManagerLog(){let e=De(H.instance.getManagerData,(++this.logIdCounter).toString());this.addLog(e)}addEventLog(e){let t=Me(e,(++this.logIdCounter).toString());if(t.type==="serializationError"){console.error(t.error,t.errorMessage);return}this.addLog(t)}render(){return Y`
1166
+ `],n([ie({attribute:!1})],C.prototype,"log",2),n([ie({type:Boolean})],C.prototype,"isExpanded",2),n([ie()],C.prototype,"onToggle",2),C=n([jt("single-log")],C);var u=class extends Vt{constructor(){super();this.logs=[];this.expandedLogIds=new Set;this.MAX_LOGS=100;this.logIdCounter=0;this.noContentMessage="No logs available";this._abortController=null;this._eventListeners=new Map;this.handleLogLocationChange=e=>{this.logLocation=e};this.handleFilterChange=(e,t)=>{this.eventsEnabled={...this.eventsEnabled,[e]:t},t?this.addForesightEventListener(e):this.removeForesightEventListener(e)};this.handleLogToggle=e=>{let t=new Set(this.expandedLogIds);t.has(e)?t.delete(e):t.add(e),this.expandedLogIds=t};let{logging:{logLocation:e,...t}}=l.instance.devtoolsSettings;this.eventsEnabled=t,this.logLocation=e,this.logDropdown=[{value:"controlPanel",label:"Control Panel",title:"Log only to the control panel",icon:le},{value:"console",label:"Console",title:"Log only to the console",icon:ce},{value:"both",label:"Both",title:"Log to both the control panel and the console",icon:ge},{value:"none",label:"None",title:"Dont log anywhere",icon:de}],this.filterDropdown=[{value:"elementRegistered",label:"Element Registered",title:"Show element registration events",icon:h},{value:"elementUnregistered",label:"Element Unregistered",title:"Show element unregistration events",icon:h},{value:"elementReactivated",label:"Element Reactivated",title:"Show when element gets reactivated after stale time has passed",icon:h},{value:"callbackInvoked",label:"Callback Invoked",title:"Show callback invoked events",icon:h},{value:"callbackCompleted",label:"Callback Completed",title:"Show callback completed events",icon:h},{value:"mouseTrajectoryUpdate",label:"Mouse Trajectory Update",title:"Show mouse trajectory update events",icon:h},{value:"scrollTrajectoryUpdate",label:"Scroll Trajectory Update",title:"Show scroll trajectory update events",icon:h},{value:"managerSettingsChanged",label:"Manager Settings Changed",title:"Show manager settings change events",icon:h},{value:"deviceStrategyChanged",label:"Strategy Changed",title:"Show strategy change events",icon:h}]}getSelectedEventFilters(){return Object.entries(this.eventsEnabled).filter(([,e])=>e).map(([e])=>e)}shouldShowPerformanceWarning(){let e=this.logLocation==="console"||this.logLocation==="both",t=this.eventsEnabled.mouseTrajectoryUpdate||this.eventsEnabled.scrollTrajectoryUpdate||this.eventsEnabled.elementDataUpdated;return e&&t}getNoLogsMessage(){return Object.values(this.eventsEnabled).filter(Boolean).length===0?"Logging for all events is turned off":this.logLocation==="console"?"No logs to display. Logging location is set to console - check browser console for events.":this.logLocation==="none"?"No logs to display. Logging location is set to none":"Interact with Foresight to generate events."}clearLogs(){this.logs=[],this.expandedLogIds.clear(),this.noContentMessage="Logs cleared"}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController,this.setupDynamicEventListeners()}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this.removeAllEventListeners()}setupDynamicEventListeners(){Object.entries(this.eventsEnabled).forEach(([e,t])=>{t&&this.addForesightEventListener(e)})}addForesightEventListener(e){if(this._eventListeners.has(e))return;let t=i=>{this.handleEvent(e,i)};this._eventListeners.set(e,t),G.instance.addEventListener(e,t,{signal:this._abortController?.signal})}removeForesightEventListener(e){let t=this._eventListeners.get(e);t&&(G.instance.removeEventListener(e,t),this._eventListeners.delete(e))}removeAllEventListeners(){this._eventListeners.forEach((e,t)=>{G.instance.removeEventListener(t,e)}),this._eventListeners.clear()}getEventColor(e){return{elementRegistered:"#2196f3",elementReactivated:"#ff9800",callbackInvoked:"#00bcd4",callbackCompleted:"#4caf50",elementDataUpdated:"#ffc107",elementUnregistered:"#ff9800",managerSettingsChanged:"#f44336",mouseTrajectoryUpdate:"#78909c",scrollTrajectoryUpdate:"#607d8b",deviceStrategyChanged:"#9c27b0"}[e]||"#ffffff"}handleEvent(e,t){if(this.logLocation!=="none"){if(this.logLocation==="console"||this.logLocation==="both"){let i=this.getEventColor(e);console.log(`%c[ForesightJS] ${e}`,`color: ${i}; font-weight: bold;`,t)}(this.logLocation==="controlPanel"||this.logLocation==="both")&&this.addEventLog(t)}}addLog(e){this.logs.unshift(e),this.logs.length>this.MAX_LOGS&&this.logs.pop(),this.requestUpdate()}logManagerData(){this.logLocation!=="none"&&((this.logLocation==="console"||this.logLocation==="both")&&console.log(G.instance.getManagerData),(this.logLocation==="controlPanel"||this.logLocation==="both")&&this.addManagerLog())}addManagerLog(){let e=_e(G.instance.getManagerData,(++this.logIdCounter).toString());this.addLog(e)}addEventLog(e){let t=Ie(e,(++this.logIdCounter).toString());if(t.type==="serializationError"){console.error(t.error,t.errorMessage);return}this.addLog(t)}render(){return X`
1115
1167
  <tab-header>
1116
1168
  <div slot="chips" class="chips-container">
1117
1169
  <chip-element title="Number of logged events (Max ${this.MAX_LOGS})">
@@ -1119,13 +1171,13 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
1119
1171
  </chip-element>
1120
1172
  </div>
1121
1173
  <div slot="actions">
1122
- ${this.shouldShowPerformanceWarning()?Y`
1174
+ ${this.shouldShowPerformanceWarning()?X`
1123
1175
  <div
1124
1176
  class="warning-container"
1125
1177
  title="Console logging can be slow with frequent trajectory events.
1126
1178
  Consider using 'Control Panel' only for better performance."
1127
1179
  >
1128
- ${me}
1180
+ ${fe}
1129
1181
  </div>
1130
1182
  `:""}
1131
1183
  <single-select-dropdown
@@ -1144,7 +1196,7 @@ Consider using 'Control Panel' only for better performance."
1144
1196
  title="Log the state from the manager"
1145
1197
  @click="${this.logManagerData}"
1146
1198
  >
1147
- ${ue}
1199
+ ${ye}
1148
1200
  </button>
1149
1201
  <button
1150
1202
  class="single-button"
@@ -1152,12 +1204,12 @@ Consider using 'Control Panel' only for better performance."
1152
1204
  ?disabled="${this.logs.length===0}"
1153
1205
  @click="${this.clearLogs}"
1154
1206
  >
1155
- ${pe}
1207
+ ${ue}
1156
1208
  </button>
1157
1209
  </div>
1158
1210
  </tab-header>
1159
1211
  <tab-content .noContentMessage=${this.noContentMessage} .hasContent=${!!this.logs.length}>
1160
- ${this.logs.length===0?Y`<div class="no-items">${this.getNoLogsMessage()}</div>`:zt(this.logs,e=>Y`
1212
+ ${this.logs.length===0?X`<div class="no-items">${this.getNoLogsMessage()}</div>`:Ht(this.logs,e=>X`
1161
1213
  <single-log
1162
1214
  .log=${e}
1163
1215
  .isExpanded=${this.expandedLogIds.has(e.logId)}
@@ -1165,7 +1217,7 @@ Consider using 'Control Panel' only for better performance."
1165
1217
  ></single-log>
1166
1218
  `)}
1167
1219
  </tab-content>
1168
- `}};m.styles=[Vt`
1220
+ `}};u.styles=[Rt`
1169
1221
  :host {
1170
1222
  display: flex;
1171
1223
  flex-direction: column;
@@ -1258,7 +1310,7 @@ Consider using 'Control Panel' only for better performance."
1258
1310
  .warning-container:hover svg {
1259
1311
  stroke: #ffdc3e;
1260
1312
  }
1261
- `],n([F()],m.prototype,"logDropdown",2),n([F()],m.prototype,"filterDropdown",2),n([F()],m.prototype,"logLocation",2),n([F()],m.prototype,"eventsEnabled",2),n([F()],m.prototype,"logs",2),n([F()],m.prototype,"expandedLogIds",2),n([jt()],m.prototype,"noContentMessage",2),m=n([At("log-tab")],m);import{ForesightManager as Ue}from"js.foresight";import{css as gn,html as Ne,LitElement as hn}from"lit";import{customElement as mn,state as X}from"lit/decorators.js";var te="points",Ie="px",_e="tabs",Oe="ms";import{LitElement as Kt,html as Wt,css as qt}from"lit";import{customElement as Yt,property as J}from"lit/decorators.js";import{LitElement as Rt,html as Ht,css as Bt}from"lit";import{customElement as Gt,property as Pe}from"lit/decorators.js";var I=class extends Rt{constructor(){super(...arguments);this.header="";this.description=""}render(){return Ht`<div class="setting-item">
1313
+ `],n([j()],u.prototype,"logDropdown",2),n([j()],u.prototype,"filterDropdown",2),n([j()],u.prototype,"logLocation",2),n([j()],u.prototype,"eventsEnabled",2),n([j()],u.prototype,"logs",2),n([j()],u.prototype,"expandedLogIds",2),n([zt()],u.prototype,"noContentMessage",2),u=n([Ft("log-tab")],u);import{ForesightManager as ae}from"js.foresight";import{css as bn,html as W,LitElement as vn}from"lit";import{customElement as fn,state as K}from"lit/decorators.js";var oe="points";var Ue="tabs";import{LitElement as qt,html as Yt,css as Jt}from"lit";import{customElement as Xt,property as Z}from"lit/decorators.js";import{LitElement as Bt,html as Gt,css as Wt}from"lit";import{customElement as Kt,property as Ne}from"lit/decorators.js";var I=class extends Bt{constructor(){super(...arguments);this.header="";this.description=""}render(){return Gt`<div class="setting-item">
1262
1314
  <label>
1263
1315
  <span class="setting-header">${this.header}</span>
1264
1316
  <span class="setting-description"> ${this.description} </span>
@@ -1266,7 +1318,7 @@ Consider using 'Control Panel' only for better performance."
1266
1318
  <div class="setting-controls">
1267
1319
  <slot name="controls"></slot>
1268
1320
  </div>
1269
- </div>`}};I.styles=[Bt`
1321
+ </div>`}};I.styles=[Wt`
1270
1322
  .setting-item {
1271
1323
  display: flex;
1272
1324
  align-items: center;
@@ -1306,14 +1358,14 @@ Consider using 'Control Panel' only for better performance."
1306
1358
  color: #fff;
1307
1359
  font-size: 13px;
1308
1360
  }
1309
- `],n([Pe({type:String})],I.prototype,"header",2),n([Pe({type:String})],I.prototype,"description",2),I=n([Gt("setting-item")],I);import{ForesightManager as Jt}from"js.foresight";var y=class extends Kt{constructor(){super(...arguments);this.isChecked=!1;this.header="";this.description="";this.setting="enableMousePrediction"}handleCheckboxChange(e){let t=e.target;if(t instanceof HTMLInputElement){let i=t.checked;this.setting==="showNameTags"?this.dispatchEvent(new CustomEvent("setting-changed",{detail:{setting:this.setting,value:i},bubbles:!0})):Jt.instance.alterGlobalSettings({[this.setting]:i})}}render(){return Wt`<setting-item header=${this.header} description=${this.description}>
1361
+ `],n([Ne({type:String})],I.prototype,"header",2),n([Ne({type:String})],I.prototype,"description",2),I=n([Kt("setting-item")],I);import{ForesightManager as Zt}from"js.foresight";var w=class extends qt{constructor(){super(...arguments);this.isChecked=!1;this.header="";this.description="";this.setting="enableMousePrediction"}handleCheckboxChange(e){let t=e.target;if(t instanceof HTMLInputElement){let i=t.checked;this.setting==="showNameTags"?this.dispatchEvent(new CustomEvent("setting-changed",{detail:{setting:this.setting,value:i},bubbles:!0})):Zt.instance.alterGlobalSettings({[this.setting]:i})}}render(){return Yt`<setting-item header=${this.header} description=${this.description}>
1310
1362
  <input
1311
1363
  slot="controls"
1312
1364
  type="checkbox"
1313
1365
  .checked=${this.isChecked}
1314
1366
  @change=${this.handleCheckboxChange}
1315
1367
  />
1316
- </setting-item>`}};y.styles=[qt`
1368
+ </setting-item>`}};w.styles=[Jt`
1317
1369
  input[type="checkbox"] {
1318
1370
  appearance: none;
1319
1371
  -webkit-appearance: none;
@@ -1356,7 +1408,7 @@ Consider using 'Control Panel' only for better performance."
1356
1408
  input[type="checkbox"]:hover {
1357
1409
  box-shadow: 0 0 0 3px rgba(176, 196, 222, 0.1);
1358
1410
  }
1359
- `],n([J({type:Boolean})],y.prototype,"isChecked",2),n([J({type:String})],y.prototype,"header",2),n([J({type:String})],y.prototype,"description",2),n([J({type:String})],y.prototype,"setting",2),y=n([Yt("setting-item-checkbox")],y);import{LitElement as Xt,html as Zt,css as Qt}from"lit";import{customElement as en,property as _,state as tn}from"lit/decorators.js";import{ForesightManager as nn}from"js.foresight";var g=class extends Xt{constructor(){super(...arguments);this.minValue=0;this.maxValue=100;this.currentValue=50;this.unit="px";this.header="";this.description="";this.setting="tabOffset";this.displayValue=50}handleRangeInput(e){let t=e.target;t instanceof HTMLInputElement&&(this.displayValue=parseInt(t.value,10))}handleRangeChange(e){let t=e.target;if(t instanceof HTMLInputElement){let i=parseInt(t.value,10);this.displayValue=i,nn.instance.alterGlobalSettings({[this.setting]:i})}}willUpdate(e){super.willUpdate(e),e.has("currentValue")&&(this.displayValue=this.currentValue)}render(){return Zt`<setting-item header=${this.header} description=${this.description}>
1411
+ `],n([Z({type:Boolean})],w.prototype,"isChecked",2),n([Z({type:String})],w.prototype,"header",2),n([Z({type:String})],w.prototype,"description",2),n([Z({type:String})],w.prototype,"setting",2),w=n([Xt("setting-item-checkbox")],w);import{LitElement as Qt,html as en,css as tn}from"lit";import{customElement as nn,property as O,state as on}from"lit/decorators.js";import{ForesightManager as an}from"js.foresight";var p=class extends Qt{constructor(){super(...arguments);this.minValue=0;this.maxValue=100;this.currentValue=50;this.unit="px";this.header="";this.description="";this.setting="tabOffset";this.displayValue=50}handleRangeInput(e){let t=e.target;t instanceof HTMLInputElement&&(this.displayValue=parseInt(t.value,10))}handleRangeChange(e){let t=e.target;if(t instanceof HTMLInputElement){let i=parseInt(t.value,10);this.displayValue=i,an.instance.alterGlobalSettings({[this.setting]:i})}}willUpdate(e){super.willUpdate(e),e.has("currentValue")&&(this.displayValue=this.currentValue)}render(){return en`<setting-item header=${this.header} description=${this.description}>
1360
1412
  <div slot="controls" class="range-wrapper">
1361
1413
  <input
1362
1414
  slot="controls"
@@ -1370,7 +1422,7 @@ Consider using 'Control Panel' only for better performance."
1370
1422
  />
1371
1423
  <span class="setting-range-value">${this.displayValue} ${this.unit}</span>
1372
1424
  </div>
1373
- </setting-item>`}};g.styles=[Qt`
1425
+ </setting-item>`}};p.styles=[tn`
1374
1426
  .setting-range-value {
1375
1427
  font-size: 12px;
1376
1428
  color: #b0c4de;
@@ -1439,14 +1491,14 @@ Consider using 'Control Panel' only for better performance."
1439
1491
  transform: scale(1.1);
1440
1492
  box-shadow: 0 0 0 4px rgba(176, 196, 222, 0.2);
1441
1493
  }
1442
- `],n([_({type:Number})],g.prototype,"minValue",2),n([_({type:Number})],g.prototype,"maxValue",2),n([_({type:Number})],g.prototype,"currentValue",2),n([_({type:String})],g.prototype,"unit",2),n([_({type:String})],g.prototype,"header",2),n([_({type:String})],g.prototype,"description",2),n([_({type:String})],g.prototype,"setting",2),n([tn()],g.prototype,"displayValue",2),g=n([en("setting-item-range")],g);var x=class extends hn{constructor(){super();this.changedSettings=[];this._abortController=null;let e=l.instance.devtoolsSettings,t=Ue.instance.getManagerData.globalSettings;this.devtoolsSettings=Object.assign({},e),this.managerSettings=Object.assign({},t),this.initialSettings={devtools:Object.assign({},e),manager:Object.assign({},t)}}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;Ue.instance.addEventListener("managerSettingsChanged",t=>{this.managerSettings=t.managerData.globalSettings,this._updateChangedSettings()},{signal:e}),this._updateChangedSettings()}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}_updateChangedSettings(){let e=[];this._checkManagerSettingsChanges(e),this._checkDevtoolsSettingsChanges(e),this.changedSettings=e}_checkManagerSettingsChanges(e){let t=["enableMousePrediction","enableTabPrediction","enableScrollPrediction","trajectoryPredictionTime","positionHistorySize","tabOffset","scrollMargin"];for(let i of t){let a=this.initialSettings.manager[i],r=this.managerSettings[i];a!==r&&e.push({setting:i,oldValue:a,newValue:r})}}_checkDevtoolsSettingsChanges(e){let t=["showNameTags"];for(let i of t){let a=this.initialSettings.devtools[i],r=this.devtoolsSettings[i];a!==r&&e.push({setting:i,oldValue:a,newValue:r})}}_handleDevtoolsSettingChange(e){let{setting:t,value:i}=e.detail;t==="showNameTags"&&(this.devtoolsSettings={...this.devtoolsSettings,showNameTags:i},l.instance.alterDevtoolsSettings({showNameTags:i}),this._updateChangedSettings())}async handleCopySettings(){if(this.managerSettings)try{let e=this.generateSettingsCode(this.managerSettings);navigator.clipboard&&navigator.clipboard.writeText&&await navigator.clipboard.writeText(e)}catch(e){console.error("Failed to copy settings code:",e)}}generateSettingsCode(e){let t={enableMousePrediction:e.enableMousePrediction,enableTabPrediction:e.enableTabPrediction,enableScrollPrediction:e.enableScrollPrediction,positionHistorySize:e.positionHistorySize,trajectoryPredictionTime:e.trajectoryPredictionTime,tabOffset:e.tabOffset,scrollMargin:e.scrollMargin};return`ForesightManager.initialize(${JSON.stringify(t,null,2)})`}render(){if(!this.managerSettings||!this.devtoolsSettings)return Ne`<tab-content
1494
+ `],n([O({type:Number})],p.prototype,"minValue",2),n([O({type:Number})],p.prototype,"maxValue",2),n([O({type:Number})],p.prototype,"currentValue",2),n([O({type:String})],p.prototype,"unit",2),n([O({type:String})],p.prototype,"header",2),n([O({type:String})],p.prototype,"description",2),n([O({type:String})],p.prototype,"setting",2),n([on()],p.prototype,"displayValue",2),p=n([nn("setting-item-range")],p);var f=class extends vn{constructor(){super();this.changedSettings=[];this.touchDeviceStrategyOptions=[{value:"onTouchStart",label:"On Touch Start",title:"Execute callbacks when user touches registered elements",icon:W`<span>Touch</span>`},{value:"viewport",label:"Viewport Entry",title:"Execute callbacks when registered elements enter the viewport",icon:W`<span>Viewport</span>`},{value:"none",label:"None",title:"Disable touch device prediction",icon:W`<span>None</span>`}];this._abortController=null;this._handleTouchDeviceStrategyChange=e=>{ae.instance.alterGlobalSettings({touchDeviceStrategy:e})};let e=l.instance.devtoolsSettings,t=ae.instance.getManagerData.globalSettings;this.devtoolsSettings=Object.assign({},e),this.managerSettings=Object.assign({},t),this.initialSettings={devtools:Object.assign({},e),manager:Object.assign({},t)}}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;ae.instance.addEventListener("managerSettingsChanged",t=>{this.managerSettings=t.managerData.globalSettings,this._updateChangedSettings()},{signal:e}),this._updateChangedSettings()}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}_updateChangedSettings(){let e=[];this._checkManagerSettingsChanges(e),this._checkDevtoolsSettingsChanges(e),this.changedSettings=e}_checkManagerSettingsChanges(e){let t=["enableMousePrediction","enableTabPrediction","enableScrollPrediction","trajectoryPredictionTime","positionHistorySize","tabOffset","scrollMargin","touchDeviceStrategy"];for(let i of t){let a=this.initialSettings.manager[i],s=this.managerSettings[i];a!==s&&e.push({setting:i,oldValue:a,newValue:s})}}_checkDevtoolsSettingsChanges(e){let t=["showNameTags"];for(let i of t){let a=this.initialSettings.devtools[i],s=this.devtoolsSettings[i];a!==s&&e.push({setting:i,oldValue:a,newValue:s})}}_handleDevtoolsSettingChange(e){let{setting:t,value:i}=e.detail;t==="showNameTags"&&(this.devtoolsSettings={...this.devtoolsSettings,showNameTags:i},l.instance.alterDevtoolsSettings({showNameTags:i}),this._updateChangedSettings())}async handleCopySettings(){if(this.managerSettings)try{let e=this.generateSettingsCode(this.managerSettings);navigator.clipboard&&navigator.clipboard.writeText&&await navigator.clipboard.writeText(e)}catch(e){console.error("Failed to copy settings code:",e)}}generateSettingsCode(e){let t={enableMousePrediction:e.enableMousePrediction,enableTabPrediction:e.enableTabPrediction,enableScrollPrediction:e.enableScrollPrediction,positionHistorySize:e.positionHistorySize,trajectoryPredictionTime:e.trajectoryPredictionTime,tabOffset:e.tabOffset,scrollMargin:e.scrollMargin,touchDeviceStrategy:e.touchDeviceStrategy};return`ForesightManager.initialize(${JSON.stringify(t,null,2)})`}render(){if(!this.managerSettings||!this.devtoolsSettings)return W`<tab-content
1443
1495
  .noContentMessage=${"Loading settings..."}
1444
1496
  .hasContent=${!1}
1445
1497
  ></tab-content>`;let e=this.managerSettings,t=this.changedSettings.length>0?`Settings that have been changed this session compared to your initialized settings.
1446
1498
  Click on the copy icon to easely copy the new setting into your project
1447
1499
 
1448
1500
  `+this.changedSettings.map(i=>`${i.setting}: ${JSON.stringify(i.oldValue)} -> ${JSON.stringify(i.newValue)}`).join(`
1449
- `):"No settings changed from initial values";return Ne`
1501
+ `):"No settings changed from initial values";return W`
1450
1502
  <tab-header>
1451
1503
  <div slot="chips" class="chips-container">
1452
1504
  <chip-element .title=${t}> ${this.changedSettings.length} changed </chip-element>
@@ -1474,7 +1526,7 @@ Click on the copy icon to easely copy the new setting into your project
1474
1526
  .currentValue=${e.trajectoryPredictionTime}
1475
1527
  .maxValue=${200}
1476
1528
  .minValue=${10}
1477
- .unit=${Oe}
1529
+ .unit=${"ms"}
1478
1530
  header="Prediction Time"
1479
1531
  description="How far into the future to calculate mouse trajectory path"
1480
1532
  setting="trajectoryPredictionTime"
@@ -1483,9 +1535,9 @@ Click on the copy icon to easely copy the new setting into your project
1483
1535
  .currentValue=${e.positionHistorySize}
1484
1536
  .maxValue=${30}
1485
1537
  .minValue=${2}
1486
- .unit=${te}
1538
+ .unit=${oe}
1487
1539
  header="Position History Size"
1488
- description="How far into the future, in ${te}, to calculate mouse trajectory path"
1540
+ description="How far into the future, in ${oe}, to calculate mouse trajectory path"
1489
1541
  setting="positionHistorySize"
1490
1542
  >
1491
1543
  </setting-item-range>
@@ -1503,7 +1555,7 @@ Click on the copy icon to easely copy the new setting into your project
1503
1555
  .currentValue=${e.tabOffset}
1504
1556
  .maxValue=${20}
1505
1557
  .minValue=${0}
1506
- .unit=${_e}
1558
+ .unit=${Ue}
1507
1559
  header="Tab Offset"
1508
1560
  description="Number of tabbable elements to look ahead when predicting navigation"
1509
1561
  setting="tabOffset"
@@ -1523,13 +1575,28 @@ Click on the copy icon to easely copy the new setting into your project
1523
1575
  .currentValue=${e.scrollMargin}
1524
1576
  .maxValue=${300}
1525
1577
  .minValue=${30}
1526
- .unit=${Ie}
1578
+ .unit=${"px"}
1527
1579
  header="Scroll Margin"
1528
1580
  description="Pixel distance to check from mouse position in scroll direction"
1529
1581
  setting="scrollMargin"
1530
1582
  ></setting-item-range>
1531
1583
  </div>
1532
1584
 
1585
+ <div class="settings-group">
1586
+ <h4>Touch Device</h4>
1587
+ <setting-item
1588
+ header="Touch Device Strategy"
1589
+ description="How to handle prediction on touch devices"
1590
+ >
1591
+ <single-select-dropdown
1592
+ slot="controls"
1593
+ .dropdownOptions=${this.touchDeviceStrategyOptions}
1594
+ .selectedOptionValue=${e.touchDeviceStrategy}
1595
+ .onSelectionChange=${this._handleTouchDeviceStrategyChange}
1596
+ ></single-select-dropdown>
1597
+ </setting-item>
1598
+ </div>
1599
+
1533
1600
  <!-- Developer Tools Group -->
1534
1601
  <div class="settings-group">
1535
1602
  <h4>Developer Tools</h4>
@@ -1544,7 +1611,7 @@ Click on the copy icon to easely copy the new setting into your project
1544
1611
  </div>
1545
1612
  </div>
1546
1613
  </tab-content>
1547
- `}};x.styles=gn`
1614
+ `}};f.styles=bn`
1548
1615
  :host {
1549
1616
  display: flex;
1550
1617
  flex-direction: column;
@@ -1575,7 +1642,7 @@ Click on the copy icon to easely copy the new setting into your project
1575
1642
  border-bottom: 1px solid rgba(176, 196, 222, 0.2);
1576
1643
  padding-bottom: 8px;
1577
1644
  }
1578
- `,n([X()],x.prototype,"managerSettings",2),n([X()],x.prototype,"initialSettings",2),n([X()],x.prototype,"devtoolsSettings",2),n([X()],x.prototype,"changedSettings",2),x=n([mn("settings-tab")],x);var O=class extends un{constructor(){super();this.isMinimized=l.instance.devtoolsSettings.isControlPanelDefaultMinimized;this.localStorageSelectedTabKey="foresight-devtools-control-panel-tab";this.activeTab=this.getStoredTab()}getStoredTab(){try{return localStorage.getItem(this.localStorageSelectedTabKey)||"logs"}catch(e){return console.error(e),"logs"}}_handleTabChange(e){this.activeTab=e.detail.tab,this.setStoredTab(this.activeTab)}setStoredTab(e){try{localStorage.setItem(this.localStorageSelectedTabKey,e)}catch(t){console.warn("ForesightDevtools: Failed to save tab preference to localStorage:",t)}}render(){return vn`
1645
+ `,n([K()],f.prototype,"managerSettings",2),n([K()],f.prototype,"initialSettings",2),n([K()],f.prototype,"devtoolsSettings",2),n([K()],f.prototype,"changedSettings",2),n([K()],f.prototype,"touchDeviceStrategyOptions",2),f=n([fn("settings-tab")],f);var x=class extends yn{constructor(){super();this.isMinimized=l.instance.devtoolsSettings.isControlPanelDefaultMinimized;this.isTouchDevice=!1;this.isWarningDismissed=!1;this.localStorageSelectedTabKey="foresight-devtools-control-panel-tab";this._abortController=null;this.activeTab=this.getStoredTab(),this.isTouchDevice=Ae.instance.getManagerData.currentDeviceStrategy==="touch"}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;Ae.instance.addEventListener("deviceStrategyChanged",t=>{this.isTouchDevice=t.newStrategy==="touch",t.newStrategy==="touch"&&(this.isWarningDismissed=!1)},{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}getStoredTab(){try{return localStorage.getItem(this.localStorageSelectedTabKey)||"logs"}catch(e){return console.error(e),"logs"}}_handleTabChange(e){this.activeTab=e.detail.tab,this.setStoredTab(this.activeTab)}setStoredTab(e){try{localStorage.setItem(this.localStorageSelectedTabKey,e)}catch(t){console.warn("ForesightDevtools: Failed to save tab preference to localStorage:",t)}}dismissWarning(){this.isWarningDismissed=!0}render(){return xn`
1579
1646
  <div class="control-wrapper ${this.isMinimized?"minimized":""}">
1580
1647
  <div class="title-wrapper">
1581
1648
  <button @click="${()=>this.isMinimized=!this.isMinimized}" class="minimize-button">
@@ -1585,6 +1652,18 @@ Click on the copy icon to easely copy the new setting into your project
1585
1652
  <div></div>
1586
1653
  </div>
1587
1654
 
1655
+ <div
1656
+ class="touch-device-warning ${this.isMinimized||!this.isTouchDevice||this.isWarningDismissed?"hidden":""}"
1657
+ >
1658
+ <div class="warning-content">
1659
+ <span class="warning-icon">⚠️</span>
1660
+ <span>Touch device mode: Overlays and visibility sorting not available</span>
1661
+ </div>
1662
+ <button @click="${this.dismissWarning}" class="dismiss-button" title="Dismiss warning">
1663
+ ×
1664
+ </button>
1665
+ </div>
1666
+
1588
1667
  <div class="tab-container ${this.isMinimized?"hidden":""}">
1589
1668
  <tab-selector
1590
1669
  .activeTab="${this.activeTab}"
@@ -1592,15 +1671,15 @@ Click on the copy icon to easely copy the new setting into your project
1592
1671
  ></tab-selector>
1593
1672
 
1594
1673
  <div class="tab-content">
1595
- <log-tab class=${ne({active:this.activeTab==="logs"})}></log-tab>
1596
- <element-tab class=${ne({active:this.activeTab==="elements"})}></element-tab>
1674
+ <log-tab class=${re({active:this.activeTab==="logs"})}></log-tab>
1675
+ <element-tab class=${re({active:this.activeTab==="elements"})}></element-tab>
1597
1676
  <settings-tab
1598
- class=${ne({active:this.activeTab==="settings"})}
1677
+ class=${re({active:this.activeTab==="settings"})}
1599
1678
  ></settings-tab>
1600
1679
  </div>
1601
1680
  </div>
1602
1681
  </div>
1603
- `}};O.styles=bn`
1682
+ `}};x.styles=wn`
1604
1683
  .control-wrapper {
1605
1684
  padding: 12px;
1606
1685
  position: fixed;
@@ -1675,7 +1754,51 @@ Click on the copy icon to easely copy the new setting into your project
1675
1754
  width: 100%;
1676
1755
  height: 100%;
1677
1756
  }
1678
- `,n([Fe()],O.prototype,"activeTab",2),n([Fe()],O.prototype,"isMinimized",2),O=n([fn("control-panel")],O);import{LitElement as Pn,css as Un,html as Nn}from"lit";import{customElement as Fn}from"lit/decorators.js";import{LitElement as yn,html as xn,css as wn}from"lit";import{customElement as kn,state as Ve,query as En}from"lit/decorators.js";import{ForesightManager as V}from"js.foresight";var C=class extends yn{constructor(){super(...arguments);this.overlayMap=new Map;this.callbackAnimations=new Map;this._abortController=null}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;V.instance.addEventListener("elementRegistered",t=>{t.elementData.isIntersectingWithViewport&&this.createOrUpdateElementOverlay(t.elementData)},{signal:e}),V.instance.addEventListener("elementUnregistered",t=>{this.removeElementOverlay(t.elementData)},{signal:e}),V.instance.addEventListener("elementReactivated",t=>{t.elementData.isIntersectingWithViewport&&this.createOrUpdateElementOverlay(t.elementData)},{signal:e}),V.instance.addEventListener("elementDataUpdated",t=>{t.updatedProps.includes("bounds")&&t.elementData.callbackInfo.isCallbackActive&&this.createOrUpdateElementOverlay(t.elementData),t.updatedProps.includes("visibility")&&(t.elementData.isIntersectingWithViewport||this.removeElementOverlay(t.elementData))},{signal:e}),V.instance.addEventListener("callbackInvoked",t=>{this.highlightElementCallback(t.elementData,t.hitType)},{signal:e}),V.instance.addEventListener("callbackCompleted",t=>{this.unhighlightElementCallback(t.elementData),this.removeElementOverlay(t.elementData)},{signal:e}),document.addEventListener("showNameTagsChanged",t=>{let i=t;this.updateNameTagVisibility(i.detail.showNameTags)},{signal:e})}createElementOverlays(e){let t=document.createElement("div");t.className="expanded-overlay";let i=document.createElement("div");i.className="name-label",this.containerElement.appendChild(t),this.containerElement.appendChild(i);let a={expandedOverlay:t,nameLabel:i};return this.overlayMap.set(e.element,a),a}updateElementOverlays(e,t){let{expandedOverlay:i,nameLabel:a}=e,{expandedRect:r}=t.elementBounds,p=r.right-r.left,K=r.bottom-r.top;i.style.width=`${p}px`,i.style.height=`${K}px`,i.style.transform=`translate3d(${r.left}px, ${r.top}px, 0)`,l.instance.devtoolsSettings.showNameTags?(a.textContent=t.name,a.style.display="block",a.style.transform=`translate3d(${r.left}px, ${r.top-25}px, 0)`):a.style.display="none"}createOrUpdateElementOverlay(e){let t=this.overlayMap.get(e.element);t||(t=this.createElementOverlays(e)),this.updateElementOverlays(t,e)}removeElementOverlay(e){let t=this.overlayMap.get(e.element);t&&(t.expandedOverlay.remove(),t.nameLabel.remove(),this.overlayMap.delete(e.element)),this.clearCallbackAnimationTimeout(e.element)}clearCallbackAnimationTimeout(e){let t=this.callbackAnimations.get(e);t&&(clearTimeout(t.timeoutId),this.callbackAnimations.delete(e))}highlightElementCallback(e,t){let i=this.overlayMap.get(e.element);if(i)switch(this.clearCallbackAnimationTimeout(e.element),t.kind){case"mouse":i.expandedOverlay.classList.add("invoked-by-mouse");break;case"scroll":i.expandedOverlay.classList.add("invoked-by-scroll");break;case"tab":i.expandedOverlay.classList.add("invoked-by-tab");break;default:}}unhighlightElementCallback(e){let t=this.overlayMap.get(e.element);if(!t)return;let i=setTimeout(()=>{t.expandedOverlay.classList.remove("callback-invoked"),this.callbackAnimations.delete(e.element)},400);this.callbackAnimations.set(e.element,{element:e.element,timeoutId:i})}updateNameTagVisibility(e){this.overlayMap.forEach(t=>{let i=t.nameLabel;e?i.style.display="block":i.style.display="none"})}disconnectedCallback(){super.disconnectedCallback(),this.callbackAnimations.forEach(e=>{clearTimeout(e.timeoutId)}),this.callbackAnimations.clear(),this.overlayMap.clear(),this._abortController?.abort(),this._abortController=null}render(){return xn` <div id="overlays-container"></div> `}};C.styles=[wn`
1757
+
1758
+ .touch-device-warning {
1759
+ background-color: rgba(255, 193, 7, 0.9);
1760
+ color: #000;
1761
+ padding: 8px 12px;
1762
+ margin: 8px 0;
1763
+ border-radius: 4px;
1764
+ font-size: 12px;
1765
+ font-weight: 500;
1766
+ display: flex;
1767
+ align-items: center;
1768
+ justify-content: space-between;
1769
+ gap: 8px;
1770
+ }
1771
+
1772
+ .touch-device-warning.hidden {
1773
+ display: none;
1774
+ }
1775
+
1776
+ .warning-content {
1777
+ display: flex;
1778
+ align-items: center;
1779
+ gap: 8px;
1780
+ }
1781
+
1782
+ .warning-icon {
1783
+ font-weight: bold;
1784
+ font-size: 14px;
1785
+ }
1786
+
1787
+ .dismiss-button {
1788
+ background: none;
1789
+ border: none;
1790
+ color: #000;
1791
+ font-size: 16px;
1792
+ cursor: pointer;
1793
+ padding: 0;
1794
+ line-height: 1;
1795
+ font-weight: bold;
1796
+ }
1797
+
1798
+ .dismiss-button:hover {
1799
+ opacity: 0.7;
1800
+ }
1801
+ `,n([Q()],x.prototype,"activeTab",2),n([Q()],x.prototype,"isMinimized",2),n([Q()],x.prototype,"isTouchDevice",2),n([Q()],x.prototype,"isWarningDismissed",2),x=n([kn("control-panel")],x);import{LitElement as jn,css as Vn,html as Ve}from"lit";import{customElement as Rn,state as Fn}from"lit/decorators.js";import{LitElement as En,html as Cn,css as Sn}from"lit";import{customElement as Tn,state as je,query as Dn}from"lit/decorators.js";import{ForesightManager as V}from"js.foresight";var S=class extends En{constructor(){super(...arguments);this.overlayMap=new Map;this.callbackAnimations=new Map;this._abortController=null}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;V.instance.addEventListener("elementRegistered",t=>{t.elementData.isIntersectingWithViewport&&this.createOrUpdateElementOverlay(t.elementData)},{signal:e}),V.instance.addEventListener("elementUnregistered",t=>{this.removeElementOverlay(t.elementData)},{signal:e}),V.instance.addEventListener("elementReactivated",t=>{t.elementData.isIntersectingWithViewport&&this.createOrUpdateElementOverlay(t.elementData)},{signal:e}),V.instance.addEventListener("elementDataUpdated",t=>{t.updatedProps.includes("bounds")&&t.elementData.callbackInfo.isCallbackActive&&this.createOrUpdateElementOverlay(t.elementData),t.updatedProps.includes("visibility")&&(t.elementData.isIntersectingWithViewport||this.removeElementOverlay(t.elementData))},{signal:e}),V.instance.addEventListener("callbackInvoked",t=>{this.highlightElementCallback(t.elementData,t.hitType)},{signal:e}),V.instance.addEventListener("callbackCompleted",t=>{this.unhighlightElementCallback(t.elementData),this.removeElementOverlay(t.elementData)},{signal:e}),document.addEventListener("showNameTagsChanged",t=>{let i=t;this.updateNameTagVisibility(i.detail.showNameTags)},{signal:e})}createElementOverlays(e){let t=document.createElement("div");t.className="expanded-overlay";let i=document.createElement("div");i.className="name-label",this.containerElement.appendChild(t),this.containerElement.appendChild(i);let a={expandedOverlay:t,nameLabel:i};return this.overlayMap.set(e.element,a),a}updateElementOverlays(e,t){let{expandedOverlay:i,nameLabel:a}=e,{expandedRect:s}=t.elementBounds,d=s.right-s.left,q=s.bottom-s.top;i.style.width=`${d}px`,i.style.height=`${q}px`,i.style.transform=`translate3d(${s.left}px, ${s.top}px, 0)`,l.instance.devtoolsSettings.showNameTags?(a.textContent=t.name,a.style.display="block",a.style.transform=`translate3d(${s.left}px, ${s.top-25}px, 0)`):a.style.display="none"}createOrUpdateElementOverlay(e){let t=this.overlayMap.get(e.element);t||(t=this.createElementOverlays(e)),this.updateElementOverlays(t,e)}removeElementOverlay(e){let t=this.overlayMap.get(e.element);t&&(t.expandedOverlay.remove(),t.nameLabel.remove(),this.overlayMap.delete(e.element)),this.clearCallbackAnimationTimeout(e.element)}clearCallbackAnimationTimeout(e){let t=this.callbackAnimations.get(e);t&&(clearTimeout(t.timeoutId),this.callbackAnimations.delete(e))}highlightElementCallback(e,t){let i=this.overlayMap.get(e.element);if(i)switch(this.clearCallbackAnimationTimeout(e.element),t.kind){case"mouse":i.expandedOverlay.classList.add("invoked-by-mouse");break;case"scroll":i.expandedOverlay.classList.add("invoked-by-scroll");break;case"tab":i.expandedOverlay.classList.add("invoked-by-tab");break;case"touch":break;case"viewport":break;default:}}unhighlightElementCallback(e){let t=this.overlayMap.get(e.element);if(!t)return;let i=setTimeout(()=>{t.expandedOverlay.classList.remove("callback-invoked"),this.callbackAnimations.delete(e.element)},400);this.callbackAnimations.set(e.element,{element:e.element,timeoutId:i})}updateNameTagVisibility(e){this.overlayMap.forEach(t=>{let i=t.nameLabel;e?i.style.display="block":i.style.display="none"})}disconnectedCallback(){super.disconnectedCallback(),this.callbackAnimations.forEach(e=>{clearTimeout(e.timeoutId)}),this.callbackAnimations.clear(),this.overlayMap.clear(),this._abortController?.abort(),this._abortController=null}render(){return Cn` <div id="overlays-container"></div> `}};S.styles=[Sn`
1679
1802
  :host {
1680
1803
  position: fixed;
1681
1804
  top: 0;
@@ -1742,7 +1865,7 @@ Click on the copy icon to easely copy the new setting into your project
1742
1865
  white-space: nowrap;
1743
1866
  pointer-events: none;
1744
1867
  }
1745
- `],n([Ve()],C.prototype,"overlayMap",2),n([Ve()],C.prototype,"callbackAnimations",2),n([En("#overlays-container")],C.prototype,"containerElement",2),C=n([kn("element-overlays")],C);import{LitElement as Cn,html as Sn,css as Tn}from"lit";import{customElement as Dn,state as ie}from"lit/decorators.js";import{styleMap as Mn}from"lit/directives/style-map.js";import{ForesightManager as B}from"js.foresight";var S=class extends Cn{constructor(){super(...arguments);this._abortController=new AbortController;this._mousePredictionIsEnabled=B.instance.getManagerData.globalSettings.enableMousePrediction;this._isVisible=!1;this._trajectoryStyles={};this.handleElementUnregistered=e=>{e.wasLastElement&&(this._isVisible=!1,this._trajectoryStyles={transform:"translate3d(0px, 0px, 0) rotate(0deg)",width:"0px"})};this.handleSettingsChange=e=>{let t=e.managerData.globalSettings.enableMousePrediction;this._mousePredictionIsEnabled=t,t||(this._isVisible=!1),this.requestUpdate()};this.handleTrajectoryUpdate=e=>{if(!this._mousePredictionIsEnabled)return;this._isVisible=!0;let{currentPoint:t,predictedPoint:i}=e.trajectoryPositions,a=i.x-t.x,r=i.y-t.y,p=Math.sqrt(a*a+r*r),K=Math.atan2(r,a)*57.29577951308232;this._trajectoryStyles={transform:`translate3d(${t.x}px, ${t.y}px, 0) rotate(${K}deg)`,width:`${p}px`}}}connectedCallback(){super.connectedCallback();let{signal:e}=this._abortController;B.instance.addEventListener("mouseTrajectoryUpdate",this.handleTrajectoryUpdate,{signal:e}),B.instance.addEventListener("elementUnregistered",this.handleElementUnregistered,{signal:e}),B.instance.addEventListener("scrollTrajectoryUpdate",()=>{this._isVisible=!1},{signal:e}),B.instance.addEventListener("managerSettingsChanged",this.handleSettingsChange,{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController.abort()}render(){let e={display:this._isVisible?"block":"none",...this._trajectoryStyles};return Sn` <div class="trajectory-line" style=${Mn(e)}></div> `}};S.styles=[Tn`
1868
+ `],n([je()],S.prototype,"overlayMap",2),n([je()],S.prototype,"callbackAnimations",2),n([Dn("#overlays-container")],S.prototype,"containerElement",2),S=n([Tn("element-overlays")],S);import{LitElement as Mn,html as Ln,css as $n}from"lit";import{customElement as _n,state as se}from"lit/decorators.js";import{styleMap as In}from"lit/directives/style-map.js";import{ForesightManager as R}from"js.foresight";var T=class extends Mn{constructor(){super(...arguments);this._abortController=new AbortController;this._mousePredictionIsEnabled=R.instance.getManagerData.globalSettings.enableMousePrediction;this._isVisible=!1;this._trajectoryStyles={};this.handleTrajectoryReset=e=>{("wasLastActiveElement"in e&&e.wasLastActiveElement||"wasLastRegisteredElement"in e&&e.wasLastRegisteredElement)&&(this._isVisible=!1,this._trajectoryStyles={transform:"translate3d(0px, 0px, 0) rotate(0deg)",width:"0px"})};this.handleSettingsChange=e=>{let t=e.managerData.globalSettings.enableMousePrediction;this._mousePredictionIsEnabled=t,t||(this._isVisible=!1),this.requestUpdate()};this.handleTrajectoryUpdate=e=>{if(!this._mousePredictionIsEnabled)return;this._isVisible=!0;let{currentPoint:t,predictedPoint:i}=e.trajectoryPositions,a=i.x-t.x,s=i.y-t.y,d=Math.sqrt(a*a+s*s),q=Math.atan2(s,a)*57.29577951308232;this._trajectoryStyles={transform:`translate3d(${t.x}px, ${t.y}px, 0) rotate(${q}deg)`,width:`${d}px`}}}connectedCallback(){super.connectedCallback();let{signal:e}=this._abortController;R.instance.addEventListener("callbackCompleted",this.handleTrajectoryReset,{signal:e}),R.instance.addEventListener("elementUnregistered",this.handleTrajectoryReset,{signal:e}),R.instance.addEventListener("mouseTrajectoryUpdate",this.handleTrajectoryUpdate,{signal:e}),R.instance.addEventListener("scrollTrajectoryUpdate",()=>{this._isVisible=!1},{signal:e}),R.instance.addEventListener("managerSettingsChanged",this.handleSettingsChange,{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController.abort()}render(){let e={display:this._isVisible?"block":"none",...this._trajectoryStyles};return Ln` <div class="trajectory-line" style=${In(e)}></div> `}};T.styles=[$n`
1746
1869
  :host {
1747
1870
  display: block;
1748
1871
  }
@@ -1773,7 +1896,7 @@ Click on the copy icon to easely copy the new setting into your project
1773
1896
  border-bottom: 4px solid transparent;
1774
1897
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.6));
1775
1898
  }
1776
- `],n([ie()],S.prototype,"_mousePredictionIsEnabled",2),n([ie()],S.prototype,"_isVisible",2),n([ie()],S.prototype,"_trajectoryStyles",2),S=n([Dn("mouse-trajectory")],S);import{LitElement as Ln,html as $n,css as In}from"lit";import{customElement as _n,state as Z}from"lit/decorators.js";import{styleMap as On}from"lit/directives/style-map.js";import{ForesightManager as A}from"js.foresight";var w=class extends Ln{constructor(){super(...arguments);this._abortController=new AbortController;this._scrollPredictionIsEnabled=A.instance.getManagerData.globalSettings.enableScrollPrediction;this._scrollMargin=A.instance.getManagerData.globalSettings.scrollMargin;this._isVisible=!1;this._trajectoryStyles={};this._isUpdateScheduled=!1;this._latestScrollTrajectory=null;this.handleElementUnregistered=e=>{e.wasLastElement&&(this._isVisible=!1)};this.handleSettingsChange=e=>{let t=e.managerData.globalSettings.enableScrollPrediction;this._scrollPredictionIsEnabled=t,t||(this._isVisible=!1);let i=e.updatedSettings.find(a=>a.setting==="scrollMargin");i&&(this._scrollMargin=i.newValue)};this.handleScrollUpdate=e=>{this._scrollPredictionIsEnabled&&(this._isVisible=!0,this._latestScrollTrajectory={currentPoint:e.currentPoint,predictedPoint:e.predictedPoint},this._isUpdateScheduled||(this._isUpdateScheduled=!0,requestAnimationFrame(this.renderScrollTrajectory)))};this.renderScrollTrajectory=()=>{if(!this._latestScrollTrajectory){this._isUpdateScheduled=!1;return}let{currentPoint:e,predictedPoint:t}=this._latestScrollTrajectory,i=t.x-e.x,a=t.y-e.y,r=Math.atan2(a,i)*180/Math.PI;this._trajectoryStyles={transform:`translate(${e.x}px, ${e.y}px) rotate(${r}deg)`},this._isUpdateScheduled=!1,this.requestUpdate()}}connectedCallback(){super.connectedCallback();let{signal:e}=this._abortController;A.instance.addEventListener("scrollTrajectoryUpdate",this.handleScrollUpdate,{signal:e}),A.instance.addEventListener("mouseTrajectoryUpdate",()=>{this._isVisible=!1},{signal:e}),A.instance.addEventListener("elementUnregistered",this.handleElementUnregistered,{signal:e}),A.instance.addEventListener("managerSettingsChanged",this.handleSettingsChange,{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController.abort()}render(){let e={display:this._isVisible?"block":"none",width:`${this._scrollMargin}px`,...this._trajectoryStyles};return $n` <div class="scroll-trajectory-line" style=${On(e)}></div> `}};w.styles=[In`
1899
+ `],n([se()],T.prototype,"_mousePredictionIsEnabled",2),n([se()],T.prototype,"_isVisible",2),n([se()],T.prototype,"_trajectoryStyles",2),T=n([_n("mouse-trajectory")],T);import{LitElement as On,html as Pn,css as Un}from"lit";import{customElement as Nn,state as ee}from"lit/decorators.js";import{styleMap as An}from"lit/directives/style-map.js";import{ForesightManager as P}from"js.foresight";var k=class extends On{constructor(){super(...arguments);this._abortController=new AbortController;this._scrollPredictionIsEnabled=P.instance.getManagerData.globalSettings.enableScrollPrediction;this._scrollMargin=P.instance.getManagerData.globalSettings.scrollMargin;this._isVisible=!1;this._trajectoryStyles={};this._isUpdateScheduled=!1;this._latestScrollTrajectory=null;this.handleTrajectoryReset=e=>{("wasLastActiveElement"in e&&e.wasLastActiveElement||"wasLastRegisteredElement"in e&&e.wasLastRegisteredElement)&&(this._isVisible=!1,this._trajectoryStyles={transform:"translate(0px, 0px) rotate(0deg)"})};this.handleSettingsChange=e=>{let t=e.managerData.globalSettings.enableScrollPrediction;this._scrollPredictionIsEnabled=t,t||(this._isVisible=!1);let i=e.updatedSettings.find(a=>a.setting==="scrollMargin");i&&(this._scrollMargin=i.newValue)};this.handleScrollUpdate=e=>{this._scrollPredictionIsEnabled&&(this._isVisible=!0,this._latestScrollTrajectory={currentPoint:e.currentPoint,predictedPoint:e.predictedPoint},this._isUpdateScheduled||(this._isUpdateScheduled=!0,requestAnimationFrame(this.renderScrollTrajectory)))};this.renderScrollTrajectory=()=>{if(!this._latestScrollTrajectory){this._isUpdateScheduled=!1;return}let{currentPoint:e,predictedPoint:t}=this._latestScrollTrajectory,i=t.x-e.x,a=t.y-e.y,s=Math.atan2(a,i)*180/Math.PI;this._trajectoryStyles={transform:`translate(${e.x}px, ${e.y}px) rotate(${s}deg)`},this._isUpdateScheduled=!1,this.requestUpdate()}}connectedCallback(){super.connectedCallback();let{signal:e}=this._abortController;P.instance.addEventListener("scrollTrajectoryUpdate",this.handleScrollUpdate,{signal:e}),P.instance.addEventListener("mouseTrajectoryUpdate",()=>{this._isVisible=!1},{signal:e}),P.instance.addEventListener("callbackCompleted",this.handleTrajectoryReset,{signal:e}),P.instance.addEventListener("elementUnregistered",this.handleTrajectoryReset,{signal:e}),P.instance.addEventListener("managerSettingsChanged",this.handleSettingsChange,{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController.abort()}render(){let e={display:this._isVisible?"block":"none",width:`${this._scrollMargin}px`,...this._trajectoryStyles};return Pn` <div class="scroll-trajectory-line" style=${An(e)}></div> `}};k.styles=[Un`
1777
1900
  :host {
1778
1901
  display: block;
1779
1902
  }
@@ -1833,13 +1956,15 @@ Click on the copy icon to easely copy the new setting into your project
1833
1956
  filter: drop-shadow(0 0 12px rgba(234, 179, 8, 0.8));
1834
1957
  }
1835
1958
  }
1836
- `],n([Z()],w.prototype,"_scrollPredictionIsEnabled",2),n([Z()],w.prototype,"_scrollMargin",2),n([Z()],w.prototype,"_isVisible",2),n([Z()],w.prototype,"_trajectoryStyles",2),w=n([_n("scroll-trajectory")],w);var G=class extends Pn{render(){return Nn`
1959
+ `],n([ee()],k.prototype,"_scrollPredictionIsEnabled",2),n([ee()],k.prototype,"_scrollMargin",2),n([ee()],k.prototype,"_isVisible",2),n([ee()],k.prototype,"_trajectoryStyles",2),k=n([Nn("scroll-trajectory")],k);import{ForesightManager as Re}from"js.foresight";var F=class extends jn{constructor(){super(...arguments);this._abortController=null;this._strategy=Re.instance.getManagerData.currentDeviceStrategy;this.handleDeviceStrategyChange=e=>this._strategy=e.newStrategy}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;Re.instance.addEventListener("deviceStrategyChanged",this.handleDeviceStrategyChange,{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort()}render(){return Ve`
1837
1960
  <div id="overlay-container">
1838
- <mouse-trajectory></mouse-trajectory>
1839
- <scroll-trajectory></scroll-trajectory>
1840
- <element-overlays></element-overlays>
1961
+ ${this._strategy==="mouse"?Ve`
1962
+ <mouse-trajectory></mouse-trajectory>
1963
+ <scroll-trajectory></scroll-trajectory>
1964
+ <element-overlays></element-overlays>
1965
+ `:""}
1841
1966
  </div>
1842
- `}};G.styles=[Un`
1967
+ `}};F.styles=[Vn`
1843
1968
  :host {
1844
1969
  display: block;
1845
1970
  }
@@ -1850,8 +1975,8 @@ Click on the copy icon to easely copy the new setting into your project
1850
1975
  pointer-events: none;
1851
1976
  z-index: 9999;
1852
1977
  }
1853
- `],G=n([Fn("debug-overlay")],G);var l=class extends Vn{constructor(){super();this.isInitialized=!1;this.devtoolsSettings={showDebugger:!0,isControlPanelDefaultMinimized:!1,showNameTags:!0,sortElementList:"visibility",logging:{logLocation:"controlPanel",callbackCompleted:!0,elementReactivated:!0,callbackInvoked:!0,elementDataUpdated:!1,elementRegistered:!1,elementUnregistered:!1,managerSettingsChanged:!0,mouseTrajectoryUpdate:!1,scrollTrajectoryUpdate:!1}}}static createAndAppendInstance(){typeof window>"u"||typeof document>"u"||(l._instance=document.createElement("foresight-devtools"),document.body.appendChild(l._instance))}static initialize(e){if(l._instance||l.createAndAppendInstance(),!l._instance)return l._instance;let t=l._instance;return t.isInitialized=!0,t.alterDevtoolsSettings(e),t}static get instance(){return l._instance?l._instance:l.initialize()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}shouldUpdateSetting(e,t){return e!==void 0&&e!==t}updateLoggingSetting(e,t){this.shouldUpdateSetting(t,this.devtoolsSettings.logging[e])&&(this.devtoolsSettings.logging[e]=t)}alterDevtoolsSettings(e){e!==void 0&&(this.shouldUpdateSetting(e.showNameTags,this.devtoolsSettings.showNameTags)&&(this.devtoolsSettings.showNameTags=e.showNameTags,this.dispatchEvent(new CustomEvent("showNameTagsChanged",{detail:{showNameTags:e.showNameTags},bubbles:!0}))),this.shouldUpdateSetting(e.showDebugger,this.devtoolsSettings.showDebugger)&&(this.devtoolsSettings.showDebugger=e.showDebugger,this.requestUpdate()),this.shouldUpdateSetting(e.isControlPanelDefaultMinimized,this.devtoolsSettings.isControlPanelDefaultMinimized)&&(this.devtoolsSettings.isControlPanelDefaultMinimized=e.isControlPanelDefaultMinimized),this.shouldUpdateSetting(e.sortElementList,this.devtoolsSettings.sortElementList)&&(this.devtoolsSettings.sortElementList=e.sortElementList),e.logging&&(this.shouldUpdateSetting(e.logging.logLocation,this.devtoolsSettings.logging.logLocation)&&(this.devtoolsSettings.logging.logLocation=e.logging.logLocation),this.updateLoggingSetting("callbackCompleted",e.logging.callbackCompleted),this.updateLoggingSetting("callbackInvoked",e.logging.callbackInvoked),this.updateLoggingSetting("elementDataUpdated",e.logging.elementDataUpdated),this.updateLoggingSetting("elementRegistered",e.logging.elementRegistered),this.updateLoggingSetting("elementUnregistered",e.logging.elementUnregistered),this.updateLoggingSetting("managerSettingsChanged",e.logging.managerSettingsChanged),this.updateLoggingSetting("mouseTrajectoryUpdate",e.logging.mouseTrajectoryUpdate),this.updateLoggingSetting("scrollTrajectoryUpdate",e.logging.scrollTrajectoryUpdate)))}cleanup(){this.requestUpdate()}render(){return!this.isInitialized||!this.devtoolsSettings.showDebugger?Ae``:Ae`<control-panel></control-panel> <debug-overlay></debug-overlay>`}};l.styles=[An`
1978
+ `],n([Fn()],F.prototype,"_strategy",2),F=n([Rn("debug-overlay")],F);var l=class extends zn{constructor(){super();this.isInitialized=!1;this.devtoolsSettings={showDebugger:!0,isControlPanelDefaultMinimized:!1,showNameTags:!0,sortElementList:"visibility",logging:{logLocation:"controlPanel",callbackCompleted:!0,elementReactivated:!0,callbackInvoked:!0,elementDataUpdated:!1,elementRegistered:!1,elementUnregistered:!1,managerSettingsChanged:!0,mouseTrajectoryUpdate:!1,scrollTrajectoryUpdate:!1,deviceStrategyChanged:!0}}}static createAndAppendInstance(){typeof window>"u"||typeof document>"u"||(l._instance=document.createElement("foresight-devtools"),document.body.appendChild(l._instance))}static initialize(e){if(l._instance||l.createAndAppendInstance(),!l._instance)return l._instance;let t=l._instance;return t.isInitialized=!0,t.alterDevtoolsSettings(e),t}static get instance(){return l._instance?l._instance:l.initialize()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}shouldUpdateSetting(e,t){return e!==void 0&&e!==t}updateLoggingSetting(e,t){this.shouldUpdateSetting(t,this.devtoolsSettings.logging[e])&&(this.devtoolsSettings.logging[e]=t)}alterDevtoolsSettings(e){e!==void 0&&(this.shouldUpdateSetting(e.showNameTags,this.devtoolsSettings.showNameTags)&&(this.devtoolsSettings.showNameTags=e.showNameTags,this.dispatchEvent(new CustomEvent("showNameTagsChanged",{detail:{showNameTags:e.showNameTags},bubbles:!0}))),this.shouldUpdateSetting(e.showDebugger,this.devtoolsSettings.showDebugger)&&(this.devtoolsSettings.showDebugger=e.showDebugger,this.requestUpdate()),this.shouldUpdateSetting(e.isControlPanelDefaultMinimized,this.devtoolsSettings.isControlPanelDefaultMinimized)&&(this.devtoolsSettings.isControlPanelDefaultMinimized=e.isControlPanelDefaultMinimized),this.shouldUpdateSetting(e.sortElementList,this.devtoolsSettings.sortElementList)&&(this.devtoolsSettings.sortElementList=e.sortElementList),e.logging&&(this.shouldUpdateSetting(e.logging.logLocation,this.devtoolsSettings.logging.logLocation)&&(this.devtoolsSettings.logging.logLocation=e.logging.logLocation),this.updateLoggingSetting("callbackCompleted",e.logging.callbackCompleted),this.updateLoggingSetting("callbackInvoked",e.logging.callbackInvoked),this.updateLoggingSetting("elementDataUpdated",e.logging.elementDataUpdated),this.updateLoggingSetting("elementRegistered",e.logging.elementRegistered),this.updateLoggingSetting("elementUnregistered",e.logging.elementUnregistered),this.updateLoggingSetting("managerSettingsChanged",e.logging.managerSettingsChanged),this.updateLoggingSetting("mouseTrajectoryUpdate",e.logging.mouseTrajectoryUpdate),this.updateLoggingSetting("scrollTrajectoryUpdate",e.logging.scrollTrajectoryUpdate),this.updateLoggingSetting("deviceStrategyChanged",e.logging.deviceStrategyChanged)))}cleanup(){this.requestUpdate()}render(){return!this.isInitialized||!this.devtoolsSettings.showDebugger?Fe``:Fe`<control-panel></control-panel> <debug-overlay></debug-overlay>`}};l.styles=[Hn`
1854
1979
  :host {
1855
1980
  display: block;
1856
1981
  }
1857
- `],l._instance=null,n([zn()],l.prototype,"isInitialized",2),l=n([jn("foresight-devtools")],l);export{l as ForesightDevtools};
1982
+ `],l._instance=null,n([Gn()],l.prototype,"isInitialized",2),l=n([Bn("foresight-devtools")],l);export{l as ForesightDevtools};