diff --git a/module.json b/module.json
index c2badab..70461fc 100644
--- a/module.json
+++ b/module.json
@@ -19,7 +19,7 @@
"version": "This is auto replaced",
"compatibility": {
"minimum": "10",
- "verified": "11.313"
+ "verified": "11.315"
},
"esmodules": [
"./scripts/token-action-hud-dnd5e.min.js"
@@ -89,8 +89,9 @@
"type": "system",
"compatibility": [
{
- "minimum": "2.1.0",
- "verified": "2.3.1"
+ "minimum": "3.0.0",
+ "maximum": "3",
+ "verified": "3.0.0"
}
]
}
@@ -103,7 +104,7 @@
{
"minimum": "1.5.0",
"maximum": "1.5",
- "verified": "1.5.0"
+ "verified": "1.5.3"
}
]
}
diff --git a/scripts/action-handler.js b/scripts/action-handler.js
index dbd0314..78a2410 100644
--- a/scripts/action-handler.js
+++ b/scripts/action-handler.js
@@ -745,7 +745,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
inventoryMap.get('consumables').set(key, value)
}
if (isEquippedItem) {
- if (type === 'backpack') {
+ if (type === 'container') {
if (!inventoryMap.has('containers')) inventoryMap.set('containers', new Map())
inventoryMap.get('containers').set(key, value)
}
@@ -1277,7 +1277,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
* @param {object} spell
*/
#getSpellInfo (spell) {
- const components = spell.system.components
+ const components = spell.system.properties
const componentsArray = []
const info1 = {}
@@ -1481,8 +1481,8 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
const modifiers = entity?.modifiers ?? null
const properties = [
...entity.system?.chatProperties ?? [],
- ...entity.system?.equippableItemChatProperties ?? [],
- ...entity.system?.activatedEffectChatProperties ?? []
+ ...entity.system?.equippableItemCardProperties ?? [],
+ ...entity.system?.activatedEffectCardProperties ?? []
].filter(p => p)
const rarity = entity?.rarity ?? null
const traits = (entity?.type === 'weapon') ? this.#getWeaponProperties(entity?.system?.properties) : null
diff --git a/scripts/defaults.js b/scripts/defaults.js
index 766f49d..712ec1f 100644
--- a/scripts/defaults.js
+++ b/scripts/defaults.js
@@ -71,15 +71,8 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
name: coreModule.api.Utils.i18n('DND5E.Effects'),
groups: [
{ ...groups.temporaryEffects, nestId: 'effects_temporary-effects' },
- { ...groups.passiveEffects, nestId: 'effects_passive-effects' }
- ]
- },
- {
- nestId: 'conditions',
- id: 'conditions',
- name: coreModule.api.Utils.i18n('tokenActionHud.dnd5e.conditions'),
- groups: [
- { ...groups.conditions, nestId: 'conditions_conditions' }
+ { ...groups.passiveEffects, nestId: 'effects_passive-effects' },
+ { ...groups.conditions, nestId: 'effects_conditions' }
]
},
{
diff --git a/scripts/roll-handler.js b/scripts/roll-handler.js
index ca22e0f..4e8112a 100644
--- a/scripts/roll-handler.js
+++ b/scripts/roll-handler.js
@@ -9,7 +9,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
* @param {string} encodedValue
*/
async handleActionClick (event, encodedValue) {
- const [actionType, actionId ] = encodedValue.split('|')
+ const [actionType, actionId] = encodedValue.split('|')
if (!this.actor) {
for (const token of coreModule.api.Utils.getControlledTokens()) {
@@ -58,7 +58,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
case 'item':
case 'spell':
case 'weapon':
- if (this.isRenderItem()) this.doRenderItem(actor, actionId)
+ if (this.isRenderItem()) this.renderItem(actor, actionId)
else this.#useItem(event, actor, actionId)
break
case 'magicItem':
diff --git a/scripts/token-action-hud-dnd5e.min.js b/scripts/token-action-hud-dnd5e.min.js
index fe14bad..b4ae2aa 100644
--- a/scripts/token-action-hud-dnd5e.min.js
+++ b/scripts/token-action-hud-dnd5e.min.js
@@ -1 +1 @@
-const e={ID:"token-action-hud-dnd5e"},t={ID:"token-action-hud-core"},s="1.5",i={ability:"DND5E.Ability",check:"tokenActionHud.dnd5e.check",condition:"tokenActionHud.dnd5e.condition",counter:"tokenActionHud.dnd5e.counter",effect:"DND5E.Effect",exhaustion:"DND5E.Exhaustion",feature:"ITEM.TypeFeat",item:"tokenActionHud.dnd5e.item",save:"DND5E.ActionSave",skill:"tokenActionHud.dnd5e.skill",spell:"ITEM.TypeSpell",utility:"DND5E.ActionUtil"},n={bonus:"fas fa-plus",crew:"fas fa-users",day:"fas fa-hourglass-end",hour:"fas fa-hourglass-half",lair:"fas fa-home",minute:"fas fa-hourglass-start",legendary:"fas fas fa-dragon",reaction:"fas fa-bolt",special:"fas fa-star"},a="fas fa-circle-c",l={blind:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.0b8N4FymGGfbZGpJ"},blinded:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.0b8N4FymGGfbZGpJ"},"Convenient Effect: Blinded":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.0b8N4FymGGfbZGpJ"},charmed:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.zZaEBrKkr66OWJvD"},"Convenient Effect: Charmed":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.zZaEBrKkr66OWJvD"},deaf:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.6G8JSjhn701cBITY"},deafened:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.6G8JSjhn701cBITY"},"Convenient Effect: Deafened":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.6G8JSjhn701cBITY"},fear:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.oreoyaFKnvZCrgij"},"Convenient Effect: Frightened":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.oreoyaFKnvZCrgij"},frightened:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.oreoyaFKnvZCrgij"},grappled:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.gYDAhd02ryUmtwZn"},"Convenient Effect: Grappled":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.gYDAhd02ryUmtwZn"},incapacitated:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.TpkZgLfxCmSndmpb"},"Convenient Effect: Incapacitated":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.TpkZgLfxCmSndmpb"},invisible:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.3UU5GCTVeRDbZy9u"},"Convenient Effect: Invisible":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.3UU5GCTVeRDbZy9u"},paralysis:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.xnSV5hLJIMaTABXP"},paralyzed:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.xnSV5hLJIMaTABXP"},"Convenient Effect: Paralyzed":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.xnSV5hLJIMaTABXP"},petrified:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.xaNDaW6NwQTgHSmi"},"Convenient Effect: Petrified":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.xaNDaW6NwQTgHSmi"},poison:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.lq3TRI6ZlED8ABMx"},poisoned:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.lq3TRI6ZlED8ABMx"},"Convenient Effect: Poisoned":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.lq3TRI6ZlED8ABMx"},prone:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.y0TkcdyoZlOTmAFT"},"Convenient Effect: Prone":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.y0TkcdyoZlOTmAFT"},restrain:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cSVcyZyNe2iG1fIc"},restrained:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cSVcyZyNe2iG1fIc"},"Convenient Effect: Restrained":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cSVcyZyNe2iG1fIc"},stun:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.ZyZMUwA2rboh4ObS"},stunned:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.ZyZMUwA2rboh4ObS"},"Convenient Effect: Stunned":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.ZyZMUwA2rboh4ObS"},unconscious:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.UWw13ISmMxDzmwbd"},"Convenient Effect: Unconscious":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.UWw13ISmMxDzmwbd"},exhaustion:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cspWveykstnu3Zcv"},"Convenient Effect: Exhaustion 1":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cspWveykstnu3Zcv"},"Convenient Effect: Exhaustion 2":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cspWveykstnu3Zcv"},"Convenient Effect: Exhaustion 3":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cspWveykstnu3Zcv"},"Convenient Effect: Exhaustion 4":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cspWveykstnu3Zcv"},"Convenient Effect: Exhaustion 5":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cspWveykstnu3Zcv"}},o={_1stLevelSpells:{id:"1st-level-spells",name:"tokenActionHud.dnd5e.1stLevelSpells",type:"system"},_2ndLevelSpells:{id:"2nd-level-spells",name:"tokenActionHud.dnd5e.2ndLevelSpells",type:"system"},_3rdLevelSpells:{id:"3rd-level-spells",name:"tokenActionHud.dnd5e.3rdLevelSpells",type:"system"},_4thLevelSpells:{id:"4th-level-spells",name:"tokenActionHud.dnd5e.4thLevelSpells",type:"system"},_5thLevelSpells:{id:"5th-level-spells",name:"tokenActionHud.dnd5e.5thLevelSpells",type:"system"},_6thLevelSpells:{id:"6th-level-spells",name:"tokenActionHud.dnd5e.6thLevelSpells",type:"system"},_7thLevelSpells:{id:"7th-level-spells",name:"tokenActionHud.dnd5e.7thLevelSpells",type:"system"},_8thLevelSpells:{id:"8th-level-spells",name:"tokenActionHud.dnd5e.8thLevelSpells",type:"system"},_9thLevelSpells:{id:"9th-level-spells",name:"tokenActionHud.dnd5e.9thLevelSpells",type:"system"},abilities:{id:"abilities",name:"tokenActionHud.dnd5e.abilities",type:"system"},actions:{id:"actions",name:"DND5E.ActionPl",type:"system"},activeFeatures:{id:"active-features",name:"tokenActionHud.dnd5e.activeFeatures",type:"system"},artificerInfusions:{id:"artificer-infusions",name:"tokenActionHud.dnd5e.artificerInfusions",type:"system"},atWillSpells:{id:"at-will-spells",name:"tokenActionHud.dnd5e.atWillSpells",type:"system"},backgroundFeatures:{id:"background-features",name:"tokenActionHud.dnd5e.backgroundFeatures",type:"system"},bonusActions:{id:"bonus-actions",name:"tokenActionHud.dnd5e.bonusActions",type:"system"},cantrips:{id:"cantrips",name:"tokenActionHud.dnd5e.cantrips",type:"system"},channelDivinity:{id:"channel-divinity",name:"tokenActionHud.dnd5e.channelDivinity",type:"system"},checks:{id:"checks",name:"tokenActionHud.dnd5e.checks",type:"system"},classFeatures:{id:"class-features",name:"tokenActionHud.dnd5e.classFeatures",type:"system"},combat:{id:"combat",name:"tokenActionHud.combat",type:"system"},conditions:{id:"conditions",name:"tokenActionHud.dnd5e.conditions",type:"system"},consumables:{id:"consumables",name:"ITEM.TypeConsumablePl",type:"system"},containers:{id:"containers",name:"ITEM.TypeContainerPl",type:"system"},counters:{id:"counters",name:"tokenActionHud.dnd5e.counters",type:"system"},crewActions:{id:"crew-actions",name:"tokenActionHud.dnd5e.crewActions",type:"system"},defensiveTactics:{id:"defensive-tactics",name:"tokenActionHud.dnd5e.defensiveTactics",type:"system"},eldritchInvocations:{id:"eldritch-invocations",name:"tokenActionHud.dnd5e.eldritchInvocations",type:"system"},elementalDisciplines:{id:"elemental-disciplines",name:"tokenActionHud.dnd5e.elementalDisciplines",type:"system"},equipment:{id:"equipment",name:"ITEM.TypeEquipmentPl",type:"system"},equipped:{id:"equipped",name:"DND5E.Equipped",type:"system"},exhaustion:{id:"exhaustion",name:"DND5E.Exhaustion",type:"system"},feats:{id:"feats",name:"tokenActionHud.dnd5e.feats",type:"system"},fightingStyles:{id:"fighting-styles",name:"tokenActionHud.dnd5e.fightingStyles",type:"system"},huntersPrey:{id:"hunters-prey",name:"tokenActionHud.dnd5e.huntersPrey",type:"system"},innateSpells:{id:"innate-spells",name:"tokenActionHud.dnd5e.innateSpells",type:"system"},kiAbilities:{id:"ki-abilities",name:"tokenActionHud.dnd5e.kiAbilities",type:"system"},lairActions:{id:"lair-actions",name:"tokenActionHud.dnd5e.lairActions",type:"system"},legendaryActions:{id:"legendary-actions",name:"tokenActionHud.dnd5e.legendaryActions",type:"system"},loot:{id:"loot",name:"ITEM.TypeLootPl",type:"system"},maneuvers:{id:"maneuvers",name:"tokenActionHud.dnd5e.maneuvers",type:"system"},metamagicOptions:{id:"metamagic-options",name:"tokenActionHud.dnd5e.metamagicOptions",type:"system"},monsterFeatures:{id:"monster-features",name:"tokenActionHud.dnd5e.monsterFeatures",type:"system"},multiattacks:{id:"multiattacks",name:"tokenActionHud.dnd5e.multiattacks",type:"system"},otherActions:{id:"other-actions",name:"tokenActionHud.dnd5e.otherActions",type:"system"},pactBoons:{id:"pact-boons",name:"tokenActionHud.dnd5e.pactBoons",type:"system"},pactSpells:{id:"pact-spells",name:"tokenActionHud.dnd5e.pactSpells",type:"system"},passiveEffects:{id:"passive-effects",name:"DND5E.EffectPassive",type:"system"},passiveFeatures:{id:"passive-features",name:"tokenActionHud.dnd5e.passiveFeatures",type:"system"},psionicPowers:{id:"psionic-powers",name:"tokenActionHud.dnd5e.psionicPowers",type:"system"},raceFeatures:{id:"race-features",name:"tokenActionHud.dnd5e.raceFeatures",type:"system"},reactions:{id:"reactions",name:"DND5E.ReactionPl",type:"system"},rests:{id:"rests",name:"tokenActionHud.dnd5e.rests",type:"system"},runes:{id:"runes",name:"tokenActionHud.dnd5e.runes",type:"system"},saves:{id:"saves",name:"DND5E.ClassSaves",type:"system"},skills:{id:"skills",name:"tokenActionHud.dnd5e.skills",type:"system"},superiorHuntersDefense:{id:"superior-hunters-defense",name:"tokenActionHud.dnd5e.superiorHuntersDefense",type:"system"},temporaryEffects:{id:"temporary-effects",name:"DND5E.EffectTemporary",type:"system"},token:{id:"token",name:"tokenActionHud.token",type:"system"},tools:{id:"tools",name:"ITEM.TypeToolPl",type:"system"},unequipped:{id:"unequipped",name:"DND5E.Unequipped",type:"system"},utility:{id:"utility",name:"tokenActionHud.utility",type:"system"},weapons:{id:"weapons",name:"ITEM.TypeWeaponPl",type:"system"}},r="fas fa-sun",d={.5:"fas fa-adjust",1:"fas fa-check",2:"fas fa-check-double"},c={common:"tokenActionHud.dnd5e.common",uncommon:"tokenActionHud.dnd5e.uncommon",rare:"tokenActionHud.dnd5e.rare",veryRare:"tokenActionHud.dnd5e.veryRare",legendary:"tokenActionHud.dnd5e.legendary",artifact:"tokenActionHud.dnd5e.artifact"},p="fas fa-circle-r",u={ada:"DND5E.WeaponPropertiesAda",amm:"DND5E.WeaponPropertiesAmm",fin:"DND5E.WeaponPropertiesFin",fir:"DND5E.WeaponPropertiesFir",foc:"DND5E.WeaponPropertiesFoc",hvy:"DND5E.WeaponPropertiesHvy",lgt:"DND5E.WeaponPropertiesLgt",lod:"DND5E.WeaponPropertiesLod",mgc:"DND5E.WeaponPropertiesMgc",rch:"DND5E.WeaponPropertiesRch",rel:"DND5E.WeaponPropertiesRel",ret:"DND5E.WeaponPropertiesRet",sil:"DND5E.WeaponPropertiesSil",spc:"DND5E.WeaponPropertiesSpc",thr:"DND5E.WeaponPropertiesThr",two:"DND5E.WeaponPropertiesTwo",ver:"DND5E.WeaponPropertiesVer"};let m=null;Hooks.once("tokenActionHudCoreApiReady",(async t=>{m=class Utils{static getSetting(s,i=null){let n=i??null;try{n=game.settings.get(e.ID,s)}catch{t.api.Logger.debug(`Setting '${s}' not found`)}return n}static async setSetting(s,i){try{i=await game.settings.set(e.ID,s,i),t.api.Logger.debug(`Setting '${s}' set to '${i}'`)}catch{t.api.Logger.debug(`Setting '${s}' not found`)}}}}));let y=null;Hooks.once("tokenActionHudCoreApiReady",(async e=>{y=class ActionHandler extends e.api.ActionHandler{actors=null;tokens=null;actorType=null;items=null;abbreviateSkills=null;displaySpellInfo=null;showItemsWithoutActivationCosts=null;showUnchargedItems=null;showUnequippedItems=null;showUnpreparedSpells=null;activationgroupIds=null;featuregroupIds=null;inventorygroupIds=null;spellgroupIds=null;featureActions=null;inventoryActions=null;spellActions=null;systemVersion=game.dnd5e.version;async buildSystemActions(t){if(this.actors=this.actor?[this.actor]:this.#e(),this.tokens=this.token?[this.token]:this.#t(),this.actorType=this.actor?.type,this.actor){let t=this.actor.items;t=this.#s(t),t=e.api.Utils.sortItemsByName(t),this.items=t}this.abbreviateSkills=m.getSetting("abbreviateSkills"),this.displaySpellInfo=m.getSetting("displaySpellInfo"),this.showItemsWithoutActivationCosts=m.getSetting("showItemsWithoutActivationCosts"),this.showUnchargedItems=m.getSetting("showUnchargedItems"),this.showUnequippedItems=m.getSetting("showUnequippedItems"),"npc"!==this.actorType||this.showUnequippedItems||(this.showUnequippedItems=m.getSetting("showUnequippedItemsNpcs")),this.showUnpreparedSpells=m.getSetting("showUnpreparedSpells"),this.activationgroupIds=["actions","bonus-actions","crew-actions","lair-actions","legendary-actions","reactions","other-actions"],this.featuregroupIds=["active-features","passive-features","background-features","class-features","feats","monster-features","race-features","artificer-infusions","channel-divinity","defensive-tactics","eldritch-invocations","elemental-disciplines","fighting-styles","hunters-prey","ki-abilities","maneuvers","metamagic-options","multiattacks","pact-boons","psionic-powers","runes","superior-hunters-defense"],this.spellgroupIds=["cantrips","1st-level-spells","2nd-level-spells","3rd-level-spells","4th-level-spells","5th-level-spells","6th-level-spells","7th-level-spells","8th-level-spells","9th-level-spells","at-will-spells","innate-spells","pact-spells"],"character"===this.actorType||"npc"===this.actorType?(this.inventorygroupIds=["equipped","consumables","containers","equipment","loot","tools","weapons","unequipped"],await this.#i()):"vehicle"===this.actorType?(this.inventorygroupIds=["consumables","equipment","tools","weapons"],await this.#n()):this.actor||await this.#a()}async#i(){await Promise.all([this.#l(),this.#o(),this.#r(),this.#d(),this.#c()]),this.#p("ability","abilities"),this.#p("check","checks"),this.#p("save","saves"),this.#u(),this.#m(),this.#y(),this.#h(),this.#g(),this.#f()}async#n(){await Promise.all([this.#l(),this.#o(),this.#r(),this.#d()]),this.#p("ability","abilities"),this.#p("check","checks"),this.#p("save","saves"),this.#u(),this.#f()}async#a(){this.#p("ability","abilities"),this.#p("check","checks"),this.#p("save","saves"),this.#u(),await this.#l(),this.#h(),this.#g(),this.#f()}#p(t,s){const n=this.actor?this.actor.system.abilities:game.dnd5e.config.abilities;if(0===n.length)return;const a=Object.entries(n).filter((e=>0!==n[e[0]].value)).map((([a,l])=>{const o=`${t}-${a}`,r=a.charAt(0).toUpperCase()+a.slice(1),d=this.systemVersion>="2.2"?game.dnd5e.config.abilities[a].label:game.dnd5e.config.abilities[a],c=this.abbreviateSkills?r:d,p=`${`${e.api.Utils.i18n(i[t])}: `??""}${d}`,u=[t,a].join(this.delimiter),m="checks"!==s?this.#v(n[a].proficient):"",y="saves"!==s?l?.mod:"saves"===s?l?.save:"";return{id:o,name:c,encodedValue:u,icon1:m,info1:this.actor?{text:e.api.Utils.getModifier(y)}:null,info2:this.actor&&"abilities"===s?{text:`(${e.api.Utils.getModifier(l?.save)})`}:null,listName:p}})),l={id:s,type:"system"};this.addActions(a,l)}async#b(e,t,s="item"){const i=new Map,n={action:"actions",bonus:"bonus-actions",crew:"crew-actions",lair:"lair-actions",legendary:"legendary-actions",reaction:"reactions",reactiondamage:"reactions",reactionmanual:"reactions",other:"other-actions"};for(const[t,s]of e){const e=s.system?.activation?.type,a=n[Object.keys(n).includes(e)?e:"other"];i.has(a)||i.set(a,new Map),i.get(a).set(t,s)}for(const e of this.activationgroupIds){if(!i.has(e))continue;const n={...t,id:`${e}+${t.id}`,type:"system-derived"};["equipped","unequipped"].includes(t.id)&&(n.defaultSelected=!1);const a={id:e,type:"system"};await this.addGroup(n,a),this.addGroupInfo(t),await this.#k(i.get(e),n,s)}}#u(){const t="utility",s={initiative:{id:"initiative",name:e.api.Utils.i18n("tokenActionHud.dnd5e.rollInitiative")},endTurn:{id:"endTurn",name:e.api.Utils.i18n("tokenActionHud.endTurn")}};game.combat?.current?.tokenId!==this.token?.id&&delete s.endTurn;const n=Object.entries(s).map((s=>{const n=s[1].id,a=s[1].name,l=`${`${e.api.Utils.i18n(i[t])}: `??""}${a}`,o=[t,n].join(this.delimiter),r={};let d="";if("initiative"===s[0]&&game.combat){const t=e.api.Utils.getControlledTokens()?.map((e=>e.id)),s=game.combat.combatants.filter((e=>t.includes(e.tokenId)));if(1===s.length){const e=s[0].initiative;r.class="tah-spotlight",r.text=e}d=`toggle${s.length>0&&s.every((e=>e?.initiative))?" active":""}`}return{id:n,name:a,encodedValue:o,info1:r,cssClass:d,listName:l}}));this.addActions(n,{id:"combat",type:"system"})}async#l(){if(0===this.tokens?.length)return;const t="condition",s=CONFIG.statusEffects.filter((e=>""!==e.id));if(0===s.length)return;const n=await Promise.all(s.map((async s=>{const n=s.id,a=e.api.Utils.i18n(s.label)??s.name,l=`${`${e.api.Utils.i18n(i[t])}: `??""}${a}`,o=[t,n].join(this.delimiter),r=`toggle${this.actors.every((e=>game.version.startsWith("11")?e.effects.some((e=>e.statuses.some((e=>e===n))&&!e?.disabled)):e.effects.some((e=>e.flags?.core?.statusId===n&&!e?.disabled))))?" active":""}`,d=e.api.Utils.getImage(s),c=await this.#A(n,a),p=await this.#I(c);return{id:n,name:a,encodedValue:o,img:d,cssClass:r,listName:l,tooltip:p}})));this.addActions(n,{id:"conditions",type:"system"})}async#m(){if("character"!==this.actorType)return;const t="counter";let s=[];if(e.api.Utils.isModuleActive("dnd5e-custom-counters")){if("character"!==this.actorType)return;s=Object.entries(game.settings.get("dnd5e-custom-counters","characterCounters")).filter((([e,t])=>t.visible)).map((([e,t])=>(t.key=e,t)))}else s=[{name:e.api.Utils.i18n("DND5E.DeathSave"),type:"successFailure",system:!0,visible:!0,key:"death-saves"},{name:e.api.Utils.i18n("DND5E.Exhaustion"),type:"number",system:!0,visible:!0,key:"exhaustion"},{name:e.api.Utils.i18n("DND5E.Inspiration"),type:"checkbox",system:!0,visible:!0,key:"inspiration"}];const n=s.map((s=>{const n=s.key,a=s.name,l=`${`${e.api.Utils.i18n(i[t])}: `??""}${a}`,o=s.system?n:encodeURIComponent(`${n}>${s.type}`),r=[t,o].join(this.delimiter);let d="",c="",p="",u="";if(s.system)switch(n){case"exhaustion":d=this.actor.system.attributes.exhaustion>0?" active":"",c=`toggle${d}`,p=e.api.Utils.getImage("modules/token-action-hud-dnd5e/icons/exhaustion.svg"),u={text:this.actor.system.attributes.exhaustion};break;case"death-saves":p=e.api.Utils.getImage("modules/token-action-hud-dnd5e/icons/death-saves.svg"),u={text:`${this.actor.system.attributes.death.success}/${this.actor.system.attributes.death.failure}`};break;case"inspiration":d=this.actor.system.attributes.inspiration?" active":"",c=`toggle${d}`,p=e.api.Utils.getImage("modules/token-action-hud-dnd5e/icons/inspiration.svg")}else{const e=this.actor.getFlag("dnd5e-custom-counters",n);switch(s.type){case"checkbox":d=e?" active":"",c=`toggle${d}`;break;case"number":d=e>0?" active":"",c=`toggle${d}`,u={text:e};break;case"successFailure":u={text:`${e?.success??0}/${e?.failure??0}`}}}return{id:n,name:a,listName:l,encodedValue:r,cssClass:c,img:p,info1:u}}));this.addActions(n,{id:"counters",type:"system"})}async#o(){const e="effect",t=this.actor.effects;if(0===t.size)return;const s=new Map,i=new Map;for(const[e,n]of t.entries()){n.isTemporary?i.set(e,n):s.set(e,n)}await Promise.all([this.#k(s,{id:"passive-effects",type:"system"},e),this.#k(i,{id:"temporary-effects",type:"system"},e)])}#y(){if(0===this.actors.length)return;if(!this.actors.every((e=>"character"===e.type)))return;const t="exhaustion",s="exhaustion",n=e.api.Utils.i18n("DND5E.Exhaustion"),a=`${`${e.api.Utils.i18n(i[t])}: `??""}${n}`,l=[t,s].join(this.delimiter),o=e.api.Utils.getImage("modules/token-action-hud-dnd5e/icons/exhaustion.svg"),r={text:this.actor.system.attributes.exhaustion};let d="";d=`toggle${this.actor.system.attributes.exhaustion>0?" active":""}`;const c=[{cssClass:d,id:s,name:n,encodedValue:l,img:o,info1:r,listName:a}];this.addActions(c,{id:"exhaustion",type:"system"})}async#r(){const t="feature",s=new Map;for(const[e,t]of this.items){"feat"===t.type&&s.set(e,t)}if(0===s.size)return;const i=new Map,n=[{type:"background",groupId:"background-features"},{type:"class",groupId:"class-features"},{type:"monster",groupId:"monster-features"},{type:"race",groupId:"race-features"},{type:"feats",groupId:"feats"}],a=[{type:"artificerInfusion",groupId:"artificer-infusions"},{type:"channelDivinity",groupId:"channel-divinity"},{type:"defensiveTactic",groupId:"defensive-tactics"},{type:"eldritchInvocation",groupId:"eldritch-invocations"},{type:"elementalDiscipline",groupId:"elemental-disciplines"},{type:"fightingStyle",groupId:"fighting-styles"},{type:"huntersPrey",groupId:"hunters-prey"},{type:"ki",groupId:"ki-abilities"},{type:"maneuver",groupId:"maneuvers"},{type:"metamagic",groupId:"metamagic-options"},{type:"multiattack",groupId:"multiattacks"},{type:"pact",groupId:"pact-boons"},{type:"psionicPower",groupId:"psionic-powers"},{type:"rune",groupId:"runes"},{type:"superiorHuntersDefense",groupId:"superior-hunters-defense"}];for(const[e,t]of s){const s=t.system.activation?.type,l=t.system.type.value,o=t.system.type?.subtype;s&&(i.has("active-features")||i.set("active-features",new Map),i.get("active-features").set(e,t)),s&&""!==s||(i.has("passive-features")||i.set("passive-features",new Map),i.get("passive-features").set(e,t));for(const s of n){const n=s.groupId;s.type===l&&(i.has(n)||i.set(n,new Map),i.get(n).set(e,t))}for(const s of a){const n=s.groupId;o&&s.type===o&&(i.has(n)||i.set(n,new Map),i.get(n).set(e,t))}}const l={"active-features":e.api.Utils.i18n("tokenActionHud.dnd5e.activeFeatures"),"passive-features":e.api.Utils.i18n("tokenActionHud.dnd5e.passiveFeatures")};for(const e of this.featuregroupIds){if(!i.has(e))continue;const s={id:e,name:l[e]??"",type:"system"},n=i.get(e);await this.#k(n,s,t),l[e]&&await this.#b(n,s,t)}}async#d(){if(0===this.items.size)return;const t=new Map;for(const[e,s]of this.items){const i=s.system.equipped,n=s.system?.quantity>0,a=this.#w(s),l=this.#E(s),o=this.#D(s),r=s.type;n&&a&&(i&&(t.has("equipped")||t.set("equipped",new Map),t.get("equipped").set(e,s)),i||(t.has("unequipped")||t.set("unequipped",new Map),t.get("unequipped").set(e,s)),l&&"consumable"===r&&(t.has("consumables")||t.set("consumables",new Map),t.get("consumables").set(e,s)),o&&("backpack"===r&&(t.has("containers")||t.set("containers",new Map),t.get("containers").set(e,s)),"equipment"===r&&(t.has("equipment")||t.set("equipment",new Map),t.get("equipment").set(e,s)),"loot"===r&&(t.has("loot")||t.set("loot",new Map),t.get("loot").set(e,s)),"tool"===r&&(t.has("tools")||t.set("tools",new Map),t.get("tools").set(e,s)),"weapon"===r&&(t.has("weapons")||t.set("weapons",new Map),t.get("weapons").set(e,s))))}const s={equipped:e.api.Utils.i18n("DND5E.Equipped"),unequipped:e.api.Utils.i18n("DND5E.Unequipped"),consumables:e.api.Utils.i18n("ITEM.TypeConsumablePl"),containers:e.api.Utils.i18n("ITEM.TypeContainerPl"),equipment:e.api.Utils.i18n("ITEM.TypeEquipmentPl"),loot:e.api.Utils.i18n("ITEM.TypeLootPl"),tools:e.api.Utils.i18n("ITEM.TypeToolPl"),weapons:e.api.Utils.i18n("ITEM.TypeWeaponPl")};for(const e of this.inventorygroupIds){if(!t.has(e))continue;const i={id:e,name:s[e],type:"system"},n=t.get(e);await this.#k(n,i),this.activationgroupIds&&await this.#b(n,i)}}#h(){if(0===this.actors.length)return;if(!this.actors.every((e=>"character"===e.type)))return;const t="utility",s={shortRest:{name:e.api.Utils.i18n("DND5E.ShortRest")},longRest:{name:e.api.Utils.i18n("DND5E.LongRest")}},n=Object.entries(s).map((s=>{const n=s[0],a=s[1].name,l=`${`${e.api.Utils.i18n(i[t])}: `??""}${a}`,o=[t,n].join(this.delimiter);return{id:n,name:a,encodedValue:o,listName:l}}));this.addActions(n,{id:"rests",type:"system"})}#g(){const t="skill",s=this.actor?this.actor.system.skills:game.dnd5e.config.skills;if(0===s.length)return;const n=Object.entries(s).map((n=>{try{const a=n[0],l=a.charAt(0).toUpperCase()+a.slice(1),o=this.abbreviateSkills?l:game.dnd5e.config.skills[a].label,r=`${`${e.api.Utils.i18n(i[t])}: `??""}${game.dnd5e.config.skills[a].label}`,d=[t,a].join(this.delimiter),c=this.#v(s[a].value),p=s[a].total;return{id:a,name:o,encodedValue:d,icon1:c,info1:this.actor?{text:p||0===p?`${p>=0?"+":""}${p}`:""}:"",listName:r}}catch(t){return e.api.Logger.error(n),null}})).filter((e=>!!e));this.addActions(n,{id:"skills",type:"system"})}async#c(){const t="spell",s=new Map;for(const[e,t]of this.items){if("spell"===t.type){const i=this.#E(t),n=this.#S(t);if(i&&n){switch(t.system.preparation.mode){case"atwill":s.has("at-will-spells")||s.set("at-will-spells",new Map),s.get("at-will-spells").set(e,t);break;case"innate":s.has("innate-spells")||s.set("innate-spells",new Map),s.get("innate-spells").set(e,t);break;case"pact":s.has("pact-spells")||s.set("pact-spells",new Map),s.get("pact-spells").set(e,t);break;default:switch(t.system.level){case 0:s.has("cantrips")||s.set("cantrips",new Map),s.get("cantrips").set(e,t);break;case 1:s.has("1st-level-spells")||s.set("1st-level-spells",new Map),s.get("1st-level-spells").set(e,t);break;case 2:s.has("2nd-level-spells")||s.set("2nd-level-spells",new Map),s.get("2nd-level-spells").set(e,t);break;case 3:s.has("3rd-level-spells")||s.set("3rd-level-spells",new Map),s.get("3rd-level-spells").set(e,t);break;case 4:s.has("4th-level-spells")||s.set("4th-level-spells",new Map),s.get("4th-level-spells").set(e,t);break;case 5:s.has("5th-level-spells")||s.set("5th-level-spells",new Map),s.get("5th-level-spells").set(e,t);break;case 6:s.has("6th-level-spells")||s.set("6th-level-spells",new Map),s.get("6th-level-spells").set(e,t);break;case 7:s.has("7th-level-spells")||s.set("7th-level-spells",new Map),s.get("7th-level-spells").set(e,t);break;case 8:s.has("8th-level-spells")||s.set("8th-level-spells",new Map),s.get("8th-level-spells").set(e,t);break;case 9:s.has("9th-level-spells")||s.set("9th-level-spells",new Map),s.get("9th-level-spells").set(e,t)}}}}}const i=Object.entries(this.actor.system.spells).reverse();let n=null;const a=[];let l=this.showUnchargedItems,o=this.showUnchargedItems;for(const[e,t]of i){const s=t.value>0,i=t.max>0,r=t.level>0;"pact"===e&&(!o&&s&&i&&r&&(o=!0),r||(o=!1),t.slotAvailable=o,n=[e,t]),e.startsWith("spell")&&"spell0"!==e?(!l&&s&&i&&(l=!0),t.slotAvailable=l,a.push([e,t])):s&&(t.slotsAvailable=!0,a.push(e,t))}if(n[1].slotAvailable){const e=a.findIndex((e=>e[0]==="spell"+n[1].level));a[e][1].slotsAvailable=!0}const r={"1st-level-spells":{spellMode:1,name:e.api.Utils.i18n("tokenActionHud.dnd5e.1stLevelSpells")},"2nd-level-spells":{spellMode:2,name:e.api.Utils.i18n("tokenActionHud.dnd5e.2ndLevelSpells")},"3rd-level-spells":{spellMode:3,name:e.api.Utils.i18n("tokenActionHud.dnd5e.3rdLevelSpells")},"4th-level-spells":{spellMode:4,name:e.api.Utils.i18n("tokenActionHud.dnd5e.4thLevelSpells")},"5th-level-spells":{spellMode:5,name:e.api.Utils.i18n("tokenActionHud.dnd5e.5thLevelSpells")},"6th-level-spells":{spellMode:6,name:e.api.Utils.i18n("tokenActionHud.dnd5e.6thLevelSpells")},"7th-level-spells":{spellMode:7,name:e.api.Utils.i18n("tokenActionHud.dnd5e.7thLevelSpells")},"8th-level-spells":{spellMode:8,name:e.api.Utils.i18n("tokenActionHud.dnd5e.8thLevelSpells")},"9th-level-spells":{spellMode:9,name:e.api.Utils.i18n("tokenActionHud.dnd5e.9thLevelSpells")},"at-will-spells":{spellMode:"atwill",name:e.api.Utils.i18n("tokenActionHud.dnd5e.atWillSpells")},cantrips:{spellMode:0,name:e.api.Utils.i18n("tokenActionHud.dnd5e.cantrips")},"innate-spells":{spellMode:"innate",name:e.api.Utils.i18n("tokenActionHud.dnd5e.innateSpells")},"pact-spells":{spellMode:"pact",name:e.api.Utils.i18n("tokenActionHud.dnd5e.pactSpells")}},d=["1","2","3","4","5","6","7","8","9","pact"];for(const e of this.spellgroupIds){const i=r[e].spellMode,l=r[e].name;if(!s.has(e))continue;const o="pact"===i?n[1]:a.find((e=>e[0]===`spell${i}`))?.[1],c=o?.value,p=o?.max,u=o?.slotAvailable;if(!u&&d.includes(i))continue;const m={};m.info1={class:"tah-spotlight",text:p>=0?`${c}/${p}`:""};const y={id:e,name:l,type:"system",info:m};this.addGroupInfo(y);const h=s.get(e);await this.#k(h,y,t),this.activationgroupIds&&await this.#b(h,y,t)}}#f(){if(0===this.actors.length)return;if(!this.actors.every((e=>"character"===e.type)))return;const t="utility",s={deathSave:{name:e.api.Utils.i18n("DND5E.DeathSave")},inspiration:{name:e.api.Utils.i18n("DND5E.Inspiration")}};(!this.actor||this.actor.system.attributes.hp.value>0)&&delete s.deathSave;const n=Object.entries(s).map((s=>{const n=s[0],a=s[1].name,l=`${`${e.api.Utils.i18n(i[t])}: `??""}${a}`,o=[t,n].join(this.delimiter);let r="";if("inspiration"===s[0]){r=`toggle${this.actors.every((e=>e.system.attributes?.inspiration))?" active":""}`}return{id:n,name:a,encodedValue:o,cssClass:r,listName:l}}));this.addActions(n,{id:"utility",type:"system"})}async#k(e,t,s="item"){if(0===e.size)return;if(!("string"==typeof t?t:t?.id))return;const i=await Promise.all([...e].map((async e=>await this.#U(s,e[1]))));this.addActions(i,t)}async#U(t,s){const n=s.id??s._id;let a=s?.name??s?.label;s?.system?.recharge&&!s?.system?.recharge?.charged&&s?.system?.recharge?.value&&(a+=` (${e.api.Utils.i18n("DND5E.Recharge")})`);const l=`${`${e.api.Utils.i18n(i[t])}: `??""}${a}`;let o="";if(Object.hasOwn(s,"disabled")){o=`toggle${s.disabled?"":" active"}`}const r=[t,n].join(this.delimiter),d=e.api.Utils.getImage(s),c=this.#C(s?.system?.activation?.type);let p=null,u=null;"spell"===s.type?(p=this.#H(s),this.displaySpellInfo&&(u=this.#T(s))):u=this.#$(s);const m=u?.info1,y=u?.info2,h=u?.info3,g=await this.#P(s);return{id:n,name:a,encodedValue:r,cssClass:o,img:d,icon1:c,icon2:p,info1:m,info2:y,info3:h,listName:l,tooltip:await this.#I(g)}}#w(e){if(this.showItemsWithoutActivationCosts)return!0;const t=Object.keys(game.dnd5e.config.abilityActivationTypes).filter((e=>"none"!==e)),s=e.system.activation,i=s?.type;return!!(s&&t.includes(i)||"tool"===e.type)}#D(e){const t=e.type;if(this.showUnequippedItems&&!["consumable","spell","feat"].includes(t))return!0;return!(!e.system.equipped||"consumable"===t)}#E(e){if(this.showUnchargedItems)return!0;return!!e.system.uses}#S(e){if("character"!==this.actorType&&this.showUnequippedItems)return!0;const t=e.system.preparation.prepared;if(this.showUnpreparedSpells)return!0;const s=e.system.level,i=Object.keys(game.dnd5e.config.spellPreparationModes).filter((e=>"prepared"!==e)),n=e.system.preparation.mode;return!(0!==s&&!i.includes(n)&&!t)}#$(e){return{info1:{text:this.#M(e)},info2:{text:this.#J(e)},info3:{text:this.#N(e)}}}#T(t){const s=t.system.components,i=[],n={},a={},l={};if(s?.vocal&&i.push(e.api.Utils.i18n("DND5E.ComponentVerbal")),s?.somatic&&i.push(e.api.Utils.i18n("DND5E.ComponentSomatic")),s?.material&&i.push(e.api.Utils.i18n("DND5E.ComponentMaterial")),i.length&&(n.title=i.join(", "),n.text=i.map((e=>e.charAt(0).toUpperCase())).join("")),s?.concentration){const t=e.api.Utils.i18n("DND5E.Concentration");a.title=t,a.text=t.charAt(0).toUpperCase()}if(s?.ritual){const t=e.api.Utils.i18n("DND5E.Ritual");l.title=t,l.text=t.charAt(0).toUpperCase()}return{info1:n,info2:a,info3:l}}#e(){const t=["character","npc"],s=e.api.Utils.getControlledTokens()?.filter((e=>e.actor)).map((e=>e.actor));return s.every((e=>t.includes(e.type)))?s:[]}#t(){const t=["character","npc"],s=e.api.Utils.getControlledTokens(),i=s?.filter((e=>e.actor)).map((e=>e.actor));return i.every((e=>t.includes(e.type)))?s:[]}#M(e){const t=e?.system?.quantity??0;return t>1?t:""}#J(e){const t=e?.system?.uses;return t&&(t.value>0||t.max>0)?`${t.value??"0"}${t.max>0?`/${t.max}`:""}`:""}#N(e){const t=e?.system?.consume?.target,s=e?.system?.consume?.type;if(t===e.id)return"";if("attribute"===s){if(!t)return"";const e=t.substr(0,t.lastIndexOf(".")),s=this.actor.system[e];return s?`${s.value??"0"}${s.max?`/${s.max}`:""}`:""}const i=this.items.get(t);if("charges"===s){const e=i?.system.uses;return e?.value?`${e.value}${e.max?`/${e.max}`:""}`:""}return i?.system?.quantity??""}#s(e){if(m.getSetting("showSlowActions"))return e;const t=["minute","hour","day"],s=new Map;for(const[i,n]of e.entries()){const e=n.system?.activation?.type;t.includes(e)||s.set(i,n)}return s}#v(e){const t=CONFIG.DND5E.proficiencyLevels[e]??"",s=d[e];if(s)return``}#C(e){const t=CONFIG.DND5E.abilityActivationTypes[e]??"",s=n[e];if(s)return``}#H(t){const s=t.system.level,i=t.system.preparation.mode,n=t.system.preparation.prepared,a=n?"fas fa-sun":"fas fa-sun tah-icon-disabled",l=n?e.api.Utils.i18n("DND5E.SpellPrepared"):e.api.Utils.i18n("DND5E.SpellUnprepared");return"prepared"===i&&0!==s?``:""}async#P(e){if("none"===this.tooltipsSetting)return"";const t=e?.name??"";if("nameOnly"===this.tooltipsSetting)return t;return{name:t,description:"string"==typeof e?.system?.description?e?.system?.description:e?.system?.description?.value??"",modifiers:e?.modifiers??null,properties:[...e.system?.chatProperties??[],...e.system?.equippableItemChatProperties??[],...e.system?.activatedEffectChatProperties??[]].filter((e=>e)),rarity:e?.rarity??null,traits:"weapon"===e?.type?this.#x(e?.system?.properties):null}}async#A(e,t){if("none"===this.tooltipsSetting)return"";if("nameOnly"===this.tooltipsSetting)return t;return{name:t,description:(l[e]&&l[e]?.uuid?await fromUuid(l[e].uuid):null)?.text?.content??""}}async#I(t){if("none"===this.tooltipsSetting)return"";if("string"==typeof t)return t;const s=e.api.Utils.i18n(t.name);if("nameOnly"===this.tooltipsSetting)return s;const i=`
${s}
`,n=t?.descriptionLocalised??await TextEditor.enrichHTML(e.api.Utils.i18n(t?.description??""),{async:!0}),a=t?.rarity?`${e.api.Utils.i18n(c[t.rarity])}`:"",l=t?.properties?`${t.properties.map((t=>`${e.api.Utils.i18n(t)}`)).join("")}
`:"",o=t?.traits?t.traits.map((t=>`${e.api.Utils.i18n(t.label??t)}`)).join(""):"",r=t?.traits2?t.traits2.map((t=>`${e.api.Utils.i18n(t.label??t)}`)).join(""):"",d=t?.traitsAlt?t.traitsAlt.map((t=>`${e.api.Utils.i18n(t.label)}`)).join(""):"",p=t?.modifiers?`${t.modifiers.filter((e=>e.enabled)).map((t=>`${e.api.Utils.i18n(t.label)} ${`${t.modifier>=0?"+":""}${t.modifier??""}`}`)).join("")}
`:"",u=[a,o,r,d].join(""),m=u?`${u}
`:"";return n||m||p?`${i}${m||p?`
${m}${p}
`:""}${n}${l}
`:s}#x(t){return t?Object.entries(t).filter((([e,t])=>t&&u[e])).map((([t,s])=>e.api.Utils.i18n(u[t]))):null}}}));let h=null;Hooks.once("tokenActionHudCoreApiReady",(async e=>{h=class MagicItemActionHandlerExtender extends e.api.ActionHandlerExtender{constructor(e){super(),this.actionHandler=e,this.actor=null}extendActionHandler(){if(this.actor=this.actionHandler.actor,!this.actor)return;const t=MagicItems.actor(this.actor.id);if(!t)return;const s=t.items??[];if(0===s.length)return;const i={id:"magic-items",type:"system"};s.forEach((t=>{if(t.attuned&&!this._isItemAttuned(t))return;if(t.equipped&&!this._isItemEquipped(t))return;const s={id:`magic-items_${t.id}`,name:t.name,type:"system-derived",info1:`${t.uses}/${t.charges}`};this.actionHandler.addGroup(s,i);const n=t.ownedEntries.map((s=>{const i=s.item,n=i.id;return{id:n,name:i.name,encodedValue:["magicItem",`${t.id}>${n}`].join("|"),img:e.api.Utils.getImage(i),info1:i.consumption,info2:i.baseLevel?`${e.api.Utils.i18n("DND5E.AbbreviationLevel")} ${i.baseLevel}`:"",selected:!0}}));this.actionHandler.addActions(n,s)}))}_isItemEquipped(e){return e.item.system.equipped}_isItemAttuned(e){return e.item.system.attunment!==(CONFIG.DND5E.attunementTypes?.REQUIRED??1)}}}));let g=null;Hooks.once("tokenActionHudCoreApiReady",(async e=>{g=class RollHandler extends e.api.RollHandler{async handleActionClick(t,s){const[i,n]=s.split("|");if(this.actor)await this.#Q(t,i,this.actor,this.token,n);else for(const s of e.api.Utils.getControlledTokens()){const e=s.actor;await this.#Q(t,i,e,s,n)}}async#Q(e,t,s,i,n){switch(t){case"ability":this.#j(e,s,n);break;case"check":this.#B(e,s,n);break;case"save":this.#q(e,s,n);break;case"condition":if(!i)return;await this.#_(e,s,i,n);break;case"counter":await this.#L(e,s,n);break;case"effect":await this.#R(e,s,n);break;case"exhaustion":await this.#F(e,s);break;case"feature":case"item":case"spell":case"weapon":this.isRenderItem()?this.doRenderItem(s,n):this.#W(e,s,n);break;case"magicItem":this.#O(s,n);break;case"skill":this.#Z(e,s,n);break;case"utility":await this.#G(e,s,i,n)}}async#L(e,t,s){switch(s){case"death-saves":this.#z(e,t);break;case"exhaustion":await this.#F(e,t);break;case"inspiration":await this.#V(t);break;default:await this.#K(e,t,s)}}async#F(e,t){const s=this.isRightClick(e),i=t.system.attributes.exhaustion,n=s?i-1:i+1;n>=0&&t.update({"system.attributes.exhaustion":n})}async#V(e){const t=!e.system.attributes.inspiration;e.update({"system.attributes.inspiration":t})}async#K(t,s,i){if(!e.api.Utils.isModuleActive("dnd5e-custom-counters"))return;const[n,a]=decodeURIComponent(i).split(">"),l=this.isRightClick(t),o=this.isCtrl(t);let r=s.getFlag("dnd5e-custom-counters",n);switch(a){case"checkbox":await s.setFlag("dnd5e-custom-counters",n,!r);break;case"number":r=r??0,l?r>0&&await s.setFlag("dnd5e-custom-counters",n,r-1):await s.setFlag("dnd5e-custom-counters",n,r+1);break;case"successFailure":r=r??{},r.success=r?.success??0,r.failure=r?.failure??0,l?o?r?.failure>0&&await s.setFlag("dnd5e-custom-counters",`${n}.failure`,r.failure-1):r?.success>0&&await s.setFlag("dnd5e-custom-counters",`${n}.success`,r.success-1):o?await s.setFlag("dnd5e-custom-counters",`${n}.failure`,r.failure+1):await s.setFlag("dnd5e-custom-counters",`${n}.success`,r.success+1)}}#j(e,t,s){t&&t.system?.abilities&&t.rollAbility(s,{event:e})}#q(e,t,s){t&&t.system?.abilities&&t.rollAbilitySave(s,{event:e})}#B(e,t,s){t&&t.system?.abilities&&t.rollAbilityTest(s,{event:e})}#z(e,t){t.rollDeathSave({event:e})}#O(e,t){const s=t.split(">"),i=s[0],n=s[1];MagicItems.actor(e.id).roll(i,n),Hooks.callAll("forceUpdateTokenActionHud")}#Z(e,t,s){t&&t.system?.skills&&t.rollSkill(s,{event:e})}#W(t,s,i){const n=e.api.Utils.getItem(s,i);if(!this.#Y(n))return n.use({event:t});n.rollRecharge()}#Y(e){return e.system.recharge&&!e.system.recharge.charged&&e.system.recharge.value}async#G(e,t,s,i){switch(i){case"deathSave":this.#z(e,t);break;case"endTurn":if(!s)break;game.combat?.current?.tokenId===s.id&&await(game.combat?.nextTurn());break;case"initiative":await this.#X(t);break;case"inspiration":await this.#V(t);break;case"longRest":t.longRest();break;case"shortRest":t.shortRest()}Hooks.callAll("forceUpdateTokenActionHud")}async#X(e){e&&(await e.rollInitiative({createCombatants:!0}),Hooks.callAll("forceUpdateTokenActionHud"))}async#_(e,t,s,i){if(!s)return;const n=this.isRightClick(e),a=CONFIG.statusEffects.find((e=>e.id===i)),l=a?.flags?Object.hasOwn(a.flags,"dfreds-convenient-effects")?a.flags["dfreds-convenient-effects"].isConvenient:null:i.startsWith("Convenient Effect");if(game.dfreds&&l)n?await game.dfreds.effectInterface.toggleEffect(a.name??a.label,{overlay:!0}):await game.dfreds.effectInterface.toggleEffect(a.name??a.label);else{const e=this.#ee(i);if(!e)return;const a=this.#te(t,i);a?.disabled&&await a.delete(),n?await s.toggleEffect(e,{overlay:!0}):await s.toggleEffect(e)}Hooks.callAll("forceUpdateTokenActionHud")}#ee(e){return CONFIG.statusEffects.find((t=>t.id===e))}#te(e,t){return game.version.startsWith("11")?e.effects.find((e=>e.statuses.every((e=>e===t)))):e.effects.find((e=>e.flags?.core?.statusId===t))}async#R(e,t,s){const i=("find"in t.effects.entries?t.effects.entries:t.effects).find((e=>e.id===s));if(!i)return;this.isRightClick(e)?await i.delete():await i.update({disabled:!i.disabled}),Hooks.callAll("forceUpdateTokenActionHud")}async handleActionHover(t,s){const[i,n]=s.split("|");if(!["feature","item","spell","weapon","magicItem"].includes(i))return;const a=e.api.Utils.getItem(this.actor,n);switch(t.type){case"mouseenter":case"mouseover":Hooks.call("tokenActionHudSystemActionHoverOn",t,a);break;case"mouseleave":case"mouseout":Hooks.call("tokenActionHudSystemActionHoverOff",t,a)}}}}));class RollHandlerObsidian extends g{_rollAbilityTest(e,t){OBSIDIAN.Items.roll(super.actor,{roll:"abl",abl:t})}_rollAbilitySave(e,t){OBSIDIAN.Items.roll(super.actor,{roll:"save",save:t})}_rollSkill(e,t){OBSIDIAN.Items.roll(super.actor,{roll:"skl",skl:t})}_useItem(e,t){OBSIDIAN.Items.roll(super.actor,{roll:"item",id:t})}}let f=null;function register(t){game.settings.register(e.ID,"abbreviateSkills",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.abbreviateSkills.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.abbreviateSkills.hint"),scope:"client",config:!0,type:Boolean,default:!1,onChange:e=>{t(e)}}),game.settings.register(e.ID,"showSlowActions",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.showSlowActions.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.showSlowActions.hint"),scope:"client",config:!0,type:Boolean,default:!0,onChange:e=>{t(e)}}),game.settings.register(e.ID,"displaySpellInfo",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.displaySpellInfo.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.displaySpellInfo.hint"),scope:"client",config:!0,type:Boolean,default:!0,onChange:e=>{t(e)}}),game.settings.register(e.ID,"showUnchargedItems",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnchargedItems.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnchargedItems.hint"),scope:"client",config:!0,type:Boolean,default:!1,onChange:e=>{t(e)}}),game.settings.register(e.ID,"showUnequippedItems",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnequippedItems.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnequippedItems.hint"),scope:"client",config:!0,type:Boolean,default:!1,onChange:e=>{t(e)}}),game.settings.register(e.ID,"showUnequippedItemsNpcs",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnequippedItemsNpcs.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnequippedItemsNpcs.hint"),scope:"client",config:!0,type:Boolean,default:!0,onChange:e=>{t(e)}}),game.settings.register(e.ID,"showUnpreparedSpells",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnpreparedSpells.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnpreparedSpells.hint"),scope:"client",config:!0,type:Boolean,default:!1,onChange:e=>{t(e)}}),game.settings.register(e.ID,"showItemsWithoutActivationCosts",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.showItemsWithoutActivationCosts.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.showItemsWithoutActivationCosts.hint"),scope:"client",config:!0,type:Boolean,default:!1,onChange:e=>{t(e)}})}Hooks.once("tokenActionHudCoreApiReady",(async e=>{const t=o;Object.values(t).forEach((t=>{t.name=e.api.Utils.i18n(t.name),t.listName=`Group: ${e.api.Utils.i18n(t.name)}`}));const s=Object.values(t);f={layout:[{nestId:"inventory",id:"inventory",name:e.api.Utils.i18n("DND5E.Inventory"),groups:[{...t.weapons,nestId:"inventory_weapons"},{...t.equipment,nestId:"inventory_equipment"},{...t.consumables,nestId:"inventory_consumables"},{...t.tools,nestId:"inventory_tools"},{...t.containers,nestId:"inventory_containers"},{...t.loot,nestId:"inventory_loot"}]},{nestId:"features",id:"features",name:e.api.Utils.i18n("DND5E.Features"),groups:[{...t.activeFeatures,nestId:"features_active-features"},{...t.passiveFeatures,nestId:"features_passive-features"}]},{nestId:"spells",id:"spells",name:e.api.Utils.i18n("ITEM.TypeSpellPl"),groups:[{...t.atWillSpells,nestId:"spells_at-will-spells"},{...t.innateSpells,nestId:"spells_innate-spells"},{...t.pactSpells,nestId:"spells_pact-spells"},{...t.cantrips,nestId:"spells_cantrips"},{...t._1stLevelSpells,nestId:"spells_1st-level-spells"},{...t._2ndLevelSpells,nestId:"spells_2nd-level-spells"},{...t._3rdLevelSpells,nestId:"spells_3rd-level-spells"},{...t._4thLevelSpells,nestId:"spells_4th-level-spells"},{...t._5thLevelSpells,nestId:"spells_5th-level-spells"},{...t._6thLevelSpells,nestId:"spells_6th-level-spells"},{...t._7thLevelSpells,nestId:"spells_7th-level-spells"},{...t._8thLevelSpells,nestId:"spells_8th-level-spells"},{...t._9thLevelSpells,nestId:"spells_9th-level-spells"}]},{nestId:"attributes",id:"attributes",name:e.api.Utils.i18n("DND5E.Attributes"),groups:[{...t.abilities,nestId:"attributes_abilities"},{...t.skills,nestId:"attributes_skills"}]},{nestId:"effects",id:"effects",name:e.api.Utils.i18n("DND5E.Effects"),groups:[{...t.temporaryEffects,nestId:"effects_temporary-effects"},{...t.passiveEffects,nestId:"effects_passive-effects"}]},{nestId:"conditions",id:"conditions",name:e.api.Utils.i18n("tokenActionHud.dnd5e.conditions"),groups:[{...t.conditions,nestId:"conditions_conditions"}]},{nestId:"utility",id:"utility",name:e.api.Utils.i18n("tokenActionHud.utility"),groups:[{...t.combat,nestId:"utility_combat"},{...t.token,nestId:"utility_token"},{...t.rests,nestId:"utility_rests"},{...t.utility,nestId:"utility_utility"}]}],groups:s}}));let v=null;Hooks.once("tokenActionHudCoreApiReady",(async e=>{v=class SystemManager extends e.api.SystemManager{getActionHandler(){const t=new y;return(e.api.Utils.isModuleActive("magic-items-2")||e.api.Utils.isModuleActive("magicitems"))&&t.addActionHandlerExtender(new h(t)),t}getAvailableRollHandlers(){let t="Core D&D5e";e.api.Utils.isModuleActive("midi-qol")&&(t+=` [supports ${e.api.Utils.getModuleTitle("midi-qol")}]`);const s={core:t};return e.api.SystemManager.addHandler(s,"obsidian"),s}getRollHandler(e){let t;if("obsidian"===e)t=new RollHandlerObsidian;else t=new g;return t}registerSettings(e){register(e)}async registerDefaults(){const t=f;if(game.modules.get("magicitems")?.active||game.modules.get("magic-items-2")?.active){const s=e.api.Utils.i18n("tokenActionHud.dnd5e.magicItems");t.groups.push({id:"magic-items",name:s,listName:`Group: ${s}`,type:"system"}),t.groups.sort(((e,t)=>e.id.localeCompare(t.id)))}return t}}})),Hooks.on("tokenActionHudCoreApiReady",(async()=>{const t=game.modules.get(e.ID);t.api={requiredCoreModuleVersion:"1.5",SystemManager:v},Hooks.call("tokenActionHudSystemReady",t)}));export{i as ACTION_TYPE,n as ACTIVATION_TYPE_ICON,y as ActionHandler,a as CONCENTRATION_ICON,l as CONDITION,t as CORE_MODULE,f as DEFAULTS,o as GROUP,e as MODULE,h as MagicItemActionHandlerExtender,r as PREPARED_ICON,d as PROFICIENCY_LEVEL_ICON,c as RARITY,s as REQUIRED_CORE_MODULE_VERSION,p as RITUAL_ICON,g as RollHandler,RollHandlerObsidian,v as SystemManager,m as Utils,u as WEAPON_PROPERTY,register};
+const e={ID:"token-action-hud-dnd5e"},t={ID:"token-action-hud-core"},s="1.5",i={ability:"DND5E.Ability",check:"tokenActionHud.dnd5e.check",condition:"tokenActionHud.dnd5e.condition",counter:"tokenActionHud.dnd5e.counter",effect:"DND5E.Effect",exhaustion:"DND5E.Exhaustion",feature:"ITEM.TypeFeat",item:"tokenActionHud.dnd5e.item",save:"DND5E.ActionSave",skill:"tokenActionHud.dnd5e.skill",spell:"ITEM.TypeSpell",utility:"DND5E.ActionUtil"},n={bonus:"fas fa-plus",crew:"fas fa-users",day:"fas fa-hourglass-end",hour:"fas fa-hourglass-half",lair:"fas fa-home",minute:"fas fa-hourglass-start",legendary:"fas fas fa-dragon",reaction:"fas fa-bolt",special:"fas fa-star"},a="fas fa-circle-c",l={blind:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.0b8N4FymGGfbZGpJ"},blinded:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.0b8N4FymGGfbZGpJ"},"Convenient Effect: Blinded":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.0b8N4FymGGfbZGpJ"},charmed:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.zZaEBrKkr66OWJvD"},"Convenient Effect: Charmed":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.zZaEBrKkr66OWJvD"},deaf:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.6G8JSjhn701cBITY"},deafened:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.6G8JSjhn701cBITY"},"Convenient Effect: Deafened":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.6G8JSjhn701cBITY"},fear:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.oreoyaFKnvZCrgij"},"Convenient Effect: Frightened":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.oreoyaFKnvZCrgij"},frightened:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.oreoyaFKnvZCrgij"},grappled:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.gYDAhd02ryUmtwZn"},"Convenient Effect: Grappled":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.gYDAhd02ryUmtwZn"},incapacitated:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.TpkZgLfxCmSndmpb"},"Convenient Effect: Incapacitated":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.TpkZgLfxCmSndmpb"},invisible:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.3UU5GCTVeRDbZy9u"},"Convenient Effect: Invisible":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.3UU5GCTVeRDbZy9u"},paralysis:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.xnSV5hLJIMaTABXP"},paralyzed:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.xnSV5hLJIMaTABXP"},"Convenient Effect: Paralyzed":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.xnSV5hLJIMaTABXP"},petrified:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.xaNDaW6NwQTgHSmi"},"Convenient Effect: Petrified":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.xaNDaW6NwQTgHSmi"},poison:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.lq3TRI6ZlED8ABMx"},poisoned:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.lq3TRI6ZlED8ABMx"},"Convenient Effect: Poisoned":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.lq3TRI6ZlED8ABMx"},prone:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.y0TkcdyoZlOTmAFT"},"Convenient Effect: Prone":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.y0TkcdyoZlOTmAFT"},restrain:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cSVcyZyNe2iG1fIc"},restrained:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cSVcyZyNe2iG1fIc"},"Convenient Effect: Restrained":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cSVcyZyNe2iG1fIc"},stun:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.ZyZMUwA2rboh4ObS"},stunned:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.ZyZMUwA2rboh4ObS"},"Convenient Effect: Stunned":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.ZyZMUwA2rboh4ObS"},unconscious:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.UWw13ISmMxDzmwbd"},"Convenient Effect: Unconscious":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.UWw13ISmMxDzmwbd"},exhaustion:{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cspWveykstnu3Zcv"},"Convenient Effect: Exhaustion 1":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cspWveykstnu3Zcv"},"Convenient Effect: Exhaustion 2":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cspWveykstnu3Zcv"},"Convenient Effect: Exhaustion 3":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cspWveykstnu3Zcv"},"Convenient Effect: Exhaustion 4":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cspWveykstnu3Zcv"},"Convenient Effect: Exhaustion 5":{uuid:"Compendium.dnd5e.rules.JournalEntry.w7eitkpD7QQTB6j0.JournalEntryPage.cspWveykstnu3Zcv"}},o={_1stLevelSpells:{id:"1st-level-spells",name:"tokenActionHud.dnd5e.1stLevelSpells",type:"system"},_2ndLevelSpells:{id:"2nd-level-spells",name:"tokenActionHud.dnd5e.2ndLevelSpells",type:"system"},_3rdLevelSpells:{id:"3rd-level-spells",name:"tokenActionHud.dnd5e.3rdLevelSpells",type:"system"},_4thLevelSpells:{id:"4th-level-spells",name:"tokenActionHud.dnd5e.4thLevelSpells",type:"system"},_5thLevelSpells:{id:"5th-level-spells",name:"tokenActionHud.dnd5e.5thLevelSpells",type:"system"},_6thLevelSpells:{id:"6th-level-spells",name:"tokenActionHud.dnd5e.6thLevelSpells",type:"system"},_7thLevelSpells:{id:"7th-level-spells",name:"tokenActionHud.dnd5e.7thLevelSpells",type:"system"},_8thLevelSpells:{id:"8th-level-spells",name:"tokenActionHud.dnd5e.8thLevelSpells",type:"system"},_9thLevelSpells:{id:"9th-level-spells",name:"tokenActionHud.dnd5e.9thLevelSpells",type:"system"},abilities:{id:"abilities",name:"tokenActionHud.dnd5e.abilities",type:"system"},actions:{id:"actions",name:"DND5E.ActionPl",type:"system"},activeFeatures:{id:"active-features",name:"tokenActionHud.dnd5e.activeFeatures",type:"system"},artificerInfusions:{id:"artificer-infusions",name:"tokenActionHud.dnd5e.artificerInfusions",type:"system"},atWillSpells:{id:"at-will-spells",name:"tokenActionHud.dnd5e.atWillSpells",type:"system"},backgroundFeatures:{id:"background-features",name:"tokenActionHud.dnd5e.backgroundFeatures",type:"system"},bonusActions:{id:"bonus-actions",name:"tokenActionHud.dnd5e.bonusActions",type:"system"},cantrips:{id:"cantrips",name:"tokenActionHud.dnd5e.cantrips",type:"system"},channelDivinity:{id:"channel-divinity",name:"tokenActionHud.dnd5e.channelDivinity",type:"system"},checks:{id:"checks",name:"tokenActionHud.dnd5e.checks",type:"system"},classFeatures:{id:"class-features",name:"tokenActionHud.dnd5e.classFeatures",type:"system"},combat:{id:"combat",name:"tokenActionHud.combat",type:"system"},conditions:{id:"conditions",name:"tokenActionHud.dnd5e.conditions",type:"system"},consumables:{id:"consumables",name:"ITEM.TypeConsumablePl",type:"system"},containers:{id:"containers",name:"ITEM.TypeContainerPl",type:"system"},counters:{id:"counters",name:"tokenActionHud.dnd5e.counters",type:"system"},crewActions:{id:"crew-actions",name:"tokenActionHud.dnd5e.crewActions",type:"system"},defensiveTactics:{id:"defensive-tactics",name:"tokenActionHud.dnd5e.defensiveTactics",type:"system"},eldritchInvocations:{id:"eldritch-invocations",name:"tokenActionHud.dnd5e.eldritchInvocations",type:"system"},elementalDisciplines:{id:"elemental-disciplines",name:"tokenActionHud.dnd5e.elementalDisciplines",type:"system"},equipment:{id:"equipment",name:"ITEM.TypeEquipmentPl",type:"system"},equipped:{id:"equipped",name:"DND5E.Equipped",type:"system"},exhaustion:{id:"exhaustion",name:"DND5E.Exhaustion",type:"system"},feats:{id:"feats",name:"tokenActionHud.dnd5e.feats",type:"system"},fightingStyles:{id:"fighting-styles",name:"tokenActionHud.dnd5e.fightingStyles",type:"system"},huntersPrey:{id:"hunters-prey",name:"tokenActionHud.dnd5e.huntersPrey",type:"system"},innateSpells:{id:"innate-spells",name:"tokenActionHud.dnd5e.innateSpells",type:"system"},kiAbilities:{id:"ki-abilities",name:"tokenActionHud.dnd5e.kiAbilities",type:"system"},lairActions:{id:"lair-actions",name:"tokenActionHud.dnd5e.lairActions",type:"system"},legendaryActions:{id:"legendary-actions",name:"tokenActionHud.dnd5e.legendaryActions",type:"system"},loot:{id:"loot",name:"ITEM.TypeLootPl",type:"system"},maneuvers:{id:"maneuvers",name:"tokenActionHud.dnd5e.maneuvers",type:"system"},metamagicOptions:{id:"metamagic-options",name:"tokenActionHud.dnd5e.metamagicOptions",type:"system"},monsterFeatures:{id:"monster-features",name:"tokenActionHud.dnd5e.monsterFeatures",type:"system"},multiattacks:{id:"multiattacks",name:"tokenActionHud.dnd5e.multiattacks",type:"system"},otherActions:{id:"other-actions",name:"tokenActionHud.dnd5e.otherActions",type:"system"},pactBoons:{id:"pact-boons",name:"tokenActionHud.dnd5e.pactBoons",type:"system"},pactSpells:{id:"pact-spells",name:"tokenActionHud.dnd5e.pactSpells",type:"system"},passiveEffects:{id:"passive-effects",name:"DND5E.EffectPassive",type:"system"},passiveFeatures:{id:"passive-features",name:"tokenActionHud.dnd5e.passiveFeatures",type:"system"},psionicPowers:{id:"psionic-powers",name:"tokenActionHud.dnd5e.psionicPowers",type:"system"},raceFeatures:{id:"race-features",name:"tokenActionHud.dnd5e.raceFeatures",type:"system"},reactions:{id:"reactions",name:"DND5E.ReactionPl",type:"system"},rests:{id:"rests",name:"tokenActionHud.dnd5e.rests",type:"system"},runes:{id:"runes",name:"tokenActionHud.dnd5e.runes",type:"system"},saves:{id:"saves",name:"DND5E.ClassSaves",type:"system"},skills:{id:"skills",name:"tokenActionHud.dnd5e.skills",type:"system"},superiorHuntersDefense:{id:"superior-hunters-defense",name:"tokenActionHud.dnd5e.superiorHuntersDefense",type:"system"},temporaryEffects:{id:"temporary-effects",name:"DND5E.EffectTemporary",type:"system"},token:{id:"token",name:"tokenActionHud.token",type:"system"},tools:{id:"tools",name:"ITEM.TypeToolPl",type:"system"},unequipped:{id:"unequipped",name:"DND5E.Unequipped",type:"system"},utility:{id:"utility",name:"tokenActionHud.utility",type:"system"},weapons:{id:"weapons",name:"ITEM.TypeWeaponPl",type:"system"}},r="fas fa-sun",d={.5:"fas fa-adjust",1:"fas fa-check",2:"fas fa-check-double"},c={common:"tokenActionHud.dnd5e.common",uncommon:"tokenActionHud.dnd5e.uncommon",rare:"tokenActionHud.dnd5e.rare",veryRare:"tokenActionHud.dnd5e.veryRare",legendary:"tokenActionHud.dnd5e.legendary",artifact:"tokenActionHud.dnd5e.artifact"},p="fas fa-circle-r",u={ada:"DND5E.WeaponPropertiesAda",amm:"DND5E.WeaponPropertiesAmm",fin:"DND5E.WeaponPropertiesFin",fir:"DND5E.WeaponPropertiesFir",foc:"DND5E.WeaponPropertiesFoc",hvy:"DND5E.WeaponPropertiesHvy",lgt:"DND5E.WeaponPropertiesLgt",lod:"DND5E.WeaponPropertiesLod",mgc:"DND5E.WeaponPropertiesMgc",rch:"DND5E.WeaponPropertiesRch",rel:"DND5E.WeaponPropertiesRel",ret:"DND5E.WeaponPropertiesRet",sil:"DND5E.WeaponPropertiesSil",spc:"DND5E.WeaponPropertiesSpc",thr:"DND5E.WeaponPropertiesThr",two:"DND5E.WeaponPropertiesTwo",ver:"DND5E.WeaponPropertiesVer"};let m=null;Hooks.once("tokenActionHudCoreApiReady",(async e=>{m=class MagicItemActionHandlerExtender extends e.api.ActionHandlerExtender{constructor(e){super(),this.actionHandler=e,this.actor=null}extendActionHandler(){if(this.actor=this.actionHandler.actor,!this.actor)return;const t=MagicItems.actor(this.actor.id);if(!t)return;const s=t.items??[];if(0===s.length)return;const i={id:"magic-items",type:"system"};s.forEach((t=>{if(t.attuned&&!this._isItemAttuned(t))return;if(t.equipped&&!this._isItemEquipped(t))return;const s={id:`magic-items_${t.id}`,name:t.name,type:"system-derived",info1:`${t.uses}/${t.charges}`};this.actionHandler.addGroup(s,i);const n=t.ownedEntries.map((s=>{const i=s.item,n=i.id;return{id:n,name:i.name,encodedValue:["magicItem",`${t.id}>${n}`].join("|"),img:e.api.Utils.getImage(i),info1:i.consumption,info2:i.baseLevel?`${e.api.Utils.i18n("DND5E.AbbreviationLevel")} ${i.baseLevel}`:"",selected:!0}}));this.actionHandler.addActions(n,s)}))}_isItemEquipped(e){return e.item.system.equipped}_isItemAttuned(e){return e.item.system.attunment!==(CONFIG.DND5E.attunementTypes?.REQUIRED??1)}}}));let y=null;Hooks.once("tokenActionHudCoreApiReady",(async e=>{const t=o;Object.values(t).forEach((t=>{t.name=e.api.Utils.i18n(t.name),t.listName=`Group: ${e.api.Utils.i18n(t.name)}`}));const s=Object.values(t);y={layout:[{nestId:"inventory",id:"inventory",name:e.api.Utils.i18n("DND5E.Inventory"),groups:[{...t.weapons,nestId:"inventory_weapons"},{...t.equipment,nestId:"inventory_equipment"},{...t.consumables,nestId:"inventory_consumables"},{...t.tools,nestId:"inventory_tools"},{...t.containers,nestId:"inventory_containers"},{...t.loot,nestId:"inventory_loot"}]},{nestId:"features",id:"features",name:e.api.Utils.i18n("DND5E.Features"),groups:[{...t.activeFeatures,nestId:"features_active-features"},{...t.passiveFeatures,nestId:"features_passive-features"}]},{nestId:"spells",id:"spells",name:e.api.Utils.i18n("ITEM.TypeSpellPl"),groups:[{...t.atWillSpells,nestId:"spells_at-will-spells"},{...t.innateSpells,nestId:"spells_innate-spells"},{...t.pactSpells,nestId:"spells_pact-spells"},{...t.cantrips,nestId:"spells_cantrips"},{...t._1stLevelSpells,nestId:"spells_1st-level-spells"},{...t._2ndLevelSpells,nestId:"spells_2nd-level-spells"},{...t._3rdLevelSpells,nestId:"spells_3rd-level-spells"},{...t._4thLevelSpells,nestId:"spells_4th-level-spells"},{...t._5thLevelSpells,nestId:"spells_5th-level-spells"},{...t._6thLevelSpells,nestId:"spells_6th-level-spells"},{...t._7thLevelSpells,nestId:"spells_7th-level-spells"},{...t._8thLevelSpells,nestId:"spells_8th-level-spells"},{...t._9thLevelSpells,nestId:"spells_9th-level-spells"}]},{nestId:"attributes",id:"attributes",name:e.api.Utils.i18n("DND5E.Attributes"),groups:[{...t.abilities,nestId:"attributes_abilities"},{...t.skills,nestId:"attributes_skills"}]},{nestId:"effects",id:"effects",name:e.api.Utils.i18n("DND5E.Effects"),groups:[{...t.temporaryEffects,nestId:"effects_temporary-effects"},{...t.passiveEffects,nestId:"effects_passive-effects"},{...t.conditions,nestId:"effects_conditions"}]},{nestId:"utility",id:"utility",name:e.api.Utils.i18n("tokenActionHud.utility"),groups:[{...t.combat,nestId:"utility_combat"},{...t.token,nestId:"utility_token"},{...t.rests,nestId:"utility_rests"},{...t.utility,nestId:"utility_utility"}]}],groups:s}}));let h=null;Hooks.once("tokenActionHudCoreApiReady",(async t=>{h=class Utils{static getSetting(s,i=null){let n=i??null;try{n=game.settings.get(e.ID,s)}catch{t.api.Logger.debug(`Setting '${s}' not found`)}return n}static async setSetting(s,i){try{i=await game.settings.set(e.ID,s,i),t.api.Logger.debug(`Setting '${s}' set to '${i}'`)}catch{t.api.Logger.debug(`Setting '${s}' not found`)}}}}));let g=null;Hooks.once("tokenActionHudCoreApiReady",(async e=>{g=class ActionHandler extends e.api.ActionHandler{actors=null;tokens=null;actorType=null;items=null;abbreviateSkills=null;displaySpellInfo=null;showItemsWithoutActivationCosts=null;showUnchargedItems=null;showUnequippedItems=null;showUnpreparedSpells=null;activationgroupIds=null;featuregroupIds=null;inventorygroupIds=null;spellgroupIds=null;featureActions=null;inventoryActions=null;spellActions=null;systemVersion=game.dnd5e.version;async buildSystemActions(t){if(this.actors=this.actor?[this.actor]:this.#e(),this.tokens=this.token?[this.token]:this.#t(),this.actorType=this.actor?.type,this.actor){let t=this.actor.items;t=this.#s(t),t=e.api.Utils.sortItemsByName(t),this.items=t}this.abbreviateSkills=h.getSetting("abbreviateSkills"),this.displaySpellInfo=h.getSetting("displaySpellInfo"),this.showItemsWithoutActivationCosts=h.getSetting("showItemsWithoutActivationCosts"),this.showUnchargedItems=h.getSetting("showUnchargedItems"),this.showUnequippedItems=h.getSetting("showUnequippedItems"),"npc"!==this.actorType||this.showUnequippedItems||(this.showUnequippedItems=h.getSetting("showUnequippedItemsNpcs")),this.showUnpreparedSpells=h.getSetting("showUnpreparedSpells"),this.activationgroupIds=["actions","bonus-actions","crew-actions","lair-actions","legendary-actions","reactions","other-actions"],this.featuregroupIds=["active-features","passive-features","background-features","class-features","feats","monster-features","race-features","artificer-infusions","channel-divinity","defensive-tactics","eldritch-invocations","elemental-disciplines","fighting-styles","hunters-prey","ki-abilities","maneuvers","metamagic-options","multiattacks","pact-boons","psionic-powers","runes","superior-hunters-defense"],this.spellgroupIds=["cantrips","1st-level-spells","2nd-level-spells","3rd-level-spells","4th-level-spells","5th-level-spells","6th-level-spells","7th-level-spells","8th-level-spells","9th-level-spells","at-will-spells","innate-spells","pact-spells"],"character"===this.actorType||"npc"===this.actorType?(this.inventorygroupIds=["equipped","consumables","containers","equipment","loot","tools","weapons","unequipped"],await this.#i()):"vehicle"===this.actorType?(this.inventorygroupIds=["consumables","equipment","tools","weapons"],await this.#n()):this.actor||await this.#a()}async#i(){await Promise.all([this.#l(),this.#o(),this.#r(),this.#d(),this.#c()]),this.#p("ability","abilities"),this.#p("check","checks"),this.#p("save","saves"),this.#u(),this.#m(),this.#y(),this.#h(),this.#g(),this.#f()}async#n(){await Promise.all([this.#l(),this.#o(),this.#r(),this.#d()]),this.#p("ability","abilities"),this.#p("check","checks"),this.#p("save","saves"),this.#u(),this.#f()}async#a(){this.#p("ability","abilities"),this.#p("check","checks"),this.#p("save","saves"),this.#u(),await this.#l(),this.#h(),this.#g(),this.#f()}#p(t,s){const n=this.actor?this.actor.system.abilities:game.dnd5e.config.abilities;if(0===n.length)return;const a=Object.entries(n).filter((e=>0!==n[e[0]].value)).map((([a,l])=>{const o=`${t}-${a}`,r=a.charAt(0).toUpperCase()+a.slice(1),d=this.systemVersion>="2.2"?game.dnd5e.config.abilities[a].label:game.dnd5e.config.abilities[a],c=this.abbreviateSkills?r:d,p=`${`${e.api.Utils.i18n(i[t])}: `??""}${d}`,u=[t,a].join(this.delimiter),m="checks"!==s?this.#v(n[a].proficient):"",y="saves"!==s?l?.mod:"saves"===s?l?.save:"";return{id:o,name:c,encodedValue:u,icon1:m,info1:this.actor?{text:e.api.Utils.getModifier(y)}:null,info2:this.actor&&"abilities"===s?{text:`(${e.api.Utils.getModifier(l?.save)})`}:null,listName:p}})),l={id:s,type:"system"};this.addActions(a,l)}async#b(e,t,s="item"){const i=new Map,n={action:"actions",bonus:"bonus-actions",crew:"crew-actions",lair:"lair-actions",legendary:"legendary-actions",reaction:"reactions",reactiondamage:"reactions",reactionmanual:"reactions",other:"other-actions"};for(const[t,s]of e){const e=s.system?.activation?.type,a=n[Object.keys(n).includes(e)?e:"other"];i.has(a)||i.set(a,new Map),i.get(a).set(t,s)}for(const e of this.activationgroupIds){if(!i.has(e))continue;const n={...t,id:`${e}+${t.id}`,type:"system-derived"};["equipped","unequipped"].includes(t.id)&&(n.defaultSelected=!1);const a={id:e,type:"system"};await this.addGroup(n,a),this.addGroupInfo(t),await this.#k(i.get(e),n,s)}}#u(){const t="utility",s={initiative:{id:"initiative",name:e.api.Utils.i18n("tokenActionHud.dnd5e.rollInitiative")},endTurn:{id:"endTurn",name:e.api.Utils.i18n("tokenActionHud.endTurn")}};game.combat?.current?.tokenId!==this.token?.id&&delete s.endTurn;const n=Object.entries(s).map((s=>{const n=s[1].id,a=s[1].name,l=`${`${e.api.Utils.i18n(i[t])}: `??""}${a}`,o=[t,n].join(this.delimiter),r={};let d="";if("initiative"===s[0]&&game.combat){const t=e.api.Utils.getControlledTokens()?.map((e=>e.id)),s=game.combat.combatants.filter((e=>t.includes(e.tokenId)));if(1===s.length){const e=s[0].initiative;r.class="tah-spotlight",r.text=e}d=`toggle${s.length>0&&s.every((e=>e?.initiative))?" active":""}`}return{id:n,name:a,encodedValue:o,info1:r,cssClass:d,listName:l}}));this.addActions(n,{id:"combat",type:"system"})}async#l(){if(0===this.tokens?.length)return;const t="condition",s=CONFIG.statusEffects.filter((e=>""!==e.id));if(0===s.length)return;const n=await Promise.all(s.map((async s=>{const n=s.id,a=e.api.Utils.i18n(s.label)??s.name,l=`${`${e.api.Utils.i18n(i[t])}: `??""}${a}`,o=[t,n].join(this.delimiter),r=`toggle${this.actors.every((e=>game.version.startsWith("11")?e.effects.some((e=>e.statuses.some((e=>e===n))&&!e?.disabled)):e.effects.some((e=>e.flags?.core?.statusId===n&&!e?.disabled))))?" active":""}`,d=e.api.Utils.getImage(s),c=await this.#A(n,a),p=await this.#I(c);return{id:n,name:a,encodedValue:o,img:d,cssClass:r,listName:l,tooltip:p}})));this.addActions(n,{id:"conditions",type:"system"})}async#m(){if("character"!==this.actorType)return;const t="counter";let s=[];if(e.api.Utils.isModuleActive("dnd5e-custom-counters")){if("character"!==this.actorType)return;s=Object.entries(game.settings.get("dnd5e-custom-counters","characterCounters")).filter((([e,t])=>t.visible)).map((([e,t])=>(t.key=e,t)))}else s=[{name:e.api.Utils.i18n("DND5E.DeathSave"),type:"successFailure",system:!0,visible:!0,key:"death-saves"},{name:e.api.Utils.i18n("DND5E.Exhaustion"),type:"number",system:!0,visible:!0,key:"exhaustion"},{name:e.api.Utils.i18n("DND5E.Inspiration"),type:"checkbox",system:!0,visible:!0,key:"inspiration"}];const n=s.map((s=>{const n=s.key,a=s.name,l=`${`${e.api.Utils.i18n(i[t])}: `??""}${a}`,o=s.system?n:encodeURIComponent(`${n}>${s.type}`),r=[t,o].join(this.delimiter);let d="",c="",p="",u="";if(s.system)switch(n){case"exhaustion":d=this.actor.system.attributes.exhaustion>0?" active":"",c=`toggle${d}`,p=e.api.Utils.getImage("modules/token-action-hud-dnd5e/icons/exhaustion.svg"),u={text:this.actor.system.attributes.exhaustion};break;case"death-saves":p=e.api.Utils.getImage("modules/token-action-hud-dnd5e/icons/death-saves.svg"),u={text:`${this.actor.system.attributes.death.success}/${this.actor.system.attributes.death.failure}`};break;case"inspiration":d=this.actor.system.attributes.inspiration?" active":"",c=`toggle${d}`,p=e.api.Utils.getImage("modules/token-action-hud-dnd5e/icons/inspiration.svg")}else{const e=this.actor.getFlag("dnd5e-custom-counters",n);switch(s.type){case"checkbox":d=e?" active":"",c=`toggle${d}`;break;case"number":d=e>0?" active":"",c=`toggle${d}`,u={text:e};break;case"successFailure":u={text:`${e?.success??0}/${e?.failure??0}`}}}return{id:n,name:a,listName:l,encodedValue:r,cssClass:c,img:p,info1:u}}));this.addActions(n,{id:"counters",type:"system"})}async#o(){const e="effect",t=this.actor.effects;if(0===t.size)return;const s=new Map,i=new Map;for(const[e,n]of t.entries()){n.isTemporary?i.set(e,n):s.set(e,n)}await Promise.all([this.#k(s,{id:"passive-effects",type:"system"},e),this.#k(i,{id:"temporary-effects",type:"system"},e)])}#y(){if(0===this.actors.length)return;if(!this.actors.every((e=>"character"===e.type)))return;const t="exhaustion",s="exhaustion",n=e.api.Utils.i18n("DND5E.Exhaustion"),a=`${`${e.api.Utils.i18n(i[t])}: `??""}${n}`,l=[t,s].join(this.delimiter),o=e.api.Utils.getImage("modules/token-action-hud-dnd5e/icons/exhaustion.svg"),r={text:this.actor.system.attributes.exhaustion};let d="";d=`toggle${this.actor.system.attributes.exhaustion>0?" active":""}`;const c=[{cssClass:d,id:s,name:n,encodedValue:l,img:o,info1:r,listName:a}];this.addActions(c,{id:"exhaustion",type:"system"})}async#r(){const t="feature",s=new Map;for(const[e,t]of this.items){"feat"===t.type&&s.set(e,t)}if(0===s.size)return;const i=new Map,n=[{type:"background",groupId:"background-features"},{type:"class",groupId:"class-features"},{type:"monster",groupId:"monster-features"},{type:"race",groupId:"race-features"},{type:"feats",groupId:"feats"}],a=[{type:"artificerInfusion",groupId:"artificer-infusions"},{type:"channelDivinity",groupId:"channel-divinity"},{type:"defensiveTactic",groupId:"defensive-tactics"},{type:"eldritchInvocation",groupId:"eldritch-invocations"},{type:"elementalDiscipline",groupId:"elemental-disciplines"},{type:"fightingStyle",groupId:"fighting-styles"},{type:"huntersPrey",groupId:"hunters-prey"},{type:"ki",groupId:"ki-abilities"},{type:"maneuver",groupId:"maneuvers"},{type:"metamagic",groupId:"metamagic-options"},{type:"multiattack",groupId:"multiattacks"},{type:"pact",groupId:"pact-boons"},{type:"psionicPower",groupId:"psionic-powers"},{type:"rune",groupId:"runes"},{type:"superiorHuntersDefense",groupId:"superior-hunters-defense"}];for(const[e,t]of s){const s=t.system.activation?.type,l=t.system.type.value,o=t.system.type?.subtype;s&&(i.has("active-features")||i.set("active-features",new Map),i.get("active-features").set(e,t)),s&&""!==s||(i.has("passive-features")||i.set("passive-features",new Map),i.get("passive-features").set(e,t));for(const s of n){const n=s.groupId;s.type===l&&(i.has(n)||i.set(n,new Map),i.get(n).set(e,t))}for(const s of a){const n=s.groupId;o&&s.type===o&&(i.has(n)||i.set(n,new Map),i.get(n).set(e,t))}}const l={"active-features":e.api.Utils.i18n("tokenActionHud.dnd5e.activeFeatures"),"passive-features":e.api.Utils.i18n("tokenActionHud.dnd5e.passiveFeatures")};for(const e of this.featuregroupIds){if(!i.has(e))continue;const s={id:e,name:l[e]??"",type:"system"},n=i.get(e);await this.#k(n,s,t),l[e]&&await this.#b(n,s,t)}}async#d(){if(0===this.items.size)return;const t=new Map;for(const[e,s]of this.items){const i=s.system.equipped,n=s.system?.quantity>0,a=this.#w(s),l=this.#E(s),o=this.#D(s),r=s.type;n&&a&&(i&&(t.has("equipped")||t.set("equipped",new Map),t.get("equipped").set(e,s)),i||(t.has("unequipped")||t.set("unequipped",new Map),t.get("unequipped").set(e,s)),l&&"consumable"===r&&(t.has("consumables")||t.set("consumables",new Map),t.get("consumables").set(e,s)),o&&("container"===r&&(t.has("containers")||t.set("containers",new Map),t.get("containers").set(e,s)),"equipment"===r&&(t.has("equipment")||t.set("equipment",new Map),t.get("equipment").set(e,s)),"loot"===r&&(t.has("loot")||t.set("loot",new Map),t.get("loot").set(e,s)),"tool"===r&&(t.has("tools")||t.set("tools",new Map),t.get("tools").set(e,s)),"weapon"===r&&(t.has("weapons")||t.set("weapons",new Map),t.get("weapons").set(e,s))))}const s={equipped:e.api.Utils.i18n("DND5E.Equipped"),unequipped:e.api.Utils.i18n("DND5E.Unequipped"),consumables:e.api.Utils.i18n("ITEM.TypeConsumablePl"),containers:e.api.Utils.i18n("ITEM.TypeContainerPl"),equipment:e.api.Utils.i18n("ITEM.TypeEquipmentPl"),loot:e.api.Utils.i18n("ITEM.TypeLootPl"),tools:e.api.Utils.i18n("ITEM.TypeToolPl"),weapons:e.api.Utils.i18n("ITEM.TypeWeaponPl")};for(const e of this.inventorygroupIds){if(!t.has(e))continue;const i={id:e,name:s[e],type:"system"},n=t.get(e);await this.#k(n,i),this.activationgroupIds&&await this.#b(n,i)}}#h(){if(0===this.actors.length)return;if(!this.actors.every((e=>"character"===e.type)))return;const t="utility",s={shortRest:{name:e.api.Utils.i18n("DND5E.ShortRest")},longRest:{name:e.api.Utils.i18n("DND5E.LongRest")}},n=Object.entries(s).map((s=>{const n=s[0],a=s[1].name,l=`${`${e.api.Utils.i18n(i[t])}: `??""}${a}`,o=[t,n].join(this.delimiter);return{id:n,name:a,encodedValue:o,listName:l}}));this.addActions(n,{id:"rests",type:"system"})}#g(){const t="skill",s=this.actor?this.actor.system.skills:game.dnd5e.config.skills;if(0===s.length)return;const n=Object.entries(s).map((n=>{try{const a=n[0],l=a.charAt(0).toUpperCase()+a.slice(1),o=this.abbreviateSkills?l:game.dnd5e.config.skills[a].label,r=`${`${e.api.Utils.i18n(i[t])}: `??""}${game.dnd5e.config.skills[a].label}`,d=[t,a].join(this.delimiter),c=this.#v(s[a].value),p=s[a].total;return{id:a,name:o,encodedValue:d,icon1:c,info1:this.actor?{text:p||0===p?`${p>=0?"+":""}${p}`:""}:"",listName:r}}catch(t){return e.api.Logger.error(n),null}})).filter((e=>!!e));this.addActions(n,{id:"skills",type:"system"})}async#c(){const t="spell",s=new Map;for(const[e,t]of this.items){if("spell"===t.type){const i=this.#E(t),n=this.#S(t);if(i&&n){switch(t.system.preparation.mode){case"atwill":s.has("at-will-spells")||s.set("at-will-spells",new Map),s.get("at-will-spells").set(e,t);break;case"innate":s.has("innate-spells")||s.set("innate-spells",new Map),s.get("innate-spells").set(e,t);break;case"pact":s.has("pact-spells")||s.set("pact-spells",new Map),s.get("pact-spells").set(e,t);break;default:switch(t.system.level){case 0:s.has("cantrips")||s.set("cantrips",new Map),s.get("cantrips").set(e,t);break;case 1:s.has("1st-level-spells")||s.set("1st-level-spells",new Map),s.get("1st-level-spells").set(e,t);break;case 2:s.has("2nd-level-spells")||s.set("2nd-level-spells",new Map),s.get("2nd-level-spells").set(e,t);break;case 3:s.has("3rd-level-spells")||s.set("3rd-level-spells",new Map),s.get("3rd-level-spells").set(e,t);break;case 4:s.has("4th-level-spells")||s.set("4th-level-spells",new Map),s.get("4th-level-spells").set(e,t);break;case 5:s.has("5th-level-spells")||s.set("5th-level-spells",new Map),s.get("5th-level-spells").set(e,t);break;case 6:s.has("6th-level-spells")||s.set("6th-level-spells",new Map),s.get("6th-level-spells").set(e,t);break;case 7:s.has("7th-level-spells")||s.set("7th-level-spells",new Map),s.get("7th-level-spells").set(e,t);break;case 8:s.has("8th-level-spells")||s.set("8th-level-spells",new Map),s.get("8th-level-spells").set(e,t);break;case 9:s.has("9th-level-spells")||s.set("9th-level-spells",new Map),s.get("9th-level-spells").set(e,t)}}}}}const i=Object.entries(this.actor.system.spells).reverse();let n=null;const a=[];let l=this.showUnchargedItems,o=this.showUnchargedItems;for(const[e,t]of i){const s=t.value>0,i=t.max>0,r=t.level>0;"pact"===e&&(!o&&s&&i&&r&&(o=!0),r||(o=!1),t.slotAvailable=o,n=[e,t]),e.startsWith("spell")&&"spell0"!==e?(!l&&s&&i&&(l=!0),t.slotAvailable=l,a.push([e,t])):s&&(t.slotsAvailable=!0,a.push(e,t))}if(n[1].slotAvailable){const e=a.findIndex((e=>e[0]==="spell"+n[1].level));a[e][1].slotsAvailable=!0}const r={"1st-level-spells":{spellMode:1,name:e.api.Utils.i18n("tokenActionHud.dnd5e.1stLevelSpells")},"2nd-level-spells":{spellMode:2,name:e.api.Utils.i18n("tokenActionHud.dnd5e.2ndLevelSpells")},"3rd-level-spells":{spellMode:3,name:e.api.Utils.i18n("tokenActionHud.dnd5e.3rdLevelSpells")},"4th-level-spells":{spellMode:4,name:e.api.Utils.i18n("tokenActionHud.dnd5e.4thLevelSpells")},"5th-level-spells":{spellMode:5,name:e.api.Utils.i18n("tokenActionHud.dnd5e.5thLevelSpells")},"6th-level-spells":{spellMode:6,name:e.api.Utils.i18n("tokenActionHud.dnd5e.6thLevelSpells")},"7th-level-spells":{spellMode:7,name:e.api.Utils.i18n("tokenActionHud.dnd5e.7thLevelSpells")},"8th-level-spells":{spellMode:8,name:e.api.Utils.i18n("tokenActionHud.dnd5e.8thLevelSpells")},"9th-level-spells":{spellMode:9,name:e.api.Utils.i18n("tokenActionHud.dnd5e.9thLevelSpells")},"at-will-spells":{spellMode:"atwill",name:e.api.Utils.i18n("tokenActionHud.dnd5e.atWillSpells")},cantrips:{spellMode:0,name:e.api.Utils.i18n("tokenActionHud.dnd5e.cantrips")},"innate-spells":{spellMode:"innate",name:e.api.Utils.i18n("tokenActionHud.dnd5e.innateSpells")},"pact-spells":{spellMode:"pact",name:e.api.Utils.i18n("tokenActionHud.dnd5e.pactSpells")}},d=["1","2","3","4","5","6","7","8","9","pact"];for(const e of this.spellgroupIds){const i=r[e].spellMode,l=r[e].name;if(!s.has(e))continue;const o="pact"===i?n[1]:a.find((e=>e[0]===`spell${i}`))?.[1],c=o?.value,p=o?.max,u=o?.slotAvailable;if(!u&&d.includes(i))continue;const m={};m.info1={class:"tah-spotlight",text:p>=0?`${c}/${p}`:""};const y={id:e,name:l,type:"system",info:m};this.addGroupInfo(y);const h=s.get(e);await this.#k(h,y,t),this.activationgroupIds&&await this.#b(h,y,t)}}#f(){if(0===this.actors.length)return;if(!this.actors.every((e=>"character"===e.type)))return;const t="utility",s={deathSave:{name:e.api.Utils.i18n("DND5E.DeathSave")},inspiration:{name:e.api.Utils.i18n("DND5E.Inspiration")}};(!this.actor||this.actor.system.attributes.hp.value>0)&&delete s.deathSave;const n=Object.entries(s).map((s=>{const n=s[0],a=s[1].name,l=`${`${e.api.Utils.i18n(i[t])}: `??""}${a}`,o=[t,n].join(this.delimiter);let r="";if("inspiration"===s[0]){r=`toggle${this.actors.every((e=>e.system.attributes?.inspiration))?" active":""}`}return{id:n,name:a,encodedValue:o,cssClass:r,listName:l}}));this.addActions(n,{id:"utility",type:"system"})}async#k(e,t,s="item"){if(0===e.size)return;if(!("string"==typeof t?t:t?.id))return;const i=await Promise.all([...e].map((async e=>await this.#U(s,e[1]))));this.addActions(i,t)}async#U(t,s){const n=s.id??s._id;let a=s?.name??s?.label;s?.system?.recharge&&!s?.system?.recharge?.charged&&s?.system?.recharge?.value&&(a+=` (${e.api.Utils.i18n("DND5E.Recharge")})`);const l=`${`${e.api.Utils.i18n(i[t])}: `??""}${a}`;let o="";if(Object.hasOwn(s,"disabled")){o=`toggle${s.disabled?"":" active"}`}const r=[t,n].join(this.delimiter),d=e.api.Utils.getImage(s),c=this.#C(s?.system?.activation?.type);let p=null,u=null;"spell"===s.type?(p=this.#H(s),this.displaySpellInfo&&(u=this.#T(s))):u=this.#$(s);const m=u?.info1,y=u?.info2,h=u?.info3,g=await this.#P(s);return{id:n,name:a,encodedValue:r,cssClass:o,img:d,icon1:c,icon2:p,info1:m,info2:y,info3:h,listName:l,tooltip:await this.#I(g)}}#w(e){if(this.showItemsWithoutActivationCosts)return!0;const t=Object.keys(game.dnd5e.config.abilityActivationTypes).filter((e=>"none"!==e)),s=e.system.activation,i=s?.type;return!!(s&&t.includes(i)||"tool"===e.type)}#D(e){const t=e.type;if(this.showUnequippedItems&&!["consumable","spell","feat"].includes(t))return!0;return!(!e.system.equipped||"consumable"===t)}#E(e){if(this.showUnchargedItems)return!0;return!!e.system.uses}#S(e){if("character"!==this.actorType&&this.showUnequippedItems)return!0;const t=e.system.preparation.prepared;if(this.showUnpreparedSpells)return!0;const s=e.system.level,i=Object.keys(game.dnd5e.config.spellPreparationModes).filter((e=>"prepared"!==e)),n=e.system.preparation.mode;return!(0!==s&&!i.includes(n)&&!t)}#$(e){return{info1:{text:this.#M(e)},info2:{text:this.#J(e)},info3:{text:this.#N(e)}}}#T(t){const s=t.system.properties,i=[],n={},a={},l={};if(s?.vocal&&i.push(e.api.Utils.i18n("DND5E.ComponentVerbal")),s?.somatic&&i.push(e.api.Utils.i18n("DND5E.ComponentSomatic")),s?.material&&i.push(e.api.Utils.i18n("DND5E.ComponentMaterial")),i.length&&(n.title=i.join(", "),n.text=i.map((e=>e.charAt(0).toUpperCase())).join("")),s?.concentration){const t=e.api.Utils.i18n("DND5E.Concentration");a.title=t,a.text=t.charAt(0).toUpperCase()}if(s?.ritual){const t=e.api.Utils.i18n("DND5E.Ritual");l.title=t,l.text=t.charAt(0).toUpperCase()}return{info1:n,info2:a,info3:l}}#e(){const t=["character","npc"],s=e.api.Utils.getControlledTokens()?.filter((e=>e.actor)).map((e=>e.actor));return s.every((e=>t.includes(e.type)))?s:[]}#t(){const t=["character","npc"],s=e.api.Utils.getControlledTokens(),i=s?.filter((e=>e.actor)).map((e=>e.actor));return i.every((e=>t.includes(e.type)))?s:[]}#M(e){const t=e?.system?.quantity??0;return t>1?t:""}#J(e){const t=e?.system?.uses;return t&&(t.value>0||t.max>0)?`${t.value??"0"}${t.max>0?`/${t.max}`:""}`:""}#N(e){const t=e?.system?.consume?.target,s=e?.system?.consume?.type;if(t===e.id)return"";if("attribute"===s){if(!t)return"";const e=t.substr(0,t.lastIndexOf(".")),s=this.actor.system[e];return s?`${s.value??"0"}${s.max?`/${s.max}`:""}`:""}const i=this.items.get(t);if("charges"===s){const e=i?.system.uses;return e?.value?`${e.value}${e.max?`/${e.max}`:""}`:""}return i?.system?.quantity??""}#s(e){if(h.getSetting("showSlowActions"))return e;const t=["minute","hour","day"],s=new Map;for(const[i,n]of e.entries()){const e=n.system?.activation?.type;t.includes(e)||s.set(i,n)}return s}#v(e){const t=CONFIG.DND5E.proficiencyLevels[e]??"",s=d[e];if(s)return``}#C(e){const t=CONFIG.DND5E.abilityActivationTypes[e]??"",s=n[e];if(s)return``}#H(t){const s=t.system.level,i=t.system.preparation.mode,n=t.system.preparation.prepared,a=n?"fas fa-sun":"fas fa-sun tah-icon-disabled",l=n?e.api.Utils.i18n("DND5E.SpellPrepared"):e.api.Utils.i18n("DND5E.SpellUnprepared");return"prepared"===i&&0!==s?``:""}async#P(e){if("none"===this.tooltipsSetting)return"";const t=e?.name??"";if("nameOnly"===this.tooltipsSetting)return t;return{name:t,description:"string"==typeof e?.system?.description?e?.system?.description:e?.system?.description?.value??"",modifiers:e?.modifiers??null,properties:[...e.system?.chatProperties??[],...e.system?.equippableItemCardProperties??[],...e.system?.activatedEffectCardProperties??[]].filter((e=>e)),rarity:e?.rarity??null,traits:"weapon"===e?.type?this.#x(e?.system?.properties):null}}async#A(e,t){if("none"===this.tooltipsSetting)return"";if("nameOnly"===this.tooltipsSetting)return t;return{name:t,description:(l[e]&&l[e]?.uuid?await fromUuid(l[e].uuid):null)?.text?.content??""}}async#I(t){if("none"===this.tooltipsSetting)return"";if("string"==typeof t)return t;const s=e.api.Utils.i18n(t.name);if("nameOnly"===this.tooltipsSetting)return s;const i=`${s}
`,n=t?.descriptionLocalised??await TextEditor.enrichHTML(e.api.Utils.i18n(t?.description??""),{async:!0}),a=t?.rarity?`${e.api.Utils.i18n(c[t.rarity])}`:"",l=t?.properties?`${t.properties.map((t=>`${e.api.Utils.i18n(t)}`)).join("")}
`:"",o=t?.traits?t.traits.map((t=>`${e.api.Utils.i18n(t.label??t)}`)).join(""):"",r=t?.traits2?t.traits2.map((t=>`${e.api.Utils.i18n(t.label??t)}`)).join(""):"",d=t?.traitsAlt?t.traitsAlt.map((t=>`${e.api.Utils.i18n(t.label)}`)).join(""):"",p=t?.modifiers?`${t.modifiers.filter((e=>e.enabled)).map((t=>`${e.api.Utils.i18n(t.label)} ${`${t.modifier>=0?"+":""}${t.modifier??""}`}`)).join("")}
`:"",u=[a,o,r,d].join(""),m=u?`${u}
`:"";return n||m||p?`${i}${m||p?`
${m}${p}
`:""}${n}${l}
`:s}#x(t){return t?Object.entries(t).filter((([e,t])=>t&&u[e])).map((([t,s])=>e.api.Utils.i18n(u[t]))):null}}}));let f=null;Hooks.once("tokenActionHudCoreApiReady",(async e=>{f=class RollHandler extends e.api.RollHandler{async handleActionClick(t,s){const[i,n]=s.split("|");if(this.actor)await this.#Q(t,i,this.actor,this.token,n);else for(const s of e.api.Utils.getControlledTokens()){const e=s.actor;await this.#Q(t,i,e,s,n)}}async#Q(e,t,s,i,n){switch(t){case"ability":this.#j(e,s,n);break;case"check":this.#B(e,s,n);break;case"save":this.#q(e,s,n);break;case"condition":if(!i)return;await this.#_(e,s,i,n);break;case"counter":await this.#L(e,s,n);break;case"effect":await this.#R(e,s,n);break;case"exhaustion":await this.#F(e,s);break;case"feature":case"item":case"spell":case"weapon":this.isRenderItem()?this.renderItem(s,n):this.#W(e,s,n);break;case"magicItem":this.#O(s,n);break;case"skill":this.#Z(e,s,n);break;case"utility":await this.#G(e,s,i,n)}}async#L(e,t,s){switch(s){case"death-saves":this.#z(e,t);break;case"exhaustion":await this.#F(e,t);break;case"inspiration":await this.#V(t);break;default:await this.#K(e,t,s)}}async#F(e,t){const s=this.isRightClick(e),i=t.system.attributes.exhaustion,n=s?i-1:i+1;n>=0&&t.update({"system.attributes.exhaustion":n})}async#V(e){const t=!e.system.attributes.inspiration;e.update({"system.attributes.inspiration":t})}async#K(t,s,i){if(!e.api.Utils.isModuleActive("dnd5e-custom-counters"))return;const[n,a]=decodeURIComponent(i).split(">"),l=this.isRightClick(t),o=this.isCtrl(t);let r=s.getFlag("dnd5e-custom-counters",n);switch(a){case"checkbox":await s.setFlag("dnd5e-custom-counters",n,!r);break;case"number":r=r??0,l?r>0&&await s.setFlag("dnd5e-custom-counters",n,r-1):await s.setFlag("dnd5e-custom-counters",n,r+1);break;case"successFailure":r=r??{},r.success=r?.success??0,r.failure=r?.failure??0,l?o?r?.failure>0&&await s.setFlag("dnd5e-custom-counters",`${n}.failure`,r.failure-1):r?.success>0&&await s.setFlag("dnd5e-custom-counters",`${n}.success`,r.success-1):o?await s.setFlag("dnd5e-custom-counters",`${n}.failure`,r.failure+1):await s.setFlag("dnd5e-custom-counters",`${n}.success`,r.success+1)}}#j(e,t,s){t&&t.system?.abilities&&t.rollAbility(s,{event:e})}#q(e,t,s){t&&t.system?.abilities&&t.rollAbilitySave(s,{event:e})}#B(e,t,s){t&&t.system?.abilities&&t.rollAbilityTest(s,{event:e})}#z(e,t){t.rollDeathSave({event:e})}#O(e,t){const s=t.split(">"),i=s[0],n=s[1];MagicItems.actor(e.id).roll(i,n),Hooks.callAll("forceUpdateTokenActionHud")}#Z(e,t,s){t&&t.system?.skills&&t.rollSkill(s,{event:e})}#W(t,s,i){const n=e.api.Utils.getItem(s,i);if(!this.#Y(n))return n.use({event:t});n.rollRecharge()}#Y(e){return e.system.recharge&&!e.system.recharge.charged&&e.system.recharge.value}async#G(e,t,s,i){switch(i){case"deathSave":this.#z(e,t);break;case"endTurn":if(!s)break;game.combat?.current?.tokenId===s.id&&await(game.combat?.nextTurn());break;case"initiative":await this.#X(t);break;case"inspiration":await this.#V(t);break;case"longRest":t.longRest();break;case"shortRest":t.shortRest()}Hooks.callAll("forceUpdateTokenActionHud")}async#X(e){e&&(await e.rollInitiative({createCombatants:!0}),Hooks.callAll("forceUpdateTokenActionHud"))}async#_(e,t,s,i){if(!s)return;const n=this.isRightClick(e),a=CONFIG.statusEffects.find((e=>e.id===i)),l=a?.flags?Object.hasOwn(a.flags,"dfreds-convenient-effects")?a.flags["dfreds-convenient-effects"].isConvenient:null:i.startsWith("Convenient Effect");if(game.dfreds&&l)n?await game.dfreds.effectInterface.toggleEffect(a.name??a.label,{overlay:!0}):await game.dfreds.effectInterface.toggleEffect(a.name??a.label);else{const e=this.#ee(i);if(!e)return;const a=this.#te(t,i);a?.disabled&&await a.delete(),n?await s.toggleEffect(e,{overlay:!0}):await s.toggleEffect(e)}Hooks.callAll("forceUpdateTokenActionHud")}#ee(e){return CONFIG.statusEffects.find((t=>t.id===e))}#te(e,t){return game.version.startsWith("11")?e.effects.find((e=>e.statuses.every((e=>e===t)))):e.effects.find((e=>e.flags?.core?.statusId===t))}async#R(e,t,s){const i=("find"in t.effects.entries?t.effects.entries:t.effects).find((e=>e.id===s));if(!i)return;this.isRightClick(e)?await i.delete():await i.update({disabled:!i.disabled}),Hooks.callAll("forceUpdateTokenActionHud")}async handleActionHover(t,s){const[i,n]=s.split("|");if(!["feature","item","spell","weapon","magicItem"].includes(i))return;const a=e.api.Utils.getItem(this.actor,n);switch(t.type){case"mouseenter":case"mouseover":Hooks.call("tokenActionHudSystemActionHoverOn",t,a);break;case"mouseleave":case"mouseout":Hooks.call("tokenActionHudSystemActionHoverOff",t,a)}}}}));class RollHandlerObsidian extends f{_rollAbilityTest(e,t){OBSIDIAN.Items.roll(super.actor,{roll:"abl",abl:t})}_rollAbilitySave(e,t){OBSIDIAN.Items.roll(super.actor,{roll:"save",save:t})}_rollSkill(e,t){OBSIDIAN.Items.roll(super.actor,{roll:"skl",skl:t})}_useItem(e,t){OBSIDIAN.Items.roll(super.actor,{roll:"item",id:t})}}function register(t){game.settings.register(e.ID,"abbreviateSkills",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.abbreviateSkills.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.abbreviateSkills.hint"),scope:"client",config:!0,type:Boolean,default:!1,onChange:e=>{t(e)}}),game.settings.register(e.ID,"showSlowActions",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.showSlowActions.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.showSlowActions.hint"),scope:"client",config:!0,type:Boolean,default:!0,onChange:e=>{t(e)}}),game.settings.register(e.ID,"displaySpellInfo",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.displaySpellInfo.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.displaySpellInfo.hint"),scope:"client",config:!0,type:Boolean,default:!0,onChange:e=>{t(e)}}),game.settings.register(e.ID,"showUnchargedItems",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnchargedItems.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnchargedItems.hint"),scope:"client",config:!0,type:Boolean,default:!1,onChange:e=>{t(e)}}),game.settings.register(e.ID,"showUnequippedItems",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnequippedItems.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnequippedItems.hint"),scope:"client",config:!0,type:Boolean,default:!1,onChange:e=>{t(e)}}),game.settings.register(e.ID,"showUnequippedItemsNpcs",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnequippedItemsNpcs.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnequippedItemsNpcs.hint"),scope:"client",config:!0,type:Boolean,default:!0,onChange:e=>{t(e)}}),game.settings.register(e.ID,"showUnpreparedSpells",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnpreparedSpells.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.showUnpreparedSpells.hint"),scope:"client",config:!0,type:Boolean,default:!1,onChange:e=>{t(e)}}),game.settings.register(e.ID,"showItemsWithoutActivationCosts",{name:game.i18n.localize("tokenActionHud.dnd5e.settings.showItemsWithoutActivationCosts.name"),hint:game.i18n.localize("tokenActionHud.dnd5e.settings.showItemsWithoutActivationCosts.hint"),scope:"client",config:!0,type:Boolean,default:!1,onChange:e=>{t(e)}})}let v=null;Hooks.once("tokenActionHudCoreApiReady",(async e=>{v=class SystemManager extends e.api.SystemManager{getActionHandler(){const t=new g;return(e.api.Utils.isModuleActive("magic-items-2")||e.api.Utils.isModuleActive("magicitems"))&&t.addActionHandlerExtender(new m(t)),t}getAvailableRollHandlers(){let t="Core D&D5e";e.api.Utils.isModuleActive("midi-qol")&&(t+=` [supports ${e.api.Utils.getModuleTitle("midi-qol")}]`);const s={core:t};return e.api.SystemManager.addHandler(s,"obsidian"),s}getRollHandler(e){let t;if("obsidian"===e)t=new RollHandlerObsidian;else t=new f;return t}registerSettings(e){register(e)}async registerDefaults(){const t=y;if(game.modules.get("magicitems")?.active||game.modules.get("magic-items-2")?.active){const s=e.api.Utils.i18n("tokenActionHud.dnd5e.magicItems");t.groups.push({id:"magic-items",name:s,listName:`Group: ${s}`,type:"system"}),t.groups.sort(((e,t)=>e.id.localeCompare(t.id)))}return t}}})),Hooks.on("tokenActionHudCoreApiReady",(async()=>{const t=game.modules.get(e.ID);t.api={requiredCoreModuleVersion:"1.5",SystemManager:v},Hooks.call("tokenActionHudSystemReady",t)}));export{i as ACTION_TYPE,n as ACTIVATION_TYPE_ICON,g as ActionHandler,a as CONCENTRATION_ICON,l as CONDITION,t as CORE_MODULE,y as DEFAULTS,o as GROUP,e as MODULE,m as MagicItemActionHandlerExtender,r as PREPARED_ICON,d as PROFICIENCY_LEVEL_ICON,c as RARITY,s as REQUIRED_CORE_MODULE_VERSION,p as RITUAL_ICON,f as RollHandler,RollHandlerObsidian,v as SystemManager,h as Utils,u as WEAPON_PROPERTY,register};