overlay-toolkit 0.11.0 → 0.11.2

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.
@@ -40,7 +40,7 @@ class y extends EventTarget {
40
40
  }
41
41
  callbackInputReport(e) {
42
42
  const a = e.instanceId, i = o(e.data), c = this.devices.get(a);
43
- c ? c.dispatchEvent(new x("inputreport", c, i[0], new DataView(i.buffer, 1))) : console.warn("Device not found:", a);
43
+ c ? c.dispatchEvent(new f("inputreport", c, i[0], new DataView(i.buffer, 1))) : console.warn("Device not found:", a);
44
44
  }
45
45
  callbackDeviceChanged(e) {
46
46
  var a = e.add;
@@ -120,7 +120,7 @@ class v extends Event {
120
120
  this.device = a;
121
121
  }
122
122
  }
123
- class x extends Event {
123
+ class f extends Event {
124
124
  constructor(e, a, i, c) {
125
125
  super(e);
126
126
  t(this, "device");
@@ -139,7 +139,7 @@ function o(r) {
139
139
  s[e / 2] = Number.parseInt(r.slice(e, e += 2), 16);
140
140
  return s;
141
141
  }
142
- class f {
142
+ class x {
143
143
  constructor(s = null) {
144
144
  t(this, "subscribers", /* @__PURE__ */ new Map());
145
145
  t(this, "queue", []);
@@ -159,10 +159,18 @@ class f {
159
159
  addOverlayListener(s, e) {
160
160
  this.subscribers.has(s) || this.subscribers.set(s, []), this.subscribers.get(s).push(e);
161
161
  }
162
+ setOverlayListener(s, e) {
163
+ this.subscribers.set(s, [e]);
164
+ }
162
165
  removeOverlayListener(s, e) {
163
166
  if (!this.subscribers.has(s))
164
167
  return;
165
- const a = this.subscribers.get(s), i = a.indexOf(e);
168
+ const a = this.subscribers.get(s);
169
+ if (!e) {
170
+ a.length = 0;
171
+ return;
172
+ }
173
+ const i = a.indexOf(e);
166
174
  i !== -1 && a.splice(i, 1);
167
175
  }
168
176
  async callOverlayHandler(s) {
@@ -205,7 +213,7 @@ class D extends EventTarget {
205
213
  }
206
214
  sendMessage(e) {
207
215
  return new Promise((a) => {
208
- window.OverlayPluginApi.callHandler(JSON.stringify(e), a);
216
+ window.OverlayPluginApi.callHandler(JSON.stringify(e), (i) => a(JSON.parse(i)));
209
217
  });
210
218
  }
211
219
  waitForApi() {
@@ -272,7 +280,7 @@ class k {
272
280
  * HID interface
273
281
  */
274
282
  t(this, "hid");
275
- t(this, "api", new f());
283
+ t(this, "api", new x());
276
284
  t(this, "handlerMap", /* @__PURE__ */ new Map());
277
285
  this.hid = w(this.api);
278
286
  }
@@ -307,7 +315,7 @@ class k {
307
315
  }, c = await this.api.callOverlayHandler(i);
308
316
  if (c.error)
309
317
  throw new Error(c.error);
310
- return c.evt_name ? (this.api.addOverlayListener(c.evt_name, (p) => this.packetHandler(p, !1)), this.api.startOverlayEvents()) : console.warn("plugin does not support evt_name for packet subscription, may < 0.4.0"), this.handlerMap.set(c.name || s, {
318
+ return c.evt_name ? (this.api.setOverlayListener(c.evt_name, (p) => this.packetHandler(p, !1)), this.api.startOverlayEvents()) : console.warn("plugin does not support evt_name for packet subscription, may < 0.4.0"), this.handlerMap.set(c.name || s, {
311
319
  handler: a,
312
320
  evt_name: c.evt_name
313
321
  }), c.name || s;
@@ -324,7 +332,10 @@ class k {
324
332
  }, a = await this.api.callOverlayHandler(e);
325
333
  if (a.error)
326
334
  throw new Error(a.error);
327
- this.handlerMap.delete(s);
335
+ if (this.handlerMap.has(s)) {
336
+ const i = this.handlerMap.get(s);
337
+ i.evt_name && this.api.removeOverlayListener(i.evt_name), this.handlerMap.delete(s);
338
+ }
328
339
  }
329
340
  packetHandler(s, e = !1) {
330
341
  let a = s, i = s;
@@ -767,7 +778,7 @@ class U extends n {
767
778
  }
768
779
  }
769
780
  }
770
- class j extends n {
781
+ class _ extends n {
771
782
  constructor(e) {
772
783
  super("NetworkActorControl", e);
773
784
  t(this, "instance");
@@ -778,7 +789,7 @@ class j extends n {
778
789
  this.data.push(parseInt(e[4 + a], 16));
779
790
  }
780
791
  }
781
- class _ extends n {
792
+ class j extends n {
782
793
  constructor(e) {
783
794
  super("NetworkNameToggle", e);
784
795
  t(this, "id");
@@ -872,7 +883,7 @@ class Z extends n {
872
883
  this.id = parseInt(e[2], 16), this.name = e[3], this.currentHP = parseInt(e[4]), this.maxHP = parseInt(e[5]), this.currentMP = parseInt(e[6]), this.maxMP = parseInt(e[7]), this.x = parseFloat(e[10]), this.y = parseFloat(e[11]), this.z = parseFloat(e[12]), this.heading = parseFloat(e[13]);
873
884
  }
874
885
  }
875
- class X extends n {
886
+ class J extends n {
876
887
  constructor(e) {
877
888
  super("Map", e);
878
889
  t(this, "id");
@@ -882,7 +893,7 @@ class X extends n {
882
893
  this.id = parseInt(e[2], 16), this.regionName = e[3], this.placeName = e[4], this.placeNameSub = e[5];
883
894
  }
884
895
  }
885
- class J extends n {
896
+ class X extends n {
886
897
  constructor(e) {
887
898
  super("SystemLogMessage", e);
888
899
  t(this, "instance");
@@ -1135,7 +1146,7 @@ class ve extends n {
1135
1146
  this.id = parseInt(e[2], 16), this.parentID = parseInt(e[3], 16), this.tetherID = parseInt(e[4], 16), this.animationState = parseInt(e[5], 16);
1136
1147
  }
1137
1148
  }
1138
- class xe extends n {
1149
+ class fe extends n {
1139
1150
  constructor(e) {
1140
1151
  super("ActorControlExtra", e);
1141
1152
  t(this, "id");
@@ -1147,7 +1158,7 @@ class xe extends n {
1147
1158
  this.id = parseInt(e[2], 16), this.category = parseInt(e[3], 16), this.param1 = parseInt(e[4], 16), this.param2 = parseInt(e[5], 16), this.param3 = parseInt(e[6], 16), this.param4 = parseInt(e[7], 16);
1148
1159
  }
1149
1160
  }
1150
- class fe extends n {
1161
+ class xe extends n {
1151
1162
  constructor(e) {
1152
1163
  super("ActorControlSelfExtra", e);
1153
1164
  t(this, "id");
@@ -1208,9 +1219,9 @@ function le(r) {
1208
1219
  case 31:
1209
1220
  return new U(r);
1210
1221
  case 33:
1211
- return new j(r);
1212
- case 34:
1213
1222
  return new _(r);
1223
+ case 34:
1224
+ return new j(r);
1214
1225
  case 35:
1215
1226
  return new G(r);
1216
1227
  case 36:
@@ -1222,9 +1233,9 @@ function le(r) {
1222
1233
  case 39:
1223
1234
  return new Z(r);
1224
1235
  case 40:
1225
- return new X(r);
1226
- case 41:
1227
1236
  return new J(r);
1237
+ case 41:
1238
+ return new X(r);
1228
1239
  case 42:
1229
1240
  return new K(r);
1230
1241
  case 251:
@@ -1270,9 +1281,9 @@ function le(r) {
1270
1281
  case 272:
1271
1282
  return new ve(r);
1272
1283
  case 273:
1273
- return new xe(r);
1274
- case 274:
1275
1284
  return new fe(r);
1285
+ case 274:
1286
+ return new xe(r);
1276
1287
  default:
1277
1288
  return new De(r);
1278
1289
  }
@@ -1283,8 +1294,8 @@ let Pe = new k();
1283
1294
  })();
1284
1295
  export {
1285
1296
  he as AbilityExtra,
1286
- xe as ActorControlExtra,
1287
- fe as ActorControlSelfExtra,
1297
+ fe as ActorControlExtra,
1298
+ xe as ActorControlSelfExtra,
1288
1299
  we as ActorMove,
1289
1300
  ye as ActorSetPos,
1290
1301
  b as AddCombatant,
@@ -1305,18 +1316,18 @@ export {
1305
1316
  te as LineRegistration,
1306
1317
  n as LogLineBase,
1307
1318
  se as MapEffect,
1308
- X as MapLog,
1319
+ J as MapLog,
1309
1320
  H as NetowrkStartsCasting,
1310
1321
  T as NetworkAbility,
1311
1322
  W as NetworkActionSync,
1312
- j as NetworkActorControl,
1323
+ _ as NetworkActorControl,
1313
1324
  A as NetworkBuff,
1314
1325
  B as NetworkBuffRemove,
1315
1326
  O as NetworkCancelAbility,
1316
1327
  L as NetworkDeath,
1317
1328
  S as NetworkDoT,
1318
1329
  U as NetworkGauge,
1319
- _ as NetworkNameToggle,
1330
+ j as NetworkNameToggle,
1320
1331
  z as NetworkRaidMarker,
1321
1332
  Y as NetworkStatusEffects,
1322
1333
  q as NetworkTargetIcon,
@@ -1334,7 +1345,7 @@ export {
1334
1345
  ve as SpawnNpcExtra,
1335
1346
  pe as StartsUsingExtra,
1336
1347
  K as StatusList3,
1337
- J as SystemLogMessage,
1348
+ X as SystemLogMessage,
1338
1349
  De as UnknownLogLine,
1339
1350
  g as Version,
1340
1351
  Pe as default
@@ -1 +1 @@
1
- (function(n,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(n=typeof globalThis<"u"?globalThis:n||self,p(n.overlayToolkit={}))})(this,function(n){"use strict";var Ne=Object.defineProperty;var Pe=(n,p,d)=>p in n?Ne(n,p,{enumerable:!0,configurable:!0,writable:!0,value:d}):n[p]=d;var t=(n,p,d)=>Pe(n,typeof p!="symbol"?p+"":p,d);function p(r){return new d(r)}class d extends EventTarget{constructor(e){super();t(this,"onconnect",null);t(this,"ondisconnect",null);t(this,"devices",new Map);this.api=e,this.addListener()}dispatchEvent(e){return e.type==="connect"&&this.onconnect&&this.onconnect.call(this,e),e.type==="disconnect"&&this.ondisconnect&&this.ondisconnect.call(this,e),super.dispatchEvent(e),!e.defaultPrevented}async getDevices(){const e=await this.requestGetDevices();let a=[];return e.forEach(c=>{if(this.devices.has(c.instanceId))a.push(this.devices.get(c.instanceId));else{const h=new I(this.api,c);this.devices.set(c.instanceId,h),a.push(h)}}),a}async requestDevice(e){return e&&console.log("Requesting device with options:",e),this.getDevices()}async requestGetDevices(){return(await o(this.api,"getDevices",{})).devices}addListener(){this.api.addOverlayListener("otk::hid::inputreport",e=>this.callbackInputReport(e)),this.api.addOverlayListener("otk::hid::devicechanged",e=>this.callbackDeviceChanged(e))}callbackInputReport(e){const a=e.instanceId,c=w(e.data),h=this.devices.get(a);h?h.dispatchEvent(new ve("inputreport",h,c[0],new DataView(c.buffer,1))):console.warn("Device not found:",a)}callbackDeviceChanged(e){var a=e.add;const c=new I(this.api,e.device),h=new ye(a?"connect":"disconnect",c);this.dispatchEvent(h)}}async function o(r,s,e){const a={call:"otk::hid",type:s,...e},c=await r.callOverlayHandler(a);return c.error&&console.log("callOverlayHID error:",s,e,c),c}class I extends EventTarget{constructor(e,a){super();t(this,"instanceId");t(this,"opened",!1);t(this,"vendorId");t(this,"productId");t(this,"productName");t(this,"collections");t(this,"oninputreport",null);this.api=e,this.instanceId=a.instanceId,this.vendorId=a.vendorId,this.productId=a.productId,this.productName=a.productName,this.collections=a.collections||[]}dispatchEvent(e){return e.type==="inputreport"&&this.oninputreport&&this.oninputreport.call(this,e),super.dispatchEvent(e),!e.defaultPrevented}async open(){this.opened||(await this.request("open",{}),this.opened=!0)}async close(){this.opened&&(await this.request("close",{}),this.opened=!1)}async forget(){}async sendReport(e,a){if(!this.opened)throw new Error("Device is not opened.");await this.request("send",{reportId:e,data:m(a)})}async sendFeatureReport(e,a){if(!this.opened)throw new Error("Device is not opened.");await this.request("sendFeature",{reportId:e,data:m(a)})}async receiveFeatureReport(e){if(!this.opened)throw new Error("Device is not opened.");const a=await this.request("recvFeature",{reportId:e}),c=w(a.data);return new DataView(c.buffer)}async request(e,a){return o(this.api,e,{instanceId:this.instanceId,...a})}}class ye extends Event{constructor(e,a){super(e);t(this,"device");this.device=a}}class ve extends Event{constructor(e,a,c,h){super(e);t(this,"device");t(this,"reportId");t(this,"data");this.device=a,this.reportId=c,this.data=h}}function m(r){let s=null;return r instanceof ArrayBuffer?s=new Uint8Array(r):s=new Uint8Array(r.buffer,r.byteOffset,r.byteLength),[...s].map(e=>e.toString(16).padStart(2,"0")).join("")}function w(r){const s=new Uint8Array(Math.ceil(r.length/2));for(let e=0;e<r.length;)s[e/2]=Number.parseInt(r.slice(e,e+=2),16);return s}class fe{constructor(s=null){t(this,"subscribers",new Map);t(this,"queue",[]);this.transport=s,s&&this.setTransport(s)}setTransport(s){this.transport=s,this.transport.addEventListener("message",e=>{this.dispatchOverlayEvent(e.detail)}),this.transport.addEventListener("connected",this.onTransportConnected.bind(this))}dispatchOverlayEvent(s){const e=this.subscribers.get(s.type);if(e)for(const a of e)a(s)}addOverlayListener(s,e){this.subscribers.has(s)||this.subscribers.set(s,[]),this.subscribers.get(s).push(e)}removeOverlayListener(s,e){if(!this.subscribers.has(s))return;const a=this.subscribers.get(s),c=a.indexOf(e);c!==-1&&a.splice(c,1)}async callOverlayHandler(s){return!this.transport||!this.transport.connected?(console.warn("OverlayPluginAPI: Transport not connected, queuing message",s),new Promise(a=>{this.queue.push([s,a])})):this.transport.sendMessage(s)}startOverlayEvents(){var s={call:"subscribe",events:Array.from(this.subscribers.keys())};this.callOverlayHandler(s)}onTransportConnected(){if(!this.transport||!this.transport.connected||this.queue.length===0)return;console.log("OverlayPluginAPI: Transport connected, sending queued messages");let s=this.queue;this.queue=[];for(let[e,a]of s)this.transport.sendMessage(e).then(a)}}class ke extends EventTarget{constructor(){super(...arguments);t(this,"connected",!1);t(this,"evtHandlerWrapper",e=>{this.dispatchEvent(new CustomEvent("message",{detail:e}))})}get transportType(){return"plugin"}sendMessage(e){return new Promise(a=>{window.OverlayPluginApi.callHandler(JSON.stringify(e),a)})}waitForApi(){if(!window.OverlayPluginApi||!window.OverlayPluginApi.ready){setTimeout(()=>this.waitForApi(),300);return}window.__OverlayCallback=this.evtHandlerWrapper,this.connected=!0,this.dispatchEvent(new Event("connected"))}}class De extends EventTarget{constructor(e){super();t(this,"ws");t(this,"sequence",0);t(this,"responseResolvers",new Map);t(this,"evtHandler",()=>{});t(this,"connected",!1);this.ws=new WebSocket(e),this.connect(this.ws)}connect(e){e.addEventListener("open",this.onOpen.bind(this)),e.addEventListener("error",this.onError.bind(this)),e.addEventListener("message",this.onMessage.bind(this)),e.addEventListener("close",this.onClosed.bind(this))}onError(e){console.error(e)}onOpen(){console.log("WebSocket connected"),this.connected=!0,this.dispatchEvent(new Event("connected"))}onMessage(e){try{const a=JSON.parse(e.data);if("rseq"in a){const c=a.rseq;this.responseResolvers.has(c)&&(this.responseResolvers.get(c)(a),this.responseResolvers.delete(c))}else this.dispatchEvent(new CustomEvent("message",{detail:a}))}catch{console.error("Failed to parse WebSocket message",e)}}onClosed(e){console.log("WebSocket closed",e),this.connected=!1,setTimeout(()=>{console.log("WebSocket reconnecting..."),this.ws=new WebSocket(this.ws.url),this.connect(this.ws)},3e3)}get transportType(){return"websocket"}sendMessage(e){const a=this.sequence++;return e.rseq=a,new Promise(c=>{this.responseResolvers.set(a,c),this.ws.send(JSON.stringify(e))})}set eventHandler(e){this.evtHandler=e}}class y{constructor(){t(this,"hid");t(this,"api",new fe);t(this,"handlerMap",new Map);this.hid=p(this.api)}Fetch(s,e={}){const a={call:"Fetch",resource:s,options:e};return this.api.callOverlayHandler(a)}async SubscribePacket(s,e,a){const c={call:"otk::packet",action:"subscribe",name:s,evt_name:"otk::packet::"+s,filters:e},h=await this.api.callOverlayHandler(c);if(h.error)throw new Error(h.error);return h.evt_name?(this.api.addOverlayListener(h.evt_name,u=>this.packetHandler(u,!1)),this.api.startOverlayEvents()):console.warn("plugin does not support evt_name for packet subscription, may < 0.4.0"),this.handlerMap.set(h.name||s,{handler:a,evt_name:h.evt_name}),h.name||s}async UnsubscribePacket(s){const e={call:"otk::packet",action:"unsubscribe",name:s},a=await this.api.callOverlayHandler(e);if(a.error)throw new Error(a.error);this.handlerMap.delete(s)}packetHandler(s,e=!1){let a=s,c=s;c.data=Uint8Array.from(atob(a.msg),u=>u.charCodeAt(0));let h=this.handlerMap.get(a.name);if(h){if(e&&h.evt_name)return;h.handler(c)}else e||console.warn("No packet handler for name",a.name)}async GetGameVersion(){const s={call:"otk::game_ver"};return this.api.callOverlayHandler(s)}async GetPluginVersion(){const s={call:"otk::plugin_ver"};return(await this.api.callOverlayHandler(s)).version}Start(){this.api.addOverlayListener("otk::packet",s=>this.packetHandler(s,!0)),this.api.startOverlayEvents()}Dispatch(s){this.api.dispatchOverlayEvent(s)}AddListener(s,e){this.api.addOverlayListener(s,e)}RemoveListener(s,e){this.api.removeOverlayListener(s,e)}Call(s){return this.api.callOverlayHandler(s)}IsOverlayPluginCEF(){return"OverlayPluginApi"in window}tryConnectToCEF(){if(!this.IsOverlayPluginCEF()){setTimeout(()=>this.tryConnectToCEF(),300);return}const s=new ke;this.api.setTransport(s),s.waitForApi()}Connect(s=""){if(this.tryConnectToCEF(),s||(s=new URLSearchParams(location.search).get("OVERLAY_WS")),s){if(this.IsOverlayPluginCEF()){console.warn("OverlayToolkit: Connect wsUrl ignored in OverlayPlugin CEF environment");return}const e=new De(s);this.api.setTransport(e)}}}class i{constructor(s,e){t(this,"type");t(this,"typeCode");t(this,"time");this.typeCode=parseInt(e[0]),this.time=e[1],this.type=s}get timeDate(){return new Date(this.time)}}class v extends i{constructor(e){super("LogLine",e);t(this,"code");t(this,"name");t(this,"line");this.code=e[2],this.name=e[3],this.line=e[4]}}class f extends i{constructor(e){super("ChangeZone",e);t(this,"zoneID");t(this,"zoneName");this.zoneID=parseInt(e[2],16),this.zoneName=e[3]}}class k extends i{constructor(e){super("ChangePrimaryPlayer",e);t(this,"charID");t(this,"charName");this.charID=parseInt(e[2],16),this.charName=e[3]}get charIDHex(){return this.charID.toString(16).toUpperCase()}}class D extends i{constructor(e){super("AddCombatant",e);t(this,"id");t(this,"name");t(this,"job");t(this,"level");t(this,"ownerID");t(this,"worldID");t(this,"worldName");t(this,"npcNameID");t(this,"npcBaseID");t(this,"currentHP");t(this,"hp");t(this,"currentMP");t(this,"mp");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.job=parseInt(e[4],16),this.level=parseInt(e[5],16),this.ownerID=parseInt(e[6],16),this.worldID=parseInt(e[7],16),this.worldName=e[8],this.npcNameID=parseInt(e[9]),this.npcBaseID=parseInt(e[10]),this.currentHP=parseInt(e[11]),this.hp=parseInt(e[12]),this.currentMP=parseInt(e[13]),this.mp=parseInt(e[14]),this.x=parseFloat(e[17]),this.y=parseFloat(e[18]),this.z=parseFloat(e[19]),this.heading=parseFloat(e[20])}}class l extends i{constructor(e){super("RemoveCombatant",e);t(this,"id");t(this,"name");t(this,"job");t(this,"level");t(this,"ownerID");t(this,"world");t(this,"npcNameID");t(this,"npcBaseID");t(this,"currentHP");t(this,"hp");t(this,"currentMP");t(this,"mp");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.job=parseInt(e[4],16),this.level=parseInt(e[5],16),this.ownerID=parseInt(e[6],16),this.world=e[8],this.npcNameID=parseInt(e[9]),this.npcBaseID=parseInt(e[10]),this.currentHP=parseInt(e[11]),this.hp=parseInt(e[12]),this.currentMP=parseInt(e[13]),this.mp=parseInt(e[14]),this.x=parseFloat(e[17]),this.y=parseFloat(e[18]),this.z=parseFloat(e[19]),this.heading=parseFloat(e[20])}}class N extends i{constructor(e){super("PartyChanged",e);t(this,"party");this.party=[];let a=parseInt(e[2]);for(let c=0;c<a;c++)this.party.push(parseInt(e[3+c],16))}}class P extends i{constructor(e){super("PlayerStats",e);t(this,"job");t(this,"strength");t(this,"dexterity");t(this,"vitality");t(this,"intelligence");t(this,"mind");t(this,"piety");t(this,"attackPower");t(this,"directHit");t(this,"criticalHit");t(this,"attakcMagicPotency");t(this,"healingMagicPotency");t(this,"determination");t(this,"skillSpeed");t(this,"spellSpeed");t(this,"tenacity");t(this,"localContentID");this.job=parseInt(e[2],16),this.strength=parseInt(e[3]),this.dexterity=parseInt(e[4]),this.vitality=parseInt(e[5]),this.intelligence=parseInt(e[6]),this.mind=parseInt(e[7]),this.piety=parseInt(e[8]),this.attackPower=parseInt(e[9]),this.directHit=parseInt(e[10]),this.criticalHit=parseInt(e[11]),this.attakcMagicPotency=parseInt(e[12]),this.healingMagicPotency=parseInt(e[13]),this.determination=parseInt(e[14]),this.skillSpeed=parseInt(e[15]),this.spellSpeed=parseInt(e[16]),this.tenacity=parseInt(e[18]),this.localContentID=parseInt(e[19],16)}}class C extends i{constructor(e){super("NetworkStartsCasting",e);t(this,"sourceID");t(this,"sourceName");t(this,"id");t(this,"ability");t(this,"targetID");t(this,"targetName");t(this,"castTime");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.sourceID=parseInt(e[2],16),this.sourceName=e[3],this.id=parseInt(e[4],16),this.ability=e[5],this.targetID=parseInt(e[6],16),this.targetName=e[7],this.castTime=parseFloat(e[8]),this.x=parseFloat(e[9]),this.y=parseFloat(e[10]),this.z=parseFloat(e[11]),this.heading=parseFloat(e[12])}}class b extends i{constructor(e){super(e[0]=="22"?"NetworkAOEAbility":"NetworkAbility",e);t(this,"sourceID");t(this,"sourceName");t(this,"id");t(this,"ability");t(this,"targetID");t(this,"targetName");t(this,"effects");t(this,"targetCurrentHP");t(this,"targetMaxHP");t(this,"targetCurrentMP");t(this,"targetMaxMP");t(this,"targetX");t(this,"targetY");t(this,"targetZ");t(this,"targetHeading");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"sequence");t(this,"targetIndex");t(this,"targetCount");t(this,"ownerID");t(this,"ownerName");t(this,"effectDisplayType");t(this,"actionID");t(this,"actionAnimationID");t(this,"animationLockTime");t(this,"rotationHex");this.sourceID=parseInt(e[2],16),this.sourceName=e[3],this.id=parseInt(e[4],16),this.ability=e[5],this.targetID=parseInt(e[6],16),this.targetName=e[7],this.effects=[];for(let a=0;a<8;a++)this.effects[a]={flags:parseInt(e[8+a*2],16),damage:e[9+a*2]};this.targetCurrentHP=parseInt(e[24]),this.targetMaxHP=parseInt(e[25]),this.targetCurrentMP=parseInt(e[26]),this.targetMaxMP=parseInt(e[27]),this.targetX=parseFloat(e[30]),this.targetY=parseFloat(e[31]),this.targetZ=parseFloat(e[32]),this.targetHeading=parseFloat(e[33]),this.currentHP=parseInt(e[34]),this.maxHP=parseInt(e[35]),this.currentMP=parseInt(e[36]),this.maxMP=parseInt(e[37]),this.x=parseFloat(e[40]),this.y=parseFloat(e[41]),this.z=parseFloat(e[42]),this.heading=parseFloat(e[43]),this.sequence=parseInt(e[44],16),this.targetIndex=parseInt(e[45]),this.targetCount=parseInt(e[46]),this.ownerID=parseInt(e[47],16),this.ownerName=e[48],this.effectDisplayType=parseInt(e[49]),this.actionID=parseInt(e[50],16),this.actionAnimationID=parseInt(e[51],16),this.animationLockTime=parseFloat(e[52]),this.rotationHex=parseInt(e[53],16)}}class x extends i{constructor(e){super("NetworkCancelAbility",e);t(this,"sourceID");t(this,"source");t(this,"id");t(this,"name");t(this,"reason");this.sourceID=parseInt(e[2],16),this.source=e[3],this.id=parseInt(e[4],16),this.name=e[5],this.reason=e[6]}}class M extends i{constructor(e){super("NetworkDoT",e);t(this,"id");t(this,"name");t(this,"which");t(this,"effectID");t(this,"damage");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"sourceID");t(this,"sourceName");t(this,"damageType");t(this,"sourceCurrentHP");t(this,"sourceMaxHP");t(this,"sourceCurrentMP");t(this,"sourceMaxMP");t(this,"sourceX");t(this,"sourceY");t(this,"sourceZ");t(this,"sourceHeading");this.id=parseInt(e[2],16),this.name=e[3],this.which=e[4],this.effectID=parseInt(e[5],16),this.damage=parseInt(e[6]),this.currentHP=parseInt(e[7]),this.maxHP=parseInt(e[8]),this.currentMP=parseInt(e[9]),this.maxMP=parseInt(e[10]),this.x=parseFloat(e[13]),this.y=parseFloat(e[14]),this.z=parseFloat(e[15]),this.heading=parseFloat(e[16]),this.sourceID=parseInt(e[17],16),this.sourceName=e[18],this.damageType=parseInt(e[19],16),this.sourceCurrentHP=parseInt(e[20]),this.sourceMaxHP=parseInt(e[21]),this.sourceCurrentMP=parseInt(e[22]),this.sourceMaxMP=parseInt(e[23]),this.sourceX=parseFloat(e[26]),this.sourceY=parseFloat(e[27]),this.sourceZ=parseFloat(e[28]),this.sourceHeading=parseFloat(e[29])}}class F extends i{constructor(e){super("NetworkDeath",e);t(this,"targetID");t(this,"targetName");t(this,"sourceID");t(this,"sourceName");this.targetID=parseInt(e[2],16),this.targetName=e[3],this.sourceID=parseInt(e[4],16),this.sourceName=e[5]}}class E extends i{constructor(e){super("NetworkBuff",e);t(this,"effectID");t(this,"effectName");t(this,"duration");t(this,"sourceID");t(this,"sourceName");t(this,"targetID");t(this,"targetName");t(this,"count");t(this,"targetMaxHP");t(this,"sourceMaxHP");this.effectID=parseInt(e[2],16),this.effectName=e[3],this.duration=parseFloat(e[4]),this.sourceID=parseInt(e[5],16),this.sourceName=e[6],this.targetID=parseInt(e[7],16),this.targetName=e[8],this.count=parseInt(e[9]),this.targetMaxHP=parseInt(e[10]==""?"-1":e[10]),this.sourceMaxHP=parseInt(e[11]==""?"-1":e[11])}}class H extends i{constructor(e){super("NetworkTargetIcon",e);t(this,"targetID");t(this,"targetName");t(this,"id");t(this,"data0");this.targetID=parseInt(e[2],16),this.targetName=e[3],this.id=parseInt(e[6],16),this.data0=parseInt(e[7],16)}}class T extends i{constructor(e){super("NetworkRaidMarker",e);t(this,"operation");t(this,"waymark");t(this,"id");t(this,"name");t(this,"x");t(this,"y");t(this,"z");this.operation=e[2],this.waymark=parseInt(e[3]),this.id=parseInt(e[4],16),this.name=e[5],this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8])}}class S extends i{constructor(e){super("NetworkTargetMarker",e);t(this,"operation");t(this,"waymark");t(this,"id");t(this,"name");t(this,"targetID");t(this,"targetName");this.operation=e[2],this.waymark=parseInt(e[3]),this.id=parseInt(e[4],16),this.name=e[5],this.targetID=parseInt(e[6],16),this.targetName=e[7]}}class L extends i{constructor(e){super("NetworkBuffRemove",e);t(this,"effectID");t(this,"effectName");t(this,"sourceID");t(this,"sourceName");t(this,"targetID");t(this,"targetName");t(this,"count");this.effectID=parseInt(e[2],16),this.effectName=e[3],this.sourceID=parseInt(e[5],16),this.sourceName=e[6],this.targetID=parseInt(e[7],16),this.targetName=e[8],this.count=parseInt(e[9],16)}}class A extends i{constructor(e){super("NetworkGauge",e);t(this,"id");t(this,"data");this.id=parseInt(e[2],16),this.data=new Uint8Array(16);let a=new DataView(this.data.buffer);for(let c=0;c<4;c++){let h=parseInt(e[3+c]);a.setUint32(c*4,h,!0)}}}class O extends i{constructor(e){super("NetworkActorControl",e);t(this,"instance");t(this,"command");t(this,"data");this.instance=parseInt(e[2],16),this.command=parseInt(e[3],16),this.data=[];for(let a=0;a<4;a++)this.data.push(parseInt(e[4+a],16))}}class q extends i{constructor(e){super("NetworkNameToggle",e);t(this,"id");t(this,"name");t(this,"targetID");t(this,"targetName");t(this,"toggle");this.id=parseInt(e[2],16),this.name=e[3],this.targetID=parseInt(e[4],16),this.targetName=e[5],this.toggle=parseInt(e[6])===1}}class z extends i{constructor(e){super("NetworkTether",e);t(this,"sourceID");t(this,"sourceName");t(this,"targetID");t(this,"targetName");t(this,"id");this.sourceID=parseInt(e[2],16),this.sourceName=e[3],this.targetID=parseInt(e[4],16),this.targetName=e[5],this.id=parseInt(e[8],16)}}class R extends i{constructor(e){super("LimitBreak",e);t(this,"value");t(this,"bars");this.value=parseInt(e[2],16),this.bars=parseInt(e[3])}}class B extends i{constructor(e){super("NetworkActionSync",e);t(this,"id");t(this,"name");t(this,"sequenceID");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"currentShield");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.sequenceID=parseInt(e[4],16),this.currentHP=e[5]?parseInt(e[5]):-1,this.maxHP=e[6]?parseInt(e[6]):-1,this.currentMP=e[7]?parseInt(e[7]):-1,this.maxMP=e[8]?parseInt(e[8]):-1,this.currentShield=e[9]?parseInt(e[9]):-1,this.x=parseFloat(e[11]),this.y=parseFloat(e[12]),this.z=parseFloat(e[13]),this.heading=parseFloat(e[14])}}class U extends i{constructor(e){super("NetworkStatusEffects",e);t(this,"targetID");t(this,"targetName");t(this,"jobLevelData");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"currentShield");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"data");this.targetID=parseInt(e[2],16),this.targetName=e[3],this.jobLevelData=parseInt(e[4],16),this.currentHP=parseInt(e[5]),this.maxHP=parseInt(e[6]),this.currentMP=parseInt(e[7]),this.maxMP=parseInt(e[8]),this.currentShield=parseInt(e[9]),this.x=parseFloat(e[11]),this.y=parseFloat(e[12]),this.z=parseFloat(e[13]),this.heading=parseFloat(e[14]),this.data=[];for(let a=0;a<6;a++)this.data.push(parseInt(e[15+a],16))}}class j extends i{constructor(e){super("NetworkUpdateHP",e);t(this,"id");t(this,"name");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.currentHP=parseInt(e[4]),this.maxHP=parseInt(e[5]),this.currentMP=parseInt(e[6]),this.maxMP=parseInt(e[7]),this.x=parseFloat(e[10]),this.y=parseFloat(e[11]),this.z=parseFloat(e[12]),this.heading=parseFloat(e[13])}}class _ extends i{constructor(e){super("Map",e);t(this,"id");t(this,"regionName");t(this,"placeName");t(this,"placeNameSub");this.id=parseInt(e[2],16),this.regionName=e[3],this.placeName=e[4],this.placeNameSub=e[5]}}class G extends i{constructor(e){super("SystemLogMessage",e);t(this,"instance");t(this,"id");t(this,"params");this.instance=parseInt(e[2],16),this.id=parseInt(e[3],16),this.params=[];for(let a=0;a<3;a++)this.params.push(parseInt(e[4+a],16))}}class V extends i{constructor(e){super("StatusList3",e);t(this,"id");t(this,"name");t(this,"statusList");this.id=parseInt(e[2],16),this.name=e[3],this.statusList=[];for(let a=0;a<e.length-4-1;a++)this.statusList.push(parseInt(e[4+a],16))}}class W extends i{constructor(e){super("Debug",e);t(this,"message");this.message=e[2]}}class Y extends i{constructor(e){super("PacketDump",e);t(this,"len");t(this,"src");t(this,"dst");t(this,"packetType");t(this,"data");this.len=parseInt(e[2],16),this.src=parseInt(e[3],16),this.dst=parseInt(e[4],16),this.packetType=parseInt(e[5],16)&65535,this.data=new Uint8Array(this.len-16);for(let a=6,c=0;a<e.length-2;a++,c++){const h=parseInt(e[a],16);for(let u=0;u<4;u++)this.data[c*4+u]=h>>u*8&255}}}class Z extends i{constructor(e){super("Version",e);t(this,"message");this.message=e[2]}}let X=class extends i{constructor(e){super("Error",e);t(this,"message");this.message=e[2]}};class J extends i{constructor(e){super("LineRegistration",e);t(this,"id");t(this,"source");t(this,"name");t(this,"version");this.id=parseInt(e[2]),this.source=e[3],this.name=e[4],this.version=e[5]}}class K extends i{constructor(e){super("MapEffect",e);t(this,"instance");t(this,"flags");t(this,"location");t(this,"data0");t(this,"data1");this.instance=parseInt(e[2],16),this.flags=parseInt(e[3],16),this.location=parseInt(e[4],16),this.data0=parseInt(e[5],16),this.data1=parseInt(e[6],16)}}class $ extends i{constructor(e){super("FateDirector",e);t(this,"category");t(this,"unknown");t(this,"id");t(this,"progress");this.category=e[2],this.unknown=parseInt(e[3],16),this.id=parseInt(e[4],16),this.progress=parseInt(e[5],16)}}class Q extends i{constructor(e){super("CEDirector",e);t(this,"popTime");t(this,"timeRemaining");t(this,"unknown");t(this,"ceKey");t(this,"numPlayers");t(this,"status");t(this,"unknown2");t(this,"progress");this.popTime=parseInt(e[2],16),this.timeRemaining=parseInt(e[3],16),this.unknown=parseInt(e[4],16),this.ceKey=parseInt(e[5],16),this.numPlayers=parseInt(e[6],16),this.status=parseInt(e[7],16),this.unknown2=parseInt(e[8],16),this.progress=parseInt(e[9],16)}}class g extends i{constructor(e){super("InCombat",e);t(this,"inACTCombat");t(this,"inGameCombat");t(this,"isACTChanged");t(this,"isGameChanged");this.inACTCombat=parseInt(e[2])===1,this.inGameCombat=parseInt(e[3])===1,this.isACTChanged=parseInt(e[4])===1,this.isGameChanged=parseInt(e[5])===1}}class ee extends i{constructor(e){super("CombatantMemory",e);t(this,"change");t(this,"id");t(this,"data");this.change=e[2],this.id=parseInt(e[3],16),this.data=new Map;for(let a=4;a<e.length-1;a+=2)this.data.set(e[a],e[a+1])}}class te extends i{constructor(e){super("RSVData",e);t(this,"locale");t(this,"unknown");t(this,"key");t(this,"value");this.locale=e[2],this.unknown=parseInt(e[3],16),this.key=e[4],this.value=e[5]}}class se extends i{constructor(e){super("StartsUsingExtra",e);t(this,"sourceID");t(this,"id");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.sourceID=parseInt(e[2],16),this.id=parseInt(e[3],16),this.x=parseFloat(e[4]),this.y=parseFloat(e[5]),this.z=parseFloat(e[6]),this.heading=parseFloat(e[7])}}class re extends i{constructor(e){super("AbilityExtra",e);t(this,"sourceID");t(this,"id");t(this,"globalEffectCounter");t(this,"dataFlag");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"animationTargetId");this.sourceID=parseInt(e[2],16),this.id=parseInt(e[3],16),this.globalEffectCounter=parseInt(e[4],16),this.dataFlag=parseInt(e[5],16),this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8]),this.heading=parseFloat(e[9]),this.animationTargetId=parseInt(e[10],16)}}class ae extends i{constructor(e){super("ContentFinderSettings",e);t(this,"zoneID");t(this,"zoneName");t(this,"inContentFinderContent");t(this,"unrestrictedParty");t(this,"minimalItemLevel");t(this,"silenceEcho");t(this,"explorerMode");t(this,"levelSync");this.zoneID=parseInt(e[2],16),this.zoneName=e[3],this.inContentFinderContent=parseInt(e[4])===1,this.unrestrictedParty=parseInt(e[5])===1,this.minimalItemLevel=parseInt(e[6])===1,this.silenceEcho=parseInt(e[7])===1,this.explorerMode=parseInt(e[8])===1,this.levelSync=parseInt(e[9])===1}}class ne extends i{constructor(e){super("NpcYell",e);t(this,"npcId");t(this,"npcNameId");t(this,"npcYellId");this.npcId=parseInt(e[2],16),this.npcNameId=parseInt(e[3],16),this.npcYellId=parseInt(e[4],16)}}class ie extends i{constructor(e){super("BattleTalk2",e);t(this,"npcId");t(this,"instance");t(this,"npcNameId");t(this,"instanceContentTextId");t(this,"displayMs");this.npcId=parseInt(e[2],16),this.instance=parseInt(e[3],16),this.npcNameId=parseInt(e[4],16),this.instanceContentTextId=parseInt(e[5],16),this.displayMs=parseInt(e[6])}}class ce extends i{constructor(e){super("Countdown",e);t(this,"id");t(this,"worldID");t(this,"countdownTime");t(this,"result");t(this,"name");this.id=parseInt(e[2],16),this.worldID=parseInt(e[3],16),this.countdownTime=parseInt(e[4]),this.result=parseInt(e[5],16),this.name=e[6]}}class he extends i{constructor(e){super("CountdownCancel",e);t(this,"id");t(this,"worldID");t(this,"name");this.id=parseInt(e[2],16),this.worldID=parseInt(e[3],16),this.name=e[4]}}class pe extends i{constructor(e){super("ActorMove",e);t(this,"id");t(this,"heading");t(this,"unk1");t(this,"unk2");t(this,"x");t(this,"y");t(this,"z");this.id=parseInt(e[2],16),this.heading=parseFloat(e[3]),this.unk1=parseInt(e[4],16),this.unk2=parseInt(e[5],16),this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8])}}class ue extends i{constructor(e){super("ActorSetPos",e);t(this,"id");t(this,"heading");t(this,"unk1");t(this,"unk2");t(this,"x");t(this,"y");t(this,"z");this.id=parseInt(e[2],16),this.heading=parseFloat(e[3]),this.unk1=parseInt(e[4],16),this.unk2=parseInt(e[5],16),this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8])}}class de extends i{constructor(e){super("SpawnNpcExtra",e);t(this,"id");t(this,"parentID");t(this,"tetherID");t(this,"animationState");this.id=parseInt(e[2],16),this.parentID=parseInt(e[3],16),this.tetherID=parseInt(e[4],16),this.animationState=parseInt(e[5],16)}}class oe extends i{constructor(e){super("ActorControlExtra",e);t(this,"id");t(this,"category");t(this,"param1");t(this,"param2");t(this,"param3");t(this,"param4");this.id=parseInt(e[2],16),this.category=parseInt(e[3],16),this.param1=parseInt(e[4],16),this.param2=parseInt(e[5],16),this.param3=parseInt(e[6],16),this.param4=parseInt(e[7],16)}}class Ie extends i{constructor(e){super("ActorControlSelfExtra",e);t(this,"id");t(this,"category");t(this,"param1");t(this,"param2");t(this,"param3");t(this,"param4");t(this,"param5");t(this,"param6");this.id=parseInt(e[2],16),this.category=parseInt(e[3],16),this.param1=parseInt(e[4],16),this.param2=parseInt(e[5],16),this.param3=parseInt(e[6],16),this.param4=parseInt(e[7],16),this.param5=parseInt(e[8],16),this.param6=parseInt(e[9],16)}}class me extends i{constructor(e){super("Unknown",e);t(this,"rawLines");this.rawLines=e}}function le(r){switch(parseInt(r[0])){case 0:return new v(r);case 1:return new f(r);case 2:return new k(r);case 3:return new D(r);case 4:return new l(r);case 11:return new N(r);case 12:return new P(r);case 20:return new C(r);case 21:case 22:return new b(r);case 23:return new x(r);case 24:return new M(r);case 25:return new F(r);case 26:return new E(r);case 27:return new H(r);case 28:return new T(r);case 29:return new S(r);case 30:return new L(r);case 31:return new A(r);case 33:return new O(r);case 34:return new q(r);case 35:return new z(r);case 36:return new R(r);case 37:return new B(r);case 38:return new U(r);case 39:return new j(r);case 40:return new _(r);case 41:return new G(r);case 42:return new V(r);case 251:return new W(r);case 252:return new Y(r);case 253:return new Z(r);case 254:return new X(r);case 256:return new J(r);case 257:return new K(r);case 258:return new $(r);case 259:return new Q(r);case 260:return new g(r);case 261:return new ee(r);case 262:return new te(r);case 263:return new se(r);case 264:return new re(r);case 265:return new ae(r);case 266:return new ne(r);case 267:return new ie(r);case 268:return new ce(r);case 269:return new he(r);case 270:return new pe(r);case 271:return new ue(r);case 272:return new de(r);case 273:return new oe(r);case 274:return new Ie(r);default:return new me(r)}}let we=new y;(function(){we.Connect()})(),n.AbilityExtra=re,n.ActorControlExtra=oe,n.ActorControlSelfExtra=Ie,n.ActorMove=pe,n.ActorSetPos=ue,n.AddCombatant=D,n.BattleTalk2=ie,n.CEDirector=Q,n.ChangePrimaryPlayer=k,n.ChangeZone=f,n.CombatantMemory=ee,n.ContentFinderSettings=ae,n.Countdown=ce,n.CountdownCancel=he,n.Debug=W,n.Error=X,n.FateDirector=$,n.GameLogLine=v,n.InCombat=g,n.LimitBreak=R,n.LineRegistration=J,n.LogLineBase=i,n.MapEffect=K,n.MapLog=_,n.NetowrkStartsCasting=C,n.NetworkAbility=b,n.NetworkActionSync=B,n.NetworkActorControl=O,n.NetworkBuff=E,n.NetworkBuffRemove=L,n.NetworkCancelAbility=x,n.NetworkDeath=F,n.NetworkDoT=M,n.NetworkGauge=A,n.NetworkNameToggle=q,n.NetworkRaidMarker=T,n.NetworkStatusEffects=U,n.NetworkTargetIcon=H,n.NetworkTargetMarker=S,n.NetworkTether=z,n.NetworkUpdateHP=j,n.NpcYell=ne,n.OverlayToolkit=y,n.PacketDump=Y,n.ParseLogLine=le,n.PartyList=N,n.PlayerStats=P,n.RSVData=te,n.RemoveCombatant=l,n.SpawnNpcExtra=de,n.StartsUsingExtra=se,n.StatusList3=V,n.SystemLogMessage=G,n.UnknownLogLine=me,n.Version=Z,n.default=we,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(n,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(n=typeof globalThis<"u"?globalThis:n||self,p(n.overlayToolkit={}))})(this,function(n){"use strict";var Ne=Object.defineProperty;var Pe=(n,p,d)=>p in n?Ne(n,p,{enumerable:!0,configurable:!0,writable:!0,value:d}):n[p]=d;var t=(n,p,d)=>Pe(n,typeof p!="symbol"?p+"":p,d);function p(r){return new d(r)}class d extends EventTarget{constructor(e){super();t(this,"onconnect",null);t(this,"ondisconnect",null);t(this,"devices",new Map);this.api=e,this.addListener()}dispatchEvent(e){return e.type==="connect"&&this.onconnect&&this.onconnect.call(this,e),e.type==="disconnect"&&this.ondisconnect&&this.ondisconnect.call(this,e),super.dispatchEvent(e),!e.defaultPrevented}async getDevices(){const e=await this.requestGetDevices();let a=[];return e.forEach(c=>{if(this.devices.has(c.instanceId))a.push(this.devices.get(c.instanceId));else{const h=new I(this.api,c);this.devices.set(c.instanceId,h),a.push(h)}}),a}async requestDevice(e){return e&&console.log("Requesting device with options:",e),this.getDevices()}async requestGetDevices(){return(await o(this.api,"getDevices",{})).devices}addListener(){this.api.addOverlayListener("otk::hid::inputreport",e=>this.callbackInputReport(e)),this.api.addOverlayListener("otk::hid::devicechanged",e=>this.callbackDeviceChanged(e))}callbackInputReport(e){const a=e.instanceId,c=w(e.data),h=this.devices.get(a);h?h.dispatchEvent(new ve("inputreport",h,c[0],new DataView(c.buffer,1))):console.warn("Device not found:",a)}callbackDeviceChanged(e){var a=e.add;const c=new I(this.api,e.device),h=new ye(a?"connect":"disconnect",c);this.dispatchEvent(h)}}async function o(r,s,e){const a={call:"otk::hid",type:s,...e},c=await r.callOverlayHandler(a);return c.error&&console.log("callOverlayHID error:",s,e,c),c}class I extends EventTarget{constructor(e,a){super();t(this,"instanceId");t(this,"opened",!1);t(this,"vendorId");t(this,"productId");t(this,"productName");t(this,"collections");t(this,"oninputreport",null);this.api=e,this.instanceId=a.instanceId,this.vendorId=a.vendorId,this.productId=a.productId,this.productName=a.productName,this.collections=a.collections||[]}dispatchEvent(e){return e.type==="inputreport"&&this.oninputreport&&this.oninputreport.call(this,e),super.dispatchEvent(e),!e.defaultPrevented}async open(){this.opened||(await this.request("open",{}),this.opened=!0)}async close(){this.opened&&(await this.request("close",{}),this.opened=!1)}async forget(){}async sendReport(e,a){if(!this.opened)throw new Error("Device is not opened.");await this.request("send",{reportId:e,data:m(a)})}async sendFeatureReport(e,a){if(!this.opened)throw new Error("Device is not opened.");await this.request("sendFeature",{reportId:e,data:m(a)})}async receiveFeatureReport(e){if(!this.opened)throw new Error("Device is not opened.");const a=await this.request("recvFeature",{reportId:e}),c=w(a.data);return new DataView(c.buffer)}async request(e,a){return o(this.api,e,{instanceId:this.instanceId,...a})}}class ye extends Event{constructor(e,a){super(e);t(this,"device");this.device=a}}class ve extends Event{constructor(e,a,c,h){super(e);t(this,"device");t(this,"reportId");t(this,"data");this.device=a,this.reportId=c,this.data=h}}function m(r){let s=null;return r instanceof ArrayBuffer?s=new Uint8Array(r):s=new Uint8Array(r.buffer,r.byteOffset,r.byteLength),[...s].map(e=>e.toString(16).padStart(2,"0")).join("")}function w(r){const s=new Uint8Array(Math.ceil(r.length/2));for(let e=0;e<r.length;)s[e/2]=Number.parseInt(r.slice(e,e+=2),16);return s}class fe{constructor(s=null){t(this,"subscribers",new Map);t(this,"queue",[]);this.transport=s,s&&this.setTransport(s)}setTransport(s){this.transport=s,this.transport.addEventListener("message",e=>{this.dispatchOverlayEvent(e.detail)}),this.transport.addEventListener("connected",this.onTransportConnected.bind(this))}dispatchOverlayEvent(s){const e=this.subscribers.get(s.type);if(e)for(const a of e)a(s)}addOverlayListener(s,e){this.subscribers.has(s)||this.subscribers.set(s,[]),this.subscribers.get(s).push(e)}setOverlayListener(s,e){this.subscribers.set(s,[e])}removeOverlayListener(s,e){if(!this.subscribers.has(s))return;const a=this.subscribers.get(s);if(!e){a.length=0;return}const c=a.indexOf(e);c!==-1&&a.splice(c,1)}async callOverlayHandler(s){return!this.transport||!this.transport.connected?(console.warn("OverlayPluginAPI: Transport not connected, queuing message",s),new Promise(a=>{this.queue.push([s,a])})):this.transport.sendMessage(s)}startOverlayEvents(){var s={call:"subscribe",events:Array.from(this.subscribers.keys())};this.callOverlayHandler(s)}onTransportConnected(){if(!this.transport||!this.transport.connected||this.queue.length===0)return;console.log("OverlayPluginAPI: Transport connected, sending queued messages");let s=this.queue;this.queue=[];for(let[e,a]of s)this.transport.sendMessage(e).then(a)}}class ke extends EventTarget{constructor(){super(...arguments);t(this,"connected",!1);t(this,"evtHandlerWrapper",e=>{this.dispatchEvent(new CustomEvent("message",{detail:e}))})}get transportType(){return"plugin"}sendMessage(e){return new Promise(a=>{window.OverlayPluginApi.callHandler(JSON.stringify(e),c=>a(JSON.parse(c)))})}waitForApi(){if(!window.OverlayPluginApi||!window.OverlayPluginApi.ready){setTimeout(()=>this.waitForApi(),300);return}window.__OverlayCallback=this.evtHandlerWrapper,this.connected=!0,this.dispatchEvent(new Event("connected"))}}class le extends EventTarget{constructor(e){super();t(this,"ws");t(this,"sequence",0);t(this,"responseResolvers",new Map);t(this,"evtHandler",()=>{});t(this,"connected",!1);this.ws=new WebSocket(e),this.connect(this.ws)}connect(e){e.addEventListener("open",this.onOpen.bind(this)),e.addEventListener("error",this.onError.bind(this)),e.addEventListener("message",this.onMessage.bind(this)),e.addEventListener("close",this.onClosed.bind(this))}onError(e){console.error(e)}onOpen(){console.log("WebSocket connected"),this.connected=!0,this.dispatchEvent(new Event("connected"))}onMessage(e){try{const a=JSON.parse(e.data);if("rseq"in a){const c=a.rseq;this.responseResolvers.has(c)&&(this.responseResolvers.get(c)(a),this.responseResolvers.delete(c))}else this.dispatchEvent(new CustomEvent("message",{detail:a}))}catch{console.error("Failed to parse WebSocket message",e)}}onClosed(e){console.log("WebSocket closed",e),this.connected=!1,setTimeout(()=>{console.log("WebSocket reconnecting..."),this.ws=new WebSocket(this.ws.url),this.connect(this.ws)},3e3)}get transportType(){return"websocket"}sendMessage(e){const a=this.sequence++;return e.rseq=a,new Promise(c=>{this.responseResolvers.set(a,c),this.ws.send(JSON.stringify(e))})}set eventHandler(e){this.evtHandler=e}}class y{constructor(){t(this,"hid");t(this,"api",new fe);t(this,"handlerMap",new Map);this.hid=p(this.api)}Fetch(s,e={}){const a={call:"Fetch",resource:s,options:e};return this.api.callOverlayHandler(a)}async SubscribePacket(s,e,a){const c={call:"otk::packet",action:"subscribe",name:s,evt_name:"otk::packet::"+s,filters:e},h=await this.api.callOverlayHandler(c);if(h.error)throw new Error(h.error);return h.evt_name?(this.api.setOverlayListener(h.evt_name,u=>this.packetHandler(u,!1)),this.api.startOverlayEvents()):console.warn("plugin does not support evt_name for packet subscription, may < 0.4.0"),this.handlerMap.set(h.name||s,{handler:a,evt_name:h.evt_name}),h.name||s}async UnsubscribePacket(s){const e={call:"otk::packet",action:"unsubscribe",name:s},a=await this.api.callOverlayHandler(e);if(a.error)throw new Error(a.error);if(this.handlerMap.has(s)){const c=this.handlerMap.get(s);c.evt_name&&this.api.removeOverlayListener(c.evt_name),this.handlerMap.delete(s)}}packetHandler(s,e=!1){let a=s,c=s;c.data=Uint8Array.from(atob(a.msg),u=>u.charCodeAt(0));let h=this.handlerMap.get(a.name);if(h){if(e&&h.evt_name)return;h.handler(c)}else e||console.warn("No packet handler for name",a.name)}async GetGameVersion(){const s={call:"otk::game_ver"};return this.api.callOverlayHandler(s)}async GetPluginVersion(){const s={call:"otk::plugin_ver"};return(await this.api.callOverlayHandler(s)).version}Start(){this.api.addOverlayListener("otk::packet",s=>this.packetHandler(s,!0)),this.api.startOverlayEvents()}Dispatch(s){this.api.dispatchOverlayEvent(s)}AddListener(s,e){this.api.addOverlayListener(s,e)}RemoveListener(s,e){this.api.removeOverlayListener(s,e)}Call(s){return this.api.callOverlayHandler(s)}IsOverlayPluginCEF(){return"OverlayPluginApi"in window}tryConnectToCEF(){if(!this.IsOverlayPluginCEF()){setTimeout(()=>this.tryConnectToCEF(),300);return}const s=new ke;this.api.setTransport(s),s.waitForApi()}Connect(s=""){if(this.tryConnectToCEF(),s||(s=new URLSearchParams(location.search).get("OVERLAY_WS")),s){if(this.IsOverlayPluginCEF()){console.warn("OverlayToolkit: Connect wsUrl ignored in OverlayPlugin CEF environment");return}const e=new le(s);this.api.setTransport(e)}}}class i{constructor(s,e){t(this,"type");t(this,"typeCode");t(this,"time");this.typeCode=parseInt(e[0]),this.time=e[1],this.type=s}get timeDate(){return new Date(this.time)}}class v extends i{constructor(e){super("LogLine",e);t(this,"code");t(this,"name");t(this,"line");this.code=e[2],this.name=e[3],this.line=e[4]}}class f extends i{constructor(e){super("ChangeZone",e);t(this,"zoneID");t(this,"zoneName");this.zoneID=parseInt(e[2],16),this.zoneName=e[3]}}class k extends i{constructor(e){super("ChangePrimaryPlayer",e);t(this,"charID");t(this,"charName");this.charID=parseInt(e[2],16),this.charName=e[3]}get charIDHex(){return this.charID.toString(16).toUpperCase()}}class l extends i{constructor(e){super("AddCombatant",e);t(this,"id");t(this,"name");t(this,"job");t(this,"level");t(this,"ownerID");t(this,"worldID");t(this,"worldName");t(this,"npcNameID");t(this,"npcBaseID");t(this,"currentHP");t(this,"hp");t(this,"currentMP");t(this,"mp");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.job=parseInt(e[4],16),this.level=parseInt(e[5],16),this.ownerID=parseInt(e[6],16),this.worldID=parseInt(e[7],16),this.worldName=e[8],this.npcNameID=parseInt(e[9]),this.npcBaseID=parseInt(e[10]),this.currentHP=parseInt(e[11]),this.hp=parseInt(e[12]),this.currentMP=parseInt(e[13]),this.mp=parseInt(e[14]),this.x=parseFloat(e[17]),this.y=parseFloat(e[18]),this.z=parseFloat(e[19]),this.heading=parseFloat(e[20])}}class D extends i{constructor(e){super("RemoveCombatant",e);t(this,"id");t(this,"name");t(this,"job");t(this,"level");t(this,"ownerID");t(this,"world");t(this,"npcNameID");t(this,"npcBaseID");t(this,"currentHP");t(this,"hp");t(this,"currentMP");t(this,"mp");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.job=parseInt(e[4],16),this.level=parseInt(e[5],16),this.ownerID=parseInt(e[6],16),this.world=e[8],this.npcNameID=parseInt(e[9]),this.npcBaseID=parseInt(e[10]),this.currentHP=parseInt(e[11]),this.hp=parseInt(e[12]),this.currentMP=parseInt(e[13]),this.mp=parseInt(e[14]),this.x=parseFloat(e[17]),this.y=parseFloat(e[18]),this.z=parseFloat(e[19]),this.heading=parseFloat(e[20])}}class N extends i{constructor(e){super("PartyChanged",e);t(this,"party");this.party=[];let a=parseInt(e[2]);for(let c=0;c<a;c++)this.party.push(parseInt(e[3+c],16))}}class P extends i{constructor(e){super("PlayerStats",e);t(this,"job");t(this,"strength");t(this,"dexterity");t(this,"vitality");t(this,"intelligence");t(this,"mind");t(this,"piety");t(this,"attackPower");t(this,"directHit");t(this,"criticalHit");t(this,"attakcMagicPotency");t(this,"healingMagicPotency");t(this,"determination");t(this,"skillSpeed");t(this,"spellSpeed");t(this,"tenacity");t(this,"localContentID");this.job=parseInt(e[2],16),this.strength=parseInt(e[3]),this.dexterity=parseInt(e[4]),this.vitality=parseInt(e[5]),this.intelligence=parseInt(e[6]),this.mind=parseInt(e[7]),this.piety=parseInt(e[8]),this.attackPower=parseInt(e[9]),this.directHit=parseInt(e[10]),this.criticalHit=parseInt(e[11]),this.attakcMagicPotency=parseInt(e[12]),this.healingMagicPotency=parseInt(e[13]),this.determination=parseInt(e[14]),this.skillSpeed=parseInt(e[15]),this.spellSpeed=parseInt(e[16]),this.tenacity=parseInt(e[18]),this.localContentID=parseInt(e[19],16)}}class C extends i{constructor(e){super("NetworkStartsCasting",e);t(this,"sourceID");t(this,"sourceName");t(this,"id");t(this,"ability");t(this,"targetID");t(this,"targetName");t(this,"castTime");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.sourceID=parseInt(e[2],16),this.sourceName=e[3],this.id=parseInt(e[4],16),this.ability=e[5],this.targetID=parseInt(e[6],16),this.targetName=e[7],this.castTime=parseFloat(e[8]),this.x=parseFloat(e[9]),this.y=parseFloat(e[10]),this.z=parseFloat(e[11]),this.heading=parseFloat(e[12])}}class b extends i{constructor(e){super(e[0]=="22"?"NetworkAOEAbility":"NetworkAbility",e);t(this,"sourceID");t(this,"sourceName");t(this,"id");t(this,"ability");t(this,"targetID");t(this,"targetName");t(this,"effects");t(this,"targetCurrentHP");t(this,"targetMaxHP");t(this,"targetCurrentMP");t(this,"targetMaxMP");t(this,"targetX");t(this,"targetY");t(this,"targetZ");t(this,"targetHeading");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"sequence");t(this,"targetIndex");t(this,"targetCount");t(this,"ownerID");t(this,"ownerName");t(this,"effectDisplayType");t(this,"actionID");t(this,"actionAnimationID");t(this,"animationLockTime");t(this,"rotationHex");this.sourceID=parseInt(e[2],16),this.sourceName=e[3],this.id=parseInt(e[4],16),this.ability=e[5],this.targetID=parseInt(e[6],16),this.targetName=e[7],this.effects=[];for(let a=0;a<8;a++)this.effects[a]={flags:parseInt(e[8+a*2],16),damage:e[9+a*2]};this.targetCurrentHP=parseInt(e[24]),this.targetMaxHP=parseInt(e[25]),this.targetCurrentMP=parseInt(e[26]),this.targetMaxMP=parseInt(e[27]),this.targetX=parseFloat(e[30]),this.targetY=parseFloat(e[31]),this.targetZ=parseFloat(e[32]),this.targetHeading=parseFloat(e[33]),this.currentHP=parseInt(e[34]),this.maxHP=parseInt(e[35]),this.currentMP=parseInt(e[36]),this.maxMP=parseInt(e[37]),this.x=parseFloat(e[40]),this.y=parseFloat(e[41]),this.z=parseFloat(e[42]),this.heading=parseFloat(e[43]),this.sequence=parseInt(e[44],16),this.targetIndex=parseInt(e[45]),this.targetCount=parseInt(e[46]),this.ownerID=parseInt(e[47],16),this.ownerName=e[48],this.effectDisplayType=parseInt(e[49]),this.actionID=parseInt(e[50],16),this.actionAnimationID=parseInt(e[51],16),this.animationLockTime=parseFloat(e[52]),this.rotationHex=parseInt(e[53],16)}}class x extends i{constructor(e){super("NetworkCancelAbility",e);t(this,"sourceID");t(this,"source");t(this,"id");t(this,"name");t(this,"reason");this.sourceID=parseInt(e[2],16),this.source=e[3],this.id=parseInt(e[4],16),this.name=e[5],this.reason=e[6]}}class M extends i{constructor(e){super("NetworkDoT",e);t(this,"id");t(this,"name");t(this,"which");t(this,"effectID");t(this,"damage");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"sourceID");t(this,"sourceName");t(this,"damageType");t(this,"sourceCurrentHP");t(this,"sourceMaxHP");t(this,"sourceCurrentMP");t(this,"sourceMaxMP");t(this,"sourceX");t(this,"sourceY");t(this,"sourceZ");t(this,"sourceHeading");this.id=parseInt(e[2],16),this.name=e[3],this.which=e[4],this.effectID=parseInt(e[5],16),this.damage=parseInt(e[6]),this.currentHP=parseInt(e[7]),this.maxHP=parseInt(e[8]),this.currentMP=parseInt(e[9]),this.maxMP=parseInt(e[10]),this.x=parseFloat(e[13]),this.y=parseFloat(e[14]),this.z=parseFloat(e[15]),this.heading=parseFloat(e[16]),this.sourceID=parseInt(e[17],16),this.sourceName=e[18],this.damageType=parseInt(e[19],16),this.sourceCurrentHP=parseInt(e[20]),this.sourceMaxHP=parseInt(e[21]),this.sourceCurrentMP=parseInt(e[22]),this.sourceMaxMP=parseInt(e[23]),this.sourceX=parseFloat(e[26]),this.sourceY=parseFloat(e[27]),this.sourceZ=parseFloat(e[28]),this.sourceHeading=parseFloat(e[29])}}class F extends i{constructor(e){super("NetworkDeath",e);t(this,"targetID");t(this,"targetName");t(this,"sourceID");t(this,"sourceName");this.targetID=parseInt(e[2],16),this.targetName=e[3],this.sourceID=parseInt(e[4],16),this.sourceName=e[5]}}class E extends i{constructor(e){super("NetworkBuff",e);t(this,"effectID");t(this,"effectName");t(this,"duration");t(this,"sourceID");t(this,"sourceName");t(this,"targetID");t(this,"targetName");t(this,"count");t(this,"targetMaxHP");t(this,"sourceMaxHP");this.effectID=parseInt(e[2],16),this.effectName=e[3],this.duration=parseFloat(e[4]),this.sourceID=parseInt(e[5],16),this.sourceName=e[6],this.targetID=parseInt(e[7],16),this.targetName=e[8],this.count=parseInt(e[9]),this.targetMaxHP=parseInt(e[10]==""?"-1":e[10]),this.sourceMaxHP=parseInt(e[11]==""?"-1":e[11])}}class H extends i{constructor(e){super("NetworkTargetIcon",e);t(this,"targetID");t(this,"targetName");t(this,"id");t(this,"data0");this.targetID=parseInt(e[2],16),this.targetName=e[3],this.id=parseInt(e[6],16),this.data0=parseInt(e[7],16)}}class T extends i{constructor(e){super("NetworkRaidMarker",e);t(this,"operation");t(this,"waymark");t(this,"id");t(this,"name");t(this,"x");t(this,"y");t(this,"z");this.operation=e[2],this.waymark=parseInt(e[3]),this.id=parseInt(e[4],16),this.name=e[5],this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8])}}class S extends i{constructor(e){super("NetworkTargetMarker",e);t(this,"operation");t(this,"waymark");t(this,"id");t(this,"name");t(this,"targetID");t(this,"targetName");this.operation=e[2],this.waymark=parseInt(e[3]),this.id=parseInt(e[4],16),this.name=e[5],this.targetID=parseInt(e[6],16),this.targetName=e[7]}}class L extends i{constructor(e){super("NetworkBuffRemove",e);t(this,"effectID");t(this,"effectName");t(this,"sourceID");t(this,"sourceName");t(this,"targetID");t(this,"targetName");t(this,"count");this.effectID=parseInt(e[2],16),this.effectName=e[3],this.sourceID=parseInt(e[5],16),this.sourceName=e[6],this.targetID=parseInt(e[7],16),this.targetName=e[8],this.count=parseInt(e[9],16)}}class A extends i{constructor(e){super("NetworkGauge",e);t(this,"id");t(this,"data");this.id=parseInt(e[2],16),this.data=new Uint8Array(16);let a=new DataView(this.data.buffer);for(let c=0;c<4;c++){let h=parseInt(e[3+c]);a.setUint32(c*4,h,!0)}}}class O extends i{constructor(e){super("NetworkActorControl",e);t(this,"instance");t(this,"command");t(this,"data");this.instance=parseInt(e[2],16),this.command=parseInt(e[3],16),this.data=[];for(let a=0;a<4;a++)this.data.push(parseInt(e[4+a],16))}}class q extends i{constructor(e){super("NetworkNameToggle",e);t(this,"id");t(this,"name");t(this,"targetID");t(this,"targetName");t(this,"toggle");this.id=parseInt(e[2],16),this.name=e[3],this.targetID=parseInt(e[4],16),this.targetName=e[5],this.toggle=parseInt(e[6])===1}}class z extends i{constructor(e){super("NetworkTether",e);t(this,"sourceID");t(this,"sourceName");t(this,"targetID");t(this,"targetName");t(this,"id");this.sourceID=parseInt(e[2],16),this.sourceName=e[3],this.targetID=parseInt(e[4],16),this.targetName=e[5],this.id=parseInt(e[8],16)}}class R extends i{constructor(e){super("LimitBreak",e);t(this,"value");t(this,"bars");this.value=parseInt(e[2],16),this.bars=parseInt(e[3])}}class B extends i{constructor(e){super("NetworkActionSync",e);t(this,"id");t(this,"name");t(this,"sequenceID");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"currentShield");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.sequenceID=parseInt(e[4],16),this.currentHP=e[5]?parseInt(e[5]):-1,this.maxHP=e[6]?parseInt(e[6]):-1,this.currentMP=e[7]?parseInt(e[7]):-1,this.maxMP=e[8]?parseInt(e[8]):-1,this.currentShield=e[9]?parseInt(e[9]):-1,this.x=parseFloat(e[11]),this.y=parseFloat(e[12]),this.z=parseFloat(e[13]),this.heading=parseFloat(e[14])}}class U extends i{constructor(e){super("NetworkStatusEffects",e);t(this,"targetID");t(this,"targetName");t(this,"jobLevelData");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"currentShield");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"data");this.targetID=parseInt(e[2],16),this.targetName=e[3],this.jobLevelData=parseInt(e[4],16),this.currentHP=parseInt(e[5]),this.maxHP=parseInt(e[6]),this.currentMP=parseInt(e[7]),this.maxMP=parseInt(e[8]),this.currentShield=parseInt(e[9]),this.x=parseFloat(e[11]),this.y=parseFloat(e[12]),this.z=parseFloat(e[13]),this.heading=parseFloat(e[14]),this.data=[];for(let a=0;a<6;a++)this.data.push(parseInt(e[15+a],16))}}class _ extends i{constructor(e){super("NetworkUpdateHP",e);t(this,"id");t(this,"name");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.currentHP=parseInt(e[4]),this.maxHP=parseInt(e[5]),this.currentMP=parseInt(e[6]),this.maxMP=parseInt(e[7]),this.x=parseFloat(e[10]),this.y=parseFloat(e[11]),this.z=parseFloat(e[12]),this.heading=parseFloat(e[13])}}class j extends i{constructor(e){super("Map",e);t(this,"id");t(this,"regionName");t(this,"placeName");t(this,"placeNameSub");this.id=parseInt(e[2],16),this.regionName=e[3],this.placeName=e[4],this.placeNameSub=e[5]}}class G extends i{constructor(e){super("SystemLogMessage",e);t(this,"instance");t(this,"id");t(this,"params");this.instance=parseInt(e[2],16),this.id=parseInt(e[3],16),this.params=[];for(let a=0;a<3;a++)this.params.push(parseInt(e[4+a],16))}}class V extends i{constructor(e){super("StatusList3",e);t(this,"id");t(this,"name");t(this,"statusList");this.id=parseInt(e[2],16),this.name=e[3],this.statusList=[];for(let a=0;a<e.length-4-1;a++)this.statusList.push(parseInt(e[4+a],16))}}class W extends i{constructor(e){super("Debug",e);t(this,"message");this.message=e[2]}}class Y extends i{constructor(e){super("PacketDump",e);t(this,"len");t(this,"src");t(this,"dst");t(this,"packetType");t(this,"data");this.len=parseInt(e[2],16),this.src=parseInt(e[3],16),this.dst=parseInt(e[4],16),this.packetType=parseInt(e[5],16)&65535,this.data=new Uint8Array(this.len-16);for(let a=6,c=0;a<e.length-2;a++,c++){const h=parseInt(e[a],16);for(let u=0;u<4;u++)this.data[c*4+u]=h>>u*8&255}}}class Z extends i{constructor(e){super("Version",e);t(this,"message");this.message=e[2]}}let J=class extends i{constructor(e){super("Error",e);t(this,"message");this.message=e[2]}};class X extends i{constructor(e){super("LineRegistration",e);t(this,"id");t(this,"source");t(this,"name");t(this,"version");this.id=parseInt(e[2]),this.source=e[3],this.name=e[4],this.version=e[5]}}class K extends i{constructor(e){super("MapEffect",e);t(this,"instance");t(this,"flags");t(this,"location");t(this,"data0");t(this,"data1");this.instance=parseInt(e[2],16),this.flags=parseInt(e[3],16),this.location=parseInt(e[4],16),this.data0=parseInt(e[5],16),this.data1=parseInt(e[6],16)}}class $ extends i{constructor(e){super("FateDirector",e);t(this,"category");t(this,"unknown");t(this,"id");t(this,"progress");this.category=e[2],this.unknown=parseInt(e[3],16),this.id=parseInt(e[4],16),this.progress=parseInt(e[5],16)}}class Q extends i{constructor(e){super("CEDirector",e);t(this,"popTime");t(this,"timeRemaining");t(this,"unknown");t(this,"ceKey");t(this,"numPlayers");t(this,"status");t(this,"unknown2");t(this,"progress");this.popTime=parseInt(e[2],16),this.timeRemaining=parseInt(e[3],16),this.unknown=parseInt(e[4],16),this.ceKey=parseInt(e[5],16),this.numPlayers=parseInt(e[6],16),this.status=parseInt(e[7],16),this.unknown2=parseInt(e[8],16),this.progress=parseInt(e[9],16)}}class g extends i{constructor(e){super("InCombat",e);t(this,"inACTCombat");t(this,"inGameCombat");t(this,"isACTChanged");t(this,"isGameChanged");this.inACTCombat=parseInt(e[2])===1,this.inGameCombat=parseInt(e[3])===1,this.isACTChanged=parseInt(e[4])===1,this.isGameChanged=parseInt(e[5])===1}}class ee extends i{constructor(e){super("CombatantMemory",e);t(this,"change");t(this,"id");t(this,"data");this.change=e[2],this.id=parseInt(e[3],16),this.data=new Map;for(let a=4;a<e.length-1;a+=2)this.data.set(e[a],e[a+1])}}class te extends i{constructor(e){super("RSVData",e);t(this,"locale");t(this,"unknown");t(this,"key");t(this,"value");this.locale=e[2],this.unknown=parseInt(e[3],16),this.key=e[4],this.value=e[5]}}class se extends i{constructor(e){super("StartsUsingExtra",e);t(this,"sourceID");t(this,"id");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.sourceID=parseInt(e[2],16),this.id=parseInt(e[3],16),this.x=parseFloat(e[4]),this.y=parseFloat(e[5]),this.z=parseFloat(e[6]),this.heading=parseFloat(e[7])}}class re extends i{constructor(e){super("AbilityExtra",e);t(this,"sourceID");t(this,"id");t(this,"globalEffectCounter");t(this,"dataFlag");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"animationTargetId");this.sourceID=parseInt(e[2],16),this.id=parseInt(e[3],16),this.globalEffectCounter=parseInt(e[4],16),this.dataFlag=parseInt(e[5],16),this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8]),this.heading=parseFloat(e[9]),this.animationTargetId=parseInt(e[10],16)}}class ae extends i{constructor(e){super("ContentFinderSettings",e);t(this,"zoneID");t(this,"zoneName");t(this,"inContentFinderContent");t(this,"unrestrictedParty");t(this,"minimalItemLevel");t(this,"silenceEcho");t(this,"explorerMode");t(this,"levelSync");this.zoneID=parseInt(e[2],16),this.zoneName=e[3],this.inContentFinderContent=parseInt(e[4])===1,this.unrestrictedParty=parseInt(e[5])===1,this.minimalItemLevel=parseInt(e[6])===1,this.silenceEcho=parseInt(e[7])===1,this.explorerMode=parseInt(e[8])===1,this.levelSync=parseInt(e[9])===1}}class ne extends i{constructor(e){super("NpcYell",e);t(this,"npcId");t(this,"npcNameId");t(this,"npcYellId");this.npcId=parseInt(e[2],16),this.npcNameId=parseInt(e[3],16),this.npcYellId=parseInt(e[4],16)}}class ie extends i{constructor(e){super("BattleTalk2",e);t(this,"npcId");t(this,"instance");t(this,"npcNameId");t(this,"instanceContentTextId");t(this,"displayMs");this.npcId=parseInt(e[2],16),this.instance=parseInt(e[3],16),this.npcNameId=parseInt(e[4],16),this.instanceContentTextId=parseInt(e[5],16),this.displayMs=parseInt(e[6])}}class ce extends i{constructor(e){super("Countdown",e);t(this,"id");t(this,"worldID");t(this,"countdownTime");t(this,"result");t(this,"name");this.id=parseInt(e[2],16),this.worldID=parseInt(e[3],16),this.countdownTime=parseInt(e[4]),this.result=parseInt(e[5],16),this.name=e[6]}}class he extends i{constructor(e){super("CountdownCancel",e);t(this,"id");t(this,"worldID");t(this,"name");this.id=parseInt(e[2],16),this.worldID=parseInt(e[3],16),this.name=e[4]}}class pe extends i{constructor(e){super("ActorMove",e);t(this,"id");t(this,"heading");t(this,"unk1");t(this,"unk2");t(this,"x");t(this,"y");t(this,"z");this.id=parseInt(e[2],16),this.heading=parseFloat(e[3]),this.unk1=parseInt(e[4],16),this.unk2=parseInt(e[5],16),this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8])}}class ue extends i{constructor(e){super("ActorSetPos",e);t(this,"id");t(this,"heading");t(this,"unk1");t(this,"unk2");t(this,"x");t(this,"y");t(this,"z");this.id=parseInt(e[2],16),this.heading=parseFloat(e[3]),this.unk1=parseInt(e[4],16),this.unk2=parseInt(e[5],16),this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8])}}class de extends i{constructor(e){super("SpawnNpcExtra",e);t(this,"id");t(this,"parentID");t(this,"tetherID");t(this,"animationState");this.id=parseInt(e[2],16),this.parentID=parseInt(e[3],16),this.tetherID=parseInt(e[4],16),this.animationState=parseInt(e[5],16)}}class oe extends i{constructor(e){super("ActorControlExtra",e);t(this,"id");t(this,"category");t(this,"param1");t(this,"param2");t(this,"param3");t(this,"param4");this.id=parseInt(e[2],16),this.category=parseInt(e[3],16),this.param1=parseInt(e[4],16),this.param2=parseInt(e[5],16),this.param3=parseInt(e[6],16),this.param4=parseInt(e[7],16)}}class Ie extends i{constructor(e){super("ActorControlSelfExtra",e);t(this,"id");t(this,"category");t(this,"param1");t(this,"param2");t(this,"param3");t(this,"param4");t(this,"param5");t(this,"param6");this.id=parseInt(e[2],16),this.category=parseInt(e[3],16),this.param1=parseInt(e[4],16),this.param2=parseInt(e[5],16),this.param3=parseInt(e[6],16),this.param4=parseInt(e[7],16),this.param5=parseInt(e[8],16),this.param6=parseInt(e[9],16)}}class me extends i{constructor(e){super("Unknown",e);t(this,"rawLines");this.rawLines=e}}function De(r){switch(parseInt(r[0])){case 0:return new v(r);case 1:return new f(r);case 2:return new k(r);case 3:return new l(r);case 4:return new D(r);case 11:return new N(r);case 12:return new P(r);case 20:return new C(r);case 21:case 22:return new b(r);case 23:return new x(r);case 24:return new M(r);case 25:return new F(r);case 26:return new E(r);case 27:return new H(r);case 28:return new T(r);case 29:return new S(r);case 30:return new L(r);case 31:return new A(r);case 33:return new O(r);case 34:return new q(r);case 35:return new z(r);case 36:return new R(r);case 37:return new B(r);case 38:return new U(r);case 39:return new _(r);case 40:return new j(r);case 41:return new G(r);case 42:return new V(r);case 251:return new W(r);case 252:return new Y(r);case 253:return new Z(r);case 254:return new J(r);case 256:return new X(r);case 257:return new K(r);case 258:return new $(r);case 259:return new Q(r);case 260:return new g(r);case 261:return new ee(r);case 262:return new te(r);case 263:return new se(r);case 264:return new re(r);case 265:return new ae(r);case 266:return new ne(r);case 267:return new ie(r);case 268:return new ce(r);case 269:return new he(r);case 270:return new pe(r);case 271:return new ue(r);case 272:return new de(r);case 273:return new oe(r);case 274:return new Ie(r);default:return new me(r)}}let we=new y;(function(){we.Connect()})(),n.AbilityExtra=re,n.ActorControlExtra=oe,n.ActorControlSelfExtra=Ie,n.ActorMove=pe,n.ActorSetPos=ue,n.AddCombatant=l,n.BattleTalk2=ie,n.CEDirector=Q,n.ChangePrimaryPlayer=k,n.ChangeZone=f,n.CombatantMemory=ee,n.ContentFinderSettings=ae,n.Countdown=ce,n.CountdownCancel=he,n.Debug=W,n.Error=J,n.FateDirector=$,n.GameLogLine=v,n.InCombat=g,n.LimitBreak=R,n.LineRegistration=X,n.LogLineBase=i,n.MapEffect=K,n.MapLog=j,n.NetowrkStartsCasting=C,n.NetworkAbility=b,n.NetworkActionSync=B,n.NetworkActorControl=O,n.NetworkBuff=E,n.NetworkBuffRemove=L,n.NetworkCancelAbility=x,n.NetworkDeath=F,n.NetworkDoT=M,n.NetworkGauge=A,n.NetworkNameToggle=q,n.NetworkRaidMarker=T,n.NetworkStatusEffects=U,n.NetworkTargetIcon=H,n.NetworkTargetMarker=S,n.NetworkTether=z,n.NetworkUpdateHP=_,n.NpcYell=ne,n.OverlayToolkit=y,n.PacketDump=Y,n.ParseLogLine=De,n.PartyList=N,n.PlayerStats=P,n.RSVData=te,n.RemoveCombatant=D,n.SpawnNpcExtra=de,n.StartsUsingExtra=se,n.StatusList3=V,n.SystemLogMessage=G,n.UnknownLogLine=me,n.Version=Z,n.default=we,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/overlay.d.ts CHANGED
@@ -20,8 +20,24 @@ export interface OverlayEventMessage {
20
20
  }
21
21
  export interface IOverlayAPI {
22
22
  dispatchOverlayEvent(event: OverlayEventMessage): void;
23
+ /**
24
+ * Add an overlay listener for specific event
25
+ * @param event Event name
26
+ * @param cb Callback function
27
+ */
23
28
  addOverlayListener(event: string, cb: OverlayEvenetHandler): void;
24
- removeOverlayListener(event: string, cb: OverlayEvenetHandler): void;
29
+ /**
30
+ * Set an overlay listener for specific event, replacing existing listeners
31
+ * @param event Event name
32
+ * @param cb Callback function
33
+ */
34
+ setOverlayListener(event: string, cb: OverlayEvenetHandler): void;
35
+ /**
36
+ * Remove an overlay listener
37
+ * @param event Event name
38
+ * @param cb Callback function (if not provided, remove all listeners for the event)
39
+ */
40
+ removeOverlayListener(event: string, cb?: OverlayEvenetHandler): void;
25
41
  callOverlayHandler(msg: OverlayCallMessage): Promise<any>;
26
42
  startOverlayEvents(): void;
27
43
  }
@@ -34,7 +50,8 @@ export declare class OverlayPluginAPI implements IOverlayAPI {
34
50
  constructor(transport?: OverlayTransport | null);
35
51
  dispatchOverlayEvent(event: OverlayEventMessage): void;
36
52
  addOverlayListener(event: string, cb: OverlayEvenetHandler): void;
37
- removeOverlayListener(event: string, cb: OverlayEvenetHandler): void;
53
+ setOverlayListener(event: string, cb: OverlayEvenetHandler): void;
54
+ removeOverlayListener(event: string, cb?: OverlayEvenetHandler): void;
38
55
  callOverlayHandler(msg: OverlayCallMessage): Promise<any>;
39
56
  /**
40
57
  * Start overlay events
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "overlay-toolkit",
3
3
  "private": false,
4
- "version": "0.11.0",
4
+ "version": "0.11.2",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"