PageSourceSearch

https://cdn.twwim.ai/modules/attention-director.DRrPbzBP.js

js twwim.ai collected 2026-10-02 06:24:31 UTC 1,552 bytes, 1 lines download raw bytes

1import{C as i,J as n,q as h,r as _}from"./executor.53lYhnKG.js";const r=5,o=5e3;class d{constructor(t,s){this.cfg=t,this.eventBus=s,this._started=!1,this._stopped=!1,this._startedAt=0,this._gateTimer=null,this._listeners=[],this._busUnsub=null}start(){this._started||this._stopped||this.cfg.enabled&&(this._started=!0,this._startedAt=Date.now(),this._busUnsub=this.eventBus.on(i,(t,s)=>{const e=s?.text;typeof e=="string"&&e.trim()&&this._show(e.trim())}),this._listen("twwimui:mode-changed",t=>{const s=t.detail?.to;typeof s=="string"&&s!=="idle"&&this._onAssistantOpened()}),this._listen(n,t=>{t.detail?.open===!0&&this._onAssistantOpened()}))}stop(){this._stopped=!0,this._clearGate(),this._busUnsub?.(),this._busUnsub=null;for(const{event:t,fn:s}of this._listeners)window.removeEventListener(t,s);this._listeners=[],this._pushDismiss()}_onAssistantOpened(){this._clearGate(),this._pushDismiss()}_show(t){if(this._stopped)return;const s=Date.now()-this._startedAt,e=o-s;if(e>0){this._clearGate(),this._gateTimer=window.setTimeout(()=>{this._gateTimer=null,this._push(t)},e);return}this._push(t)}_push(t){if(this._stopped)return;const s=this.cfg.idle?.displaySeconds??r;this._pushBubble(t,Math.max(1,s)*1e3)}_clearGate(){this._gateTimer!==null&&(clearTimeout(this._gateTimer),this._gateTimer=null)}_pushBubble(t,s){window.dispatchEvent(new CustomEvent(h,{detail:{text:t,ttlMs:s}}))}_pushDismiss(){window.dispatchEvent(new CustomEvent(_))}_listen(t,s){window.addEventListener(t,s),this._listeners.push({event:t,fn:s})}}export{d as AttentionDirector};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.