wuira 0.1.5 → 0.1.6

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +63 -1
  2. package/README.md +235 -0
  3. package/lib/Spells.d.ts +11 -0
  4. package/lib/Spells.lua +22 -0
  5. package/lib/datasources/KnownSpells.d.ts +21 -0
  6. package/lib/datasources/KnownSpells.lua +794 -0
  7. package/lib/datasources/ManaRegenTimer.d.ts +29 -0
  8. package/lib/datasources/ManaRegenTimer.lua +674 -0
  9. package/lib/datasources/ProgressSource.lua +15 -2
  10. package/lib/datasources/Resources.d.ts +13 -1
  11. package/lib/datasources/Resources.lua +118 -39
  12. package/lib/datasources/SpellCooldown.d.ts +4 -2
  13. package/lib/datasources/SpellCooldown.lua +13 -2
  14. package/lib/datasources/SpellSource.d.ts +14 -0
  15. package/lib/datasources/SpellSource.lua +224 -0
  16. package/lib/datasources/TimerSource.d.ts +2 -0
  17. package/lib/datasources/TimerSource.lua +54 -0
  18. package/lib/datasources/TotemTimer.d.ts +10 -0
  19. package/lib/datasources/TotemTimer.lua +260 -0
  20. package/lib/datasources/index.d.ts +7 -0
  21. package/lib/datasources/index.lua +16 -0
  22. package/lib/index.d.ts +8 -0
  23. package/lib/index.lua +16 -0
  24. package/lib/platform/ActionBars.d.ts +27 -0
  25. package/lib/platform/ActionBars.lua +726 -0
  26. package/lib/platform/AddonSettings.d.ts +9 -0
  27. package/lib/platform/AddonSettings.lua +36 -0
  28. package/lib/platform/BlizzardUI.d.ts +5 -0
  29. package/lib/platform/BlizzardUI.lua +357 -20
  30. package/lib/platform/MicroMenu.d.ts +15 -0
  31. package/lib/platform/MicroMenu.lua +219 -0
  32. package/lib/platform/SecureButton.d.ts +5 -0
  33. package/lib/platform/SecureButton.lua +196 -0
  34. package/lib/platform/SlashCommands.d.ts +3 -0
  35. package/lib/platform/SlashCommands.lua +309 -0
  36. package/lib/platform/forever.d.ts +78 -3
  37. package/lib/skins/MicroBar.d.ts +8 -0
  38. package/lib/skins/MicroBar.lua +65 -0
  39. package/lib/skins/NativeSkin.d.ts +26 -0
  40. package/lib/skins/NativeSkin.lua +601 -0
  41. package/lib/skins/index.d.ts +3 -0
  42. package/lib/skins/index.lua +11 -0
  43. package/lib/store/index.lua +13 -0
  44. package/lib/ui/Button.d.ts +10 -0
  45. package/lib/ui/Button.lua +9 -0
  46. package/lib/ui/Cell.d.ts +5 -1
  47. package/lib/ui/FrameMover.d.ts +21 -0
  48. package/lib/ui/FrameMover.lua +123 -0
  49. package/lib/ui/HoverTracker.d.ts +20 -0
  50. package/lib/ui/HoverTracker.lua +88 -0
  51. package/lib/ui/KeybindCapture.d.ts +20 -0
  52. package/lib/ui/KeybindCapture.lua +488 -0
  53. package/lib/ui/SecureButton.d.ts +44 -0
  54. package/lib/ui/SecureButton.lua +9 -0
  55. package/lib/ui/index.d.ts +9 -0
  56. package/lib/ui/index.lua +20 -0
  57. package/lib/ui/layout/measureLayout.lua +4 -2
  58. package/lib/ui/mount.lua +500 -117
  59. package/lib/ui/primitives/jsx.d.ts +9 -1
  60. package/lib/wuira.d.ts +3 -0
  61. package/lib/wuira.lua +5 -0
  62. package/package.json +8 -1
  63. package/tools/build-library.mjs +1 -1
@@ -0,0 +1,794 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ -- Lua Library inline imports
3
+ local function __TS__Class(self)
4
+ local c = {prototype = {}}
5
+ c.prototype.__index = c.prototype
6
+ c.prototype.constructor = c
7
+ return c
8
+ end
9
+
10
+ local function __TS__ClassExtends(target, base)
11
+ target.____super = base
12
+ local staticMetatable = setmetatable({__index = base}, base)
13
+ setmetatable(target, staticMetatable)
14
+ local baseMetatable = getmetatable(base)
15
+ if baseMetatable then
16
+ if type(baseMetatable.__index) == "function" then
17
+ staticMetatable.__index = baseMetatable.__index
18
+ end
19
+ if type(baseMetatable.__newindex) == "function" then
20
+ staticMetatable.__newindex = baseMetatable.__newindex
21
+ end
22
+ end
23
+ setmetatable(target.prototype, base.prototype)
24
+ if type(base.prototype.__index) == "function" then
25
+ target.prototype.__index = base.prototype.__index
26
+ end
27
+ if type(base.prototype.__newindex) == "function" then
28
+ target.prototype.__newindex = base.prototype.__newindex
29
+ end
30
+ if type(base.prototype.__tostring) == "function" then
31
+ target.prototype.__tostring = base.prototype.__tostring
32
+ end
33
+ end
34
+
35
+ local __TS__Symbol, Symbol
36
+ do
37
+ local symbolMetatable = {__tostring = function(self)
38
+ return ("Symbol(" .. (self.description or "")) .. ")"
39
+ end}
40
+ function __TS__Symbol(description)
41
+ return setmetatable({description = description}, symbolMetatable)
42
+ end
43
+ Symbol = {
44
+ asyncDispose = __TS__Symbol("Symbol.asyncDispose"),
45
+ dispose = __TS__Symbol("Symbol.dispose"),
46
+ iterator = __TS__Symbol("Symbol.iterator"),
47
+ hasInstance = __TS__Symbol("Symbol.hasInstance"),
48
+ species = __TS__Symbol("Symbol.species"),
49
+ toStringTag = __TS__Symbol("Symbol.toStringTag")
50
+ }
51
+ end
52
+
53
+ local __TS__Iterator
54
+ do
55
+ local function iteratorGeneratorStep(self)
56
+ local co = self.____coroutine
57
+ local status, value = coroutine.resume(co)
58
+ if not status then
59
+ error(value, 0)
60
+ end
61
+ if coroutine.status(co) == "dead" then
62
+ return
63
+ end
64
+ return true, value
65
+ end
66
+ local function iteratorIteratorStep(self)
67
+ local result = self:next()
68
+ if result.done then
69
+ return
70
+ end
71
+ return true, result.value
72
+ end
73
+ local function iteratorStringStep(self, index)
74
+ index = index + 1
75
+ if index > #self then
76
+ return
77
+ end
78
+ return index, string.sub(self, index, index)
79
+ end
80
+ function __TS__Iterator(iterable)
81
+ if type(iterable) == "string" then
82
+ return iteratorStringStep, iterable, 0
83
+ elseif iterable.____coroutine ~= nil then
84
+ return iteratorGeneratorStep, iterable
85
+ elseif iterable[Symbol.iterator] then
86
+ local iterator = iterable[Symbol.iterator](iterable)
87
+ return iteratorIteratorStep, iterator
88
+ else
89
+ return ipairs(iterable)
90
+ end
91
+ end
92
+ end
93
+
94
+ local function __TS__New(target, ...)
95
+ local instance = setmetatable({}, target.prototype)
96
+ instance:____constructor(...)
97
+ return instance
98
+ end
99
+
100
+ local Set
101
+ do
102
+ Set = __TS__Class()
103
+ Set.name = "Set"
104
+ function Set.prototype.____constructor(self, values)
105
+ self[Symbol.toStringTag] = "Set"
106
+ self.size = 0
107
+ self.nextKey = {}
108
+ self.previousKey = {}
109
+ if values == nil then
110
+ return
111
+ end
112
+ local iterable = values
113
+ if iterable[Symbol.iterator] then
114
+ local iterator = iterable[Symbol.iterator](iterable)
115
+ while true do
116
+ local result = iterator:next()
117
+ if result.done then
118
+ break
119
+ end
120
+ self:add(result.value)
121
+ end
122
+ else
123
+ local array = values
124
+ for ____, value in ipairs(array) do
125
+ self:add(value)
126
+ end
127
+ end
128
+ end
129
+ function Set.prototype.add(self, value)
130
+ local isNewValue = not self:has(value)
131
+ if isNewValue then
132
+ self.size = self.size + 1
133
+ end
134
+ if self.firstKey == nil then
135
+ self.firstKey = value
136
+ self.lastKey = value
137
+ elseif isNewValue then
138
+ self.nextKey[self.lastKey] = value
139
+ self.previousKey[value] = self.lastKey
140
+ self.lastKey = value
141
+ end
142
+ return self
143
+ end
144
+ function Set.prototype.clear(self)
145
+ self.nextKey = {}
146
+ self.previousKey = {}
147
+ self.firstKey = nil
148
+ self.lastKey = nil
149
+ self.size = 0
150
+ end
151
+ function Set.prototype.delete(self, value)
152
+ local contains = self:has(value)
153
+ if contains then
154
+ self.size = self.size - 1
155
+ local next = self.nextKey[value]
156
+ local previous = self.previousKey[value]
157
+ if next ~= nil and previous ~= nil then
158
+ self.nextKey[previous] = next
159
+ self.previousKey[next] = previous
160
+ elseif next ~= nil then
161
+ self.firstKey = next
162
+ self.previousKey[next] = nil
163
+ elseif previous ~= nil then
164
+ self.lastKey = previous
165
+ self.nextKey[previous] = nil
166
+ else
167
+ self.firstKey = nil
168
+ self.lastKey = nil
169
+ end
170
+ self.nextKey[value] = nil
171
+ self.previousKey[value] = nil
172
+ end
173
+ return contains
174
+ end
175
+ function Set.prototype.forEach(self, callback)
176
+ for ____, key in __TS__Iterator(self:keys()) do
177
+ callback(nil, key, key, self)
178
+ end
179
+ end
180
+ function Set.prototype.has(self, value)
181
+ return self.nextKey[value] ~= nil or self.lastKey == value
182
+ end
183
+ Set.prototype[Symbol.iterator] = function(self)
184
+ return self:values()
185
+ end
186
+ function Set.prototype.entries(self)
187
+ local function getFirstKey()
188
+ return self.firstKey
189
+ end
190
+ local nextKey = self.nextKey
191
+ local key
192
+ local started = false
193
+ return {
194
+ [Symbol.iterator] = function(self)
195
+ return self
196
+ end,
197
+ next = function(self)
198
+ if not started then
199
+ started = true
200
+ key = getFirstKey(nil)
201
+ else
202
+ key = nextKey[key]
203
+ end
204
+ return {done = not key, value = {key, key}}
205
+ end
206
+ }
207
+ end
208
+ function Set.prototype.keys(self)
209
+ local function getFirstKey()
210
+ return self.firstKey
211
+ end
212
+ local nextKey = self.nextKey
213
+ local key
214
+ local started = false
215
+ return {
216
+ [Symbol.iterator] = function(self)
217
+ return self
218
+ end,
219
+ next = function(self)
220
+ if not started then
221
+ started = true
222
+ key = getFirstKey(nil)
223
+ else
224
+ key = nextKey[key]
225
+ end
226
+ return {done = not key, value = key}
227
+ end
228
+ }
229
+ end
230
+ function Set.prototype.values(self)
231
+ local function getFirstKey()
232
+ return self.firstKey
233
+ end
234
+ local nextKey = self.nextKey
235
+ local key
236
+ local started = false
237
+ return {
238
+ [Symbol.iterator] = function(self)
239
+ return self
240
+ end,
241
+ next = function(self)
242
+ if not started then
243
+ started = true
244
+ key = getFirstKey(nil)
245
+ else
246
+ key = nextKey[key]
247
+ end
248
+ return {done = not key, value = key}
249
+ end
250
+ }
251
+ end
252
+ function Set.prototype.union(self, other)
253
+ local result = __TS__New(Set, self)
254
+ for ____, item in __TS__Iterator(other) do
255
+ result:add(item)
256
+ end
257
+ return result
258
+ end
259
+ function Set.prototype.intersection(self, other)
260
+ local result = __TS__New(Set)
261
+ for ____, item in __TS__Iterator(self) do
262
+ if other:has(item) then
263
+ result:add(item)
264
+ end
265
+ end
266
+ return result
267
+ end
268
+ function Set.prototype.difference(self, other)
269
+ local result = __TS__New(Set, self)
270
+ for ____, item in __TS__Iterator(other) do
271
+ result:delete(item)
272
+ end
273
+ return result
274
+ end
275
+ function Set.prototype.symmetricDifference(self, other)
276
+ local result = __TS__New(Set, self)
277
+ for ____, item in __TS__Iterator(other) do
278
+ if self:has(item) then
279
+ result:delete(item)
280
+ else
281
+ result:add(item)
282
+ end
283
+ end
284
+ return result
285
+ end
286
+ function Set.prototype.isSubsetOf(self, other)
287
+ for ____, item in __TS__Iterator(self) do
288
+ if not other:has(item) then
289
+ return false
290
+ end
291
+ end
292
+ return true
293
+ end
294
+ function Set.prototype.isSupersetOf(self, other)
295
+ for ____, item in __TS__Iterator(other) do
296
+ if not self:has(item) then
297
+ return false
298
+ end
299
+ end
300
+ return true
301
+ end
302
+ function Set.prototype.isDisjointFrom(self, other)
303
+ for ____, item in __TS__Iterator(self) do
304
+ if other:has(item) then
305
+ return false
306
+ end
307
+ end
308
+ return true
309
+ end
310
+ Set[Symbol.species] = Set
311
+ end
312
+
313
+ local function __TS__ArraySlice(self, first, last)
314
+ local len = #self
315
+ first = first or 0
316
+ if first < 0 then
317
+ first = len + first
318
+ if first < 0 then
319
+ first = 0
320
+ end
321
+ else
322
+ if first > len then
323
+ first = len
324
+ end
325
+ end
326
+ last = last or len
327
+ if last < 0 then
328
+ last = len + last
329
+ if last < 0 then
330
+ last = 0
331
+ end
332
+ else
333
+ if last > len then
334
+ last = len
335
+ end
336
+ end
337
+ local out = {}
338
+ first = first + 1
339
+ last = last + 1
340
+ local n = 1
341
+ while first < last do
342
+ out[n] = self[first]
343
+ first = first + 1
344
+ n = n + 1
345
+ end
346
+ return out
347
+ end
348
+
349
+ local function __TS__ArrayIncludes(self, searchElement, fromIndex)
350
+ if fromIndex == nil then
351
+ fromIndex = 0
352
+ end
353
+ local len = #self
354
+ local k = fromIndex
355
+ if fromIndex < 0 then
356
+ k = len + fromIndex
357
+ end
358
+ if k < 0 then
359
+ k = 0
360
+ end
361
+ for i = k + 1, len do
362
+ if self[i] == searchElement then
363
+ return true
364
+ end
365
+ end
366
+ return false
367
+ end
368
+
369
+ local __TS__ArrayFrom
370
+ do
371
+ local function arrayLikeStep(self, index)
372
+ index = index + 1
373
+ if index > self.length then
374
+ return
375
+ end
376
+ return index, self[index]
377
+ end
378
+ local function arrayLikeIterator(arr)
379
+ if type(arr.length) == "number" then
380
+ return arrayLikeStep, arr, 0
381
+ end
382
+ return __TS__Iterator(arr)
383
+ end
384
+ function __TS__ArrayFrom(arrayLike, mapFn, thisArg)
385
+ local result = {}
386
+ if mapFn == nil then
387
+ for ____, v in arrayLikeIterator(arrayLike) do
388
+ result[#result + 1] = v
389
+ end
390
+ else
391
+ local i = 0
392
+ for ____, v in arrayLikeIterator(arrayLike) do
393
+ local ____mapFn_3 = mapFn
394
+ local ____thisArg_1 = thisArg
395
+ local ____v_2 = v
396
+ local ____i_0 = i
397
+ i = ____i_0 + 1
398
+ result[#result + 1] = ____mapFn_3(____thisArg_1, ____v_2, ____i_0)
399
+ end
400
+ end
401
+ return result
402
+ end
403
+ end
404
+
405
+ local function __TS__ArraySort(self, compareFn)
406
+ if compareFn ~= nil then
407
+ table.sort(
408
+ self,
409
+ function(a, b) return compareFn(nil, a, b) < 0 end
410
+ )
411
+ else
412
+ table.sort(self)
413
+ end
414
+ return self
415
+ end
416
+
417
+ local function __TS__CloneDescriptor(____bindingPattern0)
418
+ local value
419
+ local writable
420
+ local set
421
+ local get
422
+ local configurable
423
+ local enumerable
424
+ enumerable = ____bindingPattern0.enumerable
425
+ configurable = ____bindingPattern0.configurable
426
+ get = ____bindingPattern0.get
427
+ set = ____bindingPattern0.set
428
+ writable = ____bindingPattern0.writable
429
+ value = ____bindingPattern0.value
430
+ local descriptor = {enumerable = enumerable == true, configurable = configurable == true}
431
+ local hasGetterOrSetter = get ~= nil or set ~= nil
432
+ local hasValueOrWritableAttribute = writable ~= nil or value ~= nil
433
+ if hasGetterOrSetter and hasValueOrWritableAttribute then
434
+ error("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", 0)
435
+ end
436
+ if get or set then
437
+ descriptor.get = get
438
+ descriptor.set = set
439
+ else
440
+ descriptor.value = value
441
+ descriptor.writable = writable == true
442
+ end
443
+ return descriptor
444
+ end
445
+
446
+ local __TS__DescriptorGet
447
+ do
448
+ local getmetatable = _G.getmetatable
449
+ local ____rawget = _G.rawget
450
+ function __TS__DescriptorGet(self, metatable, key)
451
+ while metatable do
452
+ local rawResult = ____rawget(metatable, key)
453
+ if rawResult ~= nil then
454
+ return rawResult
455
+ end
456
+ local descriptors = ____rawget(metatable, "_descriptors")
457
+ if descriptors then
458
+ local descriptor = descriptors[key]
459
+ if descriptor ~= nil then
460
+ if descriptor.get then
461
+ return descriptor.get(self)
462
+ end
463
+ return descriptor.value
464
+ end
465
+ end
466
+ metatable = getmetatable(metatable)
467
+ end
468
+ end
469
+ end
470
+
471
+ local __TS__DescriptorSet
472
+ do
473
+ local getmetatable = _G.getmetatable
474
+ local ____rawget = _G.rawget
475
+ local rawset = _G.rawset
476
+ function __TS__DescriptorSet(self, metatable, key, value)
477
+ while metatable do
478
+ local descriptors = ____rawget(metatable, "_descriptors")
479
+ if descriptors then
480
+ local descriptor = descriptors[key]
481
+ if descriptor ~= nil then
482
+ if descriptor.set then
483
+ descriptor.set(self, value)
484
+ else
485
+ if descriptor.writable == false then
486
+ error(
487
+ ((("Cannot assign to read only property '" .. key) .. "' of object '") .. tostring(self)) .. "'",
488
+ 0
489
+ )
490
+ end
491
+ descriptor.value = value
492
+ end
493
+ return
494
+ end
495
+ end
496
+ metatable = getmetatable(metatable)
497
+ end
498
+ rawset(self, key, value)
499
+ end
500
+ end
501
+
502
+ local __TS__SetDescriptor
503
+ do
504
+ local getmetatable = _G.getmetatable
505
+ local function descriptorIndex(self, key)
506
+ return __TS__DescriptorGet(
507
+ self,
508
+ getmetatable(self),
509
+ key
510
+ )
511
+ end
512
+ local function descriptorNewIndex(self, key, value)
513
+ return __TS__DescriptorSet(
514
+ self,
515
+ getmetatable(self),
516
+ key,
517
+ value
518
+ )
519
+ end
520
+ function __TS__SetDescriptor(target, key, desc, isPrototype)
521
+ if isPrototype == nil then
522
+ isPrototype = false
523
+ end
524
+ local ____isPrototype_0
525
+ if isPrototype then
526
+ ____isPrototype_0 = target
527
+ else
528
+ ____isPrototype_0 = getmetatable(target)
529
+ end
530
+ local metatable = ____isPrototype_0
531
+ if not metatable then
532
+ metatable = {}
533
+ setmetatable(target, metatable)
534
+ end
535
+ if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
536
+ local instanceMetatable = {}
537
+ instanceMetatable._isOwnDescriptorMetatable = true
538
+ setmetatable(instanceMetatable, metatable)
539
+ setmetatable(target, instanceMetatable)
540
+ metatable = instanceMetatable
541
+ end
542
+ local value = rawget(target, key)
543
+ if value ~= nil then
544
+ rawset(target, key, nil)
545
+ end
546
+ if not rawget(metatable, "_descriptors") then
547
+ metatable._descriptors = {}
548
+ end
549
+ metatable._descriptors[key] = __TS__CloneDescriptor(desc)
550
+ metatable.__index = descriptorIndex
551
+ metatable.__newindex = descriptorNewIndex
552
+ end
553
+ end
554
+ -- End of Lua Library inline imports
555
+ local ____exports = {}
556
+ local ____DataSource = require("datasources.DataSource")
557
+ local DataSource = ____DataSource.DataSource
558
+ --- Cached learned player spellbook IDs. Native events refresh the snapshot; no polling.
559
+ ____exports.KnownSpells = __TS__Class()
560
+ local KnownSpells = ____exports.KnownSpells
561
+ KnownSpells.name = "KnownSpells"
562
+ __TS__ClassExtends(KnownSpells, DataSource)
563
+ function KnownSpells.prototype.____constructor(self)
564
+ DataSource.prototype.____constructor(self, {})
565
+ self.ids = {}
566
+ self.names = __TS__New(Set)
567
+ self.status = "unavailable"
568
+ self.listeners = __TS__New(Set)
569
+ self.disposed = false
570
+ self.frame = CreateFrame("Frame", nil, UIParent)
571
+ for ____, event in ipairs({
572
+ "PLAYER_ENTERING_WORLD",
573
+ "PLAYER_LEVEL_UP",
574
+ "SPELLS_CHANGED",
575
+ "LEARNED_SPELL_IN_SKILL_LINE",
576
+ "PLAYER_TALENT_UPDATE",
577
+ "CHARACTER_POINTS_CHANGED"
578
+ }) do
579
+ do
580
+ pcall(function()
581
+ self.frame:RegisterEvent(event)
582
+ end)
583
+ end
584
+ end
585
+ self.frame:SetScript(
586
+ "OnEvent",
587
+ function() return self:Refresh() end
588
+ )
589
+ self:Refresh()
590
+ end
591
+ function KnownSpells.prototype.GetValue(self)
592
+ return __TS__ArraySlice(self.ids)
593
+ end
594
+ function KnownSpells.prototype.HasSecretFields(self)
595
+ return self.status == "restricted"
596
+ end
597
+ function KnownSpells.prototype.Has(self, spell)
598
+ if self.status ~= "ready" or issecretvalue(spell) then
599
+ return false
600
+ end
601
+ if type(spell) == "number" and __TS__ArrayIncludes(self.ids, spell) then
602
+ return true
603
+ end
604
+ local ____temp_4
605
+ if type(spell) == "string" then
606
+ ____temp_4 = spell
607
+ else
608
+ local ____opt_0 = C_Spell and C_Spell.GetSpellName
609
+ ____temp_4 = ____opt_0 and ____opt_0(spell)
610
+ end
611
+ local name = ____temp_4
612
+ return not issecretvalue(name) and name ~= nil and self.names:has(name)
613
+ end
614
+ function KnownSpells.prototype.onChange(self, listener)
615
+ if self.disposed then
616
+ error("KnownSpells: source is disposed")
617
+ end
618
+ self.listeners:add(listener)
619
+ return function()
620
+ self.listeners:delete(listener)
621
+ end
622
+ end
623
+ function KnownSpells.prototype.Refresh(self)
624
+ local previous = (((self.status .. ":") .. table.concat(self.ids, ",")) .. ":") .. table.concat(
625
+ __TS__ArraySort(__TS__ArrayFrom(self.names)),
626
+ "|"
627
+ )
628
+ local ids = __TS__New(Set)
629
+ local names = __TS__New(Set)
630
+ self.status = "ready"
631
+ local function add(____, id, name)
632
+ if issecretvalue(id) or issecretvalue(name) then
633
+ self.status = "restricted"
634
+ return
635
+ end
636
+ if id == nil or id <= 0 then
637
+ return
638
+ end
639
+ ids:add(id)
640
+ local ____name_9 = name
641
+ if ____name_9 == nil then
642
+ local ____opt_5 = C_Spell and C_Spell.GetSpellName
643
+ ____name_9 = ____opt_5 and ____opt_5(id)
644
+ end
645
+ local resolved = ____name_9
646
+ if issecretvalue(resolved) then
647
+ self.status = "restricted"
648
+ return
649
+ end
650
+ if resolved ~= nil then
651
+ names:add(resolved)
652
+ end
653
+ end
654
+ local book = C_SpellBook
655
+ local ____opt_10 = Enum and Enum.SpellBookSpellBank
656
+ local bank = ____opt_10 and ____opt_10.Player
657
+ local ____opt_14 = Enum and Enum.SpellBookItemType
658
+ local spellType = ____opt_14 and ____opt_14.Spell
659
+ if (book and book.GetNumSpellBookSkillLines) ~= nil and book.GetSpellBookSkillLineInfo ~= nil and book.GetSpellBookItemInfo ~= nil and bank ~= nil and spellType ~= nil then
660
+ local count = book.GetNumSpellBookSkillLines()
661
+ if issecretvalue(count) then
662
+ self.status = "restricted"
663
+ else
664
+ do
665
+ local line = 1
666
+ while line <= count do
667
+ do
668
+ local __continue25
669
+ repeat
670
+ local info = book.GetSpellBookSkillLineInfo(line)
671
+ if issecretvalue(info) then
672
+ self.status = "restricted"
673
+ break
674
+ end
675
+ if info == nil then
676
+ __continue25 = true
677
+ break
678
+ end
679
+ if issecretvalue(info.itemIndexOffset) or issecretvalue(info.numSpellBookItems) then
680
+ self.status = "restricted"
681
+ break
682
+ end
683
+ do
684
+ local slot = info.itemIndexOffset + 1
685
+ while slot <= info.itemIndexOffset + info.numSpellBookItems do
686
+ do
687
+ local __continue30
688
+ repeat
689
+ local item = book.GetSpellBookItemInfo(slot, bank)
690
+ if issecretvalue(item) then
691
+ self.status = "restricted"
692
+ break
693
+ end
694
+ if item == nil then
695
+ __continue30 = true
696
+ break
697
+ end
698
+ if issecretvalue(item.itemType) or issecretvalue(item.isOffSpec) then
699
+ self.status = "restricted"
700
+ break
701
+ end
702
+ if item.itemType == spellType and not item.isOffSpec then
703
+ add(nil, item.spellID, item.name)
704
+ end
705
+ __continue30 = true
706
+ until true
707
+ if not __continue30 then
708
+ break
709
+ end
710
+ end
711
+ slot = slot + 1
712
+ end
713
+ end
714
+ __continue25 = true
715
+ until true
716
+ if not __continue25 then
717
+ break
718
+ end
719
+ end
720
+ line = line + 1
721
+ end
722
+ end
723
+ end
724
+ elseif GetNumSpellTabs ~= nil and GetSpellTabInfo ~= nil and GetSpellBookItemInfo ~= nil then
725
+ local count = GetNumSpellTabs()
726
+ if issecretvalue(count) then
727
+ self.status = "restricted"
728
+ else
729
+ do
730
+ local tab = 1
731
+ while tab <= count do
732
+ local ____, ____, offset, size = GetSpellTabInfo(tab)
733
+ if issecretvalue(offset) or issecretvalue(size) then
734
+ self.status = "restricted"
735
+ break
736
+ end
737
+ do
738
+ local slot = offset + 1
739
+ while slot <= offset + size do
740
+ local kind, id = GetSpellBookItemInfo(slot, "spell")
741
+ if issecretvalue(kind) then
742
+ self.status = "restricted"
743
+ break
744
+ end
745
+ if kind == "SPELL" then
746
+ add(nil, id)
747
+ end
748
+ slot = slot + 1
749
+ end
750
+ end
751
+ tab = tab + 1
752
+ end
753
+ end
754
+ end
755
+ else
756
+ self.status = "unavailable"
757
+ end
758
+ self.ids = self.status == "ready" and __TS__ArraySort(
759
+ __TS__ArrayFrom(ids),
760
+ function(____, a, b) return a - b end
761
+ ) or ({})
762
+ self.names = self.status == "ready" and names or __TS__New(Set)
763
+ local next = (((self.status .. ":") .. table.concat(self.ids, ",")) .. ":") .. table.concat(
764
+ __TS__ArraySort(__TS__ArrayFrom(self.names)),
765
+ "|"
766
+ )
767
+ if next ~= previous and self.status == "ready" and self:CanEmit(self.ids) then
768
+ for ____, listener in __TS__Iterator(self.listeners) do
769
+ listener(
770
+ nil,
771
+ __TS__ArraySlice(self.ids)
772
+ )
773
+ end
774
+ end
775
+ end
776
+ function KnownSpells.prototype.Dispose(self)
777
+ if self.disposed then
778
+ return
779
+ end
780
+ self.disposed = true
781
+ self.frame:UnregisterAllEvents()
782
+ self.frame:SetScript("OnEvent", nil)
783
+ self.frame:Hide()
784
+ self.listeners:clear()
785
+ end
786
+ __TS__SetDescriptor(
787
+ KnownSpells.prototype,
788
+ "Status",
789
+ {get = function(self)
790
+ return self.status
791
+ end},
792
+ true
793
+ )
794
+ return ____exports